PERFORCE change 141358 for review
    Andrew Thompson 
    thompsa at FreeBSD.org
       
    Fri May  9 04:04:04 UTC 2008
    
    
  
http://perforce.freebsd.org/chv.cgi?CH=141358
Change 141358 by thompsa at thompsa_burger on 2008/05/09 04:03:10
	Commit the rest of the DPRINTF changes since I accidentally included
	the compat/ndis files in the last p4 submit.
Affected files ...
.. //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#23 edit
Differences ...
==== //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#23 (text+ko) ====
@@ -83,16 +83,6 @@
 #include <compat/ndis/ndis_var.h>
 #include <dev/if_ndis/if_ndisvar.h>
 
-#define NDIS_DEBUG
-#ifdef NDIS_DEBUG
-#define DPRINTF(x)	do { if (ndis_debug > 0) printf x; } while (0)
-int ndis_debug = 0;
-SYSCTL_INT(_debug, OID_AUTO, ndis, CTLFLAG_RW, &ndis_debug, 0,
-    "if_ndis debug level");
-#else
-#define DPRINTF(x)
-#endif
-
 MODULE_DEPEND(ndis, ether, 1, 1, 1);
 MODULE_DEPEND(ndis, wlan, 1, 1, 1);
 MODULE_DEPEND(ndis, ndisapi, 1, 1, 1);
@@ -497,7 +487,7 @@
 	case NDIS_80211_NETTYPE_11OFDM5:	return (IEEE80211_CHAN_A);
 	case NDIS_80211_NETTYPE_11OFDM24:	return (IEEE80211_CHAN_G);
 	}
-	DPRINTF(("unknown channel nettype %d\n", type));
+	DPRINTF("unknown channel nettype %d\n", type);
 	return (IEEE80211_CHAN_B);	/* Default to 11B chan */
 }
 
@@ -510,7 +500,7 @@
 	case NDIS_80211_NETTYPE_11OFDM5:	return (IEEE80211_MODE_11A);
 	case NDIS_80211_NETTYPE_11OFDM24:	return (IEEE80211_MODE_11G);
 	}
-	DPRINTF(("unknown mode nettype %d\n", type));
+	DPRINTF("unknown mode nettype %d\n", type);
 	return (IEEE80211_MODE_AUTO);
 }
 
@@ -1687,6 +1677,7 @@
 	NDIS_LOCK(sc);
 	if (sc->ndis_link == 0 &&
 	    sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) {
+		DPRINTF("NDIS link up\n");
 		sc->ndis_link = 1;
 		NDIS_UNLOCK(sc);
 		if (sc->ndis_80211) {
@@ -1699,6 +1690,7 @@
 
 	if (sc->ndis_link == 1 &&
 	    sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) {
+		DPRINTF("NDIS link down\n");
 		sc->ndis_link = 0;
 		if (sc->ndis_80211)
 			ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
@@ -2095,7 +2087,7 @@
 		arg = NDIS_80211_WEPSTAT_ENC3ENABLED;
 	}
 
-	DPRINTF(("Setting cipher to %d\n", arg));
+	DPRINTF("Setting cipher to %d\n", arg);
 	save = arg;
 	rval = ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &len);
 
@@ -2146,7 +2138,7 @@
 
 	/* Check for the right kind of IE. */
 	if (w->wpa_id != IEEE80211_ELEMID_VENDOR) {
-		DPRINTF(("Incorrect IE type %d\n", w->wpa_id));
+		DPRINTF("Incorrect IE type %d\n", w->wpa_id);
 		return(EINVAL);
 	}
 
@@ -2172,7 +2164,7 @@
 	if (n->ni_val == WPA_ASE_8021X_PSK)
 		arg = NDIS_80211_AUTHMODE_WPAPSK;
 
-	DPRINTF(("Setting WPA auth mode to %d\n", arg));
+	DPRINTF("Setting WPA auth mode to %d\n", arg);
 	i = sizeof(arg);
 	if (ndis_set_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &i))
 		return(ENOTSUP);
@@ -2244,7 +2236,7 @@
 	ni = vap->iv_bss;
 
 	if (!NDIS_INITIALIZED(sc)) {
-		DPRINTF(("%s: NDIS not initialized\n", __func__));
+		DPRINTF("%s: NDIS not initialized\n", __func__);
 		return;
 	}
 
@@ -2261,7 +2253,7 @@
 		arg = NDIS_80211_NET_INFRA_IBSS;
 	else
 		arg = NDIS_80211_NET_INFRA_BSS;
-
+	DPRINTF("setting INFRA mode to %d\n", arg);
 	rval = ndis_set_info(sc, OID_802_11_INFRASTRUCTURE_MODE, &arg, &len);
 
 	if (rval)
@@ -2271,12 +2263,14 @@
 
 	len = sizeof(arg);
 	arg = vap->iv_rtsthreshold;
+	DPRINTF("setting RTS threshold to %d\n", arg);
 	ndis_set_info(sc, OID_802_11_RTS_THRESHOLD, &arg, &len);
 
 	/* Set fragmentation threshold */
 
 	len = sizeof(arg);
 	arg = vap->iv_fragthreshold;
+	DPRINTF("setting FRAG threshold to %d\n", arg);
 	ndis_set_info(sc, OID_802_11_FRAGMENTATION_THRESHOLD, &arg, &len);
 
 	/* Set power management */
@@ -2318,7 +2312,7 @@
 		if (ni->ni_authmode == IEEE80211_AUTH_SHARED) {
 			len = sizeof(arg);
 			arg = NDIS_80211_AUTHMODE_SHARED;
-			DPRINTF(("Setting shared auth\n"));
+			DPRINTF("Setting shared auth\n");
 			ndis_set_info(sc, OID_802_11_AUTHENTICATION_MODE,
 			    &arg, &len);
 		}
@@ -2353,7 +2347,7 @@
 				bcopy(vap->iv_nw_keys[i].wk_key,
 				    wep.nw_keydata, wep.nw_length);
 				len = sizeof(wep);
-				DPRINTF(("Setting WEP key %d\n", i));
+				DPRINTF("Setting WEP key %d\n", i);
 				rval = ndis_set_info(sc,
 				    OID_802_11_ADD_WEP, &wep, &len);
 				if (rval)
@@ -2363,7 +2357,7 @@
 			}
 		}
 		if (keys_set) {
-			DPRINTF(("Setting WEP on\n"));
+			DPRINTF("Setting WEP on\n");
 			arg = NDIS_80211_WEPSTAT_ENABLED;
 			len = sizeof(arg);
 			rval = ndis_set_info(sc,
@@ -2412,7 +2406,7 @@
 	}
 
 	if (arg) {
-		DPRINTF(("Setting network type to %d\n", arg));
+		DPRINTF("Setting network type to %d\n", arg);
 		len = sizeof(arg);
 		rval = ndis_set_info(sc, OID_802_11_NETWORK_TYPE_IN_USE,
 		    &arg, &len);
@@ -2453,7 +2447,7 @@
 			config.nc_length = len;
 			config.nc_fhconfig.ncf_length =
 			    sizeof(ndis_80211_config_fh);
-			DPRINTF(("Setting channel to %ukHz\n", config.nc_dsconfig));
+			DPRINTF("Setting channel to %ukHz\n", config.nc_dsconfig);
 			rval = ndis_set_info(sc, OID_802_11_CONFIGURATION,
 			    &config, &len);
 			if (rval)
@@ -2486,7 +2480,7 @@
 	else
 		bcopy(ifp->if_broadcastaddr, bssid, len);
 
-	DPRINTF(("Setting BSSID to %6D\n", (uint8_t *)&bssid, ":"));
+	DPRINTF("Setting BSSID to %6D\n", (uint8_t *)&bssid, ":");
 	rval = ndis_set_info(sc, OID_802_11_BSSID, &bssid, &len);
 	if (rval)
 		device_printf(sc->ndis_dev,
@@ -3145,9 +3139,9 @@
 	struct ndis_softc *sc = ifp->if_softc;
 	enum ieee80211_state ostate;
 
-	DPRINTF(("%s: %s -> %s\n", __func__,
+	DPRINTF("%s: %s -> %s\n", __func__,
 		ieee80211_state_name[vap->iv_state],
-		ieee80211_state_name[nstate]));
+		ieee80211_state_name[nstate]);
 
 	ostate = vap->iv_state;
 	vap->iv_state = nstate;
@@ -3187,7 +3181,7 @@
 	vap = TAILQ_FIRST(&ic->ic_vaps);
 
 	if (!NDIS_INITIALIZED(sc)) {
-		DPRINTF(("%s: scan aborted\n", __func__));
+		DPRINTF("%s: scan aborted\n", __func__);
 		ieee80211_cancel_scan(vap);
 		return;
 	}
@@ -3201,16 +3195,23 @@
 		ssid.ns_ssidlen = ss->ss_ssid[0].len;
 		bcopy(ss->ss_ssid[0].ssid, ssid.ns_ssid, ssid.ns_ssidlen);
 	}
+#ifdef NDIS_DEBUG
+	if (ndis_debug > 0) {
+		printf("Setting scan ESSID to ");
+		ieee80211_print_essid(ssid.ns_ssid, ssid.ns_ssidlen);
+		printf("\n");
+	}
+#endif
 
 	error = ndis_set_info(sc, OID_802_11_SSID, &ssid, &len);
 	if (error)
-		DPRINTF(("%s: set ESSID failed\n", __func__));
+		DPRINTF("%s: set ESSID failed\n", __func__);
 
 	len = 0;
 	error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN,
 	    NULL, &len);
 	if (error) {
-		DPRINTF(("%s: scan command failed\n", __func__));
+		DPRINTF("%s: scan command failed\n", __func__);
 		ieee80211_cancel_scan(vap);
 		return;
 	}
@@ -3261,12 +3262,12 @@
 		error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len);
 	}
 	if (error) {
-		DPRINTF(("%s: failed to read\n", __func__));
+		DPRINTF("%s: failed to read\n", __func__);
 		free(bl, M_DEVBUF);
 		return;;
 	}
 
-	DPRINTF(("%s: %d results\n", __func__, bl->nblx_items));
+	DPRINTF("%s: %d results\n", __func__, bl->nblx_items);
 	rstamp++;
 	wb = &bl->nblx_bssid[0];
 	for (i = 0; i < bl->nblx_items; i++) {
@@ -3336,9 +3337,9 @@
 			}
 		}
 done:
-		DPRINTF(("scan: bssid %s chan %dMHz (%d/%d) rssi %d\n",
+		DPRINTF("scan: bssid %s chan %dMHz (%d/%d) rssi %d\n",
 		    ether_sprintf(wb->nwbx_macaddr), freq, sp.bchan, chanflag,
-		    rssi));
+		    rssi);
 		ieee80211_add_scan(vap, &sp, &wh, 0, rssi, noise, rstamp);
 		wb = (ndis_wlan_bssid_ex *)((char *)wb + wb->nwbx_len);
 	}
    
    
More information about the p4-projects
mailing list