From: Carlos Bilbao <cbil...@digitalocean.com> Initialize speed and duplex for virtio_net_config to UNKNOWN (mlx5_vdpa vDPA devices currently do not support VIRTIO_NET_F_SPEED_DUPLEX). Include logic to update these fields (for VHOST_VDPA_SET_CONFIG) -- even if hardware support is not capable yet (Make a note of that). Also add warning messages for out of bounds errors in mlx5_vnet get/set_config logic.
Note: You can test these changes from user space passing a fd of your file "/dev/vhost-vdpa-%d" to: void check_config_speed_duplex(int fd) { uint8_t *buf; uint32_t size; struct vhost_vdpa_config *config; struct virtio_net_config *net_config; if (ioctl(fd, VHOST_VDPA_GET_CONFIG_SIZE, &size) < 0) { perror("ioctl failed"); return; } config = malloc(sizeof(struct vhost_vdpa_config) + size); if (!config) { perror("malloc failed"); return; } memset(config, 0, sizeof(struct vhost_vdpa_config) + size); config->len = size; config->off = 0; buf = config->buf; if (ioctl(fd, VHOST_VDPA_GET_CONFIG, config) < 0) { perror("ioctl failed"); } else { net_config = (struct virtio_net_config *)buf; printf(" Speed: %u Mb\n", net_config->speed); if (net_config->duplex == 0) printf(" Half Duplex\n); else if (net_config->duplex == 1) printf(" Full Duplex\n"); else printf(" Unknown Duplex\n"); } free(config); } Carlos Bilbao: mlx5_vnet: Set speed and duplex of vDPA devices to UNKNOWN vdpa: Add support to update speed/duplex in vDPA/mlx5_vnet --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 46 ++++++++++++++++++++++++++++++- drivers/vdpa/vdpa.c | 27 ++++++++++++++++++ include/uapi/linux/vdpa.h | 2 ++ 3 files changed, 74 insertions(+), 1 deletion(-)