Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3d72b96 authored by Dan Williams's avatar Dan Williams Committed by John W. Linville
Browse files

ipw2x00: age scan results on resume



Scanned BSS entries are timestamped with jiffies, which doesn't
increment across suspend and hibernate.  On resume, every BSS in the
scan list looks like it was scanned within the last 10 seconds,
irregardless of how long the machine was actually asleep.  Age scan
results on resume with the time spent during sleep so userspace has a
clue how old they really are.

Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent bc8263f1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1119,6 +1119,9 @@ static inline int ieee80211_is_cck_rate(u8 rate)
extern void free_ieee80211(struct net_device *dev);
extern struct net_device *alloc_ieee80211(int sizeof_priv);

extern void ieee80211_networks_age(struct ieee80211_device *ieee,
				   unsigned long age_secs);

extern int ieee80211_set_encryption(struct ieee80211_device *ieee);

/* ieee80211_tx.c */
+11 −1
Original line number Diff line number Diff line
@@ -1692,7 +1692,13 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
	u32 lock;
	u32 ord_len = sizeof(lock);

	/* Quite if manually disabled. */
	/* Age scan list entries found before suspend */
	if (priv->suspend_time) {
		ieee80211_networks_age(priv->ieee, priv->suspend_time);
		priv->suspend_time = 0;
	}

	/* Quiet if manually disabled. */
	if (priv->status & STATUS_RF_KILL_SW) {
		IPW_DEBUG_INFO("%s: Radio is disabled by Manual Disable "
			       "switch\n", priv->net_dev->name);
@@ -6415,6 +6421,8 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)
	pci_disable_device(pci_dev);
	pci_set_power_state(pci_dev, PCI_D3hot);

	priv->suspend_at = get_seconds();

	mutex_unlock(&priv->action_mutex);

	return 0;
@@ -6458,6 +6466,8 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
	 * the queue of needed */
	netif_device_attach(dev);

	priv->suspend_time = get_seconds() - priv->suspend_at;

	/* Bring the device back up */
	if (!(priv->status & STATUS_RF_KILL_SW))
		ipw2100_up(priv, 0);
+4 −0
Original line number Diff line number Diff line
@@ -591,6 +591,10 @@ struct ipw2100_priv {

	int user_requested_scan;

	/* Track time in suspend */
	unsigned long suspend_at;
	unsigned long suspend_time;

	u32 interrupts;
	int tx_interrupts;
	int rx_interrupts;
+10 −0
Original line number Diff line number Diff line
@@ -11238,6 +11238,12 @@ static int ipw_up(struct ipw_priv *priv)
{
	int rc, i, j;

	/* Age scan list entries found before suspend */
	if (priv->suspend_time) {
		ieee80211_networks_age(priv->ieee, priv->suspend_time);
		priv->suspend_time = 0;
	}

	if (priv->status & STATUS_EXIT_PENDING)
		return -EIO;

@@ -11838,6 +11844,8 @@ static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state)
	pci_disable_device(pdev);
	pci_set_power_state(pdev, pci_choose_state(pdev, state));

	priv->suspend_at = get_seconds();

	return 0;
}

@@ -11873,6 +11881,8 @@ static int ipw_pci_resume(struct pci_dev *pdev)
	 * the queue of needed */
	netif_device_attach(dev);

	priv->suspend_time = get_seconds() - priv->suspend_at;

	/* Bring the device back up */
	queue_work(priv->workqueue, &priv->up);

+4 −0
Original line number Diff line number Diff line
@@ -1347,6 +1347,10 @@ struct ipw_priv {

	s8 tx_power;

	/* Track time in suspend */
	unsigned long suspend_at;
	unsigned long suspend_time;

#ifdef CONFIG_PM
	u32 pm_state[16];
#endif
Loading