fix up the network ifname in the network state when receiving iface/ifup events
[openwrt.git] / package / madwifi / patches / 200-no_debug.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -42,7 +42,6 @@
4   * This software is derived from work of Atsushi Onoe; his contribution
5   * is greatly appreciated.
6   */
7 -#define        AR_DEBUG
8  #include "if_ath_debug.h"
9  #include "opt_ah.h"
10  
11 @@ -368,8 +367,10 @@ static unsigned int ath_get_dfs_cac_time
12  static void ath_set_dfs_cac_time(struct ieee80211com *, unsigned int seconds);
13  
14  static unsigned int ath_test_radar(struct ieee80211com *);
15 -static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
16 +#ifdef AR_DEBUG
17  
18 +static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
19 +#endif
20  static u_int32_t ath_get_clamped_maxtxpower(struct ath_softc *sc);
21  static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
22                 u_int32_t new_clamped_maxtxpower);
23 @@ -520,9 +521,11 @@ ath_attach(u_int16_t devid, struct net_d
24         u_int8_t csz;
25  
26         sc->devid = devid;
27 +#ifdef AR_DEBUG
28         ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
29         sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
30         DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
31 +#endif
32  
33         /* Allocate space for dynamically determined maximum VAP count */
34         sc->sc_bslot = 
35 @@ -1038,8 +1041,9 @@ ath_attach(u_int16_t devid, struct net_d
36         ic->ic_vap_delete = ath_vap_delete;
37  
38         ic->ic_test_radar           = ath_test_radar;
39 +#ifdef AR_DEBUG
40         ic->ic_dump_hal_map         = ath_dump_hal_map;
41 -
42 +#endif
43         ic->ic_set_dfs_testmode     = ath_set_dfs_testmode;
44         ic->ic_get_dfs_testmode     = ath_get_dfs_testmode;
45  
46 @@ -1297,12 +1301,14 @@ ath_vap_create(struct ieee80211com *ic, 
47                 /* If no default VAP debug flags are passed, allow a few to
48                  * transfer down from the driver to new VAPs so we can have load
49                  * time debugging for VAPs too. */
50 +#ifdef AR_DEBUG
51                 vap->iv_debug = 0 |
52                         ((sc->sc_debug & ATH_DEBUG_RATE) ? IEEE80211_MSG_XRATE  : 0) | 
53                         ((sc->sc_debug & ATH_DEBUG_XMIT) ? IEEE80211_MSG_OUTPUT : 0) | 
54                         ((sc->sc_debug & ATH_DEBUG_RECV) ? IEEE80211_MSG_INPUT  : 0) |
55                         0
56                         ;
57 +#endif
58         }
59         ic->ic_debug = (sc->sc_default_ieee80211_debug & IEEE80211_MSG_IC);
60  
61 @@ -10496,9 +10502,11 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
62                                 /* XXX validate? */
63                                 sc->sc_ledpin = val;
64                                 break;
65 +#ifdef AR_DEBUG
66                         case ATH_DEBUG:
67                                 sc->sc_debug     = (val & ~ATH_DEBUG_GLOBAL);
68                                 ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
69 +#endif
70                                 break;
71                         case ATH_TXANTENNA:
72                                 /*
73 @@ -10918,9 +10926,11 @@ ath_dynamic_sysctl_register(struct ath_s
74         }
75  
76         /* initialize values */
77 +#ifdef AR_DEBUG
78         ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
79         sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
80         sc->sc_default_ieee80211_debug = ieee80211_debug;
81 +#endif
82         sc->sc_txantenna = 0;           /* default to auto-selection */
83         sc->sc_txintrperiod = ATH_TXQ_INTR_PERIOD;
84  }
85 @@ -11762,6 +11772,7 @@ ath_test_radar(struct ieee80211com *ic)
86  }
87  
88  /* This is called by a private ioctl (iwpriv) to dump the HAL obfuscation table */
89 +#ifdef AR_DEBUG
90  static unsigned int
91  ath_dump_hal_map(struct ieee80211com *ic)
92  {
93 @@ -11770,7 +11781,7 @@ ath_dump_hal_map(struct ieee80211com *ic
94         ath_hal_dump_map(sc->sc_ah);
95         return 0;
96  }
97 -
98 +#endif
99  /* If we are shutting down or blowing off the DFS channel availability check
100   * then we call this to stop the behavior before we take the rest of the
101   * necessary actions (such as a DFS reaction to radar). */
102 --- a/ath_rate/amrr/amrr.c
103 +++ b/ath_rate/amrr/amrr.c
104 @@ -70,7 +70,9 @@
105  
106  #include "amrr.h"
107  
108 +#ifdef AR_DEBUG
109  #define        AMRR_DEBUG
110 +#endif
111  #ifdef AMRR_DEBUG
112  #define        DPRINTF(sc, _fmt, ...) do {                                     \
113         if (sc->sc_debug & 0x10)                                        \
114 --- a/ath_rate/minstrel/minstrel.c
115 +++ b/ath_rate/minstrel/minstrel.c
116 @@ -117,7 +117,9 @@
117  
118  #include "minstrel.h"
119  
120 +#ifdef AR_DEBUG
121  #define        MINSTREL_DEBUG
122 +#endif
123  #ifdef MINSTREL_DEBUG
124  enum {
125                 ATH_DEBUG_RATE          = 0x00000010    /* rate control */
126 --- a/ath_rate/onoe/onoe.c
127 +++ b/ath_rate/onoe/onoe.c
128 @@ -66,7 +66,9 @@
129  
130  #include "onoe.h"
131  
132 +#ifdef AR_DEBUG
133  #define        ONOE_DEBUG
134 +#endif
135  #ifdef ONOE_DEBUG
136  enum {
137         ATH_DEBUG_RATE  = 0x00000010,   /* rate control */
138 --- a/ath_rate/sample/sample.c
139 +++ b/ath_rate/sample/sample.c
140 @@ -68,7 +68,9 @@
141  
142  #include "sample.h"
143  
144 -#define        SAMPLE_DEBUG
145 +#ifdef AR_DEBUG
146 +#define SAMPLE_DEBUG
147 +#endif
148  #ifdef SAMPLE_DEBUG
149  enum {
150         ATH_DEBUG_RATE          = 0x00000010,   /* rate control */
151 --- a/tools/do_multi.c
152 +++ b/tools/do_multi.c
153 @@ -10,16 +10,20 @@ main(int argc, char *argv[])
154  
155      progname = basename(argv[0]);
156  
157 +#ifdef AR_DEBUG
158      if(strcmp(progname, "80211debug") == 0)
159         ret = a80211debug_init(argc, argv);
160 +#endif
161      if(strcmp(progname, "80211stats") == 0)
162         ret = a80211stats_init(argc, argv);
163      if(strcmp(progname, "athchans") == 0)
164         ret = athchans_init(argc, argv);
165      if(strcmp(progname, "athctrl") == 0)
166         ret =  athctrl_init(argc, argv);
167 +#ifdef AR_DEBUG
168      if(strcmp(progname, "athdebug") == 0)
169         ret =  athdebug_init(argc, argv);
170 +#endif
171      if(strcmp(progname, "athkey") == 0)
172         ret =  athkey_init(argc, argv);
173      if(strcmp(progname, "athstats") == 0)
174 --- a/tools/Makefile
175 +++ b/tools/Makefile
176 @@ -48,6 +48,8 @@ endif
177  
178  all: compile
179  
180 +DEBUG = -DAR_DEBUG
181 +
182  ALLPROGS=      athstats 80211stats athkey athchans athctrl \
183         athdebug 80211debug wlanconfig ath_info
184  
185 @@ -55,7 +57,7 @@ OBJS= $(patsubst %,%.o,$(ALLPROGS))
186  
187  INCS=  -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
188  CFLAGS=        -g -O2 -Wall
189 -ALL_CFLAGS= $(CFLAGS) $(INCS)
190 +ALL_CFLAGS= $(CFLAGS) $(INCS) $(DEBUG)
191  LDFLAGS=
192  
193  
194 --- a/net80211/ieee80211_linux.h
195 +++ b/net80211/ieee80211_linux.h
196 @@ -29,8 +29,6 @@
197  #ifndef _NET80211_IEEE80211_LINUX_H_
198  #define _NET80211_IEEE80211_LINUX_H_
199  
200 -#define        IEEE80211_DEBUG
201 -#define        IEEE80211_DEBUG_REFCNT                  /* Node reference count debugging */
202  /* #define ATH_DEBUG_SPINLOCKS */              /* announce before spinlocking */
203  
204  #include <linux/wireless.h>
205 --- a/Makefile.inc
206 +++ b/Makefile.inc
207 @@ -148,7 +148,8 @@ ATH_RATE=   $(TOP)/ath_rate
208  TOOLS=  $(TOP)/tools 
209  
210  WARNINGS = -Werror
211 -COPTS+= $(WARNINGS)
212 +DEBUG = -DAR_DEBUG -DIEEE80211_DEBUG
213 +COPTS+= $(WARNINGS) $(DEBUG)
214  INCS=  -include $(TOP)/include/compat.h -I$(TOP)/include
215  
216  # TARGET defines the target platform architecture. It must match one of
217 --- a/ath/if_ath_radar.c
218 +++ b/ath/if_ath_radar.c
219 @@ -19,8 +19,6 @@
220   * $Id: if_ath_radar.c 2464 2007-06-15 22:51:56Z mtaylor $
221   */
222  #include "opt_ah.h"
223 -
224 -#define        AR_DEBUG
225  #include "if_ath_debug.h"
226  
227  #ifndef AUTOCONF_INCLUDED
228 @@ -56,8 +54,6 @@
229  #include <net80211/if_llc.h>
230  #endif
231  
232 -#define        AR_DEBUG
233 -
234  #include "net80211/if_athproto.h"
235  #include "if_athvar.h"
236  
237 --- a/ath/if_ath_hal.h
238 +++ b/ath/if_ath_hal.h
239 @@ -1081,6 +1081,7 @@ static inline HAL_BOOL ath_hal_disable(s
240  
241             tail -f /var/log/messages | sed -f hal_unmangle.sed 
242   */
243 +#ifdef AR_DEBUG
244  static inline void ath_hal_dump_map(struct ath_hal *ah)
245  {
246  #ifdef CONFIG_KALLSYMS
247 @@ -1345,7 +1346,7 @@ static inline void ath_hal_dump_map(stru
248  #endif                         /* #ifndef CONFIG_KALLSYMS */
249  
250  }
251 -
252 +#endif
253  #include "if_ath_hal_wrappers.h"
254  
255  #endif                         /* #ifndef _IF_ATH_HAL_H_ */
256 --- a/net80211/ieee80211_var.h
257 +++ b/net80211/ieee80211_var.h
258 @@ -492,9 +492,10 @@ struct ieee80211com {
259         /* inject a fake radar signal -- used while on a 802.11h DFS channels */
260         unsigned int (*ic_test_radar)(struct ieee80211com *);
261  
262 +#ifdef AR_DEBUG
263         /* dump HAL */
264         unsigned int (*ic_dump_hal_map)(struct ieee80211com *);
265 -
266 +#endif
267         /* DFS channel availability check time (in seconds) */
268         void (*ic_set_dfs_cac_time)(struct ieee80211com *, unsigned int);
269         unsigned int (*ic_get_dfs_cac_time)(struct ieee80211com *);
270 --- a/net80211/ieee80211_wireless.c
271 +++ b/net80211/ieee80211_wireless.c
272 @@ -1548,6 +1548,7 @@ ieee80211_get_txcont_power(struct net_de
273         return 0;
274  }
275  
276 +#ifdef AR_DEBUG
277  static int 
278  ieee80211_ioctl_hal_map(struct net_device *dev, struct iw_request_info *info,
279         void *w, char *extra)
280 @@ -1558,7 +1559,7 @@ ieee80211_ioctl_hal_map(struct net_devic
281         params[0] = ic->ic_dump_hal_map(ic);
282         return 0;
283  }
284 -
285 +#endif
286  
287  static int
288  ieee80211_ioctl_radar(struct net_device *dev, struct iw_request_info *info,
289 @@ -5258,8 +5259,10 @@ static const struct iw_priv_args ieee802
290           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "getwmmparams" },
291         { IEEE80211_IOCTL_RADAR,
292           0, 0, "doth_radar" },
293 +#ifdef AR_DEBUG
294         { IEEE80211_IOCTL_HALMAP,
295           0, 0, "dump_hal_map" },
296 +#endif
297         /*
298          * These depends on sub-ioctl support which added in version 12.
299          */
300 @@ -5695,7 +5698,9 @@ static const iw_handler ieee80211_priv_h
301         set_priv(IEEE80211_IOCTL_SETMLME, ieee80211_ioctl_setmlme),
302         set_priv(IEEE80211_IOCTL_SETKEY, ieee80211_ioctl_setkey),
303         set_priv(IEEE80211_IOCTL_DELKEY, ieee80211_ioctl_delkey),
304 +#ifdef AR_DEBUG
305         set_priv(IEEE80211_IOCTL_HALMAP, ieee80211_ioctl_hal_map),
306 +#endif
307         set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
308         set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
309         set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
310 --- a/ath/if_ath_debug.h
311 +++ b/ath/if_ath_debug.h
312 @@ -54,6 +54,10 @@ enum {
313         ATH_DEBUG_GLOBAL        = (ATH_DEBUG_SKB|ATH_DEBUG_SKB_REF)
314  };
315  
316 +#define        EPRINTF(_sc, _fmt, ...) \
317 +               printk(KERN_ERR "%s: %s: " _fmt, \
318 +                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
319 +
320  #ifdef AR_DEBUG
321  
322  /* DEBUG-ONLY DEFINITIONS */
323 @@ -68,20 +72,9 @@ enum {
324                 ath_keyprint((_sc), __func__, _ix, _hk, _mac);          \
325  } while (0)
326  
327 -#else /* #ifdef AR_DEBUG */
328 -
329 -#define        DFLAG_ISSET(sc, _m)             0
330 -#define        DPRINTF(sc, _m, _fmt, ...)
331 -#define        KEYPRINTF(sc, k, ix, mac)
332 -
333 -#endif /* #ifdef AR_DEBUG */
334  
335  #define        IFF_DUMPPKTS(_sc, _m)   DFLAG_ISSET((_sc), (_m))
336  
337 -#define        EPRINTF(_sc, _fmt, ...) \
338 -               printk(KERN_ERR "%s: %s: " _fmt, \
339 -                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
340 -
341  #define        WPRINTF(_sc, _fmt, ...) \
342                 printk(KERN_WARNING "%s: %s: " _fmt, \
343                         SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
344 @@ -89,5 +82,14 @@ enum {
345  #define        IPRINTF(_sc, _fmt, ...) \
346                 printk(KERN_INFO "%s: %s: " _fmt, \
347                         SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
348 +#else
349 +#define        DFLAG_ISSET(sc, _m)             0
350 +#define        DPRINTF(sc, _m, _fmt, ...)
351 +#define        KEYPRINTF(sc, k, ix, mac)
352 +#define WPRINTF(...)
353 +#define IPRINTF(...)
354 +#define IFF_DUMPPKTS(...) 0
355 +
356 +#endif
357  
358  #endif /* #ifndef _IF_ATH_DEBUG_H_ */
359 --- a/net80211/ieee80211_node.c
360 +++ b/net80211/ieee80211_node.c
361 @@ -920,6 +920,9 @@ node_cleanup(struct ieee80211_node *ni)
362         ni->ni_rxkeyoff = 0;
363  }
364  
365 +#ifndef IEEE80211_DEBUG
366 +#define node_print_message(...) do {} while(0)
367 +#else
368  static void node_print_message(
369                 u_int32_t flags,
370                 int show_counter, 
371 @@ -972,7 +975,7 @@ static void node_print_message(
372                         adjusted_refcount);
373         va_end(args);
374  }
375 -EXPORT_SYMBOL(node_print_message);
376 +#endif
377  
378  static void
379  #ifdef IEEE80211_DEBUG_REFCNT
380 --- a/ath/if_ath_pci.c
381 +++ b/ath/if_ath_pci.c
382 @@ -134,8 +134,10 @@ ath_pci_probe(struct pci_dev *pdev, cons
383         u16 vdevice;
384         int i;
385  
386 -       if (pci_enable_device(pdev))
387 +       if (pci_enable_device(pdev)) {
388 +               printk(KERN_ERR "%s: failed to enable PCI device\n", dev_info);
389                 return -EIO;
390 +       }
391  
392         /* XXX 32-bit addressing only */
393         if (pci_set_dma_mask(pdev, 0xffffffff)) {
394 @@ -244,8 +246,10 @@ ath_pci_probe(struct pci_dev *pdev, cons
395                 sc->aps_sc.sc_ledpin = 1;
396         }
397  
398 -       if (ath_attach(vdevice, dev, NULL) != 0)
399 +       if ((i = ath_attach(vdevice, dev, NULL)) != 0) {
400 +               printk(KERN_ERR "%s: ath_attach failed: %d\n", dev_info, i);
401                 goto bad4;
402 +       }
403  
404         athname = ath_hal_probe(id->vendor, vdevice);
405         printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",