openwrt/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch
Robert Marko 2558e7b443 kernel: add Qualcomm NSS dataplane ethernet driver
Qualcomm NSS-DP is as its name says Qualcomms ethernet driver for the NSS
subsystem (Networking subsystem) built-into various Qualcomm SoCs.

It has 2 modes of operation:
* Without NSS FW and rest of code required for offloading

This is the one that we will use as the amount of kernel patching required
for NSS offloading and the fact that its not upstreamable at all makes it
unusable for us.

Driver in this mode is rather basic, it currently only offers NAPI GRO
(Added by us as part of the fixup) and basically relies on the powerfull
CPU to get good throughput.

* With NSS FW and rest of code required for offloading

In this mode, driver just registers the interfaces and hooks them into
NSS-ECM to allow offloading.
This mode is not viable for use in OpenWrt due to reasons already described
above.

This driver is required for ipq807x to have wired networking until a better
one is available, so lets add the fixed-up version for 5.15 for now.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-01-16 12:42:23 +01:00

64 lines
2.0 KiB
Diff

From ae4fe8fb79b68f4cf4a887434ab6a8a9a1c65bfc Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 23 Jun 2022 14:18:50 +0200
Subject: [PATCH] nss-dp: edma-v1: use NAPI GRO by default
Utilize napi_gro_receive instead of plain netif_receive_skb on EDMA v1.
Usually it provides quite a lot of RX speed improvements, however in some
cases it may lead to decreased performance as there is no checksum
offloading implemented.
In cases where reduced performance is experienced its possible to disable
GRO by using ethtool.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 10 ++++++----
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 8 ++++++--
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
index 1d748db..e81c461 100644
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -589,10 +589,12 @@ drop:
*/
static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc)
{
- /*
- * TODO - add flags to support HIGHMEM/cksum offload VLAN
- * the features are enabled.
- */
+ struct net_device *netdev = dpc->dev;
+
+ netdev->features |= NETIF_F_GRO;
+ netdev->hw_features |= NETIF_F_GRO;
+ netdev->vlan_features |= NETIF_F_GRO;
+ netdev->wanted_features |= NETIF_F_GRO;
}
/* TODO - check if this is needed */
diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
index 5780a30..a002a79 100644
--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edma_hw *ehw,
if (unlikely(EDMA_RXPH_SERVICE_CODE_GET(rxph) ==
NSS_PTP_EVENT_SERVICE_CODE))
nss_phy_tstamp_rx_buf(ndev, skb);
- else
- netif_receive_skb(skb);
+ else {
+ if (likely(ndev->features & NETIF_F_GRO))
+ napi_gro_receive(&ehw->napi, skb);
+ else
+ netif_receive_skb(skb);
+ }
next_rx_desc:
/*
--
2.38.1