[ofa-general] Re: pick the outgoing HCA based on the IP used for bind
Jason Gunthorpe
jgunthorpe at obsidianresearch.com
Thu Feb 5 10:02:03 PST 2009
On Thu, Feb 05, 2009 at 02:03:42PM +0200, Or Gerlitz wrote:
> Or Gerlitz wrote:
> >Rick Frank who brought this to my attention, also handed me this patch
> >which is claimed to workaround this issue,
> >+++ ofa_kernel-1.3.1/drivers/infiniband/core/addr.c
> >@@ -174,15 +174,29 @@ static int addr_resolve_remote(struct so
> > struct flowi fl;
> > struct rtable *rt;
> > struct neighbour *neigh;
> >+ struct net_device *dev;
> > int ret;
> >
> > memset(&fl, 0, sizeof fl);
> > fl.nl_u.ip4_u.daddr = dst_ip;
> > fl.nl_u.ip4_u.saddr = src_ip;
> >+
> >+ if (src_ip && (dev = ip_dev_find(src_ip)) != NULL) {
> >+ fl.oif = dev->ifindex;
> >+ dev_put(dev);
> >+
> >+ ret = ip_route_output_key(&rt, &fl);
> >+ if (ret == 0)
> >+ goto found;
> I assume the trick here is to somehow enforce the interface returned by
> ip_dev_find and not the one resolved by the routing table. At least as I
> understand the addr.c code, it takes the interface later from neigh->dev
> , correct?
That does seem to be what it is doing, but I can't see how that is
correct? The output interface is selected by the routing table, except
in very special cases (ie SO_BINDTODEVICE).
Why doesn't the original code work? It passes src_ip into the route
lookup which should be good enough.. Does 'ip route get <dest> from
<src>' return the right thing?
Jason
More information about the general
mailing list