[ofa-general] RE: [RMDA CM IPv6 support. PATCHv5 1/2]IPv6 IB addr resolution
Sean Hefty
sean.hefty at intel.com
Mon Dec 1 11:38:29 PST 2008
>-----Original Message-----
>From: Aleksey Senin [mailto:alekseys at voltaire.com]
>Sent: Monday, December 01, 2008 5:17 AM
>To: general at lists.openfabrics.org
>Cc: Hefty, Sean; Olga Shern
>Subject: [RMDA CM IPv6 support. PATCHv5 1/2]IPv6 IB addr resolution
>
>Set from two patches for support IPv6 protocol in RMDA CM
>
>
>Changes:
>Use two patches instead of six.
>
>This patch adds IPv6 support for IB address resolution.
>
>
>>From da89c2a9ce0b2309362208f167fa2582f2f0d929 Mon Sep 17 00:00:00 2001
>From: Aleksey Senin <alekseys at voltaire.com>
>Date: Mon, 1 Dec 2008 13:55:01 +0200
>Subject: [PATCH] IB addr IPv6 support
>
>Support for network discovery in addr_send_arp function.
>Local IPv6 address resolution.
>Added remote IPv6 address resolusion for RDMA CM.
>Function addr_resolve_remote used as wrapper for two other functions:
> addr4_resolve_remote ( original addr_resolve_remote )
> addr6_resolve_remote ( new function )
>
>Signed-off-by: Aleksey Senin <alekseys at voltaire.com>
Thanks for adding this.
Acked-by: Sean Hefty <sean.hefty at intel.com>
with one nit...
> static void process_req(struct work_struct *work)
> {
> struct addr_req *req, *temp_req;
>@@ -279,29 +336,58 @@ static int addr_resolve_local(struct sockaddr *src_in,
> struct rdma_dev_addr *addr)
> {
> struct net_device *dev;
>- __be32 src_ip = ((struct sockaddr_in *)src_in)->sin_addr.s_addr;
>- __be32 dst_ip = ((struct sockaddr_in *)dst_in)->sin_addr.s_addr;
>- int ret;
>+ int ret = -EADDRNOTAVAIL;
Is this assignment needed/used?
>
>- dev = ip_dev_find(&init_net, dst_ip);
>- if (!dev)
>- return -EADDRNOTAVAIL;
>+ if (dst_in->sa_family == 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);
>+ 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);
> } else {
>- ret = rdma_translate_ip(src_in, addr);
>- if (!ret)
>- memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
>+ struct in6_addr *a = &((struct sockaddr_in6
*)dst_in)->sin6_addr;
>+
>+ for_each_netdev(&init_net, dev)
>+ if (ipv6_chk_addr(&init_net, &((struct sockaddr_in6 *)
addr)-
>>sin6_addr, dev, 1))
>+ break;
>+
>+ if (!dev)
>+ return -EADDRNOTAVAIL;
>+
>+ a = &((struct sockaddr_in6 *)src_in)->sin6_addr;
>+
>+ if (ipv6_addr_any(a)) {
>+ src_in->sa_family = dst_in->sa_family;
>+ ((struct sockaddr_in6 *)src_in)->sin6_addr =
>+ ((struct sockaddr_in6 *)dst_in)->sin6_addr;
>+ ret = rdma_copy_addr(addr, dev, dev->dev_addr);
>+ } else if (ipv6_addr_loopback(a)) {
>+ 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);
> return ret;
> }
More information about the general
mailing list