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 9184CA04B7 for ; Wed, 2 Sep 2020 11:12:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D569E07; Wed, 2 Sep 2020 11:12:25 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 35EFBE07 for ; Wed, 2 Sep 2020 11:12:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599037943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8BK4utugDZcXS6kTTUpRElhPAlde96JezMehxd8i1k=; b=DuM2TZ6iNC8HJCa0HBkAOSL6EdQZhDKh6CTHIEg7jI+Y4S921imHCY7/MKTZDS6Xyr+QtG OHxdX6gCfoZ8sISW2Hv0cqvUerUniF/MclbtydjfCoKJn3/xvaMAIuZ5kWzi1zsPrNtRDp z85TJuE0EhOG6p2NqDjTY+da31eg2gU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-Um9ctZ1XMiuV7tHX4ou-Vg-1; Wed, 02 Sep 2020 05:12:20 -0400 X-MC-Unique: Um9ctZ1XMiuV7tHX4ou-Vg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39B6B802B46; Wed, 2 Sep 2020 09:12:19 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 675825D9CC; Wed, 2 Sep 2020 09:12:18 +0000 (UTC) From: Kevin Traynor To: Rahul Lakkireddy Cc: dpdk stable Date: Wed, 2 Sep 2020 10:12:01 +0100 Message-Id: <20200902091201.123509-2-ktraynor@redhat.com> In-Reply-To: <20200902091201.123509-1-ktraynor@redhat.com> References: <20200902091201.123509-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/cxgbe: fix double MPS alloc by flow validate and create' has been queued to LTS release 18.11.10 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" Hi, FYI, your patch has been queued to LTS release 18.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 09/04/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/b82919008c7462a0f2e117e65210754ccb7470f1 Thanks. Kevin. --- >From b82919008c7462a0f2e117e65210754ccb7470f1 Mon Sep 17 00:00:00 2001 From: Rahul Lakkireddy Date: Sat, 13 Jun 2020 03:37:25 +0530 Subject: [PATCH] net/cxgbe: fix double MPS alloc by flow validate and create [ upstream commit be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 ] The Multi Port Switch (MPS) entry is allocated twice when both flow validate and create are invoked, but only freed once during flow destroy. Avoid double alloc by moving MPS entry allocation closer to when the filter create request is sent to hardware and will be ignored for filter validate request. Fixes: fefee7a619a4 ("net/cxgbe: add flow ops to match based on dest MAC") Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_filter.c | 32 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 4 +++- drivers/net/cxgbe/cxgbe_flow.c | 28 +++------------------------- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 489c23249c..ffb669731e 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -8,4 +8,5 @@ #include "t4_regs.h" #include "cxgbe_filter.h" +#include "mps_tcam.h" #include "clip_tbl.h" #include "l2t.h" @@ -274,7 +275,12 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries) static void clear_filter(struct filter_entry *f) { + struct port_info *pi = ethdev2pinfo(f->dev); + if (f->clipt) cxgbe_clip_release(f->dev, f->clipt); + if (f->fs.mask.macidx) + cxgbe_mpstcam_remove(pi, f->fs.val.macidx); + /* The zeroing of the filter rule below clears the filter valid, * pending, locked flags etc. so it's all we need for @@ -574,4 +580,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev, f->fs.iq = iq; + /* Allocate MPS TCAM entry to match Destination MAC. */ + if (f->fs.mask.macidx) { + int idx; + + idx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac); + if (idx <= 0) { + ret = -ENOMEM; + goto out_err; + } + + f->fs.val.macidx = idx; + } + /* * If the new filter requires loopback Destination MAC and/or VLAN @@ -1006,4 +1025,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id, f->dev = dev; + /* Allocate MPS TCAM entry to match Destination MAC. */ + if (f->fs.mask.macidx) { + int idx; + + idx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac); + if (idx <= 0) { + ret = -ENOMEM; + goto free_tid; + } + + f->fs.val.macidx = idx; + } + /* Allocate a clip table entry only if we have non-zero IPv6 address. */ if (chip_ver > CHELSIO_T5 && f->fs.type && diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h index 06bac8ef09..5f7ca9c5c6 100644 --- a/drivers/net/cxgbe/cxgbe_filter.h +++ b/drivers/net/cxgbe/cxgbe_filter.h @@ -70,6 +70,8 @@ struct ch_filter_tuple { uint16_t fport; /* foreign port */ + uint8_t dmac[6]; /* Destination MAC to match */ + /* reservations for future additions */ - uint8_t rsvd[12]; + uint8_t rsvd[6]; }; diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index d2466f29e4..feb5bb8bd2 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -122,18 +122,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, if (!is_zero_ether_addr(&mask->dst)) { - const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0]; - const u8 *m = (const u8 *)&mask->dst.addr_bytes[0]; - struct rte_flow *flow = (struct rte_flow *)fs->private; - struct port_info *pi = (struct port_info *) - (flow->dev->data->dev_private); - int idx; - - idx = cxgbe_mpstcam_alloc(pi, addr, m); - if (idx <= 0) - return rte_flow_error_set(e, idx, - RTE_FLOW_ERROR_TYPE_ITEM, - NULL, "unable to allocate mac" - " entry in h/w"); - CXGBE_FILL_FS(idx, 0x1ff, macidx); + CXGBE_FILL_FS(0, 0x1ff, macidx); + CXGBE_FILL_FS_MEMCPY(spec->dst.addr_bytes, mask->dst.addr_bytes, + dmac); } @@ -922,15 +911,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow) } - fs = &flow->fs; - if (fs->mask.macidx) { - struct port_info *pi = (struct port_info *) - (dev->data->dev_private); - int ret; - - ret = cxgbe_mpstcam_remove(pi, fs->val.macidx); - if (!ret) - return ret; - } - return 0; } -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-09-02 10:08:36.612933337 +0100 +++ 0002-net-cxgbe-fix-double-MPS-alloc-by-flow-validate-and-.patch 2020-09-02 10:08:36.560496766 +0100 @@ -1 +1 @@ -From be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 Mon Sep 17 00:00:00 2001 +From b82919008c7462a0f2e117e65210754ccb7470f1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 06233e41e7..317830f58b 100644 +index 489c23249c..ffb669731e 100644 @@ -26,2 +27,2 @@ -@@ -9,4 +9,5 @@ - #include "base/t4_regs.h" +@@ -8,4 +8,5 @@ + #include "t4_regs.h" @@ -32 +33 @@ -@@ -291,4 +292,6 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries) +@@ -274,7 +275,12 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries) @@ -39,2 +39,0 @@ -@@ -297,4 +300,7 @@ static void clear_filter(struct filter_entry *f) - cxgbe_l2t_release(f->l2t); @@ -47 +46 @@ -@@ -610,4 +616,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev, +@@ -574,4 +580,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev, @@ -65 +64 @@ -@@ -1068,4 +1087,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id, +@@ -1006,4 +1025,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id, @@ -84 +83 @@ -index e79c052de6..46ebf83338 100644 +index 06bac8ef09..5f7ca9c5c6 100644 @@ -98 +97 @@ -index 166c39ba55..dd8ee7bbd6 100644 +index d2466f29e4..feb5bb8bd2 100644 @@ -101 +100 @@ -@@ -195,18 +195,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, +@@ -122,18 +122,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, @@ -103 +102 @@ - if (!rte_is_zero_ether_addr(&mask->dst)) { + if (!is_zero_ether_addr(&mask->dst)) { @@ -123 +122 @@ -@@ -1213,15 +1202,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow) +@@ -922,15 +911,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)