Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
c7995a3b3b
@ -6,11 +6,11 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-5.4 = .109
|
||||
LINUX_VERSION-5.10 = .27
|
||||
LINUX_VERSION-5.4 = .110
|
||||
LINUX_VERSION-5.10 = .28
|
||||
|
||||
LINUX_KERNEL_HASH-5.4.109 = ac6af4562717d030266fcddb0a3c44598610ca8c9c3a654725f58b9cbd61b7ee
|
||||
LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9
|
||||
LINUX_KERNEL_HASH-5.4.110 = d0f6978440e8a4b266cb1847405a764bca83667541b9e4cdbbc161fb0dd9b228
|
||||
LINUX_KERNEL_HASH-5.10.28 = 4dfc3aea719556e63e90b8692e9d4b779ad1cb2a9a4823bf721e30004e7ac354
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2014 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
#
|
||||
@ -14,31 +13,31 @@ touch /etc/config/ubootenv
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
gw,imx6dl-gw51xx |\
|
||||
gw,imx6dl-gw52xx |\
|
||||
gw,imx6dl-gw53xx |\
|
||||
gw,imx6dl-gw54xx |\
|
||||
gw,imx6dl-gw551x |\
|
||||
gw,imx6dl-gw552x |\
|
||||
gw,imx6dl-gw553x |\
|
||||
gw,imx6dl-gw5904 |\
|
||||
gw,imx6dl-gw5907 |\
|
||||
gw,imx6dl-gw5910 |\
|
||||
gw,imx6dl-gw5912 |\
|
||||
gw,imx6dl-gw5913 |\
|
||||
gw,imx6q-gw51xx |\
|
||||
gw,imx6q-gw52xx |\
|
||||
gw,imx6q-gw53xx |\
|
||||
gw,imx6q-gw5400-a |\
|
||||
gw,imx6q-gw54xx |\
|
||||
gw,imx6q-gw551x |\
|
||||
gw,imx6q-gw552x |\
|
||||
gw,imx6q-gw553x |\
|
||||
gw,imx6q-gw5904 |\
|
||||
gw,imx6q-gw5907 |\
|
||||
gw,imx6q-gw5910 |\
|
||||
gw,imx6q-gw5912 |\
|
||||
gw,imx6q-gw5913 )
|
||||
gw,imx6dl-gw51xx|\
|
||||
gw,imx6dl-gw52xx|\
|
||||
gw,imx6dl-gw53xx|\
|
||||
gw,imx6dl-gw54xx|\
|
||||
gw,imx6dl-gw551x|\
|
||||
gw,imx6dl-gw552x|\
|
||||
gw,imx6dl-gw553x|\
|
||||
gw,imx6dl-gw5904|\
|
||||
gw,imx6dl-gw5907|\
|
||||
gw,imx6dl-gw5910|\
|
||||
gw,imx6dl-gw5912|\
|
||||
gw,imx6dl-gw5913|\
|
||||
gw,imx6q-gw51xx|\
|
||||
gw,imx6q-gw52xx|\
|
||||
gw,imx6q-gw53xx|\
|
||||
gw,imx6q-gw5400-a|\
|
||||
gw,imx6q-gw54xx|\
|
||||
gw,imx6q-gw551x|\
|
||||
gw,imx6q-gw552x|\
|
||||
gw,imx6q-gw553x|\
|
||||
gw,imx6q-gw5904|\
|
||||
gw,imx6q-gw5907|\
|
||||
gw,imx6q-gw5910|\
|
||||
gw,imx6q-gw5912|\
|
||||
gw,imx6q-gw5913)
|
||||
if [ -c /dev/mtd1 ]; then
|
||||
# board boots from NAND
|
||||
ubootenv_add_uci_config /dev/mtd1 0x0 0x20000 0x40000
|
||||
@ -49,9 +48,9 @@ gw,imx6q-gw5913 )
|
||||
ubootenv_add_uci_config /dev/mmcblk0 0xd1400 0x20000
|
||||
fi
|
||||
;;
|
||||
toradex,apalis_imx6q-eval |\
|
||||
toradex,apalis_imx6q-ixora |\
|
||||
toradex,apalis_imx6q-ixora-v1.1 )
|
||||
toradex,apalis_imx6q-eval|\
|
||||
toradex,apalis_imx6q-ixora|\
|
||||
toradex,apalis_imx6q-ixora-v1.1)
|
||||
ubootenv_add_uci_config $(bootdev_from_uuid)boot0 -0x2200 0x2000 0x200 10
|
||||
;;
|
||||
wand,imx6dl-wandboard)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 LEDE
|
||||
#
|
||||
@ -31,15 +30,15 @@ ubootenv_mtdinfo () {
|
||||
}
|
||||
|
||||
case "$board" in
|
||||
alfa-network,ap120c-ac |\
|
||||
devolo,magic-2-wifi-next |\
|
||||
edgecore,ecw5211 |\
|
||||
glinet,gl-ap1300 |\
|
||||
glinet,gl-b1300 |\
|
||||
luma,wrtq-329acn |\
|
||||
openmesh,a42 |\
|
||||
openmesh,a62 |\
|
||||
plasmacloud,pa1200 |\
|
||||
alfa-network,ap120c-ac|\
|
||||
devolo,magic-2-wifi-next|\
|
||||
edgecore,ecw5211|\
|
||||
glinet,gl-ap1300|\
|
||||
glinet,gl-b1300|\
|
||||
luma,wrtq-329acn|\
|
||||
openmesh,a42|\
|
||||
openmesh,a62|\
|
||||
plasmacloud,pa1200|\
|
||||
plasmacloud,pa2200)
|
||||
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
@ -55,7 +54,7 @@ buffalo,wtr-m2133hp)
|
||||
linksys,ea6350v3)
|
||||
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
linksys,ea8300 |\
|
||||
linksys,ea8300|\
|
||||
linksys,mr8300)
|
||||
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 LEDE
|
||||
#
|
||||
@ -34,18 +33,18 @@ case "$board" in
|
||||
edgecore,ecw5410)
|
||||
ubootenv_add_uci_config "/dev/mtd11" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
linksys,ea7500-v1 |\
|
||||
linksys,ea7500-v1|\
|
||||
linksys,ea8500)
|
||||
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
netgear,r7800)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
|
||||
;;
|
||||
qcom,ipq8064-ap148 |\
|
||||
qcom,ipq8064-ap148|\
|
||||
qcom,ipq8064-db149)
|
||||
ubootenv_add_uci_config $(ubootenv_mtdinfo)
|
||||
;;
|
||||
ubnt,unifi-ac-hd |\
|
||||
ubnt,unifi-ac-hd|\
|
||||
zyxel,nbg6817)
|
||||
ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 LEDE
|
||||
#
|
||||
@ -13,7 +12,7 @@ touch /etc/config/ubootenv
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
traverse,ls1043v | \
|
||||
traverse,ls1043v|\
|
||||
traverse,ls1043s)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000"
|
||||
;;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2021 OpenWrt.org
|
||||
#
|
||||
@ -18,9 +17,10 @@ linksys,e8450-ubi)
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
bananapi,bpi-r64)
|
||||
. /lib/upgrade/platform.sh
|
||||
local rootdev=$(get_rootdev)
|
||||
local envdev=/dev/$(get_partition $rootdev ubootenv)
|
||||
. /lib/upgrade/common.sh
|
||||
export_bootdevice
|
||||
export_partdevice rootdev 0
|
||||
local envdev=/dev/$(get_partition_by_name $rootdev ubootenv)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
|
||||
;;
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
@ -13,7 +12,7 @@ touch /etc/config/ubootenv
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"cloudengines,pogoplug"* | \
|
||||
"cloudengines,pogoplug"*|\
|
||||
"shuttle,kd20")
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1"
|
||||
;;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2012 OpenWrt.org
|
||||
#
|
||||
|
||||
@ -24,42 +24,15 @@ define U-Boot/apalis_imx6
|
||||
NAME:=Toradex Apalis
|
||||
UBOOT_IMAGE:=SPL u-boot.img u-boot-with-spl.imx
|
||||
UBOOT_MAKE_FLAGS:=SPL u-boot.img u-boot-with-spl.imx
|
||||
BUILD_DEVICES:=apalis
|
||||
endef
|
||||
|
||||
define U-Boot/mx6cuboxi
|
||||
NAME:=SolidRun Cubox-i boards
|
||||
UBOOT_IMAGE:=SPL u-boot.img
|
||||
UBOOT_MAKE_FLAGS:=SPL u-boot.img
|
||||
BUILD_DEVICES:=cubox-i
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mx6sabresd
|
||||
NAME:=SABRE i.MX6Quad board
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6dl
|
||||
NAME:=Nitrogen6x i.MX6Dual-Lite 1GB board
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6dl2g
|
||||
NAME:=Nitrogen6x i.MX6Dual-Lite 2GB board
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6q
|
||||
NAME:=Nitrogen6x/SABRE Lite (MX6Q/1GB)
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6q2g
|
||||
NAME:=Nitrogen6x i.MX6Quad 2GB board
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6s
|
||||
NAME:=Nitrogen6x i.MX6Solo 512MB board
|
||||
endef
|
||||
|
||||
define U-Boot/nitrogen6s1g
|
||||
NAME:=Nitrogen6x i.MX6Solo 1GB board
|
||||
NAME:=SolidRun Cubox-i boards
|
||||
UBOOT_IMAGE:=SPL u-boot.img
|
||||
UBOOT_MAKE_FLAGS:=SPL u-boot.img
|
||||
BUILD_DEVICES:=cubox-i
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
define U-Boot/wandboard
|
||||
@ -70,13 +43,6 @@ endef
|
||||
UBOOT_TARGETS := \
|
||||
apalis_imx6 \
|
||||
mx6cuboxi \
|
||||
mx6sabresd \
|
||||
nitrogen6dl \
|
||||
nitrogen6dl2g \
|
||||
nitrogen6q \
|
||||
nitrogen6q2g \
|
||||
nitrogen6s \
|
||||
nitrogen6s1g \
|
||||
wandboard
|
||||
|
||||
UBOOT_MAKE_FLAGS += u-boot.imx
|
||||
|
||||
@ -186,7 +186,7 @@
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_hdr=mmc dev 0 0 && mmc erase 0x0 0x40 && mmc write $loadaddr 0x0 0x40
|
||||
+emmc_write_bl3=mmc dev 0 0 && mmc erase 0x1000 0x800 && mmc write $loadaddr 0x1000 0x800 && mmc erase 0x2000 0x800
|
||||
+emmc_write_bl3=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_production=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+emmc_init_bl=run sdmmc_read_emmc_bl2 && run emmc_write_bl2 && run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_emmc_bl3 && run emmc_write_bl3
|
||||
@ -196,9 +196,9 @@
|
||||
+sdmmc_write_recovery=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol
|
||||
+sdmmc_read_production=mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_read_vol
|
||||
+sdmmc_read_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_read_vol
|
||||
+sdmmc_read_emmc_hdr=mmc dev 1 && mmc read $loadaddr 0x100 0x40
|
||||
+sdmmc_read_emmc_bl2=mmc dev 1 && mmc read $loadaddr 0x200 0x100
|
||||
+sdmmc_read_emmc_bl3=mmc dev 1 && mmc read $loadaddr 0x800 0x800
|
||||
+sdmmc_read_emmc_hdr=mmc dev 1 && part start mmc 1 install part_addr && mmc read $loadaddr $part_addr 0x40
|
||||
+sdmmc_read_emmc_bl2=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x400 && mmc read $loadaddr $offset 0x400
|
||||
+sdmmc_read_emmc_bl3=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x1000 && mmc read $loadaddr $offset 0x1000
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size
|
||||
+part_default=production
|
||||
|
||||
@ -28,7 +28,7 @@ define KernelPackage/can
|
||||
CONFIG_CAN_SOFTING=n \
|
||||
CONFIG_NET_EMATCH_CANID=n \
|
||||
CONFIG_CAN_DEBUG_DEVICES=n
|
||||
FILES:=$(LINUX_DIR)/drivers/net/can/can-dev.ko \
|
||||
FILES:=$(LINUX_DIR)/drivers/net/can/dev/can-dev.ko \
|
||||
$(LINUX_DIR)/net/can/can.ko
|
||||
AUTOLOAD:=$(call AutoProbe,can can-dev)
|
||||
endef
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
From: Avraham Stern <avraham.stern@intel.com>
|
||||
Date: Sun, 6 Dec 2020 14:54:45 +0200
|
||||
Subject: [PATCH] mac80211: support Rx timestamp calculation for all preamble
|
||||
types
|
||||
|
||||
Add support for calculating the Rx timestamp for HE frames.
|
||||
Since now all frame types are supported, allow setting the Rx
|
||||
timestamp regardless of the frame type.
|
||||
|
||||
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
|
||||
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
|
||||
Link: https://lore.kernel.org/r/iwlwifi.20201206145305.4786559af475.Ia54486bb0a12e5351f9d5c60ef6fcda7c9e7141c@changeid
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/ieee80211_i.h
|
||||
+++ b/net/mac80211/ieee80211_i.h
|
||||
@@ -1600,13 +1600,8 @@ ieee80211_have_rx_timestamp(struct ieee8
|
||||
{
|
||||
WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
|
||||
status->flag & RX_FLAG_MACTIME_END);
|
||||
- if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END))
|
||||
- return true;
|
||||
- /* can't handle non-legacy preamble yet */
|
||||
- if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
|
||||
- status->encoding == RX_ENC_LEGACY)
|
||||
- return true;
|
||||
- return false;
|
||||
+ return !!(status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END |
|
||||
+ RX_FLAG_MACTIME_PLCP_START));
|
||||
}
|
||||
|
||||
void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
|
||||
--- a/net/mac80211/util.c
|
||||
+++ b/net/mac80211/util.c
|
||||
@@ -3665,6 +3665,7 @@ u64 ieee80211_calculate_rx_timestamp(str
|
||||
u64 ts = status->mactime;
|
||||
struct rate_info ri;
|
||||
u16 rate;
|
||||
+ u8 n_ltf;
|
||||
|
||||
if (WARN_ON(!ieee80211_have_rx_timestamp(status)))
|
||||
return 0;
|
||||
@@ -3675,11 +3676,58 @@ u64 ieee80211_calculate_rx_timestamp(str
|
||||
|
||||
/* Fill cfg80211 rate info */
|
||||
switch (status->encoding) {
|
||||
+ case RX_ENC_HE:
|
||||
+ ri.flags |= RATE_INFO_FLAGS_HE_MCS;
|
||||
+ ri.mcs = status->rate_idx;
|
||||
+ ri.nss = status->nss;
|
||||
+ ri.he_ru_alloc = status->he_ru;
|
||||
+ if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
|
||||
+ ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
|
||||
+
|
||||
+ /*
|
||||
+ * See P802.11ax_D6.0, section 27.3.4 for
|
||||
+ * VHT PPDU format.
|
||||
+ */
|
||||
+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) {
|
||||
+ mpdu_offset += 2;
|
||||
+ ts += 36;
|
||||
+
|
||||
+ /*
|
||||
+ * TODO:
|
||||
+ * For HE MU PPDU, add the HE-SIG-B.
|
||||
+ * For HE ER PPDU, add 8us for the HE-SIG-A.
|
||||
+ * For HE TB PPDU, add 4us for the HE-STF.
|
||||
+ * Add the HE-LTF durations - variable.
|
||||
+ */
|
||||
+ }
|
||||
+
|
||||
+ break;
|
||||
case RX_ENC_HT:
|
||||
ri.mcs = status->rate_idx;
|
||||
ri.flags |= RATE_INFO_FLAGS_MCS;
|
||||
if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
|
||||
ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
|
||||
+
|
||||
+ /*
|
||||
+ * See P802.11REVmd_D3.0, section 19.3.2 for
|
||||
+ * HT PPDU format.
|
||||
+ */
|
||||
+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) {
|
||||
+ mpdu_offset += 2;
|
||||
+ if (status->enc_flags & RX_ENC_FLAG_HT_GF)
|
||||
+ ts += 24;
|
||||
+ else
|
||||
+ ts += 32;
|
||||
+
|
||||
+ /*
|
||||
+ * Add Data HT-LTFs per streams
|
||||
+ * TODO: add Extension HT-LTFs, 4us per LTF
|
||||
+ */
|
||||
+ n_ltf = ((ri.mcs >> 3) & 3) + 1;
|
||||
+ n_ltf = n_ltf == 3 ? 4 : n_ltf;
|
||||
+ ts += n_ltf * 4;
|
||||
+ }
|
||||
+
|
||||
break;
|
||||
case RX_ENC_VHT:
|
||||
ri.flags |= RATE_INFO_FLAGS_VHT_MCS;
|
||||
@@ -3687,6 +3735,23 @@ u64 ieee80211_calculate_rx_timestamp(str
|
||||
ri.nss = status->nss;
|
||||
if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
|
||||
ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
|
||||
+
|
||||
+ /*
|
||||
+ * See P802.11REVmd_D3.0, section 21.3.2 for
|
||||
+ * VHT PPDU format.
|
||||
+ */
|
||||
+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) {
|
||||
+ mpdu_offset += 2;
|
||||
+ ts += 36;
|
||||
+
|
||||
+ /*
|
||||
+ * Add VHT-LTFs per streams
|
||||
+ */
|
||||
+ n_ltf = (ri.nss != 1) && (ri.nss % 2) ?
|
||||
+ ri.nss + 1 : ri.nss;
|
||||
+ ts += 4 * n_ltf;
|
||||
+ }
|
||||
+
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
@@ -3710,7 +3775,6 @@ u64 ieee80211_calculate_rx_timestamp(str
|
||||
ri.legacy = DIV_ROUND_UP(bitrate, (1 << shift));
|
||||
|
||||
if (status->flag & RX_FLAG_MACTIME_PLCP_START) {
|
||||
- /* TODO: handle HT/VHT preambles */
|
||||
if (status->band == NL80211_BAND_5GHZ) {
|
||||
ts += 20 << shift;
|
||||
mpdu_offset += 2;
|
||||
@ -0,0 +1,31 @@
|
||||
From: Ben Greear <greearb@candelatech.com>
|
||||
Date: Tue, 30 Mar 2021 16:07:49 -0700
|
||||
Subject: [PATCH] mac80211: fix time-is-after bug in mlme
|
||||
|
||||
The incorrect timeout check caused probing to happen when it did
|
||||
not need to happen. This in turn caused tx performance drop
|
||||
for around 5 seconds in ath10k-ct driver. Possibly that tx drop
|
||||
is due to a secondary issue, but fixing the probe to not happen
|
||||
when traffic is running fixes the symptom.
|
||||
|
||||
Signed-off-by: Ben Greear <greearb@candelatech.com>
|
||||
Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
|
||||
Acked-by: Felix Fietkau <nbd@nbd.name>
|
||||
Link: https://lore.kernel.org/r/20210330230749.14097-1-greearb@candelatech.com
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
---
|
||||
|
||||
--- a/net/mac80211/mlme.c
|
||||
+++ b/net/mac80211/mlme.c
|
||||
@@ -4691,7 +4691,10 @@ static void ieee80211_sta_conn_mon_timer
|
||||
timeout = sta->rx_stats.last_rx;
|
||||
timeout += IEEE80211_CONNECTION_IDLE_TIME;
|
||||
|
||||
- if (time_is_before_jiffies(timeout)) {
|
||||
+ /* If timeout is after now, then update timer to fire at
|
||||
+ * the later date, but do not actually probe at this time.
|
||||
+ */
|
||||
+ if (time_is_after_jiffies(timeout)) {
|
||||
mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout));
|
||||
return;
|
||||
}
|
||||
@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-04-07
|
||||
PKG_SOURCE_VERSION:=813db729c02ffa74fdda6d461afeb5aabc5706bb
|
||||
PKG_MIRROR_HASH:=63bd913f8ba3e85ae7a4575737a2c66377ebf59fa543e025150c650dd9ae13f2
|
||||
PKG_SOURCE_DATE:=2021-04-11
|
||||
PKG_SOURCE_VERSION:=bf45b30d891961dd7c4139dddb58b909ea2c2b5a
|
||||
PKG_MIRROR_HASH:=431cecf80dafa986e805f809522721c2bb26289867d6770695d49baf8b471bea
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
@ -3,41 +3,44 @@
|
||||
"syscalls": [
|
||||
{
|
||||
"names": [
|
||||
"read",
|
||||
"write",
|
||||
"writev",
|
||||
"open",
|
||||
"close",
|
||||
"time",
|
||||
"brk",
|
||||
"ioctl",
|
||||
"uname",
|
||||
"bind",
|
||||
"brk",
|
||||
"clock_gettime",
|
||||
"close",
|
||||
"connect",
|
||||
"getsockname",
|
||||
"recvmsg",
|
||||
"recvfrom",
|
||||
"sendmsg",
|
||||
"sendto",
|
||||
"setsockopt",
|
||||
"socket",
|
||||
"pipe",
|
||||
"poll",
|
||||
"fcntl64",
|
||||
"fstat",
|
||||
"epoll_create",
|
||||
"epoll_create1",
|
||||
"epoll_ctl",
|
||||
"epoll_wait",
|
||||
"epoll_pwait",
|
||||
"rt_sigaction",
|
||||
"sigreturn",
|
||||
"rt_sigreturn",
|
||||
"rt_sigprocmask",
|
||||
"exit_group",
|
||||
"epoll_wait",
|
||||
"exit",
|
||||
"exit_group",
|
||||
"fcntl",
|
||||
"clock_gettime"
|
||||
"fcntl64",
|
||||
"fstat",
|
||||
"getsockname",
|
||||
"ioctl",
|
||||
"open",
|
||||
"openat",
|
||||
"pipe",
|
||||
"pipe2",
|
||||
"poll",
|
||||
"ppoll",
|
||||
"read",
|
||||
"recvfrom",
|
||||
"recvmsg",
|
||||
"rt_sigaction",
|
||||
"rt_sigprocmask",
|
||||
"rt_sigreturn",
|
||||
"sendmsg",
|
||||
"sendto",
|
||||
"setsockopt",
|
||||
"sigreturn",
|
||||
"socket",
|
||||
"time",
|
||||
"uname",
|
||||
"write",
|
||||
"writev"
|
||||
],
|
||||
"action": "SCMP_ACT_ALLOW"
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ SUBTARGETS:=generic mikrotik nand tiny
|
||||
FEATURES:=ramdisk squashfs usbgadget
|
||||
|
||||
KERNEL_PATCHVER:=5.4
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <30000000>;
|
||||
spi-max-frequency = <50000000>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
|
||||
@ -2,8 +2,6 @@ BOARDNAME:=Generic
|
||||
|
||||
DEFAULT_PACKAGES += wpad-basic-wolfssl
|
||||
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for generic Atheros AR71xx/AR913x/AR934x based boards.
|
||||
endef
|
||||
|
||||
@ -5,8 +5,6 @@ IMAGES_DIR := ../../..
|
||||
|
||||
DEFAULT_PACKAGES += wpad-basic-wolfssl
|
||||
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for MikroTik devices based on Qualcomm Atheros
|
||||
MIPS SoCs (AR71xx, AR72xx, AR91xx, AR93xx, QCA95xx).
|
||||
|
||||
@ -4,8 +4,6 @@ FEATURES += nand
|
||||
|
||||
DEFAULT_PACKAGES += wpad-basic-wolfssl
|
||||
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
|
||||
define Target/Description
|
||||
Firmware for boards using Qualcomm Atheros, MIPS-based SoCs
|
||||
in the ar72xx and subsequent series, with support for NAND flash
|
||||
|
||||
@ -3,8 +3,6 @@ FEATURES += small_flash
|
||||
|
||||
DEFAULT_PACKAGES += wpad-basic-wolfssl
|
||||
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for Atheros AR71xx/AR913x/AR934x based boards with small flash
|
||||
endef
|
||||
|
||||
@ -76,7 +76,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
/**
|
||||
* napi_synchronize - wait until NAPI is not running
|
||||
@@ -1835,6 +1825,8 @@ enum netdev_priv_flags {
|
||||
@@ -1842,6 +1832,8 @@ enum netdev_ml_priv_type {
|
||||
*
|
||||
* @wol_enabled: Wake-on-LAN is enabled
|
||||
*
|
||||
@ -85,7 +85,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
* @net_notifier_list: List of per-net netdev notifier block
|
||||
* that follow this device when it is moved
|
||||
* to another network namespace.
|
||||
@@ -2152,6 +2144,7 @@ struct net_device {
|
||||
@@ -2161,6 +2153,7 @@ struct net_device {
|
||||
struct lock_class_key *qdisc_running_key;
|
||||
bool proto_down;
|
||||
unsigned wol_enabled:1;
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
From: Oz Shlomo <ozsh@nvidia.com>
|
||||
Date: Tue, 23 Mar 2021 00:56:19 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: separate replace, destroy and
|
||||
stats to different workqueues
|
||||
|
||||
Currently the flow table offload replace, destroy and stats work items are
|
||||
executed on a single workqueue. As such, DESTROY and STATS commands may
|
||||
be backloged after a burst of REPLACE work items. This scenario can bloat
|
||||
up memory and may cause active connections to age.
|
||||
|
||||
Instatiate add, del and stats workqueues to avoid backlogs of non-dependent
|
||||
actions. Provide sysfs control over the workqueue attributes, allowing
|
||||
userspace applications to control the workqueue cpumask.
|
||||
|
||||
Signed-off-by: Oz Shlomo <ozsh@nvidia.com>
|
||||
Reviewed-by: Paul Blakey <paulb@nvidia.com>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_offload.c
|
||||
+++ b/net/netfilter/nf_flow_table_offload.c
|
||||
@@ -13,7 +13,9 @@
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
#include <net/netfilter/nf_conntrack_tuple.h>
|
||||
|
||||
-static struct workqueue_struct *nf_flow_offload_wq;
|
||||
+static struct workqueue_struct *nf_flow_offload_add_wq;
|
||||
+static struct workqueue_struct *nf_flow_offload_del_wq;
|
||||
+static struct workqueue_struct *nf_flow_offload_stats_wq;
|
||||
|
||||
struct flow_offload_work {
|
||||
struct list_head list;
|
||||
@@ -826,7 +828,12 @@ static void flow_offload_work_handler(st
|
||||
|
||||
static void flow_offload_queue_work(struct flow_offload_work *offload)
|
||||
{
|
||||
- queue_work(nf_flow_offload_wq, &offload->work);
|
||||
+ if (offload->cmd == FLOW_CLS_REPLACE)
|
||||
+ queue_work(nf_flow_offload_add_wq, &offload->work);
|
||||
+ else if (offload->cmd == FLOW_CLS_DESTROY)
|
||||
+ queue_work(nf_flow_offload_del_wq, &offload->work);
|
||||
+ else
|
||||
+ queue_work(nf_flow_offload_stats_wq, &offload->work);
|
||||
}
|
||||
|
||||
static struct flow_offload_work *
|
||||
@@ -898,8 +905,11 @@ void nf_flow_offload_stats(struct nf_flo
|
||||
|
||||
void nf_flow_table_offload_flush(struct nf_flowtable *flowtable)
|
||||
{
|
||||
- if (nf_flowtable_hw_offload(flowtable))
|
||||
- flush_workqueue(nf_flow_offload_wq);
|
||||
+ if (nf_flowtable_hw_offload(flowtable)) {
|
||||
+ flush_workqueue(nf_flow_offload_add_wq);
|
||||
+ flush_workqueue(nf_flow_offload_del_wq);
|
||||
+ flush_workqueue(nf_flow_offload_stats_wq);
|
||||
+ }
|
||||
}
|
||||
|
||||
static int nf_flow_table_block_setup(struct nf_flowtable *flowtable,
|
||||
@@ -1011,15 +1021,33 @@ EXPORT_SYMBOL_GPL(nf_flow_table_offload_
|
||||
|
||||
int nf_flow_table_offload_init(void)
|
||||
{
|
||||
- nf_flow_offload_wq = alloc_workqueue("nf_flow_table_offload",
|
||||
- WQ_UNBOUND, 0);
|
||||
- if (!nf_flow_offload_wq)
|
||||
+ nf_flow_offload_add_wq = alloc_workqueue("nf_ft_offload_add",
|
||||
+ WQ_UNBOUND | WQ_SYSFS, 0);
|
||||
+ if (!nf_flow_offload_add_wq)
|
||||
return -ENOMEM;
|
||||
|
||||
+ nf_flow_offload_del_wq = alloc_workqueue("nf_ft_offload_del",
|
||||
+ WQ_UNBOUND | WQ_SYSFS, 0);
|
||||
+ if (!nf_flow_offload_del_wq)
|
||||
+ goto err_del_wq;
|
||||
+
|
||||
+ nf_flow_offload_stats_wq = alloc_workqueue("nf_ft_offload_stats",
|
||||
+ WQ_UNBOUND | WQ_SYSFS, 0);
|
||||
+ if (!nf_flow_offload_stats_wq)
|
||||
+ goto err_stats_wq;
|
||||
+
|
||||
return 0;
|
||||
+
|
||||
+err_stats_wq:
|
||||
+ destroy_workqueue(nf_flow_offload_del_wq);
|
||||
+err_del_wq:
|
||||
+ destroy_workqueue(nf_flow_offload_add_wq);
|
||||
+ return -ENOMEM;
|
||||
}
|
||||
|
||||
void nf_flow_table_offload_exit(void)
|
||||
{
|
||||
- destroy_workqueue(nf_flow_offload_wq);
|
||||
+ destroy_workqueue(nf_flow_offload_add_wq);
|
||||
+ destroy_workqueue(nf_flow_offload_del_wq);
|
||||
+ destroy_workqueue(nf_flow_offload_stats_wq);
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:20 +0100
|
||||
Subject: [PATCH] netfilter: Fix fall-through warnings for Clang
|
||||
|
||||
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
|
||||
warnings by explicitly adding multiple break statements instead of just
|
||||
letting the code fall through to the next case.
|
||||
|
||||
Link: https://github.com/KSPP/linux/issues/115
|
||||
Acked-by: Florian Westphal <fw@strlen.de>
|
||||
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_conntrack_proto_dccp.c
|
||||
+++ b/net/netfilter/nf_conntrack_proto_dccp.c
|
||||
@@ -397,6 +397,7 @@ dccp_new(struct nf_conn *ct, const struc
|
||||
msg = "not picking up existing connection ";
|
||||
goto out_invalid;
|
||||
}
|
||||
+ break;
|
||||
case CT_DCCP_REQUEST:
|
||||
break;
|
||||
case CT_DCCP_INVALID:
|
||||
--- a/net/netfilter/nf_tables_api.c
|
||||
+++ b/net/netfilter/nf_tables_api.c
|
||||
@@ -8364,6 +8364,7 @@ static int nf_tables_check_loops(const s
|
||||
data->verdict.chain);
|
||||
if (err < 0)
|
||||
return err;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
--- a/net/netfilter/nft_ct.c
|
||||
+++ b/net/netfilter/nft_ct.c
|
||||
@@ -528,6 +528,7 @@ static void __nft_ct_set_destroy(const s
|
||||
case NFT_CT_ZONE:
|
||||
if (--nft_ct_pcpu_template_refcnt == 0)
|
||||
nft_ct_tmpl_put_pcpu();
|
||||
+ break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@ -0,0 +1,22 @@
|
||||
From: YueHaibing <yuehaibing@huawei.com>
|
||||
Date: Tue, 23 Mar 2021 00:56:21 +0100
|
||||
Subject: [PATCH] netfilter: conntrack: Remove unused variable
|
||||
declaration
|
||||
|
||||
commit e97c3e278e95 ("tproxy: split off ipv6 defragmentation to a separate
|
||||
module") left behind this.
|
||||
|
||||
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
|
||||
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
|
||||
@@ -4,7 +4,4 @@
|
||||
|
||||
extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
|
||||
|
||||
-#include <linux/sysctl.h>
|
||||
-extern struct ctl_table nf_ct_ipv6_sysctl_table[];
|
||||
-
|
||||
#endif /* _NF_CONNTRACK_IPV6_H*/
|
||||
@ -0,0 +1,291 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:22 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: consolidate
|
||||
skb_try_make_writable() call
|
||||
|
||||
Fetch the layer 4 header size to be mangled by NAT when building the
|
||||
tuple, then use it to make writable the network and the transport
|
||||
headers. After this update, the NAT routines now assumes that the skbuff
|
||||
area is writable. Do the pointer refetch only after the single
|
||||
skb_try_make_writable() call.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_core.c
|
||||
+++ b/net/netfilter/nf_flow_table_core.c
|
||||
@@ -395,9 +395,6 @@ static int nf_flow_nat_port_tcp(struct s
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*tcph)))
|
||||
- return -1;
|
||||
-
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace2(&tcph->check, skb, port, new_port, false);
|
||||
|
||||
@@ -409,9 +406,6 @@ static int nf_flow_nat_port_udp(struct s
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*udph)))
|
||||
- return -1;
|
||||
-
|
||||
udph = (void *)(skb_network_header(skb) + thoff);
|
||||
if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
inet_proto_csum_replace2(&udph->check, skb, port,
|
||||
@@ -447,9 +441,6 @@ int nf_flow_snat_port(const struct flow_
|
||||
struct flow_ports *hdr;
|
||||
__be16 port, new_port;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*hdr)))
|
||||
- return -1;
|
||||
-
|
||||
hdr = (void *)(skb_network_header(skb) + thoff);
|
||||
|
||||
switch (dir) {
|
||||
@@ -478,9 +469,6 @@ int nf_flow_dnat_port(const struct flow_
|
||||
struct flow_ports *hdr;
|
||||
__be16 port, new_port;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*hdr)))
|
||||
- return -1;
|
||||
-
|
||||
hdr = (void *)(skb_network_header(skb) + thoff);
|
||||
|
||||
switch (dir) {
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -39,9 +39,6 @@ static int nf_flow_nat_ip_tcp(struct sk_
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*tcph)))
|
||||
- return -1;
|
||||
-
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, true);
|
||||
|
||||
@@ -53,9 +50,6 @@ static int nf_flow_nat_ip_udp(struct sk_
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*udph)))
|
||||
- return -1;
|
||||
-
|
||||
udph = (void *)(skb_network_header(skb) + thoff);
|
||||
if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
inet_proto_csum_replace4(&udph->check, skb, addr,
|
||||
@@ -136,19 +130,17 @@ static int nf_flow_dnat_ip(const struct
|
||||
}
|
||||
|
||||
static int nf_flow_nat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
- unsigned int thoff, enum flow_offload_tuple_dir dir)
|
||||
+ unsigned int thoff, enum flow_offload_tuple_dir dir,
|
||||
+ struct iphdr *iph)
|
||||
{
|
||||
- struct iphdr *iph = ip_hdr(skb);
|
||||
-
|
||||
if (test_bit(NF_FLOW_SNAT, &flow->flags) &&
|
||||
(nf_flow_snat_port(flow, skb, thoff, iph->protocol, dir) < 0 ||
|
||||
- nf_flow_snat_ip(flow, skb, ip_hdr(skb), thoff, dir) < 0))
|
||||
+ nf_flow_snat_ip(flow, skb, iph, thoff, dir) < 0))
|
||||
return -1;
|
||||
|
||||
- iph = ip_hdr(skb);
|
||||
if (test_bit(NF_FLOW_DNAT, &flow->flags) &&
|
||||
(nf_flow_dnat_port(flow, skb, thoff, iph->protocol, dir) < 0 ||
|
||||
- nf_flow_dnat_ip(flow, skb, ip_hdr(skb), thoff, dir) < 0))
|
||||
+ nf_flow_dnat_ip(flow, skb, iph, thoff, dir) < 0))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -160,10 +152,10 @@ static bool ip_has_options(unsigned int
|
||||
}
|
||||
|
||||
static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev,
|
||||
- struct flow_offload_tuple *tuple)
|
||||
+ struct flow_offload_tuple *tuple, u32 *hdrsize)
|
||||
{
|
||||
- unsigned int thoff, hdrsize;
|
||||
struct flow_ports *ports;
|
||||
+ unsigned int thoff;
|
||||
struct iphdr *iph;
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(*iph)))
|
||||
@@ -178,10 +170,10 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
|
||||
switch (iph->protocol) {
|
||||
case IPPROTO_TCP:
|
||||
- hdrsize = sizeof(struct tcphdr);
|
||||
+ *hdrsize = sizeof(struct tcphdr);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
- hdrsize = sizeof(struct udphdr);
|
||||
+ *hdrsize = sizeof(struct udphdr);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
@@ -191,7 +183,7 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
return -1;
|
||||
|
||||
thoff = iph->ihl * 4;
|
||||
- if (!pskb_may_pull(skb, thoff + hdrsize))
|
||||
+ if (!pskb_may_pull(skb, thoff + *hdrsize))
|
||||
return -1;
|
||||
|
||||
iph = ip_hdr(skb);
|
||||
@@ -252,11 +244,12 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
unsigned int thoff;
|
||||
struct iphdr *iph;
|
||||
__be32 nexthop;
|
||||
+ u32 hdrsize;
|
||||
|
||||
if (skb->protocol != htons(ETH_P_IP))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (nf_flow_tuple_ip(skb, state->in, &tuple) < 0)
|
||||
+ if (nf_flow_tuple_ip(skb, state->in, &tuple, &hdrsize) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -271,11 +264,13 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (skb_try_make_writable(skb, sizeof(*iph)))
|
||||
+ iph = ip_hdr(skb);
|
||||
+ thoff = iph->ihl * 4;
|
||||
+ if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
return NF_DROP;
|
||||
|
||||
- thoff = ip_hdr(skb)->ihl * 4;
|
||||
- if (nf_flow_state_check(flow, ip_hdr(skb)->protocol, skb, thoff))
|
||||
+ iph = ip_hdr(skb);
|
||||
+ if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
@@ -285,10 +280,9 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
- if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0)
|
||||
+ if (nf_flow_nat_ip(flow, skb, thoff, dir, iph) < 0)
|
||||
return NF_DROP;
|
||||
|
||||
- iph = ip_hdr(skb);
|
||||
ip_decrease_ttl(iph);
|
||||
skb->tstamp = 0;
|
||||
|
||||
@@ -317,9 +311,6 @@ static int nf_flow_nat_ipv6_tcp(struct s
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*tcph)))
|
||||
- return -1;
|
||||
-
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace16(&tcph->check, skb, addr->s6_addr32,
|
||||
new_addr->s6_addr32, true);
|
||||
@@ -333,9 +324,6 @@ static int nf_flow_nat_ipv6_udp(struct s
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
- if (skb_try_make_writable(skb, thoff + sizeof(*udph)))
|
||||
- return -1;
|
||||
-
|
||||
udph = (void *)(skb_network_header(skb) + thoff);
|
||||
if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
inet_proto_csum_replace16(&udph->check, skb, addr->s6_addr32,
|
||||
@@ -417,31 +405,30 @@ static int nf_flow_dnat_ipv6(const struc
|
||||
|
||||
static int nf_flow_nat_ipv6(const struct flow_offload *flow,
|
||||
struct sk_buff *skb,
|
||||
- enum flow_offload_tuple_dir dir)
|
||||
+ enum flow_offload_tuple_dir dir,
|
||||
+ struct ipv6hdr *ip6h)
|
||||
{
|
||||
- struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
unsigned int thoff = sizeof(*ip6h);
|
||||
|
||||
if (test_bit(NF_FLOW_SNAT, &flow->flags) &&
|
||||
(nf_flow_snat_port(flow, skb, thoff, ip6h->nexthdr, dir) < 0 ||
|
||||
- nf_flow_snat_ipv6(flow, skb, ipv6_hdr(skb), thoff, dir) < 0))
|
||||
+ nf_flow_snat_ipv6(flow, skb, ip6h, thoff, dir) < 0))
|
||||
return -1;
|
||||
|
||||
- ip6h = ipv6_hdr(skb);
|
||||
if (test_bit(NF_FLOW_DNAT, &flow->flags) &&
|
||||
(nf_flow_dnat_port(flow, skb, thoff, ip6h->nexthdr, dir) < 0 ||
|
||||
- nf_flow_dnat_ipv6(flow, skb, ipv6_hdr(skb), thoff, dir) < 0))
|
||||
+ nf_flow_dnat_ipv6(flow, skb, ip6h, thoff, dir) < 0))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
|
||||
- struct flow_offload_tuple *tuple)
|
||||
+ struct flow_offload_tuple *tuple, u32 *hdrsize)
|
||||
{
|
||||
- unsigned int thoff, hdrsize;
|
||||
struct flow_ports *ports;
|
||||
struct ipv6hdr *ip6h;
|
||||
+ unsigned int thoff;
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(*ip6h)))
|
||||
return -1;
|
||||
@@ -450,10 +437,10 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
|
||||
switch (ip6h->nexthdr) {
|
||||
case IPPROTO_TCP:
|
||||
- hdrsize = sizeof(struct tcphdr);
|
||||
+ *hdrsize = sizeof(struct tcphdr);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
- hdrsize = sizeof(struct udphdr);
|
||||
+ *hdrsize = sizeof(struct udphdr);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
@@ -463,7 +450,7 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
return -1;
|
||||
|
||||
thoff = sizeof(*ip6h);
|
||||
- if (!pskb_may_pull(skb, thoff + hdrsize))
|
||||
+ if (!pskb_may_pull(skb, thoff + *hdrsize))
|
||||
return -1;
|
||||
|
||||
ip6h = ipv6_hdr(skb);
|
||||
@@ -493,11 +480,12 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
struct net_device *outdev;
|
||||
struct ipv6hdr *ip6h;
|
||||
struct rt6_info *rt;
|
||||
+ u32 hdrsize;
|
||||
|
||||
if (skb->protocol != htons(ETH_P_IPV6))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (nf_flow_tuple_ipv6(skb, state->in, &tuple) < 0)
|
||||
+ if (nf_flow_tuple_ipv6(skb, state->in, &tuple, &hdrsize) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -523,13 +511,13 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
- if (skb_try_make_writable(skb, sizeof(*ip6h)))
|
||||
+ if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
|
||||
return NF_DROP;
|
||||
|
||||
- if (nf_flow_nat_ipv6(flow, skb, dir) < 0)
|
||||
+ ip6h = ipv6_hdr(skb);
|
||||
+ if (nf_flow_nat_ipv6(flow, skb, dir, ip6h) < 0)
|
||||
return NF_DROP;
|
||||
|
||||
- ip6h = ipv6_hdr(skb);
|
||||
ip6h->hop_limit--;
|
||||
skb->tstamp = 0;
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:23 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: move skb_try_make_writable()
|
||||
before NAT in IPv4
|
||||
|
||||
For consistency with the IPv6 flowtable datapath and to make sure the
|
||||
skbuff is writable right before the NAT header updates.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -266,10 +266,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
|
||||
iph = ip_hdr(skb);
|
||||
thoff = iph->ihl * 4;
|
||||
- if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
- return NF_DROP;
|
||||
-
|
||||
- iph = ip_hdr(skb);
|
||||
if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
@@ -280,6 +276,10 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
+ if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
+ return NF_DROP;
|
||||
+
|
||||
+ iph = ip_hdr(skb);
|
||||
if (nf_flow_nat_ip(flow, skb, thoff, dir, iph) < 0)
|
||||
return NF_DROP;
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:24 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: move FLOW_OFFLOAD_DIR_MAX away
|
||||
from enumeration
|
||||
|
||||
This allows to remove the default case which should not ever happen and
|
||||
that was added to avoid gcc warnings on unhandled FLOW_OFFLOAD_DIR_MAX
|
||||
enumeration case.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -86,8 +86,8 @@ static inline bool nf_flowtable_hw_offlo
|
||||
enum flow_offload_tuple_dir {
|
||||
FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
|
||||
FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
|
||||
- FLOW_OFFLOAD_DIR_MAX = IP_CT_DIR_MAX
|
||||
};
|
||||
+#define FLOW_OFFLOAD_DIR_MAX IP_CT_DIR_MAX
|
||||
|
||||
struct flow_offload_tuple {
|
||||
union {
|
||||
--- a/net/netfilter/nf_flow_table_core.c
|
||||
+++ b/net/netfilter/nf_flow_table_core.c
|
||||
@@ -454,8 +454,6 @@ int nf_flow_snat_port(const struct flow_
|
||||
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
|
||||
hdr->dest = new_port;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
|
||||
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
@@ -482,8 +480,6 @@ int nf_flow_dnat_port(const struct flow_
|
||||
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
|
||||
hdr->source = new_port;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
|
||||
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -96,8 +96,6 @@ static int nf_flow_snat_ip(const struct
|
||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v4.s_addr;
|
||||
iph->daddr = new_addr;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
csum_replace4(&iph->check, addr, new_addr);
|
||||
|
||||
@@ -121,8 +119,6 @@ static int nf_flow_dnat_ip(const struct
|
||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v4.s_addr;
|
||||
iph->saddr = new_addr;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
csum_replace4(&iph->check, addr, new_addr);
|
||||
|
||||
@@ -371,8 +367,6 @@ static int nf_flow_snat_ipv6(const struc
|
||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6;
|
||||
ip6h->daddr = new_addr;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
|
||||
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
@@ -396,8 +390,6 @@ static int nf_flow_dnat_ipv6(const struc
|
||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6;
|
||||
ip6h->saddr = new_addr;
|
||||
break;
|
||||
- default:
|
||||
- return -1;
|
||||
}
|
||||
|
||||
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
@ -0,0 +1,394 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:25 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: fast NAT functions never fail
|
||||
|
||||
Simplify existing fast NAT routines by returning void. After the
|
||||
skb_try_make_writable() call consolidation, these routines cannot ever
|
||||
fail.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -229,12 +229,12 @@ void nf_flow_table_free(struct nf_flowta
|
||||
|
||||
void flow_offload_teardown(struct flow_offload *flow);
|
||||
|
||||
-int nf_flow_snat_port(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, unsigned int thoff,
|
||||
- u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
-int nf_flow_dnat_port(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, unsigned int thoff,
|
||||
- u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
+void nf_flow_snat_port(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, unsigned int thoff,
|
||||
+ u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
+void nf_flow_dnat_port(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, unsigned int thoff,
|
||||
+ u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
|
||||
struct flow_ports {
|
||||
__be16 source, dest;
|
||||
--- a/net/netfilter/nf_flow_table_core.c
|
||||
+++ b/net/netfilter/nf_flow_table_core.c
|
||||
@@ -389,20 +389,17 @@ static void nf_flow_offload_work_gc(stru
|
||||
queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
|
||||
}
|
||||
|
||||
-
|
||||
-static int nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
- __be16 port, __be16 new_port)
|
||||
+static void nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ __be16 port, __be16 new_port)
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace2(&tcph->check, skb, port, new_port, false);
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
- __be16 port, __be16 new_port)
|
||||
+static void nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ __be16 port, __be16 new_port)
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
@@ -413,30 +410,24 @@ static int nf_flow_nat_port_udp(struct s
|
||||
if (!udph->check)
|
||||
udph->check = CSUM_MANGLED_0;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_port(struct sk_buff *skb, unsigned int thoff,
|
||||
- u8 protocol, __be16 port, __be16 new_port)
|
||||
+static void nf_flow_nat_port(struct sk_buff *skb, unsigned int thoff,
|
||||
+ u8 protocol, __be16 port, __be16 new_port)
|
||||
{
|
||||
switch (protocol) {
|
||||
case IPPROTO_TCP:
|
||||
- if (nf_flow_nat_port_tcp(skb, thoff, port, new_port) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_port_tcp(skb, thoff, port, new_port);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
- if (nf_flow_nat_port_udp(skb, thoff, port, new_port) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_port_udp(skb, thoff, port, new_port);
|
||||
break;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-int nf_flow_snat_port(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, unsigned int thoff,
|
||||
- u8 protocol, enum flow_offload_tuple_dir dir)
|
||||
+void nf_flow_snat_port(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, unsigned int thoff,
|
||||
+ u8 protocol, enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
struct flow_ports *hdr;
|
||||
__be16 port, new_port;
|
||||
@@ -456,13 +447,13 @@ int nf_flow_snat_port(const struct flow_
|
||||
break;
|
||||
}
|
||||
|
||||
- return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
+ nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_flow_snat_port);
|
||||
|
||||
-int nf_flow_dnat_port(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, unsigned int thoff,
|
||||
- u8 protocol, enum flow_offload_tuple_dir dir)
|
||||
+void nf_flow_dnat_port(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
+ unsigned int thoff, u8 protocol,
|
||||
+ enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
struct flow_ports *hdr;
|
||||
__be16 port, new_port;
|
||||
@@ -482,7 +473,7 @@ int nf_flow_dnat_port(const struct flow_
|
||||
break;
|
||||
}
|
||||
|
||||
- return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
+ nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_flow_dnat_port);
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -34,19 +34,17 @@ static int nf_flow_state_check(struct fl
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ip_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
- __be32 addr, __be32 new_addr)
|
||||
+static void nf_flow_nat_ip_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ __be32 addr, __be32 new_addr)
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, true);
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ip_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
- __be32 addr, __be32 new_addr)
|
||||
+static void nf_flow_nat_ip_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ __be32 addr, __be32 new_addr)
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
@@ -57,31 +55,25 @@ static int nf_flow_nat_ip_udp(struct sk_
|
||||
if (!udph->check)
|
||||
udph->check = CSUM_MANGLED_0;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ip_l4proto(struct sk_buff *skb, struct iphdr *iph,
|
||||
- unsigned int thoff, __be32 addr,
|
||||
- __be32 new_addr)
|
||||
+static void nf_flow_nat_ip_l4proto(struct sk_buff *skb, struct iphdr *iph,
|
||||
+ unsigned int thoff, __be32 addr,
|
||||
+ __be32 new_addr)
|
||||
{
|
||||
switch (iph->protocol) {
|
||||
case IPPROTO_TCP:
|
||||
- if (nf_flow_nat_ip_tcp(skb, thoff, addr, new_addr) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ip_tcp(skb, thoff, addr, new_addr);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
- if (nf_flow_nat_ip_udp(skb, thoff, addr, new_addr) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ip_udp(skb, thoff, addr, new_addr);
|
||||
break;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_snat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
- struct iphdr *iph, unsigned int thoff,
|
||||
- enum flow_offload_tuple_dir dir)
|
||||
+static void nf_flow_snat_ip(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, struct iphdr *iph,
|
||||
+ unsigned int thoff, enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
__be32 addr, new_addr;
|
||||
|
||||
@@ -99,12 +91,12 @@ static int nf_flow_snat_ip(const struct
|
||||
}
|
||||
csum_replace4(&iph->check, addr, new_addr);
|
||||
|
||||
- return nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr);
|
||||
+ nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr);
|
||||
}
|
||||
|
||||
-static int nf_flow_dnat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
- struct iphdr *iph, unsigned int thoff,
|
||||
- enum flow_offload_tuple_dir dir)
|
||||
+static void nf_flow_dnat_ip(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, struct iphdr *iph,
|
||||
+ unsigned int thoff, enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
__be32 addr, new_addr;
|
||||
|
||||
@@ -122,24 +114,21 @@ static int nf_flow_dnat_ip(const struct
|
||||
}
|
||||
csum_replace4(&iph->check, addr, new_addr);
|
||||
|
||||
- return nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr);
|
||||
+ nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr);
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
+static void nf_flow_nat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
||||
unsigned int thoff, enum flow_offload_tuple_dir dir,
|
||||
struct iphdr *iph)
|
||||
{
|
||||
- if (test_bit(NF_FLOW_SNAT, &flow->flags) &&
|
||||
- (nf_flow_snat_port(flow, skb, thoff, iph->protocol, dir) < 0 ||
|
||||
- nf_flow_snat_ip(flow, skb, iph, thoff, dir) < 0))
|
||||
- return -1;
|
||||
-
|
||||
- if (test_bit(NF_FLOW_DNAT, &flow->flags) &&
|
||||
- (nf_flow_dnat_port(flow, skb, thoff, iph->protocol, dir) < 0 ||
|
||||
- nf_flow_dnat_ip(flow, skb, iph, thoff, dir) < 0))
|
||||
- return -1;
|
||||
-
|
||||
- return 0;
|
||||
+ if (test_bit(NF_FLOW_SNAT, &flow->flags)) {
|
||||
+ nf_flow_snat_port(flow, skb, thoff, iph->protocol, dir);
|
||||
+ nf_flow_snat_ip(flow, skb, iph, thoff, dir);
|
||||
+ }
|
||||
+ if (test_bit(NF_FLOW_DNAT, &flow->flags)) {
|
||||
+ nf_flow_dnat_port(flow, skb, thoff, iph->protocol, dir);
|
||||
+ nf_flow_dnat_ip(flow, skb, iph, thoff, dir);
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool ip_has_options(unsigned int thoff)
|
||||
@@ -276,8 +265,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
return NF_DROP;
|
||||
|
||||
iph = ip_hdr(skb);
|
||||
- if (nf_flow_nat_ip(flow, skb, thoff, dir, iph) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ip(flow, skb, thoff, dir, iph);
|
||||
|
||||
ip_decrease_ttl(iph);
|
||||
skb->tstamp = 0;
|
||||
@@ -301,22 +289,21 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_flow_offload_ip_hook);
|
||||
|
||||
-static int nf_flow_nat_ipv6_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
- struct in6_addr *addr,
|
||||
- struct in6_addr *new_addr)
|
||||
+static void nf_flow_nat_ipv6_tcp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ struct in6_addr *addr,
|
||||
+ struct in6_addr *new_addr,
|
||||
+ struct ipv6hdr *ip6h)
|
||||
{
|
||||
struct tcphdr *tcph;
|
||||
|
||||
tcph = (void *)(skb_network_header(skb) + thoff);
|
||||
inet_proto_csum_replace16(&tcph->check, skb, addr->s6_addr32,
|
||||
new_addr->s6_addr32, true);
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ipv6_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
- struct in6_addr *addr,
|
||||
- struct in6_addr *new_addr)
|
||||
+static void nf_flow_nat_ipv6_udp(struct sk_buff *skb, unsigned int thoff,
|
||||
+ struct in6_addr *addr,
|
||||
+ struct in6_addr *new_addr)
|
||||
{
|
||||
struct udphdr *udph;
|
||||
|
||||
@@ -327,32 +314,26 @@ static int nf_flow_nat_ipv6_udp(struct s
|
||||
if (!udph->check)
|
||||
udph->check = CSUM_MANGLED_0;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ipv6_l4proto(struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
- unsigned int thoff, struct in6_addr *addr,
|
||||
- struct in6_addr *new_addr)
|
||||
+static void nf_flow_nat_ipv6_l4proto(struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
+ unsigned int thoff, struct in6_addr *addr,
|
||||
+ struct in6_addr *new_addr)
|
||||
{
|
||||
switch (ip6h->nexthdr) {
|
||||
case IPPROTO_TCP:
|
||||
- if (nf_flow_nat_ipv6_tcp(skb, thoff, addr, new_addr) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ipv6_tcp(skb, thoff, addr, new_addr, ip6h);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
- if (nf_flow_nat_ipv6_udp(skb, thoff, addr, new_addr) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ipv6_udp(skb, thoff, addr, new_addr);
|
||||
break;
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static int nf_flow_snat_ipv6(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
- unsigned int thoff,
|
||||
- enum flow_offload_tuple_dir dir)
|
||||
+static void nf_flow_snat_ipv6(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
+ unsigned int thoff,
|
||||
+ enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
struct in6_addr addr, new_addr;
|
||||
|
||||
@@ -369,13 +350,13 @@ static int nf_flow_snat_ipv6(const struc
|
||||
break;
|
||||
}
|
||||
|
||||
- return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
+ nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
}
|
||||
|
||||
-static int nf_flow_dnat_ipv6(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
- unsigned int thoff,
|
||||
- enum flow_offload_tuple_dir dir)
|
||||
+static void nf_flow_dnat_ipv6(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb, struct ipv6hdr *ip6h,
|
||||
+ unsigned int thoff,
|
||||
+ enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
struct in6_addr addr, new_addr;
|
||||
|
||||
@@ -392,27 +373,24 @@ static int nf_flow_dnat_ipv6(const struc
|
||||
break;
|
||||
}
|
||||
|
||||
- return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
+ nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||
}
|
||||
|
||||
-static int nf_flow_nat_ipv6(const struct flow_offload *flow,
|
||||
- struct sk_buff *skb,
|
||||
- enum flow_offload_tuple_dir dir,
|
||||
- struct ipv6hdr *ip6h)
|
||||
+static void nf_flow_nat_ipv6(const struct flow_offload *flow,
|
||||
+ struct sk_buff *skb,
|
||||
+ enum flow_offload_tuple_dir dir,
|
||||
+ struct ipv6hdr *ip6h)
|
||||
{
|
||||
unsigned int thoff = sizeof(*ip6h);
|
||||
|
||||
- if (test_bit(NF_FLOW_SNAT, &flow->flags) &&
|
||||
- (nf_flow_snat_port(flow, skb, thoff, ip6h->nexthdr, dir) < 0 ||
|
||||
- nf_flow_snat_ipv6(flow, skb, ip6h, thoff, dir) < 0))
|
||||
- return -1;
|
||||
-
|
||||
- if (test_bit(NF_FLOW_DNAT, &flow->flags) &&
|
||||
- (nf_flow_dnat_port(flow, skb, thoff, ip6h->nexthdr, dir) < 0 ||
|
||||
- nf_flow_dnat_ipv6(flow, skb, ip6h, thoff, dir) < 0))
|
||||
- return -1;
|
||||
-
|
||||
- return 0;
|
||||
+ if (test_bit(NF_FLOW_SNAT, &flow->flags)) {
|
||||
+ nf_flow_snat_port(flow, skb, thoff, ip6h->nexthdr, dir);
|
||||
+ nf_flow_snat_ipv6(flow, skb, ip6h, thoff, dir);
|
||||
+ }
|
||||
+ if (test_bit(NF_FLOW_DNAT, &flow->flags)) {
|
||||
+ nf_flow_dnat_port(flow, skb, thoff, ip6h->nexthdr, dir);
|
||||
+ nf_flow_dnat_ipv6(flow, skb, ip6h, thoff, dir);
|
||||
+ }
|
||||
}
|
||||
|
||||
static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
|
||||
@@ -507,8 +485,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
return NF_DROP;
|
||||
|
||||
ip6h = ipv6_hdr(skb);
|
||||
- if (nf_flow_nat_ipv6(flow, skb, dir, ip6h) < 0)
|
||||
- return NF_DROP;
|
||||
+ nf_flow_nat_ipv6(flow, skb, dir, ip6h);
|
||||
|
||||
ip6h->hop_limit--;
|
||||
skb->tstamp = 0;
|
||||
@ -0,0 +1,46 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:26 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: call dst_check() to fall back to
|
||||
classic forwarding
|
||||
|
||||
In case the route is stale, pass up the packet to the classic forwarding
|
||||
path for re-evaluation and schedule this flow entry for removal.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -197,14 +197,6 @@ static bool nf_flow_exceeds_mtu(const st
|
||||
return true;
|
||||
}
|
||||
|
||||
-static int nf_flow_offload_dst_check(struct dst_entry *dst)
|
||||
-{
|
||||
- if (unlikely(dst_xfrm(dst)))
|
||||
- return dst_check(dst, 0) ? 0 : -1;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb,
|
||||
const struct nf_hook_state *state,
|
||||
struct dst_entry *dst)
|
||||
@@ -256,7 +248,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
|
||||
- if (nf_flow_offload_dst_check(&rt->dst)) {
|
||||
+ if (!dst_check(&rt->dst, 0)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
@@ -476,7 +468,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
|
||||
- if (nf_flow_offload_dst_check(&rt->dst)) {
|
||||
+ if (!dst_check(&rt->dst, 0)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:27 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: refresh timeout after dst and
|
||||
writable checks
|
||||
|
||||
Refresh the timeout (and retry hardware offload) once the skbuff dst
|
||||
is confirmed to be current and after the skbuff is made writable.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -246,8 +246,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- flow_offload_refresh(flow_table, flow);
|
||||
-
|
||||
if (!dst_check(&rt->dst, 0)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
@@ -256,6 +254,8 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
return NF_DROP;
|
||||
|
||||
+ flow_offload_refresh(flow_table, flow);
|
||||
+
|
||||
iph = ip_hdr(skb);
|
||||
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
|
||||
|
||||
@@ -466,8 +466,6 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
sizeof(*ip6h)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- flow_offload_refresh(flow_table, flow);
|
||||
-
|
||||
if (!dst_check(&rt->dst, 0)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
@@ -476,6 +474,8 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
|
||||
return NF_DROP;
|
||||
|
||||
+ flow_offload_refresh(flow_table, flow);
|
||||
+
|
||||
ip6h = ipv6_hdr(skb);
|
||||
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
|
||||
|
||||
@ -0,0 +1,103 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 23 Mar 2021 00:56:28 +0100
|
||||
Subject: [PATCH] netfilter: nftables: update table flags from the commit
|
||||
phase
|
||||
|
||||
Do not update table flags from the preparation phase. Store the flags
|
||||
update into the transaction, then update the flags from the commit
|
||||
phase.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_tables.h
|
||||
+++ b/include/net/netfilter/nf_tables.h
|
||||
@@ -1470,13 +1470,16 @@ struct nft_trans_chain {
|
||||
|
||||
struct nft_trans_table {
|
||||
bool update;
|
||||
- bool enable;
|
||||
+ u8 state;
|
||||
+ u32 flags;
|
||||
};
|
||||
|
||||
#define nft_trans_table_update(trans) \
|
||||
(((struct nft_trans_table *)trans->data)->update)
|
||||
-#define nft_trans_table_enable(trans) \
|
||||
- (((struct nft_trans_table *)trans->data)->enable)
|
||||
+#define nft_trans_table_state(trans) \
|
||||
+ (((struct nft_trans_table *)trans->data)->state)
|
||||
+#define nft_trans_table_flags(trans) \
|
||||
+ (((struct nft_trans_table *)trans->data)->flags)
|
||||
|
||||
struct nft_trans_elem {
|
||||
struct nft_set *set;
|
||||
--- a/net/netfilter/nf_tables_api.c
|
||||
+++ b/net/netfilter/nf_tables_api.c
|
||||
@@ -891,6 +891,12 @@ static void nf_tables_table_disable(stru
|
||||
nft_table_disable(net, table, 0);
|
||||
}
|
||||
|
||||
+enum {
|
||||
+ NFT_TABLE_STATE_UNCHANGED = 0,
|
||||
+ NFT_TABLE_STATE_DORMANT,
|
||||
+ NFT_TABLE_STATE_WAKEUP
|
||||
+};
|
||||
+
|
||||
static int nf_tables_updtable(struct nft_ctx *ctx)
|
||||
{
|
||||
struct nft_trans *trans;
|
||||
@@ -914,19 +920,17 @@ static int nf_tables_updtable(struct nft
|
||||
|
||||
if ((flags & NFT_TABLE_F_DORMANT) &&
|
||||
!(ctx->table->flags & NFT_TABLE_F_DORMANT)) {
|
||||
- nft_trans_table_enable(trans) = false;
|
||||
+ nft_trans_table_state(trans) = NFT_TABLE_STATE_DORMANT;
|
||||
} else if (!(flags & NFT_TABLE_F_DORMANT) &&
|
||||
ctx->table->flags & NFT_TABLE_F_DORMANT) {
|
||||
- ctx->table->flags &= ~NFT_TABLE_F_DORMANT;
|
||||
ret = nf_tables_table_enable(ctx->net, ctx->table);
|
||||
if (ret >= 0)
|
||||
- nft_trans_table_enable(trans) = true;
|
||||
- else
|
||||
- ctx->table->flags |= NFT_TABLE_F_DORMANT;
|
||||
+ nft_trans_table_state(trans) = NFT_TABLE_STATE_WAKEUP;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
+ nft_trans_table_flags(trans) = flags;
|
||||
nft_trans_table_update(trans) = true;
|
||||
list_add_tail(&trans->list, &ctx->net->nft.commit_list);
|
||||
return 0;
|
||||
@@ -7873,11 +7877,10 @@ static int nf_tables_commit(struct net *
|
||||
switch (trans->msg_type) {
|
||||
case NFT_MSG_NEWTABLE:
|
||||
if (nft_trans_table_update(trans)) {
|
||||
- if (!nft_trans_table_enable(trans)) {
|
||||
- nf_tables_table_disable(net,
|
||||
- trans->ctx.table);
|
||||
- trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
|
||||
- }
|
||||
+ if (nft_trans_table_state(trans) == NFT_TABLE_STATE_DORMANT)
|
||||
+ nf_tables_table_disable(net, trans->ctx.table);
|
||||
+
|
||||
+ trans->ctx.table->flags = nft_trans_table_flags(trans);
|
||||
} else {
|
||||
nft_clear(net, trans->ctx.table);
|
||||
}
|
||||
@@ -8090,11 +8093,9 @@ static int __nf_tables_abort(struct net
|
||||
switch (trans->msg_type) {
|
||||
case NFT_MSG_NEWTABLE:
|
||||
if (nft_trans_table_update(trans)) {
|
||||
- if (nft_trans_table_enable(trans)) {
|
||||
- nf_tables_table_disable(net,
|
||||
- trans->ctx.table);
|
||||
- trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
|
||||
- }
|
||||
+ if (nft_trans_table_state(trans) == NFT_TABLE_STATE_WAKEUP)
|
||||
+ nf_tables_table_disable(net, trans->ctx.table);
|
||||
+
|
||||
nft_trans_destroy(trans);
|
||||
} else {
|
||||
list_del_rcu(&trans->ctx.table->list);
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 4 Mar 2021 23:18:11 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:32 +0100
|
||||
Subject: [PATCH] net: resolve forwarding path from virtual netdevice and
|
||||
HW destination address
|
||||
|
||||
@ -104,7 +104,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2795,6 +2820,8 @@ void dev_remove_offload(struct packet_of
|
||||
@@ -2827,6 +2852,8 @@ void dev_remove_offload(struct packet_of
|
||||
|
||||
int dev_get_iflink(const struct net_device *dev);
|
||||
int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:16 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:33 +0100
|
||||
Subject: [PATCH] net: 8021q: resolve forwarding path for vlan devices
|
||||
|
||||
Add .ndo_fill_forward_path for vlan devices.
|
||||
@ -1,6 +1,6 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:17 +0100
|
||||
Subject: [PATCH] bridge: resolve forwarding path for bridge devices
|
||||
Date: Wed, 24 Mar 2021 02:30:34 +0100
|
||||
Subject: [PATCH] net: bridge: resolve forwarding path for bridge devices
|
||||
|
||||
Add .ndo_fill_forward_path for bridge devices.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 7 Dec 2020 20:31:45 +0100
|
||||
Subject: [PATCH] net: bridge: resolve VLAN tag actions in forwarding
|
||||
path for bridge devices
|
||||
Date: Wed, 24 Mar 2021 02:30:35 +0100
|
||||
Subject: [PATCH] net: bridge: resolve forwarding path for VLAN tag
|
||||
actions in bridge devices
|
||||
|
||||
Depending on the VLAN settings of the bridge and the port, the bridge can
|
||||
either add or remove a tag. When vlan filtering is enabled, the fdb lookup
|
||||
@ -1,9 +1,13 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 2 Mar 2021 21:45:16 +0100
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Wed, 24 Mar 2021 02:30:36 +0100
|
||||
Subject: [PATCH] net: ppp: resolve forwarding path for bridge pppoe
|
||||
devices
|
||||
|
||||
Pass on the PPPoE session ID and the real device.
|
||||
Pass on the PPPoE session ID, destination hardware address and the real
|
||||
device.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ppp/ppp_generic.c
|
||||
@ -15,7 +19,7 @@ Pass on the PPPoE session ID and the real device.
|
||||
+static int ppp_fill_forward_path(struct net_device_path_ctx *ctx,
|
||||
+ struct net_device_path *path)
|
||||
+{
|
||||
+ struct ppp *ppp = netdev_priv(path->dev);
|
||||
+ struct ppp *ppp = netdev_priv(ctx->dev);
|
||||
+ struct ppp_channel *chan;
|
||||
+ struct channel *pch;
|
||||
+
|
||||
@ -45,7 +49,7 @@ Pass on the PPPoE session ID and the real device.
|
||||
static struct device_type ppp_type = {
|
||||
--- a/drivers/net/ppp/pppoe.c
|
||||
+++ b/drivers/net/ppp/pppoe.c
|
||||
@@ -972,8 +972,30 @@ static int pppoe_xmit(struct ppp_channel
|
||||
@@ -972,8 +972,31 @@ static int pppoe_xmit(struct ppp_channel
|
||||
return __pppoe_xmit(sk, skb);
|
||||
}
|
||||
|
||||
@ -64,6 +68,7 @@ Pass on the PPPoE session ID and the real device.
|
||||
+ path->type = DEV_PATH_PPPOE;
|
||||
+ path->encap.proto = htons(ETH_P_PPP_SES);
|
||||
+ path->encap.id = be16_to_cpu(po->num);
|
||||
+ memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN);
|
||||
+ path->dev = ctx->dev;
|
||||
+ ctx->dev = dev;
|
||||
+
|
||||
@ -86,6 +91,14 @@ Pass on the PPPoE session ID and the real device.
|
||||
};
|
||||
|
||||
struct net_device_path {
|
||||
@@ -840,6 +841,7 @@ struct net_device_path {
|
||||
struct {
|
||||
u16 id;
|
||||
__be16 proto;
|
||||
+ u8 h_dest[ETH_ALEN];
|
||||
} encap;
|
||||
struct {
|
||||
enum {
|
||||
--- a/include/linux/ppp_channel.h
|
||||
+++ b/include/linux/ppp_channel.h
|
||||
@@ -28,6 +28,9 @@ struct ppp_channel_ops {
|
||||
@ -1,8 +1,11 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 4 Mar 2021 23:19:06 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:37 +0100
|
||||
Subject: [PATCH] net: dsa: resolve forwarding path for dsa slave ports
|
||||
|
||||
Add .ndo_fill_forward_path for dsa slave port devices
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
@ -15,7 +18,7 @@ Add .ndo_fill_forward_path for dsa slave port devices
|
||||
};
|
||||
|
||||
struct net_device_path {
|
||||
@@ -851,6 +852,10 @@ struct net_device_path {
|
||||
@@ -852,6 +853,10 @@ struct net_device_path {
|
||||
u16 vlan_id;
|
||||
__be16 vlan_proto;
|
||||
} bridge;
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:14 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:38 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add xmit path types
|
||||
|
||||
Add the xmit_type field that defines the two supported xmit paths in the
|
||||
@ -12,8 +12,8 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -89,6 +89,11 @@ enum flow_offload_tuple_dir {
|
||||
FLOW_OFFLOAD_DIR_MAX = IP_CT_DIR_MAX
|
||||
};
|
||||
#define FLOW_OFFLOAD_DIR_MAX IP_CT_DIR_MAX
|
||||
|
||||
+enum flow_offload_xmit_type {
|
||||
+ FLOW_OFFLOAD_XMIT_NEIGH = 0,
|
||||
@ -55,30 +55,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
return 0;
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -220,10 +220,20 @@ static bool nf_flow_exceeds_mtu(const st
|
||||
return true;
|
||||
}
|
||||
|
||||
-static int nf_flow_offload_dst_check(struct dst_entry *dst)
|
||||
+static inline struct dst_entry *
|
||||
+nft_flow_dst(struct flow_offload_tuple_rhash *tuplehash)
|
||||
{
|
||||
- if (unlikely(dst_xfrm(dst)))
|
||||
+ return tuplehash->tuple.dst_cache;
|
||||
+}
|
||||
+
|
||||
+static int nf_flow_offload_dst_check(struct flow_offload_tuple_rhash *tuplehash)
|
||||
+{
|
||||
+ struct dst_entry *dst;
|
||||
+
|
||||
+ if (unlikely(tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)) {
|
||||
+ dst = nft_flow_dst(tuplehash);
|
||||
return dst_check(dst, 0) ? 0 : -1;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -265,8 +275,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
@@ -235,8 +235,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
|
||||
dir = tuplehash->tuple.dir;
|
||||
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
|
||||
@ -87,16 +64,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
|
||||
return NF_ACCEPT;
|
||||
@@ -280,7 +288,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
|
||||
- if (nf_flow_offload_dst_check(&rt->dst)) {
|
||||
+ if (nf_flow_offload_dst_check(tuplehash)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
@@ -295,13 +303,16 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
@@ -265,13 +263,16 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||
|
||||
@ -114,7 +82,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
skb->dev = outdev;
|
||||
nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr);
|
||||
skb_dst_set_noref(skb, &rt->dst);
|
||||
@@ -506,8 +517,6 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
@@ -456,8 +457,6 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
|
||||
dir = tuplehash->tuple.dir;
|
||||
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
|
||||
@ -123,16 +91,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
|
||||
return NF_ACCEPT;
|
||||
@@ -518,7 +527,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
|
||||
- if (nf_flow_offload_dst_check(&rt->dst)) {
|
||||
+ if (nf_flow_offload_dst_check(tuplehash)) {
|
||||
flow_offload_teardown(flow);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
@@ -536,13 +545,16 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
@@ -485,13 +484,16 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:18 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:39 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: use dev_fill_forward_path() to
|
||||
obtain ingress device
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 4 Mar 2021 03:26:35 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:40 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: use dev_fill_forward_path() to
|
||||
obtain egress device
|
||||
|
||||
@ -133,7 +133,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
void flow_offload_free(struct flow_offload *flow)
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -248,6 +248,24 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
@@ -207,6 +207,24 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
@ -158,25 +158,41 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
unsigned int
|
||||
nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
@@ -262,6 +280,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
unsigned int thoff;
|
||||
@@ -222,6 +240,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
struct iphdr *iph;
|
||||
__be32 nexthop;
|
||||
u32 hdrsize;
|
||||
+ int ret;
|
||||
|
||||
if (skb->protocol != htons(ETH_P_IP))
|
||||
return NF_ACCEPT;
|
||||
@@ -303,22 +322,32 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
@@ -244,9 +263,13 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (!dst_check(&rt->dst, 0)) {
|
||||
- flow_offload_teardown(flow);
|
||||
- return NF_ACCEPT;
|
||||
+ if (tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_NEIGH ||
|
||||
+ tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM) {
|
||||
+ rt = (struct rtable *)tuplehash->tuple.dst_cache;
|
||||
+ if (!dst_check(&rt->dst, 0)) {
|
||||
+ flow_offload_teardown(flow);
|
||||
+ return NF_ACCEPT;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
@@ -263,8 +286,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||
|
||||
- rt = (struct rtable *)tuplehash->tuple.dst_cache;
|
||||
-
|
||||
if (unlikely(tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)) {
|
||||
+ rt = (struct rtable *)tuplehash->tuple.dst_cache;
|
||||
memset(skb->cb, 0, sizeof(struct inet_skb_parm));
|
||||
IPCB(skb)->iif = skb->dev->ifindex;
|
||||
IPCB(skb)->flags = IPSKB_FORWARDED;
|
||||
@@ -272,13 +293,23 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
return nf_flow_xmit_xfrm(skb, state, &rt->dst);
|
||||
}
|
||||
|
||||
@ -187,7 +203,6 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
- neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb);
|
||||
+ switch (tuplehash->tuple.xmit_type) {
|
||||
+ case FLOW_OFFLOAD_XMIT_NEIGH:
|
||||
+ rt = (struct rtable *)tuplehash->tuple.dst_cache;
|
||||
+ outdev = rt->dst.dev;
|
||||
+ skb->dev = outdev;
|
||||
+ nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr);
|
||||
@ -207,25 +222,41 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_flow_offload_ip_hook);
|
||||
|
||||
@@ -504,6 +533,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
struct net_device *outdev;
|
||||
@@ -444,6 +475,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
struct ipv6hdr *ip6h;
|
||||
struct rt6_info *rt;
|
||||
u32 hdrsize;
|
||||
+ int ret;
|
||||
|
||||
if (skb->protocol != htons(ETH_P_IPV6))
|
||||
return NF_ACCEPT;
|
||||
@@ -545,21 +575,31 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
@@ -465,9 +497,13 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
sizeof(*ip6h)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (!dst_check(&rt->dst, 0)) {
|
||||
- flow_offload_teardown(flow);
|
||||
- return NF_ACCEPT;
|
||||
+ if (tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_NEIGH ||
|
||||
+ tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM) {
|
||||
+ rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
|
||||
+ if (!dst_check(&rt->dst, 0)) {
|
||||
+ flow_offload_teardown(flow);
|
||||
+ return NF_ACCEPT;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
|
||||
@@ -484,8 +520,6 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
if (flow_table->flags & NF_FLOWTABLE_COUNTER)
|
||||
nf_ct_acct_update(flow->ct, tuplehash->tuple.dir, skb->len);
|
||||
|
||||
- rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
|
||||
-
|
||||
if (unlikely(tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)) {
|
||||
+ rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
|
||||
memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
|
||||
IP6CB(skb)->iif = skb->dev->ifindex;
|
||||
IP6CB(skb)->flags = IP6SKB_FORWARDED;
|
||||
@@ -493,12 +527,22 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
return nf_flow_xmit_xfrm(skb, state, &rt->dst);
|
||||
}
|
||||
|
||||
@ -236,7 +267,6 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
- neigh_xmit(NEIGH_ND_TABLE, outdev, nexthop, skb);
|
||||
+ switch (tuplehash->tuple.xmit_type) {
|
||||
+ case FLOW_OFFLOAD_XMIT_NEIGH:
|
||||
+ rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
|
||||
+ outdev = rt->dst.dev;
|
||||
+ skb->dev = outdev;
|
||||
+ nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6);
|
||||
@ -1,11 +1,15 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:20 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:41 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add vlan support
|
||||
|
||||
Add the vlan id and protocol to the flow tuple to uniquely identify
|
||||
flows from the receive path. For the transmit path, dev_hard_header() on
|
||||
the vlan device push the headers. This patch includes support for two
|
||||
VLAN headers (QinQ) from the ingress path.
|
||||
vlan headers (QinQ) from the ingress path.
|
||||
|
||||
Add a generic encap field to the flowtable entry which stores the
|
||||
protocol and the tag id. This allows to reuse these fields in the PPPoE
|
||||
support coming in a later patch.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
@ -79,7 +83,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
case FLOW_OFFLOAD_XMIT_DIRECT:
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -159,17 +159,38 @@ static bool ip_has_options(unsigned int
|
||||
@@ -136,23 +136,44 @@ static bool ip_has_options(unsigned int
|
||||
return thoff != sizeof(struct iphdr);
|
||||
}
|
||||
|
||||
@ -102,41 +106,46 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
+}
|
||||
+
|
||||
static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev,
|
||||
struct flow_offload_tuple *tuple)
|
||||
- struct flow_offload_tuple *tuple, u32 *hdrsize)
|
||||
+ struct flow_offload_tuple *tuple, u32 *hdrsize,
|
||||
+ u32 offset)
|
||||
{
|
||||
- unsigned int thoff, hdrsize;
|
||||
+ unsigned int thoff, hdrsize, offset = 0;
|
||||
struct flow_ports *ports;
|
||||
unsigned int thoff;
|
||||
struct iphdr *iph;
|
||||
|
||||
- if (!pskb_may_pull(skb, sizeof(*iph)))
|
||||
+ if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ offset += VLAN_HLEN;
|
||||
+
|
||||
+ if (!pskb_may_pull(skb, sizeof(*iph) + offset))
|
||||
return -1;
|
||||
|
||||
- iph = ip_hdr(skb);
|
||||
- thoff = iph->ihl * 4;
|
||||
+ iph = (struct iphdr *)(skb_network_header(skb) + offset);
|
||||
thoff = iph->ihl * 4;
|
||||
+ thoff = (iph->ihl * 4);
|
||||
|
||||
if (ip_is_fragment(iph) ||
|
||||
@@ -191,11 +212,11 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
unlikely(ip_has_options(thoff)))
|
||||
return -1;
|
||||
|
||||
thoff = iph->ihl * 4;
|
||||
- if (!pskb_may_pull(skb, thoff + hdrsize))
|
||||
+ if (!pskb_may_pull(skb, thoff + hdrsize + offset))
|
||||
+ thoff += offset;
|
||||
+
|
||||
switch (iph->protocol) {
|
||||
case IPPROTO_TCP:
|
||||
*hdrsize = sizeof(struct tcphdr);
|
||||
@@ -167,11 +188,10 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
if (iph->ttl <= 1)
|
||||
return -1;
|
||||
|
||||
- thoff = iph->ihl * 4;
|
||||
if (!pskb_may_pull(skb, thoff + *hdrsize))
|
||||
return -1;
|
||||
|
||||
- iph = ip_hdr(skb);
|
||||
- ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
|
||||
+ iph = (struct iphdr *)(skb_network_header(skb) + offset);
|
||||
+ ports = (struct flow_ports *)(skb_network_header(skb) + thoff + offset);
|
||||
ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
|
||||
|
||||
tuple->src_v4.s_addr = iph->saddr;
|
||||
tuple->dst_v4.s_addr = iph->daddr;
|
||||
@@ -204,6 +225,7 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
@@ -181,6 +201,7 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
tuple->l3proto = AF_INET;
|
||||
tuple->l4proto = iph->protocol;
|
||||
tuple->iifidx = dev->ifindex;
|
||||
@ -144,18 +153,21 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -248,6 +270,40 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
@@ -207,6 +228,43 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
+static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto)
|
||||
+static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto,
|
||||
+ u32 *offset)
|
||||
+{
|
||||
+ if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
+ struct vlan_ethhdr *veth;
|
||||
+
|
||||
+ veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
+ if (veth->h_vlan_encapsulated_proto == proto)
|
||||
+ if (veth->h_vlan_encapsulated_proto == proto) {
|
||||
+ *offset += VLAN_HLEN;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
@ -185,25 +197,30 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
static unsigned int nf_flow_queue_xmit(struct net *net, struct sk_buff *skb,
|
||||
const struct flow_offload_tuple_rhash *tuplehash,
|
||||
unsigned short type)
|
||||
@@ -276,13 +332,15 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
@@ -235,17 +293,18 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
enum flow_offload_tuple_dir dir;
|
||||
struct flow_offload *flow;
|
||||
struct net_device *outdev;
|
||||
+ u32 hdrsize, offset = 0;
|
||||
+ unsigned int thoff, mtu;
|
||||
struct rtable *rt;
|
||||
- unsigned int thoff;
|
||||
struct iphdr *iph;
|
||||
__be32 nexthop;
|
||||
+ u32 offset = 0;
|
||||
- u32 hdrsize;
|
||||
int ret;
|
||||
|
||||
- if (skb->protocol != htons(ETH_P_IP))
|
||||
+ if (skb->protocol != htons(ETH_P_IP) &&
|
||||
+ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP)))
|
||||
+ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP), &offset))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (nf_flow_tuple_ip(skb, state->in, &tuple) < 0)
|
||||
@@ -295,14 +353,19 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
- if (nf_flow_tuple_ip(skb, state->in, &tuple, &hdrsize) < 0)
|
||||
+ if (nf_flow_tuple_ip(skb, state->in, &tuple, &hdrsize, offset) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -255,11 +314,12 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
dir = tuplehash->tuple.dir;
|
||||
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
|
||||
|
||||
@ -212,45 +229,38 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
+ if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (skb_try_make_writable(skb, sizeof(*iph)))
|
||||
+ if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ offset += VLAN_HLEN;
|
||||
+
|
||||
+ if (skb_try_make_writable(skb, sizeof(*iph) + offset))
|
||||
return NF_DROP;
|
||||
|
||||
- thoff = ip_hdr(skb)->ihl * 4;
|
||||
- if (nf_flow_state_check(flow, ip_hdr(skb)->protocol, skb, thoff))
|
||||
- iph = ip_hdr(skb);
|
||||
- thoff = iph->ihl * 4;
|
||||
+ iph = (struct iphdr *)(skb_network_header(skb) + offset);
|
||||
+ thoff = (iph->ihl * 4) + offset;
|
||||
+ if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
@@ -277,6 +337,9 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
@@ -312,6 +375,9 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
+ nf_flow_encap_pop(skb, tuplehash);
|
||||
+ thoff -= offset;
|
||||
+
|
||||
if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0)
|
||||
return NF_DROP;
|
||||
iph = ip_hdr(skb);
|
||||
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
|
||||
|
||||
@@ -418,16 +481,18 @@ static void nf_flow_nat_ipv6(const struc
|
||||
}
|
||||
|
||||
@@ -479,14 +545,17 @@ static int nf_flow_nat_ipv6(const struct
|
||||
static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
|
||||
struct flow_offload_tuple *tuple)
|
||||
- struct flow_offload_tuple *tuple, u32 *hdrsize)
|
||||
+ struct flow_offload_tuple *tuple, u32 *hdrsize,
|
||||
+ u32 offset)
|
||||
{
|
||||
- unsigned int thoff, hdrsize;
|
||||
+ unsigned int thoff, hdrsize, offset = 0;
|
||||
struct flow_ports *ports;
|
||||
struct ipv6hdr *ip6h;
|
||||
unsigned int thoff;
|
||||
|
||||
- if (!pskb_may_pull(skb, sizeof(*ip6h)))
|
||||
+ if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ offset += VLAN_HLEN;
|
||||
+
|
||||
+ if (!pskb_may_pull(skb, sizeof(*ip6h) + offset))
|
||||
+ thoff = sizeof(*ip6h) + offset;
|
||||
+ if (!pskb_may_pull(skb, thoff))
|
||||
return -1;
|
||||
|
||||
- ip6h = ipv6_hdr(skb);
|
||||
@ -258,22 +268,20 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
switch (ip6h->nexthdr) {
|
||||
case IPPROTO_TCP:
|
||||
@@ -503,11 +572,11 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
@@ -443,11 +508,10 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
if (ip6h->hop_limit <= 1)
|
||||
return -1;
|
||||
|
||||
thoff = sizeof(*ip6h);
|
||||
- if (!pskb_may_pull(skb, thoff + hdrsize))
|
||||
+ if (!pskb_may_pull(skb, thoff + hdrsize + offset))
|
||||
- thoff = sizeof(*ip6h);
|
||||
if (!pskb_may_pull(skb, thoff + *hdrsize))
|
||||
return -1;
|
||||
|
||||
- ip6h = ipv6_hdr(skb);
|
||||
- ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
|
||||
+ ip6h = (struct ipv6hdr *)(skb_network_header(skb) + offset);
|
||||
+ ports = (struct flow_ports *)(skb_network_header(skb) + thoff + offset);
|
||||
ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
|
||||
|
||||
tuple->src_v6 = ip6h->saddr;
|
||||
tuple->dst_v6 = ip6h->daddr;
|
||||
@@ -516,6 +585,7 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
@@ -457,6 +521,7 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
tuple->l3proto = AF_INET6;
|
||||
tuple->l4proto = ip6h->nexthdr;
|
||||
tuple->iifidx = dev->ifindex;
|
||||
@ -281,21 +289,28 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -533,9 +603,12 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
@@ -472,15 +537,17 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
const struct in6_addr *nexthop;
|
||||
struct flow_offload *flow;
|
||||
struct net_device *outdev;
|
||||
+ unsigned int thoff, mtu;
|
||||
+ u32 hdrsize, offset = 0;
|
||||
struct ipv6hdr *ip6h;
|
||||
struct rt6_info *rt;
|
||||
+ unsigned int mtu;
|
||||
+ u32 offset = 0;
|
||||
- u32 hdrsize;
|
||||
int ret;
|
||||
|
||||
- if (skb->protocol != htons(ETH_P_IPV6))
|
||||
+ if (skb->protocol != htons(ETH_P_IPV6) &&
|
||||
+ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6)))
|
||||
+ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6), &offset))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (nf_flow_tuple_ipv6(skb, state->in, &tuple) < 0)
|
||||
@@ -548,11 +621,15 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
- if (nf_flow_tuple_ipv6(skb, state->in, &tuple, &hdrsize) < 0)
|
||||
+ if (nf_flow_tuple_ipv6(skb, state->in, &tuple, &hdrsize, offset) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -490,11 +557,13 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
dir = tuplehash->tuple.dir;
|
||||
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
|
||||
|
||||
@ -306,22 +321,26 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
|
||||
- if (nf_flow_state_check(flow, ipv6_hdr(skb)->nexthdr, skb,
|
||||
- sizeof(*ip6h)))
|
||||
+ if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ offset += VLAN_HLEN;
|
||||
+
|
||||
+ ip6h = (struct ipv6hdr *)(skb_network_header(skb) + offset);
|
||||
+ if (nf_flow_state_check(flow, ip6h->nexthdr, skb, sizeof(*ip6h)))
|
||||
+ thoff = sizeof(*ip6h) + offset;
|
||||
+ if (nf_flow_state_check(flow, ip6h->nexthdr, skb, thoff))
|
||||
return NF_ACCEPT;
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
@@ -562,6 +639,8 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
return NF_ACCEPT;
|
||||
if (tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_NEIGH ||
|
||||
@@ -506,11 +575,13 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
}
|
||||
}
|
||||
|
||||
- if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
|
||||
+ if (skb_try_make_writable(skb, thoff + hdrsize))
|
||||
return NF_DROP;
|
||||
|
||||
flow_offload_refresh(flow_table, flow);
|
||||
|
||||
+ nf_flow_encap_pop(skb, tuplehash);
|
||||
+
|
||||
if (skb_try_make_writable(skb, sizeof(*ip6h)))
|
||||
return NF_DROP;
|
||||
ip6h = ipv6_hdr(skb);
|
||||
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
|
||||
|
||||
--- a/net/netfilter/nft_flow_offload.c
|
||||
+++ b/net/netfilter/nft_flow_offload.c
|
||||
@ -1,7 +1,6 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Sun, 24 Jan 2021 18:01:34 +0100
|
||||
Subject: [PATCH] netfilter: nft_flow_offload: add bridge vlan filtering
|
||||
support
|
||||
Date: Wed, 24 Mar 2021 02:30:42 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add bridge vlan filtering support
|
||||
|
||||
Add the vlan tag based when PVID is set on.
|
||||
|
||||
@ -0,0 +1,145 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Wed, 24 Mar 2021 02:30:43 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add pppoe support
|
||||
|
||||
Add the PPPoE protocol and session id to the flow tuple using the encap
|
||||
fields to uniquely identify flows from the receive path. For the
|
||||
transmit path, dev_hard_header() on the vlan device push the headers.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/netdevice.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+#include <linux/if_pppox.h>
|
||||
+#include <linux/ppp_defs.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <net/ip6_route.h>
|
||||
@@ -139,6 +142,8 @@ static bool ip_has_options(unsigned int
|
||||
static void nf_flow_tuple_encap(struct sk_buff *skb,
|
||||
struct flow_offload_tuple *tuple)
|
||||
{
|
||||
+ struct vlan_ethhdr *veth;
|
||||
+ struct pppoe_hdr *phdr;
|
||||
int i = 0;
|
||||
|
||||
if (skb_vlan_tag_present(skb)) {
|
||||
@@ -146,11 +151,17 @@ static void nf_flow_tuple_encap(struct s
|
||||
tuple->encap[i].proto = skb->vlan_proto;
|
||||
i++;
|
||||
}
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
- struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
-
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
+ veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
tuple->encap[i].id = ntohs(veth->h_vlan_TCI);
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ phdr = (struct pppoe_hdr *)skb_mac_header(skb);
|
||||
+ tuple->encap[i].id = ntohs(phdr->sid);
|
||||
+ tuple->encap[i].proto = skb->protocol;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,17 +239,41 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
+static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
+{
|
||||
+ __be16 proto;
|
||||
+
|
||||
+ proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN +
|
||||
+ sizeof(struct pppoe_hdr)));
|
||||
+ switch (proto) {
|
||||
+ case htons(PPP_IP):
|
||||
+ return htons(ETH_P_IP);
|
||||
+ case htons(PPP_IPV6):
|
||||
+ return htons(ETH_P_IPV6);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto,
|
||||
u32 *offset)
|
||||
{
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
- struct vlan_ethhdr *veth;
|
||||
+ struct vlan_ethhdr *veth;
|
||||
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
if (veth->h_vlan_encapsulated_proto == proto) {
|
||||
*offset += VLAN_HLEN;
|
||||
return true;
|
||||
}
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ if (nf_flow_pppoe_proto(skb) == proto) {
|
||||
+ *offset += PPPOE_SES_HLEN;
|
||||
+ return true;
|
||||
+ }
|
||||
+ break;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -255,12 +290,18 @@ static void nf_flow_encap_pop(struct sk_
|
||||
__vlan_hwaccel_clear_tag(skb);
|
||||
continue;
|
||||
}
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
vlan_hdr = (struct vlan_hdr *)skb->data;
|
||||
__skb_pull(skb, VLAN_HLEN);
|
||||
vlan_set_encap_proto(skb, vlan_hdr);
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ skb->protocol = nf_flow_pppoe_proto(skb);
|
||||
+ skb_pull(skb, PPPOE_SES_HLEN);
|
||||
+ skb_reset_network_header(skb);
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
--- a/net/netfilter/nft_flow_offload.c
|
||||
+++ b/net/netfilter/nft_flow_offload.c
|
||||
@@ -90,6 +90,7 @@ static void nft_dev_path_info(const stru
|
||||
switch (path->type) {
|
||||
case DEV_PATH_ETHERNET:
|
||||
case DEV_PATH_VLAN:
|
||||
+ case DEV_PATH_PPPOE:
|
||||
info->indev = path->dev;
|
||||
if (is_zero_ether_addr(info->h_source))
|
||||
memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
|
||||
@@ -97,7 +98,7 @@ static void nft_dev_path_info(const stru
|
||||
if (path->type == DEV_PATH_ETHERNET)
|
||||
break;
|
||||
|
||||
- /* DEV_PATH_VLAN */
|
||||
+ /* DEV_PATH_VLAN and DEV_PATH_PPPOE */
|
||||
if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) {
|
||||
info->indev = NULL;
|
||||
break;
|
||||
@@ -106,6 +107,8 @@ static void nft_dev_path_info(const stru
|
||||
info->encap[info->num_encaps].id = path->encap.id;
|
||||
info->encap[info->num_encaps].proto = path->encap.proto;
|
||||
info->num_encaps++;
|
||||
+ if (path->type == DEV_PATH_PPPOE)
|
||||
+ memcpy(info->h_dest, path->encap.h_dest, ETH_ALEN);
|
||||
break;
|
||||
case DEV_PATH_BRIDGE:
|
||||
if (is_zero_ether_addr(info->h_source))
|
||||
@ -1,8 +1,10 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 4 Mar 2021 19:22:55 +0100
|
||||
Subject: [PATCH] netfilter: nft_flow_offload: add dsa support
|
||||
Date: Wed, 24 Mar 2021 02:30:44 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add dsa support
|
||||
|
||||
Replace the master ethernet device by the dsa slave port.
|
||||
Replace the master ethernet device by the dsa slave port. Packets coming
|
||||
in from the software ingress path use the dsa slave port as input
|
||||
device.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
@ -1,14 +1,14 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Fri, 20 Nov 2020 13:49:21 +0100
|
||||
Subject: [PATCH] selftests: netfilter: flowtable bridge and VLAN support
|
||||
Date: Wed, 24 Mar 2021 02:30:45 +0100
|
||||
Subject: [PATCH] selftests: netfilter: flowtable bridge and vlan support
|
||||
|
||||
This patch adds two new tests to cover bridge and VLAN support:
|
||||
This patch adds two new tests to cover bridge and vlan support:
|
||||
|
||||
- Add a bridge device to the Router1 (nsr1) container and attach the
|
||||
veth0 device to the bridge. Set the IP address to the bridge device
|
||||
to exercise the bridge forwarding path.
|
||||
|
||||
- Add VLAN encapsulation between to the bridge device in the Router1 and
|
||||
- Add vlan encapsulation between to the bridge device in the Router1 and
|
||||
one of the sender containers (ns1).
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Mon, 7 Dec 2020 20:31:44 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:46 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add offload support for xmit path
|
||||
types
|
||||
|
||||
@ -9,11 +9,13 @@ need to be used.
|
||||
|
||||
This patch also adds the FLOW_ACTION_VLAN_PUSH action to pass the VLAN
|
||||
tag to the driver.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_offload.c
|
||||
+++ b/net/netfilter/nf_flow_table_offload.c
|
||||
@@ -175,28 +175,45 @@ static int flow_offload_eth_src(struct n
|
||||
@@ -177,28 +177,45 @@ static int flow_offload_eth_src(struct n
|
||||
enum flow_offload_tuple_dir dir,
|
||||
struct nf_flow_rule *flow_rule)
|
||||
{
|
||||
@ -67,7 +69,7 @@ tag to the driver.
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -208,27 +225,40 @@ static int flow_offload_eth_dst(struct n
|
||||
@@ -210,27 +227,40 @@ static int flow_offload_eth_dst(struct n
|
||||
{
|
||||
struct flow_action_entry *entry0 = flow_action_entry_next(flow_rule);
|
||||
struct flow_action_entry *entry1 = flow_action_entry_next(flow_rule);
|
||||
@ -120,7 +122,7 @@ tag to the driver.
|
||||
}
|
||||
|
||||
mask = ~0xffffffff;
|
||||
@@ -241,7 +271,6 @@ static int flow_offload_eth_dst(struct n
|
||||
@@ -243,7 +273,6 @@ static int flow_offload_eth_dst(struct n
|
||||
val = val16;
|
||||
flow_offload_mangle(entry1, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 4,
|
||||
&val, &mask);
|
||||
@ -128,7 +130,7 @@ tag to the driver.
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -463,27 +492,52 @@ static void flow_offload_ipv4_checksum(s
|
||||
@@ -465,27 +494,52 @@ static void flow_offload_ipv4_checksum(s
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +190,7 @@ tag to the driver.
|
||||
if (dst && dst->lwtstate) {
|
||||
struct ip_tunnel_info *tun_info;
|
||||
|
||||
@@ -500,10 +554,15 @@ static void flow_offload_decap_tunnel(co
|
||||
@@ -502,10 +556,15 @@ static void flow_offload_decap_tunnel(co
|
||||
enum flow_offload_tuple_dir dir,
|
||||
struct nf_flow_rule *flow_rule)
|
||||
{
|
||||
@ -205,7 +207,7 @@ tag to the driver.
|
||||
if (dst && dst->lwtstate) {
|
||||
struct ip_tunnel_info *tun_info;
|
||||
|
||||
@@ -515,10 +574,14 @@ static void flow_offload_decap_tunnel(co
|
||||
@@ -517,10 +576,14 @@ static void flow_offload_decap_tunnel(co
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +225,7 @@ tag to the driver.
|
||||
flow_offload_decap_tunnel(flow, dir, flow_rule);
|
||||
flow_offload_encap_tunnel(flow, dir, flow_rule);
|
||||
|
||||
@@ -526,6 +589,26 @@ int nf_flow_rule_route_ipv4(struct net *
|
||||
@@ -528,6 +591,26 @@ int nf_flow_rule_route_ipv4(struct net *
|
||||
flow_offload_eth_dst(net, flow, dir, flow_rule) < 0)
|
||||
return -1;
|
||||
|
||||
@ -250,7 +252,7 @@ tag to the driver.
|
||||
if (test_bit(NF_FLOW_SNAT, &flow->flags)) {
|
||||
flow_offload_ipv4_snat(net, flow, dir, flow_rule);
|
||||
flow_offload_port_snat(net, flow, dir, flow_rule);
|
||||
@@ -538,7 +621,7 @@ int nf_flow_rule_route_ipv4(struct net *
|
||||
@@ -540,7 +623,7 @@ int nf_flow_rule_route_ipv4(struct net *
|
||||
test_bit(NF_FLOW_DNAT, &flow->flags))
|
||||
flow_offload_ipv4_checksum(net, flow, flow_rule);
|
||||
|
||||
@ -259,7 +261,7 @@ tag to the driver.
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -548,11 +631,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
@@ -550,11 +633,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
enum flow_offload_tuple_dir dir,
|
||||
struct nf_flow_rule *flow_rule)
|
||||
{
|
||||
@ -272,7 +274,7 @@ tag to the driver.
|
||||
return -1;
|
||||
|
||||
if (test_bit(NF_FLOW_SNAT, &flow->flags)) {
|
||||
@@ -564,7 +643,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
@@ -566,7 +645,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
flow_offload_port_dnat(net, flow, dir, flow_rule);
|
||||
}
|
||||
|
||||
@ -281,7 +283,7 @@ tag to the driver.
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -578,10 +657,10 @@ nf_flow_offload_rule_alloc(struct net *n
|
||||
@@ -580,10 +659,10 @@ nf_flow_offload_rule_alloc(struct net *n
|
||||
enum flow_offload_tuple_dir dir)
|
||||
{
|
||||
const struct nf_flowtable *flowtable = offload->flowtable;
|
||||
@ -294,7 +296,7 @@ tag to the driver.
|
||||
int err = -ENOMEM;
|
||||
|
||||
flow_rule = kzalloc(sizeof(*flow_rule), GFP_KERNEL);
|
||||
@@ -597,7 +676,10 @@ nf_flow_offload_rule_alloc(struct net *n
|
||||
@@ -599,7 +678,10 @@ nf_flow_offload_rule_alloc(struct net *n
|
||||
flow_rule->rule->match.key = &flow_rule->match.key;
|
||||
|
||||
tuple = &flow->tuplehash[dir].tuple;
|
||||
@ -1,10 +1,16 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 4 Mar 2021 19:24:11 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:47 +0100
|
||||
Subject: [PATCH] netfilter: nft_flow_offload: use direct xmit if
|
||||
hardware offload is enabled
|
||||
|
||||
If there is a forward path to reach an ethernet device and hardware
|
||||
offload is enabled, then use the direct xmit path.
|
||||
|
||||
Moreover, store the real device in the direct xmit path info since
|
||||
software datapath uses dev_hard_header() to push the layer encapsulation
|
||||
headers while hardware offload refers to the real device.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
@ -37,7 +43,7 @@ offload is enabled, then use the direct xmit path.
|
||||
case FLOW_OFFLOAD_XMIT_NEIGH:
|
||||
--- a/net/netfilter/nf_flow_table_offload.c
|
||||
+++ b/net/netfilter/nf_flow_table_offload.c
|
||||
@@ -506,7 +506,7 @@ static void flow_offload_redirect(struct
|
||||
@@ -508,7 +508,7 @@ static void flow_offload_redirect(struct
|
||||
switch (this_tuple->xmit_type) {
|
||||
case FLOW_OFFLOAD_XMIT_DIRECT:
|
||||
this_tuple = &flow->tuplehash[dir].tuple;
|
||||
@ -1,12 +1,13 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 8 Mar 2021 12:06:44 +0100
|
||||
Subject: [PATCH] netfilter: nf_flow_table: fix untagging with
|
||||
hardware-offloaded bridge vlan_filtering
|
||||
Date: Wed, 24 Mar 2021 02:30:48 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: bridge vlan hardware offload and
|
||||
switchdev
|
||||
|
||||
When switchdev offloading is enabled, treat an untagged VLAN as tagged for
|
||||
ingress only
|
||||
The switch might have already added the VLAN tag through PVID hardware
|
||||
offload. Keep this extra VLAN in the flowtable but skip it on egress.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
@ -78,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
flow_tuple->encap_num = route->tuple[dir].in.num_encaps;
|
||||
--- a/net/netfilter/nf_flow_table_offload.c
|
||||
+++ b/net/netfilter/nf_flow_table_offload.c
|
||||
@@ -592,8 +592,12 @@ nf_flow_rule_route_common(struct net *ne
|
||||
@@ -594,8 +594,12 @@ nf_flow_rule_route_common(struct net *ne
|
||||
other_tuple = &flow->tuplehash[!dir].tuple;
|
||||
|
||||
for (i = 0; i < other_tuple->encap_num; i++) {
|
||||
@ -1,7 +1,11 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 2 Mar 2021 00:51:31 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:49 +0100
|
||||
Subject: [PATCH] net: flow_offload: add FLOW_ACTION_PPPOE_PUSH
|
||||
|
||||
Add an action to represent the PPPoE hardware offload support that
|
||||
includes the session ID.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/flow_offload.h
|
||||
@ -1,13 +1,17 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Tue, 2 Mar 2021 01:01:50 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:50 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: support for
|
||||
FLOW_ACTION_PPPOE_PUSH
|
||||
|
||||
Add a PPPoE push action if layer 2 protocol is ETH_P_PPP_SES to add
|
||||
PPPoE flowtable hardware offload support.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_offload.c
|
||||
+++ b/net/netfilter/nf_flow_table_offload.c
|
||||
@@ -598,9 +598,18 @@ nf_flow_rule_route_common(struct net *ne
|
||||
@@ -600,9 +600,18 @@ nf_flow_rule_route_common(struct net *ne
|
||||
continue;
|
||||
|
||||
entry = flow_action_entry_next(flow_rule);
|
||||
@ -1,5 +1,5 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Mon, 18 Jan 2021 22:39:17 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:51 +0100
|
||||
Subject: [PATCH] dsa: slave: add support for TC_SETUP_FT
|
||||
|
||||
The dsa infrastructure provides a well-defined hierarchy of devices,
|
||||
@ -1,11 +1,12 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sun, 13 Sep 2020 08:17:02 +0200
|
||||
Date: Wed, 24 Mar 2021 02:30:52 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix parsing packets in GDM
|
||||
|
||||
When using DSA, set the special tag in GDM ingress control to allow the MAC
|
||||
to parse packets properly earlier. This affects rx DMA source port reporting.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@ -18,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
#include "mtk_eth_soc.h"
|
||||
|
||||
@@ -1263,13 +1264,12 @@ static int mtk_poll_rx(struct napi_struc
|
||||
@@ -1264,13 +1265,12 @@ static int mtk_poll_rx(struct napi_struc
|
||||
break;
|
||||
|
||||
/* find out which mac the packet come from. values start at 1 */
|
||||
@ -37,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
|
||||
!eth->netdev[mac]))
|
||||
@@ -2251,6 +2251,9 @@ static void mtk_gdm_config(struct mtk_et
|
||||
@@ -2233,6 +2233,9 @@ static void mtk_gdm_config(struct mtk_et
|
||||
|
||||
val |= config;
|
||||
|
||||
@ -49,7 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/* Reset and enable PSE */
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -82,6 +82,7 @@
|
||||
@@ -81,6 +81,7 @@
|
||||
|
||||
/* GDM Exgress Control Register */
|
||||
#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000))
|
||||
@ -57,7 +58,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#define MTK_GDMA_ICS_EN BIT(22)
|
||||
#define MTK_GDMA_TCS_EN BIT(21)
|
||||
#define MTK_GDMA_UCS_EN BIT(20)
|
||||
@@ -311,6 +312,7 @@
|
||||
@@ -304,6 +305,7 @@
|
||||
#define RX_DMA_L4_VALID_PDMA BIT(30) /* when PDMA is used */
|
||||
#define RX_DMA_FPORT_SHIFT 19
|
||||
#define RX_DMA_FPORT_MASK 0x7
|
||||
@ -1,6 +1,6 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sun, 11 Oct 2020 22:23:08 +0200
|
||||
Subject: [PATCH] ethernet: mediatek: mtk_eth_soc: add support for
|
||||
Date: Wed, 24 Mar 2021 02:30:53 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: add support for
|
||||
initializing the PPE
|
||||
|
||||
The PPE (packet processing engine) is used to offload NAT/routed or even
|
||||
@ -9,6 +9,7 @@ hash. It also contains some functionality that will be used to bring up
|
||||
flow offloading.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||
create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||
@ -26,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -2284,12 +2284,17 @@ static int mtk_open(struct net_device *d
|
||||
@@ -2258,12 +2258,17 @@ static int mtk_open(struct net_device *d
|
||||
|
||||
/* we run 2 netdevs on the same dma ring so we only bring it up once */
|
||||
if (!refcount_read(ð->dma_refcnt)) {
|
||||
@ -46,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
napi_enable(ð->tx_napi);
|
||||
napi_enable(ð->rx_napi);
|
||||
@@ -2359,6 +2364,9 @@ static int mtk_stop(struct net_device *d
|
||||
@@ -2330,6 +2335,9 @@ static int mtk_stop(struct net_device *d
|
||||
|
||||
mtk_dma_free(eth);
|
||||
|
||||
@ -56,7 +57,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3148,6 +3156,13 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -3058,6 +3066,13 @@ static int mtk_probe(struct platform_dev
|
||||
goto err_free_dev;
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
for (i = 0; i < MTK_MAX_DEVS; i++) {
|
||||
if (!eth->netdev[i])
|
||||
continue;
|
||||
@@ -3222,6 +3237,7 @@ static const struct mtk_soc_data mt7621_
|
||||
@@ -3132,6 +3147,7 @@ static const struct mtk_soc_data mt7621_
|
||||
.hw_features = MTK_HW_FEATURES,
|
||||
.required_clks = MT7621_CLKS_BITMAP,
|
||||
.required_pctl = false,
|
||||
@ -78,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
};
|
||||
|
||||
static const struct mtk_soc_data mt7622_data = {
|
||||
@@ -3230,6 +3246,7 @@ static const struct mtk_soc_data mt7622_
|
||||
@@ -3140,6 +3156,7 @@ static const struct mtk_soc_data mt7622_
|
||||
.hw_features = MTK_HW_FEATURES,
|
||||
.required_clks = MT7622_CLKS_BITMAP,
|
||||
.required_pctl = false,
|
||||
@ -88,15 +89,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
static const struct mtk_soc_data mt7623_data = {
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -16,6 +16,7 @@
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/u64_stats_sync.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/phylink.h>
|
||||
#include <linux/dim.h>
|
||||
+#include "mtk_ppe.h"
|
||||
|
||||
#define MTK_QDMA_PAGE_SIZE 2048
|
||||
#define MTK_MAX_RX_LENGTH 1536
|
||||
@@ -87,6 +88,7 @@
|
||||
@@ -86,6 +87,7 @@
|
||||
#define MTK_GDMA_TCS_EN BIT(21)
|
||||
#define MTK_GDMA_UCS_EN BIT(20)
|
||||
#define MTK_GDMA_TO_PDMA 0x0
|
||||
@ -104,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#define MTK_GDMA_DROP_ALL 0x7777
|
||||
|
||||
/* Unicast Filter MAC Address Register - Low */
|
||||
@@ -308,6 +310,12 @@
|
||||
@@ -301,6 +303,12 @@
|
||||
#define RX_DMA_VID(_x) ((_x) & 0xfff)
|
||||
|
||||
/* QDMA descriptor rxd4 */
|
||||
@ -117,7 +118,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#define RX_DMA_L4_VALID BIT(24)
|
||||
#define RX_DMA_L4_VALID_PDMA BIT(30) /* when PDMA is used */
|
||||
#define RX_DMA_FPORT_SHIFT 19
|
||||
@@ -807,6 +815,7 @@ struct mtk_soc_data {
|
||||
@@ -798,6 +806,7 @@ struct mtk_soc_data {
|
||||
u32 caps;
|
||||
u32 required_clks;
|
||||
bool required_pctl;
|
||||
@ -125,7 +126,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
netdev_features_t hw_features;
|
||||
};
|
||||
|
||||
@@ -918,6 +927,8 @@ struct mtk_eth {
|
||||
@@ -897,6 +906,8 @@ struct mtk_eth {
|
||||
u32 tx_int_status_reg;
|
||||
u32 rx_dma_l4_valid;
|
||||
int ip_align;
|
||||
@ -185,7 +186,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+{
|
||||
+ unsigned long timeout = jiffies + HZ;
|
||||
+
|
||||
+ while (time_is_after_jiffies(timeout)) {
|
||||
+ while (time_is_before_jiffies(timeout)) {
|
||||
+ if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY))
|
||||
+ return 0;
|
||||
+
|
||||
@ -1,9 +1,9 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 10 Dec 2020 12:19:18 +0100
|
||||
Date: Wed, 24 Mar 2021 02:30:54 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: add flow offloading support
|
||||
|
||||
This adds support for offloading IPv4 routed flows, including SNAT/DNAT,
|
||||
one VLAN, and DSA.
|
||||
one VLAN, PPPoE and DSA.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
@ -21,7 +21,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -2896,6 +2896,7 @@ static const struct net_device_ops mtk_n
|
||||
@@ -2813,6 +2813,7 @@ static const struct net_device_ops mtk_n
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = mtk_poll_controller,
|
||||
#endif
|
||||
@ -29,7 +29,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
};
|
||||
|
||||
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
||||
@@ -3161,6 +3162,10 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -3071,6 +3072,10 @@ static int mtk_probe(struct platform_dev
|
||||
eth->base + MTK_ETH_PPE_BASE, 2);
|
||||
if (err)
|
||||
goto err_free_dev;
|
||||
@ -42,15 +42,15 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
for (i = 0; i < MTK_MAX_DEVS; i++) {
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -16,6 +16,7 @@
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/u64_stats_sync.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/phylink.h>
|
||||
#include <linux/dim.h>
|
||||
+#include <linux/rhashtable.h>
|
||||
#include "mtk_ppe.h"
|
||||
|
||||
#define MTK_QDMA_PAGE_SIZE 2048
|
||||
@@ -41,7 +42,8 @@
|
||||
@@ -40,7 +41,8 @@
|
||||
NETIF_F_HW_VLAN_CTAG_RX | \
|
||||
NETIF_F_SG | NETIF_F_TSO | \
|
||||
NETIF_F_TSO6 | \
|
||||
@ -60,7 +60,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
#define MTK_HW_FEATURES_MT7628 (NETIF_F_SG | NETIF_F_RXCSUM)
|
||||
#define NEXT_DESP_IDX(X, Y) (((X) + 1) & ((Y) - 1))
|
||||
|
||||
@@ -929,6 +931,7 @@ struct mtk_eth {
|
||||
@@ -908,6 +910,7 @@ struct mtk_eth {
|
||||
int ip_align;
|
||||
|
||||
struct mtk_ppe ppe;
|
||||
@ -68,7 +68,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
};
|
||||
|
||||
/* struct mtk_mac - the structure that holds the info about the MACs of the
|
||||
@@ -973,4 +976,9 @@ int mtk_gmac_sgmii_path_setup(struct mtk
|
||||
@@ -952,4 +955,9 @@ int mtk_gmac_sgmii_path_setup(struct mtk
|
||||
int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id);
|
||||
int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
|
||||
|
||||
@ -80,7 +80,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
#endif /* MTK_ETH_H */
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
||||
@@ -0,0 +1,491 @@
|
||||
@@ -0,0 +1,485 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
|
||||
@ -220,12 +220,6 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
+ if (IS_ERR(dp))
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (!dp->cpu_dp)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (!dp->cpu_dp->tag_ops)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (dp->cpu_dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
@ -0,0 +1,236 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Wed, 24 Mar 2021 02:30:55 +0100
|
||||
Subject: [PATCH] docs: nf_flowtable: update documentation with
|
||||
enhancements
|
||||
|
||||
This patch updates the flowtable documentation to describe recent
|
||||
enhancements:
|
||||
|
||||
- Offload action is available after the first packets go through the
|
||||
classic forwarding path.
|
||||
- IPv4 and IPv6 are supported. Only TCP and UDP layer 4 are supported at
|
||||
this stage.
|
||||
- Tuple has been augmented to track VLAN id and PPPoE session id.
|
||||
- Bridge and IP forwarding integration, including bridge VLAN filtering
|
||||
support.
|
||||
- Hardware offload support.
|
||||
- Describe the [OFFLOAD] and [HW_OFFLOAD] tags in the conntrack table
|
||||
listing.
|
||||
- Replace 'flow offload' by 'flow add' in example rulesets (preferred
|
||||
syntax).
|
||||
- Describe existing cache limitations.
|
||||
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/Documentation/networking/nf_flowtable.rst
|
||||
+++ b/Documentation/networking/nf_flowtable.rst
|
||||
@@ -4,35 +4,38 @@
|
||||
Netfilter's flowtable infrastructure
|
||||
====================================
|
||||
|
||||
-This documentation describes the software flowtable infrastructure available in
|
||||
-Netfilter since Linux kernel 4.16.
|
||||
+This documentation describes the Netfilter flowtable infrastructure which allows
|
||||
+you to define a fastpath through the flowtable datapath. This infrastructure
|
||||
+also provides hardware offload support. The flowtable supports for the layer 3
|
||||
+IPv4 and IPv6 and the layer 4 TCP and UDP protocols.
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
-Initial packets follow the classic forwarding path, once the flow enters the
|
||||
-established state according to the conntrack semantics (ie. we have seen traffic
|
||||
-in both directions), then you can decide to offload the flow to the flowtable
|
||||
-from the forward chain via the 'flow offload' action available in nftables.
|
||||
-
|
||||
-Packets that find an entry in the flowtable (ie. flowtable hit) are sent to the
|
||||
-output netdevice via neigh_xmit(), hence, they bypass the classic forwarding
|
||||
-path (the visible effect is that you do not see these packets from any of the
|
||||
-netfilter hooks coming after the ingress). In case of flowtable miss, the packet
|
||||
-follows the classic forward path.
|
||||
-
|
||||
-The flowtable uses a resizable hashtable, lookups are based on the following
|
||||
-7-tuple selectors: source, destination, layer 3 and layer 4 protocols, source
|
||||
-and destination ports and the input interface (useful in case there are several
|
||||
-conntrack zones in place).
|
||||
-
|
||||
-Flowtables are populated via the 'flow offload' nftables action, so the user can
|
||||
-selectively specify what flows are placed into the flow table. Hence, packets
|
||||
-follow the classic forwarding path unless the user explicitly instruct packets
|
||||
-to use this new alternative forwarding path via nftables policy.
|
||||
+Once the first packet of the flow successfully goes through the IP forwarding
|
||||
+path, from the second packet on, you might decide to offload the flow to the
|
||||
+flowtable through your ruleset. The flowtable infrastructure provides a rule
|
||||
+action that allows you to specify when to add a flow to the flowtable.
|
||||
+
|
||||
+A packet that finds a matching entry in the flowtable (ie. flowtable hit) is
|
||||
+transmitted to the output netdevice via neigh_xmit(), hence, packets bypass the
|
||||
+classic IP forwarding path (the visible effect is that you do not see these
|
||||
+packets from any of the Netfilter hooks coming after ingress). In case that
|
||||
+there is no matching entry in the flowtable (ie. flowtable miss), the packet
|
||||
+follows the classic IP forwarding path.
|
||||
+
|
||||
+The flowtable uses a resizable hashtable. Lookups are based on the following
|
||||
+n-tuple selectors: layer 2 protocol encapsulation (VLAN and PPPoE), layer 3
|
||||
+source and destination, layer 4 source and destination ports and the input
|
||||
+interface (useful in case there are several conntrack zones in place).
|
||||
+
|
||||
+The 'flow add' action allows you to populate the flowtable, the user selectively
|
||||
+specifies what flows are placed into the flowtable. Hence, packets follow the
|
||||
+classic IP forwarding path unless the user explicitly instruct flows to use this
|
||||
+new alternative forwarding path via policy.
|
||||
|
||||
-This is represented in Fig.1, which describes the classic forwarding path
|
||||
-including the Netfilter hooks and the flowtable fastpath bypass.
|
||||
+The flowtable datapath is represented in Fig.1, which describes the classic IP
|
||||
+forwarding path including the Netfilter hooks and the flowtable fastpath bypass.
|
||||
|
||||
::
|
||||
|
||||
@@ -67,11 +70,13 @@ including the Netfilter hooks and the fl
|
||||
Fig.1 Netfilter hooks and flowtable interactions
|
||||
|
||||
The flowtable entry also stores the NAT configuration, so all packets are
|
||||
-mangled according to the NAT policy that matches the initial packets that went
|
||||
-through the classic forwarding path. The TTL is decremented before calling
|
||||
-neigh_xmit(). Fragmented traffic is passed up to follow the classic forwarding
|
||||
-path given that the transport selectors are missing, therefore flowtable lookup
|
||||
-is not possible.
|
||||
+mangled according to the NAT policy that is specified from the classic IP
|
||||
+forwarding path. The TTL is decremented before calling neigh_xmit(). Fragmented
|
||||
+traffic is passed up to follow the classic IP forwarding path given that the
|
||||
+transport header is missing, in this case, flowtable lookups are not possible.
|
||||
+TCP RST and FIN packets are also passed up to the classic IP forwarding path to
|
||||
+release the flow gracefully. Packets that exceed the MTU are also passed up to
|
||||
+the classic forwarding path to report packet-too-big ICMP errors to the sender.
|
||||
|
||||
Example configuration
|
||||
---------------------
|
||||
@@ -85,7 +90,7 @@ flowtable and add one rule to your forwa
|
||||
}
|
||||
chain y {
|
||||
type filter hook forward priority 0; policy accept;
|
||||
- ip protocol tcp flow offload @f
|
||||
+ ip protocol tcp flow add @f
|
||||
counter packets 0 bytes 0
|
||||
}
|
||||
}
|
||||
@@ -103,6 +108,117 @@ flow is offloaded, you will observe that
|
||||
does not get updated for the packets that are being forwarded through the
|
||||
forwarding bypass.
|
||||
|
||||
+You can identify offloaded flows through the [OFFLOAD] tag when listing your
|
||||
+connection tracking table.
|
||||
+
|
||||
+::
|
||||
+ # conntrack -L
|
||||
+ tcp 6 src=10.141.10.2 dst=192.168.10.2 sport=52728 dport=5201 src=192.168.10.2 dst=192.168.10.1 sport=5201 dport=52728 [OFFLOAD] mark=0 use=2
|
||||
+
|
||||
+
|
||||
+Layer 2 encapsulation
|
||||
+---------------------
|
||||
+
|
||||
+Since Linux kernel 5.13, the flowtable infrastructure discovers the real
|
||||
+netdevice behind VLAN and PPPoE netdevices. The flowtable software datapath
|
||||
+parses the VLAN and PPPoE layer 2 headers to extract the ethertype and the
|
||||
+VLAN ID / PPPoE session ID which are used for the flowtable lookups. The
|
||||
+flowtable datapath also deals with layer 2 decapsulation.
|
||||
+
|
||||
+You do not need to add the PPPoE and the VLAN devices to your flowtable,
|
||||
+instead the real device is sufficient for the flowtable to track your flows.
|
||||
+
|
||||
+Bridge and IP forwarding
|
||||
+------------------------
|
||||
+
|
||||
+Since Linux kernel 5.13, you can add bridge ports to the flowtable. The
|
||||
+flowtable infrastructure discovers the topology behind the bridge device. This
|
||||
+allows the flowtable to define a fastpath bypass between the bridge ports
|
||||
+(represented as eth1 and eth2 in the example figure below) and the gateway
|
||||
+device (represented as eth0) in your switch/router.
|
||||
+
|
||||
+::
|
||||
+ fastpath bypass
|
||||
+ .-------------------------.
|
||||
+ / \
|
||||
+ | IP forwarding |
|
||||
+ | / \ \/
|
||||
+ | br0 eth0 ..... eth0
|
||||
+ . / \ *host B*
|
||||
+ -> eth1 eth2
|
||||
+ . *switch/router*
|
||||
+ .
|
||||
+ .
|
||||
+ eth0
|
||||
+ *host A*
|
||||
+
|
||||
+The flowtable infrastructure also supports for bridge VLAN filtering actions
|
||||
+such as PVID and untagged. You can also stack a classic VLAN device on top of
|
||||
+your bridge port.
|
||||
+
|
||||
+If you would like that your flowtable defines a fastpath between your bridge
|
||||
+ports and your IP forwarding path, you have to add your bridge ports (as
|
||||
+represented by the real netdevice) to your flowtable definition.
|
||||
+
|
||||
+Counters
|
||||
+--------
|
||||
+
|
||||
+The flowtable can synchronize packet and byte counters with the existing
|
||||
+connection tracking entry by specifying the counter statement in your flowtable
|
||||
+definition, e.g.
|
||||
+
|
||||
+::
|
||||
+ table inet x {
|
||||
+ flowtable f {
|
||||
+ hook ingress priority 0; devices = { eth0, eth1 };
|
||||
+ counter
|
||||
+ }
|
||||
+ ...
|
||||
+ }
|
||||
+
|
||||
+Counter support is available since Linux kernel 5.7.
|
||||
+
|
||||
+Hardware offload
|
||||
+----------------
|
||||
+
|
||||
+If your network device provides hardware offload support, you can turn it on by
|
||||
+means of the 'offload' flag in your flowtable definition, e.g.
|
||||
+
|
||||
+::
|
||||
+ table inet x {
|
||||
+ flowtable f {
|
||||
+ hook ingress priority 0; devices = { eth0, eth1 };
|
||||
+ flags offload;
|
||||
+ }
|
||||
+ ...
|
||||
+ }
|
||||
+
|
||||
+There is a workqueue that adds the flows to the hardware. Note that a few
|
||||
+packets might still run over the flowtable software path until the workqueue has
|
||||
+a chance to offload the flow to the network device.
|
||||
+
|
||||
+You can identify hardware offloaded flows through the [HW_OFFLOAD] tag when
|
||||
+listing your connection tracking table. Please, note that the [OFFLOAD] tag
|
||||
+refers to the software offload mode, so there is a distinction between [OFFLOAD]
|
||||
+which refers to the software flowtable fastpath and [HW_OFFLOAD] which refers
|
||||
+to the hardware offload datapath being used by the flow.
|
||||
+
|
||||
+The flowtable hardware offload infrastructure also supports for the DSA
|
||||
+(Distributed Switch Architecture).
|
||||
+
|
||||
+Limitations
|
||||
+-----------
|
||||
+
|
||||
+The flowtable behaves like a cache. The flowtable entries might get stale if
|
||||
+either the destination MAC address or the egress netdevice that is used for
|
||||
+transmission changes.
|
||||
+
|
||||
+This might be a problem if:
|
||||
+
|
||||
+- You run the flowtable in software mode and you combine bridge and IP
|
||||
+ forwarding in your setup.
|
||||
+- Hardware offload is enabled.
|
||||
+
|
||||
More reading
|
||||
------------
|
||||
|
||||
@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/net/dsa/slave.c
|
||||
+++ b/net/dsa/slave.c
|
||||
@@ -2075,7 +2075,9 @@ static void dsa_slave_switchdev_event_wo
|
||||
@@ -2109,7 +2109,9 @@ static void dsa_slave_switchdev_event_wo
|
||||
|
||||
err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid);
|
||||
if (err) {
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
break;
|
||||
}
|
||||
fdb_info->offloaded = true;
|
||||
@@ -2090,9 +2092,11 @@ static void dsa_slave_switchdev_event_wo
|
||||
@@ -2124,9 +2126,11 @@ static void dsa_slave_switchdev_event_wo
|
||||
|
||||
err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid);
|
||||
if (err) {
|
||||
|
||||
@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
struct sk_buff * (*xmit)(struct sk_buff *skb,
|
||||
--- a/net/dsa/slave.c
|
||||
+++ b/net/dsa/slave.c
|
||||
@@ -2050,76 +2050,66 @@ static int dsa_slave_netdevice_event(str
|
||||
@@ -2084,76 +2084,66 @@ static int dsa_slave_netdevice_event(str
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
}
|
||||
|
||||
/* Called under rcu_read_lock() */
|
||||
@@ -2127,7 +2117,9 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2161,7 +2151,9 @@ static int dsa_slave_switchdev_event(str
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
|
||||
@ -177,7 +177,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
int err;
|
||||
|
||||
if (event == SWITCHDEV_PORT_ATTR_SET) {
|
||||
@@ -2140,20 +2132,32 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2174,20 +2166,32 @@ static int dsa_slave_switchdev_event(str
|
||||
if (!dsa_slave_dev_check(dev))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
@ -213,7 +213,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
dev_hold(dev);
|
||||
break;
|
||||
default:
|
||||
@@ -2163,10 +2167,6 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2197,10 +2201,6 @@ static int dsa_slave_switchdev_event(str
|
||||
|
||||
dsa_schedule_work(&switchdev_work->work);
|
||||
return NOTIFY_OK;
|
||||
|
||||
@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/net/dsa/slave.c
|
||||
+++ b/net/dsa/slave.c
|
||||
@@ -2122,31 +2122,29 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2156,31 +2156,29 @@ static int dsa_slave_switchdev_event(str
|
||||
struct dsa_port *dp;
|
||||
int err;
|
||||
|
||||
@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
fdb_info = ptr;
|
||||
|
||||
if (!fdb_info->added_by_user) {
|
||||
@@ -2159,13 +2157,12 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2193,13 +2191,12 @@ static int dsa_slave_switchdev_event(str
|
||||
switchdev_work->vid = fdb_info->vid;
|
||||
|
||||
dev_hold(dev);
|
||||
|
||||
@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/net/dsa/slave.c
|
||||
+++ b/net/dsa/slave.c
|
||||
@@ -2135,6 +2135,9 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2169,6 +2169,9 @@ static int dsa_slave_switchdev_event(str
|
||||
|
||||
dp = dsa_slave_to_port(dev);
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
*/
|
||||
--- a/net/dsa/slave.c
|
||||
+++ b/net/dsa/slave.c
|
||||
@@ -2112,6 +2112,28 @@ static void dsa_slave_switchdev_event_wo
|
||||
@@ -2146,6 +2146,28 @@ static void dsa_slave_switchdev_event_wo
|
||||
dev_put(dp->slave);
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
/* Called under rcu_read_lock() */
|
||||
static int dsa_slave_switchdev_event(struct notifier_block *unused,
|
||||
unsigned long event, void *ptr)
|
||||
@@ -2130,10 +2152,37 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2164,10 +2186,37 @@ static int dsa_slave_switchdev_event(str
|
||||
return notifier_from_errno(err);
|
||||
case SWITCHDEV_FDB_ADD_TO_DEVICE:
|
||||
case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
||||
@ -240,7 +240,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del)
|
||||
return NOTIFY_DONE;
|
||||
@@ -2148,18 +2197,13 @@ static int dsa_slave_switchdev_event(str
|
||||
@@ -2182,18 +2231,13 @@ static int dsa_slave_switchdev_event(str
|
||||
switchdev_work->port = dp->index;
|
||||
switchdev_work->event = event;
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
unsigned long flags;
|
||||
--- a/drivers/mtd/mtdcore.c
|
||||
+++ b/drivers/mtd/mtdcore.c
|
||||
@@ -32,6 +32,7 @@
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
#include "mtdcore.h"
|
||||
|
||||
@@ -858,6 +859,8 @@ int mtd_device_parse_register(struct mtd
|
||||
@@ -848,6 +849,8 @@ int mtd_device_parse_register(struct mtd
|
||||
register_reboot_notifier(&mtd->reboot_notifier);
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
#include <linux/nvmem-provider.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -693,6 +694,15 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||
@@ -694,6 +695,19 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||
of this try_ nonsense, and no bitching about it
|
||||
either. :) */
|
||||
__module_get(THIS_MODULE);
|
||||
@ -28,9 +28,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
+ if (!strcmp(mtd->name, "rootfs") &&
|
||||
+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
|
||||
+ ROOT_DEV == 0) {
|
||||
+ unsigned int index = mtd->index;
|
||||
+ pr_notice("mtd: device %d (%s) set to be root filesystem\n",
|
||||
+ mtd->index, mtd->name);
|
||||
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ index <<= 1;
|
||||
+#endif
|
||||
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
@ -812,9 +812,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
void flow_offload_teardown(struct flow_offload *flow);
|
||||
|
||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
|
||||
+ void (*iter)(struct flow_offload *flow, void *data),
|
||||
+ void *data);
|
||||
+ void (*iter)(struct flow_offload *flow, void *data),
|
||||
+ void *data);
|
||||
+
|
||||
int nf_flow_snat_port(const struct flow_offload *flow,
|
||||
struct sk_buff *skb, unsigned int thoff,
|
||||
u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
void nf_flow_snat_port(const struct flow_offload *flow,
|
||||
struct sk_buff *skb, unsigned int thoff,
|
||||
u8 protocol, enum flow_offload_tuple_dir dir);
|
||||
|
||||
@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
config MODULES_TREE_LOOKUP
|
||||
--- a/kernel/module.c
|
||||
+++ b/kernel/module.c
|
||||
@@ -3142,9 +3142,11 @@ static int setup_load_info(struct load_i
|
||||
@@ -3224,9 +3224,11 @@ static int setup_load_info(struct load_i
|
||||
|
||||
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
||||
{
|
||||
@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
||||
modmagic = NULL;
|
||||
|
||||
@@ -3165,6 +3167,7 @@ static int check_modinfo(struct module *
|
||||
@@ -3247,6 +3249,7 @@ static int check_modinfo(struct module *
|
||||
mod->name);
|
||||
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
||||
}
|
||||
|
||||
@ -29,9 +29,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
|
||||
+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN
|
||||
|
||||
/**
|
||||
* struct net_device - The DEVICE structure.
|
||||
@@ -1882,6 +1884,11 @@ struct net_device {
|
||||
/* Specifies the type of the struct net_device::ml_priv pointer */
|
||||
enum netdev_ml_priv_type {
|
||||
@@ -1889,6 +1891,11 @@ struct net_device {
|
||||
const struct tlsdev_ops *tlsdev_ops;
|
||||
#endif
|
||||
|
||||
@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
const struct header_ops *header_ops;
|
||||
|
||||
unsigned int flags;
|
||||
@@ -1964,6 +1971,10 @@ struct net_device {
|
||||
@@ -1971,6 +1978,10 @@ struct net_device {
|
||||
struct mpls_dev __rcu *mpls_ptr;
|
||||
#endif
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
--- a/drivers/mtd/mtdcore.c
|
||||
+++ b/drivers/mtd/mtdcore.c
|
||||
@@ -1053,6 +1053,44 @@ out_unlock:
|
||||
@@ -1043,6 +1043,44 @@ out_unlock:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_mtd_device_nm);
|
||||
|
||||
|
||||
@ -1,263 +0,0 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Mon, 1 Mar 2021 23:52:49 +0100
|
||||
Subject: [PATCH] netfilter: flowtable: add pppoe support
|
||||
|
||||
---
|
||||
|
||||
--- a/drivers/net/ppp/ppp_generic.c
|
||||
+++ b/drivers/net/ppp/ppp_generic.c
|
||||
@@ -1453,7 +1453,7 @@ static void ppp_dev_priv_destructor(stru
|
||||
static int ppp_fill_forward_path(struct net_device_path_ctx *ctx,
|
||||
struct net_device_path *path)
|
||||
{
|
||||
- struct ppp *ppp = netdev_priv(path->dev);
|
||||
+ struct ppp *ppp = netdev_priv(ctx->dev);
|
||||
struct ppp_channel *chan;
|
||||
struct channel *pch;
|
||||
|
||||
--- a/drivers/net/ppp/pppoe.c
|
||||
+++ b/drivers/net/ppp/pppoe.c
|
||||
@@ -987,6 +987,7 @@ static int pppoe_fill_forward_path(struc
|
||||
path->type = DEV_PATH_PPPOE;
|
||||
path->encap.proto = htons(ETH_P_PPP_SES);
|
||||
path->encap.id = be16_to_cpu(po->num);
|
||||
+ memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN);
|
||||
path->dev = ctx->dev;
|
||||
ctx->dev = dev;
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -842,6 +842,7 @@ struct net_device_path {
|
||||
struct {
|
||||
u16 id;
|
||||
__be16 proto;
|
||||
+ u8 h_dest[ETH_ALEN];
|
||||
} encap;
|
||||
struct {
|
||||
enum {
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/netdevice.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+#include <linux/if_pppox.h>
|
||||
+#include <linux/ppp_defs.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <net/ip6_route.h>
|
||||
@@ -162,6 +165,8 @@ static bool ip_has_options(unsigned int
|
||||
static void nf_flow_tuple_encap(struct sk_buff *skb,
|
||||
struct flow_offload_tuple *tuple)
|
||||
{
|
||||
+ struct vlan_ethhdr *veth;
|
||||
+ struct pppoe_hdr *phdr;
|
||||
int i = 0;
|
||||
|
||||
if (skb_vlan_tag_present(skb)) {
|
||||
@@ -169,23 +174,35 @@ static void nf_flow_tuple_encap(struct s
|
||||
tuple->encap[i].proto = skb->vlan_proto;
|
||||
i++;
|
||||
}
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
- struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
-
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
+ veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
tuple->encap[i].id = ntohs(veth->h_vlan_TCI);
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ phdr = (struct pppoe_hdr *)skb_mac_header(skb);
|
||||
+ tuple->encap[i].id = ntohs(phdr->sid);
|
||||
+ tuple->encap[i].proto = skb->protocol;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev,
|
||||
- struct flow_offload_tuple *tuple)
|
||||
+ struct flow_offload_tuple *tuple, u32 *nhoff)
|
||||
{
|
||||
unsigned int thoff, hdrsize, offset = 0;
|
||||
struct flow_ports *ports;
|
||||
struct iphdr *iph;
|
||||
|
||||
- if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
offset += VLAN_HLEN;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ offset += PPPOE_SES_HLEN;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(*iph) + offset))
|
||||
return -1;
|
||||
@@ -226,6 +243,7 @@ static int nf_flow_tuple_ip(struct sk_bu
|
||||
tuple->l4proto = iph->protocol;
|
||||
tuple->iifidx = dev->ifindex;
|
||||
nf_flow_tuple_encap(skb, tuple);
|
||||
+ *nhoff = offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -270,14 +288,36 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
+static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
+{
|
||||
+ __be16 proto;
|
||||
+
|
||||
+ proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN +
|
||||
+ sizeof(struct pppoe_hdr)));
|
||||
+ switch (proto) {
|
||||
+ case htons(PPP_IP):
|
||||
+ return htons(ETH_P_IP);
|
||||
+ case htons(PPP_IPV6):
|
||||
+ return htons(ETH_P_IPV6);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto)
|
||||
{
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
- struct vlan_ethhdr *veth;
|
||||
+ struct vlan_ethhdr *veth;
|
||||
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
if (veth->h_vlan_encapsulated_proto == proto)
|
||||
return true;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ if (nf_flow_pppoe_proto(skb) == proto)
|
||||
+ return true;
|
||||
+ break;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -294,12 +334,18 @@ static void nf_flow_encap_pop(struct sk_
|
||||
__vlan_hwaccel_clear_tag(skb);
|
||||
continue;
|
||||
}
|
||||
- if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
vlan_hdr = (struct vlan_hdr *)skb->data;
|
||||
__skb_pull(skb, VLAN_HLEN);
|
||||
vlan_set_encap_proto(skb, vlan_hdr);
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ skb->protocol = nf_flow_pppoe_proto(skb);
|
||||
+ skb_pull(skb, PPPOE_SES_HLEN);
|
||||
+ skb_reset_network_header(skb);
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,7 +389,7 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
!nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (nf_flow_tuple_ip(skb, state->in, &tuple) < 0)
|
||||
+ if (nf_flow_tuple_ip(skb, state->in, &tuple, &offset) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -357,9 +403,6 @@ nf_flow_offload_ip_hook(void *priv, stru
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (skb->protocol == htons(ETH_P_8021Q))
|
||||
- offset += VLAN_HLEN;
|
||||
-
|
||||
if (skb_try_make_writable(skb, sizeof(*iph) + offset))
|
||||
return NF_DROP;
|
||||
|
||||
@@ -543,14 +586,20 @@ static int nf_flow_nat_ipv6(const struct
|
||||
}
|
||||
|
||||
static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
|
||||
- struct flow_offload_tuple *tuple)
|
||||
+ struct flow_offload_tuple *tuple, u32 *nhoff)
|
||||
{
|
||||
unsigned int thoff, hdrsize, offset = 0;
|
||||
struct flow_ports *ports;
|
||||
struct ipv6hdr *ip6h;
|
||||
|
||||
- if (skb->protocol == htons(ETH_P_8021Q))
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_8021Q):
|
||||
offset += VLAN_HLEN;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ offset += PPPOE_SES_HLEN;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(*ip6h) + offset))
|
||||
return -1;
|
||||
@@ -586,6 +635,7 @@ static int nf_flow_tuple_ipv6(struct sk_
|
||||
tuple->l4proto = ip6h->nexthdr;
|
||||
tuple->iifidx = dev->ifindex;
|
||||
nf_flow_tuple_encap(skb, tuple);
|
||||
+ *nhoff = offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -611,7 +661,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
!nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (nf_flow_tuple_ipv6(skb, state->in, &tuple) < 0)
|
||||
+ if (nf_flow_tuple_ipv6(skb, state->in, &tuple, &offset) < 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
tuplehash = flow_offload_lookup(flow_table, &tuple);
|
||||
@@ -625,9 +675,6 @@ nf_flow_offload_ipv6_hook(void *priv, st
|
||||
if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
- if (skb->protocol == htons(ETH_P_8021Q))
|
||||
- offset += VLAN_HLEN;
|
||||
-
|
||||
ip6h = (struct ipv6hdr *)(skb_network_header(skb) + offset);
|
||||
if (nf_flow_state_check(flow, ip6h->nexthdr, skb, sizeof(*ip6h)))
|
||||
return NF_ACCEPT;
|
||||
--- a/net/netfilter/nft_flow_offload.c
|
||||
+++ b/net/netfilter/nft_flow_offload.c
|
||||
@@ -90,6 +90,7 @@ static void nft_dev_path_info(const stru
|
||||
switch (path->type) {
|
||||
case DEV_PATH_ETHERNET:
|
||||
case DEV_PATH_VLAN:
|
||||
+ case DEV_PATH_PPPOE:
|
||||
info->indev = path->dev;
|
||||
if (is_zero_ether_addr(info->h_source))
|
||||
memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
|
||||
@@ -97,7 +98,7 @@ static void nft_dev_path_info(const stru
|
||||
if (path->type == DEV_PATH_ETHERNET)
|
||||
break;
|
||||
|
||||
- /* DEV_PATH_VLAN */
|
||||
+ /* DEV_PATH_VLAN and DEV_PATH_PPPOE */
|
||||
if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) {
|
||||
info->indev = NULL;
|
||||
break;
|
||||
@@ -106,6 +107,8 @@ static void nft_dev_path_info(const stru
|
||||
info->encap[info->num_encaps].id = path->encap.id;
|
||||
info->encap[info->num_encaps].proto = path->encap.proto;
|
||||
info->num_encaps++;
|
||||
+ if (path->type == DEV_PATH_PPPOE)
|
||||
+ memcpy(info->h_dest, path->encap.h_dest, ETH_ALEN);
|
||||
break;
|
||||
case DEV_PATH_BRIDGE:
|
||||
if (is_zero_ether_addr(info->h_source))
|
||||
@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -2029,6 +2029,8 @@ struct net_device {
|
||||
@@ -2036,6 +2036,8 @@ struct net_device {
|
||||
struct netdev_hw_addr_list mc;
|
||||
struct netdev_hw_addr_list dev_addrs;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -857,7 +857,8 @@ static int txd_to_idx(struct mtk_tx_ring
|
||||
@@ -858,7 +858,8 @@ static int txd_to_idx(struct mtk_tx_ring
|
||||
return ((void *)dma - (void *)ring->dma) / sizeof(*dma);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
{
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
|
||||
if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) {
|
||||
@@ -889,8 +890,12 @@ static void mtk_tx_unmap(struct mtk_eth
|
||||
@@ -890,8 +891,12 @@ static void mtk_tx_unmap(struct mtk_eth
|
||||
|
||||
tx_buf->flags = 0;
|
||||
if (tx_buf->skb &&
|
||||
@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
tx_buf->skb = NULL;
|
||||
}
|
||||
|
||||
@@ -1068,7 +1073,7 @@ err_dma:
|
||||
@@ -1069,7 +1074,7 @@ err_dma:
|
||||
tx_buf = mtk_desc_to_tx_buf(ring, itxd);
|
||||
|
||||
/* unmap dma */
|
||||
|
||||
@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -85,7 +85,7 @@ static int mtk_mdio_busy_wait(struct mtk
|
||||
@@ -86,7 +86,7 @@ static int mtk_mdio_busy_wait(struct mtk
|
||||
return 0;
|
||||
if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
|
||||
break;
|
||||
|
||||
@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
skb_record_rx_queue(skb, 0);
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -295,6 +295,7 @@
|
||||
@@ -300,6 +300,7 @@
|
||||
#define RX_DMA_LSO BIT(30)
|
||||
#define RX_DMA_PLEN0(_x) (((_x) & 0x3fff) << 16)
|
||||
#define RX_DMA_GET_PLEN0(_x) (((_x) >> 16) & 0x3fff)
|
||||
|
||||
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -1130,17 +1130,6 @@ static void mtk_wake_queue(struct mtk_et
|
||||
@@ -1131,17 +1131,6 @@ static void mtk_wake_queue(struct mtk_et
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
static netdev_tx_t mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct mtk_mac *mac = netdev_priv(dev);
|
||||
@@ -1161,7 +1150,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
||||
@@ -1162,7 +1151,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
||||
|
||||
tx_num = mtk_cal_txd_req(skb);
|
||||
if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
|
||||
@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
netif_err(eth, tx_queued, dev,
|
||||
"Tx Ring full when queue awake!\n");
|
||||
spin_unlock(ð->page_lock);
|
||||
@@ -1187,7 +1176,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
||||
@@ -1188,7 +1177,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
||||
goto drop;
|
||||
|
||||
if (unlikely(atomic_read(&ring->free_count) <= ring->thresh))
|
||||
|
||||
@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
MTK_QDMA_GLO_CFG);
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -197,7 +197,7 @@
|
||||
@@ -202,7 +202,7 @@
|
||||
#define MTK_RX_BT_32DWORDS (3 << 11)
|
||||
#define MTK_NDP_CO_PRO BIT(10)
|
||||
#define MTK_TX_WB_DDONE BIT(6)
|
||||
|
||||
@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -19,7 +19,7 @@
|
||||
@@ -21,7 +21,7 @@
|
||||
#define MTK_QDMA_PAGE_SIZE 2048
|
||||
#define MTK_MAX_RX_LENGTH 1536
|
||||
#define MTK_TX_DMA_BUF_LEN 0x3fff
|
||||
|
||||
@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
MediaTek SoC family.
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -1232,12 +1232,13 @@ static void mtk_update_rx_cpu_idx(struct
|
||||
@@ -1233,12 +1233,13 @@ static void mtk_update_rx_cpu_idx(struct
|
||||
static int mtk_poll_rx(struct napi_struct *napi, int budget,
|
||||
struct mtk_eth *eth)
|
||||
{
|
||||
@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (likely(napi_schedule_prep(ð->tx_napi))) {
|
||||
__napi_schedule(ð->tx_napi);
|
||||
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
|
||||
@@ -2315,6 +2332,9 @@ static int mtk_stop(struct net_device *d
|
||||
@@ -2323,6 +2340,9 @@ static int mtk_stop(struct net_device *d
|
||||
napi_disable(ð->tx_napi);
|
||||
napi_disable(ð->rx_napi);
|
||||
|
||||
@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
|
||||
mtk_stop_dma(eth, MTK_QDMA_GLO_CFG);
|
||||
mtk_stop_dma(eth, MTK_PDMA_GLO_CFG);
|
||||
@@ -2364,6 +2384,64 @@ err_disable_clks:
|
||||
@@ -2375,6 +2395,64 @@ err_disable_clks:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
static int mtk_hw_init(struct mtk_eth *eth)
|
||||
{
|
||||
int i, val, ret;
|
||||
@@ -2385,9 +2463,6 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
@@ -2396,9 +2474,6 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
goto err_disable_pm;
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/* disable delay and normal interrupt */
|
||||
mtk_tx_irq_disable(eth, ~0);
|
||||
mtk_rx_irq_disable(eth, ~0);
|
||||
@@ -2426,11 +2501,10 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
@@ -2437,11 +2512,10 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
/* Enable RX VLan Offloading */
|
||||
mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
|
||||
|
||||
@ -194,7 +194,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
mtk_tx_irq_disable(eth, ~0);
|
||||
mtk_rx_irq_disable(eth, ~0);
|
||||
|
||||
@@ -2934,6 +3008,13 @@ static int mtk_probe(struct platform_dev
|
||||
@@ -2946,6 +3020,13 @@ static int mtk_probe(struct platform_dev
|
||||
spin_lock_init(ð->page_lock);
|
||||
spin_lock_init(ð->tx_irq_lock);
|
||||
spin_lock_init(ð->rx_irq_lock);
|
||||
@ -210,15 +210,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/u64_stats_sync.h>
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/phylink.h>
|
||||
#include <linux/rhashtable.h>
|
||||
+#include <linux/dim.h>
|
||||
#include "mtk_ppe.h"
|
||||
|
||||
#define MTK_QDMA_PAGE_SIZE 2048
|
||||
#define MTK_MAX_RX_LENGTH 1536
|
||||
@@ -131,13 +132,18 @@
|
||||
@@ -136,13 +137,18 @@
|
||||
|
||||
/* PDMA Delay Interrupt Register */
|
||||
#define MTK_PDMA_DELAY_INT 0xa0c
|
||||
@ -242,7 +242,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
/* PDMA Interrupt Status Register */
|
||||
#define MTK_PDMA_INT_STATUS 0xa20
|
||||
@@ -219,6 +225,7 @@
|
||||
@@ -224,6 +230,7 @@
|
||||
/* QDMA Interrupt Status Register */
|
||||
#define MTK_QDMA_INT_STATUS 0x1A18
|
||||
#define MTK_RX_DONE_DLY BIT(30)
|
||||
@ -250,7 +250,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#define MTK_RX_DONE_INT3 BIT(19)
|
||||
#define MTK_RX_DONE_INT2 BIT(18)
|
||||
#define MTK_RX_DONE_INT1 BIT(17)
|
||||
@@ -228,8 +235,7 @@
|
||||
@@ -233,8 +240,7 @@
|
||||
#define MTK_TX_DONE_INT1 BIT(1)
|
||||
#define MTK_TX_DONE_INT0 BIT(0)
|
||||
#define MTK_RX_DONE_INT MTK_RX_DONE_DLY
|
||||
@ -260,7 +260,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
/* QDMA Interrupt grouping registers */
|
||||
#define MTK_QDMA_INT_GRP1 0x1a20
|
||||
@@ -892,6 +898,18 @@ struct mtk_eth {
|
||||
@@ -905,6 +911,18 @@ struct mtk_eth {
|
||||
|
||||
const struct mtk_soc_data *soc;
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
} else {
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -624,6 +624,7 @@ struct mtk_tx_buf {
|
||||
@@ -636,6 +636,7 @@ struct mtk_tx_buf {
|
||||
* @phys: The physical addr of tx_buf
|
||||
* @next_free: Pointer to the next free descriptor
|
||||
* @last_free: Pointer to the last free descriptor
|
||||
@ -57,7 +57,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
* @thresh: The threshold of minimum amount of free descriptors
|
||||
* @free_count: QDMA uses a linked list. Track how many free descriptors
|
||||
* are present
|
||||
@@ -634,6 +635,7 @@ struct mtk_tx_ring {
|
||||
@@ -646,6 +647,7 @@ struct mtk_tx_ring {
|
||||
dma_addr_t phys;
|
||||
struct mtk_tx_dma *next_free;
|
||||
struct mtk_tx_dma *last_free;
|
||||
|
||||
@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -776,13 +776,18 @@ static inline int mtk_max_buf_size(int f
|
||||
@@ -777,13 +777,18 @@ static inline int mtk_max_buf_size(int f
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
}
|
||||
|
||||
/* the qdma core needs scratch memory to be setup */
|
||||
@@ -1254,8 +1259,7 @@ static int mtk_poll_rx(struct napi_struc
|
||||
@@ -1255,8 +1260,7 @@ static int mtk_poll_rx(struct napi_struc
|
||||
rxd = &ring->dma[idx];
|
||||
data = ring->data[idx];
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -1924,6 +1924,8 @@ struct net_device {
|
||||
@@ -1931,6 +1931,8 @@ struct net_device {
|
||||
struct netdev_hw_addr_list mc;
|
||||
struct netdev_hw_addr_list dev_addrs;
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
};
|
||||
|
||||
enum gro_result {
|
||||
@@ -2092,6 +2095,7 @@ struct net_device {
|
||||
@@ -2101,6 +2104,7 @@ struct net_device {
|
||||
struct lock_class_key addr_list_lock_key;
|
||||
bool proto_down;
|
||||
unsigned wol_enabled:1;
|
||||
@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
};
|
||||
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
||||
|
||||
@@ -2249,6 +2253,26 @@ void netif_napi_add(struct net_device *d
|
||||
@@ -2281,6 +2285,26 @@ void netif_napi_add(struct net_device *d
|
||||
int (*poll)(struct napi_struct *, int), int weight);
|
||||
|
||||
/**
|
||||
|
||||
@ -7,11 +7,11 @@ This patch fixes the checkpatch warnings about too long lines.
|
||||
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/rx-offload.c | 39 ++++++++++++++++++++++++++-------------
|
||||
drivers/net/can/dev/rx-offload.c | 39 ++++++++++++++++++++++++++-------------
|
||||
1 file changed, 26 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -1,7 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
-/*
|
||||
|
||||
@ -7,11 +7,11 @@ This patch fixes a typo found by checkpatch.
|
||||
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/rx-offload.c | 2 +-
|
||||
drivers/net/can/dev/rx-offload.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -109,7 +109,7 @@ static int can_rx_offload_compare(struct
|
||||
cb_a = can_rx_offload_get_cb(a);
|
||||
cb_b = can_rx_offload_get_cb(b);
|
||||
|
||||
@ -8,11 +8,11 @@ This patch moves the assignment of queue_len out of the if condition.
|
||||
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/rx-offload.c | 4 ++--
|
||||
drivers/net/can/dev/rx-offload.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -238,8 +238,8 @@ int can_rx_offload_irq_offload_timestamp
|
||||
skb_queue_splice_tail(&skb_queue, &offload->skb_queue);
|
||||
spin_unlock_irqrestore(&offload->skb_queue.lock, flags);
|
||||
|
||||
@ -9,12 +9,12 @@ nothing. If we ever need this function, add it back again.
|
||||
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/rx-offload.c | 7 -------
|
||||
drivers/net/can/dev/rx-offload.c | 7 -------
|
||||
include/linux/can/rx-offload.h | 1 -
|
||||
2 files changed, 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -348,7 +348,6 @@ static int can_rx_offload_init_queue(str
|
||||
offload->skb_queue_len_max *= 4;
|
||||
skb_queue_head_init(&offload->skb_queue);
|
||||
|
||||
@ -19,7 +19,7 @@ Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/flexcan.c | 27 +++++++++++-----
|
||||
drivers/net/can/rx-offload.c | 70 ++++++++++--------------------------------
|
||||
drivers/net/can/dev/rx-offload.c | 70 ++++++++++--------------------------------
|
||||
include/linux/can/rx-offload.h | 6 ++--
|
||||
3 files changed, 40 insertions(+), 63 deletions(-)
|
||||
|
||||
@ -98,8 +98,8 @@ Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
}
|
||||
|
||||
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -139,71 +139,35 @@ static int can_rx_offload_compare(struct
|
||||
static struct sk_buff *
|
||||
can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)
|
||||
|
||||
@ -10,7 +10,7 @@ Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
|
||||
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
---
|
||||
drivers/net/can/flexcan.c | 34 +++++++++++++++++-----------------
|
||||
drivers/net/can/rx-offload.c | 4 ++--
|
||||
drivers/net/can/dev/rx-offload.c | 4 ++--
|
||||
2 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/drivers/net/can/flexcan.c
|
||||
@ -97,8 +97,8 @@ Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
||||
}
|
||||
|
||||
mark_as_read:
|
||||
--- a/drivers/net/can/rx-offload.c
|
||||
+++ b/drivers/net/can/rx-offload.c
|
||||
--- a/drivers/net/can/dev/rx-offload.c
|
||||
+++ b/drivers/net/can/dev/rx-offload.c
|
||||
@@ -51,11 +51,11 @@ static int can_rx_offload_napi_poll(stru
|
||||
|
||||
while ((work_done < quota) &&
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
#include "mt7622-ubnt-unifi-6-lr.dtsi"
|
||||
|
||||
/ {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
#include "mt7622-ubnt-unifi-6-lr.dtsi"
|
||||
|
||||
/ {
|
||||
|
||||
@ -43,11 +43,12 @@ define Build/mt7622-gpt
|
||||
-H \
|
||||
-t 0x83 -N bl2 -r -p 512k@512k \
|
||||
) \
|
||||
-t 0xef -N fip -r -p 1M@2M \
|
||||
-t 0xef -N fip -r -p 2M@2M \
|
||||
-t 0x83 -N ubootenv -r -p 1M@4M \
|
||||
-N recovery -r -p 32M@6M \
|
||||
$(if $(findstring sdmmc,$1), \
|
||||
-t 0x2e -N production -p 216M@40M \
|
||||
-N install -r -p 7M@38M \
|
||||
-t 0x2e -N production -p 211M@45M \
|
||||
) \
|
||||
$(if $(findstring emmc,$1), \
|
||||
-t 0x2e -N production -p 980M@40M \
|
||||
@ -79,13 +80,13 @@ define Device/bananapi_bpi-r64
|
||||
IMAGES := sysupgrade.itb
|
||||
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
||||
ARTIFACT/sdcard.img.gz := mt7622-gpt sdmmc |\
|
||||
pad-to 128k | mt7622-gpt emmc |\
|
||||
pad-to 256k | bl2 emmc-2ddr |\
|
||||
pad-to 512k | bl2 sdmmc-2ddr |\
|
||||
pad-to 1024k | bl31-uboot bananapi_bpi-r64-emmc |\
|
||||
pad-to 2048k | bl31-uboot bananapi_bpi-r64-sdmmc |\
|
||||
pad-to 6144k | append-image initramfs-recovery.itb |\
|
||||
pad-to 40960k | append-image squashfs-sysupgrade.itb | gzip
|
||||
pad-to 38912k | mt7622-gpt emmc |\
|
||||
pad-to 39424k | bl2 emmc-2ddr |\
|
||||
pad-to 40960k | bl31-uboot bananapi_bpi-r64-emmc |\
|
||||
pad-to 46080k | append-image squashfs-sysupgrade.itb | gzip
|
||||
KERNEL := kernel-bin | gzip
|
||||
KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
|
||||
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
|
||||
|
||||
@ -11,6 +11,7 @@ FEATURES:=ext4 rtc usb gpio
|
||||
CPU_TYPE:=arm926ej-s
|
||||
|
||||
KERNEL_PATCHVER:=5.4
|
||||
KERNEL_TESTING_PATCHVER:=5.10
|
||||
KERNELNAME:=zImage dtbs
|
||||
|
||||
define Target/Description
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user