diff mbox series

macsec_linux: hardware offload requires Linux headers >= v5.7

Message ID 20240821210348.1665468-1-geomatsi@gmail.com
State Accepted
Headers show
Series macsec_linux: hardware offload requires Linux headers >= v5.7 | expand

Commit Message

Sergey Matyukevich Aug. 21, 2024, 9:03 p.m. UTC
Hardware offload in Linux macsec driver is enabled in compile time if
libnl version is >= v3.6. This is not sufficient for successful build
since enum 'macsec_offload' has been added to Linux header if_link.h
in kernels v5.6 and v5.7, see commits:
- https://github.com/torvalds/linux/commit/21114b7feec29e4425a3ac48a037569c016a46c8
- https://github.com/torvalds/linux/commit/76564261a7db80c5f5c624e0122a28787f266bdf

New libnl with older Linux headers is a valid combination. This is how
hostapd build failure has been detected by Buildroot autobuilder, see:
- http://autobuild.buildroot.net/results/b59d5bc5bd17683a3a1e3577c40c802e81911f84/

Extend compile time condition for the enablement of the macsec hardware
offload adding Linux headers version check.

Fixes: 40c139664439 ("macsec_linux: Add support for MACsec hardware offload")

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
---
 src/drivers/driver_macsec_linux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jouni Malinen Sept. 1, 2024, 2:25 p.m. UTC | #1
On Thu, Aug 22, 2024 at 12:03:41AM +0300, Sergey Matyukevich wrote:
> Hardware offload in Linux macsec driver is enabled in compile time if
> libnl version is >= v3.6. This is not sufficient for successful build
> since enum 'macsec_offload' has been added to Linux header if_link.h
> in kernels v5.6 and v5.7, see commits:
> - https://github.com/torvalds/linux/commit/21114b7feec29e4425a3ac48a037569c016a46c8
> - https://github.com/torvalds/linux/commit/76564261a7db80c5f5c624e0122a28787f266bdf
> 
> New libnl with older Linux headers is a valid combination. This is how
> hostapd build failure has been detected by Buildroot autobuilder, see:
> - http://autobuild.buildroot.net/results/b59d5bc5bd17683a3a1e3577c40c802e81911f84/
> 
> Extend compile time condition for the enablement of the macsec hardware
> offload adding Linux headers version check.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/drivers/driver_macsec_linux.c b/src/drivers/driver_macsec_linux.c
index c86715498..9ad24183e 100644
--- a/src/drivers/driver_macsec_linux.c
+++ b/src/drivers/driver_macsec_linux.c
@@ -19,6 +19,7 @@ 
 #include <netlink/route/link.h>
 #include <netlink/route/link/macsec.h>
 #include <linux/if_macsec.h>
+#include <linux/version.h>
 #include <inttypes.h>
 
 #include "utils/common.h"
@@ -32,7 +33,7 @@ 
 
 #define UNUSED_SCI 0xffffffffffffffff
 
-#if LIBNL_VER_NUM >= LIBNL_VER(3, 6)
+#if (LIBNL_VER_NUM >= LIBNL_VER(3, 6) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
 #define LIBNL_HAS_OFFLOAD
 #endif