Commit Graph

5 Commits

Author SHA1 Message Date
ozaki-r fc47734756 Tweak mutex_enter(softnet_lock) position
The previous code took locks the following order:
- LLE_WLOCKs
- mutex_enter(softnet_lock)
- LLE_WUNLOCKs
- mutex_exit(softnet_lock)

This fix moves mutex_enter(softnet_lock) before LLE_WLOCKs.
2015-09-28 07:55:26 +00:00
ozaki-r 30818f7132 Fix race condition on la_rt between lltable_free and other places touching la_rt
We have to touch la_rt always with holding softnet_lock. And we have to
use callout_halt with softnet_lock instead of callout_stop for
la_timer (arptimer) because arptimer holds softnet_lock inside it.

This fix may solve a kernel panic christos@ encountered.
2015-09-09 01:26:50 +00:00
pooka 1d2b607cca #if __NetBSD__ -> #if defined(__NetBSD__) 2015-08-31 12:57:45 +00:00
ozaki-r 8997ac8f09 Replace ARP cache (llinfo) with lltable/llentry
Highlights of the change are:
- Use llentry instead of llinfo to manage ARP caches
  - ARP specific data are stored in the hashed list
    of an interface instead of the global list (llinfo_arp)
- Fine-grain locking on llentry
- arptimer (callout) per ARP cache
  - the global timer callout with the big locks can be
    removed (though softnet_lock is still required for now)
- net.inet.arp.prune is now obsoleted
  - it was the interval of the global timer callout
- net.inet.arp.refresh is now obsoleted
  - it was a parameter that prevents expiration of active caches
  - Removed to simplify the timer logic, but we may be able to
    restore the feature if really needed

Proposed on tech-kern and tech-net.
2015-08-31 08:05:20 +00:00
ozaki-r 85e26631cc Import lltable/llentry from FreeBSD
lltable/llentry is new L2 nexthop cache data structures that
store caches in each interface (struct ifnet). It is imported
to replace the current ARP cache implementation that uses the
global list with the big kernel lock, and provide fine-grain
locking for cache operations. It is also planned to replace
NDP caches.

The code is based on FreeBSD's lltable/llentry as of r286629
and tweaked for NetBSD.
2015-08-31 07:56:58 +00:00