Skip to contentSkip to conversation

i40evf: fix mac deletion when stop dev

PATCH Applied Jingjing Wu 4 participants 6 messages Nov 30, 2015 – Dec 6, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40evf: fix mac deletion when stop dev

When dev_stop is called in i40evf pmd driver, queues are switched off to stop receiving and transmitting. But the mac address of this VF still exists in VEB switch.
To stop the traffic from VSI level, the mac address need to be removed too. Then the bandwidth for this SRIOV VSI can be freed. This patch fix this issue.

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +7 -0
index 5c554f2..14d2a50 100644
@@ -1878,7 +1878,9 @@ err_queue:
 static void
 i40evf_dev_stop(struct rte_eth_dev *dev)
 {
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
+	struct ether_addr mac_addr;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1892,6 +1894,11 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 		rte_free(intr_handle->intr_vec);
 		intr_handle->intr_vec = NULL;
 	}
+	/* Set mac addr */
+	(void)rte_memcpy(mac_addr.addr_bytes, hw->mac.addr,
+				sizeof(mac_addr.addr_bytes));
+	/* Delete mac addr of this vf */
+	i40evf_del_mac_addr(dev, &mac_addr);
 }
 
 static int
Signature · 1 line
2.4.0
#1 lore raw
Quoted 39 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Monday, November 30, 2015 11:54 AM
To: [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Pei, Yulong
Subject: [PATCH] i40evf: fix mac deletion when stop dev

When dev_stop is called in i40evf pmd driver, queues are switched off to stop receiving and transmitting. But the mac address of this VF still exists in VEB switch.
To stop the traffic from VSI level, the mac address need to be removed too. Then the bandwidth for this SRIOV VSI can be freed.
This patch fix this issue.

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +2 -0
index 5c554f2..14d2a50 100644
@@ -1878,7 +1878,9 @@ err_queue:
 static void
 i40evf_dev_stop(struct rte_eth_dev *dev)  {
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
 >dev_private);
 	struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
+	struct ether_addr mac_addr;
 
 	PMD_INIT_FUNC_TRACE();
 

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_stop(struct rte_eth_dev *dev) · line 1899

Quoted 6 lines
drivers/net/i40e/i40e_ethdev_vf.c +3 -0
@@ -1892,6 +1894,11 @@ i40evf_dev_stop(struct rte_eth_dev *dev)
 		rte_free(intr_handle->intr_vec);
 		intr_handle->intr_vec = NULL;
 	}
+	/* Set mac addr */
+	(void)rte_memcpy(mac_addr.addr_bytes, hw->mac.addr,
+				sizeof(mac_addr.addr_bytes));

Use ether_addr_copy() instead.

/Helin

Quoted 7 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -1
+	/* Delete mac addr of this vf */
+	i40evf_del_mac_addr(dev, &mac_addr);
 }
 
 static int
--

2.4.0

#2 lore raw
Quoted 6 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_stop(struct rte_eth_dev *dev) · line 1899

Quoted 3 lines
drivers/net/i40e/i40e_ethdev_vf.c +3 -0
+	/* Set mac addr */
+	(void)rte_memcpy(mac_addr.addr_bytes, hw->mac.addr,
+				sizeof(mac_addr.addr_bytes));

Use ether_addr_copy() instead.

/Helin

Thanks. But the types of mac_addr and hw->mac are different, cannot use ether_addr_copy.

Thanks
Jingjing

#3 lore raw
In reply to Jingjing Wu

Review

Quoted 2 lines · On Mon, 30 Nov 2015 11:54:09 +0800 Jingjing Wu <[email protected]> wrote:
(quoted diff) +2 -0
+	(void)rte_memcpy(mac_addr.addr_bytes, hw->mac.addr,
+				sizeof(mac_addr.addr_bytes))

Please don't add useless (void) cast.
I haven't seen that since lint on Unix.

#4 lore raw

2015-11-30 08:33, Stephen Hemminger:

Quoted 8 lines

Review

Quoted 2 lines · On Mon, 30 Nov 2015 11:54:09 +0800 Jingjing Wu <[email protected]> wrote:
(quoted diff) +2 -0
+	(void)rte_memcpy(mac_addr.addr_bytes, hw->mac.addr,
+				sizeof(mac_addr.addr_bytes))

Please don't add useless (void) cast.
I haven't seen that since lint on Unix.

It is the style in i40e driver.
It may deserve a general cleanup.

#5 lore raw
In reply to Jingjing Wu

2015-11-30 11:54, Jingjing Wu:

Quoted 10 lines

When dev_stop is called in i40evf pmd driver, queues are switched off to stop receiving and transmitting. But the mac address of this VF still exists in VEB switch.
To stop the traffic from VSI level, the mac address need to be removed too. Then the bandwidth for this SRIOV VSI can be freed. This patch fix this issue.

Fixes 4861cde46116 ("i40e: new poll mode driver")

Applied, thanks