PERFORCE change 136065 for review

Sam Leffler sam at FreeBSD.org
Sun Feb 24 05:43:08 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136065

Change 136065 by sam at sam_ebb on 2008/02/24 05:43:02

	o split probe response frame construction into a new
	  ieee80211_alloc_proberesp routine for use by drivers
	o add missing classification of probe response frames

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_output.c#36 edit
.. //depot/projects/vap/sys/net80211/ieee80211_proto.h#16 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_output.c#36 (text+ko) ====

@@ -2037,43 +2037,21 @@
 }
 
 /*
- * Send a probe response frame to the specified mac address.
- * This does not go through the normal mgt frame api so we
- * can specify the destination address and re-use the bss node
- * for the sta reference.
+ * Return an mbuf with a probe response frame in it.
+ * Space is left to prepend and 802.11 header at the
+ * front but it's left to the caller to fill in.
  */
-int
-ieee80211_send_proberesp(struct ieee80211vap *vap,
-	const uint8_t da[IEEE80211_ADDR_LEN], int legacy)
+struct mbuf *
+ieee80211_alloc_proberesp(struct ieee80211_node *bss, int legacy)
 {
-	struct ieee80211_node *bss = vap->iv_bss;
-	struct ieee80211com *ic = vap->iv_ic;
-	struct ieee80211_frame *wh;
+	struct ieee80211vap *vap = bss->ni_vap;
+	struct ieee80211com *ic = bss->ni_ic;
 	const struct ieee80211_rateset *rs;
 	struct mbuf *m;
 	uint16_t capinfo;
 	uint8_t *frm;
 
-	if (vap->iv_state == IEEE80211_S_CAC) {
-		IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, bss,
-		    "block %s frame in CAC state", "probe response");
-		vap->iv_stats.is_tx_badstate++;
-		return EIO;		/* XXX */
-	}
-
 	/*
-	 * Hold a reference on the node so it doesn't go away until after
-	 * the xmit is complete all the way in the driver.  On error we
-	 * will remove our reference.
-	 */
-	IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
-		"ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n",
-		__func__, __LINE__,
-		bss, ether_sprintf(bss->ni_macaddr),
-		ieee80211_node_refcnt(bss)+1);
-	ieee80211_ref_node(bss);
-
-	/*
 	 * probe response frame format
 	 *	[8] time stamp
 	 *	[2] beacon interval
@@ -2123,8 +2101,7 @@
 	);
 	if (m == NULL) {
 		vap->iv_stats.is_tx_nobuf++;
-		ieee80211_free_node(bss);
-		return ENOMEM;
+		return NULL;
 	}
 
 	memset(frm, 0, 8);	/* timestamp should be filled later */
@@ -2207,6 +2184,48 @@
 		frm = add_appie(frm, vap->iv_appie_proberesp);
 	m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *);
 
+	return m;
+}
+
+/*
+ * Send a probe response frame to the specified mac address.
+ * This does not go through the normal mgt frame api so we
+ * can specify the destination address and re-use the bss node
+ * for the sta reference.
+ */
+int
+ieee80211_send_proberesp(struct ieee80211vap *vap,
+	const uint8_t da[IEEE80211_ADDR_LEN], int legacy)
+{
+	struct ieee80211_node *bss = vap->iv_bss;
+	struct ieee80211com *ic = vap->iv_ic;
+	struct ieee80211_frame *wh;
+	struct mbuf *m;
+
+	if (vap->iv_state == IEEE80211_S_CAC) {
+		IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, bss,
+		    "block %s frame in CAC state", "probe response");
+		vap->iv_stats.is_tx_badstate++;
+		return EIO;		/* XXX */
+	}
+
+	/*
+	 * Hold a reference on the node so it doesn't go away until after
+	 * the xmit is complete all the way in the driver.  On error we
+	 * will remove our reference.
+	 */
+	IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
+	    "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n",
+	    __func__, __LINE__, bss, ether_sprintf(bss->ni_macaddr),
+	    ieee80211_node_refcnt(bss)+1);
+	ieee80211_ref_node(bss);
+
+	m = ieee80211_alloc_proberesp(bss, legacy);
+	if (m == NULL) {
+		ieee80211_free_node(bss);
+		return ENOMEM;
+	}
+
 	M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT);
 	KASSERT(m != NULL, ("no room for header"));
 
@@ -2216,11 +2235,12 @@
 		vap->iv_myaddr, da, bss->ni_bssid);
 	/* XXX power management? */
 
-	IEEE80211_NODE_STAT(bss, tx_mgmt);
+	M_WME_SETAC(m, WME_AC_BE);
 
 	IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS,
 	    wh->i_addr1, "send probe resp on channel %u",
 	    ieee80211_chan2ieee(ic, ic->ic_curchan));
+	IEEE80211_NODE_STAT(bss, tx_mgmt);
 
 	return ic->ic_raw_xmit(bss, m, NULL);
 }

==== //depot/projects/vap/sys/net80211/ieee80211_proto.h#16 (text+ko) ====

@@ -47,16 +47,6 @@
 #define	IEEE80211_SEND_MGMT(_ni,_type,_arg) \
 	((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))
 
-/*
- * The formation of some management frames requires guidance to
- * deal with legacy clients.  When the client is identified as
- * "legacy 11b" this parameter can be passed in the arg param of a
- * IEEE80211_SEND_MGMT call.
- */
-#define	IEEE80211_SEND_LEGACY_11B	0x1	/* legacy 11b client */
-#define	IEEE80211_SEND_LEGACY_11	0x2	/* other legacy client */
-#define	IEEE80211_SEND_LEGACY		0x3	/* any legacy client */
-
 extern	const char *ieee80211_mgt_subtype_name[];
 extern	const char *ieee80211_phymode_name[];
 
@@ -82,6 +72,7 @@
 void	ieee80211_start(struct ifnet *);
 int	ieee80211_send_nulldata(struct ieee80211_node *);
 int	ieee80211_classify(struct ieee80211_node *, struct mbuf *m);
+struct mbuf *ieee80211_encap(struct ieee80211_node *, struct mbuf *);
 int	ieee80211_send_mgmt(struct ieee80211_node *, int, int);
 struct ieee80211_appie;
 int	ieee80211_send_probereq(struct ieee80211_node *ni,
@@ -89,9 +80,17 @@
 		const uint8_t da[IEEE80211_ADDR_LEN],
 		const uint8_t bssid[IEEE80211_ADDR_LEN],
 		const uint8_t *ssid, size_t ssidlen);
+/*
+ * The formation of ProbeResponse frames requires guidance to
+ * deal with legacy clients.  When the client is identified as
+ * "legacy 11b" ieee80211_send_proberesp is passed this token.
+ */
+#define	IEEE80211_SEND_LEGACY_11B	0x1	/* legacy 11b client */
+#define	IEEE80211_SEND_LEGACY_11	0x2	/* other legacy client */
+#define	IEEE80211_SEND_LEGACY		0x3	/* any legacy client */
+struct mbuf *ieee80211_alloc_proberesp(struct ieee80211_node *, int);
 int	ieee80211_send_proberesp(struct ieee80211vap *,
 		const uint8_t da[IEEE80211_ADDR_LEN], int);
-struct mbuf *ieee80211_encap(struct ieee80211_node *, struct mbuf *);
 
 void	ieee80211_reset_erp(struct ieee80211com *);
 void	ieee80211_set_shortslottime(struct ieee80211com *, int onoff);


More information about the p4-projects mailing list