From patchwork Mon Oct 16 13:15:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 826284 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 3yFzR36DnFz9t3R for ; Tue, 17 Oct 2017 00:18:23 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 501F3B9E; Mon, 16 Oct 2017 13:15:33 +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 6AE4AB78 for ; Mon, 16 Oct 2017 13:15:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1A662433 for ; Mon, 16 Oct 2017 13:15:32 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2017 06:15:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,371,1503385200"; d="scan'208";a="696821" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga001.jf.intel.com with ESMTP; 16 Oct 2017 06:15:29 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Mon, 16 Oct 2017 14:15:16 +0100 Message-Id: <1508159716-3656-6-git-send-email-antonio.fischetti@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1508159716-3656-1-git-send-email-antonio.fischetti@intel.com> References: <1508159716-3656-1-git-send-email-antonio.fischetti@intel.com> X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, 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 v6 5/5] netdev-dpdk: Rename dpdk_mp_put as dpdk_mp_free. 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 For readability purposes dpdk_mp_put is renamed as dpdk_mp_free. Some other comments are also added to mempool functions. CC: Mark B Kavanagh CC: Darrell Ball CC: Ciara Loftus CC: Kevin Traynor CC: Aaron Conole Signed-off-by: Antonio Fischetti --- lib/netdev-dpdk.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 5cf1392..ca07918 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -587,6 +587,9 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists) return NULL; } +/* Returns a valid pointer when either of the two cases occur: + * a new mempool was just created or the requested mempool is already + * existing. */ static struct dpdk_mp * dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists) { @@ -599,8 +602,9 @@ dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists) return dmp; } +/* Release an existing mempool. */ static void -dpdk_mp_put(struct dpdk_mp *dmp) +dpdk_mp_free(struct dpdk_mp *dmp) { char *mp_name; @@ -617,8 +621,8 @@ dpdk_mp_put(struct dpdk_mp *dmp) ovs_mutex_unlock(&dpdk_mp_mutex); } -/* Tries to allocate new mempool on requested_socket_id with - * mbuf size corresponding to requested_mtu. +/* Tries to allocate a new mempool on requested_socket_id with a size + * determined by requested_mtu and requested Rx/Tx queues. * On success new configuration will be applied. * On error, device will be left unchanged. */ static int @@ -644,7 +648,8 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk *dev) dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); return EEXIST; } else { - dpdk_mp_put(dev->dpdk_mp); + /* A new mempool was created, release the previous one. */ + dpdk_mp_free(dev->dpdk_mp); dev->dpdk_mp = mp; dev->mtu = dev->requested_mtu; dev->socket_id = dev->requested_socket_id; @@ -1089,7 +1094,7 @@ common_destruct(struct netdev_dpdk *dev) OVS_EXCLUDED(dev->mutex) { rte_free(dev->tx_q); - dpdk_mp_put(dev->dpdk_mp); + dpdk_mp_free(dev->dpdk_mp); ovs_list_remove(&dev->list_node); free(ovsrcu_get_protected(struct ingress_policer *,