Commit 575c7e58 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

RDMA/{core, cma}: Simplify rdma_translate_ip

Since no caller needs vlan, rdma_translate_ip is simplified to avoid
vlan pointer.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 699a83f1
...@@ -243,8 +243,7 @@ void rdma_copy_addr(struct rdma_dev_addr *dev_addr, ...@@ -243,8 +243,7 @@ void rdma_copy_addr(struct rdma_dev_addr *dev_addr,
EXPORT_SYMBOL(rdma_copy_addr); EXPORT_SYMBOL(rdma_copy_addr);
int rdma_translate_ip(const struct sockaddr *addr, int rdma_translate_ip(const struct sockaddr *addr,
struct rdma_dev_addr *dev_addr, struct rdma_dev_addr *dev_addr)
u16 *vlan_id)
{ {
struct net_device *dev; struct net_device *dev;
...@@ -267,8 +266,6 @@ int rdma_translate_ip(const struct sockaddr *addr, ...@@ -267,8 +266,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
rdma_copy_addr(dev_addr, dev, NULL); rdma_copy_addr(dev_addr, dev, NULL);
dev_addr->bound_dev_if = dev->ifindex; dev_addr->bound_dev_if = dev->ifindex;
if (vlan_id)
*vlan_id = rdma_vlan_dev_vlan_id(dev);
dev_put(dev); dev_put(dev);
break; break;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
...@@ -280,8 +277,6 @@ int rdma_translate_ip(const struct sockaddr *addr, ...@@ -280,8 +277,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
dev, 1)) { dev, 1)) {
rdma_copy_addr(dev_addr, dev, NULL); rdma_copy_addr(dev_addr, dev, NULL);
dev_addr->bound_dev_if = dev->ifindex; dev_addr->bound_dev_if = dev->ifindex;
if (vlan_id)
*vlan_id = rdma_vlan_dev_vlan_id(dev);
break; break;
} }
} }
...@@ -481,7 +476,7 @@ static int addr_resolve_neigh(struct dst_entry *dst, ...@@ -481,7 +476,7 @@ static int addr_resolve_neigh(struct dst_entry *dst,
if (dst->dev->flags & IFF_LOOPBACK) { if (dst->dev->flags & IFF_LOOPBACK) {
int ret; int ret;
ret = rdma_translate_ip(dst_in, addr, NULL); ret = rdma_translate_ip(dst_in, addr);
if (!ret) if (!ret)
memcpy(addr->dst_dev_addr, addr->src_dev_addr, memcpy(addr->dst_dev_addr, addr->src_dev_addr,
MAX_ADDR_LEN); MAX_ADDR_LEN);
...@@ -558,7 +553,7 @@ static int addr_resolve(struct sockaddr *src_in, ...@@ -558,7 +553,7 @@ static int addr_resolve(struct sockaddr *src_in,
} }
if (ndev->flags & IFF_LOOPBACK) { if (ndev->flags & IFF_LOOPBACK) {
ret = rdma_translate_ip(dst_in, addr, NULL); ret = rdma_translate_ip(dst_in, addr);
/* /*
* Put the loopback device and get the translated * Put the loopback device and get the translated
* device instead. * device instead.
......
...@@ -601,7 +601,7 @@ static int cma_translate_addr(struct sockaddr *addr, struct rdma_dev_addr *dev_a ...@@ -601,7 +601,7 @@ static int cma_translate_addr(struct sockaddr *addr, struct rdma_dev_addr *dev_a
int ret; int ret;
if (addr->sa_family != AF_IB) { if (addr->sa_family != AF_IB) {
ret = rdma_translate_ip(addr, dev_addr, NULL); ret = rdma_translate_ip(addr, dev_addr);
} else { } else {
cma_translate_ib((struct sockaddr_ib *) addr, dev_addr); cma_translate_ib((struct sockaddr_ib *) addr, dev_addr);
ret = 0; ret = 0;
...@@ -2131,7 +2131,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id, ...@@ -2131,7 +2131,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
mutex_lock_nested(&conn_id->handler_mutex, SINGLE_DEPTH_NESTING); mutex_lock_nested(&conn_id->handler_mutex, SINGLE_DEPTH_NESTING);
conn_id->state = RDMA_CM_CONNECT; conn_id->state = RDMA_CM_CONNECT;
ret = rdma_translate_ip(laddr, &conn_id->id.route.addr.dev_addr, NULL); ret = rdma_translate_ip(laddr, &conn_id->id.route.addr.dev_addr);
if (ret) { if (ret) {
mutex_unlock(&conn_id->handler_mutex); mutex_unlock(&conn_id->handler_mutex);
rdma_destroy_id(new_cm_id); rdma_destroy_id(new_cm_id);
......
...@@ -94,7 +94,7 @@ struct rdma_dev_addr { ...@@ -94,7 +94,7 @@ struct rdma_dev_addr {
* The dev_addr->net field must be initialized. * The dev_addr->net field must be initialized.
*/ */
int rdma_translate_ip(const struct sockaddr *addr, int rdma_translate_ip(const struct sockaddr *addr,
struct rdma_dev_addr *dev_addr, u16 *vlan_id); struct rdma_dev_addr *dev_addr);
/** /**
* rdma_resolve_ip - Resolve source and destination IP addresses to * rdma_resolve_ip - Resolve source and destination IP addresses to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment