* [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up
@ 2016-04-21 15:12 Igor Ryzhov
2016-04-21 16:15 ` Igor Ryzhov
2016-04-21 16:27 ` [dpdk-dev] [PATCH v2] kni: don't reassign " Igor Ryzhov
0 siblings, 2 replies; 5+ messages in thread
From: Igor Ryzhov @ 2016-04-21 15:12 UTC (permalink / raw)
To: dev
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.
Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
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 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 <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include <linux/pci.h>
#include <linux/kthread.h>
#include <linux/rwsem.h>
@@ -542,6 +543,15 @@ kni_ioctl_create(struct net *net,
if (pci)
pci_dev_put(pci);
+ 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 = 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 = 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.6.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up
2016-04-21 15:12 [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up Igor Ryzhov
@ 2016-04-21 16:15 ` Igor Ryzhov
2016-04-21 16:27 ` [dpdk-dev] [PATCH v2] kni: don't reassign " Igor Ryzhov
1 sibling, 0 replies; 5+ messages in thread
From: Igor Ryzhov @ 2016-04-21 16:15 UTC (permalink / raw)
To: Igor Ryzhov; +Cc: dev
Self nack. Forgot to change variable name from dev to net_dev. Will send v2.
> 21 апр. 2016 г., в 18:12, Igor Ryzhov <iryzhov@nfware.com> написал(а):
>
> 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.
>
> Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> ---
> 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 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 <linux/module.h>
> #include <linux/miscdevice.h>
> #include <linux/netdevice.h>
> +#include <linux/etherdevice.h>
> #include <linux/pci.h>
> #include <linux/kthread.h>
> #include <linux/rwsem.h>
> @@ -542,6 +543,15 @@ kni_ioctl_create(struct net *net,
> if (pci)
> pci_dev_put(pci);
>
> + 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 = 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 = 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.6.4
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] kni: don't reassign ethernet address every time an interface goes up
2016-04-21 15:12 [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up Igor Ryzhov
2016-04-21 16:15 ` Igor Ryzhov
@ 2016-04-21 16:27 ` Igor Ryzhov
2016-04-22 6:27 ` Zhang, Helin
1 sibling, 1 reply; 5+ messages in thread
From: Igor Ryzhov @ 2016-04-21 16:27 UTC (permalink / raw)
To: dev
Currently every time a KNI interface goes up, its ethernet address is reassigned.
After this patch ethernet address is assigned only once, at initialization time.
Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
v2:
- change variable name from dev to net_dev
- slightly rewrite commit message header and body
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 ae8133f..871437f 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include <linux/pci.h>
#include <linux/kthread.h>
#include <linux/rwsem.h>
@@ -542,6 +543,15 @@ kni_ioctl_create(struct net *net,
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 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 = 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.6.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] kni: don't reassign ethernet address every time an interface goes up
2016-04-21 16:27 ` [dpdk-dev] [PATCH v2] kni: don't reassign " Igor Ryzhov
@ 2016-04-22 6:27 ` Zhang, Helin
2016-04-29 13:50 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Helin @ 2016-04-22 6:27 UTC (permalink / raw)
To: Igor Ryzhov, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Igor Ryzhov
> Sent: Friday, April 22, 2016 12:28 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] kni: don't reassign ethernet address every
> time an interface goes up
>
> Currently every time a KNI interface goes up, its ethernet address is
> reassigned.
> After this patch ethernet address is assigned only once, at initialization time.
>
> Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] kni: don't reassign ethernet address every time an interface goes up
2016-04-22 6:27 ` Zhang, Helin
@ 2016-04-29 13:50 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2016-04-29 13:50 UTC (permalink / raw)
To: Igor Ryzhov; +Cc: dev, Zhang, Helin
> > Currently every time a KNI interface goes up, its ethernet address is
> > reassigned.
> > After this patch ethernet address is assigned only once, at initialization time.
> >
> > Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
> > Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> Acked-by: Helin Zhang <helin.zhang@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-29 13:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 15:12 [dpdk-dev] [PATCH] kni: don't rewrite ethernet address every time an interface goes up Igor Ryzhov
2016-04-21 16:15 ` Igor Ryzhov
2016-04-21 16:27 ` [dpdk-dev] [PATCH v2] kni: don't reassign " Igor Ryzhov
2016-04-22 6:27 ` Zhang, Helin
2016-04-29 13:50 ` Thomas Monjalon
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).