On 25/01/2023 01.33, Lorenzo Bianconi wrote:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 90f2be194bc5..2cbe9a6ede76 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -47,6 +47,7 @@
#include <uapi/linux/netdevice.h>
#include <uapi/linux/if_bonding.h>
#include <uapi/linux/pkt_cls.h>
+#include <uapi/linux/netdev.h>
#include <linux/hashtable.h>
#include <linux/rbtree.h>
#include <net/net_trackers.h>
@@ -2055,6 +2056,7 @@ struct net_device {
/* Read-mostly cache-line for fast-path access */
unsigned int flags;
+ xdp_features_t xdp_features;
Nice you found a 4 bytes hole to place the u32 xdp_features member in
and in a "Read-mostly cache-line for fast-path access" that is good :-)
(Added my pahole output for reference below)
Acked-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
unsigned long long priv_flags;
const struct net_device_ops *netdev_ops;
const struct xdp_metadata_ops *xdp_metadata_ops;
@@ -2839,6 +2841,7 @@ enum netdev_cmd {
NETDEV_OFFLOAD_XSTATS_DISABLE,
NETDEV_OFFLOAD_XSTATS_REPORT_USED,
NETDEV_OFFLOAD_XSTATS_REPORT_DELTA,
+ NETDEV_XDP_FEAT_CHANGE,
};
const char *netdev_cmd_to_name(enum netdev_cmd cmd);
diff --git a/include/net/xdp.h b/include/net/xdp.h
index 91292aa13bc0..8d1c86914f4c 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -7,6 +7,7 @@
#define __LINUX_NET_XDP_H__
#include <linux/skbuff.h> /* skb_shared_info */
+#include <uapi/linux/netdev.h>
/**
* DOC: XDP RX-queue information
@@ -43,6 +44,8 @@ enum xdp_mem_type {
MEM_TYPE_MAX,
};
+typedef u32 xdp_features_t;
+
/* XDP flags for ndo_xdp_xmit */
#define XDP_XMIT_FLUSH (1U << 0) /* doorbell signal consumer */
#define XDP_XMIT_FLAGS_MASK XDP_XMIT_FLUSH
--Jesper
On 64 bit arch partial output from:
pahole -C net_device net/core/skbuff.o
struct net_device {
char name[16]; /* 0 16 */
struct netdev_name_node * name_node; /* 16 8 */
struct dev_ifalias * ifalias; /* 24 8 */
long unsigned int mem_end; /* 32 8 */
long unsigned int mem_start; /* 40 8 */
long unsigned int base_addr; /* 48 8 */
long unsigned int state; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct list_head dev_list; /* 64 16 */
struct list_head napi_list; /* 80 16 */
struct list_head unreg_list; /* 96 16 */
struct list_head close_list; /* 112 16 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct list_head ptype_all; /* 128 16 */
struct list_head ptype_specific; /* 144 16 */
struct {
struct list_head upper; /* 160 16 */
struct list_head lower; /* 176 16 */
} adj_list; /* 160 32 */
/* --- cacheline 3 boundary (192 bytes) --- */
unsigned int flags; /* 192 4 */
/* XXX 4 bytes hole, try to pack */
long long unsigned int priv_flags; /* 200 8 */
const struct net_device_ops * netdev_ops; /* 208 8 */
const struct xdp_metadata_ops * xdp_metadata_ops; /* 216
8 */
int ifindex; /* 224 4 */
short unsigned int gflags; /* 228 2 */
short unsigned int hard_header_len; /* 230 2 */
unsigned int mtu; /* 232 4 */
short unsigned int needed_headroom; /* 236 2 */
short unsigned int needed_tailroom; /* 238 2 */
netdev_features_t features; /* 240 8 */
netdev_features_t hw_features; /* 248 8 */
/* --- cacheline 4 boundary (256 bytes) --- */
netdev_features_t wanted_features; /* 256 8 */
netdev_features_t vlan_features; /* 264 8 */
netdev_features_t hw_enc_features; /* 272 8 */
netdev_features_t mpls_features; /* 280 8 */
netdev_features_t gso_partial_features; /* 288 8 */
unsigned int min_mtu; /* 296 4 */
unsigned int max_mtu; /* 300 4 */
short unsigned int type; /* 304 2 */
unsigned char min_header_len; /* 306 1 */
unsigned char name_assign_type; /* 307 1 */