From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 452631B1BE for ; Wed, 24 Jan 2018 16:40:21 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D5B6E226C8; Wed, 24 Jan 2018 10:40:20 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:40:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=EvGJgykSuMMbwKeAe Ga9JRmkMosnoaitEf+cZBlZIa0=; b=GSVxA+5wglZJvhEhSRG4aD/wjF3C4jStq Je0X82PgHwnPJbHqhFLECGnCiLqoMeKklTqUdE6yrnkcPqNqVjYwUW0764W+cDKb wEqxIrUtuHEjELYLEoDCO5I59zKn2BtWjcmtfI83jnvHoG9mYDAgfVRNTygHQyD4 Rs2JP01iP9e4ErYPoRZ/X7UxtxTwM8WcnUlwHcqQ46bJDnepECbAkKLFWGEoMaBY 80gUNaI9XBneOheNen478djLfIhb3I7eD5AFoEpii3Ge2nlA2W+oroBm6O/GTi09 N8xWKLvbUINMNQa0MRBl9EU4qKZLZfKOPz3dKdDvDbOKPff6OKV6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=EvGJgykSuMMbwKeAeGa9JRmkMosnoaitEf+cZBlZIa0=; b=kDoShz/x MCQWYpgurrTMIoegZe16bFmbWjxM7RHDTyorTX6h0wwUrWLGMSZqjtoRXljDdIxF A17Ve6r8i65nkju76MCv85oYv0wGrfEMEmz11bsq1Ps0rabOlet2TnmA/BPaqZrr KIwiUJJubFIJFpYMGjONvF3w2MJP+xzWh1/WI/yLjTuQsPxR+xhSwMR08f2dl3lB xQaREj6+rvu1NN3u8lqMKVBD5N0F6y15GTqiRoWHxsqdfU5ANW8KN4bTkK936j1f 5ihotP29I21KvHRdBDd3LWtQYaQJtl3e67fkpA8/iuDJo1NR7j9QnsGsLZA/873t zsWpX86FkyGtaA== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 26C267E1BE; Wed, 24 Jan 2018 10:40:18 -0500 (EST) From: Yuanhan Liu To: Natalie Samsonov Cc: dpdk stable Date: Wed, 24 Jan 2018 23:32:48 +0800 Message-Id: <1516808026-25523-100-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/mrvl: fix oversize bpool handling' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 15:40:21 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 8acd505556d91b7783ae80b6332812afe478729f Mon Sep 17 00:00:00 2001 From: Natalie Samsonov Date: Thu, 11 Jan 2018 16:35:41 +0100 Subject: [PATCH] net/mrvl: fix oversize bpool handling [ upstream commit a9bd1322b8cfe277e3ba2b81423e99ae14cd5d57 ] Don't return mbuf to dpdk pool if failed to get buffer from the bpool. Fix maximum bpool size calculation to prevent unnecessary bpool oversize cases when working with small rx queues. Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton") Signed-off-by: Natalie Samsonov --- drivers/net/mrvl/mrvl_ethdev.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index 7fef37c..d1ecbf8 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -169,6 +169,8 @@ static int mrvl_lcore_first; static int mrvl_lcore_last; static int mrvl_dev_num; +static int mrvl_fill_bpool(struct mrvl_rxq *rxq, int num); + static inline int mrvl_get_bpool_size(int pp2_id, int pool_id) { @@ -465,20 +467,13 @@ mrvl_dev_start(struct rte_eth_dev *dev) { struct mrvl_priv *priv = dev->data->dev_private; char match[MRVL_MATCH_LEN]; - int ret; + int ret = 0, def_init_size; snprintf(match, sizeof(match), "ppio-%d:%d", priv->pp_id, priv->ppio_id); priv->ppio_params.match = match; /* - * Calculate the maximum bpool size for refill feature to 1.5 of the - * configured size. In case the bpool size will exceed this value, - * superfluous buffers will be removed - */ - priv->bpool_max_size = priv->bpool_init_size + - (priv->bpool_init_size >> 1); - /* * Calculate the minimum bpool size for refill feature as follows: * 2 default burst sizes multiply by number of rx queues. * If the bpool size will be below this value, new buffers will @@ -486,6 +481,29 @@ mrvl_dev_start(struct rte_eth_dev *dev) */ priv->bpool_min_size = priv->nb_rx_queues * MRVL_BURST_SIZE * 2; + /* In case initial bpool size configured in queues setup is + * smaller than minimum size add more buffers + */ + def_init_size = priv->bpool_min_size + MRVL_BURST_SIZE * 2; + if (priv->bpool_init_size < def_init_size) { + int buffs_to_add = def_init_size - priv->bpool_init_size; + + priv->bpool_init_size += buffs_to_add; + ret = mrvl_fill_bpool(dev->data->rx_queues[0], buffs_to_add); + if (ret) + RTE_LOG(ERR, PMD, "Failed to add buffers to bpool\n"); + } + + /* + * Calculate the maximum bpool size for refill feature as follows: + * maximum number of descriptors in rx queue multiply by number + * of rx queues plus minimum bpool size. + * In case the bpool size will exceed this value, superfluous buffers + * will be removed + */ + priv->bpool_max_size = (priv->nb_rx_queues * MRVL_PP2_RXD_MAX) + + priv->bpool_min_size; + ret = pp2_ppio_init(&priv->ppio_params, &priv->ppio); if (ret) return ret; @@ -1733,14 +1751,15 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) q->priv->bpool_init_size); for (i = 0; i < pkt_to_remove; i++) { - pp2_bpool_get_buff(hif, bpool, &buff); + ret = pp2_bpool_get_buff(hif, bpool, &buff); + if (ret) + break; mbuf = (struct rte_mbuf *) (cookie_addr_high | buff.cookie); rte_pktmbuf_free(mbuf); } mrvl_port_bpool_size - [bpool->pp2_id][bpool->id][core_id] -= - pkt_to_remove; + [bpool->pp2_id][bpool->id][core_id] -= i; } rte_spinlock_unlock(&q->priv->lock); } -- 2.7.4