get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74085,
    "url": "http://patches.dpdk.org/api/patches/74085/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200715195329.34699-2-chenmin.sun@intel.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": "<20200715195329.34699-2-chenmin.sun@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200715195329.34699-2-chenmin.sun@intel.com",
    "date": "2020-07-15T19:53:26",
    "name": "[V4,1/4] net/i40e: introducing the fdir space tracking",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3870d052a20424b8d0ec664e75f3aa9b6bcaf3b1",
    "submitter": {
        "id": 1212,
        "url": "http://patches.dpdk.org/api/people/1212/?format=api",
        "name": "Chenmin Sun",
        "email": "chenmin.sun@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200715195329.34699-2-chenmin.sun@intel.com/mbox/",
    "series": [
        {
            "id": 11046,
            "url": "http://patches.dpdk.org/api/series/11046/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11046",
            "date": "2020-07-15T19:53:25",
            "name": "i40e FDIR update rate optimization",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/11046/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74085/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/74085/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 30B57A0545;\n\tWed, 15 Jul 2020 12:56:43 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C64761BEDD;\n\tWed, 15 Jul 2020 12:56:38 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 4C4751BED7\n for <dev@dpdk.org>; Wed, 15 Jul 2020 12:56:36 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 15 Jul 2020 03:56:36 -0700",
            "from npg-dpdk-vpp-scm-1.sh.intel.com ([10.67.118.226])\n by orsmga005.jf.intel.com with ESMTP; 15 Jul 2020 03:56:34 -0700"
        ],
        "IronPort-SDR": [
            "\n fOM+/6pSi9CcMaTl7LnWdapalmGjc1HjdREE2tFyqkzRUuAIVvdKIB9hZEgHKOvRLCthuOOtnP\n dEPNmn0bK0RA==",
            "\n gPnLvR56HmWedPZtlFRXBnhysrcMjBJUX4AgAMtfAMxWyFfX6zy4VdBbfdhuQDmTdWK6zRcqcY\n rlwVWP3YSVWA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9682\"; a=\"137249740\"",
            "E=Sophos;i=\"5.75,355,1589266800\"; d=\"scan'208\";a=\"137249740\"",
            "E=Sophos;i=\"5.75,355,1589266800\"; d=\"scan'208\";a=\"460026042\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "chenmin.sun@intel.com",
        "To": "qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com,\n haiyue.wang@intel.com",
        "Cc": "dev@dpdk.org,\n\tchenmin.sun@intel.com",
        "Date": "Thu, 16 Jul 2020 03:53:26 +0800",
        "Message-Id": "<20200715195329.34699-2-chenmin.sun@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200715195329.34699-1-chenmin.sun@intel.com>",
        "References": "<20200713222321.2118-1-chenmin.sun@intel.com>\n <20200715195329.34699-1-chenmin.sun@intel.com>",
        "Subject": "[dpdk-dev] [PATCH V4 1/4] net/i40e: introducing the fdir space\n\ttracking",
        "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": "From: Chenmin Sun <chenmin.sun@intel.com>\n\nThis patch introduces a fdir flow management for guaranteed/shared\nspace tracking.\nThe fdir space is reported by the\ni40e_hw_capabilities.fd_filters_guaranteed and fd_filters_best_effort.\nThe fdir space is managed by hardware and now is tracking in software.\nThe management algorithm is controlled by the GLQF_CTL.INVALPRIO.\nDetailed implementation please check in the datasheet and the\ndescription of struct i40e_fdir_info.fdir_invalprio.\n\nThis patch changes the global register GLQF_CTL. Therefore, when devarg\n``support-multi-driver`` is set, the patch will not take effect to\navoid affecting the normal behavior of other i40e drivers, e.g., Linux\nkernel driver.\n\nSigned-off-by: Chenmin Sun <chenmin.sun@intel.com>\n---\n drivers/net/i40e/i40e_ethdev.c | 41 ++++++++++++++++++++++++++++++++++\n drivers/net/i40e/i40e_ethdev.h | 28 +++++++++++++++++++++--\n drivers/net/i40e/i40e_fdir.c   | 16 +++++++++++++\n drivers/net/i40e/i40e_flow.c   |  5 +++++\n drivers/net/i40e/i40e_rxtx.c   |  1 +\n 5 files changed, 89 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 393b5320f..dca84a1f1 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -26,6 +26,7 @@\n #include <rte_dev.h>\n #include <rte_tailq.h>\n #include <rte_hash_crc.h>\n+#include <rte_bitmap.h>\n \n #include \"i40e_logs.h\"\n #include \"base/i40e_prototype.h\"\n@@ -1045,8 +1046,11 @@ static int\n i40e_init_fdir_filter_list(struct rte_eth_dev *dev)\n {\n \tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n \tstruct i40e_fdir_info *fdir_info = &pf->fdir;\n \tchar fdir_hash_name[RTE_HASH_NAMESIZE];\n+\tuint32_t alloc = hw->func_caps.fd_filters_guaranteed;\n+\tuint32_t best = hw->func_caps.fd_filters_best_effort;\n \tint ret;\n \n \tstruct rte_hash_parameters fdir_hash_params = {\n@@ -1067,6 +1071,7 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)\n \t\tPMD_INIT_LOG(ERR, \"Failed to create fdir hash table!\");\n \t\treturn -EINVAL;\n \t}\n+\n \tfdir_info->hash_map = rte_zmalloc(\"i40e_fdir_hash_map\",\n \t\t\t\t\t  sizeof(struct i40e_fdir_filter *) *\n \t\t\t\t\t  I40E_MAX_FDIR_FILTER_NUM,\n@@ -1077,6 +1082,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)\n \t\tret = -ENOMEM;\n \t\tgoto err_fdir_hash_map_alloc;\n \t}\n+\n+\tfdir_info->fdir_space_size = alloc + best;\n+\tfdir_info->fdir_actual_cnt = 0;\n+\tfdir_info->fdir_guarantee_total_space = alloc;\n+\tfdir_info->fdir_guarantee_free_space =\n+\t\tfdir_info->fdir_guarantee_total_space;\n+\n+\tPMD_DRV_LOG(INFO, \"FDIR guarantee space: %u, best_effort space %u.\", alloc, best);\n+\n \treturn 0;\n \n err_fdir_hash_map_alloc:\n@@ -1101,6 +1115,30 @@ i40e_init_customized_info(struct i40e_pf *pf)\n \tpf->esp_support = false;\n }\n \n+static void\n+i40e_init_filter_invalidation(struct i40e_pf *pf)\n+{\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tstruct i40e_fdir_info *fdir_info = &pf->fdir;\n+\tuint32_t glqf_ctl_reg = 0;\n+\n+\tglqf_ctl_reg = i40e_read_rx_ctl(hw, I40E_GLQF_CTL);\n+\tif (!pf->support_multi_driver) {\n+\t\tfdir_info->fdir_invalprio = 1;\n+\t\tglqf_ctl_reg |= I40E_GLQF_CTL_INVALPRIO_MASK;\n+\t\tPMD_DRV_LOG(INFO, \"FDIR INVALPRIO set to guaranteed first\");\n+\t\ti40e_write_rx_ctl(hw, I40E_GLQF_CTL, glqf_ctl_reg);\n+\t} else {\n+\t\tif (glqf_ctl_reg & I40E_GLQF_CTL_INVALPRIO_MASK) {\n+\t\t\tfdir_info->fdir_invalprio = 1;\n+\t\t\tPMD_DRV_LOG(INFO, \"FDIR INVALPRIO is: guaranteed first\");\n+\t\t} else {\n+\t\t\tfdir_info->fdir_invalprio = 0;\n+\t\t\tPMD_DRV_LOG(INFO, \"FDIR INVALPRIO is: shared first\");\n+\t\t}\n+\t}\n+}\n+\n void\n i40e_init_queue_region_conf(struct rte_eth_dev *dev)\n {\n@@ -1654,6 +1692,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)\n \t/* Initialize customized information */\n \ti40e_init_customized_info(pf);\n \n+\t/* Initialize the filter invalidation configuration */\n+\ti40e_init_filter_invalidation(pf);\n+\n \tret = i40e_init_ethtype_filter_list(dev);\n \tif (ret < 0)\n \t\tgoto err_init_ethtype_filter_list;\ndiff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h\nindex 31ca05de9..eb505c799 100644\n--- a/drivers/net/i40e/i40e_ethdev.h\n+++ b/drivers/net/i40e/i40e_ethdev.h\n@@ -698,6 +698,30 @@ struct i40e_fdir_info {\n \tstruct i40e_fdir_filter **hash_map;\n \tstruct rte_hash *hash_table;\n \n+\t/*\n+\t * Priority ordering at filter invalidation(destroying a flow) between\n+\t * \"best effort\" space and \"guaranteed\" space.\n+\t *\n+\t * 0 = At filter invalidation, the hardware first tries to increment the\n+\t * \"best effort\" space. The \"guaranteed\" space is incremented only when\n+\t * the global \"best effort\" space is at it max value or the \"best effort\"\n+\t * space of the PF is at its max value.\n+\t * 1 = At filter invalidation, the hardware first tries to increment its\n+\t * \"guaranteed\" space. The \"best effort\" space is incremented only when\n+\t * it is already at its max value.\n+\t */\n+\tuint32_t fdir_invalprio;\n+\t/* the total size of the fdir, this number is the sum of the guaranteed +\n+\t * shared space\n+\t */\n+\tuint32_t fdir_space_size;\n+\t/* the actual number of the fdir rules in hardware, initialized as 0 */\n+\tuint32_t fdir_actual_cnt;\n+\t/* the free guaranteed space of the fdir */\n+\tuint32_t fdir_guarantee_free_space;\n+\t/* the fdir total guaranteed space */\n+\tuint32_t fdir_guarantee_total_space;\n+\n \t/* Mark if flex pit and mask is set */\n \tbool flex_pit_flag[I40E_MAX_FLXPLD_LAYER];\n \tbool flex_mask_flag[I40E_FILTER_PCTYPE_MAX];\n@@ -1335,8 +1359,8 @@ int i40e_add_del_fdir_filter(struct rte_eth_dev *dev,\n \t\t\t     const struct rte_eth_fdir_filter *filter,\n \t\t\t     bool add);\n int i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,\n-\t\t\t\t  const struct i40e_fdir_filter_conf *filter,\n-\t\t\t\t  bool add);\n+\t\t\t      const struct i40e_fdir_filter_conf *filter,\n+\t\t\t      bool add);\n int i40e_dev_tunnel_filter_set(struct i40e_pf *pf,\n \t\t\t       struct rte_eth_tunnel_filter_conf *tunnel_filter,\n \t\t\t       uint8_t add);\ndiff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c\nindex 71eb31fb8..c37343f8f 100644\n--- a/drivers/net/i40e/i40e_fdir.c\n+++ b/drivers/net/i40e/i40e_fdir.c\n@@ -21,6 +21,7 @@\n #include <rte_tcp.h>\n #include <rte_sctp.h>\n #include <rte_hash_crc.h>\n+#include <rte_bitmap.h>\n \n #include \"i40e_logs.h\"\n #include \"base/i40e_type.h\"\n@@ -244,6 +245,10 @@ i40e_fdir_setup(struct i40e_pf *pf)\n \tpf->fdir.dma_addr = mz->iova;\n \n \tpf->fdir.match_counter_index = I40E_COUNTER_INDEX_FDIR(hw->pf_id);\n+\tpf->fdir.fdir_actual_cnt = 0;\n+\tpf->fdir.fdir_guarantee_free_space =\n+\t\tpf->fdir.fdir_guarantee_total_space;\n+\n \tPMD_DRV_LOG(INFO, \"FDIR setup successfully, with programming queue %u.\",\n \t\t    vsi->base_queue);\n \treturn I40E_SUCCESS;\n@@ -1762,6 +1767,11 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,\n \t}\n \n \tif (add) {\n+\t\tfdir_info->fdir_actual_cnt++;\n+\t\tif (fdir_info->fdir_invalprio == 1 &&\n+\t\t\t\tfdir_info->fdir_guarantee_free_space > 0)\n+\t\t\tfdir_info->fdir_guarantee_free_space--;\n+\n \t\tfdir_filter = rte_zmalloc(\"fdir_filter\",\n \t\t\t\t\t  sizeof(*fdir_filter), 0);\n \t\tif (fdir_filter == NULL) {\n@@ -1774,6 +1784,12 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,\n \t\tif (ret < 0)\n \t\t\trte_free(fdir_filter);\n \t} else {\n+\t\tfdir_info->fdir_actual_cnt--;\n+\t\tif (fdir_info->fdir_invalprio == 1 &&\n+\t\t\t\tfdir_info->fdir_guarantee_free_space <\n+\t\t\t\tfdir_info->fdir_guarantee_total_space)\n+\t\t\tfdir_info->fdir_guarantee_free_space++;\n+\n \t\tret = i40e_sw_fdir_filter_del(pf, &node->fdir.input);\n \t}\n \ndiff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c\nindex 7cd537340..1f2da7926 100644\n--- a/drivers/net/i40e/i40e_flow.c\n+++ b/drivers/net/i40e/i40e_flow.c\n@@ -17,6 +17,7 @@\n #include <rte_malloc.h>\n #include <rte_tailq.h>\n #include <rte_flow_driver.h>\n+#include <rte_bitmap.h>\n \n #include \"i40e_logs.h\"\n #include \"base/i40e_type.h\"\n@@ -5601,6 +5602,10 @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf)\n \t\t\t}\n \t\t}\n \n+\t\tfdir_info->fdir_actual_cnt = 0;\n+\t\tfdir_info->fdir_guarantee_free_space =\n+\t\t\tfdir_info->fdir_guarantee_total_space;\n+\n \t\tfor (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;\n \t\t     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++)\n \t\t\tpf->fdir.inset_flag[pctype] = 0;\ndiff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c\nindex 2d2efb71a..d21fbeaca 100644\n--- a/drivers/net/i40e/i40e_rxtx.c\n+++ b/drivers/net/i40e/i40e_rxtx.c\n@@ -2989,6 +2989,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)\n \n \ttxq->tx_ring_phys_addr = tz->iova;\n \ttxq->tx_ring = (struct i40e_tx_desc *)tz->addr;\n+\n \t/*\n \t * don't need to allocate software ring and reset for the fdir\n \t * program queue just set the queue has been configured.\n",
    "prefixes": [
        "V4",
        "1/4"
    ]
}