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 1E41B5A58 for ; Tue, 9 Jun 2015 17:49:33 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 09 Jun 2015 08:20:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,581,1427785200"; d="scan'208";a="723933607" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by fmsmga001.fm.intel.com with ESMTP; 09 Jun 2015 08:20:59 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 9 Jun 2015 23:20:57 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.146]) with mapi id 14.03.0224.002; Tue, 9 Jun 2015 23:20:56 +0800 From: "Qiu, Michael" To: "Chen, Jing D" , "dev@dpdk.org" Thread-Topic: [PATCH 1/3] fm10k: Add promiscuous mode support Thread-Index: AQHQn25zsQp73NSWuUyiBL8w7/kp0Q== Date: Tue, 9 Jun 2015 15:20:56 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E6028604692953@SHSMSX101.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> 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: Tue, 09 Jun 2015 15:49:34 -0000 On 2015/6/5 17:03, Chen, Jing D wrote:=0A= > From: "Chen Jing D(Mark)" =0A= >=0A= > Add functions to support promiscuous/allmulticast enable and=0A= > disable.=0A= >=0A= > Signed-off-by: Chen Jing D(Mark) =0A= > ---=0A= > drivers/net/fm10k/fm10k_ethdev.c | 118 ++++++++++++++++++++++++++++++++= +++++-=0A= > 1 files changed, 117 insertions(+), 1 deletions(-)=0A= >=0A= =0A= ...=0A= =0A= > +=0A= > +static void=0A= > +fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)=0A= > +{=0A= > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private)= ;=0A= > + int status;=0A= > +=0A= > + PMD_INIT_FUNC_TRACE();=0A= > +=0A= > + /* Return if it didn't acquire valid glort range */=0A= > + if (!fm10k_glort_valid(hw))=0A= > + return;=0A= > +=0A= > + fm10k_mbx_lock(hw);=0A= > + status =3D hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,=0A= > + FM10K_XCAST_MODE_PROMISC);=0A= > + fm10k_mbx_unlock(hw);=0A= > +=0A= > + if (status !=3D FM10K_SUCCESS)=0A= > + PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode");=0A= > +}=0A= > +=0A= > +static void=0A= > +fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)=0A= > +{=0A= > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private)= ;=0A= > + uint8_t mode;=0A= > + int status;=0A= > +=0A= > + PMD_INIT_FUNC_TRACE();=0A= > +=0A= > + /* Return if it didn't acquire valid glort range */=0A= > + if (!fm10k_glort_valid(hw))=0A= > + return;=0A= > +=0A= > + if (dev->data->all_multicast =3D=3D 1)=0A= > + mode =3D FM10K_XCAST_MODE_ALLMULTI;=0A= > + else=0A= > + mode =3D FM10K_XCAST_MODE_NONE;=0A= > +=0A= > + fm10k_mbx_lock(hw);=0A= > + status =3D hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,=0A= > + mode);=0A= > + fm10k_mbx_unlock(hw);=0A= > +=0A= > + if (status !=3D FM10K_SUCCESS)=0A= > + PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode");=0A= > +}=0A= > +=0A= > +static void=0A= > +fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev)=0A= > +{=0A= > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private)= ;=0A= > + int status;=0A= > +=0A= > + PMD_INIT_FUNC_TRACE();=0A= > +=0A= > + /* Return if it didn't acquire valid glort range */=0A= > + if (!fm10k_glort_valid(hw))=0A= > + return;=0A= > +=0A= > + /* If promiscuous mode is enabled, it doesn't make sense to enable=0A= > + * allmulticast and disable promiscuous since fm10k only can select=0A= > + * one of the modes.=0A= > + */=0A= > + if (dev->data->promiscuous)=0A= =0A= Would it be better to add a log here to tell user?=0A= =0A= > + return;=0A= > +=0A= > + fm10k_mbx_lock(hw);=0A= > + status =3D hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,=0A= > + FM10K_XCAST_MODE_ALLMULTI);=0A= > + fm10k_mbx_unlock(hw);=0A= > +=0A= > + if (status !=3D FM10K_SUCCESS)=0A= > + PMD_INIT_LOG(ERR, "Failed to enable allmulticast mode");=0A= > +}=0A= > +=0A= > +static void=0A= > +fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev)=0A= > +{=0A= > + struct fm10k_hw *hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private)= ;=0A= > + int status;=0A= > +=0A= > + PMD_INIT_FUNC_TRACE();=0A= > +=0A= > + /* Return if it didn't acquire valid glort range */=0A= > + if (!fm10k_glort_valid(hw))=0A= > + return;=0A= > +=0A= > + if (dev->data->promiscuous)=0A= =0A= Also here?=0A= =0A= > + return;=0A= > +=0A= > + fm10k_mbx_lock(hw);=0A= > + /* Change mode to unicast mode */=0A= > + status =3D hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,=0A= > + FM10K_XCAST_MODE_NONE);=0A= > + fm10k_mbx_unlock(hw);=0A= > +=0A= > + if (status !=3D FM10K_SUCCESS)=0A= > + PMD_INIT_LOG(ERR, "Failed to disable allmulticast mode");=0A= > +}=0A= > +=0A= > /* fls =3D find last set bit =3D 32 minus the number of leading zeros */= =0A= > #ifndef fls=0A= > #define fls(x) (((x) =3D=3D 0) ? 0 : (32 - __builtin_clz((x))))=0A= > @@ -1654,6 +1766,10 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = =3D {=0A= > .dev_start =3D fm10k_dev_start,=0A= > .dev_stop =3D fm10k_dev_stop,=0A= > .dev_close =3D fm10k_dev_close,=0A= > + .promiscuous_enable =3D fm10k_dev_promiscuous_enable,=0A= > + .promiscuous_disable =3D fm10k_dev_promiscuous_disable,=0A= > + .allmulticast_enable =3D fm10k_dev_allmulticast_enable,=0A= > + .allmulticast_disable =3D fm10k_dev_allmulticast_disable,=0A= > .stats_get =3D fm10k_stats_get,=0A= > .stats_reset =3D fm10k_stats_reset,=0A= > .link_update =3D fm10k_link_update,=0A= > @@ -1819,7 +1935,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)=0A= > * API func.=0A= > */=0A= > hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,=0A= > - FM10K_XCAST_MODE_MULTI);=0A= > + FM10K_XCAST_MODE_NONE);=0A= > =0A= > fm10k_mbx_unlock(hw);=0A= > =0A= =0A=