Re: [PATCH V6 mlx5-next 12/16] RDMA/core: Get xmit slave for LAG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 26, 2020 at 10:17:13AM +0300, Maor Gottlieb wrote:
> Add a call to rdma_lag_get_ah_roce_slave when
> Address handle is created.
> Lower driver can use it to select the QP's affinity port.
> 
> Signed-off-by: Maor Gottlieb <maorg@xxxxxxxxxxxx>
> Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>  drivers/infiniband/core/verbs.c | 53 +++++++++++++++++++++++----------
>  include/rdma/ib_verbs.h         |  2 ++
>  2 files changed, 39 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 86be8a54a2d6..36fb3d032330 100644
> +++ b/drivers/infiniband/core/verbs.c
> @@ -50,6 +50,7 @@
>  #include <rdma/ib_cache.h>
>  #include <rdma/ib_addr.h>
>  #include <rdma/rw.h>
> +#include <rdma/lag.h>
>  
>  #include "core_priv.h"
>  #include <trace/events/rdma_core.h>
> @@ -500,7 +501,8 @@ rdma_update_sgid_attr(struct rdma_ah_attr *ah_attr,
>  static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
>  				     struct rdma_ah_attr *ah_attr,
>  				     u32 flags,
> -				     struct ib_udata *udata)
> +				     struct ib_udata *udata,
> +				     struct net_device *xmit_slave)
>
>  {
>  	struct rdma_ah_init_attr init_attr = {};
>  	struct ib_device *device = pd->device;
> @@ -524,6 +526,7 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
>  	ah->sgid_attr = rdma_update_sgid_attr(ah_attr, NULL);
>  	init_attr.ah_attr = ah_attr;
>  	init_attr.flags = flags;
> +	init_attr.xmit_slave = xmit_slave;
>  
>  	ret = device->ops.create_ah(ah, &init_attr, udata);
>  	if (ret) {
> @@ -550,6 +553,7 @@ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
>  			     u32 flags)
>  {
>  	const struct ib_gid_attr *old_sgid_attr;
> +	struct net_device *slave;
>  	struct ib_ah *ah;
>  	int ret;
>  
> @@ -557,8 +561,14 @@ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> -	ah = _rdma_create_ah(pd, ah_attr, flags, NULL);
> +	ret = rdma_lag_get_ah_roce_slave(pd->device, ah_attr, &slave);
> +	if (ret) {
> +		rdma_unfill_sgid_attr(ah_attr, old_sgid_attr);
> +		return ERR_PTR(ret);
> +	}
>  
> +	ah = _rdma_create_ah(pd, ah_attr, flags, NULL, slave);
> +	rdma_lag_put_ah_roce_slave(slave);
>  	rdma_unfill_sgid_attr(ah_attr, old_sgid_attr);
>  	return ah;
>  }
> @@ -597,7 +607,8 @@ struct ib_ah *rdma_create_user_ah(struct ib_pd *pd,
>  		}
>  	}
>  
> -	ah = _rdma_create_ah(pd, ah_attr, RDMA_CREATE_AH_SLEEPABLE, udata);
> +	ah = _rdma_create_ah(pd, ah_attr, RDMA_CREATE_AH_SLEEPABLE,
> +			     udata, NULL);

Why doesn't the user space do the check too?

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux