summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiago De Franco <hiago.franco@toradex.com>2023-12-19 13:32:17 -0300
committerMax Krummenacher <max.krummenacher@toradex.com>2024-01-21 13:36:36 +0100
commit940907a1ce6f7fb3f53fde83885f8ad06c2c24fa (patch)
tree2ba8d565cd471adfa5a8c48fe73c44645db5fe92
parentfa8aab8528cd119d318c53b19148ab4397833c92 (diff)
linux-toradex-mainline: Add patch for f_ncm.c
This patch addresses an issue related to NCM and the transmission of small packets, as when using VNC, for example. The ongoing discussion about this problem can be checked on the Linux kernel mailing list at [1]. Until the matter is resolved in the mainline, we should keep this patch here as it has demonstrated it solves the issue for now. Future updates can be made once the mainline fix is implemented. [1] https://lore.kernel.org/all/20231204183751.64202-1-hiagofranco@gmail.com/ Related-to: TEI-1078 Signed-off-by: Hiago De Franco <hiago.franco@toradex.com> Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com> (cherry picked from commit 856736e6c4c8844d5a89a02a9a8fb3794a13587e) Conflicts: recipes-kernel/linux/linux-toradex-mainline_git.bb recipes-kernel/linux/linux-toradex-upstream/0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream/0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch68
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream_mainline.bb3
2 files changed, 70 insertions, 1 deletions
diff --git a/recipes-kernel/linux/linux-toradex-upstream/0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch b/recipes-kernel/linux/linux-toradex-upstream/0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch
new file mode 100644
index 0000000..dfdd723
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream/0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch
@@ -0,0 +1,68 @@
+From 2147c8ddfaa746cdb8857db070f907fa9abfcb60 Mon Sep 17 00:00:00 2001
+From: Hiago De Franco <hiago.franco@toradex.com>
+Date: Tue, 19 Dec 2023 11:52:07 -0300
+Subject: [PATCH] usb: gadget: f_ncm: Apply workaround for packet clogging
+
+The existing size of 32 is causing significant slowness and freezing when
+utilizing the NCM protocol with a VNC client. This issue likely arises
+because the VNC protocol relies on sending numerous small packets, which
+accumulate until the 16KB limit is reached, leading to transmission
+delays.
+
+By decreasing TX_MAX_NUM_DPE to 4, we ensure that the NCM driver transmits
+packets at a reduced interval, thereby resolving the VNC performance
+issues. To comprehend how these packets are sent, refer to the code
+snippet below from f_ncm.c:
+
+```
+ /* If the new skb is too big for the current NCM NTB then
+ * set the current stored skb to be sent now and clear it
+ * ready for new data.
+ * NOTE: Assume maximum align for speed of calculation.
+ */
+ if (ncm->skb_tx_data
+ && (ncm->ndp_dgram_count >= TX_MAX_NUM_DPE
+ || (ncm->skb_tx_data->len +
+ div + rem + skb->len +
+ ncm->skb_tx_ndp->len + ndp_align + (2 * dgram_idx_len))
+ > max_size)) {
+ skb2 = package_for_tx(ncm);
+ if (!skb2)
+ goto err;
+ }
+```
+
+This issue is presently under investigation on the Linux kernel mailing
+list, and you can find the entire discussion at [1].
+
+[1] https://lore.kernel.org/all/20231204183751.64202-1-hiagofranco@gmail.com/
+
+Upstream-Status: Inappropriate [other]
+
+There is no proper patch for now, so instead we're using this patch that
+makes VNC work again as a temporarily solution until the mainline code
+gets fixed.
+
+Related-to: TEI-1078
+Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
+Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
+---
+ drivers/usb/gadget/function/f_ncm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
+index e0c183234283..5e972d1c1a0c 100644
+--- a/drivers/usb/gadget/function/f_ncm.c
++++ b/drivers/usb/gadget/function/f_ncm.c
+@@ -113,7 +113,7 @@ static inline unsigned ncm_bitrate(struct usb_gadget *g)
+ * Smaller packets are not likely to be trying to maximize the
+ * throughput and will be mstly sending smaller infrequent frames.
+ */
+-#define TX_MAX_NUM_DPE 32
++#define TX_MAX_NUM_DPE 4
+
+ /* Delay for the transmit to wait before sending an unfilled NTB frame. */
+ #define TX_TIMEOUT_NSECS 300000
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream_mainline.bb b/recipes-kernel/linux/linux-toradex-upstream_mainline.bb
index 6a962ed..5212cac 100644
--- a/recipes-kernel/linux/linux-toradex-upstream_mainline.bb
+++ b/recipes-kernel/linux/linux-toradex-upstream_mainline.bb
@@ -11,9 +11,10 @@ TDX_PATCHES = " \
file://0002-Revert-drm-panel-simple-drop-use-of-data-mapping-pro.patch \
file://0003-drivers-chipidea-disable-runtime-pm-for-imx6ul.patch \
file://0004-media-i2c-ov5640-Implement-get_mbus_config.patch \
+ file://0001-usb-gadget-f_ncm-Apply-workaround-for-packet-cloggin.patch \
"
# set PV manually, that way PREFERRED_VERSION can be set to a constant value
PV = "mainline"
-LINUX_VERSION = "6.6-rc"
+LINUX_VERSION = "6.8-rc"
KBRANCH = "master"
SRCREV_machine = "${AUTOREV}"