From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 56B109AD8 for ; Tue, 2 Jun 2015 14:24:18 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 02 Jun 2015 05:23:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,539,1427785200"; d="scan'208";a="703897252" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2015 05:23:53 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 2 Jun 2015 05:23:52 -0700 Received: from FMSMSX110.amr.corp.intel.com ([169.254.14.46]) by fmsmsx111.amr.corp.intel.com ([169.254.12.13]) with mapi id 14.03.0224.002; Tue, 2 Jun 2015 05:23:52 -0700 From: "Wang, Liang-min" To: "Ananyev, Konstantin" , "dev@dpdk.org" Thread-Topic: [PATCH 1/2] ethdev: add api to set default mac address Thread-Index: AQHQmkVyPbWTzZzMFkK+j70RQx9Qf52ZhTwA//+il7A= Date: Tue, 2 Jun 2015 12:23:51 +0000 Message-ID: References: <1432927612-12244-1-git-send-email-liang-min.wang@intel.com> <1432927612-12244-2-git-send-email-liang-min.wang@intel.com> <2601191342CEEE43887BDE71AB977258214345AB@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258214345AB@irsmsx105.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Tue, 02 Jun 2015 12:24:19 -0000 >> -----Original Message----- >> From: Wang, Liang-min >> Sent: Friday, May 29, 2015 8:27 PM >> To: dev@dpdk.org >> Cc: Richardson, Bruce; Ananyev, Konstantin; dharton@cisco.com;=20 > >agh@cisco.com; Wang, Liang-min >> Subject: [PATCH 1/2] ethdev: add api to set default mac address > > >> add a new api: rte_eth_dev_default_mac_addr_set to support changing=20 >> default mac address of a NIC > > > >Signed-off-by: Liang-Min Larry Wang >> --- > > lib/librte_ether/rte_ethdev.c | 16 ++++++++++++++++ > > lib/librte_ether/rte_ethdev.h | 14 ++++++++++++++ >> lib/librte_ether/rte_ether_version.map | 1 + >> 3 files changed, 31 insertions(+) >> >> diff --git a/lib/librte_ether/rte_ethdev.c=20 >> b/lib/librte_ether/rte_ethdev.c index 024fe8b..96ee00e 100644 >> --- a/lib/librte_ether/rte_ethdev.c >> +++ b/lib/librte_ether/rte_ethdev.c >> @@ -2752,6 +2752,22 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id,=20 >> struct ether_addr *addr) } >>=20 >> int >> +rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr=20 >> +*addr) { >> + struct rte_eth_dev *dev; >> + >> + 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_set, -ENOTSUP); >> + >> + return (*dev->dev_ops->mac_addr_set)(dev, addr); } >As I can see mac_addr_set() is implemented now only for virtio. >Which means that for all Intel HW your new rte_eth_dev_default_mac_addr_se= t() >would not work right now? >Probably rte_eth_dev_default_mac_addr_set() should combine both approaches= : >If mac_addr_set() is implemented by dev, then use it, otherwise try to use= addr_remove()/addr_add() (as your first version did)? >Konstantin =20 The implementation of mac_addr_set() through mac_addr_remove() and mac_addr= _add() is very creative, but it may not work for devices other than igb/ixg= be. I will release a patch latter to add hooks on igb and ixgbe(). Just wan= t to keep this interface clean and not to be confined to igb/ixgbe characte= ristics. > + > +int > rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, > uint16_t rx_mode, uint8_t on) > { > diff --git a/lib/librte_ether/rte_ethdev.h=20 > b/lib/librte_ether/rte_ethdev.h index 16dbe00..5f07e0d 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -2982,6 +2982,20 @@ int rte_eth_dev_mac_addr_add(uint8_t port,=20 > struct ether_addr *mac_addr, int rte_eth_dev_mac_addr_remove(uint8_t=20 > port, struct ether_addr *mac_addr); >=20 > /** > + * Set the default MAC address. > + * > + * @param port > + * The port identifier of the Ethernet device. > + * @param mac_addr > + * New default MAC address. > + * @return > + * - (0) if successful, or *mac_addr* didn't exist. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port* invalid. > + */ > +int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr=20 > +*mac_addr); > + > +/** > * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet de= vice. > * > * @param port > diff --git a/lib/librte_ether/rte_ether_version.map=20 > b/lib/librte_ether/rte_ether_version.map > index a2d25a6..2dbbaa7 100644 > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -102,6 +102,7 @@ DPDK_2.0 { > rte_eth_tx_queue_setup; > rte_eth_xstats_get; > rte_eth_xstats_reset; > + rte_eth_dev_default_mac_addr_set; >=20 > local: *; > }; > -- > 2.1.4