get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81590,
    "url": "http://patches.dpdk.org/api/patches/81590/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201020113242.453712-4-simei.su@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": "<20201020113242.453712-4-simei.su@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201020113242.453712-4-simei.su@intel.com",
    "date": "2020-10-20T11:32:42",
    "name": "[v5,3/3] net/ice: support ACL filter in DCF",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e7b8332c78569ca2bbf7177ee3f700f284b5b557",
    "submitter": {
        "id": 1298,
        "url": "http://patches.dpdk.org/api/people/1298/?format=api",
        "name": "Simei Su",
        "email": "simei.su@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/20201020113242.453712-4-simei.su@intel.com/mbox/",
    "series": [
        {
            "id": 13143,
            "url": "http://patches.dpdk.org/api/series/13143/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13143",
            "date": "2020-10-20T11:32:39",
            "name": "net/ice: support DCF ACL capabiltiy",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/13143/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/81590/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/81590/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 EC5F7A04DC;\n\tTue, 20 Oct 2020 13:42:13 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3BD25BC0A;\n\tTue, 20 Oct 2020 13:41:24 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id DF4C0AC65\n for <dev@dpdk.org>; Tue, 20 Oct 2020 13:41:19 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Oct 2020 04:41:19 -0700",
            "from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com)\n ([10.67.119.195])\n by fmsmga005.fm.intel.com with ESMTP; 20 Oct 2020 04:41:17 -0700"
        ],
        "IronPort-SDR": [
            "\n kH3zmaUuwlkSZywIW4iUxEAZ26ULiyNJ7cqX2Hn38H/+9scmdLgrT59Lc05wuEwG2CqRq2zLR8\n JA2iwmXCVYOQ==",
            "\n OMob/ZRKvIcaIJSm12jnPDrRkHu2VPL7tkjlOo54qTn4dYQGMMJF1eI7rRkYkM7ZRC+FEQEQgx\n YbrQ1YoAE+BQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9779\"; a=\"184819951\"",
            "E=Sophos;i=\"5.77,396,1596524400\"; d=\"scan'208\";a=\"184819951\"",
            "E=Sophos;i=\"5.77,396,1596524400\"; d=\"scan'208\";a=\"523476279\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Simei Su <simei.su@intel.com>",
        "To": "qi.z.zhang@intel.com,\n\tqiming.yang@intel.com",
        "Cc": "dev@dpdk.org, haiyue.wang@intel.com, beilei.xing@intel.com,\n xuan.ding@intel.com, Simei Su <simei.su@intel.com>",
        "Date": "Tue, 20 Oct 2020 19:32:42 +0800",
        "Message-Id": "<20201020113242.453712-4-simei.su@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20201020113242.453712-1-simei.su@intel.com>",
        "References": "<20201016084419.439699-1-simei.su@intel.com>\n <20201020113242.453712-1-simei.su@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 3/3] net/ice: support ACL filter in DCF",
        "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": "Add ice_acl_create_filter to create a rule and ice_acl_destroy_filter\nto destroy a rule. If a flow is matched by ACL filter, filter rule\nwill be set to HW. Currently IPV4/IPV4_UDP/IPV4_TCP/IPV4_SCTP pattern\nand drop action are supported.\n\nSigned-off-by: Simei Su <simei.su@intel.com>\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\n---\n doc/guides/rel_notes/release_20_11.rst |    2 +-\n drivers/net/ice/ice_acl_filter.c       | 1011 ++++++++++++++++++++++++++++++++\n drivers/net/ice/ice_ethdev.h           |   17 +\n drivers/net/ice/ice_generic_flow.c     |    2 +\n drivers/net/ice/meson.build            |    3 +-\n 5 files changed, 1033 insertions(+), 2 deletions(-)\n create mode 100644 drivers/net/ice/ice_acl_filter.c",
    "diff": "diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex 278d8dd..335a43f 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -183,7 +183,7 @@ New Features\n \n * **Updated Intel ice driver.**\n \n-  Updated the Intel ice driver to use write combining stores.\n+  * Added acl filter support for Intel DCF.\n \n * **Updated Intel qat driver.**\n \ndiff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c\nnew file mode 100644\nindex 0000000..ca483f0\n--- /dev/null\n+++ b/drivers/net/ice/ice_acl_filter.c\n@@ -0,0 +1,1011 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+\n+#include <sys/queue.h>\n+#include <stdio.h>\n+#include <errno.h>\n+#include <stdint.h>\n+#include <string.h>\n+#include <unistd.h>\n+#include <stdarg.h>\n+#include <rte_debug.h>\n+#include <rte_ether.h>\n+#include <rte_ethdev_driver.h>\n+#include <rte_log.h>\n+#include <rte_malloc.h>\n+#include <rte_eth_ctrl.h>\n+#include <rte_tailq.h>\n+#include <rte_flow_driver.h>\n+#include <rte_flow.h>\n+#include <rte_bitmap.h>\n+#include \"base/ice_type.h\"\n+#include \"base/ice_acl.h\"\n+#include \"ice_logs.h\"\n+#include \"ice_ethdev.h\"\n+#include \"ice_generic_flow.h\"\n+#include \"base/ice_flow.h\"\n+\n+#define MAX_ACL_SLOTS_ID 2048\n+\n+#define ICE_ACL_INSET_ETH_IPV4 ( \\\n+\tICE_INSET_SMAC | ICE_INSET_DMAC | \\\n+\tICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)\n+#define ICE_ACL_INSET_ETH_IPV4_UDP ( \\\n+\tICE_ACL_INSET_ETH_IPV4 | \\\n+\tICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)\n+#define ICE_ACL_INSET_ETH_IPV4_TCP ( \\\n+\tICE_ACL_INSET_ETH_IPV4 | \\\n+\tICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)\n+#define ICE_ACL_INSET_ETH_IPV4_SCTP ( \\\n+\tICE_ACL_INSET_ETH_IPV4 | \\\n+\tICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)\n+\n+static struct ice_flow_parser ice_acl_parser;\n+\n+struct acl_rule {\n+\tenum ice_fltr_ptype flow_type;\n+\tuint32_t entry_id[4];\n+};\n+\n+static struct\n+ice_pattern_match_item ice_acl_pattern[] = {\n+\t{pattern_eth_ipv4,      ICE_ACL_INSET_ETH_IPV4,      ICE_INSET_NONE},\n+\t{pattern_eth_ipv4_udp,  ICE_ACL_INSET_ETH_IPV4_UDP,  ICE_INSET_NONE},\n+\t{pattern_eth_ipv4_tcp,  ICE_ACL_INSET_ETH_IPV4_TCP,  ICE_INSET_NONE},\n+\t{pattern_eth_ipv4_sctp, ICE_ACL_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE},\n+};\n+\n+static int\n+ice_acl_prof_alloc(struct ice_hw *hw)\n+{\n+\tenum ice_fltr_ptype ptype, fltr_ptype;\n+\n+\tif (!hw->acl_prof) {\n+\t\thw->acl_prof = (struct ice_fd_hw_prof **)\n+\t\t\tice_malloc(hw, ICE_FLTR_PTYPE_MAX *\n+\t\t\t\t   sizeof(*hw->acl_prof));\n+\t\tif (!hw->acl_prof)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tfor (ptype = ICE_FLTR_PTYPE_NONF_NONE + 1;\n+\t     ptype < ICE_FLTR_PTYPE_MAX; ptype++) {\n+\t\tif (!hw->acl_prof[ptype]) {\n+\t\t\thw->acl_prof[ptype] = (struct ice_fd_hw_prof *)\n+\t\t\t\tice_malloc(hw, sizeof(**hw->acl_prof));\n+\t\t\tif (!hw->acl_prof[ptype])\n+\t\t\t\tgoto fail_mem;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+\n+fail_mem:\n+\tfor (fltr_ptype = ICE_FLTR_PTYPE_NONF_NONE + 1;\n+\t     fltr_ptype < ptype; fltr_ptype++) {\n+\t\trte_free(hw->acl_prof[fltr_ptype]);\n+\t\thw->acl_prof[fltr_ptype] = NULL;\n+\t}\n+\n+\trte_free(hw->acl_prof);\n+\thw->acl_prof = NULL;\n+\n+\treturn -ENOMEM;\n+}\n+\n+/**\n+ * ice_acl_setup - Reserve and initialize the ACL resources\n+ * @pf: board private structure\n+ */\n+static int\n+ice_acl_setup(struct ice_pf *pf)\n+{\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tuint32_t pf_num = hw->dev_caps.num_funcs;\n+\tstruct ice_acl_tbl_params params;\n+\tuint16_t scen_id;\n+\tint err = 0;\n+\n+\tmemset(&params, 0, sizeof(params));\n+\n+\t/* create for IPV4 table */\n+\tif (pf_num < 4)\n+\t\tparams.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 6;\n+\telse\n+\t\tparams.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 3;\n+\n+\tparams.depth = ICE_AQC_ACL_TCAM_DEPTH;\n+\tparams.entry_act_pairs = 1;\n+\tparams.concurr = false;\n+\n+\terr = ice_acl_create_tbl(hw, &params);\n+\tif (err)\n+\t\treturn err;\n+\n+\terr = ice_acl_create_scen(hw, params.width, params.depth,\n+\t\t\t\t  &scen_id);\n+\tif (err)\n+\t\treturn err;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_deinit_acl - Unroll the initialization of the ACL block\n+ * @pf: ptr to PF device\n+ *\n+ * returns 0 on success, negative on error\n+ */\n+static void ice_deinit_acl(struct ice_pf *pf)\n+{\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\n+\tice_acl_destroy_tbl(hw);\n+\n+\trte_free(hw->acl_tbl);\n+\thw->acl_tbl = NULL;\n+\n+\tif (pf->acl.slots) {\n+\t\trte_free(pf->acl.slots);\n+\t\tpf->acl.slots = NULL;\n+\t}\n+}\n+\n+static void\n+acl_add_prof_prepare(struct ice_hw *hw, struct ice_flow_seg_info *seg,\n+\t\t     bool is_l4, uint16_t src_port, uint16_t dst_port)\n+{\n+\tuint16_t val_loc, mask_loc;\n+\n+\tif (hw->dev_caps.num_funcs < 4) {\n+\t\t/* mac source address */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ext_data.src_mac);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    ext_mask.src_mac);\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_SA,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t/* mac destination address */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ext_data.dst_mac);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    ext_mask.dst_mac);\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_DA,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t}\n+\n+\t/* IP source address */\n+\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.src_ip);\n+\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.src_ip);\n+\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_SA, val_loc,\n+\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t/* IP destination address */\n+\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.dst_ip);\n+\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.dst_ip);\n+\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_DA, val_loc,\n+\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\tif (is_l4) {\n+\t\t/* Layer 4 source port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.src_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.src_port);\n+\t\tice_flow_set_fld(seg, src_port, val_loc,\n+\t\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t/* Layer 4 destination port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.dst_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.dst_port);\n+\t\tice_flow_set_fld(seg, dst_port, val_loc,\n+\t\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\t}\n+}\n+\n+/**\n+ * ice_acl_prof_init - Initialize ACL profile\n+ * @pf: ice PF structure\n+ *\n+ * Returns 0 on success.\n+ */\n+static int\n+ice_acl_prof_init(struct ice_pf *pf)\n+{\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tstruct ice_flow_prof *prof_ipv4 = NULL;\n+\tstruct ice_flow_prof *prof_ipv4_udp = NULL;\n+\tstruct ice_flow_prof *prof_ipv4_tcp = NULL;\n+\tstruct ice_flow_prof *prof_ipv4_sctp = NULL;\n+\tstruct ice_flow_seg_info *seg;\n+\tint i;\n+\tint ret;\n+\n+\tseg = (struct ice_flow_seg_info *)\n+\t\t ice_malloc(hw, sizeof(*seg));\n+\tif (!seg)\n+\t\treturn -ENOMEM;\n+\n+\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV4);\n+\tacl_add_prof_prepare(hw, seg, false, 0, 0);\n+\tret = ice_flow_add_prof(hw, ICE_BLK_ACL, ICE_FLOW_RX,\n+\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_OTHER,\n+\t\t\t\tseg, 1, NULL, 0, &prof_ipv4);\n+\tif (ret)\n+\t\tgoto err_add_prof;\n+\n+\tice_memset(seg, 0, sizeof(*seg), ICE_NONDMA_MEM);\n+\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);\n+\tacl_add_prof_prepare(hw, seg, true,\n+\t\t\t     ICE_FLOW_FIELD_IDX_UDP_SRC_PORT,\n+\t\t\t     ICE_FLOW_FIELD_IDX_UDP_DST_PORT);\n+\tret = ice_flow_add_prof(hw, ICE_BLK_ACL, ICE_FLOW_RX,\n+\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_UDP,\n+\t\t\t\tseg, 1, NULL, 0, &prof_ipv4_udp);\n+\tif (ret)\n+\t\tgoto err_add_prof_ipv4_udp;\n+\n+\tice_memset(seg, 0, sizeof(*seg), ICE_NONDMA_MEM);\n+\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);\n+\tacl_add_prof_prepare(hw, seg, true,\n+\t\t\t     ICE_FLOW_FIELD_IDX_TCP_SRC_PORT,\n+\t\t\t     ICE_FLOW_FIELD_IDX_TCP_DST_PORT);\n+\tret = ice_flow_add_prof(hw, ICE_BLK_ACL, ICE_FLOW_RX,\n+\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_TCP,\n+\t\t\t\tseg, 1, NULL, 0, &prof_ipv4_tcp);\n+\tif (ret)\n+\t\tgoto err_add_prof_ipv4_tcp;\n+\n+\tice_memset(seg, 0, sizeof(*seg), ICE_NONDMA_MEM);\n+\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);\n+\tacl_add_prof_prepare(hw, seg, true,\n+\t\t\t     ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT,\n+\t\t\t     ICE_FLOW_FIELD_IDX_SCTP_DST_PORT);\n+\tret = ice_flow_add_prof(hw, ICE_BLK_ACL, ICE_FLOW_RX,\n+\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_SCTP,\n+\t\t\t\tseg, 1, NULL, 0, &prof_ipv4_sctp);\n+\tif (ret)\n+\t\tgoto err_add_prof_ipv4_sctp;\n+\n+\tfor (i = 0; i < pf->main_vsi->idx; i++) {\n+\t\tret = ice_flow_assoc_prof(hw, ICE_BLK_ACL, prof_ipv4, i);\n+\t\tif (ret)\n+\t\t\tgoto err_assoc_prof;\n+\n+\t\tret = ice_flow_assoc_prof(hw, ICE_BLK_ACL, prof_ipv4_udp, i);\n+\t\tif (ret)\n+\t\t\tgoto err_assoc_prof;\n+\n+\t\tret = ice_flow_assoc_prof(hw, ICE_BLK_ACL, prof_ipv4_tcp, i);\n+\t\tif (ret)\n+\t\t\tgoto err_assoc_prof;\n+\n+\t\tret = ice_flow_assoc_prof(hw, ICE_BLK_ACL, prof_ipv4_sctp, i);\n+\t\tif (ret)\n+\t\t\tgoto err_assoc_prof;\n+\t}\n+\treturn 0;\n+\n+err_assoc_prof:\n+\tice_flow_rem_prof(hw, ICE_BLK_ACL, ICE_FLTR_PTYPE_NONF_IPV4_SCTP);\n+err_add_prof_ipv4_sctp:\n+\tice_flow_rem_prof(hw, ICE_BLK_ACL, ICE_FLTR_PTYPE_NONF_IPV4_TCP);\n+err_add_prof_ipv4_tcp:\n+\tice_flow_rem_prof(hw, ICE_BLK_ACL, ICE_FLTR_PTYPE_NONF_IPV4_UDP);\n+err_add_prof_ipv4_udp:\n+\tice_flow_rem_prof(hw, ICE_BLK_ACL, ICE_FLTR_PTYPE_NONF_IPV4_OTHER);\n+err_add_prof:\n+\tice_free(hw, seg);\n+\treturn ret;\n+}\n+\n+/**\n+ * ice_acl_set_input_set - Helper function to set the input set for ACL\n+ * @hw: pointer to HW instance\n+ * @filter: pointer to ACL info\n+ * @input: filter structure\n+ *\n+ * Return error value or 0 on success.\n+ */\n+static int\n+ice_acl_set_input_set(struct ice_acl_conf *filter, struct ice_fdir_fltr *input)\n+{\n+\tif (!input)\n+\t\treturn ICE_ERR_BAD_PTR;\n+\n+\tinput->q_index = filter->input.q_index;\n+\tinput->dest_vsi = filter->input.dest_vsi;\n+\tinput->dest_ctl = filter->input.dest_ctl;\n+\tinput->fltr_status = ICE_FLTR_PRGM_DESC_FD_STATUS_FD_ID;\n+\tinput->flow_type = filter->input.flow_type;\n+\n+\tswitch (input->flow_type) {\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_TCP:\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_UDP:\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_SCTP:\n+\t\tinput->ip.v4.dst_port = filter->input.ip.v4.dst_port;\n+\t\tinput->ip.v4.src_port = filter->input.ip.v4.src_port;\n+\t\tinput->ip.v4.dst_ip = filter->input.ip.v4.dst_ip;\n+\t\tinput->ip.v4.src_ip = filter->input.ip.v4.src_ip;\n+\n+\t\tinput->mask.v4.dst_port = filter->input.mask.v4.dst_port;\n+\t\tinput->mask.v4.src_port = filter->input.mask.v4.src_port;\n+\t\tinput->mask.v4.dst_ip = filter->input.mask.v4.dst_ip;\n+\t\tinput->mask.v4.src_ip = filter->input.mask.v4.src_ip;\n+\n+\t\tice_memcpy(&input->ext_data.src_mac,\n+\t\t\t   &filter->input.ext_data.src_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tice_memcpy(&input->ext_mask.src_mac,\n+\t\t\t   &filter->input.ext_mask.src_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tice_memcpy(&input->ext_data.dst_mac,\n+\t\t\t   &filter->input.ext_data.dst_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\tice_memcpy(&input->ext_mask.dst_mac,\n+\t\t\t   &filter->input.ext_mask.dst_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\tice_memcpy(&input->ip.v4, &filter->input.ip.v4,\n+\t\t\t   sizeof(struct ice_fdir_v4),\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\tice_memcpy(&input->mask.v4, &filter->input.mask.v4,\n+\t\t\t   sizeof(struct ice_fdir_v4),\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tice_memcpy(&input->ext_data.src_mac,\n+\t\t\t   &filter->input.ext_data.src_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\tice_memcpy(&input->ext_mask.src_mac,\n+\t\t\t   &filter->input.ext_mask.src_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tice_memcpy(&input->ext_data.dst_mac,\n+\t\t\t   &filter->input.ext_data.dst_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\tice_memcpy(&input->ext_mask.dst_mac,\n+\t\t\t   &filter->input.ext_mask.dst_mac,\n+\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int\n+ice_acl_alloc_slot_id(struct rte_bitmap *slots, uint32_t *slot_id)\n+{\n+\tuint32_t pos = 0;\n+\tuint64_t slab = 0;\n+\tuint32_t i = 0;\n+\n+\t__rte_bitmap_scan_init(slots);\n+\tif (!rte_bitmap_scan(slots, &pos, &slab))\n+\t\treturn -rte_errno;\n+\n+\ti = rte_bsf64(slab);\n+\tpos += i;\n+\trte_bitmap_clear(slots, pos);\n+\n+\t*slot_id = pos;\n+\treturn 0;\n+}\n+\n+static inline int\n+ice_acl_hw_set_conf(struct ice_pf *pf, struct ice_fdir_fltr *input,\n+\t\t    struct ice_flow_action *acts, struct acl_rule *rule,\n+\t\t    enum ice_fltr_ptype flow_type, int32_t entry_idx)\n+{\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tenum ice_block blk = ICE_BLK_ACL;\n+\tuint64_t entry_id, hw_entry;\n+\tuint32_t slot_id = 0;\n+\tint act_cnt = 1;\n+\tint ret = 0;\n+\n+\t/* Allocate slot_id from bitmap table. */\n+\tret = ice_acl_alloc_slot_id(pf->acl.slots, &slot_id);\n+\tif (ret) {\n+\t\tPMD_DRV_LOG(ERR, \"fail to alloc slot id.\");\n+\t\treturn ret;\n+\t}\n+\n+\t/* For IPV4_OTHER type, should add entry for all types.\n+\t * For IPV4_UDP/TCP/SCTP type, only add entry for each.\n+\t */\n+\tif (slot_id < MAX_ACL_ENTRIES) {\n+\t\tentry_id = ((uint64_t)flow_type << 32) | slot_id;\n+\t\tret = ice_flow_add_entry(hw, blk, flow_type,\n+\t\t\t\t\t entry_id, pf->main_vsi->idx,\n+\t\t\t\t\t ICE_FLOW_PRIO_NORMAL, input,\n+\t\t\t\t\t acts, act_cnt, &hw_entry);\n+\t\tif (ret) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Fail to add entry.\");\n+\t\t\treturn ret;\n+\t\t}\n+\t\trule->entry_id[entry_idx] = slot_id;\n+\t\tpf->acl.hw_entry_id[slot_id] = hw_entry;\n+\t} else {\n+\t\tPMD_DRV_LOG(ERR, \"Exceed the maximum entry number(%d)\"\n+\t\t\t    \" HW supported!\", MAX_ACL_ENTRIES);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline void\n+ice_acl_hw_rem_conf(struct ice_pf *pf, struct acl_rule *rule, int32_t entry_idx)\n+{\n+\tuint32_t slot_id;\n+\tint32_t i;\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\n+\tfor (i = 0; i < entry_idx; i++) {\n+\t\tslot_id = rule->entry_id[i];\n+\t\trte_bitmap_set(pf->acl.slots, slot_id);\n+\t\tice_flow_rem_entry(hw, ICE_BLK_ACL,\n+\t\t\t\t   pf->acl.hw_entry_id[slot_id]);\n+\t}\n+}\n+\n+static int\n+ice_acl_create_filter(struct ice_adapter *ad,\n+\t\t      struct rte_flow *flow,\n+\t\t      void *meta,\n+\t\t      struct rte_flow_error *error)\n+{\n+\tstruct ice_acl_conf *filter = meta;\n+\tenum ice_fltr_ptype flow_type = filter->input.flow_type;\n+\tstruct ice_flow_action acts[1];\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_fdir_fltr *input;\n+\tstruct acl_rule *rule;\n+\tint ret;\n+\n+\trule = rte_zmalloc(\"acl_rule\", sizeof(*rule), 0);\n+\tif (!rule) {\n+\t\trte_flow_error_set(error, ENOMEM,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t   \"Failed to allocate memory for acl rule\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tinput = rte_zmalloc(\"acl_entry\", sizeof(*input), 0);\n+\tif (!input) {\n+\t\trte_flow_error_set(error, ENOMEM,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t   \"Failed to allocate memory for acl input\");\n+\t\tret = -rte_errno;\n+\t\tgoto err_acl_input_alloc;\n+\t}\n+\n+\tret = ice_acl_set_input_set(filter, input);\n+\tif (ret) {\n+\t\trte_flow_error_set(error, -ret,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t   \"failed to set input set.\");\n+\t\tret = -rte_errno;\n+\t\tgoto err_acl_set_input;\n+\t}\n+\n+\tif (filter->input.dest_ctl == ICE_FLTR_PRGM_DESC_DEST_DROP_PKT) {\n+\t\tacts[0].type = ICE_FLOW_ACT_DROP;\n+\t\tacts[0].data.acl_act.mdid = ICE_MDID_RX_PKT_DROP;\n+\t\tacts[0].data.acl_act.prio = 0x3;\n+\t\tacts[0].data.acl_act.value = CPU_TO_LE16(0x1);\n+\t}\n+\n+\tinput->acl_fltr = true;\n+\tret = ice_acl_hw_set_conf(pf, input, acts, rule, flow_type, 0);\n+\tif (ret) {\n+\t\trte_flow_error_set(error, -ret,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t   \"failed to set hw configure.\");\n+\t\tret = -rte_errno;\n+\t\treturn ret;\n+\t}\n+\n+\tif (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) {\n+\t\tret = ice_acl_hw_set_conf(pf, input, acts, rule,\n+\t\t\t\t\t  ICE_FLTR_PTYPE_NONF_IPV4_UDP, 1);\n+\t\tif (ret)\n+\t\t\tgoto err_acl_hw_set_conf_udp;\n+\t\tret = ice_acl_hw_set_conf(pf, input, acts, rule,\n+\t\t\t\t\t  ICE_FLTR_PTYPE_NONF_IPV4_TCP, 2);\n+\t\tif (ret)\n+\t\t\tgoto err_acl_hw_set_conf_tcp;\n+\t\tret = ice_acl_hw_set_conf(pf, input, acts, rule,\n+\t\t\t\t\t  ICE_FLTR_PTYPE_NONF_IPV4_SCTP, 3);\n+\t\tif (ret)\n+\t\t\tgoto err_acl_hw_set_conf_sctp;\n+\t}\n+\n+\trule->flow_type = flow_type;\n+\tflow->rule = rule;\n+\treturn 0;\n+\n+err_acl_hw_set_conf_sctp:\n+\tice_acl_hw_rem_conf(pf, rule, 3);\n+err_acl_hw_set_conf_tcp:\n+\tice_acl_hw_rem_conf(pf, rule, 2);\n+err_acl_hw_set_conf_udp:\n+\tice_acl_hw_rem_conf(pf, rule, 1);\n+err_acl_set_input:\n+\trte_free(input);\n+err_acl_input_alloc:\n+\trte_free(rule);\n+\treturn ret;\n+}\n+\n+static int\n+ice_acl_destroy_filter(struct ice_adapter *ad,\n+\t\t       struct rte_flow *flow,\n+\t\t       struct rte_flow_error *error __rte_unused)\n+{\n+\tstruct acl_rule *rule = (struct acl_rule *)flow->rule;\n+\tuint32_t slot_id, i;\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tint ret = 0;\n+\n+\tswitch (rule->flow_type) {\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\tfor (i = 0; i < 4; i++) {\n+\t\t\tslot_id = rule->entry_id[i];\n+\t\t\trte_bitmap_set(pf->acl.slots, slot_id);\n+\t\t\tice_flow_rem_entry(hw, ICE_BLK_ACL,\n+\t\t\t\t\t   pf->acl.hw_entry_id[slot_id]);\n+\t\t}\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_UDP:\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_TCP:\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_SCTP:\n+\t\tslot_id = rule->entry_id[0];\n+\t\trte_bitmap_set(pf->acl.slots, slot_id);\n+\t\tice_flow_rem_entry(hw, ICE_BLK_ACL,\n+\t\t\t\t   pf->acl.hw_entry_id[slot_id]);\n+\t\tbreak;\n+\tdefault:\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t   NULL, \"Unsupported flow type.\");\n+\t\tbreak;\n+\t}\n+\n+\tflow->rule = NULL;\n+\trte_free(rule);\n+\treturn ret;\n+}\n+\n+static void\n+ice_acl_filter_free(struct rte_flow *flow)\n+{\n+\trte_free(flow->rule);\n+\tflow->rule = NULL;\n+}\n+\n+static int\n+ice_acl_parse_action(__rte_unused struct ice_adapter *ad,\n+\t\t     const struct rte_flow_action actions[],\n+\t\t     struct rte_flow_error *error,\n+\t\t     struct ice_acl_conf *filter)\n+{\n+\tuint32_t dest_num = 0;\n+\n+\tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n+\t\tswitch (actions->type) {\n+\t\tcase RTE_FLOW_ACTION_TYPE_VOID:\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_DROP:\n+\t\t\tdest_num++;\n+\n+\t\t\tfilter->input.dest_ctl =\n+\t\t\t\tICE_FLTR_PRGM_DESC_DEST_DROP_PKT;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ACTION, actions,\n+\t\t\t\t   \"Invalid action.\");\n+\t\t\treturn -rte_errno;\n+\t\t}\n+\t}\n+\n+\tif (dest_num == 0 || dest_num >= 2) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t   RTE_FLOW_ERROR_TYPE_ACTION, actions,\n+\t\t\t   \"Unsupported action combination\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,\n+\t\t       const struct rte_flow_item pattern[],\n+\t\t       struct rte_flow_error *error,\n+\t\t       struct ice_acl_conf *filter)\n+{\n+\tconst struct rte_flow_item *item = pattern;\n+\tenum rte_flow_item_type item_type;\n+\tenum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END;\n+\tconst struct rte_flow_item_eth *eth_spec, *eth_mask;\n+\tconst struct rte_flow_item_ipv4 *ipv4_spec, *ipv4_mask;\n+\tconst struct rte_flow_item_tcp *tcp_spec, *tcp_mask;\n+\tconst struct rte_flow_item_udp *udp_spec, *udp_mask;\n+\tconst struct rte_flow_item_sctp *sctp_spec, *sctp_mask;\n+\tuint64_t input_set = ICE_INSET_NONE;\n+\tuint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;\n+\n+\tfor (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {\n+\t\titem_type = item->type;\n+\n+\t\tswitch (item_type) {\n+\t\tcase RTE_FLOW_ITEM_TYPE_ETH:\n+\t\t\teth_spec = item->spec;\n+\t\t\teth_mask = item->mask;\n+\n+\t\t\tif (eth_spec && eth_mask) {\n+\t\t\t\tif (!rte_is_zero_ether_addr(&eth_spec->src) &&\n+\t\t\t\t    !rte_is_zero_ether_addr(&eth_mask->src)) {\n+\t\t\t\t\tinput_set |= ICE_INSET_SMAC;\n+\t\t\t\t\tice_memcpy(&filter->input.ext_data.src_mac,\n+\t\t\t\t\t\t   &eth_spec->src,\n+\t\t\t\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\t\t\tice_memcpy(&filter->input.ext_mask.src_mac,\n+\t\t\t\t\t\t   &eth_mask->src,\n+\t\t\t\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\t\t}\n+\n+\t\t\t\tif (!rte_is_zero_ether_addr(&eth_spec->dst) &&\n+\t\t\t\t    !rte_is_zero_ether_addr(&eth_mask->dst)) {\n+\t\t\t\t\tinput_set |= ICE_INSET_DMAC;\n+\t\t\t\t\tice_memcpy(&filter->input.ext_data.dst_mac,\n+\t\t\t\t\t\t   &eth_spec->dst,\n+\t\t\t\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\t\t\tice_memcpy(&filter->input.ext_mask.dst_mac,\n+\t\t\t\t\t\t   &eth_mask->dst,\n+\t\t\t\t\t\t   RTE_ETHER_ADDR_LEN,\n+\t\t\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_IPV4:\n+\t\t\tl3 = RTE_FLOW_ITEM_TYPE_IPV4;\n+\t\t\tipv4_spec = item->spec;\n+\t\t\tipv4_mask = item->mask;\n+\n+\t\t\tif (ipv4_spec && ipv4_mask) {\n+\t\t\t\t/* Check IPv4 mask and update input set */\n+\t\t\t\tif (ipv4_mask->hdr.version_ihl ||\n+\t\t\t\t    ipv4_mask->hdr.total_length ||\n+\t\t\t\t    ipv4_mask->hdr.packet_id ||\n+\t\t\t\t    ipv4_mask->hdr.fragment_offset ||\n+\t\t\t\t    ipv4_mask->hdr.hdr_checksum) {\n+\t\t\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\titem,\n+\t\t\t\t\t\t\"Invalid IPv4 mask.\");\n+\t\t\t\t\treturn -rte_errno;\n+\t\t\t\t}\n+\n+\t\t\t\tif (ipv4_mask->hdr.src_addr) {\n+\t\t\t\t\tfilter->input.ip.v4.src_ip =\n+\t\t\t\t\t\tipv4_spec->hdr.src_addr;\n+\t\t\t\t\tfilter->input.mask.v4.src_ip =\n+\t\t\t\t\t\tipv4_mask->hdr.src_addr;\n+\n+\t\t\t\t\tinput_set |= ICE_INSET_IPV4_SRC;\n+\t\t\t\t}\n+\n+\t\t\t\tif (ipv4_mask->hdr.dst_addr) {\n+\t\t\t\t\tfilter->input.ip.v4.dst_ip =\n+\t\t\t\t\t\tipv4_spec->hdr.dst_addr;\n+\t\t\t\t\tfilter->input.mask.v4.dst_ip =\n+\t\t\t\t\t\tipv4_mask->hdr.dst_addr;\n+\n+\t\t\t\t\tinput_set |= ICE_INSET_IPV4_DST;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tflow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_TCP:\n+\t\t\ttcp_spec = item->spec;\n+\t\t\ttcp_mask = item->mask;\n+\n+\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4)\n+\t\t\t\tflow_type = ICE_FLTR_PTYPE_NONF_IPV4_TCP;\n+\n+\t\t\tif (tcp_spec && tcp_mask) {\n+\t\t\t\t/* Check TCP mask and update input set */\n+\t\t\t\tif (tcp_mask->hdr.sent_seq ||\n+\t\t\t\t    tcp_mask->hdr.recv_ack ||\n+\t\t\t\t    tcp_mask->hdr.data_off ||\n+\t\t\t\t    tcp_mask->hdr.tcp_flags ||\n+\t\t\t\t    tcp_mask->hdr.rx_win ||\n+\t\t\t\t    tcp_mask->hdr.cksum ||\n+\t\t\t\t    tcp_mask->hdr.tcp_urp) {\n+\t\t\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\titem,\n+\t\t\t\t\t\t\"Invalid TCP mask\");\n+\t\t\t\t\treturn -rte_errno;\n+\t\t\t\t}\n+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    tcp_mask->hdr.src_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_TCP_SRC_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.src_port =\n+\t\t\t\t\t\ttcp_spec->hdr.src_port;\n+\t\t\t\t\tfilter->input.mask.v4.src_port =\n+\t\t\t\t\t\ttcp_mask->hdr.src_port;\n+\t\t\t\t}\n+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    tcp_mask->hdr.dst_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_TCP_DST_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.dst_port =\n+\t\t\t\t\t\ttcp_spec->hdr.dst_port;\n+\t\t\t\t\tfilter->input.mask.v4.dst_port =\n+\t\t\t\t\t\ttcp_mask->hdr.dst_port;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_UDP:\n+\t\t\tudp_spec = item->spec;\n+\t\t\tudp_mask = item->mask;\n+\n+\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4)\n+\t\t\t\tflow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP;\n+\n+\t\t\tif (udp_spec && udp_mask) {\n+\t\t\t\t/* Check UDP mask and update input set*/\n+\t\t\t\tif (udp_mask->hdr.dgram_len ||\n+\t\t\t\t    udp_mask->hdr.dgram_cksum) {\n+\t\t\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t\titem,\n+\t\t\t\t\t\t\"Invalid UDP mask\");\n+\t\t\t\t\treturn -rte_errno;\n+\t\t\t\t}\n+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    udp_mask->hdr.src_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_UDP_SRC_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.src_port =\n+\t\t\t\t\t\tudp_spec->hdr.src_port;\n+\t\t\t\t\tfilter->input.mask.v4.src_port =\n+\t\t\t\t\t\tudp_mask->hdr.src_port;\n+\t\t\t\t}\n+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    udp_mask->hdr.dst_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_UDP_DST_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.dst_port =\n+\t\t\t\t\t\tudp_spec->hdr.dst_port;\n+\t\t\t\t\tfilter->input.mask.v4.dst_port =\n+\t\t\t\t\t\tudp_mask->hdr.dst_port;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_SCTP:\n+\t\t\tsctp_spec = item->spec;\n+\t\t\tsctp_mask = item->mask;\n+\n+\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4)\n+\t\t\t\tflow_type = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;\n+\n+\t\t\tif (sctp_spec && sctp_mask) {\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    sctp_mask->hdr.src_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_SCTP_SRC_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.src_port =\n+\t\t\t\t\t\tsctp_spec->hdr.src_port;\n+\t\t\t\t\tfilter->input.mask.v4.src_port =\n+\t\t\t\t\t\tsctp_mask->hdr.src_port;\n+\t\t\t\t}\n+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&\n+\t\t\t\t    sctp_mask->hdr.dst_port) {\n+\t\t\t\t\tinput_set |= ICE_INSET_SCTP_DST_PORT;\n+\t\t\t\t\tfilter->input.ip.v4.dst_port =\n+\t\t\t\t\t\tsctp_spec->hdr.dst_port;\n+\t\t\t\t\tfilter->input.mask.v4.dst_port =\n+\t\t\t\t\t\tsctp_mask->hdr.dst_port;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_VOID:\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\titem,\n+\t\t\t\t\"Invalid pattern item.\");\n+\t\t\treturn -rte_errno;\n+\t\t}\n+\t}\n+\n+\tfilter->input.flow_type = flow_type;\n+\tfilter->input_set = input_set;\n+\n+\treturn 0;\n+}\n+\n+static int\n+ice_acl_parse(struct ice_adapter *ad,\n+\t       struct ice_pattern_match_item *array,\n+\t       uint32_t array_len,\n+\t       const struct rte_flow_item pattern[],\n+\t       const struct rte_flow_action actions[],\n+\t       void **meta,\n+\t       struct rte_flow_error *error)\n+{\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_acl_conf *filter = &pf->acl.conf;\n+\tstruct ice_pattern_match_item *item = NULL;\n+\tuint64_t input_set;\n+\tint ret;\n+\n+\tmemset(filter, 0, sizeof(*filter));\n+\titem = ice_search_pattern_match_item(pattern, array, array_len, error);\n+\tif (!item)\n+\t\treturn -rte_errno;\n+\n+\tret = ice_acl_parse_pattern(ad, pattern, error, filter);\n+\tif (ret)\n+\t\tgoto error;\n+\tinput_set = filter->input_set;\n+\tif (!input_set || input_set & ~item->input_set_mask) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,\n+\t\t\t\t   pattern,\n+\t\t\t\t   \"Invalid input set\");\n+\t\tret = -rte_errno;\n+\t\tgoto error;\n+\t}\n+\n+\tret = ice_acl_parse_action(ad, actions, error, filter);\n+\tif (ret)\n+\t\tgoto error;\n+\n+\tif (meta)\n+\t\t*meta = filter;\n+\n+error:\n+\trte_free(item);\n+\treturn ret;\n+}\n+\n+static int\n+ice_acl_bitmap_init(struct ice_pf *pf)\n+{\n+\tuint32_t bmp_size;\n+\tvoid *mem = NULL;\n+\tstruct rte_bitmap *slots;\n+\tint ret = 0;\n+\tbmp_size = rte_bitmap_get_memory_footprint(MAX_ACL_SLOTS_ID);\n+\tmem = rte_zmalloc(\"create_acl_bmap\", bmp_size, RTE_CACHE_LINE_SIZE);\n+\tif (mem == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to allocate memory for acl bitmap.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tslots = rte_bitmap_init_with_all_set(MAX_ACL_SLOTS_ID, mem, bmp_size);\n+\tif (slots == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to initialize acl bitmap.\");\n+\t\tret = -rte_errno;\n+\t\tgoto err_acl_mem_alloc;\n+\t}\n+\tpf->acl.slots = slots;\n+\treturn 0;\n+\n+err_acl_mem_alloc:\n+\trte_free(mem);\n+\treturn ret;\n+}\n+\n+static int\n+ice_acl_init(struct ice_adapter *ad)\n+{\n+\tint ret = 0;\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tstruct ice_flow_parser *parser = &ice_acl_parser;\n+\n+\tret = ice_acl_prof_alloc(hw);\n+\tif (ret) {\n+\t\tPMD_DRV_LOG(ERR, \"Cannot allocate memory for \"\n+\t\t\t    \"ACL profile.\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tret = ice_acl_setup(pf);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = ice_acl_bitmap_init(pf);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = ice_acl_prof_init(pf);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn ice_register_parser(parser, ad);\n+}\n+\n+static void\n+ice_acl_prof_free(struct ice_hw *hw)\n+{\n+\tenum ice_fltr_ptype ptype;\n+\n+\tfor (ptype = ICE_FLTR_PTYPE_NONF_NONE + 1;\n+\t     ptype < ICE_FLTR_PTYPE_MAX; ptype++) {\n+\t\trte_free(hw->acl_prof[ptype]);\n+\t\thw->acl_prof[ptype] = NULL;\n+\t}\n+\n+\trte_free(hw->acl_prof);\n+\thw->acl_prof = NULL;\n+}\n+\n+static void\n+ice_acl_uninit(struct ice_adapter *ad)\n+{\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_hw *hw = ICE_PF_TO_HW(pf);\n+\tstruct ice_flow_parser *parser = &ice_acl_parser;\n+\n+\tice_unregister_parser(parser, ad);\n+\n+\tice_deinit_acl(pf);\n+\tice_acl_prof_free(hw);\n+}\n+\n+static struct\n+ice_flow_engine ice_acl_engine = {\n+\t.init = ice_acl_init,\n+\t.uninit = ice_acl_uninit,\n+\t.create = ice_acl_create_filter,\n+\t.destroy = ice_acl_destroy_filter,\n+\t.free = ice_acl_filter_free,\n+\t.type = ICE_FLOW_ENGINE_ACL,\n+};\n+\n+static struct\n+ice_flow_parser ice_acl_parser = {\n+\t.engine = &ice_acl_engine,\n+\t.array = ice_acl_pattern,\n+\t.array_len = RTE_DIM(ice_acl_pattern),\n+\t.parse_pattern_action = ice_acl_parse,\n+\t.stage = ICE_FLOW_STAGE_DISTRIBUTOR,\n+};\n+\n+RTE_INIT(ice_acl_engine_init)\n+{\n+\tstruct ice_flow_engine *engine = &ice_acl_engine;\n+\tice_register_flow_engine(engine);\n+}\ndiff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h\nindex 9789096..05218af 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -49,6 +49,8 @@\n #define ICE_PKG_FILE_SEARCH_PATH_UPDATES \"/lib/firmware/updates/intel/ice/ddp/\"\n #define ICE_MAX_PKG_FILENAME_SIZE   256\n \n+#define MAX_ACL_ENTRIES    512\n+\n /**\n  * vlan_id is a 12 bit number.\n  * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.\n@@ -398,6 +400,20 @@ struct ice_hash_ctx {\n \tstruct ice_hash_gtpu_ctx gtpu6;\n };\n \n+struct ice_acl_conf {\n+\tstruct ice_fdir_fltr input;\n+\tuint64_t input_set;\n+};\n+\n+/**\n+ * A structure used to define fields of ACL related info.\n+ */\n+struct ice_acl_info {\n+\tstruct ice_acl_conf conf;\n+\tstruct rte_bitmap *slots;\n+\tuint64_t hw_entry_id[MAX_ACL_ENTRIES];\n+};\n+\n struct ice_pf {\n \tstruct ice_adapter *adapter; /* The adapter this PF associate to */\n \tstruct ice_vsi *main_vsi; /* pointer to main VSI structure */\n@@ -421,6 +437,7 @@ struct ice_pf {\n \tuint16_t fdir_nb_qps; /* The number of queue pairs of Flow Director */\n \tuint16_t fdir_qp_offset;\n \tstruct ice_fdir_info fdir; /* flow director info */\n+\tstruct ice_acl_info acl; /* ACL info */\n \tstruct ice_hash_ctx hash_ctx;\n \tuint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];\n \tuint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];\ndiff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c\nindex 54b0316..1429cbc 100644\n--- a/drivers/net/ice/ice_generic_flow.c\n+++ b/drivers/net/ice/ice_generic_flow.c\n@@ -1896,6 +1896,8 @@ ice_register_parser(struct ice_flow_parser *parser,\n \t\t\tTAILQ_INSERT_TAIL(list, parser_node, node);\n \t\telse if (parser->engine->type == ICE_FLOW_ENGINE_FDIR)\n \t\t\tTAILQ_INSERT_HEAD(list, parser_node, node);\n+\t\telse if (parser->engine->type == ICE_FLOW_ENGINE_ACL)\n+\t\t\tTAILQ_INSERT_HEAD(list, parser_node, node);\n \t\telse\n \t\t\treturn -EINVAL;\n \t}\ndiff --git a/drivers/net/ice/meson.build b/drivers/net/ice/meson.build\nindex 99e1b77..254595a 100644\n--- a/drivers/net/ice/meson.build\n+++ b/drivers/net/ice/meson.build\n@@ -10,7 +10,8 @@ sources = files(\n \t'ice_switch_filter.c',\n \t'ice_generic_flow.c',\n \t'ice_fdir_filter.c',\n-\t'ice_hash.c'\n+\t'ice_hash.c',\n+\t'ice_acl_filter.c'\n \t)\n \n deps += ['hash', 'net', 'common_iavf']\n",
    "prefixes": [
        "v5",
        "3/3"
    ]
}