* [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-12 2:07 ` Xing, Beilei
2020-08-11 6:29 ` [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case SteveX Yang
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: 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] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling
2020-08-11 6:29 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-08-12 2:07 ` Xing, Beilei
0 siblings, 0 replies; 10+ messages in thread
From: Xing, Beilei @ 2020-08-12 2:07 UTC (permalink / raw)
To: Yang, SteveX, Wu, Jingjing, dev
> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Tuesday, August 11, 2020 2:29 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> dev@dpdk.org
> Cc: Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH 1/7] net/iavf: fix scattered Rx enabling
>
> No need to add additional vlan tag size for max packet size, since for i40e, the
AVF is for all intel NICs(i40e, ice now), so please also check ice driver.
BTW, please check with the original owner if the fix is for DPDK PF or kernel PF.
> 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] 10+ messages in thread
* [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore SteveX Yang
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: 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] 10+ messages in thread
* [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 2/7] net/iavf: set speed to undefined for default case SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf SteveX Yang
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: 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] 10+ messages in thread
* [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
` (2 preceding siblings ...)
2020-08-11 6:29 ` [dpdk-dev] [PATCH 3/7] net/iavf: fix port start during configuration restore SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: 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] 10+ 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] Bugs Porting from I40evf For IAVF Feature SteveX Yang
` (3 preceding siblings ...)
2020-08-11 6:29 ` [dpdk-dev] [PATCH 4/7] net/iavf: fix setting of MAC address on iavf SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
6 siblings, 0 replies; 10+ 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] 10+ messages in thread
* [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
` (4 preceding siblings ...)
2020-08-11 6:29 ` [dpdk-dev] [PATCH 5/7] net/iavf: fix multiple interrupts for VF SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
2020-08-11 6:29 ` [dpdk-dev] [PATCH 7/7] net/iavf: fix port close SteveX Yang
6 siblings, 0 replies; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: 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] 10+ messages in thread
* [dpdk-dev] [PATCH 7/7] net/iavf: fix port close
2020-08-11 6:29 [dpdk-dev] [PATCH 0/7] Bugs Porting from I40evf For IAVF Feature SteveX Yang
` (5 preceding siblings ...)
2020-08-11 6:29 ` [dpdk-dev] [PATCH 6/7] net/iavf: downgrade error log SteveX Yang
@ 2020-08-11 6:29 ` SteveX Yang
6 siblings, 0 replies; 10+ messages in thread
From: SteveX Yang @ 2020-08-11 6:29 UTC (permalink / raw)
To: jingjing.wu, beilei.xing, dev; +Cc: Zhang, RobinX, SteveX Yang
From: "Zhang, RobinX" <robinx.zhang@intel.com>
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] 10+ messages in thread