DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature
@ 2020-08-11  7:59 SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
                   ` (8 more replies)
  0 siblings, 9 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

These patches are bugs porting from i40evf to iavf.

  [PATCH 1/7] net/iavf: fix scattered Rx enabling
  [PATCH 2/7] net/iavf: set speed to undefined for default case
  [PATCH 3/7] net/iavf: fix port start during configuration restore
  [PATCH 4/7] net/iavf: fix setting of MAC address on iavf
  [PATCH 5/7] net/iavf: fix multiple interrupts for VF
  [PATCH 6/7] net/iavf: downgrade error log
  [PATCH 7/7] net/iavf: fix port close

 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 24 ++++++++++----
 drivers/net/iavf/iavf_vchnl.c  | 58 +++++++++++++++++++++++++++-------
 3 files changed, 65 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case SteveX Yang
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

No need to add additional vlan tag size for max packet size, since
for i40e, the queue's Rx Max Frame Size (rxq->max_pkt_len) already
includes the vlan header size.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index c3aa4cd72..f9dd5710c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -253,7 +253,7 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 
 	rxq->max_pkt_len = max_pkt_len;
 	if ((dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) ||
-	    (rxq->max_pkt_len + 2 * IAVF_VLAN_TAG_SIZE) > buf_size) {
+	    rxq->max_pkt_len > buf_size) {
 		dev_data->scattered_rx = 1;
 	}
 	IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore SteveX Yang
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

During PF/VF link update, a default speed value of 100M will be set
if get_link_info has failed or speed is unknown.

Consequently if PF is put in no-carrier state, VFs will switch to
"in carrier" state due to a link up + a link speed set to 100M
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, sets default speed to undefined (instead of 100M)
and updates a link status of VF only if link is up and speed is
different from undefined.

Fixes: 48de41ca11f0 ("net/avf: enable link status update")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f9dd5710c..ae508f2f0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	}
 
 	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-	new_link.link_status = vf->link_up ? ETH_LINK_UP :
-					     ETH_LINK_DOWN;
+	new_link.link_status = (vf->link_up &&
+				new_link.link_speed != ETH_SPEED_NUM_NONE)
+				? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
 				ETH_LINK_SPEED_FIXED);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf SteveX Yang
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

If configuring VF promiscuous mode is not supported,
return -ENOTSUP error code in .promiscuous_enable/disable dev_ops.
This is to fix the port start during configuration restore,
where if .promiscuous_enable/disable dev_ops exists
and return any value other than -ENOTSUP, start will fail.

Same is done for .allmulticast_enable/disable dev_ops.

Fixes: ca041cd44fcc ("ethdev: change allmulticast callbacks to return status")
Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index ae508f2f0..349c82cae 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -648,6 +648,8 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, true, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -669,6 +671,8 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				  vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -689,6 +693,8 @@ iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, true);
 	if (!ret)
 		vf->promisc_multicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -709,6 +715,8 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, false);
 	if (!ret)
 		vf->promisc_multicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (2 preceding siblings ...)
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

When setting the MAC address, the ethdev layer copies the new mac
address in dev->data->mac_addrs[0] before calling the dev_ops.

Therefore, is_same_ether_addr(mac_addr, dev->data->mac_addrs) was
always true, and the MAC was never set. Remove this test to fix the
issue.

Fixes: 538da7a1cad2 ("net: add rte prefix to ether functions")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 349c82cae..f16aff531 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -978,9 +978,6 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	old_addr = (struct rte_ether_addr *)hw->mac.addr;
 	perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr;
 
-	if (rte_is_same_ether_addr(mac_addr, old_addr))
-		return 0;
-
 	/* If the MAC address is configured by host, skip the setting */
 	if (rte_is_valid_assigned_ether_addr(perm_addr))
 		return -EPERM;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (3 preceding siblings ...)
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log SteveX Yang
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

Interrupt mapping should be 1:n queue(s).This patch fixes the
logic of interrupt bind by code reconstruction.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 33acea54a..614ea7e79 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -18,6 +18,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_dev.h>
+#include <rte_bus_pci.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
@@ -686,20 +687,53 @@ int
 iavf_config_irq_map(struct iavf_adapter *adapter)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint8_t *cmd_buffer = NULL;
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
-	struct iavf_cmd_info args;
-	int len, i, err;
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	uint32_t vec, cmd_buffer_size, max_vectors, nb_msix, msix_base, i;
+	uint16_t rxq_map[vf->vf_res->max_vectors];
+	int err;
 
-	len = sizeof(struct virtchnl_irq_map_info) +
-	      sizeof(struct virtchnl_vector_map) * vf->nb_msix;
+	memset(rxq_map, 0, sizeof(rxq_map));
+	if (dev->data->dev_conf.intr_conf.rxq &&
+		rte_intr_allow_others(intr_handle)) {
+		msix_base = IAVF_RX_VEC_START;
+		max_vectors = vf->vf_res->max_vectors - 1;
+		nb_msix = RTE_MIN(max_vectors, intr_handle->nb_efd);
+
+		vec = msix_base;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[vec] |= 1 << i;
+			intr_handle->intr_vec[i] = vec++;
+			if (vec >= vf->vf_res->max_vectors)
+				vec = msix_base;
+		}
+	} else {
+		msix_base = IAVF_MISC_VEC_ID;
+		nb_msix = 1;
 
-	map_info = rte_zmalloc("map_info", len, 0);
-	if (!map_info)
-		return -ENOMEM;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[msix_base] |= 1 << i;
+			if (rte_intr_dp_is_en(intr_handle))
+				intr_handle->intr_vec[i] = msix_base;
+		}
+	}
 
-	map_info->num_vectors = vf->nb_msix;
-	for (i = 0; i < vf->nb_msix; i++) {
+	cmd_buffer_size = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * nb_msix;
+	cmd_buffer = rte_zmalloc("iavf", cmd_buffer_size, 0);
+	if (!cmd_buffer) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory");
+		return IAVF_ERR_NO_MEMORY;
+	}
+
+	map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
+	map_info->num_vectors = nb_msix;
+	for (i = 0; i < nb_msix; i++) {
 		vecmap = &map_info->vecmap[i];
 		vecmap->vsi_id = vf->vsi_res->vsi_id;
 		vecmap->rxitr_idx = IAVF_ITR_INDEX_DEFAULT;
@@ -709,8 +743,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
 	}
 
 	args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
-	args.in_args = (u8 *)map_info;
-	args.in_args_size = len;
+	args.in_args = (u8 *)cmd_buffer;
+	args.in_args_size = cmd_buffer_size;
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 	err = iavf_execute_vf_cmd(adapter, &args);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (4 preceding siblings ...)
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

When receiving the unsupported AQ messages, it's taken as an
error. It's not appropriate and triggers too much unnecessary print.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 614ea7e79..06eaae0e4 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -266,7 +266,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 			}
 			break;
 		default:
-			PMD_DRV_LOG(ERR, "Request %u is not supported yet",
+			PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
 				    aq_opc);
 			break;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 7/7] net/iavf: fix port close
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (5 preceding siblings ...)
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log SteveX Yang
@ 2020-08-11  7:59 ` SteveX Yang
  2020-08-12  2:57   ` Wu, Jingjing
  2020-08-27  1:01 ` [dpdk-dev] [PATCH v2 0/6] These patches are bugs porting from i40evf to SteveX Yang
  2020-08-27  1:14 ` SteveX Yang
  8 siblings, 1 reply; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  7:59 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: qiming.yang, SteveX Yang

Port reset will call iavf_dev_uninit() to release resources. It wants
to call iavf_dev_close() to release resources. So there will be a
call conflict if calling iavf_dev_reset() and iavf_dev_close() at the
same time.

This patch added adapter->closed flag in iavf_dev_close()
to control the status of close.

Fixes: 83fe5e80692a ("net/iavf: move device state flag")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf.h        | 1 +
 drivers/net/iavf/iavf_ethdev.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 9be8a2381..06cbe6089 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -161,6 +161,7 @@ struct iavf_adapter {
 	bool tx_vec_allowed;
 	const uint32_t *ptype_tbl;
 	bool stopped;
+	bool closed;
 	uint16_t fdir_ref_cnt;
 };
 
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f16aff531..b58e57b07 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1367,6 +1367,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->back = IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
 	adapter->eth_dev = eth_dev;
 	adapter->stopped = 1;
+	adapter->closed = 0;
 
 	if (iavf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
@@ -1423,6 +1424,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
+	if (adapter->closed == 1)
+		return;
+
 	iavf_dev_stop(dev);
 	iavf_flow_flush(dev, NULL);
 	iavf_flow_uninit(adapter);
@@ -1434,6 +1438,8 @@ iavf_dev_close(struct rte_eth_dev *dev)
 	rte_intr_callback_unregister(intr_handle,
 				     iavf_dev_interrupt_handler, dev);
 	iavf_disable_irq0(hw);
+
+	adapter->closed = 1;
 }
 
 static int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH 7/7] net/iavf: fix port close
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
@ 2020-08-12  2:57   ` Wu, Jingjing
  0 siblings, 0 replies; 34+ messages in thread
From: Wu, Jingjing @ 2020-08-12  2:57 UTC (permalink / raw)
  To: Yang, SteveX, Xing, Beilei, dev; +Cc: Yang, Qiming

If RTE_ETH_DEV_CLOSE_REMOVE is set, port would be released when dev_close is called.
So it is not necessary to mark it as closed.

Another concern in my mind is the REST virtchnl message is missed to send to PF in iavf_dev_reset.

Thanks
Jingjing

> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Tuesday, August 11, 2020 3:59 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH 7/7] net/iavf: fix port close
> 
> Port reset will call iavf_dev_uninit() to release resources. It wants to call
> iavf_dev_close() to release resources. So there will be a call conflict if calling
> iavf_dev_reset() and iavf_dev_close() at the same time.
> 
> This patch added adapter->closed flag in iavf_dev_close() to control the
> status of close.
> 
> Fixes: 83fe5e80692a ("net/iavf: move device state flag")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf.h        | 1 +
>  drivers/net/iavf/iavf_ethdev.c | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> 9be8a2381..06cbe6089 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -161,6 +161,7 @@ struct iavf_adapter {
>  	bool tx_vec_allowed;
>  	const uint32_t *ptype_tbl;
>  	bool stopped;
> +	bool closed;
>  	uint16_t fdir_ref_cnt;
>  };
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index f16aff531..b58e57b07 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -1367,6 +1367,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>  	hw->back = IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data-
> >dev_private);
>  	adapter->eth_dev = eth_dev;
>  	adapter->stopped = 1;
> +	adapter->closed = 0;
> 
>  	if (iavf_init_vf(eth_dev) != 0) {
>  		PMD_INIT_LOG(ERR, "Init vf failed");
> @@ -1423,6 +1424,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
>  	struct iavf_adapter *adapter =
>  		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> 
> +	if (adapter->closed == 1)
> +		return;
> +
>  	iavf_dev_stop(dev);
>  	iavf_flow_flush(dev, NULL);
>  	iavf_flow_uninit(adapter);
> @@ -1434,6 +1438,8 @@ iavf_dev_close(struct rte_eth_dev *dev)
>  	rte_intr_callback_unregister(intr_handle,
>  				     iavf_dev_interrupt_handler, dev);
>  	iavf_disable_irq0(hw);
> +
> +	adapter->closed = 1;
>  }
> 
>  static int
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 0/6] These patches are bugs porting from i40evf to
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (6 preceding siblings ...)
  2020-08-11  7:59 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
@ 2020-08-27  1:01 ` SteveX Yang
  2020-08-27  1:14 ` SteveX Yang
  8 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:01 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

v2:
removed patch (net/iavf: fix port close), because all resources will be
released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is set.

SteveX Yang (6):
  net/iavf: fix scattered Rx enabling
  net/iavf: set speed to undefined for default case
  net/iavf: fix port start during configuration restore
  net/iavf: fix setting of MAC address on iavf
  net/iavf: fix multiple interrupts for VF
  net/iavf: downgrade error log

 drivers/net/iavf/iavf_ethdev.c | 18 +++++++----
 drivers/net/iavf/iavf_vchnl.c  | 58 +++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 0/6] These patches are bugs porting from i40evf to
  2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                   ` (7 preceding siblings ...)
  2020-08-27  1:01 ` [dpdk-dev] [PATCH v2 0/6] These patches are bugs porting from i40evf to SteveX Yang
@ 2020-08-27  1:14 ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
                     ` (6 more replies)
  8 siblings, 7 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

v2:
removed patch (net/iavf: fix port close), because all resources will be
released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is set.

SteveX Yang (6):
  net/iavf: fix scattered Rx enabling
  net/iavf: set speed to undefined for default case
  net/iavf: fix port start during configuration restore
  net/iavf: fix setting of MAC address on iavf
  net/iavf: fix multiple interrupts for VF
  net/iavf: downgrade error log

 drivers/net/iavf/iavf_ethdev.c | 18 +++++++----
 drivers/net/iavf/iavf_vchnl.c  | 58 +++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling
  2020-08-27  1:14 ` SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-08-27  2:49     ` Xing, Beilei
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case SteveX Yang
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

No need to add additional vlan tag size for max packet size, since
for i40e, the queue's Rx Max Frame Size (rxq->max_pkt_len) already
includes the vlan header size.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index c3aa4cd72..f9dd5710c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -253,7 +253,7 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 
 	rxq->max_pkt_len = max_pkt_len;
 	if ((dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) ||
-	    (rxq->max_pkt_len + 2 * IAVF_VLAN_TAG_SIZE) > buf_size) {
+	    rxq->max_pkt_len > buf_size) {
 		dev_data->scattered_rx = 1;
 	}
 	IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case
  2020-08-27  1:14 ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-08-27  6:46     ` Xing, Beilei
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 3/6] net/iavf: fix port start during configuration restore SteveX Yang
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

During PF/VF link update, a default speed value of 100M will be set
if get_link_info has failed or speed is unknown.

Consequently if PF is put in no-carrier state, VFs will switch to
"in carrier" state due to a link up + a link speed set to 100M
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, sets default speed to undefined (instead of 100M)
and updates a link status of VF only if link is up and speed is
different from undefined.

Fixes: 48de41ca11f0 ("net/avf: enable link status update")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f9dd5710c..ae508f2f0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	}
 
 	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-	new_link.link_status = vf->link_up ? ETH_LINK_UP :
-					     ETH_LINK_DOWN;
+	new_link.link_status = (vf->link_up &&
+				new_link.link_speed != ETH_SPEED_NUM_NONE)
+				? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
 				ETH_LINK_SPEED_FIXED);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] net/iavf: fix port start during configuration restore
  2020-08-27  1:14 ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

If configuring VF promiscuous mode is not supported,
return -ENOTSUP error code in .promiscuous_enable/disable dev_ops.
This is to fix the port start during configuration restore,
where if .promiscuous_enable/disable dev_ops exists
and return any value other than -ENOTSUP, start will fail.

Same is done for .allmulticast_enable/disable dev_ops.

Fixes: ca041cd44fcc ("ethdev: change allmulticast callbacks to return status")
Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index ae508f2f0..349c82cae 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -648,6 +648,8 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, true, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -669,6 +671,8 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				  vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -689,6 +693,8 @@ iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, true);
 	if (!ret)
 		vf->promisc_multicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -709,6 +715,8 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, false);
 	if (!ret)
 		vf->promisc_multicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] net/iavf: fix setting of MAC address on iavf
  2020-08-27  1:14 ` SteveX Yang
                     ` (2 preceding siblings ...)
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 3/6] net/iavf: fix port start during configuration restore SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

When setting the MAC address, the ethdev layer copies the new mac
address in dev->data->mac_addrs[0] before calling the dev_ops.

Therefore, is_same_ether_addr(mac_addr, dev->data->mac_addrs) was
always true, and the MAC was never set. Remove this test to fix the
issue.

Fixes: 538da7a1cad2 ("net: add rte prefix to ether functions")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 349c82cae..f16aff531 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -978,9 +978,6 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	old_addr = (struct rte_ether_addr *)hw->mac.addr;
 	perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr;
 
-	if (rte_is_same_ether_addr(mac_addr, old_addr))
-		return 0;
-
 	/* If the MAC address is configured by host, skip the setting */
 	if (rte_is_valid_assigned_ether_addr(perm_addr))
 		return -EPERM;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] net/iavf: fix multiple interrupts for VF
  2020-08-27  1:14 ` SteveX Yang
                     ` (3 preceding siblings ...)
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 6/6] net/iavf: downgrade error log SteveX Yang
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

Interrupt mapping should be 1:n queue(s).This patch fixes the
logic of interrupt bind by code reconstruction.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 33acea54a..614ea7e79 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -18,6 +18,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_dev.h>
+#include <rte_bus_pci.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
@@ -686,20 +687,53 @@ int
 iavf_config_irq_map(struct iavf_adapter *adapter)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint8_t *cmd_buffer = NULL;
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
-	struct iavf_cmd_info args;
-	int len, i, err;
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	uint32_t vec, cmd_buffer_size, max_vectors, nb_msix, msix_base, i;
+	uint16_t rxq_map[vf->vf_res->max_vectors];
+	int err;
 
-	len = sizeof(struct virtchnl_irq_map_info) +
-	      sizeof(struct virtchnl_vector_map) * vf->nb_msix;
+	memset(rxq_map, 0, sizeof(rxq_map));
+	if (dev->data->dev_conf.intr_conf.rxq &&
+		rte_intr_allow_others(intr_handle)) {
+		msix_base = IAVF_RX_VEC_START;
+		max_vectors = vf->vf_res->max_vectors - 1;
+		nb_msix = RTE_MIN(max_vectors, intr_handle->nb_efd);
+
+		vec = msix_base;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[vec] |= 1 << i;
+			intr_handle->intr_vec[i] = vec++;
+			if (vec >= vf->vf_res->max_vectors)
+				vec = msix_base;
+		}
+	} else {
+		msix_base = IAVF_MISC_VEC_ID;
+		nb_msix = 1;
 
-	map_info = rte_zmalloc("map_info", len, 0);
-	if (!map_info)
-		return -ENOMEM;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[msix_base] |= 1 << i;
+			if (rte_intr_dp_is_en(intr_handle))
+				intr_handle->intr_vec[i] = msix_base;
+		}
+	}
 
-	map_info->num_vectors = vf->nb_msix;
-	for (i = 0; i < vf->nb_msix; i++) {
+	cmd_buffer_size = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * nb_msix;
+	cmd_buffer = rte_zmalloc("iavf", cmd_buffer_size, 0);
+	if (!cmd_buffer) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory");
+		return IAVF_ERR_NO_MEMORY;
+	}
+
+	map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
+	map_info->num_vectors = nb_msix;
+	for (i = 0; i < nb_msix; i++) {
 		vecmap = &map_info->vecmap[i];
 		vecmap->vsi_id = vf->vsi_res->vsi_id;
 		vecmap->rxitr_idx = IAVF_ITR_INDEX_DEFAULT;
@@ -709,8 +743,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
 	}
 
 	args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
-	args.in_args = (u8 *)map_info;
-	args.in_args_size = len;
+	args.in_args = (u8 *)cmd_buffer;
+	args.in_args_size = cmd_buffer_size;
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 	err = iavf_execute_vf_cmd(adapter, &args);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] net/iavf: downgrade error log
  2020-08-27  1:14 ` SteveX Yang
                     ` (4 preceding siblings ...)
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
@ 2020-08-27  1:14   ` SteveX Yang
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-27  1:14 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

When receiving the unsupported AQ messages, it's taken as an
error. It's not appropriate and triggers too much unnecessary print.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 614ea7e79..06eaae0e4 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -266,7 +266,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 			}
 			break;
 		default:
-			PMD_DRV_LOG(ERR, "Request %u is not supported yet",
+			PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
 				    aq_opc);
 			break;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-08-27  2:49     ` Xing, Beilei
  0 siblings, 0 replies; 34+ messages in thread
From: Xing, Beilei @ 2020-08-27  2:49 UTC (permalink / raw)
  To: Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Thursday, August 27, 2020 9:14 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH v2 1/6] net/iavf: fix scattered Rx enabling
> 
> No need to add additional vlan tag size for max packet size, since for i40e, the

Seems my comment in v1 patch is not addressed.

> queue's Rx Max Frame Size (rxq->max_pkt_len) already includes the vlan
> header size.
> 
> Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index c3aa4cd72..f9dd5710c 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -253,7 +253,7 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct
> iavf_rx_queue *rxq)
> 
>  	rxq->max_pkt_len = max_pkt_len;
>  	if ((dev_data->dev_conf.rxmode.offloads &
> DEV_RX_OFFLOAD_SCATTER) ||
> -	    (rxq->max_pkt_len + 2 * IAVF_VLAN_TAG_SIZE) > buf_size) {
> +	    rxq->max_pkt_len > buf_size) {
>  		dev_data->scattered_rx = 1;
>  	}
>  	IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case SteveX Yang
@ 2020-08-27  6:46     ` Xing, Beilei
  0 siblings, 0 replies; 34+ messages in thread
From: Xing, Beilei @ 2020-08-27  6:46 UTC (permalink / raw)
  To: Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Thursday, August 27, 2020 9:14 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH v2 2/6] net/iavf: set speed to undefined for default case
> 
> During PF/VF link update, a default speed value of 100M will be set if
> get_link_info has failed or speed is unknown.
> 
> Consequently if PF is put in no-carrier state, VFs will switch to "in carrier" state
> due to a link up + a link speed set to 100M (default value if no speed detected).
> 
> To be consistent with linux drivers on which PF and VFs are in same carrier
> state, sets default speed to undefined (instead of 100M) and updates a link
> status of VF only if link is up and speed is different from undefined.

The original fix is focus on i40e, the fix includes changes for both PF and VF.
But this patch is only for iavf, so please pay attention:
1. rework the commit log, since the PF changes has been applied.
2. double check if the issue exists on ice.

Thanks,
Beilei

> 
> Fixes: 48de41ca11f0 ("net/avf: enable link status update")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index f9dd5710c..ae508f2f0 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
>  	}
> 
>  	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
> -	new_link.link_status = vf->link_up ? ETH_LINK_UP :
> -					     ETH_LINK_DOWN;
> +	new_link.link_status = (vf->link_up &&
> +				new_link.link_speed !=
> ETH_SPEED_NUM_NONE)
> +				? ETH_LINK_UP : ETH_LINK_DOWN;
>  	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
>  				ETH_LINK_SPEED_FIXED);
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
  2020-08-27  1:14 ` SteveX Yang
                     ` (5 preceding siblings ...)
  2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 6/6] net/iavf: downgrade error log SteveX Yang
@ 2020-09-04  7:29   ` SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
                       ` (6 more replies)
  6 siblings, 7 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

These patches are bugs porting from i40evf to iavf.

v3:
 - changed the comment of patch (net/iavf: fix scattered Rx enabling).
 - changed the comment of patch (net/iavf: fix incorrect link status
   when speed is undefined).

v2:
 - removed patch (net/iavf: fix port close), because all resources
   will be released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is set.

SteveX Yang (6):
  net/iavf: fix scattered Rx enabling
  net/iavf: fix incorrect link status when speed is undefined
  net/iavf: fix port start during configuration restore
  net/iavf: fix setting of MAC address on iavf
  net/iavf: fix multiple interrupts for VF
  net/iavf: downgrade error log

 drivers/net/iavf/iavf_ethdev.c | 18 +++++++----
 drivers/net/iavf/iavf_vchnl.c  | 58 +++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 1/6] net/iavf: fix scattered Rx enabling
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined SteveX Yang
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

No need to add additional vlan tag size for max packet size,
the queue's Rx Max Frame Size (rxq->max_pkt_len) already
includes the vlan header size in iavf.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index c3aa4cd72..f9dd5710c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -253,7 +253,7 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq)
 
 	rxq->max_pkt_len = max_pkt_len;
 	if ((dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) ||
-	    (rxq->max_pkt_len + 2 * IAVF_VLAN_TAG_SIZE) > buf_size) {
+	    rxq->max_pkt_len > buf_size) {
 		dev_data->scattered_rx = 1;
 	}
 	IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-07 14:39       ` Ferruh Yigit
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 3/6] net/iavf: fix port start during configuration restore SteveX Yang
                       ` (4 subsequent siblings)
  6 siblings, 1 reply; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

When PF is put in no-carrier state, iavf VFs will switch to
"in carrier" state due to a link up + a link speed set to 0
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, updates a link status of VF only if link is up
and speed is different from undefined.

Fixes: 48de41ca11f0 ("net/avf: enable link status update")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f9dd5710c..ae508f2f0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	}
 
 	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-	new_link.link_status = vf->link_up ? ETH_LINK_UP :
-					     ETH_LINK_DOWN;
+	new_link.link_status = (vf->link_up &&
+				new_link.link_speed != ETH_SPEED_NUM_NONE)
+				? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
 				ETH_LINK_SPEED_FIXED);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 3/6] net/iavf: fix port start during configuration restore
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

If configuring VF promiscuous mode is not supported,
return -ENOTSUP error code in .promiscuous_enable/disable dev_ops.
This is to fix the port start during configuration restore,
where if .promiscuous_enable/disable dev_ops exists
and return any value other than -ENOTSUP, start will fail.

Same is done for .allmulticast_enable/disable dev_ops.

Fixes: ca041cd44fcc ("ethdev: change allmulticast callbacks to return status")
Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index ae508f2f0..349c82cae 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -648,6 +648,8 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, true, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -669,6 +671,8 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				  vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -689,6 +693,8 @@ iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, true);
 	if (!ret)
 		vf->promisc_multicast_enabled = true;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
@@ -709,6 +715,8 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, false);
 	if (!ret)
 		vf->promisc_multicast_enabled = false;
+	else if (ret == IAVF_NOT_SUPPORTED)
+		ret = -ENOTSUP;
 	else
 		ret = -EAGAIN;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 4/6] net/iavf: fix setting of MAC address on iavf
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                       ` (2 preceding siblings ...)
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 3/6] net/iavf: fix port start during configuration restore SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

When setting the MAC address, the ethdev layer copies the new mac
address in dev->data->mac_addrs[0] before calling the dev_ops.

Therefore, is_same_ether_addr(mac_addr, dev->data->mac_addrs) was
always true, and the MAC was never set. Remove this test to fix the
issue.

Fixes: 538da7a1cad2 ("net: add rte prefix to ether functions")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 349c82cae..f16aff531 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -978,9 +978,6 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev,
 	old_addr = (struct rte_ether_addr *)hw->mac.addr;
 	perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr;
 
-	if (rte_is_same_ether_addr(mac_addr, old_addr))
-		return 0;
-
 	/* If the MAC address is configured by host, skip the setting */
 	if (rte_is_valid_assigned_ether_addr(perm_addr))
 		return -EPERM;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                       ` (3 preceding siblings ...)
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-08  7:53       ` Xu, Ting
  2020-09-11  9:04       ` Zhang, Qi Z
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 6/6] net/iavf: downgrade error log SteveX Yang
  2020-09-04  8:17     ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature Xing, Beilei
  6 siblings, 2 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

Interrupt mapping should be 1:n queue(s).This patch fixes the
logic of interrupt bind by code reconstruction.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 33acea54a..614ea7e79 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -18,6 +18,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_dev.h>
+#include <rte_bus_pci.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
@@ -686,20 +687,53 @@ int
 iavf_config_irq_map(struct iavf_adapter *adapter)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint8_t *cmd_buffer = NULL;
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
-	struct iavf_cmd_info args;
-	int len, i, err;
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	uint32_t vec, cmd_buffer_size, max_vectors, nb_msix, msix_base, i;
+	uint16_t rxq_map[vf->vf_res->max_vectors];
+	int err;
 
-	len = sizeof(struct virtchnl_irq_map_info) +
-	      sizeof(struct virtchnl_vector_map) * vf->nb_msix;
+	memset(rxq_map, 0, sizeof(rxq_map));
+	if (dev->data->dev_conf.intr_conf.rxq &&
+		rte_intr_allow_others(intr_handle)) {
+		msix_base = IAVF_RX_VEC_START;
+		max_vectors = vf->vf_res->max_vectors - 1;
+		nb_msix = RTE_MIN(max_vectors, intr_handle->nb_efd);
+
+		vec = msix_base;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[vec] |= 1 << i;
+			intr_handle->intr_vec[i] = vec++;
+			if (vec >= vf->vf_res->max_vectors)
+				vec = msix_base;
+		}
+	} else {
+		msix_base = IAVF_MISC_VEC_ID;
+		nb_msix = 1;
 
-	map_info = rte_zmalloc("map_info", len, 0);
-	if (!map_info)
-		return -ENOMEM;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[msix_base] |= 1 << i;
+			if (rte_intr_dp_is_en(intr_handle))
+				intr_handle->intr_vec[i] = msix_base;
+		}
+	}
 
-	map_info->num_vectors = vf->nb_msix;
-	for (i = 0; i < vf->nb_msix; i++) {
+	cmd_buffer_size = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * nb_msix;
+	cmd_buffer = rte_zmalloc("iavf", cmd_buffer_size, 0);
+	if (!cmd_buffer) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory");
+		return IAVF_ERR_NO_MEMORY;
+	}
+
+	map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
+	map_info->num_vectors = nb_msix;
+	for (i = 0; i < nb_msix; i++) {
 		vecmap = &map_info->vecmap[i];
 		vecmap->vsi_id = vf->vsi_res->vsi_id;
 		vecmap->rxitr_idx = IAVF_ITR_INDEX_DEFAULT;
@@ -709,8 +743,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
 	}
 
 	args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
-	args.in_args = (u8 *)map_info;
-	args.in_args_size = len;
+	args.in_args = (u8 *)cmd_buffer;
+	args.in_args_size = cmd_buffer_size;
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 	err = iavf_execute_vf_cmd(adapter, &args);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH v3 6/6] net/iavf: downgrade error log
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                       ` (4 preceding siblings ...)
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
@ 2020-09-04  7:29     ` SteveX Yang
  2020-09-04  8:17     ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature Xing, Beilei
  6 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-09-04  7:29 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, jingjing.wu, beilei.xing, SteveX Yang

When receiving the unsupported AQ messages, it's taken as an
error. It's not appropriate and triggers too much unnecessary print.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 614ea7e79..06eaae0e4 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -266,7 +266,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 			}
 			break;
 		default:
-			PMD_DRV_LOG(ERR, "Request %u is not supported yet",
+			PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
 				    aq_opc);
 			break;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
  2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
                       ` (5 preceding siblings ...)
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 6/6] net/iavf: downgrade error log SteveX Yang
@ 2020-09-04  8:17     ` Xing, Beilei
  2020-09-07  5:58       ` Zhang, Qi Z
  6 siblings, 1 reply; 34+ messages in thread
From: Xing, Beilei @ 2020-09-04  8:17 UTC (permalink / raw)
  To: Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing



> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Friday, September 4, 2020 3:29 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
> 
> These patches are bugs porting from i40evf to iavf.
> 
> v3:
>  - changed the comment of patch (net/iavf: fix scattered Rx enabling).
>  - changed the comment of patch (net/iavf: fix incorrect link status
>    when speed is undefined).
> 
> v2:
>  - removed patch (net/iavf: fix port close), because all resources
>    will be released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is set.
> 
> SteveX Yang (6):
>   net/iavf: fix scattered Rx enabling
>   net/iavf: fix incorrect link status when speed is undefined
>   net/iavf: fix port start during configuration restore
>   net/iavf: fix setting of MAC address on iavf
>   net/iavf: fix multiple interrupts for VF
>   net/iavf: downgrade error log
> 
>  drivers/net/iavf/iavf_ethdev.c | 18 +++++++----  drivers/net/iavf/iavf_vchnl.c
> | 58 +++++++++++++++++++++++++++-------
>  2 files changed, 58 insertions(+), 18 deletions(-)
> 
> --
> 2.17.1

Acked-by: Beilei Xing <beilei.xing@intel.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
  2020-09-04  8:17     ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature Xing, Beilei
@ 2020-09-07  5:58       ` Zhang, Qi Z
  2020-09-07 15:23         ` Ferruh Yigit
  0 siblings, 1 reply; 34+ messages in thread
From: Zhang, Qi Z @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Xing, Beilei, Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> Sent: Friday, September 4, 2020 4:18 PM
> To: Yang, SteveX <stevex.yang@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF
> Feature
> 
> 
> 
> > -----Original Message-----
> > From: Yang, SteveX <stevex.yang@intel.com>
> > Sent: Friday, September 4, 2020 3:29 PM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang,
> > SteveX <stevex.yang@intel.com>
> > Subject: [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
> >
> > These patches are bugs porting from i40evf to iavf.
> >
> > v3:
> >  - changed the comment of patch (net/iavf: fix scattered Rx enabling).
> >  - changed the comment of patch (net/iavf: fix incorrect link status
> >    when speed is undefined).
> >
> > v2:
> >  - removed patch (net/iavf: fix port close), because all resources
> >    will be released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is
> set.
> >
> > SteveX Yang (6):
> >   net/iavf: fix scattered Rx enabling
> >   net/iavf: fix incorrect link status when speed is undefined
> >   net/iavf: fix port start during configuration restore
> >   net/iavf: fix setting of MAC address on iavf
> >   net/iavf: fix multiple interrupts for VF
> >   net/iavf: downgrade error log
> >
> >  drivers/net/iavf/iavf_ethdev.c | 18 +++++++----
> > drivers/net/iavf/iavf_vchnl.c
> > | 58 +++++++++++++++++++++++++++-------
> >  2 files changed, 58 insertions(+), 18 deletions(-)
> >
> > --
> > 2.17.1
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined SteveX Yang
@ 2020-09-07 14:39       ` Ferruh Yigit
  0 siblings, 0 replies; 34+ messages in thread
From: Ferruh Yigit @ 2020-09-07 14:39 UTC (permalink / raw)
  To: SteveX Yang, dev; +Cc: qiming.yang, jingjing.wu, beilei.xing

On 9/4/2020 8:29 AM, SteveX Yang wrote:
> When PF is put in no-carrier state, iavf VFs will switch to
> "in carrier" state due to a link up + a link speed set to 0
> (default value if no speed detected).
> 
> To be consistent with linux drivers on which PF and VFs are in
> same carrier state, updates a link status of VF only if link is up
> and speed is different from undefined.
> 
> Fixes: 48de41ca11f0 ("net/avf: enable link status update")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index f9dd5710c..ae508f2f0 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
>  	}
>  
>  	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
> -	new_link.link_status = vf->link_up ? ETH_LINK_UP :
> -					     ETH_LINK_DOWN;
> +	new_link.link_status = (vf->link_up &&
> +				new_link.link_speed != ETH_SPEED_NUM_NONE)
> +				? ETH_LINK_UP : ETH_LINK_DOWN;
>  	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
>  				ETH_LINK_SPEED_FIXED);
>  
> 

Hi Steve,

There is a new 'ETH_SPEED_NUM_UNKNOWN' macro, and can you please check how it is
used for 'i40e' [1], can same done here?


[1]
https://git.dpdk.org/next/dpdk-next-net/commit/?id=bd1868e46d1b

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
  2020-09-07  5:58       ` Zhang, Qi Z
@ 2020-09-07 15:23         ` Ferruh Yigit
  0 siblings, 0 replies; 34+ messages in thread
From: Ferruh Yigit @ 2020-09-07 15:23 UTC (permalink / raw)
  To: Zhang, Qi Z, Xing, Beilei, Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing

On 9/7/2020 6:58 AM, Zhang, Qi Z wrote:
> 
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
>> Sent: Friday, September 4, 2020 4:18 PM
>> To: Yang, SteveX <stevex.yang@intel.com>; dev@dpdk.org
>> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF
>> Feature
>>
>>
>>
>>> -----Original Message-----
>>> From: Yang, SteveX <stevex.yang@intel.com>
>>> Sent: Friday, September 4, 2020 3:29 PM
>>> To: dev@dpdk.org
>>> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
>>> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang,
>>> SteveX <stevex.yang@intel.com>
>>> Subject: [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature
>>>
>>> These patches are bugs porting from i40evf to iavf.
>>>
>>> v3:
>>>  - changed the comment of patch (net/iavf: fix scattered Rx enabling).
>>>  - changed the comment of patch (net/iavf: fix incorrect link status
>>>    when speed is undefined).
>>>
>>> v2:
>>>  - removed patch (net/iavf: fix port close), because all resources
>>>    will be released in dev_close when RTE_ETH_DEV_CLOSE_REMOVE is
>> set.
>>>
>>> SteveX Yang (6):
>>>   net/iavf: fix scattered Rx enabling
>>>   net/iavf: fix incorrect link status when speed is undefined
>>>   net/iavf: fix port start during configuration restore
>>>   net/iavf: fix setting of MAC address on iavf
>>>   net/iavf: fix multiple interrupts for VF
>>>   net/iavf: downgrade error log
>>>
>>>  drivers/net/iavf/iavf_ethdev.c | 18 +++++++----
>>> drivers/net/iavf/iavf_vchnl.c
>>> | 58 +++++++++++++++++++++++++++-------
>>>  2 files changed, 58 insertions(+), 18 deletions(-)
>>>
>>> --
>>> 2.17.1
>>
>> Acked-by: Beilei Xing <beilei.xing@intel.com>
> 
> Applied to dpdk-next-net-intel.
> 

Pulled except 2/6 since it is independent and it can be done differently after
'ETH_SPEED_NUM_UNKNOWN' merged.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
@ 2020-09-08  7:53       ` Xu, Ting
  2020-09-11  9:04       ` Zhang, Qi Z
  1 sibling, 0 replies; 34+ messages in thread
From: Xu, Ting @ 2020-09-08  7:53 UTC (permalink / raw)
  To: Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing, Xing, Beilei, Yang, SteveX

Hi, Steve,

I am also coding on this part for large VF recently, and see that you sent a fix patch, and I have some questions not quite clear, which are shown below in inline.

Thanks!

Best Regards,
Xu Ting

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of SteveX Yang
> Sent: Friday, September 4, 2020 3:29 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
> 
> Interrupt mapping should be 1:n queue(s).This patch fixes the logic of
> interrupt bind by code reconstruction.
> 
> Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++-------
>  1 file changed, 45 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> 33acea54a..614ea7e79 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -18,6 +18,7 @@
>  #include <rte_ether.h>
>  #include <rte_ethdev_driver.h>
>  #include <rte_dev.h>
> +#include <rte_bus_pci.h>
> 
>  #include "iavf.h"
>  #include "iavf_rxtx.h"
> @@ -686,20 +687,53 @@ int
>  iavf_config_irq_map(struct iavf_adapter *adapter)  {
>  	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> +	struct iavf_cmd_info args;
> +	uint8_t *cmd_buffer = NULL;
>  	struct virtchnl_irq_map_info *map_info;
>  	struct virtchnl_vector_map *vecmap;
> -	struct iavf_cmd_info args;
> -	int len, i, err;
> +	struct rte_eth_dev *dev = adapter->eth_dev;
> +	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> +	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
> +	uint32_t vec, cmd_buffer_size, max_vectors, nb_msix, msix_base, i;
> +	uint16_t rxq_map[vf->vf_res->max_vectors];
> +	int err;
> 
> -	len = sizeof(struct virtchnl_irq_map_info) +
> -	      sizeof(struct virtchnl_vector_map) * vf->nb_msix;
> +	memset(rxq_map, 0, sizeof(rxq_map));
> +	if (dev->data->dev_conf.intr_conf.rxq &&
> +		rte_intr_allow_others(intr_handle)) {
> +		msix_base = IAVF_RX_VEC_START;
> +		max_vectors = vf->vf_res->max_vectors - 1;
> +		nb_msix = RTE_MIN(max_vectors, intr_handle->nb_efd);
> +
> +		vec = msix_base;
> +		for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +			rxq_map[vec] |= 1 << i;
> +			intr_handle->intr_vec[i] = vec++;
> +			if (vec >= vf->vf_res->max_vectors)
> +				vec = msix_base;
> +		}
> +	} else {
> +		msix_base = IAVF_MISC_VEC_ID;
> +		nb_msix = 1;
> 
> -	map_info = rte_zmalloc("map_info", len, 0);
> -	if (!map_info)
> -		return -ENOMEM;
> +		for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +			rxq_map[msix_base] |= 1 << i;
> +			if (rte_intr_dp_is_en(intr_handle))
> +				intr_handle->intr_vec[i] = msix_base;
> +		}
> +	}
> 

This part to configure parameters like nb_msix, msix_base and rxq_map, is already done in the upper level function iavf_config_rx_queues_irqs, why shall we do it again here? Or is it OK to change in that function directly if necessary?

> -	map_info->num_vectors = vf->nb_msix;
> -	for (i = 0; i < vf->nb_msix; i++) {
> +	cmd_buffer_size = sizeof(struct virtchnl_irq_map_info) +
> +	      sizeof(struct virtchnl_vector_map) * nb_msix;
> +	cmd_buffer = rte_zmalloc("iavf", cmd_buffer_size, 0);
> +	if (!cmd_buffer) {
> +		PMD_DRV_LOG(ERR, "Failed to allocate memory");
> +		return IAVF_ERR_NO_MEMORY;
> +	}
> +
> +	map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
> +	map_info->num_vectors = nb_msix;
> +	for (i = 0; i < nb_msix; i++) {
>  		vecmap = &map_info->vecmap[i];
>  		vecmap->vsi_id = vf->vsi_res->vsi_id;
>  		vecmap->rxitr_idx = IAVF_ITR_INDEX_DEFAULT; @@ -709,8

Here is a line of code "vecmap->rxq_map = vf->rxq_map[vf->msix_base + i];" not displayed. I noticed that this is not changed. That means we still use the bitmap configured in iavf_config_rx_queues_irqs, not the new one here (although they may be the same)
But it seems that the new rxq_map is not used. Do I miss something? Thank!

> +743,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
>  	}
> 
>  	args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
> -	args.in_args = (u8 *)map_info;
> -	args.in_args_size = len;
> +	args.in_args = (u8 *)cmd_buffer;
> +	args.in_args_size = cmd_buffer_size;
>  	args.out_buffer = vf->aq_resp;
>  	args.out_size = IAVF_AQ_BUF_SZ;
>  	err = iavf_execute_vf_cmd(adapter, &args);
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
  2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
  2020-09-08  7:53       ` Xu, Ting
@ 2020-09-11  9:04       ` Zhang, Qi Z
  2020-09-11 12:07         ` Ferruh Yigit
  1 sibling, 1 reply; 34+ messages in thread
From: Zhang, Qi Z @ 2020-09-11  9:04 UTC (permalink / raw)
  To: Yang, SteveX, dev
  Cc: Yang, Qiming, Wu, Jingjing, Xing, Beilei, Yang, SteveX, Yigit, Ferruh



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of SteveX Yang
> Sent: Friday, September 4, 2020 3:29 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
> 
> Interrupt mapping should be 1:n queue(s).This patch fixes the logic of interrupt
> bind by code reconstruction.
> 
> Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>

The patch has been reverted from dpdk-next-net-intel, since it's not necessary.


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
  2020-09-11  9:04       ` Zhang, Qi Z
@ 2020-09-11 12:07         ` Ferruh Yigit
  0 siblings, 0 replies; 34+ messages in thread
From: Ferruh Yigit @ 2020-09-11 12:07 UTC (permalink / raw)
  To: Zhang, Qi Z, Yang, SteveX, dev; +Cc: Yang, Qiming, Wu, Jingjing, Xing, Beilei

On 9/11/2020 10:04 AM, Zhang, Qi Z wrote:
> 
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of SteveX Yang
>> Sent: Friday, September 4, 2020 3:29 PM
>> To: dev@dpdk.org
>> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
>> <stevex.yang@intel.com>
>> Subject: [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF
>>
>> Interrupt mapping should be 1:n queue(s).This patch fixes the logic of interrupt
>> bind by code reconstruction.
>>
>> Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
>>
>> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> 
> The patch has been reverted from dpdk-next-net-intel, since it's not necessary.
> 

Dropped from next-net, patchwork status updated as rejected.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF
  2020-08-11  6:29 [dpdk-dev] [PATCH 0/7] " SteveX Yang
@ 2020-08-11  6:29 ` SteveX Yang
  0 siblings, 0 replies; 34+ messages in thread
From: SteveX Yang @ 2020-08-11  6:29 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, dev; +Cc: SteveX Yang

Interrupt mapping should be 1:n queue(s).This patch fixes the
logic of interrupt bind by code reconstruction.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 33acea54a..614ea7e79 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -18,6 +18,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_dev.h>
+#include <rte_bus_pci.h>
 
 #include "iavf.h"
 #include "iavf_rxtx.h"
@@ -686,20 +687,53 @@ int
 iavf_config_irq_map(struct iavf_adapter *adapter)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct iavf_cmd_info args;
+	uint8_t *cmd_buffer = NULL;
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
-	struct iavf_cmd_info args;
-	int len, i, err;
+	struct rte_eth_dev *dev = adapter->eth_dev;
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	uint32_t vec, cmd_buffer_size, max_vectors, nb_msix, msix_base, i;
+	uint16_t rxq_map[vf->vf_res->max_vectors];
+	int err;
 
-	len = sizeof(struct virtchnl_irq_map_info) +
-	      sizeof(struct virtchnl_vector_map) * vf->nb_msix;
+	memset(rxq_map, 0, sizeof(rxq_map));
+	if (dev->data->dev_conf.intr_conf.rxq &&
+		rte_intr_allow_others(intr_handle)) {
+		msix_base = IAVF_RX_VEC_START;
+		max_vectors = vf->vf_res->max_vectors - 1;
+		nb_msix = RTE_MIN(max_vectors, intr_handle->nb_efd);
+
+		vec = msix_base;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[vec] |= 1 << i;
+			intr_handle->intr_vec[i] = vec++;
+			if (vec >= vf->vf_res->max_vectors)
+				vec = msix_base;
+		}
+	} else {
+		msix_base = IAVF_MISC_VEC_ID;
+		nb_msix = 1;
 
-	map_info = rte_zmalloc("map_info", len, 0);
-	if (!map_info)
-		return -ENOMEM;
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rxq_map[msix_base] |= 1 << i;
+			if (rte_intr_dp_is_en(intr_handle))
+				intr_handle->intr_vec[i] = msix_base;
+		}
+	}
 
-	map_info->num_vectors = vf->nb_msix;
-	for (i = 0; i < vf->nb_msix; i++) {
+	cmd_buffer_size = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * nb_msix;
+	cmd_buffer = rte_zmalloc("iavf", cmd_buffer_size, 0);
+	if (!cmd_buffer) {
+		PMD_DRV_LOG(ERR, "Failed to allocate memory");
+		return IAVF_ERR_NO_MEMORY;
+	}
+
+	map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
+	map_info->num_vectors = nb_msix;
+	for (i = 0; i < nb_msix; i++) {
 		vecmap = &map_info->vecmap[i];
 		vecmap->vsi_id = vf->vsi_res->vsi_id;
 		vecmap->rxitr_idx = IAVF_ITR_INDEX_DEFAULT;
@@ -709,8 +743,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
 	}
 
 	args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
-	args.in_args = (u8 *)map_info;
-	args.in_args_size = len;
+	args.in_args = (u8 *)cmd_buffer;
+	args.in_args_size = cmd_buffer_size;
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 	err = iavf_execute_vf_cmd(adapter, &args);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-09-11 12:07 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  7:59 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log SteveX Yang
2020-08-11  7:59 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
2020-08-12  2:57   ` Wu, Jingjing
2020-08-27  1:01 ` [dpdk-dev] [PATCH v2 0/6] These patches are bugs porting from i40evf to SteveX Yang
2020-08-27  1:14 ` SteveX Yang
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
2020-08-27  2:49     ` Xing, Beilei
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 2/6] net/iavf: set speed to undefined for default case SteveX Yang
2020-08-27  6:46     ` Xing, Beilei
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 3/6] net/iavf: fix port start during configuration restore SteveX Yang
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
2020-08-27  1:14   ` [dpdk-dev] [PATCH v2 6/6] net/iavf: downgrade error log SteveX Yang
2020-09-04  7:29   ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature SteveX Yang
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 1/6] net/iavf: fix scattered Rx enabling SteveX Yang
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 2/6] net/iavf: fix incorrect link status when speed is undefined SteveX Yang
2020-09-07 14:39       ` Ferruh Yigit
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 3/6] net/iavf: fix port start during configuration restore SteveX Yang
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 4/6] net/iavf: fix setting of MAC address on iavf SteveX Yang
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 5/6] net/iavf: fix multiple interrupts for VF SteveX Yang
2020-09-08  7:53       ` Xu, Ting
2020-09-11  9:04       ` Zhang, Qi Z
2020-09-11 12:07         ` Ferruh Yigit
2020-09-04  7:29     ` [dpdk-dev] [PATCH v3 6/6] net/iavf: downgrade error log SteveX Yang
2020-09-04  8:17     ` [dpdk-dev] [PATCH v3 0/6] Bugs Porting from I40evf For IAVF Feature Xing, Beilei
2020-09-07  5:58       ` Zhang, Qi Z
2020-09-07 15:23         ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2020-08-11  6:29 [dpdk-dev] [PATCH 0/7] " SteveX Yang
2020-08-11  6:29 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git