mbox series

[net,0/3] net: ethernet: ti: am65-cpsw: Fix XDP implementation

Message ID 20240829-am65-cpsw-xdp-v1-0-ff3c81054a5e@kernel.org (mailing list archive)
Headers show
Series net: ethernet: ti: am65-cpsw: Fix XDP implementation | expand

Message

Roger Quadros Aug. 29, 2024, 12:03 p.m. UTC
The XDP implementation on am65-cpsw driver is broken in many ways
and this series fixes it.

Below are the current issues that are being fixed:

1)  The following XDP_DROP test from [1] stalls the interface after
    250 packets.
    ~# xdb-bench drop -m native eth0
    This is because new RX requests are never queued. Fix that.

2)  The below XDP_TX test from [1] fails with a warning
    [  499.947381] XDP_WARN: xdp_update_frame_from_buff(line:277): Driver BUG: missing reserved tailroom
    ~# xdb-bench tx -m native eth0
    Fix that by using PAGE_SIZE during xdp_init_buf().

3)  In XDP_REDIRECT case only 1 packet was processed in rx_poll.
    Fix it to process up to budget packets.
    ~# ./xdp-bench redirect -m native eth0 eth0

4)  If number of TX queues are set to 1 we get a NULL pointer
    dereference during XDP_TX.
    ~# ethtool -L eth0 tx 1
    ~# ./xdp-trafficgen udp -A <ipv6-src> -a <ipv6-dst> eth0 -t 2
    Transmitting on eth0 (ifindex 2)
    [  241.135257] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030

5)  Net statistics is broken for XDP_TX and XDP_REDIRECT

[1] xdp-tools suite https://github.com/xdp-project/xdp-tools

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Roger Quadros (3):
      net: ethernet: ti: am65-cpsw: fix XDP_DROP, XDP_TX and XDP_REDIRECT
      net: ethernet: ti: am65-cpsw: Fix NULL dereference on XDP_TX
      net: ethernet: ti: am65-cpsw: Fix RX statistics for XDP_TX and XDP_REDIRECT

 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 82 +++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 33 deletions(-)
---
base-commit: 5be63fc19fcaa4c236b307420483578a56986a37
change-id: 20240829-am65-cpsw-xdp-d5876b25335c

Best regards,

Comments

Jacob Keller Aug. 29, 2024, 8:15 p.m. UTC | #1
On 8/29/2024 5:03 AM, Roger Quadros wrote:
> The XDP implementation on am65-cpsw driver is broken in many ways
> and this series fixes it.
> 
> Below are the current issues that are being fixed:
> 
> 1)  The following XDP_DROP test from [1] stalls the interface after
>     250 packets.
>     ~# xdb-bench drop -m native eth0
>     This is because new RX requests are never queued. Fix that.
> 
> 2)  The below XDP_TX test from [1] fails with a warning
>     [  499.947381] XDP_WARN: xdp_update_frame_from_buff(line:277): Driver BUG: missing reserved tailroom
>     ~# xdb-bench tx -m native eth0
>     Fix that by using PAGE_SIZE during xdp_init_buf().
> 
> 3)  In XDP_REDIRECT case only 1 packet was processed in rx_poll.
>     Fix it to process up to budget packets.
>     ~# ./xdp-bench redirect -m native eth0 eth0
> 
> 4)  If number of TX queues are set to 1 we get a NULL pointer
>     dereference during XDP_TX.
>     ~# ethtool -L eth0 tx 1
>     ~# ./xdp-trafficgen udp -A <ipv6-src> -a <ipv6-dst> eth0 -t 2
>     Transmitting on eth0 (ifindex 2)
>     [  241.135257] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
> 
> 5)  Net statistics is broken for XDP_TX and XDP_REDIRECT
> 
> [1] xdp-tools suite https://github.com/xdp-project/xdp-tools
> 

Everything in this series looks good to me.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Julien Panis Aug. 30, 2024, 7:36 a.m. UTC | #2
On 8/29/24 14:03, Roger Quadros wrote:
> The XDP implementation on am65-cpsw driver is broken in many ways
> and this series fixes it.
>
> Below are the current issues that are being fixed:
>
> 1)  The following XDP_DROP test from [1] stalls the interface after
>      250 packets.
>      ~# xdb-bench drop -m native eth0
>      This is because new RX requests are never queued. Fix that.
>
> 2)  The below XDP_TX test from [1] fails with a warning
>      [  499.947381] XDP_WARN: xdp_update_frame_from_buff(line:277): Driver BUG: missing reserved tailroom
>      ~# xdb-bench tx -m native eth0
>      Fix that by using PAGE_SIZE during xdp_init_buf().
>
> 3)  In XDP_REDIRECT case only 1 packet was processed in rx_poll.
>      Fix it to process up to budget packets.
>      ~# ./xdp-bench redirect -m native eth0 eth0
>
> 4)  If number of TX queues are set to 1 we get a NULL pointer
>      dereference during XDP_TX.
>      ~# ethtool -L eth0 tx 1
>      ~# ./xdp-trafficgen udp -A <ipv6-src> -a <ipv6-dst> eth0 -t 2
>      Transmitting on eth0 (ifindex 2)
>      [  241.135257] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
>
> 5)  Net statistics is broken for XDP_TX and XDP_REDIRECT
>
> [1] xdp-tools suite https://github.com/xdp-project/xdp-tools
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
> Roger Quadros (3):
>        net: ethernet: ti: am65-cpsw: fix XDP_DROP, XDP_TX and XDP_REDIRECT
>        net: ethernet: ti: am65-cpsw: Fix NULL dereference on XDP_TX
>        net: ethernet: ti: am65-cpsw: Fix RX statistics for XDP_TX and XDP_REDIRECT
>
>   drivers/net/ethernet/ti/am65-cpsw-nuss.c | 82 +++++++++++++++++++-------------
>   1 file changed, 49 insertions(+), 33 deletions(-)
> ---
> base-commit: 5be63fc19fcaa4c236b307420483578a56986a37
> change-id: 20240829-am65-cpsw-xdp-d5876b25335c
>
> Best regards,

Thank you for the fixes Roger.

Acked-by: Julien Panis <jpanis@baylibre.com>
MD Danish Anwar Aug. 30, 2024, 10:10 a.m. UTC | #3
On 29/08/24 5:33 pm, Roger Quadros wrote:
> The XDP implementation on am65-cpsw driver is broken in many ways
> and this series fixes it.
> 
> Below are the current issues that are being fixed:
> 
> 1)  The following XDP_DROP test from [1] stalls the interface after
>     250 packets.
>     ~# xdb-bench drop -m native eth0
>     This is because new RX requests are never queued. Fix that.
> 
> 2)  The below XDP_TX test from [1] fails with a warning
>     [  499.947381] XDP_WARN: xdp_update_frame_from_buff(line:277): Driver BUG: missing reserved tailroom
>     ~# xdb-bench tx -m native eth0
>     Fix that by using PAGE_SIZE during xdp_init_buf().
> 
> 3)  In XDP_REDIRECT case only 1 packet was processed in rx_poll.
>     Fix it to process up to budget packets.
>     ~# ./xdp-bench redirect -m native eth0 eth0
> 
> 4)  If number of TX queues are set to 1 we get a NULL pointer
>     dereference during XDP_TX.
>     ~# ethtool -L eth0 tx 1
>     ~# ./xdp-trafficgen udp -A <ipv6-src> -a <ipv6-dst> eth0 -t 2
>     Transmitting on eth0 (ifindex 2)
>     [  241.135257] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
> 
> 5)  Net statistics is broken for XDP_TX and XDP_REDIRECT
> 
> [1] xdp-tools suite https://github.com/xdp-project/xdp-tools
> 
> Signed-off-by: Roger Quadros <rogerq@kernel.org>

This series looks good to me.

Reviewed-by: MD Danish Anwar <danishanwar@ti.com>
patchwork-bot+netdevbpf@kernel.org Sept. 3, 2024, 9 a.m. UTC | #4
Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Thu, 29 Aug 2024 15:03:18 +0300 you wrote:
> The XDP implementation on am65-cpsw driver is broken in many ways
> and this series fixes it.
> 
> Below are the current issues that are being fixed:
> 
> 1)  The following XDP_DROP test from [1] stalls the interface after
>     250 packets.
>     ~# xdb-bench drop -m native eth0
>     This is because new RX requests are never queued. Fix that.
> 
> [...]

Here is the summary with links:
  - [net,1/3] net: ethernet: ti: am65-cpsw: fix XDP_DROP, XDP_TX and XDP_REDIRECT
    https://git.kernel.org/netdev/net/c/5e24db550bd6
  - [net,2/3] net: ethernet: ti: am65-cpsw: Fix NULL dereference on XDP_TX
    https://git.kernel.org/netdev/net/c/0a50c35277f9
  - [net,3/3] net: ethernet: ti: am65-cpsw: Fix RX statistics for XDP_TX and XDP_REDIRECT
    https://git.kernel.org/netdev/net/c/624d3291484f

You are awesome, thank you!