From patchwork Thu Oct 5 15:52:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 821907 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7HQM0bmhz9sNr for ; Fri, 6 Oct 2017 02:54:35 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EFB8AB13; Thu, 5 Oct 2017 15:52:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BEFADAE7 for ; Thu, 5 Oct 2017 15:52:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 730843FA for ; Thu, 5 Oct 2017 15:52:15 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 05 Oct 2017 08:52:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,481,1500966000"; d="scan'208";a="159805865" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by fmsmga006.fm.intel.com with ESMTP; 05 Oct 2017 08:52:13 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Thu, 5 Oct 2017 16:52:04 +0100 Message-Id: <1507218725-2355-4-git-send-email-antonio.fischetti@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1507218725-2355-1-git-send-email-antonio.fischetti@intel.com> References: <1507218725-2355-1-git-send-email-antonio.fischetti@intel.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v3 4/5] netdev-dpdk: Reword mp_size as n_mbufs. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Rename mp_size as n_mbufs in dpdk_mp structure. This parameter is passed to rte mempool creation functions and is meant to contain the number of elements inside the requested mempool. CC: Ciara Loftus CC: Kevin Traynor CC: Aaron Conole Signed-off-by: Antonio Fischetti --- lib/netdev-dpdk.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 46bd201..b5f54cc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -308,7 +308,7 @@ struct dpdk_mp { int mtu; int socket_id; char if_name[IFNAMSIZ]; - unsigned mp_size; + unsigned n_mbufs; /* Number of mbufs inside the mempool. */ struct ovs_list list_node OVS_GUARDED_BY(dpdk_mp_mutex); }; @@ -500,7 +500,7 @@ dpdk_mp_name(struct dpdk_mp *dmp) uint32_t h = hash_string(dmp->if_name, 0); char *mp_name = xcalloc(RTE_MEMPOOL_NAMESIZE, sizeof *mp_name); int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%u", - h, dmp->mtu, dmp->mp_size); + h, dmp->mtu, dmp->n_mbufs); ovs_assert(ret >= 0 && ret < RTE_MEMPOOL_NAMESIZE); return mp_name; } @@ -517,13 +517,13 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) ovs_strzcpy(dmp->if_name, dev->up.name, IFNAMSIZ); /* - * XXX: rough estimation of memory required for port: + * XXX: rough estimation of number of mbufs required for this port: * * + * + * + */ - dmp->mp_size = dev->requested_n_rxq * dev->requested_rxq_size + dmp->n_mbufs = dev->requested_n_rxq * dev->requested_rxq_size + dev->requested_n_txq * dev->requested_txq_size + MIN(RTE_MAX_LCORE, dev->requested_n_rxq) * NETDEV_MAX_BURST + MIN_NB_MBUF; @@ -533,10 +533,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) VLOG_DBG("Requesting a mempool of %u mbufs for netdev %s " "with %d Rx and %d Tx queues.", - dmp->mp_size, dev->up.name, + dmp->n_mbufs, dev->up.name, dev->requested_n_rxq, dev->requested_n_txq); - dmp->mp = rte_pktmbuf_pool_create(mp_name, dmp->mp_size, + dmp->mp = rte_pktmbuf_pool_create(mp_name, dmp->n_mbufs, MP_CACHE_SZ, sizeof (struct dp_packet) - sizeof (struct rte_mbuf), @@ -545,7 +545,7 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) dmp->socket_id); if (dmp->mp) { VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", mp_name, - dmp->mp_size); + dmp->n_mbufs); /* rte_pktmbuf_pool_create has done some initialization of the * rte_mbuf part of each dp_packet. Some OvS specific fields * of the packet still need to be initialized by @@ -563,14 +563,14 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) *mp_exists = true; } else { VLOG_ERR("Failed mempool \"%s\" create request of %u mbufs", - mp_name, dmp->mp_size); + mp_name, dmp->n_mbufs); } free(mp_name); if (dmp->mp) { return dmp; } } while (!(*mp_exists) && - (rte_errno == ENOMEM && (dmp->mp_size /= 2) >= MIN_NB_MBUF)); + (rte_errno == ENOMEM && (dmp->n_mbufs /= 2) >= MIN_NB_MBUF)); rte_free(dmp); return NULL;