Porting OpenBSD MPLS to FreeBSD

2021-11-19 Thread Neel Chauhan

Hi freebsd-net@,

Long time no see. I've gotten a (Ports) commit bit since then.

I haven't been very active in TCP/IP hacking as of late, as more 
recently I've been more focused on GNOME packages and some GPU drivers.


Going back, I'm thinking about porting OpenBSD's MPLS to FreeBSD.

I have a two questions:

 * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off 
doing a from-scratch implementation based on netgraph?


 * Would some of the other committers here be willing to mentor/help me 
if needed?


Unlike my old IPFW patches which got nowhere (plus I no longer use 
IPFW), I feel this is more something that could be useful when running 
FreeBSD as a router, but hasn't really been done.


-Neel (nc@)



Re: Porting OpenBSD MPLS to FreeBSD

2021-11-19 Thread Lutz Donnerhacke
On Fri, Nov 19, 2021 at 11:17:42AM -0800, Neel Chauhan wrote:
>  * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off doing 
> a from-scratch implementation based on netgraph?

I'd prefer a netgraph approach, if possible.
It helps to concentrate on the important things.

>  * Would some of the other committers here be willing to mentor/help me if 
> needed?

For the netgraph part ...



Re: Porting OpenBSD MPLS to FreeBSD

2021-11-19 Thread Rodney W. Grimes
> Hi freebsd-net@,
> 
> Long time no see. I've gotten a (Ports) commit bit since then.
> 
> I haven't been very active in TCP/IP hacking as of late, as more 
> recently I've been more focused on GNOME packages and some GPU drivers.
> 
> Going back, I'm thinking about porting OpenBSD's MPLS to FreeBSD.

I have had similiar thoughts on and off over the years,
and one pretty solid "want" for this.

> 
> I have a two questions:
> 
>   * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off 
> doing a from-scratch implementation based on netgraph?

Feasible, yes, as to the better off part that probably depends on
who you ask.  MPLS is not that complicated to implement, so doing
it either way all depends on weither you want to deal with netgraph,
or the kernel network interface code.  Its also probably fairly trivial
to do both with a great deal of shared code.

> 
>   * Would some of the other committers here be willing to mentor/help me 
> if needed?

Yes.

> 
> Unlike my old IPFW patches which got nowhere (plus I no longer use 
> IPFW), I feel this is more something that could be useful when running 
> FreeBSD as a router, but hasn't really been done.

I can probably arrange a telco size beta tester too... unless
there interested has gone away, which I doubt.

> -Neel (nc@)

-- 
Rod Grimes rgri...@freebsd.org



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-04 Thread Alexander V. Chernikov



> On 19 Nov 2021, at 19:17, Neel Chauhan  wrote:
> 
> Hi freebsd-net@,
> 
> Long time no see. I've gotten a (Ports) commit bit since then.
> 
> I haven't been very active in TCP/IP hacking as of late, as more recently 
> I've been more focused on GNOME packages and some GPU drivers.
> 
> Going back, I'm thinking about porting OpenBSD's MPLS to FreeBSD.
> 
> I have a two questions:
> 
> * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off doing a 
> from-scratch implementation based on netgraph?
It depends. MPLS implementaiton can be splitted into multiple logical parts - 
dataplane (input, control, output, forward) and control plane (programming ip 
routes+mpls and mpls-only fowarding state). Some parts of the former can indeed 
be imported from OpenBSD. However, most of the control plane part have to be 
written from scratch. Finally, it may be desired to maintain an programming 
interface close to the one already implemented in major routing SW (frr, bird) 
- I guess that would be simpler to achieve with native, non-netgraph 
implementation.
> 
> * Would some of the other committers here be willing to mentor/help me if 
> needed?
I’d love to. Most of my the routing-related stack changes (modular lookup 
framework, nexthops, rtsock cleanups) were done to enable efficient 
kernel-based MPLS implementation.
> 
> Unlike my old IPFW patches which got nowhere (plus I no longer use IPFW), I 
> feel this is more something that could be useful when running FreeBSD as a 
> router, but hasn't really been done.
> 
> -Neel (nc@)
> 




Re: Porting OpenBSD MPLS to FreeBSD

2021-12-04 Thread Neel Chauhan

Hi Alexander,

On 2021-12-04 10:42, Alexander V. Chernikov wrote:
* Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off 
doing a from-scratch implementation based on netgraph?

It depends. MPLS implementaiton can be splitted into multiple logical
parts - dataplane (input, control, output, forward) and control plane
(programming ip routes+mpls and mpls-only fowarding state). Some parts
of the former can indeed be imported from OpenBSD. However, most of
the control plane part have to be written from scratch. Finally, it
may be desired to maintain an programming interface close to the one
already implemented in major routing SW (frr, bird) - I guess that
would be simpler to achieve with native, non-netgraph implementation.


Thanks for your description. I haven't started work yet, but I'd 
probably import the dataplane from OpenBSD where I can and do a new 
control plane, maybe that with a FRR/Bird-compatible API.


I wasn't too keen on using netgraph anyways, I felt it was unnecessary 
complexity.


If I were to work on this, would I be better off starting with the 
dataplane or control plane?


* Would some of the other committers here be willing to mentor/help me 
if needed?

I’d love to. Most of my the routing-related stack changes (modular
lookup framework, nexthops, rtsock cleanups) were done to enable
efficient kernel-based MPLS implementation.


Thanks!

-Neel (nc@)



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-05 Thread Alexander V. Chernikov



> On 5 Dec 2021, at 03:49, Neel Chauhan  wrote:
> 
> Hi Alexander,
> 
> On 2021-12-04 10:42, Alexander V. Chernikov wrote:
>>> * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off doing a 
>>> from-scratch implementation based on netgraph?
>> It depends. MPLS implementaiton can be splitted into multiple logical
>> parts - dataplane (input, control, output, forward) and control plane
>> (programming ip routes+mpls and mpls-only fowarding state). Some parts
>> of the former can indeed be imported from OpenBSD. However, most of
>> the control plane part have to be written from scratch. Finally, it
>> may be desired to maintain an programming interface close to the one
>> already implemented in major routing SW (frr, bird) - I guess that
>> would be simpler to achieve with native, non-netgraph implementation.
> 
> Thanks for your description. I haven't started work yet, but I'd probably 
> import the dataplane from OpenBSD where I can and do a new control plane, 
> maybe that with a FRR/Bird-compatible API.
> 
> I wasn't too keen on using netgraph anyways, I felt it was unnecessary 
> complexity.
> 
> If I were to work on this, would I be better off starting with the dataplane 
> or control plane?
I’d start with dataplane first - it’ll allow to get something simple actually 
working and establish the basic datastructures. With these in place it’ll be 
easier to do iterate w/ control plane implementation. 
> 
>>> * Would some of the other committers here be willing to mentor/help me if 
>>> needed?
>> I’d love to. Most of my the routing-related stack changes (modular
>> lookup framework, nexthops, rtsock cleanups) were done to enable
>> efficient kernel-based MPLS implementation.
> 
> Thanks!
> 
> -Neel (nc@)




Re: Porting OpenBSD MPLS to FreeBSD

2021-12-05 Thread Neel Chauhan
Hi Alexander,

On Sun, 2021-12-05 at 22:19 +, Alexander V. Chernikov wrote:
> > If I were to work on this, would I be better off starting with the
> > dataplane or control plane?
> I’d start with dataplane first - it’ll allow to get something simple
> actually working and establish the basic datastructures. With these
> in place it’ll be easier to do iterate w/ control plane
> implementation. 
> 

Thanks for your response!

I may start with copying over some of the dataplane from OpenBSD,
porting it, and then writing a new control plane.

-Neel (nc@)




Re: Porting OpenBSD MPLS to FreeBSD

2021-12-06 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Hi Alexander,
> 
> On 2021-12-04 10:42, Alexander V. Chernikov wrote:
> >> * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off 
> >> doing a from-scratch implementation based on netgraph?
> > It depends. MPLS implementaiton can be splitted into multiple logical
> > parts - dataplane (input, control, output, forward) and control plane
> > (programming ip routes+mpls and mpls-only fowarding state). Some parts
> > of the former can indeed be imported from OpenBSD. However, most of
> > the control plane part have to be written from scratch. Finally, it
> > may be desired to maintain an programming interface close to the one
> > already implemented in major routing SW (frr, bird) - I guess that
> > would be simpler to achieve with native, non-netgraph implementation.
> 
> Thanks for your description. I haven't started work yet, but I'd 
> probably import the dataplane from OpenBSD where I can and do a new 
> control plane, maybe that with a FRR/Bird-compatible API.

When you get to working with FRR let me know, I am a member of
the CI infustructure team there and can hook you up directly
with very knowledgeable FRR developers.  

> 
> I wasn't too keen on using netgraph anyways, I felt it was unnecessary 
> complexity.

True, but with that complexity comes an ulmost unlimited flexiablity.

> If I were to work on this, would I be better off starting with the 
> dataplane or control plane?

I concur with Alexander on this, dataplace first, with an eye on how
FRR/Bird interact with the dataplane.

> 
> >> * Would some of the other committers here be willing to mentor/help me 
> >> if needed?
> > I?d love to. Most of my the routing-related stack changes (modular
> > lookup framework, nexthops, rtsock cleanups) were done to enable
> > efficient kernel-based MPLS implementation.
> 
> Thanks!
> 
> -Neel (nc@)
> 
> 

-- 
Rod Grimes rgri...@freebsd.org



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-06 Thread Lev Serebryakov

On 19.11.2021 23:16, Lutz Donnerhacke wrote:


  * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off doing
a from-scratch implementation based on netgraph?


I'd prefer a netgraph approach, if possible.
It helps to concentrate on the important things.


 Isn't netgraph is very PPS-limited due to excessive logging? I thought, MPLS 
is carrier-grade stuff, and netgraph is very limited now.

--
// Lev Serebryakov



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-07 Thread Lutz Donnerhacke
On Mon, Dec 06, 2021 at 11:41:27PM +0300, Lev Serebryakov wrote:
> On 19.11.2021 23:16, Lutz Donnerhacke wrote:
>>>   * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off doing
>>> a from-scratch implementation based on netgraph?
>>
>> I'd prefer a netgraph approach, if possible.
>> It helps to concentrate on the important things.
>
> Isn't netgraph is very PPS-limited due to excessive logging?

No.

> I thought, MPLS is carrier-grade stuff, and netgraph is very limited now.

I do use netgraph for carrier-grade stuff.
Yes, ng_bridge was limited, but this is fixed.



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-07 Thread Santiago Martinez

Hi Neel, it is exciting to see the topic coming alive again.

Once you think is good/ready for testing, or when you require it,  i can 
avail hardware , routers and traffic generator to take the stack for a ride.


Count me in for testing, reporting, etc.

Best regards.

Santi

On 12/6/21 18:40, Rodney W. Grimes wrote:

[ Charset UTF-8 unsupported, converting... ]

Hi Alexander,

On 2021-12-04 10:42, Alexander V. Chernikov wrote:

* Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off
doing a from-scratch implementation based on netgraph?

It depends. MPLS implementaiton can be splitted into multiple logical
parts - dataplane (input, control, output, forward) and control plane
(programming ip routes+mpls and mpls-only fowarding state). Some parts
of the former can indeed be imported from OpenBSD. However, most of
the control plane part have to be written from scratch. Finally, it
may be desired to maintain an programming interface close to the one
already implemented in major routing SW (frr, bird) - I guess that
would be simpler to achieve with native, non-netgraph implementation.

Thanks for your description. I haven't started work yet, but I'd
probably import the dataplane from OpenBSD where I can and do a new
control plane, maybe that with a FRR/Bird-compatible API.

When you get to working with FRR let me know, I am a member of
the CI infustructure team there and can hook you up directly
with very knowledgeable FRR developers.


I wasn't too keen on using netgraph anyways, I felt it was unnecessary
complexity.

True, but with that complexity comes an ulmost unlimited flexiablity.


If I were to work on this, would I be better off starting with the
dataplane or control plane?

I concur with Alexander on this, dataplace first, with an eye on how
FRR/Bird interact with the dataplane.


* Would some of the other committers here be willing to mentor/help me
if needed?

I?d love to. Most of my the routing-related stack changes (modular
lookup framework, nexthops, rtsock cleanups) were done to enable
efficient kernel-based MPLS implementation.

Thanks!

-Neel (nc@)






Re: Porting OpenBSD MPLS to FreeBSD

2021-12-07 Thread Zaphod Beeblebrox
I would also like to be on the list of possible beta testers.

On Tue, Dec 7, 2021 at 11:27 AM Santiago Martinez 
wrote:

> Hi Neel, it is exciting to see the topic coming alive again.
>
> Once you think is good/ready for testing, or when you require it,  i can
> avail hardware , routers and traffic generator to take the stack for a
> ride.
>
> Count me in for testing, reporting, etc.
>
> Best regards.
>
> Santi
>
> On 12/6/21 18:40, Rodney W. Grimes wrote:
> > [ Charset UTF-8 unsupported, converting... ]
> >> Hi Alexander,
> >>
> >> On 2021-12-04 10:42, Alexander V. Chernikov wrote:
> >>>> * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off
> >>>> doing a from-scratch implementation based on netgraph?
> >>> It depends. MPLS implementaiton can be splitted into multiple logical
> >>> parts - dataplane (input, control, output, forward) and control plane
> >>> (programming ip routes+mpls and mpls-only fowarding state). Some parts
> >>> of the former can indeed be imported from OpenBSD. However, most of
> >>> the control plane part have to be written from scratch. Finally, it
> >>> may be desired to maintain an programming interface close to the one
> >>> already implemented in major routing SW (frr, bird) - I guess that
> >>> would be simpler to achieve with native, non-netgraph implementation.
> >> Thanks for your description. I haven't started work yet, but I'd
> >> probably import the dataplane from OpenBSD where I can and do a new
> >> control plane, maybe that with a FRR/Bird-compatible API.
> > When you get to working with FRR let me know, I am a member of
> > the CI infustructure team there and can hook you up directly
> > with very knowledgeable FRR developers.
> >
> >> I wasn't too keen on using netgraph anyways, I felt it was unnecessary
> >> complexity.
> > True, but with that complexity comes an ulmost unlimited flexiablity.
> >
> >> If I were to work on this, would I be better off starting with the
> >> dataplane or control plane?
> > I concur with Alexander on this, dataplace first, with an eye on how
> > FRR/Bird interact with the dataplane.
> >
> >>>> * Would some of the other committers here be willing to mentor/help me
> >>>> if needed?
> >>> I?d love to. Most of my the routing-related stack changes (modular
> >>> lookup framework, nexthops, rtsock cleanups) were done to enable
> >>> efficient kernel-based MPLS implementation.
> >> Thanks!
> >>
> >> -Neel (nc@)
> >>
> >>
>
>


Re: Porting OpenBSD MPLS to FreeBSD

2021-12-08 Thread Lev Serebryakov

On 07.12.2021 17:28, Lutz Donnerhacke wrote:


I'd prefer a netgraph approach, if possible.
It helps to concentrate on the important things.


Isn't netgraph is very PPS-limited due to excessive logging?


No.

 s/logging/locking/, I don't understand, what I've been thinking about to make 
such stupid mistake.




I thought, MPLS is carrier-grade stuff, and netgraph is very limited now.


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...


--
// Lev Serebryakov



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-08 Thread 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.



Re: Porting OpenBSD MPLS to FreeBSD

2021-12-10 Thread Andrey V. Elsukov

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.


Hi,

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


OpenPGP_signature
Description: OpenPGP digital signature


Re: Porting OpenBSD MPLS to FreeBSD

2021-12-10 Thread Rodney W. Grimes
> > Hi freebsd-net@,
> > 
> > Long time no see. I've gotten a (Ports) commit bit since then.
> > 
> > I haven't been very active in TCP/IP hacking as of late, as more 
> > recently I've been more focused on GNOME packages and some GPU drivers.
> > 
> > Going back, I'm thinking about porting OpenBSD's MPLS to FreeBSD.
> 
> I have had similiar thoughts on and off over the years,
> and one pretty solid "want" for this.
> 
> > 
> > I have a two questions:
> > 
> >   * Is porting OpenBSD MPLS to FreeBSD feasible, or are we better off 
> > doing a from-scratch implementation based on netgraph?
> 
> Feasible, yes, as to the better off part that probably depends on
> who you ask.  MPLS is not that complicated to implement, so doing
> it either way all depends on weither you want to deal with netgraph,
> or the kernel network interface code.  Its also probably fairly trivial
> to do both with a great deal of shared code.
> 
> > 
> >   * Would some of the other committers here be willing to mentor/help me 
> > if needed?
> 
> Yes.
> 
> > 
> > Unlike my old IPFW patches which got nowhere (plus I no longer use 
> > IPFW), I feel this is more something that could be useful when running 
> > FreeBSD as a router, but hasn't really been done.
> 
> I can probably arrange a telco size beta tester too... unless
> there interested has gone away, which I doubt.
> 
> > -Neel (nc@)

Just to follow up, I had a discussion in the weekly Open Source Routing
meeting, and have identified the FRR MPLS expert and have help avaliable
from that resource for this work.  The first order answer on making things
FRR compatible is that if you use the OpenBSD API it would be pretty
much a drop in function.

I have also been asked if there would be a willingness to work with
the OSR/FRR folks (netdef.org) in getting the MPLS CI framework working
on FreeBSD.  They already do CI testing of FRR on FreeBSD, but since
there is no MPLS that feature is not tested.  

I am working out the details on a cross introduction of the FRR
MPLS developer and yourself Neel, if you want to travel down
that road.  This person works cross platform on FRR, iirc mainly
BGP, MPLS, and SR on Linux and BSD.

-- 
Rod Grimes rgri...@freebsd.org