Commit fbf33a28 authored by Kretschmer, Mathias's avatar Kretschmer, Mathias Committed by David S. Miller

af_packet / TX_RING not fully non-blocking (w/ MSG_DONTWAIT).

This patch fixes an issue where the send(MSG_DONTWAIT) call
on a TX_RING is not fully non-blocking in cases where the device's sndBuf is
full. We pass nonblock=true to sock_alloc_send_skb() and return any possibly
occuring error code (most likely EGAIN) to the caller. As the fast-path stays
as it is, we keep the unlikely() around skb == NULL.
Signed-off-by: default avatarMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd9c3997
...@@ -2311,11 +2311,14 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) ...@@ -2311,11 +2311,14 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
tlen = dev->needed_tailroom; tlen = dev->needed_tailroom;
skb = sock_alloc_send_skb(&po->sk, skb = sock_alloc_send_skb(&po->sk,
hlen + tlen + sizeof(struct sockaddr_ll), hlen + tlen + sizeof(struct sockaddr_ll),
0, &err); !need_wait, &err);
if (unlikely(skb == NULL)) if (unlikely(skb == NULL)) {
/* we assume the socket was initially writeable ... */
if (likely(len_sum > 0))
err = len_sum;
goto out_status; goto out_status;
}
tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto, tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto,
addr, hlen); addr, hlen);
if (tp_len > dev->mtu + dev->hard_header_len) { if (tp_len > dev->mtu + dev->hard_header_len) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment