From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id BD38529C8 for ; Thu, 3 Mar 2016 03:33:53 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 02 Mar 2016 18:33:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,531,1449561600"; d="scan'208";a="662877718" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 02 Mar 2016 18:33:52 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 2 Mar 2016 18:33:51 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 2 Mar 2016 18:33:51 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.232]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.24]) with mapi id 14.03.0248.002; Thu, 3 Mar 2016 10:33:49 +0800 From: "Lu, Wenzhuo" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] e1000: fix setting of VF MAC address Thread-Index: AQHRdJ33wrprsz4Hz0aOYidUIoEHs59HAEZw Date: Thu, 3 Mar 2016 02:33:48 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC090903437428@shsmsx102.ccr.corp.intel.com> References: <1456934946-15349-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1456934946-15349-1-git-send-email-bernard.iremonger@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] e1000: fix setting of VF MAC address 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: Thu, 03 Mar 2016 02:33:54 -0000 Hi Bernard, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger > Sent: Thursday, March 3, 2016 12:09 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] e1000: fix setting of VF MAC address >=20 > Allow reprogramming of the RAR with a zero mac address, to ensure that th= e VF > traffic goes to the PF after stop, close and detach of the VF. >=20 > Fixes: be2d648a2dd3 ("igb: add PF support") > Fixes: d82170d27918 ("igb: add VF support") > Signed-off-by: Bernard Iremonger > --- > drivers/net/e1000/igb_ethdev.c | 12 +++++++++++- > drivers/net/e1000/igb_pf.c | 8 +++++--- > 2 files changed, 16 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethde= v.c > index 4ed5e95..f1044b7 100644 > --- a/drivers/net/e1000/igb_ethdev.c > +++ b/drivers/net/e1000/igb_ethdev.c > @@ -1,7 +1,7 @@ > /*- > * BSD LICENSE > * > - * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -2819,6 +2819,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) > struct e1000_hw *hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > struct e1000_adapter *adapter =3D > E1000_DEV_PRIVATE(dev->data->dev_private); > + struct ether_addr addr; >=20 > PMD_INIT_FUNC_TRACE(); >=20 > @@ -2827,6 +2828,15 @@ igbvf_dev_close(struct rte_eth_dev *dev) > igbvf_dev_stop(dev); > adapter->stopped =3D 1; > igb_dev_free_queues(dev); > + > + /** > + * reprogram the RAR with a zero mac address, > + * to ensure that the VF traffic goes to the PF > + * after stop, close and detach of the VF. > + **/ > + > + memset(&addr, 0, sizeof(addr)); > + igbvf_default_mac_addr_set(dev, &addr); > } >=20 > static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on) di= ff --git > a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index > 1d00dda..95204e9 100644 > --- a/drivers/net/e1000/igb_pf.c > +++ b/drivers/net/e1000/igb_pf.c > @@ -1,7 +1,7 @@ > /*- > * BSD LICENSE > * > - * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -332,8 +332,10 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, > uint32_t vf, uint32_t *msgbuf) > int rar_entry =3D hw->mac.rar_entry_count - (vf + 1); > uint8_t *new_mac =3D (uint8_t *)(&msgbuf[1]); >=20 > - if (is_valid_assigned_ether_addr((struct ether_addr*)new_mac)) { > - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); > + if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { > + if (!is_zero_ether_addr((struct ether_addr *)new_mac)) > + rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, > + sizeof(vfinfo[vf].vf_mac_addresses)); > hw->mac.ops.rar_set(hw, new_mac, rar_entry); If the new mac is 0, after this, the rar is 0, but the address stored in vf= info is not changed and surely not 0. Right? So, they're not align with each other. Could it cause some problem? > return 0; > } > -- > 2.6.3