aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface.h')
-rw-r--r--src/vnet/interface.h116
1 files changed, 52 insertions, 64 deletions
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 822d4c3a7ad..801298a0f05 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -519,72 +519,60 @@ typedef enum vnet_hw_interface_flags_t_
VNET_HW_INTERFACE_FLAG_NBMA = (1 << 19),
} vnet_hw_interface_flags_t;
-typedef enum vnet_hw_interface_capabilities_t_
+#define foreach_vnet_hw_if_caps \
+ _ (0, TX_IP4_CKSUM, "ip4-csum-tx") \
+ _ (1, TX_TCP_CKSUM, "tcp-csum-tx") \
+ _ (2, TX_UDP_CKSUM, "udp-csum-tx") \
+ _ (3, TX_IP4_OUTER_CKSUM, "outer-ip4-csum-tx") \
+ _ (4, TX_UDP_OUTER_CKSUM, "outer-udp-csum-tx") \
+ _ (5, RX_IP4_CKSUM, "ip4-csum-rx") \
+ _ (6, RX_TCP_CKSUM, "tcp-csum-rx") \
+ _ (7, RX_UDP_CKSUM, "udp-csum-rx") \
+ _ (8, RX_IP4_OUTER_CKSUM, "outer-ip4-csum-rx") \
+ _ (9, RX_UDP_OUTER_CKSUM, "outer-udp-csum-rx") \
+ _ (10, TCP_GSO, "tcp-tso") \
+ _ (11, UDP_GSO, "udp-gso") \
+ _ (12, VXLAN_TNL_GSO, "vxlan-tnl-gso") \
+ _ (13, IPIP_TNL_GSO, "ipip-tnl-gso") \
+ _ (14, GENEVE_TNL_GSO, "geneve-tnl-gso") \
+ _ (15, GRE_TNL_GSO, "gre-tnl-gso") \
+ _ (16, UDP_TNL_GSO, "udp-tnl-gso") \
+ _ (17, IP_TNL_GSO, "ip-tnl-gso") \
+ _ (18, TCP_LRO, "tcp-lro") \
+ _ (30, INT_MODE, "int-mode") \
+ _ (31, MAC_FILTER, "mac-filter")
+
+typedef enum vnet_hw_if_caps_t_
{
VNET_HW_INTERFACE_CAP_NONE,
+#define _(bit, sfx, str) VNET_HW_IF_CAP_##sfx = (1 << (bit)),
+ foreach_vnet_hw_if_caps
+#undef _
- /* tx checksum offload */
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM = (1 << 0),
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM = (1 << 1),
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM = (1 << 2),
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_OUTER_CKSUM = (1 << 3),
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_OUTER_CKSUM = (1 << 4),
-
- /* rx checksum offload */
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM = (1 << 5),
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM = (1 << 6),
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM = (1 << 7),
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_OUTER_CKSUM = (1 << 8),
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_OUTER_CKSUM = (1 << 9),
-
- /* gso */
- VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO = (1 << 10),
- VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_GSO = (1 << 11),
- VNET_HW_INTERFACE_CAP_SUPPORTS_VXLAN_TNL_GSO = (1 << 12),
- VNET_HW_INTERFACE_CAP_SUPPORTS_IPIP_TNL_GSO = (1 << 13),
- VNET_HW_INTERFACE_CAP_SUPPORTS_GENEVE_TNL_GSO = (1 << 14),
- VNET_HW_INTERFACE_CAP_SUPPORTS_GRE_TNL_GSO = (1 << 15),
- VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_TNL_GSO = (1 << 16),
- VNET_HW_INTERFACE_CAP_SUPPORTS_IP_TNL_GSO = (1 << 17),
-
- /* lro */
- VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_LRO = (1 << 18),
-
- /* rx mode */
- VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE = (1 << 30),
- /* hw/driver can switch between l2-promisc and l3-dmac-filter modes */
- VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER = (1 << 31),
-} vnet_hw_interface_capabilities_t;
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_OUTER_CKSUM \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_OUTER_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_OUTER_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM_MASK \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_TX_OUTER_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_RX_CKSUM \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_RX_CKSUM \
- (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
-
-#define VNET_HW_INTERFACE_CAP_SUPPORTS_TNL_GSO_MASK \
- VNET_HW_INTERFACE_CAP_SUPPORTS_VXLAN_TNL_GSO | \
- VNET_HW_INTERFACE_CAP_SUPPORTS_IPIP_TNL_GSO
+} vnet_hw_if_caps_t;
+
+#define VNET_HW_IF_CAP_L4_TX_CKSUM \
+ (VNET_HW_IF_CAP_TX_TCP_CKSUM | VNET_HW_IF_CAP_TX_UDP_CKSUM)
+
+#define VNET_HW_IF_CAP_TX_CKSUM \
+ (VNET_HW_IF_CAP_TX_IP4_CKSUM | VNET_HW_IF_CAP_TX_TCP_CKSUM | \
+ VNET_HW_IF_CAP_TX_UDP_CKSUM)
+
+#define VNET_HW_IF_CAP_TX_OUTER_CKSUM \
+ (VNET_HW_IF_CAP_TX_IP4_OUTER_CKSUM | VNET_HW_IF_CAP_TX_UDP_OUTER_CKSUM)
+
+#define VNET_HW_IF_CAP_TX_CKSUM_MASK \
+ (VNET_HW_IF_CAP_TX_CKSUM | VNET_HW_IF_CAP_TX_OUTER_CKSUM)
+
+#define VNET_HW_IF_CAP_L4_RX_CKSUM \
+ (VNET_HW_IF_CAP_RX_TCP_CKSUM | VNET_HW_IF_CAP_RX_UDP_CKSUM)
+
+#define VNET_HW_IF_CAP_RX_CKSUM \
+ (VNET_HW_IF_CAP_RX_IP4_CKSUM | VNET_HW_IF_CAP_RX_TCP_CKSUM | \
+ VNET_HW_IF_CAP_RX_UDP_CKSUM)
+
+#define VNET_HW_IF_CAP_TNL_GSO_MASK \
+ VNET_HW_IF_CAP_VXLAN_TNL_GSO | VNET_HW_IF_CAP_IPIP_TNL_GSO
#define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1
#define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3
@@ -659,7 +647,7 @@ typedef struct vnet_hw_interface_t
vnet_hw_interface_flags_t flags;
/* capabilities flags */
- vnet_hw_interface_capabilities_t caps;
+ vnet_hw_if_caps_t caps;
/* Hardware address as vector. Zero (e.g. zero-length vector) if no
address for this class (e.g. PPP). */