From: Rasesh Mody <rasesh.mody@cavium.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: Rasesh Mody <rasesh.mody@cavium.com>, Dept-EngDPDKDev@cavium.com
Subject: [dpdk-dev] [PATCH 32/53] net/qede/base: use proper units for rate limiting
Date: Mon, 18 Sep 2017 18:51:22 -0700 [thread overview]
Message-ID: <1505785903-1741-3-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1505785903-1741-1-git-send-email-rasesh.mody@cavium.com>
Change module parameter semantics to standard units (Rate limiting is used
for DCQCN feature).
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
drivers/net/qede/base/ecore_sp_commands.c | 43 +++++++++++++++++++++++++----
drivers/net/qede/base/ecore_sp_commands.h | 8 +++---
2 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/drivers/net/qede/base/ecore_sp_commands.c b/drivers/net/qede/base/ecore_sp_commands.c
index d67805c..2f5d453 100644
--- a/drivers/net/qede/base/ecore_sp_commands.c
+++ b/drivers/net/qede/base/ecore_sp_commands.c
@@ -422,6 +422,22 @@ enum _ecore_status_t ecore_sp_pf_update_dcbx(struct ecore_hwfn *p_hwfn)
return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
}
+/* QM rate limiter resolution is 1.6Mbps */
+#define QM_RL_RESOLUTION(mb_val) ((mb_val) * 10 / 16)
+
+/* FW uses 1/64k to express gd */
+#define FW_GD_RESOLUTION(gd) (64 * 1024 / (gd))
+
+u16 ecore_sp_rl_mb_to_qm(u32 mb_val)
+{
+ return (u16)OSAL_MIN_T(u32, (u16)(~0U), QM_RL_RESOLUTION(mb_val));
+}
+
+u16 ecore_sp_rl_gd_denom(u32 gd)
+{
+ return gd ? (u16)OSAL_MIN_T(u32, (u16)(~0U), FW_GD_RESOLUTION(gd)) : 0;
+}
+
enum _ecore_status_t ecore_sp_rl_update(struct ecore_hwfn *p_hwfn,
struct ecore_rl_update_params *params)
{
@@ -453,15 +469,30 @@ enum _ecore_status_t ecore_sp_rl_update(struct ecore_hwfn *p_hwfn,
rl_update->rl_id_last = params->rl_id_last;
rl_update->rl_dc_qcn_flg = params->rl_dc_qcn_flg;
rl_update->rl_bc_rate = OSAL_CPU_TO_LE32(params->rl_bc_rate);
- rl_update->rl_max_rate = OSAL_CPU_TO_LE16(params->rl_max_rate);
- rl_update->rl_r_ai = OSAL_CPU_TO_LE16(params->rl_r_ai);
- rl_update->rl_r_hai = OSAL_CPU_TO_LE16(params->rl_r_hai);
- rl_update->dcqcn_g = OSAL_CPU_TO_LE16(params->dcqcn_g);
+ rl_update->rl_max_rate =
+ OSAL_CPU_TO_LE16(ecore_sp_rl_mb_to_qm(params->rl_max_rate));
+ rl_update->rl_r_ai =
+ OSAL_CPU_TO_LE16(ecore_sp_rl_mb_to_qm(params->rl_r_ai));
+ rl_update->rl_r_hai =
+ OSAL_CPU_TO_LE16(ecore_sp_rl_mb_to_qm(params->rl_r_hai));
+ rl_update->dcqcn_g =
+ OSAL_CPU_TO_LE16(ecore_sp_rl_gd_denom(params->dcqcn_gd));
rl_update->dcqcn_k_us = OSAL_CPU_TO_LE32(params->dcqcn_k_us);
- rl_update->dcqcn_timeuot_us = OSAL_CPU_TO_LE32(
- params->dcqcn_timeuot_us);
+ rl_update->dcqcn_timeuot_us =
+ OSAL_CPU_TO_LE32(params->dcqcn_timeuot_us);
rl_update->qcn_timeuot_us = OSAL_CPU_TO_LE32(params->qcn_timeuot_us);
+ DP_VERBOSE(p_hwfn, ECORE_MSG_SPQ, "rl_params: qcn_update_param_flg %x, dcqcn_update_param_flg %x, rl_init_flg %x, rl_start_flg %x, rl_stop_flg %x, rl_id_first %x, rl_id_last %x, rl_dc_qcn_flg %x, rl_bc_rate %x, rl_max_rate %x, rl_r_ai %x, rl_r_hai %x, dcqcn_g %x, dcqcn_k_us %x, dcqcn_timeuot_us %x, qcn_timeuot_us %x\n",
+ rl_update->qcn_update_param_flg,
+ rl_update->dcqcn_update_param_flg,
+ rl_update->rl_init_flg, rl_update->rl_start_flg,
+ rl_update->rl_stop_flg, rl_update->rl_id_first,
+ rl_update->rl_id_last, rl_update->rl_dc_qcn_flg,
+ rl_update->rl_bc_rate, rl_update->rl_max_rate,
+ rl_update->rl_r_ai, rl_update->rl_r_hai,
+ rl_update->dcqcn_g, rl_update->dcqcn_k_us,
+ rl_update->dcqcn_timeuot_us, rl_update->qcn_timeuot_us);
+
return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
}
diff --git a/drivers/net/qede/base/ecore_sp_commands.h b/drivers/net/qede/base/ecore_sp_commands.h
index 34d5a76..74f6a34 100644
--- a/drivers/net/qede/base/ecore_sp_commands.h
+++ b/drivers/net/qede/base/ecore_sp_commands.h
@@ -125,10 +125,10 @@ struct ecore_rl_update_params {
u8 rl_id_last;
u8 rl_dc_qcn_flg; /* If set, RL will used for DCQCN */
u32 rl_bc_rate; /* Byte Counter Limit */
- u16 rl_max_rate; /* Maximum rate in 1.6 Mbps resolution */
- u16 rl_r_ai; /* Active increase rate */
- u16 rl_r_hai; /* Hyper active increase rate */
- u16 dcqcn_g; /* DCQCN Alpha update gain in 1/64K resolution */
+ u32 rl_max_rate; /* Maximum rate in Mbps resolution */
+ u32 rl_r_ai; /* Active increase rate */
+ u32 rl_r_hai; /* Hyper active increase rate */
+ u32 dcqcn_gd; /* DCQCN Alpha update gain */
u32 dcqcn_k_us; /* DCQCN Alpha update interval */
u32 dcqcn_timeuot_us;
u32 qcn_timeuot_us;
--
1.7.10.3
next prev parent reply other threads:[~2017-09-19 1:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 1:51 [dpdk-dev] [PATCH 30/53] net/qede/base: read per queue coalescing from HW Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 31/53] net/qede/base: refactor device's number of ports logic Rasesh Mody
2017-09-19 1:51 ` Rasesh Mody [this message]
2017-09-19 1:51 ` [dpdk-dev] [PATCH 33/53] net/qede/base: use available macro Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 34/53] net/qede/base: use function pointers for spq async callback Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 35/53] net/qede/base: fix API return types Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 36/53] net/qede/base: semantic changes Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 37/53] net/qede/base: handle the error condition properly Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 38/53] net/qede/base: add new macro for CMT mode Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 39/53] net/qede/base: change verbosity Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 40/53] net/qede/base: fix number of app table entries Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 41/53] net/qede/base: update firmware to 8.30.12.0 Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 42/53] net/qede/base: add UFP support Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 43/53] net/qede/base: add support for mapped doorbell Bars for VFs Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 44/53] net/qede/base: add support for driver attribute repository Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 45/53] net/qede/base: move define to header file Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 46/53] net/qede/base: dcbx dscp related extensions Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 47/53] net/qede/base: add feature support for per-PF virtual link Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 48/53] net/qede/base: catch an init command write failure Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 49/53] net/qede/base: retain dcbx config till actually applied Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 50/53] net/qede/base: disable aRFS for NPAR and 100G Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 51/53] net/qede/base: add support for WoL writes Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 52/53] net/qede/base: remove unused input parameter Rasesh Mody
2017-09-19 1:51 ` [dpdk-dev] [PATCH 53/53] net/qede/base: update PMD version to 2.6.0.1 Rasesh Mody
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=1505785903-1741-3-git-send-email-rasesh.mody@cavium.com \
--to=rasesh.mody@cavium.com \
--cc=Dept-EngDPDKDev@cavium.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@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).