1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-14 11:13:53 +02:00
openwrt/target/linux/layerscape/patches-5.4/701-net-0292-staging-fsl_ppfe-eth-Avoid-packet-drop-at-TMU-queues.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

88 lines
2.9 KiB
Diff

From 8b99b4595d2b5f4d0b2252b16de83572e03b337a Mon Sep 17 00:00:00 2001
From: Kavi Akhila-B46177 <akhila.kavi@nxp.com>
Date: Thu, 2 Nov 2017 12:05:35 +0530
Subject: [PATCH] staging: fsl_ppfe/eth: Avoid packet drop at TMU queues
Added flow control between TMU queues and PFE Linux driver,
based on TMU credits availability.
Added tx_qos module parameter to control this behavior.
Use queue-0 as default queue to transmit packets.
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Akhila Kavi <akhila.kavi@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
---
drivers/staging/fsl_ppfe/pfe_eth.c | 17 +++++++++++++----
drivers/staging/fsl_ppfe/pfe_hif_lib.c | 7 +++++--
2 files changed, 18 insertions(+), 6 deletions(-)
--- a/drivers/staging/fsl_ppfe/pfe_eth.c
+++ b/drivers/staging/fsl_ppfe/pfe_eth.c
@@ -293,10 +293,10 @@ static int pfe_eth_sysfs_init(struct net
/* Initialize the default values */
/*
- * By default, packets without conntrack will use this default high
+ * By default, packets without conntrack will use this default low
* priority queue
*/
- priv->default_priority = 15;
+ priv->default_priority = 0;
/* Create our sysfs files */
err = device_create_file(&ndev->dev, &dev_attr_default_priority);
@@ -1566,10 +1566,17 @@ static int pfe_eth_might_stop_tx(struct
unsigned int n_segs)
{
ktime_t kt;
+ int tried = 0;
+try_again:
if (unlikely((__hif_tx_avail(&pfe->hif) < n_desc) ||
- (hif_lib_tx_avail(&priv->client, queuenum) < n_desc) ||
+ (hif_lib_tx_avail(&priv->client, queuenum) < n_desc) ||
(hif_lib_tx_credit_avail(pfe, priv->id, queuenum) < n_segs))) {
+ if (!tried) {
+ __hif_lib_update_credit(&priv->client, queuenum);
+ tried = 1;
+ goto try_again;
+ }
#ifdef PFE_ETH_TX_STATS
if (__hif_tx_avail(&pfe->hif) < n_desc) {
priv->stop_queue_hif[queuenum]++;
@@ -1692,8 +1699,10 @@ static void pfe_eth_flush_tx(struct pfe_
netif_info(priv, tx_done, priv->ndev, "%s\n", __func__);
- for (ii = 0; ii < emac_txq_cnt; ii++)
+ for (ii = 0; ii < emac_txq_cnt; ii++) {
pfe_eth_flush_txQ(priv, ii, 0, 0);
+ __hif_lib_update_credit(&priv->client, ii);
+ }
}
void pfe_tx_get_req_desc(struct sk_buff *skb, unsigned int *n_desc, unsigned int
--- a/drivers/staging/fsl_ppfe/pfe_hif_lib.c
+++ b/drivers/staging/fsl_ppfe/pfe_hif_lib.c
@@ -34,7 +34,10 @@
unsigned int lro_mode;
unsigned int page_mode;
-unsigned int tx_qos;
+unsigned int tx_qos = 1;
+module_param(tx_qos, uint, 0444);
+MODULE_PARM_DESC(tx_qos, "0: disable ,\n"
+ "1: enable (default), guarantee no packet drop at TMU level\n");
unsigned int pfe_pkt_size;
unsigned int pfe_pkt_headroom;
unsigned int emac_txq_cnt;
@@ -576,7 +579,7 @@ void __hif_lib_update_credit(struct hif_
if (tx_qos) {
tmu_tx_packets = be32_to_cpu(pe_dmem_read(TMU0_ID +
- client->id, TMU_DM_TX_TRANS, 4));
+ client->id, (TMU_DM_TX_TRANS + (queue * 4)), 4));
/* tx_packets counter overflowed */
if (tmu_tx_packets >