BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq, acr_nid) != 8);
BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq *)0)->acr_nid) != 8);
+ /* Checks for struct lnet_acceptor_connreq_v2 */
+ BUILD_BUG_ON((int)sizeof(struct lnet_acceptor_connreq_v2) != 28);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq_v2, acr_magic) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq_v2 *)0)->acr_magic) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq_v2, acr_version) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq_v2 *)0)->acr_version) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq_v2, acr_nid) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq_v2 *)0)->acr_nid) != 20);
+
/* Checks for struct lnet_counters_common */
BUILD_BUG_ON((int)sizeof(struct lnet_counters_common) != 60);
BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_msgs_alloc) != 0);
int
lnet_net_add_pref_rtr(struct lnet_net *net,
- lnet_nid_t gw_nid)
+ struct lnet_nid *gw_nid)
__must_hold(&the_lnet.ln_api_mutex)
{
struct lnet_nid_list *ne;
* lock.
*/
list_for_each_entry(ne, &net->net_rtr_pref_nids, nl_list) {
- if (ne->nl_nid == gw_nid)
+ if (nid_same(&ne->nl_nid, gw_nid))
return -EEXIST;
}
if (!ne)
return -ENOMEM;
- ne->nl_nid = gw_nid;
+ ne->nl_nid = *gw_nid;
/* Lock the cpt to protect against addition and checks in the
* selection algorithm
}
bool
-lnet_net_is_pref_rtr_locked(struct lnet_net *net, lnet_nid_t rtr_nid)
+lnet_net_is_pref_rtr_locked(struct lnet_net *net, struct lnet_nid *rtr_nid)
{
struct lnet_nid_list *ne;
- CDEBUG(D_NET, "%s: rtr pref emtpy: %d\n",
+ CDEBUG(D_NET, "%s: rtr pref empty: %d\n",
libcfs_net2str(net->net_id),
list_empty(&net->net_rtr_pref_nids));
list_for_each_entry(ne, &net->net_rtr_pref_nids, nl_list) {
CDEBUG(D_NET, "Comparing pref %s with gw %s\n",
- libcfs_nid2str(ne->nl_nid),
- libcfs_nid2str(rtr_nid));
- if (rtr_nid == ne->nl_nid)
+ libcfs_nidstr(&ne->nl_nid),
+ libcfs_nidstr(rtr_nid));
+ if (nid_same(rtr_nid, &ne->nl_nid))
return true;
}
}
int
-lnet_cpt_of_nid(lnet_nid_t nid4, struct lnet_ni *ni)
+lnet_nid2cpt(struct lnet_nid *nid, struct lnet_ni *ni)
{
int cpt;
int cpt2;
- struct lnet_nid nid;
if (LNET_CPT_NUMBER == 1)
return 0; /* the only one */
- lnet_nid4_to_nid(nid4, &nid);
cpt = lnet_net_lock_current();
- cpt2 = lnet_cpt_of_nid_locked(&nid, ni);
+ cpt2 = lnet_cpt_of_nid_locked(nid, ni);
lnet_net_unlock(cpt);
return cpt2;
}
+EXPORT_SYMBOL(lnet_nid2cpt);
+
+int
+lnet_cpt_of_nid(lnet_nid_t nid4, struct lnet_ni *ni)
+{
+ struct lnet_nid nid;
+
+ if (LNET_CPT_NUMBER == 1)
+ return 0; /* the only one */
+
+ lnet_nid4_to_nid(nid4, &nid);
+ return lnet_nid2cpt(&nid, ni);
+}
EXPORT_SYMBOL(lnet_cpt_of_nid);
int
EXPORT_SYMBOL(lnet_nid_to_ni_addref);
int
-lnet_islocalnid(lnet_nid_t nid)
+lnet_islocalnid4(lnet_nid_t nid)
{
struct lnet_ni *ni;
int cpt;
}
int
+lnet_islocalnid(struct lnet_nid *nid)
+{
+ struct lnet_ni *ni;
+ int cpt;
+
+ cpt = lnet_net_lock_current();
+ ni = lnet_nid_to_ni_locked(nid, cpt);
+ lnet_net_unlock(cpt);
+
+ return ni != NULL;
+}
+
+int
lnet_count_acceptor_nets(void)
{
/* Return the # of NIs that need the acceptor. */
struct lnet_handle_md *ping_mdh,
int ni_count, bool set_eq)
{
- struct lnet_process_id id = {
- .nid = LNET_NID_ANY,
+ struct lnet_processid id = {
+ .nid = LNET_ANY_NID,
.pid = LNET_PID_ANY
};
struct lnet_me *me;
}
/* Ping target ME/MD */
- me = LNetMEAttach(LNET_RESERVED_PORTAL, id,
+ me = LNetMEAttach(LNET_RESERVED_PORTAL, &id,
LNET_PROTO_PING_MATCHBITS, 0,
LNET_UNLINK, LNET_INS_AFTER);
if (IS_ERR(me)) {
int lnet_push_target_post(struct lnet_ping_buffer *pbuf,
struct lnet_handle_md *mdhp)
{
- struct lnet_process_id id = { LNET_NID_ANY, LNET_PID_ANY };
+ struct lnet_processid id = { LNET_ANY_NID, LNET_PID_ANY };
struct lnet_md md = { NULL };
struct lnet_me *me;
int rc;
- me = LNetMEAttach(LNET_RESERVED_PORTAL, id,
+ me = LNetMEAttach(LNET_RESERVED_PORTAL, &id,
LNET_PROTO_PING_MATCHBITS, 0,
LNET_UNLINK, LNET_INS_AFTER);
if (IS_ERR(me)) {
struct lnet_ioctl_config_data *config;
struct lnet_process_id id = {0};
struct lnet_ni *ni;
+ struct lnet_nid nid;
int rc;
BUILD_BUG_ON(sizeof(struct lnet_ioctl_net_config) +
config->cfg_config_u.cfg_route.rtr_sensitivity;
}
+ lnet_nid4_to_nid(config->cfg_nid, &nid);
mutex_lock(&the_lnet.ln_api_mutex);
rc = lnet_add_route(config->cfg_net,
config->cfg_config_u.cfg_route.rtr_hop,
- config->cfg_nid,
+ &nid,
config->cfg_config_u.cfg_route.
rtr_priority, sensitivity);
mutex_unlock(&the_lnet.ln_api_mutex);