From 51edc4eb89bb299d5da2a20e1cc7349b808c6747 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 31 Mar 2020 13:01:18 +0100 Subject: [PATCH 1/6] jansson: convert to cmake Signed-off-by: Kevin Darbyshire-Bryant --- package/libs/jansson/Makefile | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/package/libs/jansson/Makefile b/package/libs/jansson/Makefile index 880d372116..30278ca02e 100644 --- a/package/libs/jansson/Makefile +++ b/package/libs/jansson/Makefile @@ -11,38 +11,33 @@ PKG_NAME:=jansson PKG_VERSION:=2.12 PKG_RELEASE:=1 PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.digip.org/jansson/releases/ PKG_HASH:=645d72cc5dbebd4df608d33988e55aa42a7661039e19a379fcbe5c79d1aee1d2 -PKG_INSTALL:=1 - include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_INSTALL:=1 +CMAKE_OPTIONS += \ + -DJANSSON_BUILD_DOCS:BOOL=OFF \ + -DJANSSON_BUILD_SHARED_LIBS:BOOL=ON \ + -DJANSSON_EXAMPLES:BOOL=OFF \ + -DJANSSON_WITHOUT_TESTS:BOOL=ON define Package/jansson SECTION:=libs CATEGORY:=Libraries TITLE:=Jansson library URL:=http://www.digip.org/jansson/ - MAINTAINER:=Gergely Kiss endef define Package/jansson/description Jansson is a C library for encoding, decoding and manipulating JSON data endef -TARGET_CFLAGS += $(FPIC) -TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -lm - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/{lib,include} - $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ -endef - define Package/jansson/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so* $(1)/usr/lib/ From a24a9bbc8c131c300fd8d4f9307aa236ed61a34b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 30 Mar 2020 23:35:04 +0100 Subject: [PATCH 2/6] mac80211: rt2x00: prune more unnecessary exports The calibration patches for MT7620 unnecessarily export symbols and populate never accessed function pointers. Remove all that and make functions static as the only place where each of those functions is called is within rt2800lib.c. Also make code more readable by fixing indentation, removing unnecessary parantheses and simplifying some instructions using shorthands here and there. Signed-off-by: Daniel Golle --- ...-rt2x00-add-rf-self-txdc-calibration.patch | 28 ++---------- .../rt2x00/983-rt2x00-add-r-calibration.patch | 43 ++++--------------- .../984-rt2x00-add-rxdcoc-calibration.patch | 29 ++----------- .../985-rt2x00-add-rxiq-calibration.patch | 39 ++++------------- .../986-rt2x00-add-TX-LOFT-calibration.patch | 25 ++--------- 5 files changed, 27 insertions(+), 137 deletions(-) diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 3bb91ec7c5..4addb8e545 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8422,6 +8422,58 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8422,6 +8422,56 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } -+void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) ++static void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) +{ + u8 rfb5r1_org, rfb7r1_org, rfvalue; + u32 mac0518, mac051c, mac0528, mac052c; @@ -52,14 +52,12 @@ + rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); + + rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); -+ +} -+EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9029,6 +9081,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9029,6 +9079,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); @@ -67,23 +65,3 @@ rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); } ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -242,6 +242,7 @@ void rt2800_link_tuner(struct rt2x00_dev - const u32 count); - void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -562,6 +562,7 @@ struct rt2x00lib_ops { - struct link_qual *qual, const u32 count); - void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); - void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index d7d07f8bb6..8041580411 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8474,6 +8474,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x +@@ -8472,6 +8472,155 @@ static void rt2800_rf_self_txdc_cal(stru + rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); } - EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); -+int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) ++static int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) +{ + int calcode; + calcode = ((d2 - d1) * 1000) / 43; @@ -14,9 +14,8 @@ + + return calcode; +} -+EXPORT_SYMBOL_GPL(rt2800_calcrcalibrationcode); + -+void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) ++static void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) +{ + u32 savemacsysctrl; + u8 saverfb0r1, saverfb0r34, saverfb0r35; @@ -29,6 +28,8 @@ + char d1 = 0, d2 = 0; + u8 rfvalue; + u32 MAC_RF_BYPASS0, MAC_RF_CONTROL0, MAC_PWR_PIN_CFG; ++ u32 maccfg, macstatus; ++ int i; + + saverfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); + saverfb0r34 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 34); @@ -48,10 +49,6 @@ + MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); + MAC_PWR_PIN_CFG = rt2800_register_read(rt2x00dev, PWR_PIN_CFG); + -+ { -+ u32 maccfg, macstatus; -+ int i; -+ + maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); + maccfg &= (~0x04); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); @@ -62,7 +59,7 @@ + udelay(50); + else + break; -+ } ++ } + + if (i == 10000) + rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); @@ -81,7 +78,6 @@ + + if (i == 10000) + rt2x00_warn(rt2x00dev, "Wait MAC Rx Status to MAX !!!\n"); -+ } + + rfvalue = (MAC_RF_BYPASS0 | 0x3004); + rt2800_register_write(rt2x00dev, RF_BYPASS0, rfvalue); @@ -156,12 +152,11 @@ + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); + rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); +} -+EXPORT_SYMBOL_GPL(rt2800_r_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9081,6 +9235,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9079,6 +9228,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); @@ -169,25 +164,3 @@ rt2800_rf_self_txdc_cal(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -243,6 +243,8 @@ void rt2800_link_tuner(struct rt2x00_dev - void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); -+int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); -+void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -563,6 +563,8 @@ struct rt2x00lib_ops { - void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); - void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); -+ int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); -+ void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index b6180efa8b..89a4ccb961 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,10 +1,10 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8628,6 +8628,71 @@ void rt2800_r_calibration(struct rt2x00_ +@@ -8621,6 +8621,70 @@ static void rt2800_r_calibration(struct + rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } - EXPORT_SYMBOL_GPL(rt2800_r_calibration); -+void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) ++static void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) +{ + u8 bbpreg = 0; + u32 macvalue = 0, macvalue1 = 0; @@ -67,12 +67,11 @@ + + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); +} -+EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9237,6 +9302,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9230,6 +9294,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); @@ -80,23 +79,3 @@ rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); } ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -245,6 +245,7 @@ void rt2800_vco_calibration(struct rt2x0 - void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); - int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -565,6 +565,7 @@ struct rt2x00lib_ops { - void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); - int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 63cca526c2..9a03efdef8 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8693,6 +8693,385 @@ void rt2800_rxdcoc_calibration(struct rt +@@ -8685,6 +8685,384 @@ static void rt2800_rxdcoc_calibration(st + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } - EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); +static u32 rt2800_do_sqrt_accumulation(u32 si) { + u32 root, root_pre, bit; @@ -19,7 +19,7 @@ + return root; +} + -+void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) { ++static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) { + u8 rfb0r1, rfb0r2, rfb0r42; + u8 rfb4r0, rfb4r19; + u8 rfb5r3, rfb5r4, rfb5r17, rfb5r18, rfb5r19, rfb5r20; @@ -82,11 +82,11 @@ + + rt2800_register_write(rt2x00dev, RF_CONTROL1, 0x00000202); + rt2800_register_write(rt2x00dev, RF_BYPASS1, 0x00000303); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0101); -+ } else { ++ else + rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0000); -+ } ++ + rt2800_register_write(rt2x00dev, RF_BYPASS3, 0xf1f1); + + rfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); @@ -340,10 +340,10 @@ + + rt2800_bbp_write(rt2x00dev, 244, 0x00); + bbpval = rt2800_bbp_read(rt2x00dev, 21); -+ bbpval = (bbpval | 0x1); ++ bbpval |= 0x1; + rt2800_bbp_write(rt2x00dev, 21, bbpval); + usleep_range(10, 200); -+ bbpval = (bbpval & 0xfe); ++ bbpval &= 0xfe; + rt2800_bbp_write(rt2x00dev, 21, bbpval); + + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfb0r1); @@ -381,12 +381,11 @@ + rt2800_register_write(rt2x00dev, RF_BYPASS3, orig_RF_BYPASS3); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); +} -+EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9305,6 +9684,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9297,6 +9675,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); @@ -394,23 +393,3 @@ } static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -246,6 +246,7 @@ void rt2800_rf_self_txdc_cal(struct rt2x - int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -566,6 +566,7 @@ struct rt2x00lib_ops { - int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index 1a18f13f8e..fc5e4ca5d7 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9072,6 +9072,944 @@ restore_value: +@@ -9063,6 +9063,943 @@ restore_value: + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } - EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); +static void rt2800_rf_configstore(struct rt2x00_dev *rt2x00dev, rf_reg_pair rf_reg_record[][13], u8 chain) +{ @@ -940,12 +940,11 @@ + + return; +} -+EXPORT_SYMBOL_GPL(rt2800_loft_iq_calibration); + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9684,6 +10622,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9675,6 +10612,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); @@ -972,21 +971,3 @@ /* RT2800 driver data structure */ struct rt2800_drv_data { -@@ -247,6 +257,7 @@ int rt2800_calcrcalibrationcode(struct r - void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); - void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); -+void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev); - - int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); - void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -567,6 +567,7 @@ struct rt2x00lib_ops { - void (*r_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); - void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); -+ void (*loft_iq_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. From e32eaf5896276825e81c2250d9c58e4952c3a563 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 1 Apr 2020 14:08:42 -0600 Subject: [PATCH 3/6] wireguard: bump to 1.0.20200401 Recent backports to 5.5 and 5.4 broke our compat layer. This release is to keep things running with the latest upstream stable kernels. Signed-off-by: Jason A. Donenfeld --- package/network/services/wireguard/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile index 7e98f0b3ca..2d8a766023 100644 --- a/package/network/services/wireguard/Makefile +++ b/package/network/services/wireguard/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=1.0.20200330 +PKG_VERSION:=1.0.20200401 PKG_RELEASE:=1 PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/ -PKG_HASH:=2d57b239605be2ee0e4c2da935ff1a23e9ed8bb3ee692e10ae032ae50f280bef +PKG_HASH:=7dfb4a8315e1d6ae406ff32d01c496175df558dd65968a19e5222d02c7cfb77a PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From 475738c9af41c503eda01c756f5c8dcb95d2c50b Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 30 Mar 2020 18:52:09 +0100 Subject: [PATCH 4/6] kmod-sched-cake: rename to kmod-sched-cake-oot In preparation for dropping the out of tree cake module and using in tree cake from upstream, rename the package to kmod-sched-cake-oot (out of tree) Initially add a PROVIDES kmod-sched-cake so that package dependencies can be satisfied. Ultimately this package will be removed when linux 4.14 is removed. Signed-off-by: Kevin Darbyshire-Bryant --- .../Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) rename package/kernel/{kmod-sched-cake => kmod-sched-cake-oot}/Makefile (74%) diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake-oot/Makefile similarity index 74% rename from package/kernel/kmod-sched-cake/Makefile rename to package/kernel/kmod-sched-cake-oot/Makefile index 42e45b5789..e53e42eb9c 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake-oot/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_NAME:=sched-cake +PKG_NAME:=sched-cake-oot PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -20,23 +20,24 @@ PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk -define KernelPackage/sched-cake +define KernelPackage/sched-cake-oot SUBMENU:=Network Support - TITLE:=Cake fq_codel/blue derived shaper + TITLE:=OOT Cake fq_codel/blue derived shaper URL:=https://github.com/dtaht/sch_cake FILES:=$(PKG_BUILD_DIR)/sch_cake.ko AUTOLOAD:=$(call AutoLoad,75,sch_cake) - DEPENDS:=+kmod-ipt-conntrack + DEPENDS:=+kmod-sched-core +kmod-ipt-conntrack + PROVIDES:=kmod-sched-cake endef include $(INCLUDE_DIR)/kernel-defaults.mk define KernelPackage/sched-cake/description - Common Applications Kept Enhanced fq_codel/blue derived shaper + O(ut) O(f) T(ree) Common Applications Kept Enhanced fq_codel/blue derived shaper endef define Build/Compile $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules endef -$(eval $(call KernelPackage,sched-cake)) +$(eval $(call KernelPackage,sched-cake-oot)) From b74386acc6793ee7effe92153e93e3f9fad7fc9c Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 29 Jul 2019 16:54:02 +0100 Subject: [PATCH 5/6] kmod-sched-cake: switch to in-tree cake for 4.19+ Use in tree version of cake for kernels 4.19+ and backport features from later kernel versions to 4.19. Unfortunately PROVIDES dependency handling produces bogus circular dependency warnings so whilst this package and kmod-sched-cake-oot should be able to PROVIDE kmod-sched-cake this doesn't work. Instead, remove the PROVIDES option and modify package sqm-scripts to depend on the correct module independently. Signed-off-by: Kevin Darbyshire-Bryant --- package/kernel/kmod-sched-cake-oot/Makefile | 3 +- package/kernel/linux/modules/netsupport.mk | 17 +- ...-sch_cake-Make-the-dual-modes-fairer.patch | 217 ++++++++++++++++++ ...-use-of-connmarks-as-tin-classifiers.patch | 118 ++++++++++ ...erpret-fwmark-parameter-as-a-bitmask.patch | 102 ++++++++ ...rop-unused-variable-tin_quantum_prio.patch | 158 +++++++++++++ ...sing-NLA-policy-entry-TCA_CAKE_SPLIT.patch | 30 +++ 7 files changed, 642 insertions(+), 3 deletions(-) create mode 100644 target/linux/generic/backport-4.19/392-v5.1-sch_cake-Make-the-dual-modes-fairer.patch create mode 100644 target/linux/generic/backport-4.19/393-v5.1-sch_cake-Permit-use-of-connmarks-as-tin-classifiers.patch create mode 100644 target/linux/generic/backport-4.19/394-v5.1-sch_cake-Interpret-fwmark-parameter-as-a-bitmask.patch create mode 100644 target/linux/generic/backport-4.19/395-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch create mode 100644 target/linux/generic/backport-4.19/396-v5.4-sch_cake-Add-missing-NLA-policy-entry-TCA_CAKE_SPLIT.patch diff --git a/package/kernel/kmod-sched-cake-oot/Makefile b/package/kernel/kmod-sched-cake-oot/Makefile index e53e42eb9c..963681c1fb 100644 --- a/package/kernel/kmod-sched-cake-oot/Makefile +++ b/package/kernel/kmod-sched-cake-oot/Makefile @@ -26,8 +26,7 @@ define KernelPackage/sched-cake-oot URL:=https://github.com/dtaht/sch_cake FILES:=$(PKG_BUILD_DIR)/sch_cake.ko AUTOLOAD:=$(call AutoLoad,75,sch_cake) - DEPENDS:=+kmod-sched-core +kmod-ipt-conntrack - PROVIDES:=kmod-sched-cake + DEPENDS:=@LINUX_4_14 +kmod-sched-core +kmod-ipt-conntrack endef include $(INCLUDE_DIR)/kernel-defaults.mk diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index b3b32877a3..ca25138571 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -746,7 +746,7 @@ $(eval $(call KernelPackage,mppe)) SCHED_MODULES = $(patsubst $(LINUX_DIR)/net/sched/%.ko,%,$(wildcard $(LINUX_DIR)/net/sched/*.ko)) SCHED_MODULES_CORE = sch_ingress sch_fq_codel sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_mirred act_skbedit cls_matchall -SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark act_ctinfo sch_netem sch_mqprio em_ipset cls_bpf cls_flower act_bpf act_vlan +SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark act_ctinfo sch_cake sch_netem sch_mqprio em_ipset cls_bpf cls_flower act_bpf act_vlan SCHED_MODULES_EXTRA = $(filter-out $(SCHED_MODULES_FILTER),$(SCHED_MODULES)) SCHED_FILES = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(filter $(SCHED_MODULES_CORE),$(SCHED_MODULES))) SCHED_FILES_EXTRA = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(SCHED_MODULES_EXTRA)) @@ -785,6 +785,21 @@ endef $(eval $(call KernelPackage,sched-core)) +define KernelPackage/sched-cake + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Cake fq_codel/blue derived shaper + DEPENDS:=@!LINUX_4_14 +kmod-sched-core + KCONFIG:=CONFIG_NET_SCH_CAKE + FILES:=$(LINUX_DIR)/net/sched/sch_cake.ko + AUTOLOAD:=$(call AutoProbe,sch_cake) +endef + +define KernelPackage/sched-cake/description + Common Applications Kept Enhanced fq_codel/blue derived shaper +endef + +$(eval $(call KernelPackage,sched-cake)) + define KernelPackage/sched-flower SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Flower traffic classifier diff --git a/target/linux/generic/backport-4.19/392-v5.1-sch_cake-Make-the-dual-modes-fairer.patch b/target/linux/generic/backport-4.19/392-v5.1-sch_cake-Make-the-dual-modes-fairer.patch new file mode 100644 index 0000000000..cd94600152 --- /dev/null +++ b/target/linux/generic/backport-4.19/392-v5.1-sch_cake-Make-the-dual-modes-fairer.patch @@ -0,0 +1,217 @@ +From 712639929912c5eefb09facccb48d55b3f72c9f8 Mon Sep 17 00:00:00 2001 +From: George Amanakis +Date: Fri, 1 Mar 2019 16:04:05 +0100 +Subject: [PATCH] sch_cake: Make the dual modes fairer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +CAKE host fairness does not work well with TCP flows in dual-srchost and +dual-dsthost setup. The reason is that ACKs generated by TCP flows are +classified as sparse flows, and affect flow isolation from other hosts. Fix +this by calculating host_load based only on the bulk flows a host +generates. In a hash collision the host_bulk_flow_count values must be +decremented on the old hosts and incremented on the new ones *if* the queue +is in the bulk set. + +Reported-by: Pete Heist +Signed-off-by: George Amanakis +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +Signed-off-by: Kevin Darbyshire-Bryant +--- + net/sched/sch_cake.c | 92 ++++++++++++++++++++++++++++++-------------- + 1 file changed, 63 insertions(+), 29 deletions(-) + +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -138,8 +138,8 @@ struct cake_flow { + struct cake_host { + u32 srchost_tag; + u32 dsthost_tag; +- u16 srchost_refcnt; +- u16 dsthost_refcnt; ++ u16 srchost_bulk_flow_count; ++ u16 dsthost_bulk_flow_count; + }; + + struct cake_heap_entry { +@@ -746,8 +746,10 @@ skip_hash: + * queue, accept the collision, update the host tags. + */ + q->way_collisions++; +- q->hosts[q->flows[reduced_hash].srchost].srchost_refcnt--; +- q->hosts[q->flows[reduced_hash].dsthost].dsthost_refcnt--; ++ if (q->flows[outer_hash + k].set == CAKE_SET_BULK) { ++ q->hosts[q->flows[reduced_hash].srchost].srchost_bulk_flow_count--; ++ q->hosts[q->flows[reduced_hash].dsthost].dsthost_bulk_flow_count--; ++ } + allocate_src = cake_dsrc(flow_mode); + allocate_dst = cake_ddst(flow_mode); + found: +@@ -767,13 +769,14 @@ found: + } + for (i = 0; i < CAKE_SET_WAYS; + i++, k = (k + 1) % CAKE_SET_WAYS) { +- if (!q->hosts[outer_hash + k].srchost_refcnt) ++ if (!q->hosts[outer_hash + k].srchost_bulk_flow_count) + break; + } + q->hosts[outer_hash + k].srchost_tag = srchost_hash; + found_src: + srchost_idx = outer_hash + k; +- q->hosts[srchost_idx].srchost_refcnt++; ++ if (q->flows[reduced_hash].set == CAKE_SET_BULK) ++ q->hosts[srchost_idx].srchost_bulk_flow_count++; + q->flows[reduced_hash].srchost = srchost_idx; + } + +@@ -789,13 +792,14 @@ found_src: + } + for (i = 0; i < CAKE_SET_WAYS; + i++, k = (k + 1) % CAKE_SET_WAYS) { +- if (!q->hosts[outer_hash + k].dsthost_refcnt) ++ if (!q->hosts[outer_hash + k].dsthost_bulk_flow_count) + break; + } + q->hosts[outer_hash + k].dsthost_tag = dsthost_hash; + found_dst: + dsthost_idx = outer_hash + k; +- q->hosts[dsthost_idx].dsthost_refcnt++; ++ if (q->flows[reduced_hash].set == CAKE_SET_BULK) ++ q->hosts[dsthost_idx].dsthost_bulk_flow_count++; + q->flows[reduced_hash].dsthost = dsthost_idx; + } + } +@@ -1793,20 +1797,30 @@ static s32 cake_enqueue(struct sk_buff * + b->sparse_flow_count++; + + if (cake_dsrc(q->flow_mode)) +- host_load = max(host_load, srchost->srchost_refcnt); ++ host_load = max(host_load, srchost->srchost_bulk_flow_count); + + if (cake_ddst(q->flow_mode)) +- host_load = max(host_load, dsthost->dsthost_refcnt); ++ host_load = max(host_load, dsthost->dsthost_bulk_flow_count); + + flow->deficit = (b->flow_quantum * + quantum_div[host_load]) >> 16; + } else if (flow->set == CAKE_SET_SPARSE_WAIT) { ++ struct cake_host *srchost = &b->hosts[flow->srchost]; ++ struct cake_host *dsthost = &b->hosts[flow->dsthost]; ++ + /* this flow was empty, accounted as a sparse flow, but actually + * in the bulk rotation. + */ + flow->set = CAKE_SET_BULK; + b->sparse_flow_count--; + b->bulk_flow_count++; ++ ++ if (cake_dsrc(q->flow_mode)) ++ srchost->srchost_bulk_flow_count++; ++ ++ if (cake_ddst(q->flow_mode)) ++ dsthost->dsthost_bulk_flow_count++; ++ + } + + if (q->buffer_used > q->buffer_max_used) +@@ -1974,23 +1988,8 @@ retry: + dsthost = &b->hosts[flow->dsthost]; + host_load = 1; + +- if (cake_dsrc(q->flow_mode)) +- host_load = max(host_load, srchost->srchost_refcnt); +- +- if (cake_ddst(q->flow_mode)) +- host_load = max(host_load, dsthost->dsthost_refcnt); +- +- WARN_ON(host_load > CAKE_QUEUES); +- + /* flow isolation (DRR++) */ + if (flow->deficit <= 0) { +- /* The shifted prandom_u32() is a way to apply dithering to +- * avoid accumulating roundoff errors +- */ +- flow->deficit += (b->flow_quantum * quantum_div[host_load] + +- (prandom_u32() >> 16)) >> 16; +- list_move_tail(&flow->flowchain, &b->old_flows); +- + /* Keep all flows with deficits out of the sparse and decaying + * rotations. No non-empty flow can go into the decaying + * rotation, so they can't get deficits +@@ -1999,6 +1998,13 @@ retry: + if (flow->head) { + b->sparse_flow_count--; + b->bulk_flow_count++; ++ ++ if (cake_dsrc(q->flow_mode)) ++ srchost->srchost_bulk_flow_count++; ++ ++ if (cake_ddst(q->flow_mode)) ++ dsthost->dsthost_bulk_flow_count++; ++ + flow->set = CAKE_SET_BULK; + } else { + /* we've moved it to the bulk rotation for +@@ -2008,6 +2014,22 @@ retry: + flow->set = CAKE_SET_SPARSE_WAIT; + } + } ++ ++ if (cake_dsrc(q->flow_mode)) ++ host_load = max(host_load, srchost->srchost_bulk_flow_count); ++ ++ if (cake_ddst(q->flow_mode)) ++ host_load = max(host_load, dsthost->dsthost_bulk_flow_count); ++ ++ WARN_ON(host_load > CAKE_QUEUES); ++ ++ /* The shifted prandom_u32() is a way to apply dithering to ++ * avoid accumulating roundoff errors ++ */ ++ flow->deficit += (b->flow_quantum * quantum_div[host_load] + ++ (prandom_u32() >> 16)) >> 16; ++ list_move_tail(&flow->flowchain, &b->old_flows); ++ + goto retry; + } + +@@ -2028,6 +2050,13 @@ retry: + &b->decaying_flows); + if (flow->set == CAKE_SET_BULK) { + b->bulk_flow_count--; ++ ++ if (cake_dsrc(q->flow_mode)) ++ srchost->srchost_bulk_flow_count--; ++ ++ if (cake_ddst(q->flow_mode)) ++ dsthost->dsthost_bulk_flow_count--; ++ + b->decaying_flow_count++; + } else if (flow->set == CAKE_SET_SPARSE || + flow->set == CAKE_SET_SPARSE_WAIT) { +@@ -2041,14 +2070,19 @@ retry: + if (flow->set == CAKE_SET_SPARSE || + flow->set == CAKE_SET_SPARSE_WAIT) + b->sparse_flow_count--; +- else if (flow->set == CAKE_SET_BULK) ++ else if (flow->set == CAKE_SET_BULK) { + b->bulk_flow_count--; +- else ++ ++ if (cake_dsrc(q->flow_mode)) ++ srchost->srchost_bulk_flow_count--; ++ ++ if (cake_ddst(q->flow_mode)) ++ dsthost->dsthost_bulk_flow_count--; ++ ++ } else + b->decaying_flow_count--; + + flow->set = CAKE_SET_NONE; +- srchost->srchost_refcnt--; +- dsthost->dsthost_refcnt--; + } + goto begin; + } diff --git a/target/linux/generic/backport-4.19/393-v5.1-sch_cake-Permit-use-of-connmarks-as-tin-classifiers.patch b/target/linux/generic/backport-4.19/393-v5.1-sch_cake-Permit-use-of-connmarks-as-tin-classifiers.patch new file mode 100644 index 0000000000..9ac1388c98 --- /dev/null +++ b/target/linux/generic/backport-4.19/393-v5.1-sch_cake-Permit-use-of-connmarks-as-tin-classifiers.patch @@ -0,0 +1,118 @@ +From 0b5c7efdfc6e389ec6840579fe90bdb6f42b08dc Mon Sep 17 00:00:00 2001 +From: Kevin Darbyshire-Bryant +Date: Fri, 1 Mar 2019 16:04:05 +0100 +Subject: [PATCH] sch_cake: Permit use of connmarks as tin classifiers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add flag 'FWMARK' to enable use of firewall connmarks as tin selector. +The connmark (skbuff->mark) needs to be in the range 1->tin_cnt ie. +for diffserv3 the mark needs to be 1->3. + +Background + +Typically CAKE uses DSCP as the basis for tin selection. DSCP values +are relatively easily changed as part of the egress path, usually with +iptables & the mangle table, ingress is more challenging. CAKE is often +used on the WAN interface of a residential gateway where passthrough of +DSCP from the ISP is either missing or set to unhelpful values thus use +of ingress DSCP values for tin selection isn't helpful in that +environment. + +An approach to solving the ingress tin selection problem is to use +CAKE's understanding of tc filters. Naive tc filters could match on +source/destination port numbers and force tin selection that way, but +multiple filters don't scale particularly well as each filter must be +traversed whether it matches or not. e.g. a simple example to map 3 +firewall marks to tins: + +MAJOR=$( tc qdisc show dev $DEV | head -1 | awk '{print $3}' ) +tc filter add dev $DEV parent $MAJOR protocol all handle 0x01 fw action skbedit priority ${MAJOR}1 +tc filter add dev $DEV parent $MAJOR protocol all handle 0x02 fw action skbedit priority ${MAJOR}2 +tc filter add dev $DEV parent $MAJOR protocol all handle 0x03 fw action skbedit priority ${MAJOR}3 + +Another option is to use eBPF cls_act with tc filters e.g. + +MAJOR=$( tc qdisc show dev $DEV | head -1 | awk '{print $3}' ) +tc filter add dev $DEV parent $MAJOR bpf da obj my-bpf-fwmark-to-class.o + +This has the disadvantages of a) needing someone to write & maintain +the bpf program, b) a bpf toolchain to compile it and c) needing to +hardcode the major number in the bpf program so it matches the cake +instance (or forcing the cake instance to a particular major number) +since the major number cannot be passed to the bpf program via tc +command line. + +As already hinted at by the previous examples, it would be helpful +to associate tins with something that survives the Internet path and +ideally allows tin selection on both egress and ingress. Netfilter's +conntrack permits setting an identifying mark on a connection which +can also be restored to an ingress packet with tc action connmark e.g. + +tc filter add dev eth0 parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action connmark action mirred egress redirect dev ifb1 + +Since tc's connmark action has restored any connmark into skb->mark, +any of the previous solutions are based upon it and in one form or +another copy that mark to the skb->priority field where again CAKE +picks this up. + +This change cuts out at least one of the (less intuitive & +non-scalable) middlemen and permit direct access to skb->mark. + +Signed-off-by: Kevin Darbyshire-Bryant +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +--- + include/uapi/linux/pkt_sched.h | 1 + + net/sched/sch_cake.c | 34 +++++++++++++++++++++++++++------- + 2 files changed, 28 insertions(+), 7 deletions(-) + +--- a/include/uapi/linux/pkt_sched.h ++++ b/include/uapi/linux/pkt_sched.h +@@ -991,6 +991,7 @@ enum { + TCA_CAKE_INGRESS, + TCA_CAKE_ACK_FILTER, + TCA_CAKE_SPLIT_GSO, ++ TCA_CAKE_FWMARK, + __TCA_CAKE_MAX + }; + #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -258,7 +258,8 @@ enum { + CAKE_FLAG_AUTORATE_INGRESS = BIT(1), + CAKE_FLAG_INGRESS = BIT(2), + CAKE_FLAG_WASH = BIT(3), +- CAKE_FLAG_SPLIT_GSO = BIT(4) ++ CAKE_FLAG_SPLIT_GSO = BIT(4), ++ CAKE_FLAG_FWMARK = BIT(5) + }; + + /* COBALT operates the Codel and BLUE algorithms in parallel, in order to +@@ -2623,6 +2624,13 @@ static int cake_change(struct Qdisc *sch + q->rate_flags &= ~CAKE_FLAG_SPLIT_GSO; + } + ++ if (tb[TCA_CAKE_FWMARK]) { ++ if (!!nla_get_u32(tb[TCA_CAKE_FWMARK])) ++ q->rate_flags |= CAKE_FLAG_FWMARK; ++ else ++ q->rate_flags &= ~CAKE_FLAG_FWMARK; ++ } ++ + if (q->tins) { + sch_tree_lock(sch); + cake_reconfigure(sch); +@@ -2782,6 +2790,10 @@ static int cake_dump(struct Qdisc *sch, + !!(q->rate_flags & CAKE_FLAG_SPLIT_GSO))) + goto nla_put_failure; + ++ if (nla_put_u32(skb, TCA_CAKE_FWMARK, ++ !!(q->rate_flags & CAKE_FLAG_FWMARK))) ++ goto nla_put_failure; ++ + return nla_nest_end(skb, opts); + + nla_put_failure: diff --git a/target/linux/generic/backport-4.19/394-v5.1-sch_cake-Interpret-fwmark-parameter-as-a-bitmask.patch b/target/linux/generic/backport-4.19/394-v5.1-sch_cake-Interpret-fwmark-parameter-as-a-bitmask.patch new file mode 100644 index 0000000000..325f5719d7 --- /dev/null +++ b/target/linux/generic/backport-4.19/394-v5.1-sch_cake-Interpret-fwmark-parameter-as-a-bitmask.patch @@ -0,0 +1,102 @@ +From eab2fc822af38f31fd5f4e731b5d10b94904d919 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Thu, 14 Mar 2019 23:08:22 +0100 +Subject: [PATCH] sch_cake: Interpret fwmark parameter as a bitmask +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We initially interpreted the fwmark parameter as a flag that simply turned +on the feature, using the whole skb->mark field as the index into the CAKE +tin_order array. However, it is quite common for different applications to +use different parts of the mask field for their own purposes, each using a +different mask. + +Support this use of subsets of the mark by interpreting the TCA_CAKE_FWMARK +parameter as a bitmask to apply to the fwmark field when reading it. The +result will be right-shifted by the number of unset lower bits of the mask +before looking up the tin. + +In the original commit message we also failed to credit Felix Resch with +originally suggesting the fwmark feature back in 2017; so the Suggested-By +in this commit covers the whole fwmark feature. + +Fixes: 0b5c7efdfc6e ("sch_cake: Permit use of connmarks as tin classifiers") +Suggested-by: Felix Resch +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +Signed-off-by: Kevin Darbyshire-Bryant +--- + net/sched/sch_cake.c | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -211,6 +211,9 @@ struct cake_sched_data { + u8 ack_filter; + u8 atm_mode; + ++ u32 fwmark_mask; ++ u16 fwmark_shft; ++ + /* time_next = time_this + ((len * rate_ns) >> rate_shft) */ + u16 rate_shft; + ktime_t time_next_packet; +@@ -258,8 +261,7 @@ enum { + CAKE_FLAG_AUTORATE_INGRESS = BIT(1), + CAKE_FLAG_INGRESS = BIT(2), + CAKE_FLAG_WASH = BIT(3), +- CAKE_FLAG_SPLIT_GSO = BIT(4), +- CAKE_FLAG_FWMARK = BIT(5) ++ CAKE_FLAG_SPLIT_GSO = BIT(4) + }; + + /* COBALT operates the Codel and BLUE algorithms in parallel, in order to +@@ -1554,7 +1556,7 @@ static struct cake_tin_data *cake_select + struct sk_buff *skb) + { + struct cake_sched_data *q = qdisc_priv(sch); +- u32 tin; ++ u32 tin, mark; + u8 dscp; + + /* Tin selection: Default to diffserv-based selection, allow overriding +@@ -1562,6 +1564,7 @@ static struct cake_tin_data *cake_select + */ + dscp = cake_handle_diffserv(skb, + q->rate_flags & CAKE_FLAG_WASH); ++ mark = (skb->mark & q->fwmark_mask) >> q->fwmark_shft; + + if (q->tin_mode == CAKE_DIFFSERV_BESTEFFORT) + tin = 0; +@@ -2178,6 +2181,7 @@ static const struct nla_policy cake_poli + [TCA_CAKE_MPU] = { .type = NLA_U32 }, + [TCA_CAKE_INGRESS] = { .type = NLA_U32 }, + [TCA_CAKE_ACK_FILTER] = { .type = NLA_U32 }, ++ [TCA_CAKE_FWMARK] = { .type = NLA_U32 }, + }; + + static void cake_set_rate(struct cake_tin_data *b, u64 rate, u32 mtu, +@@ -2625,10 +2629,8 @@ static int cake_change(struct Qdisc *sch + } + + if (tb[TCA_CAKE_FWMARK]) { +- if (!!nla_get_u32(tb[TCA_CAKE_FWMARK])) +- q->rate_flags |= CAKE_FLAG_FWMARK; +- else +- q->rate_flags &= ~CAKE_FLAG_FWMARK; ++ q->fwmark_mask = nla_get_u32(tb[TCA_CAKE_FWMARK]); ++ q->fwmark_shft = q->fwmark_mask ? __ffs(q->fwmark_mask) : 0; + } + + if (q->tins) { +@@ -2790,8 +2792,7 @@ static int cake_dump(struct Qdisc *sch, + !!(q->rate_flags & CAKE_FLAG_SPLIT_GSO))) + goto nla_put_failure; + +- if (nla_put_u32(skb, TCA_CAKE_FWMARK, +- !!(q->rate_flags & CAKE_FLAG_FWMARK))) ++ if (nla_put_u32(skb, TCA_CAKE_FWMARK, q->fwmark_mask)) + goto nla_put_failure; + + return nla_nest_end(skb, opts); diff --git a/target/linux/generic/backport-4.19/395-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch b/target/linux/generic/backport-4.19/395-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch new file mode 100644 index 0000000000..33e5c54b8c --- /dev/null +++ b/target/linux/generic/backport-4.19/395-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch @@ -0,0 +1,158 @@ +From d7e1738f0a0b0573ac93cf570ba3df9dee61b68e Mon Sep 17 00:00:00 2001 +From: Kevin 'ldir' Darbyshire-Bryant +Date: Wed, 18 Dec 2019 14:05:13 +0000 +Subject: [PATCH 2/2] sch_cake: drop unused variable tin_quantum_prio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Turns out tin_quantum_prio isn't used anymore and is a leftover from a +previous implementation of diffserv tins. Since the variable isn't used +in any calculations it can be eliminated. + +Drop variable and places where it was set. Rename remaining variable +and consolidate naming of intermediate variables that set it. + +Signed-off-by: Kevin Darbyshire-Bryant +Acked-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +--- + net/sched/sch_cake.c | 59 ++++++++++++++------------------------------ + 1 file changed, 18 insertions(+), 41 deletions(-) + +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -173,8 +173,7 @@ struct cake_tin_data { + u64 tin_rate_bps; + u16 tin_rate_shft; + +- u16 tin_quantum_prio; +- u16 tin_quantum_band; ++ u16 tin_quantum; + s32 tin_deficit; + u32 tin_backlog; + u32 tin_dropped; +@@ -1916,7 +1915,7 @@ begin: + while (b->tin_deficit < 0 || + !(b->sparse_flow_count + b->bulk_flow_count)) { + if (b->tin_deficit <= 0) +- b->tin_deficit += b->tin_quantum_band; ++ b->tin_deficit += b->tin_quantum; + if (b->sparse_flow_count + b->bulk_flow_count) + empty = false; + +@@ -2237,8 +2236,7 @@ static int cake_config_besteffort(struct + + cake_set_rate(b, rate, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); +- b->tin_quantum_band = 65535; +- b->tin_quantum_prio = 65535; ++ b->tin_quantum = 65535; + + return 0; + } +@@ -2249,8 +2247,7 @@ static int cake_config_precedence(struct + struct cake_sched_data *q = qdisc_priv(sch); + u32 mtu = psched_mtu(qdisc_dev(sch)); + u64 rate = q->rate_bps; +- u32 quantum1 = 256; +- u32 quantum2 = 256; ++ u32 quantum = 256; + u32 i; + + q->tin_cnt = 8; +@@ -2263,18 +2260,14 @@ static int cake_config_precedence(struct + cake_set_rate(b, rate, mtu, us_to_ns(q->target), + us_to_ns(q->interval)); + +- b->tin_quantum_prio = max_t(u16, 1U, quantum1); +- b->tin_quantum_band = max_t(u16, 1U, quantum2); ++ b->tin_quantum = max_t(u16, 1U, quantum); + + /* calculate next class's parameters */ + rate *= 7; + rate >>= 3; + +- quantum1 *= 3; +- quantum1 >>= 1; +- +- quantum2 *= 7; +- quantum2 >>= 3; ++ quantum *= 7; ++ quantum >>= 3; + } + + return 0; +@@ -2343,8 +2336,7 @@ static int cake_config_diffserv8(struct + struct cake_sched_data *q = qdisc_priv(sch); + u32 mtu = psched_mtu(qdisc_dev(sch)); + u64 rate = q->rate_bps; +- u32 quantum1 = 256; +- u32 quantum2 = 256; ++ u32 quantum = 256; + u32 i; + + q->tin_cnt = 8; +@@ -2360,18 +2352,14 @@ static int cake_config_diffserv8(struct + cake_set_rate(b, rate, mtu, us_to_ns(q->target), + us_to_ns(q->interval)); + +- b->tin_quantum_prio = max_t(u16, 1U, quantum1); +- b->tin_quantum_band = max_t(u16, 1U, quantum2); ++ b->tin_quantum = max_t(u16, 1U, quantum); + + /* calculate next class's parameters */ + rate *= 7; + rate >>= 3; + +- quantum1 *= 3; +- quantum1 >>= 1; +- +- quantum2 *= 7; +- quantum2 >>= 3; ++ quantum *= 7; ++ quantum >>= 3; + } + + return 0; +@@ -2410,17 +2398,11 @@ static int cake_config_diffserv4(struct + cake_set_rate(&q->tins[3], rate >> 2, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); + +- /* priority weights */ +- q->tins[0].tin_quantum_prio = quantum; +- q->tins[1].tin_quantum_prio = quantum >> 4; +- q->tins[2].tin_quantum_prio = quantum << 2; +- q->tins[3].tin_quantum_prio = quantum << 4; +- + /* bandwidth-sharing weights */ +- q->tins[0].tin_quantum_band = quantum; +- q->tins[1].tin_quantum_band = quantum >> 4; +- q->tins[2].tin_quantum_band = quantum >> 1; +- q->tins[3].tin_quantum_band = quantum >> 2; ++ q->tins[0].tin_quantum = quantum; ++ q->tins[1].tin_quantum = quantum >> 4; ++ q->tins[2].tin_quantum = quantum >> 1; ++ q->tins[3].tin_quantum = quantum >> 2; + + return 0; + } +@@ -2451,15 +2433,10 @@ static int cake_config_diffserv3(struct + cake_set_rate(&q->tins[2], rate >> 2, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); + +- /* priority weights */ +- q->tins[0].tin_quantum_prio = quantum; +- q->tins[1].tin_quantum_prio = quantum >> 4; +- q->tins[2].tin_quantum_prio = quantum << 4; +- + /* bandwidth-sharing weights */ +- q->tins[0].tin_quantum_band = quantum; +- q->tins[1].tin_quantum_band = quantum >> 4; +- q->tins[2].tin_quantum_band = quantum >> 2; ++ q->tins[0].tin_quantum = quantum; ++ q->tins[1].tin_quantum = quantum >> 4; ++ q->tins[2].tin_quantum = quantum >> 2; + + return 0; + } diff --git a/target/linux/generic/backport-4.19/396-v5.4-sch_cake-Add-missing-NLA-policy-entry-TCA_CAKE_SPLIT.patch b/target/linux/generic/backport-4.19/396-v5.4-sch_cake-Add-missing-NLA-policy-entry-TCA_CAKE_SPLIT.patch new file mode 100644 index 0000000000..32f0e1ae89 --- /dev/null +++ b/target/linux/generic/backport-4.19/396-v5.4-sch_cake-Add-missing-NLA-policy-entry-TCA_CAKE_SPLIT.patch @@ -0,0 +1,30 @@ +From b3c424eb6a1a3c485de64619418a471dee6ce849 Mon Sep 17 00:00:00 2001 +From: Victorien Molle +Date: Mon, 2 Dec 2019 15:11:38 +0100 +Subject: [PATCH] sch_cake: Add missing NLA policy entry TCA_CAKE_SPLIT_GSO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This field has never been checked since introduction in mainline kernel + +Signed-off-by: Victorien Molle +Signed-off-by: Florent Fourcot +Fixes: 2db6dc2662ba "sch_cake: Make gso-splitting configurable from userspace" +Acked-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +Signed-off-by: Kevin Darbyshire-Bryant +--- + net/sched/sch_cake.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -2180,6 +2180,7 @@ static const struct nla_policy cake_poli + [TCA_CAKE_MPU] = { .type = NLA_U32 }, + [TCA_CAKE_INGRESS] = { .type = NLA_U32 }, + [TCA_CAKE_ACK_FILTER] = { .type = NLA_U32 }, ++ [TCA_CAKE_SPLIT_GSO] = { .type = NLA_U32 }, + [TCA_CAKE_FWMARK] = { .type = NLA_U32 }, + }; + From fcd14017007db35a4a41ef4fd6b69a5e02edbd5e Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Wed, 1 Apr 2020 22:44:37 +0100 Subject: [PATCH 6/6] grub2: fix build when ASLR enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable ASLR and filter '-fno-plt' from CFLAGS: solves building when ASLR enabled by basically disabling ASLR. Solves errors similar to: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE or module missing GLOBAL_OFFSET_TABLE Suggested-by: 李国 Acked-by: Petr Štetiar Signed-off-by: Kevin Darbyshire-Bryant --- package/boot/grub2/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 840401fa3a..46e3597cc2 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=grub PKG_CPE_ID:=cpe:/a:gnu:grub2 PKG_VERSION:=2.04 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/grub @@ -20,6 +20,7 @@ PKG_HASH:=e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d HOST_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=grub2/host +PKG_ASLR_PIE:=0 PKG_SSP:=0 PKG_FLAGS:=nonshared @@ -83,7 +84,7 @@ HOST_MAKE_FLAGS += \ TARGET_RANLIB=$(TARGET_RANLIB) \ LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a -TARGET_CFLAGS := +TARGET_CFLAGS := $(filter-out -fno-plt,$(TARGET_CFLAGS)) define Host/Configure $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in