From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Subject: [dpdk-dev] [PATCH 1/4] net/ice/base: add function for DSCP configure
Date: Mon, 21 Jun 2021 23:06:16 +0800 [thread overview]
Message-ID: <20210621150619.463430-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20210621150619.463430-1-qi.z.zhang@intel.com>
ice_aq_set_pfc_mode is used to configure DSCP.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ice/base/ice_dcb.c | 41 ++++++++++++++++++++++++++++++++++
drivers/net/ice/base/ice_dcb.h | 2 ++
2 files changed, 43 insertions(+)
diff --git a/drivers/net/ice/base/ice_dcb.c b/drivers/net/ice/base/ice_dcb.c
index 0aaa5ae8c1..c73fc095ff 100644
--- a/drivers/net/ice/base/ice_dcb.c
+++ b/drivers/net/ice/base/ice_dcb.c
@@ -735,6 +735,47 @@ ice_aq_get_cee_dcb_cfg(struct ice_hw *hw,
return ice_aq_send_cmd(hw, &desc, (void *)buff, sizeof(*buff), cd);
}
+/**
+ * ice_aq_set_pfc_mode - Set PFC mode
+ * @hw: pointer to the HW struct
+ * @pfc_mode: value of PFC mode to set
+ * @cd: pointer to command details structure or NULL
+ *
+ * This AQ call configures the PFC mdoe to DSCP-based PFC mode or VLAN
+ * -based PFC (0x0303)
+ */
+enum ice_status
+ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd)
+{
+ struct ice_aqc_set_query_pfc_mode *cmd;
+ struct ice_aq_desc desc;
+ enum ice_status status;
+
+ if (pfc_mode > ICE_AQC_PFC_DSCP_BASED_PFC)
+ return ICE_ERR_PARAM;
+
+ cmd = &desc.params.set_query_pfc_mode;
+
+ ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_pfc_mode);
+
+ cmd->pfc_mode = pfc_mode;
+
+ status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+ if (status)
+ return status;
+
+ /* The spec isn't clear about whether the FW will return an error code
+ * if the PFC mode requested by the driver was not set. The spec just
+ * says that the FW will write the PFC mode set back into cmd->pfc_mode,
+ * so after the AQ has been executed, check if cmd->pfc_mode is what was
+ * requested.
+ */
+ if (cmd->pfc_mode != pfc_mode)
+ return ICE_ERR_NOT_SUPPORTED;
+
+ return ICE_SUCCESS;
+}
+
/**
* ice_cee_to_dcb_cfg
* @cee_cfg: pointer to CEE configuration struct
diff --git a/drivers/net/ice/base/ice_dcb.h b/drivers/net/ice/base/ice_dcb.h
index a053adbb30..24c8da2dc8 100644
--- a/drivers/net/ice/base/ice_dcb.h
+++ b/drivers/net/ice/base/ice_dcb.h
@@ -196,6 +196,8 @@ enum ice_status
ice_aq_get_cee_dcb_cfg(struct ice_hw *hw,
struct ice_aqc_get_cee_dcb_cfg_resp *buff,
struct ice_sq_cd *cd);
+enum ice_status
+ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);
enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg);
u8 ice_get_dcbx_status(struct ice_hw *hw);
enum ice_status
--
2.26.2
next prev parent reply other threads:[~2021-06-21 15:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 15:06 [dpdk-dev] [PATCH 0/4] ice base code update Qi Zhang
2021-06-21 15:06 ` Qi Zhang [this message]
2021-06-21 15:06 ` [dpdk-dev] [PATCH 2/4] net/ice/base: remove firmware log Qi Zhang
2021-06-21 15:06 ` [dpdk-dev] [PATCH 3/4] net/ice/base: remove VSI info from previous aggregator Qi Zhang
2021-06-21 15:06 ` [dpdk-dev] [PATCH 4/4] net/ice/base: remove unncessary code 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=20210621150619.463430-2-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=anirudh.venkataramanan@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).