Page MenuHomeFreeBSD

ip_mroute: rework ip_mroute
ClosedPublic

Authored by wma on May 20 2021, 8:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 16 2024, 11:13 AM
Unknown Object (File)
Feb 16 2024, 5:21 AM
Unknown Object (File)
Feb 16 2024, 5:21 AM
Unknown Object (File)
Feb 16 2024, 4:27 AM
Unknown Object (File)
Jan 14 2024, 5:49 AM
Unknown Object (File)
Jan 14 2024, 4:38 AM
Unknown Object (File)
Jan 4 2024, 7:24 PM
Unknown Object (File)
Nov 26 2023, 11:14 PM
Subscribers

Details

Summary
Changes:
1. add spinlock to bw_meter

If two contexts read and modify bw_meter values
it might happen that these are corrupted.
Guard only code fragments which do read-and-modify.
Context which only do "reads" are not done inside
spinlock block. The only sideffect that can happen is
an 1-p;acket outdated value reported back to userspace.

2. replace all locks with a single RWLOCK

Multiple locks caused a performance issue in routing
hot path, when two of them had to be taken. All locks
were replaced with single RWLOCK which makes the hot
path able to take only shared access to lock most of
the times.
All configuration routines have to take exclusive lock
(as it was done before) but these operation are very rare
compared to packet routing.

3. redesign MFC expire and UPCALL expire

Use generic kthread and cv_wait/cv_signal for deferring
work. Previously, upcalls could be sent from two contexts
which complicated the design. All upcall sending is now
done in a kthread which allows hot path to work more
efficient in some rare cases.

4. replace mutex-guarded linked list with lock free buf_ring

All message and data is now passed over lockless buf_ring.
This allowed to remove some heavy locking when linked
lists were used.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wma requested review of this revision.May 20 2021, 8:18 AM
sys/netinet/ip_mroute.c
2193

add bu free here

This revision is now accepted and ready to land.May 28 2021, 9:41 AM
This revision was automatically updated to reflect the committed changes.