DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
	Brett Creeley <brett.creeley@intel.com>
Subject: [dpdk-dev] [PATCH v2 07/21] net/ice/base: add functions to allocate and free a RSS global LUT
Date: Sun, 25 Oct 2020 08:29:39 +0800	[thread overview]
Message-ID: <20201025002953.1680999-8-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20201025002953.1680999-1-qi.z.zhang@intel.com>

Currently there is no API to allocate and free a RSS global LUT.
Incoming changes to support VFs having >16 queues will require using
RSS global LUT resources. The functions included will allow a PF to
configure a RSS global LUT for VFs that request >16 queues.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 65 +++++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_switch.h |  2 +
 2 files changed, 67 insertions(+)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 01d59edf42..cd78685735 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -1848,6 +1848,71 @@ ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp_elem *buf,
 	return status;
 }
 
+/**
+ * ice_alloc_rss_global_lut - allocate a RSS global LUT
+ * @hw: pointer to the HW struct
+ * @shared_res: true to allocate as a shared resource and false to allocate as a dedicated resource
+ * @global_lut_id: output parameter for the RSS global LUT's ID
+ */
+enum ice_status ice_alloc_rss_global_lut(struct ice_hw *hw, bool shared_res, u16 *global_lut_id)
+{
+	struct ice_aqc_alloc_free_res_elem *sw_buf;
+	enum ice_status status;
+	u16 buf_len;
+
+	buf_len = ice_struct_size(sw_buf, elem, 1);
+	sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len);
+	if (!sw_buf)
+		return ICE_ERR_NO_MEMORY;
+
+	sw_buf->num_elems = CPU_TO_LE16(1);
+	sw_buf->res_type = CPU_TO_LE16(ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH |
+				       (shared_res ? ICE_AQC_RES_TYPE_FLAG_SHARED :
+				       ICE_AQC_RES_TYPE_FLAG_DEDICATED));
+
+	status = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len, ice_aqc_opc_alloc_res, NULL);
+	if (status) {
+		ice_debug(hw, ICE_DBG_RES, "Failed to allocate %s RSS global LUT, status %d\n",
+			  shared_res ? "shared" : "dedicated", status);
+		goto ice_alloc_global_lut_exit;
+	}
+
+	*global_lut_id = LE16_TO_CPU(sw_buf->elem[0].e.sw_resp);
+
+ice_alloc_global_lut_exit:
+	ice_free(hw, sw_buf);
+	return status;
+}
+
+/**
+ * ice_free_global_lut - free a RSS global LUT
+ * @hw: pointer to the HW struct
+ * @global_lut_id: ID of the RSS global LUT to free
+ */
+enum ice_status ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id)
+{
+	struct ice_aqc_alloc_free_res_elem *sw_buf;
+	u16 buf_len, num_elems = 1;
+	enum ice_status status;
+
+	buf_len = ice_struct_size(sw_buf, elem, num_elems);
+	sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len);
+	if (!sw_buf)
+		return ICE_ERR_NO_MEMORY;
+
+	sw_buf->num_elems = CPU_TO_LE16(num_elems);
+	sw_buf->res_type = CPU_TO_LE16(ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH);
+	sw_buf->elem[0].e.sw_resp = CPU_TO_LE16(global_lut_id);
+
+	status = ice_aq_alloc_free_res(hw, num_elems, sw_buf, buf_len, ice_aqc_opc_free_res, NULL);
+	if (status)
+		ice_debug(hw, ICE_DBG_RES, "Failed to free RSS global LUT %d, status %d\n",
+			  global_lut_id, status);
+
+	ice_free(hw, sw_buf);
+	return status;
+}
+
 /**
  * ice_alloc_sw - allocate resources specific to switch
  * @hw: pointer to the HW struct
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index a7e94344c1..be9b74fd4c 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -418,6 +418,8 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
 
 /* Switch/bridge related commands */
 enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
+enum ice_status ice_alloc_rss_global_lut(struct ice_hw *hw, bool shared_res, u16 *global_lut_id);
+enum ice_status ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id);
 enum ice_status
 ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,
 	     u16 *counter_id);
-- 
2.25.4


  parent reply	other threads:[~2020-10-25  0:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25  0:29 [dpdk-dev] [PATCH v2 00/21] ice: update base code Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 01/21] net/ice/base: add tunnel support for FDIR Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 02/21] net/ice/base: add NVM Write Response flags Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 03/21] net/ice/base: modify ptype bitmap for outer MAC Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 04/21] net/ice/base: rename ptype bitmap Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 05/21] net/ice/base: move sched function prototypes Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 06/21] net/ice/base: read security revision Qi Zhang
2020-10-25  0:29 ` Qi Zhang [this message]
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 08/21] net/ice/base: add more capability to admin queue Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 09/21] net/ice/base: update to use package info from ice segment Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 10/21] net/ice/base: use malloc instead of calloc Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 11/21] net/ice/base: add support for class 5+ modules Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 12/21] net/ice/base: return error directly Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 13/21] net/ice/base: implement shared rate limiter Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 14/21] net/ice/base: recognize 860 as iSCSI port in CEE mode Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 15/21] net/ice/base: fix parameter name in comment Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 16/21] net/ice/base: support extended GPIO access Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 17/21] net/ice/base: remove duplicated AQ command flag setting Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 18/21] net/ice/base: introduce and use FLEX_ARRAY_SIZE where possible Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 19/21] net/ice/base: refactor RSS configure API Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 20/21] net/ice/base: add support for get/set RSS LUT to specify global LUT Qi Zhang
2020-10-25  0:29 ` [dpdk-dev] [PATCH v2 21/21] net/ice/base: update version Qi Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201025002953.1680999-8-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=brett.creeley@intel.com \
    --cc=dev@dpdk.org \
    --cc=qiming.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).