From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61108A0547; Mon, 21 Jun 2021 17:03:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C8DD411CA; Mon, 21 Jun 2021 17:03:31 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 24D18411C3 for ; Mon, 21 Jun 2021 17:03:27 +0200 (CEST) IronPort-SDR: Gu4z315mLjey2XCHOGILrAVv9CbnXBclTaV+VCgfakceswIJ3jCex45DziPGVkf5tQXiab6/Dt T6l9D6j6Mc5A== X-IronPort-AV: E=McAfee;i="6200,9189,10022"; a="187239567" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="187239567" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 08:03:07 -0700 IronPort-SDR: UoiC8ivLl9QQKpcDUUhfnm9Zva/PX45MDbhI76yMfnuP0LrtMbVbomnli1Q9LQisOIvEF5aeK5 pBeg45JEl0kw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="453911985" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga008.fm.intel.com with ESMTP; 21 Jun 2021 08:03:05 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, Qi Zhang , Anirudh Venkataramanan Date: Mon, 21 Jun 2021 23:06:16 +0800 Message-Id: <20210621150619.463430-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210621150619.463430-1-qi.z.zhang@intel.com> References: <20210621150619.463430-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/4] net/ice/base: add function for DSCP configure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ice_aq_set_pfc_mode is used to configure DSCP. Signed-off-by: Anirudh Venkataramanan Signed-off-by: Qi Zhang --- 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