aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 85bb38cb56fd..d5495d87f399 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2156,6 +2156,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2156 int err, reserve = 0; 2156 int err, reserve = 0;
2157 void *ph; 2157 void *ph;
2158 struct sockaddr_ll *saddr = (struct sockaddr_ll *)msg->msg_name; 2158 struct sockaddr_ll *saddr = (struct sockaddr_ll *)msg->msg_name;
2159 bool need_wait = !(msg->msg_flags & MSG_DONTWAIT);
2159 int tp_len, size_max; 2160 int tp_len, size_max;
2160 unsigned char *addr; 2161 unsigned char *addr;
2161 int len_sum = 0; 2162 int len_sum = 0;
@@ -2198,10 +2199,10 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2198 2199
2199 do { 2200 do {
2200 ph = packet_current_frame(po, &po->tx_ring, 2201 ph = packet_current_frame(po, &po->tx_ring,
2201 TP_STATUS_SEND_REQUEST); 2202 TP_STATUS_SEND_REQUEST);
2202
2203 if (unlikely(ph == NULL)) { 2203 if (unlikely(ph == NULL)) {
2204 schedule(); 2204 if (need_wait && need_resched())
2205 schedule();
2205 continue; 2206 continue;
2206 } 2207 }
2207 2208
@@ -2255,10 +2256,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2255 } 2256 }
2256 packet_increment_head(&po->tx_ring); 2257 packet_increment_head(&po->tx_ring);
2257 len_sum += tp_len; 2258 len_sum += tp_len;
2258 } while (likely((ph != NULL) || 2259 } while (likely((ph != NULL) || (need_wait &&
2259 ((!(msg->msg_flags & MSG_DONTWAIT)) && 2260 atomic_read(&po->tx_ring.pending))));
2260 (atomic_read(&po->tx_ring.pending))))
2261 );
2262 2261
2263 err = len_sum; 2262 err = len_sum;
2264 goto out_put; 2263 goto out_put;