From patchwork Thu Dec 14 17:15:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 32284 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 [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D49DE2BCE; Thu, 14 Dec 2017 18:15:51 +0100 (CET) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 2C4B9107A; Thu, 14 Dec 2017 18:15:51 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id C23D0114823; Thu, 14 Dec 2017 18:07:25 +0100 (CET) From: Olivier Matz To: dev@dpdk.org, Thomas Monjalon Cc: Laurent Hardy , stable@dpdk.org Date: Thu, 14 Dec 2017 18:15:31 +0100 Message-Id: <20171214171531.10506-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] ethdev: fix setting of MAC address 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" From: Laurent Hardy When a new mac address is set, it is saved in dev->data->mac_addrs before the ethdev handler is called. First, it is inconsistent with the other ethdev functions rte_eth_dev_mac_addr_remove() and rte_eth_dev_mac_addr_add(). Moreover, it prevents the drivers from wrongly comparing the old address and the new one, like it's done in i40evf driver: if (is_same_ether_addr(mac_addr, dev->data->mac_addrs)) return; Fixes: 943c2d899a0c ("net/i40e: set VF MAC from VF") Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier") Cc: stable@dpdk.org Signed-off-by: Laurent Hardy --- lib/librte_ether/rte_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 4f492e3db..297c02a54 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2643,11 +2643,11 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP); + (*dev->dev_ops->mac_addr_set)(dev, addr); + /* Update default address in NIC data structure */ ether_addr_copy(addr, &dev->data->mac_addrs[0]); - (*dev->dev_ops->mac_addr_set)(dev, addr); - return 0; }