diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-02-22 01:38:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:03:04 -0500 |
commit | ac5e1e39c1eeaaff7e6f03bf7cf7a444b42fbc23 (patch) | |
tree | 596566fc2f06b58683270687a1a2601755dfe0c5 /drivers | |
parent | 1e73eb62cec7cf78b7295769b6e51a915518f5a1 (diff) |
wl1271: Update TX packet life time handling with higher resolution time
This patch uses a higher precision timer to synchronize with the firmware
clock. Improved precision is needed as on some platforms a jiffy may be up to
tens of milliseconds, and the required precision is closer to TU's.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_tx.c | 7 |
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 457ce725027..41de47caa20 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -404,7 +404,7 @@ struct wl1271 { | |||
404 | u32 tx_packets_count; | 404 | u32 tx_packets_count; |
405 | 405 | ||
406 | /* Time-offset between host and chipset clocks */ | 406 | /* Time-offset between host and chipset clocks */ |
407 | int time_offset; | 407 | s64 time_offset; |
408 | 408 | ||
409 | /* Session counter for the chipset */ | 409 | /* Session counter for the chipset */ |
410 | int session_counter; | 410 | int session_counter; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 9f741686405..4c4d22acaee 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -374,6 +374,7 @@ static void wl1271_power_on(struct wl1271 *wl) | |||
374 | static void wl1271_fw_status(struct wl1271 *wl, | 374 | static void wl1271_fw_status(struct wl1271 *wl, |
375 | struct wl1271_fw_status *status) | 375 | struct wl1271_fw_status *status) |
376 | { | 376 | { |
377 | struct timespec ts; | ||
377 | u32 total = 0; | 378 | u32 total = 0; |
378 | int i; | 379 | int i; |
379 | 380 | ||
@@ -402,8 +403,9 @@ static void wl1271_fw_status(struct wl1271 *wl, | |||
402 | ieee80211_queue_work(wl->hw, &wl->tx_work); | 403 | ieee80211_queue_work(wl->hw, &wl->tx_work); |
403 | 404 | ||
404 | /* update the host-chipset time offset */ | 405 | /* update the host-chipset time offset */ |
405 | wl->time_offset = jiffies_to_usecs(jiffies) - | 406 | getnstimeofday(&ts); |
406 | le32_to_cpu(status->fw_localtime); | 407 | wl->time_offset = (timespec_to_ns(&ts) >> 10) - |
408 | (s64)le32_to_cpu(status->fw_localtime); | ||
407 | } | 409 | } |
408 | 410 | ||
409 | #define WL1271_IRQ_MAX_LOOPS 10 | 411 | #define WL1271_IRQ_MAX_LOOPS 10 |
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c index 7926471cd09..a32d3014781 100644 --- a/drivers/net/wireless/wl12xx/wl1271_tx.c +++ b/drivers/net/wireless/wl12xx/wl1271_tx.c | |||
@@ -86,8 +86,10 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra) | |||
86 | static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | 86 | static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, |
87 | u32 extra, struct ieee80211_tx_info *control) | 87 | u32 extra, struct ieee80211_tx_info *control) |
88 | { | 88 | { |
89 | struct timespec ts; | ||
89 | struct wl1271_tx_hw_descr *desc; | 90 | struct wl1271_tx_hw_descr *desc; |
90 | int pad, ac; | 91 | int pad, ac; |
92 | s64 hosttime; | ||
91 | u16 tx_attr; | 93 | u16 tx_attr; |
92 | 94 | ||
93 | desc = (struct wl1271_tx_hw_descr *) skb->data; | 95 | desc = (struct wl1271_tx_hw_descr *) skb->data; |
@@ -101,8 +103,9 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
101 | } | 103 | } |
102 | 104 | ||
103 | /* configure packet life time */ | 105 | /* configure packet life time */ |
104 | desc->start_time = cpu_to_le32(jiffies_to_usecs(jiffies) - | 106 | getnstimeofday(&ts); |
105 | wl->time_offset); | 107 | hosttime = (timespec_to_ns(&ts) >> 10); |
108 | desc->start_time = cpu_to_le32(hosttime - wl->time_offset); | ||
106 | desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU); | 109 | desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU); |
107 | 110 | ||
108 | /* configure the tx attributes */ | 111 | /* configure the tx attributes */ |