Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-10391 lnet: discard some peer_ni lookup functions
[fs/lustre-release.git]
/
lnet
/
lnet
/
lib-ptl.c
diff --git
a/lnet/lnet/lib-ptl.c
b/lnet/lnet/lib-ptl.c
index
75a352d
..
cbe7a30
100644
(file)
--- a/
lnet/lnet/lib-ptl.c
+++ b/
lnet/lnet/lib-ptl.c
@@
-25,7
+25,6
@@
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lnet/lnet/lib-ptl.c
*
*
* lnet/lnet/lib-ptl.c
*
@@
-44,15
+43,15
@@
module_param(portal_rotor, int, 0644);
MODULE_PARM_DESC(portal_rotor, "redirect PUTs to different cpu-partitions");
static int
MODULE_PARM_DESC(portal_rotor, "redirect PUTs to different cpu-partitions");
static int
-lnet_ptl_match_type(unsigned int index, struct lnet_process
_id
match_id,
+lnet_ptl_match_type(unsigned int index, struct lnet_process
id *
match_id,
__u64 mbits, __u64 ignore_bits)
{
struct lnet_portal *ptl = the_lnet.ln_portals[index];
int unique;
__u64 mbits, __u64 ignore_bits)
{
struct lnet_portal *ptl = the_lnet.ln_portals[index];
int unique;
- unique = ignore_bits == 0 &&
-
match_id.nid != LNET_NID_ANY
&&
-
match_id.pid != LNET_PID_ANY
;
+ unique =
(
ignore_bits == 0 &&
+
!LNET_NID_IS_ANY(&match_id->nid)
&&
+
match_id->pid != LNET_PID_ANY)
;
LASSERT(!lnet_ptl_is_unique(ptl) || !lnet_ptl_is_wildcard(ptl));
LASSERT(!lnet_ptl_is_unique(ptl) || !lnet_ptl_is_wildcard(ptl));
@@
-154,8
+153,8
@@
lnet_try_match_md(struct lnet_libmd *md,
return LNET_MATCHMD_NONE;
/* mismatched ME nid/pid? */
return LNET_MATCHMD_NONE;
/* mismatched ME nid/pid? */
- if (
me->me_match_id.nid != LNET_NID_ANY
&&
-
me->me_match_id.nid != info->mi_id.nid
)
+ if (
!LNET_NID_IS_ANY(&me->me_match_id.nid)
&&
+
!nid_same(&me->me_match_id.nid, &info->mi_id.nid)
)
return LNET_MATCHMD_NONE;
if (me->me_match_id.pid != LNET_PID_ANY &&
return LNET_MATCHMD_NONE;
if (me->me_match_id.pid != LNET_PID_ANY &&
@@
-186,7
+185,7
@@
lnet_try_match_md(struct lnet_libmd *md,
/* this packet _really_ is too big */
CERROR("Matching packet from %s, match %llu"
" length %d too big: %d left, %d allowed\n",
/* this packet _really_ is too big */
CERROR("Matching packet from %s, match %llu"
" length %d too big: %d left, %d allowed\n",
- libcfs_id
2str(
info->mi_id), info->mi_mbits,
+ libcfs_id
str(&
info->mi_id), info->mi_mbits,
info->mi_rlength, md->md_length - offset, mlength);
return LNET_MATCHMD_DROP;
info->mi_rlength, md->md_length - offset, mlength);
return LNET_MATCHMD_DROP;
@@
-196,7
+195,7
@@
lnet_try_match_md(struct lnet_libmd *md,
CDEBUG(D_NET, "Incoming %s index %x from %s of "
"length %d/%d into md %#llx [%d] + %d\n",
(info->mi_opc == LNET_MD_OP_PUT) ? "put" : "get",
CDEBUG(D_NET, "Incoming %s index %x from %s of "
"length %d/%d into md %#llx [%d] + %d\n",
(info->mi_opc == LNET_MD_OP_PUT) ? "put" : "get",
- info->mi_portal, libcfs_id
2str(
info->mi_id), mlength,
+ info->mi_portal, libcfs_id
str(&
info->mi_id), mlength,
info->mi_rlength, md->md_lh.lh_cookie, md->md_niov, offset);
lnet_msg_attach_md(msg, md, offset, mlength);
info->mi_rlength, md->md_lh.lh_cookie, md->md_niov, offset);
lnet_msg_attach_md(msg, md, offset, mlength);
@@
-215,18
+214,18
@@
lnet_try_match_md(struct lnet_libmd *md,
}
static struct lnet_match_table *
}
static struct lnet_match_table *
-lnet_match2mt(struct lnet_portal *ptl, struct lnet_process
_id
id, __u64 mbits)
+lnet_match2mt(struct lnet_portal *ptl, struct lnet_process
id *
id, __u64 mbits)
{
if (LNET_CPT_NUMBER == 1)
return ptl->ptl_mtables[0]; /* the only one */
/* if it's a unique portal, return match-table hashed by NID */
return lnet_ptl_is_unique(ptl) ?
{
if (LNET_CPT_NUMBER == 1)
return ptl->ptl_mtables[0]; /* the only one */
/* if it's a unique portal, return match-table hashed by NID */
return lnet_ptl_is_unique(ptl) ?
- ptl->ptl_mtables[lnet_
cpt_of_nid(id.
nid, NULL)] : NULL;
+ ptl->ptl_mtables[lnet_
nid2cpt(&id->
nid, NULL)] : NULL;
}
struct lnet_match_table *
}
struct lnet_match_table *
-lnet_mt_of_attach(unsigned int index, struct lnet_process
_id
id,
+lnet_mt_of_attach(unsigned int index, struct lnet_process
id *
id,
__u64 mbits, __u64 ignore_bits, enum lnet_ins_pos pos)
{
struct lnet_portal *ptl;
__u64 mbits, __u64 ignore_bits, enum lnet_ins_pos pos)
{
struct lnet_portal *ptl;
@@
-275,13
+274,13
@@
lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg)
LASSERT(lnet_ptl_is_wildcard(ptl) || lnet_ptl_is_unique(ptl));
LASSERT(lnet_ptl_is_wildcard(ptl) || lnet_ptl_is_unique(ptl));
- mtable = lnet_match2mt(ptl, info->mi_id, info->mi_mbits);
+ mtable = lnet_match2mt(ptl,
&
info->mi_id, info->mi_mbits);
if (mtable != NULL)
return mtable;
/* it's a wildcard portal */
if (mtable != NULL)
return mtable;
/* it's a wildcard portal */
- routed = LNET_NID
NET(
msg->msg_hdr.src_nid) !=
- LNET_NID
NET(
msg->msg_hdr.dest_nid);
+ routed = LNET_NID
_NET(&
msg->msg_hdr.src_nid) !=
+ LNET_NID
_NET(&
msg->msg_hdr.dest_nid);
if (portal_rotor == LNET_PTL_ROTOR_OFF ||
(portal_rotor != LNET_PTL_ROTOR_ON && !routed)) {
if (portal_rotor == LNET_PTL_ROTOR_OFF ||
(portal_rotor != LNET_PTL_ROTOR_ON && !routed)) {
@@
-356,14
+355,14
@@
lnet_mt_set_exhausted(struct lnet_match_table *mtable, int pos, int exhausted)
struct list_head *
lnet_mt_match_head(struct lnet_match_table *mtable,
struct list_head *
lnet_mt_match_head(struct lnet_match_table *mtable,
- struct lnet_process
_id
id, __u64 mbits)
+ struct lnet_process
id *
id, __u64 mbits)
{
struct lnet_portal *ptl = the_lnet.ln_portals[mtable->mt_portal];
if (lnet_ptl_is_wildcard(ptl)) {
return &mtable->mt_mhash[mbits & LNET_MT_HASH_MASK];
} else {
{
struct lnet_portal *ptl = the_lnet.ln_portals[mtable->mt_portal];
if (lnet_ptl_is_wildcard(ptl)) {
return &mtable->mt_mhash[mbits & LNET_MT_HASH_MASK];
} else {
- unsigned long hash = mbits +
id.nid + id.
pid;
+ unsigned long hash = mbits +
nidhash(&id->nid) + id->
pid;
LASSERT(lnet_ptl_is_unique(ptl));
hash = hash_long(hash, LNET_MT_HASH_BITS);
LASSERT(lnet_ptl_is_unique(ptl));
hash = hash_long(hash, LNET_MT_HASH_BITS);
@@
-385,7
+384,8
@@
lnet_mt_match_md(struct lnet_match_table *mtable,
if (!list_empty(&mtable->mt_mhash[LNET_MT_HASH_IGNORE]))
head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE];
else
if (!list_empty(&mtable->mt_mhash[LNET_MT_HASH_IGNORE]))
head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE];
else
- head = lnet_mt_match_head(mtable, info->mi_id, info->mi_mbits);
+ head = lnet_mt_match_head(mtable, &info->mi_id,
+ info->mi_mbits);
again:
/* NB: only wildcard portal needs to return LNET_MATCHMD_EXHAUSTED */
if (lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]))
again:
/* NB: only wildcard portal needs to return LNET_MATCHMD_EXHAUSTED */
if (lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]))
@@
-416,7
+416,8
@@
lnet_mt_match_md(struct lnet_match_table *mtable,
}
if (exhausted == 0 && head == &mtable->mt_mhash[LNET_MT_HASH_IGNORE]) {
}
if (exhausted == 0 && head == &mtable->mt_mhash[LNET_MT_HASH_IGNORE]) {
- head = lnet_mt_match_head(mtable, info->mi_id, info->mi_mbits);
+ head = lnet_mt_match_head(mtable, &info->mi_id,
+ info->mi_mbits);
goto again; /* re-check MEs w/o ignore-bits */
}
goto again; /* re-check MEs w/o ignore-bits */
}
@@
-566,8
+567,9
@@
lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg)
struct lnet_portal *ptl;
int rc;
struct lnet_portal *ptl;
int rc;
- CDEBUG(D_NET, "Request from %s of length %d into portal %d "
- "MB=%#llx\n", libcfs_id2str(info->mi_id),
+ CDEBUG(D_NET,
+ "Request from %s of length %d into portal %d MB=%#llx\n",
+ libcfs_idstr(&info->mi_id),
info->mi_rlength, info->mi_portal, info->mi_mbits);
if (info->mi_portal >= the_lnet.ln_nportals) {
info->mi_rlength, info->mi_portal, info->mi_mbits);
if (info->mi_portal >= the_lnet.ln_nportals) {
@@
-625,7
+627,7
@@
lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg)
CDEBUG(D_NET,
"Delaying %s from %s ptl %d MB %#llx off %d len %d\n",
info->mi_opc == LNET_MD_OP_PUT ? "PUT" : "GET",
CDEBUG(D_NET,
"Delaying %s from %s ptl %d MB %#llx off %d len %d\n",
info->mi_opc == LNET_MD_OP_PUT ? "PUT" : "GET",
- libcfs_id
2str(
info->mi_id), info->mi_portal,
+ libcfs_id
str(&
info->mi_id), info->mi_portal,
info->mi_mbits, info->mi_roffset, info->mi_rlength);
}
goto out0;
info->mi_mbits, info->mi_roffset, info->mi_rlength);
}
goto out0;
@@
-683,7
+685,7
@@
lnet_ptl_attach_md(struct lnet_me *me, struct lnet_libmd *md,
hdr = &msg->msg_hdr;
/* Multi-Rail: Primary peer NID */
hdr = &msg->msg_hdr;
/* Multi-Rail: Primary peer NID */
- info.mi_id.nid = msg->msg_initiator;
+ info.mi_id.nid = msg->msg_initiator;
info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_PUT;
info.mi_portal = hdr->msg.put.ptl_index;
info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_PUT;
info.mi_portal = hdr->msg.put.ptl_index;
@@
-716,7
+718,7
@@
lnet_ptl_attach_md(struct lnet_me *me, struct lnet_libmd *md,
CDEBUG(D_NET, "Resuming delayed PUT from %s portal %d "
"match %llu offset %d length %d.\n",
CDEBUG(D_NET, "Resuming delayed PUT from %s portal %d "
"match %llu offset %d length %d.\n",
- libcfs_id
2str(
info.mi_id),
+ libcfs_id
str(&
info.mi_id),
info.mi_portal, info.mi_mbits,
info.mi_roffset, info.mi_rlength);
} else {
info.mi_portal, info.mi_mbits,
info.mi_roffset, info.mi_rlength);
} else {
@@
-768,11
+770,14
@@
lnet_ptl_cleanup(struct lnet_portal *ptl)
struct lnet_me, me_list);
CERROR("Active ME %p on exit\n", me);
list_del(&me->me_list);
struct lnet_me, me_list);
CERROR("Active ME %p on exit\n", me);
list_del(&me->me_list);
- lnet_me_free(me);
+ CDEBUG(D_MALLOC,
+ "slab-freed 'me' at %p in cleanup.\n",
+ me);
+ kmem_cache_free(lnet_mes_cachep, me);
}
}
/* the extra entry is for MEs with ignore bits */
}
}
/* the extra entry is for MEs with ignore bits */
-
LIBCFS_FREE(mhash, sizeof(*mhash) * (LNET_MT_HASH_SIZE + 1)
);
+
CFS_FREE_PTR_ARRAY(mhash, LNET_MT_HASH_SIZE + 1
);
}
cfs_percpt_free(ptl->ptl_mtables);
}
cfs_percpt_free(ptl->ptl_mtables);
@@
-825,6
+830,7
@@
lnet_ptl_setup(struct lnet_portal *ptl, int index)
return -ENOMEM;
}
return -ENOMEM;
}
+#define PORTAL_SIZE (offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]))
void
lnet_portals_destroy(void)
{
void
lnet_portals_destroy(void)
{
@@
-834,29
+840,31
@@
lnet_portals_destroy(void)
return;
for (i = 0; i < the_lnet.ln_nportals; i++)
return;
for (i = 0; i < the_lnet.ln_nportals; i++)
- lnet_ptl_cleanup(the_lnet.ln_portals[i]);
+ if (the_lnet.ln_portals[i]) {
+ lnet_ptl_cleanup(the_lnet.ln_portals[i]);
+ LIBCFS_FREE(the_lnet.ln_portals[i], PORTAL_SIZE);
+ }
-
cfs_array_free(the_lnet.ln_
portals);
+
CFS_FREE_PTR_ARRAY(the_lnet.ln_portals, the_lnet.ln_n
portals);
the_lnet.ln_portals = NULL;
}
int
lnet_portals_create(void)
{
the_lnet.ln_portals = NULL;
}
int
lnet_portals_create(void)
{
- int size;
int i;
int i;
- size = offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]);
-
the_lnet.ln_nportals = MAX_PORTALS;
the_lnet.ln_nportals = MAX_PORTALS;
-
the_lnet.ln_portals = cfs_array_alloc(the_lnet.ln_nportals, size
);
+
CFS_ALLOC_PTR_ARRAY(the_lnet.ln_portals, the_lnet.ln_nportals
);
if (the_lnet.ln_portals == NULL) {
CERROR("Failed to allocate portals table\n");
return -ENOMEM;
}
for (i = 0; i < the_lnet.ln_nportals; i++) {
if (the_lnet.ln_portals == NULL) {
CERROR("Failed to allocate portals table\n");
return -ENOMEM;
}
for (i = 0; i < the_lnet.ln_nportals; i++) {
- if (lnet_ptl_setup(the_lnet.ln_portals[i], i)) {
+ LIBCFS_ALLOC(the_lnet.ln_portals[i], PORTAL_SIZE);
+ if (!the_lnet.ln_portals[i] ||
+ lnet_ptl_setup(the_lnet.ln_portals[i], i)) {
lnet_portals_destroy();
return -ENOMEM;
}
lnet_portals_destroy();
return -ENOMEM;
}
@@
-920,7
+928,7
@@
int
lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason)
{
struct lnet_portal *ptl;
lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason)
{
struct lnet_portal *ptl;
-
struct list_head zombies = LIST_HEAD_INIT
(zombies);
+
LIST_HEAD
(zombies);
if (portal < 0 || portal >= the_lnet.ln_nportals)
return -EINVAL;
if (portal < 0 || portal >= the_lnet.ln_nportals)
return -EINVAL;