Commit Graph

80 Commits

Author SHA1 Message Date
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Gleb Smirnoff
674d86bf91 Node constructor methods are supposed to be called in syscall
context always. Convert nodes to consistently use M_WAITOK flag
for memory allocation.

Reviewed by:	julian
2011-04-18 09:12:27 +00:00
Alexander Motin
39228864fd Remove some more alignment constraints. 2010-03-31 22:47:55 +00:00
Alexander Motin
d6b013b537 Make ng_ppp fulfill upper protocol stack layers alignment requirements
on platforms with strict alignment constraints.
This fixes kernel panics on arm and probably other architectures.

PR:		sparc64/80410
2010-03-31 20:37:44 +00:00
Alexander Motin
aa559f63d1 Remove strict limitation on minimal multilink MRRU. RFC claims that MRRU
of 1500 must be supported, but allows smaller values to be negotiated.
Enforce specified MRRU for outgoing frames.

MFC after:	2 weeks
2009-01-18 12:03:43 +00:00
Dag-Erling Smørgrav
1ede983cc9 Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after:	3 months
2008-10-23 15:53:51 +00:00
Alexander Motin
b4d0be220a Do not use bcmp() to compare two bytes with constants. 2008-02-06 20:37:34 +00:00
Alexander Motin
5716b3f192 Improve multilink receive performance by netgraph item reuse. 2008-01-26 22:42:47 +00:00
Alexander Motin
f9ec69904b Improve multilink xmit performance by netgraph item reuse. 2008-01-26 22:41:14 +00:00
Alexander Motin
93caf2e299 Improve multilink receive performance with fragment headers preallocation. 2008-01-26 22:39:05 +00:00
Alexander Motin
9c10d11388 Fix bundle xmit octets stats for packet-split operation mode. 2008-01-23 11:47:09 +00:00
Alexander Motin
6d67c50b39 Fix typo which brokes VJ decompression
when VJC negotiated in only one direction.

Approved by:	re (bmah), glebius (mentor)
2007-09-15 16:55:44 +00:00
Alexander Motin
d6fe462ac1 Add 64bit statistic counters to the ng_ppp node.
64bit counters are needed to simplify traffic accounting and
reduce system load at the big PPP concentrators.

Approved by:	re (rwatson), glebius (mentor)
2007-08-01 20:49:35 +00:00
Alexander Motin
e89c150775 This patch improves fine-grained locking for the ng_ppp node.
Till now node's transmit path was completely unprotected
and so wasn't thread safe in multilink mode. It's receive path was
declared as WRITER as the simpliest protection method but it
reduces performance when compression or encryption enabled.

Approved by:	re (rwatson), glebius (mentor)
2007-08-01 20:38:37 +00:00
Alexander Motin
c35e19c430 No need to update link queue stats when round-robin algorithm enabled.
Approved by:	glebius (mentor)
2007-06-04 13:50:09 +00:00
Alexander Motin
e07c5170e1 Added m_tag_copy_chain() call to copy original outgoing packet tags to all of
it's fragments.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-20 08:44:40 +00:00
Alexander Motin
ccffcb5147 Optimized packet distribution plan for the equal links case. Do not
split packet on fragments smaller then MP_MIN_FRAG_LEN to reduce total
overhead.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-20 08:42:08 +00:00
Alexander Motin
8e8f114e62 - Changed sequence numbers processing to avoid incorrect timeout waiting
when one of links is inactive and have stale sequence number. To avoid
this sequence numbers of all links are getting updated on every
successful packet reassembling.
- ng_ppp_bump_mseq function created to simplify code.
- ng_ppp_frag_drop function separated from ng_ppp_frag_process to
simplify code.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-20 08:38:18 +00:00
Alexander Motin
fd58342c26 - Fixed mistakes in latency and xmitBytes calculation math
which lead to ineffective multilink packet distribution plans.
- Changed bytesInQueue calculation math to have more precise information
about links utilization.
- Taken rough account of the link overhead. Better way to do it could be to
get exact overhead from user-level, but I have not done it to keep
binary compatibility.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-20 08:22:57 +00:00
Gleb Smirnoff
39c14742d9 - Create ng_ppp_bypass() function, that prepares a packet
with bypass header, to send it out to userland.
- Use ng_ppp_bypass() in ng_ppp_proto_recv().
- Use ng_ppp_bypass() in ng_ppp_comp_recv() and in
  ng_ppp_crypt_recv() if compression or encryption is
  disabled, respectively.
- Any LCP packet goes directly to ng_ppp_bypass(), instead
  of passing through PPP stack.
- Any non-LCP packet on disabled link is discarded. This
  is behavior defined in RFC.

Submitted by:	Alexander Motin <mav alkar.net>
2007-01-25 21:16:50 +00:00
Matt Jacob
33eb7cb0a9 A less draconian fix to the build. 2007-01-18 19:41:39 +00:00
David E. O'Brien
da1fa91ac0 Temporarily comment out the KASSERT that broke the kernel build. 2007-01-18 18:53:13 +00:00
Gleb Smirnoff
164b576e96 Revise the ng_ppp(4) node, so that code flow is more clear. All non-link
hooks get their per hook rcvdata methods, and all functions are organized
corresponding to protocol stack model.

Submitted by:	Alexander Motin <mav alkar.net>
Reviewed by:	archie, julian
2007-01-18 13:55:21 +00:00
Gleb Smirnoff
ccb07cc3db Before this commit, if the compression is enabled the, ng_ppp(4)
node would send every outgoing frame to the "compress" hook.
Packets received on the "compress" hook were expected to be
compressed and PROT_COMPD tag was put on them unconditionally.

After this commit an alternative compression mode can be set.
In this mode the node doesn't put the PROT_COMPD, the compressor
should put it itself. This is important for such kind of
compressors, that can submit uncompressed frames.

Before this commit, if the decompression is enabled, the ng_ppp(4)
node would send and incoming frame to the "decompress" hook
only if it has the PROT_COMPD proto tag on it.

After this commit an alternative decompression mode can be set.
In this mode the node sends all the incoming packets to the
decompression hook. This is important for such kind of compressors
that need uncompressed packets too, to keep their library in sync.

These new features will be used in new version of mpd4, and in new
compressor nodes.

Submitted by:	Alexander Motin <mav alkar.net>
2006-12-28 13:21:54 +00:00
Gleb Smirnoff
d0784b4740 Refactor places where ng_package_data() failed.
Suggested & reviewed by:	archie
2005-05-16 19:12:57 +00:00
Gleb Smirnoff
74eafa88cf - Catch up with new interface to ng_package_data().
- Handle errors from ng_package_data().
2005-05-16 17:08:53 +00:00
Gleb Smirnoff
dc2f4d7f5f Utilize callout_pending() macro 2005-01-11 12:20:28 +00:00
Warner Losh
c398230b64 /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
Gleb Smirnoff
9d952bd3fd - Use ng_callout() instead of timeout(9).
- Do not put/remove node references, since this no longer
  needed.
- Remove timerActive flag, use callout flags.
- Schedule next callout after doing current one.

Reviewed by:	archie
Approved by:	julian (mentor)
2004-12-06 19:49:55 +00:00
Archie Cobbs
2adb8d6ab0 Disable protocol field compression on the inner PPP frame when also doing
normal PPP compression, as a workaround for certain (arguably) broken
Linux PPP implementations that can't handle this particular case.

MFC after:	1 week
2004-11-27 20:29:00 +00:00
Bjoern A. Zeeb
49728ffc2f Do not change link[n].conf.latency for internal usage but have
link[n].latency calculated from user supplied value.
This prevents repeated NGM_PPP_SET_CONFIG/NGM_PPP_GET_CONFIG
from failing because of link[n].conf.latency being out of range.

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:34:55 +00:00
Gleb Smirnoff
8250de8330 Use qsort_r() instead of qsort() when sorting links by latency
This helps us to remove a global variable and a mutex protecting it.

Reviewed by:	rwatson
Approved by:	julian (mentor)
2004-07-16 00:07:44 +00:00
Robert Watson
489264ddae Add ng_ppp_latencies_mtx, a global mutex to protect the latency list.
Note that the table is a hack, and so is this mutex.

Reviewed by:	glebius
2004-07-14 20:29:54 +00:00
Julian Elischer
3ca24c284d Having moved metadata usage to mbuf tags, remove code that supports
the old way of doing it.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-26 22:24:16 +00:00
Julian Elischer
f8aae7776f Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by:	Harti Brandt <harti@freebsd.org>
MFC after:	1 week
2004-05-29 00:51:19 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Archie Cobbs
2b2a8188b1 Fix a use-after-free bug that could cause multi-link fragment reassembly to
fail for a long time (until the incoming sequence numbers wrapped around).

Reported by:	Matthew Impett <mimpett@Glue.umd.edu>
MFC after:	3 days
2003-03-05 23:12:59 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Bosko Milekic
86fea6be59 o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}.
o Fix a bpf_compat issue where malloc() was defined to just call
  bpf_alloc() and pass the 'canwait' flag(s) along.  It's been changed
  to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT
  flag (and only one of those two).

Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
2002-12-19 22:58:27 +00:00
John Baldwin
8214d60e20 Use intptr_t to fix various sizeof(int) != sizeof(void *) warnings. 2002-11-08 21:13:18 +00:00
Julian Elischer
ed2836692f if you have taken the mbuf out of the message object, then if you pass
the object to someone else, you need to put the mbuf back into it first..
2002-06-09 07:28:35 +00:00
Archie Cobbs
f0184ff8e3 Fix GCC warnings caused by initializing a zero length array. In the process,
simply things a bit by getting rid of 'struct ng_parse_struct_info' which
was useless because it only contained one field.

MFC after:	2 weeks
2002-05-31 23:48:03 +00:00
Archie Cobbs
931c828ac5 Fix bugs where the ng_ppp node could transmit PPP frames whose length
exceeded the peer's configured MRU or MRRU.

MFC after:	1 week
2002-03-15 02:31:14 +00:00
Archie Cobbs
b5a60ddb7e Fix another bug in handling of multi-link sequence numbers.
MFC after:	1 week
2002-02-13 00:58:49 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Julian Elischer
9c8c302fd0 Fix some memory leaks
Add memory leak detection assitance.
2001-01-10 07:13:58 +00:00
Julian Elischer
30400f03aa Part 2 of the netgraph rewrite.
This is mostly cosmetic changes, (though I caught a bug or two while
makeing them)
Reviewed by:	archie@freebsd.org
2001-01-08 05:34:06 +00:00
Julian Elischer
069154d55f Rewrite of netgraph to start getting ready for SMP.
This version is functional and is aproaching solid..
notice I said APROACHING. There are many node types I cannot test
I have tested: echo hole ppp socket vjc iface tee bpf async tty
The rest compile and "Look" right.  More changes to follow.
DEBUGGING is enabled in this code to help if people have problems.
2001-01-06 00:46:47 +00:00
Julian Elischer
589f6ed8ce Divorce the kernel binary ABI version number from the message
format version number. (userland programs should not need to be
recompiled when the netgraph kernel internal ABI is changed.

Also fix modules that don;t handle the fact that a caller may not supply
a return message pointer. (benign at the moment because the calling code
checks, but that will change)
2000-12-18 20:03:32 +00:00