-/* $OpenBSD: if_ipw.c,v 1.107 2015/02/10 23:25:46 mpi Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.108 2015/05/27 22:10:52 kettenis Exp $ */
/*-
* Copyright (c) 2004-2008
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_frame *wh;
struct ieee80211_key *k;
- struct mbuf *m1;
struct ipw_soft_bd *sbd;
struct ipw_soft_hdr *shdr;
struct ipw_soft_buf *sbuf;
}
if (error != 0) {
/* too many fragments, linearize */
- MGETHDR(m1, M_DONTWAIT, MT_DATA);
- if (m1 == NULL) {
+ if (m_defrag(m, M_DONTWAIT)) {
m_freem(m);
return ENOBUFS;
}
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m1, M_DONTWAIT);
- if (!(m1->m_flags & M_EXT)) {
- m_freem(m);
- m_freem(m1);
- return ENOBUFS;
- }
- }
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m1, caddr_t));
- m1->m_pkthdr.len = m1->m_len = m->m_pkthdr.len;
- m_freem(m);
- m = m1;
-
error = bus_dmamap_load_mbuf(sc->sc_dmat, sbuf->map, m,
BUS_DMA_NOWAIT);
if (error != 0) {
-/* $OpenBSD: if_iwi.c,v 1.124 2015/03/14 03:38:48 jsg Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.125 2015/05/27 22:10:52 kettenis Exp $ */
/*-
* Copyright (c) 2004-2008
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_frame *wh;
struct ieee80211_key *k;
- struct mbuf *m1;
struct iwi_tx_data *data;
struct iwi_tx_desc *desc;
struct iwi_tx_ring *txq = &sc->txq[0];
}
if (error != 0) {
/* too many fragments, linearize */
- MGETHDR(m1, M_DONTWAIT, MT_DATA);
- if (m1 == NULL) {
+ if (m_defrag(m0, M_DONTWAIT)) {
m_freem(m0);
return ENOBUFS;
}
- if (m0->m_pkthdr.len > MHLEN) {
- MCLGET(m1, M_DONTWAIT);
- if (!(m1->m_flags & M_EXT)) {
- m_freem(m0);
- m_freem(m1);
- return ENOBUFS;
- }
- }
- m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m1, caddr_t));
- m1->m_pkthdr.len = m1->m_len = m0->m_pkthdr.len;
- m_freem(m0);
- m0 = m1;
-
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0,
BUS_DMA_NOWAIT);
if (error != 0) {
-/* $OpenBSD: if_iwn.c,v 1.142 2015/04/08 09:29:49 jasper Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.143 2015/05/27 22:10:52 kettenis Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
const struct iwn_rate *rinfo;
struct ieee80211_frame *wh;
struct ieee80211_key *k = NULL;
- struct mbuf *m1;
enum ieee80211_edca_ac ac;
uint32_t flags;
uint16_t qos;
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
BUS_DMA_NOWAIT | BUS_DMA_WRITE);
+ if (error != 0 && error != EFBIG) {
+ printf("%s: can't map mbuf (error %d)\n",
+ sc->sc_dev.dv_xname, error);
+ m_freem(m);
+ return error;
+ }
if (error != 0) {
- if (error != EFBIG) {
- printf("%s: can't map mbuf (error %d)\n",
- sc->sc_dev.dv_xname, error);
- m_freem(m);
- return error;
- }
/* Too many DMA segments, linearize mbuf. */
- MGETHDR(m1, M_DONTWAIT, MT_DATA);
- if (m1 == NULL) {
+ if (m_defrag(m, M_DONTWAIT)) {
m_freem(m);
return ENOBUFS;
}
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m1, M_DONTWAIT);
- if (!(m1->m_flags & M_EXT)) {
- m_freem(m);
- m_freem(m1);
- return ENOBUFS;
- }
- }
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m1, caddr_t));
- m1->m_pkthdr.len = m1->m_len = m->m_pkthdr.len;
- m_freem(m);
- m = m1;
-
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
BUS_DMA_NOWAIT | BUS_DMA_WRITE);
if (error != 0) {
-/* $OpenBSD: if_wpi.c,v 1.126 2015/03/16 04:09:53 jsg Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.127 2015/05/27 22:10:52 kettenis Exp $ */
/*-
* Copyright (c) 2006-2008
const struct wpi_rate *rinfo;
struct ieee80211_frame *wh;
struct ieee80211_key *k = NULL;
- struct mbuf *m1;
enum ieee80211_edca_ac ac;
uint32_t flags;
uint16_t qos;
}
if (error != 0) {
/* Too many DMA segments, linearize mbuf. */
- MGETHDR(m1, M_DONTWAIT, MT_DATA);
- if (m1 == NULL) {
+ if (m_defrag(m, M_DONTWAIT)) {
m_freem(m);
return ENOBUFS;
}
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m1, M_DONTWAIT);
- if (!(m1->m_flags & M_EXT)) {
- m_freem(m);
- m_freem(m1);
- return ENOBUFS;
- }
- }
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m1, caddr_t));
- m1->m_pkthdr.len = m1->m_len = m->m_pkthdr.len;
- m_freem(m);
- m = m1;
-
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
BUS_DMA_NOWAIT | BUS_DMA_WRITE);
if (error != 0) {