xsk_fwd.c usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I wanted to try out the xsk_fwd.c [0] sample with Mininet. This sample
is capable of forwarding between network interfaces with AF_XDP. My
topology is very simple:
host1 <-----> switch <-----> host2
sudo mn --switch=lxbr
I started the xsk_fwd to forward between the two veth interface of the switch:
sudo ./xsk_fwd -i s1-eth1 -q0 -i s1-eth2 -q0 -c 0

This is failed with EOPNOTSUPP error first. Then I looked into the
xsk_bind function and soon after I found this (at there [1]):
if (force_copy)
    /* For copy-mode, we are done. */
    return 0;

if (!netdev->netdev_ops->ndo_bpf ||
    !netdev->netdev_ops->ndo_xsk_wakeup) {
    err = -EOPNOTSUPP;
    goto err_unreg_pool;
}

After that just like the code said, I removed the XDP_ZEROCOPY from
the bind flags [2] at the xsk_fwd.c which solved the problem and the
program started successfully, but without any traffic between host1
and host2.

My main question: removing XDP_ZEROCOPY requires any semantical
modification in the forwarding code? For example I should have to
memcopy the xdp buffer manually? Or the kernel do the copy
automatically and I have to look for the problem elsewhere? I have
5.10.5 kernel version which supports shared UMEMs.

[0] https://elixir.bootlin.com/linux/v5.11-rc3/source/samples/bpf/xsk_fwd.c
[1] https://elixir.bootlin.com/linux/v5.10.5/source/net/xdp/xsk_buff_pool.c#L158
[2] https://elixir.bootlin.com/linux/v5.11-rc3/source/samples/bpf/xsk_fwd.c#L732

Thanks for the help!
Ferenc



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux