mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Initialize vDPA speed/duplex and support their updates
@ 2024-08-29 16:16 Carlos Bilbao
  2024-08-29 16:16 ` [PATCH 1/2] mlx5_vnet: Set speed and duplex of vDPA devices to UNKNOWN Carlos Bilbao
  2024-08-29 16:16 ` [PATCH 2/2] vdpa: Add support to update speed/duplex in vDPA/mlx5_vnet Carlos Bilbao
  0 siblings, 2 replies; 11+ messages in thread
From: Carlos Bilbao @ 2024-08-29 16:16 UTC (permalink / raw)
  To: dtatulea, mst, jasowang
  Cc: bilbao, xuanzhuo, eperezma, cratiu, lingshan.zhu, virtualization,
	linux-kernel, Carlos Bilbao

From: Carlos Bilbao <cbilbao@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(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-09-03 16:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29 16:16 [PATCH 0/2] Initialize vDPA speed/duplex and support their updates Carlos Bilbao
2024-08-29 16:16 ` [PATCH 1/2] mlx5_vnet: Set speed and duplex of vDPA devices to UNKNOWN Carlos Bilbao
2024-08-29 18:44   ` Dragos Tatulea
2024-08-29 21:52     ` Carlos Bilbao
2024-08-29 16:16 ` [PATCH 2/2] vdpa: Add support to update speed/duplex in vDPA/mlx5_vnet Carlos Bilbao
2024-08-29 21:07   ` Dragos Tatulea
2024-08-29 22:38     ` Carlos Bilbao
2024-08-30  2:31     ` Jason Wang
2024-08-30 13:15       ` Carlos Bilbao
2024-09-02  4:27         ` Jason Wang
2024-09-03 16:01           ` Carlos Bilbao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®