Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1288148/?format=api
{ "id": 1288148, "url": "http://patchwork.ozlabs.org/api/patches/1288148/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200512010146.41303-2-anthony.l.nguyen@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/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": "<20200512010146.41303-2-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2020-05-12T01:01:41", "name": "[S42,2/7] ice: Support displaying ntuple rules", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "4fad26cdfd67f376bd04a1b28032ba56af324dd9", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200512010146.41303-2-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 176248, "url": "http://patchwork.ozlabs.org/api/series/176248/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=176248", "date": "2020-05-12T01:01:45", "name": "[S42,1/7] ice: Initialize Flow Director resources", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/176248/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1288148/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1288148/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@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49Lfhv1Kb8z9sRf\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 12 May 2020 11:04:30 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9E0C686BC9;\n\tTue, 12 May 2020 01:04:27 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id LVOBY+dMeRRR; Tue, 12 May 2020 01:04:23 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E71BE86822;\n\tTue, 12 May 2020 01:04:23 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by ash.osuosl.org (Postfix) with ESMTP id D06DE1BF841\n for <intel-wired-lan@lists.osuosl.org>; Tue, 12 May 2020 01:04:22 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by whitealder.osuosl.org (Postfix) with ESMTP id CA8B186822\n for <intel-wired-lan@lists.osuosl.org>; Tue, 12 May 2020 01:04:22 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id wCc08jaH8OWB for <intel-wired-lan@lists.osuosl.org>;\n Tue, 12 May 2020 01:04:20 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by whitealder.osuosl.org (Postfix) with ESMTPS id 3C2CB867CC\n for <intel-wired-lan@lists.osuosl.org>; Tue, 12 May 2020 01:04:20 +0000 (UTC)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 May 2020 18:04:19 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.241.65])\n by orsmga004.jf.intel.com with ESMTP; 11 May 2020 18:04:19 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "IronPort-SDR": [ "\n CCysqOxZIejrVkBo3Ab6yfQJvqjQ6MB4ivkwLa40cnuUakEEty6cdxxHARBIqJPS8a9VXsVf0B\n rg6ZuLbPc2Mg==", "\n 2ll3ruKcy3tAw7cHSMpgLUMs06ePtb41asGpbv5AOqIZCOINRsmK9ZO4eExu17VbBsdBw7X/Us\n gJ847nbskeGA==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,381,1583222400\"; d=\"scan'208\";a=\"409116463\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 11 May 2020 18:01:41 -0700", "Message-Id": "<20200512010146.41303-2-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200512010146.41303-1-anthony.l.nguyen@intel.com>", "References": "<20200512010146.41303-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S42 2/7] ice: Support displaying ntuple\n rules", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Henry Tieman <henry.w.tieman@intel.com>\n\nAdd functionality for ethtool --show-ntuple, allowing for filters to be\ndisplayed when set functionality is added. Add statistics related to\nFlow Director matches and status.\n\nSigned-off-by: Henry Tieman <henry.w.tieman@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h | 9 +\n drivers/net/ethernet/intel/ice/ice_ethtool.c | 17 ++\n .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 161 ++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_fdir.c | 33 ++++\n drivers/net/ethernet/intel/ice/ice_fdir.h | 47 +++++\n .../net/ethernet/intel/ice/ice_hw_autogen.h | 1 +\n drivers/net/ethernet/intel/ice/ice_main.c | 9 +\n drivers/net/ethernet/intel/ice/ice_type.h | 3 +\n 8 files changed, 280 insertions(+)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex a070ddcc2cb3..51caf3a3c76b 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -535,6 +535,11 @@ static inline struct ice_vsi *ice_get_ctrl_vsi(struct ice_pf *pf)\n \treturn pf->vsi[pf->ctrl_vsi_idx];\n }\n \n+#define ICE_FD_STAT_CTR_BLOCK_COUNT\t256\n+#define ICE_FD_STAT_PF_IDX(base_idx) \\\n+\t\t\t((base_idx) * ICE_FD_STAT_CTR_BLOCK_COUNT)\n+#define ICE_FD_SB_STAT_IDX(base_idx) ICE_FD_STAT_PF_IDX(base_idx)\n+\n int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);\n int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);\n int ice_vsi_open_ctrl(struct ice_vsi *vsi);\n@@ -566,6 +571,10 @@ ice_for_each_peer(struct ice_pf *pf, void *data,\n const char *ice_stat_str(enum ice_status stat_err);\n const char *ice_aq_str(enum ice_aq_err aq_err);\n void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena);\n+int ice_get_ethtool_fdir_entry(struct ice_hw *hw, struct ethtool_rxnfc *cmd);\n+int\n+ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,\n+\t\t u32 *rule_locs);\n void ice_fdir_release_flows(struct ice_hw *hw);\n int ice_fdir_create_dflt_rules(struct ice_pf *pf);\n int ice_open(struct net_device *netdev);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex d11960b21474..f77db28e1e4c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -130,6 +130,8 @@ static const struct ice_stats ice_gstrings_pf_stats[] = {\n \tICE_PF_STAT(\"illegal_bytes.nic\", stats.illegal_bytes),\n \tICE_PF_STAT(\"mac_local_faults.nic\", stats.mac_local_faults),\n \tICE_PF_STAT(\"mac_remote_faults.nic\", stats.mac_remote_faults),\n+\tICE_PF_STAT(\"fdir_sb_match.nic\", stats.fd_sb_match),\n+\tICE_PF_STAT(\"fdir_sb_status.nic\", stats.fd_sb_status),\n };\n \n static const u32 ice_regs_dump_list[] = {\n@@ -2558,12 +2560,27 @@ ice_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n \tstruct ice_vsi *vsi = np->vsi;\n \tint ret = -EOPNOTSUPP;\n+\tstruct ice_hw *hw;\n+\n+\thw = &vsi->back->hw;\n \n \tswitch (cmd->cmd) {\n \tcase ETHTOOL_GRXRINGS:\n \t\tcmd->data = vsi->rss_size;\n \t\tret = 0;\n \t\tbreak;\n+\tcase ETHTOOL_GRXCLSRLCNT:\n+\t\tcmd->rule_cnt = hw->fdir_active_fltr;\n+\t\t/* report total rule count */\n+\t\tcmd->data = ice_get_fdir_cnt_all(hw);\n+\t\tret = 0;\n+\t\tbreak;\n+\tcase ETHTOOL_GRXCLSRULE:\n+\t\tret = ice_get_ethtool_fdir_entry(hw, cmd);\n+\t\tbreak;\n+\tcase ETHTOOL_GRXCLSRLALL:\n+\t\tret = ice_get_fdir_fltr_ids(hw, cmd, (u32 *)rule_locs);\n+\t\tbreak;\n \tcase ETHTOOL_GRXFH:\n \t\tice_get_rss_hash_opt(vsi, cmd);\n \t\tret = 0;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\nindex f07f40cb70bd..a7349cdb5ed1 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c\n@@ -12,6 +12,167 @@\n */\n #define TNL_SEG_CNT(_TNL_) ((_TNL_) + 1)\n \n+/**\n+ * ice_fltr_to_ethtool_flow - convert filter type values to ethtool\n+ * flow type values\n+ * @flow: filter type to be converted\n+ *\n+ * Returns the corresponding ethtool flow type.\n+ */\n+static int ice_fltr_to_ethtool_flow(enum ice_fltr_ptype flow)\n+{\n+\tswitch (flow) {\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_TCP:\n+\t\treturn TCP_V4_FLOW;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_UDP:\n+\t\treturn UDP_V4_FLOW;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_SCTP:\n+\t\treturn SCTP_V4_FLOW;\n+\tcase ICE_FLTR_PTYPE_NONF_IPV4_OTHER:\n+\t\treturn IPV4_USER_FLOW;\n+\tdefault:\n+\t\t/* 0 is undefined ethtool flow */\n+\t\treturn 0;\n+\t}\n+}\n+\n+/**\n+ * ice_ethtool_flow_to_fltr - convert ethtool flow type to filter enum\n+ * @eth: Ethtool flow type to be converted\n+ *\n+ * Returns flow enum\n+ */\n+static enum ice_fltr_ptype ice_ethtool_flow_to_fltr(int eth)\n+{\n+\tswitch (eth) {\n+\tcase TCP_V4_FLOW:\n+\t\treturn ICE_FLTR_PTYPE_NONF_IPV4_TCP;\n+\tcase UDP_V4_FLOW:\n+\t\treturn ICE_FLTR_PTYPE_NONF_IPV4_UDP;\n+\tcase SCTP_V4_FLOW:\n+\t\treturn ICE_FLTR_PTYPE_NONF_IPV4_SCTP;\n+\tcase IPV4_USER_FLOW:\n+\t\treturn ICE_FLTR_PTYPE_NONF_IPV4_OTHER;\n+\tdefault:\n+\t\treturn ICE_FLTR_PTYPE_NONF_NONE;\n+\t}\n+}\n+\n+/**\n+ * ice_get_ethtool_fdir_entry - fill ethtool structure with fdir filter data\n+ * @hw: hardware structure that contains filter list\n+ * @cmd: ethtool command data structure to receive the filter data\n+ *\n+ * Returns 0 on success and -EINVAL on failure\n+ */\n+int ice_get_ethtool_fdir_entry(struct ice_hw *hw, struct ethtool_rxnfc *cmd)\n+{\n+\tstruct ethtool_rx_flow_spec *fsp;\n+\tstruct ice_fdir_fltr *rule;\n+\tint ret = 0;\n+\tu16 idx;\n+\n+\tfsp = (struct ethtool_rx_flow_spec *)&cmd->fs;\n+\n+\tmutex_lock(&hw->fdir_fltr_lock);\n+\n+\trule = ice_fdir_find_fltr_by_idx(hw, fsp->location);\n+\n+\tif (!rule || fsp->location != rule->fltr_id) {\n+\t\tret = -EINVAL;\n+\t\tgoto release_lock;\n+\t}\n+\n+\tfsp->flow_type = ice_fltr_to_ethtool_flow(rule->flow_type);\n+\n+\tmemset(&fsp->m_u, 0, sizeof(fsp->m_u));\n+\tmemset(&fsp->m_ext, 0, sizeof(fsp->m_ext));\n+\n+\tswitch (fsp->flow_type) {\n+\tcase IPV4_USER_FLOW:\n+\t\tfsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4;\n+\t\tfsp->h_u.usr_ip4_spec.proto = 0;\n+\t\tfsp->h_u.usr_ip4_spec.l4_4_bytes = rule->ip.l4_header;\n+\t\tfsp->h_u.usr_ip4_spec.tos = rule->ip.tos;\n+\t\tfsp->h_u.usr_ip4_spec.ip4src = rule->ip.src_ip;\n+\t\tfsp->h_u.usr_ip4_spec.ip4dst = rule->ip.dst_ip;\n+\t\tfsp->m_u.usr_ip4_spec.ip4src = rule->mask.src_ip;\n+\t\tfsp->m_u.usr_ip4_spec.ip4dst = rule->mask.dst_ip;\n+\t\tfsp->m_u.usr_ip4_spec.ip_ver = 0xFF;\n+\t\tfsp->m_u.usr_ip4_spec.proto = 0;\n+\t\tfsp->m_u.usr_ip4_spec.l4_4_bytes = rule->mask.l4_header;\n+\t\tfsp->m_u.usr_ip4_spec.tos = rule->mask.tos;\n+\t\tbreak;\n+\tcase TCP_V4_FLOW:\n+\tcase UDP_V4_FLOW:\n+\tcase SCTP_V4_FLOW:\n+\t\tfsp->h_u.tcp_ip4_spec.psrc = rule->ip.src_port;\n+\t\tfsp->h_u.tcp_ip4_spec.pdst = rule->ip.dst_port;\n+\t\tfsp->h_u.tcp_ip4_spec.ip4src = rule->ip.src_ip;\n+\t\tfsp->h_u.tcp_ip4_spec.ip4dst = rule->ip.dst_ip;\n+\t\tfsp->m_u.tcp_ip4_spec.psrc = rule->mask.src_port;\n+\t\tfsp->m_u.tcp_ip4_spec.pdst = rule->mask.dst_port;\n+\t\tfsp->m_u.tcp_ip4_spec.ip4src = rule->mask.src_ip;\n+\t\tfsp->m_u.tcp_ip4_spec.ip4dst = rule->mask.dst_ip;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\tif (rule->dest_ctl == ICE_FLTR_PRGM_DESC_DEST_DROP_PKT)\n+\t\tfsp->ring_cookie = RX_CLS_FLOW_DISC;\n+\telse\n+\t\tfsp->ring_cookie = rule->q_index;\n+\n+\tidx = ice_ethtool_flow_to_fltr(fsp->flow_type);\n+\tif (idx == ICE_FLTR_PTYPE_NONF_NONE) {\n+\t\tdev_err(ice_hw_to_dev(hw), \"Missing input index for flow_type %d\\n\",\n+\t\t\trule->flow_type);\n+\t\tret = -EINVAL;\n+\t}\n+\n+release_lock:\n+\tmutex_unlock(&hw->fdir_fltr_lock);\n+\treturn ret;\n+}\n+\n+/**\n+ * ice_get_fdir_fltr_ids - fill buffer with filter IDs of active filters\n+ * @hw: hardware structure containing the filter list\n+ * @cmd: ethtool command data structure\n+ * @rule_locs: ethtool array passed in from OS to receive filter IDs\n+ *\n+ * Returns 0 as expected for success by ethtool\n+ */\n+int\n+ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,\n+\t\t u32 *rule_locs)\n+{\n+\tstruct ice_fdir_fltr *f_rule;\n+\tunsigned int cnt = 0;\n+\tint val = 0;\n+\n+\t/* report total rule count */\n+\tcmd->data = ice_get_fdir_cnt_all(hw);\n+\n+\tmutex_lock(&hw->fdir_fltr_lock);\n+\n+\tlist_for_each_entry(f_rule, &hw->fdir_list_head, fltr_node) {\n+\t\tif (cnt == cmd->rule_cnt) {\n+\t\t\tval = -EMSGSIZE;\n+\t\t\tgoto release_lock;\n+\t\t}\n+\t\trule_locs[cnt] = f_rule->fltr_id;\n+\t\tcnt++;\n+\t}\n+\n+release_lock:\n+\tmutex_unlock(&hw->fdir_fltr_lock);\n+\tif (!val)\n+\t\tcmd->rule_cnt = cnt;\n+\treturn val;\n+}\n+\n /**\n * ice_fdir_get_hw_prof - return the ice_fd_hw_proc associated with a flow\n * @hw: hardware structure containing the filter list\ndiff --git a/drivers/net/ethernet/intel/ice/ice_fdir.c b/drivers/net/ethernet/intel/ice/ice_fdir.c\nindex c43f79d0bd5a..68405882f63f 100644\n--- a/drivers/net/ethernet/intel/ice/ice_fdir.c\n+++ b/drivers/net/ethernet/intel/ice/ice_fdir.c\n@@ -52,3 +52,36 @@ ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)\n \t\t\t\t ICE_AQC_RES_TYPE_FLAG_DEDICATED, num_fltr,\n \t\t\t\t cntr_id);\n }\n+\n+/**\n+ * ice_get_fdir_cnt_all - get the number of Flow Director filters\n+ * @hw: hardware data structure\n+ *\n+ * Returns the number of filters available on device\n+ */\n+int ice_get_fdir_cnt_all(struct ice_hw *hw)\n+{\n+\treturn hw->func_caps.fd_fltr_guar + hw->func_caps.fd_fltr_best_effort;\n+}\n+\n+/**\n+ * ice_fdir_find_by_idx - find filter with idx\n+ * @hw: pointer to hardware structure\n+ * @fltr_idx: index to find.\n+ *\n+ * Returns pointer to filter if found or null\n+ */\n+struct ice_fdir_fltr *\n+ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx)\n+{\n+\tstruct ice_fdir_fltr *rule;\n+\n+\tlist_for_each_entry(rule, &hw->fdir_list_head, fltr_node) {\n+\t\t/* rule ID found in the list */\n+\t\tif (fltr_idx == rule->fltr_id)\n+\t\t\treturn rule;\n+\t\tif (fltr_idx < rule->fltr_id)\n+\t\t\tbreak;\n+\t}\n+\treturn NULL;\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_fdir.h b/drivers/net/ethernet/intel/ice/ice_fdir.h\nindex 2cb8cb089d9f..d37171d1a306 100644\n--- a/drivers/net/ethernet/intel/ice/ice_fdir.h\n+++ b/drivers/net/ethernet/intel/ice/ice_fdir.h\n@@ -3,10 +3,57 @@\n \n #ifndef _ICE_FDIR_H_\n #define _ICE_FDIR_H_\n+\n+enum ice_fltr_prgm_desc_dest {\n+\tICE_FLTR_PRGM_DESC_DEST_DROP_PKT,\n+\tICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX,\n+};\n+\n+struct ice_fdir_v4 {\n+\t__be32 dst_ip;\n+\t__be32 src_ip;\n+\t__be16 dst_port;\n+\t__be16 src_port;\n+\t__be32 l4_header;\n+\t__be32 sec_parm_idx;\t/* security parameter index */\n+\tu8 tos;\n+\tu8 ip_ver;\n+\tu8 proto;\n+};\n+\n+struct ice_fdir_extra {\n+\tu8 dst_mac[ETH_ALEN];\t/* dest MAC address */\n+\tu32 usr_def[2];\t\t/* user data */\n+\t__be16 vlan_type;\t/* VLAN ethertype */\n+\t__be16 vlan_tag;\t/* VLAN tag info */\n+};\n+\n+struct ice_fdir_fltr {\n+\tstruct list_head fltr_node;\n+\tenum ice_fltr_ptype flow_type;\n+\n+\tstruct ice_fdir_v4 ip;\n+\tstruct ice_fdir_v4 mask;\n+\n+\tstruct ice_fdir_extra ext_data;\n+\tstruct ice_fdir_extra ext_mask;\n+\n+\t/* filter control */\n+\tu16 q_index;\n+\tu16 dest_vsi;\n+\tu8 dest_ctl;\n+\tu8 fltr_status;\n+\tu16 cnt_index;\n+\tu32 fltr_id;\n+};\n+\n enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);\n enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);\n enum ice_status\n ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);\n enum ice_status\n ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);\n+int ice_get_fdir_cnt_all(struct ice_hw *hw);\n+struct ice_fdir_fltr *\n+ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx);\n #endif /* _ICE_FDIR_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\nindex 3a85138d526b..dd96409673d4 100644\n--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n@@ -344,6 +344,7 @@\n #define GLPRT_TDOLD(_i)\t\t\t\t(0x00381280 + ((_i) * 8))\n #define GLPRT_UPRCL(_i)\t\t\t\t(0x00381300 + ((_i) * 8))\n #define GLPRT_UPTCL(_i)\t\t\t\t(0x003811C0 + ((_i) * 8))\n+#define GLSTAT_FD_CNT0L(_i)\t\t\t(0x003A0000 + ((_i) * 8))\n #define GLV_BPRCL(_i)\t\t\t\t(0x003B6000 + ((_i) * 8))\n #define GLV_BPTCL(_i)\t\t\t\t(0x0030E000 + ((_i) * 8))\n #define GLV_GORCL(_i)\t\t\t\t(0x003B0000 + ((_i) * 8))\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 83457d8ca587..bf7d070eaba1 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -4343,6 +4343,7 @@ void ice_update_pf_stats(struct ice_pf *pf)\n {\n \tstruct ice_hw_port_stats *prev_ps, *cur_ps;\n \tstruct ice_hw *hw = &pf->hw;\n+\tu16 fd_ctr_base;\n \tu8 port;\n \n \tport = hw->port_info->lport;\n@@ -4431,6 +4432,12 @@ void ice_update_pf_stats(struct ice_pf *pf)\n \tice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded,\n \t\t\t &prev_ps->tx_size_big, &cur_ps->tx_size_big);\n \n+\tfd_ctr_base = hw->fd_ctr_base;\n+\n+\tice_stat_update40(hw,\n+\t\t\t GLSTAT_FD_CNT0L(ICE_FD_SB_STAT_IDX(fd_ctr_base)),\n+\t\t\t pf->stat_prev_loaded, &prev_ps->fd_sb_match,\n+\t\t\t &cur_ps->fd_sb_match);\n \tice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded,\n \t\t\t &prev_ps->link_xon_rx, &cur_ps->link_xon_rx);\n \n@@ -4474,6 +4481,8 @@ void ice_update_pf_stats(struct ice_pf *pf)\n \tice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded,\n \t\t\t &prev_ps->rx_jabber, &cur_ps->rx_jabber);\n \n+\tcur_ps->fd_sb_status = test_bit(ICE_FLAG_FD_ENA, pf->flags) ? 1 : 0;\n+\n \tpf->stat_prev_loaded = true;\n }\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex 571f707544c6..5291b687a75f 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -695,6 +695,9 @@ struct ice_hw_port_stats {\n \tu64 tx_size_1023;\t\t/* ptc1023 */\n \tu64 tx_size_1522;\t\t/* ptc1522 */\n \tu64 tx_size_big;\t\t/* ptc9522 */\n+\t/* flow director stats */\n+\tu32 fd_sb_status;\n+\tu64 fd_sb_match;\n };\n \n /* Checksum and Shadow RAM pointers */\n", "prefixes": [ "S42", "2/7" ] }