488 #include <sys/types.h> 489 #include <sys/stat.h> 490 #include <sys/ioctl.h> 557 rc = ioctl(
fd, cmd, arg);
563 return M0_RC(-errno);
607 if (nidstrs ==
NULL) {
611 for (
i = 0,
p = dngp.
dng_buf;
i < nidstrs_nr; ++
i, ++
p) {
616 nidstrs[nidstrs_nr] =
NULL;
636 static const struct {
639 const char *err_help;
640 } possible_open_errors[] = {
641 { EACCES,
"EACCES",
"Please check permissions." },
642 { ENOENT,
"ENOENT",
"Please ensure that m0tr.ko is loaded." },
657 if (ud->
ud_fd == -1) {
662 if (possible_open_errors[
i].err == -
rc) {
664 "open(\"%s\", O_RDWR|O_CLOEXEC) failed: " 665 "errno=%d (%s). %s" ,
667 possible_open_errors[
i].err_str,
668 possible_open_errors[
i].err_help);
683 #define NLX_IP_SET(f) ud->ud_##f = ip.ddi_##f 759 .dbr_buffer_id = buffer_id,
820 #define NLX_UCORE_BUF_OP(op, loc, ...) \ 821 struct nlx_ucore_domain *ud; \ 822 struct nlx_ucore_transfer_mc *utm; \ 823 struct nlx_ucore_buffer *ub; \ 824 struct m0_lnet_dev_buf_queue_params dbqp; \ 827 M0_PRE(cd != NULL); \ 829 M0_PRE(nlx_ucore_domain_invariant(ud)); \ 831 M0_PRE(nlx_core_tm_invariant(ctm)); \ 832 utm = ctm->ctm_upvt; \ 833 M0_PRE(nlx_ucore_tm_invariant(utm)); \ 835 M0_PRE(nlx_core_buffer_invariant(cb)); \ 837 M0_PRE(nlx_ucore_buffer_invariant(ub)); \ 841 dbqp.dbq_ktm = ctm->ctm_kpvt; \ 842 dbqp.dbq_kb = cb->cb_kpvt; \ 843 rc = nlx_ucore_ioctl(ud->ud_fd, op, &dbqp) 958 #undef NLX_UCORE_BUF_OP 982 }
while (
rc == -EINTR);
983 return rc < 0 ?
rc : 0;
987 const char *nidstr, uint64_t * nid)
1125 goto fail_blessed_bev;
1146 if (
rc == -EADDRINUSE)
1149 "by another process.",
static struct m0_addb2_philter p
static int nlx_ucore_nidstrs_get(struct nlx_ucore_domain *ud, char ***nidary)
struct nlx_core_bev_link cbe_tm_link
#define M0_LNET_BUF_ACTIVE_SEND
M0_INTERNAL int nlx_core_buf_passive_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
#define NLX_UCORE_BUF_OP(op, loc,...)
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_ep_addr cb_addr
static void nlx_ucore_tm_stop(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
M0_INTERNAL int nlx_core_nidstr_decode(struct nlx_core_domain *cd, const char *nidstr, uint64_t *nid)
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)
m0_bcount_t ud_max_buffer_size
#define M0_LOG(level,...)
static void nlx_core_match_bits_decode(uint64_t mb, uint32_t *tmid, uint64_t *counter)
static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *lcb)
#define M0_LNET_BUF_MSG_SEND
#define M0_LNET_BUF_REGISTER
M0_INTERNAL void * m0_alloc_wired(size_t size, unsigned shift)
static void bev_cqueue_init(struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *ql1, struct nlx_core_bev_link *ql2)
struct m0_bufvec dbr_bvec
#define M0_LNET_NIDSTR_ENCODE
#define NLX_ALLOC_PTR(ptr)
static const char * nlx_ucore_dev_name
m0_bcount_t ud_max_buffer_segment_size
static bool nlx_ucore_domain_invariant(const struct nlx_ucore_domain *ud)
M0_INTERNAL int nlx_core_buf_passive_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
M0_INTERNAL void nlx_core_dom_fini(struct nlx_core_domain *cd)
M0_INTERNAL void nlx_core_nidstrs_put(struct nlx_core_domain *cd, char ***nidary)
#define NLX_ALLOC_ARR(ptr, nr)
M0_INTERNAL void m0_free_wired(void *data, size_t size, unsigned shift)
M0_INTERNAL int nlx_core_buf_del(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
uint64_t nlx_core_opaque_ptr_t
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_segment_size(struct nlx_core_domain *cd)
#define M0_LNET_BUF_PASSIVE_SEND
#define M0_LNET_BUF_DEREGISTER
struct nlx_core_ep_addr ctm_addr
#define M0_ERR_INFO(rc, fmt,...)
return M0_ERR(-EOPNOTSUPP)
static void nlx_ucore_nidstrs_put(struct nlx_ucore_domain *ud, char ***nidary)
M0_INTERNAL int nlx_core_dom_init(struct m0_net_domain *dom, struct nlx_core_domain *cd)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
struct nlx_core_bev_cqueue ctm_bevq
M0_INTERNAL int nlx_core_tm_start(struct nlx_core_domain *cd, struct m0_net_transfer_mc *tm, struct nlx_core_transfer_mc *ctm)
m0_bcount_t cb_min_receive_size
char dn_buf[M0_NET_LNET_NIDSTR_SIZE]
#define M0_LNET_NIDSTR_DECODE
struct nlx_core_transfer_mc * dts_ctm
static struct m0_bufvec bvec
static struct m0_stob_domain * dom
#define NLX_ALLOC_ALIGNED_PTR(ptr)
struct nlx_core_buffer * dbr_lcbuf
static bool nlx_tm_invariant(const struct m0_net_transfer_mc *tm)
static bool bev_cqueue_is_empty(const struct nlx_core_bev_cqueue *q)
M0_INTERNAL int32_t nlx_core_get_max_buffer_segments(struct nlx_core_domain *cd)
uint32_t cb_max_operations
M0_INTERNAL int nlx_core_nidstrs_get(struct nlx_core_domain *cd, char ***nidary)
#define M0_LNET_BUF_EVENT_WAIT
static bool nlx_ucore_buffer_invariant(const struct nlx_ucore_buffer *ub)
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_size(struct nlx_core_domain *cd)
#define M0_LNET_BUF_PASSIVE_RECV
static int nlx_core_init(void)
static int nlx_ucore_ioctl(int fd, unsigned long cmd, void *arg)
#define M0_LNET_IOC_MAX_NR
static void bev_cqueue_fini(struct nlx_core_bev_cqueue *q, void(*free_cb)(struct nlx_core_bev_link *))
M0_INTERNAL void nlx_core_mem_free(void *data, size_t size, unsigned shift)
#define M0_LNET_NIDSTRS_GET
#define NLX_FREE_ALIGNED_PTR(ptr)
M0_INTERNAL int nlx_core_buf_active_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
struct m0t1fs_filedata * fd
enum m0_net_queue_type cb_qtype
static void nlx_core_fini(void)
#define M0_ASSERT_INFO(cond, fmt,...)
static bool nlx_core_tm_invariant(const struct nlx_core_transfer_mc *lctm)
struct nlx_core_domain * ddi_cd
static void nlx_core_bev_free_cb(struct nlx_core_bev_link *ql)
static struct bulkio_params * bp
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)
static bool nlx_ucore_tm_invariant(const struct nlx_ucore_transfer_mc *utm)
#define M0_LNET_BEV_BLESS
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 void nlx_core_tm_stop(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
#define M0_LNET_IOC_MAGIC
#define M0_LNET_IOC_MIN_NR
#define M0_LNET_BUF_MSG_RECV
M0_INTERNAL int nlx_core_buf_active_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
static unsigned nlx_ucore_nidstrs_thunk
M0_INTERNAL int nlx_core_nidstr_encode(struct nlx_core_domain *cd, uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
M0_INTERNAL void nlx_core_buf_deregister(struct nlx_core_domain *cd, struct nlx_core_buffer *cb)
M0_INTERNAL m0_time_t m0_time_to_realtime(m0_time_t abs_time)
#define M0_LNET_BUF_ACTIVE_RECV
int32_t ud_max_buffer_segments
M0_INTERNAL void * nlx_core_mem_alloc(size_t size, unsigned shift)
int nlx_core_buf_event_wait(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, m0_time_t timeout)