DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Helin" <helin.zhang@intel.com>
To: Sergey Balabanov <balabanovsv@ecotelecom.ru>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
Date: Fri, 18 Mar 2016 02:14:02 +0000	[thread overview]
Message-ID: <F35DEAC7BCE34641BA9FAC6BCA4A12E70A9CC9D0@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1440767187-19120-1-git-send-email-balabanovsv@ecotelecom.ru>

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
> 
> 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).
Could you help to clarify a bit of the real issue? What's wrong there?

> 
> Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
> ---
>  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 <linux/pci.h>
>  #include <linux/kthread.h>
>  #include <linux/rwsem.h>
> +#include <linux/etherdevice.h> /* eth_type_trans */
> 
>  #include <exec-env/rte_kni_common.h>
>  #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);
> +
A rebase is needed, as a lot of changes after that. Thanks!

Helin
>  	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));
> --
> 2.1.4

  parent reply	other threads:[~2016-03-18  2:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 13:06 Sergey Balabanov
2015-08-28 13:08 ` Sergey Balabanov
2016-03-17 15:06   ` Thomas Monjalon
2016-03-18  2:14 ` Zhang, Helin [this message]
2016-04-21 15:16   ` Igor Ryzhov
2016-04-22  1:57     ` Zhang, Helin
2016-04-22  5:58       ` Igor Ryzhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F35DEAC7BCE34641BA9FAC6BCA4A12E70A9CC9D0@SHSMSX104.ccr.corp.intel.com \
    --to=helin.zhang@intel.com \
    --cc=balabanovsv@ecotelecom.ru \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).