Skip to contentSkip to conversation

cleanup of the NETIF_F_* flag definitions

PATCH In review Peter Zijlstra 3 participants 3 messages Aug 12, 2006 – Aug 13, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup of the NETIF_F_* flag definitions

Cleanup the NETIF_F_ flag definitions

---
 include/linux/netdevice.h |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
include/linux/netdevice.h +14 -12
Index: linux-2.6/include/linux/netdevice.h
===================================================================
@@ -298,18 +298,20 @@ struct net_device
 
 	/* Net device features */
 	unsigned long		features;
-#define NETIF_F_SG		1	/* Scatter/gather IO. */
-#define NETIF_F_IP_CSUM		2	/* Can checksum only TCP/UDP over IPv4. */
-#define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
-#define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
-#define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
-#define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
-#define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
-#define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
-#define NETIF_F_GSO		2048	/* Enable software GSO. */
-#define NETIF_F_LLTX		4096	/* LockLess TX */
+#define NETIF_F_SG		0x0001	/* Scatter/gather IO. */
+#define NETIF_F_IP_CSUM		0x0002	/* Can checksum only TCP/UDP over IPv4. */
+#define NETIF_F_NO_CSUM		0x0004	/* Does not require checksum. F.e. loopack. */
+#define NETIF_F_HW_CSUM		0x0008	/* Can checksum all the packets. */
+
+#define NETIF_F_HIGHDMA		0x0010	/* Can DMA to high memory. */
+#define NETIF_F_FRAGLIST	0x0020	/* Scatter/gather IO. */
+#define NETIF_F_HW_VLAN_TX	0x0040	/* Transmit VLAN hw acceleration */
+#define NETIF_F_HW_VLAN_RX	0x0080	/* Receive VLAN hw acceleration */
+
+#define NETIF_F_HW_VLAN_FILTER	0x0100	/* Receive filtering on VLAN */
+#define NETIF_F_VLAN_CHALLENGED	0x0200	/* Device cannot handle VLAN packets */
+#define NETIF_F_GSO		0x0400	/* Enable software GSO. */
+#define NETIF_F_LLTX		0x0800	/* LockLess TX */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
#1 lore raw
Quoted 3 lines · Peter Zijlstra

Cleanup the NETIF_F_ flag definitions

If you are going to do a cleanup here, you should use the form that makes it _immediately_ obvious which bit(s) are being used:

#define NETIF_F_SG (1 << 0)
#define NETIF_F_IP_CSUM (1 << 1)
#define NETIF_F_NO_CSUM (1 << 2)
[...]

Maybe DaveM's brain automatically translates all hex numbers into bit numbers, but not everybody's brain works that way... :) It is better to use a form that requires no human brain translation...

Jeff

#2 lore raw
Quoted 7 lines · Jeff Garzik
Quoted 3 lines · Peter Zijlstra

Cleanup the NETIF_F_ flag definitions

If you are going to do a cleanup here, you should use the form that makes it _immediately_ obvious which bit(s) are being used:

Also, please avoid changing the values if possible.

It shouldn't really break anything as far as I know, but it does change a user-visible interface since we export (for some reason unbeknownst to me) the features value to user-space via sysfs.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt