From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B4EC6C322 for ; Tue, 16 Jun 2015 14:08:26 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 16 Jun 2015 05:08:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,626,1427785200"; d="scan'208";a="744363491" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga002.fm.intel.com with ESMTP; 16 Jun 2015 05:08:24 -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 20:08:23 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Tue, 16 Jun 2015 20:08:17 +0800 From: "Qiu, Michael" To: "Chen, Jing D" , "dev@dpdk.org" Thread-Topic: [PATCH 5/6] fm10k: Do sanity check on mac address Thread-Index: AQHQmecLriF4mKOCukSNgr0MPSGjQA== Date: Tue, 16 Jun 2015 12:08:16 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E602860469C49F@SHSMSX101.ccr.corp.intel.com> References: <1432887044-24777-1-git-send-email-jing.d.chen@intel.com> <1432887044-24777-6-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 5/6] fm10k: Do sanity check on 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: Tue, 16 Jun 2015 12:08:27 -0000 Tested-by: Michael Qiu =0A= =0A= - OS: Fedora20 3.11.10-301=0A= - GCC: gcc version 4.8.3 2014911=0A= - CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz=0A= - NIC: Ethernet controller: Intel Corporation Device 15a4 (rev 01)=0A= - Default x86_64-native-linuxapp-gcc configuration=0A= =0A= =0A= On 5/29/2015 4:11 PM, Chen, Jing D wrote:=0A= > From: "Chen Jing D(Mark)" =0A= >=0A= > After acquiring MAC address from HW, it's necessary to validate=0A= > MAC address before use.=0A= >=0A= > Signed-off-by: Chen Jing D(Mark) =0A= > ---=0A= > drivers/net/fm10k/fm10k_ethdev.c | 24 ++++++++++--------------=0A= > 1 files changed, 10 insertions(+), 14 deletions(-)=0A= >=0A= > diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_e= thdev.c=0A= > index dedfbb4..b6e82e3 100644=0A= > --- a/drivers/net/fm10k/fm10k_ethdev.c=0A= > +++ b/drivers/net/fm10k/fm10k_ethdev.c=0A= > @@ -1756,24 +1756,20 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)=0A= > }=0A= > =0A= > diag =3D fm10k_read_mac_addr(hw);=0A= > - if (diag !=3D FM10K_SUCCESS) {=0A= > - /*=0A= > - * TODO: remove special handling on VF. Need shared code to=0A= > - * fix first.=0A= > - */=0A= > - if (hw->mac.type =3D=3D fm10k_mac_pf) {=0A= > - PMD_INIT_LOG(ERR, "Read MAC addr failed: %d", diag);=0A= > - return -EIO;=0A= > - } else {=0A= > - /* Generate a random addr */=0A= > - eth_random_addr(hw->mac.addr);=0A= > - memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN);=0A= > - }=0A= > - }=0A= > =0A= > ether_addr_copy((const struct ether_addr *)hw->mac.addr,=0A= > &dev->data->mac_addrs[0]);=0A= > =0A= > + if (diag !=3D FM10K_SUCCESS ||=0A= > + !is_valid_assigned_ether_addr(dev->data->mac_addrs)) {=0A= > +=0A= > + /* Generate a random addr */=0A= > + eth_random_addr(hw->mac.addr);=0A= > + memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN);=0A= > + ether_addr_copy((const struct ether_addr *)hw->mac.addr,=0A= > + &dev->data->mac_addrs[0]);=0A= > + }=0A= > +=0A= > /* Reset the hw statistics */=0A= > fm10k_stats_reset(dev);=0A= > =0A= =0A=