From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id CE5201B854 for ; Tue, 15 May 2018 15:49:05 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id n10-v6so1271889wmc.1 for ; Tue, 15 May 2018 06:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D2kv30Wm0o0YieydzsU/gNmD0O91qBmiatCO4wDT8aM=; b=JNaEaB20VBW45HEK8PaNCZkybCL0FL/sPl+svTJ+SbhkiTOuGeB7eV+rBXffKP24zR +to/zx7T/pG5+u0T2bHT9B7olXu/ECLzvkquHw8mXZvlOGmh6nlcfO+pfRr0yNI33+Jv acwZTHX92bgAk3A+QkVz2qLvTwy2ZEagDUVMKf0dGb/ao8Bv9821XDRbh2EfNrHGlUKH qFsEh6BI1NVlgJKBIQcfEKpiuZxq0hie0KgT6LXbrbT5mZoq4X8W3McCpBywibjYOUVz nNe8EJr3C2P5V+DehZAQ8eTSpyQ6Nt/PLoeofT06y2ZEzciZ558UNecDPMVopCgMRf2o J6/g== 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; bh=D2kv30Wm0o0YieydzsU/gNmD0O91qBmiatCO4wDT8aM=; b=oW/AtOl+E+D+cnJqcikivJF+XKPnEZYYUBaFLKbpAtGktXAN1xe9kG0nZG0/hAZLiJ 6uuArIoN6i/TETaFmnRz2yN05w8TQMdzTXO91SP9NPdVQ0eEfKPOFXIVXkULD8y9MrBQ is3sxh5vbYVxhR6O73EoXs6VyZQZsJ8i0rpFs+Lbyw9FQPb7oZZuk0klo11geCV2kcsX mnl+TPm/rvYrqeLmz5CA7LjqCjIfTYi9ctB6YlXxwG9TKF3tAz2q2LQMIlV6/cb945sk 8qnMTB6mv9BLqezckpFvL5KRINdEVM3f5xDKfRpNpMUwrfwxyFEPF6kbqueif1UxuQBr af5w== X-Gm-Message-State: ALKqPweQ4sDrVq75N9bRPbY0yS1rZ0HlIY52LtbJyh3tVIv6G5bcEPDg mv1PA5ONVqCX/FTMa105XX/gLDsHiuk= X-Google-Smtp-Source: AB8JxZq4rkVeHa263JDPoMWAo/tlWWYap0K1EYe3Nz9CMc1Tsaqnm+F4Nb6vcU4OYWZe4JyG6Ob4UQ== X-Received: by 2002:a1c:d913:: with SMTP id q19-v6mr7817246wmg.91.1526392145544; Tue, 15 May 2018 06:49:05 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id l20-v6sm76302wrf.90.2018.05.15.06.49.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:49:04 -0700 (PDT) From: luca.boccassi@gmail.com To: Xiaoxin Peng Cc: Jay Ding , Scott Branden , Ray Jui , Randy Schacher , Ajit Khaparde , dpdk stable Date: Tue, 15 May 2018 14:47:01 +0100 Message-Id: <20180515134731.9337-50-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515134731.9337-1-luca.boccassi@gmail.com> References: <20180503110612.12146-2-luca.boccassi@gmail.com> <20180515134731.9337-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/bnxt: fix Rx mbuf and agg ring leak in dev stop' has been queued to stable release 18.02.2 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: Tue, 15 May 2018 13:49:06 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From de3fae4aaf8d47dce4bad353a1910bcfc402b038 Mon Sep 17 00:00:00 2001 From: Xiaoxin Peng Date: Mon, 30 Apr 2018 18:06:14 -0700 Subject: [PATCH] net/bnxt: fix Rx mbuf and agg ring leak in dev stop [ upstream commit 3f07f2da6ca91febb67816ce8818cbdec4976413 ] In the start/stop_op operation, mbufs allocated for rings were not freed 1) add bnxt_free_tx_mbuf/bnxt_free_rx_mbuf in bnxt_dev_stop_op to free MBUF before freeing the rings. 2) MBUF allocation and free routines were not in sync. Allocation uses the ring->ring_size including any rounded up and multiple factors while the free routine uses the requested queue size. Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations") Signed-off-by: Jay Ding Signed-off-by: Scott Branden Reviewed-by: Ray Jui Reviewed-by: Randy Schacher Signed-off-by: Xiaoxin Peng Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/bnxt/bnxt_rxq.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 90eb787f4..a74afc831 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -646,6 +646,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) } bnxt_set_hwrm_link_config(bp, false); bnxt_hwrm_port_clr_stats(bp); + bnxt_free_tx_mbufs(bp); + bnxt_free_rx_mbufs(bp); bnxt_shutdown_nic(bp); bp->dev_stopped = 1; } @@ -657,8 +659,6 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) if (bp->dev_stopped == 0) bnxt_dev_stop_op(eth_dev); - bnxt_free_tx_mbufs(bp); - bnxt_free_rx_mbufs(bp); bnxt_free_mem(bp); if (eth_dev->data->mac_addrs != NULL) { rte_free(eth_dev->data->mac_addrs); diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 33cca9263..e5749b974 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -237,7 +237,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq) if (rxq) { sw_ring = rxq->rx_ring->rx_buf_ring; if (sw_ring) { - for (i = 0; i < rxq->nb_rx_desc; i++) { + for (i = 0; + i < rxq->rx_ring->rx_ring_struct->ring_size; i++) { if (sw_ring[i].mbuf) { rte_pktmbuf_free_seg(sw_ring[i].mbuf); sw_ring[i].mbuf = NULL; @@ -247,7 +248,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq) /* Free up mbufs in Agg ring */ sw_ring = rxq->rx_ring->ag_buf_ring; if (sw_ring) { - for (i = 0; i < rxq->nb_rx_desc; i++) { + for (i = 0; + i < rxq->rx_ring->ag_ring_struct->ring_size; i++) { if (sw_ring[i].mbuf) { rte_pktmbuf_free_seg(sw_ring[i].mbuf); sw_ring[i].mbuf = NULL; -- 2.14.2