History

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>

Parav Pandit committed 5 years ago

Commit d8ca2fa1 parent 960deb37 files · +62 −8Browse files

Showing the changes to include (1 of 7 files). Show all

Unified · Split

include/linux/vdpa.h+16−1
@@ -6,6 +6,8 @@ · 5 unmodified lines
6#include <linux/device.h>6#include <linux/device.h>
7#include <linux/interrupt.h>7#include <linux/interrupt.h>
8#include <linux/vhost_iotlb.h>8#include <linux/vhost_iotlb.h>
9#include <linux/virtio_net.h>
10#include <linux/if_ether.h>
9 11
10/**12/**
11 * struct vdpa_calllback - vDPA callback definition.13 * struct vdpa_calllback - vDPA callback definition.
@@ -93,6 +95,14 @@ struct vdpa_iova_range { · 81 unmodified lines
93 u64 last;95 u64 last;
94};96};
95 97
98struct vdpa_dev_set_config {
99 struct {
100 u8 mac[ETH_ALEN];
101 u16 mtu;
102 } net;
103 u64 mask;
104};
105
96/**106/**
97 * Corresponding file area for device memory mapping107 * Corresponding file area for device memory mapping
98 * @file: vma->vm_file for the mapping108 * @file: vma->vm_file for the mapping
@@ -397,6 +407,7 @@ void vdpa_set_config(struct vdpa_device *dev, unsigned int offset, · 298 unmodified lines
397 * @dev_add: Add a vdpa device using alloc and register407 * @dev_add: Add a vdpa device using alloc and register
398 * @mdev: parent device to use for device addition408 * @mdev: parent device to use for device addition
399 * @name: name of the new vdpa device409 * @name: name of the new vdpa device
410 * @config: config attributes to apply to the device under creation
400 * Driver need to add a new device using _vdpa_register_device()411 * Driver need to add a new device using _vdpa_register_device()
401 * after fully initializing the vdpa device. Driver must return 0412 * after fully initializing the vdpa device. Driver must return 0
402 * on success or appropriate error code.413 * on success or appropriate error code.
@@ -407,7 +418,8 @@ void vdpa_set_config(struct vdpa_device *dev, unsigned int offset, · 4 unmodified lines
407 * _vdpa_unregister_device().418 * _vdpa_unregister_device().
408 */419 */
409struct vdpa_mgmtdev_ops {420struct vdpa_mgmtdev_ops {
410 int (*dev_add)(struct vdpa_mgmt_dev *mdev, const char *name);421 int (*dev_add)(struct vdpa_mgmt_dev *mdev, const char *name,
422 const struct vdpa_dev_set_config *config);
411 void (*dev_del)(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev);423 void (*dev_del)(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev);
412};424};
413 425
@@ -416,12 +428,15 @@ struct vdpa_mgmtdev_ops { · 2 unmodified lines
416 * @device: Management parent device428 * @device: Management parent device
417 * @ops: operations supported by management device429 * @ops: operations supported by management device
418 * @id_table: Pointer to device id table of supported ids430 * @id_table: Pointer to device id table of supported ids
431 * @config_attr_mask: bit mask of attributes of type enum vdpa_attr that
432 * management device support during dev_add callback
419 * @list: list entry433 * @list: list entry
420 */434 */
421struct vdpa_mgmt_dev {435struct vdpa_mgmt_dev {
422 struct device *device;436 struct device *device;
423 const struct vdpa_mgmtdev_ops *ops;437 const struct vdpa_mgmtdev_ops *ops;
424 const struct virtio_device_id *id_table;438 const struct virtio_device_id *id_table;
439 u64 config_attr_mask;
425 struct list_head list;440 struct list_head list;
426};441};
427 442

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t