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 EAB721E34 for ; Thu, 21 Feb 2019 07:36:46 +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 x1L6ZFr2032552; Wed, 20 Feb 2019 22:36:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=IrCuNYjf1v8YUUAVd0D+cpyEmMM+n4Jdjc976S9hmpQ=; b=oR4F8I4HlkxjSJvUDbV4+jm5NCZKfMdPH/Fzt8Wg+Dmh5mSpA6Ut32TN/Dypkm5sacZT m6B/vthhOV4fvbdEnerggYLF4BuZ0mMGjPQfH4hcPiH/l29s25Xo6LpZr3Ujyeb0xIq+ VnKDdru4QelDcviHwoiTrOMiGFo9/UOd5dAgLQ9YJhh1pxt/6JBqd5AOKrr3Z/LDxDNW TNsXrCC+ISjApuFod+ok7NwTK+4ka9guvKvOtaEBkxjDR8bbr46BWyMmpSEnOw0fTavw JIW5QjnDhFgDstYUZFLdKwlI6wEUSFhbVHryoQbDjlgNnSIfBpmrL0cQEVx2lzb7rNUc Cw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2qs78kje91-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 20 Feb 2019 22:36:45 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 20 Feb 2019 22:36:44 -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; Wed, 20 Feb 2019 22:36:45 -0800 Received: from pt-lxl0023.marvell.com (pt-lxl0023.marvell.com [10.5.213.12]) by maili.marvell.com (Postfix) with ESMTP id 09A803F7040; Wed, 20 Feb 2019 22:36:43 -0800 (PST) From: To: CC: , , Liron Himi Date: Thu, 21 Feb 2019 10:47:35 +0200 Message-ID: <1550738855-11107-1-git-send-email-lironh@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-21_05:, , 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-1902210050 Subject: [dpdk-dev] [PATCH] 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: Thu, 21 Feb 2019 06:36:47 -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/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