On Fri, Jan 31, 2020, 16:30 Parav Pandit <parav@xxxxxxxxxxxx> wrote: > > Hi Devesh, > > > From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma- > > owner@xxxxxxxxxxxxxxx> On Behalf Of Devesh Sharma > > > [..] > > > static int print_all_port_gids(struct ibv_context *ctx, uint8_t port_num, int > > tbl_len) { > > + enum ibv_gid_type type; > > union ibv_gid gid; > > int rc = 0; > > int i; > > @@ -175,8 +185,16 @@ static int print_all_port_gids(struct ibv_context *ctx, > > uint8_t port_num, int tb > > port_num, i); > > return rc; > > } > > + > > + rc = ibv_query_gid_type(ctx, port_num, i, &type); > > + if (rc) { > > + fprintf(stderr, "Failed to query gid type to port %d, > > index %d\n", > > + port_num, i); > > + return rc; > GID table can have holes depending on how IP addresses, vlan configured/removed. > ibv_query_gid_type() is masking the EINVAL error with RoCEv1 type so here return is ok. > But as good practice, instead of bailing out the loop, if it returns failure, skip the particular GID entry print. > This way rest of valid entries can be still printed. Okay, will send V2 shortly.