Bugs Porting from I40evf For IAVF Feature
cover Bugs Porting from I40evf For IAVF Feature
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(-)
Signature · 1 line
2.17.1
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 queue's Rx Max Frame Size (rxq->max_pkt_len) already includes the vlan header size.
--- drivers/net/iavf/iavf_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/iavf/iavf_ethdev.c +1 -1
@@ -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 );
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 1/7] net/iavf: fix scattered Rx enabling
Quoted 11 lines
-----Original Message-----
From: Yang, SteveX <[email protected]>
Sent: Tuesday, August 11, 2020 2:29 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Cc: Yang, SteveX <[email protected]>
Subject: [PATCH 1/7] net/iavf: fix scattered Rx enablingNo 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.
Quoted 27 lines
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 <[email protected]>--- drivers/net/iavf/iavf_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/iavf/iavf_ethdev.c +0
-0@@ -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) ||drivers/net/iavf/iavf_ethdev.c +1
-2- (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
PATCH 2/7 net/iavf: set speed to undefined for default case
In reply to SteveX YangDuring 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.
--- drivers/net/iavf/iavf_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_ethdev.c +3 -2
@@ -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 Ð_LINK_SPEED_FIXED );
Signature · 1 line
2.17.1
PATCH 3/7 net/iavf: fix port start during configuration restore
In reply to SteveX YangIf 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.
--- drivers/net/iavf/iavf_ethdev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_ethdev.c +8 -0
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 4/7 net/iavf: fix setting of MAC address on iavf
In reply to SteveX YangWhen 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.
--- drivers/net/iavf/iavf_ethdev.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/iavf/iavf_ethdev.c +0 -3
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 5/7 net/iavf: fix multiple interrupts for VF
In reply to SteveX YangInterrupt mapping should be 1:n queue(s).This patch fixes the logic of interrupt bind by code reconstruction.
--- drivers/net/iavf/iavf_vchnl.c | 56 ++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-)
drivers/net/iavf/iavf_vchnl.c +45 -11
@@ -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);
Signature · 1 line
2.17.1
PATCH 6/7 net/iavf: downgrade error log
In reply to SteveX YangWhen receiving the unsupported AQ messages, it's taken as an error. It's not appropriate and triggers too much unnecessary print.
--- drivers/net/iavf/iavf_vchnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/iavf/iavf_vchnl.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 7/7 net/iavf: fix port close
In reply to SteveX YangFrom: "Zhang, RobinX" <[email protected]>
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.
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/net/iavf/iavf.h +1 -0
@@ -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; };
drivers/net/iavf/iavf_ethdev.c +6 -0
@@ -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
Signature · 1 line
2.17.1