Motr  M0
lnet_pvt.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_NET_LNET_PVT_H__
26 #define __MOTR_NET_LNET_PVT_H__
27 
33 /* forward references to other static functions */
34 static bool nlx_tm_invariant(const struct m0_net_transfer_mc *tm);
35 static void nlx_tm_ev_worker(struct m0_net_transfer_mc *tm);
36 static bool nlx_ep_invariant(const struct m0_net_end_point *ep);
37 static int nlx_ep_create(struct m0_net_end_point **epp,
38  struct m0_net_transfer_mc *tm,
39  const struct nlx_core_ep_addr *cepa);
40 static bool nlx_xo_buffer_bufvec_invariant(const struct m0_net_buffer *nb);
41 
45 static inline
47 {
48  struct nlx_xo_ep *xep;
50  xep = container_of(ep, struct nlx_xo_ep, xe_ep);
51  return &xep->xe_core;
52 }
53 
55  struct nlx_core_buffer_event *lcbev,
56  struct m0_net_buffer_event *nbev);
57 
58 static m0_time_t nlx_tm_get_buffer_timeout_tick(const struct
59  m0_net_transfer_mc *tm);
60 static int nlx_tm_timeout_buffers(struct m0_net_transfer_mc *tm, m0_time_t now);
61  /* LNetXODFS */
63 
69 /* forward references to other static functions */
70 static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *cb);
71 static bool nlx_core_tm_is_locked(const struct nlx_core_transfer_mc *ctm);
72 
76 static uint32_t nlx_core_kmem_loc_checksum(const struct nlx_core_kmem_loc *loc);
77 
81 static inline bool nlx_core_kmem_loc_invariant(
82  const struct nlx_core_kmem_loc *loc)
83 {
84  return _0C(loc != NULL) && _0C(loc->kl_page != NULL) &&
86 }
87 
91 static inline bool nlx_core_kmem_loc_is_empty(
92  const struct nlx_core_kmem_loc *loc)
93 {
94  return loc->kl_page == NULL &&
95  loc->kl_offset == 0 &&
96  loc->kl_checksum == 0;
97 }
98 
104 static inline bool nlx_core_kmem_loc_eq(const struct nlx_core_kmem_loc *a,
105  const struct nlx_core_kmem_loc *b)
106 {
107  if (a == NULL || b == NULL)
108  return a == b;
109  return a->kl_page == b->kl_page &&
110  a->kl_offset == b->kl_offset &&
111  a->kl_checksum == b->kl_checksum;
112 }
113 
121 static int nlx_core_nidstr_decode(struct nlx_core_domain *lcdom,
122  const char *nidstr,
123  uint64_t *nid);
124 
131 static int nlx_core_nidstr_encode(struct nlx_core_domain *lcdom,
132  uint64_t nid,
133  char nidstr[M0_NET_LNET_NIDSTR_SIZE]);
134  /* LNetCore */
136 
137 #endif /* __MOTR_NET_LNET_PVT_H__ */
138 
139 /*
140  * Local variables:
141  * c-indentation-style: "K&R"
142  * c-basic-offset: 8
143  * tab-width: 8
144  * fill-column: 80
145  * scroll-step: 1
146  * End:
147  */
#define M0_PRE(cond)
struct m0_net_end_point xe_ep
Definition: lnet_xo.h:57
#define NULL
Definition: misc.h:38
static int nlx_ep_create(struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const struct nlx_core_ep_addr *cepa)
static uint32_t nlx_core_kmem_loc_checksum(const struct nlx_core_kmem_loc *loc)
static bool nlx_xo_buffer_bufvec_invariant(const struct m0_net_buffer *nb)
uint64_t m0_time_t
Definition: time.h:37
struct page * kl_page
#define container_of(ptr, type, member)
Definition: misc.h:33
static void nlx_tm_ev_worker(struct m0_net_transfer_mc *tm)
static int nlx_core_nidstr_encode(struct nlx_core_domain *lcdom, uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
Definition: klnet_core.c:1732
static bool nlx_core_kmem_loc_eq(const struct nlx_core_kmem_loc *a, const struct nlx_core_kmem_loc *b)
Definition: lnet_pvt.h:104
Definition: sock.c:754
static struct nlx_core_ep_addr * nlx_ep_to_core(struct m0_net_end_point *ep)
Definition: lnet_pvt.h:46
static int nlx_xo_core_bev_to_net_bev(struct m0_net_transfer_mc *tm, struct nlx_core_buffer_event *lcbev, struct m0_net_buffer_event *nbev)
Definition: lnet_tm.c:240
static m0_time_t nlx_tm_get_buffer_timeout_tick(const struct m0_net_transfer_mc *tm)
static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *cb)
static bool nlx_ep_invariant(const struct m0_net_end_point *ep)
static bool nlx_tm_invariant(const struct m0_net_transfer_mc *tm)
static int nlx_core_nidstr_decode(struct nlx_core_domain *lcdom, const char *nidstr, uint64_t *nid)
Definition: klnet_core.c:1710
static int nlx_tm_timeout_buffers(struct m0_net_transfer_mc *tm, m0_time_t now)
static bool nlx_core_tm_is_locked(const struct nlx_core_transfer_mc *ctm)
#define _0C(exp)
Definition: assert.h:311
struct nlx_core_ep_addr xe_core
Definition: lnet_xo.h:60
static bool nlx_core_kmem_loc_invariant(const struct nlx_core_kmem_loc *loc)
Definition: lnet_pvt.h:81
static bool nlx_core_kmem_loc_is_empty(const struct nlx_core_kmem_loc *loc)
Definition: lnet_pvt.h:91