summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2013-08-26 09:52:05 +0000
committeradrian <adrian@FreeBSD.org>2013-08-26 09:52:05 +0000
commitce40cb7097e047f57e790a30bd01abeb620b57e8 (patch)
tree18bb416de2e6e62ea19d05364dcbe51e60ac770d /sys/net80211
parentb34d889a8e8f1965dd3ff78a3e7f5d22d2a6e372 (diff)
downloadFreeBSD-src-ce40cb7097e047f57e790a30bd01abeb620b57e8.zip
FreeBSD-src-ce40cb7097e047f57e790a30bd01abeb620b57e8.tar.gz
Migrate the ff_encap1() routine out into the normal output code.
This will eventually be used by the A-MSDU encapsulation code that I'm writing - the sub-frame encapsulation requirement is the same.
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_output.c37
-rw-r--r--sys/net80211/ieee80211_proto.h3
-rw-r--r--sys/net80211/ieee80211_superg.c41
3 files changed, 42 insertions, 39 deletions
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 5afe70a..96bf0ec 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -3316,3 +3316,40 @@ ieee80211_beacon_update(struct ieee80211_node *ni,
return len_changed;
}
+
+/*
+ * Do Ethernet-LLC encapsulation for each payload in a fast frame
+ * tunnel encapsulation. The frame is assumed to have an Ethernet
+ * header at the front that must be stripped before prepending the
+ * LLC followed by the Ethernet header passed in (with an Ethernet
+ * type that specifies the payload size).
+ */
+struct mbuf *
+ieee80211_ff_encap1(struct ieee80211vap *vap, struct mbuf *m,
+ const struct ether_header *eh)
+{
+ struct llc *llc;
+ uint16_t payload;
+
+ /* XXX optimize by combining m_adj+M_PREPEND */
+ m_adj(m, sizeof(struct ether_header) - sizeof(struct llc));
+ llc = mtod(m, struct llc *);
+ llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
+ llc->llc_control = LLC_UI;
+ llc->llc_snap.org_code[0] = 0;
+ llc->llc_snap.org_code[1] = 0;
+ llc->llc_snap.org_code[2] = 0;
+ llc->llc_snap.ether_type = eh->ether_type;
+ payload = m->m_pkthdr.len; /* NB: w/o Ethernet header */
+
+ M_PREPEND(m, sizeof(struct ether_header), M_NOWAIT);
+ if (m == NULL) { /* XXX cannot happen */
+ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG,
+ "%s: no space for ether_header\n", __func__);
+ vap->iv_stats.is_tx_nobuf++;
+ return NULL;
+ }
+ ETHER_HEADER_COPY(mtod(m, void *), eh);
+ mtod(m, struct ether_header *)->ether_type = htons(payload);
+ return m;
+}
diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h
index ae21087..b8f25da 100644
--- a/sys/net80211/ieee80211_proto.h
+++ b/sys/net80211/ieee80211_proto.h
@@ -125,6 +125,9 @@ int ieee80211_send_probereq(struct ieee80211_node *ni,
const uint8_t da[IEEE80211_ADDR_LEN],
const uint8_t bssid[IEEE80211_ADDR_LEN],
const uint8_t *ssid, size_t ssidlen);
+struct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *,
+ const struct ether_header *);
+
/*
* The formation of ProbeResponse frames requires guidance to
* deal with legacy clients. When the client is identified as
diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c
index 5c72393..21f3b99 100644
--- a/sys/net80211/ieee80211_superg.c
+++ b/sys/net80211/ieee80211_superg.c
@@ -330,43 +330,6 @@ ieee80211_ff_decap(struct ieee80211_node *ni, struct mbuf *m)
}
/*
- * Do Ethernet-LLC encapsulation for each payload in a fast frame
- * tunnel encapsulation. The frame is assumed to have an Ethernet
- * header at the front that must be stripped before prepending the
- * LLC followed by the Ethernet header passed in (with an Ethernet
- * type that specifies the payload size).
- */
-static struct mbuf *
-ff_encap1(struct ieee80211vap *vap, struct mbuf *m,
- const struct ether_header *eh)
-{
- struct llc *llc;
- uint16_t payload;
-
- /* XXX optimize by combining m_adj+M_PREPEND */
- m_adj(m, sizeof(struct ether_header) - sizeof(struct llc));
- llc = mtod(m, struct llc *);
- llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
- llc->llc_control = LLC_UI;
- llc->llc_snap.org_code[0] = 0;
- llc->llc_snap.org_code[1] = 0;
- llc->llc_snap.org_code[2] = 0;
- llc->llc_snap.ether_type = eh->ether_type;
- payload = m->m_pkthdr.len; /* NB: w/o Ethernet header */
-
- M_PREPEND(m, sizeof(struct ether_header), M_NOWAIT);
- if (m == NULL) { /* XXX cannot happen */
- IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG,
- "%s: no space for ether_header\n", __func__);
- vap->iv_stats.is_tx_nobuf++;
- return NULL;
- }
- ETHER_HEADER_COPY(mtod(m, void *), eh);
- mtod(m, struct ether_header *)->ether_type = htons(payload);
- return m;
-}
-
-/*
* Fast frame encapsulation. There must be two packets
* chained with m_nextpkt. We do header adjustment for
* each, add the tunnel encapsulation, and then concatenate
@@ -424,10 +387,10 @@ ieee80211_ff_encap(struct ieee80211vap *vap, struct mbuf *m1, int hdrspace,
* Now do tunnel encapsulation. First, each
* frame gets a standard encapsulation.
*/
- m1 = ff_encap1(vap, m1, &eh1);
+ m1 = ieee80211_ff_encap1(vap, m1, &eh1);
if (m1 == NULL)
goto bad;
- m2 = ff_encap1(vap, m2, &eh2);
+ m2 = ieee80211_ff_encap1(vap, m2, &eh2);
if (m2 == NULL)
goto bad;
OpenPOWER on IntegriCloud