enable large VF configuration
v3 cover enable large VF configuration
This patchset supports to configure up to 256 queue pairs per VF. If large VF is supported after capability negotiation, VF will request queues from PF as needed. New virtual channel opcodes and structures are used to indicate 256 queues, so VF is designed to handle the new function of configure VSI queues, IRQ mapping and enable/disable queues. Also, enable VF to query the max RSS queue region.
Ting Xu (2):
net/iavf: add IAVF request queues function
net/iavf: enable large VF configuration
---v2->v3:
Fix coding style issue.
Move get max RSS queue region after VF reset.
Add request queues capability negotiation.
v1->v2:
Change the communication with kernel PF.
--- drivers/net/iavf/iavf.h | 40 ++- drivers/net/iavf/iavf_ethdev.c | 102 +++++++- drivers/net/iavf/iavf_rxtx.c | 27 +- drivers/net/iavf/iavf_vchnl.c | 444 ++++++++++++++++++++++++++++++--- 4 files changed, 558 insertions(+), 55 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/2 net/iavf: add IAVF request queues function
Add new virtchnl function to request additional queues from PF. Current default queue pairs number when creating a VF is 16. In order to support up to 256 queue pairs, enable this request queues function. Since request queues command may return event message, modify function iavf_read_msg_from_pf to identify event opcode and mark VF reset status.
--- drivers/net/iavf/iavf.h | 17 ++++ drivers/net/iavf/iavf_ethdev.c | 12 ++- drivers/net/iavf/iavf_vchnl.c | 145 ++++++++++++++++++++++++++++++--- 3 files changed, 158 insertions(+), 16 deletions(-)
drivers/net/iavf/iavf.h +17 -0
@@ -107,6 +107,21 @@ struct iavf_fdir_info {/* TODO: is that correct to assume the max number to be 16 ?*/ #define IAVF_MAX_MSIX_VECTORS 16 +/* Event status from PF */ +enum pending_msg { +PFMSG_LINK_CHANGE =0x1 , +PFMSG_RESET_IMPENDING =0x2 , +PFMSG_DRIVER_CLOSE =0x4 , +}; + +/* Message type read in admin queue from PF */ +enum iavf_aq_result { +IAVF_MSG_ERR =-1 ,/* Meet error when accessing admin queue */ +IAVF_MSG_NON ,/* Read nothing from admin queue */ +IAVF_MSG_SYS ,/* Read system msg from admin queue */ +IAVF_MSG_CMD ,/* Read async command result */ +}; +/* Structure to store private data specific for VF instance. */ struct iavf_info {uint16_t num_queue_pairs;
@@ -123,6 +138,7 @@ struct iavf_info {volatile enum virtchnl_ops pend_cmd;/* pending command not finished */ uint32_t cmd_retval;/* return value of the cmd response from PF */ uint8_t *aq_resp;/* buffer to store the adminq response from PF */ +uint16_t pend_msg;/* flags indicates events from pf not handled yet */ /* Event from pf */ bool dev_closed;
@@ -301,4 +317,5 @@ int iavf_add_del_rss_cfg(struct iavf_adapter *adapter,int iavf_add_del_mc_addr_list (struct iavf_adapter *adapter,struct rte_ether_addr *mc_addrs,uint32_t mc_addrs_num,bool add); +int iavf_request_queues (struct rte_eth_dev *dev,uint16_t num);#endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +9 -3
@@ -1236,7 +1236,7 @@ iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) }static int -iavf_check_vf_reset_done (struct iavf_hw *hw) +iavf_check_vf_reset_done (struct iavf_hw *hw,struct iavf_info *vf) {int i, reset;
@@ -1253,6 +1253,10 @@ iavf_check_vf_reset_done(struct iavf_hw *hw)if (i >=IAVF_RESET_WAIT_CNT )return -1 ; +/* VF is not in reset or reset is completed */ + vf->vf_reset = false; + vf->pend_msg &= ~PFMSG_RESET_IMPENDING ; +return 0 ; }
@@ -1620,7 +1624,7 @@ iavf_init_vf(struct rte_eth_dev *dev) goto err; } - err =iavf_check_vf_reset_done (hw); + err =iavf_check_vf_reset_done (hw, vf);if (err) {PMD_INIT_LOG (ERR ,"VF is still resetting" ); goto err;
@@ -1869,7 +1873,9 @@ iavf_dev_close(struct rte_eth_dev *dev)iavf_dev_stop (dev);iavf_flow_flush (dev,NULL ); -iavf_flow_uninit (adapter); +/* if VF is in reset, adminq is disabled, skip the process via adminq */ +if (!vf->vf_reset) +iavf_flow_uninit (adapter);iavf_shutdown_adminq (hw);/* disable uio intr before callback unregister */ rte_intr_disable (intr_handle);
drivers/net/iavf/iavf_vchnl.c +132 -13
206 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/2 net/iavf: enable large VF configuration
In reply to Ting XuAdd support to negotiate large VF capability, configure VSI queues, enable/disable queues and IRQ mapping for large VF. Use new virtchnl opcodes and structures to support max 256 queue pairs. Request additional queues from PF first if current allocated queues are not enough. Query max RSS queue region for future RSS configuration.
--- drivers/net/iavf/iavf.h | 23 ++- drivers/net/iavf/iavf_ethdev.c | 90 ++++++++-- drivers/net/iavf/iavf_rxtx.c | 27 ++- drivers/net/iavf/iavf_vchnl.c | 301 ++++++++++++++++++++++++++++++--- 4 files changed, 401 insertions(+), 40 deletions(-)
drivers/net/iavf/iavf.h +18 -5
@@ -19,7 +19,10 @@#define IAVF_FRAME_SIZE_MAX 9728#define IAVF_QUEUE_BASE_ADDR_UNIT 128 -#define IAVF_MAX_NUM_QUEUES 16 +#define IAVF_MAX_NUM_QUEUES_DFLT 16 +#define IAVF_MAX_NUM_QUEUES_LV 256 +#define IAVF_RXTX_QUEUE_CHUNKS_NUM 2 +#define IAVF_CFG_Q_NUM_PER_BUF 32#define IAVF_NUM_MACADDR_MAX 64
@@ -104,8 +107,10 @@ struct iavf_fdir_info {struct iavf_fdir_conf conf; }; -/* TODO: is that correct to assume the max number to be 16 ?*/ -#define IAVF_MAX_MSIX_VECTORS 16 +struct iavf_qv_map { +uint16_t queue_id; +uint16_t vector_id; +};/* Event status from PF */ enum pending_msg {
@@ -157,14 +162,16 @@ struct iavf_info {uint8_t *rss_key;uint16_t nb_msix;/* number of MSI-X interrupts on Rx */ uint16_t msix_base;/* msix vector base from */ -/* queue bitmask for each vector */ -uint16_t rxq_map[IAVF_MAX_MSIX_VECTORS ]; +uint16_t max_rss_qregion;/* max RSS queue region supported by PF */ +struct iavf_qv_map *qv_map;/* queue vector mapping */ struct iavf_flow_list flow_list;rte_spinlock_t flow_ops_lock;struct iavf_parser_list rss_parser_list;struct iavf_parser_list dist_parser_list;struct iavf_fdir_info fdir;/* flow director info */ +/* indicate large VF support enabled or not */ +bool lv_enabled; };#define IAVF_MAX_PKT_TYPE 1024
@@ -291,13 +298,18 @@ int iavf_enable_vlan_strip(struct iavf_adapter *adapter);int iavf_disable_vlan_strip (struct iavf_adapter *adapter);int iavf_switch_queue (struct iavf_adapter *adapter,uint16_t qid,bool rx,bool on); +int iavf_switch_queue_lv (struct iavf_adapter *adapter,uint16_t qid, +bool rx,bool on);int iavf_enable_queues (struct iavf_adapter *adapter); +int iavf_enable_queues_lv (struct iavf_adapter *adapter);int iavf_disable_queues (struct iavf_adapter *adapter); +int iavf_disable_queues_lv (struct iavf_adapter *adapter);int iavf_configure_rss_lut (struct iavf_adapter *adapter);int iavf_configure_rss_key (struct iavf_adapter *adapter);int iavf_configure_queues (struct iavf_adapter *adapter);int iavf_get_supported_rxdid (struct iavf_adapter *adapter);int iavf_config_irq_map (struct iavf_adapter *adapter); +int iavf_config_irq_map_lv (struct iavf_adapter *adapter);void iavf_add_del_all_mac_addr (struct iavf_adapter *adapter,bool add);int iavf_dev_link_update (struct rte_eth_dev *dev, __rte_unused int wait_to_complete);
@@ -318,4 +330,5 @@ int iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num, bool add);int iavf_request_queues (struct rte_eth_dev *dev,uint16_t num); +int iavf_get_max_rss_queue_region (struct iavf_adapter *adapter);#endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +80 -10
174 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx.c +22 -5
@@ -720,6 +720,7 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)struct iavf_adapter *adapter =IAVF_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);struct iavf_hw *hw =IAVF_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);struct iavf_rx_queue *rxq;int err =0 ;
@@ -743,7 +744,11 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)IAVF_WRITE_FLUSH (hw);/* Ready to switch the queue on */ - err =iavf_switch_queue (adapter, rx_queue_id, true, true); +if (!vf->lv_enabled) + err =iavf_switch_queue (adapter, rx_queue_id, true, true); +else + err =iavf_switch_queue_lv (adapter, rx_queue_id, true, true); +if (err)PMD_DRV_LOG (ERR ,"Failed to switch RX queue %u on" , rx_queue_id);
@@ -760,6 +765,7 @@ iavf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)struct iavf_adapter *adapter =IAVF_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);struct iavf_hw *hw =IAVF_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);struct iavf_tx_queue *txq;int err =0 ;
@@ -775,7 +781,10 @@ iavf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)IAVF_WRITE_FLUSH (hw);/* Ready to switch the queue on */ - err =iavf_switch_queue (adapter, tx_queue_id, false, true); +if (!vf->lv_enabled) + err =iavf_switch_queue (adapter, tx_queue_id, false, true); +else + err =iavf_switch_queue_lv (adapter, tx_queue_id, false, true);if (err) PMD_DRV_LOG(ERR, "Failed to switch TX queue %u on",
@@ -876,14 +885,22 @@ iavf_stop_queues(struct rte_eth_dev *dev) {struct iavf_adapter *adapter =IAVF_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);struct iavf_rx_queue *rxq;struct iavf_tx_queue *txq;int ret, i;/* Stop All queues */ - ret =iavf_disable_queues (adapter); -if (ret) -PMD_DRV_LOG (WARNING ,"Fail to stop queues" ); +if (!vf->lv_enabled) { + ret =iavf_disable_queues (adapter); +if (ret) +PMD_DRV_LOG (WARNING ,"Fail to stop queues" ); + }else { + ret =iavf_disable_queues_lv (adapter); +if (ret) +PMD_DRV_LOG (WARNING ,"Fail to stop queues for large VF" ); + } +for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
drivers/net/iavf/iavf_vchnl.c +281 -20
356 lines not on this page · raw message
Signature · 1 line
2.17.1