From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2D2AD1B5F5 for ; Fri, 22 Mar 2019 17:01:27 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2MFslqq005192; Fri, 22 Mar 2019 09:01:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=Cud+jGj9pWJv55jDqDlcO3Td9m4VHwtbZKwyHj1TudI=; b=Ubimirrevlc40a1kOmLIiXn18P/JPQ3xvLBpViNx8r2ToFFGVrBTTGa9tzV9sTZxCoZ3 droPdZ1AtvnWk1oU6wN6oS6JMyZmF45DG4IxaflMdJvrcZPsA3Ceeajv32yQ7pyDe+90 sawjslAQBXZttewhhCAjsQwSVpejOYlpLr0+ND+DLutNwh8ivdPQxMRu13i8GjH/+Ypv lz8yWS3cmQbs0Ap7EmYXdlBekyyHbJ375HLEJ2y006qwMBPsUMux8Z6gYleKvgOdM9Ok ANrFQjhHC7NF/rEhGrmE29T8w6IWzfyPWG7bT3B5opFP7ItCpaviscHXGQ+fDAVZ+KQh Tg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rcv6ah5t1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 22 Mar 2019 09:01:24 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 22 Mar 2019 09:01:18 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 22 Mar 2019 09:01:18 -0700 Received: from pt-lxl0023.marvell.com (pt-lxl0023.marvell.com [10.5.213.12]) by maili.marvell.com (Postfix) with ESMTP id 6AF423F7048; Fri, 22 Mar 2019 09:01:17 -0700 (PDT) From: To: CC: , , Liron Himi Date: Fri, 22 Mar 2019 20:12:17 +0200 Message-ID: <1553278337-12558-1-git-send-email-lironh@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550952885-2395-1-git-send-email-lironh@marvell.com> References: <1550952885-2395-1-git-send-email-lironh@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-22_09:, , signatures=0 Subject: [dpdk-dev] [PATCH v3] 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: , X-List-Received-Date: Fri, 22 Mar 2019 16:01:27 -0000 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. 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..c8a1559 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 + th given mb-pool. This provide the ability to pass jumbo frames + if the bm-pool contains suitable buffers' size. + 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; /* * 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 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) { -- 2.7.4 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 672D7A00E6 for ; Fri, 22 Mar 2019 17:01:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A15051B5FB; Fri, 22 Mar 2019 17:01:29 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2D2AD1B5F5 for ; Fri, 22 Mar 2019 17:01:27 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2MFslqq005192; Fri, 22 Mar 2019 09:01:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=Cud+jGj9pWJv55jDqDlcO3Td9m4VHwtbZKwyHj1TudI=; b=Ubimirrevlc40a1kOmLIiXn18P/JPQ3xvLBpViNx8r2ToFFGVrBTTGa9tzV9sTZxCoZ3 droPdZ1AtvnWk1oU6wN6oS6JMyZmF45DG4IxaflMdJvrcZPsA3Ceeajv32yQ7pyDe+90 sawjslAQBXZttewhhCAjsQwSVpejOYlpLr0+ND+DLutNwh8ivdPQxMRu13i8GjH/+Ypv lz8yWS3cmQbs0Ap7EmYXdlBekyyHbJ375HLEJ2y006qwMBPsUMux8Z6gYleKvgOdM9Ok ANrFQjhHC7NF/rEhGrmE29T8w6IWzfyPWG7bT3B5opFP7ItCpaviscHXGQ+fDAVZ+KQh Tg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rcv6ah5t1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 22 Mar 2019 09:01:24 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 22 Mar 2019 09:01:18 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 22 Mar 2019 09:01:18 -0700 Received: from pt-lxl0023.marvell.com (pt-lxl0023.marvell.com [10.5.213.12]) by maili.marvell.com (Postfix) with ESMTP id 6AF423F7048; Fri, 22 Mar 2019 09:01:17 -0700 (PDT) From: To: CC: , , Liron Himi Date: Fri, 22 Mar 2019 20:12:17 +0200 Message-ID: <1553278337-12558-1-git-send-email-lironh@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550952885-2395-1-git-send-email-lironh@marvell.com> References: <1550952885-2395-1-git-send-email-lironh@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-22_09:, , signatures=0 Subject: [dpdk-dev] [PATCH v3] 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: <20190322181217.OnLpH4LtTkdvKHtZYBu-OT4ner2auJd8CpxxsCRaYQw@z> 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. 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..c8a1559 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 + th given mb-pool. This provide the ability to pass jumbo frames + if the bm-pool contains suitable buffers' size. + 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; /* * 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 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) { -- 2.7.4