mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
170aafe35c
Add a netdev_dmabuf_binding struct which represents the dma-buf-to-netdevice binding. The netlink API will bind the dma-buf to rx queues on the netdevice. On the binding, the dma_buf_attach & dma_buf_map_attachment will occur. The entries in the sg_table from mapping will be inserted into a genpool to make it ready for allocation. The chunks in the genpool are owned by a dmabuf_chunk_owner struct which holds the dma-buf offset of the base of the chunk and the dma_addr of the chunk. Both are needed to use allocations that come from this chunk. We create a new type that represents an allocation from the genpool: net_iov. We setup the net_iov allocation size in the genpool to PAGE_SIZE for simplicity: to match the PAGE_SIZE normally allocated by the page pool and given to the drivers. The user can unbind the dmabuf from the netdevice by closing the netlink socket that established the binding. We do this so that the binding is automatically unbound even if the userspace process crashes. The binding and unbinding leaves an indicator in struct netdev_rx_queue that the given queue is bound, and the binding is actuated by resetting the rx queue using the queue API. The netdev_dmabuf_binding struct is refcounted, and releases its resources only when all the refs are released. Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Kaiyuan Zhang <kaiyuanz@google.com> Signed-off-by: Mina Almasry <almasrymina@google.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> # excluding netlink Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20240910171458.219195-4-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
|
|
/* Do not edit directly, auto-generated from: */
|
|
/* Documentation/netlink/specs/netdev.yaml */
|
|
/* YNL-GEN kernel header */
|
|
|
|
#ifndef _LINUX_NETDEV_GEN_H
|
|
#define _LINUX_NETDEV_GEN_H
|
|
|
|
#include <net/netlink.h>
|
|
#include <net/genetlink.h>
|
|
|
|
#include <uapi/linux/netdev.h>
|
|
#include <linux/list.h>
|
|
|
|
/* Common nested types */
|
|
extern const struct nla_policy netdev_page_pool_info_nl_policy[NETDEV_A_PAGE_POOL_IFINDEX + 1];
|
|
extern const struct nla_policy netdev_queue_id_nl_policy[NETDEV_A_QUEUE_TYPE + 1];
|
|
|
|
int netdev_nl_dev_get_doit(struct sk_buff *skb, struct genl_info *info);
|
|
int netdev_nl_dev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);
|
|
int netdev_nl_page_pool_get_doit(struct sk_buff *skb, struct genl_info *info);
|
|
int netdev_nl_page_pool_get_dumpit(struct sk_buff *skb,
|
|
struct netlink_callback *cb);
|
|
int netdev_nl_page_pool_stats_get_doit(struct sk_buff *skb,
|
|
struct genl_info *info);
|
|
int netdev_nl_page_pool_stats_get_dumpit(struct sk_buff *skb,
|
|
struct netlink_callback *cb);
|
|
int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info);
|
|
int netdev_nl_queue_get_dumpit(struct sk_buff *skb,
|
|
struct netlink_callback *cb);
|
|
int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info);
|
|
int netdev_nl_napi_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);
|
|
int netdev_nl_qstats_get_dumpit(struct sk_buff *skb,
|
|
struct netlink_callback *cb);
|
|
int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info);
|
|
|
|
enum {
|
|
NETDEV_NLGRP_MGMT,
|
|
NETDEV_NLGRP_PAGE_POOL,
|
|
};
|
|
|
|
extern struct genl_family netdev_nl_family;
|
|
|
|
void netdev_nl_sock_priv_init(struct list_head *priv);
|
|
void netdev_nl_sock_priv_destroy(struct list_head *priv);
|
|
|
|
#endif /* _LINUX_NETDEV_GEN_H */
|