Skip to contentSkip to conversation

netpoll: send arp reply on master device immediately

PATCH In review [email protected] 3 participants 4 messages Mar 17, 2014 – Mar 18, 2014

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

PATCH 1/1 netpoll: send arp reply on master device immediately

From: Li RongQing <[email protected]>

1. the arp queue has been moved from slave device to master, so the master device netpoll_info should be as input of service_arp_queue()
2. not need to check if ni is NULL or not, since it has been used before.

Cc WANG Cong <[email protected]>
Cc Neil Horman <[email protected]>
---
 net/core/netpoll.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
net/core/netpoll.c +12 -14
index a664f78..dd0a796 100644
@@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
 	up(&ni->dev_lock);
 
 	if (dev->flags & IFF_SLAVE) {
-		if (ni) {
-			struct net_device *bond_dev;
-			struct sk_buff *skb;
-			struct netpoll_info *bond_ni;
-
-			bond_dev = netdev_master_upper_dev_get_rcu(dev);
-			bond_ni = rcu_dereference_bh(bond_dev->npinfo);
-			while ((skb = skb_dequeue(&ni->neigh_tx))) {
-				skb->dev = bond_dev;
-				skb_queue_tail(&bond_ni->neigh_tx, skb);
-			}
-		}
-	}
+		struct net_device *bond_dev;
+		struct sk_buff *skb;
+		struct netpoll_info *bond_ni;
 
-	service_neigh_queue(ni);
+		bond_dev = netdev_master_upper_dev_get_rcu(dev);
+		bond_ni = rcu_dereference_bh(bond_dev->npinfo);
+		while ((skb = skb_dequeue(&ni->neigh_tx))) {
+			skb->dev = bond_dev;
+			skb_queue_tail(&bond_ni->neigh_tx, skb);
+		}
+		service_neigh_queue(bond_ni);
+	} else
+		service_neigh_queue(ni);
 
 	zap_completion_queue();
 }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 35 lines · On Mon, Mar 17, 2014 at 03:41:46PM +0800, [email protected] wrote:

From: Li RongQing <[email protected]>

1. the arp queue has been moved from slave device to master, so the master device netpoll_info should be as input of service_arp_queue()
2. not need to check if ni is NULL or not, since it has been used before.

Cc WANG Cong <[email protected]>
Cc Neil Horman <[email protected]>
---
 net/core/netpoll.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
net/core/netpoll.c +1 -13
index a664f78..dd0a796 100644
@@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
 	up(&ni->dev_lock);
 
 	if (dev->flags & IFF_SLAVE) {
-		if (ni) {
-			struct net_device *bond_dev;
-			struct sk_buff *skb;
-			struct netpoll_info *bond_ni;
-
-			bond_dev = netdev_master_upper_dev_get_rcu(dev);
-			bond_ni = rcu_dereference_bh(bond_dev->npinfo);
-			while ((skb = skb_dequeue(&ni->neigh_tx))) {
-				skb->dev = bond_dev;
-				skb_queue_tail(&bond_ni->neigh_tx, skb);
-			}
-		}
-	}
+		struct net_device *bond_dev;

net/core/netpoll.c static void netpoll_poll_dev(struct net_device *dev) · line 241

Quoted 10 lines
net/core/netpoll.c +8 -1
+		struct sk_buff *skb;
+		struct netpoll_info *bond_ni;
 
-	service_neigh_queue(ni);
+		bond_dev = netdev_master_upper_dev_get_rcu(dev);
+		bond_ni = rcu_dereference_bh(bond_dev->npinfo);
+		while ((skb = skb_dequeue(&ni->neigh_tx))) {
+			skb->dev = bond_dev;
+			skb_queue_tail(&bond_ni->neigh_tx, skb);
+		}

Here, instead of calling service_neigh_queue in two separate places, just set ni = bond_ni if you fall into the if conditional. Then you can get rid of the else clause and have a single call site for service_neigh_queue

Other than that, looks good.

Neil

Quoted 10 lines
net/core/netpoll.c +3 -0
+		service_neigh_queue(bond_ni);
+	} else
+		service_neigh_queue(ni);
 
 	zap_completion_queue();
 }
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to [email protected]

Hello.

Quoted 21 lines · On 17-03-2014 11:41, [email protected] wrote:

From: Li RongQing <[email protected]>

1. the arp queue has been moved from slave device to master, so the master device netpoll_info should be as input of service_arp_queue()
2. not need to check if ni is NULL or not, since it has been used before.

Cc WANG Cong <[email protected]>
Cc Neil Horman <[email protected]>
---
  net/core/netpoll.c |   26 ++++++++++++--------------
  1 file changed, 12 insertions(+), 14 deletions(-)
net/core/netpoll.c +0 -0
index a664f78..dd0a796 100644
@@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
  	up(&ni->dev_lock);
 
  	if (dev->flags & IFF_SLAVE) {

[...]

Quoted 4 lines
net/core/netpoll.c +3 -0
+		struct net_device *bond_dev;
+		struct sk_buff *skb;
+		struct netpoll_info *bond_ni;
 

net/core/netpoll.c static void netpoll_poll_dev(struct net_device *dev) · line 244

Quoted 10 lines
net/core/netpoll.c +9 -1
-	service_neigh_queue(ni);
+		bond_dev = netdev_master_upper_dev_get_rcu(dev);
+		bond_ni = rcu_dereference_bh(bond_dev->npinfo);
+		while ((skb = skb_dequeue(&ni->neigh_tx))) {
+			skb->dev = bond_dev;
+			skb_queue_tail(&bond_ni->neigh_tx, skb);
+		}
+		service_neigh_queue(bond_ni);
+	} else
+		service_neigh_queue(ni);

The *else* branch should also have {}, according to
Documentation/CodingStyle.

WBR, Sergei

#3 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 53 lines · Sergei Shtylyov

Hello.

Quoted 24 lines · On 17-03-2014 11:41, [email protected] wrote:

From: Li RongQing <[email protected]>

1. the arp queue has been moved from slave device to master, so the master device netpoll_info should be as input of service_arp_queue()
2. not need to check if ni is NULL or not, since it has been used before.

Cc WANG Cong <[email protected]>
Cc Neil Horman <[email protected]>
---
  net/core/netpoll.c |   26 ++++++++++++--------------
  1 file changed, 12 insertions(+), 14 deletions(-)
net/core/netpoll.c +0 -0
index a664f78..dd0a796 100644
@@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
        up(&ni->dev_lock);
 
        if (dev->flags & IFF_SLAVE) {

[...]

Quoted 4 lines
net/core/netpoll.c +3 -0
+               struct net_device *bond_dev;
+               struct sk_buff *skb;
+               struct netpoll_info *bond_ni;
 

net/core/netpoll.c static void netpoll_poll_dev(struct net_device *dev) · line 244

Quoted 10 lines
net/core/netpoll.c +9 -1
-       service_neigh_queue(ni);
+               bond_dev = netdev_master_upper_dev_get_rcu(dev);
+               bond_ni = rcu_dereference_bh(bond_dev->npinfo);
+               while ((skb = skb_dequeue(&ni->neigh_tx))) {
+                       skb->dev = bond_dev;
+                       skb_queue_tail(&bond_ni->neigh_tx, skb);
+               }
+               service_neigh_queue(bond_ni);
+       } else
+               service_neigh_queue(ni);

The *else* branch should also have {}, according to
Documentation/CodingStyle.

WBR, Sergei