summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/dev/usb/wlan/if_rum.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/dev/usb/wlan/if_rum.c')
-rw-r--r--freebsd/sys/dev/usb/wlan/if_rum.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/freebsd/sys/dev/usb/wlan/if_rum.c b/freebsd/sys/dev/usb/wlan/if_rum.c
index dbb12335..5c826cac 100644
--- a/freebsd/sys/dev/usb/wlan/if_rum.c
+++ b/freebsd/sys/dev/usb/wlan/if_rum.c
@@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$");
* http://www.ralinktech.com.tw/
*/
+#include <rtems/bsd/local/opt_wlan.h>
+
#include <sys/param.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -1421,37 +1423,25 @@ rum_sendprot(struct rum_softc *sc,
const struct mbuf *m, struct ieee80211_node *ni, int prot, int rate)
{
struct ieee80211com *ic = ni->ni_ic;
- const struct ieee80211_frame *wh;
struct rum_tx_data *data;
struct mbuf *mprot;
- int protrate, pktlen, flags, isshort;
- uint16_t dur;
+ int protrate, flags;
RUM_LOCK_ASSERT(sc);
- KASSERT(prot == IEEE80211_PROT_RTSCTS || prot == IEEE80211_PROT_CTSONLY,
- ("protection %d", prot));
- wh = mtod(m, const struct ieee80211_frame *);
- pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN;
+ mprot = ieee80211_alloc_prot(ni, m, rate, prot);
+ if (mprot == NULL) {
+ if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1);
+ device_printf(sc->sc_dev,
+ "could not allocate mbuf for protection mode %d\n", prot);
+ return (ENOBUFS);
+ }
protrate = ieee80211_ctl_rate(ic->ic_rt, rate);
-
- isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0;
- dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort)
- + ieee80211_ack_duration(ic->ic_rt, rate, isshort);
flags = 0;
- if (prot == IEEE80211_PROT_RTSCTS) {
- /* NB: CTS is the same size as an ACK */
- dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort);
+ if (prot == IEEE80211_PROT_RTSCTS)
flags |= RT2573_TX_NEED_ACK;
- mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur);
- } else {
- mprot = ieee80211_alloc_cts(ic, ni->ni_vap->iv_myaddr, dur);
- }
- if (mprot == NULL) {
- /* XXX stat + msg */
- return (ENOBUFS);
- }
+
data = STAILQ_FIRST(&sc->tx_free);
STAILQ_REMOVE_HEAD(&sc->tx_free, next);
sc->tx_nfree--;