[openib-general] [PATCH] [FIXED] Fix underlying problem with using typedefs
Tom Duffy
Tom.Duffy at Sun.COM
Fri Jul 30 11:42:05 PDT 2004
On Fri, 2004-07-30 at 11:03, Greg KH wrote:
> No, that should be:
> memset(path_elmt, 0, sizeof(*path_elmt));
>
> to prevent any future change of that variable type causing a problem.
>
> Please change your patch to use this style.
OK, I changed it throughout ip2pr_link.c
Index: drivers/infiniband/ulp/ipoib/ip2pr_priv.h
===================================================================
--- drivers/infiniband/ulp/ipoib/ip2pr_priv.h (revision 547)
+++ drivers/infiniband/ulp/ipoib/ip2pr_priv.h (working copy)
@@ -92,46 +92,43 @@
/*
* IPoIB hardware address.
*/
-struct tIP2PR_IPOIB_ADDR_STRUCT {
- tUINT32 qpn; /* MSB = reserved, low 3 bytes=QPN */
+struct ip2pr_ipoib_addr {
+ u32 qpn; /* MSB = reserved, low 3 bytes=QPN */
union {
- tUINT8 all[16];
+ u8 all[16];
struct {
- tUINT64 high;
- tUINT64 low;
+ u64 high;
+ u64 low;
} s;
} gid;
} __attribute__ ((packed));
-typedef struct tIP2PR_IPOIB_ADDR_STRUCT tIP2PR_IPOIB_ADDR_STRUCT,
- *tIP2PR_IPOIB_ADDR;
+
/*
* The two src and dst addresses are the same size as the GRH.
*/
-struct tIP2PR_IPOIB_HDR_STRUCT {
- tIP2PR_IPOIB_ADDR_STRUCT src;
- tIP2PR_IPOIB_ADDR_STRUCT dst;
- tUINT16 proto;
- tUINT16 reserved;
+struct ip2pr_ipoib_hdr {
+ struct ip2pr_ipoib_addr src;
+ struct ip2pr_ipoib_addr dst;
+ u16 proto;
+ u16 reserved;
} __attribute__ ((packed));
/*
* Ethernet/IPoIB pseudo ARP header, used by out IPoIB driver.
*/
-struct tIP2PR_IPOIB_ARP_STRUCT {
- tUINT16 addr_type; /* format of hardware address */
- tUINT16 proto_type; /* format of protocol address */
- tUINT8 addr_len; /* length of hardware address */
- tUINT8 proto_len; /* length of protocol address */
- tUINT16 cmd; /* ARP opcode (command) */
+struct ip2pr_ipoib_arp {
+ u16 addr_type; /* format of hardware address */
+ u16 proto_type; /* format of protocol address */
+ u8 addr_len; /* length of hardware address */
+ u8 proto_len; /* length of protocol address */
+ u16 cmd; /* ARP opcode (command) */
/*
* begin ethernet
*/
- tUINT8 src_hw[ETH_ALEN];
- tUINT32 src_ip;
- tUINT8 dst_hw[ETH_ALEN];
- tUINT32 dst_ip;
+ u8 src_hw[ETH_ALEN];
+ u32 src_ip;
+ u8 dst_hw[ETH_ALEN];
+ u32 dst_ip;
} __attribute__ ((packed));
-typedef struct tIP2PR_IPOIB_ARP_STRUCT tIP2PR_IPOIB_ARP_STRUCT,
- *tIP2PR_IPOIB_ARP;
typedef enum {
IP2PR_LOCK_HELD = 0,
@@ -193,98 +190,90 @@
/*
* tables
*/
-typedef struct tIP2PR_IPOIB_WAIT_STRUCT tIP2PR_IPOIB_WAIT_STRUCT,
- *tIP2PR_IPOIB_WAIT;
+
/*
* wait for an ARP event to complete.
*/
-struct tIP2PR_IPOIB_WAIT_STRUCT {
- tINT8 type; /* ip2pr or gid2pr */
+struct ip2pr_ipoib_wait {
+ s8 type; /* ip2pr or gid2pr */
tIP2PR_PATH_LOOKUP_ID plid; /* request identifier */
tPTR func; /* callback function for completion */
tPTR arg; /* user argument */
struct net_device *dev; /* ipoib device */
tTS_KERNEL_TIMER_STRUCT timer; /* retry timer */
- tUINT8 retry; /* retry counter */
- tUINT8 flags; /* usage flags */
- tUINT8 state; /* current state */
- tUINT8 hw[ETH_ALEN]; /* hardware address */
- tUINT32 src_addr; /* requested address. */
- tUINT32 dst_addr; /* requested address. */
- tUINT32 gw_addr; /* next hop IP address */
- tUINT8 local_rt; /* local route only */
- tINT32 bound_dev; /* bound device interface */
+ u8 retry; /* retry counter */
+ u8 flags; /* usage flags */
+ u8 state; /* current state */
+ u8 hw[ETH_ALEN]; /* hardware address */
+ u32 src_addr; /* requested address. */
+ u32 dst_addr; /* requested address. */
+ u32 gw_addr; /* next hop IP address */
+ u8 local_rt; /* local route only */
+ s32 bound_dev; /* bound device interface */
tTS_IB_GID src_gid; /* source GID */
tTS_IB_GID dst_gid; /* destination GID */
u16 pkey; /* pkey to use */
tTS_IB_PORT hw_port; /* hardware port */
struct ib_device *ca; /* hardware HCA */
- tUINT32 prev_timeout; /* timeout value for pending request */
+ u32 prev_timeout; /* timeout value for pending request */
tTS_IB_CLIENT_QUERY_TID tid; /* path record lookup transactionID */
spinlock_t lock;
- tIP2PR_IPOIB_WAIT next; /* next element in wait list. */
- tIP2PR_IPOIB_WAIT *p_next; /* previous next element in list */
+ struct ip2pr_ipoib_wait *next; /* next element in wait list. */
+ struct ip2pr_ipoib_wait **p_next; /* previous next element in list */
struct work_struct arp_completion;
-}; /* tIP2PR_IPOIB_WAIT_STRUCT */
+};
-typedef struct tIP2PR_PATH_ELEMENT_STRUCT tIP2PR_PATH_ELEMENT_STRUCT,
- *tIP2PR_PATH_ELEMENT;
/*
* wait for an ARP event to complete.
*/
-struct tIP2PR_PATH_ELEMENT_STRUCT {
- tUINT32 src_addr; /* requested address. */
- tUINT32 dst_addr; /* requested address. */
- tUINT32 usage; /* last used time. */
+struct ip2pr_path_element {
+ u32 src_addr; /* requested address. */
+ u32 dst_addr; /* requested address. */
+ u32 usage; /* last used time. */
tTS_IB_PORT hw_port; /* source port */
struct ib_device *ca; /* hardware HCA */
struct ib_path_record path_s; /* path structure */
- tIP2PR_PATH_ELEMENT next; /* next element in wait list. */
- tIP2PR_PATH_ELEMENT *p_next; /* previous next element in list */
-}; /* tIP2PR_PATH_ELEMENT_STRUCT */
+ struct ip2pr_path_element *next; /* next element in wait list. */
+ struct ip2pr_path_element **p_next; /* previous next element in list */
+};
-struct tIP2PR_USER_REQ_STRUCT {
+struct ip2pr_user_req {
struct ib_path_record path_record;
- tINT32 status;
+ s32 status;
struct ib_device *device;
tTS_IB_PORT port;
struct semaphore sem;
};
-typedef struct tIP2PR_USER_REQ_STRUCT tIP2PR_USER_REQ_STRUCT, *tIP2PR_USER_REQ;
/*
* List of Path records cached on a port on a hca
*/
-typedef struct tIP2PR_GID_PR_ELEMENT_STRUCT tIP2PR_GID_PR_ELEMENT_STRUCT,
- *tIP2PR_GID_PR_ELEMENT;
-struct tIP2PR_GID_PR_ELEMENT_STRUCT {
+struct ip2pr_gid_pr_element {
struct ib_path_record path_record;
- tUINT32 usage; /* last used time. */
- tIP2PR_GID_PR_ELEMENT next;
- tIP2PR_GID_PR_ELEMENT *p_next;
+ u32 usage; /* last used time. */
+ struct ip2pr_gid_pr_element *next;
+ struct ip2pr_gid_pr_element **p_next;
};
/*
* List of Source GID's
*/
-typedef struct tIP2PR_SGID_ELEMENT_STRUCT tIP2PR_SGID_ELEMENT_STRUCT,
- *tIP2PR_SGID_ELEMENT;
-struct tIP2PR_SGID_ELEMENT_STRUCT {
+struct ip2pr_sgid_element {
tTS_IB_GID gid;
struct ib_device *ca;
tTS_IB_PORT port;
enum ib_port_state port_state;
int gid_index;
- tIP2PR_GID_PR_ELEMENT pr_list;
- tIP2PR_SGID_ELEMENT next; /* next element in the GID list */
- tIP2PR_SGID_ELEMENT *p_next; /* previous next element in the list */
+ struct ip2pr_gid_pr_element *pr_list;
+ struct ip2pr_sgid_element *next; /* next element in the GID list */
+ struct ip2pr_sgid_element **p_next; /* previous next element in the list */
};
-struct tIP2PR_LINK_ROOT_STRUCT {
+struct ip2pr_link_root {
/*
* waiting for resolution table
*/
- tIP2PR_IPOIB_WAIT wait_list;
+ struct ip2pr_ipoib_wait *wait_list;
kmem_cache_t *wait_cache;
spinlock_t wait_lock;
int max_retries;
@@ -296,7 +285,7 @@
/*
* path record cache list.
*/
- tIP2PR_PATH_ELEMENT path_list;
+ struct ip2pr_path_element *path_list;
kmem_cache_t *path_cache;
spinlock_t path_lock;
/*
@@ -307,14 +296,12 @@
/*
* source gid list
*/
- tIP2PR_SGID_ELEMENT src_gid_list;
+ struct ip2pr_sgid_element *src_gid_list;
kmem_cache_t *src_gid_cache;
kmem_cache_t *gid_pr_cache;
spinlock_t gid_lock;
-}; /* tIP2PR_LINK_ROOT_STRUCT */
-typedef struct tIP2PR_LINK_ROOT_STRUCT tIP2PR_LINK_ROOT_STRUCT,
- *tIP2PR_LINK_ROOT;
+};
#define TS_EXPECT(mod, expr)
#define TS_CHECK_NULL(value, result)
Index: drivers/infiniband/ulp/ipoib/ip2pr_link.c
===================================================================
--- drivers/infiniband/ulp/ipoib/ip2pr_link.c (revision 547)
+++ drivers/infiniband/ulp/ipoib/ip2pr_link.c (working copy)
@@ -35,7 +35,7 @@
static unsigned int ip2pr_path_timeout = 0;
static unsigned int ip2pr_total_fail = 0;
-static tIP2PR_LINK_ROOT_STRUCT _tsIp2prLinkRoot = {
+static struct ip2pr_link_root _tsIp2prLinkRoot = {
wait_list:NULL,
path_list:NULL,
wait_lock:SPIN_LOCK_UNLOCKED,
@@ -47,7 +47,7 @@
gid_lock:SPIN_LOCK_UNLOCKED
};
-tINT32 _tsIp2PrnDelete(tIP2PR_GID_PR_ELEMENT pr_elmt);
+s32 _tsIp2PrnDelete(struct ip2pr_gid_pr_element *pr_elmt);
static tTS_IB_GID nullgid = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -62,8 +62,9 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*.._tsIp2prPathElementLookup -- lookup a path record entry */
-static tIP2PR_PATH_ELEMENT _tsIp2prPathElementLookup(tUINT32 ip_addr) {
- tIP2PR_PATH_ELEMENT path_elmt;
+static struct ip2pr_path_element *_tsIp2prPathElementLookup(u32 ip_addr)
+{
+ struct ip2pr_path_element *path_elmt;
for (path_elmt = _tsIp2prLinkRoot.path_list;
NULL != path_elmt; path_elmt = path_elmt->next) {
@@ -79,13 +80,12 @@
/* ========================================================================= */
/*.._tsIp2prPathElementCreate -- create an entry for a path record element */
-static tINT32 _tsIp2prPathElementCreate
- (tUINT32 dst_addr,
- tUINT32 src_addr,
- tTS_IB_PORT hw_port,
- struct ib_device *ca,
- struct ib_path_record *path_r, tIP2PR_PATH_ELEMENT * return_elmt) {
- tIP2PR_PATH_ELEMENT path_elmt;
+static s32 _tsIp2prPathElementCreate(u32 dst_addr, u32 src_addr,
+ tTS_IB_PORT hw_port, struct ib_device *ca,
+ struct ib_path_record *path_r,
+ struct ip2pr_path_element **return_elmt)
+{
+ struct ip2pr_path_element *path_elmt;
unsigned long flags;
TS_CHECK_NULL(path_r, -EINVAL);
@@ -98,7 +98,7 @@
return -ENOMEM;
}
/* if */
- memset(path_elmt, 0, sizeof(tIP2PR_PATH_ELEMENT_STRUCT));
+ memset(path_elmt, 0, sizeof(*path_elmt));
spin_lock_irqsave(&_tsIp2prLinkRoot.path_lock, flags);
path_elmt->next = _tsIp2prLinkRoot.path_list;
@@ -118,7 +118,7 @@
path_elmt->hw_port = hw_port;
path_elmt->ca = ca;
path_elmt->usage = jiffies;
- memcpy(&path_elmt->path_s, path_r, sizeof(struct ib_path_record));
+ memcpy(&path_elmt->path_s, path_r, sizeof(*path_r));
*return_elmt = path_elmt;
@@ -127,7 +127,8 @@
/* ========================================================================= */
/*.._tsIp2prPathElementDestroy -- destroy an entry for a path record element */
-static tINT32 _tsIp2prPathElementDestroy(tIP2PR_PATH_ELEMENT path_elmt) {
+static s32 _tsIp2prPathElementDestroy(struct ip2pr_path_element *path_elmt)
+{
unsigned long flags;
TS_CHECK_NULL(path_elmt, -EINVAL);
@@ -154,9 +155,11 @@
/* ========================================================================= */
/*.._tsIp2prPathLookupComplete -- complete the resolution of a path record */
-static tINT32 _tsIp2prPathLookupComplete
- (tIP2PR_PATH_LOOKUP_ID plid,
- tINT32 status, tIP2PR_PATH_ELEMENT path_elmt, tPTR funcptr, tPTR arg) {
+static s32 _tsIp2prPathLookupComplete(tIP2PR_PATH_LOOKUP_ID plid,
+ s32 status,
+ struct ip2pr_path_element *path_elmt,
+ tPTR funcptr, tPTR arg)
+{
tIP2PR_PATH_LOOKUP_FUNC func = (tIP2PR_PATH_LOOKUP_FUNC) funcptr;
TS_CHECK_NULL(func, -EINVAL);
@@ -184,8 +187,8 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*.._tsIp2prIpoibWaitDestroy -- destroy an entry for an outstanding request */
-static tINT32 _tsIp2prIpoibWaitDestroy
- (tIP2PR_IPOIB_WAIT ipoib_wait, IP2PR_USE_LOCK use_lock) {
+static s32 _tsIp2prIpoibWaitDestroy
+ (struct ip2pr_ipoib_wait *ipoib_wait, IP2PR_USE_LOCK use_lock) {
unsigned long flags = 0;
TS_CHECK_NULL(ipoib_wait, -EINVAL);
@@ -214,9 +217,10 @@
/* ========================================================================= */
/*.._tsIp2prIpoibWaitTimeout -- timeout function for link resolution */
-static void _tsIp2prIpoibWaitTimeout(tPTR arg) {
- tIP2PR_IPOIB_WAIT ipoib_wait = (tIP2PR_IPOIB_WAIT) arg;
- tINT32 result;
+static void _tsIp2prIpoibWaitTimeout(tPTR arg)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait = (struct ip2pr_ipoib_wait *)arg;
+ s32 result;
if (NULL == ipoib_wait) {
@@ -294,21 +298,19 @@
/* ========================================================================= */
/*.._tsIp2prIpoibWaitCreate -- create an entry for an outstanding request */
-static tIP2PR_IPOIB_WAIT _tsIp2prIpoibWaitCreate
- (tIP2PR_PATH_LOOKUP_ID plid,
- tUINT32 dst_addr,
- tUINT32 src_addr,
- tUINT8 localroute,
- tINT32 bound_dev_if,
- tIP2PR_PATH_LOOKUP_FUNC func, tPTR arg, tINT32 ltype) {
- tIP2PR_IPOIB_WAIT ipoib_wait;
+static struct ip2pr_ipoib_wait *
+_tsIp2prIpoibWaitCreate(tIP2PR_PATH_LOOKUP_ID plid, u32 dst_addr, u32 src_addr,
+ u8 localroute, u32 bound_dev_if,
+ tIP2PR_PATH_LOOKUP_FUNC func, tPTR arg, s32 ltype)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait;
TS_CHECK_NULL(_tsIp2prLinkRoot.wait_cache, NULL);
ipoib_wait = kmem_cache_alloc(_tsIp2prLinkRoot.wait_cache, SLAB_ATOMIC);
if (NULL != ipoib_wait) {
- memset(ipoib_wait, 0, sizeof(tIP2PR_IPOIB_WAIT_STRUCT));
+ memset(ipoib_wait, 0, sizeof(*ipoib_wait));
/*
* start timer only for IP to PR lookups
@@ -349,7 +351,8 @@
/* ========================================================================= */
/*.._tsIp2prIpoibWaitListInsert -- insert an entry into the wait list */
-static tINT32 _tsIp2prIpoibWaitListInsert(tIP2PR_IPOIB_WAIT ipoib_wait) {
+static s32 _tsIp2prIpoibWaitListInsert(struct ip2pr_ipoib_wait *ipoib_wait)
+{
unsigned long flags;
TS_CHECK_NULL(ipoib_wait, -EINVAL);
@@ -385,9 +388,11 @@
/* ========================================================================= */
/*.._tsIp2prIpoibWaitPlidLookup -- lookup an entry for an outstanding request */
-static tIP2PR_IPOIB_WAIT tsIp2prIpoibWaitPlidLookup(tIP2PR_PATH_LOOKUP_ID plid) {
+static struct ip2pr_ipoib_wait *
+tsIp2prIpoibWaitPlidLookup(tIP2PR_PATH_LOOKUP_ID plid)
+{
unsigned long flags;
- tIP2PR_IPOIB_WAIT ipoib_wait;
+ struct ip2pr_ipoib_wait *ipoib_wait;
spin_lock_irqsave(&_tsIp2prLinkRoot.wait_lock, flags);
for (ipoib_wait = _tsIp2prLinkRoot.wait_list;
@@ -405,11 +410,12 @@
/* ========================================================================= */
/*..tsIp2prPathElementTableDump - dump the path record element table to proc */
-tINT32 tsIp2prPathElementTableDump
- (tSTR buffer, tINT32 max_size, tINT32 start_index, long *end_index) {
- tIP2PR_PATH_ELEMENT path_elmt;
- tINT32 counter = 0;
- tINT32 offset = 0;
+s32 tsIp2prPathElementTableDump(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
+{
+ struct ip2pr_path_element *path_elmt;
+ s32 counter = 0;
+ s32 offset = 0;
unsigned long flags;
TS_CHECK_NULL(buffer, -EINVAL);
@@ -448,12 +454,12 @@
((path_elmt->dst_addr >> 16) & 0xff),
((path_elmt->dst_addr >> 24) & 0xff),
(unsigned long long)
- be64_to_cpu(*(tUINT64 *) path_elmt->
+ be64_to_cpu(*(u64 *) path_elmt->
path_s.dgid),
(unsigned long long)
- be64_to_cpu(*(tUINT64 *)
+ be64_to_cpu(*(u64 *)
(path_elmt->path_s.dgid +
- sizeof(tUINT64))),
+ sizeof(u64))),
path_elmt->path_s.dlid,
path_elmt->path_s.slid,
path_elmt->path_s.pkey,
@@ -473,11 +479,13 @@
/* ========================================================================= */
/*..tsIp2prIpoibWaitTableDump - dump the address resolution wait table to proc */
-tINT32 tsIp2prIpoibWaitTableDump
- (tSTR buffer, tINT32 max_size, tINT32 start_index, long *end_index) {
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tINT32 counter = 0;
- tINT32 offset = 0;
+s32
+tsIp2prIpoibWaitTableDump(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ s32 counter = 0;
+ s32 offset = 0;
unsigned long flags;
TS_CHECK_NULL(buffer, -EINVAL);
@@ -530,11 +538,10 @@
} /* tsIp2prIpoibWaitTableDump */
/* ..tsIp2prProcReadInt. dump integer value to /proc file */
-tINT32 tsIp2prProcReadInt(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index, int val)
+s32 tsIp2prProcReadInt(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index, int val)
{
- tINT32 offset = 0;
+ s32 offset = 0;
TS_CHECK_NULL(buffer, -EINVAL);
TS_CHECK_NULL(end_index, -EINVAL);
@@ -547,9 +554,8 @@
}
/* ..tsIp2prProcMaxRetriesRead. dump current retry value */
-tINT32 tsIp2prProcRetriesRead(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcRetriesRead(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -559,9 +565,8 @@
}
/* ..tsIp2prProcTimeoutRead. dump current timeout value */
-tINT32 tsIp2prProcTimeoutRead(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcTimeoutRead(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -571,9 +576,8 @@
}
/* ..tsIp2prProcBackoutRead. dump current backout value */
-tINT32 tsIp2prProcBackoffRead(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcBackoffRead(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -583,9 +587,8 @@
}
/* ..tsIp2prProcCacheTimeoutRead. dump current cache timeout value */
-tINT32 tsIp2prProcCacheTimeoutRead(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcCacheTimeoutRead(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -595,8 +598,8 @@
}
/* ..tsIp2prProcMaxRetriesRead. dump current retry value */
-tINT32 tsIp2prProcTotalReq(tSTR buffer,
- tINT32 max_size, tINT32 start_index, long *end_index)
+s32 tsIp2prProcTotalReq(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -605,9 +608,8 @@
}
/* ..tsIp2prProcMaxRetriesRead. dump current retry value */
-tINT32 tsIp2prProcArpTimeout(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcArpTimeout(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -616,9 +618,8 @@
}
/* ..tsIp2prProcMaxRetriesRead. dump current retry value */
-tINT32 tsIp2prProcPathTimeout(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcPathTimeout(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -627,9 +628,8 @@
}
/* ..tsIp2prProcMaxRetriesRead. dump current retry value */
-tINT32 tsIp2prProcTotalFail(tSTR buffer,
- tINT32 max_size,
- tINT32 start_index, long *end_index)
+s32 tsIp2prProcTotalFail(tSTR buffer, s32 max_size, s32 start_index,
+ long *end_index)
{
return (tsIp2prProcReadInt(buffer,
@@ -645,8 +645,8 @@
char kernel_buf[256];
int ret;
- if (count > sizeof kernel_buf) {
- count = sizeof kernel_buf;
+ if (count > sizeof(kernel_buf)) {
+ count = sizeof(kernel_buf);
}
if (copy_from_user(kernel_buf, buffer, count)) {
@@ -726,12 +726,13 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*.._tsIp2prPathRecordComplete -- path lookup complete, save result */
-static tINT32 _tsIp2prPathRecordComplete
- (tTS_IB_CLIENT_QUERY_TID tid,
- tINT32 status, struct ib_path_record *path, tINT32 remaining, tPTR arg) {
- tIP2PR_IPOIB_WAIT ipoib_wait = (tIP2PR_IPOIB_WAIT) arg;
- tIP2PR_PATH_ELEMENT path_elmt = NULL;
- tINT32 result;
+static s32 _tsIp2prPathRecordComplete(tTS_IB_CLIENT_QUERY_TID tid, s32 status,
+ struct ib_path_record *path,
+ s32 remaining, tPTR arg)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait = (struct ip2pr_ipoib_wait *) arg;
+ struct ip2pr_path_element *path_elmt = NULL;
+ s32 result;
TS_CHECK_NULL(ipoib_wait, -EINVAL);
TS_CHECK_NULL(path, -EINVAL);
@@ -803,9 +804,9 @@
TS_TRACE(MOD_IP2PR, T_VERY_VERBOSE, TRACE_FLOW_INOUT,
"POST: Path record lookup complete. <%016llx:%016llx:%d>",
- be64_to_cpu(*(tUINT64 *) path->dgid),
- be64_to_cpu(*(tUINT64 *)
- (path->dgid + sizeof(tUINT64))),
+ be64_to_cpu(*(u64 *) path->dgid),
+ be64_to_cpu(*(u64 *)
+ (path->dgid + sizeof(u64))),
path->dlid);
result = _tsIp2prPathElementCreate(ipoib_wait->dst_addr,
@@ -867,10 +868,11 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*.._tsIp2prLinkFindComplete -- complete the resolution of an ip address */
-static tINT32 _tsIp2prLinkFindComplete
- (tIP2PR_IPOIB_WAIT ipoib_wait, tINT32 status, IP2PR_USE_LOCK use_lock) {
- tINT32 result = 0;
- tINT32 expect;
+static s32 _tsIp2prLinkFindComplete(struct ip2pr_ipoib_wait *ipoib_wait,
+ s32 status, IP2PR_USE_LOCK use_lock)
+{
+ s32 result = 0;
+ s32 expect;
unsigned long flags;
TS_CHECK_NULL(ipoib_wait, -EINVAL);
@@ -968,7 +970,8 @@
/* ========================================================================= */
/*.._tsIp2prArpQuery -- query arp cache */
-static int tsIp2prArpQuery(tIP2PR_IPOIB_WAIT ipoib_wait, tUINT32 * state) {
+static int tsIp2prArpQuery(struct ip2pr_ipoib_wait *ipoib_wait, u32 * state)
+{
struct neighbour *neigh;
extern struct neigh_table arp_tbl;
@@ -990,9 +993,10 @@
/* ========================================================================= */
/*.._tsIp2prLinkFind -- resolve an ip address to a ipoib link address. */
-static tINT32 _tsIp2prLinkFind(tIP2PR_IPOIB_WAIT ipoib_wait) {
- tINT32 result;
- tUINT32 state;
+static s32 _tsIp2prLinkFind(struct ip2pr_ipoib_wait *ipoib_wait)
+{
+ s32 result;
+ u32 state;
struct rtable *rt;
char devname[20];
int i;
@@ -1223,11 +1227,12 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*.._tsIp2prArpRecvComplete -- receive all ARP packets. */
-static void _tsIp2prArpRecvComplete(tPTR arg) {
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tIP2PR_IPOIB_WAIT next_wait;
- tUINT32 ip_addr = (unsigned long)arg;
- tINT32 result;
+static void _tsIp2prArpRecvComplete(tPTR arg)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ struct ip2pr_ipoib_wait *next_wait;
+ u32 ip_addr = (unsigned long)arg;
+ s32 result;
unsigned long flags;
TS_TRACE(MOD_IP2PR, T_VERY_VERBOSE, TRACE_FLOW_INOUT,
@@ -1276,12 +1281,12 @@
/* ========================================================================= */
/*.._tsIp2prArpRecv -- receive all ARP packets. */
-static tINT32 _tsIp2prArpRecv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt)
+static s32 _tsIp2prArpRecv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tIP2PR_IPOIB_ARP arp_hdr;
- tINT32 counter;
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ struct ip2pr_ipoib_arp *arp_hdr;
+ s32 counter;
unsigned long flags;
struct work_struct *tqp = NULL;
@@ -1289,7 +1294,7 @@
TS_CHECK_NULL(skb, -EINVAL);
TS_CHECK_NULL(skb->nh.raw, -EINVAL);
- arp_hdr = (tIP2PR_IPOIB_ARP) skb->nh.raw;
+ arp_hdr = (struct ip2pr_ipoib_arp *) skb->nh.raw;
#if 0
TS_TRACE(MOD_IP2PR, T_VERY_VERBOSE, TRACE_FLOW_INOUT,
@@ -1364,11 +1369,11 @@
static void _tsIp2prAsyncEventFunc(struct ib_async_event_record *record,
void *arg)
{
- tIP2PR_PATH_ELEMENT path_elmt;
- tINT32 result;
- tIP2PR_SGID_ELEMENT sgid_elmt;
+ struct ip2pr_path_element *path_elmt;
+ s32 result;
+ struct ip2pr_sgid_element *sgid_elmt;
unsigned long flags;
- tIP2PR_GID_PR_ELEMENT prn_elmt;
+ struct ip2pr_gid_pr_element *prn_elmt;
if (NULL == record) {
@@ -1412,7 +1417,7 @@
/* for now zero it. Will get it, when user queries */
memcpy(sgid_elmt->gid, nullgid,
- sizeof(tTS_IB_GID));
+ sizeof(nullgid));
}
/* clear the Gid pr cache */
while (NULL != (prn_elmt = sgid_elmt->pr_list)) {
@@ -1432,12 +1437,13 @@
/* ========================================================================= */
/*.._tsIp2prPathSweepTimerFunc --sweep path cache to reap old entries. */
-static void _tsIp2prPathSweepTimerFunc(tPTR arg) {
- tIP2PR_PATH_ELEMENT path_elmt;
- tIP2PR_PATH_ELEMENT next_elmt;
- tINT32 result;
- tIP2PR_SGID_ELEMENT sgid_elmt;
- tIP2PR_GID_PR_ELEMENT prn_elmt, next_prn;
+static void _tsIp2prPathSweepTimerFunc(tPTR arg)
+{
+ struct ip2pr_path_element *path_elmt;
+ struct ip2pr_path_element *next_elmt;
+ s32 result;
+ struct ip2pr_sgid_element *sgid_elmt;
+ struct ip2pr_gid_pr_element *prn_elmt, *next_prn;
/* cache_timeout of zero implies static path records. */
if (_tsIp2prLinkRoot.cache_timeout) {
@@ -1448,7 +1454,7 @@
while (NULL != path_elmt) {
next_elmt = path_elmt->next;
if (!((_tsIp2prLinkRoot.cache_timeout * HZ) >
- (tINT32) (jiffies - path_elmt->usage))) {
+ (s32) (jiffies - path_elmt->usage))) {
TS_TRACE(MOD_IP2PR, T_VERY_VERBOSE,
TRACE_FLOW_INOUT,
@@ -1472,7 +1478,7 @@
while (NULL != prn_elmt) {
next_prn = prn_elmt->next;
if (!((_tsIp2prLinkRoot.cache_timeout * HZ) >
- (tINT32) (jiffies - prn_elmt->usage))) {
+ (s32) (jiffies - prn_elmt->usage))) {
TS_TRACE(MOD_IP2PR, T_VERY_VERBOSE,
TRACE_FLOW_INOUT,
@@ -1502,16 +1508,14 @@
/* --------------------------------------------------------------------- */
/* ========================================================================= */
/*..tsSdpPathRecordLookup -- resolve an ip address to a path record */
-tINT32 tsIp2prPathRecordLookup(tUINT32 dst_addr, /* NBO */
- tUINT32 src_addr, /* NBO */
- tUINT8 localroute,
- tINT32 bound_dev_if,
- tIP2PR_PATH_LOOKUP_FUNC func,
- tPTR arg, tIP2PR_PATH_LOOKUP_ID * plid) {
- tIP2PR_PATH_ELEMENT path_elmt;
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tINT32 result = 0;
- tINT32 expect;
+s32 tsIp2prPathRecordLookup(u32 dst_addr, u32 src_addr, u8 localroute,
+ s32 bound_dev_if, tIP2PR_PATH_LOOKUP_FUNC func,
+ tPTR arg, tIP2PR_PATH_LOOKUP_ID * plid)
+{
+ struct ip2pr_path_element *path_elmt;
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ s32 result = 0;
+ s32 expect;
TS_CHECK_NULL(plid, -EINVAL);
TS_CHECK_NULL(func, -EINVAL);
@@ -1579,9 +1583,10 @@
/* ========================================================================= */
/*..tsIp2prPathRecordCancel -- cancel a lookup for an address. */
-tINT32 tsIp2prPathRecordCancel(tIP2PR_PATH_LOOKUP_ID plid) {
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tINT32 result;
+s32 tsIp2prPathRecordCancel(tIP2PR_PATH_LOOKUP_ID plid)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ s32 result;
if (TS_IP2PR_PATH_LOOKUP_INVALID == plid) {
@@ -1622,9 +1627,10 @@
} /* tsIp2prPathRecordCancel */
/*..tsGid2prCancel -- cancel a lookup for an address. */
-tINT32 tsGid2prCancel(tIP2PR_PATH_LOOKUP_ID plid) {
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tINT32 result;
+s32 tsGid2prCancel(tIP2PR_PATH_LOOKUP_ID plid)
+{
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ s32 result;
if (TS_IP2PR_PATH_LOOKUP_INVALID == plid) {
@@ -1672,12 +1678,12 @@
/* ========================================================================= */
/*.._tsIp2prGidCacheLookup -- Lookup for GID in cache */
-tINT32 _tsIp2prGidCacheLookup
- (tTS_IB_GID src_gid,
- tTS_IB_GID dst_gid,
- struct ib_path_record *path_record, tIP2PR_SGID_ELEMENT * gid_node) {
- tIP2PR_SGID_ELEMENT sgid_elmt;
- tIP2PR_GID_PR_ELEMENT prn_elmt;
+s32 _tsIp2prGidCacheLookup(tTS_IB_GID src_gid, tTS_IB_GID dst_gid,
+ struct ib_path_record *path_record,
+ struct ip2pr_sgid_element **gid_node)
+{
+ struct ip2pr_sgid_element *sgid_elmt;
+ struct ip2pr_gid_pr_element *prn_elmt;
unsigned long flags;
*gid_node = NULL;
@@ -1691,8 +1697,7 @@
* gid in the async handler had failed. Try to get it now.
*/
if (0 ==
- memcmp(sgid_elmt->gid, nullgid,
- sizeof(tTS_IB_GID))) {
+ memcmp(sgid_elmt->gid, nullgid, sizeof(nullgid))) {
if (ib_gid_entry_get(sgid_elmt->ca,
sgid_elmt->port, 0,
sgid_elmt->gid)) {
@@ -1707,20 +1712,17 @@
/* we have a valid GID */
if (0 ==
- memcmp(sgid_elmt->gid, src_gid,
- sizeof(tTS_IB_GID))) {
+ memcmp(sgid_elmt->gid, src_gid, sizeof(src_gid))) {
*gid_node = sgid_elmt;
for (prn_elmt = sgid_elmt->pr_list;
NULL != prn_elmt;
prn_elmt = prn_elmt->next) {
if (0 ==
memcmp(&prn_elmt->path_record.dgid,
- dst_gid,
- sizeof(tTS_IB_GID))) {
+ dst_gid, sizeof(dst_gid))) {
memcpy(path_record,
&prn_elmt->path_record,
- sizeof
- (struct ib_path_record));
+ sizeof(*path_record));
prn_elmt->usage = jiffies;
spin_unlock_irqrestore
@@ -1739,15 +1741,17 @@
/* ========================================================================= */
/*.._tsIp2prSrcGidNodeGet -- */
-tINT32 _tsIp2prSrcGidNodeGet(tTS_IB_GID src_gid, tIP2PR_SGID_ELEMENT * gid_node) {
- tIP2PR_SGID_ELEMENT sgid_elmt;
+s32 _tsIp2prSrcGidNodeGet(tTS_IB_GID src_gid,
+ struct ip2pr_sgid_element **gid_node)
+{
+ struct ip2pr_sgid_element *sgid_elmt;
unsigned long flags;
*gid_node = NULL;
spin_lock_irqsave(&_tsIp2prLinkRoot.gid_lock, flags);
for (sgid_elmt = _tsIp2prLinkRoot.src_gid_list;
NULL != sgid_elmt; sgid_elmt = sgid_elmt->next) {
- if (0 == memcmp(sgid_elmt->gid, src_gid, sizeof(tTS_IB_GID))) {
+ if (0 == memcmp(sgid_elmt->gid, src_gid, sizeof(src_gid))) {
*gid_node = sgid_elmt;
spin_unlock_irqrestore(&_tsIp2prLinkRoot.gid_lock,
flags);
@@ -1761,11 +1765,12 @@
/* ========================================================================= */
/*.._tsIp2prGidElementAdd -- Add one node to Source GID List. */
-tINT32 _tsIp2prGidElementAdd
- (tIP2PR_IPOIB_WAIT ipoib_wait, struct ib_path_record *path_record) {
+s32 _tsIp2prGidElementAdd(struct ip2pr_ipoib_wait *ipoib_wait,
+ struct ib_path_record *path_record)
+{
unsigned long flags;
- tIP2PR_SGID_ELEMENT gid_node = NULL;
- tIP2PR_GID_PR_ELEMENT prn_elmt;
+ struct ip2pr_sgid_element *gid_node = NULL;
+ struct ip2pr_gid_pr_element *prn_elmt;
if (_tsIp2prSrcGidNodeGet(ipoib_wait->src_gid, &gid_node)) {
return (-EINVAL);
@@ -1778,7 +1783,7 @@
return (-ENOMEM);
}
memcpy(&prn_elmt->path_record, path_record,
- sizeof(struct ib_path_record));
+ sizeof(*path_record));
/*
* Insert into the ccache list
@@ -1798,7 +1803,8 @@
return (0);
}
-tINT32 _tsIp2PrnDelete(tIP2PR_GID_PR_ELEMENT prn_elmt) {
+s32 _tsIp2PrnDelete(struct ip2pr_gid_pr_element *prn_elmt)
+{
if (NULL != prn_elmt->p_next) {
if (NULL != prn_elmt->next) {
@@ -1817,9 +1823,10 @@
/* ========================================================================= */
/*.._tsIp2prSrcGidDelete -- Cleanup one node in Source GID List. */
-tINT32 _tsIp2prSrcGidDelete(tIP2PR_SGID_ELEMENT sgid_elmt) {
+s32 _tsIp2prSrcGidDelete(struct ip2pr_sgid_element *sgid_elmt)
+{
unsigned long flags;
- tIP2PR_GID_PR_ELEMENT prn_elmt;
+ struct ip2pr_gid_pr_element *prn_elmt;
spin_lock_irqsave(&_tsIp2prLinkRoot.gid_lock, flags);
@@ -1850,11 +1857,11 @@
/* ========================================================================= */
/*.._tsIp2prSrcGidAdd -- Add one node to Source GID List. */
-tINT32 _tsIp2prSrcGidAdd(struct ib_device *hca_device,
- tTS_IB_PORT port,
- enum ib_port_state port_state)
+s32 _tsIp2prSrcGidAdd(struct ib_device *hca_device,
+ tTS_IB_PORT port,
+ enum ib_port_state port_state)
{
- tIP2PR_SGID_ELEMENT sgid_elmt;
+ struct ip2pr_sgid_element *sgid_elmt;
unsigned long flags;
sgid_elmt =
@@ -1865,7 +1872,7 @@
return (-ENOMEM);
}
- memset(sgid_elmt, 0, sizeof(tIP2PR_SGID_ELEMENT_STRUCT));
+ memset(sgid_elmt, 0, sizeof(*sgid_elmt));
if (ib_gid_entry_get(hca_device, port, 0, sgid_elmt->gid)) {
kmem_cache_free(_tsIp2prLinkRoot.src_gid_cache, sgid_elmt);
return (-EFAULT);
@@ -1899,11 +1906,12 @@
/* ========================================================================= */
/*.._tsGid2prComplete -- path lookup complete, save result */
-static tINT32 _tsGid2prComplete
- (tTS_IB_CLIENT_QUERY_TID tid,
- tINT32 status, struct ib_path_record *path, tINT32 remaining, tPTR arg) {
- tINT32 result;
- tIP2PR_IPOIB_WAIT ipoib_wait = (tIP2PR_IPOIB_WAIT) arg;
+static s32 _tsGid2prComplete(tTS_IB_CLIENT_QUERY_TID tid, s32 status,
+ struct ib_path_record *path, s32 remaining,
+ tPTR arg)
+{
+ s32 result;
+ struct ip2pr_ipoib_wait *ipoib_wait = (struct ip2pr_ipoib_wait *) arg;
tGID2PR_LOOKUP_FUNC func;
if (tid != ipoib_wait->tid) {
@@ -1962,14 +1970,13 @@
/* ========================================================================= */
/*..tsGid2prLookup -- Resolve a destination GD to Path Record */
-tINT32 tsGid2prLookup
- (tTS_IB_GID src_gid,
- tTS_IB_GID dst_gid,
- u16 pkey,
- tGID2PR_LOOKUP_FUNC funcptr, tPTR arg, tIP2PR_PATH_LOOKUP_ID * plid) {
- tIP2PR_SGID_ELEMENT gid_node;
- tINT32 result;
- tIP2PR_IPOIB_WAIT ipoib_wait;
+s32 tsGid2prLookup(tTS_IB_GID src_gid, tTS_IB_GID dst_gid, u16 pkey,
+ tGID2PR_LOOKUP_FUNC funcptr, tPTR arg,
+ tIP2PR_PATH_LOOKUP_ID * plid)
+{
+ struct ip2pr_sgid_element *gid_node;
+ s32 result;
+ struct ip2pr_ipoib_wait *ipoib_wait;
struct ib_path_record path_record;
tGID2PR_LOOKUP_FUNC func;
@@ -2020,8 +2027,8 @@
ipoib_wait->ca = gid_node->ca;
ipoib_wait->hw_port = gid_node->port;
ipoib_wait->pkey = pkey;
- memcpy(ipoib_wait->src_gid, src_gid, sizeof(tTS_IB_GID));
- memcpy(ipoib_wait->dst_gid, dst_gid, sizeof(tTS_IB_GID));
+ memcpy(ipoib_wait->src_gid, src_gid, sizeof(src_gid));
+ memcpy(ipoib_wait->dst_gid, dst_gid, sizeof(dst_gid));
result = _tsIp2prIpoibWaitListInsert(ipoib_wait);
if (0 > result) {
@@ -2052,9 +2059,10 @@
/* ========================================================================= */
/*..tsIp2prSrcGidCleanup -- Cleanup the Source GID List. */
-tINT32 tsIp2prSrcGidCleanup(void) {
- tIP2PR_SGID_ELEMENT sgid_elmt;
- tINT32 result;
+s32 tsIp2prSrcGidCleanup(void)
+{
+ struct ip2pr_sgid_element *sgid_elmt;
+ s32 result;
while (NULL != (sgid_elmt = _tsIp2prLinkRoot.src_gid_list)) {
@@ -2070,8 +2078,9 @@
/* ========================================================================= */
/*..tsIp2prSrcGidInit -- initialize the Source GID List. */
-tINT32 tsIp2prSrcGidInit(void) {
- tINT32 result = 0;
+s32 tsIp2prSrcGidInit(void)
+{
+ s32 result = 0;
int i, j;
struct ib_device *hca_device;
struct ib_device_properties dev_prop;
@@ -2079,7 +2088,7 @@
_tsIp2prLinkRoot.src_gid_cache = kmem_cache_create("Ip2prSrcGidList",
sizeof
- (tIP2PR_SGID_ELEMENT_STRUCT),
+ (struct ip2pr_sgid_element),
0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
@@ -2092,7 +2101,7 @@
/* if */
_tsIp2prLinkRoot.gid_pr_cache = kmem_cache_create("Ip2prGidPrList",
sizeof
- (tIP2PR_GID_PR_ELEMENT_STRUCT),
+ (struct ip2pr_gid_pr_element),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _tsIp2prLinkRoot.gid_pr_cache) {
@@ -2138,8 +2147,9 @@
/* ========================================================================= */
/*..tsIp2prLinkAddrInit -- initialize the advertisment caches. */
-tINT32 tsIp2prLinkAddrInit(void) {
- tINT32 result = 0;
+s32 tsIp2prLinkAddrInit(void)
+{
+ s32 result = 0;
struct ib_async_event_record evt_rec;
int i;
struct ib_device *hca_device;
@@ -2161,7 +2171,7 @@
*/
_tsIp2prLinkRoot.wait_cache = kmem_cache_create("Ip2prIpoibWait",
sizeof
- (tIP2PR_IPOIB_WAIT_STRUCT),
+ (struct ip2pr_ipoib_wait),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _tsIp2prLinkRoot.wait_cache) {
@@ -2175,7 +2185,7 @@
/* if */
_tsIp2prLinkRoot.path_cache = kmem_cache_create("Ip2prPathLookup",
sizeof
- (tIP2PR_PATH_ELEMENT_STRUCT),
+ (struct ip2pr_path_element),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _tsIp2prLinkRoot.path_cache) {
@@ -2188,7 +2198,8 @@
}
/* if */
_tsIp2prLinkRoot.user_req = kmem_cache_create("Ip2prUserReq",
- sizeof(tIP2PR_USER_REQ_STRUCT),
+ sizeof
+ (struct ip2pr_user_req),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (NULL == _tsIp2prLinkRoot.user_req) {
@@ -2286,10 +2297,11 @@
/* ========================================================================= */
/*..tsIp2prLinkAddrCleanup -- cleanup the advertisment caches. */
-tINT32 tsIp2prLinkAddrCleanup(void) {
- tIP2PR_PATH_ELEMENT path_elmt;
- tIP2PR_IPOIB_WAIT ipoib_wait;
- tUINT32 result;
+s32 tsIp2prLinkAddrCleanup(void)
+{
+ struct ip2pr_path_element *path_elmt;
+ struct ip2pr_ipoib_wait *ipoib_wait;
+ u32 result;
int i;
TS_CHECK_NULL(_tsIp2prLinkRoot.wait_cache, -EINVAL);
@@ -2346,26 +2358,23 @@
/* ========================================================================= */
/*..tsIp2prCbInternal -- Callback for IP to Path Record Lookup */
-static tINT32 _tsIp2prCbInternal
- (tIP2PR_PATH_LOOKUP_ID plid,
- tINT32 status,
- tUINT32 src_addr,
- tUINT32 dst_addr,
- tTS_IB_PORT hw_port,
- struct ib_device *ca, struct ib_path_record *path, tPTR usr_arg) {
- tIP2PR_USER_REQ ureq;
+static s32 _tsIp2prCbInternal(tIP2PR_PATH_LOOKUP_ID plid, s32 status,
+ u32 src_addr, u32 dst_addr, tTS_IB_PORT hw_port,
+ struct ib_device *ca, struct ib_path_record *path,
+ tPTR usr_arg)
+{
+ struct ip2pr_user_req *ureq;
if (usr_arg == NULL) {
TS_REPORT_WARN(MOD_IP2PR, "Called with a NULL usr_arg");
return -1;
}
- ureq = (tIP2PR_USER_REQ) usr_arg;
+ ureq = (struct ip2pr_user_req*) usr_arg;
ureq->status = status;
- if (0 == status) {
- memcpy(&ureq->path_record, path,
- sizeof(struct ib_path_record));
- }
+ if (0 == status)
+ memcpy(&ureq->path_record, path, sizeof(*path));
+
up(&ureq->sem); /* wake up sleeping process */
return (0);
@@ -2373,26 +2382,24 @@
/* ========================================================================= */
/*..tsIp2prCbInternal -- Callback for Gid to Path Record Lookup */
-static tINT32 _tsGid2prCbInternal
- (tIP2PR_PATH_LOOKUP_ID plid,
- tINT32 status,
- tTS_IB_PORT hw_port,
- struct ib_device *ca, struct ib_path_record *path, tPTR usr_arg) {
- tIP2PR_USER_REQ ureq;
+static s32 _tsGid2prCbInternal(tIP2PR_PATH_LOOKUP_ID plid, s32 status,
+ tTS_IB_PORT hw_port, struct ib_device *ca,
+ struct ib_path_record *path, tPTR usr_arg)
+{
+ struct ip2pr_user_req *ureq;
if (usr_arg == NULL) {
TS_REPORT_WARN(MOD_IP2PR, "Called with a NULL usr_arg");
return -1;
}
- ureq = (tIP2PR_USER_REQ) usr_arg;
+ ureq = (struct ip2pr_user_req *)usr_arg;
ureq->status = status;
ureq->port = hw_port;
ureq->device = ca;
- if (0 == status) {
- memcpy(&ureq->path_record, path,
- sizeof(struct ib_path_record));
- }
+ if (0 == status)
+ memcpy(&ureq->path_record, path, sizeof(*path));
+
up(&ureq->sem); /* wake up sleeping process */
return (0);
@@ -2400,17 +2407,17 @@
/* ========================================================================= */
/*..tsIp2prUserLookup -- Process a IP to Path Record lookup ioctl request */
-tINT32 _tsIp2prUserLookup(unsigned long arg) {
- tIP2PR_USER_REQ ureq;
+s32 _tsIp2prUserLookup(unsigned long arg)
+{
+ struct ip2pr_user_req *ureq;
tIP2PR_LOOKUP_PARAM_STRUCT param;
- tINT32 status;
+ s32 status;
tIP2PR_PATH_LOOKUP_ID plid;
if (0 == arg) {
return (-EINVAL);
}
- if (copy_from_user(¶m, (tIP2PR_LOOKUP_PARAM) arg,
- sizeof(tIP2PR_LOOKUP_PARAM_STRUCT))) {
+ if (copy_from_user(¶m, (tIP2PR_LOOKUP_PARAM) arg, sizeof(param))) {
return (-EFAULT);
}
if (NULL == param.path_record) {
@@ -2444,7 +2451,7 @@
}
copy_to_user(param.path_record, &ureq->path_record,
- sizeof(struct ib_path_record));
+ sizeof(*param.path_record));
kmem_cache_free(_tsIp2prLinkRoot.user_req, ureq);
return (0);
@@ -2452,11 +2459,12 @@
/* ========================================================================= */
/*..tsGid2prUserLookup -- Process a Gid to Path Record lookup ioctl request */
-tINT32 _tsGid2prUserLookup(unsigned long arg) {
- tIP2PR_USER_REQ ureq;
+s32 _tsGid2prUserLookup(unsigned long arg)
+{
+ struct ip2pr_user_req *ureq;
tGID2PR_LOOKUP_PARAM_STRUCT param;
tGID2PR_LOOKUP_PARAM upa;
- tINT32 status;
+ s32 status;
tIP2PR_PATH_LOOKUP_ID plid;
if (0 == arg) {
@@ -2464,7 +2472,7 @@
}
if (copy_from_user(¶m, (tGID2PR_LOOKUP_PARAM) arg,
- sizeof(tGID2PR_LOOKUP_PARAM_STRUCT))) {
+ sizeof(param))) {
return (-EFAULT);
}
@@ -2498,10 +2506,10 @@
}
upa = (tGID2PR_LOOKUP_PARAM) arg;
- copy_to_user(&upa->device, &ureq->device, sizeof (struct ib_device *));
- copy_to_user(&upa->port, &ureq->port, sizeof(tTS_IB_PORT));
+ copy_to_user(&upa->device, &ureq->device, sizeof(upa->device));
+ copy_to_user(&upa->port, &ureq->port, sizeof(upa->port));
copy_to_user(param.path_record, &ureq->path_record,
- sizeof(struct ib_path_record));
+ sizeof(*param.path_record));
kmem_cache_free(_tsIp2prLinkRoot.user_req, ureq);
return (0);
More information about the general
mailing list