From patchwork Tue Dec 6 09:01:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangchang X-Patchwork-Id: 1712600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NRDtW6XkXz23ys for ; Tue, 6 Dec 2022 20:01:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B369E60C0F; Tue, 6 Dec 2022 09:01:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B369E60C0F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 85Mo7bjHT8cH; Tue, 6 Dec 2022 09:01:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id E46E760BB5; Tue, 6 Dec 2022 09:01:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E46E760BB5 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B81CCC0033; Tue, 6 Dec 2022 09:01:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1AF18C002D for ; Tue, 6 Dec 2022 09:01:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DCAC060BC4 for ; Tue, 6 Dec 2022 09:01:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DCAC060BC4 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PrKFm-a7mG1W for ; Tue, 6 Dec 2022 09:01:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 51B7560BB5 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.220]) by smtp3.osuosl.org (Postfix) with ESMTP id 51B7560BB5 for ; Tue, 6 Dec 2022 09:01:31 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:57532.1024152798 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-221.216.139.62 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 4EF552800A7 for ; Tue, 6 Dec 2022 17:01:21 +0800 (CST) X-189-SAVE-TO-SEND: yangchang@chinatelecom.cn Received: from ([221.216.139.62]) by app0025 with ESMTP id 946f7c0fe90c44c7be5da077a8e988bf for dev@openvswitch.org; Tue, 06 Dec 2022 17:01:25 CST X-Transaction-ID: 946f7c0fe90c44c7be5da077a8e988bf X-Real-From: yangchang@chinatelecom.cn X-Receive-IP: 221.216.139.62 X-MEDUSA-Status: 0 Date: Tue, 6 Dec 2022 17:01:20 +0800 From: yangchang To: dev X-Priority: 3 X-GUID: 252B4B44-9146-4FFA-A3C2-1FFD98AD49B6 X-Has-Attach: no X-Mailer: Foxmail 7.2.18.95[cn] Mime-Version: 1.0 Message-ID: <202212061701201499334@chinatelecom.cn> X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [ovs-dev] [PATCH] netdev-dpdk: make sure the mempool have enough mbufs for rxq X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" For eth dev, dpdk XXX_rx_queue_start fuction will pre alloc mbuf for rxq, if n_mbufs < n_rxq * rxq_size, dev will start error becuse of it cannot allocate memory. When n_mbufs are not enough, the mempool is not necessary to create. Signed-off-by: yangchang --- lib/netdev-dpdk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 1.8.3.1 yangchang@chinatelecom.cn diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 72e7a32..bc3353e 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -757,6 +757,19 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu) n_mbufs = dpdk_calculate_mbufs(dev, mtu); do { + /* For eth dev, dpdk XXX_rx_queue_start fuction will pre alloc mbuf + * for rxq, if n_mbufs < n_rxq * rxq_size, dev will start error + * becuse of it cannot allocate memory. + */ + if ((!per_port_mp) && (dev->type == DPDK_DEV_ETH) && + (n_mbufs < dev->requested_n_rxq * dev->requested_rxq_size)) { + VLOG_ERR("Port %s: a mempool of %u mbuffs is not enough " + "for %d Rx queues and %d queue size", + netdev_name, n_mbufs, dev->requested_n_rxq, + dev->requested_rxq_size); + break; + } + /* Full DPDK memory pool name must be unique and cannot be * longer than RTE_MEMPOOL_NAMESIZE. Note that for the shared * mempool case this can result in one device using a mempool