aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2015-03-18 08:57:34 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-18 14:55:19 -0400
commitfc31e2560a2443410fe45c27116fae736541a7b5 (patch)
tree6b2d25803b612cb1fcb2038d069d4063a843a4eb /include/linux/mlx4
parent822b3b2ebfff8e9b3d006086c527738a7ca00cd0 (diff)
net/mlx4_core: Add basic support for QP max-rate limiting
Add the low-level device commands and definitions used for QP max-rate limiting. This is done through the following elements: - read rate-limit device caps in QUERY_DEV_CAP: number of different rates and the min/max rates in Kbs/Mbs/Gbs units - enhance the QP context struct to contain rate limit units and value - allow to do run time rate-limit setting to QPs through the update-qp firmware command - QP rate-limiting is disallowed for VFs Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mlx4')
-rw-r--r--include/linux/mlx4/device.h17
-rw-r--r--include/linux/mlx4/qp.h14
2 files changed, 27 insertions, 4 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 1cc54822b931..4550c67b92e4 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -205,6 +205,7 @@ enum {
205 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, 205 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20,
206 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21, 206 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21,
207 MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22, 207 MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22,
208 MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT = 1LL << 23
208}; 209};
209 210
210enum { 211enum {
@@ -450,6 +451,21 @@ enum mlx4_module_id {
450 MLX4_MODULE_ID_QSFP28 = 0x11, 451 MLX4_MODULE_ID_QSFP28 = 0x11,
451}; 452};
452 453
454enum { /* rl */
455 MLX4_QP_RATE_LIMIT_NONE = 0,
456 MLX4_QP_RATE_LIMIT_KBS = 1,
457 MLX4_QP_RATE_LIMIT_MBS = 2,
458 MLX4_QP_RATE_LIMIT_GBS = 3
459};
460
461struct mlx4_rate_limit_caps {
462 u16 num_rates; /* Number of different rates */
463 u8 min_unit;
464 u16 min_val;
465 u8 max_unit;
466 u16 max_val;
467};
468
453static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 469static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
454{ 470{
455 return (major << 32) | (minor << 16) | subminor; 471 return (major << 32) | (minor << 16) | subminor;
@@ -565,6 +581,7 @@ struct mlx4_caps {
565 u32 dmfs_high_rate_qpn_base; 581 u32 dmfs_high_rate_qpn_base;
566 u32 dmfs_high_rate_qpn_range; 582 u32 dmfs_high_rate_qpn_range;
567 u32 vf_caps; 583 u32 vf_caps;
584 struct mlx4_rate_limit_caps rl_caps;
568}; 585};
569 586
570struct mlx4_buf_list { 587struct mlx4_buf_list {
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 551f85456c11..1023ebe035b7 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -207,14 +207,16 @@ struct mlx4_qp_context {
207 __be32 msn; 207 __be32 msn;
208 __be16 rq_wqe_counter; 208 __be16 rq_wqe_counter;
209 __be16 sq_wqe_counter; 209 __be16 sq_wqe_counter;
210 u32 reserved3[2]; 210 u32 reserved3;
211 __be16 rate_limit_params;
212 __be16 reserved4;
211 __be32 param3; 213 __be32 param3;
212 __be32 nummmcpeers_basemkey; 214 __be32 nummmcpeers_basemkey;
213 u8 log_page_size; 215 u8 log_page_size;
214 u8 reserved4[2]; 216 u8 reserved5[2];
215 u8 mtt_base_addr_h; 217 u8 mtt_base_addr_h;
216 __be32 mtt_base_addr_l; 218 __be32 mtt_base_addr_l;
217 u32 reserved5[10]; 219 u32 reserved6[10];
218}; 220};
219 221
220struct mlx4_update_qp_context { 222struct mlx4_update_qp_context {
@@ -229,6 +231,7 @@ struct mlx4_update_qp_context {
229enum { 231enum {
230 MLX4_UPD_QP_MASK_PM_STATE = 32, 232 MLX4_UPD_QP_MASK_PM_STATE = 32,
231 MLX4_UPD_QP_MASK_VSD = 33, 233 MLX4_UPD_QP_MASK_VSD = 33,
234 MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
232}; 235};
233 236
234enum { 237enum {
@@ -428,7 +431,8 @@ struct mlx4_wqe_inline_seg {
428enum mlx4_update_qp_attr { 431enum mlx4_update_qp_attr {
429 MLX4_UPDATE_QP_SMAC = 1 << 0, 432 MLX4_UPDATE_QP_SMAC = 1 << 0,
430 MLX4_UPDATE_QP_VSD = 1 << 1, 433 MLX4_UPDATE_QP_VSD = 1 << 1,
431 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 434 MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
435 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 3) - 1
432}; 436};
433 437
434enum mlx4_update_qp_params_flags { 438enum mlx4_update_qp_params_flags {
@@ -438,6 +442,8 @@ enum mlx4_update_qp_params_flags {
438struct mlx4_update_qp_params { 442struct mlx4_update_qp_params {
439 u8 smac_index; 443 u8 smac_index;
440 u32 flags; 444 u32 flags;
445 u16 rate_unit;
446 u16 rate_val;
441}; 447};
442 448
443int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 449int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,