* [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
@ 2009-11-17 0:07 Sean Hefty
[not found] ` <AD17449F0C4E4FE7B20C32412F077C00-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Sean Hefty @ 2009-11-17 0:07 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Merge resolve local/remote address resolution into a single
data flow to ensure consistent access and use of the local routing
tables.
Based on work from:
David Wilder <dwilder-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/core/addr.c | 81 +++++++++++-----------------------------
1 files changed, 23 insertions(+), 58 deletions(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 4febc0e..07c2944 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -184,17 +184,6 @@ static void addr_send_arp(struct sockaddr *dst_in)
memset(&fl, 0, sizeof fl);
switch (dst_in->sa_family) {
- case AF_INET:
- fl.nl_u.ip4_u.daddr =
- ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
-
- if (ip_route_output_key(&init_net, &rt, &fl))
- return;
-
- neigh_event_send(rt->u.dst.neighbour, NULL);
- ip_rt_put(rt);
- break;
-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case AF_INET6:
{
@@ -215,9 +204,9 @@ static void addr_send_arp(struct sockaddr *dst_in)
}
}
-static int addr4_resolve_remote(struct sockaddr_in *src_in,
- struct sockaddr_in *dst_in,
- struct rdma_dev_addr *addr)
+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;
@@ -235,6 +224,16 @@ static int addr4_resolve_remote(struct sockaddr_in *src_in,
if (ret)
goto out;
+ src_in->sin_family = AF_INET;
+ src_in->sin_addr.s_addr = rt->rt_src;
+
+ if (rt->idev->dev->flags & IFF_LOOPBACK) {
+ ret = rdma_translate_ip((struct sockaddr *) dst_in, addr);
+ if (!ret)
+ memcpy(addr->dst_dev_addr, addr->src_dev_addr, MAX_ADDR_LEN);
+ goto put;
+ }
+
/* If the device does ARP internally, return 'done' */
if (rt->idev->dev->flags & IFF_NOARP) {
rdma_copy_addr(addr, rt->idev->dev, NULL);
@@ -242,21 +241,14 @@ static int addr4_resolve_remote(struct sockaddr_in *src_in,
}
neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->idev->dev);
- if (!neigh) {
+ if (!neigh || !(neigh->nud_state & NUD_VALID)) {
+ neigh_event_send(rt->u.dst.neighbour, NULL);
ret = -ENODATA;
+ if (neigh)
+ goto release;
goto put;
}
- if (!(neigh->nud_state & NUD_VALID)) {
- ret = -ENODATA;
- goto release;
- }
-
- if (!src_ip) {
- src_in->sin_family = dst_in->sin_family;
- src_in->sin_addr.s_addr = rt->rt_src;
- }
-
ret = rdma_copy_addr(addr, neigh->dev, neigh->ha);
release:
neigh_release(neigh);
@@ -305,12 +297,12 @@ static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
}
#endif
-static int addr_resolve_remote(struct sockaddr *src_in,
- struct sockaddr *dst_in,
- struct rdma_dev_addr *addr)
+static int addr_resolve(struct sockaddr *src_in,
+ struct sockaddr *dst_in,
+ struct rdma_dev_addr *addr)
{
if (src_in->sa_family == AF_INET) {
- return addr4_resolve_remote((struct sockaddr_in *) src_in,
+ return addr4_resolve((struct sockaddr_in *) src_in,
(struct sockaddr_in *) dst_in, addr);
} else
return addr6_resolve_remote((struct sockaddr_in6 *) src_in,
@@ -330,8 +322,7 @@ static void process_req(struct work_struct *work)
if (req->status == -ENODATA) {
src_in = (struct sockaddr *) &req->src_addr;
dst_in = (struct sockaddr *) &req->dst_addr;
- req->status = addr_resolve_remote(src_in, dst_in,
- req->addr);
+ req->status = addr_resolve(src_in, dst_in, req->addr);
if (req->status && time_after_eq(jiffies, req->timeout))
req->status = -ETIMEDOUT;
else if (req->status == -ENODATA)
@@ -363,32 +354,6 @@ static int addr_resolve_local(struct sockaddr *src_in,
int ret;
switch (dst_in->sa_family) {
- case AF_INET:
- {
- __be32 src_ip = ((struct sockaddr_in *) src_in)->sin_addr.s_addr;
- __be32 dst_ip = ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
-
- dev = ip_dev_find(&init_net, dst_ip);
- if (!dev)
- return -EADDRNOTAVAIL;
-
- if (ipv4_is_zeronet(src_ip)) {
- src_in->sa_family = dst_in->sa_family;
- ((struct sockaddr_in *) src_in)->sin_addr.s_addr = dst_ip;
- ret = rdma_copy_addr(addr, dev, dev->dev_addr);
- } else if (ipv4_is_loopback(src_ip)) {
- ret = rdma_translate_ip(dst_in, addr);
- if (!ret)
- memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
- } else {
- ret = rdma_translate_ip(src_in, addr);
- if (!ret)
- memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
- }
- dev_put(dev);
- break;
- }
-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case AF_INET6:
{
@@ -466,7 +431,7 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
req->status = addr_resolve_local(src_in, dst_in, addr);
if (req->status == -EADDRNOTAVAIL)
- req->status = addr_resolve_remote(src_in, dst_in, addr);
+ req->status = addr_resolve(src_in, dst_in, addr);
switch (req->status) {
case 0:
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
[not found] ` <AD17449F0C4E4FE7B20C32412F077C00-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
@ 2009-11-17 6:27 ` Or Gerlitz
[not found] ` <4B024258.7070500-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Or Gerlitz @ 2009-11-17 6:27 UTC (permalink / raw)
To: Sean Hefty; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Sean Hefty wrote:
> Merge resolve local/remote address resolution into a single
> data flow to ensure consistent access and use of the local routing tables.
Sean, I reviewed patches 1-6 & 8 and they all look fine, I will give the whole series a try later this week to further validate them.
> Based on work from:
> David Wilder <dwilder-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
David, Jason, are you planning to test these patches as well? specifically I assume the IPv6 work should be of interest to you...
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
[not found] ` <4B024258.7070500-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
@ 2009-11-17 20:51 ` David J. Wilder
[not found] ` <1258491091.11975.1.camel-XfwDJb4SXxnMbYB6QlFGEg@public.gmane.org>
2009-11-19 14:52 ` Or Gerlitz
1 sibling, 1 reply; 6+ messages in thread
From: David J. Wilder @ 2009-11-17 20:51 UTC (permalink / raw)
To: Or Gerlitz; +Cc: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA
I hope to give them a go shortly.
On Tue, 2009-11-17 at 08:27 +0200, Or Gerlitz wrote:
> Sean Hefty wrote:
> > Merge resolve local/remote address resolution into a single
> > data flow to ensure consistent access and use of the local routing tables.
>
> Sean, I reviewed patches 1-6 & 8 and they all look fine, I will give the whole series a try later this week to further validate them.
>
> > Based on work from:
> > David Wilder <dwilder-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
>
> David, Jason, are you planning to test these patches as well? specifically I assume the IPv6 work should be of interest to you...
>
> Or.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
[not found] ` <1258491091.11975.1.camel-XfwDJb4SXxnMbYB6QlFGEg@public.gmane.org>
@ 2009-11-17 21:26 ` Sean Hefty
0 siblings, 0 replies; 6+ messages in thread
From: Sean Hefty @ 2009-11-17 21:26 UTC (permalink / raw)
To: 'David J. Wilder', Or Gerlitz; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
>I hope to give them a go shortly.
Btw - I've pushed out some patches to my librdmacm.git tree to add ipv6 support
in cmatose.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
[not found] ` <4B024258.7070500-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
2009-11-17 20:51 ` David J. Wilder
@ 2009-11-19 14:52 ` Or Gerlitz
[not found] ` <4B055BBA.8020505-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Or Gerlitz @ 2009-11-19 14:52 UTC (permalink / raw)
To: Sean Hefty
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Roland Dreier, David J. Wilder
> I reviewed patches 1-6 & 8 and they all look fine, I will give the whole series
> a try later this week to further validate them
I tested the patch series (V2 for the patches that have it, V1 for the rest) over 2.6.32-rc5
and librdmacm-1.0.8-1.el5 covering AF_INET/PS_TCP unicast and AF_INET/PS_IPOIB multicast and
bonding (operability and address-change event). I used mckey and rping, all worked fine,
thanks for driving this change set, Sean. David, I'll be happy to hear how the IPv6 testing went, lets get this going.
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses
[not found] ` <4B055BBA.8020505-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
@ 2009-11-19 16:46 ` David J. Wilder
0 siblings, 0 replies; 6+ messages in thread
From: David J. Wilder @ 2009-11-19 16:46 UTC (permalink / raw)
To: Or Gerlitz; +Cc: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Roland Dreier
On Thu, 2009-11-19 at 16:52 +0200, Or Gerlitz wrote:
> > I reviewed patches 1-6 & 8 and they all look fine, I will give the whole series
> > a try later this week to further validate them
>
I tested ipv4 and ipv6 address resolution using ucmatose. All my tests
ran fine. I tested with patches 1 through 9 on ofed
1.5(OFED-1.5-20091118-0600) on 2.6.30. Ucmatose was taken from Sean's
librdmacm git (required for ipv6 support). Here are the tests I ran:
ucmatose
[-s server_address]
[-b bind_address]
ipv4 - Local address
----------------------
ucmatose -s 127.0.0.1
ucmatose -s 192.168.0.199
ucmatose -b 192.168.0.199 -s 192.168.0.199
ipv4 - Remote address
----------------------
ucmatose -s 192.168.0.198
ucmatose -b 192.168.0.199 -s 192.168.0.198
ipv6 - Local addresses
-----------------------
ucmatose -s fe80::202:c903:1:28ed%ib0
ucmatose -s 2001:db8:1234::1
ucmatose -b fe80::202:c903:1:28ed%ib0 -s fe80::202:c903:1:28ed%ib0
ucmatose -b 2001:db8:1234::1 -s 2001:db8:1234::1
ucmatose -b 2001:db8:1234::1 -s fe80::202:c903:1:28ed%ib0
ucmatose -b fe80::202:c903:1:28ee%ib1 -s 2001:db8:1234::1
ucmatose -b 2001:db8:1234::10 -s 2001:db8:1234::1
ipv6 - Remote addresses
------------------------
ucmatose -s 2001:db8:1234::2
ucmatose -b 2001:db8:1234::1 -s 2001:db8:1234::2
ucmatose -b fe80::202:c903:1:28ed%ib0 -s 2001:db8:1234::2
ucmatose -b fe80::202:c903:1:28ee%ib1 -s 2001:db8:1234::2
ucmatose -s fe80::202:c903:1:1925%ib0
ucmatose -b 2001:db8:1234::1 -s fe80::202:c903:1:1925%ib0
ucmatose -b fe80::202:c903:1:28ed%ib0 -s fe80::202:c903:1:1925%ib0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-19 16:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-17 0:07 [PATCH 8/9] ib/addr: simplify resolving IPv4 addresses Sean Hefty
[not found] ` <AD17449F0C4E4FE7B20C32412F077C00-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-11-17 6:27 ` Or Gerlitz
[not found] ` <4B024258.7070500-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
2009-11-17 20:51 ` David J. Wilder
[not found] ` <1258491091.11975.1.camel-XfwDJb4SXxnMbYB6QlFGEg@public.gmane.org>
2009-11-17 21:26 ` Sean Hefty
2009-11-19 14:52 ` Or Gerlitz
[not found] ` <4B055BBA.8020505-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
2009-11-19 16:46 ` David J. Wilder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.