From patchwork Wed Dec 7 07:06:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangchang X-Patchwork-Id: 1713038 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=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.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 4NRpHP4B1tz23yq for ; Wed, 7 Dec 2022 18:06:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DEB1B610B0; Wed, 7 Dec 2022 07:06:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DEB1B610B0 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 9i-LAELztNxj; Wed, 7 Dec 2022 07:06:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0DB8A61079; Wed, 7 Dec 2022 07:06:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0DB8A61079 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D6D1CC0032; Wed, 7 Dec 2022 07:06:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B851C002D for ; Wed, 7 Dec 2022 07:06:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D3E7481EB3 for ; Wed, 7 Dec 2022 07:06:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D3E7481EB3 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IrkltcKESWYm for ; Wed, 7 Dec 2022 07:06:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BDDC281E9E Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.219]) by smtp1.osuosl.org (Postfix) with ESMTP id BDDC281E9E for ; Wed, 7 Dec 2022 07:06:31 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.48:33726.245749156 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-221.216.139.62 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id BB3CA2800FA for ; Wed, 7 Dec 2022 15:06:20 +0800 (CST) X-189-SAVE-TO-SEND: yangchang@chinatelecom.cn Received: from ([221.216.139.62]) by app0024 with ESMTP id f8ea7aa46de24fab8f3a4db13933ae92 for dev@openvswitch.org; Wed, 07 Dec 2022 15:06:21 CST X-Transaction-ID: f8ea7aa46de24fab8f3a4db13933ae92 X-Real-From: yangchang@chinatelecom.cn X-Receive-IP: 221.216.139.62 X-MEDUSA-Status: 0 Date: Wed, 7 Dec 2022 15:06:21 +0800 From: yangchang To: dev X-Priority: 3 X-GUID: DB32071C-F69B-469D-A3CF-3FAA0A4ABDBF X-Has-Attach: no X-Mailer: Foxmail 7.2.18.95[cn] Mime-Version: 1.0 Message-ID: <2022120715062096939211@chinatelecom.cn> X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [ovs-dev] [PATCH v2] netdev-dpdk: make sure the mempool has 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 X_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 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..9f29c86 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 X_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