From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E994D2EDA for ; Fri, 29 May 2015 20:21:45 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 29 May 2015 11:21:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,518,1427785200"; d="scan'208";a="702258004" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by orsmga001.jf.intel.com with ESMTP; 29 May 2015 11:21:43 -0700 Received: from fmsmsx107.amr.corp.intel.com (10.18.124.205) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 29 May 2015 11:21:42 -0700 Received: from FMSMSX110.amr.corp.intel.com ([169.254.14.46]) by fmsmsx107.amr.corp.intel.com ([169.254.6.159]) with mapi id 14.03.0224.002; Fri, 29 May 2015 11:21:42 -0700 From: "Wang, Liang-min" To: Stephen Hemminger Thread-Topic: [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address Thread-Index: AQHQmhGHFMqqXi1UFkquffrRBkufSZ2ThymA//+8QtA= Date: Fri, 29 May 2015 18:21:41 +0000 Message-ID: References: <1432905309-912-1-git-send-email-liang-min.wang@intel.com> <1432905309-912-2-git-send-email-liang-min.wang@intel.com> <20150529082021.16147bb5@urahara> In-Reply-To: <20150529082021.16147bb5@urahara> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" , "bruce.richardson@intle.com" Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2015 18:21:46 -0000 >On Fri, 29 May 2015 09:15:08 -0400 >Liang-Min Larry Wang wrote: > >> } > >=20 >> int >> +rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr=20 >> +*addr) { >> + struct rte_eth_dev *dev; >> + const int index =3D 0; >> + const uint32_t pool =3D 0; >> + >> + if (!rte_eth_dev_is_valid_port(port_id)) { >> + PMD_DEBUG_TRACE("Invalid port_id=3D%d\n", port_id); >> + return -ENODEV; >> + } >> + >> + dev =3D &rte_eth_devices[port_id]; >> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP); >> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); >> + >> + /* Update NIC default MAC address*/ >> + (*dev->dev_ops->mac_addr_remove)(dev, index); >> + (*dev->dev_ops->mac_addr_add)(dev, addr, index, pool); >> + >> + /* Update default address in NIC data structure */ >> + ether_addr_copy(addr, &dev->data->mac_addrs[index]); >> + >> + return 0; >> +} >> + > >No. this won't work. for some devices. > >Please use mac_addr_set hook added in recent DPDK I tested over ixgbe and igb, and both work. As for your concern, it's legit= . I will take your suggestion and make modification.