From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0003CA05D3 for ; Mon, 25 Mar 2019 16:44:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3544F2BF7; Mon, 25 Mar 2019 16:44:29 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id F088E2BF4 for ; Mon, 25 Mar 2019 16:44:26 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 08:44:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,269,1549958400"; d="scan'208";a="310268572" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.46]) ([10.237.221.46]) by orsmga005.jf.intel.com with ESMTP; 25 Mar 2019 08:44:24 -0700 To: lironh@marvell.com Cc: dev@dpdk.org, walan@marvell.com References: <1553278337-12558-1-git-send-email-lironh@marvell.com> <1553429745-10169-1-git-send-email-lironh@marvell.com> From: Ferruh Yigit Openpgp: preference=signencrypt Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= mQINBFXZCFABEADCujshBOAaqPZpwShdkzkyGpJ15lmxiSr3jVMqOtQS/sB3FYLT0/d3+bvy qbL9YnlbPyRvZfnP3pXiKwkRoR1RJwEo2BOf6hxdzTmLRtGtwWzI9MwrUPj6n/ldiD58VAGQ +iR1I/z9UBUN/ZMksElA2D7Jgg7vZ78iKwNnd+vLBD6I61kVrZ45Vjo3r+pPOByUBXOUlxp9 GWEKKIrJ4eogqkVNSixN16VYK7xR+5OUkBYUO+sE6etSxCr7BahMPKxH+XPlZZjKrxciaWQb +dElz3Ab4Opl+ZT/bK2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xQAgjj2oyZEwaLKtKbAFsXL43jv1pUGgSvWwYtDwHITXXFQto9rZEuUDRFSx4sg9OR+Q6/6 LY+nQQ3OdHlBkflzYMPcWgDcvcTAO6yasLEUf7UcYoSWTyMYjLB4QuNlXzTswzGVMssJF/vo V8lD1eqqaSUWG3STF6GVLQOr1NLvN5+kUBiEStHFxBpgSCvYY9sNV8FS6N24CAWMBl+10W+D 2h1yiiP5dOdPcBDYKsgqDD91/sP0WdyMJkwdQJtD49f9f+lYloxHnSAxMleOpyscg1pldw+i mPaUY1bmIknLhhkqfMmjywQOXpac5LRMibAAYkcB8v7y3kwELnt8mhqqZy6LUsqcWygNbH/W K3GGt5tRpeIXeJ25x8gg5EBQ0Jnvp/IbBYQfPLtXH0Myq2QuAhk/1q2yEIbVjS+7iowEZNyE 56K63WBJxsJPB2mvmLgn98GqB4G6GufP1ndS0XDti/2K0o8rep9xoY/JDGi0n0L0tk9BHyoP Y7kaEpu7UyY3nVdRLe5H1/MnFG8hdJ97WqnPS0buYZlrbTV0nRFL/NI2VABl18vEEXvNQiO+ vM8= Message-ID: Date: Mon, 25 Mar 2019 15:44:23 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <1553429745-10169-1-git-send-email-lironh@marvell.com> Content-Type: text/plain; charset="UTF-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v4] net/kni: calc mbuf&mtu according to given mb_pool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190325154423.VKXCBVTtOw0v9D6YdJNxtBC_L1Xh4sKUk3Fm3skEnII@z> On 3/24/2019 12:15 PM, lironh@marvell.com wrote: > From: Liron Himi > > - 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 > --- > doc/guides/nics/kni.rst | 3 ++- > doc/guides/prog_guide/kernel_nic_interface.rst | 1 + > doc/guides/rel_notes/release_19_05.rst | 9 +++++++++ > drivers/net/kni/rte_eth_kni.c | 10 +++++++--- > examples/kni/main.c | 3 ++- > kernel/linux/kni/compat.h | 4 ++++ > kernel/linux/kni/kni_misc.c | 3 +++ > 7 files changed, 28 insertions(+), 5 deletions(-) > > diff --git a/doc/guides/nics/kni.rst b/doc/guides/nics/kni.rst > index 204fbd5..a66c595 100644 > --- a/doc/guides/nics/kni.rst > +++ b/doc/guides/nics/kni.rst > @@ -55,7 +55,8 @@ configuration: > > Interface name: kni# > force bind kernel thread to a core : NO > - mbuf size: MAX_PACKET_SZ > + mbuf size: (rte_pktmbuf_data_room_size(pktmbuf_pool) - RTE_PKTMBUF_HEADROOM) > + mtu: (conf.mbuf_size - ETHER_HDR_LEN) > > KNI control path is not supported with the PMD, since there is no physical > backend device by default. > diff --git a/doc/guides/prog_guide/kernel_nic_interface.rst b/doc/guides/prog_guide/kernel_nic_interface.rst > index 33ea980..412769f 100644 > --- a/doc/guides/prog_guide/kernel_nic_interface.rst > +++ b/doc/guides/prog_guide/kernel_nic_interface.rst > @@ -187,6 +187,7 @@ The ``struct rte_kni_conf`` structure contains fields which allow the > user to specify the interface name, set the MTU size, set an explicit or > random MAC address and control the affinity of the kernel Rx thread(s) > (both single and multi-threaded modes). > +By default the mtu is derived from the mbuf buffer length. This seems slightly different for kni sample and PMD, by default kni sample gets mtu from matching device, and for kni pmd it is derived from mbuf buffer length, can you please reflect this? > > The ``struct rte_kni_ops`` structure contains pointers to functions to > handle requests from the ``rte_kni`` kernel module. These functions > diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst > index 61a2c73..74a838b 100644 > --- a/doc/guides/rel_notes/release_19_05.rst > +++ b/doc/guides/rel_notes/release_19_05.rst > @@ -91,6 +91,15 @@ New Features > > * Added promiscuous mode support. > > +* **Updated KNI kernel module, KNI PMD driver.** > + > + Updated the KNI kernel module to set the max_mtu according to the given > + initial mtu size. Without it, the maximum mtu was 1500. > + > + Updated the KNI PMD driver to set the mbuf_size and mtu based on > + the given mb-pool. This provide the ability to pass jumbo frames > + if the mb-pool contains suitable buffers' size. > + Minor issue, kni is considered as core library, so can you please move the release note update above the PMD updates. > > Removed Items > ------------- > 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/examples/kni/main.c b/examples/kni/main.c > index a58774a..50cb771 100644 > --- a/examples/kni/main.c > +++ b/examples/kni/main.c > @@ -888,7 +888,8 @@ kni_alloc(uint16_t port_id) > snprintf(conf.name, RTE_KNI_NAMESIZE, > "vEth%u", port_id); > conf.group_id = port_id; > - conf.mbuf_size = MAX_PACKET_SZ; > + conf.mbuf_size = rte_pktmbuf_data_room_size(pktmbuf_pool) - > + RTE_PKTMBUF_HEADROOM; I overlooked this part, 'MAX_PACKET_SZ' is used to create mempool, so always MAX_PACKET_SZ == rte_pktmbuf_data_room_size(pktmbuf_pool) - RTE_PKTMBUF_HEADROOM Technically above code makes no difference with existing logic, perhaps we can drop it, sorry for redundant work. > /* > * The first KNI device associated to a port > * is the master, for multiple kernel thread > diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h > index 3c575c7..b9f9a6f 100644 > --- a/kernel/linux/kni/compat.h > +++ b/kernel/linux/kni/compat.h > @@ -117,3 +117,7 @@ > #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) > #define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER > #endif > + > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) > +#define HAVE_MAX_MTU_PARAM > +#endif Minor nit, trying to keep order based on kernel version check, can you please move this above the 4.11 check? > diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c > index 522ae23..04c78eb 100644 > --- a/kernel/linux/kni/kni_misc.c > +++ b/kernel/linux/kni/kni_misc.c > @@ -459,6 +459,9 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, > > if (dev_info.mtu) > net_dev->mtu = dev_info.mtu; > +#ifdef HAVE_MAX_MTU_PARAM > + net_dev->max_mtu = net_dev->mtu; > +#endif > > ret = register_netdev(net_dev); > if (ret) { >