0797f8fb655be5c4fe669170b686a5b3524f3f10
[librecmc/librecmc.git] / package / madwifi / patches-testing / 200-no_debug.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -323,8 +323,10 @@
4  static void ath_set_dfs_cac_time(struct ieee80211com *, unsigned int seconds);
5  
6  static unsigned int ath_test_radar(struct ieee80211com *);
7 -static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
8 +#ifdef AR_DEBUG
9  
10 +static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
11 +#endif
12  static u_int32_t ath_get_clamped_maxtxpower(struct ath_softc *sc);
13  static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
14                 u_int32_t new_clamped_maxtxpower);
15 @@ -334,7 +336,10 @@
16                 unsigned int param, unsigned int value);
17  
18  static u_int32_t ath_get_real_maxtxpower(struct ath_softc *sc);
19 +
20 +#ifdef AR_DEBUG
21  static int ath_txq_check(struct ath_softc *sc, struct ath_txq *txq, const char *msg);
22 +#endif
23  
24  static int ath_countrycode = CTRY_DEFAULT;     /* country code */
25  static int ath_outdoor = AH_FALSE;             /* enable outdoor use */
26 @@ -486,9 +491,11 @@
27         u_int8_t csz;
28  
29         sc->devid = devid;
30 +#ifdef AR_DEBUG
31         ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
32         sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
33         DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
34 +#endif
35  
36         /* Allocate space for dynamically determined maximum VAP count */
37         sc->sc_bslot = 
38 @@ -1014,7 +1021,9 @@
39         ic->ic_vap_delete = ath_vap_delete;
40  
41         ic->ic_test_radar               = ath_test_radar;
42 +#ifdef AR_DEBUG
43         ic->ic_dump_hal_map             = ath_dump_hal_map;
44 +#endif
45  
46         ic->ic_set_dfs_testmode         = ath_set_dfs_testmode;
47         ic->ic_get_dfs_testmode         = ath_get_dfs_testmode;
48 @@ -1285,12 +1294,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 @@ -2811,6 +2822,7 @@
64  #endif
65  }
66  
67 +#ifdef AR_DEBUG
68  static void
69  ath_txq_dump(struct ath_softc *sc, struct ath_txq *txq)
70  {
71 @@ -2866,6 +2878,7 @@
72  
73         return 1;
74  }
75 +#endif
76  
77  /*
78   * Insert a buffer on a txq
79 @@ -8384,7 +8397,9 @@
80  ath_tx_timeout(struct net_device *dev)
81  {
82         struct ath_softc *sc = dev->priv;
83 +#ifdef AR_DEBUG
84         int i;
85 +#endif
86  
87         if (ath_chan_unavail(sc))
88                 return;
89 @@ -8393,12 +8408,14 @@
90                 (dev->flags & IFF_RUNNING) ? "" : "NOT ",
91                 sc->sc_invalid ? "in" : "");
92  
93 +#ifdef AR_DEBUG
94         for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
95                 if (ATH_TXQ_SETUP(sc, i)) {
96                         ath_txq_check(sc, &sc->sc_txq[i], __func__);
97                         ath_txq_dump(sc, &sc->sc_txq[i]);
98                 }
99         }
100 +#endif
101  
102         if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
103                 sc->sc_stats.ast_watchdog++;
104 @@ -10638,6 +10655,7 @@
105                                 /* XXX validate? */
106                                 sc->sc_ledpin = val;
107                                 break;
108 +#ifdef AR_DEBUG
109                         case ATH_DEBUG:
110                                 sc->sc_debug     = (val & ~ATH_DEBUG_GLOBAL);
111                                 ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
112 @@ -10645,6 +10663,7 @@
113                                                 "0x%08x.\n", val);
114  
115                                 break;
116 +#endif
117                         case ATH_TXANTENNA:
118                                 /*
119                                  * antenna can be:
120 @@ -10818,9 +10837,11 @@
121                 case ATH_REGDOMAIN:
122                         ath_hal_getregdomain(ah, &val);
123                         break;
124 +#ifdef AR_DEBUG
125                 case ATH_DEBUG:
126                         val = sc->sc_debug | ath_debug_global;
127                         break;
128 +#endif
129                 case ATH_TXANTENNA:
130                         val = sc->sc_txantenna;
131                         break;
132 @@ -11939,6 +11960,7 @@
133  }
134  
135  /* This is called by a private ioctl (iwpriv) to dump the HAL obfuscation table */
136 +#ifdef AR_DEBUG
137  static unsigned int
138  ath_dump_hal_map(struct ieee80211com *ic)
139  {
140 @@ -11947,7 +11969,7 @@
141         ath_hal_dump_map(sc->sc_ah);
142         return 0;
143  }
144 -
145 +#endif
146  /* If we are shutting down or blowing off the DFS channel availability check
147   * then we call this to stop the behavior before we take the rest of the
148   * necessary actions (such as a DFS reaction to radar). */
149 --- a/ath_rate/amrr/amrr.c
150 +++ b/ath_rate/amrr/amrr.c
151 @@ -70,7 +70,9 @@
152  
153  #include "amrr.h"
154  
155 +#ifdef AR_DEBUG
156  #define        AMRR_DEBUG
157 +#endif
158  #ifdef AMRR_DEBUG
159  #define        DPRINTF(sc, _fmt, ...) do {                                     \
160         if (sc->sc_debug & 0x10)                                        \
161 --- a/ath_rate/minstrel/minstrel.c
162 +++ b/ath_rate/minstrel/minstrel.c
163 @@ -117,7 +117,9 @@
164  
165  #include "minstrel.h"
166  
167 +#ifdef AR_DEBUG
168  #define        MINSTREL_DEBUG
169 +#endif
170  #ifdef MINSTREL_DEBUG
171  enum {
172                 ATH_DEBUG_RATE          = 0x00000010    /* rate control */
173 @@ -963,7 +965,9 @@
174                 (struct ieee80211_node_table *)&vap->iv_ic->ic_sta;
175         unsigned int x = 0;
176         unsigned int this_tp, this_prob, this_eprob;
177 -       struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
178 +#ifdef AR_DEBUG
179 +       struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
180 +#endif
181  
182         IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
183         TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
184 --- a/ath_rate/onoe/onoe.c
185 +++ b/ath_rate/onoe/onoe.c
186 @@ -66,7 +66,9 @@
187  
188  #include "onoe.h"
189  
190 +#ifdef AR_DEBUG
191  #define        ONOE_DEBUG
192 +#endif
193  #ifdef ONOE_DEBUG
194  enum {
195         ATH_DEBUG_RATE  = 0x00000010,   /* rate control */
196 --- a/ath_rate/sample/sample.c
197 +++ b/ath_rate/sample/sample.c
198 @@ -68,7 +68,9 @@
199  
200  #include "sample.h"
201  
202 -#define        SAMPLE_DEBUG
203 +#ifdef AR_DEBUG
204 +#define SAMPLE_DEBUG
205 +#endif
206  #ifdef SAMPLE_DEBUG
207  enum {
208         ATH_DEBUG_RATE          = 0x00000010,   /* rate control */
209 --- a/tools/do_multi.c
210 +++ b/tools/do_multi.c
211 @@ -9,16 +9,20 @@
212  
213      progname = basename(argv[0]);
214  
215 +#ifdef AR_DEBUG
216      if(strcmp(progname, "80211debug") == 0)
217         ret = a80211debug_init(argc, argv);
218 +#endif
219      if(strcmp(progname, "80211stats") == 0)
220         ret = a80211stats_init(argc, argv);
221      if(strcmp(progname, "athchans") == 0)
222         ret = athchans_init(argc, argv);
223      if(strcmp(progname, "athctrl") == 0)
224         ret =  athctrl_init(argc, argv);
225 +#ifdef AR_DEBUG
226      if(strcmp(progname, "athdebug") == 0)
227         ret =  athdebug_init(argc, argv);
228 +#endif
229      if(strcmp(progname, "athkey") == 0)
230         ret =  athkey_init(argc, argv);
231      if(strcmp(progname, "athstats") == 0)
232 --- a/tools/Makefile
233 +++ b/tools/Makefile
234 @@ -39,6 +39,10 @@
235  
236  ATH_HAL = $(TOP)/ath_hal
237  
238 +ifndef ATH_DEBUG
239 +ATH_DEBUG=1
240 +endif
241 +
242  #
243  # Path to the HAL source code.
244  #
245 @@ -46,17 +50,22 @@
246  HAL = $(TOP)/hal
247  endif
248  
249 +INCS = -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL) -I$(TOP)/ath
250 +CFLAGS = -g -O2 -Wall
251 +ALL_CFLAGS = $(CFLAGS) $(INCS)
252 +LDFLAGS =
253  
254  PROGRAMS = athstats 80211stats athkey athchans athctrl \
255 -       athdebug 80211debug wlanconfig wpakey
256 +       wlanconfig wpakey
257 +
258 +ifeq ($(ATH_DEBUG),1)
259 +  PROGRAMS += athdebug 80211debug
260 +  ALL_CFLAGS += -DAR_DEBUG
261 +endif
262  
263  OBJS = $(patsubst %,%.o,$(PROGRAMS)) ath_info/ath_info.o
264  SUBDIRS = ath_info
265  
266 -INCS = -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL) -I$(TOP)/ath
267 -CFLAGS = -g -O2 -Wall
268 -ALL_CFLAGS = $(CFLAGS) $(INCS)
269 -LDFLAGS =
270  
271  all: all-subdirs compile
272  
273 --- a/ath/if_ath_hal.h
274 +++ b/ath/if_ath_hal.h
275 @@ -1263,6 +1263,7 @@
276  
277             tail -f /var/log/messages | sed -f hal_unmangle.sed 
278   */
279 +#ifdef AR_DEBUG
280  static inline void ath_hal_dump_map(struct ath_hal *ah)
281  {
282  #ifdef CONFIG_KALLSYMS
283 @@ -1527,7 +1528,7 @@
284  #endif                         /* #ifndef CONFIG_KALLSYMS */
285  
286  }
287 -
288 +#endif
289  #include "if_ath_hal_wrappers.h"
290  #include "if_ath_hal_extensions.h"
291  
292 --- a/net80211/ieee80211_var.h
293 +++ b/net80211/ieee80211_var.h
294 @@ -495,9 +495,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 --- a/net80211/ieee80211_wireless.c
307 +++ b/net80211/ieee80211_wireless.c
308 @@ -1557,6 +1557,7 @@
309         return 0;
310  }
311  
312 +#ifdef AR_DEBUG
313  static int 
314  ieee80211_ioctl_hal_map(struct net_device *dev, struct iw_request_info *info,
315         void *w, char *extra)
316 @@ -1567,7 +1568,7 @@
317         params[0] = ic->ic_dump_hal_map(ic);
318         return 0;
319  }
320 -
321 +#endif
322  
323  static int
324  ieee80211_ioctl_radar(struct net_device *dev, struct iw_request_info *info,
325 @@ -5296,8 +5297,10 @@
326           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "getwmmparams" },
327         { IEEE80211_IOCTL_RADAR,
328           0, 0, "doth_radar" },
329 +#ifdef AR_DEBUG
330         { IEEE80211_IOCTL_HALMAP,
331           0, 0, "dump_hal_map" },
332 +#endif
333         /*
334          * These depends on sub-ioctl support which added in version 12.
335          */
336 @@ -5751,7 +5754,9 @@
337         set_priv(IEEE80211_IOCTL_SETMLME, ieee80211_ioctl_setmlme),
338         set_priv(IEEE80211_IOCTL_SETKEY, ieee80211_ioctl_setkey),
339         set_priv(IEEE80211_IOCTL_DELKEY, ieee80211_ioctl_delkey),
340 +#ifdef AR_DEBUG
341         set_priv(IEEE80211_IOCTL_HALMAP, ieee80211_ioctl_hal_map),
342 +#endif
343         set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
344         set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
345         set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
346 --- a/ath/if_ath_debug.h
347 +++ b/ath/if_ath_debug.h
348 @@ -54,6 +54,10 @@
349         ATH_DEBUG_GLOBAL        = (ATH_DEBUG_SKB|ATH_DEBUG_SKB_REF)
350  };
351  
352 +#define        EPRINTF(_sc, _fmt, ...) \
353 +               printk(KERN_ERR "%s: %s: " _fmt, \
354 +                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
355 +
356  #ifdef AR_DEBUG
357  
358  /* DEBUG-ONLY DEFINITIONS */
359 @@ -68,20 +72,9 @@
360                 ath_keyprint((_sc), __func__, _ix, _hk, _mac);          \
361  } while (0)
362  
363 -#else /* #ifdef AR_DEBUG */
364 -
365 -#define        DFLAG_ISSET(sc, _m)             0
366 -#define        DPRINTF(sc, _m, _fmt, ...)
367 -#define        KEYPRINTF(sc, k, ix, mac)
368 -
369 -#endif /* #ifdef AR_DEBUG */
370  
371  #define        IFF_DUMPPKTS(_sc, _m)   DFLAG_ISSET((_sc), (_m))
372  
373 -#define        EPRINTF(_sc, _fmt, ...) \
374 -               printk(KERN_ERR "%s: %s: " _fmt, \
375 -                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
376 -
377  #define        WPRINTF(_sc, _fmt, ...) \
378                 printk(KERN_WARNING "%s: %s: " _fmt, \
379                         SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
380 @@ -89,5 +82,14 @@
381  #define        IPRINTF(_sc, _fmt, ...) \
382                 printk(KERN_INFO "%s: %s: " _fmt, \
383                         SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
384 +#else
385 +#define        DFLAG_ISSET(sc, _m)             0
386 +#define        DPRINTF(sc, _m, _fmt, ...)
387 +#define        KEYPRINTF(sc, k, ix, mac)
388 +#define WPRINTF(...)
389 +#define IPRINTF(...)
390 +#define IFF_DUMPPKTS(...) 0
391 +
392 +#endif
393  
394  #endif /* #ifndef _IF_ATH_DEBUG_H_ */
395 --- a/ath/if_ath_pci.c
396 +++ b/ath/if_ath_pci.c
397 @@ -134,8 +134,10 @@
398         u16 vdevice;
399         int i;
400  
401 -       if (pci_enable_device(pdev))
402 +       if (pci_enable_device(pdev)) {
403 +               printk(KERN_ERR "%s: failed to enable PCI device\n", dev_info);
404                 return -EIO;
405 +       }
406  
407         /* XXX 32-bit addressing only */
408         if (pci_set_dma_mask(pdev, 0xffffffff)) {
409 @@ -244,8 +246,10 @@
410                 sc->aps_sc.sc_ledpin = 1;
411         }
412  
413 -       if (ath_attach(vdevice, dev, NULL) != 0)
414 +       if ((i = ath_attach(vdevice, dev, NULL)) != 0) {
415 +               printk(KERN_ERR "%s: ath_attach failed: %d\n", dev_info, i);
416                 goto bad4;
417 +       }
418  
419         athname = ath_hal_probe(id->vendor, vdevice);
420         printk(KERN_INFO "%s: %s: %s: mem=0x%llx, irq=%d\n",