Remove wrappers

Port of 788253860c21f4e40add556d7ed715fefb2bafb3
Port of ace050139cee44d06b06b4c78074b4eb80fb7c0a
This commit is contained in:
Carlos Garces 2021-10-14 22:19:09 +02:00
parent 5ac00c9dc2
commit bb871e7167
13 changed files with 43 additions and 75 deletions

View File

@ -467,7 +467,7 @@ static void rtw_mesh_acnode_set_notify_etime(_adapter *adapter, u8 *rframe_whdr)
if (rtw_mesh_scanned_is_acnode_confirmed(adapter, scanned)) {
scanned->acnode_notify_etime = jiffies
+ rtw_ms_to_systime(adapter->mesh_cfg.peer_sel_policy.acnode_notify_timeout_ms);
+ msecs_to_jiffies(adapter->mesh_cfg.peer_sel_policy.acnode_notify_timeout_ms);
if (scanned->acnode_notify_etime == 0)
scanned->acnode_notify_etime++;
}
@ -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 - jiffies));
RTW_PRINT_SEL(sel, "peer_conf:%d\n", jiffies_to_msecs(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 - jiffies));
RTW_PRINT_SEL(sel, "cto_mgate_conf:%d\n", jiffies_to_msecs(ent->cto_mgate_conf_end_time - jiffies));
else
RTW_PRINT_SEL(sel, "cto_mgate_conf:TIMEOUT\n");
}
@ -2941,7 +2941,7 @@ static int rtw_mrc_check(_adapter *adapter, const u8 *msa, u32 seq)
return 0;
p->seqnum = seq;
p->exp_time = jiffies + rtw_ms_to_systime(RTW_MRC_TIMEOUT_MS);
p->exp_time = jiffies + msecs_to_jiffies(RTW_MRC_TIMEOUT_MS);
memcpy(p->msa, msa, ETH_ALEN);
rtw_hlist_add_head(&p->list, &mrc->bucket[idx]);
return 0;
@ -3215,7 +3215,7 @@ int rtw_mesh_nexthop_lookup(_adapter *adapter,
if (rtw_time_after(jiffies,
mpath->exp_time -
rtw_ms_to_systime(adapter->mesh_cfg.path_refresh_time)) &&
msecs_to_jiffies(adapter->mesh_cfg.path_refresh_time)) &&
_rtw_memcmp(adapter_mac_addr(adapter), msa, ETH_ALEN) == _TRUE &&
!(mpath->flags & RTW_MESH_PATH_RESOLVING) &&
!(mpath->flags & RTW_MESH_PATH_FIXED)) {

View File

@ -159,7 +159,7 @@ enum rtw_mesh_deferred_task_flags {
#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 = jiffies + rtw_ms_to_systime(timeout_ms); \
(plink)->peer_conf_end_time = jiffies + msecs_to_jiffies(timeout_ms); \
if ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED) \
(plink)->peer_conf_end_time++; \
} while (0)
@ -177,7 +177,7 @@ enum rtw_mesh_deferred_task_flags {
#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 = jiffies + rtw_ms_to_systime(timeout_ms); \
(plink)->cto_mgate_conf_end_time = jiffies + msecs_to_jiffies(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

@ -145,7 +145,7 @@ static inline u16 rtw_u16_field_get(const u8 *preq_elem, int shift, BOOLEAN ae)
#define RTW_PERR_IE_TARGET_SN(x) rtw_u32_field_get(x, 9, 0)
#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_SYSTIME(x) (usecs_to_jiffies((x) * 1024))
#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)
@ -158,16 +158,16 @@ static inline u32 RTW_SN_DELTA(u32 x, u32 y)
}
#define rtw_net_traversal_jiffies(adapter) \
rtw_ms_to_systime(adapter->mesh_cfg.dot11MeshHWMPnetDiameterTraversalTime)
msecs_to_jiffies(adapter->mesh_cfg.dot11MeshHWMPnetDiameterTraversalTime)
#define rtw_default_lifetime(adapter) \
RTW_MSEC_TO_TU(adapter->mesh_cfg.dot11MeshHWMPactivePathTimeout)
#define rtw_min_preq_int_jiff(adapter) \
(rtw_ms_to_systime(adapter->mesh_cfg.dot11MeshHWMPpreqMinInterval))
(msecs_to_jiffies(adapter->mesh_cfg.dot11MeshHWMPpreqMinInterval))
#define rtw_max_preq_retries(adapter) (adapter->mesh_cfg.dot11MeshHWMPmaxPREQretries)
#define rtw_disc_timeout_jiff(adapter) \
rtw_ms_to_systime(adapter->mesh_cfg.min_discovery_timeout)
msecs_to_jiffies(adapter->mesh_cfg.min_discovery_timeout)
#define rtw_root_path_confirmation_jiffies(adapter) \
rtw_ms_to_systime(adapter->mesh_cfg.dot11MeshHWMPconfirmationInterval)
msecs_to_jiffies(adapter->mesh_cfg.dot11MeshHWMPconfirmationInterval)
static inline BOOLEAN rtw_ether_addr_equal(const u8 *addr1, const u8 *addr2)
{

View File

@ -360,7 +360,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 = jiffies +
rtw_ms_to_systime(mcfg->path_gate_timeout_factor *
msecs_to_jiffies(mcfg->path_gate_timeout_factor *
mpath->gate_ann_int);
if (mpath->is_gate) {
err = -EEXIST;
@ -1148,7 +1148,7 @@ void rtw_mesh_path_tbl_expire(_adapter *adapter,
exit_critical_bh(&mpath->state_lock);
} else {
mpath->gate_asked = true;
mpath->gate_timeout = jiffies + rtw_ms_to_systime(mpath->gate_ann_int);
mpath->gate_timeout = jiffies + msecs_to_jiffies(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",

View File

@ -472,8 +472,8 @@ u32 rtw_chset_get_ch_non_ocp_ms(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8 offset
if (lo <= rtw_ch2freq(ch_set[i].ChannelNum)
&& rtw_ch2freq(ch_set[i].ChannelNum) <= hi
) {
if (rtw_systime_to_ms(ch_set[i].non_ocp_end_time - current_time) > ms)
ms = rtw_systime_to_ms(ch_set[i].non_ocp_end_time - current_time);
if (jiffies_to_msecs(ch_set[i].non_ocp_end_time - current_time) > ms)
ms = jiffies_to_msecs(ch_set[i].non_ocp_end_time - current_time);
}
}
@ -507,9 +507,9 @@ static void _rtw_chset_update_non_ocp(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8
&& rtw_ch2freq(ch_set[i].ChannelNum) <= hi
) {
if (ms >= 0)
ch_set[i].non_ocp_end_time = jiffies + rtw_ms_to_systime(ms);
ch_set[i].non_ocp_end_time = jiffies + msecs_to_jiffies(ms);
else
ch_set[i].non_ocp_end_time = jiffies + rtw_ms_to_systime(NON_OCP_TIME_MS);
ch_set[i].non_ocp_end_time = jiffies + msecs_to_jiffies(NON_OCP_TIME_MS);
}
}
@ -560,7 +560,7 @@ u32 rtw_get_ch_waiting_ms(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset, u32 *
cac_ms = 0;
else if (in_rd_range && !non_ocp_ms) {
if (IS_CH_WAITING(rfctl))
cac_ms = rtw_systime_to_ms(rfctl->cac_end_time - jiffies);
cac_ms = jiffies_to_msecs(rfctl->cac_end_time - jiffies);
else
cac_ms = 0;
} else if (rtw_is_long_cac_ch(ch, bw, offset, rtw_odm_get_dfs_domain(dvobj)))
@ -589,8 +589,8 @@ void rtw_reset_cac(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset)
, &cac_ms
);
rfctl->cac_start_time = jiffies + rtw_ms_to_systime(non_ocp_ms);
rfctl->cac_end_time = rfctl->cac_start_time + rtw_ms_to_systime(cac_ms);
rfctl->cac_start_time = jiffies + msecs_to_jiffies(non_ocp_ms);
rfctl->cac_end_time = rfctl->cac_start_time + msecs_to_jiffies(cac_ms);
/* skip special value */
if (rfctl->cac_start_time == RTW_CAC_STOPPED) {
@ -767,7 +767,7 @@ void dump_chset(void *sel, RT_CHANNEL_INFO *ch_set)
if (rtw_is_dfs_ch(ch_set[i].ChannelNum)) {
if (CH_IS_NON_OCP(&ch_set[i]))
_RTW_PRINT_SEL(sel, ", non_ocp:%d"
, rtw_systime_to_ms(ch_set[i].non_ocp_end_time - jiffies));
, jiffies_to_msecs(ch_set[i].non_ocp_end_time - jiffies));
else
_RTW_PRINT_SEL(sel, ", non_ocp:N/A");
}

View File

@ -2475,7 +2475,7 @@ u8 rtw_interface_ps_func(_adapter *padapter, HAL_INTF_PS_FUNC efunc_id, u8 *val)
inline void rtw_set_ips_deny(_adapter *padapter, u32 ms)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ms);
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms);
}
/*
@ -2501,8 +2501,8 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
padapter = GET_PRIMARY_ADAPTER(padapter);
pmlmepriv = &padapter->mlmepriv;
if (rtw_time_after(jiffies + rtw_ms_to_systime(ips_deffer_ms), pwrpriv->ips_deny_time))
pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms);
if (rtw_time_after(jiffies + msecs_to_jiffies(ips_deffer_ms), pwrpriv->ips_deny_time))
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
if (pwrpriv->ps_processing) {
@ -2627,8 +2627,8 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
}
exit:
if (rtw_time_after(jiffies + rtw_ms_to_systime(ips_deffer_ms), pwrpriv->ips_deny_time))
pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms);
if (rtw_time_after(jiffies + msecs_to_jiffies(ips_deffer_ms), pwrpriv->ips_deny_time))
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms);
/*RTW_INFO(FUNC_ADPT_FMT "<===\n", FUNC_ADPT_ARG(padapter));*/
return ret;
@ -2675,7 +2675,7 @@ int rtw_pm_set_lps_level(_adapter *padapter, u8 level)
inline void rtw_set_lps_deny(_adapter *adapter, u32 ms)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
pwrpriv->lps_deny_time = jiffies + rtw_ms_to_systime(ms);
pwrpriv->lps_deny_time = jiffies + msecs_to_jiffies(ms);
}
int rtw_pm_set_ips(_adapter *padapter, u8 mode)

View File

@ -991,7 +991,7 @@ s32 rtw_tdls_do_ch_sw(_adapter *padapter, struct sta_info *ptdls_sta, u8 chnl_ty
u8 take_care_iqk;
s32 ret = _FAIL;
ch_sw_time_start = rtw_systime_to_ms(jiffies);
ch_sw_time_start = jiffies_to_msecs(jiffies);
/* set mac_id sleep before channel switch */
rtw_hal_macid_sleep(padapter, ptdls_sta->cmn.mac_id);
@ -1043,7 +1043,7 @@ s32 rtw_tdls_do_ch_sw(_adapter *padapter, struct sta_info *ptdls_sta, u8 chnl_ty
#endif
if (ret == _SUCCESS) {
ch_sw_time_spent = rtw_systime_to_ms(jiffies) - ch_sw_time_start;
ch_sw_time_spent = jiffies_to_msecs(jiffies) - ch_sw_time_start;
if (chnl_type == TDLS_CH_SW_OFF_CHNL) {
if ((u32)ch_switch_time / 1000 > ch_sw_time_spent)
wait_time = (u32)ch_switch_time / 1000 - ch_sw_time_spent;

View File

@ -454,7 +454,7 @@ void halbtcoutsrc_AggregationCheck(PBTC_COEXIST pBtCoexist)
/* It can only be called after 8 seconds. */
/* ===================================== */
curTime = rtw_systime_to_ms(jiffies);
curTime = jiffies_to_msecs(jiffies);
if ((curTime - preTime) < HALBTCOUTSRC_AGG_CHK_WINDOW_IN_MS) /* over 8 seconds you can execute this function again. */
return;
else

View File

@ -3448,7 +3448,7 @@ void rtw_hal_periodic_tsf_update_chk(_adapter *adapter)
if (!restore_ms)
return;
dvobj->periodic_tsf_update_etime = jiffies + rtw_ms_to_systime(restore_ms);
dvobj->periodic_tsf_update_etime = jiffies + msecs_to_jiffies(restore_ms);
if (!dvobj->periodic_tsf_update_etime)
dvobj->periodic_tsf_update_etime++;

View File

@ -50,7 +50,7 @@ void interrupt_handler_8192eu(_adapter *padapter, u16 pkt_len, u8 *pbuf)
if (pHalData->IntArray[0] & IMR_BCNDMAINT0_88E) {
struct tdls_ch_switch *pchsw_info = &padapter->tdlsinfo.chsw_info;
u32 last_time = pchsw_info->cur_time;
pchsw_info->cur_time = rtw_systime_to_ms(jiffies);
pchsw_info->cur_time = jiffies_to_msecs(jiffies);
if ((atomic_read(&pchsw_info->chsw_on) == _TRUE) &&
/* Sometimes we receive multiple interrupts in very little time period, use the follow condition test to filter */
(pchsw_info->cur_time - last_time > padapter->mlmeextpriv.mlmext_info.bcn_interval - 5) &&

View File

@ -275,27 +275,18 @@ extern void _rtw_deinit_queue(_queue *pqueue);
extern u32 _rtw_queue_empty(_queue *pqueue);
extern u32 rtw_end_of_queue_search(_list *queue, _list *pelement);
extern u32 _rtw_systime_to_ms(systime stime);
extern systime _rtw_ms_to_systime(u32 ms);
extern systime _rtw_us_to_systime(u32 us);
extern s32 _rtw_get_passing_time_ms(systime start);
extern s32 _rtw_get_remaining_time_ms(systime end);
extern s32 _rtw_get_time_interval_ms(systime start, systime end);
extern bool _rtw_time_after(systime a, systime b);
#ifdef DBG_SYSTIME
#define rtw_systime_to_ms(stime) ({u32 __ms = _rtw_systime_to_ms(stime); typecheck(systime, stime); __ms;})
#define rtw_ms_to_systime(ms) ({systime __stime = _rtw_ms_to_systime(ms); __stime;})
#define rtw_us_to_systime(us) ({systime __stime = _rtw_us_to_systime(us); __stime;})
#define rtw_get_passing_time_ms(start) ({u32 __ms = _rtw_get_passing_time_ms(start); typecheck(systime, start); __ms;})
#define rtw_get_remaining_time_ms(end) ({u32 __ms = _rtw_get_remaining_time_ms(end); typecheck(systime, end); __ms;})
#define rtw_get_time_interval_ms(start, end) ({u32 __ms = _rtw_get_time_interval_ms(start, end); typecheck(systime, start); typecheck(systime, end); __ms;})
#define rtw_time_after(a,b) ({bool __r = _rtw_time_after(a,b); typecheck(systime, a); typecheck(systime, b); __r;})
#define rtw_time_before(a,b) ({bool __r = _rtw_time_after(b, a); typecheck(systime, a); typecheck(systime, b); __r;})
#else
#define rtw_systime_to_ms(stime) _rtw_systime_to_ms(stime)
#define rtw_ms_to_systime(ms) _rtw_ms_to_systime(ms)
#define rtw_us_to_systime(us) _rtw_us_to_systime(us)
#define rtw_get_passing_time_ms(start) _rtw_get_passing_time_ms(start)
#define rtw_get_remaining_time_ms(end) _rtw_get_remaining_time_ms(end)
#define rtw_get_time_interval_ms(start, end) _rtw_get_time_interval_ms(start, end)

View File

@ -8600,7 +8600,7 @@ static void rtw_cfg80211_mpath_set_pinfo(struct rtw_mesh_path *mpath, u8 *next_h
pinfo->metric = mpath->metric;
if (rtw_time_after(mpath->exp_time, jiffies))
pinfo->exptime = rtw_get_remaining_time_ms(mpath->exp_time);
pinfo->discovery_timeout = rtw_systime_to_ms(mpath->discovery_timeout);
pinfo->discovery_timeout = jiffies_to_msecs(mpath->discovery_timeout);
pinfo->discovery_retries = mpath->discovery_retries;
if (mpath->flags & RTW_MESH_PATH_ACTIVE)
pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;

View File

@ -1003,43 +1003,20 @@ u32 rtw_end_of_queue_search(_list *head, _list *plist)
return _FALSE;
}
inline u32 _rtw_systime_to_ms(systime stime)
{
#ifdef PLATFORM_LINUX
return jiffies_to_msecs(stime);
#endif
}
inline systime _rtw_ms_to_systime(u32 ms)
{
#ifdef PLATFORM_LINUX
return msecs_to_jiffies(ms);
#endif
}
inline systime _rtw_us_to_systime(u32 us)
{
#ifdef PLATFORM_LINUX
return usecs_to_jiffies(us);
#else
#error "TBD\n"
#endif
}
/* the input parameter start use the same unit as returned by jiffies */
inline s32 _rtw_get_passing_time_ms(systime start)
{
return _rtw_systime_to_ms(jiffies - start);
return jiffies_to_msecs(jiffies - start);
}
inline s32 _rtw_get_remaining_time_ms(systime end)
{
return _rtw_systime_to_ms(end - jiffies);
return jiffies_to_msecs(end - jiffies);
}
inline s32 _rtw_get_time_interval_ms(systime start, systime end)
{
return _rtw_systime_to_ms(end - start);
return jiffies_to_msecs(end - start);
}
inline bool _rtw_time_after(systime a, systime b)
@ -1183,9 +1160,9 @@ inline void rtw_resume_unlock_suspend(void)
inline void rtw_lock_suspend_timeout(u32 timeout_ms)
{
#ifdef CONFIG_WAKELOCK
wake_lock_timeout(&rtw_suspend_lock, rtw_ms_to_systime(timeout_ms));
wake_lock_timeout(&rtw_suspend_lock, msecs_to_jiffies(timeout_ms));
#elif defined(CONFIG_ANDROID_POWER)
android_lock_suspend_auto_expire(&rtw_suspend_lock, rtw_ms_to_systime(timeout_ms));
android_lock_suspend_auto_expire(&rtw_suspend_lock, msecs_to_jiffies(timeout_ms));
#endif
}
@ -1193,9 +1170,9 @@ inline void rtw_lock_suspend_timeout(u32 timeout_ms)
inline void rtw_lock_traffic_suspend_timeout(u32 timeout_ms)
{
#ifdef CONFIG_WAKELOCK
wake_lock_timeout(&rtw_suspend_traffic_lock, rtw_ms_to_systime(timeout_ms));
wake_lock_timeout(&rtw_suspend_traffic_lock, msecs_to_jiffies(timeout_ms));
#elif defined(CONFIG_ANDROID_POWER)
android_lock_suspend_auto_expire(&rtw_suspend_traffic_lock, rtw_ms_to_systime(timeout_ms));
android_lock_suspend_auto_expire(&rtw_suspend_traffic_lock, msecs_to_jiffies(timeout_ms));
#endif
/* RTW_INFO("traffic lock timeout:%d\n", timeout_ms); */
}
@ -1913,7 +1890,7 @@ int rtw_blacklist_add(_queue *blist, const u8 *addr, u32 timeout_ms)
if (rtw_time_after(jiffies, ent->exp_time))
timeout = _TRUE;
ent->exp_time = jiffies
+ rtw_ms_to_systime(timeout_ms);
+ msecs_to_jiffies(timeout_ms);
break;
}
@ -1928,7 +1905,7 @@ int rtw_blacklist_add(_queue *blist, const u8 *addr, u32 timeout_ms)
if (ent) {
memcpy(ent->addr, addr, ETH_ALEN);
ent->exp_time = jiffies
+ rtw_ms_to_systime(timeout_ms);
+ msecs_to_jiffies(timeout_ms);
rtw_list_insert_tail(&ent->list, head);
}
}