Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144457065
D48265.1774707107.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D48265.1774707107.diff
View Options
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -936,8 +936,8 @@
mb_free_extpg(old_m);
}
-static struct mbuf *
-_mb_unmapped_to_ext(struct mbuf *m)
+static int
+_mb_unmapped_to_ext(struct mbuf *m, struct mbuf **mres)
{
struct mbuf *m_new, *top, *prev, *mref;
struct sf_buf *sf;
@@ -947,9 +947,15 @@
u_int ref_inc = 0;
M_ASSERTEXTPG(m);
+
+ if (m->m_epg_tls != NULL) {
+ /* can't convert TLS mbuf */
+ m_freem(m);
+ *mres = NULL;
+ return (EINVAL);
+ }
+
len = m->m_len;
- KASSERT(m->m_epg_tls == NULL, ("%s: can't convert TLS mbuf %p",
- __func__, m));
/* See if this is the mbuf that holds the embedded refcount. */
if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) {
@@ -1048,7 +1054,8 @@
atomic_add_int(refcnt, ref_inc);
}
m_free(m);
- return (top);
+ *mres = top;
+ return (0);
fail:
if (ref_inc != 0) {
@@ -1065,13 +1072,15 @@
}
m_free(m);
m_freem(top);
- return (NULL);
+ *mres = NULL;
+ return (ENOMEM);
}
-struct mbuf *
-mb_unmapped_to_ext(struct mbuf *top)
+int
+mb_unmapped_to_ext(struct mbuf *top, struct mbuf **mres)
{
- struct mbuf *m, *next, *prev = NULL;
+ struct mbuf *m, *m1, *next, *prev = NULL;
+ int error;
prev = NULL;
for (m = top; m != NULL; m = next) {
@@ -1087,12 +1096,15 @@
*/
prev->m_next = NULL;
}
- m = _mb_unmapped_to_ext(m);
- if (m == NULL) {
- m_freem(top);
+ error = _mb_unmapped_to_ext(m, &m1);
+ if (error != 0) {
+ if (top != m)
+ m_free(top);
m_freem(next);
- return (NULL);
+ *mres = NULL;
+ return (error);
}
+ m = m1;
if (prev == NULL) {
top = m;
} else {
@@ -1111,7 +1123,8 @@
prev = m;
}
}
- return (top);
+ *mres = top;
+ return (0);
}
/*
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -813,7 +813,7 @@
struct mbuf *mb_mapped_to_unmapped(struct mbuf *, int, int, int,
struct mbuf **);
int mb_unmapped_compress(struct mbuf *m);
-struct mbuf *mb_unmapped_to_ext(struct mbuf *m);
+int mb_unmapped_to_ext(struct mbuf *m, struct mbuf **mres);
void mb_free_notready(struct mbuf *m, int count);
void m_adj(struct mbuf *, int);
void m_adj_decap(struct mbuf *, int);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 28, 2:11 PM (17 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28218403
Default Alt Text
D48265.1774707107.diff (2 KB)
Attached To
Mode
D48265: ipsec: improve integration with unmapped mbufs (on Tx)
Attached
Detach File
Event Timeline
Log In to Comment