Replace rtw_get_current_time() with jiffies

Port of c01fb49636b65ceea513c00966c58b8bdb095c8f
This commit is contained in:
Carlos Garces
2021-10-14 21:34:26 +02:00
parent 4032543691
commit 7a5f134424
40 changed files with 199 additions and 211 deletions

View File

@@ -269,7 +269,7 @@ void rtw_mesh_update_scanned_acnode_status(_adapter *adapter, struct wlan_networ
acnode = !nop && accept;
if (acnode && scanned->acnode_stime == 0) {
scanned->acnode_stime = rtw_get_current_time();
scanned->acnode_stime = jiffies;
if (scanned->acnode_stime == 0)
scanned->acnode_stime++;
} else if (!acnode) {
@@ -288,7 +288,7 @@ bool rtw_mesh_scanned_is_acnode_confirmed(_adapter *adapter, struct wlan_network
static bool rtw_mesh_scanned_is_acnode_allow_notify(_adapter *adapter, struct wlan_network *scanned)
{
return scanned->acnode_notify_etime
&& rtw_time_after(scanned->acnode_notify_etime, rtw_get_current_time());
&& rtw_time_after(scanned->acnode_notify_etime, jiffies);
}
bool rtw_mesh_acnode_prevent_allow_sacrifice(_adapter *adapter)
@@ -466,7 +466,7 @@ static void rtw_mesh_acnode_set_notify_etime(_adapter *adapter, u8 *rframe_whdr)
struct wlan_network *scanned = rtw_find_network(&adapter->mlmepriv.scanned_queue, get_addr2_ptr(rframe_whdr));
if (rtw_mesh_scanned_is_acnode_confirmed(adapter, scanned)) {
scanned->acnode_notify_etime = rtw_get_current_time()
scanned->acnode_notify_etime = jiffies
+ rtw_ms_to_systime(adapter->mesh_cfg.peer_sel_policy.acnode_notify_timeout_ms);
if (scanned->acnode_notify_etime == 0)
scanned->acnode_notify_etime++;
@@ -631,7 +631,7 @@ static void rtw_mesh_cto_mgate_blacklist_chk(_adapter *adapter)
ent = LIST_CONTAINOR(list, struct blacklist_ent, list);
list = get_next(list);
if (rtw_time_after(rtw_get_current_time(), ent->exp_time)) {
if (rtw_time_after(jiffies, ent->exp_time)) {
rtw_list_delete(&ent->list);
rtw_mfree(ent, sizeof(struct blacklist_ent));
continue;
@@ -2344,7 +2344,7 @@ void dump_mesh_plink_ctl(void *sel, _adapter *adapter)
#if CONFIG_RTW_MESH_PEER_BLACKLIST
if (!IS_PEER_CONF_DISABLED(ent)) {
if (!IS_PEER_CONF_TIMEOUT(ent))
RTW_PRINT_SEL(sel, "peer_conf:%d\n", rtw_systime_to_ms(ent->peer_conf_end_time - rtw_get_current_time()));
RTW_PRINT_SEL(sel, "peer_conf:%d\n", rtw_systime_to_ms(ent->peer_conf_end_time - jiffies));
else
RTW_PRINT_SEL(sel, "peer_conf:TIMEOUT\n");
}
@@ -2353,7 +2353,7 @@ void dump_mesh_plink_ctl(void *sel, _adapter *adapter)
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
if (!IS_CTO_MGATE_CONF_DISABLED(ent)) {
if (!IS_CTO_MGATE_CONF_TIMEOUT(ent))
RTW_PRINT_SEL(sel, "cto_mgate_conf:%d\n", rtw_systime_to_ms(ent->cto_mgate_conf_end_time - rtw_get_current_time()));
RTW_PRINT_SEL(sel, "cto_mgate_conf:%d\n", rtw_systime_to_ms(ent->cto_mgate_conf_end_time - jiffies));
else
RTW_PRINT_SEL(sel, "cto_mgate_conf:TIMEOUT\n");
}
@@ -2924,7 +2924,7 @@ static int rtw_mrc_check(_adapter *adapter, const u8 *msa, u32 seq)
idx = seq & mrc->idx_mask;
rtw_hlist_for_each_entry_safe(p, np, n, &mrc->bucket[idx], list) {
++entries;
timeout = rtw_time_after(rtw_get_current_time(), p->exp_time);
timeout = rtw_time_after(jiffies, p->exp_time);
if (timeout || entries == RTW_MRC_QUEUE_MAX_LEN) {
if (!timeout)
minfo->mshstats.mrc_del_qlen++;
@@ -2941,7 +2941,7 @@ static int rtw_mrc_check(_adapter *adapter, const u8 *msa, u32 seq)
return 0;
p->seqnum = seq;
p->exp_time = rtw_get_current_time() + rtw_ms_to_systime(RTW_MRC_TIMEOUT_MS);
p->exp_time = jiffies + rtw_ms_to_systime(RTW_MRC_TIMEOUT_MS);
memcpy(p->msa, msa, ETH_ALEN);
rtw_hlist_add_head(&p->list, &mrc->bucket[idx]);
return 0;
@@ -3081,9 +3081,9 @@ void rtw_mesh_init_mesh_info(_adapter *adapter)
rtw_mesh_plink_ctl_init(adapter);
minfo->last_preq = rtw_get_current_time();
/* minfo->last_sn_update = rtw_get_current_time(); */
minfo->next_perr = rtw_get_current_time();
minfo->last_preq = jiffies;
/* minfo->last_sn_update = jiffies; */
minfo->next_perr = jiffies;
atomic_set(&minfo->mpaths, 0);
rtw_mesh_pathtbl_init(adapter);
@@ -3213,7 +3213,7 @@ int rtw_mesh_nexthop_lookup(_adapter *adapter,
if (!mpath || !(mpath->flags & RTW_MESH_PATH_ACTIVE))
goto endlookup;
if (rtw_time_after(rtw_get_current_time(),
if (rtw_time_after(jiffies,
mpath->exp_time -
rtw_ms_to_systime(adapter->mesh_cfg.path_refresh_time)) &&
_rtw_memcmp(adapter_mac_addr(adapter), msa, ETH_ALEN) == _TRUE &&
@@ -3366,7 +3366,7 @@ int rtw_mesh_addr_resolve(_adapter *adapter, struct xmit_frame *xframe, _pkt *pk
if (mpp_lookup) {
mppath = rtw_mpp_path_lookup(adapter, etherhdr.h_dest);
if (mppath)
mppath->exp_time = rtw_get_current_time();
mppath->exp_time = jiffies;
}
if (mppath && mpath)
@@ -3801,7 +3801,7 @@ int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
enter_critical_bh(&mppath->state_lock);
if (_rtw_memcmp(mppath->mpp, mpp_addr, ETH_ALEN) == _FALSE)
memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
mppath->exp_time = rtw_get_current_time();
mppath->exp_time = jiffies;
exit_critical_bh(&mppath->state_lock);
}
rtw_rcu_read_unlock();

View File

@@ -155,11 +155,11 @@ enum rtw_mesh_deferred_task_flags {
#define RTW_MESH_PEER_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
#if CONFIG_RTW_MESH_PEER_BLACKLIST
#define IS_PEER_CONF_DISABLED(plink) ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED)
#define IS_PEER_CONF_TIMEOUT(plink)(!IS_PEER_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->peer_conf_end_time))
#define IS_PEER_CONF_TIMEOUT(plink)(!IS_PEER_CONF_DISABLED(plink) && rtw_time_after(jiffies, (plink)->peer_conf_end_time))
#define SET_PEER_CONF_DISABLED(plink) (plink)->peer_conf_end_time = RTW_MESH_PEER_CONF_DISABLED
#define SET_PEER_CONF_END_TIME(plink, timeout_ms) \
do { \
(plink)->peer_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
(plink)->peer_conf_end_time = jiffies + rtw_ms_to_systime(timeout_ms); \
if ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED) \
(plink)->peer_conf_end_time++; \
} while (0)
@@ -173,11 +173,11 @@ enum rtw_mesh_deferred_task_flags {
#define RTW_MESH_CTO_MGATE_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
#define IS_CTO_MGATE_CONF_DISABLED(plink) ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED)
#define IS_CTO_MGATE_CONF_TIMEOUT(plink)(!IS_CTO_MGATE_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->cto_mgate_conf_end_time))
#define IS_CTO_MGATE_CONF_TIMEOUT(plink)(!IS_CTO_MGATE_CONF_DISABLED(plink) && rtw_time_after(jiffies, (plink)->cto_mgate_conf_end_time))
#define SET_CTO_MGATE_CONF_DISABLED(plink) (plink)->cto_mgate_conf_end_time = RTW_MESH_CTO_MGATE_CONF_DISABLED
#define SET_CTO_MGATE_CONF_END_TIME(plink, timeout_ms) \
do { \
(plink)->cto_mgate_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
(plink)->cto_mgate_conf_end_time = jiffies + rtw_ms_to_systime(timeout_ms); \
if ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED) \
(plink)->cto_mgate_conf_end_time++; \
} while (0)

View File

@@ -146,7 +146,7 @@ static inline u16 rtw_u16_field_get(const u8 *preq_elem, int shift, BOOLEAN ae)
#define RTW_PERR_IE_TARGET_RCODE(x) rtw_u16_field_get(x, 13, 0)
#define RTW_TU_TO_SYSTIME(x) (rtw_us_to_systime((x) * 1024))
#define RTW_TU_TO_EXP_TIME(x) (rtw_get_current_time() + RTW_TU_TO_SYSTIME(x))
#define RTW_TU_TO_EXP_TIME(x) (jiffies + RTW_TU_TO_SYSTIME(x))
#define RTW_MSEC_TO_TU(x) (x*1000/1024)
#define RTW_SN_GT(x, y) ((s32)(y - x) < 0)
#define RTW_SN_LT(x, y) ((s32)(x - y) < 0)
@@ -335,7 +335,7 @@ int rtw_mesh_path_error_tx(_adapter *adapter,
u8 *pos, ie_len;
u16 *fctrl = NULL;
if (rtw_time_before(rtw_get_current_time(), minfo->next_perr))
if (rtw_time_before(jiffies, minfo->next_perr))
return -1;
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
@@ -669,11 +669,11 @@ static void rtw_hwmp_preq_frame_process(_adapter *adapter,
reply = _TRUE;
to_gate_ask = 1;
target_metric = 0;
if (rtw_time_after(rtw_get_current_time(), minfo->last_sn_update +
if (rtw_time_after(jiffies, minfo->last_sn_update +
rtw_net_traversal_jiffies(adapter)) ||
rtw_time_before(rtw_get_current_time(), minfo->last_sn_update)) {
rtw_time_before(jiffies, minfo->last_sn_update)) {
++minfo->sn;
minfo->last_sn_update = rtw_get_current_time();
minfo->last_sn_update = jiffies;
}
target_sn = minfo->sn;
} else if (is_broadcast_mac_addr(target_addr) &&
@@ -686,7 +686,7 @@ static void rtw_hwmp_preq_frame_process(_adapter *adapter,
target_addr = adapter_mac_addr(adapter);
target_sn = ++minfo->sn;
target_metric = 0;
minfo->last_sn_update = rtw_get_current_time();
minfo->last_sn_update = jiffies;
}
if (preq_is_gate) {
@@ -998,9 +998,9 @@ static void rtw_hwmp_rann_frame_process(_adapter *adapter,
}
if ((!(path->flags & (RTW_MESH_PATH_ACTIVE | RTW_MESH_PATH_RESOLVING)) ||
(rtw_time_after(rtw_get_current_time(), path->last_preq_to_root +
(rtw_time_after(jiffies, path->last_preq_to_root +
rtw_root_path_confirmation_jiffies(adapter)) ||
rtw_time_before(rtw_get_current_time(), path->last_preq_to_root))) &&
rtw_time_before(jiffies, path->last_preq_to_root))) &&
!(path->flags & RTW_MESH_PATH_FIXED) && (ttl != 0)) {
u8 preq_node_flag = RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH;
@@ -1022,7 +1022,7 @@ static void rtw_hwmp_rann_frame_process(_adapter *adapter,
}
#endif
rtw_mesh_queue_preq(path, preq_node_flag);
path->last_preq_to_root = rtw_get_current_time();
path->last_preq_to_root = jiffies;
}
path->sn = originator_sn;
@@ -1325,12 +1325,12 @@ void rtw_mesh_queue_preq(struct rtw_mesh_path *path, u8 flags)
++minfo->preq_queue_len;
exit_critical_bh(&minfo->mesh_preq_queue_lock);
if (rtw_time_after(rtw_get_current_time(), minfo->last_preq + rtw_min_preq_int_jiff(adapter)))
if (rtw_time_after(jiffies, minfo->last_preq + rtw_min_preq_int_jiff(adapter)))
rtw_mesh_work(&adapter->mesh_work);
else if (rtw_time_before(rtw_get_current_time(), minfo->last_preq)) {
else if (rtw_time_before(jiffies, minfo->last_preq)) {
/* systime wrapped around issue */
minfo->last_preq = rtw_get_current_time() - rtw_min_preq_int_jiff(adapter) - 1;
minfo->last_preq = jiffies - rtw_min_preq_int_jiff(adapter) - 1;
rtw_mesh_work(&adapter->mesh_work);
} else
rtw_mod_timer(&adapter->mesh_path_timer, minfo->last_preq +
@@ -1372,7 +1372,7 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
enter_critical_bh(&minfo->mesh_preq_queue_lock);
if (!minfo->preq_queue_len ||
rtw_time_before(rtw_get_current_time(), minfo->last_preq +
rtw_time_before(jiffies, minfo->last_preq +
rtw_min_preq_int_jiff(adapter))) {
exit_critical_bh(&minfo->mesh_preq_queue_lock);
return;
@@ -1412,13 +1412,13 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
goto enddiscovery;
}
minfo->last_preq = rtw_get_current_time();
minfo->last_preq = jiffies;
if (rtw_time_after(rtw_get_current_time(), minfo->last_sn_update +
if (rtw_time_after(jiffies, minfo->last_sn_update +
rtw_net_traversal_jiffies(adapter)) ||
rtw_time_before(rtw_get_current_time(), minfo->last_sn_update)) {
rtw_time_before(jiffies, minfo->last_sn_update)) {
++minfo->sn;
minfo->last_sn_update = rtw_get_current_time();
minfo->last_sn_update = jiffies;
}
lifetime = rtw_default_lifetime(adapter);
ttl = mshcfg->element_ttl;
@@ -1448,7 +1448,7 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
rtw_mesh_path_sel_frame_tx(RTW_MPATH_PREQ, flags, adapter_mac_addr(adapter), minfo->sn,
target_flags, path->dst, path->sn, da, 0,
ttl, lifetime, 0, minfo->preq_id++, adapter);
rtw_mod_timer(&path->timer, rtw_get_current_time() + path->discovery_timeout);
rtw_mod_timer(&path->timer, jiffies + path->discovery_timeout);
enddiscovery:
rtw_rcu_read_unlock();
@@ -1496,7 +1496,7 @@ void rtw_mesh_path_timer(void *ctx)
RTW_MESH_PATH_REQ_QUEUED |
RTW_MESH_PATH_ROOT_ADD_CHK |
RTW_MESH_PATH_PEER_AKA);
path->exp_time = rtw_get_current_time();
path->exp_time = jiffies;
exit_critical_bh(&path->state_lock);
if (!path->is_gate && rtw_mesh_gate_num(adapter) > 0) {
ret = rtw_mesh_path_send_to_gates(path);
@@ -1602,7 +1602,7 @@ void rtw_mesh_work_hdl(_workitem *work)
_adapter *adapter = container_of(work, _adapter, mesh_work);
while(adapter->mesh_info.preq_queue_len) {
if (rtw_time_after(rtw_get_current_time(),
if (rtw_time_after(jiffies,
adapter->mesh_info.last_preq + rtw_min_preq_int_jiff(adapter)))
/* It will consume preq_queue_len */
rtw_mesh_path_start_discovery(adapter);

View File

@@ -61,7 +61,7 @@ static const rtw_rhashtable_params rtw_mesh_rht_params = {
static inline bool rtw_mpath_expired(struct rtw_mesh_path *mpath)
{
return (mpath->flags & RTW_MESH_PATH_ACTIVE) &&
rtw_time_after(rtw_get_current_time(), mpath->exp_time) &&
rtw_time_after(jiffies, mpath->exp_time) &&
!(mpath->flags & RTW_MESH_PATH_FIXED);
}
@@ -359,7 +359,7 @@ int rtw_mesh_path_add_gate(struct rtw_mesh_path *mpath)
enter_critical_bh(&mpath->state_lock);
mcfg = &mpath->adapter->mesh_cfg;
mpath->gate_timeout = rtw_get_current_time() +
mpath->gate_timeout = jiffies +
rtw_ms_to_systime(mcfg->path_gate_timeout_factor *
mpath->gate_ann_int);
if (mpath->is_gate) {
@@ -551,7 +551,7 @@ struct rtw_mesh_path *rtw_mesh_path_new(_adapter *adapter,
new_mpath->gate_asked = false;
_rtw_init_queue(&new_mpath->frame_queue);
new_mpath->frame_queue_len = 0;
new_mpath->exp_time = rtw_get_current_time();
new_mpath->exp_time = jiffies;
_rtw_spinlock_init(&new_mpath->state_lock);
rtw_init_timer(&new_mpath->timer, adapter, rtw_mesh_path_timer, new_mpath);
@@ -1134,21 +1134,21 @@ void rtw_mesh_path_tbl_expire(_adapter *adapter,
break;
if ((!(mpath->flags & RTW_MESH_PATH_RESOLVING)) &&
(!(mpath->flags & RTW_MESH_PATH_FIXED)) &&
rtw_time_after(rtw_get_current_time(), mpath->exp_time + RTW_MESH_PATH_EXPIRE))
rtw_time_after(jiffies, mpath->exp_time + RTW_MESH_PATH_EXPIRE))
__rtw_mesh_path_del(tbl, mpath);
if (mpath->is_gate && /* need not to deal with non-gate case */
rtw_time_after(rtw_get_current_time(), mpath->gate_timeout)) {
rtw_time_after(jiffies, mpath->gate_timeout)) {
RTW_MPATH_DBG(FUNC_ADPT_FMT"mpath [%pM] expired systime is %lu systime is %lu\n",
FUNC_ADPT_ARG(adapter), mpath->dst,
mpath->gate_timeout, rtw_get_current_time());
mpath->gate_timeout, jiffies);
enter_critical_bh(&mpath->state_lock);
if (mpath->gate_asked) { /* asked gate before */
rtw_mesh_gate_del(tbl, mpath);
exit_critical_bh(&mpath->state_lock);
} else {
mpath->gate_asked = true;
mpath->gate_timeout = rtw_get_current_time() + rtw_ms_to_systime(mpath->gate_ann_int);
mpath->gate_timeout = jiffies + rtw_ms_to_systime(mpath->gate_ann_int);
exit_critical_bh(&mpath->state_lock);
rtw_mesh_queue_preq(mpath, RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH);
RTW_MPATH_DBG(FUNC_ADPT_FMT"mpath [%pM] ask mesh gate existence (is_root=%d)\n",