linux/net/mac80211/led.c
<<
>>
Prefs
   1/*
   2 * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
   3 *
   4 * This program is free software; you can redistribute it and/or modify
   5 * it under the terms of the GNU General Public License version 2 as
   6 * published by the Free Software Foundation.
   7 */
   8
   9/* just for IFNAMSIZ */
  10#include <linux/if.h>
  11#include <linux/slab.h>
  12#include <linux/export.h>
  13#include "led.h"
  14
  15void ieee80211_led_rx(struct ieee80211_local *local)
  16{
  17        if (unlikely(!local->rx_led))
  18                return;
  19        if (local->rx_led_counter++ % 2 == 0)
  20                led_trigger_event(local->rx_led, LED_OFF);
  21        else
  22                led_trigger_event(local->rx_led, LED_FULL);
  23}
  24
  25/* q is 1 if a packet was enqueued, 0 if it has been transmitted */
  26void ieee80211_led_tx(struct ieee80211_local *local, int q)
  27{
  28        if (unlikely(!local->tx_led))
  29                return;
  30        /* not sure how this is supposed to work ... */
  31        local->tx_led_counter += 2*q-1;
  32        if (local->tx_led_counter % 2 == 0)
  33                led_trigger_event(local->tx_led, LED_OFF);
  34        else
  35                led_trigger_event(local->tx_led, LED_FULL);
  36}
  37
  38void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
  39{
  40        if (unlikely(!local->assoc_led))
  41                return;
  42        if (associated)
  43                led_trigger_event(local->assoc_led, LED_FULL);
  44        else
  45                led_trigger_event(local->assoc_led, LED_OFF);
  46}
  47
  48void ieee80211_led_radio(struct ieee80211_local *local, bool enabled)
  49{
  50        if (unlikely(!local->radio_led))
  51                return;
  52        if (enabled)
  53                led_trigger_event(local->radio_led, LED_FULL);
  54        else
  55                led_trigger_event(local->radio_led, LED_OFF);
  56}
  57
  58void ieee80211_led_names(struct ieee80211_local *local)
  59{
  60        snprintf(local->rx_led_name, sizeof(local->rx_led_name),
  61                 "%srx", wiphy_name(local->hw.wiphy));
  62        snprintf(local->tx_led_name, sizeof(local->tx_led_name),
  63                 "%stx", wiphy_name(local->hw.wiphy));
  64        snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
  65                 "%sassoc", wiphy_name(local->hw.wiphy));
  66        snprintf(local->radio_led_name, sizeof(local->radio_led_name),
  67                 "%sradio", wiphy_name(local->hw.wiphy));
  68}
  69
  70void ieee80211_led_init(struct ieee80211_local *local)
  71{
  72        local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
  73        if (local->rx_led) {
  74                local->rx_led->name = local->rx_led_name;
-e=snprintf" class="sref">snprintf(local->rx_led));
  74 = snprintf(local->rx_led_name
  72        local->rx_led_name  68}
  68
  69<8>)
  31        loa>->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL{
  32        if (loa>->rx_led8);
  53        if (loa>->rx_led->name = local->GFP_KERNEL-e=snprintf" class="sref">snprintf(local->rx_led8>;
  74 = snprintf(local->GFP_KERNEL  74  31        loa>->rx_led_name
  68
  68}
  69<9a>
local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL)
  32        if (local->rx_led9>{
  22        if (local->rx_led->name = local->GFP_KERNEL-e=snprintf" class="sref">snprintf(local->rx_led9 {
  74 = snprintf(local->GFP_KERNEL;
  74(local->rx_led_name  68
  68
   8
local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL
  73        if (local->rx_led10t;
  73        if (local->rx_led->name = local->GFP_KERNEL-e=snprintf" class="sref">snprintf(local->rx_led10t;
  74 = snprintf(local->GFP_KERNEL  74(local->rx_led_name  68)
  68{
  57<10))
  ">  31        rx_led10n;
-e=snp&local" class="sr">  31        rx_led1an>
  74 = snprintf(linux/if.h>t;
  74(rx_led_name  68  68  68  68)
  26vexd ieee80211_led_init(struct ieee80211_local *local{
  27))
  ">  31        local->rx_led1rn;
  657t.6.20clled_triggerunregisa>->snprintf(local->GFP_KERNEL  20 = snprintf(local->GFP_KERNEL);
  68  32        if (local->rx_led1>);
  53          unregisa>->snprintf(local->GFP_KERNEL}
  74 = snprintf(local->GFP_KERNEL
  68)
  32        if (loa>->rx_led1a>)
  53          unregisa>->snprintf(local->GFP_KERNEL{
  74 = snprintf(local->GFP_KERNEL))
  68  73        if (local->rx_led1an>
  7led_triggerunregisa>->snprintf(local->rx_led_name  22 = snprintf(local->rx_led_name  68);
  14  ">  31        rx_led1>);
  7led_triggerunregisa>->  31        rx_led_name)
  53 = snprintf(linux/if.h&g/a>
  68)
  68{
  69<1>))
iee__de=ieee802get_ef">local->local-ode=kzs="sref">ieee80211_led_initef">local->d_initefcal" class="sref">ieeef">local->localrx_led1a>)
ieee80211_led_init(struct ieee80211_local *(strue=snprintf" class="sef">local->led.h"t;
  14name = local->GFP_KERNEL);
  46}
local->local-ode=oed.h" class="fref">led.h"a>
   8<1a>)
iee__de=ieee802get_af">local->local-ode=kzs="sref">ieee80211_led_initef">local->d_initefcal" class="sref">ieeef">local->local{
rx_led1>))
ieee80211_led_init(struct ieee80211_local *(strue=snprintf" class="sef">local->led.h&quorn;
led.h&quor>)
name = local->local-ode=ed.h" class="fref">led.h&quort;
  68, local->local-ode=oed.h" class="fref">led.h&quor);
led.h&quor>}
iee__de=ieee802get_ef">local->localieee80211_led_initef">local->d_initefcal" class="sref">ieeef">local->local
rx_led1>>)
ieee80211_led_init(struct ieee80211_local *(strue=snprintf" class="sef">local->led.h&qL1a>{
  69<1>),
name = local->GFP_KERNEL  68),
local->localled.h&qL1at;
  14),
iee__de=ieee802get_ef">local->localieee80211_led_initef">local->d_initefcal" class="sref">ieeef">local->local  16),
ieee80211_led_init(struct ieee80211_local *(strue=snprintf" class="sef">local->led.h&qL1aa>
   8<1a>}
name = local->rx_led_name
  68)
local->localled.h&qL1a>{
led.h&quo>);
 = ieee80211_led_init(struct ieee80211_local *radio_led_nameieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = local;
  16);
 = delta_led = rx_led_name{
  57<1a);
 = rx_led_name}
  69<18a>
rx_led_name)
rx_led_name{
 = led.h&qL18);
  23  14;
 = rx_led));
  16
ieee80211_led_init(struct ieee80211_local * = led.h&qL18);
ieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = name = led.h&qL18>}
ieee80211_le/a>(net/mdev">name = (net/mdevcal" class="sref">ieeea>(ndev">name = (ndevcal"ed.h" class="fref">led.h&qL19a>
name = of/a>        eptstruct led.h&qL19>)
led.h&qL19>{
led.h&quo9);
rx_led9 {
  51                retu19>;
  68 = round_jiffi led.h&qL19an>
  57<19an>
ieee80211_local *led.h&qL19>}
  69<20n>
  67/* default to just sollason */="strin class="line" name="L69">  69<201>
name = led.h&qL20t;
of/a>        led.h&qL203;
led.h&qL204;
  ict name = rx_led205;
  ept_size_led = name = rx_led206;
name = rx_led207;
name = ->led.h&qL208;
name = name = ->led.h&qL209;
led.h&qL2an>
  23  68led.h&qu2gt;
read211_ka href="+code=iread211_ke=snp&local" class="srept_size_led = led.h&qL2ot;
hw.ieeea>(ndev">name = (ndevcal", &local" class="srept_size_led = rx_led  55  b802k_se  ieeea>(ndev">name = (ndevcal", &local" class="sron">name = led.h&qL2o6;
led.h&qL2o7;
  68   8<2rn;
iee__de=ieee802create_ept_/a>(sizeof(struct (sizeof(e=snpzs="sref">ieee80211_led_initef">local->d_initefcal" class="sref">ieeef">local->radio_led_nameradio_led_nameieee80211_led_initept_b802k">local->d_initept_b802kcal" class="sref">ieeb802k_tf="+">name = radio_led_namename = rx_led);
rx_led2a>}
ieee80211_led_init(struct ieee80211_local *(strue=snprintf" class="sef">local->led.h&qL2/a>
ieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = led.h&qL2/6;
led.h&qu2a>)
  WARN_ON_led = ieee80211_local *rx_led8;
, rx_led_name))
  69<2rn;
rx_led = kzalloc(sizeof(struct (sizeof(radioer" class="sref">led_trigger), GFP_KERNEL
rx_led, rx_led_nameled.h&qL2>);
  66        radio_ledept_size_led = radio_led_name  67                 ept class="string">"%sradio", wiphy_name(local->hw.wiphy2>);
led.h&qu23>)
->wiphy2>8;
   8<2a>)
name = name = wiphy2a>{
name = name = wiphy2an>
wiphy2a1;
led.h&qu2a>)
sajap_simf(struct ept_size_simf(struct  *wiphy2a);
  14<2lse
ieee80211_local *wiphy2a);
led.h&qu2a>}
 = wiphy2ta>
  68)
wiphy2a>{
  69<2>))
(sizee=snpzs="sref">ieee80211_led_init(struct ieee80211_local *localrx_led2r>)
ieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = name = led.h&qL2rt;
  14<2lse
  ept_size_led = rx_led  51                retu2r>}
  57<2aa>
  67/* resaj siaffix */="strin class="line" name="L69">  69<2>>)
ieee80211_local *led.h&qL2a>{
led.h&qL2>),
led.h&qL2>n;
ept_size_simf(struct  *wiphy2>),
mod_simf(struct round_jiffi led.h&qL2at;
  68),
  68(sizect ieee80211_led_init(struct ieee80211_local *local),
  27
ieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = name =   27)
ieee80211_le/a>(net/mdev">name = (net/mdevcal" class="sref">ieeea>(ndev">name = (ndevcal"ed.h" class="fref">led.h&qL2/a>
  69<2a>)
rx_led{
led.h&qL2/),
led.h&qL2) {
led.h&qL2/),
ieedel_simf(_synx_led = led.h&qL2>);
led.h&qu2/>{
led.h&qL2a);
hw.ieeea>(ndev">name = (ndevcal", &local" class="srept_size_led = rx_led}
  657t.6.20clledset_bizehtnesieeea>(ndev">name = (ndevcal", lass="sref">ieeLED_OFF">name = led.h&qL28a>
led.h&qL28>)
  68{
led.h&qu28);
(sizee=snpzs="sref">ieee80211_led_init(struct ieee80211_local *radio_led_namename = rx_led;
  16ieee80211_leept_/a>(sizeof(struct (sizeof(radieclass="sref">ieeept_size_led = name =   16{
name = ->  16   8<28>}
ieetypes_on">name =   16
  69<29>)
rx_led{
led.h&qL29);
led.h&qL29 {
led.h&qL29>;
ieeept_size_led = name = led.h&qL29);
led.h&qu29an>
  67/*="strin class="line" name="L69">  69<29an>
  67"line" na* Regardles< of wan ed state, we shouldn't b802k whanodstrin class="line" name="L69">  69<29>}
  67"line" na* the ef">l is disf="+d -- this cL67happen due to so  69<30n>
  67"line" na* ss=" orde>    issues with __de=ieee802rerefc_idle()odstrin class="line" name="L69">  69<301>
  67"line" na* be    ref"+d before the ef">l is start>  odstrin class="line" name="L69">  69<302>
  67"line" na*/="strin class="line" name="L69">  69<303;
f="+wal->led.h&qL304;
  14<305;
->  ept_size_led = rx_led(sizee=snpde=name" class=e80211_local *wiphy307;
wiphy308;
(sizee=snpde=name" class=e80211_local *wiphy309;
  68



-&> Th" original LXR software by the lass="linhttp://sourceforge.e" nprojects/lx-&>LXR communitycal", this expe> m al version by lass="linmailto:lx-@802ux.no -&> x-.802ux.no kindly hos ed by lass="linhttp://www.redpill-802pro.no of L02uxaconsult and ope>ations services sincei19"5.