diff options
Diffstat (limited to 'drivers/staging/lustre/include/linux/lnet')
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/api.h | 65 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 232 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lib-types.h | 137 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lnetst.h | 12 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/nidstr.h | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/socklnd.h | 14 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/types.h | 155 |
7 files changed, 312 insertions, 305 deletions
diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index cb0d6b481455..f4b6de2ec0ff 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -74,9 +74,8 @@ int LNetNIFini(void); * \see LNetMEAttach * @{ */ -int LNetGetId(unsigned int index, lnet_process_id_t *id); +int LNetGetId(unsigned int index, struct lnet_process_id *id); int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order); -void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle); /** @} lnet_addr */ @@ -94,22 +93,22 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle); * @{ */ int LNetMEAttach(unsigned int portal, - lnet_process_id_t match_id_in, + struct lnet_process_id match_id_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); + enum lnet_unlink unlink_in, + enum lnet_ins_pos pos_in, + struct lnet_handle_me *handle_out); -int LNetMEInsert(lnet_handle_me_t current_in, - lnet_process_id_t match_id_in, +int LNetMEInsert(struct lnet_handle_me current_in, + struct lnet_process_id match_id_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); + enum lnet_unlink unlink_in, + enum lnet_ins_pos position_in, + struct lnet_handle_me *handle_out); -int LNetMEUnlink(lnet_handle_me_t current_in); +int LNetMEUnlink(struct lnet_handle_me current_in); /** @} lnet_me */ /** \defgroup lnet_md Memory descriptors @@ -125,16 +124,16 @@ 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_unlink_t unlink_in, - lnet_handle_md_t *handle_out); +int LNetMDAttach(struct lnet_handle_me current_in, + struct lnet_md md_in, + enum lnet_unlink unlink_in, + struct lnet_handle_md *md_handle_out); -int LNetMDBind(lnet_md_t md_in, - lnet_unlink_t unlink_in, - lnet_handle_md_t *handle_out); +int LNetMDBind(struct lnet_md md_in, + enum lnet_unlink unlink_in, + struct lnet_handle_md *md_handle_out); -int LNetMDUnlink(lnet_handle_md_t md_in); +int LNetMDUnlink(struct lnet_handle_md md_in); /** @} lnet_md */ /** \defgroup lnet_eq Events and event queues @@ -147,9 +146,9 @@ int LNetMDUnlink(lnet_handle_md_t md_in); * associated with it. If an event handler exists, it will be run for each * event that is deposited into the EQ. * - * In addition to the lnet_handle_eq_t, the LNet API defines two types - * associated with events: The ::lnet_event_kind_t defines the kinds of events - * that can be stored in an EQ. The lnet_event_t defines a structure that + * In addition to the lnet_handle_eq, the LNet API defines two types + * associated with events: The ::lnet_event_kind defines the kinds of events + * that can be stored in an EQ. The lnet_event defines a structure that * holds the information about with an event. * * There are five functions for dealing with EQs: LNetEQAlloc() is used to @@ -162,14 +161,14 @@ int LNetMDUnlink(lnet_handle_md_t md_in); */ int LNetEQAlloc(unsigned int count_in, lnet_eq_handler_t handler, - lnet_handle_eq_t *handle_out); + struct lnet_handle_eq *handle_out); -int LNetEQFree(lnet_handle_eq_t eventq_in); +int LNetEQFree(struct lnet_handle_eq eventq_in); -int LNetEQPoll(lnet_handle_eq_t *eventqs_in, +int LNetEQPoll(struct lnet_handle_eq *eventqs_in, int neq_in, int timeout_ms, - lnet_event_t *event_out, + struct lnet_event *event_out, int *which_eq_out); /** @} lnet_eq */ @@ -180,17 +179,17 @@ int LNetEQPoll(lnet_handle_eq_t *eventqs_in, * @{ */ 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, + struct lnet_handle_md md_in, + enum lnet_ack_req ack_req_in, + struct lnet_process_id target_in, unsigned int portal_in, __u64 match_bits_in, unsigned int offset_in, __u64 hdr_data_in); int LNetGet(lnet_nid_t self, - lnet_handle_md_t md_in, - lnet_process_id_t target_in, + struct lnet_handle_md md_in, + struct lnet_process_id target_in, unsigned int portal_in, __u64 match_bits_in, unsigned int offset_in); @@ -203,7 +202,7 @@ int LNetGet(lnet_nid_t self, int LNetSetLazyPortal(int portal); int LNetClearLazyPortal(int portal); int LNetCtl(unsigned int cmd, void *arg); -void LNetDebugPeer(lnet_process_id_t id); +void LNetDebugPeer(struct lnet_process_id id); /** @} lnet_misc */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 3d19402ba728..8ae7423b4543 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -41,7 +41,7 @@ #include "lib-types.h" #include "lib-dlc.h" -extern lnet_t the_lnet; /* THE network */ +extern struct lnet the_lnet; /* THE network */ #if (BITS_PER_LONG == 32) /* 2 CPTs, allowing more CPTs might make us under memory pressure */ @@ -65,7 +65,7 @@ extern lnet_t the_lnet; /* THE network */ /** exclusive lock */ #define LNET_LOCK_EX CFS_PERCPT_LOCK_EX -static inline int lnet_is_route_alive(lnet_route_t *route) +static inline int lnet_is_route_alive(struct lnet_route *route) { /* gateway is down */ if (!route->lr_gateway->lp_alive) @@ -84,14 +84,14 @@ static inline int lnet_is_wire_handle_none(struct lnet_handle_wire *wh) wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE); } -static inline int lnet_md_exhausted(lnet_libmd_t *md) +static inline int lnet_md_exhausted(struct lnet_libmd *md) { return (!md->md_threshold || ((md->md_options & LNET_MD_MAX_SIZE) && md->md_offset + md->md_max_size > md->md_length)); } -static inline int lnet_md_unlinkable(lnet_libmd_t *md) +static inline int lnet_md_unlinkable(struct lnet_libmd *md) { /* * Should unlink md when its refcount is 0 and either: @@ -178,34 +178,34 @@ lnet_net_lock_current(void) #define MAX_PORTALS 64 -static inline lnet_eq_t * +static inline struct lnet_eq * lnet_eq_alloc(void) { - lnet_eq_t *eq; + struct lnet_eq *eq; LIBCFS_ALLOC(eq, sizeof(*eq)); return eq; } static inline void -lnet_eq_free(lnet_eq_t *eq) +lnet_eq_free(struct lnet_eq *eq) { LIBCFS_FREE(eq, sizeof(*eq)); } -static inline lnet_libmd_t * -lnet_md_alloc(lnet_md_t *umd) +static inline struct lnet_libmd * +lnet_md_alloc(struct lnet_md *umd) { - lnet_libmd_t *md; + struct lnet_libmd *md; unsigned int size; unsigned int niov; if (umd->options & LNET_MD_KIOV) { niov = umd->length; - size = offsetof(lnet_libmd_t, md_iov.kiov[niov]); + size = offsetof(struct lnet_libmd, md_iov.kiov[niov]); } else { niov = umd->options & LNET_MD_IOVEC ? umd->length : 1; - size = offsetof(lnet_libmd_t, md_iov.iov[niov]); + size = offsetof(struct lnet_libmd, md_iov.iov[niov]); } LIBCFS_ALLOC(md, size); @@ -221,37 +221,37 @@ lnet_md_alloc(lnet_md_t *umd) } static inline void -lnet_md_free(lnet_libmd_t *md) +lnet_md_free(struct lnet_libmd *md) { unsigned int size; if (md->md_options & LNET_MD_KIOV) - size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]); + size = offsetof(struct lnet_libmd, md_iov.kiov[md->md_niov]); else - size = offsetof(lnet_libmd_t, md_iov.iov[md->md_niov]); + size = offsetof(struct lnet_libmd, md_iov.iov[md->md_niov]); LIBCFS_FREE(md, size); } -static inline lnet_me_t * +static inline struct lnet_me * lnet_me_alloc(void) { - lnet_me_t *me; + struct lnet_me *me; LIBCFS_ALLOC(me, sizeof(*me)); return me; } static inline void -lnet_me_free(lnet_me_t *me) +lnet_me_free(struct lnet_me *me) { LIBCFS_FREE(me, sizeof(*me)); } -static inline lnet_msg_t * +static inline struct lnet_msg * lnet_msg_alloc(void) { - lnet_msg_t *msg; + struct lnet_msg *msg; LIBCFS_ALLOC(msg, sizeof(*msg)); @@ -260,57 +260,57 @@ lnet_msg_alloc(void) } static inline void -lnet_msg_free(lnet_msg_t *msg) +lnet_msg_free(struct lnet_msg *msg) { LASSERT(!msg->msg_onactivelist); LIBCFS_FREE(msg, sizeof(*msg)); } -lnet_libhandle_t *lnet_res_lh_lookup(struct lnet_res_container *rec, - __u64 cookie); +struct lnet_libhandle *lnet_res_lh_lookup(struct lnet_res_container *rec, + __u64 cookie); void lnet_res_lh_initialize(struct lnet_res_container *rec, - lnet_libhandle_t *lh); + struct lnet_libhandle *lh); static inline void -lnet_res_lh_invalidate(lnet_libhandle_t *lh) +lnet_res_lh_invalidate(struct lnet_libhandle *lh) { /* NB: cookie is still useful, don't reset it */ list_del(&lh->lh_hash_chain); } static inline void -lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq) +lnet_eq2handle(struct lnet_handle_eq *handle, struct lnet_eq *eq) { if (!eq) { - LNetInvalidateHandle(handle); + LNetInvalidateEQHandle(handle); return; } handle->cookie = eq->eq_lh.lh_cookie; } -static inline lnet_eq_t * -lnet_handle2eq(lnet_handle_eq_t *handle) +static inline struct lnet_eq * +lnet_handle2eq(struct lnet_handle_eq *handle) { - lnet_libhandle_t *lh; + struct lnet_libhandle *lh; lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie); if (!lh) return NULL; - return lh_entry(lh, lnet_eq_t, eq_lh); + return lh_entry(lh, struct lnet_eq, eq_lh); } static inline void -lnet_md2handle(lnet_handle_md_t *handle, lnet_libmd_t *md) +lnet_md2handle(struct lnet_handle_md *handle, struct lnet_libmd *md) { handle->cookie = md->md_lh.lh_cookie; } -static inline lnet_libmd_t * -lnet_handle2md(lnet_handle_md_t *handle) +static inline struct lnet_libmd * +lnet_handle2md(struct lnet_handle_md *handle) { /* ALWAYS called with resource lock held */ - lnet_libhandle_t *lh; + struct lnet_libhandle *lh; int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); @@ -319,14 +319,14 @@ lnet_handle2md(lnet_handle_md_t *handle) if (!lh) return NULL; - return lh_entry(lh, lnet_libmd_t, md_lh); + return lh_entry(lh, struct lnet_libmd, md_lh); } -static inline lnet_libmd_t * +static inline struct lnet_libmd * lnet_wire_handle2md(struct lnet_handle_wire *wh) { /* ALWAYS called with resource lock held */ - lnet_libhandle_t *lh; + struct lnet_libhandle *lh; int cpt; if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie) @@ -338,20 +338,20 @@ lnet_wire_handle2md(struct lnet_handle_wire *wh) if (!lh) return NULL; - return lh_entry(lh, lnet_libmd_t, md_lh); + return lh_entry(lh, struct lnet_libmd, md_lh); } static inline void -lnet_me2handle(lnet_handle_me_t *handle, lnet_me_t *me) +lnet_me2handle(struct lnet_handle_me *handle, struct lnet_me *me) { handle->cookie = me->me_lh.lh_cookie; } -static inline lnet_me_t * -lnet_handle2me(lnet_handle_me_t *handle) +static inline struct lnet_me * +lnet_handle2me(struct lnet_handle_me *handle) { /* ALWAYS called with resource lock held */ - lnet_libhandle_t *lh; + struct lnet_libhandle *lh; int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); @@ -360,20 +360,20 @@ lnet_handle2me(lnet_handle_me_t *handle) if (!lh) return NULL; - return lh_entry(lh, lnet_me_t, me_lh); + return lh_entry(lh, struct lnet_me, me_lh); } static inline void -lnet_peer_addref_locked(lnet_peer_t *lp) +lnet_peer_addref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); lp->lp_refcount++; } -void lnet_destroy_peer_locked(lnet_peer_t *lp); +void lnet_destroy_peer_locked(struct lnet_peer *lp); static inline void -lnet_peer_decref_locked(lnet_peer_t *lp) +lnet_peer_decref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); lp->lp_refcount--; @@ -382,13 +382,13 @@ lnet_peer_decref_locked(lnet_peer_t *lp) } static inline int -lnet_isrouter(lnet_peer_t *lp) +lnet_isrouter(struct lnet_peer *lp) { return lp->lp_rtr_refcount ? 1 : 0; } static inline void -lnet_ni_addref_locked(lnet_ni_t *ni, int cpt) +lnet_ni_addref_locked(struct lnet_ni *ni, int cpt) { LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER); LASSERT(*ni->ni_refs[cpt] >= 0); @@ -397,7 +397,7 @@ lnet_ni_addref_locked(lnet_ni_t *ni, int cpt) } static inline void -lnet_ni_addref(lnet_ni_t *ni) +lnet_ni_addref(struct lnet_ni *ni) { lnet_net_lock(0); lnet_ni_addref_locked(ni, 0); @@ -405,7 +405,7 @@ lnet_ni_addref(lnet_ni_t *ni) } static inline void -lnet_ni_decref_locked(lnet_ni_t *ni, int cpt) +lnet_ni_decref_locked(struct lnet_ni *ni, int cpt) { LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER); LASSERT(*ni->ni_refs[cpt] > 0); @@ -414,15 +414,15 @@ lnet_ni_decref_locked(lnet_ni_t *ni, int cpt) } static inline void -lnet_ni_decref(lnet_ni_t *ni) +lnet_ni_decref(struct lnet_ni *ni) { lnet_net_lock(0); lnet_ni_decref_locked(ni, 0); lnet_net_unlock(0); } -void lnet_ni_free(lnet_ni_t *ni); -lnet_ni_t * +void lnet_ni_free(struct lnet_ni *ni); +struct lnet_ni * lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist); static inline int @@ -439,22 +439,22 @@ lnet_net2rnethash(__u32 net) ((1U << the_lnet.ln_remote_nets_hbits) - 1)]; } -extern lnd_t the_lolnd; +extern struct lnet_lnd the_lolnd; extern int avoid_asym_router_failure; int lnet_cpt_of_nid_locked(lnet_nid_t nid); int lnet_cpt_of_nid(lnet_nid_t nid); -lnet_ni_t *lnet_nid2ni_locked(lnet_nid_t nid, int cpt); -lnet_ni_t *lnet_net2ni_locked(__u32 net, int cpt); -lnet_ni_t *lnet_net2ni(__u32 net); +struct lnet_ni *lnet_nid2ni_locked(lnet_nid_t nid, int cpt); +struct lnet_ni *lnet_net2ni_locked(__u32 net, int cpt); +struct lnet_ni *lnet_net2ni(__u32 net); extern int portal_rotor; int lnet_lib_init(void); void lnet_lib_exit(void); -int lnet_notify(lnet_ni_t *ni, lnet_nid_t peer, int alive, unsigned long when); -void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, +int lnet_notify(struct lnet_ni *ni, lnet_nid_t peer, int alive, unsigned long when); +void lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, unsigned long when); int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid, unsigned int priority); @@ -468,12 +468,12 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg); void lnet_router_debugfs_init(void); void lnet_router_debugfs_fini(void); int lnet_rtrpools_alloc(int im_a_router); -void lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages); +void lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages); int lnet_rtrpools_adjust(int tiny, int small, int large); int lnet_rtrpools_enable(void); void lnet_rtrpools_disable(void); void lnet_rtrpools_free(int keep_pools); -lnet_remotenet_t *lnet_find_net_locked(__u32 net); +struct lnet_remotenet *lnet_find_net_locked(__u32 net); int lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf); int lnet_dyn_del_ni(__u32 net); @@ -482,69 +482,70 @@ int lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason); int lnet_islocalnid(lnet_nid_t nid); int lnet_islocalnet(__u32 net); -void lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md, +void lnet_msg_attach_md(struct lnet_msg *msg, struct lnet_libmd *md, unsigned int offset, unsigned int mlen); -void lnet_msg_detach_md(lnet_msg_t *msg, int status); -void lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev); -void lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type); -void lnet_msg_commit(lnet_msg_t *msg, int cpt); -void lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status); - -void lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev); -void lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, - unsigned int offset, unsigned int len); -int lnet_send(lnet_nid_t nid, lnet_msg_t *msg, lnet_nid_t rtr_nid); -void lnet_return_tx_credits_locked(lnet_msg_t *msg); -void lnet_return_rx_credits_locked(lnet_msg_t *msg); -void lnet_schedule_blocked_locked(lnet_rtrbufpool_t *rbp); +void lnet_msg_detach_md(struct lnet_msg *msg, int status); +void lnet_build_unlink_event(struct lnet_libmd *md, struct lnet_event *ev); +void lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type); +void lnet_msg_commit(struct lnet_msg *msg, int cpt); +void lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status); + +void lnet_eq_enqueue_event(struct lnet_eq *eq, struct lnet_event *ev); +void lnet_prep_send(struct lnet_msg *msg, int type, + struct lnet_process_id target, unsigned int offset, + unsigned int len); +int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid); +void lnet_return_tx_credits_locked(struct lnet_msg *msg); +void lnet_return_rx_credits_locked(struct lnet_msg *msg); +void lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp); void lnet_drop_routed_msgs_locked(struct list_head *list, int cpt); /* portals functions */ /* portals attributes */ static inline int -lnet_ptl_is_lazy(lnet_portal_t *ptl) +lnet_ptl_is_lazy(struct lnet_portal *ptl) { return !!(ptl->ptl_options & LNET_PTL_LAZY); } static inline int -lnet_ptl_is_unique(lnet_portal_t *ptl) +lnet_ptl_is_unique(struct lnet_portal *ptl) { return !!(ptl->ptl_options & LNET_PTL_MATCH_UNIQUE); } static inline int -lnet_ptl_is_wildcard(lnet_portal_t *ptl) +lnet_ptl_is_wildcard(struct lnet_portal *ptl) { return !!(ptl->ptl_options & LNET_PTL_MATCH_WILDCARD); } static inline void -lnet_ptl_setopt(lnet_portal_t *ptl, int opt) +lnet_ptl_setopt(struct lnet_portal *ptl, int opt) { ptl->ptl_options |= opt; } static inline void -lnet_ptl_unsetopt(lnet_portal_t *ptl, int opt) +lnet_ptl_unsetopt(struct lnet_portal *ptl, int opt) { ptl->ptl_options &= ~opt; } /* match-table functions */ struct list_head *lnet_mt_match_head(struct lnet_match_table *mtable, - lnet_process_id_t id, __u64 mbits); + struct lnet_process_id id, __u64 mbits); struct lnet_match_table *lnet_mt_of_attach(unsigned int index, - lnet_process_id_t id, __u64 mbits, - __u64 ignore_bits, - lnet_ins_pos_t pos); + struct lnet_process_id id, + __u64 mbits, __u64 ignore_bits, + enum lnet_ins_pos pos); int lnet_mt_match_md(struct lnet_match_table *mtable, struct lnet_match_info *info, struct lnet_msg *msg); /* portals match/attach functions */ -void lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md, +void lnet_ptl_attach_md(struct lnet_me *me, struct lnet_libmd *md, struct list_head *matches, struct list_head *drops); -void lnet_ptl_detach_md(lnet_me_t *me, lnet_libmd_t *md); +void lnet_ptl_detach_md(struct lnet_me *me, struct lnet_libmd *md); int lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg); /* initialized and finalize portals */ @@ -552,23 +553,26 @@ int lnet_portals_create(void); void lnet_portals_destroy(void); /* message functions */ -int lnet_parse(lnet_ni_t *ni, struct lnet_hdr *hdr, +int lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t fromnid, void *private, int rdma_req); -int lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg); -int lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg); +int lnet_parse_local(struct lnet_ni *ni, struct lnet_msg *msg); +int lnet_parse_forward_locked(struct lnet_ni *ni, struct lnet_msg *msg); -void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, - unsigned int offset, unsigned int mlen, unsigned int rlen); -void lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, +void lnet_recv(struct lnet_ni *ni, void *private, struct lnet_msg *msg, + int delayed, unsigned int offset, unsigned int mlen, + unsigned int rlen); +void lnet_ni_recv(struct lnet_ni *ni, void *private, struct lnet_msg *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); +struct lnet_msg *lnet_create_reply_msg(struct lnet_ni *ni, + struct lnet_msg *get_msg); +void lnet_set_reply_msg_len(struct lnet_ni *ni, struct lnet_msg *msg, + unsigned int len); -void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc); +void lnet_finalize(struct lnet_ni *ni, struct lnet_msg *msg, int rc); -void lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, +void lnet_drop_message(struct lnet_ni *ni, int cpt, void *private, unsigned int nob); void lnet_drop_delayed_msg_list(struct list_head *head, char *reason); void lnet_recv_delayed_msg_list(struct list_head *head); @@ -600,7 +604,7 @@ bool lnet_delay_rule_match_locked(struct lnet_hdr *hdr, struct lnet_msg *msg); /** @} lnet_fault_simulation */ -void lnet_counters_get(lnet_counters_t *counters); +void lnet_counters_get(struct lnet_counters *counters); void lnet_counters_reset(void); unsigned int lnet_iov_nob(unsigned int niov, struct kvec *iov); @@ -608,25 +612,25 @@ int lnet_extract_iov(int dst_niov, struct kvec *dst, int src_niov, const struct kvec *src, unsigned int offset, unsigned int len); -unsigned int lnet_kiov_nob(unsigned int niov, lnet_kiov_t *iov); -int lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst, - int src_niov, const lnet_kiov_t *src, +unsigned int lnet_kiov_nob(unsigned int niov, struct bio_vec *iov); +int lnet_extract_kiov(int dst_niov, struct bio_vec *dst, + int src_niov, const struct bio_vec *src, unsigned int offset, unsigned int len); void lnet_copy_iov2iter(struct iov_iter *to, unsigned int nsiov, const struct kvec *siov, unsigned int soffset, unsigned int nob); void lnet_copy_kiov2iter(struct iov_iter *to, - unsigned int nkiov, const lnet_kiov_t *kiov, + unsigned int nkiov, const struct bio_vec *kiov, unsigned int kiovoffset, unsigned int nob); -void lnet_me_unlink(lnet_me_t *me); +void lnet_me_unlink(struct lnet_me *me); -void lnet_md_unlink(lnet_libmd_t *md); -void lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd); +void lnet_md_unlink(struct lnet_libmd *md); +void lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_md *umd); -void lnet_register_lnd(lnd_t *lnd); -void lnet_unregister_lnd(lnd_t *lnd); +void lnet_register_lnd(struct lnet_lnd *lnd); +void lnet_unregister_lnd(struct lnet_lnd *lnd); int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port); @@ -659,11 +663,11 @@ int lnet_sock_connect(struct socket **sockp, int *fatal, void libcfs_sock_release(struct socket *sock); int lnet_peers_start_down(void); -int lnet_peer_buffer_credits(lnet_ni_t *ni); +int lnet_peer_buffer_credits(struct lnet_ni *ni); int lnet_router_checker_start(void); void lnet_router_checker_stop(void); -void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net); +void lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net); void lnet_swap_pinginfo(struct lnet_ping_info *info); int lnet_parse_ip2nets(char **networksp, char *ip2nets); @@ -671,10 +675,10 @@ int lnet_parse_routes(char *route_str, int *im_a_router); int lnet_parse_networks(struct list_head *nilist, char *networks); int lnet_net_unique(__u32 net, struct list_head *nilist); -int lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt); -lnet_peer_t *lnet_find_peer_locked(struct lnet_peer_table *ptable, - lnet_nid_t nid); -void lnet_peer_tables_cleanup(lnet_ni_t *ni); +int lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt); +struct lnet_peer *lnet_find_peer_locked(struct lnet_peer_table *ptable, + lnet_nid_t nid); +void lnet_peer_tables_cleanup(struct lnet_ni *ni); void lnet_peer_tables_destroy(void); int lnet_peer_tables_create(void); void lnet_debug_peer(lnet_nid_t nid); @@ -686,7 +690,7 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob); static inline void -lnet_peer_set_alive(lnet_peer_t *lp) +lnet_peer_set_alive(struct lnet_peer *lp) { lp->lp_last_query = jiffies; lp->lp_last_alive = jiffies; diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 9850398bf29a..321752dfe58b 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -54,11 +54,11 @@ /* forward refs */ struct lnet_libmd; -typedef struct lnet_msg { +struct lnet_msg { struct list_head msg_activelist; struct list_head msg_list; /* Q for credits/MD */ - lnet_process_id_t msg_target; + struct lnet_process_id msg_target; /* where is it from, it's only for building event */ lnet_nid_t msg_from; __u32 msg_type; @@ -102,47 +102,47 @@ typedef struct lnet_msg { unsigned int msg_offset; unsigned int msg_niov; struct kvec *msg_iov; - lnet_kiov_t *msg_kiov; + struct bio_vec *msg_kiov; - lnet_event_t msg_ev; + struct lnet_event msg_ev; struct lnet_hdr msg_hdr; -} lnet_msg_t; +}; -typedef struct lnet_libhandle { +struct lnet_libhandle { struct list_head lh_hash_chain; __u64 lh_cookie; -} lnet_libhandle_t; +}; #define lh_entry(ptr, type, member) \ ((type *)((char *)(ptr) - (char *)(&((type *)0)->member))) -typedef struct lnet_eq { +struct lnet_eq { struct list_head eq_list; - lnet_libhandle_t eq_lh; - lnet_seq_t eq_enq_seq; - lnet_seq_t eq_deq_seq; + struct lnet_libhandle eq_lh; + unsigned long eq_enq_seq; + unsigned long eq_deq_seq; unsigned int eq_size; lnet_eq_handler_t eq_callback; - lnet_event_t *eq_events; + struct lnet_event *eq_events; int **eq_refs; /* percpt refcount for EQ */ -} lnet_eq_t; +}; -typedef struct lnet_me { +struct lnet_me { struct list_head me_list; - lnet_libhandle_t me_lh; - lnet_process_id_t me_match_id; + struct lnet_libhandle me_lh; + struct lnet_process_id me_match_id; unsigned int me_portal; unsigned int me_pos; /* hash offset in mt_hash */ __u64 me_match_bits; __u64 me_ignore_bits; - lnet_unlink_t me_unlink; + enum lnet_unlink me_unlink; struct lnet_libmd *me_md; -} lnet_me_t; +}; -typedef struct lnet_libmd { +struct lnet_libmd { struct list_head md_list; - lnet_libhandle_t md_lh; - lnet_me_t *md_me; + struct lnet_libhandle md_lh; + struct lnet_me *md_me; char *md_start; unsigned int md_offset; unsigned int md_length; @@ -152,24 +152,24 @@ typedef struct lnet_libmd { unsigned int md_options; unsigned int md_flags; void *md_user_ptr; - lnet_eq_t *md_eq; + struct lnet_eq *md_eq; unsigned int md_niov; /* # frags */ union { struct kvec iov[LNET_MAX_IOV]; - lnet_kiov_t kiov[LNET_MAX_IOV]; + struct bio_vec kiov[LNET_MAX_IOV]; } md_iov; -} lnet_libmd_t; +}; #define LNET_MD_FLAG_ZOMBIE (1 << 0) #define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) #define LNET_MD_FLAG_ABORTED (1 << 2) -typedef struct { +struct lnet_test_peer { /* info about peers we are trying to fail */ struct list_head tp_list; /* ln_test_peers */ lnet_nid_t tp_nid; /* matching nid */ unsigned int tp_threshold; /* # failures to simulate */ -} lnet_test_peer_t; +}; #define LNET_COOKIE_TYPE_MD 1 #define LNET_COOKIE_TYPE_ME 2 @@ -179,7 +179,7 @@ typedef struct { struct lnet_ni; /* forward ref */ -typedef struct lnet_lnd { +struct lnet_lnd { /* fields managed by portals */ struct list_head lnd_list; /* stash in the LND table */ int lnd_refcount; /* # active instances */ @@ -210,7 +210,8 @@ typedef struct lnet_lnd { * non-zero for immediate failure, otherwise complete later with * lnet_finalize() */ - int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg); + int (*lnd_send)(struct lnet_ni *ni, void *private, + struct lnet_msg *msg); /* * Start receiving 'mlen' bytes of payload data, skipping the following @@ -219,7 +220,7 @@ typedef struct lnet_lnd { * complete later with lnet_finalize(). This also gives back a receive * credit if the LND does flow control. */ - int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, + int (*lnd_recv)(struct lnet_ni *ni, void *private, struct lnet_msg *msg, int delayed, struct iov_iter *to, unsigned int rlen); /* @@ -231,7 +232,7 @@ typedef struct lnet_lnd { * release resources; lnd_recv() will not be called. */ int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, - lnet_msg_t *msg, void **new_privatep); + struct lnet_msg *msg, void **new_privatep); /* notification of peer health */ void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive); @@ -242,7 +243,7 @@ typedef struct lnet_lnd { /* accept a new connection */ int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock); -} lnd_t; +}; struct lnet_tx_queue { int tq_credits; /* # tx credits free */ @@ -251,7 +252,7 @@ struct lnet_tx_queue { struct list_head tq_delayed; /* delayed TXs */ }; -typedef struct lnet_ni { +struct lnet_ni { spinlock_t ni_lock; struct list_head ni_list; /* chain on ln_nis */ struct list_head ni_cptlist; /* chain on ln_nis_cpt */ @@ -266,7 +267,7 @@ typedef struct lnet_ni { __u32 *ni_cpts; /* bond NI on some CPTs */ lnet_nid_t ni_nid; /* interface's NID */ void *ni_data; /* instance-specific data */ - lnd_t *ni_lnd; /* procedural interface */ + struct lnet_lnd *ni_lnd; /* procedural interface */ struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */ int **ni_refs; /* percpt reference count */ time64_t ni_last_alive;/* when I was last alive */ @@ -277,7 +278,7 @@ typedef struct lnet_ni { char *ni_interfaces[LNET_MAX_INTERFACES]; /* original net namespace */ struct net *ni_net_ns; -} lnet_ni_t; +}; #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL @@ -296,15 +297,15 @@ typedef struct lnet_ni { /* router checker data, per router */ #define LNET_MAX_RTR_NIS 16 #define LNET_PINGINFO_SIZE offsetof(struct lnet_ping_info, pi_ni[LNET_MAX_RTR_NIS]) -typedef struct { +struct lnet_rc_data { /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */ struct list_head rcd_list; - lnet_handle_md_t rcd_mdh; /* ping buffer MD */ + struct lnet_handle_md rcd_mdh; /* ping buffer MD */ struct lnet_peer *rcd_gateway; /* reference to gateway */ struct lnet_ping_info *rcd_pinginfo; /* ping buffer */ -} lnet_rc_data_t; +}; -typedef struct lnet_peer { +struct lnet_peer { struct list_head lp_hashlist; /* chain on peer hash */ struct list_head lp_txq; /* messages blocking for tx credits */ @@ -335,17 +336,17 @@ typedef struct lnet_peer { unsigned long lp_last_alive; /* when I was last alive */ unsigned long lp_last_query; /* when lp_ni was queried last time */ - lnet_ni_t *lp_ni; /* interface peer is on */ + struct lnet_ni *lp_ni; /* interface peer is on */ lnet_nid_t lp_nid; /* peer's NID */ int lp_refcount; /* # refs */ int lp_cpt; /* CPT this peer attached on */ - /* # refs from lnet_route_t::lr_gateway */ + /* # refs from lnet_route::lr_gateway */ int lp_rtr_refcount; /* returned RC ping features */ unsigned int lp_ping_feats; struct list_head lp_routes; /* routers on this peer */ - lnet_rc_data_t *lp_rcd; /* router checker state */ -} lnet_peer_t; + struct lnet_rc_data *lp_rcd; /* router checker state */ +}; /* peer hash size */ #define LNET_PEER_HASH_BITS 9 @@ -363,39 +364,39 @@ struct lnet_peer_table { /* * peer aliveness is enabled only on routers for peers in a network where the - * lnet_ni_t::ni_peertimeout has been set to a positive value + * lnet_ni::ni_peertimeout has been set to a positive value */ #define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \ (lp)->lp_ni->ni_peertimeout > 0) -typedef struct { +struct lnet_route { struct list_head lr_list; /* chain on net */ struct list_head lr_gwlist; /* chain on gateway */ - lnet_peer_t *lr_gateway; /* router node */ + struct lnet_peer *lr_gateway; /* router node */ __u32 lr_net; /* remote network number */ int lr_seq; /* sequence for round-robin */ unsigned int lr_downis; /* number of down NIs */ __u32 lr_hops; /* how far I am */ unsigned int lr_priority; /* route priority */ -} lnet_route_t; +}; #define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7) #define LNET_REMOTE_NETS_HASH_MAX (1U << 16) #define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits) -typedef struct { +struct lnet_remotenet { struct list_head lrn_list; /* chain on ln_remote_nets_hash */ struct list_head lrn_routes; /* routes to me */ __u32 lrn_net; /* my net number */ -} lnet_remotenet_t; +}; /** lnet message has credit and can be submitted to lnd for send/receive */ #define LNET_CREDIT_OK 0 /** lnet message is waiting for credit */ #define LNET_CREDIT_WAIT 1 -typedef struct { +struct lnet_rtrbufpool { struct list_head rbp_bufs; /* my free buffer pool */ struct list_head rbp_msgs; /* messages blocking for a buffer */ @@ -407,13 +408,13 @@ typedef struct { int rbp_credits; /* # free buffers / blocked messages */ int rbp_mincredits; /* low water mark */ -} lnet_rtrbufpool_t; +}; -typedef struct { +struct lnet_rtrbuf { struct list_head rb_list; /* chain on rbp_bufs */ - lnet_rtrbufpool_t *rb_pool; /* owning pool */ - lnet_kiov_t rb_kiov[0]; /* the buffer space */ -} lnet_rtrbuf_t; + struct lnet_rtrbufpool *rb_pool; /* owning pool */ + struct bio_vec rb_kiov[0]; /* the buffer space */ +}; #define LNET_PEER_HASHSIZE 503 /* prime! */ @@ -424,7 +425,7 @@ typedef struct { /* # different router buffer pools */ #define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1) -enum { +enum lnet_match_flags { /* Didn't match anything */ LNET_MATCHMD_NONE = (1 << 0), /* Matched OK */ @@ -437,7 +438,7 @@ enum { LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP), }; -/* Options for lnet_portal_t::ptl_options */ +/* Options for lnet_portal::ptl_options */ #define LNET_PTL_LAZY (1 << 0) #define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */ #define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match, @@ -446,7 +447,7 @@ enum { /* parameter for matching operations (GET, PUT) */ struct lnet_match_info { __u64 mi_mbits; - lnet_process_id_t mi_id; + struct lnet_process_id mi_id; unsigned int mi_opc; unsigned int mi_portal; unsigned int mi_rlength; @@ -496,7 +497,7 @@ struct lnet_match_table { /* dispatch routed PUT message by hashing source NID for wildcard portals */ #define LNET_PTL_ROTOR_HASH_RT 3 -typedef struct lnet_portal { +struct lnet_portal { spinlock_t ptl_lock; unsigned int ptl_index; /* portal ID, reserved */ /* flags on this portal: lazy, unique... */ @@ -513,7 +514,7 @@ typedef struct lnet_portal { int ptl_mt_nmaps; /* array of active entries' cpu-partition-id */ int ptl_mt_maps[0]; -} lnet_portal_t; +}; #define LNET_LH_HASH_BITS 12 #define LNET_LH_HASH_SIZE (1ULL << LNET_LH_HASH_BITS) @@ -544,7 +545,7 @@ struct lnet_msg_container { #define LNET_RC_STATE_RUNNING 1 /* started up OK */ #define LNET_RC_STATE_STOPPING 2 /* telling thread to stop */ -typedef struct { +struct lnet { /* CPU partition table of LNet */ struct cfs_cpt_table *ln_cpt_table; /* number of CPTs in ln_cpt_table */ @@ -556,7 +557,7 @@ typedef struct { /* # portals */ int ln_nportals; /* the vector of portals */ - lnet_portal_t **ln_portals; + struct lnet_portal **ln_portals; /* percpt ME containers */ struct lnet_res_container **ln_me_containers; /* percpt MD container */ @@ -572,7 +573,7 @@ typedef struct { struct cfs_percpt_lock *ln_net_lock; /* percpt message containers for active/finalizing/freed message */ struct lnet_msg_container **ln_msg_containers; - lnet_counters_t **ln_counters; + struct lnet_counters **ln_counters; struct lnet_peer_table **ln_peer_tables; /* failure simulation */ struct list_head ln_test_peers; @@ -584,7 +585,7 @@ typedef struct { struct list_head ln_nis_cpt; /* dying LND instances */ struct list_head ln_nis_zombie; - lnet_ni_t *ln_loni; /* the loopback NI */ + struct lnet_ni *ln_loni; /* the loopback NI */ /* remote networks with routes to them */ struct list_head *ln_remote_nets_hash; @@ -595,16 +596,16 @@ typedef struct { /* validity stamp */ __u64 ln_routers_version; /* percpt router buffer pools */ - lnet_rtrbufpool_t **ln_rtrpools; + struct lnet_rtrbufpool **ln_rtrpools; - lnet_handle_md_t ln_ping_target_md; - lnet_handle_eq_t ln_ping_target_eq; + struct lnet_handle_md ln_ping_target_md; + struct lnet_handle_eq ln_ping_target_eq; struct lnet_ping_info *ln_ping_info; /* router checker startup/shutdown state */ int ln_rc_state; /* router checker's event queue */ - lnet_handle_eq_t ln_rc_eqh; + struct lnet_handle_eq ln_rc_eqh; /* rcd still pending on net */ struct list_head ln_rcd_deathrow; /* rcd ready for free */ @@ -647,6 +648,6 @@ typedef struct { */ wait_queue_head_t ln_rc_waitq; -} lnet_t; +}; #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index c81c246ef221..ea736f8d5231 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -86,7 +86,7 @@ struct lst_bid { #define LST_NODE_UNKNOWN 0x8 /* node not in session */ struct lstcon_node_ent { - lnet_process_id_t nde_id; /* id of node */ + struct lnet_process_id nde_id; /* id of node */ int nde_state; /* state of node */ }; /*** node entry, for list_group command */ @@ -126,7 +126,7 @@ struct lstcon_test_batch_ent { struct lstcon_rpc_ent { struct list_head rpe_link; /* link chain */ - lnet_process_id_t rpe_peer; /* peer's id */ + struct lnet_process_id rpe_peer; /* peer's id */ struct timeval rpe_stamp; /* time stamp of RPC */ int rpe_state; /* peer's state */ int rpe_rpc_errno; /* RPC errno */ @@ -287,7 +287,7 @@ struct lstio_debug_args { group|batch */ int lstio_dbg_count; /* IN: # of test nodes to debug */ - lnet_process_id_t __user *lstio_dbg_idsp; /* IN: id of test + struct lnet_process_id __user *lstio_dbg_idsp; /* IN: id of test nodes */ struct list_head __user *lstio_dbg_resultp; /* OUT: list head of result buffer */ @@ -317,7 +317,7 @@ struct lstio_group_update_args { int lstio_grp_nmlen; /* IN: name length */ char __user *lstio_grp_namep; /* IN: group name */ int lstio_grp_count; /* IN: # of nodes id */ - lnet_process_id_t __user *lstio_grp_idsp; /* IN: array of nodes */ + struct lnet_process_id __user *lstio_grp_idsp; /* IN: array of nodes */ struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ }; @@ -329,7 +329,7 @@ struct lstio_group_nodes_args { int lstio_grp_count; /* IN: # of nodes */ /** OUT: session features */ unsigned int __user *lstio_grp_featp; - lnet_process_id_t __user *lstio_grp_idsp; /* IN: nodes */ + struct lnet_process_id __user *lstio_grp_idsp; /* IN: nodes */ struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ }; @@ -429,7 +429,7 @@ struct lstio_stat_args { length */ char __user *lstio_sta_namep; /* IN: group name */ int lstio_sta_count; /* IN: # of pid */ - lnet_process_id_t __user *lstio_sta_idsp; /* IN: pid */ + struct lnet_process_id __user *lstio_sta_idsp; /* IN: pid */ struct list_head __user *lstio_sta_resultp; /* OUT: list head of result buffer */ }; diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 937fcc9e4a30..ecdd0db04d0a 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -88,7 +88,7 @@ static inline char *libcfs_nid2str(lnet_nid_t nid) __u32 libcfs_str2net(const char *str); lnet_nid_t libcfs_str2nid(const char *str); int libcfs_str2anynid(lnet_nid_t *nid, const char *str); -char *libcfs_id2str(lnet_process_id_t id); +char *libcfs_id2str(struct lnet_process_id id); void cfs_free_nidlist(struct list_head *list); int cfs_parse_nidlist(char *str, int len, struct list_head *list); int cfs_print_nidlist(char *buffer, int count, struct list_head *list); diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index acf20ce6f403..dd5bc0e46560 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -45,7 +45,7 @@ #define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN -typedef struct { +struct ksock_hello_msg { __u32 kshm_magic; /* magic number of socklnd message */ __u32 kshm_version; /* version of socklnd message */ lnet_nid_t kshm_src_nid; /* sender's nid */ @@ -57,9 +57,9 @@ typedef struct { __u32 kshm_ctype; /* connection type */ __u32 kshm_nips; /* # IP addrs */ __u32 kshm_ips[0]; /* IP addrs */ -} WIRE_ATTR ksock_hello_msg_t; +} WIRE_ATTR; -typedef struct { +struct ksock_lnet_msg { struct lnet_hdr ksnm_hdr; /* lnet hdr */ /* @@ -68,17 +68,17 @@ typedef struct { * structure definitions. lnet payload will be stored just after * the body of structure ksock_lnet_msg_t */ -} WIRE_ATTR ksock_lnet_msg_t; +} WIRE_ATTR; -typedef struct { +struct ksock_msg { __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 + struct ksock_lnet_msg lnetmsg; /* lnet message, it's empty if * it's NOOP */ } WIRE_ATTR ksm_u; -} WIRE_ATTR ksock_msg_t; +} WIRE_ATTR; #define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */ #define KSOCK_MSG_LNET 0xC1 /* lnet msg */ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 1c8de72e6d6b..1be9b7aa7326 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -64,7 +64,7 @@ typedef __u64 lnet_nid_t; /** * ID of a process in a node. Shortened as PID to distinguish from - * lnet_process_id_t, the global process ID. + * lnet_process_id, the global process ID. */ typedef __u32 lnet_pid_t; @@ -114,7 +114,7 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) #define WIRE_ATTR __packed -/* Packed version of lnet_process_id_t to transfer via network */ +/* Packed version of lnet_process_id to transfer via network */ struct lnet_process_id_packed { /* node id / process id */ lnet_nid_t nid; @@ -132,13 +132,13 @@ struct lnet_handle_wire { __u64 wh_object_cookie; } WIRE_ATTR; -typedef enum { +enum lnet_msg_type { LNET_MSG_ACK = 0, LNET_MSG_PUT, LNET_MSG_GET, LNET_MSG_REPLY, LNET_MSG_HELLO, -} lnet_msg_type_t; +}; /* * The variant fields of the portals message header are aligned on an 8 @@ -182,7 +182,7 @@ struct lnet_hdr { lnet_nid_t src_nid; lnet_pid_t dest_pid; lnet_pid_t src_pid; - __u32 type; /* lnet_msg_type_t */ + __u32 type; /* enum lnet_msg_type */ __u32 payload_length; /* payload data to follow */ /*<------__u64 aligned------->*/ union { @@ -250,7 +250,7 @@ struct lnet_ping_info { struct lnet_ni_status pi_ni[0]; } WIRE_ATTR; -typedef struct lnet_counters { +struct lnet_counters { __u32 msgs_alloc; __u32 msgs_max; __u32 errors; @@ -262,7 +262,7 @@ typedef struct lnet_counters { __u64 recv_length; __u64 route_length; __u64 drop_length; -} WIRE_ATTR lnet_counters_t; +} WIRE_ATTR; #define LNET_NI_STATUS_UP 0x15aac0de #define LNET_NI_STATUS_DOWN 0xdeadface @@ -272,61 +272,70 @@ typedef struct lnet_counters { /** * Objects maintained by the LNet are accessed through handles. Handle types - * have names of the form lnet_handle_xx_t, where xx is one of the two letter + * have names of the form lnet_handle_xx, where xx is one of the two letter * object type codes ('eq' for event queue, 'md' for memory descriptor, and - * 'me' for match entry). - * Each type of object is given a unique handle type to enhance type checking. - * The type lnet_handle_any_t can be used when a generic handle is needed. - * Every handle value can be converted into a value of type lnet_handle_any_t - * without loss of information. + * 'me' for match entry). Each type of object is given a unique handle type + * to enhance type checking. */ -typedef struct { - __u64 cookie; -} lnet_handle_any_t; - -typedef lnet_handle_any_t lnet_handle_eq_t; -typedef lnet_handle_any_t lnet_handle_md_t; -typedef lnet_handle_any_t lnet_handle_me_t; - #define LNET_WIRE_HANDLE_COOKIE_NONE (-1) +struct lnet_handle_eq { + u64 cookie; +}; + /** - * Invalidate handle \a h. + * Invalidate eq handle @h. */ -static inline void LNetInvalidateHandle(lnet_handle_any_t *h) +static inline void LNetInvalidateEQHandle(struct lnet_handle_eq *h) { h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE; } /** - * Compare handles \a h1 and \a h2. + * Check whether eq handle @h is invalid. * - * \return 1 if handles are equal, 0 if otherwise. + * @return 1 if handle is invalid, 0 if valid. */ -static inline int LNetHandleIsEqual(lnet_handle_any_t h1, lnet_handle_any_t h2) +static inline int LNetEQHandleIsInvalid(struct lnet_handle_eq h) { - return h1.cookie == h2.cookie; + return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie); } +struct lnet_handle_md { + u64 cookie; +}; + /** - * Check whether handle \a h is invalid. + * Invalidate md handle @h. + */ +static inline void LNetInvalidateMDHandle(struct lnet_handle_md *h) +{ + h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE; +} + +/** + * Check whether eq handle @h is invalid. * - * \return 1 if handle is invalid, 0 if valid. + * @return 1 if handle is invalid, 0 if valid. */ -static inline int LNetHandleIsInvalid(lnet_handle_any_t h) +static inline int LNetMDHandleIsInvalid(struct lnet_handle_md h) { - return h.cookie == LNET_WIRE_HANDLE_COOKIE_NONE; + return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie); } +struct lnet_handle_me { + u64 cookie; +}; + /** * Global process ID. */ -typedef struct { +struct lnet_process_id { /** node id */ lnet_nid_t nid; /** process id */ lnet_pid_t pid; -} lnet_process_id_t; +}; /** @} lnet_addr */ /** \addtogroup lnet_me @@ -337,26 +346,26 @@ typedef struct { * Specifies whether the match entry or memory descriptor should be unlinked * automatically (LNET_UNLINK) or not (LNET_RETAIN). */ -typedef enum { +enum lnet_unlink { LNET_RETAIN = 0, LNET_UNLINK -} lnet_unlink_t; +}; /** - * Values of the type lnet_ins_pos_t are used to control where a new match + * Values of the type lnet_ins_pos are used to control where a new match * entry is inserted. The value LNET_INS_BEFORE is used to insert the new * entry before the current entry or before the head of the list. The value * LNET_INS_AFTER is used to insert the new entry after the current entry * or after the last item in the list. */ -typedef enum { +enum lnet_ins_pos { /** insert ME before current position or head of the list */ LNET_INS_BEFORE, /** insert ME after current position or tail of the list */ LNET_INS_AFTER, /** attach ME at tail of local CPU partition ME list */ LNET_INS_LOCAL -} lnet_ins_pos_t; +}; /** @} lnet_me */ @@ -368,14 +377,14 @@ typedef enum { * Defines the visible parts of a memory descriptor. Values of this type * are used to initialize memory descriptors. */ -typedef struct { +struct lnet_md { /** * Specify the memory region associated with the memory descriptor. * If the options field has: * - LNET_MD_KIOV bit set: The start field points to the starting - * address of an array of lnet_kiov_t and the length field specifies + * address of an array of struct bio_vec and the length field specifies * the number of entries in the array. The length can't be bigger - * than LNET_MAX_IOV. The lnet_kiov_t is used to describe page-based + * than LNET_MAX_IOV. The struct bio_vec is used to describe page-based * fragments that are not necessarily mapped in virtual memory. * - LNET_MD_IOVEC bit set: The start field points to the starting * address of an array of struct iovec and the length field specifies @@ -435,7 +444,7 @@ typedef struct { * acknowledgment. Acknowledgments are never sent for GET operations. * The data sent in the REPLY serves as an implicit acknowledgment. * - LNET_MD_KIOV: The start and length fields specify an array of - * lnet_kiov_t. + * struct bio_vec. * - LNET_MD_IOVEC: The start and length fields specify an array of * struct iovec. * - LNET_MD_MAX_SIZE: The max_size field is valid. @@ -461,8 +470,8 @@ typedef struct { * by LNetInvalidateHandle()), operations performed on this memory * descriptor are not logged. */ - lnet_handle_eq_t eq_handle; -} lnet_md_t; + struct lnet_handle_eq eq_handle; +}; /* * Max Transfer Unit (minimum supported everywhere). @@ -476,35 +485,31 @@ typedef struct { #define LNET_MAX_IOV 256 /** - * Options for the MD structure. See lnet_md_t::options. + * Options for the MD structure. See lnet_md::options. */ #define LNET_MD_OP_PUT (1 << 0) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_OP_GET (1 << 1) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_MANAGE_REMOTE (1 << 2) /* unused (1 << 3) */ -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_TRUNCATE (1 << 4) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_ACK_DISABLE (1 << 5) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_IOVEC (1 << 6) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_MAX_SIZE (1 << 7) -/** See lnet_md_t::options. */ +/** See lnet_md::options. */ #define LNET_MD_KIOV (1 << 8) /* For compatibility with Cray Portals */ #define LNET_MD_PHYS 0 -/** Infinite threshold on MD operations. See lnet_md_t::threshold */ +/** Infinite threshold on MD operations. See lnet_md::threshold */ #define LNET_MD_THRESH_INF (-1) -/* NB lustre portals uses struct iovec internally! */ -typedef struct iovec lnet_md_iovec_t; - -typedef struct bio_vec lnet_kiov_t; /** @} lnet_md */ /** \addtogroup lnet_eq @@ -514,7 +519,7 @@ typedef struct bio_vec lnet_kiov_t; /** * Six types of events can be logged in an event queue. */ -typedef enum { +enum lnet_event_kind { /** An incoming GET operation has completed on the MD. */ LNET_EVENT_GET = 1, /** @@ -550,20 +555,18 @@ typedef enum { * \see LNetMDUnlink */ LNET_EVENT_UNLINK, -} lnet_event_kind_t; +}; -#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) +#define LNET_SEQ_GT(a, b) (((signed long)((a) - (b))) > 0) /** * Information about an event on a MD. */ -typedef struct { +struct lnet_event { /** The identifier (nid, pid) of the target. */ - lnet_process_id_t target; + struct lnet_process_id target; /** The identifier (nid, pid) of the initiator. */ - lnet_process_id_t initiator; + struct lnet_process_id 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 @@ -571,7 +574,7 @@ typedef struct { */ lnet_nid_t sender; /** Indicates the type of the event. */ - lnet_event_kind_t type; + enum lnet_event_kind type; /** The portal table index specified in the request */ unsigned int pt_index; /** A copy of the match bits specified in the request. */ @@ -582,7 +585,7 @@ typedef struct { * The length (in bytes) of the data that was manipulated by the * operation. For truncated operations, the manipulated length will be * the number of bytes specified by the MD (possibly with an offset, - * see lnet_md_t). For all other operations, the manipulated length + * see lnet_md). For all other operations, the manipulated length * will be the length of the requested operation, i.e. rlength. */ unsigned int mlength; @@ -590,13 +593,13 @@ typedef struct { * 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; + struct lnet_handle_md 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; + struct lnet_md md; /** * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT. * \see LNetPut @@ -618,15 +621,15 @@ typedef struct { * 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 + * \see lnet_md::options */ unsigned int offset; /** * The sequence number for this event. Sequence numbers are unique * to each event. */ - volatile lnet_seq_t sequence; -} lnet_event_t; + volatile unsigned long sequence; +}; /** * Event queue handler function type. @@ -638,7 +641,7 @@ typedef struct { * The handler must not block, must be reentrant, and must not call any LNet * API functions. It should return as quickly as possible. */ -typedef void (*lnet_eq_handler_t)(lnet_event_t *event); +typedef void (*lnet_eq_handler_t)(struct lnet_event *event); #define LNET_EQ_HANDLER_NONE NULL /** @} lnet_eq */ @@ -651,15 +654,15 @@ typedef void (*lnet_eq_handler_t)(lnet_event_t *event); * operation completes (i.e., when the data has been written to a MD of the * target process). * - * \see lnet_md_t::options for the discussion on LNET_MD_ACK_DISABLE by which + * \see lnet_md::options for the discussion on LNET_MD_ACK_DISABLE by which * acknowledgments can be disabled for a MD. */ -typedef enum { +enum lnet_ack_req { /** Request an acknowledgment */ LNET_ACK_REQ, /** Request that no acknowledgment should be generated. */ LNET_NOACK_REQ -} lnet_ack_req_t; +}; /** @} lnet_data */ /** @} lnet */ |