From: Shai Malin <smalin@marvell.com>
To: <linux-rdma@vger.kernel.org>, <dledford@redhat.com>,
<jgg@nvidia.com>, <mkalderon@marvell.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <smalin@marvell.com>,
<aelior@marvell.com>, <pkushwaha@marvell.com>,
<prabhakar.pkin@gmail.com>, <malin1024@gmail.com>
Subject: [PATCH for-next 1/3] qed: add get and set support for dscp priority
Date: Thu, 29 Jul 2021 16:30:30 +0300 [thread overview]
Message-ID: <20210729133032.26278-2-smalin@marvell.com> (raw)
In-Reply-To: <20210729133032.26278-1-smalin@marvell.com>
From: Prabhakar Kushwaha <pkushwaha@marvell.com>
This patch add support of get or set priority value for a given
dscp index.
Signed-off-by: Shai Malin <smalin@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
---
drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 65 ++++++++++++++++++++++
drivers/net/ethernet/qlogic/qed/qed_dcbx.h | 9 +++
include/linux/qed/qed_if.h | 6 ++
3 files changed, 80 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index e81dd34a3cac..ba9276599e72 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -1280,6 +1280,71 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
return 0;
}
+int qed_dcbx_get_dscp_priority(struct qed_hwfn *p_hwfn, u8 dscp_index,
+ u8 *p_dscp_pri)
+{
+ struct qed_dcbx_get *p_dcbx_info;
+ int rc;
+
+ if (IS_VF(p_hwfn->cdev)) {
+ DP_ERR(p_hwfn->cdev,
+ "qed rdma get dscp priority not supported for VF.\n");
+ return -EINVAL;
+ }
+
+ if (dscp_index >= QED_DCBX_DSCP_SIZE) {
+ DP_ERR(p_hwfn, "Invalid dscp index %d\n", dscp_index);
+ return -EINVAL;
+ }
+
+ p_dcbx_info = kmalloc(sizeof(*p_dcbx_info), GFP_KERNEL);
+ if (!p_dcbx_info)
+ return -ENOMEM;
+
+ memset(p_dcbx_info, 0, sizeof(*p_dcbx_info));
+ rc = qed_dcbx_query_params(p_hwfn, p_dcbx_info,
+ QED_DCBX_OPERATIONAL_MIB);
+ if (rc) {
+ kfree(p_dcbx_info);
+ return rc;
+ }
+
+ *p_dscp_pri = p_dcbx_info->dscp.dscp_pri_map[dscp_index];
+ kfree(p_dcbx_info);
+
+ return 0;
+}
+
+int qed_dcbx_set_dscp_priority(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
+ u8 dscp_index, u8 pri_val)
+{
+ struct qed_dcbx_set dcbx_set;
+ int rc;
+
+ if (IS_VF(p_hwfn->cdev)) {
+ DP_ERR(p_hwfn->cdev,
+ "qed rdma set dscp priority not supported for VF.\n");
+ return -EINVAL;
+ }
+
+ if (dscp_index >= QED_DCBX_DSCP_SIZE ||
+ pri_val >= QED_MAX_PFC_PRIORITIES) {
+ DP_ERR(p_hwfn, "Invalid dscp params: index = %d pri = %d\n",
+ dscp_index, pri_val);
+ return -EINVAL;
+ }
+
+ memset(&dcbx_set, 0, sizeof(dcbx_set));
+ rc = qed_dcbx_get_config_params(p_hwfn, &dcbx_set);
+ if (rc)
+ return rc;
+
+ dcbx_set.override_flags = QED_DCBX_OVERRIDE_DSCP_CFG;
+ dcbx_set.dscp.dscp_pri_map[dscp_index] = pri_val;
+
+ return qed_dcbx_config_params(p_hwfn, p_ptt, &dcbx_set, 1);
+}
+
static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn,
enum qed_mib_read_type type)
{
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
index e1798925b444..6d8ce9bb30bd 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h
@@ -46,6 +46,7 @@ struct qed_dcbx_set {
bool enabled;
struct qed_dcbx_admin_params config;
u32 ver_num;
+ struct qed_dcbx_dscp_params dscp;
};
struct qed_dcbx_results {
@@ -100,6 +101,14 @@ void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
struct pf_update_ramrod_data *p_dest);
+/* Returns priority value for a given dscp index */
+int qed_dcbx_get_dscp_priority(struct qed_hwfn *p_hwfn, u8 dscp_index,
+ u8 *p_dscp_pri);
+
+/* Sets priority value for a given dscp index */
+int qed_dcbx_set_dscp_priority(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
+ u8 dscp_index, u8 pri_val);
+
#define QED_DCBX_DEFAULT_TC 0
u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri);
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index 850b98991670..f7ce9a923d7c 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -124,12 +124,18 @@ struct qed_dcbx_operational_params {
u32 err;
};
+struct qed_dcbx_dscp_params {
+ bool enabled;
+ u8 dscp_pri_map[QED_DCBX_DSCP_SIZE];
+};
+
struct qed_dcbx_get {
struct qed_dcbx_operational_params operational;
struct qed_dcbx_lldp_remote lldp_remote;
struct qed_dcbx_lldp_local lldp_local;
struct qed_dcbx_remote_params remote;
struct qed_dcbx_admin_params local;
+ struct qed_dcbx_dscp_params dscp;
};
enum qed_nvm_images {
--
2.24.1
next prev parent reply other threads:[~2021-07-29 13:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 13:30 [PATCH for-next 0/3] qedr: consider dscp prio for vlan tag and update tos Shai Malin
2021-07-29 13:30 ` Shai Malin [this message]
2021-07-29 17:21 ` [PATCH for-next 1/3] qed: add get and set support for dscp priority Leon Romanovsky
2021-07-29 13:30 ` [PATCH for-next 2/3] qedr: Consider dscp priority for vlan priority Shai Malin
2021-07-29 13:30 ` [PATCH for-next 3/3] qedr: Use grh layer traffic_class as RDMA CM TOS Shai Malin
-- strict thread matches above, loose matches on Subject: below --
2021-07-30 6:46 [PATCH for-next 1/3] qed: add get and set support for dscp priority Shai Malin
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=20210729133032.26278-2-smalin@marvell.com \
--to=smalin@marvell.com \
--cc=aelior@marvell.com \
--cc=davem@davemloft.net \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=malin1024@gmail.com \
--cc=mkalderon@marvell.com \
--cc=pkushwaha@marvell.com \
--cc=prabhakar.pkin@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.