From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by dpdk.org (Postfix) with ESMTP id 4C7732C72 for ; Thu, 21 Apr 2016 18:15:19 +0200 (CEST) Received: by mail-lf0-f54.google.com with SMTP id g184so63776190lfb.3 for ; Thu, 21 Apr 2016 09:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=kTtuEh/j3BWOLDVFdINKURa4q1NN2zB+5hPWUIHe+18=; b=yjhB2i96z+z9tdRJkpocUHcpL+OH0Nx5MaHRGDjMzAWTaYK+BSg/GDe7EcH0RFYjth PtOvcUkQC0MuhSkJv/ddVh+KD3yW3czaPsc+37v5oQmJn/5RKOzqagZkgn8KW0KAh0K3 tF1uU4qiHk0cgwdqOHlWFwn+iAMYUsnEMuPjaMWsW5qHBb87rnmZH/ShpC7wBaB/Kicw GQUhtiI3uZScWHA6eIFoDBDbznjKF9uOXb6gWK96X2GrByxX2M/vNcz1pl2dG+OzU99u C4teayTCUeIgB3BARzNo1uznszx1X7Ltxdq3luAYffYQHeorUZCV2+JDVE0/4p3QRhl5 T61A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=kTtuEh/j3BWOLDVFdINKURa4q1NN2zB+5hPWUIHe+18=; b=CuoEtygUXnW7ezx1ol1k0rV11Swue76R4zUP3aQEQvtUKz6WQ2ckE2XGTMfjk4BhOg h2wyXDsLhoqM8Rt3IvifCpzuunsGVhgd30M2UEV2N5xxCEvo6geOpfJ1ZbmkUI8k7P3s 4Hrd8nuQDnwis+johk0tE6AHU0pYxQT7Ahjz/9AV49iJ5zDKOCwM9h6QYb9E2ssmsnEu NtH3Mx/Z/bcd54cvhIDWpHkLVj3rJbK7eH6ZMN4QwlAxgHgnTHIJYrMKVxBd4tp5pboK 7jlyNW2hUjcs/IwbtTFqsDhcm7Alk8XK7Y+K7rmdK/8hdvaDambTmLyGNZ5pYlygraDE P+tg== X-Gm-Message-State: AOPr4FVOfmGK42l/gCiNbz+ReqFELqUB0wYHDo9mwl51nQQBJ6F5v2+sIOdaWzweb9De3Q== X-Received: by 10.25.39.210 with SMTP id n201mr5728027lfn.121.1461255318826; Thu, 21 Apr 2016 09:15:18 -0700 (PDT) Received: from mbp-igor.arccn.local (vpn.arccn.ru. [95.182.74.2]) by smtp.gmail.com with ESMTPSA id c191sm686141lfb.29.2016.04.21.09.15.17 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Apr 2016 09:15:18 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Igor Ryzhov In-Reply-To: <1461251576-46028-1-git-send-email-iryzhov@nfware.com> Date: Thu, 21 Apr 2016 19:15:16 +0300 Cc: dev@dpdk.org Content-Transfer-Encoding: quoted-printable Message-Id: <57B2F7F9-FA3C-4B4B-B146-C6DF86255245@nfware.com> References: <1461251576-46028-1-git-send-email-iryzhov@nfware.com> To: Igor Ryzhov X-Mailer: Apple Mail (2.3124) Subject: Re: [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up 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, 21 Apr 2016 16:15:19 -0000 Self nack. Forgot to change variable name from dev to net_dev. Will send = v2. > 21 =D0=B0=D0=BF=D1=80. 2016 =D0=B3., =D0=B2 18:12, Igor Ryzhov = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): >=20 > Now every time a KNI interface goes up, its ethernet address is = overwritten. > After this patch ethernet address is assigned only once, at = initialization > time. >=20 > Suggested-by: Sergey Balabanov > Signed-off-by: Igor Ryzhov > --- > 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 ae8133f..45bcf32 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -542,6 +543,15 @@ kni_ioctl_create(struct net *net, > if (pci) > pci_dev_put(pci); >=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); > + > 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 cfa8339..3d2d246 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_net.c > +++ b/lib/librte_eal/linuxapp/kni/kni_net.c > @@ -69,15 +69,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)); > --=20 > 2.6.4 >=20