On Thu, Sep 10, 2020 at 05:22:02PM +0300, Leon Romanovsky wrote: > diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c > index 3c1e2ca564fe..f1b277793980 100644 > +++ b/drivers/infiniband/core/cma_configfs.c > @@ -123,16 +123,21 @@ static ssize_t default_roce_mode_store(struct config_item *item, > { > struct cma_device *cma_dev; > struct cma_dev_port_group *group; > - int gid_type = ib_cache_gid_parse_type_str(buf); > + int gid_type; > ssize_t ret; > > - if (gid_type < 0) > - return -EINVAL; > - > ret = cma_configfs_params_get(item, &cma_dev, &group); > if (ret) > return ret; > > + gid_type = ib_cache_gid_parse_type_str(buf); > + if (gid_type < 0) > + return -EINVAL; > + > + if (gid_type == IB_GID_TYPE_IB && > + rdma_protocol_roce_eth_encap(cma_dev->device, group->port_num)) > + gid_type = IB_GID_TYPE_ROCE; This logic should be in cma_set_default_gid_type() so as not to move struct cma_device Jason