Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Dec 2016 20:19:57 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309827 - head/sys/dev/usb/wlan
Message-ID:  <201612102019.uBAKJvif031781@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sat Dec 10 20:19:57 2016
New Revision: 309827
URL: https://svnweb.freebsd.org/changeset/base/309827

Log:
  rsu: use bitmap for all debug messages.
  
  - Replace all remaining DPRINTF(N)'s with RSU_DPRINTF.
  - Add new RSU_DEBUG_USB flag to track error codes returned by
  usbd_do_request_flags().
  - Improve few messages.

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rsu.c	Sat Dec 10 19:14:51 2016	(r309826)
+++ head/sys/dev/usb/wlan/if_rsu.c	Sat Dec 10 20:19:57 2016	(r309827)
@@ -68,9 +68,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/usb/usbdi.h>
 #include "usbdevs.h"
 
-#define USB_DEBUG_VAR rsu_debug
-#include <dev/usb/usb_debug.h>
-
 #include <dev/usb/wlan/if_rsureg.h>
 
 #ifdef USB_DEBUG
@@ -103,6 +100,7 @@ TUNABLE_INT("hw.usb.rsu.enable_11n", &rs
 #define	RSU_DEBUG_FWDBG		0x00000200
 #define	RSU_DEBUG_AMPDU		0x00000400
 #define	RSU_DEBUG_KEY		0x00000800
+#define	RSU_DEBUG_USB		0x00001000
 
 static const STRUCT_USB_HOST_ID rsu_devs[] = {
 #define	RSU_HT_NOT_SUPPORTED 0
@@ -665,8 +663,9 @@ rsu_do_request(struct rsu_softc *sc, str
 		    req, data, 0, NULL, 250 /* ms */);
 		if (err == 0 || err == USB_ERR_NOT_CONFIGURED)
 			break;
-		DPRINTFN(1, "Control request failed, %s (retrying)\n",
-		    usbd_errstr(err));
+		RSU_DPRINTF(sc, RSU_DEBUG_USB,
+		    "Control request failed, %s (retries left: %d)\n",
+		    usbd_errstr(err), ntries);
 		rsu_ms_delay(sc, 10);
         }
 
@@ -1207,7 +1206,7 @@ rsu_read_rom(struct rsu_softc *sc)
 		}
 	}
 #ifdef USB_DEBUG
-	if (rsu_debug >= 5) {
+	if (rsu_debug & RSU_DEBUG_RESET) {
 		/* Dump ROM content. */
 		printf("\n");
 		for (i = 0; i < sizeof(sc->rom); i++)
@@ -1294,7 +1293,7 @@ rsu_calib_task(void *arg, int pending __
 	    rsu_read_1(sc, R92S_GPIO_IO_SEL) & ~R92S_GPIO_WPS);
 	reg = rsu_read_1(sc, R92S_GPIO_CTRL);
 	if (reg != 0xff && (reg & R92S_GPIO_WPS))
-		DPRINTF(("WPS PBC is pushed\n"));
+		RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "WPS PBC is pushed\n");
 #endif
 	/* Read current signal level. */
 	if (rsu_fw_iocmd(sc, 0xf4000001) == 0) {
@@ -2113,7 +2112,7 @@ rsu_event_join_bss(struct rsu_softc *sc,
 
 	tmp = le32toh(rsp->associd);
 	if (tmp >= vap->iv_max_aid) {
-		DPRINTF("Assoc ID overflow\n");
+		RSU_DPRINTF(sc, RSU_DEBUG_ANY, "Assoc ID overflow\n");
 		tmp = 1;
 	}
 	RSU_DPRINTF(sc, RSU_DEBUG_STATE | RSU_DEBUG_FWCMD,
@@ -2306,8 +2305,9 @@ rsu_rx_copy_to_mbuf(struct rsu_softc *sc
 
 	m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR);
 	if (__predict_false(m == NULL)) {
-		device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n",
-		    __func__);
+		device_printf(sc->sc_dev,
+		    "%s: could not allocate RX mbuf, totlen %d\n",
+		    __func__, totlen);
 		goto fail;
 	}
 
@@ -2490,7 +2490,7 @@ rsu_rxeof(struct usb_xfer *xfer, struct 
 	usbd_xfer_status(xfer, &len, NULL, NULL, NULL);
 
 	if (__predict_false(len < sizeof(*stat))) {
-		DPRINTF("xfer too short %d\n", len);
+		RSU_DPRINTF(sc, RSU_DEBUG_RX, "xfer too short %d\n", len);
 		counter_u64_add(ic->ic_ierrors, 1);
 		return (NULL);
 	}
@@ -3251,8 +3251,9 @@ rsu_load_firmware(struct rsu_softc *sc)
 		error = EINVAL;
 		goto fail;
 	}
-	DPRINTF("FW V%d %02x-%02x %02x:%02x\n", le16toh(hdr->version),
-	    hdr->month, hdr->day, hdr->hour, hdr->minute);
+	RSU_DPRINTF(sc, RSU_DEBUG_FW, "FW V%d %02x-%02x %02x:%02x\n",
+	    le16toh(hdr->version), hdr->month, hdr->day, hdr->hour,
+	    hdr->minute);
 
 	/* Make sure that driver and firmware are in sync. */
 	if (hdr->privsz != htole32(sizeof(*dmem))) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612102019.uBAKJvif031781>