[openib-general] [PATCH][SDP][10/22] Whitespace cleanup in sdp_link.c
Tom Duffy
Tom.Duffy at Sun.COM
Fri Feb 18 16:46:05 PST 2005
Signed-off-by: Tom Duffy <tduffy at sun.com>
Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_link.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_link.c (revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_link.c (working copy)
@@ -106,10 +106,8 @@ static void _sdp_path_wait_add(struct sd
info->wait_list = wait;
wait->pext = &info->wait_list;
- if (NULL != wait->next) {
-
+ if (NULL != wait->next)
wait->next->pext = &wait->next;
- }
return;
} /* _sdp_path_wait_add */
@@ -123,10 +121,8 @@ static void _sdp_path_wait_destroy(struc
* if it's in the list, pext will not be null
*/
if (NULL != wait->pext) {
-
- if (NULL != wait->next) {
+ if (NULL != wait->next)
wait->next->pext = wait->pext;
- }
*(wait->pext) = wait->next;
@@ -164,14 +160,9 @@ static struct sdp_path_info *_sdp_path_i
{
struct sdp_path_info *info;
- for (info = _info_list; NULL != info; info = info->next) {
-
- if (dst_ip == info->dst &&
- dev_if == info->dif) {
-
+ for (info = _info_list; NULL != info; info = info->next)
+ if (dst_ip == info->dst && dev_if == info->dif)
break;
- }
- }
return info;
} /* _sdp_path_info_lookup */
@@ -184,10 +175,8 @@ static struct sdp_path_info *_sdp_path_i
struct sdp_path_info *info;
info = kmem_cache_alloc(_info_cache, SLAB_KERNEL);
- if (NULL == info) {
-
+ if (NULL == info)
return NULL;
- }
memset(info, 0, sizeof(struct sdp_path_info));
@@ -195,10 +184,8 @@ static struct sdp_path_info *_sdp_path_i
_info_list = info;
info->pext = &_info_list;
- if (NULL != info->next) {
-
+ if (NULL != info->next)
info->next->pext = &info->next;
- }
info->dst = dst_ip;
info->dif = dev_if;
@@ -221,10 +208,8 @@ static void _sdp_path_info_destroy(struc
* if it's in the list, pext will not be null
*/
if (NULL != info->pext) {
-
- if (NULL != info->next) {
+ if (NULL != info->next)
info->next->pext = info->pext;
- }
*(info->pext) = info->next;
@@ -232,10 +217,8 @@ static void _sdp_path_info_destroy(struc
info->next = NULL;
}
- while (NULL != (wait = info->wait_list)) {
-
+ while (NULL != (wait = info->wait_list))
_sdp_path_wait_complete(wait, info, status);
- }
cancel_delayed_work(&info->timer);
kmem_cache_free(_info_cache, info);
@@ -271,27 +254,21 @@ static void _sdp_link_path_rec_done(int
sweep = info->wait_list;
while (NULL != sweep) {
-
wait = sweep;
sweep = sweep->next;
/*
* on timeout increment retries.
*/
- if (-ETIMEDOUT == status) {
-
+ if (-ETIMEDOUT == status)
wait->retry++;
- }
-
- if (!status || SDP_LINK_SA_RETRY < wait->retry) {
+ if (!status || SDP_LINK_SA_RETRY < wait->retry)
_sdp_path_wait_complete(wait, info, status);
- }
}
/*
* retry if anyone is waiting.
*/
if (NULL != info->wait_list) {
-
info->sa_time = min(info->sa_time * 2, SDP_LINK_SA_TIME_MAX);
result = ib_sa_path_rec_get(info->ca,
@@ -308,7 +285,6 @@ static void _sdp_link_path_rec_done(int
&info->query);
if (0 > result) {
-
sdp_dbg_warn(NULL, "Error <%d> restarting path query",
result);
_sdp_path_info_destroy(info, result);
@@ -329,10 +305,8 @@ static int _sdp_link_path_rec_get(struct
GID_ARG(info->path.sgid),
GID_ARG(info->path.dgid));
- if (SDP_LINK_F_PATH & info->flags) {
-
+ if (SDP_LINK_F_PATH & info->flags)
return 0;
- }
result = ib_sa_path_rec_get(info->ca,
info->port,
@@ -347,13 +321,10 @@ static int _sdp_link_path_rec_get(struct
info,
&info->query);
if (0 > result) {
-
sdp_dbg_warn(NULL, "Error <%d> starting path record query",
result);
info->query = NULL;
- }
- else {
-
+ } else {
info->qid = result;
info->flags |= SDP_LINK_F_PATH;
}
@@ -391,21 +362,16 @@ void _sdp_link_path_lookup(void *data)
/*
* path request in progress?
*/
- if (NULL != info->query) {
-
+ if (NULL != info->query)
goto done;
- }
/*
* route information present, but no path query, goto re-arp.
*/
- if (NULL != info->ca) {
-
+ if (NULL != info->ca)
goto arp;
- }
result = ip_route_output_key(&rt, &fl);
if (0 > result || NULL == rt) {
-
sdp_dbg_warn(NULL, "Error <%d> routing <%08x:%08x> (%d)",
result, info->dst, info->src, info->dif);
goto error;
@@ -414,7 +380,6 @@ void _sdp_link_path_lookup(void *data)
* check route flags
*/
if (0 < ((RTCF_MULTICAST|RTCF_BROADCAST) & rt->rt_flags)) {
-
ip_rt_put(rt);
result = -ENETUNREACH;
goto error;
@@ -422,9 +387,7 @@ void _sdp_link_path_lookup(void *data)
/*
* check that device is IPoIB
*/
- if (NULL == rt->u.dst.neighbour ||
- NULL == rt->u.dst.neighbour->dev) {
-
+ if (NULL == rt->u.dst.neighbour || NULL == rt->u.dst.neighbour->dev) {
sdp_dbg_warn(NULL, "No neighbour found for <%08x:%08x>",
rt->rt_src, rt->rt_dst);
@@ -437,7 +400,6 @@ void _sdp_link_path_lookup(void *data)
*/
if (ARPHRD_INFINIBAND != rt->u.dst.neighbour->dev->type &&
0 == (IFF_LOOPBACK & rt->u.dst.neighbour->dev->flags)) {
-
result = -ENETUNREACH;
goto error;
}
@@ -457,21 +419,16 @@ void _sdp_link_path_lookup(void *data)
info->gw = rt->rt_gateway;
info->src = rt->rt_src; /* true source IP address */
- if (IFF_LOOPBACK & info->dev->flags) {
-
+ if (IFF_LOOPBACK & info->dev->flags)
while (NULL != (info->dev = dev_get_by_index(++counter))) {
dev_put(info->dev);
if (ARPHRD_INFINIBAND == info->dev->type &&
- 0 < (IFF_UP & info->dev->flags)) {
-
+ 0 < (IFF_UP & info->dev->flags))
break;
- }
}
- }
if (NULL == info->dev) {
-
sdp_dbg_warn(NULL, "No device for IB comm <%s:%08x:%08x>",
rt->u.dst.neighbour->dev->name,
rt->u.dst.neighbour->dev->flags,
@@ -497,7 +454,6 @@ void _sdp_link_path_lookup(void *data)
* the IB device which was found.
*/
if (IFF_LOOPBACK & rt->u.dst.neighbour->dev->flags) {
-
memcpy(&info->path.dgid,
(info->dev->dev_addr + 4),
sizeof(union ib_gid));
@@ -508,7 +464,6 @@ void _sdp_link_path_lookup(void *data)
if ((NUD_CONNECTED|NUD_DELAY|NUD_PROBE) &
rt->u.dst.neighbour->nud_state) {
-
memcpy(&info->path.dgid,
(rt->u.dst.neighbour->ha + 4),
sizeof(union ib_gid));
@@ -519,7 +474,6 @@ void _sdp_link_path_lookup(void *data)
* No address entry, either ARP inprogress or needs to be issued.
*/
if (NUD_INCOMPLETE & rt->u.dst.neighbour->nud_state) {
-
result = 0;
goto done;
}
@@ -541,19 +495,15 @@ arp:
sweep = info->wait_list;
while (NULL != sweep) {
-
wait = sweep;
sweep = sweep->next;
- if (SDP_LINK_SA_RETRY < wait->retry++) {
-
+ if (SDP_LINK_SA_RETRY < wait->retry++)
_sdp_path_wait_complete(wait, info,
-ETIMEDOUT);
- }
}
if (NULL == info->wait_list) {
-
result = -ETIMEDOUT;
goto error;
}
@@ -569,7 +519,6 @@ arp:
path:
result = _sdp_link_path_rec_get(info);
if (result) {
-
sdp_dbg_warn(NULL, "Error <%d> getting path record.", result);
goto error;
}
@@ -611,10 +560,8 @@ int sdp_link_path_lookup(u32 dst_addr,
*/
info = _sdp_path_info_lookup(dst_addr, bound_dev_if);
if (NULL == info) {
-
info = _sdp_path_info_create(dst_addr, bound_dev_if);
if (NULL == info) {
-
sdp_dbg_warn(NULL, "Failed to create path object");
return -ENOMEM;
}
@@ -626,7 +573,6 @@ int sdp_link_path_lookup(u32 dst_addr,
* if not waiting for result, complete.
*/
if (SDP_LINK_F_VALID & info->flags) {
-
_sdp_link_path_complete(*id, 0, info, completion, arg);
return 0;
}
@@ -635,7 +581,6 @@ int sdp_link_path_lookup(u32 dst_addr,
*/
wait = kmem_cache_alloc(_wait_cache, SLAB_KERNEL);
if (NULL == wait) {
-
sdp_dbg_warn(NULL, "Failed to create path wait object");
result = -ENOMEM;
goto error;
@@ -649,10 +594,8 @@ int sdp_link_path_lookup(u32 dst_addr,
/*
* initiate address lookup, if not in progress.
*/
- if (!((SDP_LINK_F_ARP|SDP_LINK_F_PATH) & info->flags)) {
-
+ if (!((SDP_LINK_F_ARP|SDP_LINK_F_PATH) & info->flags))
_sdp_link_path_lookup(info);
- }
return 0;
error:
@@ -673,12 +616,10 @@ static void _sdp_link_sweep(void *data)
sweep = _info_list;
while (NULL != sweep) {
-
info = sweep;
sweep = sweep->next;
if (jiffies > (info->use + SDP_LINK_INFO_TIMEOUT)) {
-
sdp_dbg_ctrl(NULL,
"info delete <%d.%d.%d.%d> <%lu:%lu>",
(info->dst & 0x000000ff),
@@ -721,23 +662,16 @@ static void _sdp_link_arp_work(void *dat
/*
* find a path info structure for the source IP address.
*/
- for (info = _info_list; NULL != info; info = info->next) {
-
- if (info->dst == arp->src_ip) {
-
+ for (info = _info_list; NULL != info; info = info->next)
+ if (info->dst == arp->src_ip)
break;
- }
- }
-
- if (NULL == info) {
+ if (NULL == info)
goto done;
- }
/*
* update record info, and request new path record data.
*/
if (SDP_LINK_F_ARP & info->flags) {
-
cancel_delayed_work(&info->timer);
info->flags &= ~SDP_LINK_F_ARP;
}
@@ -746,7 +680,6 @@ static void _sdp_link_arp_work(void *dat
result = _sdp_link_path_rec_get(info);
if (result) {
-
sdp_dbg_warn(NULL, "Error <%d> path request on ARP.", result);
_sdp_path_info_destroy(info, result);
}
@@ -771,18 +704,14 @@ static int _sdp_link_arp_recv(struct sk_
if (ARPHRD_INFINIBAND != dev->type ||
(arp_hdr->ar_op != __constant_htons(ARPOP_REPLY) &&
- arp_hdr->ar_op != __constant_htons(ARPOP_REQUEST))) {
-
+ arp_hdr->ar_op != __constant_htons(ARPOP_REQUEST)))
goto done;
- }
/*
* queue IB arp packet onto work queue.
*/
work = kmalloc(sizeof(*work), GFP_ATOMIC);
- if (NULL == work) {
-
+ if (NULL == work)
goto done;
- }
work->arg = skb;
INIT_WORK(&work->work, _sdp_link_arp_work, work);
@@ -829,7 +758,6 @@ int sdp_link_addr_init(void)
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _info_cache) {
-
sdp_warn("Failed to allocate path info cache.");
result = -ENOMEM;
@@ -841,7 +769,6 @@ int sdp_link_addr_init(void)
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _wait_cache) {
-
sdp_warn("Failed to allocate path wait cache.");
result = -ENOMEM;
@@ -850,7 +777,6 @@ int sdp_link_addr_init(void)
_link_wq = create_workqueue("sdp_wq");
if (NULL == _link_wq) {
-
sdp_warn("Failed to allocate ARP wait queue.");
result = -ENOMEM;
@@ -886,10 +812,8 @@ int sdp_link_addr_cleanup(void)
/*
* clear objects
*/
- while (NULL != (info = _info_list)) {
-
+ while (NULL != (info = _info_list))
_sdp_path_info_destroy(info, -EINTR);
- }
/*
* remove ARP packet processing.
*/
More information about the general
mailing list