DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v2 3/3] kni: set initial value for MTU
Date: Tue, 26 Dec 2017 16:06:48 +0530	[thread overview]
Message-ID: <1514284608-9263-3-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1514284608-9263-1-git-send-email-hemant.agrawal@nxp.com>

Configure initial application provided  mtu on the KNI interface.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
v2: fix ABI breakage

 examples/kni/main.c                                           | 2 ++
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 1 +
 lib/librte_eal/linuxapp/kni/kni_misc.c                        | 3 +++
 lib/librte_kni/rte_kni.c                                      | 1 +
 lib/librte_kni/rte_kni.h                                      | 1 +
 5 files changed, 8 insertions(+)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 1c251c2..d9c9fa5 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -845,6 +845,8 @@ kni_alloc(uint16_t port_id)
 			rte_eth_macaddr_get(port_id,
 					(struct ether_addr *)&conf.mac_addr);
 
+			rte_eth_dev_get_mtu(port_id, &conf.mtu);
+
 			memset(&ops, 0, sizeof(ops));
 			ops.port_id = port_id;
 			ops.change_mtu = kni_change_mtu;
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index b519db5..2e393c0 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -172,6 +172,7 @@ struct rte_kni_device_info {
 
 	/* mbuf size */
 	unsigned mbuf_size;
+	unsigned int mtu;
 	char mac_addr[6];
 };
 
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index b524d30..0ccd227 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -470,6 +470,9 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
 			random_ether_addr(net_dev->dev_addr);
 	}
 
+	if (dev_info.mtu)
+		net_dev->mtu = dev_info.mtu;
+
 	ret = register_netdev(net_dev);
 	if (ret) {
 		pr_err("error %i registering device \"%s\"\n",
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index bed3f20..2461b47 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -369,6 +369,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
 	dev_info.force_bind = conf->force_bind;
 	dev_info.group_id = conf->group_id;
 	dev_info.mbuf_size = conf->mbuf_size;
+	dev_info.mtu = conf->mtu;
 
 	memcpy(dev_info.mac_addr, conf->mac_addr, ETHER_ADDR_LEN);
 
diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h
index 4530bdd..cbf3188 100644
--- a/lib/librte_kni/rte_kni.h
+++ b/lib/librte_kni/rte_kni.h
@@ -98,6 +98,7 @@ struct rte_kni_conf {
 	__extension__
 	uint8_t force_bind : 1; /* Flag to bind kernel thread */
 	char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */
+	uint16_t mtu;
 };
 
 /**
-- 
2.7.4

  parent reply	other threads:[~2017-12-26 10:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 11:46 [dpdk-dev] [PATCH 1/3] kni: support for MAC addr change Hemant Agrawal
2017-11-30 11:46 ` [dpdk-dev] [PATCH 2/3] kni: add support for promisc mode set Hemant Agrawal
2017-12-22 21:57   ` Ferruh Yigit
2017-11-30 11:46 ` [dpdk-dev] [PATCH 3/3] kni: set initial value for MTU Hemant Agrawal
2017-12-22 22:01   ` Ferruh Yigit
2017-12-22 21:55 ` [dpdk-dev] [PATCH 1/3] kni: support for MAC addr change Ferruh Yigit
2017-12-26 10:08   ` Hemant Agrawal
2017-12-26 10:36 ` [dpdk-dev] [PATCH v2 " Hemant Agrawal
2017-12-26 10:36   ` [dpdk-dev] [PATCH v2 2/3] kni: add support for promisc mode set Hemant Agrawal
2017-12-26 10:36   ` Hemant Agrawal [this message]
2018-01-18  6:12   ` [dpdk-dev] [PATCH v3 1/3] kni: support for MAC addr change Hemant Agrawal
2018-01-18  6:12     ` [dpdk-dev] [PATCH v3 2/3] kni: add support for promisc mode set Hemant Agrawal
2018-01-18  6:13     ` [dpdk-dev] [PATCH v3 3/3] kni: set initial value for MTU Hemant Agrawal
2018-01-21 22:07     ` [dpdk-dev] [PATCH v3 1/3] kni: support for MAC addr change Ferruh Yigit
2018-01-22  5:20       ` Hemant Agrawal
2018-01-22 15:48         ` Ferruh Yigit
2018-02-01  0:04           ` Thomas Monjalon

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=1514284608-9263-3-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).