All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net-next V1] net: followup adjust net_device layout for cacheline usage
Date: Fri, 12 Feb 2021 14:50:26 +0100	[thread overview]
Message-ID: <161313782625.1008639.6000589679659428869.stgit@firesoul> (raw)

As Eric pointed out in response to commit 28af22c6c8df ("net: adjust
net_device layout for cacheline usage") the netdev_features_t members
wanted_features and hw_features are only used in control path.

Thus, this patch reorder the netdev_features_t to let more members that
are used in fast path into the 3rd cacheline. Whether these members are
read depend on SKB properties, which are hinted as comments. The member
mpls_features could not fit in the cacheline, but it was the least
commonly used (depend on CONFIG_NET_MPLS_GSO).

In the future we should consider relocating member gso_partial_features
to be closer to member gso_max_segs. (see usage in gso_features_check()).

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 include/linux/netdevice.h |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index bfadf3b82f9c..3898bb167579 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1890,13 +1890,16 @@ struct net_device {
 	unsigned short		needed_headroom;
 	unsigned short		needed_tailroom;
 
+	/* Fast path features - via netif_skb_features */
 	netdev_features_t	features;
+	netdev_features_t	vlan_features;       /* if skb_vlan_tagged */
+	netdev_features_t	hw_enc_features;     /* if skb->encapsulation */
+	netdev_features_t	gso_partial_features;/* if skb_is_gso */
+	netdev_features_t	mpls_features; /* if eth_p_mpls+NET_MPLS_GSO */
+
+	/* Control path features */
 	netdev_features_t	hw_features;
 	netdev_features_t	wanted_features;
-	netdev_features_t	vlan_features;
-	netdev_features_t	hw_enc_features;
-	netdev_features_t	mpls_features;
-	netdev_features_t	gso_partial_features;
 
 	unsigned int		min_mtu;
 	unsigned int		max_mtu;



             reply	other threads:[~2021-02-12 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 13:50 Jesper Dangaard Brouer [this message]
2021-02-12 17:03 ` [PATCH net-next V1] net: followup adjust net_device layout for cacheline usage Eric Dumazet
2021-02-15  9:01   ` Jesper Dangaard Brouer

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=161313782625.1008639.6000589679659428869.stgit@firesoul \
    --to=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.