linux.port: add usb_net_cdc_ncm.patch

NCM tries to batch TX packets using timeouts (500us) and does not send packets
before 3 packets are in the submit queue. Timeouts take milliseconds on
dde_linux which leads to delayed ACKs and poor performance for the RX case.
Therefore, we send small packets (<100 Bytes) immediately without batching (it
might be an ACK or last packet of a larger transfer).

issue #4958
This commit is contained in:
Sebastian Sumpf 2023-08-18 19:32:16 +02:00 committed by Christian Helmuth
parent 5c1b9399b0
commit 9f8ccc030b
3 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,25 @@
NCM tries to batch TX packets using timeouts (500us) and does not send packets
before 3 packets are in the submit queue. Timeouts take milliseconds on
dde_linux which leads to delayed ACKs and poor performance for the RX case.
Therefore, we send small packets (<100 Bytes) immediately without batching (it
might be an ACK or last packet of a larger transfer).
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 0897fdb..4dd6047 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1354,6 +1354,14 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
}
skb_put_data(skb_out, skb->data, skb->len);
ctx->tx_curr_frame_payload += skb->len; /* count real tx payload data */
+
+ /*
+ * send small packets immediately (e.g., TCP ACKS), just batch with large
+ * payloads
+ */
+ if (skb->len < 100)
+ ready2send = 1;
+
dev_kfree_skb_any(skb);
skb = NULL;

View File

@ -1 +1 @@
00e8b314800d990be43b16cec7eebc5418245fc2
e6eaabb8e0a8e3f3357229f65ec69ad213019034

View File

@ -13,9 +13,11 @@ PATCH_FILES := i915_irq.patch \
iwlwifi_enable_irq_before_pnvm.patch \
iwlwifi_limit_rx_bufs.patch \
usb_net_pinephone.patch \
usb_net_cdc_ncm.patch \
workqueue_deadlock.patch
PATCHES += $(addprefix patches/,$(PATCH_FILES))
PATCH_OPT(patches/i915_irq.patch) := -p1 -d${DIR(linux)}
PATCH_OPT(patches/usb_net_pinephone.patch) := -p1 -d${DIR(linux)}
PATCH_OPT(patches/usb_net_cdc_ncm.patch) := -p1 -d${DIR(linux)}
PATCH_OPT(patches/workqueue_deadlock.patch) := -p1 -d${DIR(linux)}