[v2] net/ixgbe: fix setting VF MAC address

Message ID 20200311090651.4328-1-guinanx.sun@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series [v2] net/ixgbe: fix setting VF MAC address |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

Guinan Sun March 11, 2020, 9:06 a.m. UTC
The reason why PF cannot receive data normally is that
vf performed the clear_rar operation through dev close
without adding a mac address. 
This will cause the association between the index and
rx address set by VMDq to be cancelled,thus affecting
the data reception of PF.
The correction method is to add a check action, and do
not perform the set_rar operation without adding a mac
address to prevent affecting the reception of data.

Fixes: 3c4270187518 ("net/ixgbe: support VF MAC address add/remove")
Cc: stable@dpdk.org

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
v2 changes:
* Modify commit log
---
 drivers/net/ixgbe/ixgbe_pf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Xiaolong Ye March 13, 2020, 1:09 a.m. UTC | #1
On 03/11, Guinan Sun wrote:
>The reason why PF cannot receive data normally is that
>vf performed the clear_rar operation through dev close
>without adding a mac address. 
>This will cause the association between the index and
>rx address set by VMDq to be cancelled,thus affecting
>the data reception of PF.
>The correction method is to add a check action, and do
>not perform the set_rar operation without adding a mac
>address to prevent affecting the reception of data.
>
>Fixes: 3c4270187518 ("net/ixgbe: support VF MAC address add/remove")
>Cc: stable@dpdk.org
>
>Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
>---
>v2 changes:
>* Modify commit log
>---
> drivers/net/ixgbe/ixgbe_pf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
>index afae21f81..67b5bef44 100644
>--- a/drivers/net/ixgbe/ixgbe_pf.c
>+++ b/drivers/net/ixgbe/ixgbe_pf.c
>@@ -783,8 +783,10 @@ ixgbe_set_vf_macvlan_msg(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
> 		hw->mac.ops.set_rar(hw, vf_info[vf].mac_count,
> 				new_mac, vf, IXGBE_RAH_AV);
> 	} else {
>-		hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count);
>-		vf_info[vf].mac_count = 0;
>+		if (vf_info[vf].mac_count) {
>+			hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count);
>+			vf_info[vf].mac_count = 0;
>+		}
> 	}
> 	return 0;
> }
>-- 
>2.17.1
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel, Thanks.
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index afae21f81..67b5bef44 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -783,8 +783,10 @@  ixgbe_set_vf_macvlan_msg(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		hw->mac.ops.set_rar(hw, vf_info[vf].mac_count,
 				new_mac, vf, IXGBE_RAH_AV);
 	} else {
-		hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count);
-		vf_info[vf].mac_count = 0;
+		if (vf_info[vf].mac_count) {
+			hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count);
+			vf_info[vf].mac_count = 0;
+		}
 	}
 	return 0;
 }