From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 44120133F for ; Fri, 6 Jan 2017 04:00:39 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP; 05 Jan 2017 19:00:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,323,1477983600"; d="scan'208";a="50093429" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 05 Jan 2017 19:00:39 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 19:00:38 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 19:00:38 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Fri, 6 Jan 2017 11:00:37 +0800 From: "Lu, Wenzhuo" To: "Wu, Jingjing" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF Thread-Index: AQHSZzEMMQw5sPMhZkm+8mWcpVFTaKEqw13g Date: Fri, 6 Jan 2017 03:00:37 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B55642C@shsmsx102.ccr.corp.intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com> <1483426488-117332-5-git-send-email-wenzhuo.lu@intel.com> <9BB6961774997848B5B42BEC655768F810CC36FA@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810CC36FA@SHSMSX103.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 Subject: Re: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF 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: Fri, 06 Jan 2017 03:00:41 -0000 Hi Jingjing, > -----Original Message----- > From: Wu, Jingjing > Sent: Thursday, January 5, 2017 4:52 PM > To: Lu, Wenzhuo; dev@dpdk.org > Cc: Lu, Wenzhuo > Subject: RE: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoof= ing > from PF >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Tuesday, January 3, 2017 2:54 PM > > To: dev@dpdk.org > > Cc: Lu, Wenzhuo > > Subject: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN > > anti-spoofing from PF > > > > Support enabling/disabling VF VLAN anti-spoofing from PF. > > User can call the API on PF to enable/disable a specific VF's VLAN anti= - > spoofing. > > > > Signed-off-by: Wenzhuo Lu > > --- > > drivers/net/i40e/i40e_ethdev.c | 116 > > +++++++++++++++++++++++++++++- > > drivers/net/i40e/i40e_ethdev.h | 1 + > > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++ > > drivers/net/i40e/rte_pmd_i40e_version.map | 1 + > > 4 files changed, 135 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 68c07de..bcc59b2 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -4418,6 +4418,7 @@ struct i40e_vsi * > > vsi->max_macaddrs =3D I40E_NUM_MACADDR_MAX; > > vsi->parent_vsi =3D uplink_vsi ? uplink_vsi : pf->main_vsi; > > vsi->user_param =3D user_param; > > + vsi->vlan_anti_spoof_on =3D 0; > > /* Allocate queues */ > > switch (vsi->type) { > > case I40E_VSI_MAIN : > > @@ -5761,17 +5762,35 @@ struct i40e_vsi * > > uint16_t vlan_id, bool on) > > { > > uint32_t vid_idx, vid_bit; > > + struct i40e_hw *hw =3D I40E_VSI_TO_HW(vsi); > > + struct i40e_aqc_add_remove_vlan_element_data vlan_data =3D {0}; > > + int ret; > > > > if (vlan_id > ETH_VLAN_ID_MAX) > > return; > > > > vid_idx =3D I40E_VFTA_IDX(vlan_id); > > vid_bit =3D I40E_VFTA_BIT(vlan_id); > > + vlan_data.vlan_tag =3D rte_cpu_to_le_16(vlan_id); > > > > - if (on) > > + if (on) { > > + if (vsi->vlan_anti_spoof_on) { > > + ret =3D i40e_aq_add_vlan(hw, vsi->seid, > > + &vlan_data, 1, NULL); > > + if (ret !=3D I40E_SUCCESS) > > + PMD_DRV_LOG(ERR, "Failed to add vlan > filter"); > > + } > > vsi->vfta[vid_idx] |=3D vid_bit; > > - else > > + } else { > > + if (vsi->vlan_anti_spoof_on) { > > + ret =3D i40e_aq_remove_vlan(hw, vsi->seid, > > + &vlan_data, 1, NULL); > > + if (ret !=3D I40E_SUCCESS) > > + PMD_DRV_LOG(ERR, > > + "Failed to remove vlan filter"); > > + } > > vsi->vfta[vid_idx] &=3D ~vid_bit; > > + } > > } > > > The function i40e_set_vlan_filter is used to store the vlan info in vsi s= tructure. I > think it will be better to move the hardware vlan filter handling to > i40e_vsi_add_vlan who called the i40e_set_vlan_filter function to let the= code > more easy to maintain. Thanks for the suggestion. I'll split it to 2 functions, one for storing, t= he other for HW setting. >=20 >=20 > Thanks > Jingjing