get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/71486/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 71486,
    "url": "https://patches.dpdk.org/api/patches/71486/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/98c3a261b8e69bbf58fcc65d7d741be04421615c.1591998771.git.rahul.lakkireddy@chelsio.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<98c3a261b8e69bbf58fcc65d7d741be04421615c.1591998771.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/98c3a261b8e69bbf58fcc65d7d741be04421615c.1591998771.git.rahul.lakkireddy@chelsio.com",
    "date": "2020-06-12T22:07:25",
    "name": "[3/5] net/cxgbe: fix double MPS alloc due to flow validate and create",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "272ab6e71cccf604076c6c5739b5b6993d049d06",
    "submitter": {
        "id": 241,
        "url": "https://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/98c3a261b8e69bbf58fcc65d7d741be04421615c.1591998771.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 10446,
            "url": "https://patches.dpdk.org/api/series/10446/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10446",
            "date": "2020-06-12T22:07:22",
            "name": "net/cxgbe: fix rte_flow related hardware resource leaks",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/10446/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/71486/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/71486/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8A853A00BE;\n\tSat, 13 Jun 2020 00:20:33 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 25C491C199;\n\tSat, 13 Jun 2020 00:20:26 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n by dpdk.org (Postfix) with ESMTP id BBDBF1C198;\n Sat, 13 Jun 2020 00:20:24 +0200 (CEST)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id 05CMKMWo009575;\n Fri, 12 Jun 2020 15:20:23 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org, nirranjan@chelsio.com",
        "Date": "Sat, 13 Jun 2020 03:37:25 +0530",
        "Message-Id": "\n <98c3a261b8e69bbf58fcc65d7d741be04421615c.1591998771.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1591998771.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1591998771.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1591998771.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1591998771.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 3/5] net/cxgbe: fix double MPS alloc due to flow\n\tvalidate and create",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The Multi Port Switch (MPS) entry is allocated twice when both\nflow validate and create are invoked, but only freed once during\nflow destroy. Avoid double alloc by moving MPS entry allocation\ncloser to when the filter create request is sent to hardware and\nwill be ignored for filter validate request.\n\nFixes: fefee7a619a4 (\"net/cxgbe: add flow ops to match based on dest MAC\")\nCc: stable@dpdk.org\n\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n drivers/net/cxgbe/cxgbe_filter.c | 32 ++++++++++++++++++++++++++++++++\n drivers/net/cxgbe/cxgbe_filter.h |  4 +++-\n drivers/net/cxgbe/cxgbe_flow.c   | 28 +++-------------------------\n 3 files changed, 38 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c\nindex 06233e41e..317830f58 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.c\n+++ b/drivers/net/cxgbe/cxgbe_filter.c\n@@ -8,6 +8,7 @@\n #include \"base/t4_tcb.h\"\n #include \"base/t4_regs.h\"\n #include \"cxgbe_filter.h\"\n+#include \"mps_tcam.h\"\n #include \"clip_tbl.h\"\n #include \"l2t.h\"\n #include \"smt.h\"\n@@ -290,12 +291,17 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)\n  */\n static void clear_filter(struct filter_entry *f)\n {\n+\tstruct port_info *pi = ethdev2pinfo(f->dev);\n+\n \tif (f->clipt)\n \t\tcxgbe_clip_release(f->dev, f->clipt);\n \n \tif (f->l2t)\n \t\tcxgbe_l2t_release(f->l2t);\n \n+\tif (f->fs.mask.macidx)\n+\t\tcxgbe_mpstcam_remove(pi, f->fs.val.macidx);\n+\n \t/* The zeroing of the filter rule below clears the filter valid,\n \t * pending, locked flags etc. so it's all we need for\n \t * this operation.\n@@ -609,6 +615,19 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,\n \tf->dev = dev;\n \tf->fs.iq = iq;\n \n+\t/* Allocate MPS TCAM entry to match Destination MAC. */\n+\tif (f->fs.mask.macidx) {\n+\t\tint idx;\n+\n+\t\tidx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac);\n+\t\tif (idx <= 0) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto out_err;\n+\t\t}\n+\n+\t\tf->fs.val.macidx = idx;\n+\t}\n+\n \t/*\n \t * If the new filter requires loopback Destination MAC and/or VLAN\n \t * rewriting then we need to allocate a Layer 2 Table (L2T) entry for\n@@ -1067,6 +1086,19 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,\n \tf->fs.iq = iq;\n \tf->dev = dev;\n \n+\t/* Allocate MPS TCAM entry to match Destination MAC. */\n+\tif (f->fs.mask.macidx) {\n+\t\tint idx;\n+\n+\t\tidx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac);\n+\t\tif (idx <= 0) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto free_tid;\n+\t\t}\n+\n+\t\tf->fs.val.macidx = idx;\n+\t}\n+\n \t/* Allocate a clip table entry only if we have non-zero IPv6 address. */\n \tif (chip_ver > CHELSIO_T5 && f->fs.type &&\n \t    memcmp(f->fs.val.lip, bitoff, sizeof(bitoff))) {\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h\nindex e79c052de..46ebf8333 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.h\n+++ b/drivers/net/cxgbe/cxgbe_filter.h\n@@ -69,8 +69,10 @@ struct ch_filter_tuple {\n \tuint16_t lport;\t\t/* local port */\n \tuint16_t fport;\t\t/* foreign port */\n \n+\tuint8_t dmac[6];        /* Destination MAC to match */\n+\n \t/* reservations for future additions */\n-\tuint8_t rsvd[12];\n+\tuint8_t rsvd[6];\n };\n \n /*\ndiff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c\nindex 166c39ba5..dd8ee7bbd 100644\n--- a/drivers/net/cxgbe/cxgbe_flow.c\n+++ b/drivers/net/cxgbe/cxgbe_flow.c\n@@ -194,20 +194,9 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,\n \t\t\t\t\t  \"src mac filtering not supported\");\n \n \tif (!rte_is_zero_ether_addr(&mask->dst)) {\n-\t\tconst u8 *addr = (const u8 *)&spec->dst.addr_bytes[0];\n-\t\tconst u8 *m = (const u8 *)&mask->dst.addr_bytes[0];\n-\t\tstruct rte_flow *flow = (struct rte_flow *)fs->private;\n-\t\tstruct port_info *pi = (struct port_info *)\n-\t\t\t\t\t(flow->dev->data->dev_private);\n-\t\tint idx;\n-\n-\t\tidx = cxgbe_mpstcam_alloc(pi, addr, m);\n-\t\tif (idx <= 0)\n-\t\t\treturn rte_flow_error_set(e, idx,\n-\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ITEM,\n-\t\t\t\t\t\t  NULL, \"unable to allocate mac\"\n-\t\t\t\t\t\t  \" entry in h/w\");\n-\t\tCXGBE_FILL_FS(idx, 0x1ff, macidx);\n+\t\tCXGBE_FILL_FS(0, 0x1ff, macidx);\n+\t\tCXGBE_FILL_FS_MEMCPY(spec->dst.addr_bytes, mask->dst.addr_bytes,\n+\t\t\t\t     dmac);\n \t}\n \n \tCXGBE_FILL_FS(be16_to_cpu(spec->type),\n@@ -1212,17 +1201,6 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)\n \t\treturn ctx.result;\n \t}\n \n-\tfs = &flow->fs;\n-\tif (fs->mask.macidx) {\n-\t\tstruct port_info *pi = (struct port_info *)\n-\t\t\t\t\t(dev->data->dev_private);\n-\t\tint ret;\n-\n-\t\tret = cxgbe_mpstcam_remove(pi, fs->val.macidx);\n-\t\tif (!ret)\n-\t\t\treturn ret;\n-\t}\n-\n \treturn 0;\n }\n \n",
    "prefixes": [
        "3/5"
    ]
}