From 9fb0fccb89d92486ed79651a6de00c35f3d0fd61 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Wed, 8 Apr 2009 16:19:50 +0000 Subject: [PATCH] o add a capability for drivers that require 802.3 encapsulation of frames passed down through the transmit path o mark ndis requiring 802.3 encap'd frames Reviewed by: "Paul B. Mahol" , thompsa --- sys/dev/if_ndis/if_ndis.c | 3 ++- sys/net80211/ieee80211_output.c | 18 ++++++++++-------- sys/net80211/ieee80211_var.h | 5 +++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index b16bdb6c6ae7..a3bda2c3b27f 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -753,7 +753,8 @@ ndis_attach(dev) ic->ic_ifp = ifp; ic->ic_opmode = IEEE80211_M_STA; ic->ic_phytype = IEEE80211_T_DS; - ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS; + ic->ic_caps = IEEE80211_C_8023ENCAP | + IEEE80211_C_STA | IEEE80211_C_IBSS; setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); len = 0; r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED, diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 5705c514389b..21e0370e7ce4 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -253,14 +253,16 @@ ieee80211_start(struct ifnet *ifp) } } #endif /* IEEE80211_SUPPORT_SUPERG */ - /* - * Encapsulate the packet in prep for transmission. - */ - m = ieee80211_encap(vap, ni, m); - if (m == NULL) { - /* NB: stat+msg handled in ieee80211_encap */ - ieee80211_free_node(ni); - continue; + if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { + /* + * Encapsulate the packet in prep for transmission. + */ + m = ieee80211_encap(vap, ni, m); + if (m == NULL) { + /* NB: stat+msg handled in ieee80211_encap */ + ieee80211_free_node(ni); + continue; + } } /* diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index db0485cbf551..47050475875f 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -532,8 +532,9 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FVEN_BITS "\20" /* ic_caps/iv_caps: device driver capabilities */ -/* 0x2f available */ +/* 0x2e available */ #define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */ +#define IEEE80211_C_8023ENCAP 0x00000002 /* CAPABILITY: 802.3 encap */ #define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */ #define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/ #define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */ @@ -565,7 +566,7 @@ MALLOC_DECLARE(M_80211_VAP); IEEE80211_C_TDMA) #define IEEE80211_C_BITS \ - "\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \ + "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \ "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ "\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ "\37TXFRAG\40TDMA"