All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netpoll: send arp reply on master device immediately
@ 2014-03-17  7:41 roy.qing.li
  2014-03-17 11:11 ` Neil Horman
  2014-03-17 12:41 ` Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: roy.qing.li @ 2014-03-17  7:41 UTC (permalink / raw)
  To: netdev; +Cc: amwang, nhorman

From: Li RongQing <roy.qing.li@gmail.com>

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.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Cc: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
---
 net/core/netpoll.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a664f78..dd0a796 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -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();
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] netpoll: send arp reply on master device immediately
  2014-03-17  7:41 [PATCH] netpoll: send arp reply on master device immediately roy.qing.li
@ 2014-03-17 11:11 ` Neil Horman
  2014-03-17 12:41 ` Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: Neil Horman @ 2014-03-17 11:11 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev, amwang

On Mon, Mar 17, 2014 at 03:41:46PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> 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.
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> Cc: WANG Cong <amwang@redhat.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> ---
>  net/core/netpoll.c |   26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index a664f78..dd0a796 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -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);
> +		}

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

> +		service_neigh_queue(bond_ni);
> +	} else
> +		service_neigh_queue(ni);
>  
>  	zap_completion_queue();
>  }
> -- 
> 1.7.10.4
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netpoll: send arp reply on master device immediately
  2014-03-17  7:41 [PATCH] netpoll: send arp reply on master device immediately roy.qing.li
  2014-03-17 11:11 ` Neil Horman
@ 2014-03-17 12:41 ` Sergei Shtylyov
  2014-03-18  0:04   ` Li RongQing
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2014-03-17 12:41 UTC (permalink / raw)
  To: roy.qing.li, netdev; +Cc: amwang, nhorman

Hello.

On 17-03-2014 11:41, roy.qing.li@gmail.com wrote:

> From: Li RongQing <roy.qing.li@gmail.com>

> 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.

> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> Cc: WANG Cong <amwang@redhat.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> ---
>   net/core/netpoll.c |   26 ++++++++++++--------------
>   1 file changed, 12 insertions(+), 14 deletions(-)

> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index a664f78..dd0a796 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
>   	up(&ni->dev_lock);
>
>   	if (dev->flags & IFF_SLAVE) {
[...]
> +		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);

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

WBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netpoll: send arp reply on master device immediately
  2014-03-17 12:41 ` Sergei Shtylyov
@ 2014-03-18  0:04   ` Li RongQing
  0 siblings, 0 replies; 4+ messages in thread
From: Li RongQing @ 2014-03-18  0:04 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, Cong Wang, nhorman

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

On Mon, Mar 17, 2014 at 8:41 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 17-03-2014 11:41, roy.qing.li@gmail.com wrote:
>
>> From: Li RongQing <roy.qing.li@gmail.com>
>
>
>> 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.
>
>
>> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
>> Cc: WANG Cong <amwang@redhat.com>
>> Cc: Neil Horman <nhorman@tuxdriver.com>
>> ---
>>   net/core/netpoll.c |   26 ++++++++++++--------------
>>   1 file changed, 12 insertions(+), 14 deletions(-)
>
>
>> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
>> index a664f78..dd0a796 100644
>> --- a/net/core/netpoll.c
>> +++ b/net/core/netpoll.c
>> @@ -229,21 +229,19 @@ static void netpoll_poll_dev(struct net_device *dev)
>>         up(&ni->dev_lock);
>>
>>         if (dev->flags & IFF_SLAVE) {
>
> [...]
>
>> +               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);
>
>
>     The *else* branch should also have {}, according to
> Documentation/CodingStyle.
>
> WBR, Sergei
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-18  0:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17  7:41 [PATCH] netpoll: send arp reply on master device immediately roy.qing.li
2014-03-17 11:11 ` Neil Horman
2014-03-17 12:41 ` Sergei Shtylyov
2014-03-18  0:04   ` Li RongQing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.