Page MenuHomeFreeBSD

Mechanically convert netmap(4) to DrvAPI
ClosedPublic

Authored by jhibbits on Dec 22 2022, 3:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 2:03 AM
Unknown Object (File)
Jan 10 2024, 9:00 PM
Unknown Object (File)
Jan 10 2024, 9:00 PM
Unknown Object (File)
Jan 10 2024, 9:00 PM
Unknown Object (File)
Jan 10 2024, 9:00 PM
Unknown Object (File)
Dec 21 2023, 5:50 PM
Unknown Object (File)
Dec 20 2023, 7:12 AM
Unknown Object (File)
Dec 11 2023, 1:13 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 49370
Build 46260: arc lint + arc unit

Event Timeline

A first pass.

sys/dev/netmap/netmap.c
2259 ↗(On Diff #114440)

if_name() or if_getdname() ?

2872 ↗(On Diff #114440)

This is not ifnet stuff, so it should not be touched.

3976 ↗(On Diff #114440)

Yep, we need a way to grab the if_input method. Can DRVAPI expose that?

sys/dev/netmap/netmap_freebsd.c
358 ↗(On Diff #114440)

So a if_getinputfn() maybe?

391 ↗(On Diff #114440)

What about a if_gettransmitfn()?

sys/dev/netmap/netmap_generic.c
110 ↗(On Diff #114440)

You can ignore this, it is Linux specific.

sys/dev/netmap/netmap_mem2.c
2125 ↗(On Diff #114440)

You can drop all of these. Not related to struct ifnet.

2143 ↗(On Diff #114440)

Drop.

2155–2156 ↗(On Diff #114440)

Drop.

2169 ↗(On Diff #114440)

Drop.

2796 ↗(On Diff #114440)

Drop

2804 ↗(On Diff #114440)

Drop

This revision now requires changes to proceed.Jan 11 2023, 5:45 PM

Address feedback. Update with new IfAPI accessors.

zlei added inline comments.
sys/dev/netmap/if_ptnet.c
520 ↗(On Diff #116146)

This must be wrongly changed by tools ;)
Should be if_getcapenable(sc->ifp)

764 ↗(On Diff #116146)

Is this removal intended ?

sys/dev/netmap/netmap.c
2264 ↗(On Diff #116146)

if_getdname(), is this intended ?

2259 ↗(On Diff #114440)

if_name() or if_getdname() ?

I think this should be if_name().

sys/net/if.c

const char *    
if_name(if_t ifp)       
{                       
        return ((struct ifnet *)ifp)->if_xname;
}
sys/dev/netmap/netmap_freebsd.c
621 ↗(On Diff #116146)

@vmaffione
The mtu set got overwritten by line 626
if_setmtu(ifp, ETHERMTU);

sys/dev/netmap/netmap_kern.h
1723 ↗(On Diff #116146)

Style(9).

2030 ↗(On Diff #116146)

Small nits, align member np_ifp

sys/dev/netmap/netmap_vale.c
414 ↗(On Diff #116146)

Must be wrongly changed by tools ;)

1387 ↗(On Diff #116146)

@vmaffione
Is this intended, if_getdname() or if_name() ?

jhibbits added inline comments.
sys/dev/netmap/if_ptnet.c
520 ↗(On Diff #116146)

And somehow this didn't get caught even in a LINT build. The script is rather naive, so I've had to do a lot of these fixes, caught by build failures.

764 ↗(On Diff #116146)

Not at all.

sys/dev/netmap/netmap.c
2259 ↗(On Diff #114440)

if_name() gets ifp->if_xname, so it's a literal conversion.

3976 ↗(On Diff #114440)

Yeah, I'll need to add an accessor for it.

sys/dev/netmap/netmap_freebsd.c
358 ↗(On Diff #114440)

Good enough a name as any.

jhibbits marked 2 inline comments as done.

Address feedback from @zlei.

Still some changes to be done.

sys/dev/netmap/if_ptnet.c
444 ↗(On Diff #116704)

You have a typo here, since this is a multi line assignment

1877 ↗(On Diff #116704)

Why the comment?

sys/dev/netmap/netmap.c
2272 ↗(On Diff #116704)

this should be if_name

2264 ↗(On Diff #116146)

This should be the interface name, so if_name looks good to me

2872 ↗(On Diff #114440)

please drop the comment

sys/dev/netmap/netmap_freebsd.c
621 ↗(On Diff #116146)

That's right, thanks. I dropped that line in the src main branch.

sys/dev/netmap/netmap_generic.c
1118 ↗(On Diff #116704)

Please drop the comments.

sys/dev/netmap/netmap_mem2.c
2520 ↗(On Diff #116704)

This should be if_name(ptif->ifp)

2560 ↗(On Diff #116704)

This should be if_name(curr->ifp)

2125 ↗(On Diff #114440)

Please drop also the space added at the end of the lines.

sys/dev/netmap/netmap_vale.c
1387 ↗(On Diff #116146)

Yes, if_name is correct.

This revision now requires changes to proceed.Feb 8 2023, 9:14 PM

I don't know how any of the issues you pointed out compiled in the first place. No errors on them. Will post an updated diff shortly.

sys/dev/netmap/if_ptnet.c
444 ↗(On Diff #116704)

No idea at all how this was not caught by the compiler; pretty embarassing.

1877 ↗(On Diff #116704)

It shouldn't be there, thought I removed them all.

sys/dev/netmap/if_ptnet.c
444 ↗(On Diff #116704)

no worries, it's just unsettling if not catched by a compiler :)

jhibbits marked 2 inline comments as done.

Address feedback. No more DRVAPI comments in the code.

This revision is now accepted and ready to land.Feb 11 2023, 4:47 PM

Looks good to me.

sys/dev/netmap/netmap_mem2.c
2121 ↗(On Diff #116934)

Drop spaces at the end of the lines.

This revision was automatically updated to reflect the committed changes.