From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 7AA9A2BD0 for ; Thu, 17 Mar 2016 16:08:12 +0100 (CET) Received: by mail-wm0-f42.google.com with SMTP id p65so121716267wmp.0 for ; Thu, 17 Mar 2016 08:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=83pMzXcnZOlcjVrB7abZ1+5Xaejj4LrIY8ngEmhe1wQ=; b=sjY6D6TmdyLTUB9FjP5QsqjgEmaVJTZDVOFPvU8VBRsTO82eJjm3dQpnXQGETtYmsZ rKlsW8PrENzKy8KeBKAwNz12YIfybGorZNErSlrr8kKhXjGNQxDNl9O+IacucNBrHwlH CPRS/QIbwJnyKPrKnxfD1En9hgYvs9uAlJYlSqmBgTwigDNQnLBULadKdfplvSuv0V5l C3fERzuY8BIvg1mVcpmo3KnBIwxErOwhUA4zAGiXB22353boCTo0L+Di/EjUSyNNc7Me UuDl1XBW8ysXEdfYco5gF+WLla1En04C7W2Wu7fV3bCZsuECLHS6xvtsjR87FieoSWOi nevg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=83pMzXcnZOlcjVrB7abZ1+5Xaejj4LrIY8ngEmhe1wQ=; b=LnPmC+6BtO9YZ6/lk23Pq9tp7co8GG5dq67riUe6m91PkPq7RGfDbiopvErFnk8zqZ p/Rk3ilVg4oGFEldIgpSKHHxCuVX5SbHEgzM5tC1GeAIVyUkFM/+9/5KF/hfxdoI4Rls 58LaNswMoSLOp62VQPmIaL5Ek9zWsv1fjxF6rT2/HBAnnX4ppI62Br3knDCwIe3mOliz mmCadyobJPai3CCWE1CzBcDYtv4FOLHesqOWxz1pxq/sUGNT45qaga38cdII5ptD8zqm Mdisip6Nb84fj4S6PmeZMl+yl56ffoBTPJ7cWYA+e6ZMqQdPVx+XdifOAGKJCyI0fnRG v3mA== X-Gm-Message-State: AD7BkJJdzrVrK0Ii6aRv0EX+Ps6517cxVFkV4dLHrl4f53PhtRUj0YH2NOdTNt/zqD7rSqQu X-Received: by 10.28.48.136 with SMTP id w130mr37881906wmw.54.1458227292349; Thu, 17 Mar 2016 08:08:12 -0700 (PDT) Received: from xps13.localnet (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id ka7sm8118220wjb.8.2016.03.17.08.08.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2016 08:08:10 -0700 (PDT) From: Thomas Monjalon To: Helin Zhang Cc: dev@dpdk.org, Sergey Balabanov Date: Thu, 17 Mar 2016 16:06:41 +0100 Message-ID: <1937236.JoGhlxSSgr@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <3010257.KLf28YlHHW@stand> References: <1440767187-19120-1-git-send-email-balabanovsv@ecotelecom.ru> <3010257.KLf28YlHHW@stand> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Thu, 17 Mar 2016 15:08:12 -0000 Helin, You have probably missed this (old) patch / bug report. 2015-08-28 16:08, Sergey Balabanov: > Hi, > > Probably I missed something in understanding why the mac is not set on kni > creation. Any comments would be highly appreciated. > > Thanks, > Sergey > > On Friday 28 August 2015 16:06:27 Sergey Balabanov wrote: > > 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 > > 'ipconfig up' event (kni_net_open callback) not on kni creation > > (kni_ioctl_create). > > > > 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(-) > > > > 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 */ > > > > #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); > > > > + 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); > > + > > ret = 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 = netdev_priv(dev); > > > > - 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); > > > > memset(&req, 0, sizeof(req));