net/ice: support header split in Rx data path
cover net/ice: support header split in Rx data path
From: Xuan Ding <[email protected]>
Header split is useful in some scenarios, such as GPU acceleration. The spliting will help to enable true zero copy and hence improve the performance significantly.
This patchset enables header split in normal Rx data paths. When Rx queue is configured with header split feature with testpmd, packets received will be directly splited into two different mempools.
Xuan Ding (2):
app/testpmd: add header split configuration
net/ice: support header split in Rx data path
app/test-pmd/cmdline.c | 85 +++++++++++ app/test-pmd/testpmd.c | 6 +- app/test-pmd/testpmd.h | 2 + drivers/net/ice/ice_ethdev.c | 5 +- drivers/net/ice/ice_rxtx.c | 211 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx.h | 15 ++ drivers/net/ice/ice_rxtx_vec_common.h | 3 + 7 files changed, 295 insertions(+), 32 deletions(-)
Signature · 1 line
2.17.1
RFC 1/2 app/testpmd: add header split configuration
From: Xuan Ding <[email protected]>
This patch adds header split configuration in testpmd. The header split feature is off by default. To enable header split, you need:
1. Configure Rx queue with rx_offload header split on.
2. Set the protocol type of header split.
Command for set header split protocol type:
testpmd> port config <port_id> header_split inner_l2|out_l2|ip|tcp_udp|sctp
--- app/test-pmd/cmdline.c | 85 ++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.c | 6 ++- app/test-pmd/testpmd.h | 2 + 3 files changed, 92 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +85 -0
@@ -16352,6 +16352,90 @@ cmdline_parse_inst_t cmd_config_per_port_rx_offload = { } }; +/* config a per port header split protocol */ +struct cmd_config_per_port_headersplit_protocol_result { +cmdline_fixed_string_t port; +cmdline_fixed_string_t config; +uint16_t port_id; +cmdline_fixed_string_t headersplit; +cmdline_fixed_string_t protocol; +}; + +cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_port = +TOKEN_STRING_INITIALIZER + (struct cmd_config_per_port_headersplit_protocol_result, + port,"port" ); +cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_config = +TOKEN_STRING_INITIALIZER + (struct cmd_config_per_port_headersplit_protocol_result, + config,"config" ); +cmdline_parse_token_num_t cmd_config_per_port_headersplit_protocol_result_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_config_per_port_headersplit_protocol_result, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_headersplit = +TOKEN_STRING_INITIALIZER + (struct cmd_config_per_port_headersplit_protocol_result, + headersplit,"header_split" ); +cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_protocol = +TOKEN_STRING_INITIALIZER + (struct cmd_config_per_port_headersplit_protocol_result, + protocol,"inner_l2#out_l2#ip#tcp_udp#sctp" ); + +static void +cmd_config_per_port_headersplit_protocol_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_config_per_port_headersplit_protocol_result *res = parsed_result; +portid_t port_id = res->port_id; +struct rte_port *port = &ports[port_id]; +uint16_t protocol; + +if (port_id_is_invalid (port_id,ENABLED_WARN )) +return ; + +if (port->port_status !=RTE_PORT_STOPPED ) { +fprintf (stderr, +"Error: Can't config offload when Port %d is not stopped\n" , + port_id); +return ; + } + +if (!strcmp (res->protocol,"inner_l2" )) + protocol =RTE_ETH_RX_HEADER_SPLIT_INNER_L2 ; +else if (!strcmp (res->protocol,"out_l2" )) + protocol =RTE_ETH_RX_HEADER_SPLIT_OUTER_L2 ; +else if (!strcmp (res->protocol,"ip" )) + protocol =RTE_ETH_RX_HEADER_SPLIT_IP ; +else if (!strcmp (res->protocol,"tcp_udp" )) + protocol =RTE_ETH_RX_HEADER_SPLIT_TCP_UDP ; +else if (!strcmp (res->protocol,"sctp" )) + protocol =RTE_ETH_RX_HEADER_SPLIT_SCTP ; +else { +fprintf (stderr,"Unknown protocol name: %s\n" , res->protocol); +return ; + } + + rx_pkt_header_split_proto = protocol; + +cmd_reconfig_device_queue (port_id,1 ,1 ); +} + +cmdline_parse_inst_t cmd_config_per_port_headersplit_protocol = { + .f = cmd_config_per_port_headersplit_protocol_parsed, + .data =NULL , + .help_str ="port config <port_id> header_split inner_l2|out_l2|ip|tcp_udp|sctp" , + .tokens = { + (void *)&cmd_config_per_port_headersplit_protocol_result_port, + (void *)&cmd_config_per_port_headersplit_protocol_result_config, + (void *)&cmd_config_per_port_headersplit_protocol_result_port_id, + (void *)&cmd_config_per_port_headersplit_protocol_result_headersplit, + (void *)&cmd_config_per_port_headersplit_protocol_result_protocol, +NULL , + } +}; +/* Enable/Disable a per queue offloading */ struct cmd_config_per_queue_rx_offload_result {cmdline_fixed_string_t port;
@@ -18070,6 +18154,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_rx_offload_get_capa, (cmdline_parse_inst_t *)&cmd_rx_offload_get_configuration, (cmdline_parse_inst_t *)&cmd_config_per_port_rx_offload, + (cmdline_parse_inst_t *)&cmd_config_per_port_headersplit_protocol, (cmdline_parse_inst_t *)&cmd_config_per_queue_rx_offload, (cmdline_parse_inst_t *)&cmd_tx_offload_get_capa, (cmdline_parse_inst_t *)&cmd_tx_offload_get_configuration,
app/test-pmd/testpmd.c +5 -1
@@ -253,6 +253,8 @@ uint8_t tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */enum tx_pkt_split tx_pkt_split =TX_PKT_SPLIT_OFF ;/**< Split policy for packets to TX. */ +uint8_t rx_pkt_header_split_proto; +uint8_t txonly_multi_flow;/**< Whether multiple flows are generated in TXONLY mode. */
@@ -2568,7 +2570,8 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,int ret;if (rx_pkt_nb_segs <=1 || - (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) ==0 ) { + (((rx_conf->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) ==0 ) && + ((rx_conf->offloads &RTE_ETH_RX_OFFLOAD_HEADER_SPLIT ) ==0 ))) { rx_conf->rx_seg =NULL ; rx_conf->rx_nseg =0 ; ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
@@ -2592,6 +2595,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, rx_seg->offset = i < rx_pkt_nb_offs ? rx_pkt_seg_offsets[i] :0 ; rx_seg->mp = mpx ? mpx : mp; + rx_seg->proto = rx_pkt_header_split_proto; } rx_conf->rx_nseg = rx_pkt_nb_segs; rx_conf->rx_seg = rx_useg;
app/test-pmd/testpmd.h +2 -0
@@ -531,6 +531,8 @@ enum tx_pkt_split {extern enum tx_pkt_split tx_pkt_split; +extern uint8_t rx_pkt_header_split_proto; +extern uint8_t txonly_multi_flow;extern uint32_t rxq_share;
Signature · 1 line
2.17.1
RFC 2/2 net/ice: support header split in Rx data path
In reply to [email protected]From: Xuan Ding <[email protected]>
This patch adds support for header split in normal Rx data paths. When Rx queue is configured with header split feature, packets received will be directly splited into header and payload parts. And the two parts will be put into different mempools.
Currently, the vectorized path is not supported.
--- drivers/net/ice/ice_ethdev.c | 5 +- drivers/net/ice/ice_rxtx.c | 211 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx.h | 15 ++ drivers/net/ice/ice_rxtx_vec_common.h | 3 + 4 files changed, 203 insertions(+), 31 deletions(-)
drivers/net/ice/ice_ethdev.c +3 -2
@@ -3707,7 +3707,8 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |RTE_ETH_RX_OFFLOAD_RSS_HASH | -RTE_ETH_RX_OFFLOAD_TIMESTAMP ; +RTE_ETH_RX_OFFLOAD_TIMESTAMP | +RTE_ETH_RX_OFFLOAD_HEADER_SPLIT ; dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_QINQ_INSERT | RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
@@ -3719,7 +3720,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->flow_type_rss_offloads |=ICE_RSS_OFFLOAD_ALL ; } - dev_info->rx_queue_offload_capa =0 ; + dev_info->rx_queue_offload_capa =RTE_ETH_RX_OFFLOAD_HEADER_SPLIT ; dev_info->tx_queue_offload_capa =RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; dev_info->reta_size = pf->hash_lut_size;
drivers/net/ice/ice_rxtx.c +182 -29
347 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +15 -0
@@ -16,6 +16,8 @@#define ICE_RX_MAX_BURST 32#define ICE_TX_MAX_BURST 32 +#define ICE_RX_MAX_NSEG 2 +#define ICE_CHK_Q_ENA_COUNT 100#define ICE_CHK_Q_ENA_INTERVAL_US 100
@@ -43,6 +45,11 @@extern uint64_t ice_timestamp_dynflag;extern int ice_timestamp_dynfield_offset; +/* Max header size can be 2K - 64 bytes */ +#define ICE_RX_HDR_BUF_SIZE (2048 - 64) + +#define ICE_HEADER_SPLIT_ENA BIT(0) +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); typedef void (*ice_rxd_to_pkt_fields_t)(struct ice_rx_queue *rxq,
@@ -53,6 +60,12 @@ struct ice_rx_entry {struct rte_mbuf *mbuf; }; +enum ice_rx_dtype { +ICE_RX_DTYPE_NO_SPLIT =0 , +ICE_RX_DTYPE_HEADER_SPLIT =1 , +ICE_RX_DTYPE_SPLIT_ALWAYS =2 , +}; +struct ice_rx_queue {struct rte_mempool *mp;/* mbuf pool to populate RX ring */ volatile union ice_rx_flex_desc *rx_ring;/* RX ring virtual address */
@@ -95,6 +108,8 @@ struct ice_rx_queue {uint32_t time_high;uint32_t hw_register_set;const struct rte_memzone *mz; +struct rte_eth_rxseg_split rxseg[ICE_RX_MAX_NSEG ]; +uint32_t rxseg_nb; };struct ice_tx_entry {
drivers/net/ice/ice_rxtx_vec_common.h +3 -0
@@ -290,6 +290,9 @@ ice_rx_vec_queue_default(struct ice_rx_queue *rxq)if (rxq->offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP )return -1 ; +if (rxq->offloads &RTE_ETH_RX_OFFLOAD_HEADER_SPLIT ) +return -1 ; +if (rxq->offloads &ICE_RX_VECTOR_OFFLOAD )return ICE_VECTOR_OFFLOAD_PATH ;
Signature · 1 line
2.17.1