net/idpf: introduce idpf common modle
Subsystems (2)
PATCH v7 1/19 common/idpf: add adapter structure
In reply to [email protected]From: Beilei Xing <[email protected]>
Add structure idpf_adapter in common module, the structure includes some basic fields.
Introduce structure idpf_adapter_ext in PMD, this structure includes extra fields except idpf_adapter.
--- drivers/common/idpf/idpf_common_device.h | 20 ++++++ drivers/net/idpf/idpf_ethdev.c | 91 ++++++++++-------------- drivers/net/idpf/idpf_ethdev.h | 25 +++---- drivers/net/idpf/idpf_rxtx.c | 16 ++--- drivers/net/idpf/idpf_rxtx.h | 4 +- drivers/net/idpf/idpf_rxtx_vec_avx512.c | 3 +- drivers/net/idpf/idpf_vchnl.c | 30 ++++---- 7 files changed, 99 insertions(+), 90 deletions(-) create mode 100644 drivers/common/idpf/idpf_common_device.h
drivers/common/idpf/idpf_common_device.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Intel Corporation +*/ + +#ifndef _IDPF_COMMON_DEVICE_H_ +#define _IDPF_COMMON_DEVICE_H_ + +#include <base/idpf_prototype.h> +#include <base/virtchnl2.h> + +struct idpf_adapter { +struct idpf_hw hw; +struct virtchnl2_version_info virtchnl_version; +struct virtchnl2_get_capabilities caps; +volatile uint32_t pend_cmd;/* pending command not finished */ +uint32_t cmd_retval;/* return value of the cmd response from cp */ +uint8_t *mbx_resp;/* buffer to store the mailbox response from cp */ +}; + +#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/net/idpf/idpf_ethdev.c +38 -53
232 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +11 -14
@@ -15,6 +15,7 @@#include "idpf_logs.h" +#include <idpf_common_device.h> #include <base/idpf_prototype.h> #include <base/virtchnl2.h>
@@ -91,7 +92,7 @@ struct idpf_chunks_info { };struct idpf_vport_param { -struct idpf_adapter *adapter; +struct idpf_adapter_ext *adapter;uint16_t devarg_id;/* arg id from user */ uint16_t idx;/* index in adapter->vports[]*/ };
@@ -144,17 +145,11 @@ struct idpf_devargs {uint16_t req_vport_nb; }; -struct idpf_adapter { -TAILQ_ENTRY (idpf_adapter) next; -struct idpf_hw hw; -char name[IDPF_ADAPTER_NAME_LEN ]; - -struct virtchnl2_version_info virtchnl_version; -struct virtchnl2_get_capabilities *caps; +struct idpf_adapter_ext { +TAILQ_ENTRY (idpf_adapter_ext) next; +struct idpf_adapter base; -volatile uint32_t pend_cmd;/* pending command not finished */ -uint32_t cmd_retval;/* return value of the cmd response from ipf */ -uint8_t *mbx_resp;/* buffer to store the mailbox response from ipf */ +char name[IDPF_ADAPTER_NAME_LEN ];uint32_t txq_model;/* 0 - split queue model, non-0 - single queue model */ uint32_t rxq_model;/* 0 - split queue model, non-0 - single queue model */
@@ -182,10 +177,12 @@ struct idpf_adapter {uint64_t time_hw; }; -TAILQ_HEAD (idpf_adapter_list, idpf_adapter); +TAILQ_HEAD (idpf_adapter_list, idpf_adapter_ext);#define IDPF_DEV_TO_PCI (eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device) +#define IDPF_ADAPTER_TO_EXT (p) \ + container_of((p), struct idpf_adapter_ext, base)/* structure used for sending and checking response of virtchnl ops */ struct idpf_cmd_info {
@@ -234,10 +231,10 @@ atomic_set_cmd(struct idpf_adapter *adapter, uint32_t ops)return !ret; } -struct idpf_adapter *idpf_find_adapter (struct rte_pci_device *pci_dev); +struct idpf_adapter_ext *idpf_find_adapter_ext (struct rte_pci_device *pci_dev);void idpf_handle_virtchnl_msg (struct rte_eth_dev *dev);int idpf_vc_check_api_version (struct idpf_adapter *adapter); -int idpf_get_pkt_type (struct idpf_adapter *adapter); +int idpf_get_pkt_type (struct idpf_adapter_ext *adapter);int idpf_vc_get_caps (struct idpf_adapter *adapter);int idpf_vc_create_vport (struct idpf_vport *vport,struct virtchnl2_create_vport *vport_info);
drivers/net/idpf/idpf_rxtx.c +8 -8
@@ -1384,7 +1384,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,struct idpf_rx_queue *rxq;const uint32_t *ptype_tbl;uint8_t status_err0_qw1; -struct idpf_adapter *ad; +struct idpf_adapter_ext *ad;struct rte_mbuf *rxm;uint16_t rx_id_bufq1;uint16_t rx_id_bufq2;
@@ -1398,7 +1398,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nb_rx =0 ; rxq = rx_queue; - ad = rxq->adapter; + ad =IDPF_ADAPTER_TO_EXT (rxq->adapter);if (unlikely (rxq ==NULL ) ||unlikely (!rxq->q_started))return nb_rx;
@@ -1407,7 +1407,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rx_id_bufq1 = rxq->bufq1->rx_next_avail; rx_id_bufq2 = rxq->bufq2->rx_next_avail; rx_desc_ring = rxq->rx_ring; - ptype_tbl = rxq->adapter->ptype_tbl; + ptype_tbl = ad->ptype_tbl;if ((rxq->offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) !=0 ) rxq->hw_register_set =1 ;
@@ -1791,7 +1791,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,const uint32_t *ptype_tbl;uint16_t rx_id, nb_hold;struct rte_eth_dev *dev; -struct idpf_adapter *ad; +struct idpf_adapter_ext *ad;uint16_t rx_packet_len;struct rte_mbuf *rxm;struct rte_mbuf *nmb;
@@ -1805,14 +1805,14 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nb_hold =0 ; rxq = rx_queue; - ad = rxq->adapter; + ad =IDPF_ADAPTER_TO_EXT (rxq->adapter);if (unlikely (rxq ==NULL ) ||unlikely (!rxq->q_started))return nb_rx; rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; - ptype_tbl = rxq->adapter->ptype_tbl; + ptype_tbl = ad->ptype_tbl;if ((rxq->offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) !=0 ) rxq->hw_register_set =1 ;
@@ -2221,7 +2221,7 @@ idpf_set_rx_function(struct rte_eth_dev *dev) {struct idpf_vport *vport = dev->data->dev_private;#ifdef RTE_ARCH_X86 -struct idpf_adapter *ad = vport->adapter; +struct idpf_adapter_ext *ad =IDPF_ADAPTER_TO_EXT (vport->adapter);struct idpf_rx_queue *rxq;int i;
@@ -2275,7 +2275,7 @@ idpf_set_tx_function(struct rte_eth_dev *dev) {struct idpf_vport *vport = dev->data->dev_private;#ifdef RTE_ARCH_X86 -struct idpf_adapter *ad = vport->adapter; +struct idpf_adapter_ext *ad =IDPF_ADAPTER_TO_EXT (vport->adapter);#ifdef CC_AVX512_SUPPORT struct idpf_tx_queue *txq;int i;
drivers/net/idpf/idpf_rxtx.h +2 -2
@@ -247,11 +247,11 @@ void idpf_set_tx_function(struct rte_eth_dev *dev);/* Helper function to convert a 32b nanoseconds timestamp to 64b. */ static inline uint64_t -idpf_tstamp_convert_32b_64b (struct idpf_adapter *ad,uint32_t flag, +idpf_tstamp_convert_32b_64b (struct idpf_adapter_ext *ad,uint32_t flag,uint32_t in_timestamp) {#ifdef RTE_ARCH_X86_64 -struct idpf_hw *hw = &ad->hw; +struct idpf_hw *hw = &ad->base.hw;const uint64_t mask =0xFFFFFFFF ;uint32_t hi, lo, lo2, delta;uint64_t ns;
drivers/net/idpf/idpf_rxtx_vec_avx512.c +2 -1
@@ -245,7 +245,8 @@ _idpf_singleq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { -const uint32_t *type_table = rxq->adapter->ptype_tbl; +struct idpf_adapter_ext *adapter =IDPF_ADAPTER_TO_EXT (rxq->adapter); +const uint32_t *type_table = adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
drivers/net/idpf/idpf_vchnl.c +18 -12
@@ -311,13 +311,17 @@ idpf_vc_check_api_version(struct idpf_adapter *adapter) } int __rte_cold -idpf_get_pkt_type (struct idpf_adapter *adapter) +idpf_get_pkt_type (struct idpf_adapter_ext *adapter) {struct virtchnl2_get_ptype_info *ptype_info; -uint16_t ptype_recvd =0 , ptype_offset, i, j; +struct idpf_adapter *base; +uint16_t ptype_offset, i, j; +uint16_t ptype_recvd =0 ;int ret; - ret =idpf_vc_query_ptype_info (adapter); + base = &adapter->base; + + ret =idpf_vc_query_ptype_info (base);if (ret !=0 ) {PMD_DRV_LOG (ERR ,"Fail to query packet type information" );return ret;
@@ -328,7 +332,7 @@ idpf_get_pkt_type(struct idpf_adapter *adapter)return -ENOMEM ;while (ptype_recvd <IDPF_MAX_PKT_TYPE ) { - ret =idpf_read_one_msg (adapter,VIRTCHNL2_OP_GET_PTYPE_INFO , + ret =idpf_read_one_msg (base,VIRTCHNL2_OP_GET_PTYPE_INFO ,IDPF_DFLT_MBX_BUF_SIZE , (u8 *)ptype_info);if (ret !=0 ) {PMD_DRV_LOG (ERR ,"Fail to get packet type information" );
@@ -515,7 +519,7 @@ idpf_get_pkt_type(struct idpf_adapter *adapter) free_ptype_info:rte_free (ptype_info); -clear_cmd (adapter); +clear_cmd (base);return ret; }
@@ -577,7 +581,7 @@ idpf_vc_get_caps(struct idpf_adapter *adapter)return err; } -rte_memcpy (adapter->caps, args.out_buffer,sizeof (caps_msg)); +rte_memcpy (&adapter->caps, args.out_buffer,sizeof (caps_msg));return 0 ; }
@@ -740,7 +744,8 @@ idpf_vc_set_rss_hash(struct idpf_vport *vport)int idpf_vc_config_rxqs (struct idpf_vport *vport) { -struct idpf_adapter *adapter = vport->adapter; +struct idpf_adapter *base = vport->adapter; +struct idpf_adapter_ext *adapter =IDPF_ADAPTER_TO_EXT (base);struct idpf_rx_queue **rxq = (struct idpf_rx_queue **)vport->dev_data->rx_queues;struct virtchnl2_config_rx_queues *vc_rxqs =NULL ;
@@ -832,10 +837,10 @@ idpf_vc_config_rxqs(struct idpf_vport *vport) args.ops =VIRTCHNL2_OP_CONFIG_RX_QUEUES ; args.in_args = (uint8_t *)vc_rxqs; args.in_args_size = size; - args.out_buffer = adapter->mbx_resp; + args.out_buffer = base->mbx_resp; args.out_size =IDPF_DFLT_MBX_BUF_SIZE ; - err =idpf_execute_vc_cmd (adapter, &args); + err =idpf_execute_vc_cmd (base, &args);rte_free (vc_rxqs);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to execute command of VIRTCHNL2_OP_CONFIG_RX_QUEUES" );
@@ -940,7 +945,8 @@ idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id)int idpf_vc_config_txqs (struct idpf_vport *vport) { -struct idpf_adapter *adapter = vport->adapter; +struct idpf_adapter *base = vport->adapter; +struct idpf_adapter_ext *adapter =IDPF_ADAPTER_TO_EXT (base);struct idpf_tx_queue **txq = (struct idpf_tx_queue **)vport->dev_data->tx_queues;struct virtchnl2_config_tx_queues *vc_txqs =NULL ;
@@ -1010,10 +1016,10 @@ idpf_vc_config_txqs(struct idpf_vport *vport) args.ops =VIRTCHNL2_OP_CONFIG_TX_QUEUES ; args.in_args = (uint8_t *)vc_txqs; args.in_args_size = size; - args.out_buffer = adapter->mbx_resp; + args.out_buffer = base->mbx_resp; args.out_size =IDPF_DFLT_MBX_BUF_SIZE ; - err =idpf_execute_vc_cmd (adapter, &args); + err =idpf_execute_vc_cmd (base, &args);rte_free (vc_txqs);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to execute command of VIRTCHNL2_OP_CONFIG_TX_QUEUES" );
Signature · 1 line
2.26.2
PATCH v7 2/19 common/idpf: add vport structure
In reply to [email protected]From: Beilei Xing <[email protected]>
Move idpf_vport structure to common module, remove ethdev dependency. Also remove unused functions.
--- drivers/common/idpf/idpf_common_device.h | 59 ++++++ drivers/net/idpf/idpf_ethdev.c | 10 +- drivers/net/idpf/idpf_ethdev.h | 66 +----- drivers/net/idpf/idpf_rxtx.c | 4 +- drivers/net/idpf/idpf_rxtx.h | 3 + drivers/net/idpf/idpf_vchnl.c | 252 +++-------------------- 6 files changed, 96 insertions(+), 298 deletions(-)
drivers/common/idpf/idpf_common_device.h +59 -0
@@ -17,4 +17,63 @@ struct idpf_adapter {uint8_t *mbx_resp;/* buffer to store the mailbox response from cp */ }; +struct idpf_chunks_info { +uint32_t tx_start_qid; +uint32_t rx_start_qid; +/* Valid only if split queue model */ +uint32_t tx_compl_start_qid; +uint32_t rx_buf_start_qid; + +uint64_t tx_qtail_start; +uint32_t tx_qtail_spacing; +uint64_t rx_qtail_start; +uint32_t rx_qtail_spacing; +uint64_t tx_compl_qtail_start; +uint32_t tx_compl_qtail_spacing; +uint64_t rx_buf_qtail_start; +uint32_t rx_buf_qtail_spacing; +}; + +struct idpf_vport { +struct idpf_adapter *adapter;/* Backreference to associated adapter */ +struct virtchnl2_create_vport *vport_info;/* virtchnl response info handling */ +uint16_t sw_idx;/* SW index in adapter->vports[]*/ +uint16_t vport_id; +uint32_t txq_model; +uint32_t rxq_model; +uint16_t num_tx_q; +/* valid only if txq_model is split Q */ +uint16_t num_tx_complq; +uint16_t num_rx_q; +/* valid only if rxq_model is split Q */ +uint16_t num_rx_bufq; + +uint16_t max_mtu; +uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS ]; + +enum virtchnl_rss_algorithm rss_algorithm; +uint16_t rss_key_size; +uint16_t rss_lut_size; + +void *dev_data;/* Pointer to the device data */ +uint16_t max_pkt_len;/* Maximum packet length */ + +/* RSS info */ +uint32_t *rss_lut; +uint8_t *rss_key; +uint64_t rss_hf; + +/* MSIX info*/ +struct virtchnl2_queue_vector *qv_map;/* queue vector mapping */ +uint16_t max_vectors; +struct virtchnl2_alloc_vectors *recv_vectors; + +/* Chunk info */ +struct idpf_chunks_info chunks_info; + +uint16_t devarg_id; + +bool stopped; +}; +#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/net/idpf/idpf_ethdev.c +6 -4
@@ -275,11 +275,13 @@ static int idpf_init_rss(struct idpf_vport *vport) {struct rte_eth_rss_conf *rss_conf; +struct rte_eth_dev_data *dev_data;uint16_t i, nb_q, lut_size;int ret =0 ; - rss_conf = &vport->dev_data->dev_conf.rx_adv_conf.rss_conf; - nb_q = vport->dev_data->nb_rx_queues; + dev_data = vport->dev_data; + rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf; + nb_q = dev_data->nb_rx_queues; vport->rss_key =rte_zmalloc ("rss_key" , vport->rss_key_size,0 );
@@ -466,7 +468,7 @@ idpf_config_rx_queues_irqs(struct rte_eth_dev *dev) } vport->qv_map = qv_map; -if (idpf_vc_config_irq_map_unmap (vport, true) !=0 ) { +if (idpf_vc_config_irq_map_unmap (vport, dev->data->nb_rx_queues, true) !=0 ) {PMD_DRV_LOG (ERR ,"config interrupt mapping failed" ); goto config_irq_map_err; }
@@ -582,7 +584,7 @@ idpf_dev_stop(struct rte_eth_dev *dev)idpf_stop_queues (dev); -idpf_vc_config_irq_map_unmap (vport, false); +idpf_vc_config_irq_map_unmap (vport, dev->data->nb_rx_queues, false);if (vport->recv_vectors !=NULL )idpf_vc_dealloc_vectors (vport);
drivers/net/idpf/idpf_ethdev.h +2 -64
88 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.c +2 -2
@@ -1066,7 +1066,7 @@ idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) dev->data->rx_queues[rx_queue_id];int err =0 ; - err =idpf_vc_config_rxq (vport, rx_queue_id); + err =idpf_vc_config_rxq (vport, rxq);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Fail to configure Rx queue %u" , rx_queue_id);return err;
@@ -1117,7 +1117,7 @@ idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) dev->data->tx_queues[tx_queue_id];int err =0 ; - err =idpf_vc_config_txq (vport, tx_queue_id); + err =idpf_vc_config_txq (vport, txq);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Fail to configure Tx queue %u" , tx_queue_id);return err;
drivers/net/idpf/idpf_rxtx.h +3 -0
@@ -243,6 +243,9 @@ void idpf_stop_queues(struct rte_eth_dev *dev);void idpf_set_rx_function (struct rte_eth_dev *dev);void idpf_set_tx_function (struct rte_eth_dev *dev); +int idpf_vc_config_rxq (struct idpf_vport *vport,struct idpf_rx_queue *rxq); +int idpf_vc_config_txq (struct idpf_vport *vport,struct idpf_tx_queue *txq); +#define IDPF_TIMESYNC_REG_WRAP_GUARD_BAND 10000/* Helper function to convert a 32b nanoseconds timestamp to 64b. */ static inline uint64_t
drivers/net/idpf/idpf_vchnl.c +24 -228
327 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v7 3/19 common/idpf: add virtual channel functions
In reply to [email protected]From: Beilei Xing <[email protected]>
Move most of the virtual channel functions to idpf common module.
--- drivers/common/idpf/base/idpf_controlq_api.h | 4 - drivers/common/idpf/base/meson.build | 2 +- drivers/common/idpf/idpf_common_device.c | 8 + drivers/common/idpf/idpf_common_device.h | 61 ++ drivers/common/idpf/idpf_common_logs.h | 23 + drivers/common/idpf/idpf_common_virtchnl.c | 815 ++++++++++++++++++ drivers/common/idpf/idpf_common_virtchnl.h | 48 ++ drivers/common/idpf/meson.build | 5 + drivers/common/idpf/version.map | 20 +- drivers/net/idpf/idpf_ethdev.c | 9 +- drivers/net/idpf/idpf_ethdev.h | 85 +- drivers/net/idpf/idpf_rxtx.c | 8 +- drivers/net/idpf/idpf_vchnl.c | 817 +------------------ 13 files changed, 986 insertions(+), 919 deletions(-) create mode 100644 drivers/common/idpf/idpf_common_device.c create mode 100644 drivers/common/idpf/idpf_common_logs.h create mode 100644 drivers/common/idpf/idpf_common_virtchnl.c create mode 100644 drivers/common/idpf/idpf_common_virtchnl.h
drivers/common/idpf/base/idpf_controlq_api.h +0 -4
@@ -177,7 +177,6 @@ void idpf_ctlq_remove(struct idpf_hw *hw, struct idpf_ctlq_info *cq);/* Sends messages to HW and will also free the buffer*/ -__rte_internal int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,
@@ -186,17 +185,14 @@ int idpf_ctlq_send(struct idpf_hw *hw,/* Receives messages and called by interrupt handler/polling * initiated by app/process. Also caller is supposed to free the buffers */ -__rte_internal int idpf_ctlq_recv (struct idpf_ctlq_info *cq,u16 *num_q_msg,struct idpf_ctlq_msg *q_msg);/* Reclaims send descriptors on HW write back */ -__rte_internal int idpf_ctlq_clean_sq (struct idpf_ctlq_info *cq,u16 *clean_count,struct idpf_ctlq_msg *msg_status[]);/* Indicate RX buffers are done being processed */ -__rte_internal int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 *buff_count,
drivers/common/idpf/base/meson.build +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Intel Corporation -sources = files( +sources += files( 'idpf_common.c', 'idpf_controlq.c', 'idpf_controlq_setup.c',
drivers/common/idpf/idpf_common_device.c new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Intel Corporation +*/ + +#include <rte_log.h> +#include <idpf_common_device.h> + +RTE_LOG_REGISTER_SUFFIX (idpf_common_logtype, common,NOTICE );
drivers/common/idpf/idpf_common_device.h +61 -0
71 lines not on this page · raw message
drivers/common/idpf/idpf_common_logs.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Intel Corporation +*/ + +#ifndef _IDPF_COMMON_LOGS_H_ +#define _IDPF_COMMON_LOGS_H_ + +#include <rte_log.h> + +extern int idpf_common_logtype; + +#define DRV_LOG_RAW (level, ...) \ + rte_log(RTE_LOG_ ## level, \ + idpf_common_logtype, \ + RTE_FMT("%s(): " \ + RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + __func__, \ + RTE_FMT_TAIL(__VA_ARGS__,))) + +#define DRV_LOG(level, fmt, args...) \ + DRV_LOG_RAW(level, fmt "\n", ## args) + +#endif /* _IDPF_COMMON_LOGS_H_ */
drivers/common/idpf/idpf_common_virtchnl.c new file +815 -0
815 lines not on this page · raw message
drivers/common/idpf/idpf_common_virtchnl.h new file +48 -0
48 lines not on this page · raw message
drivers/common/idpf/meson.build +5 -0
@@ -1,4 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Intel Corporation +sources = files( + 'idpf_common_device.c', + 'idpf_common_virtchnl.c', +) + subdir('base')
drivers/common/idpf/version.map +16 -4
@@ -3,10 +3,22 @@ INTERNAL { idpf_ctlq_deinit; idpf_ctlq_init; - idpf_ctlq_clean_sq; - idpf_ctlq_recv; - idpf_ctlq_send; - idpf_ctlq_post_rx_buffs; + idpf_execute_vc_cmd; + idpf_vc_alloc_vectors; + idpf_vc_check_api_version; + idpf_vc_config_irq_map_unmap; + idpf_vc_create_vport; + idpf_vc_dealloc_vectors; + idpf_vc_destroy_vport; + idpf_vc_ena_dis_queues; + idpf_vc_ena_dis_vport; + idpf_vc_get_caps; + idpf_vc_query_ptype_info; + idpf_vc_read_one_msg; + idpf_vc_set_rss_hash; + idpf_vc_set_rss_key; + idpf_vc_set_rss_lut; + idpf_vc_switch_queue; local: *; };
drivers/net/idpf/idpf_ethdev.c +1 -8
@@ -942,13 +942,6 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *adapt goto err_api; } - adapter->max_rxq_per_msg = (IDPF_DFLT_MBX_BUF_SIZE - -sizeof (struct virtchnl2_config_rx_queues )) / -sizeof (struct virtchnl2_rxq_info ); - adapter->max_txq_per_msg = (IDPF_DFLT_MBX_BUF_SIZE - -sizeof (struct virtchnl2_config_tx_queues )) / -sizeof (struct virtchnl2_txq_info ); - adapter->cur_vports =0 ; adapter->cur_vport_nb =0 ;
@@ -1075,7 +1068,7 @@ static const struct rte_pci_id pci_id_idpf_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -struct idpf_adapter_ext * +static struct idpf_adapter_ext *idpf_find_adapter_ext (struct rte_pci_device *pci_dev) {struct idpf_adapter_ext *adapter;
drivers/net/idpf/idpf_ethdev.h +1 -84
121 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.c +4 -4
@@ -1080,7 +1080,7 @@ idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) }/* Ready to switch the queue on */ - err =idpf_switch_queue (vport, rx_queue_id, true, true); + err =idpf_vc_switch_queue (vport, rx_queue_id, true, true);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch RX queue %u on" , rx_queue_id);
@@ -1131,7 +1131,7 @@ idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) }/* Ready to switch the queue on */ - err =idpf_switch_queue (vport, tx_queue_id, false, true); + err =idpf_vc_switch_queue (vport, tx_queue_id, false, true);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch TX queue %u on" , tx_queue_id);
@@ -1154,7 +1154,7 @@ idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (rx_queue_id >= dev->data->nb_rx_queues)return -EINVAL ; - err =idpf_switch_queue (vport, rx_queue_id, true, false); + err =idpf_vc_switch_queue (vport, rx_queue_id, true, false);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch RX queue %u off" , rx_queue_id);
@@ -1185,7 +1185,7 @@ idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (tx_queue_id >= dev->data->nb_tx_queues)return -EINVAL ; - err =idpf_switch_queue (vport, tx_queue_id, false, false); + err =idpf_vc_switch_queue (vport, tx_queue_id, false, false);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch TX queue %u off" , tx_queue_id);
drivers/net/idpf/idpf_vchnl.c +3 -814
844 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v7 4/19 common/idpf: introduce adapter init and deinit
In reply to [email protected]From: Beilei Xing <[email protected]>
Introduce idpf_adapter_init and idpf_adapter_deinit functions in common module.
And also introduce idpf_adapter_ext_init and idpf_adapter_ext_deinit functions.
--- drivers/common/idpf/base/idpf_controlq_api.h | 2 - drivers/common/idpf/idpf_common_device.c | 153 ++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 6 + drivers/common/idpf/version.map | 4 +- drivers/net/idpf/idpf_ethdev.c | 158 ++----------------- drivers/net/idpf/idpf_ethdev.h | 2 - 6 files changed, 178 insertions(+), 147 deletions(-)
drivers/common/idpf/base/idpf_controlq_api.h +0 -2
@@ -161,7 +161,6 @@ enum idpf_mbx_opc {/* Will init all required q including default mb. "q_info" is an array of * create_info structs equal to the number of control queues to be created. */ -__rte_internal int idpf_ctlq_init (struct idpf_hw *hw,u8 num_q,struct idpf_ctlq_create_info *q_info);
@@ -199,7 +198,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_dma_mem **buffs);/* Will destroy all q including the default mb */ -__rte_internal int idpf_ctlq_deinit (struct idpf_hw *hw);#endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/idpf_common_device.c +153 -0
158 lines not on this page · raw message
drivers/common/idpf/idpf_common_device.h +6 -0
@@ -9,6 +9,7 @@#include <base/virtchnl2.h> #include <idpf_common_logs.h> +#define IDPF_CTLQ_ID -1#define IDPF_CTLQ_LEN 64#define IDPF_DFLT_MBX_BUF_SIZE 4096
@@ -137,4 +138,9 @@ atomic_set_cmd(struct idpf_adapter *adapter, uint32_t ops)return !ret; } +__rte_internal +int idpf_adapter_init(struct idpf_adapter *adapter); +__rte_internal +int idpf_adapter_deinit(struct idpf_adapter *adapter); +#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/version.map +2 -2
@@ -1,8 +1,8 @@ INTERNAL { global: - idpf_ctlq_deinit; - idpf_ctlq_init; + idpf_adapter_deinit; + idpf_adapter_init; idpf_execute_vc_cmd; idpf_vc_alloc_vectors; idpf_vc_check_api_version;
drivers/net/idpf/idpf_ethdev.c +17 -141
219 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +0 -2
@@ -31,8 +31,6 @@#define IDPF_RXQ_PER_GRP 1#define IDPF_RX_BUFQ_PER_GRP 2 -#define IDPF_CTLQ_ID -1 -#define IDPF_DFLT_Q_VEC_NUM 1#define IDPF_DFLT_INTERVAL 16
Signature · 1 line
2.26.2
PATCH v7 5/19 common/idpf: add vport init/deinit
In reply to [email protected]From: Beilei Xing <[email protected]>
Introduce idpf_vport_init and idpf_vport_deinit functions in common module.
--- drivers/common/idpf/idpf_common_device.c | 115 +++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 13 +- drivers/common/idpf/idpf_common_virtchnl.c | 18 +-- drivers/common/idpf/version.map | 2 + drivers/net/idpf/idpf_ethdev.c | 138 ++------------------- 5 files changed, 148 insertions(+), 138 deletions(-)
drivers/common/idpf/idpf_common_device.c +115 -0
@@ -158,4 +158,119 @@ idpf_adapter_deinit(struct idpf_adapter *adapter)return 0 ; } +int +idpf_vport_init (struct idpf_vport *vport, +struct virtchnl2_create_vport *create_vport_info, +void *dev_data) +{ +struct virtchnl2_create_vport *vport_info; +int i, type, ret; + + ret =idpf_vc_create_vport (vport, create_vport_info); +if (ret !=0 ) { +DRV_LOG (ERR ,"Failed to create vport." ); + goto err_create_vport; + } + + vport_info = &(vport->vport_info.info); + vport->vport_id = vport_info->vport_id; + vport->txq_model = vport_info->txq_model; + vport->rxq_model = vport_info->rxq_model; + vport->num_tx_q = vport_info->num_tx_q; + vport->num_tx_complq = vport_info->num_tx_complq; + vport->num_rx_q = vport_info->num_rx_q; + vport->num_rx_bufq = vport_info->num_rx_bufq; + vport->max_mtu = vport_info->max_mtu; +rte_memcpy (vport->default_mac_addr, + vport_info->default_mac_addr,ETH_ALEN ); + vport->rss_algorithm = vport_info->rss_algorithm; + vport->rss_key_size =RTE_MIN (IDPF_RSS_KEY_LEN , + vport_info->rss_key_size); + vport->rss_lut_size = vport_info->rss_lut_size; + +for (i =0 ; i < vport_info->chunks.num_chunks; i++) { + type = vport_info->chunks.chunks[i].type; +switch (type) { +case VIRTCHNL2_QUEUE_TYPE_TX : + vport->chunks_info.tx_start_qid = + vport_info->chunks.chunks[i].start_queue_id; + vport->chunks_info.tx_qtail_start = + vport_info->chunks.chunks[i].qtail_reg_start; + vport->chunks_info.tx_qtail_spacing = + vport_info->chunks.chunks[i].qtail_reg_spacing; +break ; +case VIRTCHNL2_QUEUE_TYPE_RX : + vport->chunks_info.rx_start_qid = + vport_info->chunks.chunks[i].start_queue_id; + vport->chunks_info.rx_qtail_start = + vport_info->chunks.chunks[i].qtail_reg_start; + vport->chunks_info.rx_qtail_spacing = + vport_info->chunks.chunks[i].qtail_reg_spacing; +break ; +case VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION : + vport->chunks_info.tx_compl_start_qid = + vport_info->chunks.chunks[i].start_queue_id; + vport->chunks_info.tx_compl_qtail_start = + vport_info->chunks.chunks[i].qtail_reg_start; + vport->chunks_info.tx_compl_qtail_spacing = + vport_info->chunks.chunks[i].qtail_reg_spacing; +break ; +case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER : + vport->chunks_info.rx_buf_start_qid = + vport_info->chunks.chunks[i].start_queue_id; + vport->chunks_info.rx_buf_qtail_start = + vport_info->chunks.chunks[i].qtail_reg_start; + vport->chunks_info.rx_buf_qtail_spacing = + vport_info->chunks.chunks[i].qtail_reg_spacing; +break ; +default : +DRV_LOG (ERR ,"Unsupported queue type" ); +break ; + } + } + + vport->dev_data = dev_data; + + vport->rss_key =rte_zmalloc ("rss_key" , + vport->rss_key_size,0 ); +if (vport->rss_key ==NULL ) { +DRV_LOG (ERR ,"Failed to allocate RSS key" ); + ret = -ENOMEM ; + goto err_rss_key; + } + + vport->rss_lut =rte_zmalloc ("rss_lut" , +sizeof (uint32_t ) * vport->rss_lut_size,0 ); +if (vport->rss_lut ==NULL ) { +DRV_LOG (ERR ,"Failed to allocate RSS lut" ); + ret = -ENOMEM ; + goto err_rss_lut; + } + +return 0 ; + +err_rss_lut: + vport->dev_data =NULL ; +rte_free (vport->rss_key); + vport->rss_key =NULL ; +err_rss_key: +idpf_vc_destroy_vport (vport); +err_create_vport: +return ret; +} +int +idpf_vport_deinit (struct idpf_vport *vport) +{ +rte_free (vport->rss_lut); + vport->rss_lut =NULL ; + +rte_free (vport->rss_key); + vport->rss_key =NULL ; + + vport->dev_data =NULL ; + +idpf_vc_destroy_vport (vport); + +return 0 ; +}RTE_LOG_REGISTER_SUFFIX (idpf_common_logtype, common,NOTICE );
drivers/common/idpf/idpf_common_device.h +12 -1
@@ -9,6 +9,8 @@#include <base/virtchnl2.h> #include <idpf_common_logs.h> +#define IDPF_RSS_KEY_LEN 52 +#define IDPF_CTLQ_ID -1#define IDPF_CTLQ_LEN 64#define IDPF_DFLT_MBX_BUF_SIZE 4096
@@ -43,7 +45,10 @@ struct idpf_chunks_info {struct idpf_vport {struct idpf_adapter *adapter;/* Backreference to associated adapter */ -struct virtchnl2_create_vport *vport_info;/* virtchnl response info handling */ +union { +struct virtchnl2_create_vport info;/* virtchnl response info handling */ +uint8_t data[IDPF_DFLT_MBX_BUF_SIZE ]; + } vport_info;uint16_t sw_idx;/* SW index in adapter->vports[]*/ uint16_t vport_id;uint32_t txq_model;
@@ -142,5 +147,11 @@ __rte_internalint idpf_adapter_init (struct idpf_adapter *adapter);__rte_internal int idpf_adapter_deinit(struct idpf_adapter *adapter); +__rte_internal +int idpf_vport_init(struct idpf_vport *vport, +struct virtchnl2_create_vport *vport_req_info, +void *dev_data); +__rte_internal +int idpf_vport_deinit(struct idpf_vport *vport);#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/idpf_common_virtchnl.c +9 -9
@@ -355,7 +355,7 @@ idpf_vc_get_caps(struct idpf_adapter *adapter)int idpf_vc_create_vport (struct idpf_vport *vport, -struct virtchnl2_create_vport *vport_req_info) +struct virtchnl2_create_vport *create_vport_info) {struct idpf_adapter *adapter = vport->adapter;struct virtchnl2_create_vport vport_msg;
@@ -363,13 +363,13 @@ idpf_vc_create_vport(struct idpf_vport *vport,int err =-1 ;memset (&vport_msg,0 ,sizeof (struct virtchnl2_create_vport )); - vport_msg.vport_type = vport_req_info->vport_type; - vport_msg.txq_model = vport_req_info->txq_model; - vport_msg.rxq_model = vport_req_info->rxq_model; - vport_msg.num_tx_q = vport_req_info->num_tx_q; - vport_msg.num_tx_complq = vport_req_info->num_tx_complq; - vport_msg.num_rx_q = vport_req_info->num_rx_q; - vport_msg.num_rx_bufq = vport_req_info->num_rx_bufq; + vport_msg.vport_type = create_vport_info->vport_type; + vport_msg.txq_model = create_vport_info->txq_model; + vport_msg.rxq_model = create_vport_info->rxq_model; + vport_msg.num_tx_q = create_vport_info->num_tx_q; + vport_msg.num_tx_complq = create_vport_info->num_tx_complq; + vport_msg.num_rx_q = create_vport_info->num_rx_q; + vport_msg.num_rx_bufq = create_vport_info->num_rx_bufq;memset (&args,0 ,sizeof (args)); args.ops =VIRTCHNL2_OP_CREATE_VPORT ;
@@ -385,7 +385,7 @@ idpf_vc_create_vport(struct idpf_vport *vport,return err; } -rte_memcpy (vport->vport_info, args.out_buffer,IDPF_DFLT_MBX_BUF_SIZE ); +rte_memcpy (&(vport->vport_info.info), args.out_buffer,IDPF_DFLT_MBX_BUF_SIZE );return 0 ; }
drivers/common/idpf/version.map +2 -0
@@ -19,6 +19,8 @@ INTERNAL { idpf_vc_set_rss_key; idpf_vc_set_rss_lut; idpf_vc_switch_queue; + idpf_vport_deinit; + idpf_vport_init; local: *; };
drivers/net/idpf/idpf_ethdev.c +10 -128
209 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v7 6/19 common/idpf: add config RSS
In reply to [email protected]From: Beilei Xing <[email protected]>
Move configure RSS to common module.
--- drivers/common/idpf/idpf_common_device.c | 25 +++++++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 2 ++ drivers/common/idpf/version.map | 1 + drivers/net/idpf/idpf_ethdev.c | 26 ------------------------ 4 files changed, 28 insertions(+), 26 deletions(-)
drivers/common/idpf/idpf_common_device.c +25 -0
@@ -273,4 +273,29 @@ idpf_vport_deinit(struct idpf_vport *vport)return 0 ; } +int +idpf_config_rss (struct idpf_vport *vport) +{ +int ret; + + ret =idpf_vc_set_rss_key (vport); +if (ret !=0 ) { +DRV_LOG (ERR ,"Failed to configure RSS key" ); +return ret; + } + + ret =idpf_vc_set_rss_lut (vport); +if (ret !=0 ) { +DRV_LOG (ERR ,"Failed to configure RSS lut" ); +return ret; + } + + ret =idpf_vc_set_rss_hash (vport); +if (ret !=0 ) { +DRV_LOG (ERR ,"Failed to configure RSS hash" ); +return ret; + } + +return ret; +}RTE_LOG_REGISTER_SUFFIX (idpf_common_logtype, common,NOTICE );
drivers/common/idpf/idpf_common_device.h +2 -0
@@ -153,5 +153,7 @@ int idpf_vport_init(struct idpf_vport *vport, void *dev_data);__rte_internal int idpf_vport_deinit(struct idpf_vport *vport); +__rte_internal +int idpf_config_rss(struct idpf_vport *vport);#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/version.map +1 -0
@@ -3,6 +3,7 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + idpf_config_rss; idpf_execute_vc_cmd; idpf_vc_alloc_vectors; idpf_vc_check_api_version;
drivers/net/idpf/idpf_ethdev.c +0 -26
@@ -178,32 +178,6 @@ idpf_init_vport_req_info(struct rte_eth_dev *dev,return 0 ; } -static int -idpf_config_rss (struct idpf_vport *vport) -{ -int ret; - - ret =idpf_vc_set_rss_key (vport); -if (ret !=0 ) { -PMD_INIT_LOG (ERR ,"Failed to configure RSS key" ); -return ret; - } - - ret =idpf_vc_set_rss_lut (vport); -if (ret !=0 ) { -PMD_INIT_LOG (ERR ,"Failed to configure RSS lut" ); -return ret; - } - - ret =idpf_vc_set_rss_hash (vport); -if (ret !=0 ) { -PMD_INIT_LOG (ERR ,"Failed to configure RSS hash" ); -return ret; - } - -return ret; -} -static int idpf_init_rss (struct idpf_vport *vport) {
Signature · 1 line
2.26.2
PATCH v7 7/19 common/idpf: add irq map/unmap
In reply to [email protected]From: Beilei Xing <[email protected]>
Introduce idpf_config_irq_map/idpf_config_irq_unmap functions in common module, and refine config rxq irqs function. Refine device start function with some irq error handling. Besides, vport->stopped should be initialized at the end of the function.
--- drivers/common/idpf/idpf_common_device.c | 102 +++++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 6 ++ drivers/common/idpf/idpf_common_virtchnl.c | 8 -- drivers/common/idpf/idpf_common_virtchnl.h | 6 +- drivers/common/idpf/version.map | 2 + drivers/net/idpf/idpf_ethdev.c | 102 +++------------------ drivers/net/idpf/idpf_ethdev.h | 1 - 7 files changed, 125 insertions(+), 102 deletions(-)
drivers/common/idpf/idpf_common_device.c +102 -0
@@ -247,8 +247,21 @@ idpf_vport_init(struct idpf_vport *vport, goto err_rss_lut; } +/* recv_vectors is used for VIRTCHNL2_OP_ALLOC_VECTORS response, +* reserve maximum size for it now, may need optimization in future. +*/ + vport->recv_vectors =rte_zmalloc ("recv_vectors" ,IDPF_DFLT_MBX_BUF_SIZE ,0 ); +if (vport->recv_vectors ==NULL ) { +DRV_LOG (ERR ,"Failed to allocate recv_vectors" ); + ret = -ENOMEM ; + goto err_recv_vec; + } +return 0 ; +err_recv_vec: +rte_free (vport->rss_lut); + vport->rss_lut =NULL ; err_rss_lut: vport->dev_data =NULL ;rte_free (vport->rss_key);
@@ -261,6 +274,8 @@ idpf_vport_init(struct idpf_vport *vport,int idpf_vport_deinit (struct idpf_vport *vport) { +rte_free (vport->recv_vectors); + vport->recv_vectors =NULL ;rte_free (vport->rss_lut); vport->rss_lut =NULL ;
@@ -298,4 +313,91 @@ idpf_config_rss(struct idpf_vport *vport)return ret; } + +int +idpf_config_irq_map (struct idpf_vport *vport,uint16_t nb_rx_queues) +{ +struct idpf_adapter *adapter = vport->adapter; +struct virtchnl2_queue_vector *qv_map; +struct idpf_hw *hw = &adapter->hw; +uint32_t dynctl_val, itrn_val; +uint32_t dynctl_reg_start; +uint32_t itrn_reg_start; +uint16_t i; +int ret; + + qv_map =rte_zmalloc ("qv_map" , + nb_rx_queues * +sizeof (struct virtchnl2_queue_vector ),0 ); +if (qv_map ==NULL ) { +DRV_LOG (ERR ,"Failed to allocate %d queue-vector map" , + nb_rx_queues); + ret = -ENOMEM ; + goto qv_map_alloc_err; + } + +/* Rx interrupt disabled, Map interrupt only for writeback */ + +/* The capability flags adapter->caps.other_caps should be +* compared with bit VIRTCHNL2_CAP_WB_ON_ITR here. The if +* condition should be updated when the FW can return the +* correct flag bits. +*/ + dynctl_reg_start = + vport->recv_vectors->vchunks.vchunks->dynctl_reg_start; + itrn_reg_start = + vport->recv_vectors->vchunks.vchunks->itrn_reg_start; + dynctl_val =IDPF_READ_REG (hw, dynctl_reg_start); +DRV_LOG (DEBUG ,"Value of dynctl_reg_start is 0x%x" , dynctl_val); + itrn_val =IDPF_READ_REG (hw, itrn_reg_start); +DRV_LOG (DEBUG ,"Value of itrn_reg_start is 0x%x" , itrn_val); +/* Force write-backs by setting WB_ON_ITR bit in DYN_CTL +* register. WB_ON_ITR and INTENA are mutually exclusive +* bits. Setting WB_ON_ITR bits means TX and RX Descs +* are written back based on ITR expiration irrespective +* of INTENA setting. +*/ +/* TBD: need to tune INTERVAL value for better performance. */ + itrn_val = (itrn_val ==0 ) ?IDPF_DFLT_INTERVAL : itrn_val; + dynctl_val =VIRTCHNL2_ITR_IDX_0 << +PF_GLINT_DYN_CTL_ITR_INDX_S | +PF_GLINT_DYN_CTL_WB_ON_ITR_M | + itrn_val <<PF_GLINT_DYN_CTL_INTERVAL_S ; +IDPF_WRITE_REG (hw, dynctl_reg_start, dynctl_val); + +for (i =0 ; i < nb_rx_queues; i++) { +/* map all queues to the same vector */ + qv_map[i].queue_id = vport->chunks_info.rx_start_qid + i; + qv_map[i].vector_id = + vport->recv_vectors->vchunks.vchunks->start_vector_id; + } + vport->qv_map = qv_map; + + ret =idpf_vc_config_irq_map_unmap (vport, nb_rx_queues, true); +if (ret !=0 ) { +DRV_LOG (ERR ,"config interrupt mapping failed" ); + goto config_irq_map_err; + } + +return 0 ; + +config_irq_map_err: +rte_free (vport->qv_map); + vport->qv_map =NULL ; + +qv_map_alloc_err: +return ret; +} + +int +idpf_config_irq_unmap (struct idpf_vport *vport,uint16_t nb_rx_queues) +{ +idpf_vc_config_irq_map_unmap (vport, nb_rx_queues, false); + +rte_free (vport->qv_map); + vport->qv_map =NULL ; + +return 0 ; +} +RTE_LOG_REGISTER_SUFFIX (idpf_common_logtype, common,NOTICE );
drivers/common/idpf/idpf_common_device.h +6 -0
@@ -17,6 +17,8 @@#define IDPF_MAX_PKT_TYPE 1024 +#define IDPF_DFLT_INTERVAL 16 +struct idpf_adapter {struct idpf_hw hw;struct virtchnl2_version_info virtchnl_version;
@@ -155,5 +157,9 @@ __rte_internalint idpf_vport_deinit (struct idpf_vport *vport);__rte_internal int idpf_config_rss(struct idpf_vport *vport); +__rte_internal +int idpf_config_irq_map(struct idpf_vport *vport, uint16_t nb_rx_queues); +__rte_internal +int idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues);#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/idpf_common_virtchnl.c +0 -8
@@ -573,14 +573,6 @@ idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors)if (err !=0 )DRV_LOG (ERR ,"Failed to execute command VIRTCHNL2_OP_ALLOC_VECTORS" ); -if (vport->recv_vectors ==NULL ) { - vport->recv_vectors =rte_zmalloc ("recv_vectors" , len,0 ); -if (vport->recv_vectors ==NULL ) { -rte_free (alloc_vec); -return -ENOMEM ; - } - } -rte_memcpy (vport->recv_vectors, args.out_buffer, len);rte_free (alloc_vec);return err;
drivers/common/idpf/idpf_common_virtchnl.h +3 -3
@@ -23,6 +23,9 @@ int idpf_vc_set_rss_lut(struct idpf_vport *vport);__rte_internal int idpf_vc_set_rss_hash(struct idpf_vport *vport);__rte_internal +int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, +uint16_t nb_rxq,bool map); +__rte_internal int idpf_vc_switch_queue(struct idpf_vport *vport, uint16_t qid,bool rx,bool on); __rte_internal
@@ -30,9 +33,6 @@ int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);__rte_internal int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);__rte_internal -int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, -uint16_t nb_rxq,bool map); -__rte_internal int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors);__rte_internal int idpf_vc_dealloc_vectors(struct idpf_vport *vport);
drivers/common/idpf/version.map +2 -0
@@ -3,6 +3,8 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + idpf_config_irq_map; + idpf_config_irq_unmap; idpf_config_rss; idpf_execute_vc_cmd; idpf_vc_alloc_vectors;
drivers/net/idpf/idpf_ethdev.c +12 -90
149 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +0 -1
@@ -32,7 +32,6 @@#define IDPF_RX_BUFQ_PER_GRP 2#define IDPF_DFLT_Q_VEC_NUM 1 -#define IDPF_DFLT_INTERVAL 16#define IDPF_MIN_BUF_SIZE 1024#define IDPF_MAX_FRAME_SIZE 9728
Signature · 1 line
2.26.2
PATCH v7 8/19 common/idpf: support get packet type
In reply to [email protected]From: Beilei Xing <[email protected]>
Move ptype_tbl field to idpf_adapter structure.
Move get_pkt_type to common module.
--- drivers/common/idpf/idpf_common_device.c | 216 +++++++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 7 + drivers/common/idpf/meson.build | 2 + drivers/net/idpf/idpf_ethdev.c | 6 - drivers/net/idpf/idpf_ethdev.h | 4 - drivers/net/idpf/idpf_rxtx.c | 4 +- drivers/net/idpf/idpf_rxtx.h | 4 - drivers/net/idpf/idpf_rxtx_vec_avx512.c | 3 +- drivers/net/idpf/idpf_vchnl.c | 213 ---------------------- 9 files changed, 228 insertions(+), 231 deletions(-)
drivers/common/idpf/idpf_common_device.c +216 -0
@@ -96,6 +96,216 @@ idpf_init_mbx(struct idpf_hw *hw)return ret; } +static int +idpf_get_pkt_type (struct idpf_adapter *adapter) +{ +struct virtchnl2_get_ptype_info *ptype_info; +uint16_t ptype_offset, i, j; +uint16_t ptype_recvd =0 ; +int ret; + + ret =idpf_vc_query_ptype_info (adapter); +if (ret !=0 ) { +DRV_LOG (ERR ,"Fail to query packet type information" ); +return ret; + } + + ptype_info =rte_zmalloc ("ptype_info" ,IDPF_DFLT_MBX_BUF_SIZE ,0 ); +if (ptype_info ==NULL ) +return -ENOMEM ; + +while (ptype_recvd <IDPF_MAX_PKT_TYPE ) { + ret =idpf_vc_read_one_msg (adapter,VIRTCHNL2_OP_GET_PTYPE_INFO , +IDPF_DFLT_MBX_BUF_SIZE , (uint8_t *)ptype_info); +if (ret !=0 ) { +DRV_LOG (ERR ,"Fail to get packet type information" ); + goto free_ptype_info; + } + + ptype_recvd += ptype_info->num_ptypes; + ptype_offset =sizeof (struct virtchnl2_get_ptype_info ) - +sizeof (struct virtchnl2_ptype ); + +for (i =0 ; i <rte_cpu_to_le_16 (ptype_info->num_ptypes); i++) { +bool is_inner = false, is_ip = false; +struct virtchnl2_ptype *ptype; +uint32_t proto_hdr =0 ; + + ptype = (struct virtchnl2_ptype *) + ((uint8_t *)ptype_info + ptype_offset); + ptype_offset +=IDPF_GET_PTYPE_SIZE (ptype); +if (ptype_offset >IDPF_DFLT_MBX_BUF_SIZE ) { + ret = -EINVAL ; + goto free_ptype_info; + } + +if (rte_cpu_to_le_16 (ptype->ptype_id_10) ==0xFFFF ) + goto free_ptype_info; + +for (j =0 ; j < ptype->proto_id_count; j++) { +switch (rte_cpu_to_le_16 (ptype->proto_id[j])) { +case VIRTCHNL2_PROTO_HDR_GRE : +case VIRTCHNL2_PROTO_HDR_VXLAN : + proto_hdr &= ~RTE_PTYPE_L4_MASK ; + proto_hdr |=RTE_PTYPE_TUNNEL_GRENAT ; + is_inner = true; +break ; +case VIRTCHNL2_PROTO_HDR_MAC : +if (is_inner) { + proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK ; + proto_hdr |=RTE_PTYPE_INNER_L2_ETHER ; + }else { + proto_hdr &= ~RTE_PTYPE_L2_MASK ; + proto_hdr |=RTE_PTYPE_L2_ETHER ; + } +break ; +case VIRTCHNL2_PROTO_HDR_VLAN : +if (is_inner) { + proto_hdr &= ~RTE_PTYPE_INNER_L2_MASK ; + proto_hdr |=RTE_PTYPE_INNER_L2_ETHER_VLAN ; + } +break ; +case VIRTCHNL2_PROTO_HDR_PTP : + proto_hdr &= ~RTE_PTYPE_L2_MASK ; + proto_hdr |=RTE_PTYPE_L2_ETHER_TIMESYNC ; +break ; +case VIRTCHNL2_PROTO_HDR_LLDP : + proto_hdr &= ~RTE_PTYPE_L2_MASK ; + proto_hdr |=RTE_PTYPE_L2_ETHER_LLDP ; +break ; +case VIRTCHNL2_PROTO_HDR_ARP : + proto_hdr &= ~RTE_PTYPE_L2_MASK ; + proto_hdr |=RTE_PTYPE_L2_ETHER_ARP ; +break ; +case VIRTCHNL2_PROTO_HDR_PPPOE : + proto_hdr &= ~RTE_PTYPE_L2_MASK ; + proto_hdr |=RTE_PTYPE_L2_ETHER_PPPOE ; +break ; +case VIRTCHNL2_PROTO_HDR_IPV4 : +if (!is_ip) { + proto_hdr |=RTE_PTYPE_L3_IPV4_EXT_UNKNOWN ; + is_ip = true; + }else { + proto_hdr |=RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | +RTE_PTYPE_TUNNEL_IP ; + is_inner = true; + } +break ; +case VIRTCHNL2_PROTO_HDR_IPV6 : +if (!is_ip) { + proto_hdr |=RTE_PTYPE_L3_IPV6_EXT_UNKNOWN ; + is_ip = true; + }else { + proto_hdr |=RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | +RTE_PTYPE_TUNNEL_IP ; + is_inner = true; + } +break ; +case VIRTCHNL2_PROTO_HDR_IPV4_FRAG : +case VIRTCHNL2_PROTO_HDR_IPV6_FRAG : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_FRAG ; +else + proto_hdr |=RTE_PTYPE_L4_FRAG ; +break ; +case VIRTCHNL2_PROTO_HDR_UDP : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_UDP ; +else + proto_hdr |=RTE_PTYPE_L4_UDP ; +break ; +case VIRTCHNL2_PROTO_HDR_TCP : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_TCP ; +else + proto_hdr |=RTE_PTYPE_L4_TCP ; +break ; +case VIRTCHNL2_PROTO_HDR_SCTP : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_SCTP ; +else + proto_hdr |=RTE_PTYPE_L4_SCTP ; +break ; +case VIRTCHNL2_PROTO_HDR_ICMP : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_ICMP ; +else + proto_hdr |=RTE_PTYPE_L4_ICMP ; +break ; +case VIRTCHNL2_PROTO_HDR_ICMPV6 : +if (is_inner) + proto_hdr |=RTE_PTYPE_INNER_L4_ICMP ; +else + proto_hdr |=RTE_PTYPE_L4_ICMP ; +break ; +case VIRTCHNL2_PROTO_HDR_L2TPV2 : +case VIRTCHNL2_PROTO_HDR_L2TPV2_CONTROL : +case VIRTCHNL2_PROTO_HDR_L2TPV3 : + is_inner = true; + proto_hdr |=RTE_PTYPE_TUNNEL_L2TP ; +break ; +case VIRTCHNL2_PROTO_HDR_NVGRE : + is_inner = true; + proto_hdr |=RTE_PTYPE_TUNNEL_NVGRE ; +break ; +case VIRTCHNL2_PROTO_HDR_GTPC_TEID : + is_inner = true; + proto_hdr |=RTE_PTYPE_TUNNEL_GTPC ; +break ; +case VIRTCHNL2_PROTO_HDR_GTPU : +case VIRTCHNL2_PROTO_HDR_GTPU_UL : +case VIRTCHNL2_PROTO_HDR_GTPU_DL : + is_inner = true; + proto_hdr |=RTE_PTYPE_TUNNEL_GTPU ; +break ; +case VIRTCHNL2_PROTO_HDR_PAY : +case VIRTCHNL2_PROTO_HDR_IPV6_EH : +case VIRTCHNL2_PROTO_HDR_PRE_MAC : +case VIRTCHNL2_PROTO_HDR_POST_MAC : +case VIRTCHNL2_PROTO_HDR_ETHERTYPE : +case VIRTCHNL2_PROTO_HDR_SVLAN : +case VIRTCHNL2_PROTO_HDR_CVLAN : +case VIRTCHNL2_PROTO_HDR_MPLS : +case VIRTCHNL2_PROTO_HDR_MMPLS : +case VIRTCHNL2_PROTO_HDR_CTRL : +case VIRTCHNL2_PROTO_HDR_ECP : +case VIRTCHNL2_PROTO_HDR_EAPOL : +case VIRTCHNL2_PROTO_HDR_PPPOD : +case VIRTCHNL2_PROTO_HDR_IGMP : +case VIRTCHNL2_PROTO_HDR_AH : +case VIRTCHNL2_PROTO_HDR_ESP : +case VIRTCHNL2_PROTO_HDR_IKE : +case VIRTCHNL2_PROTO_HDR_NATT_KEEP : +case VIRTCHNL2_PROTO_HDR_GTP : +case VIRTCHNL2_PROTO_HDR_GTP_EH : +case VIRTCHNL2_PROTO_HDR_GTPCV2 : +case VIRTCHNL2_PROTO_HDR_ECPRI : +case VIRTCHNL2_PROTO_HDR_VRRP : +case VIRTCHNL2_PROTO_HDR_OSPF : +case VIRTCHNL2_PROTO_HDR_TUN : +case VIRTCHNL2_PROTO_HDR_VXLAN_GPE : +case VIRTCHNL2_PROTO_HDR_GENEVE : +case VIRTCHNL2_PROTO_HDR_NSH : +case VIRTCHNL2_PROTO_HDR_QUIC : +case VIRTCHNL2_PROTO_HDR_PFCP : +case VIRTCHNL2_PROTO_HDR_PFCP_NODE : +case VIRTCHNL2_PROTO_HDR_PFCP_SESSION : +case VIRTCHNL2_PROTO_HDR_RTP : +case VIRTCHNL2_PROTO_HDR_NO_PROTO : +default : +continue ; + } + adapter->ptype_tbl[ptype->ptype_id_10] = proto_hdr; + } + } + } + +free_ptype_info: +rte_free (ptype_info); +clear_cmd (adapter); +return ret; +} +int idpf_adapter_init (struct idpf_adapter *adapter) {
@@ -135,6 +345,12 @@ idpf_adapter_init(struct idpf_adapter *adapter) goto err_check_api; } + ret =idpf_get_pkt_type (adapter); +if (ret !=0 ) { +DRV_LOG (ERR ,"Failed to set ptype table" ); + goto err_check_api; + } +return 0 ; err_check_api:
drivers/common/idpf/idpf_common_device.h +7 -0
@@ -5,6 +5,7 @@#ifndef _IDPF_COMMON_DEVICE_H_#define _IDPF_COMMON_DEVICE_H_ +#include <rte_mbuf_ptype.h> #include <base/idpf_prototype.h> #include <base/virtchnl2.h> #include <idpf_common_logs.h>
@@ -19,6 +20,10 @@#define IDPF_DFLT_INTERVAL 16 +#define IDPF_GET_PTYPE_SIZE (p) \ + (sizeof(struct virtchnl2_ptype) + \ + (((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0]))) +struct idpf_adapter {struct idpf_hw hw;struct virtchnl2_version_info virtchnl_version;
@@ -26,6 +31,8 @@ struct idpf_adapter {volatile uint32_t pend_cmd;/* pending command not finished */ uint32_t cmd_retval;/* return value of the cmd response from cp */ uint8_t *mbx_resp;/* buffer to store the mailbox response from cp */ + + uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned; };struct idpf_chunks_info {
drivers/common/idpf/meson.build +2 -0
@@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Intel Corporation +deps += ['mbuf'] + sources = files( 'idpf_common_device.c', 'idpf_common_virtchnl.c',
drivers/net/idpf/idpf_ethdev.c +0 -6
@@ -602,12 +602,6 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a goto err_adapter_init; } - ret =idpf_get_pkt_type (adapter); -if (ret !=0 ) { -PMD_INIT_LOG (ERR ,"Failed to set ptype table" ); - goto err_get_ptype; - } - adapter->max_vport_nb = adapter->base.caps.max_vports; adapter->vports = rte_zmalloc("vports",
drivers/net/idpf/idpf_ethdev.h +0 -4
@@ -89,8 +89,6 @@ struct idpf_adapter_ext {uint16_t used_vecs_num; - uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned; -bool rx_vec_allowed;bool tx_vec_allowed;bool rx_use_avx512;
@@ -107,6 +105,4 @@ TAILQ_HEAD(idpf_adapter_list, idpf_adapter_ext);#define IDPF_ADAPTER_TO_EXT (p) \ container_of((p), struct idpf_adapter_ext, base) -int idpf_get_pkt_type (struct idpf_adapter_ext *adapter); -#endif /* _IDPF_ETHDEV_H_ */
drivers/net/idpf/idpf_rxtx.c +2 -2
@@ -1407,7 +1407,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rx_id_bufq1 = rxq->bufq1->rx_next_avail; rx_id_bufq2 = rxq->bufq2->rx_next_avail; rx_desc_ring = rxq->rx_ring; - ptype_tbl = ad->ptype_tbl; + ptype_tbl = rxq->adapter->ptype_tbl;if ((rxq->offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) !=0 ) rxq->hw_register_set =1 ;
@@ -1812,7 +1812,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; - ptype_tbl = ad->ptype_tbl; + ptype_tbl = rxq->adapter->ptype_tbl;if ((rxq->offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) !=0 ) rxq->hw_register_set =1 ;
drivers/net/idpf/idpf_rxtx.h +0 -4
@@ -82,10 +82,6 @@#define IDPF_TX_OFFLOAD_NOTSUP_MASK \ (RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK) -#define IDPF_GET_PTYPE_SIZE (p) \ - (sizeof(struct virtchnl2_ptype) + \ - (((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0]))) -extern uint64_t idpf_timestamp_dynflag;struct idpf_rx_queue {
drivers/net/idpf/idpf_rxtx_vec_avx512.c +1 -2
@@ -245,8 +245,7 @@ _idpf_singleq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { -struct idpf_adapter_ext *adapter =IDPF_ADAPTER_TO_EXT (rxq->adapter); -const uint32_t *type_table = adapter->ptype_tbl; +const uint32_t *type_table = rxq->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
drivers/net/idpf/idpf_vchnl.c +0 -213
219 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v7 9/19 common/idpf: add vport info initialization
In reply to [email protected]From: Beilei Xing <[email protected]>
Move queue module fields from idpf_adapter_ext structure to idpf_adapter structure.
Refine some parameter and function name, and move function idpf_create_vport_info_init to common module.
--- drivers/common/idpf/idpf_common_device.c | 36 ++++++++++++++++++ drivers/common/idpf/idpf_common_device.h | 11 ++++++ drivers/common/idpf/version.map | 1 + drivers/net/idpf/idpf_ethdev.c | 48 +++--------------------- drivers/net/idpf/idpf_ethdev.h | 8 ---- 5 files changed, 54 insertions(+), 50 deletions(-)
drivers/common/idpf/idpf_common_device.c +36 -0
@@ -616,4 +616,40 @@ idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues)return 0 ; } +int +idpf_create_vport_info_init (struct idpf_vport *vport, +struct virtchnl2_create_vport *vport_info) +{ +struct idpf_adapter *adapter = vport->adapter; + + vport_info->vport_type =rte_cpu_to_le_16 (VIRTCHNL2_VPORT_TYPE_DEFAULT ); +if (adapter->txq_model ==0 ) { + vport_info->txq_model = +rte_cpu_to_le_16 (VIRTCHNL2_QUEUE_MODEL_SPLIT ); + vport_info->num_tx_q = +rte_cpu_to_le_16 (IDPF_DEFAULT_TXQ_NUM ); + vport_info->num_tx_complq = +rte_cpu_to_le_16 (IDPF_DEFAULT_TXQ_NUM *IDPF_TX_COMPLQ_PER_GRP ); + }else { + vport_info->txq_model = +rte_cpu_to_le_16 (VIRTCHNL2_QUEUE_MODEL_SINGLE ); + vport_info->num_tx_q =rte_cpu_to_le_16 (IDPF_DEFAULT_TXQ_NUM ); + vport_info->num_tx_complq =0 ; + } +if (adapter->rxq_model ==0 ) { + vport_info->rxq_model = +rte_cpu_to_le_16 (VIRTCHNL2_QUEUE_MODEL_SPLIT ); + vport_info->num_rx_q =rte_cpu_to_le_16 (IDPF_DEFAULT_RXQ_NUM ); + vport_info->num_rx_bufq = +rte_cpu_to_le_16 (IDPF_DEFAULT_RXQ_NUM *IDPF_RX_BUFQ_PER_GRP ); + }else { + vport_info->rxq_model = +rte_cpu_to_le_16 (VIRTCHNL2_QUEUE_MODEL_SINGLE ); + vport_info->num_rx_q =rte_cpu_to_le_16 (IDPF_DEFAULT_RXQ_NUM ); + vport_info->num_rx_bufq =0 ; + } + +return 0 ; +} +RTE_LOG_REGISTER_SUFFIX (idpf_common_logtype, common,NOTICE );
drivers/common/idpf/idpf_common_device.h +11 -0
@@ -16,6 +16,11 @@#define IDPF_CTLQ_LEN 64#define IDPF_DFLT_MBX_BUF_SIZE 4096 +#define IDPF_DEFAULT_RXQ_NUM 16 +#define IDPF_RX_BUFQ_PER_GRP 2 +#define IDPF_DEFAULT_TXQ_NUM 16 +#define IDPF_TX_COMPLQ_PER_GRP 1 +#define IDPF_MAX_PKT_TYPE 1024#define IDPF_DFLT_INTERVAL 16
@@ -33,6 +38,9 @@ struct idpf_adapter {uint8_t *mbx_resp;/* buffer to store the mailbox response from cp */ uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned; + +uint32_t txq_model;/* 0 - split queue model, non-0 - single queue model */ +uint32_t rxq_model;/* 0 - split queue model, non-0 - single queue model */ };struct idpf_chunks_info {
@@ -168,5 +176,8 @@ __rte_internalint idpf_config_irq_map (struct idpf_vport *vport,uint16_t nb_rx_queues);__rte_internal int idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues); +__rte_internal +int idpf_create_vport_info_init(struct idpf_vport *vport, +struct virtchnl2_create_vport *vport_info);#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/version.map +1 -0
@@ -6,6 +6,7 @@ INTERNAL { idpf_config_irq_map; idpf_config_irq_unmap; idpf_config_rss; + idpf_create_vport_info_init; idpf_execute_vc_cmd; idpf_vc_alloc_vectors; idpf_vc_check_api_version;
drivers/net/idpf/idpf_ethdev.c +6 -42
81 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +0 -8
@@ -22,14 +22,9 @@#define IDPF_MAX_VPORT_NUM 8 -#define IDPF_DEFAULT_RXQ_NUM 16 -#define IDPF_DEFAULT_TXQ_NUM 16 -#define IDPF_INVALID_VPORT_IDX 0xffff#define IDPF_TXQ_PER_GRP 1 -#define IDPF_TX_COMPLQ_PER_GRP 1#define IDPF_RXQ_PER_GRP 1 -#define IDPF_RX_BUFQ_PER_GRP 2#define IDPF_DFLT_Q_VEC_NUM 1
@@ -78,9 +73,6 @@ struct idpf_adapter_ext {char name[IDPF_ADAPTER_NAME_LEN ]; -uint32_t txq_model;/* 0 - split queue model, non-0 - single queue model */ -uint32_t rxq_model;/* 0 - split queue model, non-0 - single queue model */ -struct idpf_vport **vports;uint16_t max_vport_nb;
Signature · 1 line
2.26.2
PATCH v7 10/19 common/idpf: add vector flags in vport
In reply to [email protected]From: Beilei Xing <[email protected]>
Move vector flags from idpf_adapter_ext structure to idpf_vport structure.
--- drivers/common/idpf/idpf_common_device.h | 5 +++++ drivers/net/idpf/idpf_ethdev.h | 5 ----- drivers/net/idpf/idpf_rxtx.c | 22 ++++++++++------------ 3 files changed, 15 insertions(+), 17 deletions(-)
drivers/common/idpf/idpf_common_device.h +5 -0
@@ -103,6 +103,11 @@ struct idpf_vport {uint16_t devarg_id;bool stopped; + +bool rx_vec_allowed; +bool tx_vec_allowed; +bool rx_use_avx512; +bool tx_use_avx512; };/* Message type read in virtual channel from PF */
drivers/net/idpf/idpf_ethdev.h +0 -5
@@ -81,11 +81,6 @@ struct idpf_adapter_ext {uint16_t used_vecs_num; -bool rx_vec_allowed; -bool tx_vec_allowed; -bool rx_use_avx512; -bool tx_use_avx512; -/* For PTP */ uint64_t time_hw; };
drivers/net/idpf/idpf_rxtx.c +10 -12
@@ -2221,25 +2221,24 @@ idpf_set_rx_function(struct rte_eth_dev *dev) {struct idpf_vport *vport = dev->data->dev_private;#ifdef RTE_ARCH_X86 -struct idpf_adapter_ext *ad =IDPF_ADAPTER_TO_EXT (vport->adapter);struct idpf_rx_queue *rxq;int i;if (idpf_rx_vec_dev_check_default (dev) ==IDPF_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { - ad->rx_vec_allowed = true; + vport->rx_vec_allowed = true; if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512BW ) ==1 ) - ad->rx_use_avx512 = true; + vport->rx_use_avx512 = true;#else PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif /* CC_AVX512_SUPPORT */ }else { - ad->rx_vec_allowed = false; + vport->rx_vec_allowed = false; }#endif /* RTE_ARCH_X86 */
@@ -2247,13 +2246,13 @@ idpf_set_rx_function(struct rte_eth_dev *dev)if (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SPLIT ) { dev->rx_pkt_burst = idpf_splitq_recv_pkts; }else { -if (ad->rx_vec_allowed) { +if (vport->rx_vec_allowed) {for (i =0 ; i < dev->data->nb_tx_queues; i++) { rxq = dev->data->rx_queues[i]; (void )idpf_singleq_rx_vec_setup (rxq); }#ifdef CC_AVX512_SUPPORT -if (ad->rx_use_avx512) { +if (vport->rx_use_avx512) { dev->rx_pkt_burst = idpf_singleq_recv_pkts_avx512;return ; }
@@ -2275,7 +2274,6 @@ idpf_set_tx_function(struct rte_eth_dev *dev) {struct idpf_vport *vport = dev->data->dev_private;#ifdef RTE_ARCH_X86 -struct idpf_adapter_ext *ad =IDPF_ADAPTER_TO_EXT (vport->adapter);#ifdef CC_AVX512_SUPPORT struct idpf_tx_queue *txq;int i;
@@ -2283,18 +2281,18 @@ idpf_set_tx_function(struct rte_eth_dev *dev)if (idpf_rx_vec_dev_check_default (dev) ==IDPF_VECTOR_PATH &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { - ad->tx_vec_allowed = true; + vport->tx_vec_allowed = true; if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512BW ) ==1 ) - ad->tx_use_avx512 = true; + vport->tx_use_avx512 = true;#else PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif /* CC_AVX512_SUPPORT */ }else { - ad->tx_vec_allowed = false; + vport->tx_vec_allowed = false; }#endif /* RTE_ARCH_X86 */
@@ -2303,9 +2301,9 @@ idpf_set_tx_function(struct rte_eth_dev *dev) dev->tx_pkt_prepare = idpf_prep_pkts; } else { #ifdef RTE_ARCH_X86 - if (ad->tx_vec_allowed) { + if (vport->tx_vec_allowed) { #ifdef CC_AVX512_SUPPORT - if (ad->tx_use_avx512) { + if (vport->tx_use_avx512) { for (i = 0; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i]; if (txq == NULL)
Signature · 1 line
2.26.2
PATCH v7 11/19 common/idpf: add rxq and txq struct
In reply to [email protected]From: Beilei Xing <[email protected]>
Add idpf_rxq and idpf_txq structure in common module. Move idpf_vc_config_rxq and idpf_vc_config_txq functions to common module.
--- drivers/common/idpf/idpf_common_device.h | 2 + drivers/common/idpf/idpf_common_rxtx.h | 112 +++++++++++++ drivers/common/idpf/idpf_common_virtchnl.c | 160 ++++++++++++++++++ drivers/common/idpf/idpf_common_virtchnl.h | 10 +- drivers/common/idpf/version.map | 2 + drivers/net/idpf/idpf_ethdev.h | 2 - drivers/net/idpf/idpf_rxtx.h | 97 +---------- drivers/net/idpf/idpf_vchnl.c | 184 --------------------- drivers/net/idpf/meson.build | 1 - 9 files changed, 284 insertions(+), 286 deletions(-) create mode 100644 drivers/common/idpf/idpf_common_rxtx.h delete mode 100644 drivers/net/idpf/idpf_vchnl.c
drivers/common/idpf/idpf_common_device.h +2 -0
@@ -18,8 +18,10 @@#define IDPF_DEFAULT_RXQ_NUM 16#define IDPF_RX_BUFQ_PER_GRP 2 +#define IDPF_RXQ_PER_GRP 1#define IDPF_DEFAULT_TXQ_NUM 16#define IDPF_TX_COMPLQ_PER_GRP 1 +#define IDPF_TXQ_PER_GRP 1#define IDPF_MAX_PKT_TYPE 1024
drivers/common/idpf/idpf_common_rxtx.h new file +112 -0
112 lines not on this page · raw message
drivers/common/idpf/idpf_common_virtchnl.c +160 -0
163 lines not on this page · raw message
drivers/common/idpf/idpf_common_virtchnl.h +7 -3
@@ -6,6 +6,7 @@#define _IDPF_COMMON_VIRTCHNL_H_#include <idpf_common_device.h> +#include <idpf_common_rxtx.h> __rte_internal int idpf_vc_check_api_version(struct idpf_adapter *adapter);
@@ -26,6 +27,9 @@ __rte_internalint idpf_vc_config_irq_map_unmap (struct idpf_vport *vport,uint16_t nb_rxq,bool map);__rte_internal +int idpf_execute_vc_cmd(struct idpf_adapter *adapter, +struct idpf_cmd_info *args); +__rte_internal int idpf_vc_switch_queue(struct idpf_vport *vport, uint16_t qid,bool rx,bool on); __rte_internal
@@ -42,7 +46,7 @@ __rte_internalint idpf_vc_read_one_msg (struct idpf_adapter *adapter,uint32_t ops,uint16_t buf_len,uint8_t *buf);__rte_internal -int idpf_execute_vc_cmd(struct idpf_adapter *adapter, -struct idpf_cmd_info *args); - +int idpf_vc_config_rxq(struct idpf_vport *vport, struct idpf_rx_queue *rxq); +__rte_internal +int idpf_vc_config_txq(struct idpf_vport *vport, struct idpf_tx_queue *txq);#endif /* _IDPF_COMMON_VIRTCHNL_H_ */
drivers/common/idpf/version.map +2 -0
@@ -11,6 +11,8 @@ INTERNAL { idpf_vc_alloc_vectors; idpf_vc_check_api_version; idpf_vc_config_irq_map_unmap; + idpf_vc_config_rxq; + idpf_vc_config_txq; idpf_vc_create_vport; idpf_vc_dealloc_vectors; idpf_vc_destroy_vport;
drivers/net/idpf/idpf_ethdev.h +0 -2
@@ -23,8 +23,6 @@#define IDPF_MAX_VPORT_NUM 8#define IDPF_INVALID_VPORT_IDX 0xffff -#define IDPF_TXQ_PER_GRP 1 -#define IDPF_RXQ_PER_GRP 1#define IDPF_DFLT_Q_VEC_NUM 1
drivers/net/idpf/idpf_rxtx.h +1 -96
119 lines not on this page · raw message
drivers/net/idpf/idpf_vchnl.c deleted +0 -184
184 lines not on this page · raw message
drivers/net/idpf/meson.build +0 -1
@@ -18,7 +18,6 @@ deps += ['common_idpf'] sources = files( 'idpf_ethdev.c', 'idpf_rxtx.c', - 'idpf_vchnl.c', ) if arch_subdir == 'x86'
Signature · 1 line
2.26.2
PATCH v7 12/19 common/idpf: add help functions for queue setup and release
In reply to [email protected]From: Beilei Xing <[email protected]>
Refine rxq setup and txq setup.
Move some help functions of queue setup and queue release to common module.
--- drivers/common/idpf/idpf_common_rxtx.c | 414 +++++++++ drivers/common/idpf/idpf_common_rxtx.h | 57 ++ drivers/common/idpf/meson.build | 1 + drivers/common/idpf/version.map | 15 + drivers/net/idpf/idpf_rxtx.c | 1051 ++++++----------------- drivers/net/idpf/idpf_rxtx.h | 9 - drivers/net/idpf/idpf_rxtx_vec_avx512.c | 2 +- 7 files changed, 773 insertions(+), 776 deletions(-) create mode 100644 drivers/common/idpf/idpf_common_rxtx.c
drivers/common/idpf/idpf_common_rxtx.c new file +414 -0
@@ -0,0 +1,414 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Intel Corporation +*/ + +#include <rte_mbuf_dyn.h> +#include "idpf_common_rxtx.h" + +int +idpf_check_rx_thresh (uint16_t nb_desc,uint16_t thresh) +{ +/* The following constraints must be satisfied: +* thresh < rxq->nb_rx_desc +*/ +if (thresh >= nb_desc) { +DRV_LOG (ERR ,"rx_free_thresh (%u) must be less than %u" , + thresh, nb_desc); +return -EINVAL ; + } + +return 0 ; +} + +int +idpf_check_tx_thresh (uint16_t nb_desc,uint16_t tx_rs_thresh, +uint16_t tx_free_thresh) +{ +/* TX descriptors will have their RS bit set after tx_rs_thresh +* descriptors have been used. The TX descriptor ring will be cleaned +* after tx_free_thresh descriptors are used or if the number of +* descriptors required to transmit a packet is greater than the +* number of free TX descriptors. +* +* The following constraints must be satisfied: +* - tx_rs_thresh must be less than the size of the ring minus 2. +* - tx_free_thresh must be less than the size of the ring minus 3. +* - tx_rs_thresh must be less than or equal to tx_free_thresh. +* - tx_rs_thresh must be a divisor of the ring size. +* +* One descriptor in the TX ring is used as a sentinel to avoid a H/W +* race condition, hence the maximum threshold constraints. When set +* to zero use default values. +*/ +if (tx_rs_thresh >= (nb_desc -2 )) { +DRV_LOG (ERR ,"tx_rs_thresh (%u) must be less than the " +"number of TX descriptors (%u) minus 2" , + tx_rs_thresh, nb_desc); +return -EINVAL ; + } +if (tx_free_thresh >= (nb_desc -3 )) { +DRV_LOG (ERR ,"tx_free_thresh (%u) must be less than the " +"number of TX descriptors (%u) minus 3." , + tx_free_thresh, nb_desc); +return -EINVAL ; + } +if (tx_rs_thresh > tx_free_thresh) { +DRV_LOG (ERR ,"tx_rs_thresh (%u) must be less than or " +"equal to tx_free_thresh (%u)." , + tx_rs_thresh, tx_free_thresh); +return -EINVAL ; + } +if ((nb_desc % tx_rs_thresh) !=0 ) { +DRV_LOG (ERR ,"tx_rs_thresh (%u) must be a divisor of the " +"number of TX descriptors (%u)." , + tx_rs_thresh, nb_desc); +return -EINVAL ; + } + +return 0 ; +} + +void +idpf_release_rxq_mbufs (struct idpf_rx_queue *rxq) +{ +uint16_t i; + +if (rxq->sw_ring ==NULL ) +return ; + +for (i =0 ; i < rxq->nb_rx_desc; i++) { +if (rxq->sw_ring[i] !=NULL ) { +rte_pktmbuf_free_seg (rxq->sw_ring[i]); + rxq->sw_ring[i] =NULL ; + } + } +} + +void +idpf_release_txq_mbufs (struct idpf_tx_queue *txq) +{ +uint16_t nb_desc, i; + +if (txq ==NULL || txq->sw_ring ==NULL ) { +DRV_LOG (DEBUG ,"Pointer to rxq or sw_ring is NULL" ); +return ; + } + +if (txq->sw_nb_desc !=0 ) { +/* For split queue model, descriptor ring */ + nb_desc = txq->sw_nb_desc; + }else { +/* For single queue model */ + nb_desc = txq->nb_tx_desc; + } +for (i =0 ; i < nb_desc; i++) { +if (txq->sw_ring[i].mbuf !=NULL ) { +rte_pktmbuf_free_seg (txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf =NULL ; + } + } +} + +void +idpf_reset_split_rx_descq (struct idpf_rx_queue *rxq) +{ +uint16_t len; +uint32_t i; + +if (rxq ==NULL ) +return ; + + len = rxq->nb_rx_desc +IDPF_RX_MAX_BURST ; + +for (i =0 ; i < len *sizeof (struct virtchnl2_rx_flex_desc_adv_nic_3 ); + i++) + ((volatile char *)rxq->rx_ring)[i] =0 ; + + rxq->rx_tail =0 ; + rxq->expected_gen_id =1 ; +} + +void +idpf_reset_split_rx_bufq (struct idpf_rx_queue *rxq) +{ +uint16_t len; +uint32_t i; + +if (rxq ==NULL ) +return ; + + len = rxq->nb_rx_desc +IDPF_RX_MAX_BURST ; + +for (i =0 ; i < len *sizeof (struct virtchnl2_splitq_rx_buf_desc ); + i++) + ((volatile char *)rxq->rx_ring)[i] =0 ; + +memset (&rxq->fake_mbuf,0x0 ,sizeof (rxq->fake_mbuf)); + +for (i =0 ; i <IDPF_RX_MAX_BURST ; i++) + rxq->sw_ring[rxq->nb_rx_desc + i] = &rxq->fake_mbuf; + +/* The next descriptor id which can be received. */ + rxq->rx_next_avail =0 ; + +/* The next descriptor id which can be refilled. */ + rxq->rx_tail =0 ; +/* The number of descriptors which can be refilled. */ + rxq->nb_rx_hold = rxq->nb_rx_desc -1 ; + + rxq->bufq1 =NULL ; + rxq->bufq2 =NULL ; +} + +void +idpf_reset_split_rx_queue (struct idpf_rx_queue *rxq) +{ +idpf_reset_split_rx_descq (rxq); +idpf_reset_split_rx_bufq (rxq->bufq1); +idpf_reset_split_rx_bufq (rxq->bufq2); +} + +void +idpf_reset_single_rx_queue (struct idpf_rx_queue *rxq) +{ +uint16_t len; +uint32_t i; + +if (rxq ==NULL ) +return ; + + len = rxq->nb_rx_desc +IDPF_RX_MAX_BURST ; + +for (i =0 ; i < len *sizeof (struct virtchnl2_singleq_rx_buf_desc ); + i++) + ((volatile char *)rxq->rx_ring)[i] =0 ; + +memset (&rxq->fake_mbuf,0x0 ,sizeof (rxq->fake_mbuf)); + +for (i =0 ; i <IDPF_RX_MAX_BURST ; i++) + rxq->sw_ring[rxq->nb_rx_desc + i] = &rxq->fake_mbuf; + + rxq->rx_tail =0 ; + rxq->nb_rx_hold =0 ; + +rte_pktmbuf_free (rxq->pkt_first_seg); + + rxq->pkt_first_seg =NULL ; + rxq->pkt_last_seg =NULL ; + rxq->rxrearm_start =0 ; + rxq->rxrearm_nb =0 ; +} + +void +idpf_reset_split_tx_descq (struct idpf_tx_queue *txq) +{ +struct idpf_tx_entry *txe; +uint32_t i, size; +uint16_t prev; + +if (txq ==NULL ) { +DRV_LOG (DEBUG ,"Pointer to txq is NULL" ); +return ; + } + + size =sizeof (struct idpf_flex_tx_sched_desc ) * txq->nb_tx_desc; +for (i =0 ; i < size; i++) + ((volatile char *)txq->desc_ring)[i] =0 ; + + txe = txq->sw_ring; + prev = (uint16_t )(txq->sw_nb_desc -1 ); +for (i =0 ; i < txq->sw_nb_desc; i++) { + txe[i].mbuf =NULL ; + txe[i].last_id = i; + txe[prev].next_id = i; + prev = i; + } + + txq->tx_tail =0 ; + txq->nb_used =0 ; + +/* Use this as next to clean for split desc queue */ + txq->last_desc_cleaned =0 ; + txq->sw_tail =0 ; + txq->nb_free = txq->nb_tx_desc -1 ; +} + +void +idpf_reset_split_tx_complq (struct idpf_tx_queue *cq) +{ +uint32_t i, size; + +if (cq ==NULL ) { +DRV_LOG (DEBUG ,"Pointer to complq is NULL" ); +return ; + } + + size =sizeof (struct idpf_splitq_tx_compl_desc ) * cq->nb_tx_desc; +for (i =0 ; i < size; i++) + ((volatile char *)cq->compl_ring)[i] =0 ; + + cq->tx_tail =0 ; + cq->expected_gen_id =1 ; +} + +void +idpf_reset_single_tx_queue (struct idpf_tx_queue *txq) +{ +struct idpf_tx_entry *txe; +uint32_t i, size; +uint16_t prev; + +if (txq ==NULL ) { +DRV_LOG (DEBUG ,"Pointer to txq is NULL" ); +return ; + } + + txe = txq->sw_ring; + size =sizeof (struct idpf_flex_tx_desc ) * txq->nb_tx_desc; +for (i =0 ; i < size; i++) + ((volatile char *)txq->tx_ring)[i] =0 ; + + prev = (uint16_t )(txq->nb_tx_desc -1 ); +for (i =0 ; i < txq->nb_tx_desc; i++) { + txq->tx_ring[i].qw1.cmd_dtype = +rte_cpu_to_le_16 (IDPF_TX_DESC_DTYPE_DESC_DONE ); + txe[i].mbuf =NULL ; + txe[i].last_id = i; + txe[prev].next_id = i; + prev = i; + } + + txq->tx_tail =0 ; + txq->nb_used =0 ; + + txq->last_desc_cleaned = txq->nb_tx_desc -1 ; + txq->nb_free = txq->nb_tx_desc -1 ; + + txq->next_dd = txq->rs_thresh -1 ; + txq->next_rs = txq->rs_thresh -1 ; +} + +void +idpf_rx_queue_release (void *rxq) +{ +struct idpf_rx_queue *q = rxq; + +if (q ==NULL ) +return ; + +/* Split queue */ +if (q->bufq1 !=NULL && q->bufq2 !=NULL ) { + q->bufq1->ops->release_mbufs (q->bufq1); +rte_free (q->bufq1->sw_ring); +rte_memzone_free (q->bufq1->mz); +rte_free (q->bufq1); + q->bufq2->ops->release_mbufs (q->bufq2); +rte_free (q->bufq2->sw_ring); +rte_memzone_free (q->bufq2->mz); +rte_free (q->bufq2); +rte_memzone_free (q->mz); +rte_free (q); +return ; + } + +/* Single queue */ + q->ops->release_mbufs (q); +rte_free (q->sw_ring); +rte_memzone_free (q->mz); +rte_free (q); +} + +void +idpf_tx_queue_release (void *txq) +{ +struct idpf_tx_queue *q = txq; + +if (q ==NULL ) +return ; + +if (q->complq) { +rte_memzone_free (q->complq->mz); +rte_free (q->complq); + } + + q->ops->release_mbufs (q); +rte_free (q->sw_ring); +rte_memzone_free (q->mz); +rte_free (q); +} + +int +idpf_alloc_single_rxq_mbufs (struct idpf_rx_queue *rxq) +{ +volatile struct virtchnl2_singleq_rx_buf_desc *rxd; +struct rte_mbuf *mbuf =NULL ; +uint64_t dma_addr; +uint16_t i; + +for (i =0 ; i < rxq->nb_rx_desc; i++) { + mbuf =rte_mbuf_raw_alloc (rxq->mp); +if (unlikely (mbuf ==NULL )) { +DRV_LOG (ERR ,"Failed to allocate mbuf for RX" ); +return -ENOMEM ; + } + +rte_mbuf_refcnt_set (mbuf,1 ); + mbuf->next =NULL ; + mbuf->data_off =RTE_PKTMBUF_HEADROOM ; + mbuf->nb_segs =1 ; + mbuf->port = rxq->port_id; + + dma_addr = +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf)); + + rxd = &((volatile struct virtchnl2_singleq_rx_buf_desc *)(rxq->rx_ring))[i]; + rxd->pkt_addr = dma_addr; + rxd->hdr_addr =0 ; + rxd->rsvd1 =0 ; + rxd->rsvd2 =0 ; + rxq->sw_ring[i] = mbuf; + } + +return 0 ; +} + +int +idpf_alloc_split_rxq_mbufs (struct idpf_rx_queue *rxq) +{ +volatile struct virtchnl2_splitq_rx_buf_desc *rxd; +struct rte_mbuf *mbuf =NULL ; +uint64_t dma_addr; +uint16_t i; + +for (i =0 ; i < rxq->nb_rx_desc; i++) { + mbuf =rte_mbuf_raw_alloc (rxq->mp); +if (unlikely (mbuf ==NULL )) { +DRV_LOG (ERR ,"Failed to allocate mbuf for RX" ); +return -ENOMEM ; + } + +rte_mbuf_refcnt_set (mbuf,1 ); + mbuf->next =NULL ; + mbuf->data_off =RTE_PKTMBUF_HEADROOM ; + mbuf->nb_segs =1 ; + mbuf->port = rxq->port_id; + + dma_addr = +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf)); + + rxd = &((volatile struct virtchnl2_splitq_rx_buf_desc *)(rxq->rx_ring))[i]; + rxd->qword0.buf_id = i; + rxd->qword0.rsvd0 =0 ; + rxd->qword0.rsvd1 =0 ; + rxd->pkt_addr = dma_addr; + rxd->hdr_addr =0 ; + rxd->rsvd2 =0 ; + + rxq->sw_ring[i] = mbuf; + } + + rxq->nb_rx_hold =0 ; + rxq->rx_tail = rxq->nb_rx_desc -1 ; + +return 0 ; +}
drivers/common/idpf/idpf_common_rxtx.h +57 -0
72 lines not on this page · raw message
drivers/common/idpf/meson.build +1 -0
@@ -5,6 +5,7 @@ deps += ['mbuf'] sources = files( 'idpf_common_device.c', + 'idpf_common_rxtx.c', 'idpf_common_virtchnl.c', )
drivers/common/idpf/version.map +15 -0
@@ -3,11 +3,26 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + idpf_alloc_single_rxq_mbufs; + idpf_alloc_split_rxq_mbufs; + idpf_check_rx_thresh; + idpf_check_tx_thresh; idpf_config_irq_map; idpf_config_irq_unmap; idpf_config_rss; idpf_create_vport_info_init; idpf_execute_vc_cmd; + idpf_release_rxq_mbufs; + idpf_release_txq_mbufs; + idpf_reset_single_rx_queue; + idpf_reset_single_tx_queue; + idpf_reset_split_rx_bufq; + idpf_reset_split_rx_descq; + idpf_reset_split_rx_queue; + idpf_reset_split_tx_complq; + idpf_reset_split_tx_descq; + idpf_rx_queue_release; + idpf_tx_queue_release; idpf_vc_alloc_vectors; idpf_vc_check_api_version; idpf_vc_config_irq_map_unmap;
drivers/net/idpf/idpf_rxtx.c +285 -766
1,268 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.h +0 -9
@@ -51,7 +51,6 @@/* Base address of the HW descriptor ring should be 128B aligned. */ #define IDPF_RING_BASE_ALIGN 128 -#define IDPF_RX_MAX_BURST 32#define IDPF_DEFAULT_RX_FREE_THRESH 32/* used for Vector PMD */
@@ -101,14 +100,6 @@ union idpf_tx_offload { }; }; -struct idpf_rxq_ops { -void (*release_mbufs)(struct idpf_rx_queue *rxq); -}; - -struct idpf_txq_ops { -void (*release_mbufs)(struct idpf_tx_queue *txq); -}; - int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf,
drivers/net/idpf/idpf_rxtx_vec_avx512.c +1 -1
@@ -562,7 +562,7 @@ idpf_tx_free_bufs_avx512(struct idpf_tx_queue *txq) txep = (void *)txq->sw_ring; txep += txq->next_dd - (n -1 ); -if (txq->offloads &RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE && (n &31 ) ==0 ) { +if (txq->offloads &IDPF_TX_OFFLOAD_MBUF_FAST_FREE && (n &31 ) ==0 ) {struct rte_mempool *mp = txep[0 ].mbuf->pool;struct rte_mempool_cache *cache =rte_mempool_default_cache (mp,rte_lcore_id ());
Signature · 1 line
2.26.2
PATCH v7 13/19 common/idpf: add Rx and Tx data path
In reply to [email protected]From: Beilei Xing <[email protected]>
Add timestamp filed to idpf_adapter structure.
Move scalar Rx/Tx data path for both single queue and split queue to common module.
--- drivers/common/idpf/idpf_common_device.h | 5 + drivers/common/idpf/idpf_common_logs.h | 24 + drivers/common/idpf/idpf_common_rxtx.c | 987 +++++++++++++++++++++++ drivers/common/idpf/idpf_common_rxtx.h | 87 ++ drivers/common/idpf/version.map | 6 + drivers/net/idpf/idpf_ethdev.c | 2 - drivers/net/idpf/idpf_ethdev.h | 4 - drivers/net/idpf/idpf_logs.h | 24 - drivers/net/idpf/idpf_rxtx.c | 937 +-------------------- drivers/net/idpf/idpf_rxtx.h | 132 --- drivers/net/idpf/idpf_rxtx_vec_avx512.c | 8 +- 11 files changed, 1114 insertions(+), 1102 deletions(-)
drivers/common/idpf/idpf_common_device.h +5 -0
@@ -23,6 +23,8 @@#define IDPF_TX_COMPLQ_PER_GRP 1#define IDPF_TXQ_PER_GRP 1 +#define IDPF_MIN_FRAME_SIZE 14 +#define IDPF_MAX_PKT_TYPE 1024#define IDPF_DFLT_INTERVAL 16
@@ -43,6 +45,9 @@ struct idpf_adapter {uint32_t txq_model;/* 0 - split queue model, non-0 - single queue model */ uint32_t rxq_model;/* 0 - split queue model, non-0 - single queue model */ + +/* For timestamp */ +uint64_t time_hw; };struct idpf_chunks_info {
drivers/common/idpf/idpf_common_logs.h +24 -0
@@ -20,4 +20,28 @@ extern int idpf_common_logtype; #define DRV_LOG(level, fmt, args...) \ DRV_LOG_RAW(level, fmt "\n", ## args) +#ifdef RTE_LIBRTE_IDPF_DEBUG_RX +#define RX_LOG (level, ...) \ + RTE_LOG(level, \ + PMD, \ + RTE_FMT("%s(): " \ + RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + __func__, \ + RTE_FMT_TAIL(__VA_ARGS__,))) +#else +#define RX_LOG(level, fmt, args...) do { } while (0) +#endif + +#ifdef RTE_LIBRTE_IDPF_DEBUG_TX +#define TX_LOG (level, ...) \ + RTE_LOG(level, \ + PMD, \ + RTE_FMT("%s(): " \ + RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + __func__, \ + RTE_FMT_TAIL(__VA_ARGS__,))) +#else +#define TX_LOG(level, fmt, args...) do { } while (0) +#endif +#endif /* _IDPF_COMMON_LOGS_H_ */
drivers/common/idpf/idpf_common_rxtx.c +987 -0
1,004 lines not on this page · raw message
drivers/common/idpf/idpf_common_rxtx.h +87 -0
113 lines not on this page · raw message
drivers/common/idpf/version.map +6 -0
@@ -12,6 +12,8 @@ INTERNAL { idpf_config_rss; idpf_create_vport_info_init; idpf_execute_vc_cmd; + idpf_prep_pkts; + idpf_register_ts_mbuf; idpf_release_rxq_mbufs; idpf_release_txq_mbufs; idpf_reset_single_rx_queue;
@@ -22,6 +24,10 @@ INTERNAL { idpf_reset_split_tx_complq; idpf_reset_split_tx_descq; idpf_rx_queue_release; + idpf_singleq_recv_pkts; + idpf_singleq_xmit_pkts; + idpf_splitq_recv_pkts; + idpf_splitq_xmit_pkts; idpf_tx_queue_release; idpf_vc_alloc_vectors; idpf_vc_check_api_version;
drivers/net/idpf/idpf_ethdev.c +0 -2
@@ -22,8 +22,6 @@ rte_spinlock_t idpf_adapter_lock;struct idpf_adapter_list idpf_adapter_list;bool idpf_adapter_list_init; -uint64_t idpf_timestamp_dynflag; -static const char *const idpf_valid_args[] = {IDPF_TX_SINGLE_Q ,IDPF_RX_SINGLE_Q ,
drivers/net/idpf/idpf_ethdev.h +0 -4
@@ -28,7 +28,6 @@#define IDPF_MIN_BUF_SIZE 1024#define IDPF_MAX_FRAME_SIZE 9728 -#define IDPF_MIN_FRAME_SIZE 14#define IDPF_DEFAULT_MTU RTE_ETHER_MTU#define IDPF_NUM_MACADDR_MAX 64
@@ -78,9 +77,6 @@ struct idpf_adapter_ext {uint16_t cur_vport_nb;uint16_t used_vecs_num; - -/* For PTP */ -uint64_t time_hw; };TAILQ_HEAD (idpf_adapter_list, idpf_adapter_ext);
drivers/net/idpf/idpf_logs.h +0 -24
@@ -29,28 +29,4 @@ extern int idpf_logtype_driver; #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt "\n", ## args) -#ifdef RTE_LIBRTE_IDPF_DEBUG_RX -#define PMD_RX_LOG (level, ...) \ - RTE_LOG(level, \ - PMD, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) -#else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) -#endif - -#ifdef RTE_LIBRTE_IDPF_DEBUG_TX -#define PMD_TX_LOG (level, ...) \ - RTE_LOG(level, \ - PMD, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) -#else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) -#endif -#endif /* _IDPF_LOGS_H_ */
drivers/net/idpf/idpf_rxtx.c +1 -936
961 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.h +0 -132
162 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx_vec_avx512.c +4 -4
@@ -38,8 +38,8 @@ idpf_singleq_rearm_common(struct idpf_rx_queue *rxq) dma_addr0); } } - rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed += -IDPF_RXQ_REARM_THRESH ; +__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED);return ; }struct rte_mbuf *mb0, *mb1, *mb2, *mb3;
@@ -168,8 +168,8 @@ idpf_singleq_rearm(struct idpf_rx_queue *rxq) dma_addr0); } } - rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed += -IDPF_RXQ_REARM_THRESH ; +__atomic_fetch_add (&rxq->rx_stats.mbuf_alloc_failed, +IDPF_RXQ_REARM_THRESH , __ATOMIC_RELAXED);return ; } }
Signature · 1 line
2.26.2
PATCH v7 14/19 common/idpf: add vec queue setup
In reply to [email protected]From: Beilei Xing <[email protected]>
Move vector queue setup for single queue model to common module.
--- drivers/common/idpf/idpf_common_rxtx.c | 57 ++++++++++++++++++++++++++ drivers/common/idpf/idpf_common_rxtx.h | 2 + drivers/common/idpf/version.map | 1 + drivers/net/idpf/idpf_rxtx.c | 57 -------------------------- drivers/net/idpf/idpf_rxtx.h | 1 - 5 files changed, 60 insertions(+), 58 deletions(-)
drivers/common/idpf/idpf_common_rxtx.c +57 -0
@@ -1399,3 +1399,60 @@ idpf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,return i; } + +static void __rte_cold +release_rxq_mbufs_vec (struct idpf_rx_queue *rxq) +{ +const uint16_t mask = rxq->nb_rx_desc -1 ; +uint16_t i; + +if (rxq->sw_ring ==NULL || rxq->rxrearm_nb >= rxq->nb_rx_desc) +return ; + +/* free all mbufs that are valid in the ring */ +if (rxq->rxrearm_nb ==0 ) { +for (i =0 ; i < rxq->nb_rx_desc; i++) { +if (rxq->sw_ring[i] !=NULL ) +rte_pktmbuf_free_seg (rxq->sw_ring[i]); + } + }else { +for (i = rxq->rx_tail; i != rxq->rxrearm_start; i = (i +1 ) & mask) { +if (rxq->sw_ring[i] !=NULL ) +rte_pktmbuf_free_seg (rxq->sw_ring[i]); + } + } + + rxq->rxrearm_nb = rxq->nb_rx_desc; + +/* set all entries to NULL */ +memset (rxq->sw_ring,0 ,sizeof (rxq->sw_ring[0 ]) * rxq->nb_rx_desc); +} + +static const struct idpf_rxq_ops def_singleq_rx_ops_vec = { + .release_mbufs = release_rxq_mbufs_vec, +}; + +static inline int +idpf_singleq_rx_vec_setup_default (struct idpf_rx_queue *rxq) +{ +uintptr_t p; +struct rte_mbuf mb_def = { .buf_addr =0 };/* zeroed mbuf */ + + mb_def.nb_segs =1 ; + mb_def.data_off =RTE_PKTMBUF_HEADROOM ; + mb_def.port = rxq->port_id; +rte_mbuf_refcnt_set (&mb_def,1 ); + +/* prevent compiler reordering: rearm_data covers previous fields */ +rte_compiler_barrier (); + p = (uintptr_t )&mb_def.rearm_data; + rxq->mbuf_initializer = *(uint64_t *)p; +return 0 ; +} + +int __rte_cold +idpf_singleq_rx_vec_setup (struct idpf_rx_queue *rxq) +{ + rxq->ops = &def_singleq_rx_ops_vec; +return idpf_singleq_rx_vec_setup_default (rxq); +}
drivers/common/idpf/idpf_common_rxtx.h +2 -0
@@ -252,5 +252,7 @@ uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,__rte_internal uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +__rte_internal +int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);#endif /* _IDPF_COMMON_RXTX_H_ */
drivers/common/idpf/version.map +1 -0
@@ -25,6 +25,7 @@ INTERNAL { idpf_reset_split_tx_descq; idpf_rx_queue_release; idpf_singleq_recv_pkts; + idpf_singleq_rx_vec_setup; idpf_singleq_xmit_pkts; idpf_splitq_recv_pkts; idpf_splitq_xmit_pkts;
drivers/net/idpf/idpf_rxtx.c +0 -57
63 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.h +0 -1
@@ -44,7 +44,6 @@ void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);int idpf_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); -int idpf_singleq_rx_vec_setup (struct idpf_rx_queue *rxq);int idpf_tx_queue_init (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);
Signature · 1 line
2.26.2
PATCH v7 15/19 common/idpf: add avx512 for single queue model
In reply to [email protected]From: Beilei Xing <[email protected]>
Move avx512 vector path for single queue to common module.
---
drivers/common/idpf/idpf_common_rxtx.h | 20 ++++++++++++++
.../idpf/idpf_common_rxtx_avx512.c} | 6 ++---
drivers/common/idpf/meson.build | 27 +++++++++++++++++++
drivers/common/idpf/version.map | 3 +++
drivers/net/idpf/idpf_rxtx.h | 13 ---------
drivers/net/idpf/meson.build | 17 ------------
6 files changed, 53 insertions(+), 33 deletions(-)
rename drivers/{net/idpf/idpf_rxtx_vec_avx512.c => common/idpf/idpf_common_rxtx_avx512.c} (99%)drivers/common/idpf/idpf_common_rxtx.h +20 -0
@@ -47,6 +47,12 @@#define IDPF_TX_OFFLOAD_NOTSUP_MASK \ (RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK) +/* used for Vector PMD */ +#define IDPF_VPMD_RX_MAX_BURST 32 +#define IDPF_VPMD_TX_MAX_BURST 32 +#define IDPF_VPMD_DESCS_PER_LOOP 4 +#define IDPF_RXQ_REARM_THRESH 64 +/* MTS */ #define GLTSYN_CMD_SYNC_0_0 (PF_TIMESYNC_BASE + 0x0)#define PF_GLTSYN_SHTIME_0_0 (PF_TIMESYNC_BASE + 0x4)
@@ -193,6 +199,10 @@ union idpf_tx_offload { }; }; +struct idpf_tx_vec_entry { +struct rte_mbuf *mbuf; +}; +struct idpf_rxq_ops {void (*release_mbufs)(struct idpf_rx_queue *rxq); };
@@ -254,5 +264,15 @@ uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);__rte_internal int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq); +__rte_internal +int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq); +__rte_internal +uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +__rte_internal +uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _IDPF_COMMON_RXTX_H_ */
drivers/common/idpf/idpf_common_rxtx_avx512.c renamed from drivers/net/idpf/idpf_rxtx_vec_avx512.c +3 -3
@@ -1,10 +1,10 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2022 Intel Corporation +* Copyright(c) 2023 Intel Corporation */ -#include "idpf_rxtx_vec_common.h" -#include <rte_vect.h> +#include <idpf_common_device.h> +#include <idpf_common_rxtx.h> #ifndef __INTEL_COMPILER#pragma GCC diagnostic ignored "-Wcast-qual"
drivers/common/idpf/meson.build +27 -0
@@ -9,4 +9,31 @@ sources = files( 'idpf_common_virtchnl.c', ) +if arch_subdir == 'x86' + idpf_avx512_cpu_support = ( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '' + ) + + idpf_avx512_cc_support = ( + not machine_args.contains('-mno-avx512f') and + cc.has_argument('-mavx512f') and + cc.has_argument('-mavx512bw') + ) + + if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true + cflags += ['-DCC_AVX512_SUPPORT'] + avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + endif + idpf_common_avx512_lib = static_library('idpf_common_avx512_lib', + 'idpf_common_rxtx_avx512.c', + dependencies: [static_rte_mbuf,], + include_directories: includes, + c_args: avx512_args) + objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') + endif +endif + subdir('base')
drivers/common/idpf/version.map +3 -0
@@ -25,8 +25,11 @@ INTERNAL { idpf_reset_split_tx_descq; idpf_rx_queue_release; idpf_singleq_recv_pkts; + idpf_singleq_recv_pkts_avx512; idpf_singleq_rx_vec_setup; + idpf_singleq_tx_vec_setup_avx512; idpf_singleq_xmit_pkts; + idpf_singleq_xmit_pkts_avx512; idpf_splitq_recv_pkts; idpf_splitq_xmit_pkts; idpf_tx_queue_release;
drivers/net/idpf/idpf_rxtx.h +0 -13
@@ -19,23 +19,14 @@#define IDPF_DEFAULT_RX_FREE_THRESH 32/* used for Vector PMD */ -#define IDPF_VPMD_RX_MAX_BURST 32 -#define IDPF_VPMD_TX_MAX_BURST 32 -#define IDPF_VPMD_DESCS_PER_LOOP 4 -#define IDPF_RXQ_REARM_THRESH 64#define IDPF_DEFAULT_TX_RS_THRESH 32#define IDPF_DEFAULT_TX_FREE_THRESH 32 -struct idpf_tx_vec_entry { -struct rte_mbuf *mbuf; -}; -int idpf_rx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); -int idpf_singleq_tx_vec_setup_avx512 (struct idpf_tx_queue *txq);int idpf_rx_queue_init (struct rte_eth_dev *dev,uint16_t rx_queue_id);int idpf_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id);int idpf_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);
@@ -48,10 +39,6 @@ int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);int idpf_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void idpf_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); -uint16_t idpf_singleq_recv_pkts_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts); -uint16_t idpf_singleq_xmit_pkts_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, -uint16_t nb_pkts);void idpf_stop_queues (struct rte_eth_dev *dev);
drivers/net/idpf/meson.build +0 -17
@@ -34,22 +34,5 @@ if arch_subdir == 'x86' if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = [cflags, '-mavx512f', '-mavx512bw'] - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - endif - idpf_avx512_lib = static_library( - 'idpf_avx512_lib', - 'idpf_rxtx_vec_avx512.c', - dependencies: [ - static_rte_common_idpf, - static_rte_ethdev, - static_rte_bus_pci, - static_rte_kvargs, - static_rte_hash, - ], - include_directories: includes, - c_args: avx512_args) - objs += idpf_avx512_lib.extract_objects('idpf_rxtx_vec_avx512.c') endif endif
Signature · 1 line
2.26.2
PATCH v7 16/19 common/idpf: refine API name for vport functions
In reply to [email protected]From: Beilei Xing <[email protected]>
This patch refines API name for all vport related functions.
--- drivers/common/idpf/idpf_common_device.c | 8 ++++---- drivers/common/idpf/idpf_common_device.h | 10 +++++----- drivers/common/idpf/version.map | 14 ++++++++------ drivers/net/idpf/idpf_ethdev.c | 10 +++++----- 4 files changed, 22 insertions(+), 20 deletions(-)
drivers/common/idpf/idpf_common_device.c +4 -4
@@ -505,7 +505,7 @@ idpf_vport_deinit(struct idpf_vport *vport)return 0 ; }int -idpf_config_rss (struct idpf_vport *vport) +idpf_vport_rss_config (struct idpf_vport *vport) {int ret;
@@ -531,7 +531,7 @@ idpf_config_rss(struct idpf_vport *vport) }int -idpf_config_irq_map (struct idpf_vport *vport,uint16_t nb_rx_queues) +idpf_vport_irq_map_config (struct idpf_vport *vport,uint16_t nb_rx_queues) {struct idpf_adapter *adapter = vport->adapter;struct virtchnl2_queue_vector *qv_map;
@@ -606,7 +606,7 @@ idpf_config_irq_map(struct idpf_vport *vport, uint16_t nb_rx_queues) }int -idpf_config_irq_unmap (struct idpf_vport *vport,uint16_t nb_rx_queues) +idpf_vport_irq_unmap_config (struct idpf_vport *vport,uint16_t nb_rx_queues) {idpf_vc_config_irq_map_unmap (vport, nb_rx_queues, false);
@@ -617,7 +617,7 @@ idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues) }int -idpf_create_vport_info_init (struct idpf_vport *vport, +idpf_vport_info_init (struct idpf_vport *vport,struct virtchnl2_create_vport *vport_info) {struct idpf_adapter *adapter = vport->adapter;
drivers/common/idpf/idpf_common_device.h +5 -5
@@ -183,13 +183,13 @@ int idpf_vport_init(struct idpf_vport *vport,__rte_internal int idpf_vport_deinit(struct idpf_vport *vport);__rte_internal -int idpf_config_rss(struct idpf_vport *vport); +int idpf_vport_rss_config(struct idpf_vport *vport);__rte_internal -int idpf_config_irq_map(struct idpf_vport *vport, uint16_t nb_rx_queues); +int idpf_vport_irq_map_config(struct idpf_vport *vport, uint16_t nb_rx_queues);__rte_internal -int idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues); +int idpf_vport_irq_unmap_config(struct idpf_vport *vport, uint16_t nb_rx_queues);__rte_internal -int idpf_create_vport_info_init(struct idpf_vport *vport, -struct virtchnl2_create_vport *vport_info); +int idpf_vport_info_init(struct idpf_vport *vport, +struct virtchnl2_create_vport *vport_info);#endif /* _IDPF_COMMON_DEVICE_H_ */
drivers/common/idpf/version.map +8 -6
@@ -3,14 +3,18 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + + idpf_vport_deinit; + idpf_vport_info_init; + idpf_vport_init; + idpf_vport_irq_map_config; + idpf_vport_irq_unmap_config; + idpf_vport_rss_config; + idpf_alloc_single_rxq_mbufs; idpf_alloc_split_rxq_mbufs; idpf_check_rx_thresh; idpf_check_tx_thresh; - idpf_config_irq_map; - idpf_config_irq_unmap; - idpf_config_rss; - idpf_create_vport_info_init; idpf_execute_vc_cmd; idpf_prep_pkts; idpf_register_ts_mbuf;
@@ -50,8 +54,6 @@ INTERNAL { idpf_vc_set_rss_key; idpf_vc_set_rss_lut; idpf_vc_switch_queue; - idpf_vport_deinit; - idpf_vport_init; local: *; };
drivers/net/idpf/idpf_ethdev.c +5 -5
@@ -169,7 +169,7 @@ idpf_init_rss(struct idpf_vport *vport) vport->rss_hf =IDPF_DEFAULT_RSS_HASH_EXPANDED ; - ret =idpf_config_rss (vport); + ret =idpf_vport_rss_config (vport);if (ret !=0 )PMD_INIT_LOG (ERR ,"Failed to configure RSS" );
@@ -245,7 +245,7 @@ idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)struct idpf_vport *vport = dev->data->dev_private;uint16_t nb_rx_queues = dev->data->nb_rx_queues; -return idpf_config_irq_map (vport, nb_rx_queues); +return idpf_vport_irq_map_config (vport, nb_rx_queues); } static int
@@ -334,7 +334,7 @@ idpf_dev_start(struct rte_eth_dev *dev) err_vport:idpf_stop_queues (dev); err_startq: -idpf_config_irq_unmap (vport, dev->data->nb_rx_queues); +idpf_vport_irq_unmap_config (vport, dev->data->nb_rx_queues); err_irq:idpf_vc_dealloc_vectors (vport); err_vec:
@@ -353,7 +353,7 @@ idpf_dev_stop(struct rte_eth_dev *dev)idpf_stop_queues (dev); -idpf_config_irq_unmap (vport, dev->data->nb_rx_queues); +idpf_vport_irq_unmap_config (vport, dev->data->nb_rx_queues);idpf_vc_dealloc_vectors (vport);
@@ -643,7 +643,7 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) vport->devarg_id = param->devarg_id;memset (&create_vport_info,0 ,sizeof (create_vport_info)); - ret =idpf_create_vport_info_init (vport, &create_vport_info); + ret =idpf_vport_info_init (vport, &create_vport_info);if (ret !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init vport req_info." ); goto err;
Signature · 1 line
2.26.2
PATCH v7 17/19 common/idpf: refine API name for queue config module
In reply to [email protected]From: Beilei Xing <[email protected]>
This patch refines API name for queue config functions.
--- drivers/common/idpf/idpf_common_rxtx.c | 42 ++++++++-------- drivers/common/idpf/idpf_common_rxtx.h | 38 +++++++------- drivers/common/idpf/idpf_common_rxtx_avx512.c | 2 +- drivers/common/idpf/version.map | 37 +++++++------- drivers/net/idpf/idpf_rxtx.c | 50 +++++++++---------- 5 files changed, 85 insertions(+), 84 deletions(-)
drivers/common/idpf/idpf_common_rxtx.c +21 -21
@@ -11,7 +11,7 @@ int idpf_timestamp_dynfield_offset = -1;uint64_t idpf_timestamp_dynflag;int -idpf_check_rx_thresh (uint16_t nb_desc,uint16_t thresh) +idpf_qc_rx_thresh_check (uint16_t nb_desc,uint16_t thresh) {/* The following constraints must be satisfied: * thresh < rxq->nb_rx_desc
@@ -26,8 +26,8 @@ idpf_check_rx_thresh(uint16_t nb_desc, uint16_t thresh) }int -idpf_check_tx_thresh (uint16_t nb_desc,uint16_t tx_rs_thresh, -uint16_t tx_free_thresh) +idpf_qc_tx_thresh_check (uint16_t nb_desc,uint16_t tx_rs_thresh, +uint16_t tx_free_thresh) {/* TX descriptors will have their RS bit set after tx_rs_thresh * descriptors have been used. The TX descriptor ring will be cleaned
@@ -74,7 +74,7 @@ idpf_check_tx_thresh(uint16_t nb_desc, uint16_t tx_rs_thresh, }void -idpf_release_rxq_mbufs (struct idpf_rx_queue *rxq) +idpf_qc_rxq_mbufs_release (struct idpf_rx_queue *rxq) {uint16_t i;
@@ -90,7 +90,7 @@ idpf_release_rxq_mbufs(struct idpf_rx_queue *rxq) }void -idpf_release_txq_mbufs (struct idpf_tx_queue *txq) +idpf_qc_txq_mbufs_release (struct idpf_tx_queue *txq) {uint16_t nb_desc, i;
@@ -115,7 +115,7 @@ idpf_release_txq_mbufs(struct idpf_tx_queue *txq) }void -idpf_reset_split_rx_descq (struct idpf_rx_queue *rxq) +idpf_qc_split_rx_descq_reset (struct idpf_rx_queue *rxq) {uint16_t len;uint32_t i;
@@ -134,7 +134,7 @@ idpf_reset_split_rx_descq(struct idpf_rx_queue *rxq) }void -idpf_reset_split_rx_bufq (struct idpf_rx_queue *rxq) +idpf_qc_split_rx_bufq_reset (struct idpf_rx_queue *rxq) {uint16_t len;uint32_t i;
@@ -166,15 +166,15 @@ idpf_reset_split_rx_bufq(struct idpf_rx_queue *rxq) }void -idpf_reset_split_rx_queue (struct idpf_rx_queue *rxq) +idpf_qc_split_rx_queue_reset (struct idpf_rx_queue *rxq) { -idpf_reset_split_rx_descq (rxq); -idpf_reset_split_rx_bufq (rxq->bufq1); -idpf_reset_split_rx_bufq (rxq->bufq2); +idpf_qc_split_rx_descq_reset (rxq); +idpf_qc_split_rx_bufq_reset (rxq->bufq1); +idpf_qc_split_rx_bufq_reset (rxq->bufq2); }void -idpf_reset_single_rx_queue (struct idpf_rx_queue *rxq) +idpf_qc_single_rx_queue_reset (struct idpf_rx_queue *rxq) {uint16_t len;uint32_t i;
@@ -205,7 +205,7 @@ idpf_reset_single_rx_queue(struct idpf_rx_queue *rxq) }void -idpf_reset_split_tx_descq (struct idpf_tx_queue *txq) +idpf_qc_split_tx_descq_reset (struct idpf_tx_queue *txq) {struct idpf_tx_entry *txe;uint32_t i, size;
@@ -239,7 +239,7 @@ idpf_reset_split_tx_descq(struct idpf_tx_queue *txq) }void -idpf_reset_split_tx_complq (struct idpf_tx_queue *cq) +idpf_qc_split_tx_complq_reset (struct idpf_tx_queue *cq) {uint32_t i, size;
@@ -257,7 +257,7 @@ idpf_reset_split_tx_complq(struct idpf_tx_queue *cq) }void -idpf_reset_single_tx_queue (struct idpf_tx_queue *txq) +idpf_qc_single_tx_queue_reset (struct idpf_tx_queue *txq) {struct idpf_tx_entry *txe;uint32_t i, size;
@@ -294,7 +294,7 @@ idpf_reset_single_tx_queue(struct idpf_tx_queue *txq) }void -idpf_rx_queue_release (void *rxq) +idpf_qc_rx_queue_release (void *rxq) {struct idpf_rx_queue *q = rxq;
@@ -324,7 +324,7 @@ idpf_rx_queue_release(void *rxq) }void -idpf_tx_queue_release (void *txq) +idpf_qc_tx_queue_release (void *txq) {struct idpf_tx_queue *q = txq;
@@ -343,7 +343,7 @@ idpf_tx_queue_release(void *txq) }int -idpf_register_ts_mbuf (struct idpf_rx_queue *rxq) +idpf_qc_ts_mbuf_register (struct idpf_rx_queue *rxq) {int err;if ((rxq->offloads &IDPF_RX_OFFLOAD_TIMESTAMP ) !=0 ) {
@@ -360,7 +360,7 @@ idpf_register_ts_mbuf(struct idpf_rx_queue *rxq) }int -idpf_alloc_single_rxq_mbufs (struct idpf_rx_queue *rxq) +idpf_qc_single_rxq_mbufs_alloc (struct idpf_rx_queue *rxq) {volatile struct virtchnl2_singleq_rx_buf_desc *rxd;struct rte_mbuf *mbuf =NULL ;
@@ -395,7 +395,7 @@ idpf_alloc_single_rxq_mbufs(struct idpf_rx_queue *rxq) }int -idpf_alloc_split_rxq_mbufs (struct idpf_rx_queue *rxq) +idpf_qc_split_rxq_mbufs_alloc (struct idpf_rx_queue *rxq) {volatile struct virtchnl2_splitq_rx_buf_desc *rxd;struct rte_mbuf *mbuf =NULL ;
@@ -1451,7 +1451,7 @@ idpf_singleq_rx_vec_setup_default(struct idpf_rx_queue *rxq) } int __rte_cold -idpf_singleq_rx_vec_setup (struct idpf_rx_queue *rxq) +idpf_qc_singleq_rx_vec_setup (struct idpf_rx_queue *rxq) { rxq->ops = &def_singleq_rx_ops_vec;return idpf_singleq_rx_vec_setup_default (rxq);
drivers/common/idpf/idpf_common_rxtx.h +19 -19
@@ -215,38 +215,38 @@ extern int idpf_timestamp_dynfield_offset;extern uint64_t idpf_timestamp_dynflag;__rte_internal -int idpf_check_rx_thresh(uint16_t nb_desc, uint16_t thresh); +int idpf_qc_rx_thresh_check(uint16_t nb_desc, uint16_t thresh);__rte_internal -int idpf_check_tx_thresh(uint16_t nb_desc, uint16_t tx_rs_thresh, -uint16_t tx_free_thresh); +int idpf_qc_tx_thresh_check(uint16_t nb_desc, uint16_t tx_rs_thresh, +uint16_t tx_free_thresh);__rte_internal -void idpf_release_rxq_mbufs(struct idpf_rx_queue *rxq); +void idpf_qc_rxq_mbufs_release(struct idpf_rx_queue *rxq);__rte_internal -void idpf_release_txq_mbufs(struct idpf_tx_queue *txq); +void idpf_qc_txq_mbufs_release(struct idpf_tx_queue *txq);__rte_internal -void idpf_reset_split_rx_descq(struct idpf_rx_queue *rxq); +void idpf_qc_split_rx_descq_reset(struct idpf_rx_queue *rxq);__rte_internal -void idpf_reset_split_rx_bufq(struct idpf_rx_queue *rxq); +void idpf_qc_split_rx_bufq_reset(struct idpf_rx_queue *rxq);__rte_internal -void idpf_reset_split_rx_queue(struct idpf_rx_queue *rxq); +void idpf_qc_split_rx_queue_reset(struct idpf_rx_queue *rxq);__rte_internal -void idpf_reset_single_rx_queue(struct idpf_rx_queue *rxq); +void idpf_qc_single_rx_queue_reset(struct idpf_rx_queue *rxq);__rte_internal -void idpf_reset_split_tx_descq(struct idpf_tx_queue *txq); +void idpf_qc_split_tx_descq_reset(struct idpf_tx_queue *txq);__rte_internal -void idpf_reset_split_tx_complq(struct idpf_tx_queue *cq); +void idpf_qc_split_tx_complq_reset(struct idpf_tx_queue *cq);__rte_internal -void idpf_reset_single_tx_queue(struct idpf_tx_queue *txq); +void idpf_qc_single_tx_queue_reset(struct idpf_tx_queue *txq);__rte_internal -void idpf_rx_queue_release(void *rxq); +void idpf_qc_rx_queue_release(void *rxq);__rte_internal -void idpf_tx_queue_release(void *txq); +void idpf_qc_tx_queue_release(void *txq);__rte_internal -int idpf_register_ts_mbuf(struct idpf_rx_queue *rxq); +int idpf_qc_ts_mbuf_register(struct idpf_rx_queue *rxq);__rte_internal -int idpf_alloc_single_rxq_mbufs(struct idpf_rx_queue *rxq); +int idpf_qc_single_rxq_mbufs_alloc(struct idpf_rx_queue *rxq);__rte_internal -int idpf_alloc_split_rxq_mbufs(struct idpf_rx_queue *rxq); +int idpf_qc_split_rxq_mbufs_alloc(struct idpf_rx_queue *rxq);__rte_internal uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,uint16_t nb_pkts);
@@ -263,9 +263,9 @@ __rte_internaluint16_t idpf_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);__rte_internal -int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq); +int idpf_qc_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);__rte_internal -int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq); +int idpf_qc_singleq_tx_vec_avx512_setup(struct idpf_tx_queue *txq); __rte_internal uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/common/idpf/idpf_common_rxtx_avx512.c +1 -1
@@ -850,7 +850,7 @@ static const struct idpf_txq_ops avx512_singleq_tx_vec_ops = { }; int __rte_cold -idpf_singleq_tx_vec_setup_avx512 (struct idpf_tx_queue *txq) +idpf_qc_singleq_tx_vec_avx512_setup (struct idpf_tx_queue *txq) { txq->ops = &avx512_singleq_tx_vec_ops;return 0 ;
drivers/common/idpf/version.map +19 -18
@@ -4,6 +4,25 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + idpf_qc_rx_thresh_check; + idpf_qc_rx_queue_release; + idpf_qc_rxq_mbufs_release; + idpf_qc_single_rx_queue_reset; + idpf_qc_single_rxq_mbufs_alloc; + idpf_qc_single_tx_queue_reset; + idpf_qc_singleq_rx_vec_setup; + idpf_qc_singleq_tx_vec_avx512_setup; + idpf_qc_split_rx_bufq_reset; + idpf_qc_split_rx_descq_reset; + idpf_qc_split_rx_queue_reset; + idpf_qc_split_rxq_mbufs_alloc; + idpf_qc_split_tx_complq_reset; + idpf_qc_split_tx_descq_reset; + idpf_qc_ts_mbuf_register; + idpf_qc_tx_queue_release; + idpf_qc_tx_thresh_check; + idpf_qc_txq_mbufs_release; + idpf_vport_deinit; idpf_vport_info_init; idpf_vport_init;
@@ -11,32 +30,14 @@ INTERNAL { idpf_vport_irq_unmap_config; idpf_vport_rss_config; - idpf_alloc_single_rxq_mbufs; - idpf_alloc_split_rxq_mbufs; - idpf_check_rx_thresh; - idpf_check_tx_thresh; idpf_execute_vc_cmd; idpf_prep_pkts; - idpf_register_ts_mbuf; - idpf_release_rxq_mbufs; - idpf_release_txq_mbufs; - idpf_reset_single_rx_queue; - idpf_reset_single_tx_queue; - idpf_reset_split_rx_bufq; - idpf_reset_split_rx_descq; - idpf_reset_split_rx_queue; - idpf_reset_split_tx_complq; - idpf_reset_split_tx_descq; - idpf_rx_queue_release; idpf_singleq_recv_pkts; idpf_singleq_recv_pkts_avx512; - idpf_singleq_rx_vec_setup; - idpf_singleq_tx_vec_setup_avx512; idpf_singleq_xmit_pkts; idpf_singleq_xmit_pkts_avx512; idpf_splitq_recv_pkts; idpf_splitq_xmit_pkts; - idpf_tx_queue_release; idpf_vc_alloc_vectors; idpf_vc_check_api_version; idpf_vc_config_irq_map_unmap;
drivers/net/idpf/idpf_rxtx.c +25 -25
170 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v7 18/19 common/idpf: refine API name for data path module
In reply to [email protected]From: Beilei Xing <[email protected]>
Refine API name for all data path functions.
--- drivers/common/idpf/idpf_common_rxtx.c | 20 ++++++------ drivers/common/idpf/idpf_common_rxtx.h | 32 +++++++++---------- drivers/common/idpf/idpf_common_rxtx_avx512.c | 8 ++--- drivers/common/idpf/version.map | 15 +++++---- drivers/net/idpf/idpf_rxtx.c | 22 ++++++------- 5 files changed, 49 insertions(+), 48 deletions(-)
drivers/common/idpf/idpf_common_rxtx.c +10 -10
@@ -618,8 +618,8 @@ idpf_split_rx_bufq_refill(struct idpf_rx_queue *rx_bufq) }uint16_t -idpf_splitq_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +idpf_dp_splitq_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc_ring;volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc;
@@ -850,8 +850,8 @@ idpf_set_splitq_tso_ctx(struct rte_mbuf *mbuf, }uint16_t -idpf_splitq_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, -uint16_t nb_pkts) +idpf_dp_splitq_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) {struct idpf_tx_queue *txq = (struct idpf_tx_queue *)tx_queue;volatile struct idpf_flex_tx_sched_desc *txr;
@@ -1024,8 +1024,8 @@ idpf_update_rx_tail(struct idpf_rx_queue *rxq, uint16_t nb_hold, }uint16_t -idpf_singleq_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +idpf_dp_singleq_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {volatile union virtchnl2_rx_desc *rx_ring;volatile union virtchnl2_rx_desc *rxdp;
@@ -1186,8 +1186,8 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)/* TX function */ uint16_t -idpf_singleq_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, -uint16_t nb_pkts) +idpf_dp_singleq_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) {volatile struct idpf_flex_tx_desc *txd;volatile struct idpf_flex_tx_desc *txr;
@@ -1350,8 +1350,8 @@ idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,/* TX prep functions */ uint16_t -idpf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, -uint16_t nb_pkts) +idpf_dp_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) {#ifdef RTE_LIBRTE_ETHDEV_DEBUG int ret;
drivers/common/idpf/idpf_common_rxtx.h +16 -16
@@ -248,31 +248,31 @@ int idpf_qc_single_rxq_mbufs_alloc(struct idpf_rx_queue *rxq);__rte_internal int idpf_qc_split_rxq_mbufs_alloc(struct idpf_rx_queue *rxq);__rte_internal -uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);__rte_internal -uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);__rte_internal -uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);__rte_internal -uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);__rte_internal -uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);__rte_internal int idpf_qc_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);__rte_internal int idpf_qc_singleq_tx_vec_avx512_setup(struct idpf_tx_queue *txq);__rte_internal -uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_singleq_recv_pkts_avx512(void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);__rte_internal -uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, -struct rte_mbuf **tx_pkts, -uint16_t nb_pkts); +uint16_t idpf_dp_singleq_xmit_pkts_avx512(void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _IDPF_COMMON_RXTX_H_ */
drivers/common/idpf/idpf_common_rxtx_avx512.c +4 -4
@@ -533,8 +533,8 @@ _idpf_singleq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq,* - nb_pkts < IDPF_DESCS_PER_LOOP, just return no packet */ uint16_t -idpf_singleq_recv_pkts_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +idpf_dp_singleq_recv_pkts_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {return _idpf_singleq_recv_raw_pkts_avx512 (rx_queue, rx_pkts, nb_pkts); }
@@ -819,8 +819,8 @@ idpf_xmit_pkts_vec_avx512_cmn(void *tx_queue, struct rte_mbuf **tx_pkts, }uint16_t -idpf_singleq_xmit_pkts_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, -uint16_t nb_pkts) +idpf_dp_singleq_xmit_pkts_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) {return idpf_xmit_pkts_vec_avx512_cmn (tx_queue, tx_pkts, nb_pkts); }
drivers/common/idpf/version.map +8 -7
@@ -4,6 +4,14 @@ INTERNAL { idpf_adapter_deinit; idpf_adapter_init; + idpf_dp_prep_pkts; + idpf_dp_singleq_recv_pkts; + idpf_dp_singleq_recv_pkts_avx512; + idpf_dp_singleq_xmit_pkts; + idpf_dp_singleq_xmit_pkts_avx512; + idpf_dp_splitq_recv_pkts; + idpf_dp_splitq_xmit_pkts; + idpf_qc_rx_thresh_check; idpf_qc_rx_queue_release; idpf_qc_rxq_mbufs_release;
@@ -31,13 +39,6 @@ INTERNAL { idpf_vport_rss_config; idpf_execute_vc_cmd; - idpf_prep_pkts; - idpf_singleq_recv_pkts; - idpf_singleq_recv_pkts_avx512; - idpf_singleq_xmit_pkts; - idpf_singleq_xmit_pkts_avx512; - idpf_splitq_recv_pkts; - idpf_splitq_xmit_pkts; idpf_vc_alloc_vectors; idpf_vc_check_api_version; idpf_vc_config_irq_map_unmap;
drivers/net/idpf/idpf_rxtx.c +11 -11
@@ -771,7 +771,7 @@ idpf_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 if (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SPLIT ) { - dev->rx_pkt_burst = idpf_splitq_recv_pkts; + dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts; }else {if (vport->rx_vec_allowed) {for (i =0 ; i < dev->data->nb_tx_queues; i++) {
@@ -780,19 +780,19 @@ idpf_set_rx_function(struct rte_eth_dev *dev) }#ifdef CC_AVX512_SUPPORT if (vport->rx_use_avx512) { - dev->rx_pkt_burst = idpf_singleq_recv_pkts_avx512; + dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts_avx512;return ; }#endif /* CC_AVX512_SUPPORT */ } - dev->rx_pkt_burst = idpf_singleq_recv_pkts; + dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts; }#else if (vport->rxq_model ==VIRTCHNL2_QUEUE_MODEL_SPLIT ) - dev->rx_pkt_burst = idpf_splitq_recv_pkts; + dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;else - dev->rx_pkt_burst = idpf_singleq_recv_pkts; + dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;#endif /* RTE_ARCH_X86 */ }
@@ -824,8 +824,8 @@ idpf_set_tx_function(struct rte_eth_dev *dev)#endif /* RTE_ARCH_X86 */ if (vport->txq_model ==VIRTCHNL2_QUEUE_MODEL_SPLIT ) { - dev->tx_pkt_burst = idpf_splitq_xmit_pkts; - dev->tx_pkt_prepare = idpf_prep_pkts; + dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts; + dev->tx_pkt_prepare = idpf_dp_prep_pkts; }else {#ifdef RTE_ARCH_X86 if (vport->tx_vec_allowed) {
@@ -837,14 +837,14 @@ idpf_set_tx_function(struct rte_eth_dev *dev)continue ;idpf_qc_singleq_tx_vec_avx512_setup (txq); } - dev->tx_pkt_burst = idpf_singleq_xmit_pkts_avx512; - dev->tx_pkt_prepare = idpf_prep_pkts; + dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx512; + dev->tx_pkt_prepare = idpf_dp_prep_pkts;return ; }#endif /* CC_AVX512_SUPPORT */ }#endif /* RTE_ARCH_X86 */ - dev->tx_pkt_burst = idpf_singleq_xmit_pkts; - dev->tx_pkt_prepare = idpf_prep_pkts; + dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts; + dev->tx_pkt_prepare = idpf_dp_prep_pkts; } }
Signature · 1 line
2.26.2
PATCH v7 19/19 common/idpf: refine API name for virtual channel functions
In reply to [email protected]From: Beilei Xing <[email protected]>
This patch refines API name for all virtual channel functions.
--- drivers/common/idpf/idpf_common_device.c | 24 ++++---- drivers/common/idpf/idpf_common_virtchnl.c | 70 +++++++++++----------- drivers/common/idpf/idpf_common_virtchnl.h | 36 +++++------ drivers/common/idpf/version.map | 38 ++++++------ drivers/net/idpf/idpf_ethdev.c | 10 ++-- drivers/net/idpf/idpf_rxtx.c | 12 ++-- 6 files changed, 95 insertions(+), 95 deletions(-)
drivers/common/idpf/idpf_common_device.c +12 -12
@@ -104,7 +104,7 @@ idpf_get_pkt_type(struct idpf_adapter *adapter)uint16_t ptype_recvd =0 ;int ret; - ret =idpf_vc_query_ptype_info (adapter); + ret =idpf_vc_ptype_info_query (adapter);if (ret !=0 ) {DRV_LOG (ERR ,"Fail to query packet type information" );return ret;
@@ -115,7 +115,7 @@ idpf_get_pkt_type(struct idpf_adapter *adapter)return -ENOMEM ;while (ptype_recvd <IDPF_MAX_PKT_TYPE ) { - ret =idpf_vc_read_one_msg (adapter,VIRTCHNL2_OP_GET_PTYPE_INFO , + ret =idpf_vc_one_msg_read (adapter,VIRTCHNL2_OP_GET_PTYPE_INFO ,IDPF_DFLT_MBX_BUF_SIZE , (uint8_t *)ptype_info);if (ret !=0 ) {DRV_LOG (ERR ,"Fail to get packet type information" );
@@ -333,13 +333,13 @@ idpf_adapter_init(struct idpf_adapter *adapter) goto err_mbx_resp; } - ret =idpf_vc_check_api_version (adapter); + ret =idpf_vc_api_version_check (adapter);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to check api version" ); goto err_check_api; } - ret =idpf_vc_get_caps (adapter); + ret =idpf_vc_caps_get (adapter);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to get capabilities" ); goto err_check_api;
@@ -382,7 +382,7 @@ idpf_vport_init(struct idpf_vport *vport,struct virtchnl2_create_vport *vport_info;int i, type, ret; - ret =idpf_vc_create_vport (vport, create_vport_info); + ret =idpf_vc_vport_create (vport, create_vport_info);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to create vport." ); goto err_create_vport;
@@ -483,7 +483,7 @@ idpf_vport_init(struct idpf_vport *vport,rte_free (vport->rss_key); vport->rss_key =NULL ; err_rss_key: -idpf_vc_destroy_vport (vport); +idpf_vc_vport_destroy (vport); err_create_vport:return ret; }
@@ -500,7 +500,7 @@ idpf_vport_deinit(struct idpf_vport *vport) vport->dev_data =NULL ; -idpf_vc_destroy_vport (vport); +idpf_vc_vport_destroy (vport);return 0 ; }
@@ -509,19 +509,19 @@ idpf_vport_rss_config(struct idpf_vport *vport) {int ret; - ret =idpf_vc_set_rss_key (vport); + ret =idpf_vc_rss_key_set (vport);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to configure RSS key" );return ret; } - ret =idpf_vc_set_rss_lut (vport); + ret =idpf_vc_rss_lut_set (vport);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to configure RSS lut" );return ret; } - ret =idpf_vc_set_rss_hash (vport); + ret =idpf_vc_rss_hash_set (vport);if (ret !=0 ) {DRV_LOG (ERR ,"Failed to configure RSS hash" );return ret;
@@ -589,7 +589,7 @@ idpf_vport_irq_map_config(struct idpf_vport *vport, uint16_t nb_rx_queues) } vport->qv_map = qv_map; - ret =idpf_vc_config_irq_map_unmap (vport, nb_rx_queues, true); + ret =idpf_vc_irq_map_unmap_config (vport, nb_rx_queues, true);if (ret !=0 ) {DRV_LOG (ERR ,"config interrupt mapping failed" ); goto config_irq_map_err;
@@ -608,7 +608,7 @@ idpf_vport_irq_map_config(struct idpf_vport *vport, uint16_t nb_rx_queues)int idpf_vport_irq_unmap_config (struct idpf_vport *vport,uint16_t nb_rx_queues) { -idpf_vc_config_irq_map_unmap (vport, nb_rx_queues, false); +idpf_vc_irq_map_unmap_config (vport, nb_rx_queues, false);rte_free (vport->qv_map); vport->qv_map =NULL ;
drivers/common/idpf/idpf_common_virtchnl.c +35 -35
280 lines not on this page · raw message
drivers/common/idpf/idpf_common_virtchnl.h +18 -18
@@ -9,44 +9,44 @@#include <idpf_common_rxtx.h> __rte_internal -int idpf_vc_check_api_version(struct idpf_adapter *adapter); +int idpf_vc_api_version_check(struct idpf_adapter *adapter);__rte_internal -int idpf_vc_get_caps(struct idpf_adapter *adapter); +int idpf_vc_caps_get(struct idpf_adapter *adapter);__rte_internal -int idpf_vc_create_vport(struct idpf_vport *vport, +int idpf_vc_vport_create(struct idpf_vport *vport,struct virtchnl2_create_vport *vport_info);__rte_internal -int idpf_vc_destroy_vport(struct idpf_vport *vport); +int idpf_vc_vport_destroy(struct idpf_vport *vport);__rte_internal -int idpf_vc_set_rss_key(struct idpf_vport *vport); +int idpf_vc_rss_key_set(struct idpf_vport *vport);__rte_internal -int idpf_vc_set_rss_lut(struct idpf_vport *vport); +int idpf_vc_rss_lut_set(struct idpf_vport *vport);__rte_internal -int idpf_vc_set_rss_hash(struct idpf_vport *vport); +int idpf_vc_rss_hash_set(struct idpf_vport *vport);__rte_internal -int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, +int idpf_vc_irq_map_unmap_config(struct idpf_vport *vport,uint16_t nb_rxq,bool map);__rte_internal -int idpf_execute_vc_cmd(struct idpf_adapter *adapter, +int idpf_vc_cmd_execute(struct idpf_adapter *adapter,struct idpf_cmd_info *args);__rte_internal -int idpf_vc_switch_queue(struct idpf_vport *vport, uint16_t qid, +int idpf_vc_queue_switch(struct idpf_vport *vport, uint16_t qid,bool rx,bool on);__rte_internal -int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable); +int idpf_vc_queues_ena_dis(struct idpf_vport *vport, bool enable);__rte_internal -int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable); +int idpf_vc_vport_ena_dis(struct idpf_vport *vport, bool enable);__rte_internal -int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors); +int idpf_vc_vectors_alloc(struct idpf_vport *vport, uint16_t num_vectors);__rte_internal -int idpf_vc_dealloc_vectors(struct idpf_vport *vport); +int idpf_vc_vectors_dealloc(struct idpf_vport *vport);__rte_internal -int idpf_vc_query_ptype_info(struct idpf_adapter *adapter); +int idpf_vc_ptype_info_query(struct idpf_adapter *adapter);__rte_internal -int idpf_vc_read_one_msg(struct idpf_adapter *adapter, uint32_t ops, +int idpf_vc_one_msg_read(struct idpf_adapter *adapter, uint32_t ops,uint16_t buf_len,uint8_t *buf);__rte_internal -int idpf_vc_config_rxq(struct idpf_vport *vport, struct idpf_rx_queue *rxq); +int idpf_vc_rxq_config(struct idpf_vport *vport, struct idpf_rx_queue *rxq);__rte_internal -int idpf_vc_config_txq(struct idpf_vport *vport, struct idpf_tx_queue *txq); +int idpf_vc_txq_config(struct idpf_vport *vport, struct idpf_tx_queue *txq);#endif /* _IDPF_COMMON_VIRTCHNL_H_ */
drivers/common/idpf/version.map +19 -19
@@ -31,6 +31,25 @@ INTERNAL { idpf_qc_tx_thresh_check; idpf_qc_txq_mbufs_release; + idpf_vc_api_version_check; + idpf_vc_caps_get; + idpf_vc_cmd_execute; + idpf_vc_irq_map_unmap_config; + idpf_vc_one_msg_read; + idpf_vc_ptype_info_query; + idpf_vc_queue_switch; + idpf_vc_queues_ena_dis; + idpf_vc_rss_hash_set; + idpf_vc_rss_key_set; + idpf_vc_rss_lut_set; + idpf_vc_rxq_config; + idpf_vc_txq_config; + idpf_vc_vectors_alloc; + idpf_vc_vectors_dealloc; + idpf_vc_vport_create; + idpf_vc_vport_destroy; + idpf_vc_vport_ena_dis; + idpf_vport_deinit; idpf_vport_info_init; idpf_vport_init;
@@ -38,24 +57,5 @@ INTERNAL { idpf_vport_irq_unmap_config; idpf_vport_rss_config; - idpf_execute_vc_cmd; - idpf_vc_alloc_vectors; - idpf_vc_check_api_version; - idpf_vc_config_irq_map_unmap; - idpf_vc_config_rxq; - idpf_vc_config_txq; - idpf_vc_create_vport; - idpf_vc_dealloc_vectors; - idpf_vc_destroy_vport; - idpf_vc_ena_dis_queues; - idpf_vc_ena_dis_vport; - idpf_vc_get_caps; - idpf_vc_query_ptype_info; - idpf_vc_read_one_msg; - idpf_vc_set_rss_hash; - idpf_vc_set_rss_key; - idpf_vc_set_rss_lut; - idpf_vc_switch_queue; - local: *; };
drivers/net/idpf/idpf_ethdev.c +5 -5
@@ -299,7 +299,7 @@ idpf_dev_start(struct rte_eth_dev *dev) goto err_vec; } - ret =idpf_vc_alloc_vectors (vport, req_vecs_num); + ret =idpf_vc_vectors_alloc (vport, req_vecs_num);if (ret !=0 ) {PMD_DRV_LOG (ERR ,"Failed to allocate interrupt vectors" ); goto err_vec;
@@ -321,7 +321,7 @@ idpf_dev_start(struct rte_eth_dev *dev)idpf_set_rx_function (dev);idpf_set_tx_function (dev); - ret =idpf_vc_ena_dis_vport (vport, true); + ret =idpf_vc_vport_ena_dis (vport, true);if (ret !=0 ) {PMD_DRV_LOG (ERR ,"Failed to enable vport" ); goto err_vport;
@@ -336,7 +336,7 @@ idpf_dev_start(struct rte_eth_dev *dev) err_startq:idpf_vport_irq_unmap_config (vport, dev->data->nb_rx_queues); err_irq: -idpf_vc_dealloc_vectors (vport); +idpf_vc_vectors_dealloc (vport); err_vec:return ret; }
@@ -349,13 +349,13 @@ idpf_dev_stop(struct rte_eth_dev *dev)if (vport->stopped ==1 )return 0 ; -idpf_vc_ena_dis_vport (vport, false); +idpf_vc_vport_ena_dis (vport, false);idpf_stop_queues (dev);idpf_vport_irq_unmap_config (vport, dev->data->nb_rx_queues); -idpf_vc_dealloc_vectors (vport); +idpf_vc_vectors_dealloc (vport); vport->stopped =1 ;
drivers/net/idpf/idpf_rxtx.c +6 -6
@@ -566,7 +566,7 @@ idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) dev->data->rx_queues[rx_queue_id];int err =0 ; - err =idpf_vc_config_rxq (vport, rxq); + err =idpf_vc_rxq_config (vport, rxq);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Fail to configure Rx queue %u" , rx_queue_id);return err;
@@ -580,7 +580,7 @@ idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) }/* Ready to switch the queue on */ - err =idpf_vc_switch_queue (vport, rx_queue_id, true, true); + err =idpf_vc_queue_switch (vport, rx_queue_id, true, true);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch RX queue %u on" , rx_queue_id);
@@ -617,7 +617,7 @@ idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) dev->data->tx_queues[tx_queue_id];int err =0 ; - err =idpf_vc_config_txq (vport, txq); + err =idpf_vc_txq_config (vport, txq);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Fail to configure Tx queue %u" , tx_queue_id);return err;
@@ -631,7 +631,7 @@ idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) }/* Ready to switch the queue on */ - err =idpf_vc_switch_queue (vport, tx_queue_id, false, true); + err =idpf_vc_queue_switch (vport, tx_queue_id, false, true);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch TX queue %u on" , tx_queue_id);
@@ -654,7 +654,7 @@ idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (rx_queue_id >= dev->data->nb_rx_queues)return -EINVAL ; - err =idpf_vc_switch_queue (vport, rx_queue_id, true, false); + err =idpf_vc_queue_switch (vport, rx_queue_id, true, false);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch RX queue %u off" , rx_queue_id);
@@ -685,7 +685,7 @@ idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (tx_queue_id >= dev->data->nb_tx_queues)return -EINVAL ; - err =idpf_vc_switch_queue (vport, tx_queue_id, false, false); + err =idpf_vc_queue_switch (vport, tx_queue_id, false, false);if (err !=0 ) {PMD_DRV_LOG (ERR ,"Failed to switch TX queue %u off" , tx_queue_id);
Signature · 1 line
2.26.2
Quoted 81 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Monday, February 6, 2023 1:46 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v7 00/19] net/idpf: introduce idpf common modleFrom: Beilei Xing <[email protected]>
Refactor idpf pmd by introducing idpf common module, which will be also consumed by a new PMD - CPFL (Control Plane Function Library) PMD.
v2 changes:
- Refine irq map/unmap functions.
- Fix cross compile issue.
v3 changes:
- Embedvport_infofield into the vport structure.
- Refine APIs' name and order in version.map.
- Refine commit log.
v4 changes:
- Refine commit log.
v5 changes:
- Refine version.map.
- Fix typo.
- Return error log.
v6 changes:
- Refine API name in common module.
v7 changes:
- Change new files' copy right date to 2023.
- Correct format for meson.build.
- Changerte_atomicusages to compiler atomic built-ins.Beilei Xing (19):
common/idpf: add adapter structure
common/idpf: add vport structure
common/idpf: add virtual channel functions common/idpf: introduce adapter init and deinit common/idpf: add vport init/deinit
common/idpf: add config RSS
common/idpf: add irq map/unmap
common/idpf: support get packet type
common/idpf: add vport info initialization common/idpf: add vector flags in vport common/idpf: add rxq and txq struct
common/idpf: add help functions for queue setup and release common/idpf: add Rx and Tx data path
common/idpf: add vec queue setup
common/idpf: add avx512 for single queue model common/idpf: refine API name for vport functions common/idpf: refine API name for queue config module common/idpf: refine API name for data path module common/idpf: refine API name for virtual channel functionsdrivers/common/idpf/base/idpf_controlq_api.h | 6 - drivers/common/idpf/base/meson.build | 2 +- drivers/common/idpf/idpf_common_device.c | 655 +++++ drivers/common/idpf/idpf_common_device.h | 195 ++ drivers/common/idpf/idpf_common_logs.h | 47 + drivers/common/idpf/idpf_common_rxtx.c | 1458 ++++++++++++ drivers/common/idpf/idpf_common_rxtx.h | 278 +++ .../idpf/idpf_common_rxtx_avx512.c} | 26 +- .../idpf/idpf_common_virtchnl.c} | 947 ++------ drivers/common/idpf/idpf_common_virtchnl.h | 52 + drivers/common/idpf/meson.build | 35 + drivers/common/idpf/version.map | 61 +- drivers/net/idpf/idpf_ethdev.c | 552 +---- drivers/net/idpf/idpf_ethdev.h | 194 +- drivers/net/idpf/idpf_logs.h | 24 - drivers/net/idpf/idpf_rxtx.c | 2107 +++-------------- drivers/net/idpf/idpf_rxtx.h | 253 +- drivers/net/idpf/meson.build | 18 - 18 files changed, 3441 insertions(+), 3469 deletions(-) create mode 100644 drivers/common/idpf/idpf_common_device.c create mode 100644 drivers/common/idpf/idpf_common_device.h create mode 100644 drivers/common/idpf/idpf_common_logs.h create mode 100644 drivers/common/idpf/idpf_common_rxtx.c create mode 100644 drivers/common/idpf/idpf_common_rxtx.h rename drivers/{net/idpf/idpf_rxtx_vec_avx512.c =>
Quoted 6 lines
common/idpf/idpf_common_rxtx_avx512.c} (97%) renamedrivers/{net/idpf/idpf_vchnl.c=>common/idpf/idpf_common_virtchnl.c} (51%) create mode 100644drivers/common/idpf/idpf_common_virtchnl.h--
2.26.2
Applied to dpdk-next-net-intel.
Thanks
Qi