[][kernel][common][hnat][Refactor PPPQ to dispatch ACK packets to the high priority TXQ]
[Description]
Refactor PPPQ to dispatch ACK packets to the high priority TXQ.
Without this patch, the Linux-PC to Windows-PC case is unable to
reach line rate during the unbalanced PHY rate test.
[Release-log]
N/A
Change-Id: I2f5b36b71a6e6ae6247c9870821e13cc1fbab699
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8847396
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
index 34fc091..f909142 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
@@ -2805,7 +2805,7 @@
qos_toggle = 1;
} else if (buf[0] == '2') {
pr_info("Per-port-per-queue mode is going to be enabled!\n");
- pr_info("PPPQ use qid 0~5 (scheduler 0).\n");
+ pr_info("PPPQ use qid 0~11 (scheduler 0).\n");
qos_toggle = 2;
qos_dl_toggle = 1;
qos_ul_toggle = 1;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 5a428e1..579ef9a 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -1223,6 +1223,7 @@
int udp = 0;
u32 qid = 0;
u32 port_id = 0;
+ u32 payload_len = 0;
int mape = 0;
struct mtk_mac *mac = netdev_priv(dev);
@@ -1759,6 +1760,29 @@
else
qid = 0;
+ if (IS_PPPQ_MODE && IS_PPPQ_PATH(dev, skb)) {
+ if (ntohs(eth->h_proto) == ETH_P_IP) {
+ iph = ip_hdr(skb);
+ if (iph->protocol == IPPROTO_TCP) {
+ skb_set_transport_header(skb, sizeof(struct iphdr));
+ payload_len = be16_to_cpu(iph->tot_len) -
+ skb_transport_offset(skb) - tcp_hdrlen(skb);
+ /* Dispatch ACK packets to high priority queue */
+ if (payload_len == 0)
+ qid += 6;
+ }
+ } else if (ntohs(eth->h_proto) == ETH_P_IPV6) {
+ ip6h = ipv6_hdr(skb);
+ if (ip6h->nexthdr == NEXTHDR_TCP) {
+ skb_set_transport_header(skb, sizeof(struct ipv6hdr));
+ payload_len = be16_to_cpu(ip6h->payload_len) - tcp_hdrlen(skb);
+ /* Dispatch ACK packets to high priority queue */
+ if (payload_len == 0)
+ qid += 6;
+ }
+ }
+ }
+
if (IS_IPV4_GRP(foe)) {
entry.ipv4_hnapt.iblk2.dp = gmac;
entry.ipv4_hnapt.iblk2.port_mg =