798 #if M0_LUSTRE_VERSION < 2110 801 #include <lnet/nidstr.h> 804 #if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 51, 0) 805 #include <lnet/api.h> 806 #include <lnet/lib-types.h> 848 M0_BASSERT(
sizeof(__u64) ==
sizeof(uint64_t));
874 #define _NLXIS(s) ._##s = s 883 #define NLX_kcore_LNetMDAttach(ktm, lcbuf, kb, umd) \ 884 (*nlx_kcore_iv._nlx_kcore_LNetMDAttach)(ktm, lcbuf, kb, umd) 885 #define NLX_kcore_LNetPut(ktm, lcbuf, kb, umd) \ 886 (*nlx_kcore_iv._nlx_kcore_LNetPut)(ktm, lcbuf, kb, umd) 887 #define NLX_kcore_LNetGet(ktm, lcbuf, kb, umd) \ 888 (*nlx_kcore_iv._nlx_kcore_LNetGet)(ktm, lcbuf, kb, umd) 962 scanaddr = &
scan->ktm_addr;
972 return tmid >= 0 ? tmid :
M0_ERR(-EADDRNOTAVAIL);
988 scanaddr = &
scan->ktm_addr;
990 tms_tlist_add_before(
scan, kctm);
1012 bool is_unlinked =
false;
1018 if (event->type == LNET_EVENT_ACK) {
1021 nlx_kprint_lnet_event(
"nlx_kcore_eq_cb: filtered ACK",
1025 kbp =
event->md.user_ptr;
1030 NLXDBGP(ktm, 1,
"\t%p: eq_cb: %p %s U:%d S:%d T:%d buf:%lx\n",
1031 ktm, event, nlx_kcore_lnet_event_type_to_string(event->type),
1032 event->unlinked, event->status, event->md.threshold,
1034 NLXDBG(ktm, 2, nlx_kprint_lnet_event(
"eq_cb", event));
1035 NLXDBG(ktm, 3, nlx_kprint_kcore_tm(
"eq_cb", ktm));
1037 if (event->unlinked != 0) {
1038 LNetInvalidateMDHandle(&kbp->
kb_mdh);
1042 status =
event->status;
1043 mlength =
event->mlength;
1046 if (event->type == LNET_EVENT_SEND &&
1050 NLXDBGP(ktm, 1,
"\t%p: ignored LNetGet() SEND\n", ktm);
1059 "\t%p: LNetGet() SEND with unlinked: thr:%d ooo:%d\n",
1063 status = -ECANCELED;
1070 }
else if (event->type == LNET_EVENT_UNLINK) {
1072 status = -ECANCELED;
1073 }
else if (!is_unlinked) {
1074 NLXDBGP(ktm, 1,
"\t%p: eq_cb: %p %s !unlinked Q=%d\n", ktm,
1075 event, nlx_kcore_lnet_event_type_to_string(event->type),
1101 if (event->hdr_data != 0) {
1128 struct page *pg, uint32_t off)
1240 return LNET_MAX_IOV;
1257 drv_bufs_tlink_init(kb);
1263 LNetInvalidateMDHandle(&kb->
kb_mdh);
1287 drv_bufs_tlink_fini(kb);
1317 goto fail_buf_registered;
1322 fail_buf_registered:
1672 return M0_RC(-ETIMEDOUT);
1679 rc = wait_event_interruptible_timeout(ktm->
ktm_wq,
1682 return M0_RC(
rc == 0 ? -ETIMEDOUT :
rc < 0 ?
rc : 0);
1704 *nid = libcfs_str2nid(nidstr);
1705 if (*nid == LNET_NID_ANY)
1711 const char *nidstr, uint64_t * nid)
1724 const char *cp = libcfs_nid2str(nid);
1747 lnet_process_id_t
id;
1754 for (
nr = 0,
rc = 0;
rc != -ENOENT; ++
nr)
1755 rc = LNetGetId(
nr, &
id);
1757 if (*nidary ==
NULL)
1759 for (
i = 0;
i <
nr - 1; ++
i) {
1760 rc = LNetGetId(
i, &
id);
1762 nidstr = libcfs_nid2str(
id.nid);
1765 if ((*nidary)[
i] ==
NULL) {
1766 for (j = 0; j <
i; ++j)
1779 for (
i = 0; (*nidary)[
i] !=
NULL; ++
i)
1826 drv_tms_tlink_fini(ktm);
1827 tms_tlink_fini(ktm);
1863 lnet_process_id_t
id;
1878 "LNET_RESERVED_PORTAL=%d M0_NET_LNET_MAX_PORTALS=%d",
1884 for (
i = 0; ; ++
i) {
1885 rc = LNetGetId(
i, &
id);
1919 tms_tlink_init(ktm);
1923 drv_tms_tlink_init(ktm);
1927 init_waitqueue_head(&ktm->
ktm_wq);
1970 ctm->ctm_upvt =
NULL;
1975 goto fail_blessed_bev;
2016 #ifdef LNET_PID_LUSTRE 2017 rc = LNetNIInit(LNET_PID_LUSTRE);
2019 rc = LNetNIInit(LUSTRE_SRV_LNET_PID);
int(* _nlx_kcore_LNetMDAttach)(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
static void nlx_kcore_hdr_data_decode(uint64_t hdr_data, uint32_t *portal, uint32_t *tmid)
static uint32_t nlx_core_kmem_loc_checksum(const struct nlx_core_kmem_loc *loc)
struct nlx_core_kmem_loc kd_cd_loc
static void nlx_kcore_kiov_restore_length(struct nlx_kcore_buffer *kcb)
static void nlx_kcore_kcore_dom_fini(struct nlx_kcore_domain *kd)
#define NLX_kcore_LNetMDAttach(ktm, lcbuf, kb, umd)
M0_INTERNAL void m0_thread_tls_back(struct m0_thread_tls *tls)
static int nlx_kcore_buf_passive_send(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL int nlx_core_buf_msg_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
M0_INTERNAL int nlx_dev_init(void)
M0_BASSERT(sizeof(__u64)==sizeof(uint64_t))
unsigned kb_kiov_orig_len
M0_INTERNAL int nlx_core_buf_del(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
struct nlx_core_bev_link cbe_tm_link
M0_INTERNAL void nlx_core_dom_fini(struct nlx_core_domain *cd)
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_segment_size(struct nlx_core_domain *lcdom)
struct nlx_core_ep_addr cb_addr
static struct nlx_kcore_ops nlx_kcore_def_ops
static struct nlx_kcore_interceptable_subs nlx_kcore_iv
static void bev_cqueue_put(struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *p)
#define M0_LOG(level,...)
static int nlx_kcore_kcore_dom_init(struct nlx_kcore_domain *kd)
static void nlx_kcore_umd_init(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, int threshold, int max_size, unsigned options, bool isLNetGetOp, lnet_md_t *umd)
static void nlx_core_match_bits_decode(uint64_t mb, uint32_t *tmid, uint64_t *counter)
static bool nlx_kcore_tm_invariant(const struct nlx_kcore_transfer_mc *kctm)
static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *lcb)
#define NLXDBG(ptr, dbg, stmt)
int(* _nlx_kcore_LNetGet)(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
#define NLX_PAGE_OFFSET(addr)
static void nlx_kcore_core_tm_unmap_atomic(struct nlx_core_transfer_mc *ctm)
uint64_t m0_time_nanoseconds(const m0_time_t time)
static void nlx_core_fini(void)
static int nlx_kcore_max_tmid_find(struct nlx_core_ep_addr *cepa)
static void bev_cqueue_init(struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *ql1, struct nlx_core_bev_link *ql2)
nlx_core_opaque_ptr_t kb_buffer_id
#define NLX_ALLOC_PTR(ptr)
static int nlx_kcore_core_dom_init(struct nlx_kcore_domain *kd, struct nlx_core_domain *cd)
static void nlx_kcore_core_dom_fini(struct nlx_kcore_domain *kd, struct nlx_core_domain *cd)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
static void nlx_kcore_tm_stop(struct nlx_core_transfer_mc *ctm, struct nlx_kcore_transfer_mc *ktm)
static int nlx_kcore_LNetMDAttach(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
M0_INTERNAL int nlx_core_nidstr_encode(struct nlx_core_domain *lcdom, uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
M0_INTERNAL void nlx_core_mem_free(void *data, size_t size, unsigned shift)
M0_INTERNAL int nlx_core_buf_active_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
M0_INTERNAL int nlx_core_new_blessed_bev(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer_event **bevp)
uint64_t nlx_core_opaque_ptr_t
static int nlx_kcore_buffer_kla_to_kiov(struct nlx_kcore_buffer *kb, const struct m0_bufvec *bvec)
static struct nlx_core_bev_link * bev_cqueue_pnext(const struct nlx_core_bev_cqueue *q)
static int nlx_kcore_nidstr_decode(const char *nidstr, uint64_t *nid)
static void nlx_kcore_buf_deregister(struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
static int nlx_kcore_nidstr_encode(uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
struct nlx_core_ep_addr ctm_addr
#define M0_ERR_INFO(rc, fmt,...)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void nlx_dev_fini(void)
int(* _nlx_kcore_LNetPut)(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
static bool nlx_kcore_addr_in_use(struct nlx_core_ep_addr *cepa)
static struct m0_mutex nlx_kcore_mutex
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
struct nlx_core_bev_cqueue ctm_bevq
m0_time_t m0_time_now(void)
static int nlx_kcore_buf_passive_recv(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
m0_bcount_t cb_min_receive_size
static int nlx_kcore_buf_msg_recv(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
nlx_core_opaque_ptr_t cbe_buffer_id
static struct m0_bufvec bvec
static int nlx_kcore_tm_start(struct nlx_kcore_domain *kd, struct nlx_core_transfer_mc *ctm, struct nlx_kcore_transfer_mc *ktm)
static bool nlx_kcore_buffer_event_invariant(const struct nlx_kcore_buffer_event *kbe)
static struct m0_stob_domain * dom
M0_INTERNAL void nlx_core_tm_stop(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_size(struct nlx_core_domain *lcdom)
M0_INTERNAL struct m0_thread_tls * m0_thread_tls_pop(void)
M0_INTERNAL int32_t nlx_core_get_max_buffer_segments(struct nlx_core_domain *lcdom)
#define NLX_ALLOC_ALIGNED_PTR(ptr)
void * m0_alloc(size_t size)
static bool nlx_tm_invariant(const struct m0_net_transfer_mc *tm)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
M0_INTERNAL int nlx_core_buf_active_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
static bool bev_cqueue_is_empty(const struct nlx_core_bev_cqueue *q)
static __thread struct m0_thread_tls * tls
M0_INTERNAL void nlx_core_buf_deregister(struct nlx_core_domain *cd, struct nlx_core_buffer *cb)
static void nlx_core_kmem_loc_set(struct nlx_core_kmem_loc *loc, struct page *pg, uint32_t off)
static m0_bindex_t offset
M0_INTERNAL int nlx_core_buf_register(struct nlx_core_domain *cd, nlx_core_opaque_ptr_t buffer_id, const struct m0_bufvec *bvec, struct nlx_core_buffer *cb)
static void bev_link_bless(struct nlx_core_bev_link *ql, struct page *pg)
static int nlx_kcore_LNetGet(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
M0_INTERNAL void * nlx_core_mem_alloc(size_t size, unsigned shift)
M0_INTERNAL void nlx_core_nidstrs_put(struct nlx_core_domain *lcdom, char ***nidary)
uint32_t cb_max_operations
uint64_t m0_time_seconds(const m0_time_t time)
struct nlx_core_ep_addr cbe_sender
struct nlx_core_ep_addr ktm_addr
static void nlx_kcore_kiov_adjust_length(struct nlx_kcore_transfer_mc *ktm, struct nlx_kcore_buffer *kcb, lnet_md_t *umd, m0_bcount_t bytes)
struct nlx_kcore_transfer_mc * kb_ktm
struct m0_mutex kd_drv_mutex
#define NLX_kcore_LNetPut(ktm, lcbuf, kb, umd)
static bool nlx_core_ep_eq(const struct nlx_core_ep_addr *cep1, const struct nlx_core_ep_addr *cep2)
static int nlx_kcore_LNetPut(struct nlx_kcore_transfer_mc *kctm, struct nlx_core_buffer *lcbuf, struct nlx_kcore_buffer *kcb, lnet_md_t *umd)
struct nlx_kcore_ops * kd_drv_ops
M0_INTERNAL int nlx_core_buf_passive_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
static uint8_t fail[DATA_UNIT_COUNT_MAX+PARITY_UNIT_COUNT_MAX]
M0_INTERNAL int nlx_core_dom_init(struct m0_net_domain *dom, struct nlx_core_domain *cd)
M0_INTERNAL int nlx_core_buf_passive_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
static int nlx_kcore_buf_register(struct nlx_kcore_domain *kd, nlx_core_opaque_ptr_t buffer_id, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
static struct m0_tl nlx_kcore_tms
static struct nlx_core_transfer_mc * nlx_kcore_core_tm_map_atomic(struct nlx_kcore_transfer_mc *ktm)
static void bev_cqueue_fini(struct nlx_core_bev_cqueue *q, void(*free_cb)(struct nlx_core_bev_link *))
struct nlx_core_kmem_loc kb_cb_loc
#define NLXDBGP(ptr, dbg, fmt,...)
static int nlx_kcore_buf_event_wait(struct nlx_core_transfer_mc *ctm, struct nlx_kcore_transfer_mc *ktm, m0_time_t timeout)
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
static void nlx_kcore_tms_list_add(struct nlx_kcore_transfer_mc *kctm)
static int nlx_kcore_buf_active_send(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
M0_INTERNAL int nlx_core_buf_event_wait(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, m0_time_t timeout)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static int nlx_kcore_buf_msg_send(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
enum m0_net_queue_type cb_qtype
M0_TL_DEFINE(tms, static, struct nlx_kcore_transfer_mc)
#define M0_ASSERT_INFO(cond, fmt,...)
static bool nlx_core_tm_invariant(const struct nlx_core_transfer_mc *lctm)
static void nlx_core_bev_free_cb(struct nlx_core_bev_link *ql)
M0_INTERNAL int nlx_core_buf_msg_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
struct nlx_core_kmem_loc kbe_bev_loc
static int nlx_core_init(void)
enum m0_net_queue_type kb_qtype
static bool nlx_core_kmem_loc_invariant(const struct nlx_core_kmem_loc *loc)
static bool nlx_core_kmem_loc_is_empty(const struct nlx_core_kmem_loc *loc)
struct m0_tl ktm_drv_bevs
static int scan(struct scanner *s)
int(* ko_dom_init)(struct nlx_kcore_domain *kd, struct nlx_core_domain *cd)
struct nlx_core_kmem_loc ktm_ctm_loc
#define m0_tl_for(name, head, obj)
M0_INTERNAL int nlx_core_tm_start(struct nlx_core_domain *cd, struct m0_net_transfer_mc *tm, struct nlx_core_transfer_mc *ctm)
static bool nlx_kcore_buffer_invariant(const struct nlx_kcore_buffer *kcb)
static int nlx_kcore_buf_active_recv(struct nlx_kcore_transfer_mc *ktm, struct nlx_core_buffer *cb, struct nlx_kcore_buffer *kb)
M0_TL_DESCR_DEFINE(tms, "nlx tms", static, struct nlx_kcore_transfer_mc, ktm_tm_linkage, ktm_magic, M0_NET_LNET_KCORE_TM_MAGIC, M0_NET_LNET_KCORE_TMS_MAGIC)
#define m0_tl_exists(name, var, head,...)
M0_INTERNAL int nlx_core_nidstr_decode(struct nlx_core_domain *lcdom, const char *nidstr, uint64_t *nid)
#define NLX_kcore_LNetGet(ktm, lcbuf, kb, umd)
nlx_core_opaque_ptr_t cb_buffer_id
M0_INTERNAL int nlx_core_nidstrs_get(struct nlx_core_domain *lcdom, char ***nidary)
static bool nlx_kcore_domain_invariant(const struct nlx_kcore_domain *kd)
static void nlx_kcore_eq_cb(lnet_event_t *event)
static int nlx_kcore_LNetMDUnlink(struct nlx_kcore_transfer_mc *kctm, struct nlx_kcore_buffer *kcb)
static uint64_t nlx_core_match_bits_encode(uint32_t tmid, uint64_t counter)