RDMA/cma: Refactor to access multiple fields of rdma_dev_addr
Pass the rdma_cm_id so that multiple fields of the rdma_dev_addr structure can be accessed, instead of passing each individual fields. This is needed to access some additional fields in followup patches. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
00db63c128
commit
2493a57bc1
|
@ -612,11 +612,14 @@ static int cma_translate_addr(struct sockaddr *addr, struct rdma_dev_addr *dev_a
|
||||||
|
|
||||||
static inline int cma_validate_port(struct ib_device *device, u8 port,
|
static inline int cma_validate_port(struct ib_device *device, u8 port,
|
||||||
enum ib_gid_type gid_type,
|
enum ib_gid_type gid_type,
|
||||||
union ib_gid *gid, int dev_type,
|
union ib_gid *gid,
|
||||||
int bound_if_index)
|
struct rdma_id_private *id_priv)
|
||||||
{
|
{
|
||||||
int ret = -ENODEV;
|
struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
|
||||||
|
int bound_if_index = dev_addr->bound_dev_if;
|
||||||
|
int dev_type = dev_addr->dev_type;
|
||||||
struct net_device *ndev = NULL;
|
struct net_device *ndev = NULL;
|
||||||
|
int ret = -ENODEV;
|
||||||
|
|
||||||
if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port))
|
if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port))
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -671,8 +674,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv,
|
||||||
rdma_protocol_ib(cma_dev->device, port) ?
|
rdma_protocol_ib(cma_dev->device, port) ?
|
||||||
IB_GID_TYPE_IB :
|
IB_GID_TYPE_IB :
|
||||||
listen_id_priv->gid_type, gidp,
|
listen_id_priv->gid_type, gidp,
|
||||||
dev_addr->dev_type,
|
id_priv);
|
||||||
dev_addr->bound_dev_if);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
id_priv->id.port_num = port;
|
id_priv->id.port_num = port;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -693,8 +695,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv,
|
||||||
rdma_protocol_ib(cma_dev->device, port) ?
|
rdma_protocol_ib(cma_dev->device, port) ?
|
||||||
IB_GID_TYPE_IB :
|
IB_GID_TYPE_IB :
|
||||||
cma_dev->default_gid_type[port - 1],
|
cma_dev->default_gid_type[port - 1],
|
||||||
gidp, dev_addr->dev_type,
|
gidp, id_priv);
|
||||||
dev_addr->bound_dev_if);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
id_priv->id.port_num = port;
|
id_priv->id.port_num = port;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue