#
364163 |
|
12-Aug-2020 |
ae |
MFC r363906: Add m__getjcl SDT probe.
|
#
338618 |
|
12-Sep-2018 |
markj |
MFC r337423: Improve handling of control message truncation.
PR: 131876
|
#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
328391 |
|
25-Jan-2018 |
pkelsey |
MFC of r316630, r316631, r316632, r316633, r316634
Fixed various typos.
|
#
318815 |
|
24-May-2017 |
np |
MFC r307380:
Fix typo in comments.
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
300982 |
|
30-May-2016 |
sephe |
mbuf: Add a flag for M_HASHTYPE_ to indicate the type has hash properties
This flag has not been used, and drivers setting M_HASHTYPE_OPAQUE have not been converted as of this commit.
Reviewed by: hps, gallatin (early version) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6406
|
#
300113 |
|
18-May-2016 |
scottl |
Import the 'iflib' API library for network drivers. From the author:
"iflib is a library to eliminate the need for frequently duplicated device independent logic propagated (poorly) across many network drivers."
Participation is purely optional. The IFLIB kernel config option is provided for drivers that want to transition between legacy and iflib modes of operation. ixl and ixgbe driver conversions will be committed shortly. We hope to see participation from the Broadcom and maybe Chelsio drivers in the near future.
Submitted by: mmacy@nextbsd.org Reviewed by: gallatin Differential Revision: D5211
|
#
297241 |
|
24-Mar-2016 |
glebius |
Space and style(9) corrections for recent mbuf changes.
|
#
297227 |
|
24-Mar-2016 |
gnn |
Move mbuf provider under SDT to indicate that it is FreeBSD specific and not a stable interface.
Reviewed by: markj MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D5716
|
#
297188 |
|
22-Mar-2016 |
gnn |
Add an mbuf provider to DTrace.
The mbuf provider is made up of a set of Statically Defined Tracepoints which help us look into mbufs as they are allocated and freed. This can be used to inspect the buffers or for a simplified mbuf leak detector.
New tracepoints are:
mbuf:::m-init mbuf:::m-gethdr mbuf:::m-get mbuf:::m-getcl mbuf:::m-clget mbuf:::m-cljget mbuf:::m-cljset mbuf:::m-free mbuf:::m-freem
There is also a translator for mbufs which gives some visibility into the structure, see mbuf.d for more details.
Reviewed by: bz, markj MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D5682
|
#
296242 |
|
29-Feb-2016 |
glebius |
New way to manage reference counting of mbuf external storage.
The m_ext.ext_cnt pointer becomes a union. It can now hold the refcount value itself. To tell that m_ext.ext_flags flag EXT_FLAG_EMBREF is used. The first mbuf to attach a cluster stores the refcount. The further mbufs to reference the cluster point at refcount in the first mbuf. The first mbuf is freed only when the last reference is freed.
The benefit over refcounts stored in separate slabs is that now refcounts of different, unrelated mbufs do not share a cache line.
For EXT_EXTREF mbufs the zone_ext_refcnt is no longer needed, and m_extadd() becomes void, making widely used M_EXTADD macro safe.
For EXT_SFBUF mbufs the sf_ext_ref() is removed, which was an optimization exactly against the cache aliasing problem with regular refcounting.
Discussed with: rrs, rwatson, gnn, hiren, sbruno, np Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D5396 Sponsored by: Netflix
|
#
295547 |
|
11-Feb-2016 |
glebius |
o Gather all mbuf(9) allocation functions into kern_mbuf.c, and all mbuf(9) manipulation functions into uipc_mbuf.c. This looks like the initial intent, but had diffused in the last decade.
o Gather all declarations in mbuf.h in one place and sort them.
o Uninline m_clget() and m_cljget().
There are no functional changes in this patch.
The patch comes from a larger version, where all mbuf(9) allocation was uninlined, which allowed to make mbuf(9) UMA zones private to kern_mbuf.c. The performance impact of the total uninlining is still unclear, so we are holding on now with larger version.
Together with: melifaro, olivier
|
#
295482 |
|
10-Feb-2016 |
glebius |
Garbage collect unused arguments of m_init().
|
#
295481 |
|
10-Feb-2016 |
glebius |
Garbage collect m_getclr().
|
#
293439 |
|
08-Jan-2016 |
glebius |
New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and up to now.
The new sendfile is the code that Netflix uses to send their multiple tens of gigabits of data per second. The new implementation features asynchronous I/O, when I/O operations are launched, but not awaited to be complete. An explanation of why such behavior is beneficial compared to old one is going to be too long for a commit message, so we will skip it here.
Additional features of new syscall are extra flags, which provide an application more control over data sent. The SF_NOCACHE flag tells kernel that data shouldn't be cached after it was sent. The SF_READAHEAD() macro allows to specify readahead size in pages.
The new syscalls is a drop in replacement. No modifications are required to applications. One can take nginx binary for stable/10 and run it successfully on head. Although SF_NODISKIO lost its original sense, as now sendfile doesn't block, and now means something completely different (tm), using the new sendfile the old way is absolutely safe.
Celebrates: Netflix global launch! Sponsored by: Nginx, Inc. Sponsored by: Netflix Relnotes: yes
|
#
289492 |
|
18-Oct-2015 |
jmg |
page sized is not spelled 4096 on all arches...
|
#
289276 |
|
13-Oct-2015 |
hiren |
There are times when it would be really nice to have a record of the last few packets and/or state transitions from each TCP socket. That would help with narrowing down certain problems we see in the field that are hard to reproduce without understanding the history of how we got into a certain state. This change provides just that.
It saves copies of the last N packets in a list in the tcpcb. When the tcpcb is destroyed, the list is freed. I thought this was likely to be more performance-friendly than saving copies of the tcpcb. Plus, with the packets, you should be able to reverse-engineer what happened to the tcpcb.
To enable the feature, you will need to compile a kernel with the TCPPCAP option. Even then, the feature defaults to being deactivated. You can activate it by setting a positive value for the number of captured packets. You can do that on either a global basis or on a per-socket basis (via a setsockopt call).
There is no way to get the packets out of the kernel other than using kmem or getting a coredump. I thought that would help some of the legal/privacy concerns regarding such a feature. However, it should be possible to add a future effort to export them in PCAP format.
I tested this at low scale, and found that there were no mbuf leaks and the peak mbuf usage appeared to be unchanged with and without the feature.
The main performance concern I can envision is the number of mbufs that would be used on systems with a large number of sockets. If you save five packets per direction per socket and have 3,000 sockets, that will consume at least 30,000 mbufs just to keep these packets. I tried to reduce the concerns associated with this by limiting the number of clusters (not mbufs) that could be used for this feature. Again, in my testing, that appears to work correctly.
Differential Revision: D3100 Submitted by: Jonathan Looney <jlooney at juniper dot net> Reviewed by: gnn, hiren
|
#
286450 |
|
08-Aug-2015 |
melifaro |
Add const-qualifiers for source mbuf argument in m_dup(), m_copym(), m_dup_pkthdr() and m_tag_copy_chain().
|
#
286027 |
|
29-Jul-2015 |
pkelsey |
Revert r265338, r271089 and r271123 as those changes do not handle non-inline urgent data and introduce an mbuf exhaustion attack vector similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs.
Address the issue described in FreeBSD-SA-15:15.tcp.
Reviewed by: glebius Approved by: so Approved by: jmallett (mentor) Security: FreeBSD-SA-15:15.tcp Sponsored by: Norse Corp, Inc.
|
#
284961 |
|
30-Jun-2015 |
np |
Fix leak in tcp_lro_rx. Simply clearing M_PKTHDR isn't enough, any tags hanging off the header need to be freed too.
Differential Revision: https://reviews.freebsd.org/D2708 Reviewed by: ae@, hiren@
|
#
281844 |
|
21-Apr-2015 |
rodrigc |
Quiet compiler warnings in mbuf.h
* Mark unused arguments with __unused * Move inline before the return type (and use __inline to keep the file consistent in style.)
Submitted by: Steve Kiernan <stevek@juniper.net> Obtained from: Juniper Networks, Inc.
|
#
281142 |
|
06-Apr-2015 |
glebius |
Convert printfs in m_ext allocator to KASSERTs.
Discussed with: rwatson Sponsored by: Nginx, Inc.
|
#
280222 |
|
18-Mar-2015 |
jhb |
Clear an mbuf's external storage flags in m_extaddref(). They are cleared in other places that set the external storage type (ext_type) such as m_cljset(), m_extadd(), mb_ctor_clust(), and vn_sendfile().
Differential Revision: https://reviews.freebsd.org/D2080 Reviewed by: np, glebius MFC after: 2 weeks
|
#
279891 |
|
11-Mar-2015 |
hselasky |
Factor out mbuf hashing code from LAGG driver so that other network drivers can use it. This avoids some code duplication. Add missing default case to all switch statements while at it. Also move the hashing of the IPv6 flow field to layer 4 because the IPv6 flow field is constant on a per L4 connection basis and not on a per L3 network.
Differential Revision: https://reviews.freebsd.org/D1987 Sponsored by: Mellanox Technologies MFC after: 1 month
|
#
279213 |
|
23-Feb-2015 |
glebius |
A lot of current code in network stack expects mbufs not having m_nextpkt pointer, assuming that if there is one, then this is a packet batch. Thus, mbufq_dequeue() needs to clear it on mbuf that is being returned.
|
#
278987 |
|
19-Feb-2015 |
glebius |
Widen _KERNEL ifdef to hide more kernel network stack structures from userland.
|
#
278977 |
|
18-Feb-2015 |
glebius |
Provide a set of inline functions to manage simple mbuf(9) queues, based on queue(3)'s STAILQ. Utilize them in cxgb(4) and Xen, deleting home grown implementations.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
#
278920 |
|
17-Feb-2015 |
glebius |
Use anonymous unions and structs to organize shared space in mbuf(9), instead of preprocessor macros. This will make debugger output of 'print *m' exactly match the names we use in code, making life of a kernel hacker way more pleasant. And this also allows to rename struct_m_ext back to m_ext.
|
#
278914 |
|
17-Feb-2015 |
glebius |
Use anonymous unions to add possibility to put mbufs into queue(3) STAILQs and SLISTs using the same structure field as good old m_next and m_nextpkt linkage occupy.
New code is encouraged to use queue(3) macros, instead of implementing the wheel. However, better not to have a mixture of old style and queue(3) in one file or subsystem.
Reviewed by: rwatson, rrs, rpaulo Differential Revision: D1499
|
#
277203 |
|
14-Jan-2015 |
rwatson |
In order to support ongoing work to implement variable-size mbufs, and more generally make it easier to extend 'struct mbuf in the future', make a number of changes to the data structure:
- As we anticipate embedding mbufs headers within variable-size regions of memory in the future, change the definitions of byte arrays embedded in mbufs to be of size [0] rather than [MLEN] and [MHLEN]. In fact, the cxgbe driver already uses 'struct mbuf' on the front of other storage sizes, but we would like the global mbuf allocator do be able to do this as well.
- Fold 'struct m_hdr' into 'struct mbuf' itself, eliminating a set of macros that aliased 'mh_foo' field names to 'm_foo' names such as 'm_next'. These present a particular problem as we would like to add new mbuf-header fields -- e.g., 'm_size' -- that, if similarly named via macros, would introduce collisions with many other variable names in the kernel.
- Rename 'struct m_ext' to 'struct struct_m_ext' so that we can add compile-time assertions without bumping into the still-extant 'm_ext' macro.
- Remove the MSIZE compile-time assertion for 'struct mbuf', but add new assertions for alignment of embedded data arrays (64-bit alignment even on 32-bit platforms), and for the sizes the mbuf header, packet header, and m_ext structure.
- Document that these assertions exist in comments in mbuf.h.
This change is not intended to cause (non-trivial) behavioural differences, but is a precursor to further mbuf-allocator work.
Differential Revision: https://reviews.freebsd.org/D1483 Reviewed by: bz, gnn, np, glebius ("go ahead, I trust you") Sponsored by: EMC / Isilon Storage Division
|
#
276982 |
|
11-Jan-2015 |
hselasky |
Remove no longer used "M_FLOWID" flag and update the netisr manpage. This patch completes process started by r275358.
Sponsored by: Mellanox Technologies
|
#
276910 |
|
10-Jan-2015 |
rwatson |
Garbage collect m_copymdata(), an mbuf utility routine introduced in FreeBSD 7 that has not been used since. It contains a number of unresolved bugs including an inverted bcopy() and incorrect handling of read-only mbufs using internal storage. Removing this unused code is substantially essier than fixing it in order to update it to the coming mbuf world order -- but it can always be restored from revision history if it turns out to prove useful for future work.
Pointed out by: jmallett Sponsored by: EMC / Isilon Storage Division
|
#
276888 |
|
09-Jan-2015 |
rwatson |
Uninline M_SIZE() in m_align() to reduce direct use of MLEN and MHLEN.
Differential Revision: https://reviews.freebsd.org/D1471 Reviewed by: glebius, bz, rpaulo Sponsored by: EMC / Isilon Storage Division
|
#
276750 |
|
06-Jan-2015 |
rwatson |
In order to reduce use of M_EXT outside of the mbuf allocator and socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value.
With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations.
NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature.
Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division
|
#
276694 |
|
05-Jan-2015 |
bz |
With r276692 m_align() moved and became an inline function. Remove the (now) redundant function declaration.
|
#
276692 |
|
05-Jan-2015 |
rwatson |
To ease changes to underlying mbuf structure and the mbuf allocator, reduce the knowledge of mbuf layout, and in particular constants such as M_EXT, MLEN, MHLEN, and so on, in mbuf consumers by unifying various alignment utility functions (M_ALIGN(), MH_ALIGN(), MEXT_ALIGN() in a single M_ALIGN() macro, implemented by a now-inlined m_align() function:
- Move m_align() from uipc_mbuf.c to mbuf.h; mark as __inline. - Reimplement M_ALIGN(), MH_ALIGN(), and MEXT_ALIGN() using m_align(). - Update consumers around the tree to simply use M_ALIGN().
This change eliminates a number of cases where mbuf consumers must be aware of whether or not mbufs returned by the allocator use external storage, but also assumptions about the size of the returned mbuf. This will make it easier to introduce changes in how we use external storage, as well as features such as variable-size mbufs.
Differential Revision: https://reviews.freebsd.org/D1436 Reviewed by: glebius, trasz, gnn, bz Sponsored by: EMC / Isilon Storage Division
|
#
276136 |
|
23-Dec-2014 |
glebius |
m_clrprotoflags() is designed to cleanup M_PROTO flags when mbufs cross protocol and facility boundaries. However, now it cleans up only the first mbuf, while intent clearly means all mbufs in a possible chain.
Differential Revision: https://reviews.freebsd.org/D1352 Reviewed by: rpaulo, gnn, adrian Sponsored by: Nginx, Inc.
|
#
275329 |
|
30-Nov-2014 |
glebius |
Merge from projects/sendfile: extend protocols API to support sending not ready data: o Add new flag to pru_send() flags - PRUS_NOTREADY. o Add new protocol method pru_ready().
Sponsored by: Nginx, Inc. Sponsored by: Netflix
|
#
273741 |
|
27-Oct-2014 |
glebius |
Tiny comment fixup.
|
#
272796 |
|
09-Oct-2014 |
bryanv |
Add M_FLOWID to M_COPYFLAGS
The M_FLOWID flag should be propagated to the new mbuf pkthdr in m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the existing flowid value, but would be ignored since the flag was not set.
Phabricator: https://reviews.freebsd.org/D914 Reviewed by: adrian Obtained from: NetApp MFC after: 1 week
|
#
271420 |
|
11-Sep-2014 |
rwatson |
Add new a M_START() mbuf macro that returns a pointer to the start of an mbuf's storage (internal or external).
Add a new M_SIZE() mbuf macro that returns the size of an mbuf's storage (internal or external).
These contrast with m_data and m_len, which are with respect to data in the buffer, rather than the buffer itself.
Rewrite M_LEADINGSPACE() and M_TRAILINGSPACE() in terms of M_START() and M_SIZE().
This is done as we currently have many instances of using mbuf flags to generate pointers or lengths for internal storage in header and regular mbufs, as well as to external storage. Rather than replicate this logic throughout the network stack, centralising the implementation will make it easier for us to refine mbuf storage. This should also help reduce bugs by limiting the amount of mbuf-type-specific pointer arithmetic. Followup changes will propagate use of the macros throughout the stack.
M_SIZE() conflicts with one macro in the Chelsio driver; rename that macro in a slightly unsatisfying way to eliminate the collision.
MFC after: 3 days Obtained from: jeff (with enhancements) Sponsored by: EMC / Isilon Storage Division Reviewed by: bz, glebius, np Differential Revision: https://reviews.freebsd.org/D753
|
#
271174 |
|
05-Sep-2014 |
rwatson |
Clarify a diagnostic printf() in the mbuf code: M_EXT doesn't necessarily imply a cluster is attached; it could also refer to some other sort of external storage (e.g., an sf_buf).
MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
|
#
271088 |
|
04-Sep-2014 |
glebius |
Provide m_catpkt(), a wrapper around m_cat() that deals with M_PKTHDR mbufs.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
#
271006 |
|
03-Sep-2014 |
glebius |
Clean up unused CSUM_FRAGMENT.
Sponsored by: Nginx, Inc.
|
#
268825 |
|
17-Jul-2014 |
kevlo |
Remove deprecated definition "m_act".
Suggested by: adrian, glebius
|
#
268558 |
|
12-Jul-2014 |
adrian |
Add some hash types for UDP RSS for both IPv4 and IPv6.
Nothing is yet using this but I'd like to reserve these values.
|
#
268535 |
|
11-Jul-2014 |
glebius |
Improve reference counting of EXT_SFBUF pages attached to mbufs.
o Do not use UMA refcount zone. The problem with this zone is that several refcounting words (16 on amd64) share the same cache line, and issueing atomic(9) updates on them creates cache line contention. Also, allocating and freeing them is extra CPU cycles. Instead, refcount the page directly via vm_page_wire() and the sfbuf via sf_buf_alloc(sf_buf_page(sf)) [1].
o Call refcounting/freeing function for EXT_SFBUF via direct function call, instead of function pointer. This removes barrier for CPU branch predictor.
o Do not cleanup the mbuf to be freed in mb_free_ext(), merely to satisfy assertion in mb_dtor_mbuf(). Remove the assertion from mb_dtor_mbuf(). Use bcopy() instead of manual assignments to copy m_ext in mb_dupcl().
[1] This has some problems for now. Using sf_buf_alloc() merely to increase refcount is expensive, and is broken on sparc64. To be fixed.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
#
268530 |
|
11-Jul-2014 |
glebius |
Fix style bug: rename the refcount field of m_ext to ext_cnt, to match other members.
Sponsored by: Nginx, Inc.
|
#
268529 |
|
11-Jul-2014 |
glebius |
All mbuf external free functions never fail, so let them be void.
Sponsored by: Nginx, Inc.
|
#
265338 |
|
04-May-2014 |
glebius |
The FreeBSD-SA-14:08.tcp was a lesson on not doing acrobatics with mixing on stack memory and UMA memory in one linked list.
Thus, rewrite TCP reassembly code in terms of memory usage. The algorithm remains unchanged.
We actually do not need extra memory to build a reassembly queue. Arriving mbufs are always packet header mbufs. So we got the length of data as pkthdr.len. We got m_nextpkt for linkage. And we need only one pointer to point at the tcphdr, use PH_loc for that.
In tcpcb the t_segq fields becomes mbuf pointer. The t_segqlen field now counts not packets, but bytes in the queue. This gives us more precision when comparing to socket buffer limits.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
#
261804 |
|
12-Feb-2014 |
np |
Provide additional information in some panic strings.
MFC after: 1 week
|
#
261733 |
|
11-Feb-2014 |
marcel |
Fix spelling of eight (was spelled eigth) in struct pkthdr.
|
#
260719 |
|
16-Jan-2014 |
glebius |
Simplify wait/nowait code, eventually killing last remnant of historical mbuf(9) allocator flag.
Sponsored by: Nginx, Inc.
|
#
255047 |
|
29-Aug-2013 |
np |
Add a routine for attaching an mbuf to a buffer with an external refcount. This one is willing to work with buffers that may already be referenced. MEXTADD/m_extadd are suitable only for the first attachment to a cluster -- they initialize the refcount to 1.
|
#
255016 |
|
29-Aug-2013 |
np |
Merge r254736 from user/np/cxl_tuning.
Don't leak tags when M_NOFREE | M_PKTHDR mbufs are freed.
Reviewed by: andre
|
#
254973 |
|
27-Aug-2013 |
andre |
Pad m_hdr on 32bit architectures to to prevent alignment and padding problems with the way MLEN, MHLEN, and struct mbuf are set up.
CTASSERT's are provided to detect such issues at compile time in the future.
The #define MLEN and MHLEN calculation do not take actual compiler- induced alignment and padding inside the complete struct mbuf into account. Accordingly appropriate attention is required when changing members of struct mbuf.
Ideally one would calculate MLEN as (MSIZE - sizeof(((struct mbuf *)0)->m_hdr) but that doesn't work as the compiler refuses to operate on an as of yet incomplete structure.
In particular ARM 32bit has more strict alignment requirements which caused 4 bytes of padding between m_hdr and pkthdr in struct mbuf because of the 64bit members in pkthdr. This wasn't picked up by MLEN and MHLEN causing an overflow of the mbuf provided data storage by overestimating its size.
I386 didn't show this problem because it handles unaligned access just fine, albeit at a small performance penalty.
On 64bit architectures the struct mbuf layout is 64bit aligned in all places.
Reported by: Thomas Skibo <ThomasSkibo-at-sbcglobal-dot-net> Tested by: tuexen, ian, Thomas Skibo (extended patch) Sponsored by: The FreeBSD Foundation
|
#
254857 |
|
25-Aug-2013 |
andre |
Fix CSUM compatibility mapping. SCTP is a layer 4 protocol.
Submitted by: tuexen
|
#
254842 |
|
25-Aug-2013 |
andre |
Give (*ext_free) an int return value allowing for very sophisticated external mbuf buffer management capabilities in the future.
For now only EXT_FREE_OK is defined with current legacy behavior.
Sponsored by: The FreeBSD Foundation
|
#
254812 |
|
24-Aug-2013 |
andre |
Remove unused m_free_fast(). The difference to m_free() is only 2 predictable branches nowadays. However as a pre-condition the caller had to ensure that the mbuf pkthdr did not have any mtags attached to it, costing some potential branches again.
Sponsored by: The FreeBSD Foundation
|
#
254807 |
|
24-Aug-2013 |
andre |
Compact m_hdr by packing the type and flags fields into one uint32_t.
The mbuf type is an enumerator with only a handful of types in use and thus reduced from int to 8bits allowing for 255 types to be specified. Only 5 types have been in use for a long time.
The flags field gets the remaining 24 bits with 12 bits for global persistent flags and 12 bits for protocol/layer specific overlays. Some of the global flags/functionality can be moved to the csum_flags or ext_flags bits in the future.
MT_VENDOR[1-4] and MT_EXP[1-4] types for vendor-internal and experimental local mapping are added.
The size of m_hdr shrinks from 24/40 to 20/32bytes (32/64bit architectures).
Sponsored by: The FreeBSD Foundation
|
#
254805 |
|
24-Aug-2013 |
andre |
Add mtodo(m, o) macro taking an additional offset into the mbuf data section.
Sponsored by: The FreeBSD Foundation
|
#
254804 |
|
24-Aug-2013 |
andre |
Restructure the mbuf pkthdr to make it fit for upcoming capabilities and features. The changes in particular are:
o Remove rarely used "header" pointer and replace it with a 64bit protocol/ layer specific union PH_loc for local use. Protocols can flexibly overlay their own 8 to 64 bit fields to store information while the packet is worked on.
o Mechanically convert IP reassembly, IGMP/MLD and ATM to use pkthdr.PH_loc instead of pkthdr.header.
o Extend csum_flags to 64bits to allow for additional future offload information to be carried (e.g. iSCSI, IPsec offload, and others).
o Move the RSS hash type enumerator from abusing m_flags to its own 8bit rsstype field. Adjust accessor macros.
o Add cosqos field to store Class of Service / Quality of Service information with the packet. It is not yet supported in any drivers but allows us to get on par with Cisco/Juniper in routing applications (plus MPLS QoS) with a modernized ALTQ.
o Add four 8 bit fields l[2-5]hlen to store the relative header offsets from the start of the packet. This is important for various offload capabilities and to relieve the drivers from having to parse the packet and protocol headers to find out location of checksums and other information. Header parsing in drivers is a lot of copy-paste and unhandled corner cases which we want to avoid.
o Add another flexible 64bit union to map various additional persistent packet information, like ether_vtag, tso_segsz and csum fields. Depending on the csum_flags settings some fields may have different usage making it very flexible and adaptable to future capabilities.
o Restructure the CSUM flags to better signify their outbound (down the stack) and inbound (up the stack) use. The CSUM flags used to be a bit chaotic and rather poorly documented leading to incorrect use in many places. Bring clarity into their use through better naming. Compatibility mappings are provided to preserve the API. The drivers can be corrected one by one and MFC'd without issue.
o The size of pkthdr stays the same at 48/56bytes (32/64bit architectures).
Sponsored by: The FreeBSD Foundation
|
#
254799 |
|
24-Aug-2013 |
andre |
Add an mbuf pointer parameter to (*ext_free) to give the external free function access to the mbuf the external memory was attached to.
Mechanically adjust all users to include the mbuf parameter.
This fixes a long standing annoyance for external free functions. Before one had to sacrifice one of the argument pointers for this.
Sponsored by: The FreeBSD Foundation
|
#
254780 |
|
24-Aug-2013 |
andre |
dd a 24 bits wide ext_flags field to m_ext by reducing ext_type to 8 bits. ext_type is an enumerator and the number of types we have is a mere dozen.
A couple of ext_types are renumbered to fit within 8 bits.
EXT_VENDOR[1-4] and EXT_EXP[1-4] types for vendor-internal and experimental local mapping.
The ext_flags field is currently unused but has a couple of flags already defined for future use. Again vendor and experimental flags are provided for local mapping.
EXT_FLAG_BITS is provided for the printf(9) %b identifier.
Initialize and copy ext_flags in the relevant mbuf functions.
Improve alignment and packing of struct m_ext on 32 and 64 archs by carefully sorting the fields.
|
#
254605 |
|
21-Aug-2013 |
andre |
Revert r254520 and resurrect the M_NOFREE mbuf flag and functionality.
Requested by: np, grehan
|
#
254527 |
|
19-Aug-2013 |
andre |
Reorder the mbuf defines to make more sense and group related flags together.
Add M_FLAG_PRINTF for use with printf(9) %b indentifier.
Use the generic mbuf flags print names in the net80211 code and adjust the protocol specific bits for their new positions.
Change SCTP M_PROTO mapping from 5 to 1 to fit within the 16bit field they use internally to store some additional information.
Discussed with: trociny, glebius
|
#
254526 |
|
19-Aug-2013 |
andre |
Migrate the net80211 protocol specific use of M_FRAG, M_FIRSTFRAG and M_LASTFRAG flags to protocol specific flags.
Remove the now unused M_FRAG, M_FIRSTFRAG and M_LASTFRAG mbuf flags.
Discussed with: trociny, glebius, adrian
|
#
254524 |
|
19-Aug-2013 |
andre |
Add four additional M_PROTOFLAGS[9-12] for protocol specific use.
Discussed with: trociny, glebius, adrian
|
#
254523 |
|
19-Aug-2013 |
andre |
Add m_clrprotoflags() to clear protocol specific mbuf flags at up and downwards layer crossings.
Consistently use it within IP, IPv6 and ethernet protocols.
Discussed with: trociny, glebius
|
#
254521 |
|
19-Aug-2013 |
andre |
Move the SCTP specific definition of M_NOTIFICATION onto a protocol specific mbuf flag from sys/mbuf.h to netinet/sctp_os_bsd.h. It is only relevant within SCTP.
Discussed with: tuexen
|
#
254520 |
|
19-Aug-2013 |
andre |
Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree users for a very long time, if ever.
Should such a functionality ever be needed again the appropriate and much better way to do it is through a custom EXT_SOMETHING external mbuf type together with a dedicated *ext_free function.
Discussed with: trociny, glebius
|
#
254519 |
|
19-Aug-2013 |
andre |
Move the global M_SKIP_FIREWALL mbuf flags to a protocol layer specific flag instead. The flag is only used within the IP and IPv6 layer 3 protocols.
Because some firewall packages treat IPv4 and IPv6 packets the same the flag should have the same value for both.
Discussed with: trociny, glebius
|
#
253361 |
|
15-Jul-2013 |
glebius |
Nuke mbstat. It wasn't used for mbuf statistics since FreeBSD 5.
Now that r253351 moved sendfile() stats to a separate struct, the last field used in mbstat is m_mcfail, which is updated, but never read or obtained from userland.
|
#
253351 |
|
15-Jul-2013 |
ae |
Introduce new structure sfstat for collecting sendfile's statistics and remove corresponding fields from struct mbstat. Use PCPU counters and SFSTAT_INC() macro for update these statistics.
Discussed with: glebius
|
#
250829 |
|
20-May-2013 |
julian |
Remove accidentally included line.. No effect as it wasn't used but was a) wrong b) clutter
|
#
250720 |
|
16-May-2013 |
julian |
Fix cut-n-paste error.
|
#
250700 |
|
16-May-2013 |
julian |
Finally change the mbuf to have its own fib field instead of stealing 4 flag bits. This was supposed to happen in 8.0, and again in 2012..
MFC after: never
|
#
248417 |
|
17-Mar-2013 |
glebius |
Add MEXT_ALIGN() macro, similar to M_ALIGN() and MH_ALIGN(), but for mbufs with external buffer.
|
#
248207 |
|
12-Mar-2013 |
glebius |
Functions m_getm2() and m_get2() have different order of arguments, and that can drive someone crazy. While m_get2() is young and not documented yet, change its order of arguments to match m_getm2().
Sorry for churn, but better now than later.
|
#
248193 |
|
12-Mar-2013 |
glebius |
The m_extadd() can fail due to memory allocation failure, thus: - Make it return int, not void. - Add wait parameter. - Update MEXTADD() macro appropriately, defaults to M_NOWAIT, as before this change.
Sponsored by: Nginx, Inc.
|
#
245905 |
|
25-Jan-2013 |
glebius |
In mbuf(9) API length is always integer. Thus, cast mbuf length constants to be integers.
Reviewed by: bde
|
#
245873 |
|
24-Jan-2013 |
glebius |
- Move large functions m_getjcl() and m_get2() to kern/uipc_mbuf.c - style(9) fixes to mbuf.h
Reviewed by: bde
|
#
245575 |
|
17-Jan-2013 |
andre |
Move the mbuf memory limit calculations from init_param2() to tunable_mbinit() where it is next to where it is used later.
Change the sysinit level of tunable_mbinit() from SI_SUB_TUNABLES to SI_SUB_KMEM after the VM is running. This allows to use better methods to determine the effectively available physical and virtual memory available to the kernel.
Update comments.
In a second step it can be merged into mbuf_init().
|
#
245223 |
|
09-Jan-2013 |
hselasky |
Change function argument type instead of casting.
Suggested by: glebius @
|
#
245222 |
|
09-Jan-2013 |
hselasky |
Fix compile warning when using GCC: Comparison between signed and unsigned.
MFC after: 1 week
|
#
243882 |
|
05-Dec-2012 |
glebius |
Mechanically substitute flags from historic mbuf allocator with malloc(9) flags within sys.
Exceptions:
- sys/contrib not touched - sys/mbuf.h edited manually
|
#
243668 |
|
29-Nov-2012 |
andre |
Using a long is the wrong type to represent the realmem and maxmbufmem variable as they may overflow on i386/PAE and i386 with > 2GB RAM.
Use 64bit quad_t instead. It has broader kernel infrastructure support with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types.
Pointed out by: alc, bde
|
#
243631 |
|
27-Nov-2012 |
andre |
Base the mbuf related limits on the available physical memory or kernel memory, whichever is lower. The overall mbuf related memory limit must be set so that mbufs (and clusters of various sizes) can't exhaust physical RAM or KVM.
The limit is set to half of the physical RAM or KVM (whichever is lower) as the baseline. In any normal scenario we want to leave at least half of the physmem/kvm for other kernel functions and userspace to prevent it from swapping too easily. Via a tunable kern.maxmbufmem the limit can be upped to at most 3/4 of physmem/kvm.
At the same time divorce maxfiles from maxusers and set maxfiles to physpages / 8 with a floor based on maxusers. This way busy servers can make use of the significantly increased mbuf limits with a much larger number of open sockets.
Tidy up ordering in init_param2() and check up on some users of those values calculated here.
Out of the overall mbuf memory limit 2K clusters and 4K (page size) clusters to get 1/4 each because these are the most heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet inbound packets. 4K clusters are used whenever possible for sends on sockets and thus outbound packets. The larger cluster sizes of 9K and 16K are limited to 1/6 of the overall mbuf memory limit. When jumbo MTU's are used these large clusters will end up only on the inbound path. They are not used on outbound, there it's still 4K. Yes, that will stay that way because otherwise we run into lots of complications in the stack. And it really isn't a problem, so don't make a scene.
Normal mbufs (256B) weren't limited at all previously. This was problematic as there are certain places in the kernel that on allocation failure of clusters try to piece together their packet from smaller mbufs.
The mbuf limit is the number of all other mbuf sizes together plus some more to allow for standalone mbufs (ACK for example) and to send off a copy of a cluster. Unfortunately there isn't a way to set an overall limit for all mbuf memory together as UMA doesn't support such a limiting.
NB: Every cluster also has an mbuf associated with it.
Two examples on the revised mbuf sizing limits:
1GB KVM: 512MB limit for mbufs 419,430 mbufs 65,536 2K mbuf clusters 32,768 4K mbuf clusters 9,709 9K mbuf clusters 5,461 16K mbuf clusters
16GB RAM: 8GB limit for mbufs 33,554,432 mbufs 1,048,576 2K mbuf clusters 524,288 4K mbuf clusters 155,344 9K mbuf clusters 87,381 16K mbuf clusters
These defaults should be sufficient for even the most demanding network loads.
MFC after: 1 month
|
#
243628 |
|
27-Nov-2012 |
andre |
Update comment to prefer M_NOWAIT over M_DONTWAIT and M_WAITOK over M_WAIT.
MFC after: 1 week
|
#
243624 |
|
27-Nov-2012 |
andre |
Remove unused and unnecessary CSUM_IP_FRAGS checksumming capability. Checksumming the IP header of fragments is no different from doing normal IP headers.
Discussed with: yongari MFC after: 1 week
|
#
240233 |
|
08-Sep-2012 |
glebius |
Merge the projects/pf/head branch, that was worked on for last six months, into head. The most significant achievements in the new code:
o Fine grained locking, thus much better performance. o Fixes to many problems in pf, that were specific to FreeBSD port.
New code doesn't have that many ifdefs and much less OpenBSDisms, thus is more attractive to our developers.
Those interested in details, can browse through SVN log of the projects/pf/head branch. And for reference, here is exact list of revisions merged:
r232043, r232044, r232062, r232148, r232149, r232150, r232298, r232330, r232332, r232340, r232386, r232390, r232391, r232605, r232655, r232656, r232661, r232662, r232663, r232664, r232673, r232691, r233309, r233782, r233829, r233830, r233834, r233835, r233836, r233865, r233866, r233868, r233873, r234056, r234096, r234100, r234108, r234175, r234187, r234223, r234271, r234272, r234282, r234307, r234309, r234382, r234384, r234456, r234486, r234606, r234640, r234641, r234642, r234644, r234651, r235505, r235506, r235535, r235605, r235606, r235826, r235991, r235993, r236168, r236173, r236179, r236180, r236181, r236186, r236223, r236227, r236230, r236252, r236254, r236298, r236299, r236300, r236301, r236397, r236398, r236399, r236499, r236512, r236513, r236525, r236526, r236545, r236548, r236553, r236554, r236556, r236557, r236561, r236570, r236630, r236672, r236673, r236679, r236706, r236710, r236718, r237154, r237155, r237169, r237314, r237363, r237364, r237368, r237369, r237376, r237440, r237442, r237751, r237783, r237784, r237785, r237788, r237791, r238421, r238522, r238523, r238524, r238525, r239173, r239186, r239644, r239652, r239661, r239773, r240125, r240130, r240131, r240136, r240186, r240196, r240212.
I'd like to thank people who participated in early testing:
Tested by: Florian Smeets <flo freebsd.org> Tested by: Chekaluk Vitaly <artemrts ukr.net> Tested by: Ben Wilber <ben desync.com> Tested by: Ian FREISLICH <ianf cloudseed.co.za>
|
#
236332 |
|
30-May-2012 |
tuexen |
Seperate SCTP checksum offloading for IPv4 and IPv6. While there: remove some trainling whitespaces.
MFC after: 3 days X-MFC with: 236170
|
#
236170 |
|
28-May-2012 |
bz |
It turns out that too many drivers are not only parsing the L2/3/4 headers for TSO but also for generic checksum offloading. Ideally we would only have one common function shared amongst all drivers, and perhaps when updating them for IPv6 we should introduce that. Eventually we should provide the meta information along with mbufs to avoid (re-)parsing entirely.
To not break IPv6 (checksums and offload) and to be able to MFC the changes without risking to hurt 3rd party drivers, duplicate the v4 framework, as other OSes have done as well.
Introduce interface capability flags for TX/RX checksum offload with IPv6, to allow independent toggling (where possible). Add CSUM_*_IPV6 flags for UDP/TCP over IPv6, and reserve further for SCTP, and IPv6 fragmentation. Define CSUM_DELAY_DATA_IPV6 as we do for legacy IP and add an alias for CSUM_DATA_VALID_IPV6.
This pretty much brings IPv6 handling in line with IPv4. TSO is still handled in a different way and not via if_hwassist.
Update ifconfig to allow (un)setting of the new capability flags. Update loopback to announce the new capabilities and if_hwassist flags.
Individual driver updates will have to follow, as will SCTP.
Reported by: gallatin, dim, .. Reviewed by: gallatin (glanced at?) MFC after: 3 days X-MFC with: r235961,235959,235958
|
#
230264 |
|
17-Jan-2012 |
glebius |
Provide a function m_get2() that allocates a minimal mbuf that would fit specified size. Returned mbuf may be a single mbuf, an mbuf with a cluster from packet zone, or an mbuf with jumbo cluster of sufficient size.
|
#
230215 |
|
16-Jan-2012 |
glebius |
Make panic strings in m_gettype(), m_getzone(), m_cljset() consistent.
|
#
230210 |
|
16-Jan-2012 |
glebius |
m_getzone() should return only cluster zones.
|
#
223637 |
|
28-Jun-2011 |
bz |
Update packet filter (pf) code to OpenBSD 4.5.
You need to update userland (world and ports) tools to be in sync with the kernel.
Submitted by: mlaier Submitted by: eri
|
#
222709 |
|
05-Jun-2011 |
rwatson |
Correct a last minute merge error for new M_HASHTYPE macros. This didn't turn up as a build problem because the macros aren't used (yet).
MFC after: 3 days Sponsored by: Juniper Networks, Inc.
|
#
222702 |
|
04-Jun-2011 |
rwatson |
Allocate four bits from the mbuf flags field to represent the hash type of a software- or hardware-generated hash held in the mbuf.m_pkthdr.flowid field, and provide accessor macros to easily clear, set, receive, and test for hash values. Some of these constants correspond to RSS hash types, but we don't want to limit ourselves to that, as a number of other hashing techniques are in use on hardware supported by FreeBSD.
Mark the M_FLOWID flag as deprecated; I hope to remove this before 9.0, changing drivers and the stack over to using the new M_HASHTYPEBITS, most likely to use M_HASHTYPE_OPAQUE as we don't yet want to nail down the KPI for RSS key/bucket management for device drivers.
MFC after: 3 days Reviewed by: bz Sponsored by: Juniper Networks, Inc.
|
#
211501 |
|
19-Aug-2010 |
anchie |
MFp4: anchie_soc2009 branch:
Add kernel side support for Secure Neighbor Discovery (SeND), RFC 3971.
The implementation consists of a kernel module that gets packets from the nd6 code, sends them to user space on a dedicated socket and reinjects them back for further processing.
Hooks are used from nd6 code paths to divert relevant packets to the send implementation for processing in user space. The hooks are only triggered if the send module is loaded. In case no user space application is connected to the send socket, processing continues normaly as if the module would not be loaded. Unloading the module is not possible at this time due to missing nd6 locking.
The native SeND socket is similar to a raw IPv6 socket but with its own, internal pseudo-protocol.
Approved by: bz (mentor)
|
#
210226 |
|
18-Jul-2010 |
trasz |
Revert r210225 - turns out I was wrong; the "/*-" is not license-only thing; it's also used to indicate that the comment should not be automatically rewrapped.
Explained by: cperciva@
|
#
210225 |
|
18-Jul-2010 |
trasz |
The "/*-" comment marker is supposed to denote copyrights. Remove non-copyright occurences from sys/sys/ and sys/kern/.
|
#
207761 |
|
07-May-2010 |
fabient |
Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge.
MFC after: 1 week
|
#
194667 |
|
22-Jun-2009 |
andre |
Add m_mbuftouio() helper function to copy(out) an arbitrary long mbuf chain into an arbitrary large uio in a single step. It is a functional mirror image of m_uiotombuf().
This function is supposed to be used instead of hand rolled code with the same purpose and to concentrate it into one place for potential further optimization or hardware assistance.
|
#
194549 |
|
20-Jun-2009 |
rwatson |
Remove definition of dtom(), which converted a data pointer into a pointer to the containing mbuf. This eliminates a strong assumption about the layout of network buffer memory, giving us greater flexibility to revise mbuf semantics in the future.
|
#
194515 |
|
19-Jun-2009 |
kmacy |
define helper routines for deferred mbuf initialization
|
#
194062 |
|
12-Jun-2009 |
vanhu |
Added support for NAT-Traversal (RFC 3948) in IPsec stack.
Thanks to (no special order) Emmanuel Dreyfus (manu@netbsd.org), Larry Baird (lab@gta.com), gnn, bz, and other FreeBSD devs, Julien Vanherzeele (julien.vanherzeele@netasq.com, for years of bug reporting), the PFSense team, and all people who used / tried the NAT-T patch for years and reported bugs, patches, etc...
X-MFC: never
Reviewed by: bz Approved by: gnn(mentor) Obtained from: NETASQ
|
#
191529 |
|
26-Apr-2009 |
bz |
Whitespace (use tabs like for all other lines).
MFC after: 1 month
|
#
190880 |
|
10-Apr-2009 |
kmacy |
Import "flowid" support for serializing flows across transmit queues
Reviewed by: rwatson and jeli
|
#
189345 |
|
04-Mar-2009 |
bms |
Overlay a uint16_t field suitable for use by the IGMPv3 code. It is used to maintain the number of group records contained in a pending IGMPv3 output mbuf chain.
|
#
186815 |
|
06-Jan-2009 |
rrs |
Adds flags for SCTP checksum offload. Prep for support for new Intel NIC's that have this feature.
|
#
185166 |
|
22-Nov-2008 |
kmacy |
Add flowid to mbuf to allow drivers to uniquely identify connection flows to guarantee ordering across queues
|
#
178888 |
|
09-May-2008 |
julian |
Add code to allow the system to handle multiple routing tables. This particular implementation is designed to be fully backwards compatible and to be MFC-able to 7.x (and 6.x)
Currently the only protocol that can make use of the multiple tables is IPv4 Similar functionality exists in OpenBSD and Linux.
From my notes:
-----
One thing where FreeBSD has been falling behind, and which by chance I have some time to work on is "policy based routing", which allows different packet streams to be routed by more than just the destination address.
Constraints: ------------
I want to make some form of this available in the 6.x tree (and by extension 7.x) , but FreeBSD in general needs it so I might as well do it in -current and back port the portions I need.
One of the ways that this can be done is to have the ability to instantiate multiple kernel routing tables (which I will now refer to as "Forwarding Information Bases" or "FIBs" for political correctness reasons). Which FIB a particular packet uses to make the next hop decision can be decided by a number of mechanisms. The policies these mechanisms implement are the "Policies" referred to in "Policy based routing".
One of the constraints I have if I try to back port this work to 6.x is that it must be implemented as a EXTENSION to the existing ABIs in 6.x so that third party applications do not need to be recompiled in timespan of the branch.
This first version will not have some of the bells and whistles that will come with later versions. It will, for example, be limited to 16 tables in the first commit. Implementation method, Compatible version. (part 1) ------------------------------- For this reason I have implemented a "sufficient subset" of a multiple routing table solution in Perforce, and back-ported it to 6.x. (also in Perforce though not always caught up with what I have done in -current/P4). The subset allows a number of FIBs to be defined at compile time (8 is sufficient for my purposes in 6.x) and implements the changes needed to allow IPV4 to use them. I have not done the changes for ipv6 simply because I do not need it, and I do not have enough knowledge of ipv6 (e.g. neighbor discovery) needed to do it.
Other protocol families are left untouched and should there be users with proprietary protocol families, they should continue to work and be oblivious to the existence of the extra FIBs.
To understand how this is done, one must know that the current FIB code starts everything off with a single dimensional array of pointers to FIB head structures (One per protocol family), each of which in turn points to the trie of routes available to that family.
The basic change in the ABI compatible version of the change is to extent that array to be a 2 dimensional array, so that instead of protocol family X looking at rt_tables[X] for the table it needs, it looks at rt_tables[Y][X] when for all protocol families except ipv4 Y is always 0. Code that is unaware of the change always just sees the first row of the table, which of course looks just like the one dimensional array that existed before.
The entry points rtrequest(), rtalloc(), rtalloc1(), rtalloc_ign() are all maintained, but refer only to the first row of the array, so that existing callers in proprietary protocols can continue to do the "right thing". Some new entry points are added, for the exclusive use of ipv4 code called in_rtrequest(), in_rtalloc(), in_rtalloc1() and in_rtalloc_ign(), which have an extra argument which refers the code to the correct row.
In addition, there are some new entry points (currently called rtalloc_fib() and friends) that check the Address family being looked up and call either rtalloc() (and friends) if the protocol is not IPv4 forcing the action to row 0 or to the appropriate row if it IS IPv4 (and that info is available). These are for calling from code that is not specific to any particular protocol. The way these are implemented would change in the non ABI preserving code to be added later.
One feature of the first version of the code is that for ipv4, the interface routes show up automatically on all the FIBs, so that no matter what FIB you select you always have the basic direct attached hosts available to you. (rtinit() does this automatically).
You CAN delete an interface route from one FIB should you want to but by default it's there. ARP information is also available in each FIB. It's assumed that the same machine would have the same MAC address, regardless of which FIB you are using to get to it.
This brings us as to how the correct FIB is selected for an outgoing IPV4 packet.
Firstly, all packets have a FIB associated with them. if nothing has been done to change it, it will be FIB 0. The FIB is changed in the following ways.
Packets fall into one of a number of classes.
1/ locally generated packets, coming from a socket/PCB. Such packets select a FIB from a number associated with the socket/PCB. This in turn is inherited from the process, but can be changed by a socket option. The process in turn inherits it on fork. I have written a utility call setfib that acts a bit like nice..
setfib -3 ping target.example.com # will use fib 3 for ping.
It is an obvious extension to make it a property of a jail but I have not done so. It can be achieved by combining the setfib and jail commands.
2/ packets received on an interface for forwarding. By default these packets would use table 0, (or possibly a number settable in a sysctl(not yet)). but prior to routing the firewall can inspect them (see below). (possibly in the future you may be able to associate a FIB with packets received on an interface.. An ifconfig arg, but not yet.)
3/ packets inspected by a packet classifier, which can arbitrarily associate a fib with it on a packet by packet basis. A fib assigned to a packet by a packet classifier (such as ipfw) would over-ride a fib associated by a more default source. (such as cases 1 or 2).
4/ a tcp listen socket associated with a fib will generate accept sockets that are associated with that same fib.
5/ Packets generated in response to some other packet (e.g. reset or icmp packets). These should use the FIB associated with the packet being reponded to.
6/ Packets generated during encapsulation. gif, tun and other tunnel interfaces will encapsulate using the FIB that was in effect withthe proces that set up the tunnel. thus setfib 1 ifconfig gif0 [tunnel instructions] will set the fib for the tunnel to use to be fib 1.
Routing messages would be associated with their process, and thus select one FIB or another. messages from the kernel would be associated with the fib they refer to and would only be received by a routing socket associated with that fib. (not yet implemented)
In addition Netstat has been edited to be able to cope with the fact that the array is now 2 dimensional. (It looks in system memory using libkvm (!)). Old versions of netstat see only the first FIB.
In addition two sysctls are added to give: a) the number of FIBs compiled in (active) b) the default FIB of the calling process.
Early testing experience: -------------------------
Basically our (IronPort's) appliance does this functionality already using ipfw fwd but that method has some drawbacks.
For example, It can't fully simulate a routing table because it can't influence the socket's choice of local address when a connect() is done.
Testing during the generating of these changes has been remarkably smooth so far. Multiple tables have co-existed with no notable side effects, and packets have been routes accordingly.
ipfw has grown 2 new keywords:
setfib N ip from anay to any count ip from any to any fib N
In pf there seems to be a requirement to be able to give symbolic names to the fibs but I do not have that capacity. I am not sure if it is required.
SCTP has interestingly enough built in support for this, called VRFs in Cisco parlance. it will be interesting to see how that handles it when it suddenly actually does something.
Where to next: --------------------
After committing the ABI compatible version and MFCing it, I'd like to proceed in a forward direction in -current. this will result in some roto-tilling in the routing code.
Firstly: the current code's idea of having a separate tree per protocol family, all of the same format, and pointed to by the 1 dimensional array is a bit silly. Especially when one considers that there is code that makes assumptions about every protocol having the same internal structures there. Some protocols don't WANT that sort of structure. (for example the whole idea of a netmask is foreign to appletalk). This needs to be made opaque to the external code.
My suggested first change is to add routing method pointers to the 'domain' structure, along with information pointing the data. instead of having an array of pointers to uniform structures, there would be an array pointing to the 'domain' structures for each protocol address domain (protocol family), and the methods this reached would be called. The methods would have an argument that gives FIB number, but the protocol would be free to ignore it.
When the ABI can be changed it raises the possibilty of the addition of a fib entry into the "struct route". Currently, the structure contains the sockaddr of the desination, and the resulting fib entry. To make this work fully, one could add a fib number so that given an address and a fib, one can find the third element, the fib entry.
Interaction with the ARP layer/ LL layer would need to be revisited as well. Qing Li has been working on this already.
This work was sponsored by Ironport Systems/Cisco
Reviewed by: several including rwatson, bz and mlair (parts each) Obtained from: Ironport systems/Cisco
|
#
178674 |
|
29-Apr-2008 |
julian |
Add an option (compiled out by default) to profile outoing packets for a number of mbuf chain related parameters e.g. number of mbufs, wasted space. probably will do with further work later.
Reviewed by: various
|
#
177599 |
|
25-Mar-2008 |
ru |
Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT. Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA.
Reviewed by: arch
There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
|
#
177566 |
|
24-Mar-2008 |
sam |
o add M_PROTO[678]; they'll be needed by net80211 vap code o sort mbuf flags together and extend values to 32 bits o write M_COPYFLAGS in terms of M_PROTOFLAGS o move M_COPYFLAGS and M_PROTOFLAGS up to be together with flag defs
Reviewed by: rwatson MFC after: 3 weeks
|
#
175872 |
|
01-Feb-2008 |
phk |
Give MEXTADD() another argument to make both void pointers to the free function controlable, instead of passing the KVA of the buffer storage as the first argument.
Fix all conventional users of the API to pass the KVA of the buffer as the first argument, to make this a no-op commit.
Likely break the only non-convetional user of the API, after informing the relevant committer.
Update the mbuf(9) manual page, which was already out of sync on this point.
Bump __FreeBSD_version to 800016 as there is no way to tell how many arguments a CPP macro needs any other way.
This paves the way for giving sendfile(9) a way to wait for the passed storage to have been accessed before returning.
This does not affect the memory layout or size of mbufs.
Parental oversight by: sam and rwatson.
No MFC is anticipated.
|
#
175414 |
|
17-Jan-2008 |
sam |
promote ath_defrag to m_collapse (and retire private+unused m_collapse from cxgb)
Reviewed by: pyun, jhb, kmacy MFC after: 2 weeks
|
#
175342 |
|
15-Jan-2008 |
yongari |
Protect arg in macro M_ASSERTPKTHDR.
|
#
175170 |
|
09-Jan-2008 |
kmacy |
Fix KASSERT in m_free_fast - the LIST_EMPTY check only applies to packet headers. In the non packet header case there may be data there.
|
#
174896 |
|
25-Dec-2007 |
wkoszek |
Rename "mbuf_jumbo_pagesize" to "mbuf_jumbo_page". It makes it aligned correctly within ddb(4) and in the vmstat(8) output.
This change requires netstat(8) to be recompiled.
Reviewed by: rwatson@ Tested by: make LINT
|
#
172463 |
|
06-Oct-2007 |
kmacy |
This patch adds an M_NOFREE flag which allows one to mark an mbuf as not being independently freeable. This allows one to embed an mbuf in the cluster itself. This confers the benefits of the packet zone on all cluster sizes. Embedded mbufs currently suffer from the same limitation that packet zone mbufs do in that one cannot disconnect them and pass them around independently of the cluster. It would likely be possible to eliminate this limitation in the future by adding a second reference for the mbuf itself.
Approved by: re(gnn)
|
#
172462 |
|
06-Oct-2007 |
kmacy |
Allow drivers to free an mbuf without having the mbuf be touched if the driver has already freed any attached tags
Approved by: re(gnn)
|
#
171943 |
|
23-Aug-2007 |
rrs |
- Fix address add handling to clear cached routes and source addresses when peer acks the add in case the routing table changes. - Fix sctp_lower_sosend to send shutdown chunk for mbuf send case when sndlen = 0 and sinfoflag = SCTP_EOF - Fix sctp_lower_sosend for SCTP_ABORT mbuf send case with null data, So that it does not send the "null" data mbuf out and cause it to get freed twice. - Fix so auto-asconf sysctl actually effect the socket's asconf state. - Do not allow SCTP_AUTO_ASCONF option to be used on subset bound sockets. - Memset bug in sctp_output.c (arguments were reversed) submitted found and reported by Dave Jones (davej@codemonkey.org.uk). - PD-API point needs to be invoked >= not just > to conform to socket api draft this fixes sctp_indata.c in the two places need to be >=. - move M_NOTIFICATION to use M_PROTO5. - PEER_ADDR_PARAMS did not fail properly if you specify an address that is not in the association with a valid assoc_id. This meant you got or set the stcb level values instead of the destination you thought you were going to get/set. Now validate if the stcb is non-null and the net is NULL that the sa_family is set and the address is unspecified otherwise return an error. - The thread based iterator could crash if associations were freed at the exact time it was running. rework the worker thread to use the increment/decrement to prevent this and no longer use the markers that the timer based iterator uses. - Fix the memleak in sctp_add_addr_to_vrf() for the case when it is detected that ifa is already pointing to a ifn. - Fix it so that if someone is so insane that they drop the send window below the minimal add mark, they still can send. - Changed all state for associations to use mask safe macro. - During front states in association freeing in sctp_inpcbfree, we had a locking problem where locks were not in place where they should have been. - Free association calls were not testing the return value in sctp_inpcb_free() properly... others should be cast void returns where we don't care about the return value. - If a reference count is held on an assoc, even from the "force free" we should not do the actual free.. but instead let the timer free it. - When we enter sctp_input(), if the SCTP_ASOC_ABOUT_TO_BE_FREED flag is set, we must NOT process the packet but handle it like ootb. This is because while freeing an assoc we release the locks to get all the higher order locks so we can purge all the hash tables. This leaves a hole if a packet comes in just at that point. Now sctp_common_input_processing() will call the ootb code in such a case. - Change MBUF M_NOTIFICATION to use M_PROTO5 (per Sam L). This makes it so we don't have a conflict (I think this is a covertity change). We made this change AFTER some conversation and looking to make sure that M_PROTO5 does not have a problem between SCTP and the 802.11 stuff (which is the only other place its used). - Fixed lock order reversal and missing atomic protection around locked_tcb during association lookup and the 1-2-1 model. - Added debug to source address selection. - V6 output must always do checksum even for loopback. - Remove more locks around inp that are not needed for an atomically added/subtracted ref count. - slight optimization in the way we zero the array in sctp_sack_check() - It was possible to respond to a ABORT() with bad checksum with a PKT-DROP. This lead to a PKT-DROP/ABORT war. Add code to NOT send a PKT-DROP to any ABORT(). - Add an option for local logging (useful for macintosh or when you need better performing during debugging). Note no commands are here to get the log info, you must just use kgdb. - The timer code needs to be aware of if it needs to call sctp_sack_check() to slide the maps and adjust the cum-ack. This is because it may be out of sync cum-ack wise. - Added threshold managment logging. - If the user picked just the right size, that just filled the send window minus one mtu, we would enter a forever loop not copying and at the same time not blocking. Change from < to <= solves this. - Sysctl added to control the fragment interleave level which defaults to 1. - My rwnd control was not being used to control the rwnd properly (we did not add and subtract to it :-() this is now fixed so we handle small messages (1 byte etc) better to bring our rwnd down more slowly.
Approved by: re@freebsd.org (Bruce Mah)
|
#
171173 |
|
03-Jul-2007 |
mlaier |
Link pf 4.1 to the build: - move ftp-proxy from libexec to usr.sbin - add tftp-proxy - new altq mtag link
Approved by: re (kensmith)
|
#
170565 |
|
11-Jun-2007 |
gallatin |
Back out the previous commit which added an M_LRO mbuf flag to defeat the mtu check in ether_input. Mbuf flags are too scarce. Discussed with: sam
|
#
170560 |
|
11-Jun-2007 |
gallatin |
Allow drivers, such as cxgb and mxge, which support LRO to bypass the MTU check in ether_input() on LRO merged frames.
Discussed with: kmacy
|
#
168751 |
|
15-Apr-2007 |
kmacy |
back out option to disable packet zone
Requested by: sam
|
#
168735 |
|
14-Apr-2007 |
kmacy |
hide static declaration remove extra white space
|
#
168733 |
|
14-Apr-2007 |
kmacy |
Add option for disabling allocation from the packet zone
|
#
168732 |
|
14-Apr-2007 |
kmacy |
pad out m_hdr to make pkthdr word-aligned shuffle pkthdr.len so that pkthdr.header is aligned without compiler added padding
Reviewed by: rwatson, andre, sam
|
#
168638 |
|
11-Apr-2007 |
andre |
Add m_last() inline function.
|
#
168350 |
|
04-Apr-2007 |
kmacy |
m_extadd does not appear to do the right thing for the case of clusters allocated from UMA - add m_cljset to correspond to m_cljget
MFC after: 3 days
|
#
168335 |
|
03-Apr-2007 |
kmacy |
add helper functions for mapping size to zonez and types eliminate duplicated zone lookup switch statements
|
#
167870 |
|
24-Mar-2007 |
rwatson |
General style cleanup.
Correct spelling errors.
Remove references to M_COPY_PKTHDR -- it was deprecated in 6.x and is not used (or defined) in our tree.
|
#
167145 |
|
01-Mar-2007 |
bms |
Introduce a new mbuf flag, M_PROMISC.
An mbuf packet chain with the M_PROMISC flag set contains a unicast packet received by the link layer, which does not correspond to any configured link layer address in the local system.
It is copied when copying m_pkthdr. It is not cleared when crossing layers. As such, it is defined to have a flag value which is outside of the M_PROTO* range, like M_VLANTAG has.
Reviewed by: andre Obtained from: NetBSD
|
#
166213 |
|
24-Jan-2007 |
mohans |
Fix for problems that occur when all mbuf clusters migrate to the mbuf packet zone. Cluster allocations fail when this happens. Also processes that may have blocked on cluster allocations will never be woken up. Thanks to rwatson for an overview of the issue and pointers to the mbuma paper and his tool to dump out UMA zones.
Reviewed by: andre@
|
#
164274 |
|
14-Nov-2006 |
pjd |
Use tabs instead of spaces.
|
#
164273 |
|
14-Nov-2006 |
bz |
Correct a typo.
|
#
163953 |
|
03-Nov-2006 |
rrs |
Ok, here it is, we finally add SCTP to current. Note that this work is not just mine, but it is also the works of Peter Lei and Michael Tuexen. They both are my two key other developers working on the project.. and they need ata-boy's too: **** peterlei@cisco.com tuexen@fh-muenster.de **** I did do a make sysent which updated the syscall's and sysproto.. I hope that is correct... without it you don't build since we have new syscalls for SCTP :-0
So go out and look at the NOTES, add option SCTP (make sure inet and inet6 are present too) and play with SCTP.
I will see about comitting some test tools I have after I figure out where I should place them. I also have a lib (libsctp.a) that adds some of the missing socketapi functions that I need to put into lib's.. I will talk to George about this :-)
There may still be some 64 bit issues in here, none of us have a 64 bit processor to test with yet.. Michael may have a MAC but thats another beast too..
If you have a mac and want to use SCTP contact Michael he maintains a web site with a loadable module with this code :-)
Reviewed by: gnn Approved by: gnn
|
#
163915 |
|
02-Nov-2006 |
andre |
Rename m_getm() to m_getm2() and rewrite it to allocate up to page sized mbuf clusters. Add a flags parameter to accept M_PKTHDR and M_EOR mbuf chain flags. Provide compatibility macro for m_getm() calling m_getm2() with M_PKTHDR set.
Rewrite m_uiotombuf() to use m_getm2() for mbuf allocation and do the uiomove() in a tight loop over the mbuf chain. Add a flags parameter to accept mbuf flags to be passed to m_getm2(). Adjust all callers for the extra parameter.
Sponsored by: TCP/IP Optimization Fundraise 2005 MFC after: 3 month
|
#
162560 |
|
22-Sep-2006 |
ru |
Update a comment about M_VLANTAG.
|
#
162375 |
|
17-Sep-2006 |
andre |
Move ethernet VLAN tags from mtags to its own mbuf packet header field m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content.
Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field:
m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG;
to mark the packet m with the specified VLAN tag.
On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid:
if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... }
VLAN tags are stored in host byte order. Byte swapping may be necessary.
(Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.)
Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done.
Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
162091 |
|
06-Sep-2006 |
andre |
Reserve a precious 16bit gap in the mbuf pkthdr struct for ethernet 802.1pq vlan tags.
|
#
162084 |
|
06-Sep-2006 |
andre |
First step of TSO (TCP segmentation offload) support in our network stack.
o add IFCAP_TSO[46] for drivers to announce this capability for IPv4 and IPv6 o add CSUM_TSO flag to mbuf pkthdr csum_flags field o add tso_segsz field to mbuf pkthdr o enhance ip_output() packet length check to allow for large TSO packets o extend tcp_maxmtu[46]() with a flag pointer to pass interface capabilities o adjust all callers of tcp_maxmtu[46]() accordingly
Discussed on: -current, -net Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
162070 |
|
06-Sep-2006 |
andre |
Improve description of if_capabilities, if_capenable and ifi_hwassist.
Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
160608 |
|
23-Jul-2006 |
rwatson |
Remove MT_FTABLE, as it's no longer used.
Comment that many stats in mbstat are now not used, as libmemstat and UMA stats are used.
|
#
160606 |
|
23-Jul-2006 |
rwatson |
Garbage collect #if 0'd MT_ mbuf types, as they are no longer used, and there are no plans to re-introduce them.
|
#
160424 |
|
17-Jul-2006 |
phk |
Add some casts to make these files more C++ compatible.
Submitted by: Kristen Nielsen <krn@krn.dk>
|
#
156756 |
|
15-Mar-2006 |
sam |
promote fast ipsec's m_clone routine for public use; it is renamed m_unshare and the caller can now control how mbufs are allocated
Reviewed by: andre, luigi, mlaier MFC after: 1 week
|
#
155780 |
|
17-Feb-2006 |
andre |
Replace the 4k fixed sized jumbo mbuf clusters with PAGE_SIZE sized jumbo mbuf clusters. To make the variable size clear they are named MJUMPAGESIZE.
Having jumbo clusters with the native PAGE_SIZE is more useful than a fixed 4k size according the device driver writers using this API.
The 9k and 16k jumbo mbuf clusters remain unchanged.
Requested by: glebius, gallatin Sponsored by: TCP/IP Optimization Fundraise 2005 MFC after: 3 days
|
#
155051 |
|
30-Jan-2006 |
glebius |
Merge the //depot/user/yar/vlan branch into CVS. It contains some collective work by yar, thompsa and myself. The checksum offloading part also involves work done by Mihail Balikov.
The most important changes:
o Instead of global linked list of all vlan softc use a per-trunk hash. The size of hash is dynamically adjusted, depending on number of entries. This changes struct ifnet, replacing counter of vlans with a pointer to trunk structure. This change is an improvement for setups with big number of VLANs, several interfaces and several CPUs. It is a small regression for a setup with a single VLAN interface. An alternative to dynamic hash is a per-trunk static array with 4096 entries, which is a compile time option - VLAN_ARRAY. In my experiments the array is not an improvement, probably because such a big trunk structure doesn't fit into CPU cache. o Introduce an UMA zone for VLAN tags. Since drivers depend on it, the zone is declared in kern_mbuf.c, not in optional vlan(4) driver. This change is a big improvement for any setup utilizing vlan(4). o Use rwlock(9) instead of mutex(9) for locking. We are the first ones to do this! :) o Some drivers can do hardware VLAN tagging + hardware checksum offloading. Add an infrastructure for this. Whenever vlan(4) is attached to a parent or parent configuration is changed, the flags on vlan(4) interface are updated.
In collaboration with: yar, thompsa In collaboration with: Mihail Balikov <mihail.balikov interbgc.com>
|
#
154577 |
|
20-Jan-2006 |
andre |
Fix m_getjcl() the right way this time.
Submitted by: glebius Pointy hat to: andre
|
#
154575 |
|
20-Jan-2006 |
andre |
m_getjcl() should return the address of the mbuf, not the cluster.
Found by: glebius
|
#
153294 |
|
10-Dec-2005 |
andre |
Hide the 4k mbuf clusters if the normal clusters are defined to be 4k already.
This unbreaks tinderbox.
Submitted by: ru
|
#
153232 |
|
08-Dec-2005 |
andre |
Add an API for jumbo mbuf cluster allocation and also provide 4k clusters in addition to 9k and 16k ones.
struct mbuf *m_getjcl(int how, short type, int flags, int size) void *m_cljget(struct mbuf *m, int how, int size)
m_getjcl() returns an mbuf with a cluster of the specified size attached like m_getcl() does for 2k clusters.
m_cljget() is different from m_clget() as it can allocate clusters without attaching them to an mbuf. In that case the return value is the pointer to the cluster of the requested size. If an mbuf was specified, it gets the cluster attached to it and the return value can be safely ignored.
For size both take MCLBYTES, MJUM4BYTES, MJUM9BYTES, MJUM16BYTES.
Reviewed by: glebius Tested by: glebius Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
152583 |
|
18-Nov-2005 |
andre |
Purge layer specific mbuf flags on layer crossings to avoid confusing upper or lower layers.
Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
152580 |
|
18-Nov-2005 |
andre |
Add KASSERTs to M_ALIGN() and MH_ALIGN() to prevent usage on wrong mbuf types.
Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
152101 |
|
05-Nov-2005 |
andre |
Free only those mbuf+clusters back to the packet zone that were allocated from there. All others get broken up and free'd individually to the mbuf and cluster zones.
The packet zone is a secondary zone to the mbuf zone. There is currently a limitation in UMA which prevents decreasing the packet zone stock when the mbuf and cluster zone are drained and all their members are part of packets. When this is fixed this change may be reverted.
|
#
151976 |
|
02-Nov-2005 |
andre |
Mandatory mbuf cluster reference counting and groundwork for UMA based jumbo 9k and jumbo 16k cluster support.
All mbuf's with external storage attached are mandatory reference counted. For clusters and jumbo clusters UMA provides the refcnt storage directly. It does not have to be separatly allocated. Any other type of external storage gets its own refcnt allocated from an UMA mbuf refcnt zone instead of normal kernel malloc.
The refcount API MEXT_ADD_REF() and MEXT_REM_REF() is no longer publically accessible. The proper m_* functions have to be used.
mb_ctor_clust() and mb_dtor_clust() both handle normal 2K as well as 9k and 16k clusters.
Clusters and jumbo clusters may be obtained without attaching it immideatly to an mbuf. This is for high performance cluster allocation in network drivers where mbufs are attached after the cluster has been filled.
Tested by: rwatson Sponsored by: TCP/IP Optimizations Fundraise 2005
|
#
151967 |
|
02-Nov-2005 |
andre |
Retire MT_HEADER mbuf type and change its users to use MT_DATA.
Having an additional MT_HEADER mbuf type is superfluous and redundant as nothing depends on it. It only adds a layer of confusion. The distinction between header mbuf's and data mbuf's is solely done through the m->m_flags M_PKTHDR flag.
Non-native code is not changed in this commit. For compatibility MT_HEADER is mapped to MT_DATA.
Sponsored by: TCP/IP Optimization Fundraise 2005
|
#
149647 |
|
30-Aug-2005 |
andre |
Unbreak m_demote() and put back the 'all' flag. Without it we cannot correctly test for m_nextpkt in an mbuf chain.
|
#
149643 |
|
30-Aug-2005 |
andre |
o Remove the 'all' flag from m_demote(). Users can simply call it with m_demote(m->m_next) if they wish to start at the second mbuf in chain. o Test m_type with == instead of &. o Check m_nextpkt against NULL instead of implicit 0.
Based on feedback from: sam
|
#
149602 |
|
29-Aug-2005 |
andre |
Add m_copymdata(struct mbuf *m, struct mbuf *n, int off, int len, int prep, int how).
Copies the data portion of mbuf (chain) n starting from offset off for length len to mbuf (chain) m. Depending on prep the copied data will be appended or prepended. The function ensures that the mbuf (chain) m will be fully writeable by making real (not refcnt) copies of mbuf clusters. For the prepending the function returns a pointer to the new start of mbuf chain m and leaves as much leading space as possible in the new first mbuf.
Reviewed by: glebius
|
#
149599 |
|
29-Aug-2005 |
andre |
Add m_sanity(struct mbuf *m, int sanitize) to do some heavy sanity checking on mbuf's and mbuf chains. Set sanitize to 1 to garble illegal things and have them blow up later when used/accessed.
m_sanity()'s main purpose is for KASSERT()'s and debugging of non- kosher mbuf manipulation (of which we have a number of).
Reviewed by: glebius
|
#
149598 |
|
29-Aug-2005 |
andre |
Add m_demote(struct mbuf *m, int all) to clean up mbuf (chain) from any tags and packet headers. If "all" is set then the first mbuf in the chain will be cleaned too.
This function is used before an mbuf, that arrived as packet with m->flags & M_PKTHDR, is appended to an mbuf chain using m->m_next (not m->m_nextpkt).
Reviewed by: glebius
|
#
148552 |
|
29-Jul-2005 |
sam |
add m_align, a function to align any type of mbuf (i.e. it is a superset of M_ALIGN and MH_ALIGN)
Reviewed by: several
|
#
148095 |
|
17-Jul-2005 |
rwatson |
Define four constants, MBUF_{,MEM,CLUSTER,PACKET,TAG}_MEM_NAME, which are string names for their respective UMA zones and malloc types, and are passed into uma_zcreate() and MALLOC_DEFINE(). Export them outside of _KERNEL in mbuf.h so that netstat can reference them.
Change the names to improve consistency, with each zone/type associated with the mbuf allocator being prefixed mbuf_.
MFC after: 1 week
|
#
145883 |
|
04-May-2005 |
emax |
Change m_uiotombuf so it will accept offset at which data should be copied to the mbuf. Offset cannot exceed MHLEN bytes. This is currently used to fix Ethernet header alignment problem on alpha and sparc64. Also change all users of m_uiotombuf to pass proper offset.
Reviewed by: jmg, sam Tested by: Sten Spans "sten AT blinkenlights DOT nl" MFC after: 1 week
|
#
143761 |
|
17-Mar-2005 |
jmg |
add m_copyup function.. This can be used to help make our ip stack less alignment restrictive, and help performance on some ethernet cards which currently copy the entire packet a couple bytes to get the packet aligned properly...
Wordsmithing by: dwhite Obtained from: NetBSD (code only) I'll clean it up later: rwatson
|
#
143188 |
|
06-Mar-2005 |
alc |
The m_ext reference counts are potentially shared and modified asynchronously by different threads. Thus, declare as volatile the reference count that is accessed through m_ext's pointer, ref_cnt. Revert the previous change, revision 1.144, that casts as volatile a single dereference of ref_cnt.
Reviewed by: bmilekic, dwhite Problem reported by: kris MFC after: 3 days
|
#
142215 |
|
22-Feb-2005 |
glebius |
Add CARP (Common Address Redundancy Protocol), which allows multiple hosts to share an IP address, providing high availability and load balancing.
Original work on CARP done by Michael Shalayeff, with many additions by Marco Pfatschbacher and Ryan McBride.
FreeBSD port done solely by Max Laier.
Patch by: mlaier Obtained from: OpenBSD (mickey, mcbride)
|
#
142069 |
|
18-Feb-2005 |
ru |
Allocate the M_VLANTAG m_pkthdr flag, and use it to indicate that a packet has VLAN mbuf tag attached. This is faster to check than m_tag_locate(), and allows us to use the tags in non-vlan(4) VLAN producers.
The first argument to VLAN_OUTPUT_TAG() is now unused but retained for backward compatibility.
While here, embellish a fix in rev. 1.174 of if_ethersubr.c -- it now checks for packets with VLAN (mbuf) tags, and it should now be possible to bridge(4) on vlan(4)'s whose parent interfaces support VLAN decapsulation in hardware.
Reviewed by: sam
|
#
141668 |
|
10-Feb-2005 |
bmilekic |
Optimize the way reference counting is performed with Mbufs. We do not need to perform an extra memory fetch in the Packet (Mbuf+Cluster) constructor to initialize the reference counter anymore. The reference counts are located in a separate memory region (in the slab header, because this zone is UMA_ZONE_REFCNT), so the memory fetch resulted very often in a cache miss. Additionally, and perhaps more significantly, optimize the free mbuf+cluster (packet) case, which is very common, to no longer require an atomic operation on free (to verify the reference counter) if the reference on the cluster has never been increased (also very common). Reduces an atomic on mbuf free on average.
Original patch submitted by: Gerrit Nagelhout <gnagelhout@sandvine.com>
|
#
138541 |
|
08-Dec-2004 |
sam |
add m_append utility function to be used in forthcoming changes
|
#
136451 |
|
12-Oct-2004 |
glebius |
Fix comment: since move from mballoc to mbuma, the allocation functions live in kern_mbuf.c, not subr_mbuf.c
|
#
136386 |
|
11-Oct-2004 |
glebius |
Rename _m_tag_free() to m_tag_free_default() and make it non-static.
Approved by: sam
|
#
136347 |
|
10-Oct-2004 |
glebius |
Revert last commit since it breaks API.
Requested by: sam
|
#
136310 |
|
09-Oct-2004 |
glebius |
Remove inlined m_tag_free(). Rename _m_tag_free() to m_tag_free() and make it visible (same way as in OpenBSD). Describe usage in manpage.
This change is useful for creating custom free methods, which call default free method at their end.
While here, make malloc declaration for mbuf tags more informative.
Approved by: julian (mentor), sam MFC after: 1 month
|
#
135904 |
|
28-Sep-2004 |
jmg |
improve the mbuf m_print function.. Only pull length from pkthdr if there is one, detect mbuf loops and stop, add an extra arg so you can only print the first x bytes of the data per mbuf (print all if arg is -1), print flags using %b (bitmask)...
No code in the tree appears to use m_print, and it's just a maner of adding -1 as an additional arg to m_print to restore original behavior..
MFC after: 4 days
|
#
135274 |
|
15-Sep-2004 |
andre |
Remove the last two global variables that are used to store packet state while it travels through the IP stack. This wasn't much of a problem because IP source routing is disabled by default but when enabled together with SMP and preemption it would have very likely cross-corrupted the IP options in transit.
The IP source route options of a packet are now stored in a mtag instead of the global variable.
|
#
133920 |
|
17-Aug-2004 |
andre |
Convert ipfw to use PFIL_HOOKS. This is change is transparent to userland and preserves the ipfw ABI. The ipfw core packet inspection and filtering functions have not been changed, only how ipfw is invoked is different.
However there are many changes how ipfw is and its add-on's are handled:
In general ipfw is now called through the PFIL_HOOKS and most associated magic, that was in ip_input() or ip_output() previously, is now done in ipfw_check_[in|out]() in the ipfw PFIL handler.
IPDIVERT is entirely handled within the ipfw PFIL handlers. A packet to be diverted is checked if it is fragmented, if yes, ip_reass() gets in for reassembly. If not, or all fragments arrived and the packet is complete, divert_packet is called directly. For 'tee' no reassembly attempt is made and a copy of the packet is sent to the divert socket unmodified. The original packet continues its way through ip_input/output().
ipfw 'forward' is done via m_tag's. The ipfw PFIL handlers tag the packet with the new destination sockaddr_in. A check if the new destination is a local IP address is made and the m_flags are set appropriately. ip_input() and ip_output() have some more work to do here. For ip_input() the m_flags are checked and a packet for us is directly sent to the 'ours' section for further processing. Destination changes on the input path are only tagged and the 'srcrt' flag to ip_forward() is set to disable destination checks and ICMP replies at this stage. The tag is going to be handled on output. ip_output() again checks for m_flags and the 'ours' tag. If found, the packet will be dropped back to the IP netisr where it is going to be picked up by ip_input() again and the directly sent to the 'ours' section. When only the destination changes, the route's 'dst' is overwritten with the new destination from the forward m_tag. Then it jumps back at the route lookup again and skips the firewall check because it has been marked with M_SKIP_FIREWALL. ipfw 'forward' has to be compiled into the kernel with 'option IPFIREWALL_FORWARD' to enable it.
DUMMYNET is entirely handled within the ipfw PFIL handlers. A packet for a dummynet pipe or queue is directly sent to dummynet_io(). Dummynet will then inject it back into ip_input/ip_output() after it has served its time. Dummynet packets are tagged and will continue from the next rule when they hit the ipfw PFIL handlers again after re-injection.
BRIDGING and IPFW_ETHER are not changed yet and use ipfw_chk() directly as they did before. Later this will be changed to dedicated ETHER PFIL_HOOKS.
More detailed changes to the code:
conf/files Add netinet/ip_fw_pfil.c.
conf/options Add IPFIREWALL_FORWARD option.
modules/ipfw/Makefile Add ip_fw_pfil.c.
net/bridge.c Disable PFIL_HOOKS if ipfw for bridging is active. Bridging ipfw is still directly invoked to handle layer2 headers and packets would get a double ipfw when run through PFIL_HOOKS as well.
netinet/ip_divert.c Removed divert_clone() function. It is no longer used.
netinet/ip_dummynet.[ch] Neither the route 'ro' nor the destination 'dst' need to be stored while in dummynet transit. Structure members and associated macros are removed.
netinet/ip_fastfwd.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code.
netinet/ip_fw.h Removed 'ro' and 'dst' from struct ip_fw_args.
netinet/ip_fw2.c (Re)moved some global variables and the module handling.
netinet/ip_fw_pfil.c New file containing the ipfw PFIL handlers and module initialization.
netinet/ip_input.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code. ip_forward() does not longer require the 'next_hop' struct sockaddr_in argument. Disable early checks if 'srcrt' is set.
netinet/ip_output.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code.
netinet/ip_var.h Add ip_reass() as general function. (Used from ipfw PFIL handlers for IPDIVERT.)
netinet/raw_ip.c Directly check if ipfw and dummynet control pointers are active.
netinet/tcp_input.c Rework the 'ipfw forward' to local code to work with the new way of forward tags.
netinet/tcp_sack.c Remove include 'opt_ipfw.h' which is not needed here.
sys/mbuf.h Remove m_claim_next() macro which was exclusively for ipfw 'forward' and is no longer needed.
Approved by: re (scottl)
|
#
132987 |
|
01-Aug-2004 |
green |
* Add a "how" argument to uma_zone constructors and initialization functions so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default.
Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work.
|
#
132512 |
|
21-Jul-2004 |
bmilekic |
Back out just a portion of Alfred's last commit. Remove the MBUF_CHECK (WITNESS) for code paths that always call uma_zalloc_arg() shortly after where the check was, because uma_zalloc_arg() already does a similar check.
No objections from Alfred. Thanks Alfred.
|
#
132504 |
|
21-Jul-2004 |
alfred |
unbreak !WITNESS.
|
#
132488 |
|
21-Jul-2004 |
alfred |
Make sure we don't call mbuf allocation functions with mutexes held.
Discussed with: rwatson
|
#
132280 |
|
17-Jul-2004 |
mlaier |
Define semantic of M_SKIP_FIREWALL more precisely, i.e. also pass associated icmp_error() packets. While here retire PACKET_TAG_PF_GENERATED (which served the same purpose) and use M_SKIP_FIREWALL in pf as well. This should speed up things a bit as we get rid of the tag allocations.
Discussed with: juli
|
#
132274 |
|
17-Jul-2004 |
jmallett |
Make M_SKIP_FIREWALL a global (and semantic) flag, preventing anything from using M_PROTO6 and possibly shooting someone's foot, as well as allowing the firewall to be used in multiple passes, or with a packet classifier frontend, that may need to explicitly allow a certain packet. Presently this is handled in the ipfw_chk code as before, though I have run with it moved to upper layers, and possibly it should apply to ipfilter and pf as well, though this has not been investigated.
Discussed with: luigi, rwatson
|
#
130609 |
|
16-Jun-2004 |
mlaier |
Prepare for pf 3.5 import: - Remove pflog and pfsync modules. Things will change in such a fashion that there will be one module with pf+pflog that can be loaded into GENERIC without problems (which is what most people want). pfsync is no longer possible as a module. - Add multicast address for in-kernel multicast pfsync protocol. Protocol glue will follow once the import is done. - Add one more mbuf tag
|
#
130256 |
|
09-Jun-2004 |
rwatson |
Introduce a netisr to deliver kernel-generated routing, avoiding recursive entering of the socket code from the routing code:
- Modify rt_dispatch() to bundle up the sockaddr family, if any, associated with a pending mbuf to dispatch to routing sockets, in an m_tag on the mbuf.
- Allocate NETISR_ROUTE for use by routing sockets.
- Introduce rtsintrq, an ifqueue to be used by the netisr, and introduce rts_input(), a function to unbundle the tagged sockaddr and inject the mbuf and address into raw_input(), which previously occurred in rt_dispatch().
- Introduce rts_init() to initialize rtsintrq, its mutex, and register the netisr. Perform this at the same point in system initialization as setup of the domains.
This change introduces asynchrony between the generation of a pending routing socket message and delivery to sockets for use by userspace. It avoids socket->routing->rtsock->socket use and helps to avoid lock order reversals between the routing code and socket code (in particular, raw socket control blocks), as route locks are held over calls to rt_dispatch().
Reviewed by: "George V.Neville-Neil" <gnn@neville-neil.com> Conceptual head nod by: sam
|
#
129906 |
|
31-May-2004 |
bmilekic |
Bring in mbuma to replace mballoc.
mbuma is an Mbuf & Cluster allocator built on top of a number of extensions to the UMA framework, all included herein.
Extensions to UMA worth noting: - Better layering between slab <-> zone caches; introduce Keg structure which splits off slab cache away from the zone structure and allows multiple zones to be stacked on top of a single Keg (single type of slab cache); perhaps we should look into defining a subset API on top of the Keg for special use by malloc(9), for example. - UMA_ZONE_REFCNT zones can now be added, and reference counters automagically allocated for them within the end of the associated slab structures. uma_find_refcnt() does a kextract to fetch the slab struct reference from the underlying page, and lookup the corresponding refcnt.
mbuma things worth noting: - integrates mbuf & cluster allocations with extended UMA and provides caches for commonly-allocated items; defines several zones (two primary, one secondary) and two kegs. - change up certain code paths that always used to do: m_get() + m_clget() to instead just use m_getcl() and try to take advantage of the newly defined secondary Packet zone. - netstat(1) and systat(1) quickly hacked up to do basic stat reporting but additional stats work needs to be done once some other details within UMA have been taken care of and it becomes clearer to how stats will work within the modified framework.
From the user perspective, one implication is that the NMBCLUSTERS compile-time option is no longer used. The maximum number of clusters is still capped off according to maxusers, but it can be made unlimited by setting the kern.ipc.nmbclusters boot-time tunable to zero. Work should be done to write an appropriate sysctl handler allowing dynamic tuning of kern.ipc.nmbclusters at runtime.
Additional things worth noting/known issues (READ): - One report of 'ips' (ServeRAID) driver acting really slow in conjunction with mbuma. Need more data. Latest report is that ips is equally sucking with and without mbuma. - Giant leak in NFS code sometimes occurs, can't reproduce but currently analyzing; brueffer is able to reproduce but THIS IS NOT an mbuma-specific problem and currently occurs even WITHOUT mbuma. - Issues in network locking: there is at least one code path in the rip code where one or more locks are acquired and we end up in m_prepend() with M_WAITOK, which causes WITNESS to whine from within UMA. Current temporary solution: force all UMA allocations to be M_NOWAIT from within UMA for now to avoid deadlocks unless WITNESS is defined and we can determine with certainty that we're not holding any locks when we're M_WAITOK. - I've seen at least one weird socketbuffer empty-but- mbuf-still-attached panic. I don't believe this to be related to mbuma but please keep your eyes open, turn on debugging, and capture crash dumps.
This change removes more code than it adds.
A paper is available detailing the change and considering various performance issues, it was presented at BSDCan2004: http://www.unixdaemons.com/~bmilekic/netbuf_bmilekic.pdf Please read the paper for Future Work and implementation details, as well as credits.
Testing and Debugging: rwatson, brueffer, Ketrien I. Saihr-Kesenchedra, ... Reviewed by: Lots of people (for different parts)
|
#
129832 |
|
29-May-2004 |
maxim |
Remove unneeded XXX comments botched in previous commit.
Submitted by: bde
|
#
129810 |
|
28-May-2004 |
maxim |
Style.
Submitted by: bde
|
#
129668 |
|
24-May-2004 |
maxim |
Grammar.
|
#
129390 |
|
18-May-2004 |
maxim |
o Fix comments: s/m_tag_allocate/m_tag_alloc/.
Spotted by: Gleb Smirnoff MFC after: 1 week
|
#
128829 |
|
02-May-2004 |
darrenr |
Rename m_claim_next_hop() to m_claim_next(), as suggested by Max Laier.
|
#
128816 |
|
02-May-2004 |
darrenr |
Rename ip_claim_next_hop() to m_claim_next_hop(), give it an extra arg (the type of tag to claim) and push it out of ip_var.h into mbuf.h alongside all of the other macros that work ok mbuf's and tag's.
|
#
128402 |
|
18-Apr-2004 |
luigi |
constify the last argument of m_copyback.
|
#
127976 |
|
07-Apr-2004 |
imp |
Remove advertising clause from University of California Regent's license, per letter dated July 22, 1999.
Approved by: core
|
#
126263 |
|
26-Feb-2004 |
mlaier |
Tweak existing header and other build infrastructure to be able to build pf/pflog/pfsync as modules. Do not list them in NOTES or modules/Makefile (i.e. do not connect it to any (automatic) builds - yet).
Approved by: bms(mentor)
|
#
126239 |
|
25-Feb-2004 |
mlaier |
Re-remove MT_TAGs. The problems with dummynet have been fixed now.
Tested by: -current, bms(mentor), me Approved by: bms(mentor), sam
|
#
125952 |
|
17-Feb-2004 |
mlaier |
Backout MT_TAG removal (i.e. bring back MT_TAGs) for now, as dummynet is not working properly with the patch in place.
Approved by: bms(mentor)
|
#
125784 |
|
13-Feb-2004 |
mlaier |
This set of changes eliminates the use of MT_TAG "pseudo mbufs", replacing them mostly with packet tags (one case is handled by using an mbuf flag since the linkage between "caller" and "callee" is direct and there's no need to incur the overhead of a packet tag).
This is (mostly) work from: sam
Silence from: -arch Approved by: bms(mentor), sam, rwatson
|
#
125585 |
|
08-Feb-2004 |
silby |
Move m_uiotombuf from uio.h to mbuf.h, where I should have put it in the first place.
Suggested by: bde
|
#
124077 |
|
02-Jan-2004 |
sam |
m_tag fixups in preparation for heavier use:
o promote several m_tag_* routines to inline o add an m_tag_setup inline to set the fixed fields in a packet tag o add an m_tag_free method pointer to each mtag to support, for example, allocating tags from zones o have m_tag_find check if the tag list is not empty before calling m_tag_locate to search
Reviewed by: brooks, silence from others
|
#
123931 |
|
28-Dec-2003 |
silby |
Move the declarations for nsfbufs and friends over to sf_buf.h from mbuf.h
|
#
123929 |
|
28-Dec-2003 |
silby |
Track three new sendfile-related statistics: - The number of times sendfile had to do disk I/O - The number of times sfbuf allocation failed - The number of times sfbuf allocation had to wait
|
#
123920 |
|
27-Dec-2003 |
silby |
Move the declaration of sfbufspeak and sfbufsused to mbuf.h, and use imax instead of max, as sfbufspeak and sfbufsused are signed.
Submitted by: bde
|
#
123564 |
|
16-Dec-2003 |
bms |
style(9) pass and type fixups.
Submitted by: bde
|
#
123557 |
|
15-Dec-2003 |
bms |
Push m_apply() and m_getptr() up into the colleciton of standard mbuf routines, and purge them from opencrypto.
Reviewed by: sam Obtained from: NetBSD Sponsored by: spc.org
|
#
122971 |
|
24-Nov-2003 |
sam |
Correct a problem where ipfw-generated packets were being returned for ipfw processing w/o an indication the packets were generated by ipfw--and so should not be processed (this manifested itself as a LOR.) The flag bit in the mbuf that was used to mark the packets was not listed in M_COPYFLAGS so if a packet had a header prepended (as done by IPsec) the flag was lost. Correct this by defining a new M_PROTO6 flag and use it to mark packets that need this processing.
Reviewed by: bms Approved by: re (rwatson) MFC after: 2 weeks
|
#
122717 |
|
14-Nov-2003 |
bde |
Fixed some English errors in comments.
|
#
122702 |
|
14-Nov-2003 |
andre |
Introduce ip_fastforward and remove ip_flow.
Short description of ip_fastforward:
o adds full direct process-to-completion IPv4 forwarding code o handles ip fragmentation incl. hw support (ip_flow did not) o sends icmp needfrag to source if DF is set (ip_flow did not) o supports ipfw and ipfilter (ip_flow did not) o supports divert, ipfw fwd and ipfilter nat (ip_flow did not) o returns anything it can't handle back to normal ip_input
Enable with sysctl -w net.inet.ip.fastforwarding=1
Reviewed by: sam (mentor)
|
#
121645 |
|
29-Oct-2003 |
sam |
Introduce the notion of "persistent mbuf tags"; these are tags that stay with an mbuf until it is reclaimed. This is in contrast to tags that vanish when an mbuf chain passes through an interface. Persistent tags are used, for example, by MAC labels.
Add an m_tag_delete_nonpersistent function to strip non-persistent tags from mbufs and use it to strip such tags from packets as they pass through the loopback interface and when turned around by icmp. This fixes problems with "tag leakage".
Pointed out by: Jonathan Stone Reviewed by: Robert Watson
|
#
121260 |
|
19-Oct-2003 |
silby |
Add a new macro M_ASSERTVALID which ensures that the mbuf in question is non-free. (More checks can/should be added in the future.)
Use M_ASSERTVALID in BPF_MTAP so that we catch when freed mbufs are passed in, even if no bpf listeners are active.
Inspired by a bug in if_dc caught by Kenjiro Cho.
|
#
119644 |
|
01-Sep-2003 |
silby |
Implement MBUF_STRESS_TEST mark II.
Changes from the original implementation:
- Fragmentation is handled by the function m_fragment, which can be called from whereever fragmentation is needed. Note that this function is wrapped in #ifdef MBUF_STRESS_TEST to discourage non-testing use.
- m_fragment works slightly differently from the old fragmentation code in that it allocates a seperate mbuf cluster for each fragment. This defeats dma_map_load_mbuf/buffer's feature of coalescing adjacent fragments. While that is a nice feature in practice, it nerfed the usefulness of mbuf_stress_test.
- Add two modes of random fragmentation. Chains with fragments all of the same random length and chains with fragments that are each uniquely random in length may now be requested.
|
#
114851 |
|
09-May-2003 |
silby |
Redefine M_FREELIST to be 0x8000; 0x4000 conflicted with two other uses of m_flags in the kernel. (A future commit will move all private m_flags users here so they're obvious without a great deal of searching.)
This should fix the mbuf double-free panics those using ppp or ipfw reset rules have been seeing since the double-free detection code went in.
|
#
114488 |
|
02-May-2003 |
silby |
Add the M_FREELIST flag, which is used to detect whenever a double free of a mbuf occurs and cause an immediate panic, rather than allowing free list corruption to occur.
This code is trapped under INVARIANTS, so it should not cause any change in default performance.
Reviewed by: a bunch of people on -net MFC after: 1 week
|
#
113487 |
|
14-Apr-2003 |
rwatson |
Move MAC label storage for mbufs into m_tags from the m_pkthdr structure, returning some additional room in the first mbuf in a chain, and avoiding feature-specific contents in the mbuf header. To do this:
- Modify mbuf_to_label() to extract the tag, returning NULL if not found.
- Introduce mac_init_mbuf_tag() which does most of the work mac_init_mbuf() used to do, except on an m_tag rather than an mbuf.
- Scale back mac_init_mbuf() to perform m_tag allocation and invoke mac_init_mbuf_tag().
- Replace mac_destroy_mbuf() with mac_destroy_mbuf_tag(), since m_tag's are now GC'd deep in the m_tag/mbuf code rather than at a higher level when mbufs are directly free()'d.
- Add mac_copy_mbuf_tag() to support m_copy_pkthdr() and related notions.
- Generally change all references to mbuf labels so that they use mbuf_to_label() rather than &mbuf->m_pkthdr.label. This required no changes in the MAC policies (yay!).
- Tweak mbuf release routines to not call mac_destroy_mbuf(), tag destruction takes care of it for us now.
- Remove MAC magic from m_copy_pkthdr() and m_move_pkthdr() -- the existing m_tag support does all this for us. Note that we can no longer just zero the m_tag list on the target mbuf, rather, we have to delete the chain because m_tag's will already be hung off freshly allocated mbuf's.
- Tweak m_tag copying routines so that if we're copying a MAC m_tag, we don't do a binary copy, rather, we initialize the new storage and do a deep copy of the label.
- Remove use of MAC_FLAG_INITIALIZED in a few bizarre places having to do with mbuf header copies previously.
- When an mbuf is copied in ip_input(), we no longer need to explicitly copy the label because it will get handled by the m_tag code now.
- No longer any weird handling of MAC labels in if_loop.c during header copies.
- Add MPC_LOADTIME_FLAG_LABELMBUFS flag to Biba, MLS, mac_test. In mac_test, handle the label==NULL case, since it can be dynamically loaded.
In order to improve performance with this change, introduce the notion of "lazy MAC label allocation" -- only allocate m_tag storage for MAC labels if we're running with a policy that uses MAC labels on mbufs. Policies declare this intent by setting the MPC_LOADTIME_FLAG_LABELMBUFS flag in their load-time flags field during declaration. Note: this opens up the possibility of post-boot policy modules getting back NULL slot entries even though they have policy invariants of non-NULL slot entries, as the policy might have been loaded after the mbuf was allocated, leaving the mbuf without label storage. Policies that cannot handle this case must be declared as NOTLATE, or must be modified.
- mac_labelmbufs holds the current cumulative status as to whether any policies require mbuf labeling or not. This is updated whenever the active policy set changes by the function mac_policy_updateflags(). The function iterates the list and checks whether any have the flag set. Write access to this variable is protected by the policy list; read access is currently not protected for performance reasons. This might change if it causes problems.
- Add MAC_POLICY_LIST_ASSERT_EXCLUSIVE() to permit the flags update function to assert appropriate locks.
- This makes allocation in mac_init_mbuf() conditional on the flag.
Reviewed by: sam Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
|
#
113341 |
|
10-Apr-2003 |
rwatson |
Check M_TRYWAIT as a flag, not a constant, in MBTOM() mbuf allocator to malloc flag converter.
|
#
113255 |
|
08-Apr-2003 |
des |
Introduce an M_ASSERTPKTHDR() macro which performs the very common task of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable.
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
|
#
112777 |
|
29-Mar-2003 |
silby |
Add the m_defrag routine, as discussed on committers@. This incarnation should address the concerns of all in the discussion, and keeps statistics which show how much it is used.
MFC after: 2 weeks
|
#
112691 |
|
26-Mar-2003 |
rwatson |
Add MBTOM(), a macro that converts from an mbuf blocking disposition flag (M_DONTWAIT / M_TRYWAIT) to a malloc(9) blocking disposition flag (M_NOWAIT, M_WAITOK). The semantic match isn't perfect, but for scenarios where malloc data is used in the network stack, such as for MAC labeling or for m_tags, we sometimes need to map from one to the other to get the right blocking behavior.
Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
|
#
112674 |
|
26-Mar-2003 |
mux |
Correct comment, MSIZE and MCLBYTES are defined in sys/param.h and not in machine/param.h.
|
#
112063 |
|
10-Mar-2003 |
phk |
Make malloc and mbuf allocation mode flags nonoverlapping.
Under INVARIANTS whine if we get incompatible flags.
Submitted by: imp
|
#
111164 |
|
20-Feb-2003 |
bmilekic |
o Allow "buckets" in mb_alloc to be differently sized (according to compile-time constants). That is, a "bucket" now is not necessarily a page-worth of mbufs or clusters, but it is MBUF_BUCK_SZ, CLUS_BUCK_SZ worth of mbufs, clusters. o Rename {mbuf,clust}_limit to {mbuf,clust}_hiwm and introduce {mbuf,clust}_lowm, which currently has no effect but will be used to set the low watermarks. o Fix netstat so that it can deal with the differently-sized buckets and teach it about the low watermarks too. o Make sure the per-cpu stats for an absent CPU has mb_active set to 0, explicitly. o Get rid of the allocate refcounts from mbuf map mess. Instead, just malloc() the refcounts in one shot from mbuf_init() o Clean up / update comments in subr_mbuf.c
|
#
111119 |
|
19-Feb-2003 |
imp |
Back out M_* changes, per decision of the TRB.
Approved by: trb
|
#
109623 |
|
21-Jan-2003 |
alfred |
Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
|
#
108575 |
|
02-Jan-2003 |
gallatin |
o Introduce a new external mbuf type, EXT_EXTREF.
o Allow callers of m_extadd() to allocate their own reference m_ext.ref_cnt pointer, rather than having the mbuf system allocate it with a malloc() in the critical path. This speeds m_extadd() up, and also simplifies locking (malloc() may need Giant).
A driver or subsystem wishing to take use its own ref counter must initialize m_ext.ref_cnt to point to its ref counter prior to calling m_extadd(), and it must use EXT_EXTREF as its external type.
Eg: m->m_ext.ref_cnt = my_ref_cnt_ptr; m_extadd(.....,EXT_EXTREF);
Reviewed by: bosko
|
#
108466 |
|
30-Dec-2002 |
sam |
Correct mbuf packet header propagation. Previously, packet headers were sometimes propagated using M_COPY_PKTHDR which actually did something between a "move" and a "copy" operation. This is replaced by M_MOVE_PKTHDR (which copies the pkthdr contents and "removes" it from the source mbuf) and m_dup_pkthdr which copies the packet header contents including any m_tag chain. This corrects numerous problems whereby mbuf tags could be lost during packet manipulations.
These changes also introduce arguments to m_tag_copy and m_tag_copy_chain to specify if the tag copy work should potentially block. This introduces an incompatibility with openbsd which we may want to revisit.
Note that move/dup of packet headers does not handle target mbufs that have a cluster bound to them. We may want to support this; for now we watch for it with an assert.
Finally, M_COPYFLAGS was updated to include M_FIRSTFRAG|M_LASTFRAG.
Supported by: Vernier Networks Reviewed by: Robert Watson <rwatson@FreeBSD.org>
|
#
105530 |
|
20-Oct-2002 |
phk |
Don't declare mb_statpcpu, it is static in subr_mbuf.c
Spotted by: FlexeLint
|
#
105194 |
|
15-Oct-2002 |
sam |
Replace aux mbufs with packet tags:
o instead of a list of mbufs use a list of m_tag structures a la openbsd o for netgraph et. al. extend the stock openbsd m_tag to include a 32-bit ABI/module number cookie o for openbsd compatibility define a well-known cookie MTAG_ABI_COMPAT and use this in defining openbsd-compatible m_tag_find and m_tag_get routines o rewrite KAME use of aux mbufs in terms of packet tags o eliminate the most heavily used aux mbufs by adding an additional struct inpcb parameter to ip_output and ip6_output to allow the IPsec code to locate the security policy to apply to outbound packets o bump __FreeBSD_version so code can be conditionalized o fixup ipfilter's call to ip_output based on __FreeBSD_version
Reviewed by: julian, luigi (silent), -arch, -net, darren Approved by: julian, silence from everyone else Obtained from: openbsd (mostly) MFC after: 1 month
|
#
104561 |
|
06-Oct-2002 |
markm |
Be consistent WRT function argument names. Other arguments only have types, so remove these names. This also helps by not polluting namespace.
|
#
103568 |
|
18-Sep-2002 |
bmilekic |
more style fixes: 'unsigned' should be 'u_int' in this file.
Submitted by: bde
|
#
103558 |
|
18-Sep-2002 |
bmilekic |
style fixes to mbuf.h
Submitted by: bde
|
#
103552 |
|
18-Sep-2002 |
phk |
Make m_length() and m_fixhdr() return unsigned.
Suggested by: arr
|
#
103544 |
|
18-Sep-2002 |
phk |
Introduce the m_length() function which will return the accumulated length of an mbuf-chain and optionally a pointer to the last mbuf.
|
#
103540 |
|
18-Sep-2002 |
phk |
Move m_fixhdr() from "mbchain" to "mbuf" where it belongs.
|
#
101918 |
|
15-Aug-2002 |
bmilekic |
Make m_flags an int instead of a short, this is consistent with the type of the 'flags' argument m_getcl() was using anyway; m_extadd() needed to be changed to accept an int instead of a short for 'flags.' This makes things more consistent and also gives us more bits to use for m_flags in the future (we have almost run out).
Requested by: sam (Sam Leffler)
|
#
101848 |
|
13-Aug-2002 |
rwatson |
Move to a nested include of _label.h instead of mac.h in sys/sys/*.h (Most of the places where mac.h was recursively included from another kernel header file. net/netinet to follow.)
Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Suggested by: bde
|
#
100981 |
|
30-Jul-2002 |
rwatson |
Begin committing support for Mandatory Access Control and extensible kernel access control. The MAC framework permits loadable kernel modules to link to the kernel at compile-time, boot-time, or run-time, and augment the system security policy. This commit includes the initial kernel implementation, although the interface with the userland components of the oeprating system is still under work, and not all kernel subsystems are supported. Later in this commit sequence, documentation of which kernel subsystems will not work correctly with a kernel compiled with MAC support will be added.
Label mbuf's with packet header data, permitting in-flight datagrams to be labeled in the TrustedBSD MAC implementation. Add a questionable recursive #include of sys/mac.h to maintain the current API for applications and kernel code including mbuf.h to get 'struct mbuf' definition.
Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
|
#
100960 |
|
30-Jul-2002 |
rwatson |
Make M_COPY_PKTHDR() macro into a wrapper for a m_copy_pkthdr() function. This permits conditionally compiled extensions to the packet header copying semantic, such as extensions to copy MAC labels.
Reviewed by: bmilekic Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
|
#
100103 |
|
15-Jul-2002 |
bmilekic |
o Introduce new m_getcl() interface routine that allocates an mbuf and a cluster in one shot. o Introduce MBP_PERSIST and MBP_PERSISTENT control bits to mb_alloc(); MBP_PERSIST means "if you can allocate, then keep the cache lock held on exit," and MBP_PERSISTENT means "a cache lock is alredy held on entry, so allocate from the specified (already locked) cache." They may be used in combination. o m_getcl() uses the MBP_PERSIST/MBP_PERSISTENT interface so that it doesn't drop the cache lock in between the mbuf and cluster allocations. o m_getm(), which takes a size and allocates an mbuf + cluster "best fit" chain, has been moved from uipc_mbuf.c to subr_mbuf.c and shown how to use MBP_PERSIST/MBP_PERSISTENT to attempt to do a grouped allocation without dropping the cache lock in between.
Why this is good: much less bus-locked lock acquires/drops when they're not needed. Also, prototype for m_getcl(): struct mbuf * m_getcl(int how, short type, int flags); "how" and "type" are self-explanatory. "flags" may be M_PKTHDR, in which case m_getcl() will make the mbuf a pkthdr-mbuf.
While I'm in subr_mbuf.c: o Every exported routine now has a nice comment with a description of the expected arguments. Eventually, mbuf(9) needs to be re-vamped but there's still more code to write/finalize before I get to that. o internal macros have been changed a bit. o consistently use 'short' for "type." This somehow slipped through before (that 'type' was sometimes declared as int).
Alfred has been pushing for the MBP_PERSIST{,ENT} thing for almost a year now. Luigi asked for m_getcl(), and will probably MFC that part of this commit.
TODO [Related]: teach mb_free() about MBP_PERSIST{, ENT}.
|
#
98995 |
|
28-Jun-2002 |
alfred |
remove or replace caddr_t with void. make the mbuf external free function take a void * rather than caddr_t.
|
#
98849 |
|
26-Jun-2002 |
ken |
At long last, commit the zero copy sockets code.
MAKEDEV: Add MAKEDEV glue for the ti(4) device nodes.
ti.4: Update the ti(4) man page to include information on the TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS kernel options, and also include information about the new character device interface and the associated ioctls.
man9/Makefile: Add jumbo.9 and zero_copy.9 man pages and associated links.
jumbo.9: New man page describing the jumbo buffer allocator interface and operation.
zero_copy.9: New man page describing the general characteristics of the zero copy send and receive code, and what an application author should do to take advantage of the zero copy functionality.
NOTES: Add entries for ZERO_COPY_SOCKETS, TI_PRIVATE_JUMBOS, TI_JUMBO_HDRSPLIT, MSIZE, and MCLSHIFT.
conf/files: Add uipc_jumbo.c and uipc_cow.c.
conf/options: Add the 5 options mentioned above.
kern_subr.c: Receive side zero copy implementation. This takes "disposable" pages attached to an mbuf, gives them to a user process, and then recycles the user's page. This is only active when ZERO_COPY_SOCKETS is turned on and the kern.ipc.zero_copy.receive sysctl variable is set to 1.
uipc_cow.c: Send side zero copy functions. Takes a page written by the user and maps it copy on write and assigns it kernel virtual address space. Removes copy on write mapping once the buffer has been freed by the network stack.
uipc_jumbo.c: Jumbo disposable page allocator code. This allocates (optionally) disposable pages for network drivers that want to give the user the option of doing zero copy receive.
uipc_socket.c: Add kern.ipc.zero_copy.{send,receive} sysctls that are enabled if ZERO_COPY_SOCKETS is turned on.
Add zero copy send support to sosend() -- pages get mapped into the kernel instead of getting copied if they meet size and alignment restrictions.
uipc_syscalls.c:Un-staticize some of the sf* functions so that they can be used elsewhere. (uipc_cow.c)
if_media.c: In the SIOCGIFMEDIA ioctl in ifmedia_ioctl(), avoid calling malloc() with M_WAITOK. Return an error if the M_NOWAIT malloc fails.
The ti(4) driver and the wi(4) driver, at least, call this with a mutex held. This causes witness warnings for 'ifconfig -a' with a wi(4) or ti(4) board in the system. (I've only verified for ti(4)).
ip_output.c: Fragment large datagrams so that each segment contains a multiple of PAGE_SIZE amount of data plus headers. This allows the receiver to potentially do page flipping on receives.
if_ti.c: Add zero copy receive support to the ti(4) driver. If TI_PRIVATE_JUMBOS is not defined, it now uses the jumbo(9) buffer allocator for jumbo receive buffers.
Add a new character device interface for the ti(4) driver for the new debugging interface. This allows (a patched version of) gdb to talk to the Tigon board and debug the firmware. There are also a few additional debugging ioctls available through this interface.
Add header splitting support to the ti(4) driver.
Tweak some of the default interrupt coalescing parameters to more useful defaults.
Add hooks for supporting transmit flow control, but leave it turned off with a comment describing why it is turned off.
if_tireg.h: Change the firmware rev to 12.4.11, since we're really at 12.4.11 plus fixes from 12.4.13.
Add defines needed for debugging.
Remove the ti_stats structure, it is now defined in sys/tiio.h.
ti_fw.h: 12.4.11 firmware.
ti_fw2.h: 12.4.11 firmware, plus selected fixes from 12.4.13, and my header splitting patches. Revision 12.4.13 doesn't handle 10/100 negotiation properly. (This firmware is the same as what was in the tree previously, with the addition of header splitting support.)
sys/jumbo.h: Jumbo buffer allocator interface.
sys/mbuf.h: Add a new external mbuf type, EXT_DISPOSABLE, to indicate that the payload buffer can be thrown away / flipped to a userland process.
socketvar.h: Add prototype for socow_setup.
tiio.h: ioctl interface to the character portion of the ti(4) driver, plus associated structure/type definitions.
uio.h: Change prototype for uiomoveco() so that we'll know whether the source page is disposable.
ufs_readwrite.c:Update for new prototype of uiomoveco().
vm_fault.c: In vm_fault(), check to see whether we need to do a page based copy on write fault.
vm_object.c: Add a new function, vm_object_allocate_wait(). This does the same thing that vm_object allocate does, except that it gives the caller the opportunity to specify whether it should wait on the uma_zalloc() of the object structre.
This allows vm objects to be allocated while holding a mutex. (Without generating WITNESS warnings.)
vm_object_allocate() is implemented as a call to vm_object_allocate_wait() with the malloc flag set to M_WAITOK.
vm_object.h: Add prototype for vm_object_allocate_wait().
vm_page.c: Add page-based copy on write setup, clear and fault routines.
vm_page.h: Add page based COW function prototypes and variable in the vm_page structure.
Many thanks to Drew Gallatin, who wrote the zero copy send and receive code, and to all the other folks who have tested and reviewed this code over the years.
|
#
98673 |
|
23-Jun-2002 |
luigi |
Remove some extra spaces hidden between tabs Spotted-by: diff against the version in RELENG_4
|
#
98612 |
|
22-Jun-2002 |
luigi |
Define an mbuf type, MT_TAG, used for volatile annotations prepended to mbuf chains in the network stack. Reuse a previoulsy unused value to avoid changes in other data structures.
|
#
98516 |
|
20-Jun-2002 |
luigi |
Add some #define's for mbuf annotations.
As the comment in the code says, eventually there will be a proper data structure (e.g NetBSD's struct m_tag) to store chains of annotations, and mbuf-handling procedures will handle these chains in the correct way.
Right now, these chains do not exist, and we just use the constants defined here to implement simple ad-hoc solutions to remove some global variables used so far to pass around informations about packets being processed.
Global variables are not only ugly and make the code unreadable, they also prevent from using parallelism in network stack processing.
(the 3-days MFC only refers to this commit, i.e. the PACKET_TAG_* constants; the full mechanism will be committed and MFC'ed on a longer timescale).
MFC after: 3 days
|
#
97681 |
|
31-May-2002 |
archie |
Fix a bug in m_split(): the "m->m_ext.ext_size" field of an mbuf was being set to zero. This field indicates the total space in the external buffer and therefore should not be modified after the external buffer is added.
Add a comment warning that the mbufs returned by m_split() might be read-only.
Fix M_TRAILINGSPACE() to return zero if !M_WRITABLE(m).
Reviewed by: freebsd-net Obtained from: Vernier Networks, Inc. MFC after: 1 week
|
#
90227 |
|
05-Feb-2002 |
dillon |
Get rid of the twisted MFREE() macro entirely.
Reviewed by: dg, bmilekic MFC after: 3 days
|
#
88449 |
|
23-Dec-2001 |
bmilekic |
On the first day of Christmas bde gave to me: A [hopefully] conforming style(9) revamp of mb_alloc and related code. (This was possible due to bde's remarkable patience.)
Submitted by: (in large part) bde Reviewed by: (the other part) bde
|
#
88423 |
|
22-Dec-2001 |
bmilekic |
Move prototype of _mext_free to mbuf.h, where it belongs, because it is used in MEXTFREE and needs to be in scope for external MEXTFREE users.
Pointed out by: Chad David <davidc@acns.ab.ca> Confirmed by: bde
|
#
87899 |
|
14-Dec-2001 |
luigi |
Let M_LEADINGSPACE write into non-shared mbufs. A similar thing has been in -stable for weeks and is completely safe.
This has very good performance implications as it saves some data copying, and sometimes avoids triggering performance bugs in devices (such as the "dc" and other Tulip clones) which do not like scattered data.
|
#
84153 |
|
29-Sep-2001 |
bmilekic |
Re-enable mbtypes statistics in the mbuf allocator. I disabled these when I changed the allocator bits. This implements per-CPU mbtypes stats by keeping net number of decrements/increments of a given mbtype per-CPU and then summing all of the per-CPU mbtypes to produce the total net number of allocated mbufs of the given mbtype. Counters are carefully balanced to avoid/prevent underflows/overflows.
mbtypes stats are re-enabled with the idea that we may occasionally (although very rarely) observe slight inconsistencies in the stat reporting. Most of the time, we should be fine, though.
Also make appropriate modifications to netstat(1) and systat(1) to do the necessary reporting.
Submitted by: Jiangyi Liu <jyliu@163.net>
|
#
81908 |
|
19-Aug-2001 |
julian |
Constify m_copydata. this allows constants to be copied without giving errors. (removes a couple of warning messages in the kernel.)
Note: uipc_mbuf.c is a forced commit as it was accidentally included in another commit.
MFC after: 2 weeks
|
#
80399 |
|
26-Jul-2001 |
bmilekic |
- Do not handle the per-CPU containers in mbuf code as though the cpuids were indices in a dense array. The cpuids are a sparse set and treat them as such, setting up containers only for CPUs activated during mb_init().
- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse map, in accordance with the above.
This allows us to properly boot with certain CPUs disactivated. However, if we later decide to re-activate said CPUs, we will barf until we decide to implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU containers to get configured on their activation.
Reported by: mjacob Partially (sys/ diffs) Submitted by: mjacob
|
#
78592 |
|
22-Jun-2001 |
bmilekic |
Introduce numerous SMP friendly changes to the mbuf allocator. Namely, introduce a modified allocation mechanism for mbufs and mbuf clusters; one which can scale under SMP and which offers the possibility of resource reclamation to be implemented in the future. Notable advantages:
o Reduce contention for SMP by offering per-CPU pools and locks. o Better use of data cache due to per-CPU pools. o Much less code cache pollution due to excessively large allocation macros. o Framework for `grouping' objects from same page together so as to be able to possibly free wired-down pages back to the system if they are no longer needed by the network stacks.
Additional things changed with this addition:
- Moved some mbuf specific declarations and initializations from sys/conf/param.c into mbuf-specific code where they belong. - m_getclr() has been renamed to m_get_clrd() because the old name is really confusing. m_getclr() HAS been preserved though and is defined to the new name. No tree sweep has been done "to change the interface," as the old name will continue to be supported and is not depracated. The change was merely done because m_getclr() sounds too much like "m_get a cluster." - TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and systat(1) (see TODO below). - Fixed systat(1) to display number of "free mbufs" based on new per-CPU stat structures. - Fixed netstat(1) to display new per-CPU stats based on sysctl-exported per-CPU stat structures. All infos are fetched via sysctl.
TODO (in order of priority):
- Re-enable mbtypes statistics in both netstat(1) and systat(1) after introducing an SMP friendly way to collect the mbtypes stats under the already introduced per-CPU locks (i.e. hopefully don't use atomic() - it seems too costly for a mere stat update, especially when other locks are already present). - Optionally have systat(1) display not only "total free mbufs" but also "total free mbufs per CPU pool." - Fix minor length-fetching issues in netstat(1) related to recently re-enabled option to read mbuf stats from a core file. - Move reference counters at least for mbuf clusters into an unused portion of the cluster itself, to save space and need to allocate a counter. - Look into introducing resource freeing possibly from a kproc.
Reviewed by (in parts): jlemon, jake, silby, terry Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha) Preliminary performance measurements: jlemon (and me, obviously) URL: http://people.freebsd.org/~bmilekic/mb_alloc/
|
#
78178 |
|
13-Jun-2001 |
ume |
fix recursive mtx_lock() call.
Submitted by: mjacob
|
#
78103 |
|
11-Jun-2001 |
ume |
Nuke wrongly introduced experimental stuff during KAME merge.
Following changed was made by previous commit:
- add a pointer to struct mauxtag. two integer was too restrictive. - add m_aux_{add,find}2. - make sure to nuke mbuf pointed to m_aux.
|
#
78064 |
|
11-Jun-2001 |
ume |
Sync with recent KAME. This work was based on kame-20010528-freebsd43-snap.tgz and some critical problem after the snap was out were fixed. There are many many changes since last KAME merge.
TODO: - The definitions of SADB_* in sys/net/pfkeyv2.h are still different from RFC2407/IANA assignment because of binary compatibility issue. It should be fixed under 5-CURRENT. - ip6po_m member of struct ip6_pktopts is no longer used. But, it is still there because of binary compatibility issue. It should be removed under 5-CURRENT.
Reviewed by: itojun Obtained from: KAME MFC after: 3 weeks
|
#
76166 |
|
01-May-2001 |
markm |
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in other "system" header files.
Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files.
Sort sys/*.h includes where possible in affected files.
OK'ed by: bde (with reservations)
|
#
75686 |
|
18-Apr-2001 |
bmilekic |
Fix inconsistency in setup of kernel_map: we need to make sure that we also reserve _adequate_ space for the mb_map submap; i.e. we need space for nmbclusters, nmbufs, _and_ nmbcnt. Furthermore, we need to rounddown, and not roundup, so that we are consistent.
Pointed out by: bde
|
#
75216 |
|
05-Apr-2001 |
bmilekic |
Various style fixes. Also place the macros under #ifdef _KERNEL. Equally hide the internal structures such as the freelist structs which include condition variables.
Reviewed by: bde Mostly suggested by: bde
|
#
75112 |
|
03-Apr-2001 |
bmilekic |
- Change the msleep()s to condition variables. The mbuf and mcluster free lists now each "own" a condition variable, m_starved.
- Clean up minor indentention issues in sys/mbuf.h caused by previous commit.
|
#
75105 |
|
03-Apr-2001 |
alfred |
Use only one mutex for the entire mbuf subsystem.
Don't use atomic operations for the stats updating, instead protect the counts with the mbuf mutex. Most twiddling of the stats was done right before or after releasing a mutex. By doing this we reduce the number of locked ops needed as well as allow a sysctl to gain a consitant view of the entire stats structure.
In the future...
This will allow us to chain common mbuf operations that would normally need to aquire/release 2 or 3 of the locks to build an mbuf with a cluster or external data attached into a single op requiring only one lock.
Simplify the per-cpu locks that are planned.
There's also some if (1) code that should check if the "how" operation specifies blocking/non-blocking behavior, we _could_ make it so that we hold onto the mutex through calls into kmem_alloc when non-blocking requests are made, but for safety reasons we currently drop and reaquire the mutex around the calls.
Also, note that calling kmem_alloc is rare and only happens during a shortage so drop/re-getting the mutex will not be a common occurance.
Remove some #define's that seemed to obfuscate the code to me.
Remove an extranious comment.
Remove an XXX, including mutex.h isn't a crime.
Reviewed by: bmilekic
|
#
74914 |
|
28-Mar-2001 |
jhb |
Catch up to header include changes: - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
|
#
74764 |
|
24-Mar-2001 |
bmilekic |
Move the atomic() mbstat.m_drops incrementing to the MGET(HDR) and MCLGET macros in order to avoid incrementing the drop count twice. Otherwise, in some cases, we may increment m_drops once in m_mballoc() for example, and increment it again in m_mballoc_wait() if the wait fails.
|
#
72556 |
|
17-Feb-2001 |
bde |
Fixed unsorting of prototypes in previous commit. Fixed older unsorting.
|
#
72473 |
|
14-Feb-2001 |
bmilekic |
Implement m_getm() which will perform an "all or nothing" mbuf + cluster allocation, as required.
If m_getm() receives NULL as a first argument, then it allocates `len' (second argument) bytes worth of mbufs + clusters and returns the chain only if it was able to allocate everything. If the first argument is non-NULL, then it should be an existing mbuf chain (e.g. pre-allocated mbuf sitting on a ring, on some list, etc.) and so it will allocate `len' bytes worth of clusters and mbufs, as needed, and append them to the tail of the passed in chain, only if it was able to allocate everything requested.
If allocation fails, only what was allocated by the routine will be freed, and NULL will be returned.
Also, get rid of existing m_getm() in netncp code and replace calls to it to calls to this new generic code.
Heavily Reviewed by: bp
|
#
72356 |
|
11-Feb-2001 |
bmilekic |
Long awaited style fixup in mbuf code. Get rid of K&R style prototyping and function argument declarations. Make sure that functions that are supposed to return a pointer return NULL in case of failure. Don't cast NULL. Finally, get rid of annoying `register' uses.
|
#
72200 |
|
09-Feb-2001 |
bmilekic |
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case.
Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
|
#
71302 |
|
20-Jan-2001 |
bmilekic |
When short of mbufs or mbuf clusters, we sleep on appropriate "counters." The counters are incremented when a thread goes to sleep and decremented either when a thread is woken up by another thread or when the sleep times out. There existed a race where the sleep count could be decremented twice resulting in an eventual underflow. Move the decrementing of the "counters" to the thread initiating the sleep and thus remedy the problem.
|
#
70254 |
|
21-Dec-2000 |
bmilekic |
* Rename M_WAIT mbuf subsystem flag to M_TRYWAIT. This is because calls with M_WAIT (now M_TRYWAIT) may not wait forever when nothing is available for allocation, and may end up returning NULL. Hopefully we now communicate more of the right thing to developers and make it very clear that it's necessary to check whether calls with M_(TRY)WAIT also resulted in a failed allocation. M_TRYWAIT basically means "try harder, block if necessary, but don't necessarily wait forever." The time spent blocking is tunable with the kern.ipc.mbuf_wait sysctl. M_WAIT is now deprecated but still defined for the next little while.
* Fix a typo in a comment in mbuf.h
* Fix some code that was actually passing the mbuf subsystem's M_WAIT to malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the value of the M_WAIT flag, this could have became a big problem.
|
#
69959 |
|
13-Dec-2000 |
bmilekic |
Eliminate a race in MEXTFREE(). The reference counter decrement and test was not atomic. We now make sure that we free the ext buf if the reference count is about to reach 0 but also make sure that nobody else has done it before us.
While I'm here, change refcnt to u_int (from long). This fixes a compiler warning regarding use of atomic_cmpset_long on i386.
Submitted by: jasone Reviewed by: jlemon, jake
|
#
68656 |
|
13-Nov-2000 |
bmilekic |
Change the ext_type type from short to int, since it doesn't cost us anything and it's likely to be faster on alphas.
Also, add EXT_MOD_TYPE for modules that want to add their own ext_type and are not network drivers (so they don't use EXT_NET_DRV).
|
#
68622 |
|
11-Nov-2000 |
bmilekic |
Add new M_RDONLY flag, which can be set during setup (MEXTADD, for example), and which indicates that the ext_buf is to be marked READ-ONLY.
Also introduce M_WRITABLE() macro, which will return true if: * M_RDONLY is _not_ set AND: * either mbuf has no ext_buf attached OR it has an ext_buf attached but the ref count is NOT above 1.
sf_bufs (sendfile) are marked M_RDONLY.
Now code determining whether an mbuf's data area is "shared" or not can be made to use this instead of doing its own (often incorrect) thing.
Submitted by: bmilekic, dwmalone, and Ian Dowse Reviewed by: dwmalone, jlemon
|
#
67365 |
|
20-Oct-2000 |
jhb |
Catch up to moving headers: - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
|
#
67168 |
|
15-Oct-2000 |
bmilekic |
Correct check for NULL in MEXT_INIT_REF() which should be checking whether mbuf->m_ext.ref_cnt is NULL, and not whether mbuf is. Also, remove spaces before "mbtypes" in MGET and MGETHDR macros.
Pointed out by: dwmalone
|
#
67146 |
|
15-Oct-2000 |
bmilekic |
While I'm here:
Small change (remove tab in one of the MEXT* macros) - probably slipped through (accidently?) in dwmalone's KASSERT() addition (rev 1.58).
|
#
67026 |
|
12-Oct-2000 |
ru |
Backout my wrong attempt to fix the compilation warning in ip_input.c and instead reapply the revision 1.49 of mbuf.h, i.e.
Fixed regression of the type of the `header' member of struct pkthdr from `void *' to caddr_t in rev.1.51. This mainly caused an annoying warning for compiling ip_input.c.
Requested by: bde
|
#
66815 |
|
08-Oct-2000 |
dwmalone |
KASSERT that mbuf external reference counts are > 0 before we remove a reference. (Agreed to by Bosko some time ago).
|
#
66569 |
|
03-Oct-2000 |
bmilekic |
Fix a problem with MCHTYPE macro's use of atomic(). Basically, the reason most people haven't seen this is most likely related to the low usage of MCHTYPE.
Pointed out and suggested a fix by: Boris Popov (bp) - thanks!
|
#
66475 |
|
30-Sep-2000 |
bmilekic |
Big mbuf subsystem diff #1: incorporate mutexes and fix things up somewhat to accomodate the changes.
Here's a list of things that have changed (I may have left out a few); for a relatively complete list, see http://people.freebsd.org/~bmilekic/mtx_journal
* Remove old (once useful) mcluster code for MCLBYTES > PAGE_SIZE which nobody uses anymore. It was great while it lasted, but now we're moving onto bigger and better things (Approved by: wollman).
* Practically re-wrote the allocation macros in sys/sys/mbuf.h to accomodate new allocations which grab the necessary lock.
* Make sure that necessary mbstat variables are manipulated with corresponding atomic() routines.
* Changed the "wait" routines, cleaned it up, made one routine that does the job.
* Generalized MWAKEUP() macro. Got rid of m_retry and m_retryhdr, as they are now included in the generalized "wait" routines.
* Sleep routines now use msleep().
* Free lists have locks.
* etc... probably other stuff I'm missing...
Things to look out for and work on later:
* find a better way to (dynamically) adjust EXT_COUNTERS
* move necessity to recurse on a lock from drain routines by providing lock-free lower-level version of MFREE() (and possibly m_free()?).
* checkout include of mutex.h in sys/sys/mbuf.h - probably violating general philosophy here.
The code has been reviewed quite a bit, but problems may arise... please, don't panic! Send me Emails: bmilekic@freebsd.org
Reviewed by: jlemon, cp, alfred, others?
|
#
64856 |
|
19-Aug-2000 |
dwmalone |
A slight restyling of the previous fix and make the way the reference count is initialised to zero to be more kosher.
Reviewed by: Bosko Milekic <bmilekic@technokratis.com> Spotted by: jdp and Jake Burkholder <jburkhol@home.com> respectively
|
#
64855 |
|
19-Aug-2000 |
jdp |
Fix logic error which caused a page fault in kernel mode immediately on boot up.
Submitted by: Bosko Milekic <bmilekic@technokratis.com>
|
#
64837 |
|
19-Aug-2000 |
dwmalone |
Replace the mbuf external reference counting code with something that should be better.
The old code counted references to mbuf clusters by using the offset of the cluster from the start of memory allocated for mbufs and clusters as an index into an array of chars, which did the reference counting. If the external storage was not a cluster then reference counting had to be done by the code using that external storage.
NetBSD's system of linked lists of mbufs was cosidered, but Alfred felt it would have locking issues when the kernel was made more SMP friendly.
The system implimented uses a pool of unions to track external storage. The union contains an int for counting the references and a pointer for forming a free list. The reference counts are incremented and decremented atomically and so should be SMP friendly. This system can track reference counts for any sort of external storage.
Access to the reference counting stuff is now through macros defined in mbuf.h, so it should be easier to make changes to the system in the future.
The possibility of storing the reference count in one of the referencing mbufs was considered, but was rejected 'cos it would often leave extra mbufs allocated. Storing the reference count in the cluster was also considered, but because the external storage may not be a cluster this isn't an option.
The size of the pool of reference counters is available in the stats provided by "netstat -m".
PR: 19866 Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: alfred (glanced at by others on -net)
|
#
63203 |
|
15-Jul-2000 |
alfred |
Make mbstat.m_mtypes seperate and viewable via sysctl, also expand the size from short to ulong
Submitted by: Ian Dowse <iedowse@maths.tcd.ie> PR: kern/19809
|
#
62587 |
|
04-Jul-2000 |
itojun |
sync with kame tree as of july00. tons of bug fixes/improvements.
API changes: - additional IPv6 ioctls - IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8). (also syntax change)
|
#
61506 |
|
10-Jun-2000 |
jlemon |
Add KASSERT() to mbuf free routines in order to allow developers to catch cases where the mbuf has already been freed. Submitted by: David Malone <dwmalone@maths.tcd.ie> PR: kern/18471
|
#
61214 |
|
03-Jun-2000 |
bde |
Fixed regression of the type of the `header' member of struct pkthdr from `void *' to caddr_t in rev.1.40. This mainly caused an annoying warning for compiling ip_input.c.
|
#
59793 |
|
30-Apr-2000 |
green |
For the M_PREPEND macro, remove an initial mbuf NULL check I added. It was added accidentally, and although not terrible, it would improperly hide the bug of calling M_PREPEND with a NULL mbuf argument.
Submitted by: jlemon (ISTR)
|
#
59382 |
|
18-Apr-2000 |
peter |
Don't panic in M_PREPEND() if m_prepend() fails and frees the mbuf chain.
Reviewed by: jlemon
|
#
58698 |
|
27-Mar-2000 |
jlemon |
Add support for offloading IP/TCP/UDP checksums to NIC hardware which supports them.
|
#
58076 |
|
14-Mar-2000 |
archie |
Have MGETHDR() always initialize m->m_pkthdr.rcvif to NULL. In the past, not doing this has caused several hard to find networking bugs, and the minor slowdown is deemed worthwhile.
Reviewed by: wollman
|
#
56261 |
|
18-Jan-2000 |
msmith |
Reference machine/param.h rather than the nonexistent machine/machparam.h in a comment
PR: kern/11178, kern/16128
|
#
55778 |
|
10-Jan-2000 |
archie |
Add a comment to hopefully prevent more bugs like kern/8596.
|
#
55205 |
|
29-Dec-1999 |
peter |
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
|
#
54798 |
|
18-Dec-1999 |
green |
I've been style(9)izing mbuf.h and making the macros more resilient with guidance from EE. This is as far as I'm going without using inline functions.
Reviewed by: eivind
|
#
54781 |
|
18-Dec-1999 |
green |
I've been Bruceified! As penance, I've fixed my error (improper ordering, moving #ifdefs to the non-historically-correct place, indentation bugs), and I've also completely restyle(9)d mbuf.h. There shouldn't be any KNF issues with it anymore, nor should there be any internal discrepencies. (Oh, I also fixed a small bug, but it was benign. The spl was not released in MCLALLOC if M_NOWAIT and there were no free mclusters.)
Not objected to by: bde
|
#
54584 |
|
14-Dec-1999 |
green |
Bug fix: The variables "m_mclalloc_wid" and "m_mballoc_wid" were not in the proper place. They should have been in uipc_mbuf.c and have been global, not in mbuf.h and local per each file that uses mbuf.h.
Sorta bug fix: In mbuf.h, the definitions of various things for KERNEL and not KERNEL cases were very screwy. This fixes all of that which I could find.
|
#
54478 |
|
12-Dec-1999 |
green |
This is Bosko Milekic's mbuf allocation waiting code. Basically, this means that running out of mbuf space isn't a panic anymore, and code which runs out of network memory will sleep to wait for it.
Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: green, wollman
|
#
54002 |
|
01-Dec-1999 |
archie |
The functions m_copym() and m_copypacket() return read-only copies, because in the case of mbuf clusters they only increment the reference count rather than actually copying the data.
Add comments to this effect, and add a new routine called m_dup() that returns a real, writable copy of an mbuf chain.
This is preliminary work required for implementing 'ipfw tee'.
Reviewed by: julian
|
#
53321 |
|
17-Nov-1999 |
julian |
fix up a whitespace screwup I made.
|
#
52904 |
|
05-Nov-1999 |
shin |
KAME related header files additions and merges. (only those which don't affect c source files so much)
Reviewed by: cvs-committers Obtained from: KAME project
|
#
52756 |
|
01-Nov-1999 |
phk |
New function: m_print(struct mbuf *); hexdumps a mbuf.
|
#
52501 |
|
25-Oct-1999 |
julian |
Abstract out some functionality into some more Macro's and eliminate duplicate code. Reviwed by: Archie Cobbs <archie@freebsd.org>
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
42779 |
|
18-Jan-1999 |
fenner |
Get rid of MT_RTABLE; multicast routing no longer uses it.
|
#
40931 |
|
05-Nov-1998 |
dg |
Implemented zero-copy TCP/IP extensions via sendfile(2) - send a file to a stream socket. sendfile(2) is similar to implementations in HP-UX, Linux, and other systems, but the API is more extensive and addresses many of the complaints that the Apache Group and others have had with those other implementations. Thanks to Marc Slemko of the Apache Group for helping me work out the best API for this. Anyway, this has the "net" result of speeding up sends of files over TCP/IP sockets by about 10X (that is to say, uses 1/10th of the CPU cycles) when compared to a traditional read/write loop.
|
#
38513 |
|
24-Aug-1998 |
dfr |
Re-implement tcp and ip fragment reassembly to not store pointers in the ip header which can't work on alpha since pointers are too big.
Reviewed by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
|
#
38482 |
|
23-Aug-1998 |
wollman |
Yow! Completely change the way socket options are handled, eliminating another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners.
|
#
37653 |
|
15-Jul-1998 |
bde |
Cast pointers to [u]intptr_t instead of to [unsigned] long.
|
#
32037 |
|
27-Dec-1997 |
bde |
Unspammed nested include of <sys/malloc.h>. <sys/mbuf.h> hasn't really used any features from <sys/malloc.h> since it was "blasted from the past" in rev.1.15, and most .c files did not depend on the namespace pollution (others have been fixed). The mbuf allocation control values M_DONTWAIT and M_WAIT were just defined in terms of the malloc control values M_NOWAIT and M_WAITOK. The mbuf values are now defined directly.
|
#
30354 |
|
12-Oct-1997 |
phk |
Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them.
A couple of finer points by: bde
|
#
30282 |
|
10-Oct-1997 |
phk |
Remove a bunch of unused malloc types. A couple of potential bogons flagged. Various prototypes changed.
|
#
30278 |
|
10-Oct-1997 |
phk |
Make malloc more extensible. The malloc type is now a pointer to the struct kmemstats that describes the type.
This allows subsystems to declare their malloc types locally and <sys/malloc.h> doesn't need tweaked everytime somebody gets an idea. You can even have a type local to a lkm...
I don't know if we really need the longdesc, comments welcome.
TODO: There is a single nit in ext2fs, that will be fixed later, and I intend to remove all unused malloc types and distribute the rest closer to their use.
|
#
28270 |
|
16-Aug-1997 |
wollman |
Fix all areas of the system (or at least all those in LINT) to avoid storing socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family.
|
#
23083 |
|
24-Feb-1997 |
wollman |
Add new kern.ipc MIB branch constants and mbuf stats.
|
#
22975 |
|
22-Feb-1997 |
peter |
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not ready for it yet.
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
|
#
17673 |
|
19-Aug-1996 |
wollman |
Add a protocol-specific mbuf flag.
|
#
17663 |
|
19-Aug-1996 |
julian |
fix handling of external objects referenced by mbufs somehow this got broken between 4.3 tahoe and here, though I've been using these fixes for over a year here..
|
#
15722 |
|
10-May-1996 |
wollman |
Allocate mbufs from a separate submap so that NMBCLUSTERS works as expected.
|
#
15689 |
|
08-May-1996 |
wollman |
Our new-old mbugf allocator. This is actually something of a blast from the past, since it returns to the old system of allocating mbufs out of a private area rather than using the kernel malloc(). While this may seem like a backwards step to some, the new allocator is some 20% faster than the old one and has much better caching properties.
Written by: John Wroclawski <jtw@lcs.mit.edu>
|
#
14491 |
|
11-Mar-1996 |
hsu |
Merge in Lite2: clean up casts for architectures where the size of addresses are bigger than the size of ints add function prototypes reorder some fields Did not add prototype for m_reclaim(). It's only used in kern/uipc_mbuf.c and is declared static there. Reviewed by: davidg & bde
|
#
13765 |
|
30-Jan-1996 |
mpp |
Fix a bunch of spelling errors in the comment fields of a bunch of system include files.
|
#
12819 |
|
14-Dec-1995 |
phk |
A Major staticize sweep. Generates a couple of warnings that I'll deal with later. A number of unused vars removed. A number of unused procs removed or #ifdefed.
|
#
12453 |
|
21-Nov-1995 |
bde |
Completed function declarations and/or added prototypes.
|
#
9759 |
|
29-Jul-1995 |
bde |
Eliminate sloppy common-style declarations. There should be none left for the LINT configuation.
|
#
4466 |
|
14-Nov-1994 |
bde |
Declare a complete prototype for the function pointer *ext_free and the function m_devget.
Uniformize idempotency ifdef.
|
#
4130 |
|
03-Nov-1994 |
dg |
Backed out mbuf performance improvement. mbufs are allocated with various different types, and with the 'local cache', what is freed isn't necessarily what was originally malloced. This screws malloc's statistics and type allocation limits, resulting eventually in a deadlock when one of the limits is bogusly reached. Recent performance tests on a Pentium machine indicate no improvement with this optimization anyway (this is something to be looked at further).
|
#
3316 |
|
02-Oct-1994 |
dg |
Add back and correct declaration of m_copyback()
|
#
3304 |
|
02-Oct-1994 |
phk |
Prototypes, prototypes and even more prototypes. Not quite done yet, but getting closer all the time.
|
#
2197 |
|
21-Aug-1994 |
paul |
Another typo by me Reviewed by: Submitted by:
|
#
2165 |
|
21-Aug-1994 |
paul |
Made them all idempotent. Reviewed by: Submitted by:
|
#
1892 |
|
06-Aug-1994 |
dg |
Implemented "fast" mbuf macros. a small number of mbufs are cached in a linked list for fast allocation/free. Improves TCP performance by about 20%.
Submitted by: John Dyson
|
#
1817 |
|
02-Aug-1994 |
dg |
Added $Id$
|
#
1542 |
|
24-May-1994 |
rgrimes |
This commit was generated by cvs2svn to compensate for changes in r1541, which included commits to RCS files with non-trunk default branches.
|
#
1541 |
|
24-May-1994 |
rgrimes |
BSD 4.4 Lite Kernel Sources
|