summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2015-11-20Keep if_ref() private, if_get() is what you want to use before if_put().Martin Pieuchot
The thread detaching an interface will sleep until all references to this interface have been released. So we decided to only keep references for a short period of time. Keeping if_ref() private will hopefully help preserve this goal as long as it makes sense. Calling if_get()/if_put() in the same function also allows us to make use of static analysis tools (thanks jsg@!) to catch our errors. ok dlg@
2015-11-20Prefer if_get() over if_ref() when checking if the interface has beenMartin Pieuchot
destroyed during our sleep. No objection from the slackers.
2015-11-20sppp(4) is now only used for pppoe(4) which doesn't use framing, so removeStuart Henderson
support for sppp with framing, simplifying things. Remove unused ifdefs while there. "sppp will go away before it gets used for something else" dlg@
2015-11-20avoid a use after enqueue, which is like a use after free.David Gwynne
once you enqueue an mbuf, you no longer own it. therefore you cant read the length out of it. this reads the length first, then tries to enq it. also, call if_start instead of a bare call to the underlying start routine. ok mpi@ sthen@
2015-11-20i made a mistake. rename ifq_enq and ifq_deq to ifq_enqueue and ifq_dequeueDavid Gwynne
fixing it now before i regret it more.
2015-11-20Make use if_get() and get rid of rt_ifp.Martin Pieuchot
While here keep carp(4) bits under NCARP. Tested by and ok sthen@, ok visa@
2015-11-20fix prio KASSERT, it should be <= not <. ok dlg@Stuart Henderson
2015-11-20correctly indent a line to make the intent clearJonathan Gray
ok dlg@
2015-11-20dont needlessly clear IFF_OACTIVE.David Gwynne
only a driver sets or clears OACTIVE. clearing it without setting it is a waste of time.
2015-11-20dont play with IFF_OACTIVE needlessly.David Gwynne
only a driver sets or clears it, and trunk never sets it. therefore it never needs to clear it.
2015-11-20dont check for IFF_OACTIVEDavid Gwynne
only a driver sets or clears this flag. pppx never sets it, so it will never be set when it checks it.
2015-11-20dont check for OACTIVEDavid Gwynne
only a driver sets or clears this flag. gif never sets it, so it wont be set when it checks it.
2015-11-20if we deq m0, we should probably send it to bpf, not m.David Gwynne
found by and ok jsg@
2015-11-20shuffle struct ifqueue so in flight mbufs are protected by a mutex.David Gwynne
the code is refactored so the IFQ macros call newly implemented ifq functions. the ifq code is split so each discipline (priq and hfsc in our case) is an opaque set of operations that the common ifq code can call. the common code does the locking, accounting (ifq_len manipulation), and freeing of the mbuf if the disciplines enqueue function rejects it. theyre kind of like bufqs in the block layer with their fifo and nscan disciplines. the new api also supports atomic switching of disciplines at runtime. the hfsc setup in pf_ioctl.c has been tweaked to build a complete hfsc_if structure which it attaches to the send queue in a single operation, rather than attaching to the interface up front and building up a list of queues. the send queue is now mutexed, which raises the expectation that packets can be enqueued or purged on one cpu while another cpu is dequeueing them in a driver for transmission. a lot of drivers use IFQ_POLL to peek at an mbuf and attempt to fit it on the ring before committing to it with a later IFQ_DEQUEUE operation. if the mbuf gets freed in between the POLL and DEQUEUE operations, fireworks will ensue. to avoid this, the ifq api introduces ifq_deq_begin, ifq_deq_rollback, and ifq_deq_commit. ifq_deq_begin allows a driver to take the ifq mutex and get a reference to the mbuf they wish to try and tx. if there's space, they can ifq_deq_commit it to remove the mbuf and release the mutex. if there's no space, ifq_deq_rollback simply releases the mutex. this api was developed to make updating the drivers using IFQ_POLL easy, instead of having to do significant semantic changes to avoid POLL that we cannot test on all the hardware. the common code has been tested pretty hard, and all the driver modifications are straightforward except for de(4). if that breaks it can be dealt with later. ok mpi@ jmatthew@
2015-11-18Do not dereference rt_ifp to call if_rtrequest.Martin Pieuchot
This only happens under KERNEL_LOCK() so we know for sure that the interface attached to a route entry is valid.
2015-11-18Factorize the bits to check if a L2 route is connected, wether it isMartin Pieuchot
attached to a carp(4) or bridge(4) member, to not dereference rt_ifp directly. ok visa@
2015-11-18Revert previous workaround now that multipath route selection has beenMartin Pieuchot
fixed. ok sthen@, dlg@
2015-11-18Multipath selection should be done before caching the next hop.Martin Pieuchot
Fix a regression introduced by rtalloc(9) rewrite where only the first route of a multipath chain had a valid next hop and could be used. ok sthen@, dlg@
2015-11-17Unbreak next-hop caching on multipath setups.Martin Pieuchot
When multiple gateways are in use, the next-hop entrie might not be on the same interface. This is due to the fact that ARP entries are unique and attached to their cloning interface. Found the hard way by and ok dlg@
2015-11-15Add ifmedia definitions for 802.11n.Stefan Sperling
ok deraadt mpi phessler kettenis guenther
2015-11-14mutli -> multiMiod Vallat
2015-11-13Sore the index of the interface used for revarp instead of a pointer toMartin Pieuchot
its descriptor. Get rid of a if_ref(). ok dlg@
2015-11-12Allocate root tables on demand an free them like any other table.Martin Pieuchot
With this change we no longer waste some precious Kb for unused routing tables like the AF_MPLS one or those with rtableid != 0. This will also simplify the SRP dance during lookups.
2015-11-12Prefix flowid with ph_ and print it in m_print().Martin Pieuchot
ok dlg@
2015-11-11Remove an XXX that no longer makes sense, rt_ifp is now always the sameMartin Pieuchot
as rt_ifa->ifa_ifp.
2015-11-11Store the index of the lo0 interface instead of a pointer to itsMartin Pieuchot
descriptor. Allow to get rid of two if_ref() in the output paths. ok dlg@
2015-11-11replace the ifqueue used for the pp_cpq with an mbuf_queue.David Gwynne
2015-11-11use time_uptime instead of time_second.David Gwynne
this avoids wall clock jumps skewing the idle times.
2015-11-10Allocate ART table's heap independently from the structure and useMartin Pieuchot
pool(9) to not waste most of the memory allocated. This reduces the memory overhead of our ART routing table from 80M to 70M compared to the existing radix-tree when loading ~550K IPv4 routes. ART can now be used for huge tables without exhausting malloc(9)'s limit. claudio@ agrees with the direction, inputs from and ok dlg@
2015-11-10flush the send queue in start routines with IFQ_PURGE.David Gwynne
ok mpi@ uebayasi@
2015-11-10dont use IF_DROP when there was some arbitary problem sending a packet.David Gwynne
IF_DROP increments the drop counter on the send queue, it exists to indicate a drop on the send queue. if there was an error sending a packet be content incrementing if_oerrors. ok mpi@ uebayasi@
2015-11-09use the correct rdomain when sending gre(4) keepalive packets.Sebastian Benoit
bug found and fixed by Joonas Ruohonen, thanks ok claudio@ phessler@
2015-11-09Do not leave dangling pointers in the ART tree in case of memoryMartin Pieuchot
exhaustion. Reported by benno@ and found thanks to his bgpd(8) test setup.
2015-11-09Rewrite rtalloc(9) to consider RTF_GATEWAY entries without valid next-Martin Pieuchot
hop route as invalid. Previously when such entrie was returned by rtalloc(9) a second route lookup was done in rt_checkgate() very late in the journey of a packet. In other words a single rtalloc(9) call can now result in multiple route lookups if a RTF_GATEWAY entry is returned. This is a step towards always calling L2 output functions with valid destination information. Tested by various including jmc@, naddy@, Hrvoje Popovski
2015-11-09use IFQ_DEQUEUE to pull of the send queue.David Gwynne
2015-11-09kenjiro cho points out that requeue is hard to support on queueDavid Gwynne
disciplines while i was simply concerned with the safety of the mbuf, requeue is weird when it comes to how statistics are supposed to be handled and ultimately isnt worth it. this removes hfsc_requeue.
2015-11-07Use input handlers for bridge(4).Martin Pieuchot
This allows more flexible configurations with vlan(4) and bridge(4) on top of the same physical interface. In particular it allows to not feed VLAN tagget packets into a bridge(4). Fix regression reported by Armin Wolfermann on bugs@, ok dlg@
2015-11-07Don't try to be clever testing if a queue is full before callingMartin Pieuchot
if_enqueue(). As pointed by dlg@, IF_QFULL on works in the priq case. Prompted by a diff from uebayasi@ to export ifi_oqdrops, ok dlg@
2015-11-06Do not compile net/radix_mpath.c in ART-enabled kernels.Martin Pieuchot
In such kernels multipath routing support is independant from the data structure used to perform the binary lookup. Is is implemented as a singly-listed list of route entries. This is possible because a "struct rtentry" is no longer mapped 1:1 to a node in the tree.
2015-11-06Rename rt_mpath_next() into rtable_mpath_next() and provide anMartin Pieuchot
implementation for ART based on the singly-linked list of route entries.
2015-11-06Use a SLIST instead of a LIST for MPATH route entries with ART.Martin Pieuchot
2015-11-06In ART separate the MPATH delete case to properly recover if art_delete()Martin Pieuchot
does not find a matching node. This currently never happens because we always do a route lookup before calling rtable_delete(). Yes this is odd & due to the way multipath is implemented in the radix tree.
2015-11-06Do not use rt_ifp directly.Martin Pieuchot
ok claudio@
2015-11-06Do not use rt_ifp directly.Martin Pieuchot
ok rzalamena@
2015-11-06unbreak tree after src/sys/net/if_ppp.c r1.95.David Gwynne
i forgot to commit the change of the npqueue type in the header. noticed by benoit lecocq
2015-11-06replace sc_npqueue and sc_npqtail with a simple mbuf_list.David Gwynne
2015-11-05apply some knf.David Gwynne
ok many no objections from anyone
2015-11-04rtfree(9) accepts NULL pointers.Martin Pieuchot
2015-11-04Initialize the correct variable in ART's rtable_match().Martin Pieuchot
2015-11-04Some tweaks to build the rtable API and backends in userland.Martin Pieuchot
Needed by the regression tests.