aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iptables/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-03-23 12:53:44 +0100
committerFelix Fietkau <nbd@nbd.name>2018-04-05 18:12:30 +0200
commitd073f650cdef24dce957099e55b660124fe2e0a4 (patch)
tree53772d88d45ec77dc490bcf25d915e5338291d11 /package/network/utils/iptables/patches
parent11a3d270436137fa485257eab8153ce5d307cfa7 (diff)
downloadupstream-d073f650cdef24dce957099e55b660124fe2e0a4.tar.gz
upstream-d073f650cdef24dce957099e55b660124fe2e0a4.tar.bz2
upstream-d073f650cdef24dce957099e55b660124fe2e0a4.zip
kernel: add support for enabling hardware flow offload via iptables
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network/utils/iptables/patches')
-rw-r--r--package/network/utils/iptables/patches/800-flowoffload_target.patch87
1 files changed, 82 insertions, 5 deletions
diff --git a/package/network/utils/iptables/patches/800-flowoffload_target.patch b/package/network/utils/iptables/patches/800-flowoffload_target.patch
index c6fe65cd3e..2f79ee835a 100644
--- a/package/network/utils/iptables/patches/800-flowoffload_target.patch
+++ b/package/network/utils/iptables/patches/800-flowoffload_target.patch
@@ -1,14 +1,71 @@
--- /dev/null
+++ b/extensions/libxt_FLOWOFFLOAD.c
-@@ -0,0 +1,15 @@
+@@ -0,0 +1,72 @@
++#include <stdio.h>
+#include <xtables.h>
++#include <linux/netfilter/xt_FLOWOFFLOAD.h>
++
++enum {
++ O_HW,
++};
++
++static void offload_help(void)
++{
++ printf(
++"FLOWOFFLOAD target options:\n"
++" --hw Enable hardware offload\n"
++ );
++}
++
++static const struct xt_option_entry offload_opts[] = {
++ {.name = "hw", .id = O_HW, .type = XTTYPE_NONE},
++ XTOPT_TABLEEND,
++};
++
++static void offload_parse(struct xt_option_call *cb)
++{
++ struct xt_flowoffload_target_info *info = cb->data;
++
++ xtables_option_parse(cb);
++ switch (cb->entry->id) {
++ case O_HW:
++ info->flags |= XT_FLOWOFFLOAD_HW;
++ break;
++ }
++}
++
++static void offload_print(const void *ip, const struct xt_entry_target *target, int numeric)
++{
++ const struct xt_flowoffload_target_info *info =
++ (const struct xt_flowoffload_target_info *)target->data;
++
++ printf(" FLOWOFFLOAD");
++ if (info->flags & XT_FLOWOFFLOAD_HW)
++ printf(" hw");
++}
++
++static void offload_save(const void *ip, const struct xt_entry_target *target)
++{
++ const struct xt_flowoffload_target_info *info =
++ (const struct xt_flowoffload_target_info *)target->data;
++
++ if (info->flags & XT_FLOWOFFLOAD_HW)
++ printf(" --hw");
++}
+
+static struct xtables_target offload_tg_reg[] = {
+ {
-+ .family = NFPROTO_UNSPEC,
-+ .name = "FLOWOFFLOAD",
-+ .revision = 0,
-+ .version = XTABLES_VERSION,
++ .family = NFPROTO_UNSPEC,
++ .name = "FLOWOFFLOAD",
++ .revision = 0,
++ .version = XTABLES_VERSION,
++ .size = XT_ALIGN(sizeof(struct xt_flowoffload_target_info)),
++ .userspacesize = sizeof(struct xt_flowoffload_target_info),
++ .help = offload_help,
++ .print = offload_print,
++ .save = offload_save,
++ .x6_parse = offload_parse,
++ .x6_options = offload_opts,
+ },
+};
+
@@ -16,3 +73,23 @@
+{
+ xtables_register_targets(offload_tg_reg, ARRAY_SIZE(offload_tg_reg));
+}
+--- /dev/null
++++ b/include/linux/netfilter/xt_FLOWOFFLOAD.h
+@@ -0,0 +1,17 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++#ifndef _XT_FLOWOFFLOAD_H
++#define _XT_FLOWOFFLOAD_H
++
++#include <linux/types.h>
++
++enum {
++ XT_FLOWOFFLOAD_HW = 1 << 0,
++
++ XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW
++};
++
++struct xt_flowoffload_target_info {
++ __u32 flags;
++};
++
++#endif /* _XT_FLOWOFFLOAD_H */