get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2221408,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2221408/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260409120003.2719-9-marcin.szycik@linux.intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260409120003.2719-9-marcin.szycik@linux.intel.com>",
    "list_archive_url": null,
    "date": "2026-04-09T12:00:01",
    "name": "[iwl-next,v2,08/10] ice: program ACL entry",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bf2ad6658ed8a84727f023e001beb585e3531bdf",
    "submitter": {
        "id": 82782,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/82782/?format=api",
        "name": "Marcin Szycik",
        "email": "marcin.szycik@linux.intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260409120003.2719-9-marcin.szycik@linux.intel.com/mbox/",
    "series": [
        {
            "id": 499287,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499287/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=499287",
            "date": "2026-04-09T11:59:53",
            "name": "Add ACL support",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/499287/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221408/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221408/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=aa3Xsg9f;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.136; helo=smtp3.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fs0RC6n3dz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:00:39 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id DF7656101C;\n\tThu,  9 Apr 2026 13:00:36 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Pv2qCFDJSS9H; Thu,  9 Apr 2026 13:00:35 +0000 (UTC)",
            "from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 2AEA861013;\n\tThu,  9 Apr 2026 13:00:35 +0000 (UTC)",
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists1.osuosl.org (Postfix) with ESMTP id 21E1C1F6\n for <intel-wired-lan@lists.osuosl.org>; Thu,  9 Apr 2026 13:00:31 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 1DDBC40127\n for <intel-wired-lan@lists.osuosl.org>; Thu,  9 Apr 2026 13:00:30 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id s6Ma6ElmBWim for <intel-wired-lan@lists.osuosl.org>;\n Thu,  9 Apr 2026 13:00:28 +0000 (UTC)",
            "from mgamail.intel.com (mgamail.intel.com [192.198.163.19])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 74FD7403B8\n for <intel-wired-lan@lists.osuosl.org>; Thu,  9 Apr 2026 13:00:28 +0000 (UTC)",
            "from orviesa002.jf.intel.com ([10.64.159.142])\n by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Apr 2026 06:00:22 -0700",
            "from irvmail002.ir.intel.com ([10.43.11.120])\n by orviesa002.jf.intel.com with ESMTP; 09 Apr 2026 06:00:18 -0700",
            "from gond.igk.intel.com (gond.igk.intel.com [10.123.220.52])\n by irvmail002.ir.intel.com (Postfix) with ESMTP id 39F9E2FC5C;\n Thu,  9 Apr 2026 14:00:17 +0100 (IST)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2AEA861013",
            "OpenDKIM Filter v2.11.0 smtp2.osuosl.org 74FD7403B8"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1775739635;\n\tbh=xOJ7Gx85cwNsqa79FfMXShU18fxePWQC31iDgkIqb4o=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=aa3Xsg9f6/q6DFnblcKrKJVIQsKo1pu5Sz5JWAV/kmEXipwh8gzdeyhOBilARWfRD\n\t 9uXNd3vKY7EfHSE2wyazh2cbZbfzqGCyrm6lXdesfa2KbtEhV/uE6alYhD/fbbQuyX\n\t 4pvL9SnPqjfcmOblrwBCccXSKpvLI8d351QY/GsStIJSEvXUpUDfjimgf8Mmt/MViu\n\t Sf38+rMo2XMZaAD9UQvw60gqxNKajAfX+yCxbo6IaNUVE2IH5F8o7NjZg6qruoRdiN\n\t cXp9IArwyy3g9S4PffV0+yurnkrJ/DHB+sQrBL08IgjpCmtVdjwrRMwYa1cTu59PMu\n\t PYH0L5Ghb371A==",
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19;\n helo=mgamail.intel.com; envelope-from=marcin.szycik@linux.intel.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp2.osuosl.org 74FD7403B8",
        "X-CSE-ConnectionGUID": [
            "nriLAoaqQSiisC4RRHksHA==",
            "pVJWMJ8WSlyMgEjOeaHjKg=="
        ],
        "X-CSE-MsgGUID": [
            "euRdXWZeR3iEc+m+GTdQ8Q==",
            "kyOtShjCR/OWD2lWb55l9w=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11753\"; a=\"75777547\"",
            "E=Sophos;i=\"6.23,169,1770624000\"; d=\"scan'208\";a=\"75777547\"",
            "E=Sophos;i=\"6.23,169,1770624000\"; d=\"scan'208\";a=\"259208149\""
        ],
        "X-ExtLoop1": "1",
        "From": "Marcin Szycik <marcin.szycik@linux.intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Cc": "netdev@vger.kernel.org, sandeep.penigalapati@intel.com,\n ananth.s@intel.com,\n alexander.duyck@gmail.com, Marcin Szycik <marcin.szycik@linux.intel.com>,\n Chinh Cao <chinh.t.cao@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>",
        "Date": "Thu,  9 Apr 2026 14:00:01 +0200",
        "Message-ID": "<20260409120003.2719-9-marcin.szycik@linux.intel.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20260409120003.2719-1-marcin.szycik@linux.intel.com>",
        "References": "<20260409120003.2719-1-marcin.szycik@linux.intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Original-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1775739628; x=1807275628;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=wc86NV0sr/TVL5pX76P3lM3GVFbYRwaLgqnFfQMAmZ8=;\n b=ibprrmQw+tB00tt2DqO6v/jp9zZSVSzMnWk7stf4WY0pOqYU554tnNkP\n 2HfnwWRHX16/siy+aV2VUf90rXd4woPQhtUjqNLdiMnp+sd1x5Hse9UKj\n JbV4AAS+enVrFBm+nMrEtbjVkPiQ+j56UrQaV10xBEZxQjr/Y4HzVZpou\n Q/YyFd313WocoFDDrT7aWcV+kERpAmmPHXjrvDwrhoYPL8fbbLYos8/Bc\n f3MX8134THr7bilPp4dGBxHnEOfP+ZKpNUBYPRNsaNcmo3s0BfD+f+RbY\n KZ2bLvBz2U373ZBzDfYYQfYiMQDpyQDCeEhgi5XnDribLW97zMkQryYfO\n A==;",
        "X-Mailman-Original-Authentication-Results": [
            "smtp2.osuosl.org;\n dmarc=none (p=none dis=none)\n header.from=linux.intel.com",
            "smtp2.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=ibprrmQw"
        ],
        "Subject": "[Intel-wired-lan] [PATCH iwl-next v2 08/10] ice: program ACL entry",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Real Valiquette <real.valiquette@intel.com>\n\nComplete the filter programming process; set the flow entry and action into\nthe scenario and write it to hardware. Configure the VSI for ACL filters.\n\nCo-developed-by: Chinh Cao <chinh.t.cao@intel.com>\nSigned-off-by: Chinh Cao <chinh.t.cao@intel.com>\nSigned-off-by: Real Valiquette <real.valiquette@intel.com>\nCo-developed-by: Tony Nguyen <anthony.l.nguyen@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\nSigned-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>\n---\nv2:\n* Use plain alloc instead of devm_ for ice_flow_entry::acts\n* Use FIELD_PREP_CONST() for ICE_ACL_RX_*_MISS_CNTR\n* Fix wrong struct ice_acl_act_entry alloc count in\n  ice_flow_acl_add_scen_entry_sync() - was e->entry_sz, which is an\n  unrelated value\n* Only set acts_cnt after successful allocation in\n  ice_flow_acl_add_scen_entry_sync()\n* Return -EINVAL instead of -ENOSPC on wrong index in\n  ice_acl_scen_free_entry_idx()\n---\n drivers/net/ethernet/intel/ice/ice.h          |   2 +\n drivers/net/ethernet/intel/ice/ice_acl.h      |  21 +\n .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +\n drivers/net/ethernet/intel/ice/ice_flow.h     |   3 +\n drivers/net/ethernet/intel/ice/ice_acl.c      |  53 ++-\n drivers/net/ethernet/intel/ice/ice_acl_ctrl.c | 251 +++++++++++\n drivers/net/ethernet/intel/ice/ice_acl_main.c |   4 +\n .../ethernet/intel/ice/ice_ethtool_ntuple.c   |  48 ++-\n drivers/net/ethernet/intel/ice/ice_flow.c     | 395 ++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_lib.c      |  10 +-\n 10 files changed, 782 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 9e6643931022..f9a43daf04fe 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -1061,6 +1061,8 @@ void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task,\n \t\t\t   u16 opcode);\n int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task,\n \t\t\t  unsigned long timeout);\n+int ice_ntuple_update_list_entry(struct ice_pf *pf,\n+\t\t\t\t struct ice_ntuple_fltr *input, int fltr_idx);\n int ice_open(struct net_device *netdev);\n int ice_open_internal(struct net_device *netdev);\n int ice_stop(struct net_device *netdev);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_acl.h b/drivers/net/ethernet/intel/ice/ice_acl.h\nindex 3a4adcf368cf..0b5651401eb7 100644\n--- a/drivers/net/ethernet/intel/ice/ice_acl.h\n+++ b/drivers/net/ethernet/intel/ice/ice_acl.h\n@@ -39,6 +39,7 @@ struct ice_acl_tbl {\n \tDECLARE_BITMAP(avail, ICE_AQC_ACL_ALLOC_UNITS);\n };\n \n+#define ICE_MAX_ACL_TCAM_ENTRY (ICE_AQC_ACL_TCAM_DEPTH * ICE_AQC_ACL_SLICES)\n enum ice_acl_entry_prio {\n \tICE_ACL_PRIO_LOW = 0,\n \tICE_ACL_PRIO_NORMAL,\n@@ -65,6 +66,11 @@ struct ice_acl_scen {\n \t * participate in this scenario\n \t */\n \tDECLARE_BITMAP(act_mem_bitmap, ICE_AQC_MAX_ACTION_MEMORIES);\n+\n+\t/* If nth bit of entry_bitmap is set, then nth entry will\n+\t * be available in this scenario\n+\t */\n+\tDECLARE_BITMAP(entry_bitmap, ICE_MAX_ACL_TCAM_ENTRY);\n \tu16 first_idx[ICE_ACL_MAX_PRIO];\n \tu16 last_idx[ICE_ACL_MAX_PRIO];\n \n@@ -137,6 +143,12 @@ int ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,\n \t\t\t   struct ice_sq_cd *cd);\n int ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,\n \t\t\t     struct ice_sq_cd *cd);\n+int ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,\n+\t\t\t     struct ice_aqc_acl_profile_ranges *buf,\n+\t\t\t     struct ice_sq_cd *cd);\n+int ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,\n+\t\t\t      struct ice_aqc_acl_profile_ranges *buf,\n+\t\t\t      struct ice_sq_cd *cd);\n int ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,\n \t\t\t  struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);\n int ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id,\n@@ -145,5 +157,14 @@ int ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,\n \t\t\t   struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);\n int ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id,\n \t\t\t  struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);\n+int ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t      enum ice_acl_entry_prio prio, u8 *keys, u8 *inverts,\n+\t\t      struct ice_acl_act_entry *acts, u8 acts_cnt,\n+\t\t      u16 *entry_idx);\n+int ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t     struct ice_acl_act_entry *acts, u8 acts_cnt,\n+\t\t     u16 entry_idx);\n+int ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t      u16 entry_idx);\n \n #endif /* _ICE_ACL_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\nindex b494fa6e0943..d41b2427482d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n@@ -3032,8 +3032,10 @@ enum ice_adminq_opc {\n \tice_aqc_opc_update_acl_scen\t\t\t= 0x0C1B,\n \tice_aqc_opc_program_acl_actpair\t\t\t= 0x0C1C,\n \tice_aqc_opc_program_acl_prof_extraction\t\t= 0x0C1D,\n+\tice_aqc_opc_program_acl_prof_ranges\t\t= 0x0C1E,\n \tice_aqc_opc_program_acl_entry\t\t\t= 0x0C20,\n \tice_aqc_opc_query_acl_prof\t\t\t= 0x0C21,\n+\tice_aqc_opc_query_acl_prof_ranges\t\t= 0x0C22,\n \tice_aqc_opc_query_acl_scen\t\t\t= 0x0C23,\n \n \t/* Tx queue handling commands/events */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_flow.h b/drivers/net/ethernet/intel/ice/ice_flow.h\nindex 53456d48f6ae..fffd03c38d15 100644\n--- a/drivers/net/ethernet/intel/ice/ice_flow.h\n+++ b/drivers/net/ethernet/intel/ice/ice_flow.h\n@@ -468,6 +468,8 @@ struct ice_flow_entry {\n \tenum ice_flow_priority priority;\n \tu16 vsi_handle;\n \tu16 entry_sz;\n+\t/* Entry index in the ACL's scenario */\n+\tu16 scen_entry_idx;\n \tu8 acts_cnt;\n };\n \n@@ -535,6 +537,7 @@ ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir,\n \t\t  struct ice_flow_seg_info *segs, u8 segs_cnt,\n \t\t  bool symm, struct ice_flow_prof **prof);\n int ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id);\n+u64 ice_flow_find_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_id);\n int\n ice_flow_set_parser_prof(struct ice_hw *hw, u16 dest_vsi, u16 fdir_vsi,\n \t\t\t struct ice_parser_profile *prof, enum ice_block blk);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_acl.c b/drivers/net/ethernet/intel/ice/ice_acl.c\nindex 837adbda14e0..3ddb500ea1ec 100644\n--- a/drivers/net/ethernet/intel/ice/ice_acl.c\n+++ b/drivers/net/ethernet/intel/ice/ice_acl.c\n@@ -156,7 +156,8 @@ static int ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,\n \tcmd = libie_aq_raw(&desc);\n \tcmd->profile_id = prof_id;\n \n-\tif (opc == ice_aqc_opc_program_acl_prof_extraction)\n+\tif (opc == ice_aqc_opc_program_acl_prof_extraction ||\n+\t    opc == ice_aqc_opc_program_acl_prof_ranges)\n \t\tdesc.flags |= cpu_to_le16(LIBIE_AQ_FLAG_RD);\n \n \treturn ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);\n@@ -318,6 +319,56 @@ int ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,\n \treturn ice_aq_send_cmd(hw, &desc, NULL, 0, cd);\n }\n \n+/**\n+ * ice_prog_acl_prof_ranges - program ACL profile ranges\n+ * @hw: pointer to the HW struct\n+ * @prof_id: programmed or updated profile ID\n+ * @buf: pointer to input buffer\n+ * @cd: pointer to command details structure or NULL\n+ *\n+ * Program ACL profile ranges (indirect 0x0C1E)\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+int ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,\n+\t\t\t     struct ice_aqc_acl_profile_ranges *buf,\n+\t\t\t     struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_acl_profile *cmd;\n+\tstruct libie_aq_desc desc;\n+\n+\tice_fill_dflt_direct_cmd_desc(&desc,\n+\t\t\t\t      ice_aqc_opc_program_acl_prof_ranges);\n+\tcmd = libie_aq_raw(&desc);\n+\tcmd->profile_id = prof_id;\n+\tdesc.flags |= cpu_to_le16(LIBIE_AQ_FLAG_RD);\n+\treturn ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);\n+}\n+\n+/**\n+ * ice_query_acl_prof_ranges - query ACL profile ranges\n+ * @hw: pointer to the HW struct\n+ * @prof_id: programmed or updated profile ID\n+ * @buf: pointer to response buffer\n+ * @cd: pointer to command details structure or NULL\n+ *\n+ * Query ACL profile ranges (indirect 0x0C22)\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+int ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,\n+\t\t\t      struct ice_aqc_acl_profile_ranges *buf,\n+\t\t\t      struct ice_sq_cd *cd)\n+{\n+\tstruct ice_aqc_acl_profile *cmd;\n+\tstruct libie_aq_desc desc;\n+\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_query_acl_prof_ranges);\n+\tcmd = libie_aq_raw(&desc);\n+\tcmd->profile_id = prof_id;\n+\treturn ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);\n+}\n+\n /**\n  * ice_aq_alloc_acl_scen - allocate ACL scenario\n  * @hw: pointer to the HW struct\ndiff --git a/drivers/net/ethernet/intel/ice/ice_acl_ctrl.c b/drivers/net/ethernet/intel/ice/ice_acl_ctrl.c\nindex c6148192dc6e..f136c998a85c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_acl_ctrl.c\n+++ b/drivers/net/ethernet/intel/ice/ice_acl_ctrl.c\n@@ -6,6 +6,11 @@\n /* Determine the TCAM index of entry 'e' within the ACL table */\n #define ICE_ACL_TBL_TCAM_IDX(e) ((e) / ICE_AQC_ACL_TCAM_DEPTH)\n \n+/* Determine the entry index within the TCAM */\n+#define ICE_ACL_TBL_TCAM_ENTRY_IDX(e) ((e) % ICE_AQC_ACL_TCAM_DEPTH)\n+\n+#define ICE_ACL_SCEN_ENTRY_INVAL 0xFFFF\n+\n /**\n  * ice_acl_init_entry - initialize ACL entry\n  * @scen: pointer to the scenario struct\n@@ -29,6 +34,51 @@ static void ice_acl_init_entry(struct ice_acl_scen *scen)\n \tscen->last_idx[ICE_ACL_PRIO_HIGH] = scen->num_entry / 4 - 1;\n }\n \n+/**\n+ * ice_acl_scen_assign_entry_idx - find index of an available entry in scenario\n+ * @scen: pointer to the scenario struct\n+ * @prio: the priority of the flow entry being allocated\n+ *\n+ * Return: entry index on success, ICE_ACL_SCEN_ENTRY_INVAL on error\n+ */\n+static u16 ice_acl_scen_assign_entry_idx(struct ice_acl_scen *scen,\n+\t\t\t\t\t enum ice_acl_entry_prio prio)\n+{\n+\tu16 first_idx, last_idx, i;\n+\ts8 step;\n+\n+\tif (prio >= ICE_ACL_MAX_PRIO)\n+\t\treturn ICE_ACL_SCEN_ENTRY_INVAL;\n+\n+\tfirst_idx = scen->first_idx[prio];\n+\tlast_idx = scen->last_idx[prio];\n+\tstep = first_idx <= last_idx ? 1 : -1;\n+\n+\tfor (i = first_idx; i != last_idx + step; i += step)\n+\t\tif (!test_and_set_bit(i, scen->entry_bitmap))\n+\t\t\treturn i;\n+\n+\treturn ICE_ACL_SCEN_ENTRY_INVAL;\n+}\n+\n+/**\n+ * ice_acl_scen_free_entry_idx - mark an entry as available in a scenario\n+ * @scen: pointer to the scenario struct\n+ * @idx: the index of the flow entry being de-allocated\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+static int ice_acl_scen_free_entry_idx(struct ice_acl_scen *scen, u16 idx)\n+{\n+\tif (idx >= scen->num_entry)\n+\t\treturn -EINVAL;\n+\n+\tif (!test_and_clear_bit(idx, scen->entry_bitmap))\n+\t\treturn -ENOENT;\n+\n+\treturn 0;\n+}\n+\n /**\n  * ice_acl_tbl_calc_end_idx - get end ACL entry index\n  * @start: start index of the TCAM entry of this partition\n@@ -858,3 +908,204 @@ int ice_acl_destroy_tbl(struct ice_hw *hw)\n \n \treturn 0;\n }\n+\n+/**\n+ * ice_acl_add_entry - Add a flow entry to ACL scenario\n+ * @hw: pointer to the HW struct\n+ * @scen: scenario to add the entry to\n+ * @prio: priority level of the entry being added\n+ * @keys: buffer of the value of the key to be programmed to the ACL entry\n+ * @inverts: buffer of the value of the key inverts to be programmed\n+ * @acts: pointer to a buffer containing formatted actions\n+ * @acts_cnt: indicates the number of actions stored in \"acts\"\n+ * @entry_idx: returned scenario relative index of the added flow entry\n+ *\n+ * Given an ACL table and a scenario, to add the specified key and key invert\n+ * to an available entry in the specified scenario.\n+ * The \"keys\" and \"inverts\" buffers must be of the size which is the same as\n+ * the scenario's width\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+int ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t      enum ice_acl_entry_prio prio, u8 *keys, u8 *inverts,\n+\t\t      struct ice_acl_act_entry *acts, u8 acts_cnt,\n+\t\t      u16 *entry_idx)\n+{\n+\tu8 entry_tcam, num_cscd, offset;\n+\tstruct ice_aqc_acl_data buf = {};\n+\tint err = 0;\n+\tu16 idx;\n+\n+\tif (!scen)\n+\t\treturn -ENOENT;\n+\n+\t*entry_idx = ice_acl_scen_assign_entry_idx(scen, prio);\n+\tif (*entry_idx >= scen->num_entry) {\n+\t\t*entry_idx = 0;\n+\t\treturn -ENOSPC;\n+\t}\n+\n+\t/* Determine number of cascaded TCAMs */\n+\tnum_cscd = DIV_ROUND_UP(scen->width, ICE_AQC_ACL_KEY_WIDTH_BYTES);\n+\n+\tentry_tcam = ICE_ACL_TBL_TCAM_IDX(scen->start);\n+\tidx = ICE_ACL_TBL_TCAM_ENTRY_IDX(scen->start + *entry_idx);\n+\n+\tfor (u8 i = 0; i < num_cscd; i++) {\n+\t\t/* If the key spans more than one TCAM in the case of cascaded\n+\t\t * TCAMs, the key and key inverts need to be properly split\n+\t\t * among TCAMs.E.g.bytes 0 - 4 go to an index in the first TCAM\n+\t\t * and bytes 5 - 9 go to the same index in the next TCAM, etc.\n+\t\t * If the entry spans more than one TCAM in a cascaded TCAM\n+\t\t * mode, the programming of the entries in the TCAMs must be in\n+\t\t * reversed order - the TCAM entry of the rightmost TCAM should\n+\t\t * be programmed first; the TCAM entry of the leftmost TCAM\n+\t\t * should be programmed last.\n+\t\t */\n+\t\toffset = num_cscd - i - 1;\n+\t\tmemcpy(&buf.entry_key.val,\n+\t\t       &keys[offset * sizeof(buf.entry_key.val)],\n+\t\t       sizeof(buf.entry_key.val));\n+\t\tmemcpy(&buf.entry_key_invert.val,\n+\t\t       &inverts[offset * sizeof(buf.entry_key_invert.val)],\n+\t\t       sizeof(buf.entry_key_invert.val));\n+\t\terr = ice_aq_program_acl_entry(hw, entry_tcam + offset, idx,\n+\t\t\t\t\t       &buf, NULL);\n+\t\tif (err) {\n+\t\t\tice_debug(hw, ICE_DBG_ACL, \"aq program acl entry failed status: %d\\n\",\n+\t\t\t\t  err);\n+\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\terr = ice_acl_prog_act(hw, scen, acts, acts_cnt, *entry_idx);\n+\n+out:\n+\tif (err) {\n+\t\tice_acl_rem_entry(hw, scen, *entry_idx);\n+\t\t*entry_idx = 0;\n+\t}\n+\n+\treturn err;\n+}\n+\n+/**\n+ * ice_acl_prog_act - Program a scenario's action memory\n+ * @hw: pointer to the HW struct\n+ * @scen: scenario to add the entry to\n+ * @acts: pointer to a buffer containing formatted actions\n+ * @acts_cnt: indicates the number of actions stored in \"acts\"\n+ * @entry_idx: scenario relative index of the added flow entry\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+int ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t     struct ice_acl_act_entry *acts, u8 acts_cnt, u16 entry_idx)\n+{\n+\tu8 entry_tcam, num_cscd, i, actx_idx = 0;\n+\tstruct ice_aqc_actpair act_buf = {};\n+\tint err = 0;\n+\tu16 idx;\n+\n+\tif (entry_idx >= scen->num_entry)\n+\t\treturn -ENOSPC;\n+\n+\t/* Determine number of cascaded TCAMs */\n+\tnum_cscd = DIV_ROUND_UP(scen->width, ICE_AQC_ACL_KEY_WIDTH_BYTES);\n+\n+\tentry_tcam = ICE_ACL_TBL_TCAM_IDX(scen->start);\n+\tidx = ICE_ACL_TBL_TCAM_ENTRY_IDX(scen->start + entry_idx);\n+\n+\tfor_each_set_bit(i, scen->act_mem_bitmap, ICE_AQC_MAX_ACTION_MEMORIES) {\n+\t\tstruct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];\n+\n+\t\tif (actx_idx >= acts_cnt)\n+\t\t\tbreak;\n+\t\tif (mem->member_of_tcam >= entry_tcam &&\n+\t\t    mem->member_of_tcam < entry_tcam + num_cscd) {\n+\t\t\tmemcpy(&act_buf.act[0], &acts[actx_idx],\n+\t\t\t       sizeof(struct ice_acl_act_entry));\n+\n+\t\t\tif (++actx_idx < acts_cnt) {\n+\t\t\t\tmemcpy(&act_buf.act[1], &acts[actx_idx],\n+\t\t\t\t       sizeof(struct ice_acl_act_entry));\n+\t\t\t}\n+\n+\t\t\terr = ice_aq_program_actpair(hw, i, idx, &act_buf,\n+\t\t\t\t\t\t     NULL);\n+\t\t\tif (err) {\n+\t\t\t\tice_debug(hw, ICE_DBG_ACL, \"program actpair failed status: %d\\n\",\n+\t\t\t\t\t  err);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tactx_idx++;\n+\t\t}\n+\t}\n+\n+\tif (!err && actx_idx < acts_cnt)\n+\t\terr = -ENOSPC;\n+\n+\treturn err;\n+}\n+\n+/**\n+ * ice_acl_rem_entry - Remove a flow entry from an ACL scenario\n+ * @hw: pointer to the HW struct\n+ * @scen: scenario to remove the entry from\n+ * @entry_idx: the scenario-relative index of the flow entry being removed\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+int ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen,\n+\t\t      u16 entry_idx)\n+{\n+\tstruct ice_aqc_actpair act_buf = {};\n+\tstruct ice_aqc_acl_data buf;\n+\tu8 entry_tcam, num_cscd, i;\n+\tint err = 0;\n+\tu16 idx;\n+\n+\tif (!scen)\n+\t\treturn -ENOENT;\n+\n+\tif (entry_idx >= scen->num_entry)\n+\t\treturn -ENOSPC;\n+\n+\tif (!test_bit(entry_idx, scen->entry_bitmap))\n+\t\treturn -ENOENT;\n+\n+\t/* Determine number of cascaded TCAMs */\n+\tnum_cscd = DIV_ROUND_UP(scen->width, ICE_AQC_ACL_KEY_WIDTH_BYTES);\n+\n+\tentry_tcam = ICE_ACL_TBL_TCAM_IDX(scen->start);\n+\tidx = ICE_ACL_TBL_TCAM_ENTRY_IDX(scen->start + entry_idx);\n+\n+\t/* invalidate the flow entry */\n+\tmemset(&buf, 0, sizeof(buf));\n+\tfor (i = 0; i < num_cscd; i++) {\n+\t\terr = ice_aq_program_acl_entry(hw, entry_tcam + i, idx, &buf,\n+\t\t\t\t\t       NULL);\n+\t\tif (err)\n+\t\t\tice_debug(hw, ICE_DBG_ACL, \"AQ program ACL entry failed status: %d\\n\",\n+\t\t\t\t  err);\n+\t}\n+\n+\tfor_each_set_bit(i, scen->act_mem_bitmap, ICE_AQC_MAX_ACTION_MEMORIES) {\n+\t\tstruct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];\n+\n+\t\tif (mem->member_of_tcam >= entry_tcam &&\n+\t\t    mem->member_of_tcam < entry_tcam + num_cscd) {\n+\t\t\t/* Invalidate allocated action pairs */\n+\t\t\terr = ice_aq_program_actpair(hw, i, idx, &act_buf,\n+\t\t\t\t\t\t     NULL);\n+\t\t\tif (err)\n+\t\t\t\tice_debug(hw, ICE_DBG_ACL, \"program actpair failed status: %d\\n\",\n+\t\t\t\t\t  err);\n+\t\t}\n+\t}\n+\n+\tice_acl_scen_free_entry_idx(scen, entry_idx);\n+\n+\treturn err;\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_acl_main.c b/drivers/net/ethernet/intel/ice/ice_acl_main.c\nindex 53cca0526756..16228be574ed 100644\n--- a/drivers/net/ethernet/intel/ice/ice_acl_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_acl_main.c\n@@ -280,6 +280,10 @@ int ice_acl_add_rule_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)\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_ntuple_update_list_entry(pf, input, fsp->location);\n+\n \treturn 0;\n \n free_input:\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c\nindex 3e79c0bf40f4..21d4f4e3a1d0 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c\n@@ -1791,6 +1791,21 @@ void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena)\n \tmutex_unlock(&hw->fdir_fltr_lock);\n }\n \n+/**\n+ * ice_del_acl_ethtool - delete an ACL rule entry\n+ * @hw: pointer to HW instance\n+ * @fltr: filter structure\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+static int ice_del_acl_ethtool(struct ice_hw *hw, struct ice_ntuple_fltr *fltr)\n+{\n+\tu64 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_fdir_do_rem_flow - delete flow and possibly add perfect flow\n  * @pf: PF structure\n@@ -1824,7 +1839,7 @@ ice_fdir_do_rem_flow(struct ice_pf *pf, enum ice_fltr_ptype flow_type)\n  *\n  * Return: 0 on success and negative on errors\n  */\n-static int\n+int\n ice_ntuple_update_list_entry(struct ice_pf *pf, struct ice_ntuple_fltr *input,\n \t\t\t     int fltr_idx)\n {\n@@ -1843,13 +1858,36 @@ ice_ntuple_update_list_entry(struct ice_pf *pf, struct ice_ntuple_fltr *input,\n \n \told_fltr = ice_fdir_find_fltr_by_idx(hw, fltr_idx);\n \tif (old_fltr) {\n-\t\terr = ice_fdir_write_all_fltr(pf, old_fltr, false);\n-\t\tif (err)\n-\t\t\treturn err;\n+\t\tif (old_fltr->acl_fltr) {\n+\t\t\t/* ACL filter - if the input buffer is present\n+\t\t\t * then this is an update and we don't want to\n+\t\t\t * delete the filter from the HW. We've already\n+\t\t\t * written the change to the HW at this point, so\n+\t\t\t * just update the SW structures to make sure\n+\t\t\t * everything is hunky-dory. If no input then this\n+\t\t\t * is a delete so we should delete the filter from\n+\t\t\t * the HW and clean up our SW structures.\n+\t\t\t */\n+\t\t\tif (!input) {\n+\t\t\t\terr = ice_del_acl_ethtool(hw, old_fltr);\n+\t\t\t\tif (err)\n+\t\t\t\t\treturn err;\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/* FD filter */\n+\t\t\terr = ice_fdir_write_all_fltr(pf, old_fltr, false);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t}\n+\n \t\tice_fdir_update_cntrs(hw, old_fltr->flow_type, false, false);\n \t\t/* update sb-filters count, specific to ring->channel */\n \t\tice_update_per_q_fltr(vsi, old_fltr->orig_q_index, false);\n-\t\tif (!input && !hw->fdir_fltr_cnt[old_fltr->flow_type])\n+\t\t/* Also delete the HW filter info if we have just deleted the\n+\t\t * last filter of flow_type.\n+\t\t */\n+\t\tif (!old_fltr->acl_fltr && !input &&\n+\t\t    !hw->fdir_fltr_cnt[old_fltr->flow_type])\n \t\t\t/* we just deleted the last filter of flow_type so we\n \t\t\t * should also delete the HW filter info.\n \t\t\t */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c\nindex dce6d2ffcb15..144d8326d4f9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_flow.c\n+++ b/drivers/net/ethernet/intel/ice/ice_flow.c\n@@ -1744,6 +1744,16 @@ static int ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block blk,\n \t\treturn -EINVAL;\n \n \tif (blk == ICE_BLK_ACL) {\n+\t\tint err;\n+\n+\t\tif (!entry->prof)\n+\t\t\treturn -EINVAL;\n+\n+\t\terr = ice_acl_rem_entry(hw, entry->prof->cfg.scen,\n+\t\t\t\t\tentry->scen_entry_idx);\n+\t\tif (err)\n+\t\t\treturn err;\n+\n \t\tif (entry->acts_cnt && entry->acts)\n \t\t\tice_flow_acl_free_act_cntr(hw, entry->acts,\n \t\t\t\t\t\t   entry->acts_cnt);\n@@ -1879,10 +1889,34 @@ ice_flow_rem_prof_sync(struct ice_hw *hw, enum ice_block blk,\n \t}\n \n \tif (blk == ICE_BLK_ACL) {\n+\t\tstruct ice_aqc_acl_prof_generic_frmt buf;\n+\t\tu8 prof_id = 0;\n+\n \t\t/* Disassociate the scenario from the profile for the PF */\n \t\tstatus = ice_flow_acl_disassoc_scen(hw, prof);\n \t\tif (status)\n \t\t\treturn status;\n+\n+\t\tstatus = ice_flow_get_hw_prof(hw, blk, prof->id, &prof_id);\n+\t\tif (status)\n+\t\t\treturn status;\n+\n+\t\tstatus = ice_query_acl_prof(hw, prof_id, &buf, NULL);\n+\t\tif (status)\n+\t\t\treturn status;\n+\n+\t\t/* Clear the range-checker if the profile ID is no longer\n+\t\t * used by any PF\n+\t\t */\n+\t\tif (!ice_flow_acl_is_prof_in_use(&buf)) {\n+\t\t\t/* Clear the range-checker value for profile ID */\n+\t\t\tstruct ice_aqc_acl_profile_ranges query_rng_buf = {};\n+\n+\t\t\tstatus = ice_prog_acl_prof_ranges(hw, prof_id,\n+\t\t\t\t\t\t\t  &query_rng_buf, NULL);\n+\t\t\tif (status)\n+\t\t\t\treturn status;\n+\t\t}\n \t}\n \n \t/* Remove all hardware profiles associated with this flow profile */\n@@ -2214,6 +2248,44 @@ int ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id)\n \treturn status;\n }\n \n+/**\n+ * ice_flow_find_entry - look for a flow entry using its unique ID\n+ * @hw: pointer to the HW struct\n+ * @blk: classification stage\n+ * @entry_id: unique ID to identify this flow entry\n+ *\n+ * Look for the flow entry with the specified unique ID in all flow profiles of\n+ * the specified classification stage.\n+ *\n+ * Return: flow entry handle if entry found, ICE_FLOW_ENTRY_ID_INVAL otherwise\n+ */\n+u64 ice_flow_find_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_id)\n+{\n+\tstruct ice_flow_entry *found = NULL;\n+\tstruct ice_flow_prof *p;\n+\n+\tmutex_lock(&hw->fl_profs_locks[blk]);\n+\n+\tlist_for_each_entry(p, &hw->fl_profs[blk], l_entry) {\n+\t\tstruct ice_flow_entry *e;\n+\n+\t\tmutex_lock(&p->entries_lock);\n+\t\tlist_for_each_entry(e, &p->entries, l_entry)\n+\t\t\tif (e->id == entry_id) {\n+\t\t\t\tfound = e;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\tmutex_unlock(&p->entries_lock);\n+\n+\t\tif (found)\n+\t\t\tbreak;\n+\t}\n+\n+\tmutex_unlock(&hw->fl_profs_locks[blk]);\n+\n+\treturn found ? ICE_FLOW_ENTRY_HNDL(found) : ICE_FLOW_ENTRY_HANDLE_INVAL;\n+}\n+\n /**\n  * ice_flow_acl_check_actions - Checks the ACL rule's actions\n  * @hw: pointer to the hardware structure\n@@ -2541,6 +2613,325 @@ static int ice_flow_acl_frmt_entry(struct ice_hw *hw,\n \n \treturn err;\n }\n+\n+/**\n+ * ice_flow_acl_find_scen_entry_cond - Find an ACL scenario entry that matches\n+ *\t\t\t\t       the compared data\n+ * @prof: pointer to flow profile\n+ * @e: pointer to the comparing flow entry\n+ * @do_chg_action: decide if we want to change the ACL action\n+ * @do_add_entry: decide if we want to add the new ACL entry\n+ * @do_rem_entry: decide if we want to remove the current ACL entry\n+ *\n+ * Find an ACL scenario entry that matches the compared data. Also figure out:\n+ * a) If we want to change the ACL action\n+ * b) If we want to add the new ACL entry\n+ * c) If we want to remove the current ACL entry\n+ *\n+ * Return: ACL scenario entry, or NULL if not found\n+ */\n+static struct ice_flow_entry *\n+ice_flow_acl_find_scen_entry_cond(struct ice_flow_prof *prof,\n+\t\t\t\t  struct ice_flow_entry *e, bool *do_chg_action,\n+\t\t\t\t  bool *do_add_entry, bool *do_rem_entry)\n+{\n+\tstruct ice_flow_entry *p, *return_entry = NULL;\n+\n+\t/* Check if:\n+\t * a) There exists an entry with same matching data, but different\n+\t *    priority, then we remove this existing ACL entry. Then, we\n+\t *    will add the new entry to the ACL scenario.\n+\t * b) There exists an entry with same matching data, priority, and\n+\t *    result action, then we do nothing\n+\t * c) There exists an entry with same matching data, priority, but\n+\t *    different, action, then do only change the action's entry.\n+\t * d) Else, we add this new entry to the ACL scenario.\n+\t */\n+\t*do_chg_action = false;\n+\t*do_add_entry = true;\n+\t*do_rem_entry = false;\n+\tlist_for_each_entry(p, &prof->entries, l_entry) {\n+\t\tif (memcmp(p->entry, e->entry, p->entry_sz))\n+\t\t\tcontinue;\n+\n+\t\t/* From this point, we have the same matching_data. */\n+\t\t*do_add_entry = false;\n+\t\treturn_entry = p;\n+\n+\t\tif (p->priority != e->priority) {\n+\t\t\t/* matching data && !priority */\n+\t\t\t*do_add_entry = true;\n+\t\t\t*do_rem_entry = true;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\t/* From this point, we will have matching_data && priority */\n+\t\tif (p->acts_cnt != e->acts_cnt)\n+\t\t\t*do_chg_action = true;\n+\t\tfor (int i = 0; i < p->acts_cnt; i++) {\n+\t\t\tbool found_not_match = false;\n+\n+\t\t\tfor (int j = 0; j < e->acts_cnt; j++)\n+\t\t\t\tif (memcmp(&p->acts[i], &e->acts[j],\n+\t\t\t\t\t   sizeof(struct ice_flow_action))) {\n+\t\t\t\t\tfound_not_match = true;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\n+\t\t\tif (found_not_match) {\n+\t\t\t\t*do_chg_action = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* (do_chg_action = true) means :\n+\t\t *    matching_data && priority && !result_action\n+\t\t * (do_chg_action = false) means :\n+\t\t *    matching_data && priority && result_action\n+\t\t */\n+\t\tbreak;\n+\t}\n+\n+\treturn return_entry;\n+}\n+\n+/**\n+ * ice_flow_acl_convert_to_acl_prio - convert flow priority to ACL priority\n+ * @p: flow priority\n+ *\n+ * Return: ACL priority\n+ */\n+static enum ice_acl_entry_prio\n+ice_flow_acl_convert_to_acl_prio(enum ice_flow_priority p)\n+{\n+\tswitch (p) {\n+\tcase ICE_FLOW_PRIO_LOW:\n+\t\treturn ICE_ACL_PRIO_LOW;\n+\tcase ICE_FLOW_PRIO_NORMAL:\n+\t\treturn ICE_ACL_PRIO_NORMAL;\n+\tcase ICE_FLOW_PRIO_HIGH:\n+\t\treturn ICE_ACL_PRIO_HIGH;\n+\tdefault:\n+\t\treturn ICE_ACL_PRIO_NORMAL;\n+\t}\n+}\n+\n+/**\n+ * ice_flow_acl_union_rng_chk - Perform union operation between two range-range\n+ *\t\t\t\tchecker buffers\n+ * @dst_buf: pointer to destination range checker buffer\n+ * @src_buf: pointer to source range checker buffer\n+ *\n+ * Do the union between dst_buf and src_buf range checker buffer, and save the\n+ * result back to dst_buf.\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+static int\n+ice_flow_acl_union_rng_chk(struct ice_aqc_acl_profile_ranges *dst_buf,\n+\t\t\t   struct ice_aqc_acl_profile_ranges *src_buf)\n+{\n+\tif (!dst_buf || !src_buf)\n+\t\treturn -EINVAL;\n+\n+\tfor (int i = 0; i < ICE_AQC_ACL_PROF_RANGES_NUM_CFG; i++) {\n+\t\tstruct ice_acl_rng_data *cfg_data = NULL, *in_data;\n+\t\tbool will_populate = false;\n+\n+\t\tin_data = &src_buf->checker_cfg[i];\n+\n+\t\tif (!in_data->mask)\n+\t\t\tbreak;\n+\n+\t\tfor (int j = 0; j < ICE_AQC_ACL_PROF_RANGES_NUM_CFG; j++) {\n+\t\t\tcfg_data = &dst_buf->checker_cfg[j];\n+\n+\t\t\tif (!cfg_data->mask ||\n+\t\t\t    !memcmp(cfg_data, in_data,\n+\t\t\t\t    sizeof(struct ice_acl_rng_data))) {\n+\t\t\t\twill_populate = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (will_populate) {\n+\t\t\tmemcpy(cfg_data, in_data,\n+\t\t\t       sizeof(struct ice_acl_rng_data));\n+\t\t} else {\n+\t\t\t/* No available slot left to program range checker */\n+\t\t\treturn -ENOSPC;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_flow_acl_add_scen_entry_sync - add entry to ACL scenario sync\n+ * @hw: pointer to the hardware structure\n+ * @prof: pointer to flow profile\n+ * @entry: double pointer to the flow entry\n+ *\n+ * Look at the current added entries in the corresponding ACL scenario and\n+ * perform matching logic to see if we want to add/modify/do nothing with this\n+ * new entry.\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+static int ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw,\n+\t\t\t\t\t    struct ice_flow_prof *prof,\n+\t\t\t\t\t    struct ice_flow_entry **entry)\n+{\n+\tbool do_add_entry, do_rem_entry, do_chg_action, do_chg_rng_chk;\n+\tstruct ice_aqc_acl_profile_ranges query_rng_buf, cfg_rng_buf;\n+\tstruct ice_acl_act_entry *acts = NULL;\n+\tstruct ice_flow_entry *exist;\n+\tstruct ice_flow_entry *e;\n+\tint err = 0;\n+\n+\te = *entry;\n+\n+\tdo_chg_rng_chk = false;\n+\tif (e->range_buf) {\n+\t\tu8 prof_id = 0;\n+\n+\t\terr = ice_flow_get_hw_prof(hw, ICE_BLK_ACL, prof->id, &prof_id);\n+\t\tif (err)\n+\t\t\treturn err;\n+\n+\t\t/* Query the current range-checker value in FW */\n+\t\terr = ice_query_acl_prof_ranges(hw, prof_id, &query_rng_buf,\n+\t\t\t\t\t\tNULL);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t\tmemcpy(&cfg_rng_buf, &query_rng_buf,\n+\t\t       sizeof(struct ice_aqc_acl_profile_ranges));\n+\n+\t\t/* Generate the new range-checker value */\n+\t\terr = ice_flow_acl_union_rng_chk(&cfg_rng_buf, e->range_buf);\n+\t\tif (err)\n+\t\t\treturn err;\n+\n+\t\t/* Reconfigure the range check if the buffer is changed. */\n+\t\tdo_chg_rng_chk = false;\n+\t\tif (memcmp(&query_rng_buf, &cfg_rng_buf,\n+\t\t\t   sizeof(struct ice_aqc_acl_profile_ranges))) {\n+\t\t\terr = ice_prog_acl_prof_ranges(hw, prof_id,\n+\t\t\t\t\t\t       &cfg_rng_buf, NULL);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\n+\t\t\tdo_chg_rng_chk = true;\n+\t\t}\n+\t}\n+\n+\t/* Figure out if we want to (change the ACL action) and/or\n+\t * (Add the new ACL entry) and/or (Remove the current ACL entry)\n+\t */\n+\texist = ice_flow_acl_find_scen_entry_cond(prof, e, &do_chg_action,\n+\t\t\t\t\t\t  &do_add_entry, &do_rem_entry);\n+\n+\tif (do_rem_entry) {\n+\t\terr = ice_flow_rem_entry_sync(hw, ICE_BLK_ACL, exist);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n+\n+\t/* Prepare the result action buffer */\n+\tacts = kzalloc_objs(*acts, e->acts_cnt);\n+\tif (!acts)\n+\t\treturn -ENOMEM;\n+\n+\tfor (int i = 0; i < e->acts_cnt; i++)\n+\t\tmemcpy(&acts[i], &e->acts[i].data.acl_act,\n+\t\t       sizeof(struct ice_acl_act_entry));\n+\n+\tif (do_add_entry) {\n+\t\tenum ice_acl_entry_prio prio;\n+\t\tu8 *keys, *inverts;\n+\t\tu16 entry_idx;\n+\n+\t\tkeys = (u8 *)e->entry;\n+\t\tinverts = keys + (e->entry_sz / 2);\n+\t\tprio = ice_flow_acl_convert_to_acl_prio(e->priority);\n+\n+\t\terr = ice_acl_add_entry(hw, prof->cfg.scen, prio, keys,\n+\t\t\t\t\tinverts, acts, e->acts_cnt,\n+\t\t\t\t\t&entry_idx);\n+\t\tif (err)\n+\t\t\tgoto out;\n+\n+\t\te->scen_entry_idx = entry_idx;\n+\t\tlist_add(&e->l_entry, &prof->entries);\n+\t} else {\n+\t\tif (do_chg_action) {\n+\t\t\t/* For the action memory info, update the SW's copy of\n+\t\t\t * exist entry with e's action memory info\n+\t\t\t */\n+\t\t\tkfree(exist->acts);\n+\t\t\texist->acts = kzalloc_objs(*exist->acts, e->acts_cnt);\n+\t\t\tif (!exist->acts) {\n+\t\t\t\terr = -ENOMEM;\n+\t\t\t\tgoto out;\n+\t\t\t}\n+\t\t\texist->acts_cnt = e->acts_cnt;\n+\n+\t\t\tmemcpy(exist->acts, e->acts,\n+\t\t\t       sizeof(struct ice_flow_action) * e->acts_cnt);\n+\n+\t\t\terr = ice_acl_prog_act(hw, prof->cfg.scen, acts,\n+\t\t\t\t\t       e->acts_cnt,\n+\t\t\t\t\t       exist->scen_entry_idx);\n+\t\t\tif (err)\n+\t\t\t\tgoto out;\n+\t\t}\n+\n+\t\tif (do_chg_rng_chk) {\n+\t\t\t/* In this case, we want to update the range checker\n+\t\t\t * information of the exist entry\n+\t\t\t */\n+\t\t\terr = ice_flow_acl_union_rng_chk(exist->range_buf,\n+\t\t\t\t\t\t\t e->range_buf);\n+\t\t\tif (err)\n+\t\t\t\tgoto out;\n+\t\t}\n+\n+\t\t/* As we don't add the new entry to our SW DB, deallocate its\n+\t\t * memories, and return the exist entry to the caller\n+\t\t */\n+\t\tkfree(e->entry);\n+\t\tkfree(e->range_buf);\n+\t\tkfree(e->acts);\n+\t\tdevm_kfree(ice_hw_to_dev(hw), e);\n+\t\t*entry = exist;\n+\t}\n+out:\n+\tkfree(acts);\n+\n+\treturn err;\n+}\n+\n+/**\n+ * ice_flow_acl_add_scen_entry - Add entry to ACL scenario\n+ * @hw: pointer to the hardware structure\n+ * @prof: pointer to flow profile\n+ * @e: double pointer to the flow entry\n+ *\n+ * Return: 0 on success, negative on error\n+ */\n+static int ice_flow_acl_add_scen_entry(struct ice_hw *hw,\n+\t\t\t\t       struct ice_flow_prof *prof,\n+\t\t\t\t       struct ice_flow_entry **e)\n+{\n+\tint err;\n+\n+\tmutex_lock(&prof->entries_lock);\n+\terr = ice_flow_acl_add_scen_entry_sync(hw, prof, e);\n+\tmutex_unlock(&prof->entries_lock);\n+\n+\treturn err;\n+}\n+\n /**\n  * ice_flow_add_entry - Add a flow entry\n  * @hw: pointer to the HW struct\n@@ -2609,6 +3000,10 @@ int ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,\n \t\t\t\t\t\t acts_cnt);\n \t\tif (status)\n \t\t\tgoto out;\n+\n+\t\tstatus = ice_flow_acl_add_scen_entry(hw, prof, &e);\n+\t\tif (status)\n+\t\t\tgoto out;\n \t\tbreak;\n \tdefault:\n \t\tstatus = -EOPNOTSUPP;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 0fcd3675d0e2..39e0c4c0fd51 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -1118,7 +1118,7 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)\n \t    vsi->type != ICE_VSI_VF && vsi->type != ICE_VSI_CHNL)\n \t\treturn;\n \n-\tval = ICE_AQ_VSI_PROP_FLOW_DIR_VALID;\n+\tval = ICE_AQ_VSI_PROP_FLOW_DIR_VALID | ICE_AQ_VSI_PROP_ACL_VALID;\n \tctxt->info.valid_sections |= cpu_to_le16(val);\n \tdflt_q = 0;\n \tdflt_q_group = 0;\n@@ -1144,6 +1144,14 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)\n \t/* priority of the default qindex action */\n \tval |= FIELD_PREP(ICE_AQ_VSI_FD_DEF_PRIORITY_M, dflt_q_prio);\n \tctxt->info.fd_report_opt = cpu_to_le16(val);\n+\n+#define ICE_ACL_RX_PROF_MISS_CNTR\t\\\n+\tFIELD_PREP_CONST(ICE_AQ_VSI_ACL_DEF_RX_PROF_M, 2)\n+#define ICE_ACL_RX_TBL_MISS_CNTR\t\\\n+\tFIELD_PREP_CONST(ICE_AQ_VSI_ACL_DEF_RX_TABLE_M, 3)\n+\n+\tval = ICE_ACL_RX_PROF_MISS_CNTR | ICE_ACL_RX_TBL_MISS_CNTR;\n+\tctxt->info.acl_def_act = cpu_to_le16(val);\n }\n \n /**\n",
    "prefixes": [
        "iwl-next",
        "v2",
        "08/10"
    ]
}