From owner-svn-src-all@freebsd.org Sat Dec 10 20:19:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAAE4C7119A; Sat, 10 Dec 2016 20:19:58 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C550E1AEB; Sat, 10 Dec 2016 20:19:58 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBAKJvOh031782; Sat, 10 Dec 2016 20:19:57 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBAKJvif031781; Sat, 10 Dec 2016 20:19:57 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612102019.uBAKJvif031781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 10 Dec 2016 20:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309827 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2016 20:19:59 -0000 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 #include "usbdevs.h" -#define USB_DEBUG_VAR rsu_debug -#include - #include #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))) {