diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2005-11-23 21:29:06 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2005-11-23 21:29:06 +0000 |
commit | 8455b9165f2fdb3ec2a674ff9e974ea8a9fe6629 (patch) | |
tree | dd8c8ef7ce439e23a329b797488d0de015236e77 /sys/dev | |
parent | e2580f5bbb96b22ee8b0ee7ac9823b901bf374bd (diff) |
When defragmenting a mbuf chain before transmitting it, don't allocate a mbuf
cluster if the payload fits in the header.
From NetBSD (scw@)
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ral.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/if_ipw.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/if_iwi.c | 14 |
3 files changed, 24 insertions, 18 deletions
diff --git a/sys/dev/ic/ral.c b/sys/dev/ic/ral.c index 904a1603d11..8f14d79214a 100644 --- a/sys/dev/ic/ral.c +++ b/sys/dev/ic/ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ral.c,v 1.64 2005/11/23 20:51:20 damien Exp $ */ +/* $OpenBSD: ral.c,v 1.65 2005/11/23 21:29:01 damien Exp $ */ /*- * Copyright (c) 2005 @@ -1918,11 +1918,13 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) } M_DUP_PKTHDR(mnew, m0); - MCLGET(mnew, M_DONTWAIT); - if (!(mnew->m_flags & M_EXT)) { - m_freem(m0); - m_freem(mnew); - return ENOMEM; + 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)); diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 8834119e57a..4e4d1399e44 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.51 2005/11/23 21:15:29 damien Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.52 2005/11/23 21:29:05 damien Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -1211,11 +1211,13 @@ ipw_tx_start(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni) } M_DUP_PKTHDR(mnew, m); - MCLGET(mnew, M_DONTWAIT); - if (!(mnew->m_flags & M_EXT)) { - m_freem(m); - m_freem(mnew); - return ENOMEM; + if (m->m_pkthdr.len > MHLEN) { + MCLGET(mnew, M_DONTWAIT); + if (!(mnew->m_flags & M_EXT)) { + m_freem(m); + m_freem(mnew); + return ENOMEM; + } } m_copydata(m, 0, m->m_pkthdr.len, mtod(mnew, caddr_t)); diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 3dd96512a6e..57e00f93e00 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.54 2005/11/23 21:08:46 damien Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.55 2005/11/23 21:29:05 damien Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -1174,11 +1174,13 @@ iwi_tx_start(struct ifnet *ifp, struct mbuf *m0, struct ieee80211_node *ni) } M_DUP_PKTHDR(mnew, m0); - MCLGET(mnew, M_DONTWAIT); - if (!(mnew->m_flags & M_EXT)) { - m_freem(m0); - m_freem(mnew); - return ENOMEM; + 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)); |