On Mon, Mar 06, 2023 at 11:26:10AM +0100, Lorenzo Bianconi wrote: > Implement XDP_FEATURES_GET request to get network device information > about supported xdp functionalities through ethtool. > > Tested-by: Matteo Croce <teknoraver@xxxxxxxx> > Co-developed-by: Marek Majtyka <alardam@xxxxxxxxx> > Signed-off-by: Marek Majtyka <alardam@xxxxxxxxx> > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> ... > @@ -1429,6 +1431,18 @@ struct ethtool_sfeatures { > struct ethtool_set_features_block features[]; > }; > > +/** > + * struct ethtool_xdp_gfeatures - command to get supported XDP features > + * @cmd: command number = %ETHTOOL_XDP_GFEATURES > + * size: array size of the features[] array nit: 'size' -> '@size' > + * @features: XDP feature masks > + */ > +struct ethtool_xdp_gfeatures { > + __u32 cmd; > + __u32 size; > + __u32 features[]; > +}; > + > /** > * struct ethtool_ts_info - holds a device's timestamping and PHC association > * @cmd: command number = %ETHTOOL_GET_TS_INFO ... > diff --git a/net/ethtool/common.c b/net/ethtool/common.c > index 5fb19050991e..2be672c601ad 100644 > --- a/net/ethtool/common.c > +++ b/net/ethtool/common.c > @@ -465,6 +465,17 @@ const char udp_tunnel_type_names[][ETH_GSTRING_LEN] = { > static_assert(ARRAY_SIZE(udp_tunnel_type_names) == > __ETHTOOL_UDP_TUNNEL_TYPE_CNT); > > +const char xdp_features_strings[][ETH_GSTRING_LEN] = { > + [NETDEV_XDP_ACT_BIT_BASIC_BIT] = "xdp-basic", > + [NETDEV_XDP_ACT_BIT_REDIRECT_BIT] = "xdp-redirect", > + [NETDEV_XDP_ACT_BIT_NDO_XMIT_BIT] = "xdp-ndo-xmit", > + [NETDEV_XDP_ACT_BIT_XSK_ZEROCOPY_BIT] = "xdp-xsk-zerocopy", > + [NETDEV_XDP_ACT_BIT_HW_OFFLOAD_BIT] = "xdp-hw-offload", > + [NETDEV_XDP_ACT_BIT_RX_SG_BIT] = "xdp-rx-sg", > + [NETDEV_XDP_ACT_BIT_NDO_XMIT_SG_BIT] = "xdp-ndo-xmit-sg", > +}; nit: blank line here > +static_assert(ARRAY_SIZE(xdp_features_strings) == __NETDEV_XDP_ACT_BIT_MAX); > + > /* return false if legacy contained non-0 deprecated fields > * maxtxpkt/maxrxpkt. rest of ksettings always updated > */ ...