linux-stable/net/xdp
Björn Töpel b3a9e0be43 xsk: remove explicit ring structure from uapi
In this commit we remove the explicit ring structure from the the
uapi. It is tricky for an uapi to depend on a certain L1 cache line
size, since it can differ for variants of the same architecture. Now,
we let the user application determine the offsets of the producer,
consumer and descriptors by asking the socket via getsockopt.

A typical flow would be (Rx ring):

  struct xdp_mmap_offsets off;
  struct xdp_desc *ring;
  u32 *prod, *cons;
  void *map;
  ...

  getsockopt(fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen);

  map = mmap(NULL, off.rx.desc +
		   NUM_DESCS * sizeof(struct xdp_desc),
		   PROT_READ | PROT_WRITE,
		   MAP_SHARED | MAP_POPULATE, sfd,
		   XDP_PGOFF_RX_RING);
  prod = map + off.rx.producer;
  cons = map + off.rx.consumer;
  ring = map + off.rx.desc;

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-05-22 10:25:06 +02:00
..
Kconfig
Makefile xsk: remove newline at end of file 2018-05-18 16:07:02 +02:00
xdp_umem.c xsk: fixed some cases of unnecessary parentheses 2018-05-18 16:07:03 +02:00
xdp_umem.h xsk: clean up SPDX headers 2018-05-18 16:07:02 +02:00
xdp_umem_props.h xsk: clean up SPDX headers 2018-05-18 16:07:02 +02:00
xsk.c xsk: remove explicit ring structure from uapi 2018-05-22 10:25:06 +02:00
xsk_queue.c xsk: fixed some cases of unnecessary parentheses 2018-05-18 16:07:03 +02:00
xsk_queue.h xsk: remove explicit ring structure from uapi 2018-05-22 10:25:06 +02:00