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 372FD6D45 for ; Mon, 11 Sep 2017 07:41:04 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 10 Sep 2017 22:41:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,376,1500966000"; d="scan'208";a="899004068" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 10 Sep 2017 22:41:03 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Sep 2017 22:41:03 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Sep 2017 22:41:03 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.168]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0319.002; Mon, 11 Sep 2017 13:41:01 +0800 From: "Xing, Beilei" To: David Harton , "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [PATCH] i40e: fix i40e_validate_mac_addr to permit multicast addresses Thread-Index: AQHTG5UUv8AEvhUNYUe7J14Ww0kCqqKvQ3fQ Date: Mon, 11 Sep 2017 05:41:00 +0000 Message-ID: <94479800C636CB44BD422CB454846E013201ADD6@SHSMSX101.ccr.corp.intel.com> References: <20170822222146.36912-1-dharton@cisco.com> In-Reply-To: <20170822222146.36912-1-dharton@cisco.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] 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 05:41:05 -0000 Hi, > -----Original Message----- > From: David Harton [mailto:dharton@cisco.com] > Sent: Wednesday, August 23, 2017 6:22 AM > To: Wu, Jingjing ; Xing, Beilei > Cc: dev@dpdk.org; David Harton > Subject: [PATCH] i40e: fix i40e_validate_mac_addr to permit multicast > addresses >=20 > The i40e maintains a single MAC filter table for both unicast and multica= st > 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. > 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(-) >=20 > 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 { >=20 >=20 > /** > - * 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) >=20 > DEBUGFUNC("i40e_validate_mac_addr"); >=20 > - /* 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 ab= out 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) { Then following modification in eth_i40e_dev_init function can be removed. B= ut we should also pay attention to other functions which call i40evf_add_mac_addr. Beilei > return status; > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.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) >=20 > /* 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