From bbe99b4fdfa4d2db536ff84bf8b1b6785dfbdb4a Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 27 May 2020 11:58:24 +0800 Subject: [PATCH] mac80211:update ath10k upstream patches --- ...h10k-increase-rx-buffer-size-to-2048.patch | 37 ++++++++++++++ ...0-0010-ath10k-limit-htt-rx-ring-size.patch | 11 +++++ ...60-0011-ath10k-limit-pci-buffer-size.patch | 38 ++++++++++++++ .../090-wolfssl-fix-crypto_bignum_sum.patch | 26 ++++++++++ ...iler-warnings-on-size_t-printf-forma.patch | 31 ++++++++++++ ...ix-crypto_bignum_rand-implementation.patch | 49 +++++++++++++++++++ ...ardcode-include-directory-in-wpa_sup.patch | 26 ++++++++++ 7 files changed, 218 insertions(+) create mode 100644 package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch create mode 100644 package/kernel/mac80211/patches/ath/960-0010-ath10k-limit-htt-rx-ring-size.patch create mode 100644 package/kernel/mac80211/patches/ath/960-0011-ath10k-limit-pci-buffer-size.patch create mode 100644 package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch create mode 100644 package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch create mode 100644 package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch create mode 100644 package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch diff --git a/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch new file mode 100644 index 000000000..f7c842f42 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch @@ -0,0 +1,37 @@ +From: Linus Lüssing +Date: Wed, 5 Feb 2020 20:10:43 +0100 +Subject: ath10k: increase rx buffer size to 2048 + +Before, only frames with a maximum size of 1528 bytes could be +transmitted between two 802.11s nodes. + +For batman-adv for instance, which adds its own header to each frame, +we typically need an MTU of at least 1532 bytes to be able to transmit +without fragmentation. + +This patch now increases the maxmimum frame size from 1528 to 1656 +bytes. + +Tested with two ath10k devices in 802.11s mode, as well as with +batman-adv on top of 802.11s with forwarding disabled. + +Fix originally found and developed by Ben Greear. + +Link: https://github.com/greearb/ath10k-ct/issues/89 +Link: https://github.com/greearb/ath10k-ct/commit/9e5ab25027e0971fa24ccf93373324c08c4e992d +Cc: Ben Greear +Signed-off-by: Linus Lüssing + +Forwarded: https://patchwork.kernel.org/patch/11367055/ + +--- a/drivers/net/wireless/ath/ath10k/htt.h ++++ b/drivers/net/wireless/ath/ath10k/htt.h +@@ -2004,7 +2004,7 @@ struct htt_rx_desc { + * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, + * rounded up to a cache line size. + */ +-#define HTT_RX_BUF_SIZE 1920 ++#define HTT_RX_BUF_SIZE 2048 + #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) + + /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle diff --git a/package/kernel/mac80211/patches/ath/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/mac80211/patches/ath/960-0010-ath10k-limit-htt-rx-ring-size.patch new file mode 100644 index 000000000..810e97a78 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/wireless/ath/ath10k/htt.h ++++ b/drivers/net/wireless/ath/ath10k/htt.h +@@ -238,7 +238,7 @@ enum htt_rx_ring_flags { + }; + + #define HTT_RX_RING_SIZE_MIN 128 +-#define HTT_RX_RING_SIZE_MAX 2048 ++#define HTT_RX_RING_SIZE_MAX 512 + #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX + #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1) + #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1) diff --git a/package/kernel/mac80211/patches/ath/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/mac80211/patches/ath/960-0011-ath10k-limit-pci-buffer-size.patch new file mode 100644 index 000000000..283f4d819 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/960-0011-ath10k-limit-pci-buffer-size.patch @@ -0,0 +1,38 @@ +--- a/drivers/net/wireless/ath/ath10k/pci.c ++++ b/drivers/net/wireless/ath/ath10k/pci.c +@@ -142,7 +142,7 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, +- .dest_nentries = 512, ++ .dest_nentries = 128, + .recv_cb = ath10k_pci_htt_htc_rx_cb, + }, + +@@ -151,7 +151,7 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, +- .dest_nentries = 128, ++ .dest_nentries = 64, + .recv_cb = ath10k_pci_htc_rx_cb, + }, + +@@ -178,7 +178,7 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 512, +- .dest_nentries = 512, ++ .dest_nentries = 128, + .recv_cb = ath10k_pci_htt_rx_cb, + }, + +@@ -203,7 +203,7 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, +- .dest_nentries = 128, ++ .dest_nentries = 96, + .recv_cb = ath10k_pci_pktlog_rx_cb, + }, + diff --git a/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch b/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch new file mode 100644 index 000000000..7cc0dec3f --- /dev/null +++ b/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch @@ -0,0 +1,26 @@ +From 1766e608ba1114220f3b3598e77aa53b50c38a6e Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Mon, 14 Oct 2019 19:27:47 +0300 +Subject: [PATCH] wolfSSL: Fix crypto_bignum_sub() + +The initial crypto wrapper implementation for wolfSSL seems to have +included a copy-paste error in crypto_bignum_sub() implementation that +was identical to crypto_bignum_add() while mp_sub() should have been +used instead of mp_add(). + +Signed-off-by: Jouni Malinen +--- + src/crypto/crypto_wolfssl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/crypto/crypto_wolfssl.c ++++ b/src/crypto/crypto_wolfssl.c +@@ -1151,7 +1151,7 @@ int crypto_bignum_sub(const struct crypt + if (TEST_FAIL()) + return -1; + +- return mp_add((mp_int *) a, (mp_int *) b, ++ return mp_sub((mp_int *) a, (mp_int *) b, + (mp_int *) r) == MP_OKAY ? 0 : -1; + } + diff --git a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch new file mode 100644 index 000000000..464bcff0b --- /dev/null +++ b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch @@ -0,0 +1,31 @@ +From 6a28c4dbc102de3fed9db44637f47a10e7adfb78 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:01:51 +0300 +Subject: [PATCH 1/3] wolfssl: Fix compiler warnings on size_t printf format + use + +Signed-off-by: Jouni Malinen +--- + src/crypto/tls_wolfssl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/crypto/tls_wolfssl.c ++++ b/src/crypto/tls_wolfssl.c +@@ -1741,7 +1741,7 @@ struct wpabuf * tls_connection_encrypt(v + if (!conn) + return NULL; + +- wpa_printf(MSG_DEBUG, "SSL: encrypt: %ld bytes", wpabuf_len(in_data)); ++ wpa_printf(MSG_DEBUG, "SSL: encrypt: %zu bytes", wpabuf_len(in_data)); + + wolfssl_reset_out_data(&conn->output); + +@@ -1792,7 +1792,7 @@ struct wpabuf * tls_connection_decrypt(v + } + wpabuf_put(buf, res); + +- wpa_printf(MSG_DEBUG, "SSL: decrypt: %ld bytes", wpabuf_len(buf)); ++ wpa_printf(MSG_DEBUG, "SSL: decrypt: %zu bytes", wpabuf_len(buf)); + + return buf; + } diff --git a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch new file mode 100644 index 000000000..2464b6348 --- /dev/null +++ b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch @@ -0,0 +1,49 @@ +From eb595b3e3ab531645a5bde71cf6385335b7a4b95 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:02:17 +0300 +Subject: [PATCH 2/3] wolfssl: Fix crypto_bignum_rand() implementation + +The previous implementation used mp_rand_prime() to generate a random +value in range 0..m. That is insanely slow way of generating a random +value since mp_rand_prime() is for generating a random _prime_ which is +not what is needed here. Replace that implementation with generationg of +a random value in the requested range without doing any kind of prime +number checks or loops to reject values that are not primes. + +This speeds up SAE and EAP-pwd routines by couple of orders of +magnitude.. + +Signed-off-by: Jouni Malinen +--- + src/crypto/crypto_wolfssl.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/src/crypto/crypto_wolfssl.c ++++ b/src/crypto/crypto_wolfssl.c +@@ -1084,19 +1084,21 @@ int crypto_bignum_rand(struct crypto_big + { + int ret = 0; + WC_RNG rng; ++ size_t len; ++ u8 *buf; + + if (TEST_FAIL()) + return -1; + if (wc_InitRng(&rng) != 0) + return -1; +- if (mp_rand_prime((mp_int *) r, +- (mp_count_bits((mp_int *) m) + 7) / 8 * 2, +- &rng, NULL) != 0) +- ret = -1; +- if (ret == 0 && ++ len = (mp_count_bits((mp_int *) m) + 7) / 8; ++ buf = os_malloc(len); ++ if (!buf || wc_RNG_GenerateBlock(&rng, buf, len) != 0 || ++ mp_read_unsigned_bin((mp_int *) r, buf, len) != MP_OKAY || + mp_mod((mp_int *) r, (mp_int *) m, (mp_int *) r) != 0) + ret = -1; + wc_FreeRng(&rng); ++ bin_clear_free(buf, len); + return ret; + } + diff --git a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch new file mode 100644 index 000000000..b15dccd7d --- /dev/null +++ b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch @@ -0,0 +1,26 @@ +From 79488da576aeeb9400e1742fab7f463eed0fa7a1 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:07:45 +0300 +Subject: [PATCH 3/3] wolfssl: Do not hardcode include directory in + wpa_supplicant build + +This is not really appropriate for any kind of cross compilations and is +not really needed in general since system specific values can be set in +.config. + +Signed-off-by: Jouni Malinen +--- + wpa_supplicant/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1086,7 +1086,7 @@ endif + + ifeq ($(CONFIG_TLS), wolfssl) + ifdef TLS_FUNCS +-CFLAGS += -DWOLFSSL_DER_LOAD -I/usr/local/include/wolfssl ++CFLAGS += -DWOLFSSL_DER_LOAD + OBJS += ../src/crypto/tls_wolfssl.o + endif + OBJS += ../src/crypto/crypto_wolfssl.o -- GitLab