Commit Graph

20 Commits

Author SHA1 Message Date
ozaki-r 9161a49eaf Make bridge MPSAFE
- Introduce BRIDGE_MPSAFE
  - It's enabled only when NET_MPSAFE is defined
    in if.h or the kernel config
- Add iflist and rtlist mutex locks
  - Locking iflist is performance sensitive,
    so it's not used when !BRIDGE_MPSAFE
- Add bif object reference counting
  - It enables fine-grain locking for bridge member lists
    by allowing to not hold a lock during touching a bif
  - bridge_release_member is added to decrement the
    reference count
  - A condition variable is added to do bridge_delete_member
    gracefully
- Add if_bridgeif to ifnet
  - It's a shortcut to a bif object of a bridge member
  - It reduces a bif lookup cost and so lock contention on iflist
- Make bridgestp MPSAFE too
2014-07-14 02:34:36 +00:00
ozaki-r 5efefa8603 Remove unnecessary sc_softintr 2014-06-20 14:22:48 +00:00
ozaki-r cb4cb63151 Restructure ether_input and bridge_input
The network stack of NetBSD is well organized and
layered. A packet reception is processed from a
lower layer to an upper layer one by one. However,
ether_input and bridge_input are not structured so.
bridge_input is called inside ether_input.

The new structure replaces ifnet#if_input of a bridge
member with bridge_input when the member is attached.
So a packet goes straight on a packet reception via
a bridge, bridge_input => ether_input => ip_input.

The change is part of a patch of Lloyd Parkes submitted
in PR 48104. Unlike the patch, the change doesn't
intend to change the behavior of the packet processing.
Another patch will fix PR 48104.
2014-06-17 10:39:46 +00:00
ozaki-r 8743b7c5c8 Include pktqueue.h only if _KERNEL 2014-06-16 03:43:10 +00:00
ozaki-r ac758954c5 Use pktqueue for bridge forwarding queue and softint 2014-06-16 01:03:57 +00:00
drochner 0065310310 the address expire counter is just a time difference; it can turn
negative after the timer expired until the entry is deleted.
make it signed, so that we don't get output like
"00:1b:78:12:50:46 wm0 18446744073709551349 flags=0<>"
2012-08-23 12:06:32 +00:00
bouyer 1fd1b49685 Fix for if_start() and pfil_hook() being called from hardware interrupt
context (reported on various mailing-lists, and part of PR kern/41114,
causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used).
Defer bridge_forward() to a software interrupt; bridge_input() enqueues
mbufs to ifp->if_snd which is handled in bridge_forward().
2009-04-04 10:00:23 +00:00
mrg c30587badd Fix multiple problems:
* A sign extension error creating the bridge ID corrupted the
    priority (always making it the maximum).
    * Do not catch STP packets on an interface for which STP is not
    enabled -- it's a violation of the spec, and causes STP to fail on
    neighboring bridges.
    * An optimization to bstp_input() -- some information is already
    known when we call it.

contributed anonymously.
2009-01-18 10:28:55 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
dyoung 5493f188c7 KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous
parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.
2007-02-17 22:34:07 +00:00
elad 976bf6cfdd Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
2005-12-10 23:21:38 +00:00
seanb 262c8cc8a7 - Rearranged layout of struct bridge_iflist slightly to
make members naturally aligned.
- This saves 8 bytes worth of pad.
2005-06-28 20:09:44 +00:00
perry f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +00:00
jdc 7454db32b4 Add filter/no filter flag parameter to bridge_enqueue(). 2003-09-16 17:38:24 +00:00
itojun 91b11e1eba prototype must not have variable name 2003-07-08 07:13:50 +00:00
bouyer 4a3c894eef Fix 2 bugs:
- initialise stp when the bridge is turned up, without this stp will keep
  all interfaces disabled in a sequence like:
  brconfig bridge0 add if0 add if1 stp if0 stp if1 up
- s/BRDGSPRI/BRDGSIFPRIO in brconfig.c:cmd_ifpriority()

add a command (ifpathcost) to change the stp path cost of the STP path cost of
an interface. Display the interface path cost with the others STP parameters.
2003-03-19 10:34:33 +00:00
perseant 6b857c229e Add ipf packet-filtering option to if_bridge. The option is controlled at
compile-time by BRIDGE_IPF, and at runtime by brconfig with the {ipf,-ipf}
option on a per-bridge basis.

As a side-effect, add PFIL_HOOKS processing to if_bridge.
2003-02-15 00:46:30 +00:00
thorpej 460da35f85 Add support for building Ethernet bridges, based on Jason Wright's
bridge driver from OpenBSD, although the bridge code has been *heavily*
modified by me (the 802.1D code remains mostly unchanged from the
original).
2001-08-17 21:37:27 +00:00