Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 135772 Details for
Bug 198868
net-wireless/iwlwifi-1.1.21: LED not working
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to iwlwifi sources to enable led on iwl3945
iwlwifi-1.1.21-led.patch (text/plain), 11.89 KB, created by
Jonathan Thibault
on 2007-11-11 22:05:32 UTC
(
hide
)
Description:
patch to iwlwifi sources to enable led on iwl3945
Filename:
MIME Type:
Creator:
Jonathan Thibault
Created:
2007-11-11 22:05:32 UTC
Size:
11.89 KB
patch
obsolete
>diff -Naur iwlwifi-1.1.21/Makefile iwlwifi-1.1.21-new/Makefile >--- iwlwifi-1.1.21/Makefile 2007-11-11 12:15:39.000000000 -0500 >+++ iwlwifi-1.1.21-new/Makefile 2007-11-11 02:44:33.000000000 -0500 >@@ -12,8 +12,8 @@ > export CONFIG_IWL4965 ?= m > export CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT ?= y > export CONFIG_IWLWIFI_DEBUG ?= y >-export CONFIG_IWLWIFI_HT ?= y >-export CONFIG_IWLWIFI_HT_AGG ?= y >+export CONFIG_IWLWIFI_HT ?= n >+export CONFIG_IWLWIFI_HT_AGG ?= n > export CONFIG_IWLWIFI_SENSITIVITY ?= y > export CONFIG_IWLWIFI_QOS ?= y > export IWLWIFI_VERSION ?= test >diff -Naur iwlwifi-1.1.21/origin/iwl-3945.c iwlwifi-1.1.21-new/origin/iwl-3945.c >--- iwlwifi-1.1.21/origin/iwl-3945.c 2007-11-11 12:15:39.000000000 -0500 >+++ iwlwifi-1.1.21-new/origin/iwl-3945.c 2007-11-11 02:44:33.000000000 -0500 >@@ -248,6 +248,9 @@ > struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); > short len = le16_to_cpu(rx_hdr->len); > >+ priv->led_packets += le16_to_cpu(rx_hdr->len); >+ iwl_setup_activity_timer(priv); >+ > /* We received data from the HW, so stop the watchdog */ > if (unlikely((len + IWL_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) { > IWL_DEBUG_DROP("Corruption detected!\n"); >diff -Naur iwlwifi-1.1.21/origin/iwl-3945.h iwlwifi-1.1.21-new/origin/iwl-3945.h >--- iwlwifi-1.1.21/origin/iwl-3945.h 2007-11-11 12:15:39.000000000 -0500 >+++ iwlwifi-1.1.21-new/origin/iwl-3945.h 2007-11-11 02:44:33.000000000 -0500 >@@ -715,7 +715,7 @@ > extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv); > extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, > u16 tx_rate, u8 flags); >- >+extern void iwl_setup_activity_timer(struct iwl3945_priv *priv); > > #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT > >@@ -815,12 +815,10 @@ > struct iwl3945_init_alive_resp card_alive_init; > struct iwl3945_alive_resp card_alive; > >-#ifdef LED > /* LED related variables */ >- struct iwl3945_activity_blink activity; >+// struct iwl3945_activity_blink activity; > unsigned long led_packets; > int led_state; >-#endif > > u16 active_rate; > u16 active_rate_basic; >diff -Naur iwlwifi-1.1.21/origin/iwl3945-base.c iwlwifi-1.1.21-new/origin/iwl3945-base.c >--- iwlwifi-1.1.21/origin/iwl3945-base.c 2007-11-11 12:15:39.000000000 -0500 >+++ iwlwifi-1.1.21-new/origin/iwl3945-base.c 2007-11-11 02:44:33.000000000 -0500 >@@ -191,6 +191,224 @@ > #endif > } > >+#define IWL_LED_INTERVAL 1000 //scales the other values 1000 is 1ms units >+#define IWL_LED_ACTIVITY (1<<0) >+#define IWL_LED_LINK (1<<1) >+struct iwl_activity_blink { >+ u16 throughput; /* threshold in Mbs */ >+ u8 off; /* OFF time in interval units - 0 == always ON if >+ * time_on != 0 */ >+ u8 on; /* ON time in interval units - 0 == OFF */ >+}; >+ >+enum { >+ IWL_LED_LINK_UNINIT = 0, >+ IWL_LED_LINK_RADIOOFF, >+ IWL_LED_LINK_UNASSOCIATED, >+ IWL_LED_LINK_SCANNING, >+ IWL_LED_LINK_ASSOCIATED, >+ IWL_LED_LINK_ROAMING, >+}; >+ >+struct iwl_link_blink { >+ u16 interval; /* Number of interval units per second */ >+ u8 off; /* OFF time in interval units - 0 == always ON >+ * if time_on != 0 */ >+ u8 on; /* ON time in interval units - 0 == OFF */ >+}; >+ >+struct iwl_led { >+ u8 time_on; /* ON time in interval units - 0 == OFF */ >+ u8 time_off; /* OFF time in interval units - 0 == always ON if >+ 395 * time_on != 0 */ >+}; >+ >+static struct iwl_link_blink link_led_table[] = { >+ [IWL_LED_LINK_RADIOOFF] = {1000, 0, 0}, >+ [IWL_LED_LINK_UNASSOCIATED] = {10000, 200, 2}, >+ [IWL_LED_LINK_ASSOCIATED] = {1000, 0, 1}, >+}; >+static inline int iwl3945_is_rfkill(struct iwl3945_priv *priv); >+void iwl_setup_activity_timer(struct iwl3945_priv *priv); >+static void iwl_update_link_led(struct iwl3945_priv *priv) >+{ >+ int state; >+ struct iwl3945_led_cmd led_cmd = { >+ .id = IWL_LED_LINK, >+ }; >+ >+// * If we are in RF KILL then we can't send the LED >+// * command, so cache that the LED is in the >+// * RADIOOFF state so we'll turn it back on when >+// * we come back from RF KILL. >+ if (iwl3945_is_rfkill(priv)) { >+ IWL_DEBUG_LED("Not sending LINK LED off cmd in RF KILL.\n"); >+ priv->led_state = IWL_LED_LINK_RADIOOFF; >+ return; >+ } >+ >+ if (test_bit(STATUS_IN_SUSPEND, &priv->status)) { >+ IWL_DEBUG_LED("Not sending LINK LED off cmd in SUSPEND.\n"); >+ priv->led_state = IWL_LED_LINK_RADIOOFF; >+ return; >+ } >+ >+ if ( test_bit(STATUS_EXIT_PENDING, &priv->status) || >+ !test_bit(STATUS_READY, &priv->status)) >+ state = IWL_LED_LINK_RADIOOFF; >+ else if (iwl3945_is_associated(priv)) >+ state = IWL_LED_LINK_ASSOCIATED; >+ else >+ state = IWL_LED_LINK_UNASSOCIATED; >+ >+ if (state == priv->led_state) >+ return; >+ >+ led_cmd.interval = link_led_table[state].interval; >+ led_cmd.on = link_led_table[state].on; >+ led_cmd.off = link_led_table[state].off; >+ >+ priv->led_state = state; >+ >+ >+ IWL_DEBUG_LED("On: %d, Off: %d, Interval: %d\n", >+ led_cmd.on, led_cmd.off, led_cmd.interval); >+ >+ iwl3945_send_cmd_pdu(priv, REPLY_LEDS_CMD, >+ sizeof(struct iwl3945_led_cmd), &led_cmd); >+ >+} >+ >+static struct iwl_activity_blink activity_led_table[] = { >+ {300, 25, 25}, >+ {200, 40, 40}, >+ {100, 55, 55}, >+ {70, 65, 65}, >+ {50, 75, 75}, >+ {20, 85, 85}, >+ {10, 95, 95}, >+ {5, 110, 110}, >+ {1, 130, 130}, >+ {0, 167, 167}, >+}; >+ >+/* >+ set to correct blink rate. set to solid blink we can not find correct >+ rate value or the blink valus exceed the blink threshold >+*/ >+static void get_led_blink_rate(struct iwl3945_priv *priv, >+ struct iwl_activity_blink *blink) >+{ >+ //Adjust to Mbs throughput table >+ u32 bit_count = (priv->led_packets * 10) >> 17; >+ u32 index = 0; >+ >+// * If < 1mbs then just quick blink over long duration to >+// * indicate "some" activity >+ if (!bit_count) { >+ blink->on = 10; >+ blink->off = 200; >+ return; >+ } >+ >+ while ((bit_count <= activity_led_table[index].throughput) && >+ index < ARRAY_SIZE(activity_led_table)) >+ index++; >+ >+ if (index == ARRAY_SIZE(activity_led_table)) { >+ blink->on = 1; //turn on >+ blink->off = 0; // never turn off >+ return; >+ } >+ >+ blink->on = activity_led_table[index].on; >+ blink->off = activity_led_table[index].off; >+ >+} >+ >+#define IWL_ACTIVITY_PERIOD msecs_to_jiffies(100) >+ >+static void iwl_update_activity_led(struct iwl3945_priv *priv) >+{ >+ static struct iwl_activity_blink last_blink = { 0, 0, 0 }; >+ struct iwl_activity_blink blink; >+ struct iwl3945_led_cmd led_cmd = { >+ .id = IWL_LED_ACTIVITY, >+ .interval = IWL_LED_INTERVAL, >+ }; >+ >+ // If configured to not use LEDs or LEDs are disabled, >+ // then we don't toggle a activity led >+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { >+ blink.on = blink.off = 0; >+ } else { >+ IWL_DEBUG_LED("total Tx/Rx bytes = %lu\n", priv->led_packets); >+ get_led_blink_rate(priv, &blink); >+ priv->led_packets = 0; >+ } >+ >+ if (last_blink.on != blink.on || last_blink.off != blink.off) { >+ last_blink = blink; >+ IWL_DEBUG_LED("Blink rate: %d On, %d Off, at %d interval.\n", >+ blink.on, blink.off, led_cmd.interval); >+ >+ led_cmd.off = blink.off; >+ led_cmd.on = blink.on; >+ >+ iwl3945_send_cmd_pdu(priv, REPLY_LEDS_CMD, >+ sizeof(struct iwl3945_led_cmd), &led_cmd); >+ } >+ >+} >+ >+void iwl_setup_activity_timer(struct iwl3945_priv *priv) >+{ >+ if (priv->activity_timer_active) >+ return; >+ >+ priv->activity_timer_active = 1; >+ queue_delayed_work(priv->workqueue, &priv->activity_timer, >+ IWL_ACTIVITY_PERIOD); >+ >+} >+ >+static void iwl_bg_activity_timer(struct work_struct *work) >+{ >+ struct iwl3945_priv *priv = >+ container_of(work, struct iwl3945_priv, activity_timer.work); >+ >+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) >+ return; >+ >+ mutex_lock(&priv->mutex); >+ >+ iwl_update_activity_led(priv); >+ >+ // If we haven't Tx/Rx any packets, then don't bother >+ // running this timer any more until we do one of those things >+ if (!priv->led_packets) >+ priv->activity_timer_active = 0; >+ else >+ queue_delayed_work(priv->workqueue, >+ &priv->activity_timer, IWL_ACTIVITY_PERIOD); >+ >+ mutex_unlock(&priv->mutex); >+ >+} >+ >+static void iwl_bg_update_link_led(struct work_struct *data) >+{ >+ struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, update_link_led); >+ >+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) >+ return; >+ >+ mutex_lock(&priv->mutex); >+ iwl_update_link_led(priv); >+ mutex_unlock(&priv->mutex); >+ >+} >+ > /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** > * DMA services > * >@@ -1165,7 +1383,7 @@ > if (rc) { > IWL_ERROR("Error setting HW rate table: %02X\n", rc); > return -EIO; >- } >+ } > > return 0; > } >@@ -2290,6 +2508,7 @@ > priv->last_packet_time = 0; > > iwl3945_scan_cancel(priv); >+ iwl_update_link_led(priv); > } > > #define MAX_UCODE_BEACON_INTERVAL 1024 >@@ -2709,6 +2928,7 @@ > static int iwl3945_tx_skb(struct iwl3945_priv *priv, > struct sk_buff *skb, struct ieee80211_tx_control *ctl) > { >+ int frame_len = skb->len; > struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; > struct iwl3945_tfd_frame *tfd; > u32 *control_flags; >@@ -2892,6 +3112,9 @@ > ieee80211_stop_queue(priv->hw, ctl->queue); > } > >+ priv->led_packets += frame_len; >+ iwl_setup_activity_timer(priv); >+ > return 0; > > drop_unlock: >@@ -2968,6 +3191,7 @@ > disable_radio ? "OFF" : "ON"); > > if (disable_radio) { >+ iwl_update_link_led(priv); > iwl3945_scan_cancel(priv); > /* FIXME: This is a workaround for AP */ > if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { >@@ -3702,6 +3926,8 @@ > IWL_DEBUG_INFO("Scan took %dms\n", > jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies))); > >+ queue_work(priv->workqueue, &priv->update_link_led); >+ > queue_work(priv->workqueue, &priv->scan_completed); > > return; >@@ -6185,6 +6411,7 @@ > priv->notif_missed_beacons = 0; > set_bit(STATUS_READY, &priv->status); > >+ iwl_update_link_led(priv); > iwl3945_reg_txpower_periodic(priv); > > IWL_DEBUG_INFO("ALIVE processing complete.\n"); >@@ -6213,6 +6440,12 @@ > if (!exit_pending) > set_bit(STATUS_EXIT_PENDING, &priv->status); > >+ priv->led_packets = 0; >+ if (!(priv->status & STATUS_FW_ERROR) && iwl3945_is_alive(priv)) { >+ iwl_update_link_led(priv); >+ iwl_update_activity_led(priv); >+ } >+ > iwl3945_clear_stations_table(priv); > > /* Unblock any waiting calls */ >@@ -6429,7 +6662,7 @@ > if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) > queue_work(priv->workqueue, &priv->restart); > } else { >- >+ priv->led_state = IWL_LED_LINK_RADIOOFF; > if (!test_bit(STATUS_RF_KILL_HW, &priv->status)) > IWL_DEBUG_RF_KILL("Can not turn radio back on - " > "disabled by SW switch\n"); >@@ -6659,6 +6892,8 @@ > return; > > done: >+ if (!rc) >+ iwl_update_link_led(priv); > /* inform mac80211 scan aborted */ > queue_work(priv->workqueue, &priv->scan_completed); > mutex_unlock(&priv->mutex); >@@ -8203,10 +8438,12 @@ > INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan); > INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); > INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); >+ INIT_WORK(&priv->update_link_led, iwl_bg_update_link_led); > INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate); > INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); > INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); > INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); >+ INIT_DELAYED_WORK(&priv->activity_timer, iwl_bg_activity_timer); > > iwl3945_hw_setup_deferred_work(priv); > >@@ -8221,6 +8458,7 @@ > cancel_delayed_work(&priv->scan_check); > cancel_delayed_work(&priv->alive_start); > cancel_delayed_work(&priv->post_associate); >+ cancel_delayed_work(&priv->activity_timer); > cancel_work_sync(&priv->beacon_update); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198868
: 135772 |
135774