Commit 188acc61 authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging:lustre: LNet header code cleanup - indentation etc

Handle all the style issues reported by checkpatch.pl.
Remove general white spaces, spaces in function calls,
alignments etc.
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a9cf72b6
......@@ -95,16 +95,16 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle);
* @{ */
int LNetMEAttach(unsigned int portal,
lnet_process_id_t match_id_in,
__u64 match_bits_in,
__u64 ignore_bits_in,
__u64 match_bits_in,
__u64 ignore_bits_in,
lnet_unlink_t unlink_in,
lnet_ins_pos_t pos_in,
lnet_handle_me_t *handle_out);
int LNetMEInsert(lnet_handle_me_t current_in,
lnet_process_id_t match_id_in,
__u64 match_bits_in,
__u64 ignore_bits_in,
__u64 match_bits_in,
__u64 ignore_bits_in,
lnet_unlink_t unlink_in,
lnet_ins_pos_t position_in,
lnet_handle_me_t *handle_out);
......@@ -125,13 +125,13 @@ int LNetMEUnlink(lnet_handle_me_t current_in);
* associated with a MD: LNetMDUnlink().
* @{ */
int LNetMDAttach(lnet_handle_me_t current_in,
lnet_md_t md_in,
lnet_md_t md_in,
lnet_unlink_t unlink_in,
lnet_handle_md_t *handle_out);
int LNetMDBind(lnet_md_t md_in,
lnet_unlink_t unlink_in,
lnet_handle_md_t *handle_out);
int LNetMDBind(lnet_md_t md_in,
lnet_unlink_t unlink_in,
lnet_handle_md_t *handle_out);
int LNetMDUnlink(lnet_handle_md_t md_in);
/** @} lnet_md */
......@@ -171,10 +171,10 @@ int LNetEQWait(lnet_handle_eq_t eventq_in,
lnet_event_t *event_out);
int LNetEQPoll(lnet_handle_eq_t *eventqs_in,
int neq_in,
int timeout_ms,
int neq_in,
int timeout_ms,
lnet_event_t *event_out,
int *which_eq_out);
int *which_eq_out);
/** @} lnet_eq */
/** \defgroup lnet_data Data movement operations
......@@ -182,20 +182,20 @@ int LNetEQPoll(lnet_handle_eq_t *eventqs_in,
* The LNet API provides two data movement operations: LNetPut()
* and LNetGet().
* @{ */
int LNetPut(lnet_nid_t self,
int LNetPut(lnet_nid_t self,
lnet_handle_md_t md_in,
lnet_ack_req_t ack_req_in,
lnet_process_id_t target_in,
unsigned int portal_in,
__u64 match_bits_in,
__u64 match_bits_in,
unsigned int offset_in,
__u64 hdr_data_in);
__u64 hdr_data_in);
int LNetGet(lnet_nid_t self,
int LNetGet(lnet_nid_t self,
lnet_handle_md_t md_in,
lnet_process_id_t target_in,
unsigned int portal_in,
__u64 match_bits_in,
__u64 match_bits_in,
unsigned int offset_in);
/** @} lnet_data */
......
......@@ -44,29 +44,29 @@
#include "lnet.h"
#include "lib-types.h"
extern lnet_t the_lnet; /* THE network */
extern lnet_t the_lnet; /* THE network */
#if (BITS_PER_LONG == 32)
/* 2 CPTs, allowing more CPTs might make us under memory pressure */
# define LNET_CPT_MAX_BITS 1
#define LNET_CPT_MAX_BITS 1
#else /* 64-bit system */
/*
* 256 CPTs for thousands of CPUs, allowing more CPTs might make us
* under risk of consuming all lh_cookie.
*/
# define LNET_CPT_MAX_BITS 8
#define LNET_CPT_MAX_BITS 8
#endif /* BITS_PER_LONG == 32 */
/* max allowed CPT number */
#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS)
#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS)
#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number)
#define LNET_CPT_BITS (the_lnet.ln_cpt_bits)
#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1)
#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number)
#define LNET_CPT_BITS (the_lnet.ln_cpt_bits)
#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1)
/** exclusive lock */
#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh)
{
......@@ -163,7 +163,7 @@ lnet_net_lock_current(void)
#define lnet_ni_lock(ni) spin_lock(&(ni)->ni_lock)
#define lnet_ni_unlock(ni) spin_unlock(&(ni)->ni_lock)
#define MAX_PORTALS 64
#define MAX_PORTALS 64
static inline lnet_eq_t *
lnet_eq_alloc(void)
......@@ -184,8 +184,8 @@ static inline lnet_libmd_t *
lnet_md_alloc(lnet_md_t *umd)
{
lnet_libmd_t *md;
unsigned int size;
unsigned int niov;
unsigned int size;
unsigned int niov;
if ((umd->options & LNET_MD_KIOV) != 0) {
niov = umd->length;
......@@ -211,7 +211,7 @@ lnet_md_alloc(lnet_md_t *umd)
static inline void
lnet_md_free(lnet_libmd_t *md)
{
unsigned int size;
unsigned int size;
if ((md->md_options & LNET_MD_KIOV) != 0)
size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]);
......@@ -299,7 +299,7 @@ lnet_handle2md(lnet_handle_md_t *handle)
{
/* ALWAYS called with resource lock held */
lnet_libhandle_t *lh;
int cpt;
int cpt;
cpt = lnet_cpt_of_cookie(handle->cookie);
lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt],
......@@ -315,7 +315,7 @@ lnet_wire_handle2md(lnet_handle_wire_t *wh)
{
/* ALWAYS called with resource lock held */
lnet_libhandle_t *lh;
int cpt;
int cpt;
if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie)
return NULL;
......@@ -340,7 +340,7 @@ lnet_handle2me(lnet_handle_me_t *handle)
{
/* ALWAYS called with resource lock held */
lnet_libhandle_t *lh;
int cpt;
int cpt;
cpt = lnet_cpt_of_cookie(handle->cookie);
lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt],
......@@ -530,7 +530,9 @@ void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
unsigned int offset, unsigned int mlen, unsigned int rlen);
lnet_msg_t *lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *get_msg);
void lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *msg, unsigned int len);
void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc);
void lnet_drop_delayed_msg_list(struct list_head *head, char *reason);
void lnet_recv_delayed_msg_list(struct list_head *head);
......@@ -679,12 +681,12 @@ void lnet_peer_tables_destroy(void);
int lnet_peer_tables_create(void);
void lnet_debug_peer(lnet_nid_t nid);
static inline void lnet_peer_set_alive(lnet_peer_t *lp)
static inline void
lnet_peer_set_alive(lnet_peer_t *lp)
{
lp->lp_last_alive = lp->lp_last_query = get_seconds();
if (!lp->lp_alive)
lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
}
#endif
......@@ -42,29 +42,29 @@
#define SOCKLND_CONN_NONE (-1)
#define SOCKLND_CONN_ANY 0
#define SOCKLND_CONN_CONTROL 1
#define SOCKLND_CONN_BULK_IN 2
#define SOCKLND_CONN_BULK_OUT 3
#define SOCKLND_CONN_NTYPES 4
#define SOCKLND_CONN_CONTROL 1
#define SOCKLND_CONN_BULK_IN 2
#define SOCKLND_CONN_BULK_OUT 3
#define SOCKLND_CONN_NTYPES 4
#define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN
typedef struct {
__u32 kshm_magic; /* magic number of socklnd message */
__u32 kshm_version; /* version of socklnd message */
lnet_nid_t kshm_src_nid; /* sender's nid */
lnet_nid_t kshm_dst_nid; /* destination nid */
lnet_pid_t kshm_src_pid; /* sender's pid */
lnet_pid_t kshm_dst_pid; /* destination pid */
__u64 kshm_src_incarnation; /* sender's incarnation */
__u64 kshm_dst_incarnation; /* destination's incarnation */
__u32 kshm_ctype; /* connection type */
__u32 kshm_nips; /* # IP addrs */
__u32 kshm_ips[0]; /* IP addrs */
__u32 kshm_magic; /* magic number of socklnd message */
__u32 kshm_version; /* version of socklnd message */
lnet_nid_t kshm_src_nid; /* sender's nid */
lnet_nid_t kshm_dst_nid; /* destination nid */
lnet_pid_t kshm_src_pid; /* sender's pid */
lnet_pid_t kshm_dst_pid; /* destination pid */
__u64 kshm_src_incarnation; /* sender's incarnation */
__u64 kshm_dst_incarnation; /* destination's incarnation */
__u32 kshm_ctype; /* connection type */
__u32 kshm_nips; /* # IP addrs */
__u32 kshm_ips[0]; /* IP addrs */
} WIRE_ATTR ksock_hello_msg_t;
typedef struct {
lnet_hdr_t ksnm_hdr; /* lnet hdr */
lnet_hdr_t ksnm_hdr; /* lnet hdr */
/*
* ksnm_payload is removed because of winnt compiler's limitation:
......@@ -75,28 +75,29 @@ typedef struct {
} WIRE_ATTR ksock_lnet_msg_t;
typedef struct {
__u32 ksm_type; /* type of socklnd message */
__u32 ksm_csum; /* checksum if != 0 */
__u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
__u32 ksm_type; /* type of socklnd message */
__u32 ksm_csum; /* checksum if != 0 */
__u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
union {
ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */
ksock_lnet_msg_t lnetmsg;/* lnet message, it's empty if
* it's NOOP */
} WIRE_ATTR ksm_u;
} WIRE_ATTR ksock_msg_t;
static inline void
socklnd_init_msg(ksock_msg_t *msg, int type)
{
msg->ksm_csum = 0;
msg->ksm_type = type;
msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0;
msg->ksm_csum = 0;
msg->ksm_type = type;
msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0;
}
#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */
#define KSOCK_MSG_LNET 0xc1 /* lnet msg */
#define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */
#define KSOCK_MSG_LNET 0xC1 /* lnet msg */
/* We need to know this number to parse hello msg from ksocklnd in
* other LND (usocklnd, for example) */
#define KSOCK_PROTO_V2 2
#define KSOCK_PROTO_V3 3
#define KSOCK_PROTO_V2 2
#define KSOCK_PROTO_V3 3
#endif
......@@ -48,7 +48,7 @@
/** Portal reserved for LNet's own use.
* \see lustre/include/lustre/lustre_idl.h for Lustre portal assignments.
*/
#define LNET_RESERVED_PORTAL 0
#define LNET_RESERVED_PORTAL 0
/**
* Address of an end-point in an LNet network.
......@@ -68,15 +68,15 @@ typedef __u64 lnet_nid_t;
typedef __u32 lnet_pid_t;
/** wildcard NID that matches any end-point address */
#define LNET_NID_ANY ((lnet_nid_t) -1)
#define LNET_NID_ANY ((lnet_nid_t) -1)
/** wildcard PID that matches any lnet_pid_t */
#define LNET_PID_ANY ((lnet_pid_t) -1)
#define LNET_PID_ANY ((lnet_pid_t) -1)
#define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */
#define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */
#define LNET_PID_LUSTRE 12345
#define LNET_TIME_FOREVER (-1)
#define LNET_TIME_FOREVER (-1)
/* how an LNET NID encodes net:address */
/** extract the address part of an lnet_nid_t */
......@@ -380,8 +380,8 @@ typedef struct {
* one must start on page boundary, and all but the last must end on
* page boundary.
*/
void *start;
unsigned int length;
void *start;
unsigned int length;
/**
* Specifies the maximum number of operations that can be performed
* on the memory descriptor. An operation is any action that could
......@@ -392,7 +392,7 @@ typedef struct {
* there is no bound on the number of operations that may be applied
* to a MD.
*/
int threshold;
int threshold;
/**
* Specifies the largest incoming request that the memory descriptor
* should respond to. When the unused portion of a MD (length -
......@@ -400,7 +400,7 @@ typedef struct {
* does not respond to further operations. This value is only used
* if the LNET_MD_MAX_SIZE option is set.
*/
int max_size;
int max_size;
/**
* Specifies the behavior of the memory descriptor. A bitwise OR
* of the following values can be used:
......@@ -437,14 +437,14 @@ typedef struct {
* region (i.e. sum of all fragment lengths) must not be less than
* \a max_size.
*/
unsigned int options;
unsigned int options;
/**
* A user-specified value that is associated with the memory
* descriptor. The value does not need to be a pointer, but must fit
* in the space used by a pointer. This value is recorded in events
* associated with operations on this MD.
*/
void *user_ptr;
void *user_ptr;
/**
* A handle for the event queue used to log the operations performed on
* the memory region. If this argument is a NULL handle (i.e. nullified
......@@ -461,33 +461,33 @@ typedef struct {
#define LNET_MTU (1 << LNET_MTU_BITS)
/** limit on the number of fragments in discontiguous MDs */
#define LNET_MAX_IOV 256
#define LNET_MAX_IOV 256
/**
* Options for the MD structure. See lnet_md_t::options.
*/
#define LNET_MD_OP_PUT (1 << 0)
#define LNET_MD_OP_PUT (1 << 0)
/** See lnet_md_t::options. */
#define LNET_MD_OP_GET (1 << 1)
#define LNET_MD_OP_GET (1 << 1)
/** See lnet_md_t::options. */
#define LNET_MD_MANAGE_REMOTE (1 << 2)
/* unused (1 << 3) */
/* unused (1 << 3) */
/** See lnet_md_t::options. */
#define LNET_MD_TRUNCATE (1 << 4)
#define LNET_MD_TRUNCATE (1 << 4)
/** See lnet_md_t::options. */
#define LNET_MD_ACK_DISABLE (1 << 5)
#define LNET_MD_ACK_DISABLE (1 << 5)
/** See lnet_md_t::options. */
#define LNET_MD_IOVEC (1 << 6)
/** See lnet_md_t::options. */
#define LNET_MD_MAX_SIZE (1 << 7)
#define LNET_MD_MAX_SIZE (1 << 7)
/** See lnet_md_t::options. */
#define LNET_MD_KIOV (1 << 8)
#define LNET_MD_KIOV (1 << 8)
/* For compatibility with Cray Portals */
#define LNET_MD_PHYS 0
#define LNET_MD_PHYS 0
/** Infinite threshold on MD operations. See lnet_md_t::threshold */
#define LNET_MD_THRESH_INF (-1)
#define LNET_MD_THRESH_INF (-1)
/* NB lustre portals uses struct iovec internally! */
typedef struct iovec lnet_md_iovec_t;
......@@ -497,15 +497,15 @@ typedef struct iovec lnet_md_iovec_t;
*/
typedef struct {
/** Pointer to the page where the fragment resides */
struct page *kiov_page;
struct page *kiov_page;
/** Length in bytes of the fragment */
unsigned int kiov_len;
unsigned int kiov_len;
/**
* Starting offset of the fragment within the page. Note that the
* end of the fragment must not pass the end of the page; i.e.,
* kiov_len + kiov_offset <= PAGE_CACHE_SIZE.
*/
unsigned int kiov_offset;
unsigned int kiov_offset;
} lnet_kiov_t;
/** @} lnet_md */
......@@ -553,7 +553,7 @@ typedef enum {
LNET_EVENT_UNLINK,
} lnet_event_kind_t;
#define LNET_SEQ_BASETYPE long
#define LNET_SEQ_BASETYPE long
typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
#define LNET_SEQ_GT(a, b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
......@@ -562,23 +562,23 @@ typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
*/
typedef struct {
/** The identifier (nid, pid) of the target. */
lnet_process_id_t target;
lnet_process_id_t target;
/** The identifier (nid, pid) of the initiator. */
lnet_process_id_t initiator;
lnet_process_id_t initiator;
/**
* The NID of the immediate sender. If the request has been forwarded
* by routers, this is the NID of the last hop; otherwise it's the
* same as the initiator.
*/
lnet_nid_t sender;
lnet_nid_t sender;
/** Indicates the type of the event. */
lnet_event_kind_t type;
lnet_event_kind_t type;
/** The portal table index specified in the request */
unsigned int pt_index;
unsigned int pt_index;
/** A copy of the match bits specified in the request. */
__u64 match_bits;
__u64 match_bits;
/** The length (in bytes) specified in the request. */
unsigned int rlength;
unsigned int rlength;
/**
* The length (in bytes) of the data that was manipulated by the
* operation. For truncated operations, the manipulated length will be
......@@ -586,47 +586,47 @@ typedef struct {
* see lnet_md_t). For all other operations, the manipulated length
* will be the length of the requested operation, i.e. rlength.
*/
unsigned int mlength;
unsigned int mlength;
/**
* The handle to the MD associated with the event. The handle may be
* invalid if the MD has been unlinked.
*/
lnet_handle_md_t md_handle;
lnet_handle_md_t md_handle;
/**
* A snapshot of the state of the MD immediately after the event has
* been processed. In particular, the threshold field in md will
* reflect the value of the threshold after the operation occurred.
*/
lnet_md_t md;
lnet_md_t md;
/**
* 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT.
* \see LNetPut
*/
__u64 hdr_data;
__u64 hdr_data;
/**
* Indicates the completion status of the operation. It's 0 for
* successful operations, otherwise it's an error code.
*/
int status;
int status;
/**
* Indicates whether the MD has been unlinked. Note that:
* - An event with unlinked set is the last event on the MD.
* - This field is also set for an explicit LNET_EVENT_UNLINK event.
* \see LNetMDUnlink
*/
int unlinked;
int unlinked;
/**
* The displacement (in bytes) into the memory region that the
* operation used. The offset can be determined by the operation for
* a remote managed MD or by the local MD.
* \see lnet_md_t::options
*/
unsigned int offset;
unsigned int offset;
/**
* The sequence number for this event. Sequence numbers are unique
* to each event.
*/
volatile lnet_seq_t sequence;
volatile lnet_seq_t sequence;
} lnet_event_t;
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment