summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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}"