From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8D5E125D9 for ; Wed, 23 Jan 2019 07:20:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2019 22:20:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,510,1539673200"; d="scan'208";a="136944864" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 22 Jan 2019 22:20:53 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 22 Jan 2019 22:20:53 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 22 Jan 2019 22:20:52 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.196]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.147]) with mapi id 14.03.0415.000; Wed, 23 Jan 2019 14:20:50 +0800 From: "Yang, Qiming" To: "Lu, Wenzhuo" , "dev@dpdk.org" CC: "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support Thread-Index: AQHUssPiSWcs4qvYXUu3mznOM2sj46W8YYjg Date: Wed, 23 Jan 2019 06:20:50 +0000 Message-ID: References: <1548146542-69346-1-git-send-email-wenzhuo.lu@intel.com> <1548211021-77330-1-git-send-email-wenzhuo.lu@intel.com> In-Reply-To: <1548211021-77330-1-git-send-email-wenzhuo.lu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/ice: add promiscuous mode support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2019 06:20:55 -0000 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 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 --- 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/ic= e.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 =3D Y Jumbo frame =3D Y Scattered Rx =3D Y TSO =3D Y +Promiscuous mode =3D Y +Allmulticast mode =3D Y Unicast MAC filter =3D Y Multicast MAC filter =3D Y RSS hash =3D Y diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 466af5= 5..3998d5e 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -88,17 +88,3 @@ Limitations or Known issues ~~~~~~~~~~~~~~~~ =20 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 receiv= e 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 t= o -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. Recomman= d to use -MAC-fwd for evaluation. diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c in= dex 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_con= f_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=20 +ice_promisc_disable(struct rte_eth_dev *dev); static void=20 +ice_allmulti_enable(struct rte_eth_dev *dev); static void=20 +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 *de= v, .reta_query =3D ice_rss_reta_query, .rss_hash_update =3D ice_rss_hash_update, .rss_hash_conf_get =3D ice_rss_hash_conf_get, + .promiscuous_enable =3D ice_promisc_enable, + .promiscuous_disable =3D ice_promisc_disable, + .allmulticast_enable =3D ice_allmulti_enable, + .allmulticast_disable =3D ice_allmulti_disable, .rx_queue_intr_enable =3D ice_rx_queue_intr_enable, .rx_queue_intr_disable =3D ice_rx_queue_intr_disable, .fw_version_get =3D ice_fw_version_get, @@ -1709,6 +1717,7 @@ static int ice_init_rss(struct ice_pf *pf) struct rte_eth_dev_data *data =3D dev->data; struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_vsi *vsi =3D pf->main_vsi; uint16_t nb_rxq =3D 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; =20 + /* Enable receiving broadcast packets and transmitting packets */ + ret =3D 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 !=3D ICE_SUCCESS) + PMD_DRV_LOG(INFO, "fail to set vsi broadcast"); + ret =3D 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; } =20 +static void +ice_promisc_enable(struct rte_eth_dev *dev) { Should this '{' start on the next line?=20 + struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_vsi *vsi =3D pf->main_vsi; + uint8_t pmask; + uint16_t status; + + pmask =3D ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX | + ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; + + status =3D ice_set_vsi_promisc(hw, vsi->idx, pmask, 0); + if (status !=3D ICE_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to enable promisc, err=3D%d", status); } Same commentd for '}'. + +static void +ice_promisc_disable(struct rte_eth_dev *dev) { + struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_vsi *vsi =3D pf->main_vsi; + uint16_t status; + uint8_t pmask; + + pmask =3D ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX | + ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; + + status =3D ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0); + if (status !=3D ICE_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to clear promisc, err=3D%d", status); } + +static void +ice_allmulti_enable(struct rte_eth_dev *dev) { + struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_vsi *vsi =3D pf->main_vsi; + uint8_t pmask; + uint16_t status; + + pmask =3D ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; + + status =3D ice_set_vsi_promisc(hw, vsi->idx, pmask, 0); + if (status !=3D ICE_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to enable allmulti, err=3D%d", status); } + +static void +ice_allmulti_disable(struct rte_eth_dev *dev) { + struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_vsi *vsi =3D pf->main_vsi; + uint16_t status; + uint8_t pmask; + + if (dev->data->promiscuous =3D=3D 1) + return; /* must remain in all_multicast mode */ + + pmask =3D ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; + + status =3D ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0); + if (status !=3D ICE_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=3D%d", status); } + static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { -- 1.9.3