Re: [PATCHv2] net: Define enum for the bits used in features.
From: Michał Mirosław <hidden>
Date: 2011-05-25 09:44:11
2011/5/25 Mahesh Bandewar [off-list ref]:
quoted hunk ↗ jump to hunk
Little bit cleanup by defining enum for all bits used. Also use those enum values to redefine flags. Signed-off-by: Mahesh Bandewar <redacted> --- Changes since v1: Split the patch into two pieces. include/linux/netdevice.h | 100 +++++++++++++++++++++++++++++++------------- 1 files changed, 70 insertions(+), 30 deletions(-)diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ca333e7..b4520b2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h@@ -51,6 +51,7 @@#ifdef CONFIG_DCB #include <net/dcbnl.h> #endif +#include <linux/netdev_features.h>
This should go to other part.
quoted hunk ↗ jump to hunk
struct vlan_group; struct netpoll_info;@@ -981,6 +982,49 @@ struct net_device_ops {}; /* + * Net device feature bits; if you change something, + * also update netdev_features_strings[] in ethtool.c + */ +enum netdev_features {
[...]
+ RESERVED16_BIT, /* the GSO_MASK reserved bit 16 */ + RESERVED17_BIT, /* the GSO_MASK reserved bit 17 */ + RESERVED18_BIT, /* the GSO_MASK reserved bit 18 */ + RESERVED19_BIT, /* the GSO_MASK reserved bit 19 */ + RESERVED20_BIT, /* the GSO_MASK reserved bit 20 */ + RESERVED21_BIT, /* the GSO_MASK reserved bit 21 */ + RESERVED22_BIT, /* the GSO_MASK reserved bit 22 */ + RESERVED23_BIT, /* the GSO_MASK reserved bit 23 */
This could also define NETIF_F_GSO_SHIFT and name TSO and others. Maybe like this: NETIF_F_GSO_SHIFT, /* must == 16, for now */ GSO_RESERVED0_BIT = NETIF_F_GSO_SHIFT, GSO_RESERVED1_BIT, ... GSO_RESERVED7_BIT, ... (other bits)
+ /* Add you bit above this */
your.
+ ND_FEATURE_NUM_BITS, /* (LAST VALUE) Total bits in use */
And here GSO aliases: TSO_BIT = NETIF_F_GSO_SHIFT + SKB_GSO_TCPV4, UFO_BIT = NETIF_F_GSO_SHIFT + SKB_GSO_UDP, ... Afther this is done, I can convert the feature-names table in ethtool.c to use C99 array assignments, so that no one else will trip on a missing comma or wrong entries order there. About the bit names: NETIF_F_xxx_BIT? Best Regards, Michał Mirosław