netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: replace last open coded skb_orphan_frags with function call
@ 2015-06-08 15:53 Willem de Bruijn
  2015-06-08 15:54 ` Michael S. Tsirkin
  2015-06-08 19:15 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Willem de Bruijn @ 2015-06-08 15:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, mst, Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

Commit 70008aa50e92 ("skbuff: convert to skb_orphan_frags") replaced
open coded tests of SKBTX_DEV_ZEROCOPY and skb_copy_ubufs with calls
to helper function skb_orphan_frags. Apply that to the last remaining
open coded site.

Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 net/core/dev.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 0602e91..6778a99 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1723,15 +1723,8 @@ EXPORT_SYMBOL_GPL(is_skb_forwardable);
 
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 {
-	if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
-		if (skb_copy_ubufs(skb, GFP_ATOMIC)) {
-			atomic_long_inc(&dev->rx_dropped);
-			kfree_skb(skb);
-			return NET_RX_DROP;
-		}
-	}
-
-	if (unlikely(!is_skb_forwardable(dev, skb))) {
+	if (skb_orphan_frags(skb, GFP_ATOMIC) ||
+	    unlikely(!is_skb_forwardable(dev, skb))) {
 		atomic_long_inc(&dev->rx_dropped);
 		kfree_skb(skb);
 		return NET_RX_DROP;
-- 
2.2.0.rc0.207.ga3a616c

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

* Re: [PATCH net-next] net: replace last open coded skb_orphan_frags with function call
  2015-06-08 15:53 [PATCH net-next] net: replace last open coded skb_orphan_frags with function call Willem de Bruijn
@ 2015-06-08 15:54 ` Michael S. Tsirkin
  2015-06-08 19:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-06-08 15:54 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: netdev, davem

On Mon, Jun 08, 2015 at 11:53:08AM -0400, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> Commit 70008aa50e92 ("skbuff: convert to skb_orphan_frags") replaced
> open coded tests of SKBTX_DEV_ZEROCOPY and skb_copy_ubufs with calls
> to helper function skb_orphan_frags. Apply that to the last remaining
> open coded site.
> 
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  net/core/dev.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0602e91..6778a99 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1723,15 +1723,8 @@ EXPORT_SYMBOL_GPL(is_skb_forwardable);
>  
>  int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
>  {
> -	if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
> -		if (skb_copy_ubufs(skb, GFP_ATOMIC)) {
> -			atomic_long_inc(&dev->rx_dropped);
> -			kfree_skb(skb);
> -			return NET_RX_DROP;
> -		}
> -	}
> -
> -	if (unlikely(!is_skb_forwardable(dev, skb))) {
> +	if (skb_orphan_frags(skb, GFP_ATOMIC) ||
> +	    unlikely(!is_skb_forwardable(dev, skb))) {
>  		atomic_long_inc(&dev->rx_dropped);
>  		kfree_skb(skb);
>  		return NET_RX_DROP;
> -- 
> 2.2.0.rc0.207.ga3a616c

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

* Re: [PATCH net-next] net: replace last open coded skb_orphan_frags with function call
  2015-06-08 15:53 [PATCH net-next] net: replace last open coded skb_orphan_frags with function call Willem de Bruijn
  2015-06-08 15:54 ` Michael S. Tsirkin
@ 2015-06-08 19:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-06-08 19:15 UTC (permalink / raw)
  To: willemb; +Cc: netdev, mst

From: Willem de Bruijn <willemb@google.com>
Date: Mon,  8 Jun 2015 11:53:08 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> Commit 70008aa50e92 ("skbuff: convert to skb_orphan_frags") replaced
> open coded tests of SKBTX_DEV_ZEROCOPY and skb_copy_ubufs with calls
> to helper function skb_orphan_frags. Apply that to the last remaining
> open coded site.
> 
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied.

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

end of thread, other threads:[~2015-06-08 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 15:53 [PATCH net-next] net: replace last open coded skb_orphan_frags with function call Willem de Bruijn
2015-06-08 15:54 ` Michael S. Tsirkin
2015-06-08 19:15 ` 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).