#include <linux/module.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/vdpa.h>
#include <uapi/linux/vdpa.h>
#include <net/genetlink.h>
#include <linux/mod_devicetable.h>
#include <linux/virtio_ids.h>
static LIST_HEAD(mdev_head);
static DECLARE_RWSEM(vdpa_dev_lock);
static DEFINE_IDA(vdpa_index_ida);
void vdpa_set_status(struct vdpa_device *vdev, u8 status)
{ … }
EXPORT_SYMBOL(…);
static struct genl_family vdpa_nl_family;
static int vdpa_dev_probe(struct device *d)
{ … }
static void vdpa_dev_remove(struct device *d)
{ … }
static int vdpa_dev_match(struct device *dev, const struct device_driver *drv)
{ … }
static ssize_t driver_override_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t driver_override_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(driver_override);
static struct attribute *vdpa_dev_attrs[] = …;
static const struct attribute_group vdpa_dev_group = …;
__ATTRIBUTE_GROUPS(…);
static const struct bus_type vdpa_bus = …;
static void vdpa_release_dev(struct device *d)
{ … }
struct vdpa_device *__vdpa_alloc_device(struct device *parent,
const struct vdpa_config_ops *config,
unsigned int ngroups, unsigned int nas,
size_t size, const char *name,
bool use_va)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vdpa_name_match(struct device *dev, const void *data)
{ … }
static int __vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
{ … }
int _vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
{ … }
EXPORT_SYMBOL_GPL(…);
int vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
{ … }
EXPORT_SYMBOL_GPL(…);
void _vdpa_unregister_device(struct vdpa_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void vdpa_unregister_device(struct vdpa_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
int __vdpa_register_driver(struct vdpa_driver *drv, struct module *owner)
{ … }
EXPORT_SYMBOL_GPL(…);
void vdpa_unregister_driver(struct vdpa_driver *drv)
{ … }
EXPORT_SYMBOL_GPL(…);
int vdpa_mgmtdev_register(struct vdpa_mgmt_dev *mdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vdpa_match_remove(struct device *dev, void *data)
{ … }
void vdpa_mgmtdev_unregister(struct vdpa_mgmt_dev *mdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static void vdpa_get_config_unlocked(struct vdpa_device *vdev,
unsigned int offset,
void *buf, unsigned int len)
{ … }
void vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
void *buf, unsigned int len)
{ … }
EXPORT_SYMBOL_GPL(…);
void vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
const void *buf, unsigned int length)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool mgmtdev_handle_match(const struct vdpa_mgmt_dev *mdev,
const char *busname, const char *devname)
{ … }
static struct vdpa_mgmt_dev *vdpa_mgmtdev_get_from_attr(struct nlattr **attrs)
{ … }
static int vdpa_nl_mgmtdev_handle_fill(struct sk_buff *msg, const struct vdpa_mgmt_dev *mdev)
{ … }
static u64 vdpa_mgmtdev_get_classes(const struct vdpa_mgmt_dev *mdev,
unsigned int *nclasses)
{ … }
static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *msg,
u32 portid, u32 seq, int flags)
{ … }
static int vdpa_nl_cmd_mgmtdev_get_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static int
vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)
{ … }
#define VDPA_DEV_NET_ATTRS_MASK …
#define VIRTIO_DEVICE_F_MASK …
static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static int vdpa_nl_cmd_dev_del_set_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static int
vdpa_dev_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq,
int flags, struct netlink_ext_ack *extack)
{ … }
static int vdpa_nl_cmd_dev_get_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
struct vdpa_dev_dump_info { … };
static int vdpa_dev_dump(struct device *dev, void *data)
{ … }
static int vdpa_nl_cmd_dev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)
{ … }
static int vdpa_dev_net_mq_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_net_config *config)
{ … }
static int vdpa_dev_net_mtu_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_net_config *config)
{ … }
static int vdpa_dev_net_mac_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_net_config *config)
{ … }
static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_net_config *config)
{ … }
static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
{ … }
static int
vdpa_dev_blk_capacity_config_fill(struct sk_buff *msg,
const struct virtio_blk_config *config)
{ … }
static int
vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int
vdpa_dev_blk_block_size_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int
vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int vdpa_dev_blk_topology_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int
vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
const struct virtio_blk_config *config)
{ … }
static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 features)
{ … }
static int vdpa_dev_blk_flush_config_fill(struct sk_buff *msg, u64 features)
{ … }
static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
struct sk_buff *msg)
{ … }
static int
vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq,
int flags, struct netlink_ext_ack *extack)
{ … }
static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg,
struct genl_info *info, u32 index)
{ … }
static int vendor_stats_fill(struct vdpa_device *vdev, struct sk_buff *msg,
struct genl_info *info, u32 index)
{ … }
static int vdpa_dev_vendor_stats_fill(struct vdpa_device *vdev,
struct sk_buff *msg,
struct genl_info *info, u32 index)
{ … }
static int vdpa_nl_cmd_dev_config_get_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static int vdpa_dev_config_dump(struct device *dev, void *data)
{ … }
static int
vdpa_nl_cmd_dev_config_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)
{ … }
static int vdpa_nl_cmd_dev_stats_get_doit(struct sk_buff *skb,
struct genl_info *info)
{ … }
static const struct nla_policy vdpa_nl_policy[VDPA_ATTR_MAX + 1] = …;
static const struct genl_ops vdpa_nl_ops[] = …;
static struct genl_family vdpa_nl_family __ro_after_init = …;
static int vdpa_init(void)
{ … }
static void __exit vdpa_exit(void)
{ … }
core_initcall(vdpa_init);
module_exit(vdpa_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;