DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
@ 2019-01-16  4:42 Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 1/3] net/ixgbe: " Wei Zhao
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  4:42 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang

There is need to enable promiscuous mode enable on VF,
pf host should also enable to support that.

Zhao Wei (3):
  net/ixgbe: promiscuous mode enable on VF
  net/ixgbe: enable promiscous mode on PF host
  net/ixgbe: update API version

 drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
 3 files changed, 79 insertions(+), 22 deletions(-)

-- 
2.7.5

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

* [dpdk-dev] [PATCH 1/3] net/ixgbe: promiscuous mode enable on VF
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
@ 2019-01-16  4:42 ` Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 2/3] net/ixgbe: enable promiscous mode on PF host Wei Zhao
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  4:42 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to enable two ops of promiscuous_enable and
promiscuous_disable on VF.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 91ba620..e8a2c6e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
 	.dev_close            = ixgbevf_dev_close,
 	.dev_reset	      = ixgbevf_dev_reset,
+	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
+	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
 	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
 	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
 	.dev_infos_get        = ixgbevf_dev_info_get,
@@ -8290,6 +8294,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 }
 
 static void
+ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+}
+
+static void
+ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+}
+
+static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-- 
2.7.5

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

* [dpdk-dev] [PATCH 2/3] net/ixgbe: enable promiscous mode on PF host
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 1/3] net/ixgbe: " Wei Zhao
@ 2019-01-16  4:42 ` Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 3/3] net/ixgbe: update API version Wei Zhao
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  4:42 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to PF host promiscous mode enable. For ixgbe,
in order to support VF vlan promiscuous or unicast promiscuous,
we need to set PF host register PFVML2FLT of bit UPE and VPE.
It also align to ixgbe kernel code version 5.5.3.

Fixes: 72dec9e37a84 ("ixgbe: support multicast promiscuous mode on VF")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 78 ++++++++++++++++++++++++++++------------
 2 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index d0b9396..e81f152 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -265,6 +265,7 @@ struct ixgbe_vf_info {
 	uint8_t spoofchk_enabled;
 	uint8_t api_version;
 	uint16_t switch_domain_id;
+	uint16_t xcast_mode;
 };
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4b833ff..c9d1a1c 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
 }
 
 static int
-ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
-{
-	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t vmolr;
-
-	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-
-	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
-
-	vmolr |= IXGBE_VMOLR_MPE;
-
-	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
-
-	return 0;
-}
-
-static int
 ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -688,19 +671,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
 	struct ixgbe_vf_info *vfinfo =
 		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
-	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable */
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable */
+	u32 vmolr, fctrl, disable, enable;
 
 	switch (vfinfo[vf].api_version) {
 	case ixgbe_mbox_api_12:
+		/* promisc introduced in 1.3 version */
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+			return -EOPNOTSUPP;
+		break;
+		/* Fall threw */
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return -1;
 	}
 
-	if (enable)
-		return ixgbe_enable_vf_mc_promisc(dev, vf);
-	else
-		return ixgbe_disable_vf_mc_promisc(dev, vf);
+	if (vfinfo[vf].xcast_mode == xcast_mode)
+		goto out;
+
+	switch (xcast_mode) {
+	case IXGBEVF_XCAST_MODE_NONE:
+		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = 0;
+		break;
+	case IXGBEVF_XCAST_MODE_MULTI:
+		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
+		break;
+	case IXGBEVF_XCAST_MODE_ALLMULTI:
+		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
+		break;
+	case IXGBEVF_XCAST_MODE_PROMISC:
+		if (hw->mac.type <= ixgbe_mac_82599EB)
+			return -1;
+
+		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+		if (!(fctrl & IXGBE_FCTRL_UPE)) {
+			/* VF promisc requires PF in promisc */
+			RTE_LOG(ERR, PMD,
+			       "Enabling VF promisc requires PF in promisc\n");
+			return -1;
+		}
+
+		disable = 0;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		break;
+	default:
+		return -1;
+	}
+
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+	vmolr &= ~disable;
+	vmolr |= enable;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+	vfinfo[vf].xcast_mode = xcast_mode;
+
+out:
+	msgbuf[1] = xcast_mode;
+
+	return 0;
 }
 
 static int
-- 
2.7.5

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

* [dpdk-dev] [PATCH 3/3] net/ixgbe: update API version
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 1/3] net/ixgbe: " Wei Zhao
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 2/3] net/ixgbe: enable promiscous mode on PF host Wei Zhao
@ 2019-01-16  4:42 ` Wei Zhao
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  4:42 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to update to latest API version in order for
negotiation between pf and vf, then new API message can be
supported.

Fixes: 88fccb7a05c6 ("ixgbevf: fix jumbo frame")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e8a2c6e..a25178a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1512,6 +1512,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
 
 	/* start with highest supported, proceed down */
 	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
+		ixgbe_mbox_api_13,
 		ixgbe_mbox_api_12,
 		ixgbe_mbox_api_11,
 		ixgbe_mbox_api_10,
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index c9d1a1c..a6d8501 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -569,6 +569,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	case ixgbe_mbox_api_10:
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		vfinfo[vf].api_version = (uint8_t)api_version;
 		return 0;
 	default:
-- 
2.7.5

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

* [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
                   ` (2 preceding siblings ...)
  2019-01-16  4:42 ` [dpdk-dev] [PATCH 3/3] net/ixgbe: update API version Wei Zhao
@ 2019-01-16  5:01 ` Wei Zhao
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 1/3] " Wei Zhao
                     ` (3 more replies)
  2019-01-16  8:28 ` [dpdk-dev] [PATCH 0/3] " David Marchand
  2019-01-16 18:59 ` Stephen Hemminger
  5 siblings, 4 replies; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  5:01 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang

There is need to enable promiscuous mode enable on VF,
pf host should also enable to support that.

v2:
--fix typo in commit log.

Zhao Wei (3):
  net/ixgbe: promiscuous mode enable on VF
  net/ixgbe: enable promiscuous mode on PF host
  net/ixgbe: update API version

 drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
 3 files changed, 79 insertions(+), 22 deletions(-)

-- 
2.7.5

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

* [dpdk-dev] [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
@ 2019-01-16  5:01   ` Wei Zhao
  2019-02-13  3:35     ` Zhang, Qi Z
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host Wei Zhao
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  5:01 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to enable two ops of promiscuous_enable and
promiscuous_disable on VF.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 91ba620..e8a2c6e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
 	.dev_close            = ixgbevf_dev_close,
 	.dev_reset	      = ixgbevf_dev_reset,
+	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
+	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
 	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
 	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
 	.dev_infos_get        = ixgbevf_dev_info_get,
@@ -8290,6 +8294,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 }
 
 static void
+ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+}
+
+static void
+ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+}
+
+static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-- 
2.7.5

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

* [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 1/3] " Wei Zhao
@ 2019-01-16  5:01   ` Wei Zhao
  2019-02-13  3:41     ` Zhang, Qi Z
  2019-01-16  5:02   ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version Wei Zhao
  2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  3 siblings, 1 reply; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  5:01 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to PF host promiscuous mode enable. For ixgbe,
in order to support VF vlan promiscuous or unicast promiscuous,
we need to set PF host register PFVML2FLT of bit UPE and VPE.
It also align to ixgbe kernel code version 5.5.3.

Fixes: 72dec9e37a84 ("ixgbe: support multicast promiscuous mode on VF")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 78 ++++++++++++++++++++++++++++------------
 2 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index d0b9396..e81f152 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -265,6 +265,7 @@ struct ixgbe_vf_info {
 	uint8_t spoofchk_enabled;
 	uint8_t api_version;
 	uint16_t switch_domain_id;
+	uint16_t xcast_mode;
 };
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4b833ff..c9d1a1c 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
 }
 
 static int
-ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
-{
-	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t vmolr;
-
-	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-
-	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
-
-	vmolr |= IXGBE_VMOLR_MPE;
-
-	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
-
-	return 0;
-}
-
-static int
 ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -688,19 +671,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
 	struct ixgbe_vf_info *vfinfo =
 		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
-	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable */
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable */
+	u32 vmolr, fctrl, disable, enable;
 
 	switch (vfinfo[vf].api_version) {
 	case ixgbe_mbox_api_12:
+		/* promisc introduced in 1.3 version */
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+			return -EOPNOTSUPP;
+		break;
+		/* Fall threw */
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return -1;
 	}
 
-	if (enable)
-		return ixgbe_enable_vf_mc_promisc(dev, vf);
-	else
-		return ixgbe_disable_vf_mc_promisc(dev, vf);
+	if (vfinfo[vf].xcast_mode == xcast_mode)
+		goto out;
+
+	switch (xcast_mode) {
+	case IXGBEVF_XCAST_MODE_NONE:
+		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = 0;
+		break;
+	case IXGBEVF_XCAST_MODE_MULTI:
+		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
+		break;
+	case IXGBEVF_XCAST_MODE_ALLMULTI:
+		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
+		break;
+	case IXGBEVF_XCAST_MODE_PROMISC:
+		if (hw->mac.type <= ixgbe_mac_82599EB)
+			return -1;
+
+		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+		if (!(fctrl & IXGBE_FCTRL_UPE)) {
+			/* VF promisc requires PF in promisc */
+			RTE_LOG(ERR, PMD,
+			       "Enabling VF promisc requires PF in promisc\n");
+			return -1;
+		}
+
+		disable = 0;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		break;
+	default:
+		return -1;
+	}
+
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+	vmolr &= ~disable;
+	vmolr |= enable;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+	vfinfo[vf].xcast_mode = xcast_mode;
+
+out:
+	msgbuf[1] = xcast_mode;
+
+	return 0;
 }
 
 static int
-- 
2.7.5

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

* [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 1/3] " Wei Zhao
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host Wei Zhao
@ 2019-01-16  5:02   ` Wei Zhao
  2019-02-13  3:43     ` Zhang, Qi Z
  2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  3 siblings, 1 reply; 27+ messages in thread
From: Wei Zhao @ 2019-01-16  5:02 UTC (permalink / raw)
  To: dev; +Cc: stable, wenzhuo.lu, qi.z.zhang, Wei Zhao

There is need to update to latest API version in order for
negotiation between pf and vf, then new API message can be
supported.

Fixes: 88fccb7a05c6 ("ixgbevf: fix jumbo frame")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e8a2c6e..a25178a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1512,6 +1512,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
 
 	/* start with highest supported, proceed down */
 	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
+		ixgbe_mbox_api_13,
 		ixgbe_mbox_api_12,
 		ixgbe_mbox_api_11,
 		ixgbe_mbox_api_10,
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index c9d1a1c..a6d8501 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -569,6 +569,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	case ixgbe_mbox_api_10:
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		vfinfo[vf].api_version = (uint8_t)api_version;
 		return 0;
 	default:
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
                   ` (3 preceding siblings ...)
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
@ 2019-01-16  8:28 ` David Marchand
  2019-01-17  9:23   ` Zhao1, Wei
  2019-01-16 18:59 ` Stephen Hemminger
  5 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2019-01-16  8:28 UTC (permalink / raw)
  To: Wei Zhao; +Cc: dev, dpdk stable, Wenzhuo Lu, qi.z.zhang

On Wed, Jan 16, 2019 at 6:08 AM Wei Zhao <wei.zhao1@intel.com> wrote:

> There is need to enable promiscuous mode enable on VF,
> pf host should also enable to support that.
>
> Zhao Wei (3):
>   net/ixgbe: promiscuous mode enable on VF
>   net/ixgbe: enable promiscous mode on PF host
>   net/ixgbe: update API version
>
>  drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
>  drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
>  drivers/net/ixgbe/ixgbe_pf.c     | 79
> +++++++++++++++++++++++++++++-----------
>  3 files changed, 79 insertions(+), 22 deletions(-)
>
> --
> 2.7.5
>

This series looks more about a missing feature than a proper fix.
We have a new pf/vf api supported in this series and a new behaviour for
promiscuous.
This is not stable material to me unless you expose a clear problem that
this series wants to address.


-- 
David Marchand

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

* Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
  2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
                   ` (4 preceding siblings ...)
  2019-01-16  8:28 ` [dpdk-dev] [PATCH 0/3] " David Marchand
@ 2019-01-16 18:59 ` Stephen Hemminger
  2019-01-17  9:27   ` Zhao1, Wei
  5 siblings, 1 reply; 27+ messages in thread
From: Stephen Hemminger @ 2019-01-16 18:59 UTC (permalink / raw)
  To: Wei Zhao; +Cc: dev, stable, wenzhuo.lu, qi.z.zhang

On Wed, 16 Jan 2019 12:42:52 +0800
Wei Zhao <wei.zhao1@intel.com> wrote:

> There is need to enable promiscuous mode enable on VF,
> pf host should also enable to support that.
> 
> Zhao Wei (3):
>   net/ixgbe: promiscuous mode enable on VF
>   net/ixgbe: enable promiscous mode on PF host
>   net/ixgbe: update API version
> 
>  drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
>  drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
>  drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
>  3 files changed, 79 insertions(+), 22 deletions(-)
> 

Is there someway to check if PF on host allows promiscious mode (and
fail the attempt to set it on VF if not allowed).

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

* Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
  2019-01-16  8:28 ` [dpdk-dev] [PATCH 0/3] " David Marchand
@ 2019-01-17  9:23   ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-01-17  9:23 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, dpdk stable, Lu, Wenzhuo, Zhang, Qi Z



From: David Marchand [mailto:david.marchand@redhat.com]
Sent: Wednesday, January 16, 2019 4:29 PM
To: Zhao1, Wei <wei.zhao1@intel.com>
Cc: dev@dpdk.org; dpdk stable <stable@dpdk.org>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Subject: Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF

On Wed, Jan 16, 2019 at 6:08 AM Wei Zhao <wei.zhao1@intel.com<mailto:wei.zhao1@intel.com>> wrote:
There is need to enable promiscuous mode enable on VF,
pf host should also enable to support that.

Zhao Wei (3):
  net/ixgbe: promiscuous mode enable on VF
  net/ixgbe: enable promiscous mode on PF host
  net/ixgbe: update API version

 drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
 3 files changed, 79 insertions(+), 22 deletions(-)

--
2.7.5

This series looks more about a missing feature than a proper fix.
We have a new pf/vf api supported in this series and a new behaviour for promiscuous.
This is not stable material to me unless you expose a clear problem that this series wants to address.

Yes, this a new feature enable related, but this patch set will not introduce problem, because vf
promiscuous mode is close by default, this set is just send out for request from users that want to use
vf promiscuous. They will open it in their APP. NOT only ixgbe, but also other NIC vf HAS SUPPORT this feature.


--
David Marchand

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

* Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
  2019-01-16 18:59 ` Stephen Hemminger
@ 2019-01-17  9:27   ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-01-17  9:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, stable, Lu, Wenzhuo, Zhang, Qi Z



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, January 17, 2019 2:59 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF
> 
> On Wed, 16 Jan 2019 12:42:52 +0800
> Wei Zhao <wei.zhao1@intel.com> wrote:
> 
> > There is need to enable promiscuous mode enable on VF, pf host should
> > also enable to support that.
> >
> > Zhao Wei (3):
> >   net/ixgbe: promiscuous mode enable on VF
> >   net/ixgbe: enable promiscous mode on PF host
> >   net/ixgbe: update API version
> >
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 21 +++++++++++
> > drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
> >  drivers/net/ixgbe/ixgbe_pf.c     | 79
> +++++++++++++++++++++++++++++-----------
> >  3 files changed, 79 insertions(+), 22 deletions(-)
> >
> 
> Is there someway to check if PF on host allows promiscious mode (and fail
> the attempt to set it on VF if not allowed).

Yes, 
Pf host has check vfinfo[vf].api_version, that is key for that check.
If fail, it will return -1.


	switch (vfinfo[vf].api_version) {
 	case ixgbe_mbox_api_12:
+		/* promisc introduced in 1.3 version */
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+			return -EOPNOTSUPP;
+		break;
+		/* Fall threw */
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return -1;
 	}

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

* Re: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 1/3] " Wei Zhao
@ 2019-02-13  3:35     ` Zhang, Qi Z
  2019-02-13  3:36       ` Zhao1, Wei
  0 siblings, 1 reply; 27+ messages in thread
From: Zhang, Qi Z @ 2019-02-13  3:35 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Lu, Wenzhuo



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Wednesday, January 16, 2019 1:02 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
> 
> There is need to enable two ops of promiscuous_enable and
> promiscuous_disable on VF.
> 
> Fixes: af75078fece3 ("first public release")

I think this is not a fix, we just add some feature not be implemented.

Btw, you need to update doc/guides/nics/features/ixgbe_vf.ini

> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 91ba620..e8a2c6e 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct
> rte_eth_dev *dev,  static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw,
> int8_t direction,
>  				 uint8_t queue, uint8_t msix_vector);  static void
> ixgbevf_configure_msix(struct rte_eth_dev *dev);
> +static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
> +static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
>  static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);  static
> void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
> 
> @@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
>  	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
>  	.dev_close            = ixgbevf_dev_close,
>  	.dev_reset	      = ixgbevf_dev_reset,
> +	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
> +	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
>  	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
>  	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
>  	.dev_infos_get        = ixgbevf_dev_info_get,
> @@ -8290,6 +8294,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev
> *dev,  }
> 
>  static void
> +ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) {
> +	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	hw->mac.ops.update_xcast_mode(hw,
> IXGBEVF_XCAST_MODE_PROMISC); }
> +
> +static void
> +ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) {
> +	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE); }
> +
> +static void
>  ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)  {
>  	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> --
> 2.7.5

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

* Re: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
  2019-02-13  3:35     ` Zhang, Qi Z
@ 2019-02-13  3:36       ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-02-13  3:36 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: stable, Lu, Wenzhuo



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, February 13, 2019 11:35 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, January 16, 2019 1:02 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v2 1/3] net/ixgbe: promiscuous mode enable on VF
> >
> > There is need to enable two ops of promiscuous_enable and
> > promiscuous_disable on VF.
> >
> > Fixes: af75078fece3 ("first public release")
> 
> I think this is not a fix, we just add some feature not be implemented.
> 
> Btw, you need to update doc/guides/nics/features/ixgbe_vf.ini

Ok, I will update in v3

> 
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 91ba620..e8a2c6e 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -260,6 +260,8 @@ static int
> > ixgbevf_dev_rx_queue_intr_disable(struct
> > rte_eth_dev *dev,  static void ixgbevf_set_ivar_map(struct ixgbe_hw
> > *hw, int8_t direction,
> >  				 uint8_t queue, uint8_t msix_vector);  static
> void
> > ixgbevf_configure_msix(struct rte_eth_dev *dev);
> > +static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
> > +static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
> >  static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
> > static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
> >
> > @@ -596,6 +598,8 @@ static const struct eth_dev_ops
> ixgbevf_eth_dev_ops = {
> >  	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
> >  	.dev_close            = ixgbevf_dev_close,
> >  	.dev_reset	      = ixgbevf_dev_reset,
> > +	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
> > +	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
> >  	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
> >  	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
> >  	.dev_infos_get        = ixgbevf_dev_info_get,
> > @@ -8290,6 +8294,22 @@ ixgbe_dev_udp_tunnel_port_del(struct
> > rte_eth_dev *dev,  }
> >
> >  static void
> > +ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) {
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +	hw->mac.ops.update_xcast_mode(hw,
> > IXGBEVF_XCAST_MODE_PROMISC); }
> > +
> > +static void
> > +ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) {
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +	hw->mac.ops.update_xcast_mode(hw,
> IXGBEVF_XCAST_MODE_NONE); }
> > +
> > +static void
> >  ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)  {
> >  	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > --
> > 2.7.5

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

* Re: [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
  2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host Wei Zhao
@ 2019-02-13  3:41     ` Zhang, Qi Z
  2019-02-13  3:42       ` Zhao1, Wei
  0 siblings, 1 reply; 27+ messages in thread
From: Zhang, Qi Z @ 2019-02-13  3:41 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Lu, Wenzhuo



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Wednesday, January 16, 2019 1:02 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
> 

The title is misleading, we are going to support VF's promiscuous mode but not PF.

How about "Add VF promiscuous mode support when PF as host"

> There is need to PF host promiscuous mode enable. For ixgbe, in order to
> support VF vlan promiscuous or unicast promiscuous, we need to set PF host
> register PFVML2FLT of bit UPE and VPE.
> It also align to ixgbe kernel code version 5.5.3.
> 
> Fixes: 72dec9e37a84 ("ixgbe: support multicast promiscuous mode on VF")

Same to previous patch, not a fix.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
>  drivers/net/ixgbe/ixgbe_pf.c     | 78
> ++++++++++++++++++++++++++++------------
>  2 files changed, 57 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> b/drivers/net/ixgbe/ixgbe_ethdev.h
> index d0b9396..e81f152 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -265,6 +265,7 @@ struct ixgbe_vf_info {
>  	uint8_t spoofchk_enabled;
>  	uint8_t api_version;
>  	uint16_t switch_domain_id;
> +	uint16_t xcast_mode;
>  };
> 
>  /*
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index
> 4b833ff..c9d1a1c 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t
> vf)  }
> 
>  static int
> -ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf) -{
> -	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> -	uint32_t vmolr;
> -
> -	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> -
> -	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
> -
> -	vmolr |= IXGBE_VMOLR_MPE;
> -
> -	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> -
> -	return 0;
> -}
> -
> -static int
>  ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)  {
>  	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> @@ -688,19 +671,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev,
> uint32_t vf, uint32_t *msgbuf)  {
>  	struct ixgbe_vf_info *vfinfo =
>  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
> -	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable */
> +	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable */
> +	u32 vmolr, fctrl, disable, enable;
> 
>  	switch (vfinfo[vf].api_version) {
>  	case ixgbe_mbox_api_12:
> +		/* promisc introduced in 1.3 version */
> +		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
> +			return -EOPNOTSUPP;
> +		break;
> +		/* Fall threw */
> +	case ixgbe_mbox_api_13:
>  		break;
>  	default:
>  		return -1;
>  	}
> 
> -	if (enable)
> -		return ixgbe_enable_vf_mc_promisc(dev, vf);
> -	else
> -		return ixgbe_disable_vf_mc_promisc(dev, vf);
> +	if (vfinfo[vf].xcast_mode == xcast_mode)
> +		goto out;
> +
> +	switch (xcast_mode) {
> +	case IXGBEVF_XCAST_MODE_NONE:
> +		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> +			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> IXGBE_VMOLR_VPE;
> +		enable = 0;
> +		break;
> +	case IXGBEVF_XCAST_MODE_MULTI:
> +		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> IXGBE_VMOLR_VPE;
> +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
> +		break;
> +	case IXGBEVF_XCAST_MODE_ALLMULTI:
> +		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
> +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> IXGBE_VMOLR_MPE;
> +		break;
> +	case IXGBEVF_XCAST_MODE_PROMISC:
> +		if (hw->mac.type <= ixgbe_mac_82599EB)
> +			return -1;
> +
> +		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
> +		if (!(fctrl & IXGBE_FCTRL_UPE)) {
> +			/* VF promisc requires PF in promisc */
> +			RTE_LOG(ERR, PMD,
> +			       "Enabling VF promisc requires PF in promisc\n");
> +			return -1;
> +		}
> +
> +		disable = 0;
> +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> +			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> IXGBE_VMOLR_VPE;
> +		break;
> +	default:
> +		return -1;
> +	}
> +
> +	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> +	vmolr &= ~disable;
> +	vmolr |= enable;
> +	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> +	vfinfo[vf].xcast_mode = xcast_mode;
> +
> +out:
> +	msgbuf[1] = xcast_mode;
> +
> +	return 0;
>  }
> 
>  static int
> --
> 2.7.5

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

* Re: [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
  2019-02-13  3:41     ` Zhang, Qi Z
@ 2019-02-13  3:42       ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-02-13  3:42 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: stable, Lu, Wenzhuo



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, February 13, 2019 11:42 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, January 16, 2019 1:02 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host
> >
> 
> The title is misleading, we are going to support VF's promiscuous mode but
> not PF.
> 
> How about "Add VF promiscuous mode support when PF as host"

Get, update in v3

> 
> > There is need to PF host promiscuous mode enable. For ixgbe, in order
> > to support VF vlan promiscuous or unicast promiscuous, we need to set
> > PF host register PFVML2FLT of bit UPE and VPE.
> > It also align to ixgbe kernel code version 5.5.3.
> >
> > Fixes: 72dec9e37a84 ("ixgbe: support multicast promiscuous mode on
> > VF")
> 
> Same to previous patch, not a fix.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
> >  drivers/net/ixgbe/ixgbe_pf.c     | 78
> > ++++++++++++++++++++++++++++------------
> >  2 files changed, 57 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > index d0b9396..e81f152 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > @@ -265,6 +265,7 @@ struct ixgbe_vf_info {
> >  	uint8_t spoofchk_enabled;
> >  	uint8_t api_version;
> >  	uint16_t switch_domain_id;
> > +	uint16_t xcast_mode;
> >  };
> >
> >  /*
> > diff --git a/drivers/net/ixgbe/ixgbe_pf.c
> > b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ff..c9d1a1c 100644
> > --- a/drivers/net/ixgbe/ixgbe_pf.c
> > +++ b/drivers/net/ixgbe/ixgbe_pf.c
> > @@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev,
> > uint16_t
> > vf)  }
> >
> >  static int
> > -ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf) -{
> > -	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > -	uint32_t vmolr;
> > -
> > -	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> > -
> > -	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
> > -
> > -	vmolr |= IXGBE_VMOLR_MPE;
> > -
> > -	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> > -
> > -	return 0;
> > -}
> > -
> > -static int
> >  ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)  {
> >  	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > @@ -688,19 +671,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev
> *dev,
> > uint32_t vf, uint32_t *msgbuf)  {
> >  	struct ixgbe_vf_info *vfinfo =
> >  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
> >dev_private));
> > -	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable
> */
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable
> */
> > +	u32 vmolr, fctrl, disable, enable;
> >
> >  	switch (vfinfo[vf].api_version) {
> >  	case ixgbe_mbox_api_12:
> > +		/* promisc introduced in 1.3 version */
> > +		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
> > +			return -EOPNOTSUPP;
> > +		break;
> > +		/* Fall threw */
> > +	case ixgbe_mbox_api_13:
> >  		break;
> >  	default:
> >  		return -1;
> >  	}
> >
> > -	if (enable)
> > -		return ixgbe_enable_vf_mc_promisc(dev, vf);
> > -	else
> > -		return ixgbe_disable_vf_mc_promisc(dev, vf);
> > +	if (vfinfo[vf].xcast_mode == xcast_mode)
> > +		goto out;
> > +
> > +	switch (xcast_mode) {
> > +	case IXGBEVF_XCAST_MODE_NONE:
> > +		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > +			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		enable = 0;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_MULTI:
> > +		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_ALLMULTI:
> > +		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > IXGBE_VMOLR_MPE;
> > +		break;
> > +	case IXGBEVF_XCAST_MODE_PROMISC:
> > +		if (hw->mac.type <= ixgbe_mac_82599EB)
> > +			return -1;
> > +
> > +		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
> > +		if (!(fctrl & IXGBE_FCTRL_UPE)) {
> > +			/* VF promisc requires PF in promisc */
> > +			RTE_LOG(ERR, PMD,
> > +			       "Enabling VF promisc requires PF in promisc\n");
> > +			return -1;
> > +		}
> > +
> > +		disable = 0;
> > +		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
> > +			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE |
> > IXGBE_VMOLR_VPE;
> > +		break;
> > +	default:
> > +		return -1;
> > +	}
> > +
> > +	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> > +	vmolr &= ~disable;
> > +	vmolr |= enable;
> > +	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> > +	vfinfo[vf].xcast_mode = xcast_mode;
> > +
> > +out:
> > +	msgbuf[1] = xcast_mode;
> > +
> > +	return 0;
> >  }
> >
> >  static int
> > --
> > 2.7.5

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

* Re: [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version
  2019-01-16  5:02   ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version Wei Zhao
@ 2019-02-13  3:43     ` Zhang, Qi Z
  2019-02-14  1:22       ` Zhao1, Wei
  0 siblings, 1 reply; 27+ messages in thread
From: Zhang, Qi Z @ 2019-02-13  3:43 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Lu, Wenzhuo

I think this patch should be merged with PATCH 2/3, since "ixgbe_mbox_api_13" is already be referenced on that patch.

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Wednesday, January 16, 2019 1:02 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v2 3/3] net/ixgbe: update API version
> 
> There is need to update to latest API version in order for negotiation between pf
> and vf, then new API message can be supported.
> 
> Fixes: 88fccb7a05c6 ("ixgbevf: fix jumbo frame")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
>  drivers/net/ixgbe/ixgbe_pf.c     | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index e8a2c6e..a25178a 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -1512,6 +1512,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
> 
>  	/* start with highest supported, proceed down */
>  	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
> +		ixgbe_mbox_api_13,
>  		ixgbe_mbox_api_12,
>  		ixgbe_mbox_api_11,
>  		ixgbe_mbox_api_10,
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index
> c9d1a1c..a6d8501 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -569,6 +569,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev,
> uint32_t vf, uint32_t *msgbuf)
>  	case ixgbe_mbox_api_10:
>  	case ixgbe_mbox_api_11:
>  	case ixgbe_mbox_api_12:
> +	case ixgbe_mbox_api_13:
>  		vfinfo[vf].api_version = (uint8_t)api_version;
>  		return 0;
>  	default:
> --
> 2.7.5

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

* [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF
  2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
                     ` (2 preceding siblings ...)
  2019-01-16  5:02   ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version Wei Zhao
@ 2019-02-13  7:18   ` Wei Zhao
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 1/2] " Wei Zhao
                       ` (2 more replies)
  3 siblings, 3 replies; 27+ messages in thread
From: Wei Zhao @ 2019-02-13  7:18 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang

There is need to enable promiscuous mode enable on VF,
pf host should also enable to support that.

v2:
--fix typo in commit log.

v3:
--delete unnecessary commit log infomation
--merge 2 patch into 1
--change patch headline name
--add promiscuous enable support infomation into doc

Zhao Wei (2):
  net/ixgbe: promiscuous mode enable on VF
  net/ixgbe: add VF promiscuous mode support when PF as host

 doc/guides/nics/features/ixgbe_vf.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c      | 21 ++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h      |  1 +
 drivers/net/ixgbe/ixgbe_pf.c          | 79 +++++++++++++++++++++++++----------
 4 files changed, 80 insertions(+), 22 deletions(-)

-- 
2.7.5

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

* [dpdk-dev] [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
  2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
@ 2019-02-13  7:18     ` Wei Zhao
  2019-03-01  7:53       ` Zhang, Qi Z
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
  2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2 siblings, 1 reply; 27+ messages in thread
From: Wei Zhao @ 2019-02-13  7:18 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

There is need to enable two ops of promiscuous_enable and
promiscuous_disable on VF.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 doc/guides/nics/features/ixgbe_vf.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c      | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/doc/guides/nics/features/ixgbe_vf.ini b/doc/guides/nics/features/ixgbe_vf.ini
index 0a15500..1614190 100644
--- a/doc/guides/nics/features/ixgbe_vf.ini
+++ b/doc/guides/nics/features/ixgbe_vf.ini
@@ -11,6 +11,7 @@ Jumbo frame          = Y
 Scattered Rx         = Y
 LRO                  = Y
 TSO                  = Y
+Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7493110..f36064d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
 	.dev_close            = ixgbevf_dev_close,
 	.dev_reset	      = ixgbevf_dev_reset,
+	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
+	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
 	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
 	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
 	.dev_infos_get        = ixgbevf_dev_info_get,
@@ -8301,6 +8305,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 }
 
 static void
+ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+}
+
+static void
+ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+}
+
+static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-- 
2.7.5

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

* [dpdk-dev] [PATCH v3 2/2] net/ixgbe: add VF promiscuous mode support when PF as host
  2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 1/2] " Wei Zhao
@ 2019-02-13  7:18     ` Wei Zhao
  2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-02-13  7:18 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

There is need to PF host promiscuous mode enable. For ixgbe,
in order to support VF vlan promiscuous or unicast promiscuous,
we need to set PF host register PFVML2FLT of bit UPE and VPE.
It also align to ixgbe kernel code version 5.5.3. And also
it need to update to the latest API version in order for
negotiation between pf and vf, then new API message can be
supported.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
 3 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f36064d..ed784d8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1512,6 +1512,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
 
 	/* start with highest supported, proceed down */
 	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
+		ixgbe_mbox_api_13,
 		ixgbe_mbox_api_12,
 		ixgbe_mbox_api_11,
 		ixgbe_mbox_api_10,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 565c69c..1e4157f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -265,6 +265,7 @@ struct ixgbe_vf_info {
 	uint8_t spoofchk_enabled;
 	uint8_t api_version;
 	uint16_t switch_domain_id;
+	uint16_t xcast_mode;
 };
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index be0c076..fafff6b 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
 }
 
 static int
-ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
-{
-	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t vmolr;
-
-	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-
-	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
-
-	vmolr |= IXGBE_VMOLR_MPE;
-
-	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
-
-	return 0;
-}
-
-static int
 ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -596,6 +579,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	case ixgbe_mbox_api_10:
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		vfinfo[vf].api_version = (uint8_t)api_version;
 		return 0;
 	default:
@@ -698,19 +682,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
 	struct ixgbe_vf_info *vfinfo =
 		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
-	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable */
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable */
+	u32 vmolr, fctrl, disable, enable;
 
 	switch (vfinfo[vf].api_version) {
 	case ixgbe_mbox_api_12:
+		/* promisc introduced in 1.3 version */
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+			return -EOPNOTSUPP;
+		break;
+		/* Fall threw */
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return -1;
 	}
 
-	if (enable)
-		return ixgbe_enable_vf_mc_promisc(dev, vf);
-	else
-		return ixgbe_disable_vf_mc_promisc(dev, vf);
+	if (vfinfo[vf].xcast_mode == xcast_mode)
+		goto out;
+
+	switch (xcast_mode) {
+	case IXGBEVF_XCAST_MODE_NONE:
+		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = 0;
+		break;
+	case IXGBEVF_XCAST_MODE_MULTI:
+		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
+		break;
+	case IXGBEVF_XCAST_MODE_ALLMULTI:
+		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
+		break;
+	case IXGBEVF_XCAST_MODE_PROMISC:
+		if (hw->mac.type <= ixgbe_mac_82599EB)
+			return -1;
+
+		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+		if (!(fctrl & IXGBE_FCTRL_UPE)) {
+			/* VF promisc requires PF in promisc */
+			RTE_LOG(ERR, PMD,
+			       "Enabling VF promisc requires PF in promisc\n");
+			return -1;
+		}
+
+		disable = 0;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		break;
+	default:
+		return -1;
+	}
+
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+	vmolr &= ~disable;
+	vmolr |= enable;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+	vfinfo[vf].xcast_mode = xcast_mode;
+
+out:
+	msgbuf[1] = xcast_mode;
+
+	return 0;
 }
 
 static int
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version
  2019-02-13  3:43     ` Zhang, Qi Z
@ 2019-02-14  1:22       ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-02-14  1:22 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: stable, Lu, Wenzhuo

Hi, qi 
   New v3 has been commit as your request, thanks.

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, February 13, 2019 11:44 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v2 3/3] net/ixgbe: update API version
> 
> I think this patch should be merged with PATCH 2/3, since
> "ixgbe_mbox_api_13" is already be referenced on that patch.
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, January 16, 2019 1:02 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v2 3/3] net/ixgbe: update API version
> >
> > There is need to update to latest API version in order for negotiation
> > between pf and vf, then new API message can be supported.
> >
> > Fixes: 88fccb7a05c6 ("ixgbevf: fix jumbo frame")
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
> >  drivers/net/ixgbe/ixgbe_pf.c     | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index e8a2c6e..a25178a 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -1512,6 +1512,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
> >
> >  	/* start with highest supported, proceed down */
> >  	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
> > +		ixgbe_mbox_api_13,
> >  		ixgbe_mbox_api_12,
> >  		ixgbe_mbox_api_11,
> >  		ixgbe_mbox_api_10,
> > diff --git a/drivers/net/ixgbe/ixgbe_pf.c
> > b/drivers/net/ixgbe/ixgbe_pf.c index
> > c9d1a1c..a6d8501 100644
> > --- a/drivers/net/ixgbe/ixgbe_pf.c
> > +++ b/drivers/net/ixgbe/ixgbe_pf.c
> > @@ -569,6 +569,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev,
> > uint32_t vf, uint32_t *msgbuf)
> >  	case ixgbe_mbox_api_10:
> >  	case ixgbe_mbox_api_11:
> >  	case ixgbe_mbox_api_12:
> > +	case ixgbe_mbox_api_13:
> >  		vfinfo[vf].api_version = (uint8_t)api_version;
> >  		return 0;
> >  	default:
> > --
> > 2.7.5

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

* Re: [dpdk-dev] [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 1/2] " Wei Zhao
@ 2019-03-01  7:53       ` Zhang, Qi Z
  2019-03-08  3:18         ` Zhao1, Wei
  0 siblings, 1 reply; 27+ messages in thread
From: Zhang, Qi Z @ 2019-03-01  7:53 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable

HI

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Wednesday, February 13, 2019 3:19 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
> 
> There is need to enable two ops of promiscuous_enable and
> promiscuous_disable on VF.

Should we add something to the release note? This looks like a common feature enabling for a wildly used device, users may need to be notified for this features.

Thanks
Qi

> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  doc/guides/nics/features/ixgbe_vf.ini |  1 +
>  drivers/net/ixgbe/ixgbe_ethdev.c      | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/doc/guides/nics/features/ixgbe_vf.ini
> b/doc/guides/nics/features/ixgbe_vf.ini
> index 0a15500..1614190 100644
> --- a/doc/guides/nics/features/ixgbe_vf.ini
> +++ b/doc/guides/nics/features/ixgbe_vf.ini
> @@ -11,6 +11,7 @@ Jumbo frame          = Y
>  Scattered Rx         = Y
>  LRO                  = Y
>  TSO                  = Y
> +Promiscuous mode     = Y
>  Allmulticast mode    = Y
>  Unicast MAC filter   = Y
>  RSS hash             = Y
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 7493110..f36064d 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct
> rte_eth_dev *dev,  static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw,
> int8_t direction,
>  				 uint8_t queue, uint8_t msix_vector);  static void
> ixgbevf_configure_msix(struct rte_eth_dev *dev);
> +static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
> +static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
>  static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);  static
> void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
> 
> @@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
>  	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
>  	.dev_close            = ixgbevf_dev_close,
>  	.dev_reset	      = ixgbevf_dev_reset,
> +	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
> +	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
>  	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
>  	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
>  	.dev_infos_get        = ixgbevf_dev_info_get,
> @@ -8301,6 +8305,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev
> *dev,  }
> 
>  static void
> +ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) {
> +	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	hw->mac.ops.update_xcast_mode(hw,
> IXGBEVF_XCAST_MODE_PROMISC); }
> +
> +static void
> +ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) {
> +	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> +	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE); }
> +
> +static void
>  ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)  {
>  	struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> --
> 2.7.5

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

* [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF
  2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 1/2] " Wei Zhao
  2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
@ 2019-03-08  2:46     ` Wei Zhao
  2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 1/2] " Wei Zhao
                         ` (2 more replies)
  2 siblings, 3 replies; 27+ messages in thread
From: Wei Zhao @ 2019-03-08  2:46 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang

There is need to enable promiscuous mode enable on VF,
pf host should also enable to support that.

v2:
--fix typo in commit log.

v3:
--delete unnecessary commit log infomation
--merge 2 patch into 1
--change patch headline name
--add promiscuous enable support infomation into doc

v4:
--add information to release note

Wei Zhao (2):
  net/ixgbe: promiscuous mode enable on VF
  net/ixgbe: add VF promiscuous mode support when PF as host

 doc/guides/nics/features/ixgbe_vf.ini  |  1 +
 doc/guides/rel_notes/release_19_05.rst |  5 +++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 21 +++++++++
 drivers/net/ixgbe/ixgbe_ethdev.h       |  1 +
 drivers/net/ixgbe/ixgbe_pf.c           | 79 ++++++++++++++++++++++++----------
 5 files changed, 85 insertions(+), 22 deletions(-)

-- 
2.7.5

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

* [dpdk-dev] [PATCH v4 1/2] net/ixgbe: promiscuous mode enable on VF
  2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
@ 2019-03-08  2:46       ` Wei Zhao
  2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
  2019-03-08  5:45       ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Zhang, Qi Z
  2 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-03-08  2:46 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

There is need to enable two ops of promiscuous_enable and
promiscuous_disable on VF.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 doc/guides/nics/features/ixgbe_vf.ini  |  1 +
 doc/guides/rel_notes/release_19_05.rst |  5 +++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 20 ++++++++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/doc/guides/nics/features/ixgbe_vf.ini b/doc/guides/nics/features/ixgbe_vf.ini
index 0a15500..1614190 100644
--- a/doc/guides/nics/features/ixgbe_vf.ini
+++ b/doc/guides/nics/features/ixgbe_vf.ini
@@ -11,6 +11,7 @@ Jumbo frame          = Y
 Scattered Rx         = Y
 LRO                  = Y
 TSO                  = Y
+Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 2fc6ad4..36d843d 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -85,6 +85,11 @@ New Features
   * Added limited support for RSS.
   * Added limited support for PASSTHRU.
 
+* **Enable promiscuous mode on ixgbe VF.**
+
+  Enable promiscuous mode enable ixgbe on VF,
+  pf host also be enabled to support that.
+
 Removed Items
 -------------
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index c336937..3bf51ee 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -260,6 +260,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -596,6 +598,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
 	.dev_close            = ixgbevf_dev_close,
 	.dev_reset	      = ixgbevf_dev_reset,
+	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
+	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
 	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
 	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
 	.dev_infos_get        = ixgbevf_dev_info_get,
@@ -8310,6 +8314,22 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 }
 
 static void
+ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+}
+
+static void
+ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+}
+
+static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-- 
2.7.5

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

* [dpdk-dev] [PATCH v4 2/2] net/ixgbe: add VF promiscuous mode support when PF as host
  2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 1/2] " Wei Zhao
@ 2019-03-08  2:46       ` Wei Zhao
  2019-03-08  5:45       ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Zhang, Qi Z
  2 siblings, 0 replies; 27+ messages in thread
From: Wei Zhao @ 2019-03-08  2:46 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

There is need to PF host promiscuous mode enable. For ixgbe,
in order to support VF vlan promiscuous or unicast promiscuous,
we need to set PF host register PFVML2FLT of bit UPE and VPE.
It also align to ixgbe kernel code version 5.5.3. And also
it need to update to the latest API version in order for
negotiation between pf and vf, then new API message can be
supported.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.h |  1 +
 drivers/net/ixgbe/ixgbe_pf.c     | 79 +++++++++++++++++++++++++++++-----------
 3 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3bf51ee..97e1021 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1515,6 +1515,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw)
 
 	/* start with highest supported, proceed down */
 	static const enum ixgbe_pfvf_api_rev sup_ver[] = {
+		ixgbe_mbox_api_13,
 		ixgbe_mbox_api_12,
 		ixgbe_mbox_api_11,
 		ixgbe_mbox_api_10,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 99a5077..3fec613 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -266,6 +266,7 @@ struct ixgbe_vf_info {
 	uint8_t spoofchk_enabled;
 	uint8_t api_version;
 	uint16_t switch_domain_id;
+	uint16_t xcast_mode;
 };
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index be0c076..fafff6b 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -408,23 +408,6 @@ ixgbe_vf_reset_msg(struct rte_eth_dev *dev, uint16_t vf)
 }
 
 static int
-ixgbe_enable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
-{
-	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint32_t vmolr;
-
-	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-
-	RTE_LOG(INFO, PMD, "VF %u: enabling multicast promiscuous\n", vf);
-
-	vmolr |= IXGBE_VMOLR_MPE;
-
-	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
-
-	return 0;
-}
-
-static int
 ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -596,6 +579,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	case ixgbe_mbox_api_10:
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		vfinfo[vf].api_version = (uint8_t)api_version;
 		return 0;
 	default:
@@ -698,19 +682,70 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 {
 	struct ixgbe_vf_info *vfinfo =
 		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
-	bool enable = !!msgbuf[1];	/* msgbuf contains the flag to enable */
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int xcast_mode = msgbuf[1];	/* msgbuf contains the flag to enable */
+	u32 vmolr, fctrl, disable, enable;
 
 	switch (vfinfo[vf].api_version) {
 	case ixgbe_mbox_api_12:
+		/* promisc introduced in 1.3 version */
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC)
+			return -EOPNOTSUPP;
+		break;
+		/* Fall threw */
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return -1;
 	}
 
-	if (enable)
-		return ixgbe_enable_vf_mc_promisc(dev, vf);
-	else
-		return ixgbe_disable_vf_mc_promisc(dev, vf);
+	if (vfinfo[vf].xcast_mode == xcast_mode)
+		goto out;
+
+	switch (xcast_mode) {
+	case IXGBEVF_XCAST_MODE_NONE:
+		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = 0;
+		break;
+	case IXGBEVF_XCAST_MODE_MULTI:
+		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
+		break;
+	case IXGBEVF_XCAST_MODE_ALLMULTI:
+		disable = IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
+		break;
+	case IXGBEVF_XCAST_MODE_PROMISC:
+		if (hw->mac.type <= ixgbe_mac_82599EB)
+			return -1;
+
+		fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+		if (!(fctrl & IXGBE_FCTRL_UPE)) {
+			/* VF promisc requires PF in promisc */
+			RTE_LOG(ERR, PMD,
+			       "Enabling VF promisc requires PF in promisc\n");
+			return -1;
+		}
+
+		disable = 0;
+		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+		break;
+	default:
+		return -1;
+	}
+
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+	vmolr &= ~disable;
+	vmolr |= enable;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+	vfinfo[vf].xcast_mode = xcast_mode;
+
+out:
+	msgbuf[1] = xcast_mode;
+
+	return 0;
 }
 
 static int
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
  2019-03-01  7:53       ` Zhang, Qi Z
@ 2019-03-08  3:18         ` Zhao1, Wei
  0 siblings, 0 replies; 27+ messages in thread
From: Zhao1, Wei @ 2019-03-08  3:18 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: stable

Hi ,qi
   
   New v4 has been commit, thanks.


> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Friday, March 1, 2019 3:53 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
> 
> HI
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, February 13, 2019 3:19 PM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH v3 1/2] net/ixgbe: promiscuous mode enable on VF
> >
> > There is need to enable two ops of promiscuous_enable and
> > promiscuous_disable on VF.
> 
> Should we add something to the release note? This looks like a common
> feature enabling for a wildly used device, users may need to be notified for
> this features.
> 
> Thanks
> Qi
> 
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> >  doc/guides/nics/features/ixgbe_vf.ini |  1 +
> >  drivers/net/ixgbe/ixgbe_ethdev.c      | 20 ++++++++++++++++++++
> >  2 files changed, 21 insertions(+)
> >
> > diff --git a/doc/guides/nics/features/ixgbe_vf.ini
> > b/doc/guides/nics/features/ixgbe_vf.ini
> > index 0a15500..1614190 100644
> > --- a/doc/guides/nics/features/ixgbe_vf.ini
> > +++ b/doc/guides/nics/features/ixgbe_vf.ini
> > @@ -11,6 +11,7 @@ Jumbo frame          = Y
> >  Scattered Rx         = Y
> >  LRO                  = Y
> >  TSO                  = Y
> > +Promiscuous mode     = Y
> >  Allmulticast mode    = Y
> >  Unicast MAC filter   = Y
> >  RSS hash             = Y
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 7493110..f36064d 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -260,6 +260,8 @@ static int
> > ixgbevf_dev_rx_queue_intr_disable(struct
> > rte_eth_dev *dev,  static void ixgbevf_set_ivar_map(struct ixgbe_hw
> > *hw, int8_t direction,
> >  				 uint8_t queue, uint8_t msix_vector);  static
> void
> > ixgbevf_configure_msix(struct rte_eth_dev *dev);
> > +static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
> > +static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
> >  static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
> > static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
> >
> > @@ -596,6 +598,8 @@ static const struct eth_dev_ops
> ixgbevf_eth_dev_ops = {
> >  	.xstats_get_names     = ixgbevf_dev_xstats_get_names,
> >  	.dev_close            = ixgbevf_dev_close,
> >  	.dev_reset	      = ixgbevf_dev_reset,
> > +	.promiscuous_enable   = ixgbevf_dev_promiscuous_enable,
> > +	.promiscuous_disable  = ixgbevf_dev_promiscuous_disable,
> >  	.allmulticast_enable  = ixgbevf_dev_allmulticast_enable,
> >  	.allmulticast_disable = ixgbevf_dev_allmulticast_disable,
> >  	.dev_infos_get        = ixgbevf_dev_info_get,
> > @@ -8301,6 +8305,22 @@ ixgbe_dev_udp_tunnel_port_del(struct
> > rte_eth_dev *dev,  }
> >
> >  static void
> > +ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) {
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +	hw->mac.ops.update_xcast_mode(hw,
> > IXGBEVF_XCAST_MODE_PROMISC); }
> > +
> > +static void
> > +ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) {
> > +	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > +	hw->mac.ops.update_xcast_mode(hw,
> IXGBEVF_XCAST_MODE_NONE); }
> > +
> > +static void
> >  ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)  {
> >  	struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > --
> > 2.7.5

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

* Re: [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF
  2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
  2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 1/2] " Wei Zhao
  2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
@ 2019-03-08  5:45       ` Zhang, Qi Z
  2 siblings, 0 replies; 27+ messages in thread
From: Zhang, Qi Z @ 2019-03-08  5:45 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Friday, March 8, 2019 10:46 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF
> 
> There is need to enable promiscuous mode enable on VF, pf host should also
> enable to support that.
> 
> v2:
> --fix typo in commit log.
> 
> v3:
> --delete unnecessary commit log infomation --merge 2 patch into 1 --change
> patch headline name --add promiscuous enable support infomation into doc
> 
> v4:
> --add information to release note
> 
> Wei Zhao (2):
>   net/ixgbe: promiscuous mode enable on VF
>   net/ixgbe: add VF promiscuous mode support when PF as host
> 
>  doc/guides/nics/features/ixgbe_vf.ini  |  1 +
> doc/guides/rel_notes/release_19_05.rst |  5 +++
>  drivers/net/ixgbe/ixgbe_ethdev.c       | 21 +++++++++
>  drivers/net/ixgbe/ixgbe_ethdev.h       |  1 +
>  drivers/net/ixgbe/ixgbe_pf.c           | 79
> ++++++++++++++++++++++++----------
>  5 files changed, 85 insertions(+), 22 deletions(-)
> 
> --
> 2.7.5

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

Applied to dpdk-next-net-intel with minor reword on commit log and release notes.

Thanks
Qi

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

end of thread, other threads:[~2019-03-08  5:45 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16  4:42 [dpdk-dev] [PATCH 0/3] promiscuous mode enable on VF Wei Zhao
2019-01-16  4:42 ` [dpdk-dev] [PATCH 1/3] net/ixgbe: " Wei Zhao
2019-01-16  4:42 ` [dpdk-dev] [PATCH 2/3] net/ixgbe: enable promiscous mode on PF host Wei Zhao
2019-01-16  4:42 ` [dpdk-dev] [PATCH 3/3] net/ixgbe: update API version Wei Zhao
2019-01-16  5:01 ` [dpdk-dev] [PATCH v2 0/3] net/ixgbe: promiscuous mode enable on VF Wei Zhao
2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 1/3] " Wei Zhao
2019-02-13  3:35     ` Zhang, Qi Z
2019-02-13  3:36       ` Zhao1, Wei
2019-01-16  5:01   ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: enable promiscuous mode on PF host Wei Zhao
2019-02-13  3:41     ` Zhang, Qi Z
2019-02-13  3:42       ` Zhao1, Wei
2019-01-16  5:02   ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: update API version Wei Zhao
2019-02-13  3:43     ` Zhang, Qi Z
2019-02-14  1:22       ` Zhao1, Wei
2019-02-13  7:18   ` [dpdk-dev] [PATCH v3 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 1/2] " Wei Zhao
2019-03-01  7:53       ` Zhang, Qi Z
2019-03-08  3:18         ` Zhao1, Wei
2019-02-13  7:18     ` [dpdk-dev] [PATCH v3 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
2019-03-08  2:46     ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Wei Zhao
2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 1/2] " Wei Zhao
2019-03-08  2:46       ` [dpdk-dev] [PATCH v4 2/2] net/ixgbe: add VF promiscuous mode support when PF as host Wei Zhao
2019-03-08  5:45       ` [dpdk-dev] [PATCH v4 0/2] net/ixgbe: promiscuous mode enable on VF Zhang, Qi Z
2019-01-16  8:28 ` [dpdk-dev] [PATCH 0/3] " David Marchand
2019-01-17  9:23   ` Zhao1, Wei
2019-01-16 18:59 ` Stephen Hemminger
2019-01-17  9:27   ` Zhao1, Wei

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).