* [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
@ 2019-01-22 8:42 Wenzhuo Lu
2019-01-22 13:11 ` Zhang, Qi Z
2019-01-23 2:37 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
0 siblings, 2 replies; 7+ messages in thread
From: Wenzhuo Lu @ 2019-01-22 8:42 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Enable the APIs for unicast and multicast promiscuous
mode setting.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/nics/features/ice.ini | 2 +
drivers/net/ice/ice_ethdev.c | 86 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini
index 8b1e22e..5e6cb4b 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -14,6 +14,8 @@ MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
TSO = Y
+Promiscuous mode = Y
+Allmulticast mode = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
RSS hash = Y
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b145d9c..b450115 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -38,6 +38,10 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
+static void ice_promisc_enable(struct rte_eth_dev *dev);
+static void ice_promisc_disable(struct rte_eth_dev *dev);
+static void ice_allmulti_enable(struct rte_eth_dev *dev);
+static void ice_allmulti_disable(struct rte_eth_dev *dev);
static int ice_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id,
int on);
@@ -103,6 +107,10 @@ static int ice_xstats_get_names(struct rte_eth_dev *dev,
.reta_query = ice_rss_reta_query,
.rss_hash_update = ice_rss_hash_update,
.rss_hash_conf_get = ice_rss_hash_conf_get,
+ .promiscuous_enable = ice_promisc_enable,
+ .promiscuous_disable = ice_promisc_disable,
+ .allmulticast_enable = ice_allmulti_enable,
+ .allmulticast_disable = ice_allmulti_disable,
.rx_queue_intr_enable = ice_rx_queue_intr_enable,
.rx_queue_intr_disable = ice_rx_queue_intr_disable,
.fw_version_get = ice_fw_version_get,
@@ -1709,6 +1717,7 @@ static int ice_init_rss(struct ice_pf *pf)
struct rte_eth_dev_data *data = dev->data;
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
uint16_t nb_rxq = 0;
uint16_t nb_txq, i;
int ret;
@@ -1743,6 +1752,14 @@ static int ice_init_rss(struct ice_pf *pf)
if (ice_rxq_intr_setup(dev))
return -EIO;
+ /* Enable receiving broadcast packets and transmitting packets */
+ ret = ice_set_vsi_promisc(hw, vsi->idx,
+ ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
+ ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX,
+ 0);
+ if (ret != ICE_SUCCESS)
+ PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
+
ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM |
@@ -2556,6 +2573,75 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,
return 0;
}
+static void
+ice_promisc_enable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status);
+}
+
+static void
+ice_promisc_disable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
+}
+
+static void
+ice_allmulti_enable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable allmulti, err=%d", status);
+}
+
+static void
+ice_allmulti_disable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ if (dev->data->promiscuous == 1)
+ return; /* must remain in all_multicast mode */
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status);
+}
+
static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev,
uint16_t queue_id)
{
--
1.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
2019-01-22 8:42 [dpdk-dev] [PATCH] net/ice: add promiscuous mode support Wenzhuo Lu
@ 2019-01-22 13:11 ` Zhang, Qi Z
2019-01-23 1:08 ` Lu, Wenzhuo
2019-01-23 2:37 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
1 sibling, 1 reply; 7+ messages in thread
From: Zhang, Qi Z @ 2019-01-22 13:11 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
Hi Wenzhuo:
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 22, 2019 4:42 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
>
> Enable the APIs for unicast and multicast promiscuous mode setting.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
> doc/guides/nics/features/ice.ini | 2 +
> drivers/net/ice/ice_ethdev.c | 86
Do we also need to update the knowing issue in ice.rst?
Regards
Qi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
2019-01-22 13:11 ` Zhang, Qi Z
@ 2019-01-23 1:08 ` Lu, Wenzhuo
0 siblings, 0 replies; 7+ messages in thread
From: Lu, Wenzhuo @ 2019-01-23 1:08 UTC (permalink / raw)
To: Zhang, Qi Z, dev
Hi Qi,
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Tuesday, January 22, 2019 9:12 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
>
> Hi Wenzhuo:
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 22, 2019 4:42 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH] net/ice: add promiscuous mode support
> >
> > Enable the APIs for unicast and multicast promiscuous mode setting.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > doc/guides/nics/features/ice.ini | 2 +
> > drivers/net/ice/ice_ethdev.c | 86
>
> Do we also need to update the knowing issue in ice.rst?
Sorry, forgot it. Thanks for the reminder. Will send a V2 soon.
>
> Regards
> Qi
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
2019-01-22 8:42 [dpdk-dev] [PATCH] net/ice: add promiscuous mode support Wenzhuo Lu
2019-01-22 13:11 ` Zhang, Qi Z
@ 2019-01-23 2:37 ` Wenzhuo Lu
2019-01-23 5:07 ` Zhang, Qi Z
2019-01-23 6:20 ` Yang, Qiming
1 sibling, 2 replies; 7+ messages in thread
From: Wenzhuo Lu @ 2019-01-23 2:37 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Enable the APIs for unicast and multicast promiscuous
mode setting.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/nics/features/ice.ini | 2 +
doc/guides/nics/ice.rst | 14 -------
drivers/net/ice/ice_ethdev.c | 86 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 14 deletions(-)
diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini
index 8b1e22e..5e6cb4b 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -14,6 +14,8 @@ MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
TSO = Y
+Promiscuous mode = Y
+Allmulticast mode = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
RSS hash = Y
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 466af55..3998d5e 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -88,17 +88,3 @@ Limitations or Known issues
~~~~~~~~~~~~~~~~
Ice code released in 19.02 is for evaluation only.
-
-
-Promiscuous mode not supported
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-As promiscuous mode is not supported as this stage, a port can only receive the
-packets which destination MAC address is this port's own.
-
-
-TX anti-spoofing cannot be disabled
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-TX anti-spoofing is enabled by default. At this stage it's not supported to
-disable it. So any TX packet which source MAC address is not this port's own
-will be dropped by HW. It means io-fwd is not supported now. Recommand to use
-MAC-fwd for evaluation.
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b145d9c..b450115 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -38,6 +38,10 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
+static void ice_promisc_enable(struct rte_eth_dev *dev);
+static void ice_promisc_disable(struct rte_eth_dev *dev);
+static void ice_allmulti_enable(struct rte_eth_dev *dev);
+static void ice_allmulti_disable(struct rte_eth_dev *dev);
static int ice_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id,
int on);
@@ -103,6 +107,10 @@ static int ice_xstats_get_names(struct rte_eth_dev *dev,
.reta_query = ice_rss_reta_query,
.rss_hash_update = ice_rss_hash_update,
.rss_hash_conf_get = ice_rss_hash_conf_get,
+ .promiscuous_enable = ice_promisc_enable,
+ .promiscuous_disable = ice_promisc_disable,
+ .allmulticast_enable = ice_allmulti_enable,
+ .allmulticast_disable = ice_allmulti_disable,
.rx_queue_intr_enable = ice_rx_queue_intr_enable,
.rx_queue_intr_disable = ice_rx_queue_intr_disable,
.fw_version_get = ice_fw_version_get,
@@ -1709,6 +1717,7 @@ static int ice_init_rss(struct ice_pf *pf)
struct rte_eth_dev_data *data = dev->data;
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
uint16_t nb_rxq = 0;
uint16_t nb_txq, i;
int ret;
@@ -1743,6 +1752,14 @@ static int ice_init_rss(struct ice_pf *pf)
if (ice_rxq_intr_setup(dev))
return -EIO;
+ /* Enable receiving broadcast packets and transmitting packets */
+ ret = ice_set_vsi_promisc(hw, vsi->idx,
+ ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
+ ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX,
+ 0);
+ if (ret != ICE_SUCCESS)
+ PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
+
ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM |
@@ -2556,6 +2573,75 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,
return 0;
}
+static void
+ice_promisc_enable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status);
+}
+
+static void
+ice_promisc_disable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
+}
+
+static void
+ice_allmulti_enable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable allmulti, err=%d", status);
+}
+
+static void
+ice_allmulti_disable(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ if (dev->data->promiscuous == 1)
+ return; /* must remain in all_multicast mode */
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status);
+}
+
static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev,
uint16_t queue_id)
{
--
1.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
2019-01-23 2:37 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
@ 2019-01-23 5:07 ` Zhang, Qi Z
2019-01-23 6:20 ` Yang, Qiming
1 sibling, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2019-01-23 5:07 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Wednesday, January 23, 2019 10:37 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
>
> Enable the APIs for unicast and multicast promiscuous mode setting.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
2019-01-23 2:37 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
2019-01-23 5:07 ` Zhang, Qi Z
@ 2019-01-23 6:20 ` Yang, Qiming
2019-01-24 0:54 ` Lu, Wenzhuo
1 sibling, 1 reply; 7+ messages in thread
From: Yang, Qiming @ 2019-01-23 6:20 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
Hi, wenzhuo
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
Sent: Wednesday, January 23, 2019 10:37 AM
To: dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
Enable the APIs for unicast and multicast promiscuous mode setting.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/nics/features/ice.ini | 2 +
doc/guides/nics/ice.rst | 14 -------
drivers/net/ice/ice_ethdev.c | 86 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 14 deletions(-)
diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini
index 8b1e22e..5e6cb4b 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -14,6 +14,8 @@ MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
TSO = Y
+Promiscuous mode = Y
+Allmulticast mode = Y
Unicast MAC filter = Y
Multicast MAC filter = Y
RSS hash = Y
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 466af55..3998d5e 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -88,17 +88,3 @@ Limitations or Known issues ~~~~~~~~~~~~~~~~
Ice code released in 19.02 is for evaluation only.
-
-
-Promiscuous mode not supported
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-As promiscuous mode is not supported as this stage, a port can only receive the -packets which destination MAC address is this port's own.
-
-
-TX anti-spoofing cannot be disabled
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-TX anti-spoofing is enabled by default. At this stage it's not supported to -disable it. So any TX packet which source MAC address is not this port's own -will be dropped by HW. It means io-fwd is not supported now. Recommand to use -MAC-fwd for evaluation.
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index b145d9c..b450115 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -38,6 +38,10 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf); static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
+static void ice_promisc_enable(struct rte_eth_dev *dev); static void
+ice_promisc_disable(struct rte_eth_dev *dev); static void
+ice_allmulti_enable(struct rte_eth_dev *dev); static void
+ice_allmulti_disable(struct rte_eth_dev *dev);
static int ice_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id,
int on);
@@ -103,6 +107,10 @@ static int ice_xstats_get_names(struct rte_eth_dev *dev,
.reta_query = ice_rss_reta_query,
.rss_hash_update = ice_rss_hash_update,
.rss_hash_conf_get = ice_rss_hash_conf_get,
+ .promiscuous_enable = ice_promisc_enable,
+ .promiscuous_disable = ice_promisc_disable,
+ .allmulticast_enable = ice_allmulti_enable,
+ .allmulticast_disable = ice_allmulti_disable,
.rx_queue_intr_enable = ice_rx_queue_intr_enable,
.rx_queue_intr_disable = ice_rx_queue_intr_disable,
.fw_version_get = ice_fw_version_get,
@@ -1709,6 +1717,7 @@ static int ice_init_rss(struct ice_pf *pf)
struct rte_eth_dev_data *data = dev->data;
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
uint16_t nb_rxq = 0;
uint16_t nb_txq, i;
int ret;
@@ -1743,6 +1752,14 @@ static int ice_init_rss(struct ice_pf *pf)
if (ice_rxq_intr_setup(dev))
return -EIO;
+ /* Enable receiving broadcast packets and transmitting packets */
+ ret = ice_set_vsi_promisc(hw, vsi->idx,
+ ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
+ ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX,
+ 0);
+ if (ret != ICE_SUCCESS)
+ PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
+
ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM | @@ -2556,6 +2573,75 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,
return 0;
}
+static void
+ice_promisc_enable(struct rte_eth_dev *dev) {
Should this '{' start on the next line?
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status); }
Same commentd for '}'.
+
+static void
+ice_promisc_disable(struct rte_eth_dev *dev) {
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
+ ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status); }
+
+static void
+ice_allmulti_enable(struct rte_eth_dev *dev) {
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint8_t pmask;
+ uint16_t status;
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to enable allmulti, err=%d", status); }
+
+static void
+ice_allmulti_disable(struct rte_eth_dev *dev) {
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_vsi *vsi = pf->main_vsi;
+ uint16_t status;
+ uint8_t pmask;
+
+ if (dev->data->promiscuous == 1)
+ return; /* must remain in all_multicast mode */
+
+ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+ if (status != ICE_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status); }
+
static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev,
uint16_t queue_id)
{
--
1.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
2019-01-23 6:20 ` Yang, Qiming
@ 2019-01-24 0:54 ` Lu, Wenzhuo
0 siblings, 0 replies; 7+ messages in thread
From: Lu, Wenzhuo @ 2019-01-24 0:54 UTC (permalink / raw)
To: Yang, Qiming, dev
Hi Qiming,
> -----Original Message-----
> From: Yang, Qiming
> Sent: Wednesday, January 23, 2019 2:21 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
>
> Hi, wenzhuo
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Wednesday, January 23, 2019 10:37 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support
>
> Enable the APIs for unicast and multicast promiscuous mode setting.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
> doc/guides/nics/features/ice.ini | 2 +
> doc/guides/nics/ice.rst | 14 -------
> drivers/net/ice/ice_ethdev.c | 86
> ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 88 insertions(+), 14 deletions(-)
>
> diff --git a/doc/guides/nics/features/ice.ini
> b/doc/guides/nics/features/ice.ini
> index 8b1e22e..5e6cb4b 100644
> --- a/doc/guides/nics/features/ice.ini
> +++ b/doc/guides/nics/features/ice.ini
> @@ -14,6 +14,8 @@ MTU update = Y
> Jumbo frame = Y
> Scattered Rx = Y
> TSO = Y
> +Promiscuous mode = Y
> +Allmulticast mode = Y
> Unicast MAC filter = Y
> Multicast MAC filter = Y
> RSS hash = Y
> diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index
> 466af55..3998d5e 100644
> --- a/doc/guides/nics/ice.rst
> +++ b/doc/guides/nics/ice.rst
> @@ -88,17 +88,3 @@ Limitations or Known issues ~~~~~~~~~~~~~~~~
>
> Ice code released in 19.02 is for evaluation only.
> -
> -
> -Promiscuous mode not supported
> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> -As promiscuous mode is not supported as this stage, a port can only receive
> the -packets which destination MAC address is this port's own.
> -
> -
> -TX anti-spoofing cannot be disabled
> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> -TX anti-spoofing is enabled by default. At this stage it's not supported to -
> disable it. So any TX packet which source MAC address is not this port's own
> -will be dropped by HW. It means io-fwd is not supported now. Recommand
> to use -MAC-fwd for evaluation.
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> b145d9c..b450115 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -38,6 +38,10 @@ static int ice_rss_hash_update(struct rte_eth_dev
> *dev,
> struct rte_eth_rss_conf *rss_conf); static int
> ice_rss_hash_conf_get(struct rte_eth_dev *dev,
> struct rte_eth_rss_conf *rss_conf);
> +static void ice_promisc_enable(struct rte_eth_dev *dev); static void
> +ice_promisc_disable(struct rte_eth_dev *dev); static void
> +ice_allmulti_enable(struct rte_eth_dev *dev); static void
> +ice_allmulti_disable(struct rte_eth_dev *dev);
> static int ice_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id,
> int on);
> @@ -103,6 +107,10 @@ static int ice_xstats_get_names(struct rte_eth_dev
> *dev,
> .reta_query = ice_rss_reta_query,
> .rss_hash_update = ice_rss_hash_update,
> .rss_hash_conf_get = ice_rss_hash_conf_get,
> + .promiscuous_enable = ice_promisc_enable,
> + .promiscuous_disable = ice_promisc_disable,
> + .allmulticast_enable = ice_allmulti_enable,
> + .allmulticast_disable = ice_allmulti_disable,
> .rx_queue_intr_enable = ice_rx_queue_intr_enable,
> .rx_queue_intr_disable = ice_rx_queue_intr_disable,
> .fw_version_get = ice_fw_version_get,
> @@ -1709,6 +1717,7 @@ static int ice_init_rss(struct ice_pf *pf)
> struct rte_eth_dev_data *data = dev->data;
> struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
> >dev_private);
> + struct ice_vsi *vsi = pf->main_vsi;
> uint16_t nb_rxq = 0;
> uint16_t nb_txq, i;
> int ret;
> @@ -1743,6 +1752,14 @@ static int ice_init_rss(struct ice_pf *pf)
> if (ice_rxq_intr_setup(dev))
> return -EIO;
>
> + /* Enable receiving broadcast packets and transmitting packets */
> + ret = ice_set_vsi_promisc(hw, vsi->idx,
> + ICE_PROMISC_BCAST_RX |
> ICE_PROMISC_BCAST_TX |
> + ICE_PROMISC_UCAST_TX |
> ICE_PROMISC_MCAST_TX,
> + 0);
> + if (ret != ICE_SUCCESS)
> + PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
> +
> ret = ice_aq_set_event_mask(hw, hw->port_info->lport,
> ((u16)(ICE_AQ_LINK_EVENT_LINK_FAULT |
> ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM
> | @@ -2556,6 +2573,75 @@ static int ice_macaddr_set(struct rte_eth_dev
> *dev,
> return 0;
> }
>
> +static void
> +ice_promisc_enable(struct rte_eth_dev *dev) {
>
> Should this '{' start on the next line?
Interesting! I don't know what happened. I saw the same problem in the mail.
If you check the webpage, https://patches.dpdk.org/patch/50012/. It's good and the same as the original patch.
Could it be outlook that changes the context? TBH, I don't know.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-24 0:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 8:42 [dpdk-dev] [PATCH] net/ice: add promiscuous mode support Wenzhuo Lu
2019-01-22 13:11 ` Zhang, Qi Z
2019-01-23 1:08 ` Lu, Wenzhuo
2019-01-23 2:37 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
2019-01-23 5:07 ` Zhang, Qi Z
2019-01-23 6:20 ` Yang, Qiming
2019-01-24 0:54 ` Lu, Wenzhuo
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).