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