From 8b90d89b05322ceaaf57e0eda403c4f92546f7b3 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Thu, 8 Sep 2022 17:21:20 +0000 Subject: devices: add support for af-packet v2 Type: feature Signed-off-by: Mohsin Kazmi Change-Id: I2ccaf1d512dcb72e414be8c69cbb538ebbe0e933 --- src/vnet/devices/af_packet/af_packet.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/vnet/devices/af_packet/af_packet.h') diff --git a/src/vnet/devices/af_packet/af_packet.h b/src/vnet/devices/af_packet/af_packet.h index 940acbb1372..7aa5e6d5b9a 100644 --- a/src/vnet/devices/af_packet/af_packet.h +++ b/src/vnet/devices/af_packet/af_packet.h @@ -23,9 +23,17 @@ #include typedef struct tpacket_block_desc block_desc_t; +typedef struct tpacket_req tpacket_req_t; typedef struct tpacket_req3 tpacket_req3_t; +typedef struct tpacket2_hdr tpacket2_hdr_t; typedef struct tpacket3_hdr tpacket3_hdr_t; +typedef union _tpacket_req_u +{ + tpacket_req_t req; + tpacket_req3_t req3; +} tpacket_req_u_t; + typedef enum { AF_PACKET_IF_MODE_ETHERNET = 1, @@ -37,6 +45,7 @@ typedef enum AF_PACKET_IF_FLAGS_QDISC_BYPASS = 1, AF_PACKET_IF_FLAGS_CKSUM_GSO = 2, AF_PACKET_IF_FLAGS_FANOUT = 4, + AF_PACKET_IF_FLAGS_VERSION_2 = 8, } af_packet_if_flags_t; typedef struct @@ -58,8 +67,8 @@ typedef struct int fd; union { - tpacket_req3_t *rx_req; - tpacket_req3_t *tx_req; + tpacket_req_u_t *rx_req; + tpacket_req_u_t *tx_req; }; union @@ -71,6 +80,7 @@ typedef struct union { u32 next_rx_block; + u32 next_rx_frame; u32 next_tx_frame; }; @@ -95,7 +105,7 @@ typedef struct af_packet_if_mode_t mode; u8 is_admin_up; u8 is_cksum_gso_enabled; - + u8 version; af_packet_queue_t *rx_queues; af_packet_queue_t *tx_queues; @@ -139,6 +149,7 @@ typedef struct u32 tx_frames_per_block; u8 num_rxqs; u8 num_txqs; + u8 is_v2; af_packet_if_mode_t mode; af_packet_if_flags_t flags; -- cgit 1.2.3-korg