mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-17 22:23:45 -04:00
vdpa: Enable user to set mac and mtu of vdpa device
$ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:55 mtu 9000
$ vdpa dev config show
bar: mac 00:11:22:33:44:55 link up link_announce false mtu 9000
$ vdpa dev config show -jp
{
"config": {
"bar": {
"mac": "00:11:22:33:44:55",
"link ": "up",
"link_announce ": false,
"mtu": 9000,
}
}
}
Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Eli Cohen <elic@nvidia.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20211026175519.87795-5-parav@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
960deb33be
commit
d8ca2fa5be
@@ -6,6 +6,8 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/vhost_iotlb.h>
|
||||
#include <linux/virtio_net.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
/**
|
||||
* struct vdpa_calllback - vDPA callback definition.
|
||||
@@ -93,6 +95,14 @@ struct vdpa_iova_range {
|
||||
u64 last;
|
||||
};
|
||||
|
||||
struct vdpa_dev_set_config {
|
||||
struct {
|
||||
u8 mac[ETH_ALEN];
|
||||
u16 mtu;
|
||||
} net;
|
||||
u64 mask;
|
||||
};
|
||||
|
||||
/**
|
||||
* Corresponding file area for device memory mapping
|
||||
* @file: vma->vm_file for the mapping
|
||||
@@ -397,6 +407,7 @@ void vdpa_set_config(struct vdpa_device *dev, unsigned int offset,
|
||||
* @dev_add: Add a vdpa device using alloc and register
|
||||
* @mdev: parent device to use for device addition
|
||||
* @name: name of the new vdpa device
|
||||
* @config: config attributes to apply to the device under creation
|
||||
* Driver need to add a new device using _vdpa_register_device()
|
||||
* after fully initializing the vdpa device. Driver must return 0
|
||||
* on success or appropriate error code.
|
||||
@@ -407,7 +418,8 @@ void vdpa_set_config(struct vdpa_device *dev, unsigned int offset,
|
||||
* _vdpa_unregister_device().
|
||||
*/
|
||||
struct vdpa_mgmtdev_ops {
|
||||
int (*dev_add)(struct vdpa_mgmt_dev *mdev, const char *name);
|
||||
int (*dev_add)(struct vdpa_mgmt_dev *mdev, const char *name,
|
||||
const struct vdpa_dev_set_config *config);
|
||||
void (*dev_del)(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev);
|
||||
};
|
||||
|
||||
@@ -416,12 +428,15 @@ struct vdpa_mgmtdev_ops {
|
||||
* @device: Management parent device
|
||||
* @ops: operations supported by management device
|
||||
* @id_table: Pointer to device id table of supported ids
|
||||
* @config_attr_mask: bit mask of attributes of type enum vdpa_attr that
|
||||
* management device support during dev_add callback
|
||||
* @list: list entry
|
||||
*/
|
||||
struct vdpa_mgmt_dev {
|
||||
struct device *device;
|
||||
const struct vdpa_mgmtdev_ops *ops;
|
||||
const struct virtio_device_id *id_table;
|
||||
u64 config_attr_mask;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user