netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()
@ 2010-12-07  7:19 Eric Dumazet
  2010-12-07 10:30 ` Eric Dumazet
  2010-12-08 18:38 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-12-07  7:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Avoid some atomic ops on dst refcount, calling dev_queue_xmit_nit()
after skb_dst_drop() in dev_hard_start_xmit().

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
Next patch will perform the sk_run_filter() in dev_queue_xmit_nit(),
before cloning skb and af_packet rcv() call.

 net/core/dev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 55ff66f..59360ef 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2025,9 +2025,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 	int rc = NETDEV_TX_OK;
 
 	if (likely(!skb->next)) {
-		if (!list_empty(&ptype_all))
-			dev_queue_xmit_nit(skb, dev);
-
 		/*
 		 * If device doesnt need skb->dst, release it right now while
 		 * its hot in this cpu cache
@@ -2037,6 +2034,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 
 		skb_orphan_try(skb);
 
+		if (!list_empty(&ptype_all))
+			dev_queue_xmit_nit(skb, dev);
+
 		if (vlan_tx_tag_present(skb) &&
 		    !(dev->features & NETIF_F_HW_VLAN_TX)) {
 			skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));



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

* Re: [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()
  2010-12-07  7:19 [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop() Eric Dumazet
@ 2010-12-07 10:30 ` Eric Dumazet
  2010-12-08 18:38   ` David Miller
  2010-12-08 18:38 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-12-07 10:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Le mardi 07 décembre 2010 à 08:19 +0100, Eric Dumazet a écrit :
> Avoid some atomic ops on dst refcount, calling dev_queue_xmit_nit()
> after skb_dst_drop() in dev_hard_start_xmit().
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> Next patch will perform the sk_run_filter() in dev_queue_xmit_nit(),
> before cloning skb and af_packet rcv() call.
> 
>  net/core/dev.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 55ff66f..59360ef 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2025,9 +2025,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
>  	int rc = NETDEV_TX_OK;
>  
>  	if (likely(!skb->next)) {
> -		if (!list_empty(&ptype_all))
> -			dev_queue_xmit_nit(skb, dev);
> -
>  		/*
>  		 * If device doesnt need skb->dst, release it right now while
>  		 * its hot in this cpu cache
> @@ -2037,6 +2034,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
>  
>  		skb_orphan_try(skb);
>  
> +		if (!list_empty(&ptype_all))
> +			dev_queue_xmit_nit(skb, dev);
> +
>  		if (vlan_tx_tag_present(skb) &&
>  		    !(dev->features & NETIF_F_HW_VLAN_TX)) {
>  			skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
> 

Hmm, this was wrong, and not what I wanted to do :

in dev_queue_xmit_nit() do following tests :

        /* Never send packets back to the socket
         * they originated from - MvS (miquels@drinkel.ow.org)
         */
        if ((ptype->dev == dev || !ptype->dev) &&
            (ptype->af_packet_priv == NULL ||
             (struct sock *)ptype->af_packet_priv != skb->sk)) {
                struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);

So we should not move dev_queue_xmit_nit() after
skb_orphan_try(skb) or the (ptype->af_packet_priv != skb->sk) test 
is always true.

Here is V2 of patch :

[PATCH v2 net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()

Avoid some atomic ops on dst refcount, calling dev_queue_xmit_nit()
after skb_dst_drop() in dev_hard_start_xmit().

When queueing a packet into af_packet socket, we drop dst anyway.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/core/dev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 55ff66f..58930e4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2025,9 +2025,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 	int rc = NETDEV_TX_OK;
 
 	if (likely(!skb->next)) {
-		if (!list_empty(&ptype_all))
-			dev_queue_xmit_nit(skb, dev);
-
 		/*
 		 * If device doesnt need skb->dst, release it right now while
 		 * its hot in this cpu cache
@@ -2035,6 +2032,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 		if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
 			skb_dst_drop(skb);
 
+		if (!list_empty(&ptype_all))
+			dev_queue_xmit_nit(skb, dev);
+
 		skb_orphan_try(skb);
 
 		if (vlan_tx_tag_present(skb) &&



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

* Re: [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()
  2010-12-07  7:19 [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop() Eric Dumazet
  2010-12-07 10:30 ` Eric Dumazet
@ 2010-12-08 18:38 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-08 18:38 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Dec 2010 08:19:19 +0100

> Avoid some atomic ops on dst refcount, calling dev_queue_xmit_nit()
> after skb_dst_drop() in dev_hard_start_xmit().
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thank you.

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

* Re: [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()
  2010-12-07 10:30 ` Eric Dumazet
@ 2010-12-08 18:38   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-08 18:38 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Dec 2010 11:30:37 +0100

> Here is V2 of patch :
> 
> [PATCH v2 net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop()

Ahh, ok, I just noticed this.

I will make sure to apply this version instead.

Thanks!

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

end of thread, other threads:[~2010-12-08 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07  7:19 [PATCH net-next-2.6] net: call dev_queue_xmit_nit() after skb_dst_drop() Eric Dumazet
2010-12-07 10:30 ` Eric Dumazet
2010-12-08 18:38   ` David Miller
2010-12-08 18:38 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).