From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-2.cisco.com (alln-iport-2.cisco.com [173.37.142.89]) by dpdk.org (Postfix) with ESMTP id B800C2B84 for ; Mon, 11 Sep 2017 19:22:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3910; q=dns/txt; s=iport; t=1505150553; x=1506360153; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0TWXqW9i3RGXTa+gx7pn2WVQkum/h/uBieTuWz1IBdc=; b=JLTO+NfJwo1GBvNtYTEtJYkb08Dc8QOZnIzPqJwbDKMt7ysn8HR9XTjR QKC17XRXx6rj5UUKBERkszevGB27b2ZqYcApzB0Ktpdi/KPtxfPsB/r+q kkh40Gsm+TE96fiHL/jeR1AMDxuVLebldM2v4nCnG5l5FzhgUHSzYFDzp o=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CLAgD6xbZZ/5pdJa1cGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBg1uBUicHnjKBdJFDhHSCBAqFPgKEIlcBAgEBAQEBAmsohRgBAQEDASc?= =?us-ascii?q?TPwwEAgEIFSEJBzIUEQIEDgUIiiEIrUY6iysBAQEBAQEBAQEBAQEBAQEBAQEBA?= =?us-ascii?q?QEdgyuCAoFQhQuEX4YMBYc8mTgCjwqFPIIchWeKd0iUNgIRGQGBOAFXgQ13FYV?= =?us-ascii?q?iHIFndocAK4EFgQ8BAQE?= X-IronPort-AV: E=Sophos;i="5.42,379,1500940800"; d="scan'208";a="1914815" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by alln-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2017 17:22:31 +0000 Received: from XCH-ALN-020.cisco.com (xch-aln-020.cisco.com [173.36.7.30]) by rcdn-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id v8BHMVUt011885 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 11 Sep 2017 17:22:31 GMT Received: from xch-rcd-016.cisco.com (173.37.102.26) by XCH-ALN-020.cisco.com (173.36.7.30) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 11 Sep 2017 12:22:31 -0500 Received: from xch-rcd-016.cisco.com ([173.37.102.26]) by XCH-RCD-016.cisco.com ([173.37.102.26]) with mapi id 15.00.1263.000; Mon, 11 Sep 2017 12:22:31 -0500 From: "David Harton (dharton)" To: "Xing, Beilei" , "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [PATCH] i40e: fix i40e_validate_mac_addr to permit multicast addresses Thread-Index: AQHTG5US61d7SHDr6Eam8uZMLsGejaKvncAAgABsbgA= Date: Mon, 11 Sep 2017 17:22:30 +0000 Message-ID: References: <20170822222146.36912-1-dharton@cisco.com> <94479800C636CB44BD422CB454846E013201ADD6@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <94479800C636CB44BD422CB454846E013201ADD6@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.82.174.31] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] i40e: fix i40e_validate_mac_addr to permit multicast addresses 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: Mon, 11 Sep 2017 17:22:34 -0000 Hi Beilei, > -----Original Message----- > From: Xing, Beilei [mailto:beilei.xing@intel.com] >=20 > Hi, >=20 > > -----Original Message----- > > From: David Harton [mailto:dharton@cisco.com] > > > > The i40e maintains a single MAC filter table for both unicast and > > multicast addresses. The i40e_validate_mac_addr function was > > preventing multicast addresses from being added to the table via > > i40evf_add_mac_addr. Fixed the issue by removing the multicast > > address check in i40e_validate_mac_addr. > > >=20 > Maybe fix line is needed here. Please elaborate. If feel this is a regression and you want=20 me to add a fixline can you offer the offending commit? >=20 > > Signed-off-by: David Harton > > --- > > drivers/net/i40e/base/i40e_common.c | 12 +++++------- > > drivers/net/i40e/i40e_ethdev.c | 3 ++- > > 2 files changed, 7 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/net/i40e/base/i40e_common.c > > b/drivers/net/i40e/base/i40e_common.c > > index 900d379..9779854 100644 > > --- a/drivers/net/i40e/base/i40e_common.c > > +++ b/drivers/net/i40e/base/i40e_common.c > > @@ -969,10 +969,10 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] > > =3D { > > > > > > /** > > - * i40e_validate_mac_addr - Validate unicast MAC address > > + * i40e_validate_mac_addr - Validate MAC address > > * @mac_addr: pointer to MAC address > > * > > - * Tests a MAC address to ensure it is a valid Individual Address > > + * Tests a MAC address to ensure it is a valid Address > > **/ > > enum i40e_status_code i40e_validate_mac_addr(u8 *mac_addr) { @@ - > > 980,13 +980,11 @@ enum i40e_status_code i40e_validate_mac_addr(u8 > > *mac_addr) > > > > DEBUGFUNC("i40e_validate_mac_addr"); > > > > - /* Broadcast addresses ARE multicast addresses > > - * Make sure it is not a multicast address > > + /* > > * Reject the zero address > > */ > > - if (I40E_IS_MULTICAST(mac_addr) || > > - (mac_addr[0] =3D=3D 0 && mac_addr[1] =3D=3D 0 && mac_addr[2] =3D= =3D 0 && > > - mac_addr[3] =3D=3D 0 && mac_addr[4] =3D=3D 0 && mac_addr[5] =3D= =3D 0)) > > + if (mac_addr[0] =3D=3D 0 && mac_addr[1] =3D=3D 0 && mac_addr[2] =3D= =3D 0 && > > + mac_addr[3] =3D=3D 0 && mac_addr[4] =3D=3D 0 && mac_addr[5] =3D= =3D 0) > > status =3D I40E_ERR_INVALID_MAC_ADDR; > > >=20 > We'd better not to change the base code which is from kernel driver. How > about changing the i40evf_add_mac_addr function as following: > - if (i40e_validate_mac_addr(addr->addr_bytes) !=3D I40E_SUCCESS) { > + if (is_zero_ether_addr (addr->addr_bytes) !=3D I40E_SUCCESS) { >=20 > Then following modification in eth_i40e_dev_init function can be removed. > But we should also pay attention to other functions which call > i40evf_add_mac_addr. Sure. I'll post a new patch as suggested once the fixline question is answ= ered. =20 I was trying to fix the issue the way I did in case i40e passthru=20 wanted to benefit. Your suggestion will work for the VF as the only=20 other caller for i40evf_add_mac_addr() performs its own macaddr validation. Thanks, Dave >=20 > Beilei >=20 > > return status; > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 5f26e24..00b6082 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -1199,7 +1199,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) > > > > /* Get and check the mac address */ > > i40e_get_mac_addr(hw, hw->mac.addr); > > - if (i40e_validate_mac_addr(hw->mac.addr) !=3D I40E_SUCCESS) { > > + if (i40e_validate_mac_addr(hw->mac.addr) !=3D I40E_SUCCESS || > > + I40E_IS_MULTICAST(hw->mac.addr)) { > > PMD_INIT_LOG(ERR, "mac address is not valid"); > > ret =3D -EIO; > > goto err_get_mac_addr; > > -- > > 2.10.3.dirty