[ofa-general] IPv6 RDMA CM PATCHv2 8/8

Hefty, Sean sean.hefty at intel.com
Mon Aug 11 12:43:08 PDT 2008


>-static int addr_resolve_remote(struct sockaddr *src_in,
>-                              struct sockaddr *dst_in,
>+static int addr4_resolve_remote(struct sockaddr_in *src_in,
>+                              struct sockaddr_in *dst_in,

A previous patch converted this from sockaddr_in to sockaddr, and now it's converted back.

>                               struct rdma_dev_addr *addr)
> {
>-       __be32 src_ip = ((struct sockaddr_in *)src_in)->sin_addr.s_addr;
>-       __be32 dst_ip = ((struct sockaddr_in *)dst_in)->sin_addr.s_addr;
>+       __be32 src_ip = src_in->sin_addr.s_addr;
>+       __be32 dst_ip = dst_in->sin_addr.s_addr;
>        struct flowi fl;
>        struct rtable *rt;
>        struct neighbour *neigh;
>@@ -233,7 +249,7 @@ static int addr_resolve_remote(struct sockaddr *src_in,
>        }
>
>        if (!src_ip) {
>-               src_in->sa_family = dst_in->sa_family;
>+               src_in->sin_family = dst_in->sin_family;
>                ((struct sockaddr_in *)src_in)->sin_addr.s_addr = rt->rt_src;
>        }
>
>@@ -246,6 +262,60 @@ out:
>        return ret;
> }
>
>+static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
>+                              struct sockaddr_in6 *dst_in,
>+                              struct rdma_dev_addr *addr)
>+{
>+       struct flowi fl;
>+       struct dst_entry *dst;
>+       struct neighbour *neigh;
>+       int ret = -ENODATA;
>+
>+       memset(&fl, 0, sizeof fl);
>+       fl.nl_u.ip6_u.daddr = dst_in->sin6_addr;
>+       fl.nl_u.ip6_u.saddr = src_in->sin6_addr;
>+
>+       dst = ip6_route_output(&init_net, NULL, &fl);
>+

extra blank line

>+       if (!dst)
>+               goto out;
>+
>+       /* If the device does ARP internally, return 'done' */
>+       if (dst->dev->flags & IFF_NOARP) {
>+               ret = rdma_copy_addr(addr, dst->dev, NULL);
>+               goto release;
>+       }
>+
>+       neigh = dst->neighbour;
>+       if (!neigh) {
>+               ret = -ENODATA;

ret was initialized to ENODATA above

>+               goto release;
>+       }
>+
>+       if (!(neigh->nud_state & NUD_VALID)) {
>+               ret = -ENODATA;

ret was initialized to ENODATA above

>+               goto release;
>+       }
>+       ret = rdma_copy_addr(addr, neigh->dev, neigh->ha);
>+
>+release:
>+       dst_release(dst);
>+out:
>+       return ret;
>+}
>+
>+static int addr_resolve_remote(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,
>+                       (struct sockaddr_in *)dst_in, addr);
>+       } else

curly brace use is inconsistent here - not needed on the if portion

- Sean



More information about the general mailing list