DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address
@ 2020-03-24  4:36 Guinan Sun
  2020-04-01  2:37 ` Zhang, Qi Z
  2020-04-01  3:42 ` Ye Xiaolong
  0 siblings, 2 replies; 3+ messages in thread
From: Guinan Sun @ 2020-03-24  4:36 UTC (permalink / raw)
  To: dev; +Cc: Qi Zhang, Guinan Sun

Due to the restriction of the flag I40E_FLAG_VF_MAC_BY_PF,
VF cannot program the MAC address.
In order to solve this inflexibility, the use of I40E_FLAG_VF_MAC_BY_PF
has been deleted in the code implementation to ensure that
VF can flexibly program the MAC address.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 drivers/net/i40e/i40e_ethdev.h    | 4 +---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 +-------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index aac89de91..8cabdba6a 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -124,7 +124,6 @@ enum i40e_flxpld_layer_idx {
 #define I40E_FLAG_FDIR                  (1ULL << 6)
 #define I40E_FLAG_VXLAN                 (1ULL << 7)
 #define I40E_FLAG_RSS_AQ_CAPABLE        (1ULL << 8)
-#define I40E_FLAG_VF_MAC_BY_PF          (1ULL << 9)
 #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
 		       I40E_FLAG_DCB | \
 		       I40E_FLAG_VMDQ | \
@@ -133,8 +132,7 @@ enum i40e_flxpld_layer_idx {
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR | \
 		       I40E_FLAG_VXLAN | \
-		       I40E_FLAG_RSS_AQ_CAPABLE | \
-		       I40E_FLAG_VF_MAC_BY_PF)
+		       I40E_FLAG_RSS_AQ_CAPABLE)
 
 #define I40E_RSS_OFFLOAD_ALL ( \
 	ETH_RSS_FRAG_IPV4 | \
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 244397e0e..bb5d28a44 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1309,10 +1309,8 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	/* Store the MAC address configured by host, or generate random one */
-	if (rte_is_valid_assigned_ether_addr(
+	if (!rte_is_valid_assigned_ether_addr(
 			(struct rte_ether_addr *)hw->mac.addr))
-		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
-	else
 		rte_eth_random_addr(hw->mac.addr); /* Generate a random one */
 
 	I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01,
@@ -2780,7 +2778,6 @@ static int
 i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
 			    struct rte_ether_addr *mac_addr)
 {
-	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
@@ -2788,9 +2785,6 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	if (vf->flags & I40E_FLAG_VF_MAC_BY_PF)
-		return -EPERM;
-
 	i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr);
 
 	if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0)
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address
  2020-03-24  4:36 [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address Guinan Sun
@ 2020-04-01  2:37 ` Zhang, Qi Z
  2020-04-01  3:42 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2020-04-01  2:37 UTC (permalink / raw)
  To: Sun, GuinanX, dev



> -----Original Message-----
> From: Sun, GuinanX <guinanx.sun@intel.com>
> Sent: Tuesday, March 24, 2020 12:37 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Sun, GuinanX
> <guinanx.sun@intel.com>
> Subject: [PATCH] net/i40e: enable VF to program MAC address
> 
> Due to the restriction of the flag I40E_FLAG_VF_MAC_BY_PF, VF cannot
> program the MAC address.
> In order to solve this inflexibility, the use of I40E_FLAG_VF_MAC_BY_PF has
> been deleted in the code implementation to ensure that VF can flexibly
> program the MAC address.
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address
  2020-03-24  4:36 [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address Guinan Sun
  2020-04-01  2:37 ` Zhang, Qi Z
@ 2020-04-01  3:42 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Ye Xiaolong @ 2020-04-01  3:42 UTC (permalink / raw)
  To: Guinan Sun; +Cc: dev, Qi Zhang

On 03/24, Guinan Sun wrote:
>Due to the restriction of the flag I40E_FLAG_VF_MAC_BY_PF,
>VF cannot program the MAC address.
>In order to solve this inflexibility, the use of I40E_FLAG_VF_MAC_BY_PF
>has been deleted in the code implementation to ensure that
>VF can flexibly program the MAC address.
>
>Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
>---
> drivers/net/i40e/i40e_ethdev.h    | 4 +---
> drivers/net/i40e/i40e_ethdev_vf.c | 8 +-------
> 2 files changed, 2 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
>index aac89de91..8cabdba6a 100644
>--- a/drivers/net/i40e/i40e_ethdev.h
>+++ b/drivers/net/i40e/i40e_ethdev.h
>@@ -124,7 +124,6 @@ enum i40e_flxpld_layer_idx {
> #define I40E_FLAG_FDIR                  (1ULL << 6)
> #define I40E_FLAG_VXLAN                 (1ULL << 7)
> #define I40E_FLAG_RSS_AQ_CAPABLE        (1ULL << 8)
>-#define I40E_FLAG_VF_MAC_BY_PF          (1ULL << 9)
> #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
> 		       I40E_FLAG_DCB | \
> 		       I40E_FLAG_VMDQ | \
>@@ -133,8 +132,7 @@ enum i40e_flxpld_layer_idx {
> 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
> 		       I40E_FLAG_FDIR | \
> 		       I40E_FLAG_VXLAN | \
>-		       I40E_FLAG_RSS_AQ_CAPABLE | \
>-		       I40E_FLAG_VF_MAC_BY_PF)
>+		       I40E_FLAG_RSS_AQ_CAPABLE)
> 
> #define I40E_RSS_OFFLOAD_ALL ( \
> 	ETH_RSS_FRAG_IPV4 | \
>diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
>index 244397e0e..bb5d28a44 100644
>--- a/drivers/net/i40e/i40e_ethdev_vf.c
>+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>@@ -1309,10 +1309,8 @@ i40evf_init_vf(struct rte_eth_dev *dev)
> 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> 
> 	/* Store the MAC address configured by host, or generate random one */
>-	if (rte_is_valid_assigned_ether_addr(
>+	if (!rte_is_valid_assigned_ether_addr(
> 			(struct rte_ether_addr *)hw->mac.addr))
>-		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
>-	else
> 		rte_eth_random_addr(hw->mac.addr); /* Generate a random one */
> 
> 	I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01,
>@@ -2780,7 +2778,6 @@ static int
> i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
> 			    struct rte_ether_addr *mac_addr)
> {
>-	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> 
> 	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
>@@ -2788,9 +2785,6 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
> 		return -EINVAL;
> 	}
> 
>-	if (vf->flags & I40E_FLAG_VF_MAC_BY_PF)
>-		return -EPERM;
>-
> 	i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr);
> 
> 	if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0)
>-- 
>2.17.1
>

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

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

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

end of thread, other threads:[~2020-04-01  3:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24  4:36 [dpdk-dev] [PATCH] net/i40e: enable VF to program MAC address Guinan Sun
2020-04-01  2:37 ` Zhang, Qi Z
2020-04-01  3:42 ` Ye Xiaolong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).