get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 93841,
    "url": "http://patches.dpdk.org/api/patches/93841/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/5ef2283e6487eecf8f421168fd3018854f7c0f45.1622676125.git.rahul.lakkireddy@chelsio.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<5ef2283e6487eecf8f421168fd3018854f7c0f45.1622676125.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/5ef2283e6487eecf8f421168fd3018854f7c0f45.1622676125.git.rahul.lakkireddy@chelsio.com",
    "date": "2021-06-02T21:57:51",
    "name": "[2/2] net/cxgbe: add MAC matchall to track promisc traffic",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "9c166adf63590a42d6b4224f7f02d12304659fd6",
    "submitter": {
        "id": 241,
        "url": "http://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/5ef2283e6487eecf8f421168fd3018854f7c0f45.1622676125.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 17217,
            "url": "http://patches.dpdk.org/api/series/17217/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=17217",
            "date": "2021-06-02T21:57:49",
            "name": "net/cxgbe: add RAW MAC matchall filter support",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/17217/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/93841/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/93841/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id CE1E2A0524;\n\tThu,  3 Jun 2021 01:59:01 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EBAF1410E7;\n\tThu,  3 Jun 2021 01:58:55 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n by mails.dpdk.org (Postfix) with ESMTP id 972DD410EF\n for <dev@dpdk.org>; Thu,  3 Jun 2021 01:58:53 +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 152NwpqF007563\n for <dev@dpdk.org>; Wed, 2 Jun 2021 16:58:51 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu,  3 Jun 2021 03:27:51 +0530",
        "Message-Id": "\n <5ef2283e6487eecf8f421168fd3018854f7c0f45.1622676125.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1622676125.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1622676125.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1622676125.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1622676125.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 2/2] net/cxgbe: add MAC matchall to track promisc\n traffic",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "Chelsio T6 ASIC doesn't track Rx promisc traffic dropped due to lack\nof Rx buffers and hence the imissed counter doesn't increment. Add\nsupport for RAW MAC filter to insert a wildcard matchall rule at\nthe end of MPS TCAM to make MPS track the promisc traffic. This\nrule will only be added/removed when promisc mode is turned on/off\non the interface.\n\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n doc/guides/nics/cxgbe.rst               | 14 ++---\n drivers/net/cxgbe/base/common.h         |  3 +\n drivers/net/cxgbe/base/t4fw_interface.h |  2 +\n drivers/net/cxgbe/cxgbe_ethdev.c        | 14 +++++\n drivers/net/cxgbe/cxgbe_main.c          | 14 +++++\n drivers/net/cxgbe/mps_tcam.c            | 75 ++++++++++++++++++++++++-\n drivers/net/cxgbe/mps_tcam.h            |  4 +-\n 7 files changed, 115 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst\nindex 4a8fef07b8..a1d30c488b 100644\n--- a/doc/guides/nics/cxgbe.rst\n+++ b/doc/guides/nics/cxgbe.rst\n@@ -70,7 +70,7 @@ in :ref:`t5-nics` and :ref:`t6-nics`.\n Prerequisites\n -------------\n \n-- Requires firmware version **1.25.4.0** and higher. Visit\n+- Requires firmware version **1.25.6.0** and higher. Visit\n   `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware\n   bundled with the latest Chelsio Unified Wire package.\n \n@@ -404,7 +404,7 @@ Unified Wire package for Linux operating system are as follows:\n \n    .. code-block:: console\n \n-      firmware-version: 1.25.4.0, TP 0.1.23.2\n+      firmware-version: 1.25.6.0, TP 0.1.23.2\n \n Running testpmd\n ~~~~~~~~~~~~~~~\n@@ -462,7 +462,7 @@ devices managed by librte_net_cxgbe in Linux operating system.\n       EAL:   PCI memory mapped at 0x7fd7c0200000\n       EAL:   PCI memory mapped at 0x7fd77cdfd000\n       EAL:   PCI memory mapped at 0x7fd7c10b7000\n-      PMD: rte_cxgbe_pmd: fw: 1.25.4.0, TP: 0.1.23.2\n+      PMD: rte_cxgbe_pmd: fw: 1.25.6.0, TP: 0.1.23.2\n       PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter\n       Interactive-mode selected\n       Configuring Port 0 (socket 0)\n@@ -568,7 +568,7 @@ virtual functions.\n       [...]\n       EAL: PCI device 0000:02:01.0 on NUMA socket 0\n       EAL:   probe driver: 1425:5803 net_cxgbevf\n-      PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.0\n+      PMD: rte_cxgbe_pmd: Firmware version: 1.25.6.0\n       PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2\n       PMD: rte_cxgbe_pmd: Chelsio rev 0\n       PMD: rte_cxgbe_pmd: No bootstrap loaded\n@@ -576,7 +576,7 @@ virtual functions.\n       PMD: rte_cxgbe_pmd:  0000:02:01.0 Chelsio rev 0 1G/10GBASE-SFP\n       EAL: PCI device 0000:02:01.1 on NUMA socket 0\n       EAL:   probe driver: 1425:5803 net_cxgbevf\n-      PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.0\n+      PMD: rte_cxgbe_pmd: Firmware version: 1.25.6.0\n       PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2\n       PMD: rte_cxgbe_pmd: Chelsio rev 0\n       PMD: rte_cxgbe_pmd: No bootstrap loaded\n@@ -654,7 +654,7 @@ Unified Wire package for FreeBSD operating system are as follows:\n \n    .. code-block:: console\n \n-      dev.t5nex.0.firmware_version: 1.25.4.0\n+      dev.t5nex.0.firmware_version: 1.25.6.0\n \n Running testpmd\n ~~~~~~~~~~~~~~~\n@@ -772,7 +772,7 @@ devices managed by librte_net_cxgbe in FreeBSD operating system.\n       EAL:   PCI memory mapped at 0x8007ec000\n       EAL:   PCI memory mapped at 0x842800000\n       EAL:   PCI memory mapped at 0x80086c000\n-      PMD: rte_cxgbe_pmd: fw: 1.25.4.0, TP: 0.1.23.2\n+      PMD: rte_cxgbe_pmd: fw: 1.25.6.0, TP: 0.1.23.2\n       PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter\n       Interactive-mode selected\n       Configuring Port 0 (socket 0)\ndiff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h\nindex 2f8569cbbc..58d7d7a8f2 100644\n--- a/drivers/net/cxgbe/base/common.h\n+++ b/drivers/net/cxgbe/base/common.h\n@@ -266,6 +266,9 @@ struct adapter_params {\n \tu32 viid_smt_extn_support:1;\t  /* FW returns vin and smt index */\n \tu32 max_tx_coalesce_num; /* Max # of Tx packets that can be coalesced */\n \tu8 vi_enable_rx; /* FW support for enable/disable VI Rx at runtime */\n+\n+\tu16 rawf_start; /* FW supports RAW MAC match-all filters */\n+\tu16 rawf_size;\n };\n \n /* Firmware Port Capabilities types.\ndiff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h\nindex 0310a7ce8b..a0a9292c0c 100644\n--- a/drivers/net/cxgbe/base/t4fw_interface.h\n+++ b/drivers/net/cxgbe/base/t4fw_interface.h\n@@ -703,6 +703,8 @@ enum fw_params_param_dev {\n \tFW_PARAMS_PARAM_DEV_HASHFILTER_WITH_OFLD = 0x28,\n \tFW_PARAMS_PARAM_DEV_FILTER      = 0x2E,\n \tFW_PARAMS_PARAM_DEV_VI_ENABLE_INGRESS_AFTER_LINKUP = 0x32,\n+\tFW_PARAMS_PARAM_PFVF_RAWF_START = 0x36,\n+\tFW_PARAMS_PARAM_PFVF_RAWF_END   = 0x37,\n };\n \n /*\ndiff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c\nindex b88f80fd3e..550843b4d7 100644\n--- a/drivers/net/cxgbe/cxgbe_ethdev.c\n+++ b/drivers/net/cxgbe/cxgbe_ethdev.c\n@@ -152,6 +152,13 @@ int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)\n {\n \tstruct port_info *pi = eth_dev->data->dev_private;\n \tstruct adapter *adapter = pi->adapter;\n+\tint ret;\n+\n+\tif (adapter->params.rawf_size != 0) {\n+\t\tret = cxgbe_mpstcam_rawf_enable(pi);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n \n \treturn t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,\n \t\t\t     1, -1, 1, -1, false);\n@@ -161,6 +168,13 @@ int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)\n {\n \tstruct port_info *pi = eth_dev->data->dev_private;\n \tstruct adapter *adapter = pi->adapter;\n+\tint ret;\n+\n+\tif (adapter->params.rawf_size != 0) {\n+\t\tret = cxgbe_mpstcam_rawf_disable(pi);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n \n \treturn t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,\n \t\t\t     0, -1, 1, -1, false);\ndiff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c\nindex b14ce283ed..6dd1bf1f83 100644\n--- a/drivers/net/cxgbe/cxgbe_main.c\n+++ b/drivers/net/cxgbe/cxgbe_main.c\n@@ -1501,6 +1501,20 @@ static int adap_init0(struct adapter *adap)\n \tret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, params, val);\n \tadap->params.vi_enable_rx = (ret == 0 && val[0] != 0);\n \n+\t/* Read the RAW MPS entries. In T6, the last 2 TCAM entries\n+\t * are reserved for RAW MAC addresses (rawf = 2, one per port).\n+\t */\n+\tif (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {\n+\t\tparams[0] = CXGBE_FW_PARAM_PFVF(RAWF_START);\n+\t\tparams[1] = CXGBE_FW_PARAM_PFVF(RAWF_END);\n+\t\tret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2,\n+\t\t\t\t      params, val);\n+\t\tif (ret == 0) {\n+\t\t\tadap->params.rawf_start = val[0];\n+\t\t\tadap->params.rawf_size = val[1] - val[0] + 1;\n+\t\t}\n+\t}\n+\n \t/*\n \t * The MTU/MSS Table is initialized by now, so load their values.  If\n \t * we're initializing the adapter, then we'll make any modifications\ndiff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c\nindex 178921b701..abbf06e1a1 100644\n--- a/drivers/net/cxgbe/mps_tcam.c\n+++ b/drivers/net/cxgbe/mps_tcam.c\n@@ -49,7 +49,8 @@ cxgbe_mpstcam_lookup(struct mpstcam_table *t, const u8 *eth_addr,\n \t\treturn NULL;\n \n \tfor (i = 0; i < t->size; i++) {\n-\t\tif (entry[i].state == MPS_ENTRY_UNUSED)\n+\t\tif (entry[i].state == MPS_ENTRY_UNUSED ||\n+\t\t    entry[i].state == MPS_ENTRY_RAWF)\n \t\t\tcontinue;\t/* entry is not being used */\n \t\tif (match_entry(&entry[i], eth_addr, mask))\n \t\t\treturn &entry[i];\n@@ -184,7 +185,7 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)\n \t\treturn -EOPNOTSUPP;\n \tt4_os_write_lock(&t->lock);\n \tentry = &t->entry[idx];\n-\tif (entry->state == MPS_ENTRY_UNUSED) {\n+\tif (entry->state != MPS_ENTRY_USED) {\n \t\tt4_os_write_unlock(&t->lock);\n \t\treturn -EINVAL;\n \t}\n@@ -206,11 +207,73 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)\n \treturn ret;\n }\n \n+int cxgbe_mpstcam_rawf_enable(struct port_info *pi)\n+{\n+\tstruct adapter *adap = pi->adapter;\n+\tstruct mps_tcam_entry *entry;\n+\tstruct mpstcam_table *t;\n+\tu16 rawf_idx;\n+\tint ret = 0;\n+\n+\tt = adap->mpstcam;\n+\tif (adap->params.rawf_size == 0 || t == NULL)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tt4_os_write_lock(&t->lock);\n+\trawf_idx = adap->params.rawf_start + pi->port_id;\n+\tentry = &t->entry[rawf_idx];\n+\tif (__atomic_load_n(&entry->refcnt, __ATOMIC_RELAXED) == 1)\n+\t\tgoto out_unlock;\n+\n+\tret = t4_alloc_raw_mac_filt(adap, pi->viid, entry->eth_addr,\n+\t\t\t\t    entry->mask, rawf_idx, 0, pi->port_id,\n+\t\t\t\t    false);\n+\tif (ret < 0)\n+\t\tgoto out_unlock;\n+\n+\t__atomic_store_n(&entry->refcnt, 1, __ATOMIC_RELAXED);\n+\n+out_unlock:\n+\tt4_os_write_unlock(&t->lock);\n+\treturn ret;\n+}\n+\n+int cxgbe_mpstcam_rawf_disable(struct port_info *pi)\n+{\n+\tstruct adapter *adap = pi->adapter;\n+\tstruct mps_tcam_entry *entry;\n+\tstruct mpstcam_table *t;\n+\tu16 rawf_idx;\n+\tint ret = 0;\n+\n+\tt = adap->mpstcam;\n+\tif (adap->params.rawf_size == 0 || t == NULL)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tt4_os_write_lock(&t->lock);\n+\trawf_idx = adap->params.rawf_start + pi->port_id;\n+\tentry = &t->entry[rawf_idx];\n+\tif (__atomic_load_n(&entry->refcnt, __ATOMIC_RELAXED) != 1)\n+\t\tgoto out_unlock;\n+\n+\tret = t4_free_raw_mac_filt(adap, pi->viid, entry->eth_addr,\n+\t\t\t\t   entry->mask, rawf_idx, 0, pi->port_id,\n+\t\t\t\t   false);\n+\tif (ret < 0)\n+\t\tgoto out_unlock;\n+\n+\t__atomic_store_n(&entry->refcnt, 0, __ATOMIC_RELAXED);\n+\n+out_unlock:\n+\tt4_os_write_unlock(&t->lock);\n+\treturn ret;\n+}\n+\n struct mpstcam_table *t4_init_mpstcam(struct adapter *adap)\n {\n+\tu16 size = adap->params.arch.mps_tcam_size;\n \tstruct mpstcam_table *t;\n \tint i;\n-\tu16 size = adap->params.arch.mps_tcam_size;\n \n \tt =  t4_os_alloc(sizeof(*t) + size * sizeof(struct mps_tcam_entry));\n \tif (!t)\n@@ -226,6 +289,12 @@ struct mpstcam_table *t4_init_mpstcam(struct adapter *adap)\n \t\tt->entry[i].idx = i;\n \t}\n \n+\t/* RAW MAC entries are reserved for match-all wildcard to\n+\t * match all promiscuous traffic. So, mark them special.\n+\t */\n+\tfor (i = 0; i < adap->params.rawf_size; i++)\n+\t\tt->entry[adap->params.rawf_start + i].state = MPS_ENTRY_RAWF;\n+\n \t/* first entry is used by chip. this is overwritten only\n \t * in t4_cleanup_mpstcam()\n \t */\ndiff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h\nindex 998c2b59df..a359f52442 100644\n--- a/drivers/net/cxgbe/mps_tcam.h\n+++ b/drivers/net/cxgbe/mps_tcam.h\n@@ -17,6 +17,7 @@ enum {\n \t\t\t\t * for a specific entry\n \t\t\t\t */\n \tMPS_ENTRY_USED,\n+\tMPS_ENTRY_RAWF, /* Reserved for RAW MAC Filters */\n };\n \n struct mps_tcam_entry {\n@@ -48,5 +49,6 @@ void t4_cleanup_mpstcam(struct adapter *adap);\n int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *mac, const u8 *mask);\n int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx);\n int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr);\n-\n+int cxgbe_mpstcam_rawf_enable(struct port_info *pi);\n+int cxgbe_mpstcam_rawf_disable(struct port_info *pi);\n #endif /* _CXGBE_MPSTCAM_H_ */\n",
    "prefixes": [
        "2/2"
    ]
}