From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A7C645A8B for ; Wed, 10 Jun 2015 07:54:51 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 09 Jun 2015 22:54:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,586,1427785200"; d="scan'208";a="585178956" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by orsmga003.jf.intel.com with ESMTP; 09 Jun 2015 22:54:32 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 10 Jun 2015 13:54:25 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.129]) with mapi id 14.03.0224.002; Wed, 10 Jun 2015 13:54:24 +0800 From: "Chen, Jing D" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [PATCH 1/3] fm10k: Add promiscuous mode support Thread-Index: AQHQn25z78cpkTLyXEOmqB85OcU1J52lQOxA Date: Wed, 10 Jun 2015 05:54:23 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0170914E@shsmsx102.ccr.corp.intel.com> References: <1433494978-6708-1-git-send-email-jing.d.chen@intel.com> <1433494978-6708-2-git-send-email-jing.d.chen@intel.com> <533710CFB86FA344BFBF2D6802E6028604692953@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E6028604692953@SHSMSX101.ccr.corp.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 Cc: "He, Shaopeng" Subject: Re: [dpdk-dev] [PATCH 1/3] fm10k: Add promiscuous mode support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2015 05:54:52 -0000 Hi, Michael, > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, June 09, 2015 11:21 PM > To: Chen, Jing D; dev@dpdk.org > Cc: He, Shaopeng > Subject: Re: [PATCH 1/3] fm10k: Add promiscuous mode support >=20 > On 2015/6/5 17:03, Chen, Jing D wrote: > > From: "Chen Jing D(Mark)" > > > > Add functions to support promiscuous/allmulticast enable and > > disable. > > > > Signed-off-by: Chen Jing D(Mark) > > --- > > drivers/net/fm10k/fm10k_ethdev.c | 118 > +++++++++++++++++++++++++++++++++++++- > > 1 files changed, 117 insertions(+), 1 deletions(-) > > >=20 > ... >=20 > > + > > +static void > > +fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev) > > +{ > > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > > + int status; > > + > > + PMD_INIT_FUNC_TRACE(); > > + > > + /* Return if it didn't acquire valid glort range */ > > + if (!fm10k_glort_valid(hw)) > > + return; > > + > > + fm10k_mbx_lock(hw); > > + status =3D hw->mac.ops.update_xcast_mode(hw, hw- > >mac.dglort_map, > > + FM10K_XCAST_MODE_PROMISC); > > + fm10k_mbx_unlock(hw); > > + > > + if (status !=3D FM10K_SUCCESS) > > + PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode"); > > +} > > + > > +static void > > +fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev) > > +{ > > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > > + uint8_t mode; > > + int status; > > + > > + PMD_INIT_FUNC_TRACE(); > > + > > + /* Return if it didn't acquire valid glort range */ > > + if (!fm10k_glort_valid(hw)) > > + return; > > + > > + if (dev->data->all_multicast =3D=3D 1) > > + mode =3D FM10K_XCAST_MODE_ALLMULTI; > > + else > > + mode =3D FM10K_XCAST_MODE_NONE; > > + > > + fm10k_mbx_lock(hw); > > + status =3D hw->mac.ops.update_xcast_mode(hw, hw- > >mac.dglort_map, > > + mode); > > + fm10k_mbx_unlock(hw); > > + > > + if (status !=3D FM10K_SUCCESS) > > + PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode"); > > +} > > + > > +static void > > +fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev) > > +{ > > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > > + int status; > > + > > + PMD_INIT_FUNC_TRACE(); > > + > > + /* Return if it didn't acquire valid glort range */ > > + if (!fm10k_glort_valid(hw)) > > + return; > > + > > + /* If promiscuous mode is enabled, it doesn't make sense to enable > > + * allmulticast and disable promiscuous since fm10k only can select > > + * one of the modes. > > + */ > > + if (dev->data->promiscuous) >=20 > Would it be better to add a log here to tell user? Agree. Thanks!=09 >=20 > > + return; > > + > > + fm10k_mbx_lock(hw); > > + status =3D hw->mac.ops.update_xcast_mode(hw, hw- > >mac.dglort_map, > > + FM10K_XCAST_MODE_ALLMULTI); > > + fm10k_mbx_unlock(hw); > > + > > + if (status !=3D FM10K_SUCCESS) > > + PMD_INIT_LOG(ERR, "Failed to enable allmulticast mode"); > > +} > > + > > +static void > > +fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev) > > +{ > > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > > + int status; > > + > > + PMD_INIT_FUNC_TRACE(); > > + > > + /* Return if it didn't acquire valid glort range */ > > + if (!fm10k_glort_valid(hw)) > > + return; > > + > > + if (dev->data->promiscuous) >=20 > Also here? Agree. Thanks!=09 >=20 > > + return; > > + > > + fm10k_mbx_lock(hw); > > + /* Change mode to unicast mode */ > > + status =3D hw->mac.ops.update_xcast_mode(hw, hw- > >mac.dglort_map, > > + FM10K_XCAST_MODE_NONE); > > + fm10k_mbx_unlock(hw); > > + > > + if (status !=3D FM10K_SUCCESS) > > + PMD_INIT_LOG(ERR, "Failed to disable allmulticast mode"); > > +} > > + > > /* fls =3D find last set bit =3D 32 minus the number of leading zeros = */ > > #ifndef fls > > #define fls(x) (((x) =3D=3D 0) ? 0 : (32 - __builtin_clz((x)))) > > @@ -1654,6 +1766,10 @@ static const struct eth_dev_ops > fm10k_eth_dev_ops =3D { > > .dev_start =3D fm10k_dev_start, > > .dev_stop =3D fm10k_dev_stop, > > .dev_close =3D fm10k_dev_close, > > + .promiscuous_enable =3D fm10k_dev_promiscuous_enable, > > + .promiscuous_disable =3D fm10k_dev_promiscuous_disable, > > + .allmulticast_enable =3D fm10k_dev_allmulticast_enable, > > + .allmulticast_disable =3D fm10k_dev_allmulticast_disable, > > .stats_get =3D fm10k_stats_get, > > .stats_reset =3D fm10k_stats_reset, > > .link_update =3D fm10k_link_update, > > @@ -1819,7 +1935,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > > * API func. > > */ > > hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map, > > - FM10K_XCAST_MODE_MULTI); > > + FM10K_XCAST_MODE_NONE); > > > > fm10k_mbx_unlock(hw); > >