All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Vadai <amirv@mellanox.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>, <netdev@vger.kernel.org>,
	"Yevgeny Petrilin" <yevgenyp@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	"Ido Shamay" <idos@mellanox.com>
Subject: Re: [PATCH net-next] net: introduce netdevice gso_min_segs attribute
Date: Mon, 6 Oct 2014 09:41:31 +0300	[thread overview]
Message-ID: <5432399B.3060406@mellanox.com> (raw)
In-Reply-To: <1412529087.11091.14.camel@edumazet-glaptop2.roam.corp.google.com>

On 10/5/2014 8:11 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> Some TSO engines might have a too heavy setup cost, that impacts
> performance on hosts sending small bursts (2 MSS per packet).
> 
> This patch adds a device gso_min_segs, allowing drivers to set
> a minimum segment size for TSO packets, according to the NIC
> performance.
> 
> Tested on a mlx4 NIC, this allows to get a ~110% increase of
> throughput when sending 2 MSS per packet.
> 

Amazing!

Shouldn't there be a netif_set_gso_min_size() too?

> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> mlx4 patch will be sent later, its a one liner.
> 
>  include/linux/netdevice.h |    4 +++-
>  net/core/dev.c            |    9 ++++++---
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 22d54b9b700d..2df86f50261c 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1416,6 +1416,8 @@ enum netdev_priv_flags {
>   *	@gso_max_size:	Maximum size of generic segmentation offload
>   *	@gso_max_segs:	Maximum number of segments that can be passed to the
>   *			NIC for GSO
> + *	@gso_min_segs:	Minimum number of segments that can be passed to the
> + *			NIC for GSO
>   *
>   *	@dcbnl_ops:	Data Center Bridging netlink ops
>   *	@num_tc:	Number of traffic classes in the net device
> @@ -1666,7 +1668,7 @@ struct net_device {
>  	unsigned int		gso_max_size;
>  #define GSO_MAX_SEGS		65535
>  	u16			gso_max_segs;
> -
> +	u16			gso_min_segs;
>  #ifdef CONFIG_DCB
>  	const struct dcbnl_rtnl_ops *dcbnl_ops;
>  #endif
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 1a90530f83ff..16e8ebbd3316 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2567,10 +2567,12 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
>  
>  netdev_features_t netif_skb_features(struct sk_buff *skb)
>  {
> +	const struct net_device *dev = skb->dev;
> +	netdev_features_t features = dev->features;
> +	u16 gso_segs = skb_shinfo(skb)->gso_segs;
>  	__be16 protocol = skb->protocol;
> -	netdev_features_t features = skb->dev->features;
>  
> -	if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)
> +	if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
>  		features &= ~NETIF_F_GSO_MASK;
>  
>  	if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
> @@ -2581,7 +2583,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
>  	}
>  
>  	features = netdev_intersect_features(features,
> -					     skb->dev->vlan_features |
> +					     dev->vlan_features |
>  					     NETIF_F_HW_VLAN_CTAG_TX |
>  					     NETIF_F_HW_VLAN_STAG_TX);
>  
> @@ -6658,6 +6660,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
>  
>  	dev->gso_max_size = GSO_MAX_SIZE;
>  	dev->gso_max_segs = GSO_MAX_SEGS;
> +	dev->gso_min_segs = 0;
>  
>  	INIT_LIST_HEAD(&dev->napi_list);
>  	INIT_LIST_HEAD(&dev->unreg_list);
> 
> 

  parent reply	other threads:[~2014-10-06  6:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05  9:35 [PATCH net-next 00/14] net/mlx4_en: Optimizations to TX flow Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 01/14] net/mlx4_en: Code cleanups in tx path Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 02/14] net/mlx4_en: Align tx path structures to cache lines Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 03/14] net/mlx4_en: Avoid calling bswap in tx fast path Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 04/14] net/mlx4_en: tx_info allocated with kmalloc() instead of vmalloc() Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 05/14] net/mlx4_en: Avoid a cache line miss in TX completion for single frag skb's Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 06/14] net/mlx4_en: Use prefetch in tx path Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 07/14] net/mlx4_en: Avoid false sharing in mlx4_en_en_process_tx_cq() Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 08/14] net/mlx4_en: mlx4_en_xmit() reads ring->cons once, and ahead of time to avoid stalls Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 09/14] net/mlx4_en: Use local var in tx flow for skb_shinfo(skb) Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 10/14] net/mlx4_en: Use local var for skb_headlen(skb) Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 11/14] net/mlx4_en: tx_info->ts_requested was not cleared Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 12/14] net/mlx4_en: Enable the compiler to make is_inline() inlined Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 13/14] ethtool: Ethtool parameter to dynamically change tx_copybreak Amir Vadai
2014-10-05  9:35 ` [PATCH net-next 14/14] net/mlx4_en: Use the new tx_copybreak to set inline threshold Amir Vadai
2014-10-05 13:03   ` Sergei Shtylyov
2014-10-05 11:45 ` [PATCH net-next 00/14] net/mlx4_en: Optimizations to TX flow Amir Vadai
2014-10-05 15:50   ` Eric Dumazet
2014-10-05 17:11     ` [PATCH net-next] net: introduce netdevice gso_min_segs attribute Eric Dumazet
2014-10-05 18:45       ` Tom Herbert
2014-10-05 18:58         ` Eric Dumazet
2014-10-06  6:41       ` Amir Vadai [this message]
2014-10-06 12:17         ` Eric Dumazet
2014-10-06 12:22           ` Eric Dumazet
2014-10-06 10:20       ` David Laight
2014-10-06 12:14         ` Eric Dumazet
2014-10-06 21:21       ` David Miller
2014-10-06 21:42         ` Eric Dumazet
2014-10-06 21:54           ` David Miller
2014-10-06 22:26             ` Eric Dumazet
2014-10-06  5:04 ` [PATCH net-next 00/14] net/mlx4_en: Optimizations to TX flow David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5432399B.3060406@mellanox.com \
    --to=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=idos@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=yevgenyp@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.