Re: Porting OpenBSD MPLS to FreeBSD

From: Andrey V. Elsukov <>
Date: Fri, 10 Dec 2021 08:46:51 UTC
08.12.2021 21:01, Lutz Donnerhacke пишет:
> On Wed, Dec 08, 2021 at 11:08:38AM +0300, Lev Serebryakov wrote:
>> On 07.12.2021 17:28, Lutz Donnerhacke wrote:
>>> I do use netgraph for carrier-grade stuff.
>>> Yes, ng_bridge was limited, but this is fixed.
>>   Doesn't it take separate lock for each packet passed though hook? I'm sure, it was true some time ago...
> It's a read lock for each packet on each, which can be shared by CPUs.
> I'm not aware that there are a major perfomace penalty, so I'd assume the
> lock is lightweight.


from the previous experience, when we had rwlock on fast path in the 
network stack - it was limited from 500Kpps to 2-4Mpps rate. It depends 
on number of CPU cores and NIC queues.

Using rwlock on high pps rate leads to high lock contention. So, this is 
just personal perception and experience what we call carrier-grade stuff.

I also think it is better to make MPLS implementation independent from 
netgraph. At least until it become lockless.

WBR, Andrey V. Elsukov