From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) by dpdk.org (Postfix) with ESMTP id 9D9595598 for ; Tue, 20 Feb 2018 06:41:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1341; q=dns/txt; s=iport; t=1519105281; x=1520314881; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/jC5+l8PWjVQx8wrdP/KVsVc2xMtyApgPqrkQ+ffBaw=; b=LrmVDupzkD75SyX/Lqm05ZIGHE96wjJUn+vnXpLe7V7mX6fzGrhqYHMr nTIhM82kXcDu7ay/JWRKWPR3D1x3TnqQrZ5ucAYP4sCKE5W7gIwfXdTii 8fnI7puoh6/QGq/V5fSnOe9yj5oqaAwOdlP0x76g+dwCibjd2D0agHweQ w=; X-IronPort-AV: E=Sophos;i="5.46,537,1511827200"; d="scan'208";a="358123961" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2018 05:41:19 +0000 Received: from HYONKIM-FTCPE.cisco.com ([10.24.35.91]) by rcdn-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id w1K5fFV1011651 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Feb 2018 05:41:18 GMT Date: Tue, 20 Feb 2018 14:41:15 +0900 From: Hyong Youb Kim To: David Marchand Cc: dev@dpdk.org, johndale@cisco.com, neescoba@cisco.com Message-ID: <20180220054113.GA20756@HYONKIM-FTCPE.cisco.com> References: <20180219124227.19859-1-david.marchand@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180219124227.19859-1-david.marchand@6wind.com> User-Agent: Mutt/1.9.1 (2017-09-22) Subject: Re: [dpdk-dev] [PATCH] net/enic: add primary mac address handler 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: Tue, 20 Feb 2018 05:41:21 -0000 On Mon, Feb 19, 2018 at 01:42:27PM +0100, David Marchand wrote: > Reused the .mac_addr_add and .mac_addr_del callbacks code to implement > primary mac address handler. > > Signed-off-by: David Marchand Hi, thanks for taking a stab at this. > +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, > + struct ether_addr *addr) > +{ > + enicpmd_remove_mac_addr(eth_dev, 0); > + enicpmd_add_mac_addr(eth_dev, addr, 0, 0); > +} Unfortunately, this does not work as expected. The caller updates mac_addrs[0] prior to calling mac_addr_set. int rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *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); [...] So, enicpmd_remove_mac_addr tries to remove mac_addrs[0], which is the 'new' default address and does not exist on the NIC. Then, enicpmd_add_mac_addr adds the new address to the NIC. At the end, the NIC ends up with both the old and the new addresses. I think the driver would have to treat the 'default' mac address differently. I can submit a new patch as part of our next upstream patch set. Or you are welcome to spin a new version. Up to you. Thanks. -Hyong