Skip to contentSkip to conversation

support of configurable CRC stripping in VF

PATCH Superseded Helin Zhang 4 participants 15 messages Sep 14, 2014 – Nov 6, 2014 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

v2 cover support of configurable CRC stripping in VF

To support configurable CRC stripping in both PF host and VF, a new operation and a new structure are added to carry more configurations from VF to PF host.

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Put processing crc stripping configuration in PF host into a single patch.
* Put setting the crc stripping into a single patch.
* Put the configuring crc stripping in VF into a single patch.
* Added several more code style fixes reported by checkpatch.pl.

Helin Zhang (5):
config: remove useless i40e items in config files
i40e: renaming and code style fix
i40e: support of processing crc stripping config in PF host
i40e: set crc stripping in rx queue configuration
i40evf: support of configurable crc stripping in VF

 config/common_bsdapp                 |   1 -
 config/common_linuxapp               |   1 -
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 188 ++++++++++++++++++++++++-----------
 lib/librte_pmd_i40e/i40e_pf.c        |  94 +++++++++++-------
 lib/librte_pmd_i40e/i40e_pf.h        |   7 ++
 5 files changed, 193 insertions(+), 98 deletions(-)
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1410706109-30448-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH v2 1/5 config: remove useless i40e items in config files

Remove 'CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC' from config files of 'common_bsdapp' and 'common_linuxapp', as nowhere uses it.

---
 config/common_bsdapp   | 1 -
 config/common_linuxapp | 1 -
 2 files changed, 2 deletions(-)
config/common_bsdapp +0 -1
index bf6d8a0..c62388a 100644
@@ -180,7 +180,6 @@ CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_DRIVER=n
-CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=n
 CONFIG_RTE_LIBRTE_I40E_ALLOW_UNSUPPORTED_SFP=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
config/common_linuxapp +0 -1
index 9047975..c680a63 100644
@@ -203,7 +203,6 @@ CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_DRIVER=n
-CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC=n
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_ALLOW_UNSUPPORTED_SFP=n
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH v2 2/5 i40e: renaming and code style fix

In reply to a message not in the archive

Rename some local variables in i40e_pf.c and i40e_ethdev_vf.c, to express more accurately and briefly. Fix several issues in i40e_pf.c reported by checkpatch.pl. Line warpping for some source lines which has more than 80 characters, and merge lines together for those source lines which does not need any line wrapping actually.

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Add several more code style fixes for i40e_pf.c.

---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 75 ++++++++++++++++++------------------
 lib/librte_pmd_i40e/i40e_pf.c        | 53 +++++++++++--------------
 2 files changed, 61 insertions(+), 67 deletions(-)
lib/librte_pmd_i40e/i40e_ethdev_vf.c +38 -37
index d8552ad..113bff8 100644
@@ -527,27 +527,27 @@ static int
 i40evf_configure_queues(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct i40e_virtchnl_vsi_queue_config_info *queue_info;
-	struct i40e_virtchnl_queue_pair_info *queue_cfg;
 	struct i40e_rx_queue **rxq =
 		(struct i40e_rx_queue **)dev->data->rx_queues;
 	struct i40e_tx_queue **txq =
 		(struct i40e_tx_queue **)dev->data->tx_queues;
-	int i, len, nb_qpairs, num_rxq, num_txq;
-	int err;
+	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci;
+	struct i40e_virtchnl_queue_pair_info *vc_qpi;
+	int size, i, nb_qp, ret, num_rxq, num_txq;
 	struct vf_cmd_info args;
 	struct rte_pktmbuf_pool_private *mbp_priv;
 
-	nb_qpairs = vf->num_queue_pairs;
-	len = sizeof(*queue_info) + sizeof(*queue_cfg) * nb_qpairs;
-	queue_info = rte_zmalloc("queue_info", len, 0);
-	if (queue_info == NULL) {
-		PMD_INIT_LOG(ERR, "failed alloc memory for queue_info\n");
-		return -1;
+	nb_qp = vf->num_queue_pairs;
+	size = sizeof(*vc_vqci) + sizeof(*vc_qpi) * nb_qp;
+	vc_vqci = rte_zmalloc("vc_vqci", size, 0);
+	if (!vc_vqci) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory for VF "
+					"configuring queues\n");
+		return -ENOMEM;
 	}
-	queue_info->vsi_id = vf->vsi_res->vsi_id;
-	queue_info->num_queue_pairs = nb_qpairs;
-	queue_cfg = queue_info->qpair;
+	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
+	vc_vqci->num_queue_pairs = nb_qp;
+	vc_qpi = vc_vqci->qpair;
 
 	num_rxq = dev->data->nb_rx_queues;
 	num_txq = dev->data->nb_tx_queues;
@@ -557,48 +557,49 @@ i40evf_configure_queues(struct rte_eth_dev *dev)
 	 * work that way. The solution is fills 0 with HW ring option in case
 	 * they are not equal.
 	 */
-	for (i = 0; i < nb_qpairs; i++) {
+	for (i = 0; i < nb_qp; i++) {
 		/*Fill TX info */
-		queue_cfg->txq.vsi_id = queue_info->vsi_id;
-		queue_cfg->txq.queue_id = i;
+		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->txq.queue_id = i;
 		if (i < num_txq) {
-			queue_cfg->txq.ring_len = txq[i]->nb_tx_desc;
-			queue_cfg->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
+			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
 		} else {
-			queue_cfg->txq.ring_len = 0;
-			queue_cfg->txq.dma_ring_addr = 0;
+			vc_qpi->txq.ring_len = 0;
+			vc_qpi->txq.dma_ring_addr = 0;
 		}
 
 		/* Fill RX info */
-		queue_cfg->rxq.vsi_id = queue_info->vsi_id;
-		queue_cfg->rxq.queue_id = i;
-		queue_cfg->rxq.max_pkt_size = vf->max_pkt_len;
+		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->rxq.queue_id = i;
+		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
 		if (i < num_rxq) {
 			mbp_priv = rte_mempool_get_priv(rxq[i]->mp);
-			queue_cfg->rxq.databuffer_size = mbp_priv->mbuf_data_room_size -
-						   RTE_PKTMBUF_HEADROOM;;
-			queue_cfg->rxq.ring_len = rxq[i]->nb_rx_desc;
-			queue_cfg->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;;
+			vc_qpi->rxq.databuffer_size =
+				mbp_priv->mbuf_data_room_size -
+					RTE_PKTMBUF_HEADROOM;
+			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
+			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
 		} else {
-			queue_cfg->rxq.ring_len = 0;
-			queue_cfg->rxq.dma_ring_addr = 0;
-			queue_cfg->rxq.databuffer_size = 0;
+			vc_qpi->rxq.ring_len = 0;
+			vc_qpi->rxq.dma_ring_addr = 0;
+			vc_qpi->rxq.databuffer_size = 0;
 		}
-		queue_cfg++;
+		vc_qpi++;
 	}
 
 	args.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
-	args.in_args = (u8 *)queue_info;
-	args.in_args_size = len;
+	args.in_args = (uint8_t *)vc_vqci;
+	args.in_args_size = size;
 	args.out_buffer = cmd_result_buffer;
 	args.out_size = I40E_AQ_BUF_SZ;
-	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	ret = i40evf_execute_vf_cmd(dev, &args);
+	if (ret)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 				"OP_CONFIG_VSI_QUEUES\n");
-	rte_free(queue_info);
+	rte_free(vc_vqci);
 
-	return err;
+	return ret;
 }
 
 static int
lib/librte_pmd_i40e/i40e_pf.c +23 -30

112 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#4 lore raw

PATCH v2 3/5 i40e: support of processing crc stripping config in PF host

In reply to a message not in the archive

To support processing the extra configuration of crc stripping in DPDK PF host, new 'struct i40e_virtchnl_queue_pair_extra_info' and a new virtual channel operation of 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX' are added, and also functions are reworked to support configuring VSI queues with or without crc stripping configuration.

v2 changes:
* Put processing crc stripping configuration in PF host into a single patch.

---
 lib/librte_pmd_i40e/i40e_pf.c | 38 ++++++++++++++++++++++++++++++--------
 lib/librte_pmd_i40e/i40e_pf.h |  7 +++++++
 2 files changed, 37 insertions(+), 8 deletions(-)
lib/librte_pmd_i40e/i40e_pf.c +30 -8
index 1583021..bc9bfcb 100644
@@ -327,7 +327,8 @@ send_msg:
 static int
 i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
 			    struct i40e_pf_vf *vf,
-			    struct i40e_virtchnl_rxq_info *rxq)
+			    struct i40e_virtchnl_rxq_info *rxq,
+			    struct i40e_virtchnl_queue_pair_extra_info *qpei)
 {
 	int err = I40E_SUCCESS;
 	struct i40e_hmc_obj_rxq rx_ctx;
@@ -411,13 +412,15 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   int opcode)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
 	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci =
 		(struct i40e_virtchnl_vsi_queue_config_info *)msg;
 	struct i40e_virtchnl_queue_pair_info *vc_qpi;
+	struct i40e_virtchnl_queue_pair_extra_info *vc_qpei = NULL;
 	int i, ret = I40E_SUCCESS;
 
 	if (msg == NULL || msglen <= sizeof(*vc_vqci) ||
@@ -428,6 +431,12 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 	}
 
 	vc_qpi = vc_vqci->qpair;
+	if (opcode == I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX)
+		vc_qpei = (struct i40e_virtchnl_queue_pair_extra_info *)
+						(((uint8_t *)vc_qpi) +
+			(sizeof(struct i40e_virtchnl_queue_pair_info) *
+					vc_vqci->num_queue_pairs));
+
 	for (i = 0; i < vc_vqci->num_queue_pairs; i++) {
 		if (vc_qpi[i].rxq.queue_id > vsi->nb_qps - 1 ||
 			vc_qpi[i].txq.queue_id > vsi->nb_qps - 1) {
@@ -435,9 +444,16 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 			goto send_msg;
 		}
 
-		/* Apply VF RX queue setting to HMC */
-		if (i40e_pf_host_hmc_config_rxq(hw, vf, &vc_qpi[i].rxq)
-			!= I40E_SUCCESS) {
+		/*
+		 * Apply VF RX queue setting to HMC.
+		 * If the opcode is I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX,
+		 * then the extra information of
+		 * 'struct i40e_virtchnl_queue_pair_extra_info' is needed,
+		 * otherwise set the last parameter to NULL.
+		 */
+		if (i40e_pf_host_hmc_config_rxq(hw, vf, &vc_qpi[i].rxq,
+			(vc_qpei != NULL ? (&vc_qpei[i]) : NULL)) !=
+							I40E_SUCCESS) {
 			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
@@ -453,8 +469,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 	}
 
 send_msg:
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
-							ret, NULL, 0);
+	i40e_pf_host_send_msg_to_vf(vf, opcode, ret, NULL, 0);
+
 	return ret;
 }
 
@@ -870,7 +886,13 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received\n");
-		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg,
+						msglen, opcode);
+		break;
+	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX:
+		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES_EX received\n");
+		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg,
+						msglen, opcode);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received\n");
lib/librte_pmd_i40e/i40e_pf.h +7 -0
index 41b6826..19e1379 100644
@@ -57,7 +57,14 @@ enum i40e_virtchnl_ops_DPDK {
 	I40E_VIRTCHNL_OP_GET_LINK_STAT = I40E_VIRTCHNL_OP_EVENT + 0x100,
 	I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
 	I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+	I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX,
 };
+
+/* DPDK extra configurations for queues */
+struct i40e_virtchnl_queue_pair_extra_info {
+	uint8_t crcstrip;
+};
+
 struct i40e_virtchnl_vlan_offload_info {
 	uint16_t vsi_id;
 	uint8_t enable_vlan_strip;
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH v2 4/5 i40e: set crc stripping in rx queue configuration

In reply to a message not in the archive

It enables/disables the crc stripping in the rx queue contexts, according to the extra configuration carried from VF.

v2 changes:
* Put setting the crc stripping into a single patch.

---
 lib/librte_pmd_i40e/i40e_pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_pmd_i40e/i40e_pf.c +4 -1
index bc9bfcb..2910fd5 100644
@@ -357,7 +357,10 @@ i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
 	rx_ctx.tphdata_ena = 1;
 	rx_ctx.tphhead_ena = 1;
 	rx_ctx.lrxqthresh = 2;
-	rx_ctx.crcstrip = 1;
+	if (qpei) /* For DPDK PF host */
+		rx_ctx.crcstrip = qpei->crcstrip ? 1 : 0;
+	else /* For Linux PF host */
+		rx_ctx.crcstrip = 1;
 	rx_ctx.l2tsel = 1;
 	rx_ctx.prefena = 1;
 
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1410706109-30448-5-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

Tested-by Reviewed-by Jingjing Wu Reviewed-by Jing Chen
#7 lore raw

Re: [PATCH v2 4/5] i40e: set crc stripping in rx queue configuration

This patch has been verified on FC20 with eagle fountain:4*10G fortville, spirit falls 1*40G fortville and 2*40G fortville. The VF is greater by SRIOV, and testpmd should be run on host to support VF work on VM.

CRC stripping function works well in the testpmd app in VM and host.

Test environment information detail information as the following:
HOST environment:
CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
OS: Linux 3.11.10-301.fc20.x86_64
GCC: 4.8.3
NIC: Eagle Fountain:4*10G fortville, Spirit Falls 1*40G fortville and 2*40G fortville.

VM environment generated by KVM:
CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
OS: Linux 3.11.10-301.fc20.x86_64
GCC: 4.8.2
NIC: VF generated through SRIOV

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Sunday, September 14, 2014 10:48 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 4/5] i40e: set crc stripping in rx queue configuration

It enables/disables the crc stripping in the rx queue contexts, according to the extra configuration carried from VF.

v2 changes:
* Put setting the crc stripping into a single patch.

---
 lib/librte_pmd_i40e/i40e_pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_pmd_i40e/i40e_pf.c +4 -1
index bc9bfcb..2910fd5 100644
@@ -357,7 +357,10 @@ i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
 	rx_ctx.tphdata_ena = 1;
 	rx_ctx.tphhead_ena = 1;
 	rx_ctx.lrxqthresh = 2;
-	rx_ctx.crcstrip = 1;
+	if (qpei) /* For DPDK PF host */
+		rx_ctx.crcstrip = qpei->crcstrip ? 1 : 0;
+	else /* For Linux PF host */
+		rx_ctx.crcstrip = 1;
 	rx_ctx.l2tsel = 1;
 	rx_ctx.prefena = 1;
 
Signature · 1 line
1.8.1.4
#8 lore raw

PATCH v2 5/5 i40evf: support of configurable crc stripping in VF

In reply to a message not in the archive

Configurable crc stripping is supported in DPDK PF host, while not in Linux PF host. Two functions have been defined to talk with the those PF hosts respectively.

v2 changes:
* Put configuring crc stripping in VF into a single patch.

---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 133 +++++++++++++++++++++++++++--------
 1 file changed, 102 insertions(+), 31 deletions(-)
lib/librte_pmd_i40e/i40e_ethdev_vf.c +102 -31
index 113bff8..af5a0f3 100644
@@ -523,8 +523,9 @@ i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
 	return err;
 }
 
+/* It configures VSI queues without extra configuration */
 static int
-i40evf_configure_queues(struct rte_eth_dev *dev)
+i40evf_configure_vsi_queues(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct i40e_rx_queue **rxq =
@@ -533,13 +534,13 @@ i40evf_configure_queues(struct rte_eth_dev *dev)
 		(struct i40e_tx_queue **)dev->data->tx_queues;
 	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci;
 	struct i40e_virtchnl_queue_pair_info *vc_qpi;
-	int size, i, nb_qp, ret, num_rxq, num_txq;
 	struct vf_cmd_info args;
-	struct rte_pktmbuf_pool_private *mbp_priv;
+	int size, i, nb_qp, ret;
 
 	nb_qp = vf->num_queue_pairs;
-	size = sizeof(*vc_vqci) + sizeof(*vc_qpi) * nb_qp;
-	vc_vqci = rte_zmalloc("vc_vqci", size, 0);
+	size = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +
+		sizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp;
+	vc_vqci = rte_zmalloc("queue_info", size, 0);
 	if (!vc_vqci) {
 		PMD_DRV_LOG(ERR, "Failed to allocate memory for VF "
 					"configuring queues\n");
@@ -547,62 +548,132 @@ i40evf_configure_queues(struct rte_eth_dev *dev)
 	}
 	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
 	vc_vqci->num_queue_pairs = nb_qp;
-	vc_qpi = vc_vqci->qpair;
 
-	num_rxq = dev->data->nb_rx_queues;
-	num_txq = dev->data->nb_tx_queues;
-	/*
-	 * PF host driver required to configure queues in pairs, which means
-	 * rxq_num should equals to txq_num. The actual usage won't always
-	 * work that way. The solution is fills 0 with HW ring option in case
-	 * they are not equal.
-	 */
-	for (i = 0; i < nb_qp; i++) {
-		/*Fill TX info */
+	for (i = 0, vc_qpi = vc_vqci->qpair; i < nb_qp; i++, vc_qpi++) {
 		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
 		vc_qpi->txq.queue_id = i;
-		if (i < num_txq) {
+		if (i < dev->data->nb_tx_queues) {
 			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
 			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
-		} else {
-			vc_qpi->txq.ring_len = 0;
-			vc_qpi->txq.dma_ring_addr = 0;
 		}
 
-		/* Fill RX info */
 		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
 		vc_qpi->rxq.queue_id = i;
 		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
-		if (i < num_rxq) {
+		if (i < dev->data->nb_rx_queues) {
+			struct rte_pktmbuf_pool_private *mbp_priv;
+
+			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
+			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
 			mbp_priv = rte_mempool_get_priv(rxq[i]->mp);
 			vc_qpi->rxq.databuffer_size =
 				mbp_priv->mbuf_data_room_size -
 					RTE_PKTMBUF_HEADROOM;
+		}
+	}
+	memset(&args, 0, sizeof(args));
+	args.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	args.in_args = (uint8_t *)vc_vqci;
+	args.in_args_size = size;
+	args.out_buffer = cmd_result_buffer;
+	args.out_size = I40E_AQ_BUF_SZ;
+	ret = i40evf_execute_vf_cmd(dev, &args);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to execute command of "
+			"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES\n");
+	rte_free(vc_vqci);
+
+	return ret;
+}
+
+/* It configures VSI queues with extra configuration of crc stripping */
+static int
+i40evf_configure_vsi_queues_ex(struct rte_eth_dev *dev)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct i40e_rx_queue **rxq =
+		(struct i40e_rx_queue **)dev->data->rx_queues;
+	struct i40e_tx_queue **txq =
+		(struct i40e_tx_queue **)dev->data->tx_queues;
+	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci;
+	struct i40e_virtchnl_queue_pair_info *vc_qpi;
+	struct i40e_virtchnl_queue_pair_extra_info *vc_qpei;
+	struct vf_cmd_info args;
+	int size, i, nb_qp, ret;
+
+	nb_qp = vf->num_queue_pairs;
+	size = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +
+		sizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp +
+		sizeof(struct i40e_virtchnl_queue_pair_extra_info) * nb_qp;
+	vc_vqci = rte_zmalloc("queue_info", size, 0);
+	if (!vc_vqci) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory for VF "
+					"configuring queues\n");
+		return -ENOMEM;
+	}
+	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
+	vc_vqci->num_queue_pairs = nb_qp;
+	vc_qpi = vc_vqci->qpair;
+	vc_qpei = (struct i40e_virtchnl_queue_pair_extra_info *)
+		(((uint8_t *)vc_vqci->qpair) +
+		sizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp);
+
+	for (i = 0; i < nb_qp; i++, vc_qpi++, vc_qpei++) {
+		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->txq.queue_id = i;
+		if (i < dev->data->nb_tx_queues) {
+			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
+		}
+		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->rxq.queue_id = i;
+		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
+		if (i < dev->data->nb_rx_queues) {
+			struct rte_pktmbuf_pool_private *mbp_priv;
+
 			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
 			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
-		} else {
-			vc_qpi->rxq.ring_len = 0;
-			vc_qpi->rxq.dma_ring_addr = 0;
-			vc_qpi->rxq.databuffer_size = 0;
+			mbp_priv = rte_mempool_get_priv(rxq[i]->mp);
+			vc_qpi->rxq.databuffer_size =
+				mbp_priv->mbuf_data_room_size -
+					RTE_PKTMBUF_HEADROOM;
+			/*
+			 * It adds extra info for configuring VSI queues, which
+			 * is needed to enable the configurable crc stripping
+			 * in VF.
+			 */
+			vc_qpei->crcstrip =
+				dev->data->dev_conf.rxmode.hw_strip_crc;
 		}
-		vc_qpi++;
 	}
-
-	args.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	memset(&args, 0, sizeof(args));
+	args.ops =
+		(enum i40e_virtchnl_ops)I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX;
 	args.in_args = (uint8_t *)vc_vqci;
 	args.in_args_size = size;
 	args.out_buffer = cmd_result_buffer;
 	args.out_size = I40E_AQ_BUF_SZ;
 	ret = i40evf_execute_vf_cmd(dev, &args);
 	if (ret)
-		PMD_DRV_LOG(ERR, "fail to execute command "
-				"OP_CONFIG_VSI_QUEUES\n");
+		PMD_DRV_LOG(ERR, "Failed to execute command of "
+			"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX\n");
 	rte_free(vc_vqci);
 
 	return ret;
 }
 
 static int
+i40evf_configure_queues(struct rte_eth_dev *dev)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (vf->host_is_dpdk) /* To support DPDK PF host */
+		return i40evf_configure_vsi_queues_ex(dev);
+	else /* To support Linux PF host */
+		return i40evf_configure_vsi_queues(dev);
+}
+
+static int
 i40evf_config_irq_map(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
Signature · 1 line
1.8.1.4
#9 lore raw

v3 cover support of configurable CRC stripping in VF

In reply to a message not in the archive

To support configurable CRC stripping in both PF host and VF, a new operation and a new structure are added to carry more configurations from VF to PF host.

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Put processing crc stripping configuration in PF host into a single patch.
* Put setting the crc stripping into a single patch.
* Put the configuring crc stripping in VF into a single patch.
* Added several more code style fixes reported by checkpatch.pl.

v3 changes:
* Added a macro of calculating memory size for configuring vsi queues.
* Used array of memory in stack to replace the memory allocated by rte_zmalloc().
* Added an input parameter for configuring crc stripping in RX queue context.
* Put configuring crc stripping of both PF host and VF into a single patch.
* Defined below new structures for the configuring specifically.
- struct i40e_virtchnl_rxq_ext_info;
- struct i40e_virtchnl_queue_pair_ext_info;
- struct i40e_virtchnl_vsi_queue_config_ext_info;
* Renamed 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX' to 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT'.

Helin Zhang (5):
config: remove useless i40e items in config files
i40evf: Remove 'host_is_dpdk', and use version number instead
i40e: renaming and code style fix
i40e: support of configurable crc stripping in rx queue
i40e: support of configurable VF crc stripping

 config/common_bsdapp                 |   1 -
 config/common_linuxapp               |   1 -
 lib/librte_pmd_i40e/i40e_ethdev.h    |   3 +-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 218 +++++++++++++++++++++++------------
 lib/librte_pmd_i40e/i40e_pf.c        | 134 +++++++++++++++------
 lib/librte_pmd_i40e/i40e_pf.h        |  57 +++++++--
 6 files changed, 297 insertions(+), 117 deletions(-)
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1415278430-17920-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#11 lore raw

PATCH v3 1/5 config: remove useless i40e items in config files

Remove 'CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC' from config files, as nowhere uses it.

---
 config/common_bsdapp   | 1 -
 config/common_linuxapp | 1 -
 2 files changed, 2 deletions(-)
config/common_bsdapp +0 -1
index 9dc9f56..57cad76 100644
@@ -179,7 +179,6 @@ CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_DRIVER=n
-CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=n
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
 CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
config/common_linuxapp +0 -1
index 8be79c3..57b61c9 100644
@@ -202,7 +202,6 @@ CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_DRIVER=n
-CONFIG_RTE_LIBRTE_I40E_PF_DISABLE_STRIP_CRC=n
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
 CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
Signature · 1 line
1.8.1.4
#12 lore raw

PATCH v3 2/5 i40evf: Remove 'host_is_dpdk', and use version number instead

In reply to a message not in the archive

API version number is straightfoward enough for checking the PF host, and no need to use 'host_is_dpdk'.

---
 lib/librte_pmd_i40e/i40e_ethdev.h    |  3 ++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 29 +++++++++++++++--------------
 2 files changed, 17 insertions(+), 15 deletions(-)
lib/librte_pmd_i40e/i40e_ethdev.h +2 -1
index afa14aa..96361c2 100644
@@ -323,7 +323,8 @@ struct i40e_vf {
 	bool promisc_unicast_enabled;
 	bool promisc_multicast_enabled;
 
-	bool host_is_dpdk; /* The flag indicates if the host is DPDK */
+	uint32_t version_major; /* Major version number */
+	uint32_t version_minor; /* Minor version number */
 	uint16_t promisc_flags; /* Promiscuous setting */
 	uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */
 
lib/librte_pmd_i40e/i40e_ethdev_vf.c +15 -14
index fa838e6..966f02f 100644
@@ -393,17 +393,18 @@ i40evf_check_api_version(struct rte_eth_dev *dev)
 	}
 
 	pver = (struct i40e_virtchnl_version_info *)args.out_buffer;
-	/* We are talking with DPDK host */
-	if (pver->major == I40E_DPDK_VERSION_MAJOR) {
-		vf->host_is_dpdk = TRUE;
-		PMD_DRV_LOG(INFO, "Detect PF host is DPDK app");
-	}
-	/* It's linux host driver */
-	else if ((pver->major != version.major) ||
-	    (pver->minor != version.minor)) {
-		PMD_INIT_LOG(ERR, "pf/vf API version mismatch. "
-			     "(%u.%u)-(%u.%u)", pver->major, pver->minor,
-			     version.major, version.minor);
+	vf->version_major = pver->major;
+	vf->version_minor = pver->minor;
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
+		PMD_DRV_LOG(INFO, "Peer is DPDK PF host");
+	else if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) &&
+		(vf->version_minor == I40E_VIRTCHNL_VERSION_MINOR))
+		PMD_DRV_LOG(INFO, "Peer is Linux PF host");
+	else {
+		PMD_INIT_LOG(ERR, "PF/VF API version mismatch:(%u.%u)-(%u.%u)",
+					vf->version_major, vf->version_minor,
+						I40E_VIRTCHNL_VERSION_MAJOR,
+						I40E_VIRTCHNL_VERSION_MINOR);
 		return -1;
 	}
 
@@ -1182,7 +1183,7 @@ i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	/* Linux pf host doesn't support vlan offload yet */
-	if (vf->host_is_dpdk) {
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR) {
 		/* Vlan stripping setting */
 		if (mask & ETH_VLAN_STRIP_MASK) {
 			/* Enable or disable VLAN stripping */
@@ -1207,7 +1208,7 @@ i40evf_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
 	info.on = on;
 
 	/* Linux pf host don't support vlan offload yet */
-	if (vf->host_is_dpdk) {
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR) {
 		if (info.on)
 			info.config.pvid = pvid;
 		else {
@@ -1480,7 +1481,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	 * DPDK pf host provide interfacet to acquire link status
 	 * while Linux driver does not
 	 */
-	if (vf->host_is_dpdk)
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
 		i40evf_get_link_status(dev, &new_link);
 	else {
 		/* Always assume it's up, for Linux driver PF host */
Signature · 1 line
1.8.1.4
#13 lore raw

PATCH v3 3/5 i40e: renaming and code style fix

In reply to a message not in the archive

Rename some local variables to express more accurately and briefly. Fix several code style issues reported by checkpatch.pl. Line warpping for some source lines which has more than 80 characters, and merge lines together for those source lines which does not need any line wrapping actually. Add macros for numeric or calculating memory sizes.

---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 86 ++++++++++++++++++------------------
 lib/librte_pmd_i40e/i40e_pf.c        | 46 +++++++++----------
 lib/librte_pmd_i40e/i40e_pf.h        | 29 +++++++++---
 3 files changed, 84 insertions(+), 77 deletions(-)

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Added several more code style fixes for i40e_pf.c.

v3 changes:
* Added a macro of calculating memory size for configuring vsi queues.
* Used array of memory in stack to replace the memory allocated by rte_zmalloc().

lib/librte_pmd_i40e/i40e_ethdev_vf.c +42 -44
index 966f02f..9a8cdc8 100644
@@ -537,78 +537,76 @@ static int
 i40evf_configure_queues(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct i40e_virtchnl_vsi_queue_config_info *queue_info;
-	struct i40e_virtchnl_queue_pair_info *queue_cfg;
 	struct i40e_rx_queue **rxq =
 		(struct i40e_rx_queue **)dev->data->rx_queues;
 	struct i40e_tx_queue **txq =
 		(struct i40e_tx_queue **)dev->data->tx_queues;
-	int i, len, nb_qpairs, num_rxq, num_txq;
-	int err;
+	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci;
+	struct i40e_virtchnl_queue_pair_info *vc_qpi;
 	struct vf_cmd_info args;
-	struct rte_pktmbuf_pool_private *mbp_priv;
+	uint16_t i, nb_qp = vf->num_queue_pairs;
+	const uint32_t size =
+		I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci, nb_qp);
+	uint8_t buff[size];
+	int ret;
 
-	nb_qpairs = vf->num_queue_pairs;
-	len = sizeof(*queue_info) + sizeof(*queue_cfg) * nb_qpairs;
-	queue_info = rte_zmalloc("queue_info", len, 0);
-	if (queue_info == NULL) {
-		PMD_INIT_LOG(ERR, "failed alloc memory for queue_info");
-		return -1;
-	}
-	queue_info->vsi_id = vf->vsi_res->vsi_id;
-	queue_info->num_queue_pairs = nb_qpairs;
-	queue_cfg = queue_info->qpair;
+	memset(buff, 0, sizeof(buff));
+	vc_vqci = (struct i40e_virtchnl_vsi_queue_config_info *)buff;
+	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
+	vc_vqci->num_queue_pairs = nb_qp;
+	vc_qpi = vc_vqci->qpair;
 
-	num_rxq = dev->data->nb_rx_queues;
-	num_txq = dev->data->nb_tx_queues;
 	/*
 	 * PF host driver required to configure queues in pairs, which means
 	 * rxq_num should equals to txq_num. The actual usage won't always
 	 * work that way. The solution is fills 0 with HW ring option in case
 	 * they are not equal.
 	 */
-	for (i = 0; i < nb_qpairs; i++) {
+	for (i = 0; i < nb_qp; i++) {
 		/*Fill TX info */
-		queue_cfg->txq.vsi_id = queue_info->vsi_id;
-		queue_cfg->txq.queue_id = i;
-		if (i < num_txq) {
-			queue_cfg->txq.ring_len = txq[i]->nb_tx_desc;
-			queue_cfg->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
+		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->txq.queue_id = i;
+		if (i < dev->data->nb_tx_queues) {
+			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
 		} else {
-			queue_cfg->txq.ring_len = 0;
-			queue_cfg->txq.dma_ring_addr = 0;
+			vc_qpi->txq.ring_len = 0;
+			vc_qpi->txq.dma_ring_addr = 0;
 		}
 
 		/* Fill RX info */
-		queue_cfg->rxq.vsi_id = queue_info->vsi_id;
-		queue_cfg->rxq.queue_id = i;
-		queue_cfg->rxq.max_pkt_size = vf->max_pkt_len;
-		if (i < num_rxq) {
-			mbp_priv = rte_mempool_get_priv(rxq[i]->mp);
-			queue_cfg->rxq.databuffer_size = mbp_priv->mbuf_data_room_size -
-						   RTE_PKTMBUF_HEADROOM;;
-			queue_cfg->rxq.ring_len = rxq[i]->nb_rx_desc;
-			queue_cfg->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;;
+		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
+		vc_qpi->rxq.queue_id = i;
+		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
+		if (i < dev->data->nb_rx_queues) {
+			struct rte_pktmbuf_pool_private *mbp_priv =
+				rte_mempool_get_priv(rxq[i]->mp);
+
+			vc_qpi->rxq.databuffer_size =
+				mbp_priv->mbuf_data_room_size -
+					RTE_PKTMBUF_HEADROOM;
+			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
+			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
 		} else {
-			queue_cfg->rxq.ring_len = 0;
-			queue_cfg->rxq.dma_ring_addr = 0;
-			queue_cfg->rxq.databuffer_size = 0;
+			vc_qpi->rxq.ring_len = 0;
+			vc_qpi->rxq.dma_ring_addr = 0;
+			vc_qpi->rxq.databuffer_size = 0;
 		}
-		queue_cfg++;
+		vc_qpi++;
 	}
 
+	memset(&args, 0, sizeof(args));
 	args.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
-	args.in_args = (u8 *)queue_info;
-	args.in_args_size = len;
+	args.in_args = (uint8_t *)vc_vqci;
+	args.in_args_size = size;
 	args.out_buffer = cmd_result_buffer;
 	args.out_size = I40E_AQ_BUF_SZ;
-	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	ret = i40evf_execute_vf_cmd(dev, &args);
+	if (ret)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_CONFIG_VSI_QUEUES");
-	rte_free(queue_info);
 
-	return err;
+	return ret;
 }
 
 static int
lib/librte_pmd_i40e/i40e_pf.c +20 -26

108 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_pf.h +22 -7
index 41b6826..ce5a978 100644
@@ -46,28 +46,43 @@
 /* Default setting on number of VSIs that VF can contain */
 #define I40E_DEFAULT_VF_VSI_NUM 1
 
+#define I40E_DPDK_OFFSET  0x100
+
 enum i40e_pf_vfr_state {
 	I40E_PF_VFR_INPROGRESS = 0,
 	I40E_PF_VFR_COMPLETED = 1,
 };
 
 /* DPDK pf driver specific command to VF */
-enum i40e_virtchnl_ops_DPDK {
-	/* Keep some gap between Linu PF commands and DPDK PF specific commands */
-	I40E_VIRTCHNL_OP_GET_LINK_STAT = I40E_VIRTCHNL_OP_EVENT + 0x100,
+enum i40e_virtchnl_ops_dpdk {
+	/*
+	 * Keep some gap between Linux PF commands and
+	 * DPDK PF extended commands.
+	 */
+	I40E_VIRTCHNL_OP_GET_LINK_STAT = I40E_VIRTCHNL_OP_VERSION +
+						I40E_DPDK_OFFSET,
 	I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
 	I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
 };
+
 struct i40e_virtchnl_vlan_offload_info {
 	uint16_t vsi_id;
 	uint8_t enable_vlan_strip;
 	uint8_t reserved;
 };
 
-/* I40E_VIRTCHNL_OP_CFG_VLAN_PVID
- * VF sends this message to enable/disable pvid. If it's enable op, needs to specify the
- * pvid.
- * PF returns status code in retval.
+/*
+ * Macro to calculate the memory size for configuring VSI queues
+ * via virtual channel.
+ */
+#define I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(x, n) \
+	(sizeof(*(x)) + sizeof((x)->qpair[0]) * (n))
+
+/*
+ * I40E_VIRTCHNL_OP_CFG_VLAN_PVID
+ * VF sends this message to enable/disable pvid. If it's
+ * enable op, needs to specify the pvid. PF returns status
+ * code in retval.
  */
 struct i40e_virtchnl_pvid_info {
 	uint16_t vsi_id;
Signature · 1 line
1.8.1.4
#14 lore raw

PATCH v3 4/5 i40e: support of configurable crc stripping in rx queue

In reply to a message not in the archive

Support of configurable crc stripping in context of VF RX queues.

---
 lib/librte_pmd_i40e/i40e_pf.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

v2 changes:
* Put setting the crc stripping into a single patch.

v3 changes:
* Added an input parameter for configuring crc stripping in RX queue context.

lib/librte_pmd_i40e/i40e_pf.c +7 -4
index f4b4f2d..7f98636 100644
@@ -56,6 +56,8 @@
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
 
+#define I40E_CFG_CRCSTRIP_DEFAULT 1
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
 			   struct i40e_virtchnl_queue_select *qsel,
@@ -325,7 +327,8 @@ send_msg:
 static int
 i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
 			    struct i40e_pf_vf *vf,
-			    struct i40e_virtchnl_rxq_info *rxq)
+			    struct i40e_virtchnl_rxq_info *rxq,
+			    uint8_t crcstrip)
 {
 	int err = I40E_SUCCESS;
 	struct i40e_hmc_obj_rxq rx_ctx;
@@ -354,7 +357,7 @@ i40e_pf_host_hmc_config_rxq(struct i40e_hw *hw,
 	rx_ctx.tphdata_ena = 1;
 	rx_ctx.tphhead_ena = 1;
 	rx_ctx.lrxqthresh = 2;
-	rx_ctx.crcstrip = 1;
+	rx_ctx.crcstrip = crcstrip;
 	rx_ctx.l2tsel = 1;
 	rx_ctx.prefena = 1;
 
@@ -434,8 +437,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 		}
 
 		/* Apply VF RX queue setting to HMC */
-		if (i40e_pf_host_hmc_config_rxq(hw, vf, &vc_qpi[i].rxq)
-			!= I40E_SUCCESS) {
+		if (i40e_pf_host_hmc_config_rxq(hw, vf, &vc_qpi[i].rxq,
+			I40E_CFG_CRCSTRIP_DEFAULT) != I40E_SUCCESS) {
 			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
Signature · 1 line
1.8.1.4
#15 lore raw

PATCH v3 5/5 i40e: support of configurable VF crc stripping

In reply to a message not in the archive

Configurable CRC stripping needs to be supported in VF, and the configuration should be finally set in relevant RX queue context with PF host support.

---
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 155 +++++++++++++++++++++++++----------
 lib/librte_pmd_i40e/i40e_pf.c        |  83 +++++++++++++++++--
 lib/librte_pmd_i40e/i40e_pf.h        |  28 +++++++
 3 files changed, 218 insertions(+), 48 deletions(-)

v2 changes:
* Put setting the crc stripping of PF host into a single patch.
* Put configuring crc stripping in VF into a single patch.

v3 changes:
* Put configuring crc stripping of both PF host and VF into a single patch.
* Defined below new structures for the configuring specifically.
- struct i40e_virtchnl_rxq_ext_info;
- struct i40e_virtchnl_queue_pair_ext_info;
- struct i40e_virtchnl_vsi_queue_config_ext_info;
* Renamed 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX' to 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT'.

lib/librte_pmd_i40e/i40e_ethdev_vf.c +113 -42
index 9a8cdc8..554d9d7 100644
@@ -533,8 +533,46 @@ i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
 	return err;
 }
 
+static void
+i40evf_fill_virtchnl_vsi_txq_info(struct i40e_virtchnl_txq_info *txq_info,
+				  uint16_t vsi_id,
+				  uint16_t queue_id,
+				  uint16_t nb_txq,
+				  struct i40e_tx_queue *txq)
+{
+	txq_info->vsi_id = vsi_id;
+	txq_info->queue_id = queue_id;
+	if (queue_id < nb_txq) {
+		txq_info->ring_len = txq->nb_tx_desc;
+		txq_info->dma_ring_addr = txq->tx_ring_phys_addr;
+	}
+}
+
+static void
+i40evf_fill_virtchnl_vsi_rxq_info(struct i40e_virtchnl_rxq_info *rxq_info,
+				  uint16_t vsi_id,
+				  uint16_t queue_id,
+				  uint16_t nb_rxq,
+				  uint32_t max_pkt_size,
+				  struct i40e_rx_queue *rxq)
+{
+	rxq_info->vsi_id = vsi_id;
+	rxq_info->queue_id = queue_id;
+	rxq_info->max_pkt_size = max_pkt_size;
+	if (queue_id < nb_rxq) {
+		struct rte_pktmbuf_pool_private *mbp_priv;
+
+		rxq_info->ring_len = rxq->nb_rx_desc;
+		rxq_info->dma_ring_addr = rxq->rx_ring_phys_addr;
+		mbp_priv = rte_mempool_get_priv(rxq->mp);
+		rxq_info->databuffer_size =
+			mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM;
+	}
+}
+
+/* It configures VSI queues to co-work with Linux PF host */
 static int
-i40evf_configure_queues(struct rte_eth_dev *dev)
+i40evf_configure_vsi_queues(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct i40e_rx_queue **rxq =
@@ -554,47 +592,14 @@ i40evf_configure_queues(struct rte_eth_dev *dev)
 	vc_vqci = (struct i40e_virtchnl_vsi_queue_config_info *)buff;
 	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
 	vc_vqci->num_queue_pairs = nb_qp;
-	vc_qpi = vc_vqci->qpair;
-
-	/*
-	 * PF host driver required to configure queues in pairs, which means
-	 * rxq_num should equals to txq_num. The actual usage won't always
-	 * work that way. The solution is fills 0 with HW ring option in case
-	 * they are not equal.
-	 */
-	for (i = 0; i < nb_qp; i++) {
-		/*Fill TX info */
-		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
-		vc_qpi->txq.queue_id = i;
-		if (i < dev->data->nb_tx_queues) {
-			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
-			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
-		} else {
-			vc_qpi->txq.ring_len = 0;
-			vc_qpi->txq.dma_ring_addr = 0;
-		}
 
-		/* Fill RX info */
-		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
-		vc_qpi->rxq.queue_id = i;
-		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
-		if (i < dev->data->nb_rx_queues) {
-			struct rte_pktmbuf_pool_private *mbp_priv =
-				rte_mempool_get_priv(rxq[i]->mp);
-
-			vc_qpi->rxq.databuffer_size =
-				mbp_priv->mbuf_data_room_size -
-					RTE_PKTMBUF_HEADROOM;
-			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
-			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
-		} else {
-			vc_qpi->rxq.ring_len = 0;
-			vc_qpi->rxq.dma_ring_addr = 0;
-			vc_qpi->rxq.databuffer_size = 0;
-		}
-		vc_qpi++;
+	for (i = 0, vc_qpi = vc_vqci->qpair; i < nb_qp; i++, vc_qpi++) {
+		i40evf_fill_virtchnl_vsi_txq_info(&vc_qpi->txq,
+			vc_vqci->vsi_id, i, dev->data->nb_tx_queues, txq[i]);
+		i40evf_fill_virtchnl_vsi_rxq_info(&vc_qpi->rxq,
+			vc_vqci->vsi_id, i, dev->data->nb_rx_queues,
+					vf->max_pkt_len, rxq[i]);
 	}
-
 	memset(&args, 0, sizeof(args));
 	args.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
 	args.in_args = (uint8_t *)vc_vqci;
@@ -603,13 +608,79 @@ i40evf_configure_queues(struct rte_eth_dev *dev)
 	args.out_size = I40E_AQ_BUF_SZ;
 	ret = i40evf_execute_vf_cmd(dev, &args);
 	if (ret)
-		PMD_DRV_LOG(ERR, "fail to execute command "
-			    "OP_CONFIG_VSI_QUEUES");
+		PMD_DRV_LOG(ERR, "Failed to execute command of "
+			"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES\n");
+
+	return ret;
+}
+
+/* It configures VSI queues to co-work with DPDK PF host */
+static int
+i40evf_configure_vsi_queues_ext(struct rte_eth_dev *dev)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct i40e_rx_queue **rxq =
+		(struct i40e_rx_queue **)dev->data->rx_queues;
+	struct i40e_tx_queue **txq =
+		(struct i40e_tx_queue **)dev->data->tx_queues;
+	struct i40e_virtchnl_vsi_queue_config_ext_info *vc_vqcei;
+	struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;
+	struct vf_cmd_info args;
+	uint16_t i, nb_qp = vf->num_queue_pairs;
+	const uint32_t size =
+		I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei, nb_qp);
+	uint8_t buff[size];
+	int ret;
+
+	memset(buff, 0, sizeof(buff));
+	vc_vqcei = (struct i40e_virtchnl_vsi_queue_config_ext_info *)buff;
+	vc_vqcei->vsi_id = vf->vsi_res->vsi_id;
+	vc_vqcei->num_queue_pairs = nb_qp;
+	vc_qpei = vc_vqcei->qpair;
+	for (i = 0; i < nb_qp; i++, vc_qpei++) {
+		i40evf_fill_virtchnl_vsi_txq_info(&vc_qpei->txq,
+			vc_vqcei->vsi_id, i, dev->data->nb_tx_queues, txq[i]);
+		i40evf_fill_virtchnl_vsi_rxq_info(&vc_qpei->rxq,
+			vc_vqcei->vsi_id, i, dev->data->nb_rx_queues,
+					vf->max_pkt_len, rxq[i]);
+		if (i < dev->data->nb_rx_queues)
+			/*
+			 * It adds extra info for configuring VSI queues, which
+			 * is needed to enable the configurable crc stripping
+			 * in VF.
+			 */
+			vc_qpei->rxq_ext.crcstrip =
+				dev->data->dev_conf.rxmode.hw_strip_crc;
+	}
+	memset(&args, 0, sizeof(args));
+	args.ops =
+		(enum i40e_virtchnl_ops)I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT;
+	args.in_args = (uint8_t *)vc_vqcei;
+	args.in_args_size = size;
+	args.out_buffer = cmd_result_buffer;
+	args.out_size = I40E_AQ_BUF_SZ;
+	ret = i40evf_execute_vf_cmd(dev, &args);
+	if (ret)
+		PMD_DRV_LOG(ERR, "Failed to execute command of "
+			"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT\n");
 
 	return ret;
 }
 
 static int
+i40evf_configure_queues(struct rte_eth_dev *dev)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
+		/* To support DPDK PF host */
+		return i40evf_configure_vsi_queues_ext(dev);
+	else
+		/* To support Linux PF host */
+		return i40evf_configure_vsi_queues(dev);
+}
+
+static int
 i40evf_config_irq_map(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
lib/librte_pmd_i40e/i40e_pf.c +77 -6

113 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_pf.h +28 -0
index ce5a978..8bf83c2 100644
@@ -63,6 +63,34 @@ enum i40e_virtchnl_ops_dpdk {
 						I40E_DPDK_OFFSET,
 	I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
 	I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+	I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT,
+};
+
+/* A structure to support extended info of a receive queue. */
+struct i40e_virtchnl_rxq_ext_info {
+	uint8_t crcstrip;
+};
+
+/*
+ * A structure to support extended info of queue pairs, an additional field
+ * is added, comparing to original 'struct i40e_virtchnl_queue_pair_info'.
+ */
+struct i40e_virtchnl_queue_pair_ext_info {
+	/* vsi_id and queue_id should be identical for both rx and tx queues.*/
+	struct i40e_virtchnl_txq_info txq;
+	struct i40e_virtchnl_rxq_info rxq;
+	struct i40e_virtchnl_rxq_ext_info rxq_ext;
+};
+
+/*
+ * A structure to support extended info of VSI queue pairs,
+ * 'struct i40e_virtchnl_queue_pair_ext_info' is used, see its original
+ * of 'struct i40e_virtchnl_queue_pair_info'.
+ */
+struct i40e_virtchnl_vsi_queue_config_ext_info {
+	uint16_t vsi_id;
+	uint16_t num_queue_pairs;
+	struct i40e_virtchnl_queue_pair_ext_info qpair[0];
 };
 
 struct i40e_virtchnl_vlan_offload_info {
Signature · 1 line
1.8.1.4
#16 lore raw
In reply to a message not in the archive
Quoted 50 lines

From: Zhang, Helin
Sent: Thursday, November 06, 2014 12:54 PM
To: [email protected]
Cc: Cao, Waterman; Cao, Min; Ananyev, Konstantin; Zhang, Helin
Subject: [PATCH v3 0/5] support of configurable CRC stripping in VF

To support configurable CRC stripping in both PF host and VF, a new operation and a new structure are added to carry more configurations from VF to PF host.

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Put processing crc stripping configuration in PF host into a single patch.
* Put setting the crc stripping into a single patch.
* Put the configuring crc stripping in VF into a single patch.
* Added several more code style fixes reported by checkpatch.pl.

v3 changes:
* Added a macro of calculating memory size for configuring vsi queues.
* Used array of memory in stack to replace the memory allocated by rte_zmalloc().
* Added an input parameter for configuring crc stripping in RX queue context.
* Put configuring crc stripping of both PF host and VF into a single patch.
* Defined below new structures for the configuring specifically.
- struct i40e_virtchnl_rxq_ext_info;
- struct i40e_virtchnl_queue_pair_ext_info;
- struct i40e_virtchnl_vsi_queue_config_ext_info;
* Renamed 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX' to 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT'.

Helin Zhang (5):
config: remove useless i40e items in config files
i40evf: Remove 'host_is_dpdk', and use version number instead
i40e: renaming and code style fix
i40e: support of configurable crc stripping in rx queue
i40e: support of configurable VF crc stripping

 config/common_bsdapp                 |   1 -
 config/common_linuxapp               |   1 -
 lib/librte_pmd_i40e/i40e_ethdev.h    |   3 +-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 218 +++++++++++++++++++++++------------
 lib/librte_pmd_i40e/i40e_pf.c        | 134 +++++++++++++++------
 lib/librte_pmd_i40e/i40e_pf.h        |  57 +++++++--
 6 files changed, 297 insertions(+), 117 deletions(-)
Quoted 2 lines

--
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213A2E2C-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#18 lore raw
Quoted 28 lines
Quoted 28 lines

To support configurable CRC stripping in both PF host and VF, a new operation and a new structure are added to carry more configurations from VF to PF host.

v2 changes:
* Put all the renaming and code style fixes into a patch.
* Put processing crc stripping configuration in PF host into a single patch.
* Put setting the crc stripping into a single patch.
* Put the configuring crc stripping in VF into a single patch.
* Added several more code style fixes reported by checkpatch.pl.

v3 changes:
* Added a macro of calculating memory size for configuring vsi queues.
* Used array of memory in stack to replace the memory allocated by rte_zmalloc().
* Added an input parameter for configuring crc stripping in RX queue context.
* Put configuring crc stripping of both PF host and VF into a single patch.
* Defined below new structures for the configuring specifically.
- struct i40e_virtchnl_rxq_ext_info;
- struct i40e_virtchnl_queue_pair_ext_info;
- struct i40e_virtchnl_vsi_queue_config_ext_info;
* Renamed 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX' to 'I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT'.

Quoted 8 lines
Quoted 6 lines

Helin Zhang (5):
config: remove useless i40e items in config files
i40evf: Remove 'host_is_dpdk', and use version number instead
i40e: renaming and code style fix
i40e: support of configurable crc stripping in rx queue
i40e: support of configurable VF crc stripping

Applied

Thanks

Signature · 1 line
Thomas