1*a59e2ecbSMichał Mirosław /*
2*a59e2ecbSMichał Mirosław  * Network device features.
3*a59e2ecbSMichał Mirosław  *
4*a59e2ecbSMichał Mirosław  *
5*a59e2ecbSMichał Mirosław  * This program is free software; you can redistribute it and/or
6*a59e2ecbSMichał Mirosław  * modify it under the terms of the GNU General Public License
7*a59e2ecbSMichał Mirosław  * as published by the Free Software Foundation; either version
8*a59e2ecbSMichał Mirosław  * 2 of the License, or (at your option) any later version.
9*a59e2ecbSMichał Mirosław  */
10*a59e2ecbSMichał Mirosław #ifndef _LINUX_NETDEV_FEATURES_H
11*a59e2ecbSMichał Mirosław #define _LINUX_NETDEV_FEATURES_H
12*a59e2ecbSMichał Mirosław 
13*a59e2ecbSMichał Mirosław /* Net device feature bits; if you change something,
14*a59e2ecbSMichał Mirosław  * also update netdev_features_strings[] in ethtool.c */
15*a59e2ecbSMichał Mirosław 
16*a59e2ecbSMichał Mirosław #define NETIF_F_SG		1	/* Scatter/gather IO. */
17*a59e2ecbSMichał Mirosław #define NETIF_F_IP_CSUM		2	/* Can checksum TCP/UDP over IPv4. */
18*a59e2ecbSMichał Mirosław #define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
19*a59e2ecbSMichał Mirosław #define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
20*a59e2ecbSMichał Mirosław #define NETIF_F_IPV6_CSUM	16	/* Can checksum TCP/UDP over IPV6 */
21*a59e2ecbSMichał Mirosław #define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
22*a59e2ecbSMichał Mirosław #define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
23*a59e2ecbSMichał Mirosław #define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
24*a59e2ecbSMichał Mirosław #define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
25*a59e2ecbSMichał Mirosław #define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
26*a59e2ecbSMichał Mirosław #define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
27*a59e2ecbSMichał Mirosław #define NETIF_F_GSO		2048	/* Enable software GSO. */
28*a59e2ecbSMichał Mirosław #define NETIF_F_LLTX		4096	/* LockLess TX - deprecated. Please */
29*a59e2ecbSMichał Mirosław 					/* do not use LLTX in new drivers */
30*a59e2ecbSMichał Mirosław #define NETIF_F_NETNS_LOCAL	8192	/* Does not change network namespaces */
31*a59e2ecbSMichał Mirosław #define NETIF_F_GRO		16384	/* Generic receive offload */
32*a59e2ecbSMichał Mirosław #define NETIF_F_LRO		32768	/* large receive offload */
33*a59e2ecbSMichał Mirosław 
34*a59e2ecbSMichał Mirosław /* the GSO_MASK reserves bits 16 through 23 */
35*a59e2ecbSMichał Mirosław #define NETIF_F_FCOE_CRC	(1 << 24) /* FCoE CRC32 */
36*a59e2ecbSMichał Mirosław #define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
37*a59e2ecbSMichał Mirosław #define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
38*a59e2ecbSMichał Mirosław #define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
39*a59e2ecbSMichał Mirosław #define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
40*a59e2ecbSMichał Mirosław #define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
41*a59e2ecbSMichał Mirosław #define NETIF_F_NOCACHE_COPY	(1 << 30) /* Use no-cache copyfromuser */
42*a59e2ecbSMichał Mirosław #define NETIF_F_LOOPBACK	(1 << 31) /* Enable loopback */
43*a59e2ecbSMichał Mirosław 
44*a59e2ecbSMichał Mirosław /* Segmentation offload features */
45*a59e2ecbSMichał Mirosław #define NETIF_F_GSO_SHIFT	16
46*a59e2ecbSMichał Mirosław #define NETIF_F_GSO_MASK	0x00ff0000
47*a59e2ecbSMichał Mirosław #define NETIF_F_TSO		(SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
48*a59e2ecbSMichał Mirosław #define NETIF_F_UFO		(SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
49*a59e2ecbSMichał Mirosław #define NETIF_F_GSO_ROBUST	(SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
50*a59e2ecbSMichał Mirosław #define NETIF_F_TSO_ECN		(SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
51*a59e2ecbSMichał Mirosław #define NETIF_F_TSO6		(SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
52*a59e2ecbSMichał Mirosław #define NETIF_F_FSO		(SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
53*a59e2ecbSMichał Mirosław 
54*a59e2ecbSMichał Mirosław /* Features valid for ethtool to change */
55*a59e2ecbSMichał Mirosław /* = all defined minus driver/device-class-related */
56*a59e2ecbSMichał Mirosław #define NETIF_F_NEVER_CHANGE	(NETIF_F_VLAN_CHALLENGED | \
57*a59e2ecbSMichał Mirosław 				 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
58*a59e2ecbSMichał Mirosław #define NETIF_F_ETHTOOL_BITS	(0xff3fffff & ~NETIF_F_NEVER_CHANGE)
59*a59e2ecbSMichał Mirosław 
60*a59e2ecbSMichał Mirosław /* List of features with software fallbacks. */
61*a59e2ecbSMichał Mirosław #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | \
62*a59e2ecbSMichał Mirosław 				 NETIF_F_TSO6 | NETIF_F_UFO)
63*a59e2ecbSMichał Mirosław 
64*a59e2ecbSMichał Mirosław #define NETIF_F_GEN_CSUM	(NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)
65*a59e2ecbSMichał Mirosław #define NETIF_F_V4_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
66*a59e2ecbSMichał Mirosław #define NETIF_F_V6_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
67*a59e2ecbSMichał Mirosław #define NETIF_F_ALL_CSUM	(NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
68*a59e2ecbSMichał Mirosław 
69*a59e2ecbSMichał Mirosław #define NETIF_F_ALL_TSO 	(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
70*a59e2ecbSMichał Mirosław 
71*a59e2ecbSMichał Mirosław #define NETIF_F_ALL_FCOE	(NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
72*a59e2ecbSMichał Mirosław 				 NETIF_F_FSO)
73*a59e2ecbSMichał Mirosław 
74*a59e2ecbSMichał Mirosław /*
75*a59e2ecbSMichał Mirosław  * If one device supports one of these features, then enable them
76*a59e2ecbSMichał Mirosław  * for all in netdev_increment_features.
77*a59e2ecbSMichał Mirosław  */
78*a59e2ecbSMichał Mirosław #define NETIF_F_ONE_FOR_ALL	(NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
79*a59e2ecbSMichał Mirosław 				 NETIF_F_SG | NETIF_F_HIGHDMA |		\
80*a59e2ecbSMichał Mirosław 				 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
81*a59e2ecbSMichał Mirosław /*
82*a59e2ecbSMichał Mirosław  * If one device doesn't support one of these features, then disable it
83*a59e2ecbSMichał Mirosław  * for all in netdev_increment_features.
84*a59e2ecbSMichał Mirosław  */
85*a59e2ecbSMichał Mirosław #define NETIF_F_ALL_FOR_ALL	(NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
86*a59e2ecbSMichał Mirosław 
87*a59e2ecbSMichał Mirosław /* changeable features with no special hardware requirements */
88*a59e2ecbSMichał Mirosław #define NETIF_F_SOFT_FEATURES	(NETIF_F_GSO | NETIF_F_GRO)
89*a59e2ecbSMichał Mirosław 
90*a59e2ecbSMichał Mirosław #endif	/* _LINUX_NETDEV_FEATURES_H */
91