aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2020-07-06 14:29:58 -0300
committerJason Gunthorpe <jgg@nvidia.com>2020-07-06 14:29:58 -0300
commitf11f3f76c7264ca6a0b7c495800879e9f73d0bf7 (patch)
treec918139a8fd79ea500027b4268adc8f05992ccc4 /drivers/infiniband/ulp/ipoib
parentRDMA/mlx5: Introduce ODP prefetch counter (diff)
parentRDMA/ipoib: Handle user-supplied address when creating child (diff)
downloadlinux-dev-f11f3f76c7264ca6a0b7c495800879e9f73d0bf7.tar.xz
linux-dev-f11f3f76c7264ca6a0b7c495800879e9f73d0bf7.zip
Merge branch 'mlx5_ipoib_qpn' into rdma.git for-next
Michael Guralnik says: ==================== This series handles IPoIB child interface creation with setting interface's HW address. In current implementation, lladdr requested by user is ignored and overwritten. Child interface gets the same GID as the parent interface and a QP number which is assigned by the underlying drivers. In this series we fix this behavior so that user's requested address is assigned to the newly created interface. As specific QP number request is not supported for all vendors, QP number requested by user will still be overwritten when this is not supported. Behavior of creation of child interfaces through the sysfs mechanism or without specifying a requested address, stays the same. ==================== Based on the mlx5-next branch at git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux due to dependencies. * branch 'mlx5_ipoib_qpn': RDMA/ipoib: Handle user-supplied address when creating child net/mlx5: Enable QP number request when creating IPoIB underlay QP Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index ef60e8e4ae67..752581a8627b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1892,8 +1892,15 @@ static void ipoib_child_init(struct net_device *ndev)
priv->max_ib_mtu = ppriv->max_ib_mtu;
set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
- memcpy(priv->dev->dev_addr, ppriv->dev->dev_addr, INFINIBAND_ALEN);
- memcpy(&priv->local_gid, &ppriv->local_gid, sizeof(priv->local_gid));
+ if (memchr_inv(priv->dev->dev_addr, 0, INFINIBAND_ALEN))
+ memcpy(&priv->local_gid, priv->dev->dev_addr + 4,
+ sizeof(priv->local_gid));
+ else {
+ memcpy(priv->dev->dev_addr, ppriv->dev->dev_addr,
+ INFINIBAND_ALEN);
+ memcpy(&priv->local_gid, &ppriv->local_gid,
+ sizeof(priv->local_gid));
+ }
}
static int ipoib_ndo_init(struct net_device *ndev)