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 9526B20BD for ; Sat, 23 Feb 2019 19:03:52 +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 x1NHtv1V025904; Sat, 23 Feb 2019 10:03:51 -0800 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=AoOWfpJQOayG6OKDXhEUoQlAqs5ZkUASKekZJISMf8c=; b=PSI1zNwuYuo+nlR3sGPRI1EH8cybQPvMpMuwCAUvQPrC/LBmfMrS+Eie7cl/KmI704WX 9WSj/7jcUwpvvFa7O/jJlA+tWQxNLOmeAhfHqCO3V2QoR2m53a0/tin2M65LDZJh/J1h 4627FXyjDWZ5Fe1LB6aOo2rAFHL3zQqNhf2al0/gb+FpTeHo6UK/Tigtv0xEIFJPGc0p oq94X4YloyFIuh0ED7+hIzzTfswbbVq0+EuoP49z4cW+PcRqDAnlkhzAswbcBuff/PxU /DLj5tLzz+xQDv+Em5OLwO+JpiOdzbJuI8xKYucXRjJMmVGx2UhVER6cqaghjG3b+ujj kA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2qu4dsrq2p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 23 Feb 2019 10:03:51 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 23 Feb 2019 10:03:50 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sat, 23 Feb 2019 10:03:50 -0800 Received: from pt-lxl0023.marvell.com (unknown [10.5.213.12]) by maili.marvell.com (Postfix) with ESMTP id 9A6903F703F; Sat, 23 Feb 2019 10:03:49 -0800 (PST) From: To: CC: , Liron Himi Date: Sat, 23 Feb 2019 22:14:45 +0200 Message-ID: <1550952885-2395-1-git-send-email-lironh@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550738855-11107-1-git-send-email-lironh@marvell.com> References: <1550738855-11107-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-02-23_11:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902230137 Subject: [dpdk-dev] [PATCH v2] 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: Sat, 23 Feb 2019 18:03:53 -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 --- drivers/net/kni/rte_eth_kni.c | 10 +++++++--- kernel/linux/kni/compat.h | 4 ++++ kernel/linux/kni/kni_misc.c | 3 +++ 3 files changed, 14 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/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