From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E36FFC312 for ; Tue, 16 Jun 2015 08:43:33 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 15 Jun 2015 23:43:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,624,1427785200"; d="scan'208";a="508963896" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jun 2015 23:43:31 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 16 Jun 2015 14:43:23 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Tue, 16 Jun 2015 14:43:22 +0800 From: "Chen, Jing D" To: "He, Shaopeng" , "dev@dpdk.org" Thread-Topic: [PATCH v2] fm10k: fix PF/VF MAC address register and clean up bug Thread-Index: AQHQpwpQ4ysDW/w2CkKZs/ks8Jjijp2usSww Date: Tue, 16 Jun 2015 06:43:21 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0170C88A@shsmsx102.ccr.corp.intel.com> References: <1433474672-30951-1-git-send-email-shaopeng.he@intel.com> <1434331570-31289-1-git-send-email-shaopeng.he@intel.com> In-Reply-To: <1434331570-31289-1-git-send-email-shaopeng.he@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] fm10k: fix PF/VF MAC address register and clean up bug 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, 16 Jun 2015 06:43:34 -0000 Hi, > -----Original Message----- > From: He, Shaopeng > Sent: Monday, June 15, 2015 9:26 AM > To: dev@dpdk.org > Cc: Chen, Jing D; Qiu, Michael; He, Shaopeng > Subject: [PATCH v2] fm10k: fix PF/VF MAC address register and clean up bu= g >=20 > v2 changes: > - rebase this patch onto the HEAD > - add more description for this patch >=20 > This patch includes 3 changes related to MAC/VLAN address table > when the system(e.g. testpmd) is started and closed: > - remove default MAC address with fixed VLAN 0 which was for the > debug purpose before the MAC/VLAN filter function was implemented. > - enable VF MAC/VLAN filter for the first valid MAC address > and first valid VLAN ID. This is needed for system(e.g. testpmd) > to setup default MAC address and default VLAN for VF. > Later attempt to change these default value will be refused by > under layer shared code and PF host functions. > - un-register any combination of VLAN and MAC address from fm10k > switch side MAC table when the system(e.g. testpmd) is closed. >=20 > Signed-off-by: Shaopeng He > --- > drivers/net/fm10k/fm10k_ethdev.c | 42 ++++++++++++++++++++++-------- > ---------- > 1 file changed, 23 insertions(+), 19 deletions(-) >=20 > diff --git a/drivers/net/fm10k/fm10k_ethdev.c > b/drivers/net/fm10k/fm10k_ethdev.c > index 802a930..625fd31 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -58,6 +58,8 @@ static int > fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)= ; > static void > fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add); > +static void > +fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev); >=20 > static void > fm10k_mbx_initlock(struct fm10k_hw *hw) > @@ -703,6 +705,8 @@ fm10k_dev_close(struct rte_eth_dev *dev) >=20 > PMD_INIT_FUNC_TRACE(); >=20 > + fm10k_MACVLAN_remove_all(dev); > + > /* Stop mailbox service first */ > fm10k_close_mbx_service(hw); > fm10k_dev_stop(dev); > @@ -832,12 +836,6 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on) > hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); > macvlan =3D FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data- > >dev_private); >=20 > - /* @todo - add support for the VF */ > - if (hw->mac.type !=3D fm10k_mac_pf) { > - PMD_INIT_LOG(ERR, "VLAN filter not available on VF"); > - return -ENOTSUP; > - } > - > if (vlan_id > ETH_VLAN_ID_MAX) { > PMD_INIT_LOG(ERR, "Invalid vlan_id: must be < 4096"); > return (-EINVAL); > @@ -926,12 +924,6 @@ fm10k_MAC_filter_set(struct rte_eth_dev *dev, > const u8 *mac, bool add) > hw =3D FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); > macvlan =3D FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data- > >dev_private); >=20 > - /* @todo - add support for the VF */ > - if (hw->mac.type !=3D fm10k_mac_pf) { > - PMD_INIT_LOG(ERR, "MAC filter not available on VF"); > - return; > - } > - > i =3D 0; > for (j =3D 0; j < FM10K_VFTA_SIZE; j++) { > if (macvlan->vfta[j]) { > @@ -981,6 +973,25 @@ fm10k_macaddr_remove(struct rte_eth_dev *dev, > uint32_t index) > FALSE); > } >=20 > +/* Remove all VLAN and MAC address table entries */ > +static void > +fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev) > +{ > + uint32_t j, k; > + struct fm10k_macvlan_filter_info *macvlan; > + > + macvlan =3D FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data- > >dev_private); > + for (j =3D 0; j < FM10K_VFTA_SIZE; j++) { > + if (macvlan->vfta[j]) { > + for (k =3D 0; k < FM10K_UINT32_BIT_SIZE; k++) { > + if (macvlan->vfta[j] & (1 << k)) > + fm10k_vlan_filter_set(dev, > + j * FM10K_UINT32_BIT_SIZE > + k, false); > + } > + } > + } > +} > + > static inline int > check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t reques= t) > { > @@ -2008,13 +2019,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > /* Enable port first */ > hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map, 1, 1); >=20 > - /* > - * Add default mac. glort is assigned by SM for PF, while is > - * unused for VF. PF will assign correct glort for VF. > - */ > - hw->mac.ops.update_uc_addr(hw, hw->mac.dglort_map, hw- > >mac.addr, > - 0, 1, 0); > - > /* Set unicast mode by default. App can change to other mode in > other > * API func. > */ > -- > 1.9.3 Acked-by : Jing Chen