Re: [PATCH V4 mlx5-next 10/15] RDMA/core: Add LAG functionality

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

 



On 4/22/20 2:39 AM, Maor Gottlieb wrote:
> Add support to get the RoCE LAG xmit slave by building skb
> of the RoCE packet and call to master_get_xmit_slave.

update the ndo name

...

> +static struct net_device *rdma_get_xmit_slave_udp(struct ib_device *device,
> +						  struct net_device *master,
> +						  struct rdma_ah_attr *ah_attr)
> +{
> +	struct net_device *slave;
> +	struct sk_buff *skb;
> +
> +	skb = rdma_build_skb(device, master, ah_attr);
> +	if (!skb)
> +		return NULL;
> +
> +	slave = netdev_get_xmit_slave(master, skb,
> +				      !!(device->lag_flags &
> +					 RDMA_LAG_FLAGS_HASH_ALL_SLAVES));
> +	kfree_skb(skb);
> +	return slave;
> +}
> +
> +void rdma_lag_put_ah_roce_slave(struct rdma_ah_attr *ah_attr)
> +{
> +	if (ah_attr->roce.xmit_slave)
> +		dev_put(ah_attr->roce.xmit_slave);
> +}
> +
> +int rdma_lag_get_ah_roce_slave(struct ib_device *device,
> +			       struct rdma_ah_attr *ah_attr)
> +{
> +	struct net_device *master;
> +	struct net_device *slave;
> +
> +	if (!(ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE &&
> +	      ah_attr->grh.sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP))
> +		return 0;
> +
> +	rcu_read_lock();
> +	master = rdma_read_gid_attr_ndev_rcu(ah_attr->grh.sgid_attr);
> +	if (IS_ERR(master)) {
> +		rcu_read_unlock();
> +		return PTR_ERR(master);
> +	}
> +	dev_hold(master);
> +	rcu_read_unlock();
> +
> +	if (!netif_is_bond_master(master)) {
> +		dev_put(master);
> +		return 0;
> +	}
> +
> +	slave = rdma_get_xmit_slave_udp(device, master, ah_attr);
> +
> +	dev_put(master);

you will simplify this a bit by moving the rdma_get_xmit_slave_udp up to
the rcu_read section above.


> +	if (!slave) {
> +		ibdev_warn(device, "Failed to get lag xmit slave\n");
> +		return -EINVAL;
> +	}
> +
> +	ah_attr->roce.xmit_slave = slave;
> +
> +	return 0;
> +}



[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