{
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
- if (stats->bIsAMPDU && !stats->bFirstMPDU) {
- stats->mac_time[0] = priv->LastRxDescTSFLow;
- stats->mac_time[1] = priv->LastRxDescTSFHigh;
- } else {
- priv->LastRxDescTSFLow = stats->mac_time[0];
- priv->LastRxDescTSFHigh = stats->mac_time[1];
- }
+ if (stats->bIsAMPDU && !stats->bFirstMPDU)
+ stats->mac_time = priv->LastRxDescTSF;
+ else
+ priv->LastRxDescTSF = stats->mac_time;
}
long rtl819x_translate_todbm(struct r8192_priv * priv, u8 signal_strength_index )
int rxringcount;
u16 rxbuffersize;
- u32 LastRxDescTSFHigh;
- u32 LastRxDescTSFLow;
+ u64 LastRxDescTSF;
u16 EarlyRxThreshold;
u32 ReceiveConfig;
#define MIN_SLEEP_TIME 50
#define MAX_SLEEP_TIME 10000
-void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
+void rtl8192_hw_to_sleep(struct net_device *dev, u64 time)
{
struct r8192_priv *priv = rtllib_priv(dev);
- u32 rb = jiffies;
+ u32 tmp;
unsigned long flags;
spin_lock_irqsave(&priv->ps_lock,flags);
- tl -= MSECS(8+16+7);
+ time -= MSECS(8+16+7);
- if (((tl>=rb)&& (tl-rb) <= MSECS(MIN_SLEEP_TIME))
- ||((rb>tl)&& (rb-tl) < MSECS(MIN_SLEEP_TIME))) {
+ if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) {
spin_unlock_irqrestore(&priv->ps_lock,flags);
- printk("too short to sleep::%x, %x, %lx\n",tl, rb, MSECS(MIN_SLEEP_TIME));
+ printk(KERN_INFO "too short to sleep::%lld < %ld\n",
+ time - jiffies, MSECS(MIN_SLEEP_TIME));
return;
}
- if (((tl > rb) && ((tl-rb) > MSECS(MAX_SLEEP_TIME)))||
- ((tl < rb) && (tl>MSECS(69)) && ((rb-tl) > MSECS(MAX_SLEEP_TIME)))||
- ((tl<rb)&&(tl<MSECS(69))&&((tl+0xffffffff-rb)>MSECS(MAX_SLEEP_TIME)))) {
- printk("========>too long to sleep:%x, %x, %lx\n", tl, rb, MSECS(MAX_SLEEP_TIME));
+ if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) {
+ printk(KERN_INFO "========>too long to sleep:%lld > %ld\n",
+ time - jiffies, MSECS(MAX_SLEEP_TIME));
spin_unlock_irqrestore(&priv->ps_lock,flags);
return;
}
- {
- u32 tmp = (tl>rb)?(tl-rb):(rb-tl);
- queue_delayed_work_rsl(priv->rtllib->wq,
- &priv->rtllib->hw_wakeup_wq,tmp);
- }
+ tmp = time - jiffies;
+ queue_delayed_work_rsl(priv->rtllib->wq,
+ &priv->rtllib->hw_wakeup_wq,tmp);
queue_delayed_work_rsl(priv->rtllib->wq,
(void *)&priv->rtllib->hw_sleep_wq,0);
spin_unlock_irqrestore(&priv->ps_lock,flags);
#define INIT_DEFAULT_CHAN 1
void rtl8192_hw_wakeup(struct net_device *dev);
-void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl);
+void rtl8192_hw_to_sleep(struct net_device *dev, u64 time);
void rtllib_ips_leave_wq(struct net_device *dev);
void rtllib_ips_leave(struct net_device *dev);
void IPSLeave_wq (void *data);
* any adverse affects. */
struct rtllib_rx_stats {
#if 1
- u32 mac_time[2];
+ u64 mac_time;
s8 rssi;
u8 signal;
u8 noise;
struct rtllib_tim_parameters tim;
u8 dtim_period;
u8 dtim_data;
- u32 last_dtim_sta_time[2];
+ u64 last_dtim_sta_time;
u8 wmm_info;
struct rtllib_wmm_ac_param wmm_param[4];
int ps_timeout;
int ps_period;
struct tasklet_struct ps_task;
- u32 ps_th;
- u32 ps_tl;
+ u64 ps_time;
bool polling;
short raw_tx;
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
- void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
+ void (*enter_sleep_state) (struct net_device *dev, u64 time);
short (*ps_is_queue_empty) (struct net_device *dev);
int (*handle_beacon) (struct net_device * dev, struct rtllib_beacon * beacon, struct rtllib_network * network);
int (*handle_assoc_response) (struct net_device * dev, struct rtllib_assoc_response_frame * resp, struct rtllib_network * network);
network->dtim_period = info_element->data[1];
if (ieee->state != RTLLIB_LINKED)
break;
- network->last_dtim_sta_time[0] = jiffies;
- network->last_dtim_sta_time[1] = stats->mac_time[1];
+ network->last_dtim_sta_time = jiffies;
network->dtim_data = RTLLIB_DTIM_VALID;
dst->atim_window = src->atim_window;
dst->dtim_period = src->dtim_period;
dst->dtim_data = src->dtim_data;
- dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
- dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
+ dst->last_dtim_sta_time = src->last_dtim_sta_time;
memcpy(&dst->tim, &src->tim, sizeof(struct rtllib_tim_parameters));
dst->bssht.bdSupportHT = src->bssht.bdSupportHT;
}
-short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u32 *time_h, u32 *time_l)
+static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
{
int timeout = ieee->ps_timeout;
u8 dtim;
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
- if (time_l){
+ if (time){
if (ieee->bAwakePktSent == true) {
pPSC->LPSAwakeIntvl = 1;
} else {
LPSAwakeIntvl_tmp = pPSC->LPSAwakeIntvl;
}
- *time_l = ieee->current_network.last_dtim_sta_time[0]
+ *time = ieee->current_network.last_dtim_sta_time
+ MSECS(ieee->current_network.beacon_interval * LPSAwakeIntvl_tmp);
}
}
- if (time_h) {
- *time_h = ieee->current_network.last_dtim_sta_time[1];
- if (time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
- *time_h += 1;
- }
-
return 1;
inline void rtllib_sta_ps(struct rtllib_device *ieee)
{
- u32 th,tl;
+ u64 time;
short sleep;
unsigned long flags,flags2;
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
- sleep = rtllib_sta_ps_sleep(ieee,&th, &tl);
+ sleep = rtllib_sta_ps_sleep(ieee, &time);
/* 2 wake, 1 sleep, 0 do nothing */
if (sleep == 0)
{
}
if (sleep == 1){
if (ieee->sta_sleep == LPS_IS_SLEEP){
- ieee->enter_sleep_state(ieee->dev,th,tl);
+ ieee->enter_sleep_state(ieee->dev, time);
}
else if (ieee->sta_sleep == LPS_IS_WAKE){
ieee->sta_sleep = LPS_WAIT_NULL_DATA_SEND;
ieee->ack_tx_to_ieee = 1;
rtllib_sta_ps_send_null_frame(ieee,1);
- ieee->ps_th = th;
- ieee->ps_tl = tl;
+ ieee->ps_time = time;
}
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
/* Null frame with PS bit set */
if (success){
ieee->sta_sleep = LPS_IS_SLEEP;
- ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl);
+ ieee->enter_sleep_state(ieee->dev, ieee->ps_time);
}
/* if the card report not success we can't be sure the AP
* has not RXed so we can't assume the AP believe us awake