aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-09-05 20:56:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-11 15:53:31 -0400
commita0db663ff192e21ebb703f962308675f22fb38a8 (patch)
tree2f886aa24c8a0af53c32b8ba0d84b43076e6214c /drivers
parent3c9355222cc521ca2e8c355a9b05e773900c5dc0 (diff)
p54: 32-bit tsf timestamps
tcpdump: 02:15:42.874518 61112184us tsft 48.0 Mb/s 2437 MHz (0x0480) antenna 1 [0x0000000e] CF +QoS Data IV 02:15:42.874557 >>>4356079526us<<< tsft 24.0 Mb/s 2437 MHz (0x0480) antenna 1 [0x0000000e] Acknowledgment 02:15:42.976844 61214513us tsft 1.0 Mb/s 2437 MHz (0x0480) antenna 0 [0x0000000e] Beacon as one can see on the huge jump, it's very plausible that firmware does not report the full 64-bit mac time, just the lower 32bit and some kinds of flags... Therefore if we want a useful timestamp we have to emulate the high bits. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/p54/p54.h2
-rw-r--r--drivers/net/wireless/p54/p54common.c11
-rw-r--r--drivers/net/wireless/p54/p54common.h3
3 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 98d4f8e7d84d..36b8e584c6cf 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -87,6 +87,8 @@ struct p54_common {
87 void *cached_vdcf; 87 void *cached_vdcf;
88 unsigned int fw_var; 88 unsigned int fw_var;
89 unsigned int fw_interface; 89 unsigned int fw_interface;
90 u32 tsf_low32;
91 u32 tsf_high32;
90 struct ieee80211_tx_queue_stats tx_stats[8]; 92 struct ieee80211_tx_queue_stats tx_stats[8];
91 void *eeprom; 93 void *eeprom;
92 struct completion eeprom_comp; 94 struct completion eeprom_comp;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index f96f7c7e6af5..526d3a282b7a 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -426,10 +426,12 @@ EXPORT_SYMBOL_GPL(p54_parse_eeprom);
426 426
427static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) 427static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
428{ 428{
429 struct p54_common *priv = dev->priv;
429 struct p54_rx_hdr *hdr = (struct p54_rx_hdr *) skb->data; 430 struct p54_rx_hdr *hdr = (struct p54_rx_hdr *) skb->data;
430 struct ieee80211_rx_status rx_status = {0}; 431 struct ieee80211_rx_status rx_status = {0};
431 u16 freq = le16_to_cpu(hdr->freq); 432 u16 freq = le16_to_cpu(hdr->freq);
432 size_t header_len = sizeof(*hdr); 433 size_t header_len = sizeof(*hdr);
434 u32 tsf32;
433 435
434 rx_status.signal = hdr->rssi; 436 rx_status.signal = hdr->rssi;
435 /* XX correct? */ 437 /* XX correct? */
@@ -438,7 +440,13 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
438 rx_status.freq = freq; 440 rx_status.freq = freq;
439 rx_status.band = IEEE80211_BAND_2GHZ; 441 rx_status.band = IEEE80211_BAND_2GHZ;
440 rx_status.antenna = hdr->antenna; 442 rx_status.antenna = hdr->antenna;
441 rx_status.mactime = le64_to_cpu(hdr->timestamp); 443
444 tsf32 = le32_to_cpu(hdr->tsf32);
445 if (tsf32 < priv->tsf_low32)
446 priv->tsf_high32++;
447 rx_status.mactime = ((u64)priv->tsf_high32) << 32 | tsf32;
448 priv->tsf_low32 = tsf32;
449
442 rx_status.flag |= RX_FLAG_TSFT; 450 rx_status.flag |= RX_FLAG_TSFT;
443 451
444 if (hdr->magic & cpu_to_le16(0x4000)) 452 if (hdr->magic & cpu_to_le16(0x4000))
@@ -1037,6 +1045,7 @@ static void p54_stop(struct ieee80211_hw *dev)
1037 while ((skb = skb_dequeue(&priv->tx_queue))) 1045 while ((skb = skb_dequeue(&priv->tx_queue)))
1038 kfree_skb(skb); 1046 kfree_skb(skb);
1039 priv->stop(dev); 1047 priv->stop(dev);
1048 priv->tsf_high32 = priv->tsf_low32 = 0;
1040 priv->mode = IEEE80211_IF_TYPE_INVALID; 1049 priv->mode = IEEE80211_IF_TYPE_INVALID;
1041} 1050}
1042 1051
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index 73a9a2c923dd..976cbf9689b5 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -185,7 +185,8 @@ struct p54_rx_hdr {
185 u8 rssi; 185 u8 rssi;
186 u8 quality; 186 u8 quality;
187 u16 unknown2; 187 u16 unknown2;
188 __le64 timestamp; 188 __le32 tsf32;
189 __le32 unalloc0;
189 u8 align[0]; 190 u8 align[0];
190} __attribute__ ((packed)); 191} __attribute__ ((packed));
191 192