mbox series

[RFC,0/3] net: ethernet: ti: cpsw: Add XDP support

Message ID 20190417174942.11811-1-ivan.khoronzhuk@linaro.org (mailing list archive)
Headers show
Series net: ethernet: ti: cpsw: Add XDP support | expand

Message

Ivan Khoronzhuk April 17, 2019, 5:49 p.m. UTC
This patchset is RFC adding XDP support for TI cpsw driver that is
based on page_pool allocator. It was verified with af_xdp sockets
and on xdp drop. For XDP redirect to another interface it's under
verification, still not sure about all cases that should be verified.
Also regular tests with iperf2 were done in order to verify impact on
regular netstack performance, compared with base commit from
net-next/master: 432bc230700f86801cffa5e159e05dea6229f722

It was verified with following configs enabled:
CONFIG_JIT=y
CONFIG_BPFILTER=y
CONFIG_BPF_SYSCALL=y
CONFIG_XDP_SOCKETS=y
CONFIG_BPF_EVENTS=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_BPF_JIT=y
CONFIG_CGROUP_BPF=y

iperf2 UDP RX summary (packet size / Mbps):
+--------------------------------------------------------------+
| pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
|---------------+------+------+------+------+------+-----+-----|
| base commit   | 561  | 470  | 796  |  35  | 70.1 | 281 | 140 |
|---------------+------+------+------+------+------+-----+-----|
| XDP patched   | 563  | 455  | 808  |  35  | 70.2 | 282 | 141 |
+--------------------------------------------------------------+

iperf2 UDP TX summary (packet size / Mbps):
+--------------------------------------------------------------+
| pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
|---------------+------+------+------+------+------+-----+-----|
| base commit   | 555  | 666  | 736  | 34.5 | 70.3 | 281 | 140 |
|---------------+------+------+------+------+------+-----+-----|
| XDP patched   | 558  | 696  | 759  | 35.2 | 69.2 | 279 | 140 |
+--------------------------------------------------------------+

iperf2 TCP summary (window size / Mbps):
+------------------------------------------------------------+
| window size/rate |  16  |  32  |  64  |  128 |  8   | 256  |
|------------------+------+------+------+------+------+------|
| base commit      | 753  | 887  | 931  | 932  | 676  | 932  |
|------------------+------+------+------+------+------+------|
| XDP patched      | 823  | 888  | 932  | 933  | 669  | 933  |
+------------------------------------------------------------+

For af_xdp socket type verification several generic changes should be added
that can be seen here (rough fixes, for samples related seems like last version
of samples is more integrated with libbpf api, so should be rebased,
witch I will send as RFC separately):
https://github.com/ikhorn/af_xdp_stuff/tree/af_xdp_armv7

Ivan Khoronzhuk (3):
  net: ethernet: ti: davinci_cpdma: add dma mapped submit
  net: ethernet: ti: davinci_cpdma: return handler status
  net: ethernet: ti: cpsw: add XDP support

 drivers/net/ethernet/ti/Kconfig         |   1 +
 drivers/net/ethernet/ti/cpsw.c          | 552 +++++++++++++++++++++---
 drivers/net/ethernet/ti/davinci_cpdma.c | 117 +++--
 drivers/net/ethernet/ti/davinci_cpdma.h |   6 +-
 drivers/net/ethernet/ti/davinci_emac.c  |  18 +-
 5 files changed, 591 insertions(+), 103 deletions(-)

Comments

Björn Töpel April 18, 2019, 6:12 a.m. UTC | #1
On Wed, 17 Apr 2019 at 19:51, Ivan Khoronzhuk
<ivan.khoronzhuk@linaro.org> wrote:
>
> This patchset is RFC adding XDP support for TI cpsw driver that is
> based on page_pool allocator. It was verified with af_xdp sockets
> and on xdp drop. For XDP redirect to another interface it's under
> verification, still not sure about all cases that should be verified.
> Also regular tests with iperf2 were done in order to verify impact on
> regular netstack performance, compared with base commit from
> net-next/master: 432bc230700f86801cffa5e159e05dea6229f722
>
> It was verified with following configs enabled:
> CONFIG_JIT=y
> CONFIG_BPFILTER=y
> CONFIG_BPF_SYSCALL=y
> CONFIG_XDP_SOCKETS=y
> CONFIG_BPF_EVENTS=y
> CONFIG_HAVE_EBPF_JIT=y
> CONFIG_BPF_JIT=y
> CONFIG_CGROUP_BPF=y
>
> iperf2 UDP RX summary (packet size / Mbps):
> +--------------------------------------------------------------+
> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
> |---------------+------+------+------+------+------+-----+-----|
> | base commit   | 561  | 470  | 796  |  35  | 70.1 | 281 | 140 |
> |---------------+------+------+------+------+------+-----+-----|
> | XDP patched   | 563  | 455  | 808  |  35  | 70.2 | 282 | 141 |
> +--------------------------------------------------------------+
>
> iperf2 UDP TX summary (packet size / Mbps):
> +--------------------------------------------------------------+
> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
> |---------------+------+------+------+------+------+-----+-----|
> | base commit   | 555  | 666  | 736  | 34.5 | 70.3 | 281 | 140 |
> |---------------+------+------+------+------+------+-----+-----|
> | XDP patched   | 558  | 696  | 759  | 35.2 | 69.2 | 279 | 140 |
> +--------------------------------------------------------------+
>
> iperf2 TCP summary (window size / Mbps):
> +------------------------------------------------------------+
> | window size/rate |  16  |  32  |  64  |  128 |  8   | 256  |
> |------------------+------+------+------+------+------+------|
> | base commit      | 753  | 887  | 931  | 932  | 676  | 932  |
> |------------------+------+------+------+------+------+------|
> | XDP patched      | 823  | 888  | 932  | 933  | 669  | 933  |
> +------------------------------------------------------------+
>
> For af_xdp socket type verification several generic changes should be added
> that can be seen here (rough fixes, for samples related seems like last version
> of samples is more integrated with libbpf api, so should be rebased,
> witch I will send as RFC separately):
> https://github.com/ikhorn/af_xdp_stuff/tree/af_xdp_armv7
>

More XDP support, yay!

As for mmap/AF_XDP on 32-bit systems; Instead of hacking the if_xdp.h,
mmap2 should be used. Have a look at the libbpf code here [1]


Björn

[1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/lib/bpf/xsk.c#n81


> Ivan Khoronzhuk (3):
>   net: ethernet: ti: davinci_cpdma: add dma mapped submit
>   net: ethernet: ti: davinci_cpdma: return handler status
>   net: ethernet: ti: cpsw: add XDP support
>
>  drivers/net/ethernet/ti/Kconfig         |   1 +
>  drivers/net/ethernet/ti/cpsw.c          | 552 +++++++++++++++++++++---
>  drivers/net/ethernet/ti/davinci_cpdma.c | 117 +++--
>  drivers/net/ethernet/ti/davinci_cpdma.h |   6 +-
>  drivers/net/ethernet/ti/davinci_emac.c  |  18 +-
>  5 files changed, 591 insertions(+), 103 deletions(-)
>
> --
> 2.17.1
>
Ivan Khoronzhuk April 18, 2019, 9:47 a.m. UTC | #2
On Thu, Apr 18, 2019 at 08:12:06AM +0200, Björn Töpel wrote:
>On Wed, 17 Apr 2019 at 19:51, Ivan Khoronzhuk
><ivan.khoronzhuk@linaro.org> wrote:
>>
>> This patchset is RFC adding XDP support for TI cpsw driver that is
>> based on page_pool allocator. It was verified with af_xdp sockets
>> and on xdp drop. For XDP redirect to another interface it's under
>> verification, still not sure about all cases that should be verified.
>> Also regular tests with iperf2 were done in order to verify impact on
>> regular netstack performance, compared with base commit from
>> net-next/master: 432bc230700f86801cffa5e159e05dea6229f722
>>
>> It was verified with following configs enabled:
>> CONFIG_JIT=y
>> CONFIG_BPFILTER=y
>> CONFIG_BPF_SYSCALL=y
>> CONFIG_XDP_SOCKETS=y
>> CONFIG_BPF_EVENTS=y
>> CONFIG_HAVE_EBPF_JIT=y
>> CONFIG_BPF_JIT=y
>> CONFIG_CGROUP_BPF=y
>>
>> iperf2 UDP RX summary (packet size / Mbps):
>> +--------------------------------------------------------------+
>> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
>> |---------------+------+------+------+------+------+-----+-----|
>> | base commit   | 561  | 470  | 796  |  35  | 70.1 | 281 | 140 |
>> |---------------+------+------+------+------+------+-----+-----|
>> | XDP patched   | 563  | 455  | 808  |  35  | 70.2 | 282 | 141 |
>> +--------------------------------------------------------------+
>>
>> iperf2 UDP TX summary (packet size / Mbps):
>> +--------------------------------------------------------------+
>> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
>> |---------------+------+------+------+------+------+-----+-----|
>> | base commit   | 555  | 666  | 736  | 34.5 | 70.3 | 281 | 140 |
>> |---------------+------+------+------+------+------+-----+-----|
>> | XDP patched   | 558  | 696  | 759  | 35.2 | 69.2 | 279 | 140 |
>> +--------------------------------------------------------------+
>>
>> iperf2 TCP summary (window size / Mbps):
>> +------------------------------------------------------------+
>> | window size/rate |  16  |  32  |  64  |  128 |  8   | 256  |
>> |------------------+------+------+------+------+------+------|
>> | base commit      | 753  | 887  | 931  | 932  | 676  | 932  |
>> |------------------+------+------+------+------+------+------|
>> | XDP patched      | 823  | 888  | 932  | 933  | 669  | 933  |
>> +------------------------------------------------------------+
>>
>> For af_xdp socket type verification several generic changes should be added
>> that can be seen here (rough fixes, for samples related seems like last version
>> of samples is more integrated with libbpf api, so should be rebased,
>> witch I will send as RFC separately):
>> https://github.com/ikhorn/af_xdp_stuff/tree/af_xdp_armv7
>>
>
>More XDP support, yay!
>
>As for mmap/AF_XDP on 32-bit systems; Instead of hacking the if_xdp.h,
>mmap2 should be used. Have a look at the libbpf code here [1]
I more bothering about this fast fix (not investigated deep enough):
https://github.com/ikhorn/af_xdp_stuff/commit/f77cd4faf95ad744bbf37d0ba81d0ec79c1b0d29

That's about when page_address(umem->pgs[i]) returns nothing.

>
>
>Björn
>
>[1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/lib/bpf/xsk.c#n81
>
>
>> Ivan Khoronzhuk (3):
>>   net: ethernet: ti: davinci_cpdma: add dma mapped submit
>>   net: ethernet: ti: davinci_cpdma: return handler status
>>   net: ethernet: ti: cpsw: add XDP support
>>
>>  drivers/net/ethernet/ti/Kconfig         |   1 +
>>  drivers/net/ethernet/ti/cpsw.c          | 552 +++++++++++++++++++++---
>>  drivers/net/ethernet/ti/davinci_cpdma.c | 117 +++--
>>  drivers/net/ethernet/ti/davinci_cpdma.h |   6 +-
>>  drivers/net/ethernet/ti/davinci_emac.c  |  18 +-
>>  5 files changed, 591 insertions(+), 103 deletions(-)
>>
>> --
>> 2.17.1
>>
Grygorii Strashko April 19, 2019, 8:24 a.m. UTC | #3
Hi Ivan,

On 17.04.19 20:49, Ivan Khoronzhuk wrote:
> This patchset is RFC adding XDP support for TI cpsw driver that is
> based on page_pool allocator. It was verified with af_xdp sockets
> and on xdp drop. For XDP redirect to another interface it's under
> verification, still not sure about all cases that should be verified.
> Also regular tests with iperf2 were done in order to verify impact on
> regular netstack performance, compared with base commit from
> net-next/master: 432bc230700f86801cffa5e159e05dea6229f722
> 
> It was verified with following configs enabled:
> CONFIG_JIT=y
> CONFIG_BPFILTER=y
> CONFIG_BPF_SYSCALL=y
> CONFIG_XDP_SOCKETS=y
> CONFIG_BPF_EVENTS=y
> CONFIG_HAVE_EBPF_JIT=y
> CONFIG_BPF_JIT=y
> CONFIG_CGROUP_BPF=y
> 
> iperf2 UDP RX summary (packet size / Mbps):
> +--------------------------------------------------------------+
> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
> |---------------+------+------+------+------+------+-----+-----|
> | base commit   | 561  | 470  | 796  |  35  | 70.1 | 281 | 140 |
> |---------------+------+------+------+------+------+-----+-----|
> | XDP patched   | 563  | 455  | 808  |  35  | 70.2 | 282 | 141 |
> +--------------------------------------------------------------+
> 
> iperf2 UDP TX summary (packet size / Mbps):
> +--------------------------------------------------------------+
> | pkt_size/rate | 1024 | 1500 | 1470 |  64  | 128  | 512 | 256 |
> |---------------+------+------+------+------+------+-----+-----|
> | base commit   | 555  | 666  | 736  | 34.5 | 70.3 | 281 | 140 |
> |---------------+------+------+------+------+------+-----+-----|
> | XDP patched   | 558  | 696  | 759  | 35.2 | 69.2 | 279 | 140 |
> +--------------------------------------------------------------+
> 
> iperf2 TCP summary (window size / Mbps):
> +------------------------------------------------------------+
> | window size/rate |  16  |  32  |  64  |  128 |  8   | 256  |
> |------------------+------+------+------+------+------+------|
> | base commit      | 753  | 887  | 931  | 932  | 676  | 932  |
> |------------------+------+------+------+------+------+------|
> | XDP patched      | 823  | 888  | 932  | 933  | 669  | 933  |
> +------------------------------------------------------------+
> 
> For af_xdp socket type verification several generic changes should be added
> that can be seen here (rough fixes, for samples related seems like last version
> of samples is more integrated with libbpf api, so should be rebased,
> witch I will send as RFC separately):
> https://github.com/ikhorn/af_xdp_stuff/tree/af_xdp_armv7
> 
> Ivan Khoronzhuk (3):
>   net: ethernet: ti: davinci_cpdma: add dma mapped submit
>   net: ethernet: ti: davinci_cpdma: return handler status
>   net: ethernet: ti: cpsw: add XDP support
> 
>  drivers/net/ethernet/ti/Kconfig         |   1 +
>  drivers/net/ethernet/ti/cpsw.c          | 552 +++++++++++++++++++++---
>  drivers/net/ethernet/ti/davinci_cpdma.c | 117 +++--
>  drivers/net/ethernet/ti/davinci_cpdma.h |   6 +-
>  drivers/net/ethernet/ti/davinci_emac.c  |  18 +-
>  5 files changed, 591 insertions(+), 103 deletions(-)
> 

Thanks for your patches. It's great to have XDP support.
I have no objection to this series in general, but i'm not xdp expert, so
it can be moved forward when you resolve comments from other reviewers.