lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <161313782625.1008639.6000589679659428869.stgit@firesoul>
Date:   Fri, 12 Feb 2021 14:50:26 +0100
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     David Ahern <dsahern@...il.com>, netdev@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>
Cc:     Jesper Dangaard Brouer <brouer@...hat.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: [PATCH net-next V1] net: followup adjust net_device layout for
 cacheline usage

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@...gle.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.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;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ