From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 38CFAF614 for ; Thu, 5 Jan 2017 09:52:34 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 05 Jan 2017 00:52:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="919164911" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 05 Jan 2017 00:52:33 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 00:52:33 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 00:52:32 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.204]) with mapi id 14.03.0248.002; Thu, 5 Jan 2017 16:52:29 +0800 From: "Wu, Jingjing" To: "Lu, Wenzhuo" , "dev@dpdk.org" CC: "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF Thread-Index: AQHSZY6jjQjMvCUulUS9EvIhDPY9HqEplfyg Date: Thu, 5 Jan 2017 08:52:29 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810CC36FA@SHSMSX103.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> In-Reply-To: <1483426488-117332-5-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 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: Thu, 05 Jan 2017 08:52:35 -0000 > -----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 >=20 > 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-s= poofing. >=20 > 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(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.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; >=20 > if (vlan_id > ETH_VLAN_ID_MAX) > return; >=20 > 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); >=20 > - 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; > + } > } >=20 The function i40e_set_vlan_filter is used to store the vlan info in vsi structure. I think it will be better to move the hardware vlan filte= r handling to i40e_vsi_add_vlan who called the i40e_set_vlan_filter function to let th= e code more easy to maintain. Thanks Jingjing