Skip to contentSkip to conversation

netpoll: slight optimization for netpoll_neigh_reply

PATCH In review [email protected] 1 participant 2 messages Mar 17, 2014 – Mar 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netpoll: slight optimization for netpoll_neigh_reply

From: Li RongQing <[email protected]>

'hits' is used to check If there is a device who is interested in this skb, not care the device number, so stop the loop once a device is found

---
 net/core/netpoll.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/netpoll.c +3 -1
index dd0a796..9a276e6 100644
@@ -545,8 +545,10 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo
 	   inspection whether this is interesting at all */
 	spin_lock_irqsave(&npinfo->rx_lock, flags);
 	list_for_each_entry_safe(np, tmp, &npinfo->rx_np, rx) {
-		if (np->dev == skb->dev)
+		if (np->dev == skb->dev) {
 			hits++;
+			break;
+		}
 	}
 	spin_unlock_irqrestore(&npinfo->rx_lock, flags);
 
Signature · 1 line
1.7.10.4
#1 lore raw

this patch can be dropped since other patch has been merged into net-next[netpoll: Remove dead packet receive code (CONFIG_NETPOLL_TRAP)]

Quoted 30 lines · On Mon, Mar 17, 2014 at 3:09 PM, <[email protected]> wrote:

From: Li RongQing <[email protected]>

'hits' is used to check If there is a device who is interested in this skb, not care the device number, so stop the loop once a device is found

---
 net/core/netpoll.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/netpoll.c +3 -2
index dd0a796..9a276e6 100644
@@ -545,8 +545,10 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo
           inspection whether this is interesting at all */
        spin_lock_irqsave(&npinfo->rx_lock, flags);
        list_for_each_entry_safe(np, tmp, &npinfo->rx_np, rx) {
-               if (np->dev == skb->dev)
+               if (np->dev == skb->dev) {
                        hits++;
+                       break;
+               }
        }
        spin_unlock_irqrestore(&npinfo->rx_lock, flags);
 
--

1.7.10.4