From 8fadde6f0154a735dce2624d56b36bf2276b6a7f Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 5 Jul 2024 14:09:35 +0200 Subject: pg: misc improvements and fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) pg can typically injects packets in ethernet-input, ip4-input or ip6-input. Make sure offload offsets are correctly set for ip4-input and ip6-input. 2) add hw-addr support for ethernet mode (only available through cli) 3) refactor pg creation code to improve the readability by using data structure pg_interface_args_t 4) fix the pg input and output traces to use headers according to pg interface mode 5) introduce pg interface flags i.e. checksum, gso, gro Type: improvement Change-Id: Iffed502e9c6357d7ef8e8a72217867e8297236aa Signed-off-by: Benoît Ganne Signed-off-by: Mohsin Kazmi --- src/vnet/pg/pg.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/vnet/pg/pg.h') diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h index 5e63b58caf6..7c5d698349b 100644 --- a/src/vnet/pg/pg.h +++ b/src/vnet/pg/pg.h @@ -348,6 +348,29 @@ pg_intf_mode_to_pcap_packet_type (pg_interface_mode_t mode) return PCAP_PACKET_TYPE_ethernet; } +#define foreach_pg_interface_flags \ + _ (CSUM_OFFLOAD, 0) \ + _ (GSO, 1) \ + _ (GRO_COALESCE, 2) + +typedef enum +{ +#define _(a, b) PG_INTERFACE_FLAG_##a = (1 << b), + foreach_pg_interface_flags +#undef _ +} pg_interface_flags_t; + +typedef struct +{ + u32 if_id; + pg_interface_mode_t mode; + pg_interface_flags_t flags; + u32 gso_size; + mac_address_t hw_addr; + u8 hw_addr_set; + int rv; +} pg_interface_args_t; + typedef struct { /* TX lock */ @@ -359,6 +382,8 @@ typedef struct /* Identifies stream for this interface. */ u32 id; + mac_address_t hw_addr; + u8 coalesce_enabled; gro_flow_table_t *flow_table; u8 gso_enabled; @@ -425,9 +450,7 @@ void pg_interface_enable_disable_coalesce (pg_interface_t * pi, u8 enable, u32 tx_node_index); /* Find/create free packet-generator interface index. */ -u32 pg_interface_add_or_get (pg_main_t *pg, u32 stream_index, u8 gso_enabled, - u32 gso_size, u8 coalesce_enabled, - pg_interface_mode_t mode); +u32 pg_interface_add_or_get (pg_main_t *pg, pg_interface_args_t *args); int pg_interface_delete (u32 sw_if_index); @@ -459,6 +482,7 @@ clib_error_t *pg_capture (pg_capture_args_t * a); typedef struct { + pg_interface_mode_t mode; u32 buffer_index; vlib_buffer_t buffer; } -- cgit