get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 77127,
    "url": "http://patches.dpdk.org/api/patches/77127/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1599723455-353059-4-git-send-email-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": "<1599723455-353059-4-git-send-email-simei.su@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1599723455-353059-4-git-send-email-simei.su@intel.com",
    "date": "2020-09-10T07:37:35",
    "name": "[v1,3/3] net/ice: support ACL filter in DCF",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5da155627cf5ad038ff61df0d793ab0a59282553",
    "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/1599723455-353059-4-git-send-email-simei.su@intel.com/mbox/",
    "series": [
        {
            "id": 12091,
            "url": "http://patches.dpdk.org/api/series/12091/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12091",
            "date": "2020-09-10T07:37:32",
            "name": "net/ice: support DCF ACL capabiltiy",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/12091/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/77127/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/77127/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 A4830A04B5;\n\tThu, 10 Sep 2020 09:41:40 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A2EC71C0D7;\n\tThu, 10 Sep 2020 09:41:28 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id C5AF41C0D7\n for <dev@dpdk.org>; Thu, 10 Sep 2020 09:41:25 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2020 00:41:25 -0700",
            "from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com)\n ([10.67.110.178])\n by orsmga005.jf.intel.com with ESMTP; 10 Sep 2020 00:41:22 -0700"
        ],
        "IronPort-SDR": [
            "\n bRFPjK7KUhsNHOEeTk2pz9UCS87rws8W8THYycz1qxGwf4g12MhLlB5tY9NxGKlRnySkk/Z7Ce\n je5JdHLGqzXw==",
            "\n QjCOOrb28Xk2NY02Kivkmq71Mk2TefNY3znG2u4mDa1JPGkVhlVF7JG7XTSTHJ3EXZHRhnHPfq\n tqrGle1oTqtA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9739\"; a=\"155884479\"",
            "E=Sophos;i=\"5.76,412,1592895600\"; d=\"scan'208\";a=\"155884479\"",
            "E=Sophos;i=\"5.76,412,1592895600\"; d=\"scan'208\";a=\"480787384\""
        ],
        "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 Simei Su <simei.su@intel.com>",
        "Date": "Thu, 10 Sep 2020 15:37:35 +0800",
        "Message-Id": "<1599723455-353059-4-git-send-email-simei.su@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1599723455-353059-1-git-send-email-simei.su@intel.com>",
        "References": "<1599723455-353059-1-git-send-email-simei.su@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 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 pattern and drop\naction are supported.\n\nSigned-off-by: Simei Su <simei.su@intel.com>\n---\n drivers/net/ice/ice_acl_filter.c   | 1081 ++++++++++++++++++++++++++++++++++++\n drivers/net/ice/ice_ethdev.h       |    9 +\n drivers/net/ice/ice_generic_flow.c |    2 +\n drivers/net/ice/meson.build        |    3 +-\n 4 files changed, 1094 insertions(+), 1 deletion(-)\n create mode 100644 drivers/net/ice/ice_acl_filter.c",
    "diff": "diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c\nnew file mode 100644\nindex 0000000..a4a8528\n--- /dev/null\n+++ b/drivers/net/ice/ice_acl_filter.c\n@@ -0,0 +1,1081 @@\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 \"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 ICE_ACL_INSET_ETH_IPV4 ( \\\n+\tICE_INSET_SMAC | ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)\n+#define ICE_ACL_INSET_ETH_IPV4_UDP ( \\\n+\tICE_INSET_SMAC | ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \\\n+\tICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)\n+#define ICE_ACL_INSET_ETH_IPV4_TCP ( \\\n+\tICE_INSET_SMAC | ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \\\n+\tICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)\n+\n+enum ice_fd_stat_idx {\n+\tICE_FD_STAT_SB,\n+};\n+\n+#define ICE_FD_STAT_CTR_BLOCK_COUNT\t256\n+#define ICE_FD_STAT_PF_IDX(base_idx) \\\n+\t((base_idx) * ICE_FD_STAT_CTR_BLOCK_COUNT)\n+#define ICE_FD_SB_STAT_IDX(base_idx) \\\n+\t(ICE_FD_STAT_PF_IDX(base_idx) + ICE_FD_STAT_SB)\n+\n+static struct ice_flow_parser ice_acl_parser;\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+};\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_IPV4_UDP;\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+\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 = &pf->adapter->hw;\n+\tu32 pf_num = hw->dev_caps.num_funcs;\n+\tstruct ice_acl_tbl_params params;\n+\tint acl_ipv4_rules = 0;\n+\tu16 scen_id;\n+\tint err = 0;\n+\n+\tif (pf->adapter->devargs.acl_ipv4_rules_num)\n+\t\tacl_ipv4_rules = pf->adapter->devargs.acl_ipv4_rules_num;\n+\telse\n+\t\tacl_ipv4_rules = ICE_AQC_ACL_TCAM_DEPTH;\n+\n+\tmemset(&params, 0, sizeof(params));\n+\n+\t/* create for IPV4 table */\n+\tif (acl_ipv4_rules) {\n+\t\tif (pf_num < 4)\n+\t\t\tparams.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 5;\n+\t\telse\n+\t\t\tparams.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 3;\n+\n+\t\tparams.depth = acl_ipv4_rules;\n+\t\tparams.entry_act_pairs = 1;\n+\t\tparams.concurr = false;\n+\n+\t\terr = ice_acl_create_tbl(hw, &params);\n+\t\tif (err)\n+\t\t\treturn err;\n+\n+\t\terr = ice_acl_create_scen(hw, params.width, params.depth,\n+\t\t\t\t\t  &scen_id);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\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 = &pf->adapter->hw;\n+\n+\tice_acl_destroy_tbl(hw);\n+}\n+\n+/**\n+ * ice_del_acl_entry - Delete an ACL rule entry\n+ * @hw: pointer to HW instance\n+ * @fltr: filter structure\n+ *\n+ * returns 0 on success and negative value on error\n+ */\n+static int\n+ice_del_acl_entry(struct ice_hw *hw, struct ice_fdir_fltr *fltr)\n+{\n+\tuint64_t entry;\n+\n+\tentry = ice_flow_find_entry(hw, ICE_BLK_ACL, fltr->fltr_id);\n+\treturn ice_flow_rem_entry(hw, ICE_BLK_ACL, entry);\n+}\n+\n+/**\n+ * ice_acl_erase_flow_from_hw - Remove a flow from the HW profile tables\n+ * @hw: hardware structure containing the filter list\n+ * @flow_type: flow type to release\n+ */\n+static void\n+ice_acl_erase_flow_from_hw(struct ice_hw *hw, enum ice_fltr_ptype flow_type)\n+{\n+\tint tun;\n+\n+\tif (!hw->acl_prof || !hw->acl_prof[flow_type])\n+\t\treturn;\n+\n+\tstruct ice_fd_hw_prof *prof = hw->acl_prof[flow_type];\n+\tfor (tun = 0; tun < ICE_FD_HW_SEG_TUN; tun++) {\n+\t\tuint64_t prof_id;\n+\t\tint j;\n+\n+\t\tprof_id = flow_type + tun * ICE_FLTR_PTYPE_MAX;\n+\t\tfor (j = 0; j < prof->cnt; j++) {\n+\t\t\tuint16_t vsi_num;\n+\n+\t\t\tif (!prof->entry_h[j][tun] && !prof->vsi_h[j])\n+\t\t\t\tcontinue;\n+\t\t\tvsi_num = ice_get_hw_vsi_num(hw, prof->vsi_h[j]);\n+\t\t\tice_rem_prof_id_flow(hw, ICE_BLK_ACL, vsi_num, prof_id);\n+\t\t\tice_flow_rem_entry(hw, ICE_BLK_ACL,\n+\t\t\t\t\t   prof->entry_h[j][tun]);\n+\t\t\tprof->entry_h[j][tun] = 0;\n+\t\t}\n+\t\tice_flow_rem_prof(hw, ICE_BLK_ACL, prof_id);\n+\t}\n+}\n+\n+/**\n+ * ice_acl_rem_flow - Release the ice_flow structures for a filter type\n+ * @hw: hardware structure containing the filter list\n+ * @flow_type: flow type to release\n+ */\n+static void ice_acl_rem_flow(struct ice_hw *hw, enum ice_fltr_ptype flow_type)\n+{\n+\tstruct ice_fd_hw_prof *prof;\n+\tint tun, i;\n+\n+\tif (!hw->acl_prof || !hw->acl_prof[flow_type])\n+\t\treturn;\n+\n+\tprof = hw->acl_prof[flow_type];\n+\n+\tice_acl_erase_flow_from_hw(hw, flow_type);\n+\tfor (i = 0; i < prof->cnt; i++)\n+\t\tprof->vsi_h[i] = 0;\n+\tfor (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++) {\n+\t\tif (!prof->fdir_seg[tun])\n+\t\t\tcontinue;\n+\t\tice_free(hw, prof->fdir_seg[tun]);\n+\t\tprof->fdir_seg[tun] = NULL;\n+\t}\n+\tprof->cnt = 0;\n+}\n+\n+/**\n+ * ice_acl_update_list_entry - Add or delete a filter from the filter list\n+ * @pf: PF structure\n+ * @input: filter structure\n+ * @fltr_idx: index of filter to modify\n+ *\n+ * returns 0 on success and negative on errors\n+ */\n+static int\n+ice_acl_update_list_entry(struct ice_pf *pf, struct ice_fdir_fltr *input,\n+\t\t\t   int fltr_idx)\n+{\n+\tstruct ice_fdir_fltr *old_fltr;\n+\tint err = 0;\n+\tstruct ice_hw *hw;\n+\n+\thw = &pf->adapter->hw;\n+\told_fltr = ice_fdir_find_fltr_by_idx(hw, fltr_idx);\n+\tif (old_fltr) {\n+\t\tif (old_fltr->acl_fltr) {\n+\t\t\t/* ACL filter */\n+\t\t\tif (!input) {\n+\t\t\t\terr = ice_del_acl_entry(hw, old_fltr);\n+\t\t\t\tif (err)\n+\t\t\t\t\treturn err;\n+\t\t\t}\n+\t\t}\n+\t\tice_fdir_update_cntrs(hw, old_fltr->flow_type,\n+\t\t\t\t      old_fltr->acl_fltr, false);\n+\t\t/* we just deleted the last filter of flow_type so we\n+\t\t * should also delete the HW filter info.\n+\t\t */\n+\t\tif (old_fltr->acl_fltr && !input &&\n+\t\t    !hw->acl_fltr_cnt[old_fltr->flow_type])\n+\t\t\tice_acl_rem_flow(hw, old_fltr->flow_type);\n+\n+\t\tLIST_DEL(&old_fltr->fltr_node);\n+\t\tice_free(hw, old_fltr);\n+\t}\n+\n+\tif (!input)\n+\t\treturn err;\n+\n+\tice_fdir_list_add_fltr(hw, input);\n+\tice_fdir_update_cntrs(hw, input->flow_type, input->acl_fltr, true);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_acl_check_input_set - Check that a given ACL input set is valid\n+ * @pf: ice PF structure\n+ * @filter: pointer to ACL info\n+ *\n+ * Returns 0 on success.\n+ */\n+static int\n+ice_acl_check_input_set(struct ice_pf *pf, struct ice_acl_info *filter)\n+{\n+\tstruct ice_fd_hw_prof *hw_prof = NULL;\n+\tstruct ice_flow_prof *prof = NULL;\n+\tstruct ice_flow_seg_info *old_seg;\n+\tstruct ice_flow_seg_info *seg;\n+\tenum ice_fltr_ptype fltr_type = filter->input.flow_type;\n+\tstruct ice_hw *hw = &pf->adapter->hw;\n+\tenum ice_status status;\n+\tu16 val_loc, mask_loc;\n+\tstruct ice_fdir_v4 *ip4_mask;\n+\tuint64_t prof_id;\n+\n+\tseg = (struct ice_flow_seg_info *)\n+\t\tice_malloc(hw, sizeof(*seg));\n+\tif (!seg) {\n+\t\tPMD_DRV_LOG(ERR, \"No memory can be allocated\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tswitch (fltr_type) {\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_TCP:\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_UDP:\n+\t\tip4_mask = &filter->input.mask.v4;\n+\n+\t\t/* make sure we don't have any empty rule */\n+\t\tif (!ip4_mask->src_ip && !ip4_mask->src_port &&\n+\t\t    !ip4_mask->dst_ip && !ip4_mask->dst_port) {\n+\t\t\tgoto err_exit;\n+\n+\t\t\t/* filtering on TOS not supported */\n+\t\t\tif (ip4_mask->tos)\n+\t\t\t\tgoto err_exit;\n+\t\t}\n+\n+\t\tif (hw->dev_caps.num_funcs < 4) {\n+\t\t\t/* mac source address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t   ext_data.src_mac);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    ext_mask.src_mac);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_SA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t\t/* mac destination address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t   ext_data.dst_mac);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    ext_mask.dst_mac);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_DA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\t}\n+\n+\t\t/* IP source address */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.src_ip);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.src_ip);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_SA, val_loc,\n+\t\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t/* IP destination address */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.dst_ip);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr, mask.v4.dst_ip);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_DA, val_loc,\n+\t\t\t\t mask_loc, ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\tip4_mask = &filter->input.mask.v4;\n+\n+\t\tif (ip4_mask->tos)\n+\t\t\tgoto err_exit;\n+\t\tif (ip4_mask->ip_ver)\n+\t\t\tgoto err_exit;\n+\t\t/* Filtering on Layer 4 protocol not supported */\n+\t\tif (ip4_mask->proto)\n+\t\t\tgoto err_exit;\n+\t\t/* empty rules are not valid */\n+\t\tif (!ip4_mask->src_ip && !ip4_mask->dst_ip)\n+\t\t\tgoto err_exit;\n+\n+\t\tif (hw->dev_caps.num_funcs < 4) {\n+\t\t\t/* mac source address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t   ext_data.src_mac);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    ext_mask.src_mac);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_SA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t\t/* mac destination address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t   ext_data.dst_mac);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    ext_mask.dst_mac);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_ETH_DA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\t}\n+\n+\t\tif (ip4_mask->src_ip != 0) {\n+\t\t\t/* IP source address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t   ip.v4.src_ip);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    mask.v4.src_ip);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_SA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\t}\n+\n+\t\tif (ip4_mask->dst_ip != 0) {\n+\t\t\t/* IP destination address */\n+\t\t\tval_loc = offsetof(struct ice_fdir_fltr, ip.v4.dst_ip);\n+\t\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t\t    mask.v4.dst_ip);\n+\n+\t\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV4_DA,\n+\t\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\t}\n+\t\tbreak;\n+\tdefault:\n+\t\tgoto err_exit;\n+\t}\n+\n+\tswitch (fltr_type) {\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_TCP:\n+\t\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_TCP |\n+\t\t\t\t  ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_ETH);\n+\t\tip4_mask = &filter->input.mask.v4;\n+\n+\t\t/* Layer 4 source port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ip.v4.src_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    mask.v4.src_port);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_TCP_SRC_PORT,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t/* Layer 4 destination port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ip.v4.dst_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    mask.v4.dst_port);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_TCP_DST_PORT,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_UDP:\n+\t\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP |\n+\t\t\t\t  ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_ETH);\n+\t\tip4_mask = &filter->input.mask.v4;\n+\n+\t\t/* Layer 4 source port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ip.v4.src_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    mask.v4.src_port);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_UDP_SRC_PORT,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\n+\t\t/* Layer 4 destination port */\n+\t\tval_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t   ip.v4.dst_port);\n+\t\tmask_loc = offsetof(struct ice_fdir_fltr,\n+\t\t\t\t    mask.v4.dst_port);\n+\n+\t\tice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_UDP_DST_PORT,\n+\t\t\t\t val_loc, mask_loc,\n+\t\t\t\t ICE_FLOW_FLD_OFF_INVAL, false);\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\tICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV4 |\n+\t\t\t\t  ICE_FLOW_SEG_HDR_ETH);\n+\t\tbreak;\n+\tdefault:\n+\t\tgoto err_exit;\n+\t}\n+\n+\thw_prof = hw->acl_prof[fltr_type];\n+\told_seg = hw_prof->fdir_seg[0];\n+\tif (old_seg) {\n+\t\t/* This flow_type already has an input set.\n+\t\t * If it matches the requested input set then we are\n+\t\t * done. If it's different then it's an error.\n+\t\t */\n+\t\tif (!memcmp(old_seg, seg, sizeof(*seg))) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Rule already exists!\");\n+\t\t\tgoto err_exit;\n+\t\t}\n+\n+\t\t/* remove HW filter definition */\n+\t\tice_acl_rem_flow(hw, fltr_type);\n+\n+\t\tgoto err_exit;\n+\t}\n+\n+\t/* Adding a profile for the given flow specification with no\n+\t * actions (NULL) and zero actions 0.\n+\t */\n+\tprof_id = fltr_type;\n+\tstatus = ice_flow_add_prof(hw, ICE_BLK_ACL, ICE_FLOW_RX, prof_id,\n+\t\t\t\t   seg, 1, NULL, 0, &prof);\n+\tif (status)\n+\t\tgoto err_exit;\n+\n+\thw_prof->fdir_seg[0] = seg;\n+\treturn 0;\n+\n+err_exit:\n+\tice_free(hw, seg);\n+\treturn -EINVAL;\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_hw *hw, struct ice_acl_info *filter,\n+\t\t      struct ice_fdir_fltr *input)\n+{\n+\tif (!input)\n+\t\treturn ICE_ERR_BAD_PTR;\n+\n+\tinput->fltr_id = filter->input.fltr_id;\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->cnt_index = ICE_FD_SB_STAT_IDX(hw->fd_ctr_base);\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+\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\trte_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\trte_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+\n+\t\trte_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\trte_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+\n+\t\tbreak;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\trte_memcpy(&input->ip.v4, &filter->input.ip.v4,\n+\t\t\t   sizeof(struct ice_fdir_v4));\n+\t\trte_memcpy(&input->mask.v4, &filter->input.mask.v4,\n+\t\t\t   sizeof(struct ice_fdir_v4));\n+\n+\t\trte_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\trte_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+\n+\t\trte_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\trte_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+\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+ice_acl_create_filter(struct ice_adapter *ad,\n+\t\tstruct rte_flow *flow,\n+\t\tvoid *meta,\n+\t\tstruct rte_flow_error *error)\n+{\n+\tstruct ice_pf *pf = &ad->pf;\n+\tstruct ice_hw *hw = &ad->hw;\n+\tstruct ice_acl_info *filter = meta;\n+\tstruct ice_fdir_fltr *input;\n+\tstruct ice_flow_action acts[1];\n+\tint act_cnt;\n+\tstruct ice_fd_hw_prof *hw_prof = NULL;\n+\tenum ice_block blk = ICE_BLK_ACL;\n+\tenum ice_fltr_ptype flow_type = filter->input.flow_type;\n+\tint ret;\n+\tu64 entry_h = 0;\n+\tuint64_t prof_id;\n+\tint i;\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\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tret = ice_acl_check_input_set(pf, filter);\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   \"Profile configure failed.\");\n+\t\tgoto free_input;\n+\t}\n+\n+\tret = ice_acl_set_input_set(hw, 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\tgoto free_input;\n+\t}\n+\n+\tact_cnt = 1;\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+\thw_prof = hw->acl_prof[flow_type];\n+\tprof_id = flow_type;\n+\n+\tfor (i = 0; i < pf->main_vsi->idx; i++) {\n+\t\tret = ice_flow_add_entry(hw, blk, prof_id, input->fltr_id, i,\n+\t\t\t\t\t ICE_FLOW_PRIO_NORMAL, input, acts,\n+\t\t\t\t\t act_cnt, &entry_h);\n+\t\tif (ret) {\n+\t\t\trte_flow_error_set(error, -ret,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t   \"Flow add entry error.\");\n+\t\t\tgoto free_input;\n+\t\t}\n+\t}\n+\n+\tif (!hw_prof->cnt || 0 != hw_prof->vsi_h[hw_prof->cnt - 1]) {\n+\t\thw_prof->vsi_h[hw_prof->cnt] = 0;\n+\t\thw_prof->entry_h[hw_prof->cnt++][0] = entry_h;\n+\t}\n+\n+\tinput->acl_fltr = true;\n+\t/* input struct is added to the HW filter list */\n+\tice_acl_update_list_entry(pf, input, input->fltr_id);\n+\n+\tflow->rule = input;\n+\n+\treturn 0;\n+\n+free_input:\n+\trte_free(input);\n+\treturn -rte_errno;\n+}\n+\n+static int\n+ice_acl_destroy_filter(struct ice_adapter *ad,\n+\t\tstruct rte_flow *flow,\n+\t\tstruct rte_flow_error *error __rte_unused)\n+{\n+\tstruct ice_fdir_fltr *filter = (struct ice_fdir_fltr *)flow->rule;\n+\tint ret;\n+\n+\tret = ice_acl_update_list_entry(&ad->pf, NULL, filter->fltr_id);\n+\n+\tflow->rule = NULL;\n+\trte_free(filter);\n+\n+\treturn ret;\n+}\n+\n+static void\n+ice_acl_filter_free(struct rte_flow *flow)\n+{\n+\trte_free(flow->rule);\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_info *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_info *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+\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_broadcast_ether_addr(&eth_mask->dst) ||\n+\t\t\t\t    rte_is_broadcast_ether_addr(&eth_mask->src)) {\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 mac addr mask\");\n+\t\t\t\t\treturn -rte_errno;\n+\t\t\t\t}\n+\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\trte_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\trte_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}\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\trte_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\trte_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}\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 == UINT32_MAX) ||\n+\t\t\t\t    (ipv4_mask->hdr.dst_addr == UINT32_MAX)) {\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_spec->hdr.src_addr != 0) &&\n+\t\t\t\t    (ipv4_mask->hdr.src_addr != 0)) {\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_spec->hdr.dst_addr != 0) &&\n+\t\t\t\t    (ipv4_mask->hdr.dst_addr != 0)) {\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 (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 ((tcp_mask->hdr.src_port == UINT16_MAX) ||\n+\t\t\t\t    (tcp_mask->hdr.dst_port == UINT16_MAX)) {\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 ((tcp_mask->hdr.src_port == UINT16_MAX) ||\n+\t\t\t\t    (tcp_mask->hdr.dst_port == UINT16_MAX)) {\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_spec->hdr.src_port != 0)) {\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_spec->hdr.dst_port != 0)) {\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+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4)\n+\t\t\t\t\tflow_type =\n+\t\t\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_TCP;\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 (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 ((udp_mask->hdr.src_port == UINT16_MAX) ||\n+\t\t\t\t    (udp_mask->hdr.dst_port == UINT16_MAX)) {\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\t/* Get filter info */\n+\t\t\t\tif ((l3 == RTE_FLOW_ITEM_TYPE_IPV4) &&\n+\t\t\t\t    (udp_spec->hdr.src_port != 0)) {\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_spec->hdr.dst_port != 0)) {\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+\n+\t\t\t\tif (l3 == RTE_FLOW_ITEM_TYPE_IPV4)\n+\t\t\t\t\tflow_type =\n+\t\t\t\t\t\tICE_FLTR_PTYPE_NONF_IPV4_UDP;\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_info *filter = &pf->acl;\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\treturn ret;\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\treturn -rte_errno;\n+\t}\n+\n+\tret = ice_acl_parse_action(ad, actions, error, filter);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t*meta = filter;\n+\n+\treturn 0;\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_flow_parser *parser = &ice_acl_parser;\n+\n+\tret = ice_acl_prof_alloc(&ad->hw);\n+\tif (ret) {\n+\t\tPMD_DRV_LOG(ERR, \"Cannot allocate memory for \"\n+\t\t\t    \"ACL profile.\");\n+\t\tret = -ENOMEM;\n+\t}\n+\n+\tret = ice_acl_setup(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;\n+\t     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_flow_parser *parser = &ice_acl_parser;\n+\n+\tice_unregister_parser(parser, ad);\n+\n+\tice_deinit_acl(pf);\n+\tice_acl_prof_free(&ad->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 13f4167..63fe716 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -393,6 +393,14 @@ struct ice_hash_gtpu_ctx {\n \tstruct ice_hash_cfg ipv6_tcp;\n };\n \n+/**\n+ * A structure used to define fields of ACL related info.\n+ */\n+struct ice_acl_info {\n+\tstruct ice_fdir_fltr input;\n+\tuint64_t input_set;\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@@ -416,6 +424,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_gtpu_ctx gtpu_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 @@ enum rte_flow_item_type pattern_eth_ipv6_pfcp[] = {\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 e6fe744..3217463 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": [
        "v1",
        "3/3"
    ]
}