git: 2bddcff5a870 - stable/15 - if_bnxt: add bnxt_compat.h version-compat shim
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Oct 2026 23:37:27 UTC
The branch stable/15 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=2bddcff5a87090d37ae183a13eb7cf07be185771
commit 2bddcff5a87090d37ae183a13eb7cf07be185771
Author: Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2026-07-29 12:13:39 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 23:25:50 +0000
if_bnxt: add bnxt_compat.h version-compat shim
Add bnxt_compat.h, a small __FreeBSD_version-gated compatibility
shim: if_getmtu()/if_name()/if_getsoftc()/if_getflags() fallbacks for
pre-1500000, and a config-task vs. config-gtask abstraction over the
iflib API split at 1403000. On this branch's FreeBSD version it also
unconditionally enables KTLS_IFLIB_SUPPORT/KTLS_REC_SEQ_NUMBER, which
the upcoming kTLS patch depends on.
For stable/15, enable the existing iflib kTLS and TLS record-sequence
interfaces starting at __FreeBSD_version 1501506.
Reviewed by: gallatin
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D58604
(cherry picked from commit 42988358a9210ccf7ff500895785b49fe5615567)
---
sys/dev/bnxt/bnxt_en/bnxt.h | 1 +
sys/dev/bnxt/bnxt_en/bnxt_compat.h | 88 ++++++++++++++++++++++++++++++++++++++
sys/modules/bnxt/bnxt_en/Makefile | 1 +
3 files changed, 90 insertions(+)
diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
index 923c069afb81..3d0d63eb2244 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -45,6 +45,7 @@
#include <net/iflib.h>
#include <linux/types.h>
+#include "bnxt_compat.h"
#include "hsi_struct_def.h"
#include "bnxt_dcb.h"
#include "bnxt_auxbus_compat.h"
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_compat.h b/sys/dev/bnxt/bnxt_en/bnxt_compat.h
new file mode 100644
index 000000000000..97742b16153c
--- /dev/null
+++ b/sys/dev/bnxt/bnxt_en/bnxt_compat.h
@@ -0,0 +1,88 @@
+/*
+ * Broadcom NetXtreme-C/E network driver.
+ *
+ * Copyright (c) 2026 Broadcom, All Rights Reserved.
+ * The term Broadcom refers to Broadcom Limited and/or its subsidiaries
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef BNXT_COMPAT_H
+#define BNXT_COMPAT_H
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/taskqueue.h>
+#include <sys/bitstring.h>
+
+#include <machine/bus.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/iflib.h>
+#include <linux/types.h>
+
+
+#if (__FreeBSD_version < 1500000)
+
+#define if_getmtu(ifp) (ifp)->if_mtu
+#ifndef if_name
+#define if_name(ifp) (ifp)->if_xname
+#endif
+#define if_getsoftc(ifp) (ifp)->if_softc
+#define if_getflags(ifp) (ifp)->if_flags
+
+#endif
+
+
+#if (__FreeBSD_version >= 1403000)
+
+#define BNXT_CP_TASK_TYPE struct task
+#define BNXT_CP_TASK_FUNC(name) void name(void *context, int pending)
+#define BNXT_CP_TASK_INIT(ctx, task, func) \
+ iflib_config_task_init(ctx, task, func)
+#define BNXT_CP_TASK_ENQUEUE(ctx, task) \
+ iflib_config_task_enqueue(ctx, task)
+
+#else
+
+#define BNXT_CP_TASK_TYPE struct grouptask
+#define BNXT_CP_TASK_FUNC(name) void name(void *context)
+#define BNXT_CP_TASK_INIT(ctx, task, func) \
+ iflib_config_gtask_init(ctx, task, func, "dflt_cp")
+#define BNXT_CP_TASK_ENQUEUE(ctx, task) \
+ GROUPTASK_ENQUEUE(task)
+
+#endif
+
+#if (__FreeBSD_version >= 1600007) || \
+ (__FreeBSD_version >= 1501506 && __FreeBSD_version < 1600000)
+#define KTLS_IFLIB_SUPPORT
+#define KTLS_REC_SEQ_NUMBER
+#endif
+
+#endif /* BNXT_COMPAT_H */
diff --git a/sys/modules/bnxt/bnxt_en/Makefile b/sys/modules/bnxt/bnxt_en/Makefile
index e0d371c264de..57958d0c5922 100644
--- a/sys/modules/bnxt/bnxt_en/Makefile
+++ b/sys/modules/bnxt/bnxt_en/Makefile
@@ -16,6 +16,7 @@ SRCS += bnxt_log_data.c bnxt_log_data.h
SRCS += bnxt_coredump.c bnxt_coredump.h
SRCS += bnxt_ptp.c bnxt_ptp.h
SRCS += bnxt_mpc.c bnxt_mpc.h
+SRCS += bnxt_compat.h
SRCS += ${LINUXKPI_GENSRCS}
CFLAGS+= -DIFLIB