diff options
Diffstat (limited to 'sys/dev/ic/rt2560.c')
-rw-r--r-- | sys/dev/ic/rt2560.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index e8f9cafdf05..4981fc06a59 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.39 2008/08/27 09:05:03 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.40 2008/11/25 21:43:57 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1699,7 +1699,6 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, struct rt2560_tx_data *data; struct ieee80211_frame *wh; struct ieee80211_key *k; - struct mbuf *mnew; uint16_t dur; uint32_t flags = 0; int pktlen, rate, needcts = 0, needrts = 0, error; @@ -1828,27 +1827,10 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, } if (error != 0) { /* too many fragments, linearize */ - - MGETHDR(mnew, M_DONTWAIT, MT_DATA); - if (mnew == NULL) { + if (m_defrag(m0, M_DONTWAIT) != 0) { m_freem(m0); return ENOMEM; } - M_DUP_PKTHDR(mnew, m0); - if (m0->m_pkthdr.len > MHLEN) { - MCLGET(mnew, M_DONTWAIT); - if (!(mnew->m_flags & M_EXT)) { - m_freem(m0); - m_freem(mnew); - return ENOMEM; - } - } - - m_copydata(m0, 0, m0->m_pkthdr.len, mtod(mnew, caddr_t)); - m_freem(m0); - mnew->m_len = mnew->m_pkthdr.len; - m0 = mnew; - error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0, BUS_DMA_NOWAIT); if (error != 0) { @@ -2551,7 +2533,6 @@ rt2560_read_eeprom(struct rt2560_softc *sc) int rt2560_bbp_init(struct rt2560_softc *sc) { -#define N(a) (sizeof (a) / sizeof ((a)[0])) int i, ntries; /* wait for BBP to be ready */ @@ -2566,7 +2547,7 @@ rt2560_bbp_init(struct rt2560_softc *sc) } /* initialize BBP registers to default values */ - for (i = 0; i < N(rt2560_def_bbp); i++) { + for (i = 0; i < nitems(rt2560_def_bbp); i++) { rt2560_bbp_write(sc, rt2560_def_bbp[i].reg, rt2560_def_bbp[i].val); } @@ -2580,13 +2561,11 @@ rt2560_bbp_init(struct rt2560_softc *sc) #endif return 0; -#undef N } int rt2560_init(struct ifnet *ifp) { -#define N(a) (sizeof (a) / sizeof ((a)[0])) struct rt2560_softc *sc = ifp->if_softc; struct ieee80211com *ic = &sc->sc_ic; uint32_t tmp; @@ -2624,7 +2603,7 @@ rt2560_init(struct ifnet *ifp) RAL_WRITE(sc, RT2560_RXCSR2, sc->rxq.physaddr); /* initialize MAC registers to default values */ - for (i = 0; i < N(rt2560_def_mac); i++) + for (i = 0; i < nitems(rt2560_def_mac); i++) RAL_WRITE(sc, rt2560_def_mac[i].reg, rt2560_def_mac[i].val); IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl)); @@ -2683,7 +2662,6 @@ rt2560_init(struct ifnet *ifp) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); return 0; -#undef N } void |