From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4AE4756A2 for ; Fri, 18 Mar 2016 03:14:18 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 17 Mar 2016 19:14:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,352,1455004800"; d="scan'208";a="671620996" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 17 Mar 2016 19:14:16 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Mar 2016 19:14:15 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.132]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.24]) with mapi id 14.03.0248.002; Fri, 18 Mar 2016 10:14:03 +0800 From: "Zhang, Helin" To: Sergey Balabanov , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create Thread-Index: AQHQ4ZJzQgVsaiiD40CSlprdQ8XX559fs/Gw Date: Fri, 18 Mar 2016 02:14:02 +0000 Message-ID: References: <1440767187-19120-1-git-send-email-balabanovsv@ecotelecom.ru> In-Reply-To: <1440767187-19120-1-git-send-email-balabanovsv@ecotelecom.ru> 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: set kni mac on ioctl_create 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, 18 Mar 2016 02:14:18 -0000 Hi Sergey > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergey Balabanov > Sent: Friday, August 28, 2015 9:06 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create >=20 > There is a situation when ioctl returns zero mac address (00:00:00:00:00:= 00) > for just created kni. The situation happens because kni mac is set on 'ip= config > up' event (kni_net_open callback) not on kni creation (kni_ioctl_create). Could you help to clarify a bit of the real issue? What's wrong there? >=20 > Signed-off-by: Sergey Balabanov > --- > lib/librte_eal/linuxapp/kni/kni_misc.c | 10 ++++++++++ > lib/librte_eal/linuxapp/kni/kni_net.c | 9 --------- > 2 files changed, 10 insertions(+), 9 deletions(-) >=20 > diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c > b/lib/librte_eal/linuxapp/kni/kni_misc.c > index 2e9fa89..61f83a0 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include /* eth_type_trans */ >=20 > #include > #include "kni_dev.h" > @@ -465,6 +466,15 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned > long ioctl_param) > if (pci) > pci_dev_put(pci); >=20 > + if (kni->lad_dev) > + memcpy(net_dev->dev_addr, kni->lad_dev->dev_addr, > ETH_ALEN); > + else > + /* > + * Generate random mac address. eth_random_addr() is the > newer > + * version of generating mac address in linux kernel. > + */ > + random_ether_addr(net_dev->dev_addr); > + A rebase is needed, as a lot of changes after that. Thanks! Helin > ret =3D register_netdev(net_dev); > if (ret) { > KNI_ERR("error %i registering device \"%s\"\n", diff --git > a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni= _net.c > index ab5add4..b50b4cf 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_net.c > +++ b/lib/librte_eal/linuxapp/kni/kni_net.c > @@ -70,15 +70,6 @@ kni_net_open(struct net_device *dev) > struct rte_kni_request req; > struct kni_dev *kni =3D netdev_priv(dev); >=20 > - if (kni->lad_dev) > - memcpy(dev->dev_addr, kni->lad_dev->dev_addr, > ETH_ALEN); > - else > - /* > - * Generate random mac address. eth_random_addr() is the > newer > - * version of generating mac address in linux kernel. > - */ > - random_ether_addr(dev->dev_addr); > - > netif_start_queue(dev); >=20 > memset(&req, 0, sizeof(req)); > -- > 2.1.4