get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1115487/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1115487,
    "url": "http://patchwork.ozlabs.org/api/patches/1115487/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1560411450-29121-3-git-send-email-magnus.karlsson@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1560411450-29121-3-git-send-email-magnus.karlsson@intel.com>",
    "list_archive_url": null,
    "date": "2019-06-13T07:37:26",
    "name": "[bpf-next,2/6] xsk: add support for need_wakeup flag in AF_XDP rings",
    "commit_ref": null,
    "pull_url": null,
    "state": "awaiting-upstream",
    "archived": false,
    "hash": "e70f1424d6bd51a72a0a5177c20952302cfa833a",
    "submitter": {
        "id": 72726,
        "url": "http://patchwork.ozlabs.org/api/people/72726/?format=api",
        "name": "Magnus Karlsson",
        "email": "magnus.karlsson@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1560411450-29121-3-git-send-email-magnus.karlsson@intel.com/mbox/",
    "series": [
        {
            "id": 113704,
            "url": "http://patchwork.ozlabs.org/api/series/113704/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=113704",
            "date": "2019-06-13T07:37:25",
            "name": "add need_wakeup flag to the AF_XDP rings",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/113704/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1115487/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1115487/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 45PrF13z5Lz9s5c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 14 Jun 2019 03:23:49 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E297287821;\n\tThu, 13 Jun 2019 17:23:46 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rRllK01Jq00Q; Thu, 13 Jun 2019 17:23:44 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 614B2877F8;\n\tThu, 13 Jun 2019 17:23:44 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 04EEA1BF363\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Jun 2019 07:37:51 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 01EC887E81\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Jun 2019 07:37:51 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id JlVC5rMftt7A for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Jun 2019 07:37:50 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 02A8385EE8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Jun 2019 07:37:49 +0000 (UTC)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Jun 2019 00:37:49 -0700",
            "from mkarlsso-mobl.ger.corp.intel.com (HELO VM.ger.corp.intel.com)\n\t([10.103.211.41])\n\tby orsmga004.jf.intel.com with ESMTP; 13 Jun 2019 00:37:44 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Magnus Karlsson <magnus.karlsson@intel.com>",
        "To": "magnus.karlsson@intel.com, bjorn.topel@intel.com, ast@kernel.org,\n\tdaniel@iogearbox.net, netdev@vger.kernel.org, brouer@redhat.com",
        "Date": "Thu, 13 Jun 2019 09:37:26 +0200",
        "Message-Id": "<1560411450-29121-3-git-send-email-magnus.karlsson@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1560411450-29121-1-git-send-email-magnus.karlsson@intel.com>",
        "References": "<1560411450-29121-1-git-send-email-magnus.karlsson@intel.com>",
        "X-Mailman-Approved-At": "Thu, 13 Jun 2019 17:23:43 +0000",
        "Subject": "[Intel-wired-lan] [PATCH bpf-next 2/6] xsk: add support for\n\tneed_wakeup flag in AF_XDP rings",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "axboe@kernel.dk, maximmi@mellanox.com, kevin.laatz@intel.com,\n\tjakub.kicinski@netronome.com, maciejromanfijalkowski@gmail.com,\n\tbruce.richardson@intel.com, ciara.loftus@intel.com,\n\tilias.apalodimas@linaro.org, xiaolong.ye@intel.com,\n\tintel-wired-lan@lists.osuosl.org, qi.z.zhang@intel.com,\n\tmaciej.fijalkowski@intel.com, bpf@vger.kernel.org",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "This commit adds support for a new flag called need_wakeup in the\nAF_XDP Tx and fill rings. When this flag is set, it means that the\napplication has to explicitly wake up the kernel Rx (for the bit in\nthe fill ring) or kernel Tx (for bit in the Tx ring) processing by\nissuing a syscall. Poll() can wake up both depending on the flags\nsubmitted and sendto() will wake up tx processing only.\n\nThe main reason for introducing this new flag is to be able to\nefficiently support the case when application and driver is executing\non the same core. Previously, the driver was just busy-spinning on the\nfill ring if it ran out of buffers in the HW and there were none on\nthe fill ring. This approach works when the application is running on\nanother core as it can replenish the fill ring while the driver is\nbusy-spinning. Though, this is a lousy approach if both of them are\nrunning on the same core as the probability of the fill ring getting\nmore entries when the driver is busy-spinning is zero. With this new\nfeature the driver now sets the need_wakeup flag and returns to the\napplication. The application can then replenish the fill queue and\nthen explicitly wake up the Rx processing in the kernel using the\nsyscall poll(). For Tx, the flag is only set to one if the driver has\nno outstanding Tx completion interrupts. If it has some, the flag is\nzero as it will be woken up by a completion interrupt anyway.\n\nAs a nice side effect, this new flag also improves the performance of\nthe case where application and driver are running on two different\ncores as it reduces the number of syscalls to the kernel. The kernel\ntells user space if it needs to be woken up by a syscall, and this\neliminates many of the syscalls.\n\nThis flag needs some simple driver support. If the driver does not\nsupport this, the Rx flag is always zero and the Tx flag is always\none. This makes any application relying on this feature default to the\nold behaviour of not requiring any syscalls in the Rx path and always\nhaving to call sendto() in the Tx path.\n\nFor backwards compatibility reasons, this feature has to be explicitly\nturned on using a new bind flag (XDP_USE_NEED_WAKEUP). I recommend\nthat you always turn it on as it so far always have had a positive\nperformance impact.\n\nThe name and inspiration of the flag has been taken from io_uring by\nJens Axboe. Details about this feature in io_uring can be found in\nhttp://kernel.dk/io_uring.pdf, section 8.3.\n\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\n---\n include/linux/netdevice.h   |  4 ++\n include/net/xdp_sock.h      | 33 +++++++++++++++-\n include/uapi/linux/if_xdp.h | 13 +++++++\n net/xdp/xdp_umem.c          |  6 ++-\n net/xdp/xsk.c               | 93 +++++++++++++++++++++++++++++++++++++++++++--\n net/xdp/xsk_queue.h         |  1 +\n 6 files changed, 143 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex fd29d39..8c4320b 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -876,6 +876,9 @@ struct bpf_prog_offload_ops;\n struct netlink_ext_ack;\n struct xdp_umem;\n \n+/* Flags for the flags field in XDP_SETUP_XSK_UMEM */\n+#define XSK_DRV_CAN_SLEEP (1 << 0) /* The driver is alowed to sleep. */\n+\n struct netdev_bpf {\n \tenum bpf_netdev_command command;\n \tunion {\n@@ -898,6 +901,7 @@ struct netdev_bpf {\n \t\t/* XDP_SETUP_XSK_UMEM */\n \t\tstruct {\n \t\t\tstruct xdp_umem *umem;\n+\t\t\tu32 flags;\n \t\t\tu16 queue_id;\n \t\t} xsk;\n \t};\ndiff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h\nindex ae0f368..4d894a5 100644\n--- a/include/net/xdp_sock.h\n+++ b/include/net/xdp_sock.h\n@@ -27,6 +27,9 @@ struct xdp_umem_fq_reuse {\n \tu64 handles[];\n };\n \n+/* Flags for the umem flags field. */\n+#define XDP_UMEM_MIGHT_SLEEP (1 << 0)\n+\n struct xdp_umem {\n \tstruct xsk_queue *fq;\n \tstruct xsk_queue *cq;\n@@ -41,10 +44,12 @@ struct xdp_umem {\n \tstruct work_struct work;\n \tstruct page **pgs;\n \tu32 npgs;\n+\tu16 queue_id;\n+\tu8 need_wakeup;\n+\tu8 flags;\n \tint id;\n \tstruct net_device *dev;\n \tstruct xdp_umem_fq_reuse *fq_reuse;\n-\tu16 queue_id;\n \tbool zc;\n \tspinlock_t xsk_list_lock;\n \tstruct list_head xsk_list;\n@@ -87,6 +92,11 @@ struct xdp_umem_fq_reuse *xsk_reuseq_swap(struct xdp_umem *umem,\n \t\t\t\t\t  struct xdp_umem_fq_reuse *newq);\n void xsk_reuseq_free(struct xdp_umem_fq_reuse *rq);\n struct xdp_umem *xdp_get_umem_from_qid(struct net_device *dev, u16 queue_id);\n+void xsk_set_rx_need_wakeup(struct xdp_umem *umem);\n+void xsk_set_tx_need_wakeup(struct xdp_umem *umem);\n+void xsk_clear_rx_need_wakeup(struct xdp_umem *umem);\n+void xsk_clear_tx_need_wakeup(struct xdp_umem *umem);\n+bool xsk_umem_uses_might_sleep(struct xdp_umem *umem);\n \n static inline char *xdp_umem_get_data(struct xdp_umem *umem, u64 addr)\n {\n@@ -213,6 +223,27 @@ static inline void xsk_umem_fq_reuse(struct xdp_umem *umem, u64 addr)\n {\n }\n \n+static inline void xsk_set_rx_need_wakeup(struct xdp_umem *umem)\n+{\n+}\n+\n+static inline void xsk_set_tx_need_wakeup(struct xdp_umem *umem)\n+{\n+}\n+\n+static inline void xsk_clear_rx_need_wakeup(struct xdp_umem *umem)\n+{\n+}\n+\n+static inline void xsk_clear_tx_need_wakeup(struct xdp_umem *umem)\n+{\n+}\n+\n+static inline bool xsk_umem_uses_might_sleep(struct xdp_umem *umem)\n+{\n+\treturn false;\n+}\n+\n #endif /* CONFIG_XDP_SOCKETS */\n \n #endif /* _LINUX_XDP_SOCK_H */\ndiff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h\nindex caed8b1..3aa958e 100644\n--- a/include/uapi/linux/if_xdp.h\n+++ b/include/uapi/linux/if_xdp.h\n@@ -16,6 +16,15 @@\n #define XDP_SHARED_UMEM\t(1 << 0)\n #define XDP_COPY\t(1 << 1) /* Force copy-mode */\n #define XDP_ZEROCOPY\t(1 << 2) /* Force zero-copy mode */\n+/* If this option is set, the driver might go sleep and in that case\n+ * the XDP_RING_NEED_WAKEUP flag in the fill and/or Tx rings will be\n+ * set. If it is set, the application need to explicitly wake up the\n+ * driver with a poll() (Rx and Tx) or sendto() (Tx only). If you are\n+ * running the driver and the application on the same core, you should\n+ * use this option so that the kernel will yield to the user space\n+ * application.\n+ */\n+#define XDP_USE_NEED_WAKEUP (1 << 3)\n \n struct sockaddr_xdp {\n \t__u16 sxdp_family;\n@@ -25,10 +34,14 @@ struct sockaddr_xdp {\n \t__u32 sxdp_shared_umem_fd;\n };\n \n+/* XDP_RING flags */\n+#define XDP_RING_NEED_WAKEUP (1 << 0)\n+\n struct xdp_ring_offset {\n \t__u64 producer;\n \t__u64 consumer;\n \t__u64 desc;\n+\t__u64 flags;\n };\n \n struct xdp_mmap_offsets {\ndiff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c\nindex 2b18223..15d7c53 100644\n--- a/net/xdp/xdp_umem.c\n+++ b/net/xdp/xdp_umem.c\n@@ -105,12 +105,14 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,\n \n \tumem->dev = dev;\n \tumem->queue_id = queue_id;\n+\tif (flags & XDP_USE_NEED_WAKEUP)\n+\t\tumem->flags |= XDP_UMEM_MIGHT_SLEEP;\n+\n \tif (force_copy)\n \t\t/* For copy-mode, we are done. */\n \t\tgoto out_rtnl_unlock;\n \n-\tif (!dev->netdev_ops->ndo_bpf ||\n-\t    !dev->netdev_ops->ndo_xsk_async_xmit) {\n+\tif (!dev->netdev_ops->ndo_bpf || !dev->netdev_ops->ndo_xsk_wakeup) {\n \t\terr = -EOPNOTSUPP;\n \t\tgoto err_unreg_umem;\n \t}\ndiff --git a/net/xdp/xsk.c b/net/xdp/xsk.c\nindex a14e886..e9b9c98 100644\n--- a/net/xdp/xsk.c\n+++ b/net/xdp/xsk.c\n@@ -49,6 +49,66 @@ void xsk_umem_discard_addr(struct xdp_umem *umem)\n }\n EXPORT_SYMBOL(xsk_umem_discard_addr);\n \n+void xsk_set_rx_need_wakeup(struct xdp_umem *umem)\n+{\n+\tif (umem->need_wakeup & XDP_WAKEUP_RX)\n+\t\treturn;\n+\n+\tumem->fq->ring->flags |= XDP_RING_NEED_WAKEUP;\n+\tumem->need_wakeup |= XDP_WAKEUP_RX;\n+}\n+EXPORT_SYMBOL(xsk_set_rx_need_wakeup);\n+\n+void xsk_set_tx_need_wakeup(struct xdp_umem *umem)\n+{\n+\tstruct xdp_sock *xs;\n+\n+\tif (umem->need_wakeup & XDP_WAKEUP_TX)\n+\t\treturn;\n+\n+\trcu_read_lock();\n+\tlist_for_each_entry_rcu(xs, &umem->xsk_list, list) {\n+\t\txs->tx->ring->flags |= XDP_RING_NEED_WAKEUP;\n+\t}\n+\trcu_read_unlock();\n+\n+\tumem->need_wakeup |= XDP_WAKEUP_TX;\n+}\n+EXPORT_SYMBOL(xsk_set_tx_need_wakeup);\n+\n+void xsk_clear_rx_need_wakeup(struct xdp_umem *umem)\n+{\n+\tif (!(umem->need_wakeup & XDP_WAKEUP_RX))\n+\t\treturn;\n+\n+\tumem->fq->ring->flags &= ~XDP_RING_NEED_WAKEUP;\n+\tumem->need_wakeup &= ~XDP_WAKEUP_RX;\n+}\n+EXPORT_SYMBOL(xsk_clear_rx_need_wakeup);\n+\n+void xsk_clear_tx_need_wakeup(struct xdp_umem *umem)\n+{\n+\tstruct xdp_sock *xs;\n+\n+\tif (!(umem->need_wakeup & XDP_WAKEUP_TX))\n+\t\treturn;\n+\n+\trcu_read_lock();\n+\tlist_for_each_entry_rcu(xs, &umem->xsk_list, list) {\n+\t\txs->tx->ring->flags &= ~XDP_RING_NEED_WAKEUP;\n+\t}\n+\trcu_read_unlock();\n+\n+\tumem->need_wakeup &= ~XDP_WAKEUP_TX;\n+}\n+EXPORT_SYMBOL(xsk_clear_tx_need_wakeup);\n+\n+bool xsk_umem_uses_might_sleep(struct xdp_umem *umem)\n+{\n+\treturn umem->flags & XDP_UMEM_MIGHT_SLEEP;\n+}\n+EXPORT_SYMBOL(xsk_umem_uses_might_sleep);\n+\n static int __xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)\n {\n \tvoid *to_buf, *from_buf;\n@@ -198,7 +258,8 @@ static int xsk_zc_xmit(struct sock *sk)\n \tstruct xdp_sock *xs = xdp_sk(sk);\n \tstruct net_device *dev = xs->dev;\n \n-\treturn dev->netdev_ops->ndo_xsk_async_xmit(dev, xs->queue_id);\n+\treturn dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,\n+\t\t\t\t\t       XDP_WAKEUP_TX);\n }\n \n static void xsk_destruct_skb(struct sk_buff *skb)\n@@ -308,6 +369,12 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock,\n \tunsigned int mask = datagram_poll(file, sock, wait);\n \tstruct sock *sk = sock->sk;\n \tstruct xdp_sock *xs = xdp_sk(sk);\n+\tstruct net_device *dev = xs->dev;\n+\tstruct xdp_umem *umem = xs->umem;\n+\n+\tif (umem->need_wakeup)\n+\t\tdev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,\n+\t\t\t\t\t\tumem->need_wakeup);\n \n \tif (xs->rx && !xskq_empty_desc(xs->rx))\n \t\tmask |= POLLIN | POLLRDNORM;\n@@ -408,7 +475,8 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n \t\treturn -EINVAL;\n \n \tflags = sxdp->sxdp_flags;\n-\tif (flags & ~(XDP_SHARED_UMEM | XDP_COPY | XDP_ZEROCOPY))\n+\tif (flags & ~(XDP_SHARED_UMEM | XDP_COPY | XDP_ZEROCOPY |\n+\t\t      XDP_USE_NEED_WAKEUP))\n \t\treturn -EINVAL;\n \n \tmutex_lock(&xs->mutex);\n@@ -434,7 +502,8 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n \t\tstruct xdp_sock *umem_xs;\n \t\tstruct socket *sock;\n \n-\t\tif ((flags & XDP_COPY) || (flags & XDP_ZEROCOPY)) {\n+\t\tif ((flags & XDP_COPY) || (flags & XDP_ZEROCOPY) ||\n+\t\t    (flags & XDP_USE_NEED_WAKEUP)) {\n \t\t\t/* Cannot specify flags for shared sockets. */\n \t\t\terr = -EINVAL;\n \t\t\tgoto out_unlock;\n@@ -522,6 +591,9 @@ static int xsk_setsockopt(struct socket *sock, int level, int optname,\n \t\tmutex_lock(&xs->mutex);\n \t\tq = (optname == XDP_TX_RING) ? &xs->tx : &xs->rx;\n \t\terr = xsk_init_queue(entries, q, false);\n+\t\tif (!err && optname == XDP_TX_RING)\n+\t\t\t/* Tx needs to be explicitly woken up the first time */\n+\t\t\txs->tx->ring->flags |= XDP_RING_NEED_WAKEUP;\n \t\tmutex_unlock(&xs->mutex);\n \t\treturn err;\n \t}\n@@ -618,9 +690,12 @@ static int xsk_getsockopt(struct socket *sock, int level, int optname,\n \tcase XDP_MMAP_OFFSETS:\n \t{\n \t\tstruct xdp_mmap_offsets off;\n+\t\tbool flags_supported = true;\n \n-\t\tif (len < sizeof(off))\n+\t\tif (len < sizeof(off) - sizeof(off.rx.flags))\n \t\t\treturn -EINVAL;\n+\t\telse if (len < sizeof(off))\n+\t\t\tflags_supported = false;\n \n \t\toff.rx.producer = offsetof(struct xdp_rxtx_ring, ptrs.producer);\n \t\toff.rx.consumer = offsetof(struct xdp_rxtx_ring, ptrs.consumer);\n@@ -635,6 +710,16 @@ static int xsk_getsockopt(struct socket *sock, int level, int optname,\n \t\toff.cr.producer = offsetof(struct xdp_umem_ring, ptrs.producer);\n \t\toff.cr.consumer = offsetof(struct xdp_umem_ring, ptrs.consumer);\n \t\toff.cr.desc\t= offsetof(struct xdp_umem_ring, desc);\n+\t\tif (flags_supported) {\n+\t\t\toff.rx.flags = offsetof(struct xdp_rxtx_ring,\n+\t\t\t\t\t\tptrs.flags);\n+\t\t\toff.tx.flags = offsetof(struct xdp_rxtx_ring,\n+\t\t\t\t\t\tptrs.flags);\n+\t\t\toff.fr.flags = offsetof(struct xdp_umem_ring,\n+\t\t\t\t\t\tptrs.flags);\n+\t\t\toff.cr.flags = offsetof(struct xdp_umem_ring,\n+\t\t\t\t\t\tptrs.flags);\n+\t\t}\n \n \t\tlen = sizeof(off);\n \t\tif (copy_to_user(optval, &off, len))\ndiff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h\nindex 88b9ae2..e438eeb 100644\n--- a/net/xdp/xsk_queue.h\n+++ b/net/xdp/xsk_queue.h\n@@ -16,6 +16,7 @@\n struct xdp_ring {\n \tu32 producer ____cacheline_aligned_in_smp;\n \tu32 consumer ____cacheline_aligned_in_smp;\n+\tu32 flags;\n };\n \n /* Used for the RX and TX queues for packets */\n",
    "prefixes": [
        "bpf-next",
        "2/6"
    ]
}