From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 0B4239A16 for ; Tue, 1 Aug 2017 10:06:02 +0200 (CEST) Received: by mail-wm0-f45.google.com with SMTP id t138so31611249wmt.1 for ; Tue, 01 Aug 2017 01:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=CQof7fzopBeKcV7NM8gBP7EZofgkEFxJ7oejcHqrhCs=; b=linLyFDEkaOWRSe7Z1zrAi15HZpXy9RzJMuzg+A0xTdZm03OVFisG7Ye+I1/GukFjZ d1xiMUxoiiFjwtjEHMCYCOenOI7KIuy4RbZPvIcPy93L80ju2sytGompbgoQxkj7I0on Lz30meFg5x/MCgUTGP3m5xsetHPhpVBRVzLTFe86JD03KXxhEh5RUYeosssNcPlH7eBu PrPC68BQk4UVW6c/w997XYVe7AAZaD2vsEQFavbvbPXasS5QFHgCulwcMtOJWLpMq3/B RLcNlC/rAq4mBPXPQ3Ox5Y1wii/8LYGZpDzzDcb/jz/D0njHIvlbxJFn8JkVHPbxpUJW QZAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=CQof7fzopBeKcV7NM8gBP7EZofgkEFxJ7oejcHqrhCs=; b=uM1hUEpLz1hee2fomssU/wZRY/1IVZ7O+n6G5BknI20/j1ZtzDiZYEPZDr0Gt1vw2S hQFMRbL/meiV+cPbNRYHakJsIrZhUKom/Ek+FWVscMKNQoxQT5PqBysLJ0L/4JyAXgu+ PRH9XUDBaBl5GAtqXpJ/9+gICwAcMACeobp7u14y1j4kOPAEgfpKNI//EHQMymsVzSeG yy6yn4/2GWX7vqtL7h/gaivZtK9MFN5wRoWhS548LHm/hB2noRqWAp3Yt6VgPJy0MHSs nCuWJLRSlJuzGSiGS1oHIvcZg2EQjqyP2h6m+BdUQN1YgckCgOIEZhHJY78+chIPLHPe k40g== X-Gm-Message-State: AIVw1121tqy7YJjeXNCUaqOqSup0845Gv++jQNe7YCWPOC1HSNoP+KlG zdHATSBzxxVFWZ4QDyy6fw== X-Received: by 10.28.28.146 with SMTP id c140mr756974wmc.7.1501574761513; Tue, 01 Aug 2017 01:06:01 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v2sm21221020wra.2.2017.08.01.01.06.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 01:06:00 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Yongseok Koh Date: Tue, 1 Aug 2017 10:05:33 +0200 Message-Id: <460b903b24c7faf37c721c4e39b83bfdedf3357c.1501574380.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 3/5] net/mlx5: avoid reusing old queue's mbuf on reconfigure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 08:06:02 -0000 This patch prepare the merge of fake mbuf allocation needed by the vector code with rxq_alloc_elts() where all mbuf of the queues should be allocated. Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_rxq.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 118a2d9..b54d7b0 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -675,16 +675,12 @@ rxq_trim_elts(struct rxq *rxq) * Pointer to RX queue structure. * @param elts_n * Number of elements to allocate. - * @param[in] pool - * If not NULL, fetch buffers from this array instead of allocating them - * with rte_pktmbuf_alloc(). * * @return * 0 on success, errno value on failure. */ static int -rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n, - struct rte_mbuf *(*pool)[]) +rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n) { const unsigned int sges_n = 1 << rxq_ctrl->rxq.sges_n; unsigned int i; @@ -696,15 +692,8 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n, volatile struct mlx5_wqe_data_seg *scat = &(*rxq_ctrl->rxq.wqes)[i]; - if (pool != NULL) { - buf = (*pool)[i]; - assert(buf != NULL); - rte_pktmbuf_reset(buf); - rte_pktmbuf_refcnt_update(buf, 1); - } else - buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp); + buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp); if (buf == NULL) { - assert(pool == NULL); ERROR("%p: empty mbuf pool", (void *)rxq_ctrl); ret = ENOMEM; goto error; @@ -736,7 +725,6 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n, assert(ret == 0); return 0; error: - assert(pool == NULL); elts_n = i; for (i = 0; (i != elts_n); ++i) { if ((*rxq_ctrl->rxq.elts)[i] != NULL) @@ -1074,15 +1062,14 @@ rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl, (void *)dev, strerror(ret)); goto error; } - /* Reuse buffers from original queue if possible. */ if (rxq_ctrl->rxq.elts_n) { assert(1 << rxq_ctrl->rxq.elts_n == desc); assert(rxq_ctrl->rxq.elts != tmpl.rxq.elts); ret = rxq_trim_elts(&rxq_ctrl->rxq); if (!ret) - ret = rxq_alloc_elts(&tmpl, desc, rxq_ctrl->rxq.elts); + ret = rxq_alloc_elts(&tmpl, desc); } else - ret = rxq_alloc_elts(&tmpl, desc, NULL); + ret = rxq_alloc_elts(&tmpl, desc); if (ret) { ERROR("%p: RXQ allocation failed: %s", (void *)dev, strerror(ret)); -- 2.1.4