RDMA/cma: Simplify netdev check
Current code checks for NULL ndev twice where 2nd check is always invalid given the fact that during route resolving stage, device address must be bound to netdevice interface. This patch simplifies such check. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Родитель
5c181bda77
Коммит
4367ec7fe2
|
@ -2527,8 +2527,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
|
||||||
struct rdma_addr *addr = &route->addr;
|
struct rdma_addr *addr = &route->addr;
|
||||||
struct cma_work *work;
|
struct cma_work *work;
|
||||||
int ret;
|
int ret;
|
||||||
struct net_device *ndev = NULL;
|
struct net_device *ndev;
|
||||||
enum ib_gid_type gid_type = IB_GID_TYPE_ROCE;
|
enum ib_gid_type gid_type = IB_GID_TYPE_ROCE;
|
||||||
|
unsigned long supported_gids;
|
||||||
|
|
||||||
u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -
|
u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -
|
||||||
rdma_start_port(id_priv->cma_dev->device)];
|
rdma_start_port(id_priv->cma_dev->device)];
|
||||||
u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos;
|
u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos;
|
||||||
|
@ -2549,8 +2551,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
|
||||||
|
|
||||||
route->num_paths = 1;
|
route->num_paths = 1;
|
||||||
|
|
||||||
if (addr->dev_addr.bound_dev_if) {
|
if (!addr->dev_addr.bound_dev_if) {
|
||||||
unsigned long supported_gids;
|
ret = -ENODEV;
|
||||||
|
goto err2;
|
||||||
|
}
|
||||||
|
|
||||||
ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
|
ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
|
||||||
if (!ndev) {
|
if (!ndev) {
|
||||||
|
@ -2563,16 +2567,9 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
|
||||||
gid_type = cma_route_gid_type(addr->dev_addr.network,
|
gid_type = cma_route_gid_type(addr->dev_addr.network,
|
||||||
supported_gids,
|
supported_gids,
|
||||||
id_priv->gid_type);
|
id_priv->gid_type);
|
||||||
route->path_rec->rec_type =
|
route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
|
||||||
sa_conv_gid_to_pathrec_type(gid_type);
|
|
||||||
sa_path_set_ndev(route->path_rec, &init_net);
|
sa_path_set_ndev(route->path_rec, &init_net);
|
||||||
sa_path_set_ifindex(route->path_rec, ndev->ifindex);
|
sa_path_set_ifindex(route->path_rec, ndev->ifindex);
|
||||||
}
|
|
||||||
if (!ndev) {
|
|
||||||
ret = -ENODEV;
|
|
||||||
goto err2;
|
|
||||||
}
|
|
||||||
|
|
||||||
sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
|
sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
|
||||||
|
|
||||||
rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,
|
rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче