* [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization
@ 2026-03-24 14:46 luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 1/7] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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>
This patch series performs a general cleanup and modernization of the
HSR(High-availability Seamless Redundancy) protocol driver. Since the
HSR subsystem is currently orphaned, these changes aim to bring the
code up to modern kernel standards and improve overall maintainability.
Luka Gejak (7):
net: hsr: constify hsr_ops and prp_ops protocol operation structures
net: hsr: replace fallthrough comments with fallthrough macro
net: hsr: remove unnecessary void function return statement
net: hsr: use __func__ instead of hardcoded function name
net: hsr: remove unnecessary braces for single statement block
net: hsr: add missing blank lines after function declarations
net: hsr: use BIT() macro for bit shift constant
net/hsr/hsr_device.c | 5 ++---
net/hsr/hsr_forward.c | 2 +-
net/hsr/hsr_framereg.c | 3 +--
net/hsr/hsr_framereg.h | 2 +-
net/hsr/hsr_main.h | 23 ++++++++++++++++++-----
net/hsr/hsr_netlink.c | 4 ++--
6 files changed, 25 insertions(+), 14 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next v1 1/7] net: hsr: constify hsr_ops and prp_ops protocol operation structures
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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>
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] 14+ messages in thread
* [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 1/7] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-26 13:34 ` kernel test robot
` (3 more replies)
2026-03-24 14:46 ` [PATCH net-next v1 3/7] net: hsr: remove unnecessary void function return statement luka.gejak
` (5 subsequent siblings)
7 siblings, 4 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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 two instances of the legacy '/* Fall through */' comment with the
standardized 'fallthrough;' macro in hsr_get_node_status() and
hsr_get_node_list(). The kernel has standardized on the fallthrough macro
since the migration from comment-based annotations, which provides
compiler-level verification of intentional case fall-throughs.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_netlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index db0b0af7a692..32c1b77cf84b 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -433,7 +433,7 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
nla_put_failure:
kfree_skb(skb_out);
- /* Fall through */
+ fallthrough;
fail:
rcu_read_unlock();
@@ -524,7 +524,7 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
nla_put_failure:
nlmsg_free(skb_out);
- /* Fall through */
+ fallthrough;
fail:
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next v1 3/7] net: hsr: remove unnecessary void function return statement
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 1/7] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 4/7] net: hsr: use __func__ instead of hardcoded function name luka.gejak
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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>
Remove the trailing 'return;' from the end of the void function
send_hsr_supervision_frame() per checkpatch recommendations.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_device.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 90236028817d..6ffecc3f0004 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -363,7 +363,6 @@ static void send_hsr_supervision_frame(struct hsr_port *port,
hsr_forward_skb(skb, port);
spin_unlock_bh(&hsr->seqnr_lock);
- return;
}
static void send_prp_supervision_frame(struct hsr_port *master,
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next v1 4/7] net: hsr: use __func__ instead of hardcoded function name
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
` (2 preceding siblings ...)
2026-03-24 14:46 ` [PATCH net-next v1 3/7] net: hsr: remove unnecessary void function return statement luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 5/7] net: hsr: remove unnecessary braces for single statement block luka.gejak
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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] 14+ messages in thread
* [PATCH net-next v1 5/7] net: hsr: remove unnecessary braces for single statement block
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
` (3 preceding siblings ...)
2026-03-24 14:46 ` [PATCH net-next v1 4/7] net: hsr: use __func__ instead of hardcoded function name luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 6/7] net: hsr: add missing blank lines after function declarations luka.gejak
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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>
Remove the unnecessary curly braces around the single statement
for loop body in hsr_add_node() as per kernel coding style.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_framereg.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index 577fb588bc2f..9c3b7381788e 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -182,9 +182,8 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr,
* as initialization. (0 could trigger an spurious ring error warning).
*/
now = jiffies;
- for (i = 0; i < HSR_PT_PORTS; i++) {
+ for (i = 0; i < HSR_PT_PORTS; i++)
new_node->time_in[i] = now;
- }
if (san && hsr->proto_ops->handle_san_frame)
hsr->proto_ops->handle_san_frame(san, rx_port, new_node);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next v1 6/7] net: hsr: add missing blank lines after function declarations
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
` (4 preceding siblings ...)
2026-03-24 14:46 ` [PATCH net-next v1 5/7] net: hsr: remove unnecessary braces for single statement block luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant luka.gejak
2026-03-26 16:25 ` [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization Felix Maurer
7 siblings, 0 replies; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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>
Add missing blank lines after the inline function declarations to
comply with the kernel coding style guidelines.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_main.h | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 134e4f3fff60..202dc90bd2ab 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -143,6 +143,7 @@ static inline void set_prp_lan_id(struct prp_rct *rct, u16 lan_id)
rct->lan_id_and_LSDU_size = htons((ntohs(rct->lan_id_and_LSDU_size) &
0x0FFF) | (lan_id << 12));
}
+
static inline void set_prp_LSDU_size(struct prp_rct *rct, u16 LSDU_size)
{
rct->lan_id_and_LSDU_size = htons((ntohs(rct->lan_id_and_LSDU_size) &
@@ -277,24 +278,36 @@ static inline bool prp_check_lsdu_size(struct sk_buff *skb,
}
#if IS_ENABLED(CONFIG_DEBUG_FS)
+
void hsr_debugfs_rename(struct net_device *dev);
void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
void hsr_debugfs_term(struct hsr_priv *priv);
void hsr_debugfs_create_root(void);
void hsr_debugfs_remove_root(void);
+
#else
+
static inline void hsr_debugfs_rename(struct net_device *dev)
{
}
+
static inline void hsr_debugfs_init(struct hsr_priv *priv,
struct net_device *hsr_dev)
-{}
+{
+}
+
static inline void hsr_debugfs_term(struct hsr_priv *priv)
-{}
+{
+}
+
static inline void hsr_debugfs_create_root(void)
-{}
+{
+}
+
static inline void hsr_debugfs_remove_root(void)
-{}
+{
+}
+
#endif
#endif /* __HSR_PRIVATE_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
` (5 preceding siblings ...)
2026-03-24 14:46 ` [PATCH net-next v1 6/7] net: hsr: add missing blank lines after function declarations luka.gejak
@ 2026-03-24 14:46 ` luka.gejak
2026-03-26 16:26 ` Felix Maurer
2026-03-26 16:25 ` [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization Felix Maurer
7 siblings, 1 reply; 14+ messages in thread
From: luka.gejak @ 2026-03-24 14: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 explicit bit shift (1 << HSR_SEQ_BLOCK_SHIFT) with the
standardized BIT() macro for defining HSR_SEQ_BLOCK_SIZE. This improves
readability and aligns with kernel coding conventions.
Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
---
net/hsr/hsr_framereg.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h
index c65ecb925734..cb731ee0ce5c 100644
--- a/net/hsr/hsr_framereg.h
+++ b/net/hsr/hsr_framereg.h
@@ -79,7 +79,7 @@ struct hsr_seq_block *hsr_get_seq_block(struct hsr_node *node, u16 block_idx);
#endif
#define HSR_SEQ_BLOCK_SHIFT 7 /* 128 bits */
-#define HSR_SEQ_BLOCK_SIZE (1 << HSR_SEQ_BLOCK_SHIFT)
+#define HSR_SEQ_BLOCK_SIZE BIT(HSR_SEQ_BLOCK_SHIFT)
#define HSR_SEQ_BLOCK_MASK (HSR_SEQ_BLOCK_SIZE - 1)
#define HSR_MAX_SEQ_BLOCKS 64
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
@ 2026-03-26 13:34 ` kernel test robot
2026-03-26 16:25 ` Felix Maurer
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2026-03-26 13:34 UTC (permalink / raw)
To: luka.gejak, davem, edumazet, kuba, pabeni, netdev
Cc: oe-kbuild-all, horms, fmaurer, liuhangbin, linux-kernel,
Luka Gejak
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/luka-gejak-linux-dev/net-hsr-constify-hsr_ops-and-prp_ops-protocol-operation-structures/20260326-143638
base: net-next/main
patch link: https://lore.kernel.org/r/20260324144630.189094-3-luka.gejak%40linux.dev
patch subject: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260326/202603261419.jqhvfAVi-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260326/202603261419.jqhvfAVi-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603261419.jqhvfAVi-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/compiler_types.h:88,
from <command-line>:
net/hsr/hsr_netlink.c: In function 'hsr_get_node_status':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
net/hsr/hsr_netlink.c:436:9: note: in expansion of macro 'fallthrough'
436 | fallthrough;
| ^~~~~~~~~~~
net/hsr/hsr_netlink.c: In function 'hsr_get_node_list':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
net/hsr/hsr_netlink.c:527:9: note: in expansion of macro 'fallthrough'
527 | fallthrough;
| ^~~~~~~~~~~
--
In file included from include/linux/compiler_types.h:88,
from <command-line>:
hsr_netlink.c: In function 'hsr_get_node_status':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
hsr_netlink.c:436:9: note: in expansion of macro 'fallthrough'
436 | fallthrough;
| ^~~~~~~~~~~
hsr_netlink.c: In function 'hsr_get_node_list':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^~~~~~~~~~~~~
hsr_netlink.c:527:9: note: in expansion of macro 'fallthrough'
527 | fallthrough;
| ^~~~~~~~~~~
vim +/fallthrough +214 include/linux/compiler_attributes.h
294f69e662d157 Joe Perches 2019-10-05 201
294f69e662d157 Joe Perches 2019-10-05 202 /*
294f69e662d157 Joe Perches 2019-10-05 203 * Add the pseudo keyword 'fallthrough' so case statement blocks
294f69e662d157 Joe Perches 2019-10-05 204 * must end with any of these keywords:
294f69e662d157 Joe Perches 2019-10-05 205 * break;
294f69e662d157 Joe Perches 2019-10-05 206 * fallthrough;
ca0760e7d79e2b Wei Ming Chen 2021-05-06 207 * continue;
294f69e662d157 Joe Perches 2019-10-05 208 * goto <label>;
294f69e662d157 Joe Perches 2019-10-05 209 * return [expression];
294f69e662d157 Joe Perches 2019-10-05 210 *
294f69e662d157 Joe Perches 2019-10-05 211 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
294f69e662d157 Joe Perches 2019-10-05 212 */
294f69e662d157 Joe Perches 2019-10-05 213 #if __has_attribute(__fallthrough__)
294f69e662d157 Joe Perches 2019-10-05 @214 # define fallthrough __attribute__((__fallthrough__))
294f69e662d157 Joe Perches 2019-10-05 215 #else
294f69e662d157 Joe Perches 2019-10-05 216 # define fallthrough do {} while (0) /* fallthrough */
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 217 #endif
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 218
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
` (6 preceding siblings ...)
2026-03-24 14:46 ` [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant luka.gejak
@ 2026-03-26 16:25 ` Felix Maurer
7 siblings, 0 replies; 14+ messages in thread
From: Felix Maurer @ 2026-03-26 16:25 UTC (permalink / raw)
To: luka.gejak
Cc: davem, edumazet, kuba, pabeni, netdev, horms, liuhangbin,
linux-kernel
On Tue, Mar 24, 2026 at 03:46:23PM +0100, luka.gejak@linux.dev wrote:
> From: Luka Gejak <luka.gejak@linux.dev>
>
> This patch series performs a general cleanup and modernization of the
> HSR(High-availability Seamless Redundancy) protocol driver. Since the
> HSR subsystem is currently orphaned, these changes aim to bring the
> code up to modern kernel standards and improve overall maintainability.
I appreciate that you are working on hsr and want to improve its code
quality. I agree that there is quite some room for improvement here.
However, I have a few general remarks before commenting on the
individual patches:
- Please consider the netdev policy for simple clean-up patches outside
the context of larger work [1] (esp. patches 5, 6).
- Please attribute the use of AI coding assistants [2].
Thanks,
Felix
[1]: https://docs.kernel.org/process/maintainer-netdev.html#clean-up-patches
[2]: https://docs.kernel.org/process/coding-assistants.html
> Luka Gejak (7):
> net: hsr: constify hsr_ops and prp_ops protocol operation structures
> net: hsr: replace fallthrough comments with fallthrough macro
> net: hsr: remove unnecessary void function return statement
> net: hsr: use __func__ instead of hardcoded function name
> net: hsr: remove unnecessary braces for single statement block
> net: hsr: add missing blank lines after function declarations
> net: hsr: use BIT() macro for bit shift constant
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
2026-03-26 13:34 ` kernel test robot
@ 2026-03-26 16:25 ` Felix Maurer
2026-03-26 21:31 ` kernel test robot
2026-03-26 22:16 ` kernel test robot
3 siblings, 0 replies; 14+ messages in thread
From: Felix Maurer @ 2026-03-26 16:25 UTC (permalink / raw)
To: luka.gejak
Cc: davem, edumazet, kuba, pabeni, netdev, horms, liuhangbin,
linux-kernel
On Tue, Mar 24, 2026 at 03:46:25PM +0100, luka.gejak@linux.dev wrote:
> From: Luka Gejak <luka.gejak@linux.dev>
>
> Replace two instances of the legacy '/* Fall through */' comment with the
> standardized 'fallthrough;' macro in hsr_get_node_status() and
> hsr_get_node_list(). The kernel has standardized on the fallthrough macro
> since the migration from comment-based annotations, which provides
> compiler-level verification of intentional case fall-throughs.
As the test robot message suggests: the fallthrough macro is only for
case statement blocks.
> Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
> ---
> net/hsr/hsr_netlink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
> index db0b0af7a692..32c1b77cf84b 100644
> --- a/net/hsr/hsr_netlink.c
> +++ b/net/hsr/hsr_netlink.c
> @@ -433,7 +433,7 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
>
> nla_put_failure:
> kfree_skb(skb_out);
> - /* Fall through */
> + fallthrough;
>
> fail:
> rcu_read_unlock();
> @@ -524,7 +524,7 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
>
> nla_put_failure:
> nlmsg_free(skb_out);
> - /* Fall through */
> + fallthrough;
>
> fail:
> rcu_read_unlock();
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant
2026-03-24 14:46 ` [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant luka.gejak
@ 2026-03-26 16:26 ` Felix Maurer
0 siblings, 0 replies; 14+ messages in thread
From: Felix Maurer @ 2026-03-26 16:26 UTC (permalink / raw)
To: luka.gejak
Cc: davem, edumazet, kuba, pabeni, netdev, horms, liuhangbin,
linux-kernel
On Tue, Mar 24, 2026 at 03:46:30PM +0100, luka.gejak@linux.dev wrote:
> From: Luka Gejak <luka.gejak@linux.dev>
>
> Replace the explicit bit shift (1 << HSR_SEQ_BLOCK_SHIFT) with the
> standardized BIT() macro for defining HSR_SEQ_BLOCK_SIZE. This improves
> readability and aligns with kernel coding conventions.
I know that checkpatch suggests this, but I don't agree with it:
HSR_SEQ_BLOCK_SHIFT is not a bitmap but a number, so in my opinion the
BIT() macro makes this particular define harder to read/understand.
> Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
> ---
> net/hsr/hsr_framereg.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h
> index c65ecb925734..cb731ee0ce5c 100644
> --- a/net/hsr/hsr_framereg.h
> +++ b/net/hsr/hsr_framereg.h
> @@ -79,7 +79,7 @@ struct hsr_seq_block *hsr_get_seq_block(struct hsr_node *node, u16 block_idx);
> #endif
>
> #define HSR_SEQ_BLOCK_SHIFT 7 /* 128 bits */
> -#define HSR_SEQ_BLOCK_SIZE (1 << HSR_SEQ_BLOCK_SHIFT)
> +#define HSR_SEQ_BLOCK_SIZE BIT(HSR_SEQ_BLOCK_SHIFT)
> #define HSR_SEQ_BLOCK_MASK (HSR_SEQ_BLOCK_SIZE - 1)
> #define HSR_MAX_SEQ_BLOCKS 64
>
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
2026-03-26 13:34 ` kernel test robot
2026-03-26 16:25 ` Felix Maurer
@ 2026-03-26 21:31 ` kernel test robot
2026-03-26 22:16 ` kernel test robot
3 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2026-03-26 21:31 UTC (permalink / raw)
To: luka.gejak, davem, edumazet, kuba, pabeni, netdev
Cc: oe-kbuild-all, horms, fmaurer, liuhangbin, linux-kernel,
Luka Gejak
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/luka-gejak-linux-dev/net-hsr-constify-hsr_ops-and-prp_ops-protocol-operation-structures/20260326-143638
base: net-next/main
patch link: https://lore.kernel.org/r/20260324144630.189094-3-luka.gejak%40linux.dev
patch subject: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
config: parisc-randconfig-002-20260327 (https://download.01.org/0day-ci/archive/20260327/202603270549.2hiC5jsf-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260327/202603270549.2hiC5jsf-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603270549.2hiC5jsf-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/compiler_types.h:88,
from <command-line>:
net/hsr/hsr_netlink.c: In function 'hsr_get_node_list':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^~~~~~~~~~~~~
net/hsr/hsr_netlink.c:527:2: note: in expansion of macro 'fallthrough'
fallthrough;
^~~~~~~~~~~
net/hsr/hsr_netlink.c: In function 'hsr_get_node_status':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^~~~~~~~~~~~~
net/hsr/hsr_netlink.c:436:2: note: in expansion of macro 'fallthrough'
fallthrough;
^~~~~~~~~~~
vim +/fallthrough +214 include/linux/compiler_attributes.h
294f69e662d157 Joe Perches 2019-10-05 201
294f69e662d157 Joe Perches 2019-10-05 202 /*
294f69e662d157 Joe Perches 2019-10-05 203 * Add the pseudo keyword 'fallthrough' so case statement blocks
294f69e662d157 Joe Perches 2019-10-05 204 * must end with any of these keywords:
294f69e662d157 Joe Perches 2019-10-05 205 * break;
294f69e662d157 Joe Perches 2019-10-05 206 * fallthrough;
ca0760e7d79e2b Wei Ming Chen 2021-05-06 207 * continue;
294f69e662d157 Joe Perches 2019-10-05 208 * goto <label>;
294f69e662d157 Joe Perches 2019-10-05 209 * return [expression];
294f69e662d157 Joe Perches 2019-10-05 210 *
294f69e662d157 Joe Perches 2019-10-05 211 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
294f69e662d157 Joe Perches 2019-10-05 212 */
294f69e662d157 Joe Perches 2019-10-05 213 #if __has_attribute(__fallthrough__)
294f69e662d157 Joe Perches 2019-10-05 @214 # define fallthrough __attribute__((__fallthrough__))
294f69e662d157 Joe Perches 2019-10-05 215 #else
294f69e662d157 Joe Perches 2019-10-05 216 # define fallthrough do {} while (0) /* fallthrough */
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 217 #endif
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 218
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
` (2 preceding siblings ...)
2026-03-26 21:31 ` kernel test robot
@ 2026-03-26 22:16 ` kernel test robot
3 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2026-03-26 22:16 UTC (permalink / raw)
To: luka.gejak, davem, edumazet, kuba, pabeni, netdev
Cc: llvm, oe-kbuild-all, horms, fmaurer, liuhangbin, linux-kernel,
Luka Gejak
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/luka-gejak-linux-dev/net-hsr-constify-hsr_ops-and-prp_ops-protocol-operation-structures/20260326-143638
base: net-next/main
patch link: https://lore.kernel.org/r/20260324144630.189094-3-luka.gejak%40linux.dev
patch subject: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
config: i386-randconfig-001-20260327 (https://download.01.org/0day-ci/archive/20260327/202603270658.FJCTgZee-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260327/202603270658.FJCTgZee-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603270658.FJCTgZee-lkp@intel.com/
All errors (new ones prefixed by >>):
>> net/hsr/hsr_netlink.c:436:2: error: fallthrough annotation is outside switch statement
436 | fallthrough;
| ^
include/linux/compiler_attributes.h:214:56: note: expanded from macro 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^
net/hsr/hsr_netlink.c:527:2: error: fallthrough annotation is outside switch statement
527 | fallthrough;
| ^
include/linux/compiler_attributes.h:214:56: note: expanded from macro 'fallthrough'
214 | # define fallthrough __attribute__((__fallthrough__))
| ^
2 errors generated.
vim +436 net/hsr/hsr_netlink.c
300
301 /* HSR_C_GET_NODE_STATUS lets userspace query the internal HSR node table
302 * about the status of a specific node in the network, defined by its MAC
303 * address.
304 *
305 * Input: hsr ifindex, node mac address
306 * Output: hsr ifindex, node mac address (copied from request),
307 * age of latest frame from node over slave 1, slave 2 [ms]
308 */
309 static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
310 {
311 /* For receiving */
312 struct nlattr *na;
313 struct net_device *hsr_dev;
314
315 /* For sending */
316 struct sk_buff *skb_out;
317 void *msg_head;
318 struct hsr_priv *hsr;
319 struct hsr_port *port;
320 unsigned char hsr_node_addr_b[ETH_ALEN];
321 int hsr_node_if1_age;
322 u16 hsr_node_if1_seq;
323 int hsr_node_if2_age;
324 u16 hsr_node_if2_seq;
325 int addr_b_ifindex;
326 int res;
327
328 if (!info)
329 goto invalid;
330
331 na = info->attrs[HSR_A_IFINDEX];
332 if (!na)
333 goto invalid;
334 na = info->attrs[HSR_A_NODE_ADDR];
335 if (!na)
336 goto invalid;
337
338 rcu_read_lock();
339 hsr_dev = dev_get_by_index_rcu(genl_info_net(info),
340 nla_get_u32(info->attrs[HSR_A_IFINDEX]));
341 if (!hsr_dev)
342 goto rcu_unlock;
343 if (!is_hsr_master(hsr_dev))
344 goto rcu_unlock;
345
346 /* Send reply */
347 skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
348 if (!skb_out) {
349 res = -ENOMEM;
350 goto fail;
351 }
352
353 msg_head = genlmsg_put(skb_out, NETLINK_CB(skb_in).portid,
354 info->snd_seq, &hsr_genl_family, 0,
355 HSR_C_SET_NODE_STATUS);
356 if (!msg_head) {
357 res = -ENOMEM;
358 goto nla_put_failure;
359 }
360
361 res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex);
362 if (res < 0)
363 goto nla_put_failure;
364
365 hsr = netdev_priv(hsr_dev);
366 res = hsr_get_node_data(hsr,
367 (unsigned char *)
368 nla_data(info->attrs[HSR_A_NODE_ADDR]),
369 hsr_node_addr_b,
370 &addr_b_ifindex,
371 &hsr_node_if1_age,
372 &hsr_node_if1_seq,
373 &hsr_node_if2_age,
374 &hsr_node_if2_seq);
375 if (res < 0)
376 goto nla_put_failure;
377
378 res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN,
379 nla_data(info->attrs[HSR_A_NODE_ADDR]));
380 if (res < 0)
381 goto nla_put_failure;
382
383 if (addr_b_ifindex > -1) {
384 res = nla_put(skb_out, HSR_A_NODE_ADDR_B, ETH_ALEN,
385 hsr_node_addr_b);
386 if (res < 0)
387 goto nla_put_failure;
388
389 res = nla_put_u32(skb_out, HSR_A_ADDR_B_IFINDEX,
390 addr_b_ifindex);
391 if (res < 0)
392 goto nla_put_failure;
393 }
394
395 res = nla_put_u32(skb_out, HSR_A_IF1_AGE, hsr_node_if1_age);
396 if (res < 0)
397 goto nla_put_failure;
398 res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq);
399 if (res < 0)
400 goto nla_put_failure;
401 port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A);
402 if (port)
403 res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX,
404 port->dev->ifindex);
405 if (res < 0)
406 goto nla_put_failure;
407
408 res = nla_put_u32(skb_out, HSR_A_IF2_AGE, hsr_node_if2_age);
409 if (res < 0)
410 goto nla_put_failure;
411 res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq);
412 if (res < 0)
413 goto nla_put_failure;
414 port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B);
415 if (port)
416 res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX,
417 port->dev->ifindex);
418 if (res < 0)
419 goto nla_put_failure;
420
421 rcu_read_unlock();
422
423 genlmsg_end(skb_out, msg_head);
424 genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid);
425
426 return 0;
427
428 rcu_unlock:
429 rcu_read_unlock();
430 invalid:
431 netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL);
432 return 0;
433
434 nla_put_failure:
435 kfree_skb(skb_out);
> 436 fallthrough;
437
438 fail:
439 rcu_read_unlock();
440 return res;
441 }
442
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-26 22:16 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 14:46 [PATCH net-next v1 0/7] net: hsr: subsystem cleanups and modernization luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 1/7] net: hsr: constify hsr_ops and prp_ops protocol operation structures luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro luka.gejak
2026-03-26 13:34 ` kernel test robot
2026-03-26 16:25 ` Felix Maurer
2026-03-26 21:31 ` kernel test robot
2026-03-26 22:16 ` kernel test robot
2026-03-24 14:46 ` [PATCH net-next v1 3/7] net: hsr: remove unnecessary void function return statement luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 4/7] net: hsr: use __func__ instead of hardcoded function name luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 5/7] net: hsr: remove unnecessary braces for single statement block luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 6/7] net: hsr: add missing blank lines after function declarations luka.gejak
2026-03-24 14:46 ` [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant luka.gejak
2026-03-26 16:26 ` Felix Maurer
2026-03-26 16:25 ` [PATCH net-next v1 0/7] 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