};
static bool
-lnet_fault_nid_match(lnet_nid_t nid, lnet_nid_t msg_nid)
+lnet_fault_nid_match(lnet_nid_t nid, struct lnet_nid *msg_nid)
{
- if (nid == msg_nid || nid == LNET_NID_ANY)
+ if (nid == LNET_NID_ANY)
+ return true;
+ if (!msg_nid)
+ return false;
+ if (lnet_nid_to_nid4(msg_nid) == nid)
return true;
- if (LNET_NIDNET(nid) != LNET_NIDNET(msg_nid))
+ if (LNET_NIDNET(nid) != LNET_NID_NET(msg_nid))
return false;
/* 255.255.255.255@net is wildcard for all addresses in a network */
}
static bool
-lnet_fault_attr_match(struct lnet_fault_attr *attr, lnet_nid_t src,
- lnet_nid_t local_nid, lnet_nid_t dst,
+lnet_fault_attr_match(struct lnet_fault_attr *attr,
+ struct lnet_nid *src,
+ struct lnet_nid *local_nid,
+ struct lnet_nid *dst,
unsigned int type, unsigned int portal)
{
if (!lnet_fault_nid_match(attr->fa_src, src) ||
* decide whether should drop this message or not
*/
static bool
-drop_rule_match(struct lnet_drop_rule *rule, lnet_nid_t src,
- lnet_nid_t local_nid, lnet_nid_t dst,
+drop_rule_match(struct lnet_drop_rule *rule,
+ struct lnet_nid *src,
+ struct lnet_nid *local_nid,
+ struct lnet_nid *dst,
unsigned int type, unsigned int portal,
enum lnet_msg_hstatus *hstatus)
{
*/
bool
lnet_drop_rule_match(struct lnet_hdr *hdr,
- lnet_nid_t local_nid,
+ struct lnet_nid *local_nid,
enum lnet_msg_hstatus *hstatus)
{
- lnet_nid_t src = le64_to_cpu(hdr->src_nid);
- lnet_nid_t dst = le64_to_cpu(hdr->dest_nid);
- unsigned int typ = le32_to_cpu(hdr->type);
+ unsigned int typ = hdr->type;
struct lnet_drop_rule *rule;
unsigned int ptl = -1;
bool drop = false;
cpt = lnet_net_lock_current();
list_for_each_entry(rule, &the_lnet.ln_drop_rules, dr_link) {
- drop = drop_rule_match(rule, src, local_nid, dst, typ, ptl,
+ drop = drop_rule_match(rule, &hdr->src_nid, local_nid,
+ &hdr->dest_nid, typ, ptl,
hstatus);
if (drop)
break;
* decide whether should delay this message or not
*/
static bool
-delay_rule_match(struct lnet_delay_rule *rule, lnet_nid_t src,
- lnet_nid_t dst, unsigned int type, unsigned int portal,
- struct lnet_msg *msg)
+delay_rule_match(struct lnet_delay_rule *rule, struct lnet_nid *src,
+ struct lnet_nid *dst, unsigned int type, unsigned int portal,
+ struct lnet_msg *msg)
{
struct lnet_fault_attr *attr = &rule->dl_attr;
bool delay;
time64_t now = ktime_get_seconds();
- if (!lnet_fault_attr_match(attr, src, LNET_NID_ANY,
+ if (!lnet_fault_attr_match(attr, src, NULL,
dst, type, portal))
return false;
lnet_delay_rule_match_locked(struct lnet_hdr *hdr, struct lnet_msg *msg)
{
struct lnet_delay_rule *rule;
- lnet_nid_t src = le64_to_cpu(hdr->src_nid);
- lnet_nid_t dst = le64_to_cpu(hdr->dest_nid);
- unsigned int typ = le32_to_cpu(hdr->type);
+ unsigned int typ = hdr->type;
unsigned int ptl = -1;
/* NB: called with hold of lnet_net_lock */
ptl = le32_to_cpu(hdr->msg.get.ptl_index);
list_for_each_entry(rule, &the_lnet.ln_delay_rules, dl_link) {
- if (delay_rule_match(rule, src, dst, typ, ptl, msg))
+ if (delay_rule_match(rule, &hdr->src_nid, &hdr->dest_nid,
+ typ, ptl, msg))
return true;
}
} else if (!list_empty(msg_list)) {
/* dequeued some timedout messages, update timer for the
* next delayed message on rule */
- msg = list_entry(rule->dl_msg_list.next,
- struct lnet_msg, msg_list);
+ msg = list_first_entry(&rule->dl_msg_list,
+ struct lnet_msg, msg_list);
rule->dl_msg_send = msg->msg_delay_send;
mod_timer(&rule->dl_timer,
jiffies +
{
struct lnet_msg *msg;
- while (!list_empty(msg_list)) {
+ while ((msg = list_first_entry_or_null(msg_list, struct lnet_msg,
+ msg_list)) != NULL) {
struct lnet_ni *ni;
int cpt;
int rc;
- msg = list_entry(msg_list->next, struct lnet_msg, msg_list);
-
if (msg->msg_sending) {
/* Delayed send */
list_del_init(&msg->msg_list);
ni = msg->msg_txni;
CDEBUG(D_NET, "TRACE: msg %p %s -> %s : %s\n", msg,
libcfs_nidstr(&ni->ni_nid),
- libcfs_nid2str(msg->msg_txpeer->lpni_nid),
+ libcfs_nidstr(&msg->msg_txpeer->lpni_nid),
lnet_msgtyp2str(msg->msg_type));
lnet_ni_send(ni, msg);
continue;
case LNET_CREDIT_OK:
lnet_ni_recv(ni, msg->msg_private, msg, 0,
0, msg->msg_len, msg->msg_len);
- /* fallthrough */
+ fallthrough;
case LNET_CREDIT_WAIT:
continue;
default: /* failures */
break;
}
- rule = list_entry(delay_dd.dd_sched_rules.next,
- struct lnet_delay_rule, dl_sched_link);
+ rule = list_first_entry(&delay_dd.dd_sched_rules,
+ struct lnet_delay_rule, dl_sched_link);
list_del_init(&rule->dl_sched_link);
spin_unlock_bh(&delay_dd.dd_lock);