net: remove noblock parameter from recvmsg() entities
The internal recvmsg() functions have two parameters 'flags' and 'noblock'
that were merged inside skb_recv_datagram(). As a follow up patch to commit
f4b41f062c ("net: remove noblock parameter from skb_recv_datagram()")
this patch removes the separate 'noblock' parameter for recvmsg().
Analogue to the referenced patch for skb_recv_datagram() the 'flags' and
'noblock' parameters are unnecessarily split up with e.g.
err = sk->sk_prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT,
flags & ~MSG_DONTWAIT, &addr_len);
or in
err = INDIRECT_CALL_2(sk->sk_prot->recvmsg, tcp_recvmsg, udp_recvmsg,
sk, msg, size, flags & MSG_DONTWAIT,
flags & ~MSG_DONTWAIT, &addr_len);
instead of simply using only flags all the time and check for MSG_DONTWAIT
where needed (to preserve for the formerly separated no(n)block condition).
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20220411124955.154876-1-socketcan@hartkopp.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
f015980900
commit
ec095263a9
@@ -2084,7 +2084,7 @@ static int sctp_skb_pull(struct sk_buff *skb, int len)
|
||||
* 5 for complete description of the flags.
|
||||
*/
|
||||
static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
|
||||
int noblock, int flags, int *addr_len)
|
||||
int flags, int *addr_len)
|
||||
{
|
||||
struct sctp_ulpevent *event = NULL;
|
||||
struct sctp_sock *sp = sctp_sk(sk);
|
||||
@@ -2093,9 +2093,8 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
|
||||
int err = 0;
|
||||
int skb_len;
|
||||
|
||||
pr_debug("%s: sk:%p, msghdr:%p, len:%zd, noblock:%d, flags:0x%x, "
|
||||
"addr_len:%p)\n", __func__, sk, msg, len, noblock, flags,
|
||||
addr_len);
|
||||
pr_debug("%s: sk:%p, msghdr:%p, len:%zd, flags:0x%x, addr_len:%p)\n",
|
||||
__func__, sk, msg, len, flags, addr_len);
|
||||
|
||||
lock_sock(sk);
|
||||
|
||||
@@ -2105,7 +2104,7 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
|
||||
goto out;
|
||||
}
|
||||
|
||||
skb = sctp_skb_recv_datagram(sk, flags, noblock, &err);
|
||||
skb = sctp_skb_recv_datagram(sk, flags, &err);
|
||||
if (!skb)
|
||||
goto out;
|
||||
|
||||
@@ -8978,14 +8977,13 @@ out:
|
||||
* Note: This is pretty much the same routine as in core/datagram.c
|
||||
* with a few changes to make lksctp work.
|
||||
*/
|
||||
struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
|
||||
int noblock, int *err)
|
||||
struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, int *err)
|
||||
{
|
||||
int error;
|
||||
struct sk_buff *skb;
|
||||
long timeo;
|
||||
|
||||
timeo = sock_rcvtimeo(sk, noblock);
|
||||
timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
|
||||
|
||||
pr_debug("%s: timeo:%ld, max:%ld\n", __func__, timeo,
|
||||
MAX_SCHEDULE_TIMEOUT);
|
||||
@@ -9018,7 +9016,7 @@ struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
|
||||
break;
|
||||
|
||||
if (sk_can_busy_loop(sk)) {
|
||||
sk_busy_loop(sk, noblock);
|
||||
sk_busy_loop(sk, flags & MSG_DONTWAIT);
|
||||
|
||||
if (!skb_queue_empty_lockless(&sk->sk_receive_queue))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user