Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278347
b: refs/heads/master
c: 51d4597
h: refs/heads/master
i:
  278345: f7f9fd9
  278343: 578abba
v: v3
  • Loading branch information
David Miller committed Dec 5, 2011
1 parent ef7c548 commit 8be4b76
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2721745501a26d0dc3b88c0d2f3aa11471891388
refs/heads/master: 51d45974515c35cd401f6194a6e728a2d1c3e3c6
47 changes: 21 additions & 26 deletions trunk/drivers/infiniband/core/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,32 @@ static void queue_req(struct addr_req *req)
mutex_unlock(&lock);
}

static int dst_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *addr)
{
struct neighbour *n;
int ret;

rcu_read_lock();
n = dst_get_neighbour_noref(dst);
if (!n || !(n->nud_state & NUD_VALID)) {
if (n)
neigh_event_send(n, NULL);
ret = -ENODATA;
} else {
ret = rdma_copy_addr(addr, dst->dev, n->ha);
}
rcu_read_unlock();

return ret;
}

static int addr4_resolve(struct sockaddr_in *src_in,
struct sockaddr_in *dst_in,
struct rdma_dev_addr *addr)
{
__be32 src_ip = src_in->sin_addr.s_addr;
__be32 dst_ip = dst_in->sin_addr.s_addr;
struct rtable *rt;
struct neighbour *neigh;
struct flowi4 fl4;
int ret;

Expand Down Expand Up @@ -214,20 +232,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
goto put;
}

neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev);
if (!neigh || !(neigh->nud_state & NUD_VALID)) {
rcu_read_lock();
neigh_event_send(dst_get_neighbour_noref(&rt->dst), NULL);
rcu_read_unlock();
ret = -ENODATA;
if (neigh)
goto release;
goto put;
}

ret = rdma_copy_addr(addr, neigh->dev, neigh->ha);
release:
neigh_release(neigh);
ret = dst_fetch_ha(&rt->dst, addr);
put:
ip_rt_put(rt);
out:
Expand All @@ -240,7 +245,6 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
struct rdma_dev_addr *addr)
{
struct flowi6 fl6;
struct neighbour *neigh;
struct dst_entry *dst;
int ret;

Expand Down Expand Up @@ -276,16 +280,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
goto put;
}

rcu_read_lock();
neigh = dst_get_neighbour_noref(dst);
if (!neigh || !(neigh->nud_state & NUD_VALID)) {
if (neigh)
neigh_event_send(neigh, NULL);
ret = -ENODATA;
} else {
ret = rdma_copy_addr(addr, dst->dev, neigh->ha);
}
rcu_read_unlock();
ret = dst_fetch_ha(dst, addr);
put:
dst_release(dst);
return ret;
Expand Down

0 comments on commit 8be4b76

Please sign in to comment.