Re: [RFC Patch net-next v1 1/9] r8169: add some register definitions
From: Andrew Lunn
Date: Mon Apr 27 2026 - 10:35:19 EST
> >> +#define RTL8127_RSS_KEY_SIZE 40
> The name here is directly ported from vendor driver, which may carry some confusing.
Part of the task of taking vendor code is re-writing it to make it
understandable. That often means using better names, names which fit
with the Mainline driver. It also means making use of Mainline helpers
like BIT(). So it really is often a case of re-write vendor code, not
drop in vendor code. Use it as documentation, not code.
> V4 actually refers to the type of rx descriptor, not the version of
> RSS IP block. Since RTL8127 exclusively uses this V4 descriptor
> format (and not the older v2/v3 formats), V4 is indeed
> unnecessary. 8125B is from older chips that share the same
> descriptor format, which is also unnecessary.
Maybe also consider taking a step back and looking at the overall
structure of the driver. Would it make sense to have functions which
handle only v1 descriptors, only v2 descriptors, only v3 descriptors
and only v4 descriptors? Would that make the overall code easier to
understand? So you might need to start with refactoring the existing
code, and then add in your new code.
Andrew