Skip to contentSkip to conversation

enable large VF configuration

PATCH Superseded Ting Xu 4 participants 44 messages Sep 9, 2020 – Oct 25, 2020 Network drivers

lore
Share & tools
lore

Ting Xu

author
#0 lore raw

cover enable large VF configuration

This patchset supports to configure up to 256 queue pairs per VF. If large VF is supported, 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. Enable VF to query the max RSS queue regions and report to users.

Ting Xu (2):
net/iavf: add IAVF request queues
net/iavf: enable large VF configuration

 drivers/net/iavf/iavf.h        |  41 +++-
 drivers/net/iavf/iavf_ethdev.c |  93 +++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 ++-
 drivers/net/iavf/iavf_vchnl.c  | 426 ++++++++++++++++++++++++++++++---
 4 files changed, 528 insertions(+), 59 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 net/iavf: add IAVF request queues

Add support for IAVF request queues from PF. VF sends desired queue pairs number to PF to ask for queue allocation. If the request succeeds, VF should reset. If fails, PF will return available queue pairs number.

---
 drivers/net/iavf/iavf.h        |  17 +++++
 drivers/net/iavf/iavf_ethdev.c |  12 +++-
 drivers/net/iavf/iavf_vchnl.c  | 117 +++++++++++++++++++++++++++++----
 3 files changed, 131 insertions(+), 15 deletions(-)
drivers/net/iavf/iavf.h +17 -0
index 9ad331ee9..1a42936a0 100644
@@ -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;
@@ -279,4 +295,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
index 8e1d8a8d3..48e474f53 100644
@@ -1196,7 +1196,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;
 
@@ -1213,6 +1213,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;
 }
 
@@ -1231,7 +1235,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;
@@ -1473,7 +1477,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 +105 -12

172 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add support to configure VSI queues, enable/disable queues and IRQ mapping for large VF. The max VF queue pairs number is 256. Request more queues from PF if allocated queues are not enough. Add support to query max RSS queue regions number. Large VF offload should be supported before configuring large VF.

---
 drivers/net/iavf/iavf.h        |  24 ++-
 drivers/net/iavf/iavf_ethdev.c |  81 +++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 ++-
 drivers/net/iavf/iavf_vchnl.c  | 309 ++++++++++++++++++++++++++++++---
 4 files changed, 397 insertions(+), 44 deletions(-)
drivers/net/iavf/iavf.h +19 -5
index 1a42936a0..a16365d3b 100644
@@ -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,17 @@ 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];
+	uint32_t max_rss_qregion; /* max RSS queue region supported by PF */
+	/* queue vector mapping */
+	struct iavf_qv_map *qv_map;
 	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
@@ -269,13 +277,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);
@@ -296,4 +309,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 +70 -11

163 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index 05a7dd898..86004ac90 100644
@@ -532,6 +532,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;
 
@@ -555,7 +556,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);
@@ -572,6 +577,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;
 
@@ -587,7 +593,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",
@@ -688,14 +697,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 +286 -23

367 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#3 lore raw

v2 cover enable large VF configuration

In reply to Ting Xu

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

---
v1->v2:
Change the communication with kernel PF

---
 drivers/net/iavf/iavf.h        |  40 ++-
 drivers/net/iavf/iavf_ethdev.c |  91 ++++++-
 drivers/net/iavf/iavf_rxtx.c   |  27 +-
 drivers/net/iavf/iavf_vchnl.c  | 436 ++++++++++++++++++++++++++++++---
 4 files changed, 539 insertions(+), 55 deletions(-)
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v2 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  | 134 ++++++++++++++++++++++++++++++---
 3 files changed, 148 insertions(+), 15 deletions(-)
drivers/net/iavf/iavf.h +17 -0
index 3198d85b3..bdc75ff50 100644
@@ -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;
@@ -279,4 +295,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
index 440da7d76..8fd9b44db 100644
@@ -1193,7 +1193,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;
 
@@ -1210,6 +1210,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;
 }
 
@@ -1228,7 +1232,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;
@@ -1475,7 +1479,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 +122 -12

189 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v2 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add 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 |  79 +++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 ++-
 drivers/net/iavf/iavf_vchnl.c  | 302 ++++++++++++++++++++++++++++++---
 4 files changed, 391 insertions(+), 40 deletions(-)
drivers/net/iavf/iavf.h +18 -5
index bdc75ff50..f506a934a 100644
@@ -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
@@ -269,13 +276,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);
@@ -296,4 +308,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 +69 -10

163 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index 05a7dd898..86004ac90 100644
@@ -532,6 +532,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;
 
@@ -555,7 +556,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);
@@ -572,6 +577,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;
 
@@ -587,7 +593,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",
@@ -688,14 +697,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 +282 -20

363 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#6 lore raw

v3 cover enable large VF configuration

In reply to Ting Xu

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. Modify based on comments

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
author
#7 lore raw

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
index d56611608..1c40f9bdf 100644
@@ -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
index a88d53ab0..33745a7b2 100644
@@ -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
author
#8 lore raw

PATCH v3 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add 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
index 1c40f9bdf..b2e896598 100644
@@ -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
index 7b81bf8ad..67300db5b 100644
@@ -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
author
#9 lore raw

v4 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (2):
net/iavf: add IAVF request queues function
net/iavf: enable large VF configuration

---
v3->v4:
Optimize handling messages from PF

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        |  32 +-
 drivers/net/iavf/iavf_ethdev.c | 126 +++++++-
 drivers/net/iavf/iavf_rxtx.c   |  27 +-
 drivers/net/iavf/iavf_vchnl.c  | 525 ++++++++++++++++++++++++++++-----
 4 files changed, 617 insertions(+), 93 deletions(-)
Signature · 1 line
2.17.1
author
#10 lore raw

PATCH v4 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h +9 -0
index d56611608..93c165c62 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +8 -3
index 8b1cf8f1c..a4a28b885 100644
@@ -1282,7 +1282,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;
 
@@ -1299,6 +1299,9 @@ 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;
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;
@@ -1911,7 +1914,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);
 
 	/*
 	 * disable promiscuous mode before reset vf
drivers/net/iavf/iavf_vchnl.c +175 -51

294 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#11 lore raw

PATCH v4 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add support to negotiate large VF capability, including configure VSI queues, enable/disable queues and IRQ mapping for large VF. Use new virtchnl opcodes and structures to help indicate up to 256 queue pairs. Need to request additional queues from PF first if the current allocated queues are not enough. Add the step to query the current max RSS queue region for RSS configuration since the max RSS queue region could be smaller than the allocated queue pairs.

---
 drivers/net/iavf/iavf.h        |  23 ++-
 drivers/net/iavf/iavf_ethdev.c | 115 +++++++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 ++-
 drivers/net/iavf/iavf_vchnl.c  | 301 ++++++++++++++++++++++++++++++---
 4 files changed, 426 insertions(+), 40 deletions(-)
drivers/net/iavf/iavf.h +18 -5
index 93c165c62..fa07f1545 100644
@@ -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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -149,14 +154,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
@@ -283,13 +290,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);
@@ -310,4 +322,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +105 -10

205 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index ca0f5d072..987eb3c4e 100644
@@ -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
author
#12 lore raw

v5 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (2):
net/iavf: add IAVF request queues function
net/iavf: enable large VF configuration

---
v4->v5:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  36 ++-
 drivers/net/iavf/iavf_ethdev.c | 156 ++++++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 +-
 drivers/net/iavf/iavf_vchnl.c  | 448 ++++++++++++++++++++++++++++-----
 4 files changed, 582 insertions(+), 85 deletions(-)
Signature · 1 line
2.17.1
author
#13 lore raw

PATCH v5 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h +9 -0
index d56611608..93c165c62 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +8 -3
index 8b1cf8f1c..a4a28b885 100644
@@ -1282,7 +1282,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;
 
@@ -1299,6 +1299,9 @@ 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;
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;
@@ -1911,7 +1914,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);
 
 	/*
 	 * disable promiscuous mode before reset vf
drivers/net/iavf/iavf_vchnl.c +175 -51

294 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#14 lore raw

PATCH v5 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add support to negotiate large VF capability, including configure VSI queues, enable/disable queues and IRQ mapping for large VF. Use new virtchnl opcodes and structures to help indicate up to 256 queue pairs. Need to request additional queues from PF first if the current allocated queues are not enough. Add the step to query the current max RSS queue region for RSS configuration since the max RSS queue region could be smaller than the allocated queue pairs.

---
 drivers/net/iavf/iavf.h        |  27 +++-
 drivers/net/iavf/iavf_ethdev.c | 145 +++++++++++++++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 +++-
 drivers/net/iavf/iavf_vchnl.c  | 224 +++++++++++++++++++++++++++++++--
 4 files changed, 391 insertions(+), 32 deletions(-)
drivers/net/iavf/iavf.h +21 -6
index 93c165c62..3de096879 100644
@@ -19,7 +19,11 @@
 #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_IRQ_MAP_NUM_PER_BUF	 128
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -104,8 +108,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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -149,14 +155,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
@@ -283,13 +291,19 @@ 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_configure_queues(struct iavf_adapter *adapter,
+			uint16_t num_queue_pairs, uint16_t index);
 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, uint16_t num);
 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);
@@ -310,4 +324,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +134 -11

253 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index ca0f5d072..987eb3c4e 100644
@@ -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 +214 -10

272 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#15 lore raw

v5 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (2):
net/iavf: add IAVF request queues function
net/iavf: enable large VF configuration

---
v4->v5:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 158 +++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  27 +-
 drivers/net/iavf/iavf_vchnl.c  | 450 ++++++++++++++++++++++++++++-----
 4 files changed, 587 insertions(+), 85 deletions(-)
Signature · 1 line
2.17.1
author
#16 lore raw

PATCH v5 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h +9 -0
index d56611608..93c165c62 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +8 -3
index 8b1cf8f1c..a4a28b885 100644
@@ -1282,7 +1282,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;
 
@@ -1299,6 +1299,9 @@ 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;
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;
@@ -1911,7 +1914,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);
 
 	/*
 	 * disable promiscuous mode before reset vf
drivers/net/iavf/iavf_vchnl.c +175 -51

294 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#17 lore raw

PATCH v5 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add support to negotiate large VF capability, including configure VSI queues, enable/disable queues and IRQ mapping for large VF. Use new virtchnl opcodes and structures to help indicate up to 256 queue pairs. Need to request additional queues from PF first if the current allocated queues are not enough. Add the step to query the current max RSS queue region for RSS configuration since the max RSS queue region could be smaller than the allocated queue pairs.

---
 drivers/net/iavf/iavf.h        |  28 +++-
 drivers/net/iavf/iavf_ethdev.c | 147 +++++++++++++++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 +++-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++++++++--
 4 files changed, 396 insertions(+), 32 deletions(-)
drivers/net/iavf/iavf.h +22 -6
index 93c165c62..f4ef92225 100644
@@ -19,7 +19,11 @@
 #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_IRQ_MAP_NUM_PER_BUF	 128
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -104,8 +108,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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -149,14 +155,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
@@ -283,13 +291,20 @@ 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_configure_queues(struct iavf_adapter *adapter,
+			uint16_t num_queue_pairs, uint16_t index);
 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, uint16_t num,
+			uint16_t index);
 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);
@@ -310,4 +325,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +136 -11

255 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index ca0f5d072..987eb3c4e 100644
@@ -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 +216 -10

274 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#18 lore raw

v6 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (2):
net/iavf: add IAVF request queues function
net/iavf: enable large VF configuration

---
v4->v6:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 158 +++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  27 +-
 drivers/net/iavf/iavf_vchnl.c  | 450 ++++++++++++++++++++++++++++-----
 4 files changed, 587 insertions(+), 85 deletions(-)
Signature · 1 line
2.17.1
author
#19 lore raw

PATCH v6 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h +9 -0
index d56611608..93c165c62 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +8 -3
index 8b1cf8f1c..a4a28b885 100644
@@ -1282,7 +1282,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;
 
@@ -1299,6 +1299,9 @@ 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;
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;
@@ -1911,7 +1914,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);
 
 	/*
 	 * disable promiscuous mode before reset vf
drivers/net/iavf/iavf_vchnl.c +175 -51

294 lines not on this page · raw message

Signature · 1 line
2.17.1
#20 lore raw

Re: [dpdk-dev] [PATCH v6 1/2] net/iavf: add IAVF request queues function

Quoted 28 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Friday, October 16, 2020 9:43 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v6 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-  drivers/net/iavf/iavf_vchnl.c  | 226
+++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h index renamed from drivers/net/iavf/iavf.h +0 -0

d56611608..93c165c62 100644

drivers/net/iavf/iavf.h struct iavf_fdir_info { · line 115

Quoted 9 lines
drivers/net/iavf/iavf.h +6 -0
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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 */
+};

Is there no such message type in shared code?

Quoted 23 lines
drivers/net/iavf/iavf.h +2 -0
+
 /* Structure to store private data specific for VF instance. */  struct iavf_info {
 	uint16_t num_queue_pairs;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +1 -1
index 8b1cf8f1c..a4a28b885 100644
@@ -1282,7 +1282,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;
 

drivers/net/iavf/iavf_ethdev.c iavf_check_vf_reset_done(struct iavf_hw *hw) · line 1303

Quoted 5 lines
drivers/net/iavf/iavf_ethdev.c +2 -0
@@ -1299,6 +1299,9 @@ 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;

Seems it's not related to the feature.
Is the fix for commit 1eab95fe2e36e191ad85a9aacf82a44e7c8011fc? If yes, it's better to separate bug fix from the feature.

Quoted 14 lines
drivers/net/iavf/iavf_ethdev.c +2 -1
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;

drivers/net/iavf/iavf_ethdev.c iavf_dev_close(struct rte_eth_dev *dev) · line 1919

Quoted 7 lines
drivers/net/iavf/iavf_ethdev.c +3 -1
@@ -1911,7 +1914,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);

Same as above.

Quoted 135 lines
drivers/net/iavf/iavf_ethdev.c +0 -0
 	/*
 	 * disable promiscuous mode before reset vf diff --git

a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 5e7142893..11a1ff608 100644

drivers/net/iavf/iavf_vchnl.c +38 -0
@@ -17,6 +17,7 @@
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
+#include <rte_ethdev_pci.h>
 #include <rte_dev.h>
 
 #include "iavf.h"
@@ -25,14 +26,54 @@
 #define MAX_TRY_TIMES 200
 #define ASQ_DELAY_MS  10
 
+static uint32_t
+iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed) {
+	uint32_t speed;
+
+	switch (virt_link_speed) {
+	case VIRTCHNL_LINK_SPEED_100MB:
+		speed = 100;
+		break;
+	case VIRTCHNL_LINK_SPEED_1GB:
+		speed = 1000;
+		break;
+	case VIRTCHNL_LINK_SPEED_10GB:
+		speed = 10000;
+		break;
+	case VIRTCHNL_LINK_SPEED_40GB:
+		speed = 40000;
+		break;
+	case VIRTCHNL_LINK_SPEED_20GB:
+		speed = 20000;
+		break;
+	case VIRTCHNL_LINK_SPEED_25GB:
+		speed = 25000;
+		break;
+	case VIRTCHNL_LINK_SPEED_2_5GB:
+		speed = 2500;
+		break;
+	case VIRTCHNL_LINK_SPEED_5GB:
+		speed = 5000;
+		break;
+	default:
+		speed = 0;
+		break;
+	}
+
+	return speed;
+}
+
 /* Read data in admin queue to get msg from pf driver */ -static enum

iavf_status

drivers/net/iavf/iavf_vchnl.c +6 -1
+static enum iavf_aq_result
 iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
 		     uint8_t *buf)
 {
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct rte_eth_dev *dev = adapter->eth_dev;
 	struct iavf_arq_event_info event;
+	enum iavf_aq_result result = IAVF_MSG_NON;
 	enum virtchnl_ops opcode;
 	int ret;
@@ -42,7 +83,9 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter,
 uint16_t buf_len,
 	/* Can't read any msg from adminQ */
 	if (ret) {
 		PMD_DRV_LOG(DEBUG, "Can't read msg from AQ");
-		return ret;
+		if (ret != IAVF_ERR_ADMIN_QUEUE_NO_WORK)
+			result = IAVF_MSG_ERR;
+		return result;
 	}
 

opcode = (enum
virtchnl_ops)rte_le_to_cpu_32(event.desc.cookie_high);

drivers/net/iavf/iavf_vchnl.c +39 -5
@@ -52,16 +95,51 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter,
 uint16_t buf_len,
 	PMD_DRV_LOG(DEBUG, "AQ from pf carries opcode %u, retval %d",
 		    opcode, vf->cmd_retval);
 
-	if (opcode != vf->pend_cmd) {
-		if (opcode != VIRTCHNL_OP_EVENT) {
-			PMD_DRV_LOG(WARNING,
-				    "command mismatch, expect %u, get %u",
-				    vf->pend_cmd, opcode);
+	if (opcode == VIRTCHNL_OP_EVENT) {
+		struct virtchnl_pf_event *vpe =
+			(struct virtchnl_pf_event *)event.msg_buf;
+
+		result = IAVF_MSG_SYS;
+		switch (vpe->event) {
+		case VIRTCHNL_EVENT_LINK_CHANGE:
+			vf->link_up =
+				vpe->event_data.link_event.link_status;
+			if (vf->vf_res->vf_cap_flags &
+				VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
+				vf->link_speed =
+				    vpe-
 >event_data.link_event_adv.link_speed;
+			} else {
+				enum virtchnl_link_speed speed;
+				speed = vpe-
 >event_data.link_event.link_speed;
+				vf->link_speed =
 iavf_convert_link_speed(speed);
+			}
+			iavf_dev_link_update(dev, 0);
+			PMD_DRV_LOG(INFO, "Link status update:%s",
+					vf->link_up ? "up" : "down");
+			break;
+		case VIRTCHNL_EVENT_RESET_IMPENDING:
+			vf->vf_reset = true;
+			PMD_DRV_LOG(INFO, "VF is resetting");
+			break;
+		case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
+			vf->dev_closed = true;
+			PMD_DRV_LOG(INFO, "PF driver closed");
+			break;
+		default:
+			PMD_DRV_LOG(ERR, "%s: Unknown event %d from pf",
+					__func__, vpe->event);
+		}
+	}  else {
+		/* async reply msg on command issued by vf previously */
+		result = IAVF_MSG_CMD;
+		if (opcode != vf->pend_cmd) {
+			PMD_DRV_LOG(WARNING, "command mismatch,

drivers/net/iavf/iavf_vchnl.c iavf_read_msg_from_pf(struct iavf_adapter *adapter, · line 143

Quoted 10 lines
drivers/net/iavf/iavf_vchnl.c +3 -2
 expect %u, get %u",
+					vf->pend_cmd, opcode);
+			result = IAVF_MSG_ERR;
 		}
-		return IAVF_ERR_OPCODE_MISMATCH;
 	}
 
-	return IAVF_SUCCESS;
+	return result;
 }

How about separate this part which is handling the msg from PF?

Quoted 182 lines

static int

drivers/net/iavf/iavf_vchnl.c +3 -2
@@ -69,6 +147,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)  {
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	enum iavf_aq_result result;
 	enum iavf_status ret;
 	int err = 0;
 	int i = 0;
@@ -97,9 +176,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 	case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
 		/* for init virtchnl ops, need to poll the response */
 		do {
-			ret = iavf_read_msg_from_pf(adapter, args->out_size,
+			result = iavf_read_msg_from_pf(adapter, args-
 >out_size,
 						   args->out_buffer);
-			if (ret == IAVF_SUCCESS)
+			if (result == IAVF_MSG_CMD)
 				break;
drivers/net/iavf/iavf_vchnl.c +23 -1
 			rte_delay_ms(ASQ_DELAY_MS);
 		} while (i++ < MAX_TRY_TIMES);
@@ -111,7 +190,33 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 		}
 		_clear_cmd(vf);
 		break;
-
+	case VIRTCHNL_OP_REQUEST_QUEUES:
+		/*
+		 * ignore async reply, only wait for system message,
+		 * vf_reset = true if get VIRTCHNL_EVENT_RESET_IMPENDING,
+		 * if not, means request queues failed.
+		 */
+		do {
+			result = iavf_read_msg_from_pf(adapter, args-
 >out_size,
+						   args->out_buffer);
+			if (result == IAVF_MSG_SYS && vf->vf_reset) {
+				break;
+			} else if (result == IAVF_MSG_CMD ||
+				result == IAVF_MSG_ERR) {
+				err = -1;
+				break;
+			}
+			rte_delay_ms(ASQ_DELAY_MS);
+			/* If don't read msg or read sys event, continue */
+		} while (i++ < MAX_TRY_TIMES);
+		if (i >= MAX_TRY_TIMES ||
+		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+			err = -1;
+			PMD_DRV_LOG(ERR, "No response or return failure

(%d)"

drivers/net/iavf/iavf_vchnl.c +4 -37
+				    " for cmd %d", vf->cmd_retval, args->ops);
+		}
+		_clear_cmd(vf);
+		break;
 	default:
 		/* For other virtchnl ops in running time,
 		 * wait for the cmd done flag.
@@ -136,44 +241,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 	return err;
 }
 
-static uint32_t
-iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed) -{
-	uint32_t speed;
-
-	switch (virt_link_speed) {
-	case VIRTCHNL_LINK_SPEED_100MB:
-		speed = 100;
-		break;
-	case VIRTCHNL_LINK_SPEED_1GB:
-		speed = 1000;
-		break;
-	case VIRTCHNL_LINK_SPEED_10GB:
-		speed = 10000;
-		break;
-	case VIRTCHNL_LINK_SPEED_40GB:
-		speed = 40000;
-		break;
-	case VIRTCHNL_LINK_SPEED_20GB:
-		speed = 20000;
-		break;
-	case VIRTCHNL_LINK_SPEED_25GB:
-		speed = 25000;
-		break;
-	case VIRTCHNL_LINK_SPEED_2_5GB:
-		speed = 2500;
-		break;
-	case VIRTCHNL_LINK_SPEED_5GB:
-		speed = 5000;
-		break;
-	default:
-		speed = 0;
-		break;
-	}
-
-	return speed;
-}
-
 static void
 iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 			uint16_t msglen)
@@ -389,7 +456,8 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
 	caps = IAVF_BASIC_OFFLOAD_CAPS |

VIRTCHNL_VF_CAP_ADV_LINK_SPEED |

drivers/net/iavf/iavf_vchnl.c +40 -1
 		VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
 		VIRTCHNL_VF_OFFLOAD_FDIR_PF |
-		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF;
+		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF |
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES;
 
 	args.in_args = (uint8_t *)&caps;
 	args.in_args_size = sizeof(caps);
@@ -1148,3 +1216,59 @@ iavf_add_del_mc_addr_list(struct iavf_adapter
 *adapter,
 
 	return 0;
 }
+
+int
+iavf_request_queues(struct iavf_adapter *adapter, uint16_t num) {
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct iavf_info *vf =  IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct virtchnl_vf_res_request vfres;
+	struct iavf_cmd_info args;
+	uint16_t num_queue_pairs;
+	int err;
+
+	if (!(vf->vf_res->vf_cap_flags &
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)) {
+		PMD_DRV_LOG(ERR, "request queues not supported");
+		return -1;
+	}
+
+	if (num == 0) {
+		PMD_DRV_LOG(ERR, "queue number cannot be zero");
+		return -1;
+	}
+	vfres.num_queue_pairs = num;
+
+	args.ops = VIRTCHNL_OP_REQUEST_QUEUES;
+	args.in_args = (u8 *)&vfres;
+	args.in_args_size = sizeof(vfres);
+	args.out_buffer = vf->aq_resp;
+	args.out_size = IAVF_AQ_BUF_SZ;
+
+	/*
+	 * disable interrupt to avoid the admin queue message to be read
+	 * before iavf_read_msg_from_pf.
+	 */
+	rte_intr_disable(&pci_dev->intr_handle);
+	err = iavf_execute_vf_cmd(adapter, &args);
+	rte_intr_enable(&pci_dev->intr_handle);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command

OP_REQUEST_QUEUES");

drivers/net/iavf/iavf_vchnl.c +12 -0
+		return err;
+	}
+
+	/* request queues succeeded, vf is resetting */
+	if (vf->vf_reset) {
+		PMD_DRV_LOG(INFO, "vf is resetting");
+		return 0;
+	}
+
+	/* request additional queues failed, return available number */
+	num_queue_pairs =
+	  ((struct virtchnl_vf_res_request *)args.out_buffer)-
Quoted 1 line

num_queue_pairs;

drivers/net/iavf/iavf_vchnl.c +5 -1
+	PMD_DRV_LOG(ERR, "request queues failed, only %u queues "
+		"available", num_queue_pairs);
+
+	return -1;
+}
--

2.17.1

author
#21 lore raw

Re: [dpdk-dev] [PATCH v6 1/2] net/iavf: add IAVF request queues function

Quoted 41 lines

-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Friday, October 16, 2020 4:42 PM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [PATCH v6 1/2] net/iavf: add IAVF request queues function

Quoted 32 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Friday, October 16, 2020 9:43 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v6 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        |   9 ++
 drivers/net/iavf/iavf_ethdev.c |  11 +-
drivers/net/iavf/iavf_vchnl.c  | 226
+++++++++++++++++++++++++--------
 3 files changed, 192 insertions(+), 54 deletions(-)
drivers/net/iavf/iavf.h index renamed from drivers/net/iavf/iavf.h +0 -0

d56611608..93c165c62 100644

drivers/net/iavf/iavf.h +0 -0
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
Quoted 9 lines

drivers/net/iavf/iavf.h struct iavf_fdir_info { · line 116

Quoted 6 lines
drivers/net/iavf/iavf.h +6 -0
+/* 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 */
+};

Is there no such message type in shared code?

Yes, I did not find similar codes suitable for this case.

Quoted 27 lines

drivers/net/iavf/iavf.h struct iavf_fdir_info { · line 117

Quoted 2 lines
drivers/net/iavf/iavf.h +1 -0
+
 /* Structure to store private data specific for VF instance. */  struct

iavf_info {

Quoted 24 lines
drivers/net/iavf/iavf.h +1 -0
 	uint16_t num_queue_pairs;
@@ -301,4 +309,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
(quoted diff) +0 -0

b/drivers/net/iavf/iavf_ethdev.c index 8b1cf8f1c..a4a28b885 100644

drivers/net/iavf/iavf_ethdev.c +1 -1
@@ -1282,7 +1282,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;
 
@@ -1299,6 +1299,9 @@ iavf_check_vf_reset_done(struct iavf_hw *hw)
 	if (i >= IAVF_RESET_WAIT_CNT)
 		return -1;
 
Quoted 7 lines

drivers/net/iavf/iavf_ethdev.c iavf_check_vf_reset_done(struct iavf_hw *hw) · line 1303

Quoted 2 lines
drivers/net/iavf/iavf_ethdev.c +2 -0
+	/* VF is not in reset or reset is completed */
+	vf->vf_reset = false;

Seems it's not related to the feature.
Is the fix for commit 1eab95fe2e36e191ad85a9aacf82a44e7c8011fc? If yes, it's better to separate bug fix from the feature.

I missed the vf->vf_reset setting at the bottom of iavf_dev_init(). It is not needed here.

Quoted 166 lines
Quoted 14 lines
drivers/net/iavf/iavf_ethdev.c +2 -1
+
 	return 0;
 }
 
@@ -1666,7 +1669,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;

drivers/net/iavf/iavf_ethdev.c iavf_dev_close(struct rte_eth_dev *dev) · line 1919

Quoted 7 lines
drivers/net/iavf/iavf_ethdev.c +3 -1
@@ -1911,7 +1914,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);

Same as above.

Quoted 142 lines
drivers/net/iavf/iavf_ethdev.c +0 -0
 	/*
 	 * disable promiscuous mode before reset vf diff --git

a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 5e7142893..11a1ff608 100644

drivers/net/iavf/iavf_vchnl.c +38 -0
@@ -17,6 +17,7 @@
 #include <rte_eal.h>
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
+#include <rte_ethdev_pci.h>
 #include <rte_dev.h>
 
 #include "iavf.h"
@@ -25,14 +26,54 @@
 #define MAX_TRY_TIMES 200
 #define ASQ_DELAY_MS  10
 
+static uint32_t
+iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed) {
+	uint32_t speed;
+
+	switch (virt_link_speed) {
+	case VIRTCHNL_LINK_SPEED_100MB:
+		speed = 100;
+		break;
+	case VIRTCHNL_LINK_SPEED_1GB:
+		speed = 1000;
+		break;
+	case VIRTCHNL_LINK_SPEED_10GB:
+		speed = 10000;
+		break;
+	case VIRTCHNL_LINK_SPEED_40GB:
+		speed = 40000;
+		break;
+	case VIRTCHNL_LINK_SPEED_20GB:
+		speed = 20000;
+		break;
+	case VIRTCHNL_LINK_SPEED_25GB:
+		speed = 25000;
+		break;
+	case VIRTCHNL_LINK_SPEED_2_5GB:
+		speed = 2500;
+		break;
+	case VIRTCHNL_LINK_SPEED_5GB:
+		speed = 5000;
+		break;
+	default:
+		speed = 0;
+		break;
+	}
+
+	return speed;
+}
+
 /* Read data in admin queue to get msg from pf driver */ -static enum

iavf_status

drivers/net/iavf/iavf_vchnl.c +6 -1
+static enum iavf_aq_result
 iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
 		     uint8_t *buf)
 {
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct rte_eth_dev *dev = adapter->eth_dev;
 	struct iavf_arq_event_info event;
+	enum iavf_aq_result result = IAVF_MSG_NON;
 	enum virtchnl_ops opcode;
 	int ret;
@@ -42,7 +83,9 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter,
 uint16_t buf_len,
 	/* Can't read any msg from adminQ */
 	if (ret) {
 		PMD_DRV_LOG(DEBUG, "Can't read msg from AQ");
-		return ret;
+		if (ret != IAVF_ERR_ADMIN_QUEUE_NO_WORK)
+			result = IAVF_MSG_ERR;
+		return result;
 	}
 

opcode = (enum
virtchnl_ops)rte_le_to_cpu_32(event.desc.cookie_high);

drivers/net/iavf/iavf_vchnl.c +41 -6
@@ -52,16 +95,51 @@ iavf_read_msg_from_pf(struct iavf_adapter
 *adapter, uint16_t buf_len,
 	PMD_DRV_LOG(DEBUG, "AQ from pf carries opcode %u, retval %d",
 		    opcode, vf->cmd_retval);
 
-	if (opcode != vf->pend_cmd) {
-		if (opcode != VIRTCHNL_OP_EVENT) {
-			PMD_DRV_LOG(WARNING,
-				    "command mismatch, expect %u, get %u",
-				    vf->pend_cmd, opcode);
+	if (opcode == VIRTCHNL_OP_EVENT) {
+		struct virtchnl_pf_event *vpe =
+			(struct virtchnl_pf_event *)event.msg_buf;
+
+		result = IAVF_MSG_SYS;
+		switch (vpe->event) {
+		case VIRTCHNL_EVENT_LINK_CHANGE:
+			vf->link_up =
+				vpe->event_data.link_event.link_status;
+			if (vf->vf_res->vf_cap_flags &
+				VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
+				vf->link_speed =
+				    vpe-
 >event_data.link_event_adv.link_speed;
+			} else {
+				enum virtchnl_link_speed speed;
+				speed = vpe-
 >event_data.link_event.link_speed;
+				vf->link_speed =
 iavf_convert_link_speed(speed);
+			}
+			iavf_dev_link_update(dev, 0);
+			PMD_DRV_LOG(INFO, "Link status update:%s",
+					vf->link_up ? "up" : "down");
+			break;
+		case VIRTCHNL_EVENT_RESET_IMPENDING:
+			vf->vf_reset = true;
+			PMD_DRV_LOG(INFO, "VF is resetting");
+			break;
+		case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
+			vf->dev_closed = true;
+			PMD_DRV_LOG(INFO, "PF driver closed");
+			break;
+		default:
+			PMD_DRV_LOG(ERR, "%s: Unknown event %d from pf",
+					__func__, vpe->event);
+		}
+	}  else {
+		/* async reply msg on command issued by vf previously */
+		result = IAVF_MSG_CMD;
+		if (opcode != vf->pend_cmd) {
+			PMD_DRV_LOG(WARNING, "command mismatch,
 expect %u, get %u",
+					vf->pend_cmd, opcode);
+			result = IAVF_MSG_ERR;
 		}
-		return IAVF_ERR_OPCODE_MISMATCH;
 	}
Quoted 6 lines

drivers/net/iavf/iavf_vchnl.c iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len, · line 143

Quoted 3 lines
drivers/net/iavf/iavf_vchnl.c +1 -1
-	return IAVF_SUCCESS;
+	return result;
 }

How about separate this part which is handling the msg from PF?

Done

Quoted 182 lines
Quoted 182 lines

static int

drivers/net/iavf/iavf_vchnl.c +3 -2
@@ -69,6 +147,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)  {
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	enum iavf_aq_result result;
 	enum iavf_status ret;
 	int err = 0;
 	int i = 0;
@@ -97,9 +176,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 	case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
 		/* for init virtchnl ops, need to poll the response */
 		do {
-			ret = iavf_read_msg_from_pf(adapter, args->out_size,
+			result = iavf_read_msg_from_pf(adapter, args-
 >out_size,
 						   args->out_buffer);
-			if (ret == IAVF_SUCCESS)
+			if (result == IAVF_MSG_CMD)
 				break;
drivers/net/iavf/iavf_vchnl.c +23 -1
 			rte_delay_ms(ASQ_DELAY_MS);
 		} while (i++ < MAX_TRY_TIMES);
@@ -111,7 +190,33 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 		}
 		_clear_cmd(vf);
 		break;
-
+	case VIRTCHNL_OP_REQUEST_QUEUES:
+		/*
+		 * ignore async reply, only wait for system message,
+		 * vf_reset = true if get VIRTCHNL_EVENT_RESET_IMPENDING,
+		 * if not, means request queues failed.
+		 */
+		do {
+			result = iavf_read_msg_from_pf(adapter, args-
 >out_size,
+						   args->out_buffer);
+			if (result == IAVF_MSG_SYS && vf->vf_reset) {
+				break;
+			} else if (result == IAVF_MSG_CMD ||
+				result == IAVF_MSG_ERR) {
+				err = -1;
+				break;
+			}
+			rte_delay_ms(ASQ_DELAY_MS);
+			/* If don't read msg or read sys event, continue */
+		} while (i++ < MAX_TRY_TIMES);
+		if (i >= MAX_TRY_TIMES ||
+		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+			err = -1;
+			PMD_DRV_LOG(ERR, "No response or return failure

(%d)"

drivers/net/iavf/iavf_vchnl.c +4 -37
+				    " for cmd %d", vf->cmd_retval, args->ops);
+		}
+		_clear_cmd(vf);
+		break;
 	default:
 		/* For other virtchnl ops in running time,
 		 * wait for the cmd done flag.
@@ -136,44 +241,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
 struct iavf_cmd_info *args)
 	return err;
 }
 
-static uint32_t
-iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed) -{
-	uint32_t speed;
-
-	switch (virt_link_speed) {
-	case VIRTCHNL_LINK_SPEED_100MB:
-		speed = 100;
-		break;
-	case VIRTCHNL_LINK_SPEED_1GB:
-		speed = 1000;
-		break;
-	case VIRTCHNL_LINK_SPEED_10GB:
-		speed = 10000;
-		break;
-	case VIRTCHNL_LINK_SPEED_40GB:
-		speed = 40000;
-		break;
-	case VIRTCHNL_LINK_SPEED_20GB:
-		speed = 20000;
-		break;
-	case VIRTCHNL_LINK_SPEED_25GB:
-		speed = 25000;
-		break;
-	case VIRTCHNL_LINK_SPEED_2_5GB:
-		speed = 2500;
-		break;
-	case VIRTCHNL_LINK_SPEED_5GB:
-		speed = 5000;
-		break;
-	default:
-		speed = 0;
-		break;
-	}
-
-	return speed;
-}
-
 static void
 iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 			uint16_t msglen)
@@ -389,7 +456,8 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
 	caps = IAVF_BASIC_OFFLOAD_CAPS |

VIRTCHNL_VF_CAP_ADV_LINK_SPEED |

drivers/net/iavf/iavf_vchnl.c +40 -1
 		VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
 		VIRTCHNL_VF_OFFLOAD_FDIR_PF |
-		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF;
+		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF |
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES;
 
 	args.in_args = (uint8_t *)&caps;
 	args.in_args_size = sizeof(caps);
@@ -1148,3 +1216,59 @@ iavf_add_del_mc_addr_list(struct iavf_adapter
 *adapter,
 
 	return 0;
 }
+
+int
+iavf_request_queues(struct iavf_adapter *adapter, uint16_t num) {
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct iavf_info *vf =  IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct virtchnl_vf_res_request vfres;
+	struct iavf_cmd_info args;
+	uint16_t num_queue_pairs;
+	int err;
+
+	if (!(vf->vf_res->vf_cap_flags &
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)) {
+		PMD_DRV_LOG(ERR, "request queues not supported");
+		return -1;
+	}
+
+	if (num == 0) {
+		PMD_DRV_LOG(ERR, "queue number cannot be zero");
+		return -1;
+	}
+	vfres.num_queue_pairs = num;
+
+	args.ops = VIRTCHNL_OP_REQUEST_QUEUES;
+	args.in_args = (u8 *)&vfres;
+	args.in_args_size = sizeof(vfres);
+	args.out_buffer = vf->aq_resp;
+	args.out_size = IAVF_AQ_BUF_SZ;
+
+	/*
+	 * disable interrupt to avoid the admin queue message to be read
+	 * before iavf_read_msg_from_pf.
+	 */
+	rte_intr_disable(&pci_dev->intr_handle);
+	err = iavf_execute_vf_cmd(adapter, &args);
+	rte_intr_enable(&pci_dev->intr_handle);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command

OP_REQUEST_QUEUES");

drivers/net/iavf/iavf_vchnl.c +12 -0
+		return err;
+	}
+
+	/* request queues succeeded, vf is resetting */
+	if (vf->vf_reset) {
+		PMD_DRV_LOG(INFO, "vf is resetting");
+		return 0;
+	}
+
+	/* request additional queues failed, return available number */
+	num_queue_pairs =
+	  ((struct virtchnl_vf_res_request *)args.out_buffer)-
Quoted 1 line

num_queue_pairs;

drivers/net/iavf/iavf_vchnl.c +5 -1
+	PMD_DRV_LOG(ERR, "request queues failed, only %u queues "
+		"available", num_queue_pairs);
+
+	return -1;
+}
--

2.17.1

author
#22 lore raw

PATCH v6 2/2 net/iavf: enable large VF configuration

In reply to Ting Xu

Add support to negotiate large VF capability, including configure VSI queues, enable/disable queues and IRQ mapping for large VF. Use new virtchnl opcodes and structures to help indicate up to 256 queue pairs. Need to request additional queues from PF first if the current allocated queues are not enough. Add the step to query the current max RSS queue region for RSS configuration since the max RSS queue region could be smaller than the allocated queue pairs.

---
 drivers/net/iavf/iavf.h        |  28 +++-
 drivers/net/iavf/iavf_ethdev.c | 147 +++++++++++++++++++--
 drivers/net/iavf/iavf_rxtx.c   |  27 +++-
 drivers/net/iavf/iavf_vchnl.c  | 226 +++++++++++++++++++++++++++++++--
 4 files changed, 396 insertions(+), 32 deletions(-)
drivers/net/iavf/iavf.h +22 -6
index 93c165c62..f4ef92225 100644
@@ -19,7 +19,11 @@
 #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_IRQ_MAP_NUM_PER_BUF	 128
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -104,8 +108,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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -149,14 +155,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
@@ -283,13 +291,20 @@ 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_configure_queues(struct iavf_adapter *adapter,
+			uint16_t num_queue_pairs, uint16_t index);
 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, uint16_t num,
+			uint16_t index);
 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);
@@ -310,4 +325,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +136 -11

255 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +22 -5
index ca0f5d072..987eb3c4e 100644
@@ -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 +216 -10

274 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#23 lore raw

v7 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (6):
net/iavf: handle virtchnl event message without interrupt net/iavf: add IAVF request queues function net/iavf: negotiate large VF and request more queues net/iavf: enable multiple queues configurations for large VF net/iavf: enable IRQ mapping configuration for large VF net/iavf: add enable/disable queues for large VF

---
v6->v7:
Separate patches.

v4->v6:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 144 ++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  25 +-
 drivers/net/iavf/iavf_vchnl.c  | 450 ++++++++++++++++++++++++++++-----
 4 files changed, 576 insertions(+), 80 deletions(-)
Signature · 1 line
2.17.1
author
#24 lore raw

PATCH v7 1/6 net/iavf: handle virtchnl event message without interrupt

Currently, VF only handle virtchnl event message when interrupt is called. In some cases, event message is supposed to be handled with interrupt disabled, for example request queues. To solve this issue, virtchnl event message handling are added in reading message from PF in this patch.

---
 drivers/net/iavf/iavf.h       |   8 ++
 drivers/net/iavf/iavf_vchnl.c | 138 ++++++++++++++++++++++------------
 2 files changed, 97 insertions(+), 49 deletions(-)
drivers/net/iavf/iavf.h +8 -0
index 3198d85b3..9c16324c1 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
drivers/net/iavf/iavf_vchnl.c +89 -49

185 lines not on this page · raw message

Signature · 1 line
2.17.1
#25 lore raw

Re: [dpdk-dev] [PATCH v7 1/6] net/iavf: handle virtchnl event message without interrupt

Quoted 11 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Sunday, October 18, 2020 6:34 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v7 1/6] net/iavf: handle virtchnl event message without interrupt

The patch looks fine to me except the some typo in commit log:

Quoted 4 lines

Currently, VF only handle virtchnl event message when interrupt is called. In some cases, event message is supposed to be handled with interrupt disabled, for example request queues. To solve this issue, virtchnl event message handling are added in reading message from PF in this patch.

It's better to explain why we need the asynchronous way, but not use the example of request queues

Quoted 7 lines
---
 drivers/net/iavf/iavf.h       |   8 ++
 drivers/net/iavf/iavf_vchnl.c | 138 ++++++++++++++++++++++------------
 2 files changed, 97 insertions(+), 49 deletions(-)
author
#26 lore raw

PATCH v7 2/6 net/iavf: add IAVF request queues function

In reply to Ting Xu

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 to report info, disable interrupt before request queues to receive the adminq message.

---
 drivers/net/iavf/iavf.h       |  1 +
 drivers/net/iavf/iavf_vchnl.c | 88 ++++++++++++++++++++++++++++++++++-
 2 files changed, 87 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf.h +1 -0
index 9c16324c1..778b6c23c 100644
@@ -287,4 +287,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_vchnl.c +86 -2

109 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#27 lore raw

PATCH v7 3/6 net/iavf: negotiate large VF and request more queues

In reply to Ting Xu

Negotiate large VF capability with PF during VF initialization. If large VF is supported and the number of queues larger than 16 is required, VF requests additional queues from PF. Mark the state that large VF is supported.

If the allocated queues number is larger than 16, the max RSS queue region cannot be 16 anymore. Add the function to query max RSS queue region from PF, use it in the RSS initialization and future filters configuration.

---
 drivers/net/iavf/iavf.h        |  7 +++-
 drivers/net/iavf/iavf_ethdev.c | 74 ++++++++++++++++++++++++++++++++--
 drivers/net/iavf/iavf_vchnl.c  | 33 ++++++++++++++-
 3 files changed, 109 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +6 -1
index 778b6c23c..49ccfeece 100644
@@ -19,7 +19,8 @@
 #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_NUM_MACADDR_MAX      64
 
@@ -149,6 +150,7 @@ 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 */
+	uint16_t max_rss_qregion; /* max RSS queue region supported by PF */
 	/* queue bitmask for each vector */
 	uint16_t rxq_map[IAVF_MAX_MSIX_VECTORS];
 	struct iavf_flow_list flow_list;
@@ -157,6 +159,8 @@ struct iavf_info {
 	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
@@ -288,4 +292,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +71 -3

104 lines not on this page · raw message

drivers/net/iavf/iavf_vchnl.c +32 -1
index 9caf8ee70..e939b275a 100644
@@ -457,7 +457,8 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
 		VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
 		VIRTCHNL_VF_OFFLOAD_FDIR_PF |
 		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF |
-		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES;
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |
+		VIRTCHNL_VF_LARGE_NUM_QPAIRS;
 
 	args.in_args = (uint8_t *)&caps;
 	args.in_args_size = sizeof(caps);
@@ -1270,3 +1271,33 @@ iavf_request_queues(struct iavf_adapter *adapter, uint16_t num)
 
 	return -1;
 }
+
+int
+iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
+{
+	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint16_t qregion_width;
+	int err;
+
+	args.ops = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
+	args.in_args = NULL;
+	args.in_args_size = 0;
+	args.out_buffer = vf->aq_resp;
+	args.out_size = IAVF_AQ_BUF_SZ;
+
+	err = iavf_execute_vf_cmd(adapter, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of "
+			    "VIRTCHNL_OP_GET_MAX_RSS_QREGION");
+		return err;
+	}
+
+	qregion_width =
+	((struct virtchnl_max_rss_qregion *)args.out_buffer)->qregion_width;
+
+	vf->max_rss_qregion = (uint16_t)(1 << qregion_width);
+
+	return 0;
+}
Signature · 1 line
2.17.1
author
#28 lore raw

PATCH v7 4/6 net/iavf: enable multiple queues configurations for large VF

In reply to Ting Xu

Since the adminq buffer size has a 4K limitation, the current virtchnl command VIRTCHNL_OP_CONFIG_VSI_QUEUES cannot send the message only once to configure up to 256 queues. In this patch, we send the messages multiple times to make sure that the buffer size is less than 4K each time.

---
 drivers/net/iavf/iavf.h        |  4 +++-
 drivers/net/iavf/iavf_ethdev.c | 18 +++++++++++++++++-
 drivers/net/iavf/iavf_vchnl.c  | 11 ++++++-----
 3 files changed, 26 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf.h +3 -1
index 49ccfeece..1cdac1b10 100644
@@ -21,6 +21,7 @@
 
 #define IAVF_MAX_NUM_QUEUES_DFLT	 16
 #define IAVF_MAX_NUM_QUEUES_LV		 256
+#define IAVF_CFG_Q_NUM_PER_BUF		 32
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -269,7 +270,8 @@ int iavf_enable_queues(struct iavf_adapter *adapter);
 int iavf_disable_queues(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_configure_queues(struct iavf_adapter *adapter,
+			uint16_t num_queue_pairs, uint16_t index);
 int iavf_get_supported_rxdid(struct iavf_adapter *adapter);
 int iavf_config_irq_map(struct iavf_adapter *adapter);
 void iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add);
drivers/net/iavf/iavf_ethdev.c +17 -1
index f41be2b7d..db334b390 100644
@@ -550,6 +550,8 @@ iavf_dev_start(struct rte_eth_dev *dev)
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
+	uint16_t num_queue_pairs;
+	uint16_t index = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -558,13 +560,27 @@ iavf_dev_start(struct rte_eth_dev *dev)
 	vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
 				      dev->data->nb_tx_queues);
+	num_queue_pairs = vf->num_queue_pairs;
 
 	if (iavf_init_queues(dev) != 0) {
 		PMD_DRV_LOG(ERR, "failed to do Queue init");
 		return -1;
 	}
 
-	if (iavf_configure_queues(adapter) != 0) {
+	/* If needed, send configure queues msg multiple times to make the
+	 * adminq buffer length smaller than the 4K limitation.
+	 */
+	while (num_queue_pairs > IAVF_CFG_Q_NUM_PER_BUF) {
+		if (iavf_configure_queues(adapter,
+				IAVF_CFG_Q_NUM_PER_BUF, index) != 0) {
+			PMD_DRV_LOG(ERR, "configure queues failed");
+			goto err_queue;
+		}
+		num_queue_pairs -= IAVF_CFG_Q_NUM_PER_BUF;
+		index += IAVF_CFG_Q_NUM_PER_BUF;
+	}
+
+	if (iavf_configure_queues(adapter, num_queue_pairs, index) != 0) {
 		PMD_DRV_LOG(ERR, "configure queues failed");
 		goto err_queue;
 	}
drivers/net/iavf/iavf_vchnl.c +6 -5
index e939b275a..829963434 100644
@@ -673,7 +673,8 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
 }
 
 int
-iavf_configure_queues(struct iavf_adapter *adapter)
+iavf_configure_queues(struct iavf_adapter *adapter,
+		uint16_t num_queue_pairs, uint16_t index)
 {
 	struct iavf_rx_queue **rxq =
 		(struct iavf_rx_queue **)adapter->eth_dev->data->rx_queues;
@@ -687,16 +688,16 @@ iavf_configure_queues(struct iavf_adapter *adapter)
 	int err;
 
 	size = sizeof(*vc_config) +
-	       sizeof(vc_config->qpair[0]) * vf->num_queue_pairs;
+	       sizeof(vc_config->qpair[0]) * num_queue_pairs;
 	vc_config = rte_zmalloc("cfg_queue", size, 0);
 	if (!vc_config)
 		return -ENOMEM;
 
 	vc_config->vsi_id = vf->vsi_res->vsi_id;
-	vc_config->num_queue_pairs = vf->num_queue_pairs;
+	vc_config->num_queue_pairs = num_queue_pairs;
 
-	for (i = 0, vc_qp = vc_config->qpair;
-	     i < vf->num_queue_pairs;
+	for (i = index, vc_qp = vc_config->qpair;
+		 i < index + num_queue_pairs;
 	     i++, vc_qp++) {
 		vc_qp->txq.vsi_id = vf->vsi_res->vsi_id;
 		vc_qp->txq.queue_id = i;
Signature · 1 line
2.17.1
author
#29 lore raw

PATCH v7 5/6 net/iavf: enable IRQ mapping configuration for large VF

In reply to Ting Xu

The current IRQ mapping configuration only supports max 16 queues and 16 MSIX vectors. Change the queue vector mapping structure to indicate up to 256 queues. A new opcode is used to handle the case with large number of queues. To avoid adminq buffer size limitation, we support to send the virtchnl message multiple times if needed.

---
 drivers/net/iavf/iavf.h        | 12 +++++---
 drivers/net/iavf/iavf_ethdev.c | 52 +++++++++++++++++++++++++++++-----
 drivers/net/iavf/iavf_vchnl.c  | 50 +++++++++++++++++++++++++++++---
 3 files changed, 99 insertions(+), 15 deletions(-)
drivers/net/iavf/iavf.h +8 -4
index 1cdac1b10..5e330b215 100644
@@ -22,6 +22,7 @@
 #define IAVF_MAX_NUM_QUEUES_DFLT	 16
 #define IAVF_MAX_NUM_QUEUES_LV		 256
 #define IAVF_CFG_Q_NUM_PER_BUF		 32
+#define IAVF_IRQ_MAP_NUM_PER_BUF	 128
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -106,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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -152,8 +155,7 @@ struct iavf_info {
 	uint16_t nb_msix;   /* number of MSI-X interrupts on Rx */
 	uint16_t msix_base; /* msix vector base from */
 	uint16_t max_rss_qregion; /* max RSS queue region supported by PF */
-	/* queue bitmask for each vector */
-	uint16_t rxq_map[IAVF_MAX_MSIX_VECTORS];
+	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;
@@ -274,6 +276,8 @@ int iavf_configure_queues(struct iavf_adapter *adapter,
 			uint16_t num_queue_pairs, uint16_t index);
 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, uint16_t num,
+			uint16_t index);
 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);
drivers/net/iavf/iavf_ethdev.c +45 -7

93 lines not on this page · raw message

drivers/net/iavf/iavf_vchnl.c +46 -4

65 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#30 lore raw

PATCH v7 6/6 net/iavf: add enable/disable queues for large VF

In reply to Ting Xu

The current virtchnl structure for enable/disable queues only supports max 32 queue pairs. Use a new opcode and structure to indicate up to 256 queue pairs, in order to enable/disable queues in large VF case.

---
 drivers/net/iavf/iavf.h       |   5 ++
 drivers/net/iavf/iavf_rxtx.c  |  25 ++++++-
 drivers/net/iavf/iavf_vchnl.c | 132 ++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+), 3 deletions(-)
drivers/net/iavf/iavf.h +5 -0
index 5e330b215..3d3b0da5d 100644
@@ -23,6 +23,7 @@
 #define IAVF_MAX_NUM_QUEUES_LV		 256
 #define IAVF_CFG_Q_NUM_PER_BUF		 32
 #define IAVF_IRQ_MAP_NUM_PER_BUF	 128
+#define IAVF_RXTX_QUEUE_CHUNKS_NUM	 2
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -268,8 +269,12 @@ 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,
drivers/net/iavf/iavf_rxtx.c +22 -3
index 1b0efe043..ed052dda1 100644
@@ -531,6 +531,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_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct iavf_rx_queue *rxq;
 	int err = 0;
@@ -555,7 +556,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);
@@ -571,6 +576,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_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct iavf_tx_queue *txq;
 	int err = 0;
@@ -587,7 +593,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",
@@ -688,12 +697,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 (!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");
+	}
+
 	if (ret)
 		PMD_DRV_LOG(WARNING, "Fail to stop queues");
 
drivers/net/iavf/iavf_vchnl.c +132 -0

138 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#31 lore raw

v8 cover enable large VF configuration

In reply to Ting Xu

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 for RSS and filter configuration.

Ting Xu (6):
net/iavf: handle virtchnl event message without interrupt net/iavf: add IAVF request queues function net/iavf: negotiate large VF and request more queues net/iavf: enable multiple queues configurations for large VF net/iavf: enable IRQ mapping configuration for large VF net/iavf: add enable/disable queues for large VF

---
v7->v8:
Modify commit logs.
Make log sentences in one line.

v6->v7:
Separate patches.

v4->v6:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 142 ++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  25 +-
 drivers/net/iavf/iavf_vchnl.c  | 448 ++++++++++++++++++++++++++++-----
 4 files changed, 572 insertions(+), 80 deletions(-)
Signature · 1 line
2.17.1
author
#32 lore raw

PATCH v8 1/6 net/iavf: handle virtchnl event message without interrupt

Currently, VF can only handle virtchnl event message by calling interrupt. It is not available in two cases:
1. If the event message comes during VF initialization before interrupt is enabled, this message will not be handled correctly.
2. Some virtchnl commands need to receive the event message and handle it with interrupt disabled.
To solve this issue, we add the virtchnl event message handling in the process of reading vitchnl messages in adminq from PF.

---
 drivers/net/iavf/iavf.h       |   8 ++
 drivers/net/iavf/iavf_vchnl.c | 138 ++++++++++++++++++++++------------
 2 files changed, 97 insertions(+), 49 deletions(-)
drivers/net/iavf/iavf.h +8 -0
index 3198d85b3..9c16324c1 100644
@@ -107,6 +107,14 @@ struct iavf_fdir_info {
 /* TODO: is that correct to assume the max number to be 16 ?*/
 #define IAVF_MAX_MSIX_VECTORS   16
 
+/* 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;
drivers/net/iavf/iavf_vchnl.c +89 -49

185 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#33 lore raw

PATCH v8 2/6 net/iavf: add IAVF request queues function

In reply to Ting Xu

Add a 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 per VF, enable this request queues function.

When requesting queues succeeds, PF will return an event message. If it is handled by interrupt first, the request queues command cannot receive the correct PF response and will wait until timeout. Therefore, disable interrupt before requesting queues in order to handle the event message asynchronously.

---
 drivers/net/iavf/iavf.h       |  1 +
 drivers/net/iavf/iavf_vchnl.c | 88 ++++++++++++++++++++++++++++++++++-
 2 files changed, 87 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf.h +1 -0
index 9c16324c1..778b6c23c 100644
@@ -287,4 +287,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 iavf_adapter *adapter, uint16_t num);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_vchnl.c +86 -2

109 lines not on this page · raw message

Signature · 1 line
2.17.1
#34 lore raw

Re: [dpdk-dev] [PATCH v8 2/6] net/iavf: add IAVF request queues function

Quoted 7 lines · Ting Xu

Add a 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 per VF, enable this request queues function.

When requesting queues succeeds, PF will return an event message. If it is handled by interrupt first, the request queues command cannot receive the correct PF response and will wait until timeout.

Why interrupt is not working? Is the PF not generating an interrupt when this request/command executed?

Quoted 5 lines

Therefore, disable
interrupt before requesting queues in order to handle the event message asynchronously.

<...>

author
#35 lore raw

Re: [dpdk-dev] [PATCH v8 2/6] net/iavf: add IAVF request queues function

Quoted 13 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 23, 2020 6:07 PM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 2/6] net/iavf: add IAVF request queues function

Quoted 3 lines · Ting Xu

Add a 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 per VF, enable this request queues

Quoted 9 lines

function.

Quoted 4 lines

When requesting queues succeeds, PF will return an event message. If it is handled by interrupt first, the request queues command cannot receive the correct PF response and will wait until timeout.

Why interrupt is not working? Is the PF not generating an interrupt when this request/command executed?

If request queues command succeeds, PF will reset VF and return event message, which will trigger interrupt in the legacy way; if request queues fails, PF will return VIRTCHNL_OP_REQUEST_QUEUES message and report available queues in iavf_read_msg_from_pf() . Therefore, after we send request queues command, we cannot leave to wait for interrupt, but should loop in iavf_execute_vf_cmd() to read adminq message, including event and VIRTCHNL_OP_REQUEST_QUEUES message. So interrupt should be disabled.

Quoted 7 lines
Quoted 5 lines

Therefore, disable
interrupt before requesting queues in order to handle the event message asynchronously.

<...>

#36 lore raw

Re: [dpdk-dev] [PATCH v8 2/6] net/iavf: add IAVF request queues function

In reply to Ting Xu
Quoted 4 lines · Ting Xu

Add a 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 per VF, enable this request queues function.

If there is a "256" queue pair limit, should it be added into the function, right now it gets "uint16_t num" parameter?

Quoted 7 lines

When requesting queues succeeds, PF will return an event message. If it is handled by interrupt first, the request queues command cannot receive the correct PF response and will wait until timeout. Therefore, disable interrupt before requesting queues in order to handle the event message asynchronously.

<...>

#37 lore raw

Re: [dpdk-dev] [PATCH v8 2/6] net/iavf: add IAVF request queues function

Quoted 8 lines · Ferruh Yigit
Quoted 4 lines · Ting Xu

Add a 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 per VF, enable this request queues function.

If there is a "256" queue pair limit, should it be added into the function, right now it gets "uint16_t num" parameter?

Ahh, I can see it is enforced by caller in next patch, that is OK.

Quoted 10 lines
Quoted 7 lines

When requesting queues succeeds, PF will return an event message. If it is handled by interrupt first, the request queues command cannot receive the correct PF response and will wait until timeout. Therefore, disable interrupt before requesting queues in order to handle the event message asynchronously.

<...>

author
#38 lore raw

PATCH v8 3/6 net/iavf: negotiate large VF and request more queues

In reply to Ting Xu

Negotiate large VF capability with PF during VF initialization. If large VF is supported and the number of queues larger than 16 is required, VF requests additional queues from PF. Mark the state that large VF is supported.

If the allocated queues number is larger than 16, the max RSS queue region cannot be 16 anymore. Add the function to query max RSS queue region from PF, use it in the RSS initialization and future filters configuration.

---
 drivers/net/iavf/iavf.h        |  7 +++-
 drivers/net/iavf/iavf_ethdev.c | 74 ++++++++++++++++++++++++++++++++--
 drivers/net/iavf/iavf_vchnl.c  | 31 +++++++++++++-
 3 files changed, 107 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf.h +6 -1
index 778b6c23c..49ccfeece 100644
@@ -19,7 +19,8 @@
 #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_NUM_MACADDR_MAX      64
 
@@ -149,6 +150,7 @@ 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 */
+	uint16_t max_rss_qregion; /* max RSS queue region supported by PF */
 	/* queue bitmask for each vector */
 	uint16_t rxq_map[IAVF_MAX_MSIX_VECTORS];
 	struct iavf_flow_list flow_list;
@@ -157,6 +159,8 @@ struct iavf_info {
 	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
@@ -288,4 +292,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 iavf_adapter *adapter, uint16_t num);
+int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
 #endif /* _IAVF_ETHDEV_H_ */
drivers/net/iavf/iavf_ethdev.c +71 -3

104 lines not on this page · raw message

drivers/net/iavf/iavf_vchnl.c +30 -1
index 323e2a843..2c49a0e76 100644
@@ -457,7 +457,8 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
 		VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
 		VIRTCHNL_VF_OFFLOAD_FDIR_PF |
 		VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF |
-		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES;
+		VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |
+		VIRTCHNL_VF_LARGE_NUM_QPAIRS;
 
 	args.in_args = (uint8_t *)&caps;
 	args.in_args_size = sizeof(caps);
@@ -1267,3 +1268,31 @@ iavf_request_queues(struct iavf_adapter *adapter, uint16_t num)
 
 	return -1;
 }
+
+int
+iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
+{
+	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint16_t qregion_width;
+	int err;
+
+	args.ops = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
+	args.in_args = NULL;
+	args.in_args_size = 0;
+	args.out_buffer = vf->aq_resp;
+	args.out_size = IAVF_AQ_BUF_SZ;
+
+	err = iavf_execute_vf_cmd(adapter, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR, "Failed to execute command of VIRTCHNL_OP_GET_MAX_RSS_QREGION");
+		return err;
+	}
+
+	qregion_width =
+	((struct virtchnl_max_rss_qregion *)args.out_buffer)->qregion_width;
+
+	vf->max_rss_qregion = (uint16_t)(1 << qregion_width);
+
+	return 0;
+}
Signature · 1 line
2.17.1
author
#39 lore raw

PATCH v8 4/6 net/iavf: enable multiple queues configurations for large VF

In reply to Ting Xu

Since the adminq buffer size has a 4K limitation, the current virtchnl command VIRTCHNL_OP_CONFIG_VSI_QUEUES cannot send the message only once to configure up to 256 queues. In this patch, we send the messages multiple times to make sure that the buffer size is less than 4K each time.

---
 drivers/net/iavf/iavf.h        |  4 +++-
 drivers/net/iavf/iavf_ethdev.c | 18 +++++++++++++++++-
 drivers/net/iavf/iavf_vchnl.c  | 11 ++++++-----
 3 files changed, 26 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf.h +3 -1
index 49ccfeece..1cdac1b10 100644
@@ -21,6 +21,7 @@
 
 #define IAVF_MAX_NUM_QUEUES_DFLT	 16
 #define IAVF_MAX_NUM_QUEUES_LV		 256
+#define IAVF_CFG_Q_NUM_PER_BUF		 32
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -269,7 +270,8 @@ int iavf_enable_queues(struct iavf_adapter *adapter);
 int iavf_disable_queues(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_configure_queues(struct iavf_adapter *adapter,
+			uint16_t num_queue_pairs, uint16_t index);
 int iavf_get_supported_rxdid(struct iavf_adapter *adapter);
 int iavf_config_irq_map(struct iavf_adapter *adapter);
 void iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add);
drivers/net/iavf/iavf_ethdev.c +17 -1
index 87082d1cc..db9449590 100644
@@ -564,6 +564,8 @@ iavf_dev_start(struct rte_eth_dev *dev)
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
+	uint16_t num_queue_pairs;
+	uint16_t index = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -572,13 +574,27 @@ iavf_dev_start(struct rte_eth_dev *dev)
 	vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
 				      dev->data->nb_tx_queues);
+	num_queue_pairs = vf->num_queue_pairs;
 
 	if (iavf_init_queues(dev) != 0) {
 		PMD_DRV_LOG(ERR, "failed to do Queue init");
 		return -1;
 	}
 
-	if (iavf_configure_queues(adapter) != 0) {
+	/* If needed, send configure queues msg multiple times to make the
+	 * adminq buffer length smaller than the 4K limitation.
+	 */
+	while (num_queue_pairs > IAVF_CFG_Q_NUM_PER_BUF) {
+		if (iavf_configure_queues(adapter,
+				IAVF_CFG_Q_NUM_PER_BUF, index) != 0) {
+			PMD_DRV_LOG(ERR, "configure queues failed");
+			goto err_queue;
+		}
+		num_queue_pairs -= IAVF_CFG_Q_NUM_PER_BUF;
+		index += IAVF_CFG_Q_NUM_PER_BUF;
+	}
+
+	if (iavf_configure_queues(adapter, num_queue_pairs, index) != 0) {
 		PMD_DRV_LOG(ERR, "configure queues failed");
 		goto err_queue;
 	}
drivers/net/iavf/iavf_vchnl.c +6 -5
index 2c49a0e76..7e6abeca9 100644
@@ -673,7 +673,8 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
 }
 
 int
-iavf_configure_queues(struct iavf_adapter *adapter)
+iavf_configure_queues(struct iavf_adapter *adapter,
+		uint16_t num_queue_pairs, uint16_t index)
 {
 	struct iavf_rx_queue **rxq =
 		(struct iavf_rx_queue **)adapter->eth_dev->data->rx_queues;
@@ -687,16 +688,16 @@ iavf_configure_queues(struct iavf_adapter *adapter)
 	int err;
 
 	size = sizeof(*vc_config) +
-	       sizeof(vc_config->qpair[0]) * vf->num_queue_pairs;
+	       sizeof(vc_config->qpair[0]) * num_queue_pairs;
 	vc_config = rte_zmalloc("cfg_queue", size, 0);
 	if (!vc_config)
 		return -ENOMEM;
 
 	vc_config->vsi_id = vf->vsi_res->vsi_id;
-	vc_config->num_queue_pairs = vf->num_queue_pairs;
+	vc_config->num_queue_pairs = num_queue_pairs;
 
-	for (i = 0, vc_qp = vc_config->qpair;
-	     i < vf->num_queue_pairs;
+	for (i = index, vc_qp = vc_config->qpair;
+		 i < index + num_queue_pairs;
 	     i++, vc_qp++) {
 		vc_qp->txq.vsi_id = vf->vsi_res->vsi_id;
 		vc_qp->txq.queue_id = i;
Signature · 1 line
2.17.1
author
#40 lore raw

PATCH v8 5/6 net/iavf: enable IRQ mapping configuration for large VF

In reply to Ting Xu

The current IRQ mapping configuration only supports max 16 queues and 16 MSIX vectors. Change the queue vector mapping structure to indicate up to 256 queues. A new opcode is used to handle the case with large number of queues. To avoid adminq buffer size limitation, we support to send the virtchnl message multiple times if needed.

---
 drivers/net/iavf/iavf.h        | 12 +++++---
 drivers/net/iavf/iavf_ethdev.c | 50 +++++++++++++++++++++++++++++-----
 drivers/net/iavf/iavf_vchnl.c  | 50 +++++++++++++++++++++++++++++++---
 3 files changed, 97 insertions(+), 15 deletions(-)
drivers/net/iavf/iavf.h +8 -4
index 1cdac1b10..5e330b215 100644
@@ -22,6 +22,7 @@
 #define IAVF_MAX_NUM_QUEUES_DFLT	 16
 #define IAVF_MAX_NUM_QUEUES_LV		 256
 #define IAVF_CFG_Q_NUM_PER_BUF		 32
+#define IAVF_IRQ_MAP_NUM_PER_BUF	 128
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -106,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;
+};
 
 /* Message type read in admin queue from PF */
 enum iavf_aq_result {
@@ -152,8 +155,7 @@ struct iavf_info {
 	uint16_t nb_msix;   /* number of MSI-X interrupts on Rx */
 	uint16_t msix_base; /* msix vector base from */
 	uint16_t max_rss_qregion; /* max RSS queue region supported by PF */
-	/* queue bitmask for each vector */
-	uint16_t rxq_map[IAVF_MAX_MSIX_VECTORS];
+	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;
@@ -274,6 +276,8 @@ int iavf_configure_queues(struct iavf_adapter *adapter,
 			uint16_t num_queue_pairs, uint16_t index);
 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, uint16_t num,
+			uint16_t index);
 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);
drivers/net/iavf/iavf_ethdev.c +43 -7

91 lines not on this page · raw message

drivers/net/iavf/iavf_vchnl.c +46 -4

65 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#41 lore raw

PATCH v8 6/6 net/iavf: add enable/disable queues for large VF

In reply to Ting Xu

The current virtchnl structure for enable/disable queues only supports max 32 queue pairs. Use a new opcode and structure to indicate up to 256 queue pairs, in order to enable/disable queues in large VF case.

---
 drivers/net/iavf/iavf.h       |   5 ++
 drivers/net/iavf/iavf_rxtx.c  |  25 ++++++-
 drivers/net/iavf/iavf_vchnl.c | 132 ++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+), 3 deletions(-)
drivers/net/iavf/iavf.h +5 -0
index 5e330b215..3d3b0da5d 100644
@@ -23,6 +23,7 @@
 #define IAVF_MAX_NUM_QUEUES_LV		 256
 #define IAVF_CFG_Q_NUM_PER_BUF		 32
 #define IAVF_IRQ_MAP_NUM_PER_BUF	 128
+#define IAVF_RXTX_QUEUE_CHUNKS_NUM	 2
 
 #define IAVF_NUM_MACADDR_MAX      64
 
@@ -268,8 +269,12 @@ 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,
drivers/net/iavf/iavf_rxtx.c +22 -3
index 7d4f4ed48..6635f7fd9 100644
@@ -532,6 +532,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_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct iavf_rx_queue *rxq;
 	int err = 0;
@@ -556,7 +557,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);
@@ -572,6 +577,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_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct iavf_tx_queue *txq;
 	int err = 0;
@@ -588,7 +594,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",
@@ -689,12 +698,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 (!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");
+	}
+
 	if (ret)
 		PMD_DRV_LOG(WARNING, "Fail to stop queues");
 
drivers/net/iavf/iavf_vchnl.c +132 -0

138 lines not on this page · raw message

Signature · 1 line
2.17.1
Acked-by on the v8 series
#42 lore raw
In reply to Ting Xu
Quoted 56 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Thursday, October 22, 2020 2:49 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v8 0/6] 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 for RSS and filter configuration.

Ting Xu (6):
net/iavf: handle virtchnl event message without interrupt net/iavf: add IAVF request queues function net/iavf: negotiate large VF and request more queues net/iavf: enable multiple queues configurations for large VF net/iavf: enable IRQ mapping configuration for large VF net/iavf: add enable/disable queues for large VF

---
v7->v8:
Modify commit logs.
Make log sentences in one line.

v6->v7:
Separate patches.

v4->v6:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 142 ++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  25 +-
 drivers/net/iavf/iavf_vchnl.c  | 448 ++++++++++++++++++++++++++++-----
 4 files changed, 572 insertions(+), 80 deletions(-)
Quoted 2 lines

--
2.17.1

Applied
#43 lore raw
Quoted 67 lines

-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Thursday, October 22, 2020 2:55 PM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [PATCH v8 0/6] enable large VF configuration

Quoted 56 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Thursday, October 22, 2020 2:49 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v8 0/6] 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 for RSS and filter configuration.

Ting Xu (6):
net/iavf: handle virtchnl event message without interrupt net/iavf: add IAVF request queues function net/iavf: negotiate large VF and request more queues net/iavf: enable multiple queues configurations for large VF net/iavf: enable IRQ mapping configuration for large VF net/iavf: add enable/disable queues for large VF

---
v7->v8:
Modify commit logs.
Make log sentences in one line.

v6->v7:
Separate patches.

v4->v6:
Solve queue mapping buffer limitation issue.
Optimize VSI queue configuration

v3->v4:
Optimize handling messages from PF.

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        |  37 ++-
 drivers/net/iavf/iavf_ethdev.c | 142 ++++++++++-
 drivers/net/iavf/iavf_rxtx.c   |  25 +-
 drivers/net/iavf/iavf_vchnl.c  | 448
++++++++++++++++++++++++++++-----
 4 files changed, 572 insertions(+), 80 deletions(-)
Quoted 4 lines
Quoted 2 lines

--
2.17.1

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 1 line