* [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization
@ 2026-03-26 17:45 luka.gejak
2026-03-26 17:45 ` [PATCH net-next v2 1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: luka.gejak @ 2026-03-26 17:45 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, netdev
Cc: horms, fmaurer, liuhangbin, linux-kernel, luka.gejak
From: Luka Gejak <luka.gejak@linux.dev>
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.
Assisted-by: Copilot:gpt-5.3-codex (cover-letter/commit-message wording
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(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v2 1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures
2026-03-26 17:45 [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization luka.gejak
@ 2026-03-26 17:45 ` luka.gejak
2026-03-26 17:46 ` [PATCH net-next v2 2/2] net: hsr: use __func__ instead of hardcoded function name luka.gejak
2026-03-27 12:01 ` [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization Felix Maurer
2 siblings, 0 replies; 4+ messages in thread
From: luka.gejak @ 2026-03-26 17:45 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, netdev
Cc: horms, fmaurer, liuhangbin, linux-kernel, luka.gejak
From: Luka Gejak <luka.gejak@linux.dev>
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.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_device.c | 4 ++--
net/hsr/hsr_main.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 5c3eca2235ce..90236028817d 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -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,
diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 33b0d2460c9b..134e4f3fff60 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -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
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next v2 2/2] net: hsr: use __func__ instead of hardcoded function name
2026-03-26 17:45 [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-26 17:45 ` [PATCH net-next v2 1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
@ 2026-03-26 17:46 ` luka.gejak
2026-03-27 12:01 ` [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization Felix Maurer
2 siblings, 0 replies; 4+ messages in thread
From: luka.gejak @ 2026-03-26 17:46 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, netdev
Cc: horms, fmaurer, liuhangbin, linux-kernel, luka.gejak
From: Luka Gejak <luka.gejak@linux.dev>
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.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_forward.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index aefc9b6936ba..0aca859c88cb 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -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;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization
2026-03-26 17:45 [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-26 17:45 ` [PATCH net-next v2 1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
2026-03-26 17:46 ` [PATCH net-next v2 2/2] net: hsr: use __func__ instead of hardcoded function name luka.gejak
@ 2026-03-27 12:01 ` Felix Maurer
2 siblings, 0 replies; 4+ messages in thread
From: Felix Maurer @ 2026-03-27 12:01 UTC (permalink / raw)
To: luka.gejak
Cc: davem, edumazet, kuba, pabeni, netdev, horms, liuhangbin,
linux-kernel
On Thu, Mar 26, 2026 at 06:45:58PM +0100, luka.gejak@linux.dev wrote:
> From: Luka Gejak <luka.gejak@linux.dev>
>
> 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.
> 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 wording
> only)
>
> Luka Gejak (2):
> net: hsr: constify hsr_ops and prp_ops protocol operation structures
> net: hsr: use __func__ instead of hardcoded function name
The patches look good to me, so for the series:
Reviewed-by: Felix Maurer <fmaurer@redhat.com>
Thanks,
Felix
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-27 12:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 17:45 [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-26 17:45 ` [PATCH net-next v2 1/2] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
2026-03-26 17:46 ` [PATCH net-next v2 2/2] net: hsr: use __func__ instead of hardcoded function name luka.gejak
2026-03-27 12:01 ` [PATCH net-next v2 0/2] net: hsr: subsystem cleanups and modernization Felix Maurer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox