DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/kni: calc mbuf&mtu according to given mb_pool
@ 2019-02-21  8:47 lironh
  2019-02-23 20:14 ` [dpdk-dev] [PATCH v2] " lironh
  0 siblings, 1 reply; 37+ messages in thread
From: lironh @ 2019-02-21  8:47 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, walan, Liron Himi

From: Liron Himi <lironh@marvell.com>

- mbuf_size and mtu are now being calculated according
to the given mb-pool.

- max_mtu is now being set according to the given mtu

the above two changes provide the ability to work with jumbo frames

Signed-off-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/kni/rte_eth_kni.c | 10 +++++++---
 kernel/linux/kni/kni_misc.c   |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index a1e9970..5e02224 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -16,9 +16,11 @@
 /* Only single queue supported */
 #define KNI_MAX_QUEUE_PER_PORT 1
 
-#define MAX_PACKET_SZ 2048
 #define MAX_KNI_PORTS 8
 
+#define KNI_ETHER_MTU(mbuf_size)       \
+	((mbuf_size) - ETHER_HDR_LEN) /**< Ethernet MTU. */
+
 #define ETH_KNI_NO_REQUEST_THREAD_ARG	"no_request_thread"
 static const char * const valid_arguments[] = {
 	ETH_KNI_NO_REQUEST_THREAD_ARG,
@@ -123,11 +125,13 @@ eth_kni_start(struct rte_eth_dev *dev)
 	struct rte_kni_conf conf;
 	const char *name = dev->device->name + 4; /* remove net_ */
 
+	mb_pool = internals->rx_queues[0].mb_pool;
 	snprintf(conf.name, RTE_KNI_NAMESIZE, "%s", name);
 	conf.force_bind = 0;
 	conf.group_id = port_id;
-	conf.mbuf_size = MAX_PACKET_SZ;
-	mb_pool = internals->rx_queues[0].mb_pool;
+	conf.mbuf_size =
+		rte_pktmbuf_data_room_size(mb_pool) - RTE_PKTMBUF_HEADROOM;
+	conf.mtu = KNI_ETHER_MTU(conf.mbuf_size);
 
 	internals->kni = rte_kni_alloc(mb_pool, &conf, NULL);
 	if (internals->kni == NULL) {
diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c
index 522ae23..9dac16d 100644
--- a/kernel/linux/kni/kni_misc.c
+++ b/kernel/linux/kni/kni_misc.c
@@ -459,6 +459,7 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
 
 	if (dev_info.mtu)
 		net_dev->mtu = dev_info.mtu;
+	net_dev->max_mtu = net_dev->mtu;
 
 	ret = register_netdev(net_dev);
 	if (ret) {
-- 
2.7.4

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

end of thread, other threads:[~2019-03-30  0:00 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21  8:47 [dpdk-dev] [PATCH] net/kni: calc mbuf&mtu according to given mb_pool lironh
2019-02-23 20:14 ` [dpdk-dev] [PATCH v2] " lironh
2019-02-25 11:29   ` Liron Himi
2019-03-10 14:27     ` Liron Himi
2019-03-13 16:57       ` Ferruh Yigit
2019-03-14  6:37         ` Liron Himi
2019-03-14  6:37           ` Liron Himi
2019-03-14  9:28           ` Ferruh Yigit
2019-03-14  9:28             ` Ferruh Yigit
2019-03-15 17:02             ` Liron Himi
2019-03-15 17:02               ` Liron Himi
2019-03-15 17:59               ` Ferruh Yigit
2019-03-15 17:59                 ` Ferruh Yigit
2019-03-17  9:43                 ` Liron Himi
2019-03-17  9:43                   ` Liron Himi
2019-03-20 19:48                   ` Ferruh Yigit
2019-03-20 19:48                     ` Ferruh Yigit
2019-03-22 18:12   ` [dpdk-dev] [PATCH v3] " lironh
2019-03-22 18:12     ` lironh
2019-03-23 21:48     ` Rami Rosen
2019-03-23 21:48       ` Rami Rosen
2019-03-24 10:05       ` [dpdk-dev] [EXT] " Liron Himi
2019-03-24 10:05         ` Liron Himi
2019-03-24 12:15     ` [dpdk-dev] [PATCH v4] " lironh
2019-03-24 12:15       ` lironh
2019-03-25 15:44       ` Ferruh Yigit
2019-03-25 15:44         ` Ferruh Yigit
2019-03-25 20:48       ` [dpdk-dev] [PATCH v5] " lironh
2019-03-25 20:48         ` lironh
2019-03-25 21:11         ` Ferruh Yigit
2019-03-25 21:11           ` Ferruh Yigit
2019-03-26 18:40         ` [dpdk-dev] [PATCH v6] " lironh
2019-03-26 17:59           ` Ferruh Yigit
2019-03-26 17:59             ` Ferruh Yigit
2019-03-30  0:00             ` Thomas Monjalon
2019-03-30  0:00               ` Thomas Monjalon
2019-03-26 18:40           ` lironh

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