On 03/02/2020 7:47, Devesh Sharma wrote: > It becomes difficult to make out from the output of ibv_devinfo > if a particular gid index is RoCE v2 or not. > > Adding a string to the output of ibv_devinfo -v to display the > gid type at the end of gid. > > Signed-off-by: Devesh Sharma <devesh.sharma@xxxxxxxxxxxx> > --- > libibverbs/examples/devinfo.c | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c > index bf53eac..bbaed8c 100644 > --- a/libibverbs/examples/devinfo.c > +++ b/libibverbs/examples/devinfo.c > @@ -162,8 +162,18 @@ static const char *vl_str(uint8_t vl_num) > } > } > > +static const char *gid_type_str(enum ibv_gid_type type) > +{ > + switch (type) { > + case 0: return "IB/RoCE v1"; > + case 1: return "RoCE v2"; > + default: return "invalid value"; > + } > +} Why hard code the enum values? Use IBV_GID_TYPE_IB_ROCE_V1 and IBV_GID_TYPE_ROCE_V2.