diff options
Diffstat (limited to 'drivers/staging/lustre/include/linux/lnet')
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/api.h | 23 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lib-dlc.h | 122 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 129 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lib-types.h | 103 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lnetctl.h | 104 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/lnetst.h | 104 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/nidstr.h | 9 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/socklnd.h | 9 | ||||
-rw-r--r-- | drivers/staging/lustre/include/linux/lnet/types.h | 51 |
9 files changed, 505 insertions, 149 deletions
diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index 75285fde1..cb0d6b481 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -48,7 +48,8 @@ /** \defgroup lnet_init_fini Initialization and cleanup * The LNet must be properly initialized before any LNet calls can be made. - * @{ */ + * @{ + */ int LNetNIInit(lnet_pid_t requested_pid); int LNetNIFini(void); /** @} lnet_init_fini */ @@ -71,7 +72,8 @@ int LNetNIFini(void); * it's an entry in the portals table of a process. * * \see LNetMEAttach - * @{ */ + * @{ + */ int LNetGetId(unsigned int index, lnet_process_id_t *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); @@ -89,7 +91,8 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle); * incoming requests based on process ID or the match bits provided in the * request. MEs can be dynamically inserted into a match list by LNetMEAttach() * and LNetMEInsert(), and removed from its list by LNetMEUnlink(). - * @{ */ + * @{ + */ int LNetMEAttach(unsigned int portal, lnet_process_id_t match_id_in, __u64 match_bits_in, @@ -120,7 +123,8 @@ int LNetMEUnlink(lnet_handle_me_t current_in); * The LNet API provides two operations to create MDs: LNetMDAttach() * and LNetMDBind(); one operation to unlink and release the resources * associated with a MD: LNetMDUnlink(). - * @{ */ + * @{ + */ int LNetMDAttach(lnet_handle_me_t current_in, lnet_md_t md_in, lnet_unlink_t unlink_in, @@ -154,7 +158,8 @@ int LNetMDUnlink(lnet_handle_md_t md_in); * event from an EQ, and LNetEQWait() can be used to block a process until * an EQ has at least one event. LNetEQPoll() can be used to test or wait * on multiple EQs. - * @{ */ + * @{ + */ int LNetEQAlloc(unsigned int count_in, lnet_eq_handler_t handler, lnet_handle_eq_t *handle_out); @@ -172,7 +177,8 @@ 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, lnet_handle_md_t md_in, lnet_ack_req_t ack_req_in, @@ -192,11 +198,12 @@ int LNetGet(lnet_nid_t self, /** \defgroup lnet_misc Miscellaneous operations. * Miscellaneous operations. - * @{ */ - + * @{ + */ int LNetSetLazyPortal(int portal); int LNetClearLazyPortal(int portal); int LNetCtl(unsigned int cmd, void *arg); +void LNetDebugPeer(lnet_process_id_t id); /** @} lnet_misc */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-dlc.h b/drivers/staging/lustre/include/linux/lnet/lib-dlc.h new file mode 100644 index 000000000..84a19e96e --- /dev/null +++ b/drivers/staging/lustre/include/linux/lnet/lib-dlc.h @@ -0,0 +1,122 @@ +/* + * LGPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + * + * LGPL HEADER END + * + */ +/* + * Copyright (c) 2014, Intel Corporation. + */ +/* + * Author: Amir Shehata <amir.shehata@intel.com> + */ + +#ifndef LNET_DLC_H +#define LNET_DLC_H + +#include "../libcfs/libcfs_ioctl.h" +#include "types.h" + +#define MAX_NUM_SHOW_ENTRIES 32 +#define LNET_MAX_STR_LEN 128 +#define LNET_MAX_SHOW_NUM_CPT 128 +#define LNET_UNDEFINED_HOPS ((__u32) -1) + +struct lnet_ioctl_net_config { + char ni_interfaces[LNET_MAX_INTERFACES][LNET_MAX_STR_LEN]; + __u32 ni_status; + __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT]; +}; + +#define LNET_TINY_BUF_IDX 0 +#define LNET_SMALL_BUF_IDX 1 +#define LNET_LARGE_BUF_IDX 2 + +/* # different router buffer pools */ +#define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1) + +struct lnet_ioctl_pool_cfg { + struct { + __u32 pl_npages; + __u32 pl_nbuffers; + __u32 pl_credits; + __u32 pl_mincredits; + } pl_pools[LNET_NRBPOOLS]; + __u32 pl_routing; +}; + +struct lnet_ioctl_config_data { + struct libcfs_ioctl_hdr cfg_hdr; + + __u32 cfg_net; + __u32 cfg_count; + __u64 cfg_nid; + __u32 cfg_ncpts; + + union { + struct { + __u32 rtr_hop; + __u32 rtr_priority; + __u32 rtr_flags; + } cfg_route; + struct { + char net_intf[LNET_MAX_STR_LEN]; + __s32 net_peer_timeout; + __s32 net_peer_tx_credits; + __s32 net_peer_rtr_credits; + __s32 net_max_tx_credits; + __u32 net_cksum_algo; + __u32 net_pad; + } cfg_net; + struct { + __u32 buf_enable; + __s32 buf_tiny; + __s32 buf_small; + __s32 buf_large; + } cfg_buffers; + } cfg_config_u; + + char cfg_bulk[0]; +}; + +struct lnet_ioctl_peer { + struct libcfs_ioctl_hdr pr_hdr; + __u32 pr_count; + __u32 pr_pad; + __u64 pr_nid; + + union { + struct { + char cr_aliveness[LNET_MAX_STR_LEN]; + __u32 cr_refcount; + __u32 cr_ni_peer_tx_credits; + __u32 cr_peer_tx_credits; + __u32 cr_peer_rtr_credits; + __u32 cr_peer_min_rtr_credits; + __u32 cr_peer_tx_qnob; + __u32 cr_ncpt; + } pr_peer_credits; + } pr_lnd_u; +}; + +struct lnet_ioctl_lnet_stats { + struct libcfs_ioctl_hdr st_hdr; + struct lnet_counters st_cntrs; +}; + +#endif /* LNET_DLC_H */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index b67a6607b..dfc0208dc 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -39,6 +39,7 @@ #include "api.h" #include "lnet.h" #include "lib-types.h" +#include "lib-dlc.h" extern lnet_t the_lnet; /* THE network */ @@ -64,6 +65,19 @@ 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) +{ + /* gateway is down */ + if (!route->lr_gateway->lp_alive) + return 0; + /* no NI status, assume it's alive */ + if ((route->lr_gateway->lp_ping_feats & + LNET_PING_FEAT_NI_STATUS) == 0) + return 1; + /* has NI status, check # down NIs */ + return route->lr_downis == 0; +} + static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh) { return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE && @@ -72,25 +86,26 @@ static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh) static inline int lnet_md_exhausted(lnet_libmd_t *md) { - return (md->md_threshold == 0 || - ((md->md_options & LNET_MD_MAX_SIZE) != 0 && + 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) { - /* Should unlink md when its refcount is 0 and either: + /* + * Should unlink md when its refcount is 0 and either: * - md has been flagged for deletion (by auto unlink or * LNetM[DE]Unlink, in the latter case md may not be exhausted). * - auto unlink is on and md is exhausted. */ - if (md->md_refcount != 0) + if (md->md_refcount) return 0; - if ((md->md_flags & LNET_MD_FLAG_ZOMBIE) != 0) + if (md->md_flags & LNET_MD_FLAG_ZOMBIE) return 1; - return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) != 0 && + return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) && lnet_md_exhausted(md)); } @@ -102,8 +117,10 @@ lnet_cpt_of_cookie(__u64 cookie) { unsigned int cpt = (cookie >> LNET_COOKIE_TYPE_BITS) & LNET_CPT_MASK; - /* LNET_CPT_NUMBER doesn't have to be power2, which means we can - * get illegal cpt from it's invalid cookie */ + /* + * LNET_CPT_NUMBER doesn't have to be power2, which means we can + * get illegal cpt from it's invalid cookie + */ return cpt < LNET_CPT_NUMBER ? cpt : cpt % LNET_CPT_NUMBER; } @@ -183,18 +200,17 @@ lnet_md_alloc(lnet_md_t *umd) unsigned int size; unsigned int niov; - if ((umd->options & LNET_MD_KIOV) != 0) { + if (umd->options & LNET_MD_KIOV) { niov = umd->length; size = offsetof(lnet_libmd_t, md_iov.kiov[niov]); } else { - niov = ((umd->options & LNET_MD_IOVEC) != 0) ? - umd->length : 1; + niov = umd->options & LNET_MD_IOVEC ? umd->length : 1; size = offsetof(lnet_libmd_t, md_iov.iov[niov]); } LIBCFS_ALLOC(md, size); - if (md != NULL) { + if (md) { /* Set here in case of early free */ md->md_options = umd->options; md->md_niov = niov; @@ -209,7 +225,7 @@ lnet_md_free(lnet_libmd_t *md) { unsigned int size; - if ((md->md_options & LNET_MD_KIOV) != 0) + if (md->md_options & LNET_MD_KIOV) size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]); else size = offsetof(lnet_libmd_t, md_iov.iov[md->md_niov]); @@ -264,7 +280,7 @@ lnet_res_lh_invalidate(lnet_libhandle_t *lh) static inline void lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq) { - if (eq == NULL) { + if (!eq) { LNetInvalidateHandle(handle); return; } @@ -278,7 +294,7 @@ lnet_handle2eq(lnet_handle_eq_t *handle) lnet_libhandle_t *lh; lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie); - if (lh == NULL) + if (!lh) return NULL; return lh_entry(lh, lnet_eq_t, eq_lh); @@ -300,7 +316,7 @@ lnet_handle2md(lnet_handle_md_t *handle) cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt], handle->cookie); - if (lh == NULL) + if (!lh) return NULL; return lh_entry(lh, lnet_libmd_t, md_lh); @@ -319,7 +335,7 @@ lnet_wire_handle2md(lnet_handle_wire_t *wh) cpt = lnet_cpt_of_cookie(wh->wh_object_cookie); lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt], wh->wh_object_cookie); - if (lh == NULL) + if (!lh) return NULL; return lh_entry(lh, lnet_libmd_t, md_lh); @@ -341,7 +357,7 @@ lnet_handle2me(lnet_handle_me_t *handle) cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt], handle->cookie); - if (lh == NULL) + if (!lh) return NULL; return lh_entry(lh, lnet_me_t, me_lh); @@ -361,14 +377,14 @@ lnet_peer_decref_locked(lnet_peer_t *lp) { LASSERT(lp->lp_refcount > 0); lp->lp_refcount--; - if (lp->lp_refcount == 0) + if (!lp->lp_refcount) lnet_destroy_peer_locked(lp); } static inline int lnet_isrouter(lnet_peer_t *lp) { - return lp->lp_rtr_refcount != 0; + return lp->lp_rtr_refcount ? 1 : 0; } static inline void @@ -406,6 +422,8 @@ lnet_ni_decref(lnet_ni_t *ni) } void lnet_ni_free(lnet_ni_t *ni); +lnet_ni_t * +lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist); static inline int lnet_nid2peerhash(lnet_nid_t nid) @@ -430,24 +448,41 @@ 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); -int lnet_init(void); -void lnet_fini(void); +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, unsigned long when); -int lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway_nid, +int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid, unsigned int priority); int lnet_check_routes(void); int lnet_del_route(__u32 net, lnet_nid_t gw_nid); void lnet_destroy_routes(void); int lnet_get_route(int idx, __u32 *net, __u32 *hops, lnet_nid_t *gateway, __u32 *alive, __u32 *priority); +int lnet_get_net_config(int idx, __u32 *cpt_count, __u64 *nid, + int *peer_timeout, int *peer_tx_credits, + int *peer_rtr_cr, int *max_tx_credits, + struct lnet_ioctl_net_config *net_config); +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_rtrpools_free(void); +void lnet_destroy_rtrbuf(lnet_rtrbuf_t *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); +int lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets, + __s32 peer_timeout, __s32 peer_cr, __s32 peer_buf_cr, + __s32 credits); +int lnet_dyn_del_ni(__u32 net); +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); @@ -466,6 +501,8 @@ void lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, 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_drop_routed_msgs_locked(struct list_head *list, int cpt); /* portals functions */ /* portals attributes */ @@ -522,13 +559,22 @@ void lnet_portals_destroy(void); /* message functions */ int lnet_parse(lnet_ni_t *ni, lnet_hdr_t *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); + 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, + 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_message(lnet_ni_t *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); @@ -541,6 +587,24 @@ char *lnet_msgtyp2str(int type); void lnet_print_hdr(lnet_hdr_t *hdr); int lnet_fail_nid(lnet_nid_t nid, unsigned int threshold); +/** \addtogroup lnet_fault_simulation @{ */ + +int lnet_fault_ctl(int cmd, struct libcfs_ioctl_data *data); +int lnet_fault_init(void); +void lnet_fault_fini(void); + +bool lnet_drop_rule_match(lnet_hdr_t *hdr); + +int lnet_delay_rule_add(struct lnet_fault_attr *attr); +int lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown); +int lnet_delay_rule_list(int pos, struct lnet_fault_attr *attr, + struct lnet_fault_stat *stat); +void lnet_delay_rule_reset(void); +void lnet_delay_rule_check(void); +bool lnet_delay_rule_match_locked(lnet_hdr_t *hdr, struct lnet_msg *msg); + +/** @} lnet_fault_simulation */ + void lnet_counters_get(lnet_counters_t *counters); void lnet_counters_reset(void); @@ -660,27 +724,30 @@ void lnet_router_checker_stop(void); void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net); void lnet_swap_pinginfo(lnet_ping_info_t *info); -int lnet_ping_target_init(void); -void lnet_ping_target_fini(void); -int lnet_ping(lnet_process_id_t id, int timeout_ms, - lnet_process_id_t *ids, int n_ids); - int lnet_parse_ip2nets(char **networksp, char *ip2nets); 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(void); +void lnet_peer_tables_cleanup(lnet_ni_t *ni); void lnet_peer_tables_destroy(void); int lnet_peer_tables_create(void); void lnet_debug_peer(lnet_nid_t nid); +int lnet_get_peer_info(__u32 peer_index, __u64 *nid, + char alivness[LNET_MAX_STR_LEN], + __u32 *cpt_iter, __u32 *refcount, + __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits, + __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis, + __u32 *peer_tx_qnob); static inline void lnet_peer_set_alive(lnet_peer_t *lp) { - lp->lp_last_alive = lp->lp_last_query = jiffies; + lp->lp_last_query = jiffies; + lp->lp_last_alive = jiffies; if (!lp->lp_alive) lnet_notify_locked(lp, 0, 1, lp->lp_last_alive); } diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 3bb9468e0..29c72f8c2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -38,9 +38,9 @@ #include <linux/kthread.h> #include <linux/uio.h> #include <linux/types.h> -#include <net/sock.h> #include "types.h" +#include "lnetctl.h" /* Max payload size */ #define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD @@ -85,10 +85,10 @@ typedef struct lnet_msg { unsigned int msg_receiving:1; /* being received */ unsigned int msg_txcredit:1; /* taken an NI send credit */ unsigned int msg_peertxcredit:1; /* taken a peer send credit */ - unsigned int msg_rtrcredit:1; /* taken a global - router credit */ + unsigned int msg_rtrcredit:1; /* taken a global router credit */ unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ unsigned int msg_onactivelist:1; /* on the activelist */ + unsigned int msg_rdma_get:1; struct lnet_peer *msg_txpeer; /* peer I'm sending to */ struct lnet_peer *msg_rxpeer; /* peer I received from */ @@ -113,7 +113,7 @@ typedef struct lnet_libhandle { } lnet_libhandle_t; #define lh_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(char *)(&((type *)0)->member))) + ((type *)((char *)(ptr) - (char *)(&((type *)0)->member))) typedef struct lnet_eq { struct list_head eq_list; @@ -190,7 +190,8 @@ typedef struct lnet_lnd { void (*lnd_shutdown)(struct lnet_ni *ni); int (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg); - /* In data movement APIs below, payload buffers are described as a set + /* + * In data movement APIs below, payload buffers are described as a set * of 'niov' fragments which are... * EITHER * in virtual memory (struct iovec *iov != NULL) @@ -201,30 +202,36 @@ typedef struct lnet_lnd { * fragments to start from */ - /* Start sending a preformatted message. 'private' is NULL for PUT and + /* + * Start sending a preformatted message. 'private' is NULL for PUT and * GET messages; otherwise this is a response to an incoming message * and 'private' is the 'private' passed to lnet_parse(). Return * non-zero for immediate failure, otherwise complete later with - * lnet_finalize() */ + * lnet_finalize() + */ int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg); - /* Start receiving 'mlen' bytes of payload data, skipping the following + /* + * Start receiving 'mlen' bytes of payload data, skipping the following * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to * lnet_parse(). Return non-zero for immediate failure, otherwise * complete later with lnet_finalize(). This also gives back a receive - * credit if the LND does flow control. */ + * credit if the LND does flow control. + */ int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen); - /* lnet_parse() has had to delay processing of this message + /* + * lnet_parse() has had to delay processing of this message * (e.g. waiting for a forwarding buffer or send credits). Give the * LND a chance to free urgently needed resources. If called, return 0 * for success and do NOT give back a receive credit; that has to wait * until lnd_recv() gets called. On failure return < 0 and - * release resources; lnd_recv() will not be called. */ + * 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); @@ -272,11 +279,14 @@ typedef struct lnet_ni { #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL -/* NB: value of these features equal to LNET_PROTO_PING_VERSION_x - * of old LNet, so there shouldn't be any compatibility issue */ +/* + * NB: value of these features equal to LNET_PROTO_PING_VERSION_x + * of old LNet, so there shouldn't be any compatibility issue + */ #define LNET_PING_FEAT_INVAL (0) /* no feature */ #define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */ #define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */ +#define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */ #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS) @@ -343,13 +353,17 @@ typedef struct lnet_peer { struct lnet_peer_table { int pt_version; /* /proc validity stamp */ int pt_number; /* # peers extant */ + /* # zombies to go to deathrow (and not there yet) */ + int pt_zombies; struct list_head pt_deathrow; /* zombie peers */ struct list_head *pt_hash; /* NID->peer hash */ }; -/* 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 */ -#define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing != 0 && \ +/* + * 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 + */ +#define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \ (lp)->lp_ni->ni_peertimeout > 0) typedef struct { @@ -359,7 +373,7 @@ typedef struct { __u32 lr_net; /* remote network number */ int lr_seq; /* sequence for round-robin */ unsigned int lr_downis; /* number of down NIs */ - unsigned int lr_hops; /* how far I am */ + __u32 lr_hops; /* how far I am */ unsigned int lr_priority; /* route priority */ } lnet_route_t; @@ -384,7 +398,10 @@ typedef struct { struct list_head rbp_msgs; /* messages blocking for a buffer */ int rbp_npages; /* # pages in each buffer */ - int rbp_nbuffers; /* # buffers */ + /* requested number of buffers */ + int rbp_req_nbuffers; + /* # buffers actually allocated */ + int rbp_nbuffers; int rbp_credits; /* # free buffers / blocked messages */ int rbp_mincredits; /* low water mark */ @@ -398,7 +415,12 @@ typedef struct { #define LNET_PEER_HASHSIZE 503 /* prime! */ -#define LNET_NRBPOOLS 3 /* # different router buffer pools */ +#define LNET_TINY_BUF_IDX 0 +#define LNET_SMALL_BUF_IDX 1 +#define LNET_LARGE_BUF_IDX 2 + +/* # different router buffer pools */ +#define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1) enum { /* Didn't match anything */ @@ -433,12 +455,16 @@ struct lnet_match_info { #define LNET_MT_HASH_BITS 8 #define LNET_MT_HASH_SIZE (1 << LNET_MT_HASH_BITS) #define LNET_MT_HASH_MASK (LNET_MT_HASH_SIZE - 1) -/* we allocate (LNET_MT_HASH_SIZE + 1) entries for lnet_match_table::mt_hash, - * the last entry is reserved for MEs with ignore-bits */ +/* + * we allocate (LNET_MT_HASH_SIZE + 1) entries for lnet_match_table::mt_hash, + * the last entry is reserved for MEs with ignore-bits + */ #define LNET_MT_HASH_IGNORE LNET_MT_HASH_SIZE -/* __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which +/* + * __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which * is 4 __u64s as bit-map, and add an extra __u64 (only use one bit) for the - * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE] */ + * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE] + */ #define LNET_MT_BITS_U64 6 /* 2^6 bits */ #define LNET_MT_EXHAUSTED_BITS (LNET_MT_HASH_BITS - LNET_MT_BITS_U64) #define LNET_MT_EXHAUSTED_BMAP ((1 << LNET_MT_EXHAUSTED_BITS) + 1) @@ -448,8 +474,10 @@ struct lnet_match_table { /* reserved for upcoming patches, CPU partition ID */ unsigned int mt_cpt; unsigned int mt_portal; /* portal index */ - /* match table is set as "enabled" if there's non-exhausted MD - * attached on mt_mhash, it's only valid for wildcard portal */ + /* + * match table is set as "enabled" if there's non-exhausted MD + * attached on mt_mhash, it's only valid for wildcard portal + */ unsigned int mt_enabled; /* bitmap to flag whether MEs on mt_hash are exhausted or not */ __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; @@ -546,6 +574,8 @@ typedef struct { struct lnet_peer_table **ln_peer_tables; /* failure simulation */ struct list_head ln_test_peers; + struct list_head ln_drop_rules; + struct list_head ln_delay_rules; struct list_head ln_nis; /* LND instances */ /* NIs bond on specific CPT(s) */ @@ -553,8 +583,6 @@ typedef struct { /* dying LND instances */ struct list_head ln_nis_zombie; lnet_ni_t *ln_loni; /* the loopback NI */ - /* NI to wait for events in */ - lnet_ni_t *ln_eq_waitni; /* remote networks with routes to them */ struct list_head *ln_remote_nets_hash; @@ -584,8 +612,7 @@ typedef struct { struct mutex ln_api_mutex; struct mutex ln_lnd_mutex; - int ln_init; /* lnet_init() - called? */ + struct mutex ln_delay_mutex; /* Have I called LNetNIInit myself? */ int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ @@ -600,12 +627,24 @@ typedef struct { /* registered LNDs */ struct list_head ln_lnds; - /* space for network names */ - char *ln_network_tokens; - int ln_network_tokens_nob; /* test protocol compatibility flags */ int ln_testprotocompat; + /* + * 0 - load the NIs from the mod params + * 1 - do not load the NIs from the mod params + * Reverse logic to ensure that other calls to LNetNIInit + * need no change + */ + bool ln_nis_from_mod_params; + + /* + * waitq for router checker. As long as there are no routes in + * the list, the router checker will sleep on this queue. when + * routes are added the thread will wake up + */ + wait_queue_head_t ln_rc_waitq; + } lnet_t; #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h b/drivers/staging/lustre/include/linux/lnet/lnetctl.h index bdd69b2af..39575073b 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h @@ -10,10 +10,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Portals; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * * header for lnet ioctl */ #ifndef _LNETCTL_H_ @@ -21,6 +17,106 @@ #include "types.h" +/** \addtogroup lnet_fault_simulation + * @{ + */ + +enum { + LNET_CTL_DROP_ADD, + LNET_CTL_DROP_DEL, + LNET_CTL_DROP_RESET, + LNET_CTL_DROP_LIST, + LNET_CTL_DELAY_ADD, + LNET_CTL_DELAY_DEL, + LNET_CTL_DELAY_RESET, + LNET_CTL_DELAY_LIST, +}; + +#define LNET_ACK_BIT BIT(0) +#define LNET_PUT_BIT BIT(1) +#define LNET_GET_BIT BIT(2) +#define LNET_REPLY_BIT BIT(3) + +/** ioctl parameter for LNet fault simulation */ +struct lnet_fault_attr { + /** + * source NID of drop rule + * LNET_NID_ANY is wildcard for all sources + * 255.255.255.255@net is wildcard for all addresses from @net + */ + lnet_nid_t fa_src; + /** destination NID of drop rule, see \a dr_src for details */ + lnet_nid_t fa_dst; + /** + * Portal mask to drop, -1 means all portals, for example: + * fa_ptl_mask = (1 << _LDLM_CB_REQUEST_PORTAL ) | + * (1 << LDLM_CANCEL_REQUEST_PORTAL) + * + * If it is non-zero then only PUT and GET will be filtered, otherwise + * there is no portal filter, all matched messages will be checked. + */ + __u64 fa_ptl_mask; + /** + * message types to drop, for example: + * dra_type = LNET_DROP_ACK_BIT | LNET_DROP_PUT_BIT + * + * If it is non-zero then only specified message types are filtered, + * otherwise all message types will be checked. + */ + __u32 fa_msg_mask; + union { + /** message drop simulation */ + struct { + /** drop rate of this rule */ + __u32 da_rate; + /** + * time interval of message drop, it is exclusive + * with da_rate + */ + __u32 da_interval; + } drop; + /** message latency simulation */ + struct { + __u32 la_rate; + /** + * time interval of message delay, it is exclusive + * with la_rate + */ + __u32 la_interval; + /** latency to delay */ + __u32 la_latency; + } delay; + __u64 space[8]; + } u; +}; + +/** fault simluation stats */ +struct lnet_fault_stat { + /** total # matched messages */ + __u64 fs_count; + /** # dropped LNET_MSG_PUT by this rule */ + __u64 fs_put; + /** # dropped LNET_MSG_ACK by this rule */ + __u64 fs_ack; + /** # dropped LNET_MSG_GET by this rule */ + __u64 fs_get; + /** # dropped LNET_MSG_REPLY by this rule */ + __u64 fs_reply; + union { + struct { + /** total # dropped messages */ + __u64 ds_dropped; + } drop; + struct { + /** total # delayed messages */ + __u64 ls_delayed; + } delay; + __u64 space[8]; + } u; +}; + +/** @} lnet_fault_simulation */ + #define LNET_DEV_ID 0 #define LNET_DEV_PATH "/dev/lnet" #define LNET_DEV_MAJOR 10 diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index fd1e0fd36..417044552 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -245,20 +245,20 @@ typedef struct { int lstio_ses_force; /* IN: force create ? */ /** IN: session features */ unsigned lstio_ses_feats; - lst_sid_t *lstio_ses_idp; /* OUT: session id */ + lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* IN: session name */ + char __user *lstio_ses_namep; /* IN: session name */ } lstio_session_new_args_t; /* query current session */ typedef struct { - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int *lstio_ses_keyp; /* OUT: local key */ + lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ + int __user *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ - unsigned *lstio_ses_featp; - lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ + unsigned __user *lstio_ses_featp; + lstcon_ndlist_ent_t __user *lstio_ses_ndinfo; /* OUT: */ int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* OUT: session name */ + char __user *lstio_ses_namep; /* OUT: session name */ } lstio_session_info_args_t; /* delete a session */ @@ -283,26 +283,26 @@ typedef struct { int lstio_dbg_timeout; /* IN: timeout of debug */ int lstio_dbg_nmlen; /* IN: len of name */ - char *lstio_dbg_namep; /* IN: name of + char __user *lstio_dbg_namep; /* IN: name of group|batch */ int lstio_dbg_count; /* IN: # of test nodes to debug */ - lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test + lnet_process_id_t __user *lstio_dbg_idsp; /* IN: id of test nodes */ - struct list_head *lstio_dbg_resultp; /* OUT: list head of + struct list_head __user *lstio_dbg_resultp; /* OUT: list head of result buffer */ } lstio_debug_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char __user *lstio_grp_namep; /* IN: group name */ } lstio_group_add_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char __user *lstio_grp_namep; /* IN: group name */ } lstio_group_del_args_t; #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ @@ -315,22 +315,22 @@ typedef struct { int lstio_grp_opc; /* IN: OPC */ int lstio_grp_args; /* IN: arguments */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ int lstio_grp_count; /* IN: # of nodes id */ - lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of + lnet_process_id_t __user *lstio_grp_idsp; /* IN: array of nodes */ + struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ } lstio_group_update_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ int lstio_grp_count; /* IN: # of nodes */ /** OUT: session features */ - unsigned *lstio_grp_featp; - lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of + unsigned __user *lstio_grp_featp; + lnet_process_id_t __user *lstio_grp_idsp; /* IN: nodes */ + struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ } lstio_group_nodes_args_t; @@ -338,18 +338,18 @@ typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_idx; /* IN: group idx */ int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* OUT: name */ + char __user *lstio_grp_namep; /* OUT: name */ } lstio_group_list_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* IN: name */ - lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of + char __user *lstio_grp_namep; /* IN: name */ + lstcon_ndlist_ent_t __user *lstio_grp_entp; /* OUT: description of group */ - int *lstio_grp_idxp; /* IN/OUT: node index */ - int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ + int __user *lstio_grp_idxp; /* IN/OUT: node index */ + int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t __user *lstio_grp_dentsp; /* OUT: nodent array */ } lstio_group_info_args_t; #define LST_DEFAULT_BATCH "batch" /* default batch name */ @@ -357,13 +357,13 @@ typedef struct { typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_add_args_t; typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_del_args_t; typedef struct { @@ -371,8 +371,8 @@ typedef struct { int lstio_bat_timeout; /* IN: timeout for the batch */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of + char __user *lstio_bat_namep; /* IN: batch name */ + struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ } lstio_batch_run_args_t; @@ -381,8 +381,8 @@ typedef struct { int lstio_bat_force; /* IN: abort unfinished test RPC */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of + char __user *lstio_bat_namep; /* IN: batch name */ + struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ } lstio_batch_stop_args_t; @@ -394,8 +394,8 @@ typedef struct { int lstio_bat_timeout; /* IN: timeout for waiting */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of + char __user *lstio_bat_namep; /* IN: batch name */ + struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ } lstio_batch_query_args_t; @@ -403,21 +403,21 @@ typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_idx; /* IN: index */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_list_args_t; typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: name */ + char __user *lstio_bat_namep; /* IN: name */ int lstio_bat_server; /* IN: query server or not */ int lstio_bat_testidx; /* IN: test index */ - lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ + lstcon_test_batch_ent_t __user *lstio_bat_entp; /* OUT: batch ent */ - int *lstio_bat_idxp; /* IN/OUT: index of node */ - int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ + int __user *lstio_bat_idxp; /* IN/OUT: index of node */ + int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t __user *lstio_bat_dentsp; /* array of nodent */ } lstio_batch_info_args_t; /* add stat in session */ @@ -427,10 +427,10 @@ typedef struct { stat request */ int lstio_sta_nmlen; /* IN: group name length */ - char *lstio_sta_namep; /* IN: group name */ + char __user *lstio_sta_namep; /* IN: group name */ int lstio_sta_count; /* IN: # of pid */ - lnet_process_id_t *lstio_sta_idsp; /* IN: pid */ - struct list_head *lstio_sta_resultp; /* OUT: list head of + lnet_process_id_t __user *lstio_sta_idsp; /* IN: pid */ + struct list_head __user *lstio_sta_resultp; /* OUT: list head of result buffer */ } lstio_stat_args_t; @@ -445,7 +445,7 @@ typedef enum { typedef struct { int lstio_tes_key; /* IN: session key */ int lstio_tes_bat_nmlen; /* IN: batch name len */ - char *lstio_tes_bat_name; /* IN: batch name */ + char __user *lstio_tes_bat_name; /* IN: batch name */ int lstio_tes_type; /* IN: test type */ int lstio_tes_oneside; /* IN: one sided test */ int lstio_tes_loop; /* IN: loop count */ @@ -457,20 +457,20 @@ typedef struct { destination groups */ int lstio_tes_sgrp_nmlen; /* IN: source group name length */ - char *lstio_tes_sgrp_name; /* IN: group name */ + char __user *lstio_tes_sgrp_name; /* IN: group name */ int lstio_tes_dgrp_nmlen; /* IN: destination group name length */ - char *lstio_tes_dgrp_name; /* IN: group name */ + char __user *lstio_tes_dgrp_name; /* IN: group name */ int lstio_tes_param_len; /* IN: param buffer len */ - void *lstio_tes_param; /* IN: parameter for specified + void __user *lstio_tes_param; /* IN: parameter for specified test: lstio_bulk_param_t, lstio_ping_param_t, ... more */ - int *lstio_tes_retp; /* OUT: private returned + int __user *lstio_tes_retp; /* OUT: private returned value */ - struct list_head *lstio_tes_resultp; /* OUT: list head of + struct list_head __user *lstio_tes_resultp;/* OUT: list head of result buffer */ } lstio_test_args_t; diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 4fc9ddce8..937fcc9e4 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -34,8 +34,10 @@ * Lustre Network Driver types. */ enum { - /* Only add to these values (i.e. don't ever change or redefine them): - * network addresses depend on them... */ + /* + * Only add to these values (i.e. don't ever change or redefine them): + * network addresses depend on them... + */ QSWLND = 1, SOCKLND = 2, GMLND = 3, @@ -67,6 +69,7 @@ static inline char *libcfs_lnd2str(__u32 lnd) return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + int libcfs_str2lnd(const char *str); char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size); static inline char *libcfs_net2str(__u32 net) @@ -74,12 +77,14 @@ static inline char *libcfs_net2str(__u32 net) return libcfs_net2str_r(net, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size); static inline char *libcfs_nid2str(lnet_nid_t nid) { return libcfs_nid2str_r(nid, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + __u32 libcfs_str2net(const char *str); lnet_nid_t libcfs_str2nid(const char *str); int libcfs_str2anynid(lnet_nid_t *nid, const char *str); diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 599c9f662..bc32403f4 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -85,14 +85,17 @@ 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_zc_cookies[0] = 0; + msg->ksm_zc_cookies[1] = 0; } #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) */ +/* + * 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 diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 11630180c..1c679cb72 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -36,10 +36,14 @@ #include <linux/types.h> /** \addtogroup lnet - * @{ */ + * @{ + */ + +#define LNET_VERSION "0.6.0" /** \addtogroup lnet_addr - * @{ */ + * @{ + */ /** Portal reserved for LNet's own use. * \see lustre/include/lustre/lustre_idl.h for Lustre portal assignments. @@ -116,10 +120,12 @@ typedef struct { lnet_pid_t pid; } WIRE_ATTR lnet_process_id_packed_t; -/* The wire handle's interface cookie only matches one network interface in +/* + * The wire handle's interface cookie only matches one network interface in * one epoch (i.e. new cookie when the interface restarts or the node * reboots). The object cookie only matches one object on that interface - * during that object's lifetime (i.e. no cookie re-use). */ + * during that object's lifetime (i.e. no cookie re-use). + */ typedef struct { __u64 wh_interface_cookie; __u64 wh_object_cookie; @@ -133,10 +139,12 @@ typedef enum { LNET_MSG_HELLO, } lnet_msg_type_t; -/* The variant fields of the portals message header are aligned on an 8 +/* + * The variant fields of the portals message header are aligned on an 8 * byte boundary in the message header. Note that all types used in these * wire structs MUST be fixed size and the smaller types are placed at the - * end. */ + * end. + */ typedef struct lnet_ack { lnet_handle_wire_t dst_wmd; __u64 match_bits; @@ -185,7 +193,8 @@ typedef struct { } msg; } WIRE_ATTR lnet_hdr_t; -/* A HELLO message contains a magic number and protocol version +/* + * A HELLO message contains a magic number and protocol version * code in the header's dest_nid, the peer's NID in the src_nid, and * LNET_MSG_HELLO in the type field. All other common fields are zero * (including payload_size; i.e. no payload). @@ -208,8 +217,10 @@ typedef struct { #define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ /* Placeholder for a future "unified" protocol across all LNDs */ -/* Current LNDs that receive a request with this magic will respond with a - * "stub" reply using their current protocol */ +/* + * Current LNDs that receive a request with this magic will respond with a + * "stub" reply using their current protocol + */ #define LNET_PROTO_MAGIC 0x45726963 /* ! */ #define LNET_PROTO_TCP_VERSION_MAJOR 1 @@ -258,7 +269,7 @@ typedef struct lnet_counters { #define LNET_MAX_INTERFACES 16 -/* +/** * 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 * object type codes ('eq' for event queue, 'md' for memory descriptor, and @@ -318,7 +329,8 @@ typedef struct { /** @} lnet_addr */ /** \addtogroup lnet_me - * @{ */ + * @{ + */ /** * Specifies whether the match entry or memory descriptor should be unlinked @@ -348,7 +360,8 @@ typedef enum { /** @} lnet_me */ /** \addtogroup lnet_md - * @{ */ + * @{ + */ /** * Defines the visible parts of a memory descriptor. Values of this type @@ -450,9 +463,11 @@ typedef struct { lnet_handle_eq_t eq_handle; } lnet_md_t; -/* Max Transfer Unit (minimum supported everywhere). +/* + * Max Transfer Unit (minimum supported everywhere). * CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks) - * these limits are system wide and not interface-local. */ + * these limits are system wide and not interface-local. + */ #define LNET_MTU_BITS 20 #define LNET_MTU (1 << LNET_MTU_BITS) @@ -499,14 +514,15 @@ typedef struct { /** * 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. + * kiov_len + kiov_offset <= PAGE_SIZE. */ unsigned int kiov_offset; } lnet_kiov_t; /** @} lnet_md */ /** \addtogroup lnet_eq - * @{ */ + * @{ + */ /** * Six types of events can be logged in an event queue. @@ -640,7 +656,8 @@ typedef void (*lnet_eq_handler_t)(lnet_event_t *event); /** @} lnet_eq */ /** \addtogroup lnet_data - * @{ */ + * @{ + */ /** * Specify whether an acknowledgment should be sent by target when the PUT |