From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id BC55E30E for ; Thu, 3 Jul 2014 08:26:02 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 02 Jul 2014 23:26:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,593,1400050800"; d="scan'208";a="564550619" Received: from fmsmsx108.amr.corp.intel.com ([10.19.9.228]) by fmsmga002.fm.intel.com with ESMTP; 02 Jul 2014 23:26:14 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX108.amr.corp.intel.com (10.19.9.228) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 2 Jul 2014 23:26:12 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.122]) by shsmsx102.ccr.corp.intel.com ([169.254.2.21]) with mapi id 14.03.0123.003; Thu, 3 Jul 2014 14:26:10 +0800 From: "Zhang, Helin" To: Padam Jeet Singh , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: allow setting KNI device MAC address Thread-Index: AQHPlTcDVybmbNrwyEycaeL/ZDX4/puN5Ldw Date: Thu, 3 Jul 2014 06:26:09 +0000 Message-ID: References: <1404224052-9706-1-git-send-email-padam.singh@inventum.net> In-Reply-To: <1404224052-9706-1-git-send-email-padam.singh@inventum.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] kni: allow setting KNI device 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: Thu, 03 Jul 2014 06:26:03 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Padam Jeet Singh > Sent: Tuesday, July 1, 2014 10:14 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] kni: allow setting KNI device MAC address >=20 > Added relevant callback function to change a KNI device's MAC address >=20 > Signed-off-by: Padam Jeet Singh > --- > lib/librte_eal/linuxapp/kni/kni_net.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c > b/lib/librte_eal/linuxapp/kni/kni_net.c > index d3c0190..15e81c1 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_net.c > +++ b/lib/librte_eal/linuxapp/kni/kni_net.c > @@ -612,6 +612,21 @@ kni_net_rebuild_header(struct sk_buff *skb) > return 0; > } >=20 > +/** > + * kni_net_set_mac - Change the Ethernet Address of the KNI NIC > + * @netdev: network interface device structure > + * @p: pointer to an address structure > + * > + * Returns 0 on success, negative on failure **/ static int > +kni_net_set_mac(struct net_device *netdev, void *p) { > + struct sockaddr *addr =3D p; > + if (!is_valid_ether_addr((unsigned char *)(addr->sa_data))) > + return -EADDRNOTAVAIL; > + memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); > + return 0; > +} >=20 > static const struct header_ops kni_net_header_ops =3D { > .create =3D kni_net_header, > @@ -628,6 +643,7 @@ static const struct net_device_ops > kni_net_netdev_ops =3D { > .ndo_do_ioctl =3D kni_net_ioctl, > .ndo_get_stats =3D kni_net_stats, > .ndo_tx_timeout =3D kni_net_tx_timeout, > + .ndo_set_mac_address =3D kni_net_set_mac, > }; >=20 > void > -- > 1.8.5.2 (Apple Git-48) Reviewed-by: Helin Zhang