RDMA/bnxt_re: Congestion control settings using debugfs hook
Subsystems (2)
Selvin Xavier
maintainerPATCH 1/1 RDMA/bnxt_re: Congestion control settings using debugfs hook
Implements routines to set and get different settings of the congestion control. This will enable the users to modify the settings according to their network.
Currently supporting only GEN 0 version of the parameters. Reading these files queries the firmware and report the values currently programmed. Writing to the files sends commands that update the congestion control settings.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 215 +++++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/debugfs.h | 15 +++ 3 files changed, 231 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -232,6 +232,8 @@ struct bnxt_re_dev {unsigned long event_bitmap;struct bnxt_qplib_cc_param cc_param;struct workqueue_struct *dcb_wq; +struct dentry *cc_config; +struct bnxt_re_dbg_cc_config_params *cc_config_params; };#define to_bnxt_re_dev (ptr, member) \
drivers/infiniband/hw/bnxt_re/debugfs.c +214 -1
239 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/debugfs.h +15 -0
@@ -18,4 +18,19 @@ void bnxt_re_debugfs_rem_pdev(struct bnxt_re_dev *rdev);void bnxt_re_register_debugfs (void );void bnxt_re_unregister_debugfs (void ); +#define CC_CONFIG_GEN_EXT (x, y) (((x) << 16) | (y)) +#define CC_CONFIG_GEN0_EXT0 CC_CONFIG_GEN_EXT(0, 0) + +#define BNXT_RE_CC_PARAM_GEN0 __ffs(CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_INACTIVITY_CP) + +struct bnxt_re_cc_param { +struct bnxt_re_dev *rdev; +struct dentry *dentry; +u32 offset; +u8 cc_gen; +}; + +struct bnxt_re_dbg_cc_config_params { +struct bnxt_re_cc_param gen0_parms[BNXT_RE_CC_PARAM_GEN0 ]; +};#endif
Signature · 1 line
2.5.5
Quoted 15 lines · Selvin Xavier
Implements routines to set and get different settings of the congestion control. This will enable the users to modify the settings according to their network.
Currently supporting only GEN 0 version of the parameters. Reading these files queries the firmware and report the values currently programmed. Writing to the files sends commands that update the congestion control settings.
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 215 +++++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/debugfs.h | 15 +++ 3 files changed, 231 insertions(+), 1 deletion(-)
<...>
drivers/infiniband/hw/bnxt_re/debugfs.c line 27
Quoted 3 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +3
-0+static const char *const bnxt_re_cc_gen0_name[] = { +"enable_cc" , +"g" ,
????
Quoted 13 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +13
-0+"num_phase_per_state" , +"init_cr" , +"init_tr" , +"tos_ecn" , +"tos_dscp" , +"alt_vlan_pcp" , +"alt_vlan_dscp" , +"rtt" , +"cc_mode" , +"tcp_cp" , +"tx_queue" , + "inactivity_cp", +};
<...>
Quoted 18 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +18
-0+static int map_cc_config_offset_gen0_ext0 (u32 offset,struct bnxt_qplib_cc_param *ccparam,u32 *val) +{ +u64 map_offset; + + map_offset =BIT (offset); + +switch (map_offset) { +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ENABLE_CC : + *val = ccparam->enable; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_G : + *val = ccparam->g; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_NUMPHASEPERSTATE : + *val = ccparam->nph_per_state; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_INIT_CR : + *val = ccparam->init_cr;
drivers/infiniband/hw/bnxt_re/debugfs.c void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp) · line 157
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +10
-0+break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_INIT_TR : + *val = ccparam->init_tr; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_ECN : + *val = ccparam->tos_ecn; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_DSCP : + *val = ccparam->tos_dscp; +break ;
Wrong indentations, above and below.
Quoted 27 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +27
-0+case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ALT_VLAN_PCP : + *val = ccparam->alt_vlan_pcp; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ALT_TOS_DSCP : + *val = ccparam->alt_tos_dscp; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_RTT : + *val = ccparam->rtt; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_CC_MODE : + *val = ccparam->cc_mode; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TCP_CP : + *val = ccparam->tcp_cp; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static ssize_t bnxt_re_cc_config_get (struct file *filp,char __user *buffer, +size_t usr_buf_len,loff_t *ppos) +{ +struct bnxt_re_cc_param *dbg_cc_param = filp->private_data; +struct bnxt_re_dev *rdev = dbg_cc_param->rdev;
drivers/infiniband/hw/bnxt_re/debugfs.c void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp) · line 194
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +10
-0+struct bnxt_qplib_cc_param ccparam = {}; +u32 offset = dbg_cc_param->offset; +char buf[16 ]; +u32 val; +int rc; + + rc =bnxt_qplib_query_cc_param (&rdev->qplib_res, &ccparam); +if (rc) { +dev_err (rdev_to_dev (rdev), +"%s: Failed to query CC parameters\n" , __func__);
Let's not have debug print, and especially dev_err here.
Review
Quoted 1 line
(quoted diff) +1
-0+ return -EINVAL;
bnxt_qplib_query_cc_param() can return ENOMEM, there is no need to overwrite return value.
Quoted 13 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +13
-0+ } + + rc =map_cc_config_offset_gen0_ext0 (offset, &ccparam, &val); +if (rc) +return rc; + + rc =snprintf (buf,sizeof (buf),"%d\n" , val); +if (rc <0 ) +return rc; + +return simple_read_from_buffer (buffer, usr_buf_len, ppos, (u8 *)(buf), rc); +} +
Selvin Xavier
maintainerQuoted 18 lines · Leon Romanovsky
Quoted 9 lines · Selvin Xavier
Implements routines to set and get different settings of the congestion control. This will enable the users to modify the settings according to their network.
Currently supporting only GEN 0 version of the parameters. Reading these files queries the firmware and report the values currently programmed. Writing to the files sends commands that update the congestion control settings.
Quoted 6 lines
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 215 +++++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/debugfs.h | 15 +++ 3 files changed, 231 insertions(+), 1 deletion(-)
Quoted 7 lines
<...>
drivers/infiniband/hw/bnxt_re/debugfs.c line 27
Quoted 3 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +3
-0+static const char *const bnxt_re_cc_gen0_name[] = { +"enable_cc" , +"g" ,????
It is the "running avg. weight" used by Congestion control algo in HW. It is referred as "g" in the parameters and the FW command. So used the same name for the debugfs file.
Quoted 39 lines
Quoted 14 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +13
-0+"num_phase_per_state" , +"init_cr" , +"init_tr" , +"tos_ecn" , +"tos_dscp" , +"alt_vlan_pcp" , +"alt_vlan_dscp" , +"rtt" , +"cc_mode" , +"tcp_cp" , +"tx_queue" , + "inactivity_cp", +};<...>
Quoted 22 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +22
-0+static int map_cc_config_offset_gen0_ext0 (u32 offset,struct bnxt_qplib_cc_param *ccparam,u32 *val) +{ +u64 map_offset; + + map_offset =BIT (offset); + +switch (map_offset) { +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ENABLE_CC : + *val = ccparam->enable; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_G : + *val = ccparam->g; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_NUMPHASEPERSTATE : + *val = ccparam->nph_per_state; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_INIT_CR : + *val = ccparam->init_cr; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_INIT_TR : + *val = ccparam->init_tr; +break ;
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/debugfs.c void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp) · line 157
Quoted 6 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +6
-0+case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_ECN : + *val = ccparam->tos_ecn; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_DSCP : + *val = ccparam->tos_dscp; +break ;Wrong indentations, above and below.
My bad. Will fix it.
Quoted 32 lines
Quoted 32 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +31
-0+case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ALT_VLAN_PCP : + *val = ccparam->alt_vlan_pcp; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ALT_TOS_DSCP : + *val = ccparam->alt_tos_dscp; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_RTT : + *val = ccparam->rtt; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_CC_MODE : + *val = ccparam->cc_mode; +break ; +case CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TCP_CP : + *val = ccparam->tcp_cp; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static ssize_t bnxt_re_cc_config_get (struct file *filp,char __user *buffer, +size_t usr_buf_len,loff_t *ppos) +{ +struct bnxt_re_cc_param *dbg_cc_param = filp->private_data; +struct bnxt_re_dev *rdev = dbg_cc_param->rdev; +struct bnxt_qplib_cc_param ccparam = {}; +u32 offset = dbg_cc_param->offset; +char buf[16 ]; +u32 val;
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/debugfs.c void bnxt_re_debug_rem_qpinfo(struct bnxt_re_dev *rdev, struct bnxt_re_qp *qp) · line 194
Quoted 6 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +6
-0+int rc; + + rc =bnxt_qplib_query_cc_param (&rdev->qplib_res, &ccparam); +if (rc) { +dev_err (rdev_to_dev (rdev), +"%s: Failed to query CC parameters\n" , __func__);Let's not have debug print, and especially
dev_errhere.
Sure. Will correct it.
Quoted 5 lines
Quoted 2 lines
+ return
-EINVAL;
bnxt_qplib_query_cc_param()can return ENOMEM, there is no need to overwrite return value.
Ok
Quoted 14 lines
Quoted 14 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +13
-0+ } + + rc =map_cc_config_offset_gen0_ext0 (offset, &ccparam, &val); +if (rc) +return rc; + + rc =snprintf (buf,sizeof (buf),"%d\n" , val); +if (rc <0 ) +return rc; + +return simple_read_from_buffer (buffer, usr_buf_len, ppos, (u8 *)(buf), rc); +} +
Quoted 21 lines · Selvin Xavier
Quoted 20 lines · Leon Romanovsky
Quoted 15 lines · Selvin Xavier
Implements routines to set and get different settings of the congestion control. This will enable the users to modify the settings according to their network.
Currently supporting only GEN 0 version of the parameters. Reading these files queries the firmware and report the values currently programmed. Writing to the files sends commands that update the congestion control settings.
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 215 +++++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/debugfs.h | 15 +++ 3 files changed, 231 insertions(+), 1 deletion(-)<...>
Quoted 8 lines
Quoted 5 lines
drivers/infiniband/hw/bnxt_re/debugfs.c line 27
Quoted 3 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +3
-0+static const char *const bnxt_re_cc_gen0_name[] = { +"enable_cc" , +"g" ,????
It is the "running avg. weight" used by Congestion control algo in HW. It is referred as "g" in the parameters and the FW command. So used the same name for the debugfs file.
At the end, it is your debugfs for your customers. IMHO, it doesn't look nice to them.
Thanks
Selvin Xavier
maintainerQuoted 27 lines · Leon Romanovsky
Quoted 25 lines · Selvin Xavier
Quoted 24 lines · Leon Romanovsky
Quoted 15 lines · Selvin Xavier
Implements routines to set and get different settings of the congestion control. This will enable the users to modify the settings according to their network.
Currently supporting only GEN 0 version of the parameters. Reading these files queries the firmware and report the values currently programmed. Writing to the files sends commands that update the congestion control settings.
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 215 +++++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/debugfs.h | 15 +++ 3 files changed, 231 insertions(+), 1 deletion(-)<...>
Quoted 3 lines
drivers/infiniband/hw/bnxt_re/debugfs.c +3
-0+static const char *const bnxt_re_cc_gen0_name[] = { +"enable_cc" , +"g" ,
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
????
It is the "running avg. weight" used by Congestion control algo in HW. It is referred as "g" in the parameters and the FW command. So used the same name for the debugfs file.
At the end, it is your debugfs for your customers. IMHO, it doesn't look nice to them.
ok. I am renaming this in v2.
thanks
Quoted 2 lines
Thanks