From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:45
Reading the DMA registers immediately after the reset causes
Data Bus Error. Adding a small delay fixes this issue.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
arch/mips/lantiq/xway/dma.c | 3 +++
1 file changed, 3 insertions(+)
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:22
Different SoCs have a different number of channels, e.g .:
* amazon-se has 10 channels,
* danube+ar9 have 20 channels,
* vr9 has 28 channels,
* ar10 has 24 channels.
We can read the ID register and, depending on the reported
number of channels, reset the appropriate number of channels.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
arch/mips/lantiq/xway/dma.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:28
The current definition of 2W burst length is invalid.
This patch fixes it. Current downstream DEU driver doesn't
use DMA. An incorrect burst length value doesn't cause any
errors. This patch also adds other burst length values.
Fixes: dfec1a827d2b ("MIPS: Lantiq: Add DMA support")
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
arch/mips/lantiq/xway/dma.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:33
Configure the burst length in Ethernet drivers. This improves
Ethernet performance by 58%. According to the vendor BSP,
8W burst length is supported by ar9 and newer SoCs.
The NAT benchmark results on xRX200 (Down/Up):
* 2W: 330 Mb/s
* 4W: 432 Mb/s 372 Mb/s
* 8W: 520 Mb/s 389 Mb/s
Tested on xRX200 and xRX330.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++---
drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++---
2 files changed, 36 insertions(+), 6 deletions(-)
@@ -472,8 +475,8 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)returnNETDEV_TX_BUSY;}-/* dma needs to start on a 16 byte aligned address */-byte_offset=CPHYSADDR(skb->data)%16;+/* dma needs to start on a burst length value aligned address */+byte_offset=CPHYSADDR(skb->data)%(priv->tx_burst_len*4);ch->skb[ch->dma.desc]=skb;netif_trans_update(dev);
@@ -667,6 +670,18 @@ ltq_etop_probe(struct platform_device *pdev)spin_lock_init(&priv->lock);SET_NETDEV_DEV(dev,&pdev->dev);+err=device_property_read_u32(&pdev->dev,"lantiq,tx-burst-length",&priv->tx_burst_len);+if(err<0){+dev_err(&pdev->dev,"unable to read tx-burst-length property\n");+returnerr;+}++err=device_property_read_u32(&pdev->dev,"lantiq,rx-burst-length",&priv->rx_burst_len);+if(err<0){+dev_err(&pdev->dev,"unable to read rx-burst-length property\n");+returnerr;+}+for(i=0;i<MAX_DMA_CHAN;i++){if(IS_TX(i))netif_napi_add(dev,&priv->ch[i].napi,
@@ -316,8 +319,8 @@ static netdev_tx_t xrx200_start_xmit(struct sk_buff *skb,if(unlikely(dma_mapping_error(priv->dev,mapping)))gotoerr_drop;-/* dma needs to start on a 16 byte aligned address */-byte_offset=mapping%16;+/* dma needs to start on a burst length value aligned address */+byte_offset=mapping%(priv->tx_burst_len*4);desc->addr=mapping-byte_offset;/* Make sure the address is written before we give it to HW */
@@ -369,7 +372,7 @@ static int xrx200_dma_init(struct xrx200_priv *priv)intret=0;inti;-ltq_dma_init_port(DMA_PORT_ETOP);+ltq_dma_init_port(DMA_PORT_ETOP,priv->tx_burst_len,rx_burst_len);ch_rx->dma.nr=XRX200_DMA_RX;ch_rx->dma.dev=priv->dev;
@@ -478,6 +481,18 @@ static int xrx200_probe(struct platform_device *pdev)if(err)eth_hw_addr_random(net_dev);+err=device_property_read_u32(dev,"lantiq,tx-burst-length",&priv->tx_burst_len);+if(err<0){+dev_err(dev,"unable to read tx-burst-length property\n");+returnerr;+}++err=device_property_read_u32(dev,"lantiq,rx-burst-length",&priv->rx_burst_len);+if(err<0){+dev_err(dev,"unable to read rx-burst-length property\n");+returnerr;+}+/* bring up the dma engine and IP core */err=xrx200_dma_init(priv);if(err)
@@ -1,21 +0,0 @@-Lantiq xRX200 GSWIP PMAC Ethernet driver-==================================--Required properties:--- compatible : "lantiq,xrx200-net" for the PMAC of the embedded- : GSWIP in the xXR200-- reg : memory range of the PMAC core inside of the GSWIP core-- interrupts : TX and RX DMA interrupts. Use interrupt-names "tx" for- : the TX interrupt and "rx" for the RX interrupt.--Example:--ethernet@e10b308 {- #address-cells = <1>;- #size-cells = <0>;- compatible = "lantiq,xrx200-net";- reg = <0xe10b308 0xcf8>;- interrupts = <73>, <72>;- interrupt-names = "tx", "rx";-};
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:37
Document the Lantiq Xway SoC series External Bus Unit (ETOP) bindings.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
.../bindings/net/lantiq,etop-xway.yaml | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/lantiq,etop-xway.yaml
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:40
Make the burst length configurable by the drivers.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
.../include/asm/mach-lantiq/xway/xway_dma.h | 2 +-
arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++---
2 files changed, 34 insertions(+), 6 deletions(-)
From: Aleksander Jan Bajkowski <hidden> Date: 2021-09-14 21:21:42
The new added properties are used for configuring burst length.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
.../bindings/net/lantiq,etop-xway.yaml | 16 ++++++++++++++++
.../bindings/net/lantiq,xrx200-net.yaml | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
On 9/14/21 11:21 PM, Aleksander Jan Bajkowski wrote:
Configure the burst length in Ethernet drivers. This improves
Ethernet performance by 58%. According to the vendor BSP,
8W burst length is supported by ar9 and newer SoCs.
The NAT benchmark results on xRX200 (Down/Up):
* 2W: 330 Mb/s
* 4W: 432 Mb/s 372 Mb/s
* 8W: 520 Mb/s 389 Mb/s
Tested on xRX200 and xRX330.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++---
drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++---
2 files changed, 36 insertions(+), 6 deletions(-)
@@ -316,8 +319,8 @@ static netdev_tx_t xrx200_start_xmit(struct sk_buff *skb,if(unlikely(dma_mapping_error(priv->dev,mapping)))gotoerr_drop;-/* dma needs to start on a 16 byte aligned address */-byte_offset=mapping%16;+/* dma needs to start on a burst length value aligned address */+byte_offset=mapping%(priv->tx_burst_len*4);desc->addr=mapping-byte_offset;/* Make sure the address is written before we give it to HW */
@@ -369,7 +372,7 @@ static int xrx200_dma_init(struct xrx200_priv *priv)intret=0;inti;-ltq_dma_init_port(DMA_PORT_ETOP);+ltq_dma_init_port(DMA_PORT_ETOP,priv->tx_burst_len,rx_burst_len);ch_rx->dma.nr=XRX200_DMA_RX;ch_rx->dma.dev=priv->dev;
@@ -478,6 +481,18 @@ static int xrx200_probe(struct platform_device *pdev)if(err)eth_hw_addr_random(net_dev);+err=device_property_read_u32(dev,"lantiq,tx-burst-length",&priv->tx_burst_len);+if(err<0){+dev_err(dev,"unable to read tx-burst-length property\n");+returnerr;+}++err=device_property_read_u32(dev,"lantiq,rx-burst-length",&priv->rx_burst_len);+if(err<0){+dev_err(dev,"unable to read rx-burst-length property\n");+returnerr;+}+
I would prefer if you would hard code these values to 8 for the xrx200
driver. All SoCs with this IP block should support this.
/* bring up the dma engine and IP core */
err = xrx200_dma_init(priv);
if (err)
The DMA changes are looking good.
There is also a DMA API driver for this IP core now:
https://elixir.bootlin.com/linux/v5.15-rc1/source/drivers/dma/lgm/lgm-dma.c
I do not know if it works fully with these older MIPS SoCs.
Changing the drivers to use the standard DMA API is a bigger change,
which could be done later.
Hauke
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Tue, 14 Sep 2021 23:20:58 +0200 you wrote:
Reading the DMA registers immediately after the reset causes
Data Bus Error. Adding a small delay fixes this issue.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
arch/mips/lantiq/xway/dma.c | 3 +++
1 file changed, 3 insertions(+)
From: Aleksander Bajkowski <hidden> Date: 2021-09-19 18:16:09
Hi Hauke,
On 9/15/21 12:36 AM, Hauke Mehrtens wrote:
On 9/14/21 11:21 PM, Aleksander Jan Bajkowski wrote:
quoted
Configure the burst length in Ethernet drivers. This improves
Ethernet performance by 58%. According to the vendor BSP,
8W burst length is supported by ar9 and newer SoCs.
The NAT benchmark results on xRX200 (Down/Up):
* 2W: 330 Mb/s
* 4W: 432 Mb/s 372 Mb/s
* 8W: 520 Mb/s 389 Mb/s
Tested on xRX200 and xRX330.
Signed-off-by: Aleksander Jan Bajkowski <redacted>
---
drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++---
drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++---
2 files changed, 36 insertions(+), 6 deletions(-)
struct net_device *net_dev;
struct device *dev;
+ int tx_burst_len;
+ int rx_burst_len;
+
__iomem void *pmac_reg;
};
@@ -316,8 +319,8 @@ static netdev_tx_t xrx200_start_xmit(struct sk_buff *skb,
if (unlikely(dma_mapping_error(priv->dev, mapping)))
goto err_drop;
- /* dma needs to start on a 16 byte aligned address */
- byte_offset = mapping % 16;
+ /* dma needs to start on a burst length value aligned address */
+ byte_offset = mapping % (priv->tx_burst_len * 4);
desc->addr = mapping - byte_offset;
/* Make sure the address is written before we give it to HW */
@@ -369,7 +372,7 @@ static int xrx200_dma_init(struct xrx200_priv *priv)
int ret = 0;
int i;
- ltq_dma_init_port(DMA_PORT_ETOP);
+ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, rx_burst_len);
ch_rx->dma.nr = XRX200_DMA_RX;
ch_rx->dma.dev = priv->dev;
@@ -478,6 +481,18 @@ static int xrx200_probe(struct platform_device *pdev)
I would prefer if you would hard code these values to 8 for the xrx200 driver. All SoCs with this IP block should support this.
OK. I can hard code 8W burst length in the driver for xrx200. Burst length as a configurable parameter is really only needed in the lantiq_etop driver.
quoted
/* bring up the dma engine and IP core */
err = xrx200_dma_init(priv);
if (err)