aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2014-12-20 15:16:25 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-23 23:20:21 -0500
commitceb8d5bf17d366534f32d2f60f41d905a5bc864b (patch)
treecd9085f69e4492ce032fb55eafa09d52a3437ba2 /net
parent6bd373ebbac4b13ecd39ddc37a0dc5ad4c5e4585 (diff)
net: Rearrange loop in net_rx_action
This patch rearranges the loop in net_rx_action to reduce the amount of jumping back and forth when reading the code. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index b85eba9dfd88..c97ae6fec040 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4631,9 +4631,15 @@ static void net_rx_action(struct softirq_action *h)
4631 list_splice_init(&sd->poll_list, &list); 4631 list_splice_init(&sd->poll_list, &list);
4632 local_irq_enable(); 4632 local_irq_enable();
4633 4633
4634 while (!list_empty(&list)) { 4634 for (;;) {
4635 struct napi_struct *n; 4635 struct napi_struct *n;
4636 4636
4637 if (list_empty(&list)) {
4638 if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll))
4639 return;
4640 break;
4641 }
4642
4637 n = list_first_entry(&list, struct napi_struct, poll_list); 4643 n = list_first_entry(&list, struct napi_struct, poll_list);
4638 budget -= napi_poll(n, &repoll); 4644 budget -= napi_poll(n, &repoll);
4639 4645
@@ -4641,15 +4647,13 @@ static void net_rx_action(struct softirq_action *h)
4641 * Allow this to run for 2 jiffies since which will allow 4647 * Allow this to run for 2 jiffies since which will allow
4642 * an average latency of 1.5/HZ. 4648 * an average latency of 1.5/HZ.
4643 */ 4649 */
4644 if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit))) 4650 if (unlikely(budget <= 0 ||
4645 goto softnet_break; 4651 time_after_eq(jiffies, time_limit))) {
4652 sd->time_squeeze++;
4653 break;
4654 }
4646 } 4655 }
4647 4656
4648 if (!sd_has_rps_ipi_waiting(sd) &&
4649 list_empty(&list) &&
4650 list_empty(&repoll))
4651 return;
4652out:
4653 local_irq_disable(); 4657 local_irq_disable();
4654 4658
4655 list_splice_tail_init(&sd->poll_list, &list); 4659 list_splice_tail_init(&sd->poll_list, &list);
@@ -4659,12 +4663,6 @@ out:
4659 __raise_softirq_irqoff(NET_RX_SOFTIRQ); 4663 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
4660 4664
4661 net_rps_action_and_irq_enable(sd); 4665 net_rps_action_and_irq_enable(sd);
4662
4663 return;
4664
4665softnet_break:
4666 sd->time_squeeze++;
4667 goto out;
4668} 4666}
4669 4667
4670struct netdev_adjacent { 4668struct netdev_adjacent {