All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/i40e: vf add/del mac error log issue
@ 2017-07-18  5:36 Jeff Guo
  2017-07-19  9:01 ` [PATCH v2] " Jeff Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Guo @ 2017-07-18  5:36 UTC (permalink / raw)
  To: helin.zhang, jingjing.wu; +Cc: dev, jia.guo

when i40e vf close, it would stop vf at first, if vf had been stopped,
that would result of duplicating to add/del mac address, then the failed
of executing admin queue command info would exposure. The patch fix that
by add vf stop status check and sync up the vf mac number when add/del.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  6 +++++-
 drivers/net/i40e/i40e_ethdev_vf.c | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4c49673..5024cd8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2038,12 +2038,15 @@ static void
 i40e_dev_stop(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vsi *main_vsi = pf->main_vsi;
 	struct i40e_mirror_rule *p_mirror;
 	struct rte_pci_device *pci_dev = I40E_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i;
 
+	if (hw->adapter_stopped == 1)
+		return;
 	/* Disable all queues */
 	i40e_dev_switch_queues(pf, FALSE);
 
@@ -2085,6 +2088,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 		rte_free(intr_handle->intr_vec);
 		intr_handle->intr_vec = NULL;
 	}
+
+	hw->adapter_stopped = 1;
 }
 
 static void
@@ -2100,7 +2105,6 @@ i40e_dev_close(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	i40e_dev_stop(dev);
-	hw->adapter_stopped = 1;
 	i40e_dev_free_queues(dev);
 
 	/* Disable interrupt */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 859b5e8..efa6bc6 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -891,6 +891,8 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_ADD_ETHER_ADDRESS");
+	else
+		vf->vsi.mac_num++;
 
 	return err;
 }
@@ -929,6 +931,8 @@ i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev,
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_DEL_ETHER_ADDRESS");
+	else
+		vf->vsi.mac_num--;
 	return;
 }
 
@@ -2054,6 +2058,12 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add)
 			PMD_DRV_LOG(ERR, "fail to execute command %s",
 				    add ? "OP_ADD_ETHER_ADDRESS" :
 				    "OP_DEL_ETHER_ADDRESS");
+		else {
+			if (add)
+				vf->vsi.mac_num++;
+			else
+				vf->vsi.mac_num--;
+		}
 		rte_free(list);
 		begin = next_begin;
 	} while (begin < I40E_NUM_MACADDR_MAX);
@@ -2132,9 +2142,12 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev = I40E_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev);
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (hw->adapter_stopped == 1)
+		return;
 	i40evf_stop_queues(dev);
 	i40evf_disable_queues_intr(dev);
 	i40e_dev_clear_queues(dev);
@@ -2147,6 +2160,7 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 	}
 	/* remove all mac addrs */
 	i40evf_add_del_all_mac_addr(dev, FALSE);
+	hw->adapter_stopped = 1;
 
 }
 
@@ -2334,7 +2348,6 @@ i40evf_dev_close(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
 	i40evf_dev_stop(dev);
-	hw->adapter_stopped = 1;
 	i40e_dev_free_queues(dev);
 	i40evf_reset_vf(hw);
 	i40e_shutdown_adminq(hw);
-- 
2.7.4

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

* [PATCH v2] net/i40e: vf add/del mac error log issue
  2017-07-18  5:36 [PATCH] net/i40e: vf add/del mac error log issue Jeff Guo
@ 2017-07-19  9:01 ` Jeff Guo
  2017-07-19 11:11   ` Xing, Beilei
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Guo @ 2017-07-19  9:01 UTC (permalink / raw)
  To: beilei.xing, jingjing.wu; +Cc: dev, jia.guo

when i40e vf close, it would stop vf at first, if vf had been stopped,
that would result of duplicating to add/del mac address, then the failed
of executing admin queue command info would exposure. The patch fix that
by add vf stop status check and sync up the vf mac number when add/del.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v2->v1: fix complie error issue and coding style issue
---
 drivers/net/i40e/i40e_ethdev.c    |  6 +++++-
 drivers/net/i40e/i40e_ethdev_vf.c | 17 +++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 97a73e1..4ed9619 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2051,12 +2051,15 @@ static void
 i40e_dev_stop(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vsi *main_vsi = pf->main_vsi;
 	struct i40e_mirror_rule *p_mirror;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i;
 
+	if (hw->adapter_stopped == 1)
+		return;
 	/* Disable all queues */
 	i40e_dev_switch_queues(pf, FALSE);
 
@@ -2101,6 +2104,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
+
+	hw->adapter_stopped = 1;
 }
 
 static void
@@ -2116,7 +2121,6 @@ i40e_dev_close(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	i40e_dev_stop(dev);
-	hw->adapter_stopped = 1;
 	i40e_dev_free_queues(dev);
 
 	/* Disable interrupt */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index dc6c794..a21cfdb 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -906,6 +906,8 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_ADD_ETHER_ADDRESS");
+	else
+		vf->vsi.mac_num++;
 
 	return err;
 }
@@ -944,6 +946,8 @@ i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev,
 	if (err)
 		PMD_DRV_LOG(ERR, "fail to execute command "
 			    "OP_DEL_ETHER_ADDRESS");
+	else
+		vf->vsi.mac_num--;
 	return;
 }
 
@@ -2058,10 +2062,16 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add)
 		args.out_buffer = vf->aq_resp;
 		args.out_size = I40E_AQ_BUF_SZ;
 		err = i40evf_execute_vf_cmd(dev, &args);
-		if (err)
+		if (err) {
 			PMD_DRV_LOG(ERR, "fail to execute command %s",
 				    add ? "OP_ADD_ETHER_ADDRESS" :
 				    "OP_DEL_ETHER_ADDRESS");
+		} else {
+			if (add)
+				vf->vsi.mac_num++;
+			else
+				vf->vsi.mac_num--;
+		}
 		rte_free(list);
 		begin = next_begin;
 	} while (begin < I40E_NUM_MACADDR_MAX);
@@ -2140,9 +2150,12 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev);
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (hw->adapter_stopped == 1)
+		return;
 	i40evf_stop_queues(dev);
 	i40evf_disable_queues_intr(dev);
 	i40e_dev_clear_queues(dev);
@@ -2155,6 +2168,7 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 	}
 	/* remove all mac addrs */
 	i40evf_add_del_all_mac_addr(dev, FALSE);
+	hw->adapter_stopped = 1;
 
 }
 
@@ -2342,7 +2356,6 @@ i40evf_dev_close(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
 	i40evf_dev_stop(dev);
-	hw->adapter_stopped = 1;
 	i40e_dev_free_queues(dev);
 	i40evf_reset_vf(hw);
 	i40e_shutdown_adminq(hw);
-- 
2.7.4

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

* Re: [PATCH v2] net/i40e: vf add/del mac error log issue
  2017-07-19  9:01 ` [PATCH v2] " Jeff Guo
@ 2017-07-19 11:11   ` Xing, Beilei
  2017-07-19 11:47     ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Xing, Beilei @ 2017-07-19 11:11 UTC (permalink / raw)
  To: Guo, Jia, Wu, Jingjing; +Cc: dev



> -----Original Message-----
> From: Guo, Jia
> Sent: Wednesday, July 19, 2017 5:01 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
> Subject: [PATCH v2] net/i40e: vf add/del mac error log issue
> 
> when i40e vf close, it would stop vf at first, if vf had been stopped, that
> would result of duplicating to add/del mac address, then the failed of
> executing admin queue command info would exposure. The patch fix that by
> add vf stop status check and sync up the vf mac number when add/del.
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>

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

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

* Re: [PATCH v2] net/i40e: vf add/del mac error log issue
  2017-07-19 11:11   ` Xing, Beilei
@ 2017-07-19 11:47     ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-07-19 11:47 UTC (permalink / raw)
  To: Xing, Beilei, Guo, Jia, Wu, Jingjing; +Cc: dev

On 7/19/2017 12:11 PM, Xing, Beilei wrote:
> 
> 
>> -----Original Message-----
>> From: Guo, Jia
>> Sent: Wednesday, July 19, 2017 5:01 PM
>> To: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
>> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
>> Subject: [PATCH v2] net/i40e: vf add/del mac error log issue
>>
>> when i40e vf close, it would stop vf at first, if vf had been stopped, that
>> would result of duplicating to add/del mac address, then the failed of
>> executing admin queue command info would exposure. The patch fix that by
>> add vf stop status check and sync up the vf mac number when add/del.
>>
>> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-07-19 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-18  5:36 [PATCH] net/i40e: vf add/del mac error log issue Jeff Guo
2017-07-19  9:01 ` [PATCH v2] " Jeff Guo
2017-07-19 11:11   ` Xing, Beilei
2017-07-19 11:47     ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.