From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by dpdk.org (Postfix) with ESMTP id 19EF6100F for ; Fri, 20 Jan 2017 23:24:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2146; q=dns/txt; s=iport; t=1484951060; x=1486160660; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=HAlfmxE9KEzHeBpiQTi6krQHlOSZxSGqxl5yFZzitMU=; b=fYL9FGkggyI4afu2hTDBSYtHSujqYKDL2ak4JSA8wh2+qHLGy6+/ru6T WTDGUAcxpRbreWBAkQiNZXt8sYw4P9l6/iBpbvX4/ZoRoL9dE/A6pyg9o in7AsMrBHbVmanjMrzYPIAIG8gLhaP5FA6xy3VonThauS1jhbD7LKFtOi I=; X-IronPort-AV: E=Sophos;i="5.33,260,1477958400"; d="scan'208";a="196003593" Received: from alln-core-2.cisco.com ([173.36.13.135]) by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Jan 2017 22:24:18 +0000 Received: from sjc-ads-512.cisco.com (sjc-ads-512.cisco.com [10.28.13.212]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id v0KMOICZ012123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Jan 2017 22:24:18 GMT Received: from sjc-ads-512.cisco.com (localhost.localdomain [127.0.0.1]) by sjc-ads-512.cisco.com (8.13.8/8.13.8) with ESMTP id v0KMOHsv015082; Fri, 20 Jan 2017 14:24:17 -0800 Received: (from jonshin@localhost) by sjc-ads-512.cisco.com (8.13.8/8.13.8/Submit) id v0KMOHjE015081; Fri, 20 Jan 2017 14:24:17 -0800 From: Steve Shin To: dev@dpdk.org Cc: ferruh.yigit@intel.com, iryzhov@nfware.com, Steve Shin Date: Fri, 20 Jan 2017 14:23:49 -0800 Message-Id: <20170120222349.14567-1-jonshin@cisco.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170119184721.22348-1-jonshin@cisco.com> References: <20170119184721.22348-1-jonshin@cisco.com> Subject: [dpdk-dev] [PATCH v2] ethdev: fix MAC address replay 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: Fri, 20 Jan 2017 22:24:20 -0000 This patch fixes a bug in replaying MAC address to the hardware in rte_eth_dev_config_restore() routine. Added default MAC replay as well. Fixes: 4bdefaade6d1 ("ethdev: VMDQ enhancements") --- v2: Added default MAC replay & Code optimization Signed-off-by: Steve Shin --- lib/librte_ether/rte_ethdev.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 4790faf..150f350 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -931,7 +931,7 @@ rte_eth_dev_config_restore(uint8_t port_id) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; - struct ether_addr addr; + struct ether_addr *addr; uint16_t i; uint32_t pool = 0; @@ -942,23 +942,23 @@ rte_eth_dev_config_restore(uint8_t port_id) if (RTE_ETH_DEV_SRIOV(dev).active) pool = RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx; - /* replay MAC address configuration */ - for (i = 0; i < dev_info.max_mac_addrs; i++) { - addr = dev->data->mac_addrs[i]; + /* replay MAC address configuration including default MAC */ + if (*dev->dev_ops->mac_addr_set != NULL) { + addr = &dev->data->mac_addrs[0]; + (*dev->dev_ops->mac_addr_set)(dev, addr); + } - /* skip zero address */ - if (is_zero_ether_addr(&addr)) - continue; + if (*dev->dev_ops->mac_addr_add != NULL) { + for (i = 1; i < dev_info.max_mac_addrs; i++) { + addr = &dev->data->mac_addrs[i]; - /* add address to the hardware */ - if (*dev->dev_ops->mac_addr_add && - (dev->data->mac_pool_sel[i] & (1ULL << pool))) - (*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool); - else { - RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n", - port_id); - /* exit the loop but not return an error */ - break; + /* skip zero address */ + if (is_zero_ether_addr(addr)) + continue; + + /* add address to the hardware */ + if (dev->data->mac_pool_sel[i] & (1ULL << pool)) + (*dev->dev_ops->mac_addr_add)(dev, addr, i, pool); } } -- 2.9.3