DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
@ 2015-08-28 13:06 Sergey Balabanov
  2015-08-28 13:08 ` Sergey Balabanov
  2016-03-18  2:14 ` Zhang, Helin
  0 siblings, 2 replies; 7+ messages in thread
From: Sergey Balabanov @ 2015-08-28 13:06 UTC (permalink / raw)
  To: dev

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 <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);
+
 	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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2015-08-28 13:06 [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create Sergey Balabanov
@ 2015-08-28 13:08 ` Sergey Balabanov
  2016-03-17 15:06   ` Thomas Monjalon
  2016-03-18  2:14 ` Zhang, Helin
  1 sibling, 1 reply; 7+ messages in thread
From: Sergey Balabanov @ 2015-08-28 13:08 UTC (permalink / raw)
  To: dev

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 <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);
> +
>  	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));

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2015-08-28 13:08 ` Sergey Balabanov
@ 2016-03-17 15:06   ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2016-03-17 15:06 UTC (permalink / raw)
  To: Helin Zhang; +Cc: dev, Sergey Balabanov

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 <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);
> > +
> >  	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));

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2015-08-28 13:06 [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create Sergey Balabanov
  2015-08-28 13:08 ` Sergey Balabanov
@ 2016-03-18  2:14 ` Zhang, Helin
  2016-04-21 15:16   ` Igor Ryzhov
  1 sibling, 1 reply; 7+ messages in thread
From: Zhang, Helin @ 2016-03-18  2:14 UTC (permalink / raw)
  To: Sergey Balabanov, dev

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2016-03-18  2:14 ` Zhang, Helin
@ 2016-04-21 15:16   ` Igor Ryzhov
  2016-04-22  1:57     ` Zhang, Helin
  0 siblings, 1 reply; 7+ messages in thread
From: Igor Ryzhov @ 2016-04-21 15:16 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: Sergey Balabanov, dev

Hello.

I rebased a patch and added Suggested-by string.
Check it, please: http://dpdk.org/dev/patchwork/patch/12188/ <http://dpdk.org/dev/patchwork/patch/12188/>.

Best regards,
Igor

> 18 марта 2016 г., в 5:14, Zhang, Helin <helin.zhang@intel.com> написал(а):
> 
> Hi Sergey
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org <mailto:dev-bounces@dpdk.org>] On Behalf Of Sergey Balabanov
>> Sent: Friday, August 28, 2015 9:06 PM
>> To: dev@dpdk.org <mailto: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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2016-04-21 15:16   ` Igor Ryzhov
@ 2016-04-22  1:57     ` Zhang, Helin
  2016-04-22  5:58       ` Igor Ryzhov
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang, Helin @ 2016-04-22  1:57 UTC (permalink / raw)
  To: Igor Ryzhov; +Cc: Sergey Balabanov, dev



From: Igor Ryzhov [mailto:iryzhov@nfware.com] 
Sent: Thursday, April 21, 2016 11:16 PM
To: Zhang, Helin
Cc: Sergey Balabanov; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create

Hello.

I rebased a patch and added Suggested-by string.
Check it, please: http://dpdk.org/dev/patchwork/patch/12188/.
[Helin] is that the v2 version? It seems that I cannot find that.

Best regards,
Igor

18 марта 2016 г., в 5:14, Zhang, Helin <helin.zhang@intel.com> написал(а):

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
  2016-04-22  1:57     ` Zhang, Helin
@ 2016-04-22  5:58       ` Igor Ryzhov
  0 siblings, 0 replies; 7+ messages in thread
From: Igor Ryzhov @ 2016-04-22  5:58 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: Sergey Balabanov, dev

v2 is here, sorry: http://www.dpdk.org/dev/patchwork/patch/12190/.

> 22 апр. 2016 г., в 4:57, Zhang, Helin <helin.zhang@intel.com> написал(а):
> 
> 
> 
> From: Igor Ryzhov [mailto:iryzhov@nfware.com] 
> Sent: Thursday, April 21, 2016 11:16 PM
> To: Zhang, Helin
> Cc: Sergey Balabanov; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create
> 
> Hello.
> 
> I rebased a patch and added Suggested-by string.
> Check it, please: http://dpdk.org/dev/patchwork/patch/12188/.
> [Helin] is that the v2 version? It seems that I cannot find that.
> 
> Best regards,
> Igor
> 
> 18 марта 2016 г., в 5:14, Zhang, Helin <helin.zhang@intel.com> написал(а):
> 
> 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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-22  5:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28 13:06 [dpdk-dev] [PATCH] kni: set kni mac on ioctl_create Sergey Balabanov
2015-08-28 13:08 ` Sergey Balabanov
2016-03-17 15:06   ` Thomas Monjalon
2016-03-18  2:14 ` Zhang, Helin
2016-04-21 15:16   ` Igor Ryzhov
2016-04-22  1:57     ` Zhang, Helin
2016-04-22  5:58       ` Igor Ryzhov

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).