<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/xdp, branch v5.3-rc4</title>
<subtitle>Linux Kernel (branches are rebased on master from time to time)</subtitle>
<id>https://sre.ring0.de/linux/atom?h=v5.3-rc4</id>
<link rel='self' href='https://sre.ring0.de/linux/atom?h=v5.3-rc4'/>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/'/>
<updated>2019-07-12T13:02:21Z</updated>
<entry>
<title>xdp: fix potential deadlock on socket mutex</title>
<updated>2019-07-12T13:02:21Z</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-07-08T11:03:44Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=5464c3a0e9a037b63d5229cdea08dddc01a98aac'/>
<id>urn:sha1:5464c3a0e9a037b63d5229cdea08dddc01a98aac</id>
<content type='text'>
There are 2 call chains:

  a) xsk_bind --&gt; xdp_umem_assign_dev
  b) unregister_netdevice_queue --&gt; xsk_notifier

with the following locking order:

  a) xs-&gt;mutex --&gt; rtnl_lock
  b) rtnl_lock --&gt; xdp.lock --&gt; xs-&gt;mutex

Different order of taking 'xs-&gt;mutex' and 'rtnl_lock' could produce a
deadlock here. Fix that by moving the 'rtnl_lock' before 'xs-&gt;lock' in
the bind call chain (a).

Reported-by: syzbot+bf64ec93de836d7f4c2c@syzkaller.appspotmail.com
Fixes: 455302d1c9ae ("xdp: fix hang while unregistering device bound to xdp socket")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Jonathan Lemon &lt;jonathan.lemon@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xdp: fix possible cq entry leak</title>
<updated>2019-07-12T12:54:57Z</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-07-04T14:25:03Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=675716400da6f15b9d3db04ef74ee74ca9a00af3'/>
<id>urn:sha1:675716400da6f15b9d3db04ef74ee74ca9a00af3</id>
<content type='text'>
Completion queue address reservation could not be undone.
In case of bad 'queue_id' or skb allocation failure, reserved entry
will be leaked reducing the total capacity of completion queue.

Fix that by moving reservation to the point where failure is not
possible. Additionally, 'queue_id' checking moved out from the loop
since there is no point to check it there.

Fixes: 35fcde7f8deb ("xsk: support for Tx")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2019-07-09T02:48:57Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2019-07-09T02:48:57Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=af144a983402f7fd324ce556d9f9011a8b3e01fe'/>
<id>urn:sha1:af144a983402f7fd324ce556d9f9011a8b3e01fe</id>
<content type='text'>
Two cases of overlapping changes, nothing fancy.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>xdp: fix race on generic receive path</title>
<updated>2019-07-08T23:43:26Z</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-07-03T12:09:16Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=bf0bdd1343efbbf65b4d53aef1fce14acbd79d50'/>
<id>urn:sha1:bf0bdd1343efbbf65b4d53aef1fce14acbd79d50</id>
<content type='text'>
Unlike driver mode, generic xdp receive could be triggered
by different threads on different CPU cores at the same time
leading to the fill and rx queue breakage. For example, this
could happen while sending packets from two processes to the
first interface of veth pair while the second part of it is
open with AF_XDP socket.

Need to take a lock for each generic receive to avoid race.

Fixes: c497176cb2e4 ("xsk: add Rx receive functions and poll support")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xdp: fix hang while unregistering device bound to xdp socket</title>
<updated>2019-07-03T13:10:55Z</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-06-28T08:04:07Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=455302d1c9ae9318660aaeb9748a01ff414c9741'/>
<id>urn:sha1:455302d1c9ae9318660aaeb9748a01ff414c9741</id>
<content type='text'>
Device that bound to XDP socket will not have zero refcount until the
userspace application will not close it. This leads to hang inside
'netdev_wait_allrefs()' if device unregistering requested:

  # ip link del p1
  &lt; hang on recvmsg on netlink socket &gt;

  # ps -x | grep ip
  5126  pts/0    D+   0:00 ip link del p1

  # journalctl -b

  Jun 05 07:19:16 kernel:
  unregister_netdevice: waiting for p1 to become free. Usage count = 1

  Jun 05 07:19:27 kernel:
  unregister_netdevice: waiting for p1 to become free. Usage count = 1
  ...

Fix that by implementing NETDEV_UNREGISTER event notification handler
to properly clean up all the resources and unref device.

This should also allow socket killing via ss(8) utility.

Fixes: 965a99098443 ("xsk: add support for bind for Rx")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Jonathan Lemon &lt;jonathan.lemon@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xdp: hold device for umem regardless of zero-copy mode</title>
<updated>2019-07-03T13:10:55Z</updated>
<author>
<name>Ilya Maximets</name>
<email>i.maximets@samsung.com</email>
</author>
<published>2019-06-28T08:04:06Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=162c820ed8965bf94d2685f97388aea5aee9e258'/>
<id>urn:sha1:162c820ed8965bf94d2685f97388aea5aee9e258</id>
<content type='text'>
Device pointer stored in umem regardless of zero-copy mode,
so we heed to hold the device in all cases.

Fixes: c9b47cc1fabc ("xsk: fix bug when trying to use both copy and zero-copy on one queue id")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Jonathan Lemon &lt;jonathan.lemon@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xsk: Return the whole xdp_desc from xsk_umem_consume_tx</title>
<updated>2019-06-27T20:53:27Z</updated>
<author>
<name>Maxim Mikityanskiy</name>
<email>maximmi@mellanox.com</email>
</author>
<published>2019-06-26T14:35:28Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=4bce4e5cb65587f805655ec6808a20af2036627a'/>
<id>urn:sha1:4bce4e5cb65587f805655ec6808a20af2036627a</id>
<content type='text'>
Some drivers want to access the data transmitted in order to implement
acceleration features of the NICs. It is also useful in AF_XDP TX flow.

Change the xsk_umem_consume_tx API to return the whole xdp_desc, that
contains the data pointer, length and DMA address, instead of only the
latter two. Adapt the implementation of i40e and ixgbe to this change.

Signed-off-by: Maxim Mikityanskiy &lt;maximmi@mellanox.com&gt;
Signed-off-by: Tariq Toukan &lt;tariqt@mellanox.com&gt;
Acked-by: Saeed Mahameed &lt;saeedm@mellanox.com&gt;
Cc: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Acked-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xsk: Add getsockopt XDP_OPTIONS</title>
<updated>2019-06-27T20:53:26Z</updated>
<author>
<name>Maxim Mikityanskiy</name>
<email>maximmi@mellanox.com</email>
</author>
<published>2019-06-26T14:35:25Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=2640d3c8123223e0a205b2a25a446df6f072b3ea'/>
<id>urn:sha1:2640d3c8123223e0a205b2a25a446df6f072b3ea</id>
<content type='text'>
Make it possible for the application to determine whether the AF_XDP
socket is running in zero-copy mode. To achieve this, add a new
getsockopt option XDP_OPTIONS that returns flags. The only flag
supported for now is the zero-copy mode indicator.

Signed-off-by: Maxim Mikityanskiy &lt;maximmi@mellanox.com&gt;
Signed-off-by: Tariq Toukan &lt;tariqt@mellanox.com&gt;
Acked-by: Saeed Mahameed &lt;saeedm@mellanox.com&gt;
Acked-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xsk: Add API to check for available entries in FQ</title>
<updated>2019-06-27T20:53:26Z</updated>
<author>
<name>Maxim Mikityanskiy</name>
<email>maximmi@mellanox.com</email>
</author>
<published>2019-06-26T14:35:24Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=d57d76428ae9abca51fb89f9326da9d4b1cf8270'/>
<id>urn:sha1:d57d76428ae9abca51fb89f9326da9d4b1cf8270</id>
<content type='text'>
Add a function that checks whether the Fill Ring has the specified
amount of descriptors available. It will be useful for mlx5e that wants
to check in advance, whether it can allocate a bulk of RX descriptors,
to get the best performance.

Signed-off-by: Maxim Mikityanskiy &lt;maximmi@mellanox.com&gt;
Signed-off-by: Tariq Toukan &lt;tariqt@mellanox.com&gt;
Acked-by: Saeed Mahameed &lt;saeedm@mellanox.com&gt;
Acked-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>xsk: Properly terminate assignment in xskq_produce_flush_desc</title>
<updated>2019-06-26T12:39:05Z</updated>
<author>
<name>Nathan Chancellor</name>
<email>natechancellor@gmail.com</email>
</author>
<published>2019-06-25T18:23:52Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=f7019b7b0ad14bde732b8953161994edfc384953'/>
<id>urn:sha1:f7019b7b0ad14bde732b8953161994edfc384953</id>
<content type='text'>
Clang warns:

In file included from net/xdp/xsk_queue.c:10:
net/xdp/xsk_queue.h:292:2: warning: expression result unused
[-Wunused-value]
        WRITE_ONCE(q-&gt;ring-&gt;producer, q-&gt;prod_tail);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:284:6: note: expanded from macro 'WRITE_ONCE'
        __u.__val;                                      \
        ~~~ ^~~~~
1 warning generated.

The q-&gt;prod_tail assignment has a comma at the end, not a semi-colon.
Fix that so clang no longer warns and everything works as expected.

Fixes: c497176cb2e4 ("xsk: add Rx receive functions and poll support")
Link: https://github.com/ClangBuiltLinux/linux/issues/544
Signed-off-by: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Acked-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Acked-by: Jonathan Lemon &lt;jonathan.lemon@gmail.com&gt;
Acked-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
</feed>
