Skip to contentSkip to conversation

cobalt: Adjust dev_addr_set wrapper to 5.10, 5.1 and 4.19 backports

PATCH In review Jan Kiszka 2 participants 6 messages Aug 29, 2023

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v3 1/1 cobalt: Adjust dev_addr_set wrapper to 5.10, 5.1 and 4.19 backports

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))
 #define dev_addr_set(dev, addr)		memcpy((dev)->dev_addr, addr, MAX_ADDR_LEN)
 #define eth_hw_addr_set(dev, addr)	memcpy((dev)->dev_addr, addr, ETH_ALEN)
 #endif
Signature · 1 line
2.35.3
#1 lore raw
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)

kernel/cobalt/include/asm-generic/xenomai/wrappers.h line 63

Quoted 10 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

This is still broken. I have a 5.4.253 kernel here which already provides eth_hw_addr_set.

LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) is true for that kernel.

Quoted 5 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
 #define dev_addr_set(dev, addr)		memcpy((dev)->dev_addr, addr, MAX_ADDR_LEN)
 #define eth_hw_addr_set(dev, addr)	memcpy((dev)->dev_addr, addr, ETH_ALEN)
 #endif
Signature · 1 line
2.35.3
#2 lore raw
Quoted 30 lines · Florian Bezdeka
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)

kernel/cobalt/include/asm-generic/xenomai/wrappers.h line 63

Quoted 10 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

This is still broken. I have a 5.4.253 kernel here which already provides eth_hw_addr_set.

Quoted 1 line

LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) is true for that kernel.

I'm testing with

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
    ( \
    LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291)) \
    )

right now. Would need proper formatting of course.

Quoted 6 lines
Quoted 6 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
 #define dev_addr_set(dev, addr)		memcpy((dev)->dev_addr, addr, MAX_ADDR_LEN)
 #define eth_hw_addr_set(dev, addr)	memcpy((dev)->dev_addr, addr, ETH_ALEN)
 #endif
Signature · 1 line
2.35.3
author
#3 lore raw
Quoted 43 lines · Florian (T CED SES-DE)
Quoted 30 lines · Florian Bezdeka
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)

kernel/cobalt/include/asm-generic/xenomai/wrappers.h line 63

Quoted 10 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

This is still broken. I have a 5.4.253 kernel here which already provides eth_hw_addr_set.

Quoted 1 line

LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) is true for that kernel.

I'm testing with

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
    ( \
    LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291)) \
    )
Quoted 2 lines

right now. Would need proper formatting of course.

Wouldn't that work as well?

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

...

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
author
#4 lore raw
Quoted 56 lines · Jan Kiszka
Quoted 43 lines · Florian (T CED SES-DE)
Quoted 30 lines · Florian Bezdeka
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)

kernel/cobalt/include/asm-generic/xenomai/wrappers.h line 63

Quoted 10 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

This is still broken. I have a 5.4.253 kernel here which already provides eth_hw_addr_set.

Quoted 1 line

LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) is true for that kernel.

I'm testing with

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
    ( \
    LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) && LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291)) \
    )
Quoted 2 lines

right now. Would need proper formatting of course.

Wouldn't that work as well?

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))
Quoted 4 lines

...

Jan

BTW, both v2 and v3 make no sense for master because master does not support kernels < 5.10. But stable/v3.2.x would need it.

And I noticed that I apparently never sent v1 which was only addressing 5.10. Will do that soon (and restore next to it).

Sorry for the mess.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
author
#5 lore raw
In reply to Florian Bezdeka
Quoted 30 lines · Florian Bezdeka
Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Some stable kernels gained this helper meanwhile as well.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +0 -0
index ea7ed3ad56..a533d46690 100644
@@ -54,7 +54,13 @@
 #define close_fd(__ufd)	__close_fd(current->files, __ufd)

kernel/cobalt/include/asm-generic/xenomai/wrappers.h line 63

Quoted 10 lines
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +7 -1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,10,188)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)) && \
+    (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) || \
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,19,291))

This is still broken. I have a 5.4.253 kernel here which already provides eth_hw_addr_set.

Quoted 2 lines

LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) is true for that kernel.

Yes, the new lower limits were wrong. They should have been 5.5 and 4.20, respectively...

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center