summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2005-11-23 21:29:01 +0000
committerdamien <damien@openbsd.org>2005-11-23 21:29:01 +0000
commit86c6bfc5b2b167224cd0bb5fbbce2e53e7a35491 (patch)
tree9e68cadaffd809f4d00340a16e5c806c761ba68c
parentBe more robust when handling Rx interrupts. If we can't allocate and DMA map (diff)
downloadwireguard-openbsd-86c6bfc5b2b167224cd0bb5fbbce2e53e7a35491.tar.xz
wireguard-openbsd-86c6bfc5b2b167224cd0bb5fbbce2e53e7a35491.zip
When defragmenting a mbuf chain before transmitting it, don't allocate a mbuf
cluster if the payload fits in the header. From NetBSD (scw@)
-rw-r--r--sys/dev/ic/ral.c14
-rw-r--r--sys/dev/pci/if_ipw.c14
-rw-r--r--sys/dev/pci/if_iwi.c14
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));