From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denis Bolotin Subject: [PATCH net-next v2 1/3] qed: Add DCBX API - qed_dcbx_get_priority_tc() Date: Thu, 2 Aug 2018 11:12:49 +0300 Message-ID: <20180802081251.10003-2-denis.bolotin@cavium.com> References: <20180802081251.10003-1-denis.bolotin@cavium.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Denis Bolotin , Ariel Elior To: , Return-path: Received: from mail-eopbgr710089.outbound.protection.outlook.com ([40.107.71.89]:43648 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727354AbeHBKDR (ORCPT ); Thu, 2 Aug 2018 06:03:17 -0400 In-Reply-To: <20180802081251.10003-1-denis.bolotin@cavium.com> Sender: netdev-owner@vger.kernel.org List-ID: The API receives a priority and looks for the TC it is mapped to in the operational DCBX configuration. Signed-off-by: Denis Bolotin Signed-off-by: Ariel Elior --- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 19 +++++++++++++++++++ drivers/net/ethernet/qlogic/qed/qed_dcbx.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index d02e774..53c7be8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c @@ -989,6 +989,25 @@ void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src, qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_ETH); } +int qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri, u8 *p_tc) +{ + struct qed_dcbx_get *dcbx_info = &p_hwfn->p_dcbx_info->get; + + if (pri >= QED_MAX_PFC_PRIORITIES) { + DP_ERR(p_hwfn, "Invalid priority %d\n", pri); + return -EINVAL; + } + + if (!dcbx_info->operational.valid) { + DP_ERR(p_hwfn, "Dcbx parameters not available\n"); + return -EINVAL; + } + + *p_tc = dcbx_info->operational.params.ets_pri_tc_tbl[pri]; + + return 0; +} + #ifdef CONFIG_DCB static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *p_get, diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h index 5feb90e..324244b 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h @@ -123,4 +123,5 @@ int qed_dcbx_config_params(struct qed_hwfn *, void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src, struct pf_update_ramrod_data *p_dest); +int qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri, u8 *p_tc); #endif -- 1.8.3.1