Re: [PATCH net-next v2 07/12] ethtool: Add MAC loopback support via ethtool_ops

From: Breno Leitao

Date: Thu Mar 26 2026 - 05:50:04 EST


On Wed, Mar 25, 2026 at 03:50:14PM +0100, Björn Töpel wrote:

> @@ -284,20 +305,31 @@ static int loopback_dump_one_dev(struct sk_buff *skb,
> {
> struct loopback_req_info *req_info =
> container_of(ctx->req_info, struct loopback_req_info, base);
> + /* pos_sub encodes: upper 16 bits = component phase, lower 16 = index
> + * within that component. dump_one_dev is called repeatedly with
> + * increasing pos_sub until all components are exhausted.
> + */
> + enum ethtool_loopback_component phase = *pos_sub >> 16;
> + u32 idx = *pos_sub & 0xffff;

Consider introducing macros for these bit operations to improve code
readability. Named macros would make the shift and mask operations more
self-documenting and facilitate future changes, if we eventually get
there.