OpenBSD CVS

CVS log for src/sys/kern/uipc_mbuf.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.290 / (download) - annotate - [select for diffs], Tue Mar 5 18:52:41 2024 UTC (3 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.289: +6 -8 lines
Diff to previous 1.289 (colored)

Revert m_defrag() mbuf alignment to IP header.

m_defrag() is intended as last resort to make DMA transfers to the
hardware.  Therefore page alingment is more important than IP header
alignment.  The reason, why the mbuf returned by m_defrag() was
switched to IP header alingment, was that ether_extract_headers()
failed in em(4) driver with TSO on sparc64.  This has been fixed
by using memcpy().

The alignment change in m_defrag() is too late in the 7.5 relaese
process.  It may affect several drivers on different architectures.
Bus dmamap for ixl(4) on sun4v expects page alignment.  Such alignment
issues and TSO mbuf mapping for IOMMU need more thought.

OK deraadt@

Revision 1.289 / (download) - annotate - [select for diffs], Wed Feb 21 09:28:29 2024 UTC (3 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.288: +8 -5 lines
Diff to previous 1.288 (colored)

Keep mbuf data alignment intact in m_defrag()

The recent TSO support in em(4) triggered an alignment error on the TCP
header. In em(4) m_defrag() is called before setting up the TSO dma bits
and with that the TCP header was suddenly no longer aligned. Like other
mbuf functions preserve the data alignment in m_defrag() to prevent such
unaligned packets.

With help and OK bluhm@ mglocker@

Revision 1.284.6.1 / (download) - annotate - [select for diffs], Wed Oct 25 08:17:54 2023 UTC (7 months, 2 weeks ago) by bluhm
Branch: OPENBSD_7_3
Changes since 1.284: +4 -8 lines
Diff to previous 1.284 (colored) next main 1.285 (colored)

Avoid assertion failure when splitting mbuf cluster.

m_split() calls m_align() to initialize the data pointer of newly
allocated mbuf.  If the new mbuf will be converted to a cluster,
this is not necessary.  If additionally the new mbuf is larger than
MLEN, this can lead to a panic.
Only call m_align() when a valid m_data is needed.  This is the
case if we do not refecence the existing cluster, but memcpy() the
data into the new mbuf.

Reported-by: syzbot+0e6817f5877926f0e96a@syzkaller.appspotmail.com
OK claudio@ deraadt@

this is errata/7.3/019_msplit.patch.sig

Revision 1.287.2.1 / (download) - annotate - [select for diffs], Wed Oct 25 08:17:16 2023 UTC (7 months, 2 weeks ago) by bluhm
Branch: OPENBSD_7_4
Changes since 1.287: +4 -8 lines
Diff to previous 1.287 (colored) next main 1.288 (colored)

Avoid assertion failure when splitting mbuf cluster.

m_split() calls m_align() to initialize the data pointer of newly
allocated mbuf.  If the new mbuf will be converted to a cluster,
this is not necessary.  If additionally the new mbuf is larger than
MLEN, this can lead to a panic.
Only call m_align() when a valid m_data is needed.  This is the
case if we do not refecence the existing cluster, but memcpy() the
data into the new mbuf.

Reported-by: syzbot+0e6817f5877926f0e96a@syzkaller.appspotmail.com
OK claudio@ deraadt@

this is errata/7.4/002_msplit.patch.sig

Revision 1.288 / (download) - annotate - [select for diffs], Fri Oct 20 16:25:15 2023 UTC (7 months, 3 weeks ago) by bluhm
Branch: MAIN
Changes since 1.287: +4 -8 lines
Diff to previous 1.287 (colored)

Avoid assertion failure when splitting mbuf cluster.

m_split() calls m_align() to initialize the data pointer of newly
allocated mbuf.  If the new mbuf will be converted to a cluster,
this is not necessary.  If additionally the new mbuf is larger than
MLEN, this can lead to a panic.
Only call m_align() when a valid m_data is needed.  This is the
case if we do not refecence the existing cluster, but memcpy() the
data into the new mbuf.

Reported-by: syzbot+0e6817f5877926f0e96a@syzkaller.appspotmail.com
OK claudio@ deraadt@

Revision 1.287 / (download) - annotate - [select for diffs], Fri Jun 23 04:36:49 2023 UTC (11 months, 2 weeks ago) by gnezdo
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE
Branch point for: OPENBSD_7_4
Changes since 1.286: +2 -2 lines
Diff to previous 1.286 (colored)

Avoid division by 0 in m_pool_used

OK dlg@

Reported-by: syzbot+a377d5cd833c2343429a@syzkaller.appspotmail.com

Revision 1.286 / (download) - annotate - [select for diffs], Tue May 16 20:09:27 2023 UTC (12 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.285: +2 -2 lines
Diff to previous 1.285 (colored)

Always set maximum queue length to passed in the IFQCTL_MAXLEN case.
This is not the fast path, so dropping mq->mq_maxlen check doesn't
introduce any performance impact, but makes code MP consistent.

Discussed with and ok from bluhm@

Revision 1.285 / (download) - annotate - [select for diffs], Fri May 5 01:19:51 2023 UTC (13 months, 1 week ago) by bluhm
Branch: MAIN
Changes since 1.284: +11 -6 lines
Diff to previous 1.284 (colored)

The mbuf_queue API allows read access to integer variables which
another CPU may change simultaneously.  To prevent miss optimisation
by the compiler, they need the READ_ONCE() macro.  Otherwise there
could be two read operations with inconsistent values.  Writing to
integer in mq_set_maxlen() needs mutex protection.  Otherwise the
value could change within critical sections.  Again the compiler
could optimize to multiple read operations within the critical
section.  With inconsistent values, the behavior is undefined.
OK dlg@

Revision 1.284 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:28 2022 UTC (21 months, 4 weeks ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_2_BASE, OPENBSD_7_2
Branch point for: OPENBSD_7_3
Changes since 1.283: +1 -5 lines
Diff to previous 1.283 (colored)

remove unneeded includes in sys/kern
ok mpi@ miod@

Revision 1.283 / (download) - annotate - [select for diffs], Tue Feb 22 01:15:01 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.282: +1 -3 lines
Diff to previous 1.282 (colored)

Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>

net/if_pppx.c pointed out by jsg@
ok gnezdo@ deraadt@ jsg@ mpi@ millert@

Revision 1.282 / (download) - annotate - [select for diffs], Mon Feb 14 04:33:18 2022 UTC (2 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.281: +7 -1 lines
Diff to previous 1.281 (colored)

update sbchecklowmem() to better detect actual mbuf memory usage.

previously sbchecklowmem() (and sonewconn()) would look at the mbuf
and mbuf cluster pools to see if they were approaching their hard
limits. based on how many mbufs/clusters were allocated against the
limits, socket operations would start to fail with ENOBUFS until
utilisation went down.

mbufs and clusters have changed a lot since then though. there are
now many mbuf cluster pools, not just one for 2k clusters. because
of this the mbuf layer now limits the amount of memory all the mbuf
pools can allocate backend pages from rather than limit the individual
pools. this means sbchecklowmem() ends up looking at the default
pool hard limit, which is UINT_MAX, which in turn means means
sbchecklowmem() probably never applies backpressure. this is made
worse on multiprocessor systems where per cpu caches of mbuf and
cluster pool items are enabled because the number of in use pool
items is distorted by the cpu caches.

this switches sbchecklowmem to looking at the page allocations made
by all the pools instead. the big benefit of this is that the page
allocations are much more representative of the overall mbuf memory
usage in the system. the downside is is that the backend page
allocation accounting does not see idle memory held by pools. pools
cannot release partially free pages to the page backend (obviously),
and pools cache idle items to avoid thrashing on the backend page
allocator. this means the page allocation level is higher than the
memory used by actual in-flight mbufs.

however, this can also be a benefit. the backend page allocation is a
kind of smoothed out "trend" line. mbuf utilisation over short periods
can be extremely bursty because of things like rx ring dequeue and fill
cycles, or large socket sends. if you're trying to grow socket
buffers while these things are happening, luck becomes an important
factor in whether it will work or not. because pools cache idle items,
the backend page utilisation better represents the overall trend
of activity in the system and will give more consistent behaviour here.

this diff is deliberately simple. we're basically going from "no
limits" to "some sort of limit" for sockets again, so keeping the
code simple means it should be easy to understand and tweak in the
future.

ok djm@ visa@ claudio@

Revision 1.281 / (download) - annotate - [select for diffs], Tue Feb 8 11:28:19 2022 UTC (2 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.280: +3 -3 lines
Diff to previous 1.280 (colored)

use sizeof(long) - 1 in m_pullup to determine payload alignment.

this makes it consistent with the rest of the network stack when
determining alignment.

ok bluhm@

Revision 1.280 / (download) - annotate - [select for diffs], Tue Jan 18 12:38:21 2022 UTC (2 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.279: +7 -8 lines
Diff to previous 1.279 (colored)

Properly handle read-only clusters in m_pullup(9).

If the first mbuf of a chain in m_pullup is a cluster, check if the
cluster is read-only (shared or an external buffer).  If so, don't
touch it and create a new mbuf for the pullup data.

This restores original 4.4BSD m_pullup, that not only returned
contiguous mbuf data of the specified length, but also converted
read-only clusters into writeable memory.  The latter feature was
lost during some refactoring.

from ehrhardt@; tested by weerd@; OK stsp@ bluhm@ claudio@

Revision 1.279 / (download) - annotate - [select for diffs], Sat Mar 6 09:20:49 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.278: +2 -2 lines
Diff to previous 1.278 (colored)

ansi

Revision 1.278 / (download) - annotate - [select for diffs], Thu Feb 25 02:43:32 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.277: +3 -2 lines
Diff to previous 1.277 (colored)

let m_copydata use a void * instead of caddr_t

i'm not a fan of having to cast to caddr_t when we have modern
inventions like void *s we can take advantage of.

ok claudio@ mvs@ bluhm@

Revision 1.277 / (download) - annotate - [select for diffs], Wed Jan 13 12:38:36 2021 UTC (3 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.276: +3 -3 lines
Diff to previous 1.276 (colored)

Convert mbuf type KDASSERT() to a proper KASSERT() in m_get(9).
Should prevent to use uninitialized value as bogus counter index.
OK mvs@ claudio@ anton@

Revision 1.276 / (download) - annotate - [select for diffs], Sat Dec 12 11:48:54 2020 UTC (3 years, 5 months ago) by jan
Branch: MAIN
Changes since 1.275: +7 -7 lines
Diff to previous 1.275 (colored)

Rename the macro MCLGETI to MCLGETL and removes the dead parameter ifp.

OK dlg@, bluhm@
No Opinion mpi@
Not against it claudio@

Revision 1.275 / (download) - annotate - [select for diffs], Sun Jun 21 05:37:26 2020 UTC (3 years, 11 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.274: +20 -1 lines
Diff to previous 1.274 (colored)

add mq_push. it's like mq_enqueue, but drops from the head, not the tail.

from Matt Dunwoodie and Jason A. Donenfeld

Revision 1.274 / (download) - annotate - [select for diffs], Wed Jan 22 22:56:35 2020 UTC (4 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.273: +26 -1 lines
Diff to previous 1.273 (colored)

add ml_hdatalen and mq_hdatalen as workalikes of ifq_hdatalen.

this is so pppx(4) and the upcoming pppac(4) can give kq read data
dn FIONREAD values that makes sense like the ones tun(4) and tap(4)
provide with ifq_hdatalen.

Revision 1.273 / (download) - annotate - [select for diffs], Tue Oct 22 18:45:02 2019 UTC (4 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.272: +12 -26 lines
Diff to previous 1.272 (colored)

Replace the mutex that protects the mbuf allocation limit by an
atomic operation.
OK visa@ cheloha@

Revision 1.272 / (download) - annotate - [select for diffs], Fri Jul 19 09:03:03 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.271: +11 -3 lines
Diff to previous 1.271 (colored)

After the kernel has reached the sysclt kern.maxclusters limit,
operations get stuck while holding the net lock.  Increasing the
limit did not help as there was no wakeup of the waiting pools.  So
introduce pool_wakeup() and run through the mbuf pool request list
when the limit changes.
OK dlg@ visa@

Revision 1.271 / (download) - annotate - [select for diffs], Tue Jul 16 21:41:37 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.270: +9 -9 lines
Diff to previous 1.270 (colored)

Fix uipc white spaces.

Revision 1.270 / (download) - annotate - [select for diffs], Tue Jul 16 17:39:02 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.269: +12 -8 lines
Diff to previous 1.269 (colored)

Prevent integer overflow in kernel and userland when checking mbuf
limits.  Convert kernel variables and calculations for mbuf memory
into long to allow larger values on 64 bit machines.  Put a range
check into the kernel sysctl.  For the interface itself int is still
sufficient.  In netstat -m cast all multiplications to unsigned
long to hold the product of two unsigned int.
input and OK visa@

Revision 1.269 / (download) - annotate - [select for diffs], Mon Jun 10 23:45:19 2019 UTC (5 years ago) by dlg
Branch: MAIN
Changes since 1.268: +14 -1 lines
Diff to previous 1.268 (colored)

add m_microtime for getting the wall clock time associated with a packet

if the packet has the M_TIMESTAMP csum_flag, ph_timestamp is added
to the boottime clock, otherwise it just uses microtime().

Revision 1.268 / (download) - annotate - [select for diffs], Sun Feb 10 22:45:58 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.267: +4 -4 lines
Diff to previous 1.267 (colored)

revert revert revert. there are many other archs that use custom allocs.

Revision 1.267 / (download) - annotate - [select for diffs], Sun Feb 10 20:02:37 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.266: +4 -4 lines
Diff to previous 1.266 (colored)

make it possible to reduce kmem pressure by letting some pools use a more
accomodating allocator. an interrupt safe pool may also be used in process
context, as indicated by waitok flags. thanks to the garbage collector, we
can always free pages in process context. the only complication is where
to put the pages. solve this by saving the allocation flags in the pool
page header so the free function can examine them.
not actually used in this diff. (coming soon.)
arm testing and compile fixes from phessler

Revision 1.266 / (download) - annotate - [select for diffs], Fri Feb 1 10:43:43 2019 UTC (5 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.265: +66 -45 lines
Diff to previous 1.265 (colored)

make m_pullup use the first mbuf with data to measure alignment.

this fixes an issue found by a regress test on sparc64 by claudio,
and between us took about half a day of work to understand and fix
at a2k19.

ok claudio@

Revision 1.265 / (download) - annotate - [select for diffs], Wed Jan 9 16:37:27 2019 UTC (5 years, 5 months ago) by visa
Branch: MAIN
Changes since 1.264: +4 -4 lines
Diff to previous 1.264 (colored)

Eliminate an else branch from m_extunref().

OK millert@ bluhm@

Revision 1.264 / (download) - annotate - [select for diffs], Tue Jan 8 13:01:50 2019 UTC (5 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.263: +10 -2 lines
Diff to previous 1.263 (colored)

If the mbuf cluster in m_zero() is read only, propagate the M_ZEROIZE
flag to the other references.  Then the final m_free() will clear
the memory.
OK claudio@

Revision 1.263 / (download) - annotate - [select for diffs], Mon Jan 7 07:49:38 2019 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.262: +3 -6 lines
Diff to previous 1.262 (colored)

It is possible to call m_zero with a read-only cluster. In that case just
return. Hopefully the other reference holder has the M_ZEROIZE flag set as
well. Triggered by syzkaller. OK deradt@ visa@

Reported-by: syzbot+c578107d70008715d41f@syzkaller.appspotmail.com

Revision 1.262 / (download) - annotate - [select for diffs], Fri Nov 30 09:23:31 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.261: +5 -5 lines
Diff to previous 1.261 (colored)

Trivial MH_ALIGN/M_ALIGN to m_align conversions.
OK bluhm@

Revision 1.261 / (download) - annotate - [select for diffs], Mon Nov 12 07:45:52 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.260: +25 -15 lines
Diff to previous 1.260 (colored)

Introduce m_align() a function that works like M_ALIGN() but works with
all types of mbufs. Also introduce some KASSERT in the m_*space() functions
to ensure that no negative number is returned. This also introduces two
internal macros M_SIZE() & M_DATABUF() which return the right size and start
pointer of the mbuf data area. Use it in a few obvious places to simplify code.
OK bluhm@

Revision 1.260 / (download) - annotate - [select for diffs], Fri Nov 9 14:14:31 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.259: +18 -11 lines
Diff to previous 1.259 (colored)

M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers for
m_leadingspace() and m_trailingspace(). Convert all callers to call
directly the functions and remove the defines.
OK krw@, mpi@

Revision 1.259 / (download) - annotate - [select for diffs], Thu Sep 13 19:53:58 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.258: +5 -2 lines
Diff to previous 1.258 (colored)

Add reference counting for inet pcb, this will be needed when we
start locking the socket.  An inp can be referenced by the PCB queue
and hashes, by a pf mbuf header, or by a pf state key.
OK visa@

Revision 1.258 / (download) - annotate - [select for diffs], Mon Sep 10 16:14:07 2018 UTC (5 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.257: +13 -1 lines
Diff to previous 1.257 (colored)

Instead of calculating the mbuf packet header length here and there,
put the algorithm into a new function m_calchdrlen().  Also set an
uninitialized m_len to 0 in NFS code.
OK claudio@

Revision 1.257 / (download) - annotate - [select for diffs], Mon Sep 10 12:47:02 2018 UTC (5 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.256: +23 -10 lines
Diff to previous 1.256 (colored)

During fragment reassembly, mbuf chains with packet headers were
created.  Add a new function m_removehdr() do convert packet header
mbufs within the chain to regular mbufs.  Assert that the mbuf at
the beginning of the chain has a packet header.
found by Maxime Villard in NetBSD; from markus@; OK claudio@

Revision 1.256 / (download) - annotate - [select for diffs], Sun Mar 18 21:25:14 2018 UTC (6 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.255: +1 -5 lines
Diff to previous 1.255 (colored)

NULL deref on armv7 performing NFS, within 10 seconds.
Previous commit has no OK's or discussion about testing.

Revision 1.255 / (download) - annotate - [select for diffs], Tue Mar 13 01:34:06 2018 UTC (6 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.254: +6 -2 lines
Diff to previous 1.254 (colored)

make m_pullup skip over empty mbufs when finding the payload alignment.

Revision 1.254 / (download) - annotate - [select for diffs], Mon Mar 12 23:38:42 2018 UTC (6 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.253: +3 -2 lines
Diff to previous 1.253 (colored)

make m_adj keep m_data aligned when removing all the data in an mbuf.

previously it took a shortcut when emptying an mbuf by only setting
m_len to 0, but leaving m_data alone. this interacts badly with
m_pullup, which tries to maintain the alignment of the data
payload. if there was a 14 byte ethernet header on its own that was
m_adjed off, and then the stack wants an ip header, m_pullup
would put the ip header on the ethernet header alignment, which is
off by 2 bytes.

found by stsp@ with pair(4) on sparc64.
ok stsp@ too

Revision 1.253 / (download) - annotate - [select for diffs], Tue Jan 16 19:44:34 2018 UTC (6 years, 4 months ago) by benno
Branch: MAIN
Changes since 1.252: +1 -4 lines
Diff to previous 1.252 (colored)

garbage collect an unused variable
ok dlg@

Revision 1.252 / (download) - annotate - [select for diffs], Fri Dec 29 23:55:22 2017 UTC (6 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.251: +2 -1 lines
Diff to previous 1.251 (colored)

Make sure that pf_mbuf_link_state_key() does not overwrite an
existing statekey in the mbuf header.  Reset the statekey in
m_dup_pkthdr().
suggested by and OK sahan@

Revision 1.251 / (download) - annotate - [select for diffs], Fri Dec 29 17:05:25 2017 UTC (6 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.250: +4 -4 lines
Diff to previous 1.250 (colored)

Make the functions which link the pf state keys to mbufs, inpcbs,
or other states more consistent.
OK visa@ sashan@ on a previous version

Revision 1.250 / (download) - annotate - [select for diffs], Thu Oct 12 09:14:16 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.249: +33 -1 lines
Diff to previous 1.249 (colored)

Move sysctl_mq() where it can safely mess with mbuf queue internals.

ok visa@, bluhm@, deraadt@

Revision 1.249 / (download) - annotate - [select for diffs], Fri Sep 15 18:13:05 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.248: +8 -5 lines
Diff to previous 1.248 (colored)

Coverity complained that the while loop at the end of m_adj() could
dereference m if it is NULL.  See CID 501458.
- Remove the m NULL check from the final for loop, it is not
  necessary.  This cannot happen due to the length calculation.
  The inconsistent code caused the coverity issue.
- Move the m = mp close to all the loops where the mbuf
  chain is traversed.
- Use mp to access the m_pkthdr consistently.
- Move the next assignemnt from for (;;m = m->m_next) to the
  end of the loop to make it consistent to the previous for (;;)
  where the total length is calculated.
OK visa@ mpi@

Revision 1.248 / (download) - annotate - [select for diffs], Sat May 27 16:41:10 2017 UTC (7 years ago) by bluhm
Branch: MAIN
Changes since 1.247: +5 -5 lines
Diff to previous 1.247 (colored)

Put an assert that M_PKTHDR is set before accessing m_pkthdr in the
mbuf functions.
OK claudio@

Revision 1.247 / (download) - annotate - [select for diffs], Sat May 27 10:36:18 2017 UTC (7 years ago) by claudio
Branch: MAIN
Changes since 1.246: +31 -50 lines
Diff to previous 1.246 (colored)

Refactor m_makespace() using MCLGETI to simplify the logic of this function.
Still quite complicated but more legible in the end and it will do less
M_GET calls for huge packets.
OK bluhm@

Revision 1.246 / (download) - annotate - [select for diffs], Mon May 8 15:47:49 2017 UTC (7 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.245: +3 -1 lines
Diff to previous 1.245 (colored)

add a compile time assertion MSIZE == sizeof(struct mbuf)
ok kettenis mpi tom

Revision 1.245 / (download) - annotate - [select for diffs], Tue Feb 7 07:00:21 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.244: +9 -1 lines
Diff to previous 1.244 (colored)

enable per cpu caches on the mbuf pools.

this didnt make sense previously since the mbuf pools had item
limits that meant the cpus had to coordinate via a single counter
to make sure the limit wasnt exceeded.

mbufs are now limited by how much memory can be allocated for pages
from the system. individual pool items are no longer counted and
therefore do not have to be coordinated.

ok bluhm@ as part of a larger diff.

Revision 1.244 / (download) - annotate - [select for diffs], Tue Feb 7 06:51:58 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.243: +8 -31 lines
Diff to previous 1.243 (colored)

move the mbuf pools to m_pool_init and a single global memory limit

this replaces individual calls to pool_init, pool_set_constraints, and
pool_sethardlimit with calls to m_pool_init. m_pool_init inits the
mbuf pools with the mbuf pool allocator, and because of that doesnt
set per pool limits.

ok bluhm@ as part of a larger diff

Revision 1.243 / (download) - annotate - [select for diffs], Tue Feb 7 06:27:18 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.242: +8 -1 lines
Diff to previous 1.242 (colored)

add m_pool_init(), a wrapper around pool_init for mbuf clusters.

m_pool_init is basically a call to pool_init with everythign except
the size and alignment specified, and a call to pool_set_constraints
so the memroy is always dma reachable. it also wires up the memory
with the custom mbuf pool allocator.

ok bluhm@ as part of a larger diff

Revision 1.242 / (download) - annotate - [select for diffs], Tue Feb 7 06:21:37 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.241: +57 -1 lines
Diff to previous 1.241 (colored)

provide a custom pool page allocator for mbufs, but dont use it yet.

the custom allocator is basically a wrapper around the multi page
pool allocator, but it has a single global memory limit managed by
the wrapper.

currently each of the mbuf pools has their own memory limit (or
none in the case of the myx pool) independent of the other pools.
this means each pool can allocate up to nmbclust worth of mbufs,
rather than all of them sharing the one limit. wrapping the allocator
like this means we can move to a single memory limit for all mbufs
in the system.

ok bluhm@ as part of a larger diff

Revision 1.241 / (download) - annotate - [select for diffs], Sun Feb 5 16:23:38 2017 UTC (7 years, 4 months ago) by jca
Branch: MAIN
Changes since 1.240: +2 -2 lines
Diff to previous 1.240 (colored)

Always allocate counters memory using type M_COUNTERS.

This makes the API simpler, and is probably more useful than spreading
counters memory other several types, making it harder to track.

Prodded by mpi, ok mpi@ stsp@

Revision 1.240 / (download) - annotate - [select for diffs], Wed Jan 25 09:41:45 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.239: +10 -2 lines
Diff to previous 1.239 (colored)

Clear the reference of the original mbuf chain after m_split()'ing
a mbuf and properly intialize m_len.

From FreeBSD via Imre Vadasz.

ok bluhm@

Revision 1.239 / (download) - annotate - [select for diffs], Tue Nov 29 10:22:30 2016 UTC (7 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.238: +2 -3 lines
Diff to previous 1.238 (colored)

m_free() and m_freem() test for NULL.  Simplify callers which had their own
NULL tests.

ok mpi@

Revision 1.238 / (download) - annotate - [select for diffs], Wed Nov 9 08:55:11 2016 UTC (7 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.237: +2 -2 lines
Diff to previous 1.237 (colored)

Do not dereference a variable without initializing it beforehand.

Fix a typo introduced in m_pullup(9) refactoring and found the hard
way by semarie@ while testing another diff.

ok mikeb@, dlg@

Revision 1.237 / (download) - annotate - [select for diffs], Thu Oct 27 03:29:55 2016 UTC (7 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.236: +52 -37 lines
Diff to previous 1.236 (colored)

refactor m_pullup a bit.

the most important change is that if the requested data is already
in the first mbuf in the chain, return quickly.

if that isnt true, the code will try to use the first mbuf to fit
the requested data.

if that isnt true, it will prepend an mbuf, and maybe a cluster,
to fit the requested data.

m_pullup will now try to maintain the alignment of the original
payload, even when prepending a new mbuf for it.

ok mikeb@

Revision 1.236 / (download) - annotate - [select for diffs], Thu Oct 27 03:00:35 2016 UTC (7 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.235: +12 -4 lines
Diff to previous 1.235 (colored)

add a new pool for 2k + 2 byte (mcl2k2) clusters.

a certain vendor likes to make chips that specify the rx buffer
sizes in kilobyte increments. unfortunately it places the ethernet
header on the start of the rx buffer, which means if you give it a
mcl2k cluster, the ethernet header will not be ETHER_ALIGNed cos
mcl2k clusters are always allocated on 2k boundarys (cos they pack
into pages well). that in turn means the ip header wont be aligned
correctly.

the current workaround on these chips has been to let non-strict
alignment archs just use the normal 2k cluster, but use whatever
cluster can fit 2k + 2 on strict archs. that turns out to be the
4k cluster, meaning we waste nearly 2k of space on every packet.

properly aligning the ethernet header and ip headers gives a
performance boost, even on non-strict archs.

Revision 1.235 / (download) - annotate - [select for diffs], Mon Oct 24 23:58:33 2016 UTC (7 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.234: +2 -2 lines
Diff to previous 1.234 (colored)

avoid using realloc in the name of things that dont work like realloc.

cpumem_realloc and counters_realloc actually allocated new per cpu data
for new cpus, they didnt resize the existing allocation.

specifically, this renames cpumem_reallod to cpumem_malloc_ncpus, and
counters_realloc to counters_alloc_ncpus.

ok (and with some fixes by) bluhm@

Revision 1.234 / (download) - annotate - [select for diffs], Mon Oct 24 04:38:44 2016 UTC (7 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.233: +41 -13 lines
Diff to previous 1.233 (colored)

move the mbstat structure to percpu counters

each cpus counters still have to be protected by splnet, but this
is better thana single set of counters protected by a global mutex.

ok bluhm@

Revision 1.233 / (download) - annotate - [select for diffs], Mon Oct 10 00:41:17 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.232: +11 -11 lines
Diff to previous 1.232 (colored)

white space fixes.

no functional change

Revision 1.232 / (download) - annotate - [select for diffs], Mon Oct 10 00:34:50 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.231: +6 -2 lines
Diff to previous 1.231 (colored)

copy the offset of data inside mbufs in m_copym().

this is cheap since it is basic math. it also means that payloads
which have been aligned carefully will also be aligned in their
copy.

ok yasuoka@ claudio@

Revision 1.231 / (download) - annotate - [select for diffs], Thu Sep 15 02:00:16 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.230: +5 -8 lines
Diff to previous 1.230 (colored)

all pools have their ipl set via pool_setipl, so fold it into pool_init.

the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.

most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.

the manpage and subr_pool.c bits i did myself.

ok tedu@ jmatthew@

@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);

Revision 1.230 / (download) - annotate - [select for diffs], Thu Sep 15 00:52:08 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.229: +5 -26 lines
Diff to previous 1.229 (colored)

we dont need m_copym0 with m_copym as a single wrapper, so merge them.

cos m_copym only does shallow copies, we can make the code do them
unconditionally.

for millert@

Revision 1.229 / (download) - annotate - [select for diffs], Thu Sep 15 00:00:40 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.228: +1 -11 lines
Diff to previous 1.228 (colored)

remove m_copym2 as its use has been replaced by m_dup_pkt

ok millert@ mpi@ henning@ claudio@ markus@

Revision 1.228 / (download) - annotate - [select for diffs], Tue Sep 13 19:56:55 2016 UTC (7 years, 8 months ago) by markus
Branch: MAIN
Changes since 1.227: +116 -62 lines
Diff to previous 1.227 (colored)

avoid extensive mbuf allocation for IPsec by replacing m_inject(4)
with m_makespace(4) from freebsd; ok mpi@, bluhm@, mikeb@, dlg@

Revision 1.227 / (download) - annotate - [select for diffs], Sat Sep 3 14:17:37 2016 UTC (7 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.226: +7 -6 lines
Diff to previous 1.226 (colored)

Limit all mbuf cluster pools to the same memory size.  Having limits
by number would allow the large clusters using too much memory.
Set size of mclsizes array explicitly to keep it in sync with
mclpools.
OK claudio@

Revision 1.219.2.2 / (download) - annotate - [select for diffs], Thu Jul 14 02:56:15 2016 UTC (7 years, 10 months ago) by tedu
Branch: OPENBSD_5_9
Changes since 1.219.2.1: +5 -2 lines
Diff to previous 1.219.2.1 (colored) to branchpoint 1.219 (colored) next main 1.220 (colored)

backport splice loop fix:
On localhost a user program may create a socket splicing loop.
After writing data into this loop, it was spinning forever causing
a kernel hang.  Detect the loop by counting how often the same mbuf
is spliced.  If that happens 128 times, assume that there is a loop
and abort the splicing with ELOOP.
Bug found by tedu@;  OK tedu@ millert@ benno@

Revision 1.226 / (download) - annotate - [select for diffs], Mon Jun 13 21:24:43 2016 UTC (7 years, 11 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.225: +5 -2 lines
Diff to previous 1.225 (colored)

On localhost a user program may create a socket splicing loop.
After writing data into this loop, it was spinning forever causing
a kernel hang.  Detect the loop by counting how often the same mbuf
is spliced.  If that happens 128 times, assume that there is a loop
and abort the splicing with ELOOP.
Bug found by tedu@;  OK tedu@ millert@ benno@

Revision 1.225 / (download) - annotate - [select for diffs], Mon May 23 15:22:44 2016 UTC (8 years ago) by tedu
Branch: MAIN
Changes since 1.224: +24 -5 lines
Diff to previous 1.224 (colored)

remove the function pointer from mbufs. this memory is shared with data
via unions, and we don't want to make it easy to control the target.
instead an integer index into an array of acceptable functions is used.
drivers using custom functions must register them to receive an index.
ok deraadt

Revision 1.219.2.1 / (download) - annotate - [select for diffs], Thu Apr 28 22:31:55 2016 UTC (8 years, 1 month ago) by sthen
Branch: OPENBSD_5_9
Changes since 1.219: +3 -3 lines
Diff to previous 1.219 (colored)

MFC argument order fix for MCLGETI/m_get, from Armin Wolfermann via dlg, ok mpi

Revision 1.224 / (download) - annotate - [select for diffs], Fri Apr 15 05:05:21 2016 UTC (8 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.223: +1 -43 lines
Diff to previous 1.223 (colored)

remove ml_filter, mq_filter, niq_filter.

theyre currently unused, so no functional change.

Revision 1.223 / (download) - annotate - [select for diffs], Fri Apr 8 03:13:38 2016 UTC (8 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.222: +20 -3 lines
Diff to previous 1.222 (colored)

add m_purge for freeing a list of mbufs linked via m_nextpkt

this tweaks m_freem so it returns the m_nextpkt from the mbuf it freed,
like how m_free returns the m_next from the mbuf it frees.

ok mpi@

Revision 1.222 / (download) - annotate - [select for diffs], Wed Apr 6 01:36:06 2016 UTC (8 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.221: +2 -2 lines
Diff to previous 1.221 (colored)

correct the order of arguments to m_get in m_dup_pkt

Revision 1.221 / (download) - annotate - [select for diffs], Tue Mar 29 10:34:42 2016 UTC (8 years, 2 months ago) by sashan
Branch: MAIN
Changes since 1.220: +20 -2 lines
Diff to previous 1.220 (colored)

- packet must keep reference to statekey
  this is the second attempt to get it in, the first
  attempt got backed out on Jan 31 2016

  the change also contains fixes contributed by Stefan Kempf
  in earlier iteration.

OK srhen@

Revision 1.220 / (download) - annotate - [select for diffs], Tue Mar 22 06:17:00 2016 UTC (8 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.219: +2 -2 lines
Diff to previous 1.219 (colored)

dont mix up the len and flats argument to MCLGETI in m_dup_pkt

Revision 1.219 / (download) - annotate - [select for diffs], Tue Feb 23 01:39:14 2016 UTC (8 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE
Branch point for: OPENBSD_5_9
Changes since 1.218: +35 -1 lines
Diff to previous 1.218 (colored)

provide m_dup_pkt() for doing fast deep mbuf copies with a specified alignment

if a physical interface receives a multicast/broadcast packet and
has carp interfaces on it, that packet needs to be copied for
reception by each of those carp interfaces.

previously it was using m_copym2, but that doesn't respect the
alignment of the source packet. this meant the ip header in the
copies were aligned incorrectly for the network stack, which breaks
strict alignment archs.

m_dup_pkt lets carp specify that the payload needs an ETHER_ALIGN
adjustment, so the ip header inside will be aligned correctly.

reported and tested by anthony eden who hit this on armv7
i reproduced the problem on sparc64 and verified the fix on amd64
and sparc64
ok mpi@ mikeb@ deraadt@

Revision 1.218 / (download) - annotate - [select for diffs], Sun Jan 31 00:18:07 2016 UTC (8 years, 4 months ago) by sashan
Branch: MAIN
Changes since 1.217: +1 -18 lines
Diff to previous 1.217 (colored)

- m_pkthdr.pf.statekey changes are not ready for 5.9, I must back them out

OK sthen@

Revision 1.217 / (download) - annotate - [select for diffs], Thu Jan 7 22:23:13 2016 UTC (8 years, 5 months ago) by sashan
Branch: MAIN
Changes since 1.216: +19 -2 lines
Diff to previous 1.216 (colored)

- retrying to commit earlier change, which got backed out

    - yet another tiny step towards MP PF. This time we need to make sure
      statekey attached to packet stays around, while accepted packet is
      routed through IP stack.

  this time I'm also bringing fix contributed by Stefan Kempf. Stefan's fix
  makes sure we grab reference in m_dup_pkthdr()

OK bluhm@

Revision 1.216 / (download) - annotate - [select for diffs], Wed Dec 23 21:04:55 2015 UTC (8 years, 5 months ago) by jasper
Branch: MAIN
Changes since 1.215: +1 -14 lines
Diff to previous 1.215 (colored)

revert previous:
----------------------------------------------------------------------
revision 1.961
date: 2015/12/22 13:33:26;  author: sashan;  state: Exp;  lines: +153 -44;
commitid: oBRhtWcDV0ThviVT;
- yet another tiny step towards MP PF. This time we need to make sure
  statekey attached to packet stays around, while accepted packet is
  routed through IP stack.

OK mpi@, henning@
----------------------------------------------------------------------

there have been multiple reports of KASSERT(!pf_state_key_isvalid(sk)) being
triggered without much effort, so back this out for now.

Revision 1.215 / (download) - annotate - [select for diffs], Tue Dec 22 13:33:26 2015 UTC (8 years, 5 months ago) by sashan
Branch: MAIN
Changes since 1.214: +15 -2 lines
Diff to previous 1.214 (colored)

- yet another tiny step towards MP PF. This time we need to make sure
  statekey attached to packet stays around, while accepted packet is
  routed through IP stack.

OK mpi@, henning@

Revision 1.214 / (download) - annotate - [select for diffs], Sat Nov 21 11:46:24 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.213: +1 -27 lines
Diff to previous 1.213 (colored)

Retire ml_requeue(9) and mq_requeue(9).

As Kenjiro Cho pointed out it is very hard to cancel a dequeue operation
for some queueing disciplines when such it keeps some internal states.

As you can see, APIs can also Live Fast & Die Young.

ok dlg@

Revision 1.213 / (download) - annotate - [select for diffs], Fri Nov 13 10:12:39 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.212: +5 -5 lines
Diff to previous 1.212 (colored)

Use ph_ prefix for tag-related fields.

ok dlg@

Revision 1.212 / (download) - annotate - [select for diffs], Thu Nov 12 10:07:14 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.211: +2 -1 lines
Diff to previous 1.211 (colored)

Prefix flowid with ph_ and print it in m_print().

ok dlg@

Revision 1.211 / (download) - annotate - [select for diffs], Mon Nov 2 09:21:48 2015 UTC (8 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.210: +28 -1 lines
Diff to previous 1.210 (colored)

provide ml_purge and mq_purge.

these are modelled on IF_PURGE or IFQ_PURGE. they m_freem all the
mbufs on an mbuf list or queue.

ok jmatthew@ mpi@

Revision 1.210 / (download) - annotate - [select for diffs], Fri Oct 30 19:47:40 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.209: +11 -6 lines
Diff to previous 1.209 (colored)

Let m_resethdr() clear the whole mbuf packet header, not only the
pf part.  This allows to reuse this function in socket splicing.
Reset the mbuf flags that are related to the packet header, but
preserve the data flags.
pair(4) tested by reyk@; sosplice(9) tested by bluhm@; OK mikeb@ reyk@

Revision 1.209 / (download) - annotate - [select for diffs], Fri Oct 30 12:54:36 2015 UTC (8 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.208: +13 -1 lines
Diff to previous 1.208 (colored)

Add m_resethdr() to clear any state (pf, tags, flags) of an mbuf packet.
Start using it in pair(4) to clear state on the receiving interface;
m_resethdr() will also be used in other parts of the stack.

OK bluhm@ mikeb@

Revision 1.208 / (download) - annotate - [select for diffs], Thu Oct 22 05:26:06 2015 UTC (8 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.207: +3 -5 lines
Diff to previous 1.207 (colored)

rename ml_join to ml_enlist and expose it to the rest of the kernel.

Revision 1.207 / (download) - annotate - [select for diffs], Fri Aug 14 05:25:29 2015 UTC (8 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.206: +27 -1 lines
Diff to previous 1.206 (colored)

provide ml_requeue and mq_requeue for prepending mbufs on lists/queues

ok mpi@ claudio@

Revision 1.206 / (download) - annotate - [select for diffs], Wed Jul 15 22:29:32 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.205: +4 -1 lines
Diff to previous 1.205 (colored)

m_free() can now accept NULL, as a normal free() function.  This makes
calling code simpler.
ok stsp mpi

Revision 1.205 / (download) - annotate - [select for diffs], Tue Jun 16 11:09:39 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.204: +3 -3 lines
Diff to previous 1.204 (colored)

Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.

The interface pointer should now be retrieved when necessary with
if_get().  If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.

Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.

Tested by jmatthew@ and krw@, discussed with many.

ok mikeb@, bluhm@, dlg@

Revision 1.204 / (download) - annotate - [select for diffs], Sun May 31 20:10:44 2015 UTC (9 years ago) by bluhm
Branch: MAIN
Changes since 1.203: +6 -5 lines
Diff to previous 1.203 (colored)

If the first list was empty, ml_join() did not not clear the second
list after transferring all elements away.  Reorder the conditionals
to make sure that ml_init() is always called for a non empty second
list.  This makes all cases consistent and is less surprising.
OK dlg@

Revision 1.203 / (download) - annotate - [select for diffs], Mon Apr 13 08:45:48 2015 UTC (9 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.202: +3 -4 lines
Diff to previous 1.202 (colored)

Now that if_input() set the receiving interface pointer on mbufs for us
there's no need to do it in m_devget(9).

Stop passing an ``ifp'' will help for upcoming interface pointer -> index
conversion.

While here remove unused ``ifp'' argument from m_clget(9) and kill two
birds^W layer violations in one commit.

ok henning@

Revision 1.202 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:51 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.201: +1 -2 lines
Diff to previous 1.201 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.201 / (download) - annotate - [select for diffs], Sat Feb 7 02:52:09 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.200: +15 -5 lines
Diff to previous 1.200 (colored)

make mq_enlist drop mbufs is the queues length is exceeded.

ok mpi@ claudio@ henning@ and more at s2k15

Revision 1.200 / (download) - annotate - [select for diffs], Sat Feb 7 02:30:00 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.199: +43 -1 lines
Diff to previous 1.199 (colored)

add ml_filter and mq_filter functions to the mbuf list and queue apis.

this lets you run a filter function against each mbuf on a list or
queue. if the filter matches on an mbuf, it can return non-zero to
have ml_filter or mq_filter remove the mbuf and return it as part
of a chain of mbufs.

ok mpi@ claudio@ henning@ and s2k15 generally.

Revision 1.199 / (download) - annotate - [select for diffs], Thu Dec 11 19:21:57 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.198: +8 -8 lines
Diff to previous 1.198 (colored)

convert bcopy to memcpy/memmove. ok krw

Revision 1.198 / (download) - annotate - [select for diffs], Wed Nov 5 00:28:15 2014 UTC (9 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.197: +2 -2 lines
Diff to previous 1.197 (colored)

change the mbuf pool wait channel name from mbpl to mbufpl. "mb"
isnt descriptive enough for me.

ok deraadt@

Revision 1.197 / (download) - annotate - [select for diffs], Fri Oct 3 02:16:21 2014 UTC (9 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.196: +7 -3 lines
Diff to previous 1.196 (colored)

if you're adding the first cluster reference, you dont have to
coordinate with other mbufs so you can add all the pointers without
taking the extref lock.

looks good deraadt@

Revision 1.196 / (download) - annotate - [select for diffs], Fri Oct 3 01:11:17 2014 UTC (9 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.195: +2 -2 lines
Diff to previous 1.195 (colored)

i moved some macros into functions, and a trailing \ on a statement
snuck in.

someone who knows how cpp/cc works can explain to me why this
compiled.

Revision 1.195 / (download) - annotate - [select for diffs], Fri Oct 3 01:02:47 2014 UTC (9 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.194: +73 -84 lines
Diff to previous 1.194 (colored)

now that pools are mpsafe, we can make the mbuf allocators on top
of pools mpsafe too.

this calles pool_setipl(IPL_NET) against the mbuf and cluster pools,
and removes the use of splnet().

the other locking done in the mbuf layer is for external cluster
references. again, they relied on splnet to serialise these operations.
because there is no shared memory associated with external clusters
(except the cluster itself, which is completely dedicated to data
payload, not meta info like a refcount or lock), this has been
replaced with a single mutex that all reference ops are serialised
with.

tested by me, jmatthew@, bcook@, and phessler@

Revision 1.194 / (download) - annotate - [select for diffs], Sun Sep 14 14:17:26 2014 UTC (9 years, 8 months ago) by jsg
Branch: MAIN
Changes since 1.193: +1 -2 lines
Diff to previous 1.193 (colored)

remove uneeded proc.h includes
ok mpi@ kspillner@

Revision 1.193 / (download) - annotate - [select for diffs], Mon Aug 18 04:06:16 2014 UTC (9 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.192: +151 -1 lines
Diff to previous 1.192 (colored)

introduce mbuf list and queue apis. both manage fifo lists of mbufs
and a count of the mbufs.

struct mbuf_list and the ml_foo() apis can be used to build lists of
mbufs where you dont need locking (eg, on the stack).

struct mbuf_queue and mq_foo() wrap mbuf_lists with a mutex, and
limits the number of mbufs that can be queued. they can be useful
for moving mbufs between contexts/subsystems.

with help from jmc@ for the manpage bits
mpi@ is keen

Revision 1.192 / (download) - annotate - [select for diffs], Sun Jul 13 15:52:38 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.191: +4 -4 lines
Diff to previous 1.191 (colored)

bzero -> memset. for the speeds.

Revision 1.191 / (download) - annotate - [select for diffs], Sun Jul 13 09:52:48 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.190: +27 -25 lines
Diff to previous 1.190 (colored)

treat external storage allocated by the mbuf layer the same as
external storage attached to an mbuf anywhere else. this means it
uses MEXTADD to wire it up to the mbuf, and it relies on the ext_free
and ext_arg bits in the header to call the right free function
against the right pool.

M_CLUSTER gets renamed to M_EXTWR. the type field in MEXTADD gets
reused as a flags field so anything attaching storage to an mbuf
can say if it is writable or not.

ok claudio@

Revision 1.190 / (download) - annotate - [select for diffs], Wed Jul 9 13:05:45 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.189: +1 -2 lines
Diff to previous 1.189 (colored)

ext_type is set but never read. its a waste of space.

MEXTADD will be fixed later.

ok henning@ deraadt@ mpi@

Revision 1.189 / (download) - annotate - [select for diffs], Wed Jul 9 11:22:53 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.188: +4 -9 lines
Diff to previous 1.188 (colored)

now that mclgeti doesnt do the rx ring accounting, cluster allocation
doesnt need to know which ifp an mbuf was allocated on so it can uncount
it on free.

while here, remove the ext_backend field which identifies the pool the
cluster came from and use ext_arg instead.

ok henning@ mpi@

Revision 1.188 / (download) - annotate - [select for diffs], Tue Jul 8 07:10:12 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.187: +2 -149 lines
Diff to previous 1.187 (colored)

pull the rx ring accounting out of the mbuf layer now that its all done
via if_rxring things. this effectively deprecates the third argument
for MCLGETI and m_clget and makes the mbuf layer no longer care about
interfaces and simplifies the allocation paths.

the timeout used to measure livelock has been moved to net/if.c.

ok mpi@

Revision 1.187 / (download) - annotate - [select for diffs], Tue Jul 8 05:35:19 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.186: +4 -2 lines
Diff to previous 1.186 (colored)

cut things that relied on mclgeti for rx ring accounting/restriction over
to using if_rxr.

cut the reporting systat did over to the rxr ioctl.

tested as much as i can on alpha, amd64, and sparc64.
mpi@ has run it on macppc.
ok mpi@

Revision 1.186 / (download) - annotate - [select for diffs], Wed Jun 18 11:09:58 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.185: +2 -2 lines
Diff to previous 1.185 (colored)

trailing tabs arent needed.

Revision 1.185 / (download) - annotate - [select for diffs], Fri Jun 13 07:28:13 2014 UTC (10 years ago) by mpi
Branch: MAIN
Changes since 1.184: +24 -16 lines
Diff to previous 1.184 (colored)

Instead of updating all the cluster allocation water marks of all the
interfaces when the kernel is livelocked, only do it for the current
pool and defer the other updates.

This allow us to get rid of an interface list iteration in a critical
path.

Ridding the libc crank since this change introduce an ABI break.

ok claudio@

Revision 1.184 / (download) - annotate - [select for diffs], Sun May 4 19:27:08 2014 UTC (10 years, 1 month ago) by sf
Branch: MAIN
Changes since 1.183: +8 -8 lines
Diff to previous 1.183 (colored)

remove some hh and h format specifiers

gcc does not like hh in kprintf and it does not make any difference due
to integer promotion rules. While there, remove some h's, too.

suggested by kettenis@

Revision 1.183 / (download) - annotate - [select for diffs], Tue Apr 22 14:41:03 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.182: +1 -4 lines
Diff to previous 1.182 (colored)

Remove some altq tentacles.

ok pelikan@, henning@

Revision 1.182 / (download) - annotate - [select for diffs], Mon Apr 21 11:10:54 2014 UTC (10 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.181: +6 -6 lines
Diff to previous 1.181 (colored)

we'll do fine without casting NULL to struct foo * / void *
ok gcc & md5 (alas, no binary change)

Revision 1.181 / (download) - annotate - [select for diffs], Mon Apr 14 09:06:41 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.180: +3 -3 lines
Diff to previous 1.180 (colored)

"struct pkthdr" holds a routing table ID, not a routing domain one.
Avoid the confusion by using an appropriate name for the variable.

Note that since routing domain IDs are a subset of the set of routing
table IDs, the following idiom is correct:

	rtableid = rdomain

But to get the routing domain ID corresponding to a given routing table
ID, you must call rtable_l2(9).

claudio@ likes it, ok mikeb@

Revision 1.180 / (download) - annotate - [select for diffs], Fri Mar 28 17:57:11 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.179: +1 -2 lines
Diff to previous 1.179 (colored)

Reduce uvm include madness.  Use <uvm/uvm_extern.h> instead of
<uvm/uvm.h> if possible and remove double inclusions.

ok beck@, mlarkin@, deraadt@

Revision 1.179 / (download) - annotate - [select for diffs], Thu Mar 27 10:30:58 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.178: +12 -6 lines
Diff to previous 1.178 (colored)

Store an ifp index instead of a pointer in the "struct mbuf_ext".

This is part of the plan to remove the ifp pointer from the packet
header that will allow us to stop garbage collecting mbuf(9)s when
an ifp is detached/destroyed.

ok mikeb@, lteo@, benno@

Revision 1.178 / (download) - annotate - [select for diffs], Sun Jan 19 03:04:54 2014 UTC (10 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.177: +1 -2 lines
Diff to previous 1.177 (colored)

Remove max_datalen. It is only used once an can be replaced easily with
MHLEN - max_hdr in that place. OK mikeb@

Revision 1.177 / (download) - annotate - [select for diffs], Fri Jan 10 00:47:17 2014 UTC (10 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.176: +21 -23 lines
Diff to previous 1.176 (colored)

Let "ddb show mbuf" print all mbuf fields in a consistent way.  Move
bit field names into the header file below the definitions to keep
them in sync.
OK mikeb@ mpi@

Revision 1.176 / (download) - annotate - [select for diffs], Sat Nov 9 06:38:42 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored)

ticks is compared against mcl_grown to see if time has elapsed since
the rx ring was last allowed to grow and then assigned to it. it
is erroneous to do this because mcl_grown is a u_int and ticks is an
int.

this makes mcl_grown an int, and follows the idiom in kern_timeout.c
of going "thing - ticks < diff", which better copes with ticks
wrapping around and being used to calculate relative intervals.

ok pirofti@ guenther@

Revision 1.175 / (download) - annotate - [select for diffs], Wed Aug 21 05:21:45 2013 UTC (10 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.174: +3 -8 lines
Diff to previous 1.174 (colored)

get rid of the copy argument in m_devget that let you provide an
alternative to bcopy since noone uses it.

while there use memcpy instead of bcopy because we know the memory cannot
overlap.

ok henning@ matthew@ mikeb@ deraadt@

Revision 1.174 / (download) - annotate - [select for diffs], Thu Aug 8 23:25:06 2013 UTC (10 years, 10 months ago) by syl
Branch: MAIN
Changes since 1.173: +2 -2 lines
Diff to previous 1.173 (colored)

Uncomment kprintf format attributes for sys/kern

tested on vax (gcc3) ok miod@

Revision 1.173 / (download) - annotate - [select for diffs], Tue Jun 11 13:29:50 2013 UTC (11 years ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.172: +3 -3 lines
Diff to previous 1.172 (colored)

replace bcopy with memcpy in m_defrag. this is safe because the
memory we're copying between is guaranteed to be non-overlapping
since the target is newly allocated.

ok kettenis@ henning@ tedu@

Revision 1.172 / (download) - annotate - [select for diffs], Tue Jun 11 01:01:15 2013 UTC (11 years ago) by dlg
Branch: MAIN
Changes since 1.171: +5 -5 lines
Diff to previous 1.171 (colored)

return ENOBUFS on failure from m_defrag and m_tag_copy_chain.

m_foo functions that return errors are now consistent as far as i can tell.

ok bluhm@

Revision 1.171 / (download) - annotate - [select for diffs], Thu Mar 28 16:55:25 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.170: +1 -2 lines
Diff to previous 1.170 (colored)

do not include machine/cpu.h from a .c file; it is the responsibility of
.h files to pull it in, if needed
ok tedu

Revision 1.170 / (download) - annotate - [select for diffs], Sun Feb 17 17:39:29 2013 UTC (11 years, 3 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored)

Comment out recently added __attribute__((__format__(__kprintf__))) annotations
in MI code; gcc 2.95 does not accept such annotation for function pointer
declarations, only function prototypes.
To be uncommented once gcc 2.95 bites the dust.

Revision 1.169 / (download) - annotate - [select for diffs], Sat Feb 9 20:56:35 2013 UTC (11 years, 4 months ago) by miod
Branch: MAIN
Changes since 1.168: +3 -2 lines
Diff to previous 1.168 (colored)

Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions and
function pointer arguments which are {used as,} wrappers around the kernel
printf function.
No functional change.

Revision 1.168 / (download) - annotate - [select for diffs], Thu Feb 7 11:06:42 2013 UTC (11 years, 4 months ago) by mikeb
Branch: MAIN
Changes since 1.167: +6 -1 lines
Diff to previous 1.167 (colored)

convert mbuf tags to use pool(9) as a backend storage;
ok markus claudio haesbaert henning

Revision 1.167 / (download) - annotate - [select for diffs], Wed Sep 26 14:53:23 2012 UTC (11 years, 8 months ago) by markus
Branch: MAIN
Changes since 1.166: +25 -15 lines
Diff to previous 1.166 (colored)

add M_ZEROIZE as an mbuf flag, so copied PFKEY messages (with embedded keys)
are cleared as well; from hshoexer@, feedback and ok bluhm@, ok claudio@

Revision 1.166 / (download) - annotate - [select for diffs], Fri Apr 13 09:38:32 2012 UTC (12 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.165: +3 -3 lines
Diff to previous 1.165 (colored)

unneccessary casts to unsigned; ok claudio

Revision 1.165 / (download) - annotate - [select for diffs], Fri Dec 2 10:55:46 2011 UTC (12 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.164: +7 -2 lines
Diff to previous 1.164 (colored)

dont put MAXMCLBYTES in the mclsizes array with a comment saying its 64k
when the macro can change without automatically fixing the comment.

instead add a diagnostic that checks that the biggest cluster size is
always MAXMCLBYTES.

requested by and ok kettenis@

Revision 1.164 / (download) - annotate - [select for diffs], Wed Nov 30 10:26:56 2011 UTC (12 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.163: +4 -4 lines
Diff to previous 1.163 (colored)

this diff introduces the MAXMCLBYTES macro to describe the largest
cluster the generic network stack will be able to give you.

it also recognises that external storage on an mbuf may be bigger than
MCLBYTES. its only when m_pullup or m_pulldown need to allocate
another cluster that they now check the len argument, and now they
do it against MAXMCLBYTES.

this is required for me to do pfsync on jumbo frames as the m_pulldown
for the subregions fail beyond MCLBYTES into the packet.

ok deraadt@ mikeb@ henning@ blambert@
manpage changes ok jmc@

Revision 1.163 / (download) - annotate - [select for diffs], Wed Nov 30 01:16:09 2011 UTC (12 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.162: +5 -5 lines
Diff to previous 1.162 (colored)

correctly calculate the space available in external storage in m_pullup.

ok deraadt@ claudio@ blambert@ mikeb@

Revision 1.162 / (download) - annotate - [select for diffs], Tue Nov 29 10:39:11 2011 UTC (12 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.161: +18 -18 lines
Diff to previous 1.161 (colored)

whitespace fixes. no binary change.

Revision 1.161 / (download) - annotate - [select for diffs], Sun Sep 18 23:20:38 2011 UTC (12 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.160: +2 -2 lines
Diff to previous 1.160 (colored)

One more %hh format string.

Revision 1.160 / (download) - annotate - [select for diffs], Fri Jul 8 18:48:50 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.159: +5 -1 lines
Diff to previous 1.159 (colored)

new priority queueing implementation, extremely low overhead, thus fast.
unconditional, always on. 8 priority levels, as every better switch, the
vlan header etc etc. ok ryan mpf sthen, pea tested as well

Revision 1.159 / (download) - annotate - [select for diffs], Tue Jul 5 05:53:17 2011 UTC (12 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.158: +2 -3 lines
Diff to previous 1.158 (colored)

Minor cleanup. OK blambert@

Revision 1.158 / (download) - annotate - [select for diffs], Thu Jun 23 21:42:05 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.157: +3 -3 lines
Diff to previous 1.157 (colored)

Make mbufs and dma_alloc be contig allocations.
Requested by dlg@

ok oga@

Revision 1.157 / (download) - annotate - [select for diffs], Wed May 4 16:05:49 2011 UTC (13 years, 1 month ago) by blambert
Branch: MAIN
Changes since 1.156: +15 -78 lines
Diff to previous 1.156 (colored)

Collapse m_pullup and m_pullup2 into a single function, as they're
essentially identical; the only difference being that m_pullup2 is
capable of handling mbuf clusters, but called m_pullup for shorter
lengths (!).

testing dlg@ ok claudio@

Revision 1.156 / (download) - annotate - [select for diffs], Mon Apr 18 19:23:46 2011 UTC (13 years, 1 month ago) by art
Branch: MAIN
Changes since 1.155: +3 -3 lines
Diff to previous 1.155 (colored)

Put back the change of pool and malloc into the new km_alloc(9) api.
The problems during the hackathon were not caused by this (most likely).

prodded by deraadt@ and beck@

Revision 1.155 / (download) - annotate - [select for diffs], Mon Apr 11 13:10:13 2011 UTC (13 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.154: +6 -4 lines
Diff to previous 1.154 (colored)

Move the DDB includes up in the file so that the m_print() prototype is
defined in all of uipc_mbuf.c. I use this function a lot for quick
printf debugging.

Revision 1.154 / (download) - annotate - [select for diffs], Sun Apr 10 23:25:02 2011 UTC (13 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.153: +100 -86 lines
Diff to previous 1.153 (colored)

Backout m_split_mbuf() from revision 1.150.  It seems that m_split()
got broken.  Most /usr/src/regress/sys/kern/splice/args-oobinline-*
regression tests fail when they split an mbuf at out-of-band data.
ok claudio@, deraadt@

Revision 1.153 / (download) - annotate - [select for diffs], Wed Apr 6 15:52:13 2011 UTC (13 years, 2 months ago) by art
Branch: MAIN
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored)

Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happening
and we aren't sure what's causing them.

shouted oks by many before I even built a kernel with the diff.

Revision 1.152 / (download) - annotate - [select for diffs], Tue Apr 5 11:48:28 2011 UTC (13 years, 2 months ago) by blambert
Branch: MAIN
Changes since 1.151: +5 -5 lines
Diff to previous 1.151 (colored)

Passing M_WAITOK to mbuf functions is supposed to be a contract between
the caller and the function that the function will not fail to allocate
memory and return a NULL pointer. However, m_dup_pkthdr() violates
this contract, making it possible for functions that pass M_WAITOK to
be surprised in ways that hurt.

Fix this by passing the wait flag all the way down the functions that
actually do the allocation for m_dup_pkthdr() so that we won't be
surprised.

man page update forthcoming

ok claudio@

Revision 1.151 / (download) - annotate - [select for diffs], Tue Apr 5 01:28:05 2011 UTC (13 years, 2 months ago) by art
Branch: MAIN
Changes since 1.150: +3 -3 lines
Diff to previous 1.150 (colored)

 - Change pool constraints to use kmem_pa_mode instead of uvm_constraint_range
 - Use km_alloc for all backend allocations in pools.
 - Use km_alloc for the emergmency kentry allocations in uvm_mapent_alloc
 - Garbage collect uvm_km_getpage, uvm_km_getpage_pla and uvm_km_putpage

ariane@ ok

Revision 1.150 / (download) - annotate - [select for diffs], Mon Apr 4 21:33:27 2011 UTC (13 years, 2 months ago) by blambert
Branch: MAIN
Changes since 1.149: +86 -100 lines
Diff to previous 1.149 (colored)

both m_inject() and m_split() reached a point at which they needed
to cleave a single mbuf in twain, but managed to fail in divergent
and horrible ways in doing so in anything resembling a sane manner

introduce m_split_mbuf() and remake the previous into wrappers
around that

pounded by phessler@
ok claudio@

Revision 1.149 / (download) - annotate - [select for diffs], Sat Jan 29 13:15:39 2011 UTC (13 years, 4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.148: +5 -3 lines
Diff to previous 1.148 (colored)

The function m_tag_copy_chain() returned 0 on success and 1 on
failure.  The man page explained it the other way around.  Change
the return code to the more obvious 0 or ENOMEM and document this.
ok krw@ markus@ miod@ jmc@

Revision 1.148 / (download) - annotate - [select for diffs], Tue Dec 21 14:00:43 2010 UTC (13 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.147: +9 -1 lines
Diff to previous 1.147 (colored)

Ugly workaround in nmbclust_update(). Additionally to setting the limit
also modify the hiwat mark. This was done in pool_sethardlimit() until
rev. 1.99. Without this the mbuf cluster pool may return free pages too
quickly with the result that m_clget() may fail while populating DMA rings.
Seems to fix some hangs seen on MCLGETI() interfaces on i386 e.g. PR 6524.
A proper fix is to make all drivers handle empty rings but that will take
a while to implement.  With and OK mikeb@

Revision 1.147 / (download) - annotate - [select for diffs], Fri Nov 5 15:17:50 2010 UTC (13 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.146: +24 -19 lines
Diff to previous 1.146 (colored)

Implement m_print as real ddb command "show mbuf addr" in the way other
such commands are implemented.
"Ja! You'll need to update ddb.4 as well, of course." miod@

Revision 1.146 / (download) - annotate - [select for diffs], Thu Oct 28 16:28:56 2010 UTC (13 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.145: +45 -1 lines
Diff to previous 1.145 (colored)

Add m_print() a function to print mbuf headers. Can be called from ddb
with an mbuf pointer as argument to see the contents of it.
OK thib@, deraadt@

Revision 1.145 / (download) - annotate - [select for diffs], Tue Oct 5 13:29:40 2010 UTC (13 years, 8 months ago) by mikeb
Branch: MAIN
Changes since 1.144: +6 -3 lines
Diff to previous 1.144 (colored)

implicitly protect m_cldrop with splnet;  ok claudio dlg

Revision 1.144 / (download) - annotate - [select for diffs], Thu Sep 23 10:49:55 2010 UTC (13 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.143: +12 -8 lines
Diff to previous 1.143 (colored)

tweak the mclgeti algorithm to behave better under load.

instead of letting hardware rings grow on every interrupt, restrict
it so it can only grow once per softclock tick. we can only punish
the rings on softclock ticks, so it make sense to only grow on
softclock tick boundaries too.

the rings are now punished after >1 lost softclock tick rather than
>2. mclgeti is now more aggressive at detecting livelock.

the rings get punished by an 8th, rather than by half.

we now allow the rings to be punished again even if the system is
already considered in livelock.

without this diff a livelocked system will have its rx ring sizes
scale up and down very rapidly, while holding the rings low for too
long. this affected throughput significantly.

discussed and tested heavily at j2k10. there are still some games
with softnet we can play, but this is a good first step.

"put it in" and ok deraadt@
ok claudio@ krw@ henning@ mcbride@

if we find out that it sucks we can pull it out again later. till then
we'll run with it and see how it goes.

Revision 1.143 / (download) - annotate - [select for diffs], Thu Jul 15 09:45:09 2010 UTC (13 years, 11 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.142: +6 -6 lines
Diff to previous 1.142 (colored)

m_getptr(m, 0, ...) may return an mbuf different from m -- if m has no
data in it. m_getptr() hops over empty buffers and points to the first
allocated data byte. Because of this the m_dup_pkthdr() call done by
m_copym0() can panic because not the first mbuf is passed.
Found the hard way by myself, diff by blambert@ commiitting for him since
he is not around. Tested and OK myself

Revision 1.142 / (download) - annotate - [select for diffs], Wed Jul 14 10:31:54 2010 UTC (13 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.141: +1 -2 lines
Diff to previous 1.141 (colored)

Eliminate some unused malloc(9) type defines.  Also get rid of the
mysterious and unused mbtypes[] array in mbuf.h.

ok tedu@, deraadt@

Revision 1.141 / (download) - annotate - [select for diffs], Sat Jul 3 03:33:16 2010 UTC (13 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.140: +4 -4 lines
Diff to previous 1.140 (colored)

replace 0 with equivalent allocation flag. ok thib

Revision 1.140 / (download) - annotate - [select for diffs], Fri Jul 2 02:40:16 2010 UTC (13 years, 11 months ago) by blambert
Branch: MAIN
Changes since 1.139: +17 -8 lines
Diff to previous 1.139 (colored)

m_copyback can fail to allocate memory, but is a void fucntion so gymnastics
are required to detect that.

Change the function to take a wait argument (used in nfs server, but
M_NOWAIT everywhere else for now) and to return an error

ok claudio@ henning@ krw@

Revision 1.139 / (download) - annotate - [select for diffs], Thu Jul 1 19:23:51 2010 UTC (13 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.138: +3 -3 lines
Diff to previous 1.138 (colored)

pool setconstraints must be called immediately after pool_init, otherwise
if we allocate memory before applying constraints we get memory outside
the constraints allocated in the pool. this is bad.
ok claudio@

Revision 1.138 / (download) - annotate - [select for diffs], Sun Jun 27 03:03:48 2010 UTC (13 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.137: +5 -2 lines
Diff to previous 1.137 (colored)

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt

Revision 1.137 / (download) - annotate - [select for diffs], Mon Jun 7 19:47:25 2010 UTC (14 years ago) by blambert
Branch: MAIN
Changes since 1.136: +10 -22 lines
Diff to previous 1.136 (colored)

Replace some handrolled instances of m_getptr() with that function, which
also gets a bit of a KNF scrubbing at claudio@'s insistence. Shaves some
bytes from the kernel as well.

tested by phessler@ and zinovnik@, thanks

ok claudio@

Revision 1.136 / (download) - annotate - [select for diffs], Thu Jan 14 23:12:11 2010 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.135: +2 -2 lines
Diff to previous 1.135 (colored)

fix typos in comments, no code changes;
from Brad Tilley <brad at 16systems dot com>;
ok oga@

Revision 1.135 / (download) - annotate - [select for diffs], Tue Jan 12 04:05:45 2010 UTC (14 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.134: +22 -2 lines
Diff to previous 1.134 (colored)

Move initialization of the MCLGETI ticker to mbinit(), instead of ifinit()
ok henning

Revision 1.134 / (download) - annotate - [select for diffs], Sun Sep 13 14:42:52 2009 UTC (14 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.133: +32 -3 lines
Diff to previous 1.133 (colored)

M_DUP_PKTHDR() define -> m_dup_pkthdr() function to properly deal
with m_tag_copy_chain() failures.

Use m_defrag() to eliminate hand rolled defragging of mbufs and
some uses of M_DUP_PKTHDR().

Original diff from thib@, claudio@'s feedback integrated by me.

Tests kevlo@ claudio@, "reads ok" blambert@

ok thib@ claudio@, "m_defrag() bits ok" kettenis@

Revision 1.133 / (download) - annotate - [select for diffs], Wed Aug 12 21:44:49 2009 UTC (14 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.132: +3 -27 lines
Diff to previous 1.132 (colored)

just bzero the pkthdr instead of setting each and every member of that
struct to 0/NULL. no performance impact but way less error prone on
addition of new pkthdr field (as just ran into with a theo diff). ok theo

Revision 1.132 / (download) - annotate - [select for diffs], Wed Aug 12 20:02:42 2009 UTC (14 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.131: +24 -34 lines
Diff to previous 1.131 (colored)

revert my change to m_cluncount which tries to prevent the system
running out of mbufs for rx rings.

if the system low watermark is lower than a rx rings low watermark,
we'll never send a packet up the stack, we'll always recycle it.

found by thib@ on a bge
sadface

Revision 1.131 / (download) - annotate - [select for diffs], Wed Aug 12 14:39:05 2009 UTC (14 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.130: +34 -24 lines
Diff to previous 1.130 (colored)

if we get dangerously low on clusters during interrupts, we need
to free some for use on the rx rings on network cards.

this modifies m_cluncount to advise callers when we're in such a
situation, and makes them responsible for freeing up the cluster
for allocation by MCLGETI later.

fixes an awesome lockup with sis(4) henning has been experiencing.
this is not the best fix, but it is better than the current situation.

yep deraadt@ tested by henning@

Revision 1.130 / (download) - annotate - [select for diffs], Tue Aug 11 11:53:19 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.129: +12 -15 lines
Diff to previous 1.129 (colored)

optimise m_clget so that it holds spl for even less
ok dlg thib

Revision 1.129 / (download) - annotate - [select for diffs], Tue Aug 11 10:48:39 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

Must move the splx() lower in m_clget() so that it protects atomic access
to the per-ipf mbuf cluster reference counters
ok dlg claudio

Revision 1.128 / (download) - annotate - [select for diffs], Sun Aug 9 21:08:30 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.127: +1 -10 lines
Diff to previous 1.127 (colored)

remove the ancient MCFail / MPFail debugging technique; ok claudio

Revision 1.127 / (download) - annotate - [select for diffs], Sun Aug 9 16:19:08 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.126: +7 -3 lines
Diff to previous 1.126 (colored)

use m_free_unlocked() in m_pullup() to avoid iterative splnet/splx down
the chain
ok henning

Revision 1.126 / (download) - annotate - [select for diffs], Sun Aug 9 12:50:09 2009 UTC (14 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.125: +3 -1 lines
Diff to previous 1.125 (colored)

make mbuf tags suck a bit less, performance wise.
the most common operation is checking for a particular tag to be there.
in the majority of the cases it is not.
introduce a "tagsset" in the mbuf packet header which has a bit for
each mbuf tag type that is in the chain set, checking for its existance
is now as easy and cheap as (tagsset & type) != 0. theo ok

Revision 1.125 / (download) - annotate - [select for diffs], Sun Aug 9 12:42:11 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.124: +18 -5 lines
Diff to previous 1.124 (colored)

create a m_free_unlocked which is now used by both m_freem() and m_free().
this lets m_freem() only do one splnet/splx instead of repeating this all
the way down a chain
ok henning claudio dlg

Revision 1.124 / (download) - annotate - [select for diffs], Sun Aug 9 12:24:40 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.123: +1 -2 lines
Diff to previous 1.123 (colored)

do not clear a field before we pool_put it into oblivion; ok henning

Revision 1.123 / (download) - annotate - [select for diffs], Sun Aug 9 11:40:58 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.122: +19 -3 lines
Diff to previous 1.122 (colored)

MCLGETI() will now allocate a mbuf header if it is not provided, thus
reducing the amount of splnet/splx dancing required.. especially in the
worst case (of m_cldrop)
ok dlg kettenis damien

Revision 1.122 / (download) - annotate - [select for diffs], Mon Jun 22 10:51:06 2009 UTC (14 years, 11 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.121: +1 -0 lines
Diff to previous 1.121 (colored)

sync m_inithdr() with m_gethdr() after the
addition of rdomain to struct pkthdr.

"Doh!" claudio@
ok henning@

Revision 1.121 / (download) - annotate - [select for diffs], Fri Jun 5 00:05:21 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.120: +2 -1 lines
Diff to previous 1.120 (colored)

Initial support for routing domains. This allows to bind interfaces to
alternate routing table and separate them from other interfaces in distinct
routing tables. The same network can now be used in any doamin at the same
time without causing conflicts.
This diff is mostly mechanical and adds the necessary rdomain checks accross
net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6.
input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@

Revision 1.120 / (download) - annotate - [select for diffs], Tue Jun 2 00:05:13 2009 UTC (15 years ago) by blambert
Branch: MAIN
Changes since 1.119: +18 -13 lines
Diff to previous 1.119 (colored)

Move M_PREPEND macro code to be entirely into m_prepend the function;
calling M_PREPEND is now #define'd to be calling m_prepend.

Shaves an unknown but assumed-to-be-nontrivial amount from the kernel.

ok claudio@ henning@(who may have had to okay this twice to get me to notice)

Revision 1.119 / (download) - annotate - [select for diffs], Mon Mar 2 23:52:18 2009 UTC (15 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.118: +1 -1 lines
Diff to previous 1.118 (colored)

the packet length passed to m_clget is a u_int, print it with %u not %d in
the panic string.

Revision 1.118 / (download) - annotate - [select for diffs], Mon Feb 9 21:36:10 2009 UTC (15 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.117: +1 -3 lines
Diff to previous 1.117 (colored)

Don't panic if m_copyback() is working on a M_READONLY() mbuf. The old version
did not care either and with this packets from drivers with external buffers
(e.g. wpi(4)) would trigger this panic through pf(4).
Found the hard way by Tim van der Molen tbvdm (at) xs4all (dot) nl

Revision 1.117 / (download) - annotate - [select for diffs], Wed Feb 4 20:02:11 2009 UTC (15 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.116: +37 -16 lines
Diff to previous 1.116 (colored)

Make m_copyback() a lot smarter. Make it use all of the last mbuf
(M_TRAILINGSPACE()) and allocate one cluster if needed (instead of chaining
many mbufs). Somewhat needed for the rl(4) fix to ensure that the ethernet
header is in one mbuf for sure. Tested by landry@ and myself

Revision 1.116 / (download) - annotate - [select for diffs], Tue Jan 27 09:17:51 2009 UTC (15 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.115: +45 -34 lines
Diff to previous 1.115 (colored)

make drivers tell the mclgeti allocator what their maximum ring size is
to prevent the hwm growing beyond that. this allows the livelock mitigation
to do something where the hwm used to grow beyond twice the rx rings size.

ok kettenis@ claudio@

Revision 1.115 / (download) - annotate - [select for diffs], Mon Jan 26 15:16:39 2009 UTC (15 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.114: +8 -8 lines
Diff to previous 1.114 (colored)

Remove unneeded brackets that where left over from when these were macros.
OK dlg@

Revision 1.114 / (download) - annotate - [select for diffs], Tue Dec 23 01:06:35 2008 UTC (15 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.113: +7 -7 lines
Diff to previous 1.113 (colored)

The splvm() protection is way outdated, only splnet is needed to protect
this pool (and the mbstat variables, and a few other things in certain
cases)
ok mikeb, tedu, and discussion with others...

Revision 1.113 / (download) - annotate - [select for diffs], Mon Dec 22 18:35:52 2008 UTC (15 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.112: +2 -2 lines
Diff to previous 1.112 (colored)

Doh. Correct address in bcopy -- m->m_data not &m->m_data -- this should fix
the issues seen by damien@. OK dlg@, damien@

Revision 1.112 / (download) - annotate - [select for diffs], Sat Dec 20 22:27:38 2008 UTC (15 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.111: +6 -4 lines
Diff to previous 1.111 (colored)

protect mbstat with spl; ok claudio mikeb

Revision 1.111 / (download) - annotate - [select for diffs], Sun Dec 14 22:31:46 2008 UTC (15 years, 6 months ago) by kettenis
Branch: MAIN
Changes since 1.110: +4 -2 lines
Diff to previous 1.110 (colored)

Make sure the low water mark for cluster pools isn't 0 such that network
drivers are guaranteed to make progress.  We could probably set it to 1,
but we set it to 2, to make sure drivers that link descriptors don't link
a descriptor back to itself.

ok deraadt@, dlg@

Revision 1.110 / (download) - annotate - [select for diffs], Sat Dec 13 00:18:46 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

note to everyone:  nitems(pointer) is 0, not what you want

Revision 1.109 / (download) - annotate - [select for diffs], Thu Dec 11 16:45:45 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.108: +96 -1 lines
Diff to previous 1.108 (colored)

export per-interface mbuf cluster pool use statistics out to userland
inside if_data, so that netstat(1) and systat(1) can see them
ok dlg

Revision 1.108 / (download) - annotate - [select for diffs], Thu Dec 4 23:40:44 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.107: +0 -2 lines
Diff to previous 1.107 (colored)

enable to large clusters again now that arts put the pool allocator for
them in again.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Nov 29 19:57:09 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.106: +5 -2 lines
Diff to previous 1.106 (colored)

need splvm() around the call to m_extfree() in the defragger

Revision 1.106 / (download) - annotate - [select for diffs], Wed Nov 26 23:47:14 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Doh, do not commit before compile. Found by sthen@

Revision 1.105 / (download) - annotate - [select for diffs], Wed Nov 26 22:56:07 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.104: +5 -2 lines
Diff to previous 1.104 (colored)

Do a quick return if m->m_next is NULL in m_defrag() because there is nothing
todo. Discussed with deraadt@ and dlg@

Revision 1.104 / (download) - annotate - [select for diffs], Wed Nov 26 21:39:57 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored)

only the pool_get() needs to be spl protected; ok claudio dlg

Revision 1.103 / (download) - annotate - [select for diffs], Tue Nov 25 19:09:34 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.102: +86 -18 lines
Diff to previous 1.102 (colored)

m_defrag() a mbuf chain defragmenter. It will collaps a mbuf chain into a
single buffer without changing the head mbuf. This is done with a lot of
magic so there will be dragons.
Tested and OK dlg@, kettenis@

Revision 1.102 / (download) - annotate - [select for diffs], Tue Nov 25 17:01:14 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.101: +3 -1 lines
Diff to previous 1.101 (colored)

backout large cluster allocators.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Nov 25 15:43:32 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.100: +2 -4 lines
Diff to previous 1.100 (colored)

art says he doesnt suck anymore, so enable the really big cluster
allocators again.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Nov 25 12:47:00 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.99: +11 -11 lines
Diff to previous 1.99 (colored)

Factor increases are not needed, +1 appears to work as well.
ok dlg

Revision 1.99 / (download) - annotate - [select for diffs], Tue Nov 25 12:07:55 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

m_cluncount() needs to walk the mbuf chain to correctly uncount all clusters
but don't do that in m_free() as that will cause a double loop behaviour when
called via m_freem().
OK dlg@, deraadt@

Revision 1.98 / (download) - annotate - [select for diffs], Mon Nov 24 19:17:16 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.97: +3 -1 lines
Diff to previous 1.97 (colored)

art isnt handling spls properly in the pool allocator backends for big
objects. dmesg is being spammed with splasserts.

disable the 8k, 9k, 12k, 16k, and 64k backend pools for the cluster
allocator.

art will fix this when he gets back from dinner, otherwise i'll nag more.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Nov 24 18:34:40 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.96: +1 -4 lines
Diff to previous 1.96 (colored)

enable the 8k, 9k, 12k, 16k, and 64k backend pools for the cluster
allocator.

Revision 1.96 / (download) - annotate - [select for diffs], Mon Nov 24 14:26:54 2008 UTC (15 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.95: +5 -1 lines
Diff to previous 1.95 (colored)

move MCLPOOLS to if.h and force uipc_mbuf.c to get if.h, there is no
other option
ok dlg

Revision 1.95 / (download) - annotate - [select for diffs], Mon Nov 24 12:57:37 2008 UTC (15 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.94: +65 -22 lines
Diff to previous 1.94 (colored)

add several backend pools to allocate mbufs clusters of various sizes out
of. currently limited to MCLBYTES (2048 bytes) and 4096 bytes until pools
can allocate objects of sizes greater than PAGESIZE.

this allows drivers to ask for "jumbo" packets to fill rx rings with.

the second half of this change is per interface mbuf cluster allocator
statistics. drivers can use the new interface (MCLGETI), which will use
these stats to selectively fail allocations based on demand for mbufs. if
the driver isnt rapidly consuming rx mbufs, we dont allow it to allocate
many to put on its rx ring.

drivers require modifications to take advantage of both the new allocation
semantic and large clusters.

this was written and developed with deraadt@ over the last two days
ok deraadt@ claudio@

Revision 1.94 / (download) - annotate - [select for diffs], Tue Oct 14 18:01:53 2008 UTC (15 years, 8 months ago) by naddy
Branch: MAIN
Changes since 1.93: +36 -39 lines
Diff to previous 1.93 (colored)

Change m_devget()'s outdated and unused "offset" argument:  It is
now the offset into the first mbuf of the target chain before copying
the source data over.  From FreeBSD.

Convert drivers' use of m_devget().  Mostly from thib@.

Update mbuf(9) man page.

ok claudio@, thib@

Revision 1.93 / (download) - annotate - [select for diffs], Sun Sep 28 14:08:51 2008 UTC (15 years, 8 months ago) by naddy
Branch: MAIN
Changes since 1.92: +3 -1 lines
Diff to previous 1.92 (colored)

initialize the ether_vtag field like the rest of the packet header

Revision 1.92 / (download) - annotate - [select for diffs], Thu Aug 14 19:39:40 2008 UTC (15 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.91: +7 -4 lines
Diff to previous 1.91 (colored)

Kill the _MCLDEREFERENCE() macro it was only used once and it should be only
used once -- in m_free(). Removed so that people don't get stupid ideas.
OK thib@

Revision 1.91 / (download) - annotate - [select for diffs], Fri Aug 8 08:54:08 2008 UTC (15 years, 10 months ago) by thib
Branch: MAIN
Changes since 1.90: +4 -2 lines
Diff to previous 1.90 (colored)

plug an mbuf leak in m_pullup2(); If we fail to get a cluster for an mbuf,
free the mbuf before bailing out.

ok claudio@

Revision 1.90 / (download) - annotate - [select for diffs], Wed Jun 11 02:46:34 2008 UTC (16 years ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.89: +3 -1 lines
Diff to previous 1.89 (colored)

store a pointer to the stack side state key in the mbuf packet
header inbound. on the outbound side, we take that and look for the key
that is the exact opposite, and store that mapping in the state key. on
subsequent packets we don't have to do the lookup on outbound any more.
almost unable to get real benchmarks going here, we know for sure this
gives a more than 5% increase in forwarding performance.
many thanks to ckuethe for stress- and performance-testing.
ok ryan theo

Revision 1.89 / (download) - annotate - [select for diffs], Tue May 6 02:16:26 2008 UTC (16 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Rather than clearing particularly dangerous flags when found, just
zero all flags when we pool_put mbufs.

ok claudio@ henning@

Revision 1.88 / (download) - annotate - [select for diffs], Wed Jan 16 19:28:23 2008 UTC (16 years, 4 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.87: +4 -4 lines
Diff to previous 1.87 (colored)

Dont use PR_LIMITFAIL with PR_WAITOK when M_WAIT is passed with
the flag argument to the m_*get* functions. Since PR_LIMITFAIL
can cause us to return NULL if hit the limits.

ok claudio@

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 27 16:38:50 2007 UTC (16 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.86: +21 -1 lines
Diff to previous 1.86 (colored)

make the deceptively complicated leading and trailing space into functions.
this reduces kernel size quite a bit. ok claudio

Revision 1.86 / (download) - annotate - [select for diffs], Wed Sep 26 13:05:52 2007 UTC (16 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.85: +24 -1 lines
Diff to previous 1.85 (colored)

provide m_inithdr(), which takes an mbuf and gives an initialized M_PKTHDR
mbuf back.
for fixing PR5563 in a few, tested janjaap@stack.nl, ok claudio

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jul 20 09:59:19 2007 UTC (16 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.84: +23 -2 lines
Diff to previous 1.84 (colored)

Remove the MFREE() macro and replace it with a call to m_free().
Also remove the _MEXTREMOVE macro which was only used by MFREE.
This time with the uipc_mbuf.c change that I missed last time.

Revision 1.84 / (download) - annotate - [select for diffs], Sat Jun 2 09:45:32 2007 UTC (17 years ago) by art
Branch: MAIN
Changes since 1.83: +2 -1 lines
Diff to previous 1.83 (colored)

Initialize pkthdr.rcvif.
ok claudio@

Revision 1.83 / (download) - annotate - [select for diffs], Mon May 28 19:20:14 2007 UTC (17 years ago) by tedu
Branch: MAIN
Changes since 1.82: +2 -1 lines
Diff to previous 1.82 (colored)

set a hiwat mark for mbpool.  we spend quite a bit of time bouncing pages
in and out with the very low default.
ok dlg henning ryan

Revision 1.82 / (download) - annotate - [select for diffs], Mon May 28 17:16:39 2007 UTC (17 years ago) by henning
Branch: MAIN
Changes since 1.81: +7 -1 lines
Diff to previous 1.81 (colored)

double pf performance.
boring details:
pf used to use an mbuf tag to keep track of route-to etc, altq, tags,
routing table IDs, packets redirected to localhost etc. so each and every
packet going through pf got an mbuf tag. mbuf tags use malloc'd memory,
and that is knda slow.
instead, stuff the information into the mbuf header directly.
bridging soekris with just "pass" as ruleset went from 29 MBit/s to
58 MBit/s with that (before ryan's randomness fix, now it is even betterer)
thanks to chris for the test setup!
ok ryan ryan ckuethe reyk

Revision 1.81 / (download) - annotate - [select for diffs], Sun May 27 20:54:25 2007 UTC (17 years ago) by claudio
Branch: MAIN
Changes since 1.80: +46 -33 lines
Diff to previous 1.80 (colored)

Kill the nasty MGET, MGETHDR and MCLGET makros and replace them with normal
functions. The world is no longer running on a PDP11 so function call overhead
is not an issue. Diff by tbert, tested by many, OK art@

Revision 1.80 / (download) - annotate - [select for diffs], Thu Mar 15 11:48:09 2007 UTC (17 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.79: +5 -3 lines
Diff to previous 1.79 (colored)

m_prepend() works only for sizes smaller than MHLEN.
OK beck@ deraadt@ pyr@

Revision 1.79 / (download) - annotate - [select for diffs], Fri Dec 29 13:04:37 2006 UTC (17 years, 5 months ago) by pedro
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.78: +3 -2 lines
Diff to previous 1.78 (colored)

Avoid void * arithmetic, okay deraadt@, suggestions from millert@

Revision 1.78 / (download) - annotate - [select for diffs], Wed Nov 29 12:39:48 2006 UTC (17 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.77: +1 -3 lines
Diff to previous 1.77 (colored)

We don't use mb_map anymore since a long time already. Remove it.

Revision 1.77 / (download) - annotate - [select for diffs], Wed Oct 11 22:39:46 2006 UTC (17 years, 8 months ago) by mpf
Branch: MAIN
Changes since 1.76: +11 -14 lines
Diff to previous 1.76 (colored)

Remove unused variable and simplify m_copym0(). Diff from bret.lambert at gmail.com.
Kill another unused variable in m_devget(). Pointed out by mcbride.
Rename all offset variables from off0 to off.
OK markus@, deraadt@

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jul 14 01:58:58 2006 UTC (17 years, 11 months ago) by pedro
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Typo

Revision 1.75 / (download) - annotate - [select for diffs], Sun May 7 20:06:50 2006 UTC (18 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.74: +1 -4 lines
Diff to previous 1.74 (colored)

remove drain hooks from pool.
1.  drain hooks and lists of allocators make the code complicated
2.  the only hooks in the system are the mbuf reclaim routines
3.  if reclaim is actually able to put a meaningful amount of memory back
in the system, i think something else is dicked up.  ie, if reclaiming
your ip fragment buffers makes the difference thrashing swap and not,
your system is in a load of trouble.
4.  it's a scary amount of code running with very weird spl requirements
and i'd say it's pretty much totally untested.  raise your hand if your
router is running at the edge of swap.
5.  the reclaim stuff goes back to when mbufs lived in a tiny vm_map and
you could run out of va.  that's very unlikely (like impossible) now.
ok/tested pedro krw sturm

Revision 1.74 / (download) - annotate - [select for diffs], Fri Mar 17 04:21:57 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.73: +5 -4 lines
Diff to previous 1.73 (colored)

rev 1.77

m_cat() - if it is safe, copy data portion into 1st mbuf even if 1st mbuf
is M_EXT mbuf.

rev 1.72

clarify comment on m_cat().

From itojun NetBSD

ok claudio@ mcbride@

Revision 1.73 / (download) - annotate - [select for diffs], Sun Mar 5 00:44:25 2006 UTC (18 years, 3 months ago) by brad
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

splimp -> splvm

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jan 5 05:05:06 2006 UTC (18 years, 5 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.71: +47 -95 lines
Diff to previous 1.71 (colored)

ansi/deregister

Revision 1.71 / (download) - annotate - [select for diffs], Sat Dec 31 19:18:05 2005 UTC (18 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.70: +13 -15 lines
Diff to previous 1.70 (colored)

Nuke unused variable 'space' found by lint. Eliminate some trailing
whitespace. No binary diff on i386.

ok pedro@

Revision 1.19.2.13 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:02 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.19.2.12: +27 -47 lines
Diff to previous 1.19.2.12 (colored) to branchpoint 1.19 (colored) next main 1.20 (colored)

Merge with the trunk

Revision 1.70 / (download) - annotate - [select for diffs], Thu May 27 04:55:28 2004 UTC (20 years ago) by tedu
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.69: +3 -23 lines
Diff to previous 1.69 (colored)

change uvm_km_getpage to take waitok argument and sleep if appropriate.
change both the nointr and default pool allocators to using uvm_km_getpage.
change pools to default to a maxpages value of 8, so they hoard less memory.
change mbuf pools to use default pool allocator.
pools are now more efficient, use less of kmem_map, and a bit faster.
tested mcbride, deraadt, pedro, drahn, miod to work everywhere

Revision 1.69 / (download) - annotate - [select for diffs], Sun May 23 19:41:23 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.68: +0 -6 lines
Diff to previous 1.68 (colored)

bad stuff escaped by accident

Revision 1.68 / (download) - annotate - [select for diffs], Sun May 23 19:37:24 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.67: +7 -1 lines
Diff to previous 1.67 (colored)

according to fork1(9), retval is optional.  make it so.
from form@pdp-11.org.ru via mpech.  ok millert

Revision 1.67 / (download) - annotate - [select for diffs], Mon Apr 19 22:52:33 2004 UTC (20 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.66: +20 -20 lines
Diff to previous 1.66 (colored)

introduce a new km_page allocator that gets pages from kernel_map using
an interrupt safe thread.
use this as the new backend for mbpool and mclpool, eliminating the mb_map.
introduce a sysctl kern.maxclusters which controls the limit of clusters
allocated.
testing by many people, works everywhere but m68k.  ok deraadt@

this essentially deprecates the NMBCLUSTERS option, don't use it.
this should reduce pressure on the kmem_map and the uvm reserve of static
map entries.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Apr 17 10:18:12 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored)

Don't forget to apply the M_CLUSTER flag when copying flags in m_pullup2().
Fixes pr3740. Confirmed with pb@, ok markus@.

Revision 1.65 / (download) - annotate - [select for diffs], Thu Apr 1 23:56:05 2004 UTC (20 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.64: +14 -15 lines
Diff to previous 1.64 (colored)

use NULL for ptrs.  parts from Joris Vink

Revision 1.19.2.12 / (download) - annotate - [select for diffs], Thu Feb 19 10:56:38 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.19.2.11: +3 -3 lines
Diff to previous 1.19.2.11 (colored) to branchpoint 1.19 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.64 / (download) - annotate - [select for diffs], Wed Jan 28 20:19:24 2004 UTC (20 years, 4 months ago) by dhartmei
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

oh, i'll happily steal the commit. ok henning@, markus@, otto@ (iirc)
from KOZUKA Masahiro, fixes PR 3651

Revision 1.63 / (download) - annotate - [select for diffs], Tue Aug 12 05:09:18 2003 UTC (20 years, 10 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

src argument to m_copyback() can be a const; itojun@ ok

Revision 1.19.2.11 / (download) - annotate - [select for diffs], Sat Jun 7 11:03:40 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.19.2.10: +3 -6 lines
Diff to previous 1.19.2.10 (colored) to branchpoint 1.19 (colored)

Sync SMP branch to -current

Revision 1.62 / (download) - annotate - [select for diffs], Mon Jun 2 23:28:06 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.61: +2 -6 lines
Diff to previous 1.61 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Jun 1 16:23:41 2003 UTC (21 years ago) by art
Branch: MAIN
Changes since 1.60: +2 -1 lines
Diff to previous 1.60 (colored)

uvm_km_suballoc passes the 'min' argument untouched to uvm_map. uvm_map
uses it as a hint for where to steal space from the parent map. We've been
passing random stack garbage as that hint for ages. It's a wonder it didn't
break things until we started working on Hammer.

noone objected for at least a week.

Revision 1.44.2.5 / (download) - annotate - [select for diffs], Mon May 19 22:31:57 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.44.2.4: +56 -1 lines
Diff to previous 1.44.2.4 (colored) to branchpoint 1.44 (colored) next main 1.45 (colored)

sync

Revision 1.19.2.10 / (download) - annotate - [select for diffs], Tue May 13 19:21:28 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.19.2.9: +55 -1 lines
Diff to previous 1.19.2.9 (colored) to branchpoint 1.19 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Apr 23 01:36:52 2003 UTC (21 years, 1 month ago) by jason
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.59: +55 -1 lines
Diff to previous 1.59 (colored)

Move m_copyback() to uipc_mbuf where it makes some kinda sense; ok dhartmei

Revision 1.19.2.9 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:27 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.19.2.8: +6 -0 lines
Diff to previous 1.19.2.8 (colored) to branchpoint 1.19 (colored)

Sync the SMP branch with 3.3

Revision 1.59 / (download) - annotate - [select for diffs], Wed Feb 12 14:41:07 2003 UTC (21 years, 4 months ago) by jason
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.58: +2 -1 lines
Diff to previous 1.58 (colored)

Remove commons; inspired by netbsd.

Revision 1.44.2.4 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:44 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.44.2.3: +6 -1 lines
Diff to previous 1.44.2.3 (colored) to branchpoint 1.44 (colored)

sync to -current

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jul 3 21:19:08 2002 UTC (21 years, 11 months ago) by miod
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.57: +6 -1 lines
Diff to previous 1.57 (colored)

Change all variables definitions (int foo) in sys/sys/*.h to variable
declarations (extern int foo), and compensate in the appropriate locations.

Revision 1.44.2.3 / (download) - annotate - [select for diffs], Tue Jun 11 03:29:40 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.44.2.2: +18 -15 lines
Diff to previous 1.44.2.2 (colored) to branchpoint 1.44 (colored)

Sync UBC branch to -current

Revision 1.19.2.8 / (download) - annotate - [select for diffs], Thu Mar 28 11:43:04 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.19.2.7: +4 -4 lines
Diff to previous 1.19.2.7 (colored) to branchpoint 1.19 (colored)

Merge in -current from about a week ago

Revision 1.57 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:05 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.56: +5 -5 lines
Diff to previous 1.56 (colored)

First round of __P removal in sys

Revision 1.19.2.7 / (download) - annotate - [select for diffs], Wed Mar 6 02:13:23 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.19.2.6: +70 -88 lines
Diff to previous 1.19.2.6 (colored) to branchpoint 1.19 (colored)

Merge in trunk

Revision 1.56 / (download) - annotate - [select for diffs], Mon Feb 25 04:53:16 2002 UTC (22 years, 3 months ago) by dhartmei
Branch: MAIN
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

Make pool_sethardlimit() check that it doesn't decrease the limit below
the current size of the pool. ok art@

Revision 1.55 / (download) - annotate - [select for diffs], Sun Feb 17 22:59:53 2002 UTC (22 years, 3 months ago) by maja
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored)

Patch from Daniel Lucq <daniel@lucq.org>

The patch allows you to change the value of NMBCLUSTERS, BUFCACHEPERCENT
and NKMEMPAGES using the config command, instead of recompiling the kernel.

This is the kernel part of the patch. I have compiled it on i386, sparc64,
alpha and macppc. -moj ok art@ maja@

Revision 1.54 / (download) - annotate - [select for diffs], Tue Feb 5 22:06:43 2002 UTC (22 years, 4 months ago) by angelos
Branch: MAIN
Changes since 1.53: +2 -3 lines
Diff to previous 1.53 (colored)

Zero-ize ext even if it has a free method defined.

Revision 1.53 / (download) - annotate - [select for diffs], Tue Feb 5 21:59:18 2002 UTC (22 years, 4 months ago) by angelos
Branch: MAIN
Changes since 1.52: +6 -3 lines
Diff to previous 1.52 (colored)

panic if a read-only mbuf is given to m_zero() --- from art@openbsd.org

Revision 1.52 / (download) - annotate - [select for diffs], Tue Feb 5 21:47:59 2002 UTC (22 years, 4 months ago) by angelos
Branch: MAIN
Changes since 1.51: +7 -6 lines
Diff to previous 1.51 (colored)

Fix m_zero() yet again -- yesterday's fix wasn't sufficient.

Revision 1.51 / (download) - annotate - [select for diffs], Mon Feb 4 21:44:16 2002 UTC (22 years, 4 months ago) by angelos
Branch: MAIN
Changes since 1.50: +5 -5 lines
Diff to previous 1.50 (colored)

Also, cleanup any external buffers first (paranoid).

Revision 1.50 / (download) - annotate - [select for diffs], Mon Feb 4 20:50:42 2002 UTC (22 years, 4 months ago) by jason
Branch: MAIN
Changes since 1.49: +4 -4 lines
Diff to previous 1.49 (colored)

Revision 1.37 was borked... This time, fix the casts and address the
void * arithmetic problem correctly in m_zero()

Revision 1.44.2.2 / (download) - annotate - [select for diffs], Sat Feb 2 03:28:25 2002 UTC (22 years, 4 months ago) by art
Branch: UBC
Changes since 1.44.2.1: +2 -3 lines
Diff to previous 1.44.2.1 (colored) to branchpoint 1.44 (colored)

Merge in UBC performance changes from NetBSD.
Fix a bunch of merge errors from yesterday.

Revision 1.44.2.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:41 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.44: +21 -70 lines
Diff to previous 1.44 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.49 / (download) - annotate - [select for diffs], Fri Jan 25 15:50:22 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.48: +5 -55 lines
Diff to previous 1.48 (colored)

Add a drain hook to each pool. This hook is called in three cases.
1. When a pool hit the hard limit. Just before bailing out/sleeping.
2. When an allocator fails to allocate memory (with PR_NOWAIT).
3. Just before trying to reclaim some page in pool_reclaim.

The function called form the hook should try to free some items to the
pool if possible.

Convert m_reclaim hooks that were embedded in MCLGET, MGET and MGETHDR
into a pool drain hook (making the code much cleaner).

Revision 1.48 / (download) - annotate - [select for diffs], Wed Jan 23 17:51:52 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.47: +6 -1 lines
Diff to previous 1.47 (colored)

move mb_map allocation to mbinit()

Revision 1.47 / (download) - annotate - [select for diffs], Wed Jan 23 17:35:57 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

move definition of mb_map from zillions of machdep.c to uipc_mbuf.c

Revision 1.46 / (download) - annotate - [select for diffs], Wed Jan 23 00:39:47 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.45: +11 -14 lines
Diff to previous 1.45 (colored)

Pool deals fairly well with physical memory shortage, but it doesn't deal
well (not at all) with shortages of the vm_map where the pages are mapped
(usually kmem_map).

Try to deal with it:
 - group all information the backend allocator for a pool in a separate
   struct. The pool will only have a pointer to that struct.
 - change the pool_init API to reflect that.
 - link all pools allocating from the same allocator on a linked list.
 - Since an allocator is responsible to wait for physical memory it will
   only fail (waitok) when it runs out of its backing vm_map, carefully
   drain pools using the same allocator so that va space is freed.
   (see comments in code for caveats and details).
 - change pool_reclaim to return if it actually succeeded to free some
   memory, use that information to make draining easier and more efficient.
 - get rid of PR_URGENT, noone uses it.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Jan 16 20:50:17 2002 UTC (22 years, 4 months ago) by miod
Branch: MAIN
Changes since 1.44: +1 -2 lines
Diff to previous 1.44 (colored)

Don't include <sys/map.h> when you don't need what's in it.

Revision 1.44 / (download) - annotate - [select for diffs], Tue Dec 18 23:07:49 2001 UTC (22 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.43: +39 -11 lines
Diff to previous 1.43 (colored)

NRL license cleaning

Revision 1.19.2.6 / (download) - annotate - [select for diffs], Wed Dec 5 01:02:39 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.19.2.5: +1 -1 lines
Diff to previous 1.19.2.5 (colored) to branchpoint 1.19 (colored)

Merge in -current

Revision 1.43 / (download) - annotate - [select for diffs], Wed Nov 28 16:13:29 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

zap some typedefs.
vm_map_t -> struct vm_map *
vm_map_entry_t -> struct vm_map_entry *
simple_lock_data_t -> struct simplelock

(uvm not done yet, coming in the next commit)

Revision 1.19.2.5 / (download) - annotate - [select for diffs], Tue Nov 13 23:04:23 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.19.2.4: +1 -3 lines
Diff to previous 1.19.2.4 (colored) to branchpoint 1.19 (colored)

merge in -current

Revision 1.42 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:20 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.41: +1 -3 lines
Diff to previous 1.41 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.19.2.4 / (download) - annotate - [select for diffs], Wed Oct 31 03:26:29 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.19.2.3: +1 -2 lines
Diff to previous 1.19.2.3 (colored) to branchpoint 1.19 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.41 / (download) - annotate - [select for diffs], Wed Sep 12 00:23:33 2001 UTC (22 years, 9 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.40: +1 -2 lines
Diff to previous 1.40 (colored)

mbutl no more

Revision 1.19.2.3 / (download) - annotate - [select for diffs], Wed Jul 4 10:48:43 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.19.2.2: +158 -177 lines
Diff to previous 1.19.2.2 (colored) to branchpoint 1.19 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.40 / (download) - annotate - [select for diffs], Wed Jun 27 04:49:47 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.39: +1 -11 lines
Diff to previous 1.39 (colored)

remove old vm

Revision 1.39 / (download) - annotate - [select for diffs], Wed Jun 27 03:53:50 2001 UTC (22 years, 11 months ago) by angelos
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

Update comment.

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jun 27 03:49:52 2001 UTC (22 years, 11 months ago) by angelos
Branch: MAIN
Changes since 1.37: +4 -4 lines
Diff to previous 1.37 (colored)

Get rid of M_COPY_* macros; either use M_MOVE_* or M_DUP_*, depending
on how macros should be treated. Code by fgsch@, ok by me and itojun@

Revision 1.37 / (download) - annotate - [select for diffs], Tue Jun 26 06:27:40 2001 UTC (22 years, 11 months ago) by aaron
Branch: MAIN
Changes since 1.36: +4 -4 lines
Diff to previous 1.36 (colored)

Appease gcc by not using void pointers in arithmetic operations; art@ ok

Revision 1.36 / (download) - annotate - [select for diffs], Mon Jun 25 02:52:18 2001 UTC (22 years, 11 months ago) by angelos
Branch: MAIN
Changes since 1.35: +4 -10 lines
Diff to previous 1.35 (colored)

Don't reset M_PKTHDR before we copy the mbuf flags (bad Federico!)

Revision 1.35 / (download) - annotate - [select for diffs], Mon Jun 25 01:50:16 2001 UTC (22 years, 11 months ago) by fgsch
Branch: MAIN
Changes since 1.34: +3 -4 lines
Diff to previous 1.34 (colored)

Move common post M_COPY_HDR manipulation to the macro itself; angelos@ ok.

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 26 06:59:14 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.33: +5 -9 lines
Diff to previous 1.33 (colored)

Use m_tag_init() and M_COPY_HDR().

Revision 1.33 / (download) - annotate - [select for diffs], Sat May 26 05:46:33 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.32: +4 -2 lines
Diff to previous 1.32 (colored)

Fix backpointer.

Revision 1.32 / (download) - annotate - [select for diffs], Thu May 24 10:59:23 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.31: +3 -1 lines
Diff to previous 1.31 (colored)

If the copied tag container is empty, initialize it properly.

Revision 1.31 / (download) - annotate - [select for diffs], Sun May 20 08:31:46 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.30: +4 -4 lines
Diff to previous 1.30 (colored)

m_tag_* routines, plus minor changes (convert from tdbi to tags)

Revision 1.30 / (download) - annotate - [select for diffs], Fri May 18 23:29:33 2001 UTC (23 years ago) by millert
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Use pool_page_alloc_nointr() and pool_page_free_nointr() since they
are exported wheras pool_page_alloc() and pool_page_free() are
static.  In the non-UVM case these just call pool_page_alloc() and
pool_page_free() anyway.

Revision 1.29 / (download) - annotate - [select for diffs], Thu May 17 18:41:44 2001 UTC (23 years, 1 month ago) by provos
Branch: MAIN
Changes since 1.28: +127 -157 lines
Diff to previous 1.28 (colored)

convert mbuf and cluster allocation to pool, mostly from NetBSD
okay art@ miod@

Revision 1.28 / (download) - annotate - [select for diffs], Wed May 16 08:59:04 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.27: +29 -1 lines
Diff to previous 1.27 (colored)

Introduce a new kernel option "SMALL_KERNEL" that will be used to keep the
kernel size down.

Two changes. Uninline MALLOC and uninline a few mbuf macros. Saves 140k
on alpha RAMDISK (although only 11k after gzip).

Revision 1.19.2.2 / (download) - annotate - [select for diffs], Mon May 14 22:32:45 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.19.2.1: +14 -7 lines
Diff to previous 1.19.2.1 (colored) to branchpoint 1.19 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.27 / (download) - annotate - [select for diffs], Sat May 5 20:57:00 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

Get rid of CLSIZE and all related stuff.
CLSIZE -> 1
CLBYTES -> PAGE_SIZE
OLOFSET -> PAGE_MASK
etc.
At the same time some archs needed some cleaning in vmparam.h so that
goes in at the same time.

Revision 1.26 / (download) - annotate - [select for diffs], Thu Apr 5 10:52:45 2001 UTC (23 years, 2 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

From angelos: (he can't commit this himself right now)
> I must have been on drugs...a deep copy is needed, or else there's double
> free's when there's IPsec.
[...]
> This should solve the crash problems.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Mar 30 19:24:35 2001 UTC (23 years, 2 months ago) by angelos
Branch: MAIN
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored)

Be consistent when adjusting pkthdr.len; it doesn't matter currently,
since the callers always do the right thing, but it might in the
future. Pointed out by art@

Revision 1.24 / (download) - annotate - [select for diffs], Wed Mar 28 20:03:00 2001 UTC (23 years, 2 months ago) by angelos
Branch: MAIN
Changes since 1.23: +9 -4 lines
Diff to previous 1.23 (colored)

Allow tdbi's to appear in mbufs throughout the stack; this allows
security properties of the packets to be pushed up to the application
(not done yet). Eventually, this will be turned into a packet
attributes framework.

Make sure tdbi's are free'd/cleared properly whenever drivers (or NFS)
does weird things with mbufs.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Mar 25 07:07:57 2001 UTC (23 years, 2 months ago) by csapuntz
Branch: MAIN
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored)

Not really a bug but one day panic might throw an exception or something. THanks to dawson and team for fix

Revision 1.19.2.1 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:26 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.19: +36 -2 lines
Diff to previous 1.19 (colored)

Sync with -current

Revision 1.22 / (download) - annotate - [select for diffs], Fri Mar 3 11:15:43 2000 UTC (24 years, 3 months ago) by angelos
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.21: +27 -28 lines
Diff to previous 1.21 (colored)

Style.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Mar 3 06:19:22 2000 UTC (24 years, 3 months ago) by angelos
Branch: MAIN
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

Remove extraneous newline.

Revision 1.20 / (download) - annotate - [select for diffs], Thu Mar 2 21:40:49 2000 UTC (24 years, 3 months ago) by angelos
Branch: MAIN
Changes since 1.19: +37 -1 lines
Diff to previous 1.19 (colored)

New function: m_getptr(), takes as argument an mbuf chain and an
offset, returns a pointer to them specific mbuf and the offset inside
it that corresponds to the offset argument (so one can find where the
n'th byte is in an mbuf).

Revision 1.19 / (download) - annotate - [select for diffs], Fri Dec 31 23:37:08 1999 UTC (24 years, 5 months ago) by provos
Branch: MAIN
CVS Tags: SMP_BASE
Branch point for: SMP
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

copy pkthdr correctly in m_split, okay angelos@

Revision 1.18 / (download) - annotate - [select for diffs], Sun Dec 5 07:30:31 1999 UTC (24 years, 6 months ago) by angelos
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.17: +62 -1 lines
Diff to previous 1.17 (colored)

Add an m_inject()

Revision 1.17 / (download) - annotate - [select for diffs], Fri Oct 1 02:00:12 1999 UTC (24 years, 8 months ago) by jason
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.16: +12 -5 lines
Diff to previous 1.16 (colored)

remove dependency on external storage managed by mclusters and
add more support for external managers

Revision 1.16 / (download) - annotate - [select for diffs], Sun Sep 12 11:46:53 1999 UTC (24 years, 9 months ago) by niklas
Branch: MAIN
Changes since 1.15: +58 -57 lines
Diff to previous 1.15 (colored)

style(9)

Revision 1.15 / (download) - annotate - [select for diffs], Tue Aug 17 12:31:22 1999 UTC (24 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

There was a line missing in the commit from rev 1.6 that resulted in
an uninitialized variable; art@stacken.kth.se

Revision 1.14 / (download) - annotate - [select for diffs], Mon Aug 9 21:41:51 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +25 -17 lines
Diff to previous 1.13 (colored)

make panic messages unique

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jul 2 01:02:53 1999 UTC (24 years, 11 months ago) by cmetz
Branch: MAIN
Changes since 1.12: +45 -1 lines
Diff to previous 1.12 (colored)

Added a simple but potentially very useful new mbuf function, m_apply().
It applies the supplied function f(state, p, len) to every contiguous region
in a mbuf, thus mostly handling all the mbuf-isms for you.

It's used by my TCP MD5 signature implementation to run MD5 over the TCP
payload data in a mbuf so that I don't have to spread mbufism-loops all over.
It might also be useful for IPsec.

Revision 1.12 / (download) - annotate - [select for diffs], Fri May 14 02:12:29 1999 UTC (25 years, 1 month ago) by cmetz
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

OpenBSD has no ext_func, so that test is bogus.

Revision 1.11 / (download) - annotate - [select for diffs], Fri May 14 02:05:42 1999 UTC (25 years, 1 month ago) by cmetz
Branch: MAIN
Changes since 1.10: +3 -2 lines
Diff to previous 1.10 (colored)

m_zero will no longer zero the contents of a cluster if there's an alias to it.
(TCP uses cluster mbuf aliases for retransmission, and this would cause your
data to get retransmitted zeroed-out)

Revision 1.10 / (download) - annotate - [select for diffs], Wed May 12 21:11:40 1999 UTC (25 years, 1 month ago) by ho
Branch: MAIN
Changes since 1.9: +1 -3 lines
Diff to previous 1.9 (colored)

Fix problem with data corruption for retransmitted TCP packets
in an IPSec ESP tunnel. OpenBSD PR 819.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Feb 26 04:49:07 1999 UTC (25 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.8: +10 -1 lines
Diff to previous 1.8 (colored)

kmem allocation changes for uvm

Revision 1.8 / (download) - annotate - [select for diffs], Thu Jan 7 22:28:01 1999 UTC (25 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +177 -1 lines
Diff to previous 1.7 (colored)

new APIs: m_pullup2, m_copym2, m_zero, MCL_ALIGN; NRL/cmetz

Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 3 19:06:27 1998 UTC (26 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

bad types; wileyc@sekiya.twics.co.jp

Revision 1.6 / (download) - annotate - [select for diffs], Wed Aug 20 05:42:26 1997 UTC (26 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

In m_split(), restore m_pkthdr.len to original length if we
get an error.  From Koji Imada <koji@math.human.nagoya-u.ac.jp>

Revision 1.5 / (download) - annotate - [select for diffs], Fri Sep 6 07:21:41 1996 UTC (27 years, 9 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored)

Need cpu.h included to get at setsoftnet define

Revision 1.4 / (download) - annotate - [select for diffs], Mon Sep 2 18:14:15 1996 UTC (27 years, 9 months ago) by dm
Branch: MAIN
Changes since 1.3: +13 -1 lines
Diff to previous 1.3 (colored)

Don't drain the protocol queues at interrupt level.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 20 10:50:22 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +13 -7 lines
Diff to previous 1.2 (colored)

if kmem_malloc() fails to allocate a cluster, call m_reclaim(). log
"mb_map full" message only once a minute.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Mar 3 17:20:17 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.1: +11 -6 lines
Diff to previous 1.1 (colored)

From NetBSD: 960217 merge

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:52:46 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:52:46 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.