From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by dpdk.org (Postfix) with ESMTP id 1D22F559A for ; Fri, 14 Jul 2017 12:35:44 +0200 (CEST) Received: by mail-pf0-f195.google.com with SMTP id q85so10554662pfq.2 for ; Fri, 14 Jul 2017 03:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=07qCoJ3vlYv/oHPOArp1PTiw0ECy2FKX/erTmZSaGsY=; b=nT4pH/D9onC7qQMfjLHULyn91f7R0NR0OrDwff/dP91QRhgxlP/4q0rg+gZ6pBRoPs AXpUPoo/yZHMOvQRAhZ7MdIz3kFub3zuaduCUPecTBR5RxGzkoufkEm7ZLvj1VLKIqib Fl+2BsFI6Z4QRF5ihQu600u10JubaL/E4z4JKe1pHD5x21VAmzI1uv6THHJvGbyWXAOb Jv5XcyAul3CMZyGqdxdxx+m+Ptpvo7t7SVc05DYRLFvQibWcSOxPF+GMI6NiAE6vhulk oCwNe+3srFpaAh2BGPx1Y4c28ifEum9QH7hb6DMYJWetjRy3WVfk1x+rBBa9iH12bQAj /uqA== 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=07qCoJ3vlYv/oHPOArp1PTiw0ECy2FKX/erTmZSaGsY=; b=qX+jCdyNJEzdUBnOnCAZ4RB2JQvr2RZrVmThlFajPcWmG30C0NkzYYI/B9z71rLvIP 36sIe2WC9eQvUUkq8yXNMV4Bz5bwVNX1kwTk5Pjcue9CFFYwEldY3rT0C+iIq1hcKVak uvMR5THcAopS64mS7rFFksCGIeif1axQdCKGoPvSpndTux/zcAvE/EwQf5/57AQNJj4J ZfHTt563r4tod2JRquXtdG2N9h5GH+mWLwC08vljDeu21wkxbfqOwOimc/mnYRXs6i9J 6tbRUHZu0eL/cvmGYEqNnfxSf3e7Yxm8d55smHx5L5dgGkGKOEPUrSFfEEXD+DV3vLZl AU8w== X-Gm-Message-State: AIVw110uYADvePaZSsZCTiPo3RrJB0OFJpyjcAlGfRjIe3DYGeeLxQTg +CktONkle5v4Fb7B X-Received: by 10.84.236.3 with SMTP id q3mr15067077plk.254.1500028543402; Fri, 14 Jul 2017 03:35:43 -0700 (PDT) Received: from localhost.localdomain ([180.158.48.171]) by smtp.gmail.com with ESMTPSA id y205sm15273553pfb.124.2017.07.14.03.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jul 2017 03:35:42 -0700 (PDT) From: Yuanhan Liu To: Dahir Osman Cc: Matt Peters , Allain Legacy , Konstantin Ananyev , dpdk stable Date: Fri, 14 Jul 2017 18:33:42 +0800 Message-Id: <1500028450-25989-18-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500028450-25989-1-git-send-email-yliu@fridaylinux.org> References: <1500028450-25989-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'ip_frag: free mbufs on reassembly table destroy' has been queued to LTS release 16.11.3 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: Fri, 14 Jul 2017 10:35:44 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/19/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 7d272acbdf4495f32dff48b86d7627df18b52cf5 Mon Sep 17 00:00:00 2001 From: Dahir Osman Date: Mon, 5 Jun 2017 11:49:01 -0400 Subject: [PATCH] ip_frag: free mbufs on reassembly table destroy [ upstream commit 95908f52393da36c47905a777f64c0650585c12b ] The rte_ip_frag_table_destroy procedure simply releases the memory for the table without freeing the packet buffers that may be referenced in the hash table for in-flight or incomplete packet reassembly operations. To prevent leaked mbufs go through the list of fragments and free each one individually. Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library") Reported-by: Matt Peters Signed-off-by: Allain Legacy Acked-by: Konstantin Ananyev --- lib/librte_ip_frag/ip_frag_common.h | 20 ++++++++++++++++++++ lib/librte_ip_frag/rte_ip_frag.h | 7 ++----- lib/librte_ip_frag/rte_ip_frag_common.c | 13 +++++++++++++ lib/librte_ip_frag/rte_ipfrag_version.map | 7 +++++++ 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/lib/librte_ip_frag/ip_frag_common.h b/lib/librte_ip_frag/ip_frag_common.h index 835e4f9..9f56196 100644 --- a/lib/librte_ip_frag/ip_frag_common.h +++ b/lib/librte_ip_frag/ip_frag_common.h @@ -130,6 +130,26 @@ ip_frag_free(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr) dr->cnt = k; } +/* delete fragment's mbufs immediately instead of using death row */ +static inline void +ip_frag_free_immediate(struct ip_frag_pkt *fp) +{ + uint32_t i; + + for (i = 0; i < fp->last_idx; i++) { + if (fp->frags[i].mb != NULL) { + IP_FRAG_LOG(DEBUG, "%s:%d\n" + "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>\n", + __func__, __LINE__, fp->frags[i].mb, fp->start, + fp->key.src_dst[0], fp->key.id); + rte_pktmbuf_free(fp->frags[i].mb); + fp->frags[i].mb = NULL; + } + } + + fp->last_idx = 0; +} + /* if key is empty, mark key as in use */ static inline void ip_frag_inuse(struct rte_ip_frag_tbl *tbl, const struct ip_frag_pkt *fp) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 6708906..ff16f4c 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -180,11 +180,8 @@ struct rte_ip_frag_tbl * rte_ip_frag_table_create(uint32_t bucket_num, * @param tbl * Fragmentation table to free. */ -static inline void -rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl) -{ - rte_free(tbl); -} +void +rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl); /** * This function implements the fragmentation of IPv6 packets. diff --git a/lib/librte_ip_frag/rte_ip_frag_common.c b/lib/librte_ip_frag/rte_ip_frag_common.c index 6176ff4..8460f8e 100644 --- a/lib/librte_ip_frag/rte_ip_frag_common.c +++ b/lib/librte_ip_frag/rte_ip_frag_common.c @@ -109,6 +109,19 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, return tbl; } +/* delete fragmentation table */ +void +rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl) +{ + struct ip_frag_pkt *fp; + + TAILQ_FOREACH(fp, &tbl->lru, lru) { + ip_frag_free_immediate(fp); + } + + rte_free(tbl); +} + /* dump frag table statistics to file */ void rte_ip_frag_table_statistics_dump(FILE *f, const struct rte_ip_frag_tbl *tbl) diff --git a/lib/librte_ip_frag/rte_ipfrag_version.map b/lib/librte_ip_frag/rte_ipfrag_version.map index 354fa08..d1acf07 100644 --- a/lib/librte_ip_frag/rte_ipfrag_version.map +++ b/lib/librte_ip_frag/rte_ipfrag_version.map @@ -11,3 +11,10 @@ DPDK_2.0 { local: *; }; + +DPDK_17.08 { + global: + + rte_ip_frag_table_destroy; + +} DPDK_2.0; -- 2.7.4