On Wed, Oct 30, 2024 at 06:10:18PM +0800, Junxian Huang wrote: > > > On 2024/10/22 18:11, Selvin Xavier wrote: > > From: Kalesh AP <kalesh-anakkur.purayil@xxxxxxxxxxxx> > > > > Adding support for a per device debugfs folder for exporting > > some of the device specific debug information. > > Added support to get QP info for now. The same folder can be > > used to export other debug features in future. > > > > Signed-off-by: Saravanan Vajravel <saravanan.vajravel@xxxxxxxxxxxx> > > Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@xxxxxxxxxxxx> > > Signed-off-by: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx> > > --- > > drivers/infiniband/hw/bnxt_re/Makefile | 3 +- > > drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + > > drivers/infiniband/hw/bnxt_re/debugfs.c | 141 +++++++++++++++++++++++++++++++ > > drivers/infiniband/hw/bnxt_re/debugfs.h | 21 +++++ > > drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 + > > drivers/infiniband/hw/bnxt_re/ib_verbs.h | 1 + > > drivers/infiniband/hw/bnxt_re/main.c | 13 ++- > > 7 files changed, 183 insertions(+), 2 deletions(-) > > create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.c > > create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.h <...> > > +static inline const char *bnxt_re_qp_type_str(u8 type) > > +{ > > + switch (type) { > > + case CMDQ_CREATE_QP1_TYPE_GSI: return "QP1"; > > + case CMDQ_CREATE_QP_TYPE_GSI: return "QP1"; > > + case CMDQ_CREATE_QP_TYPE_RC: return "RC"; > > + case CMDQ_CREATE_QP_TYPE_UD: return "UD"; > > + case CMDQ_CREATE_QP_TYPE_RAW_ETHERTYPE: return "RAW_ETHERTYPE"; > > + default: return "Invalid transport type"; > > + } > > +} > > + > > Would it be better to use table-driven approach for these two functions? No, proposed variant is better as it can be consumed very easily by tools. Table are good for humans but bad for tooling. Thanks