5b88f11070804cf44ce5917c4544114451c15b45
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0211-bcmgenet-Better-coalescing-parameter-defaults.patch
1 From b3344ca9ef887c4004c61be39f7d8d058a569d4d Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 27 Mar 2019 13:45:46 +0000
4 Subject: [PATCH] bcmgenet: Better coalescing parameter defaults
5
6 Set defaults for TX and RX packet coalescing to be equivalent to:
7
8 # ethtool -C eth0 tx-frames 10
9 # ethtool -C eth0 rx-usecs 50
10
11 This may be something we want to set via DT parameters in the
12 future.
13
14 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
15 ---
16 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 7 +++++--
17 1 file changed, 5 insertions(+), 2 deletions(-)
18
19 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
20 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
21 @@ -2148,7 +2148,7 @@ static void bcmgenet_init_tx_ring(struct
22
23 bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX);
24 bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX);
25 - bcmgenet_tdma_ring_writel(priv, index, 1, DMA_MBUF_DONE_THRESH);
26 + bcmgenet_tdma_ring_writel(priv, index, 10, DMA_MBUF_DONE_THRESH);
27 /* Disable rate control for now */
28 bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
29 TDMA_FLOW_PERIOD);
30 @@ -3571,9 +3571,12 @@ static int bcmgenet_probe(struct platfor
31 netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
32
33 /* Set default coalescing parameters */
34 - for (i = 0; i < priv->hw_params->rx_queues; i++)
35 + for (i = 0; i < priv->hw_params->rx_queues; i++) {
36 priv->rx_rings[i].rx_max_coalesced_frames = 1;
37 + priv->rx_rings[i].rx_coalesce_usecs = 50;
38 + }
39 priv->rx_rings[DESC_INDEX].rx_max_coalesced_frames = 1;
40 + priv->rx_rings[DESC_INDEX].rx_coalesce_usecs = 50;
41
42 /* libphy will determine the link state */
43 netif_carrier_off(dev);