From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B98DFA04AC for ; Sat, 15 Aug 2020 16:51:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C9591C0D7; Sat, 15 Aug 2020 16:51:17 +0200 (CEST) Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id AE7B91C0BD for ; Sat, 15 Aug 2020 16:51:16 +0200 (CEST) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id 07FEpBpN010743 for ; Sat, 15 Aug 2020 07:51:12 -0700 From: Rahul Lakkireddy To: stable@dpdk.org Date: Sat, 15 Aug 2020 20:07:18 +0530 Message-Id: <1597502238-20516-1-git-send-email-rahul.lakkireddy@chelsio.com> X-Mailer: git-send-email 2.5.3 Subject: [dpdk-stable] [PATCH 19.11] net/cxgbe: fix L2T leak in filter error and free path 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit e0e1496be5fcabd31807ef9981c421963a9f8578 ] Free up Layer 2 Table (L2T) entry properly during filter create failure and filter delete. Fixes: 1decc62b1cbe ("net/cxgbe: add flow operations to offload VLAN actions") Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_filter.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 07337bb4b..7affa0785 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -281,6 +281,9 @@ static void clear_filter(struct filter_entry *f) if (f->clipt) cxgbe_clip_release(f->dev, f->clipt); + if (f->l2t) + cxgbe_l2t_release(f->l2t); + if (f->fs.mask.macidx) cxgbe_mpstcam_remove(pi, f->fs.val.macidx); @@ -735,19 +738,6 @@ static int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx) unsigned int port_id = ethdev2pinfo(dev)->port_id; int ret; - /* - * If the new filter requires loopback Destination MAC and/or VLAN - * rewriting then we need to allocate a Layer 2 Table (L2T) entry for - * the filter. - */ - if (f->fs.newvlan) { - /* allocate L2T entry for new filter */ - f->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan, - f->fs.eport, f->fs.dmac); - if (!f->l2t) - return -ENOMEM; - } - ctrlq = &adapter->sge.ctrlq[port_id]; mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool); if (!mbuf) { @@ -1057,6 +1047,19 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id, } } + /* If the new filter requires loopback Destination MAC and/or VLAN + * rewriting then we need to allocate a Layer 2 Table (L2T) entry for + * the filter. + */ + if (f->fs.newvlan) { + f->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan, + f->fs.eport, f->fs.dmac); + if (!f->l2t) { + ret = -ENOMEM; + goto free_tid; + } + } + /* * Attempt to set the filter. If we don't succeed, we clear * it and return the failure. -- 2.24.0