Re: [PATCH net-next 09/10] net: renesas: rswitch: add simple l3 routing

From: Nikita Yushchenko

Date: Fri Nov 07 2025 - 05:02:09 EST


+static bool rmon_ipv4_dst_offload_hw_op(struct rswitch_route_monitor *rmon,
+ struct rmon_ipv4_dst_offload *offload,
+ u8 frame_type, bool install)

Why all this bool functions? Especially when you have calls returning
error codes you are throwing away.

The original idea behind that was - this is "not success" from an optional optimization step, that is not exposed outside. If it fails to offload - then the stream will remain handled by software.


But, there is a more interesting question about this patchset (that actually stopped me from submitting it when it was originally developed).

What do people thing about the entire approach used to detect streams to offload?

The situation is:
- hardware is capable of doing L3 routing, with some (limited) packet update capabilities - rewrite DST MAC, decrease TTL,
- there is interest to use that, because software L3 routing even at 1Gbps consumes significant CPU load, and for 5Gbps will likely not keep the speed at all (we did not have hw to try),
- but - given the capabilities of hw are incomparably weaker than capabilities of linux networking, which approach to take to detect streams for offloading?

Second question - how exactly to get the routing decision from the kernel stack, to apply it in hardware? I was not able to find any existing implementations of something similar...

What the patchset actually implements is - maintains it's own shadow structures for (subset of) routing information, and generate offload rules based on that. This is definitely not elegant (because the same kernel where this code runs maintains full-scale routing structures). Also this is definitely breaking any complex cases - actually anything more complex than simple destination mask based routing.

I was going to post this approach as RFC at some point, raising all these questions... but unfortunately I did not have a resource to complete that :(

Nikita