net: hsr: subsystem cleanups and modernization
Subsystems (3)
v2 cover net: hsr: subsystem cleanups and modernization
From: Luka Gejak <[email protected]>
Changes in v2:
- dropped trivial cleanup-only patches per netdev clean-up policy
- added AI attribution for cover-letter/commit-message wording only
- dropped fallthrough/BIT conversion patches per review
This series contains two focused HSR cleanups with practical benefit. It constifies protocol operation tables and replaces a hardcoded function name with __func__ to keep diagnostics correct across refactoring.
only)
Luka Gejak (2):
net: hsr: constify hsr_ops and prp_ops protocol operation structures
net: hsr: use __func__ instead of hardcoded function name
net/hsr/hsr_device.c | 4 ++-- net/hsr/hsr_forward.c | 2 +- net/hsr/hsr_main.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
PATCH v2 1/2 net: hsr: constify hsr_ops and prp_ops protocol operation structures
From: Luka Gejak <[email protected]>
The hsr_ops and prp_ops structures are assigned to hsr->proto_ops during device initialization and are never modified at runtime. Declaring them as const allows the compiler to place these structures in read-only memory, which improves security by preventing accidental or malicious modification of the function pointers they contain.
The proto_ops field in struct hsr_priv is also updated to a const pointer to maintain type consistency.
--- net/hsr/hsr_device.c | 4 ++-- net/hsr/hsr_main.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/hsr/hsr_device.c +2 -2
@@ -616,7 +616,7 @@ static const struct device_type hsr_type = { .name = "hsr", }; -static struct hsr_proto_ops hsr_ops = { +static const struct hsr_proto_ops hsr_ops = { .send_sv_frame = send_hsr_supervision_frame, .create_tagged_frame = hsr_create_tagged_frame, .get_untagged_frame = hsr_get_untagged_frame,
@@ -626,7 +626,7 @@ static struct hsr_proto_ops hsr_ops = { .register_frame_out = hsr_register_frame_out, }; -static struct hsr_proto_ops prp_ops = { +static const struct hsr_proto_ops prp_ops = { .send_sv_frame = send_prp_supervision_frame, .create_tagged_frame = prp_create_tagged_frame, .get_untagged_frame = prp_get_untagged_frame,
net/hsr/hsr_main.h +1 -1
@@ -202,7 +202,7 @@ struct hsr_priv {enum hsr_version prot_version;/* Indicate if HSRv0, HSRv1 or PRPv1 */ spinlock_t seqnr_lock;/* locking for sequence_nr */ spinlock_t list_lock;/* locking for node list */ -struct hsr_proto_ops *proto_ops; +const struct hsr_proto_ops *proto_ops;#define PRP_LAN_ID 0x5/* 0x1010 for A and 0x1011 for B. Bit 0 is set * based on SLAVE_A or SLAVE_B */
Signature · 1 line
2.53.0
PATCH v2 2/2 net: hsr: use __func__ instead of hardcoded function name
In reply to [email protected]From: Luka Gejak <[email protected]>
Replace the hardcoded string "hsr_get_untagged_frame" with the standard __func__ macro in netdev_warn_once() call to make the code more robust to refactoring.
--- net/hsr/hsr_forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/hsr/hsr_forward.c +1 -1
@@ -184,7 +184,7 @@ struct sk_buff *hsr_get_untagged_frame(struct hsr_frame_info *frame,create_stripped_skb_hsr (frame->skb_hsr, frame); else netdev_warn_once(port->dev, - "Unexpected frame received in hsr_get_untagged_frame()\n"); + "Unexpected frame received in %s()\n", __func__);if (!frame->skb_std)return NULL ;
Signature · 1 line
2.53.0
Quoted 6 lines · On Thu, Mar 26, 2026 at 06:45:58PM +0100, [email protected] wrote:
From: Luka Gejak <[email protected]>
Changes in v2:
- dropped trivial cleanup-only patches per netdev clean-up policy
- added AI attribution for cover-letter/commit-message wording only
- dropped fallthrough/BIT conversion patches per review
Thank you for updating (and limiting) the series.
Quoted 10 lines
This series contains two focused HSR cleanups with practical benefit. It constifies protocol operation tables and replaces a hardcoded function name with
__func__to keep diagnostics correct across refactoring.Assisted-by Copilot:gpt-5.3-codex (cover-letter/commit-message wordingonly)
Luka Gejak (2):
net: hsr: constifyhsr_opsandprp_opsprotocol operation structures
net: hsr: use__func__instead of hardcoded function name
The patches look good to me, so for the series:
Thanks,
Felix
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 26 Mar 2026 18:45:58 +0100 you wrote:
From: Luka Gejak <[email protected]>
Changes in v2:
- dropped trivial cleanup-only patches per netdev clean-up policy
- added AI attribution for cover-letter/commit-message wording only
- dropped fallthrough/BIT conversion patches per review[...]
Here is the summary with links:
- [net-next,v2,1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures
https://git.kernel.org/netdev/net-next/c/3e09b370f830 - [net-next,v2,2/2] net: hsr: use __func__ instead of hardcoded function name https://git.kernel.org/netdev/net-next/c/137ac69c15fd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html