public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros
@ 2026-01-24  3:22 Ethan Nelson-Moore
  2026-01-24 10:25 ` Peter Korsgaard
  2026-01-28  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ethan Nelson-Moore @ 2026-01-24  3:22 UTC (permalink / raw)
  To: netdev, linux-usb
  Cc: Ethan Nelson-Moore, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Peter Korsgaard, Simon Horman

The first byte of the Rx frame is a copy of the Rx status register, so
0x40 corresponds to RSR_MF (meaning the frame is multicast). Replace
0x40 with RSR_MF for clarity. (All other bits of the RSR indicate
errors. The fact that the driver ignores these errors will be fixed by
a later patch.)

The first byte of the status URB is a copy of the NSR, so 0x40
corresponds to NSR_LINKST. Replace 0x40 with NSR_LINKST for clarity.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
 drivers/net/usb/sr9700.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index 9c7cd0db1768..8ffd2391e6d7 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -366,7 +366,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 
 	/* one skb may contains multiple packets */
 	while (skb->len > SR_RX_OVERHEAD) {
-		if (skb->data[0] != 0x40)
+		if (skb->data[0] != RSR_MF)
 			return 0;
 
 		/* ignore the CRC length */
@@ -455,7 +455,7 @@ static void sr9700_status(struct usbnet *dev, struct urb *urb)
 
 	buf = urb->transfer_buffer;
 
-	link = !!(buf[0] & 0x40);
+	link = !!(buf[0] & NSR_LINKST);
 	sr9700_handle_link_change(dev->net, link);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros
  2026-01-24  3:22 [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros Ethan Nelson-Moore
@ 2026-01-24 10:25 ` Peter Korsgaard
  2026-01-28  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2026-01-24 10:25 UTC (permalink / raw)
  To: Ethan Nelson-Moore
  Cc: netdev, linux-usb, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman

>>>>> "Ethan" == Ethan Nelson-Moore <enelsonmoore@gmail.com> writes:

 > The first byte of the Rx frame is a copy of the Rx status register, so
 > 0x40 corresponds to RSR_MF (meaning the frame is multicast). Replace
 > 0x40 with RSR_MF for clarity. (All other bits of the RSR indicate
 > errors. The fact that the driver ignores these errors will be fixed by
 > a later patch.)

 > The first byte of the status URB is a copy of the NSR, so 0x40
 > corresponds to NSR_LINKST. Replace 0x40 with NSR_LINKST for clarity.

 > Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>

I don't know the device, but sounds sensible.

Reviewed-by: Peter Korsgaard <peter@korsgaard.com>

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros
  2026-01-24  3:22 [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros Ethan Nelson-Moore
  2026-01-24 10:25 ` Peter Korsgaard
@ 2026-01-28  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-28  0:10 UTC (permalink / raw)
  To: Ethan Nelson-Moore
  Cc: netdev, linux-usb, andrew+netdev, davem, edumazet, kuba, pabeni,
	peter, horms

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 23 Jan 2026 19:22:43 -0800 you wrote:
> The first byte of the Rx frame is a copy of the Rx status register, so
> 0x40 corresponds to RSR_MF (meaning the frame is multicast). Replace
> 0x40 with RSR_MF for clarity. (All other bits of the RSR indicate
> errors. The fact that the driver ignores these errors will be fixed by
> a later patch.)
> 
> The first byte of the status URB is a copy of the NSR, so 0x40
> corresponds to NSR_LINKST. Replace 0x40 with NSR_LINKST for clarity.
> 
> [...]

Here is the summary with links:
  - [net-next] net: usb: sr9700: replace magic numbers with register bit macros
    https://git.kernel.org/netdev/net-next/c/3b721117fe15

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-28  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24  3:22 [PATCH net-next] net: usb: sr9700: replace magic numbers with register bit macros Ethan Nelson-Moore
2026-01-24 10:25 ` Peter Korsgaard
2026-01-28  0:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox