From patchwork Tue Aug 22 22:21:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Harton X-Patchwork-Id: 27728 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id CC2FE3257; Wed, 23 Aug 2017 00:22:00 +0200 (CEST) Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by dpdk.org (Postfix) with ESMTP id 4518E2C15 for ; Wed, 23 Aug 2017 00:21:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2407; q=dns/txt; s=iport; t=1503440519; x=1504650119; h=from:to:cc:subject:date:message-id; bh=9hrAQIssElMW4YEpfRZIRZoSd+seY1M2KnRalsn+mJs=; b=ch/1j8l1WdI06haBpU9TZk+yQ0q93/j5X40l6FMdfp0+sSHLTgdn52Es zZZhrsLTAI7xh6szw8f8yUn/fv4OHyle1xOsjOtXrYuPf8a50Yr1Wh4TV dtILLLNjNAcp2kqYXxJNwC2CP5g86RmJNC0pNZtzIiOGWN9frDi7hKs96 w=; X-IronPort-AV: E=Sophos;i="5.41,414,1498521600"; d="scan'208";a="473327697" Received: from alln-core-2.cisco.com ([173.36.13.135]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Aug 2017 22:21:58 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id v7MMLwbP027546; Tue, 22 Aug 2017 22:21:58 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id E03CE5AB; Tue, 22 Aug 2017 18:21:57 -0400 (EDT) From: David Harton To: jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, David Harton Date: Tue, 22 Aug 2017 18:21:46 -0400 Message-Id: <20170822222146.36912-1-dharton@cisco.com> X-Mailer: git-send-email 2.10.3.dirty Subject: [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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. 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[] = { /** - * 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] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 && - mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)) + if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 && + mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0) status = I40E_ERR_INVALID_MAC_ADDR; 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) != I40E_SUCCESS) { + if (i40e_validate_mac_addr(hw->mac.addr) != I40E_SUCCESS || + I40E_IS_MULTICAST(hw->mac.addr)) { PMD_INIT_LOG(ERR, "mac address is not valid"); ret = -EIO; goto err_get_mac_addr;