From 034d5006103446c11129f115bc26ebb971930502 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 20 Oct 2021 16:23:57 -0400 Subject: [PATCH] freebsd compat: Updates and additions for a newer iflib. --- src/libs/compat/freebsd_iflib/compat/ifdi_if.h | 12 ++++++++++++ .../compat/freebsd_iflib/compat/sys/gtaskqueue.h | 1 + src/libs/compat/freebsd_iflib/ifdi_if.c | 9 +++++++++ src/libs/compat/freebsd_network/compat/net/if.h | 10 +++++++++- .../compat/freebsd_network/compat/sys/method-ids.h | 1 + 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/libs/compat/freebsd_iflib/compat/ifdi_if.h b/src/libs/compat/freebsd_iflib/compat/ifdi_if.h index 5c2d2b5fed..d6a29a17af 100644 --- a/src/libs/compat/freebsd_iflib/compat/ifdi_if.h +++ b/src/libs/compat/freebsd_iflib/compat/ifdi_if.h @@ -610,4 +610,16 @@ static __inline void IFDI_DEBUG(if_ctx_t _ctx) ((ifdi_debug_t *) _m)(_ctx); } +extern struct kobjop_desc ifdi_needs_restart_desc; +typedef bool ifdi_needs_restart_t(if_ctx_t _ctx, enum iflib_restart_event _event); + +static __inline bool IFDI_NEEDS_RESTART(if_ctx_t _ctx, enum iflib_restart_event _event) +{ + kobjop_t _m; + bool rc; + KOBJOPLOOKUP(((kobj_t)_ctx)->ops,ifdi_needs_restart); + rc = ((ifdi_needs_restart_t *) _m)(_ctx, _event); + return (rc); +} + #endif diff --git a/src/libs/compat/freebsd_iflib/compat/sys/gtaskqueue.h b/src/libs/compat/freebsd_iflib/compat/sys/gtaskqueue.h index 92e7318677..7ef73d450b 100644 --- a/src/libs/compat/freebsd_iflib/compat/sys/gtaskqueue.h +++ b/src/libs/compat/freebsd_iflib/compat/sys/gtaskqueue.h @@ -98,6 +98,7 @@ void taskqgroup_config_gtask_deinit(struct grouptask *gtask); #define GROUPTASK_INIT(gtask, priority, func, context) \ GTASK_INIT(&(gtask)->gt_task, TASK_SKIP_WAKEUP, priority, func, context) +#define NET_GROUPTASK_INIT GROUPTASK_INIT #define GROUPTASK_ENQUEUE(gtask) \ grouptaskqueue_enqueue((gtask)->gt_taskqueue, &(gtask)->gt_task) diff --git a/src/libs/compat/freebsd_iflib/ifdi_if.c b/src/libs/compat/freebsd_iflib/ifdi_if.c index 8e2f6f7e2f..0da29a75a9 100644 --- a/src/libs/compat/freebsd_iflib/ifdi_if.c +++ b/src/libs/compat/freebsd_iflib/ifdi_if.c @@ -103,6 +103,11 @@ { } + static bool + null_needs_restart_op(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused) + { + } + static int null_q_setup(if_ctx_t _ctx __unused, uint32_t _qid __unused) { @@ -377,3 +382,7 @@ struct kobjop_desc ifdi_sysctl_int_delay_desc = { struct kobjop_desc ifdi_debug_desc = { 0, { NULL, ID_ifdi_debug, (kobjop_t)null_void_op } }; + +struct kobjop_desc ifdi_needs_restart_desc = { + 0, { NULL, ID_ifdi_needs_restart, (kobjop_t)null_needs_restart_op } +}; diff --git a/src/libs/compat/freebsd_network/compat/net/if.h b/src/libs/compat/freebsd_network/compat/net/if.h index 552073a9b6..a495512ec8 100644 --- a/src/libs/compat/freebsd_network/compat/net/if.h +++ b/src/libs/compat/freebsd_network/compat/net/if.h @@ -35,13 +35,21 @@ #define IFCAP_TOE4 0x04000 /* interface can offload TCP */ #define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ #define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ -#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ +/* available 0x20000 */ #define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ #define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ #define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ #define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */ #define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */ #define IFCAP_HWSTATS 0x800000 /* manages counters internally */ +#define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */ +#define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */ +#define IFCAP_MEXTPG 0x4000000 /* understands M_EXTPG mbufs */ +#define IFCAP_TXTLS4 0x8000000 /* can do TLS encryption and segmentation for TCP */ +#define IFCAP_TXTLS6 0x10000000 /* can do TLS encryption and segmentation for TCP6 */ +#define IFCAP_VXLAN_HWCSUM 0x20000000 /* can do IFCAN_HWCSUM on VXLANs */ +#define IFCAP_VXLAN_HWTSO 0x40000000 /* can do IFCAP_TSO on VXLANs */ +#define IFCAP_TXTLS_RTLMT 0x80000000 /* can do TLS with rate limiting */ #define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) diff --git a/src/libs/compat/freebsd_network/compat/sys/method-ids.h b/src/libs/compat/freebsd_network/compat/sys/method-ids.h index 1720558989..2202e9eeb8 100644 --- a/src/libs/compat/freebsd_network/compat/sys/method-ids.h +++ b/src/libs/compat/freebsd_network/compat/sys/method-ids.h @@ -78,6 +78,7 @@ enum device_method_ids { ID_ifdi_vlan_unregister, ID_ifdi_sysctl_int_delay, ID_ifdi_debug, + ID_ifdi_needs_restart, };