mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Carlos Bilbao <carlos.bilbao.osdev@gmail.com>
To: dtatulea@nvidia.com, mst@redhat.com, jasowang@redhat.com
Cc: bilbao@vt.edu, xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
	cratiu@nvidia.com, lingshan.zhu@intel.com,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	Carlos Bilbao <cbilbao@digitalocean.com>
Subject: [PATCH 0/2] Initialize vDPA speed/duplex and support their updates
Date: Thu, 29 Aug 2024 11:16:18 -0500	[thread overview]
Message-ID: <20240829161620.38679-1-carlos.bilbao.osdev@gmail.com> (raw)

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(-)


             reply	other threads:[~2024-08-29 16:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 16:16 Carlos Bilbao [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240829161620.38679-1-carlos.bilbao.osdev@gmail.com \
    --to=carlos.bilbao.osdev@gmail.com \
    --cc=bilbao@vt.edu \
    --cc=cbilbao@digitalocean.com \
    --cc=cratiu@nvidia.com \
    --cc=dtatulea@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®