[ofa-general] [RDMA CM IPv6 support. PATCHv3 2/9] sockaddr_in substitution
Aleksey Senin
alekseys at voltaire.com
Wed Aug 13 01:06:21 PDT 2008
>From 63ef6d190862438cf439d5da2a3a670d919dc980 Mon Sep 17 00:00:00 2001
From: Aleksey Senin <alekseys at voltaire.com>
Date: Wed, 13 Aug 2008 09:51:39 +0300
Subject: [RDMA CM IPv6 support. PATCHv3 2/9] sockaddr_in substitution
In order to prepare RDMA CM work with IPv6 these functions changed to
obtain as argument struct sockaddr* pointer and not sockaddr_in*
addr_resolve_remote
addr_resolve_local
rdma_resolve_ip
Changes in process_req function are side effect of modifications in
functions above
Signed-off-by: Aleksey Senin <alekseys at voltaire.com>
---
drivers/infiniband/core/addr.c | 46 ++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index c5b623b..b59ad53 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -171,12 +171,12 @@ static void addr_send_arp(struct sockaddr_in *dst_in)
ip_rt_put(rt);
}
-static int addr_resolve_remote(struct sockaddr_in *src_in,
- struct sockaddr_in *dst_in,
+static int addr_resolve_remote(struct sockaddr *src_in,
+ struct sockaddr *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;
+ __be32 src_ip = ((struct sockaddr_in *)src_in)->sin_addr.s_addr;
+ __be32 dst_ip = ((struct sockaddr_in *)dst_in)->sin_addr.s_addr;
struct flowi fl;
struct rtable *rt;
struct neighbour *neigh;
@@ -207,8 +207,8 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
}
if (!src_ip) {
- src_in->sin_family = dst_in->sin_family;
- src_in->sin_addr.s_addr = rt->rt_src;
+ src_in->sa_family = dst_in->sa_family;
+ ((struct sockaddr_in *)src_in)->sin_addr.s_addr = rt->rt_src;
}
ret = rdma_copy_addr(addr, neigh->dev, neigh->ha);
@@ -223,7 +223,7 @@ out:
static void process_req(struct work_struct *work)
{
struct addr_req *req, *temp_req;
- struct sockaddr_in *src_in, *dst_in;
+ struct sockaddr *src_in, *dst_in;
struct list_head done_list;
INIT_LIST_HEAD(&done_list);
@@ -231,8 +231,8 @@ static void process_req(struct work_struct *work)
mutex_lock(&lock);
list_for_each_entry_safe(req, temp_req, &req_list, list) {
if (req->status == -ENODATA) {
- src_in = (struct sockaddr_in *) &req->src_addr;
- dst_in = (struct sockaddr_in *) &req->dst_addr;
+ 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);
if (req->status && time_after_eq(jiffies, req->timeout))
@@ -251,20 +251,20 @@ static void process_req(struct work_struct *work)
list_for_each_entry_safe(req, temp_req, &done_list, list) {
list_del(&req->list);
- req->callback(req->status, &req->src_addr, req->addr,
- req->context);
+ req->callback(req->status, (struct sockaddr *) &req->src_addr, \
+ req->addr, req->context);
put_client(req->client);
kfree(req);
}
}
-static int addr_resolve_local(struct sockaddr_in *src_in,
- struct sockaddr_in *dst_in,
+static int addr_resolve_local(struct sockaddr *src_in,
+ struct sockaddr *dst_in,
struct rdma_dev_addr *addr)
{
struct net_device *dev;
- __be32 src_ip = src_in->sin_addr.s_addr;
- __be32 dst_ip = dst_in->sin_addr.s_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;
int ret;
dev = ip_dev_find(&init_net, dst_ip);
@@ -272,15 +272,15 @@ static int addr_resolve_local(struct sockaddr_in *src_in,
return -EADDRNOTAVAIL;
if (ipv4_is_zeronet(src_ip)) {
- src_in->sin_family = dst_in->sin_family;
- src_in->sin_addr.s_addr = dst_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((struct sockaddr *)dst_in, addr);
+ 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((struct sockaddr *)src_in, addr);
+ ret = rdma_translate_ip(src_in, addr);
if (!ret)
memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
}
@@ -296,7 +296,7 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
struct rdma_dev_addr *addr, void *context),
void *context)
{
- struct sockaddr_in *src_in, *dst_in;
+ struct sockaddr *src_in, *dst_in;
struct addr_req *req;
int ret = 0;
@@ -313,8 +313,8 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
req->client = client;
atomic_inc(&client->refcount);
- src_in = (struct sockaddr_in *) &req->src_addr;
- dst_in = (struct sockaddr_in *) &req->dst_addr;
+ src_in = (struct sockaddr *) &req->src_addr;
+ dst_in = (struct sockaddr *) &req->dst_addr;
req->status = addr_resolve_local(src_in, dst_in, addr);
if (req->status == -EADDRNOTAVAIL)
@@ -328,7 +328,7 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
case -ENODATA:
req->timeout = msecs_to_jiffies(timeout_ms) + jiffies;
queue_req(req);
- addr_send_arp(dst_in);
+ addr_send_arp((struct sockaddr_in *)dst_in);
break;
default:
ret = req->status;
--
1.5.6.dirty
More information about the general
mailing list