Skip to contentSkip to conversation

vdpa: Set speed and duplex of mlx5_vnet to UNKNOWN

PATCH In review Carlos Bilbao 5 participants 6 messages Aug 28, 2024 – Aug 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdpa: Set speed and duplex of mlx5_vnet to UNKNOWN

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
index fa78e8288ebb..319f5c6121de 100644
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 	init_rwsem(&ndev->reslock);
 	config = &ndev->config;
 
+	/*
+	 * mlx5_vdpa vDPA devices currently don't support reporting or
+	 * setting the speed or duplex.
+	 */
+	config->speed  = SPEED_UNKNOWN;
+	config->duplex = DUPLEX_UNKNOWN;
+
 	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
 		err = config_func_mtu(mdev, add_config->net.mtu);
 		if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	__le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	u8 duplex = DUPLEX_UNKNOWN;
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
 	struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 	if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
+	if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
include/uapi/linux/vdpa.h +2 -0
index 842bf1201ac4..1c64ee0dd7b1 100644
@@ -43,6 +43,8 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_NET_STATUS,		/* u8 */
 	VDPA_ATTR_DEV_NET_CFG_MAX_VQP,		/* u16 */
 	VDPA_ATTR_DEV_NET_CFG_MTU,		/* u16 */
+	VDPA_ATTR_DEV_NET_CFG_SPEED,		/* u32 */
+	VDPA_ATTR_DEV_NET_CFG_DUPLEX,		/* u8 */
 
 	VDPA_ATTR_DEV_NEGOTIATED_FEATURES,	/* u64 */
 	VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,		/* u32 */
Signature · 1 line
2.34.1
#1 lore raw
Quoted 84 lines · Carlos Bilbao

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
index fa78e8288ebb..319f5c6121de 100644
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
        init_rwsem(&ndev->reslock);
        config = &ndev->config;
 
+       /*
+        * mlx5_vdpa vDPA devices currently don't support reporting or
+        * setting the speed or duplex.
+        */
+       config->speed  = SPEED_UNKNOWN;
+       config->duplex = DUPLEX_UNKNOWN;
+
        if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
                err = config_func_mtu(mdev, add_config->net.mtu);
                if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
        return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+                                       struct virtio_net_config *config)
+{
+       __le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+       return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+                                       struct virtio_net_config *config)
+{
+       u8 duplex = DUPLEX_UNKNOWN;
+
+       return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
        struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
        if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
                return -EMSGSIZE;
 
+       if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+               return -EMSGSIZE;
+
+       if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+               return -EMSGSIZE;
+
        return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
include/uapi/linux/vdpa.h +0 -0
index 842bf1201ac4..1c64ee0dd7b1 100644

include/uapi/linux/vdpa.h enum vdpa_attr { · line 47

Quoted 5 lines
include/uapi/linux/vdpa.h +2 -0
@@ -43,6 +43,8 @@ enum vdpa_attr {
        VDPA_ATTR_DEV_NET_STATUS,               /* u8 */
        VDPA_ATTR_DEV_NET_CFG_MAX_VQP,          /* u16 */
        VDPA_ATTR_DEV_NET_CFG_MTU,              /* u16 */
+       VDPA_ATTR_DEV_NET_CFG_SPEED,            /* u32 */
+       VDPA_ATTR_DEV_NET_CFG_DUPLEX,           /* u8 */

This should be an independent patch as it allows vdpa tool to provision speed and duplex.

But a fundamental question is if we need such provisioning?

Thanks

Quoted 6 lines
include/uapi/linux/vdpa.h +0 -1
        VDPA_ATTR_DEV_NEGOTIATED_FEATURES,      /* u64 */
        VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,          /* u32 */
--

2.34.1

#2 lore raw
Quoted 81 lines · Jason Wang
Quoted 79 lines · Carlos Bilbao

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
index fa78e8288ebb..319f5c6121de 100644
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
        init_rwsem(&ndev->reslock);
        config = &ndev->config;
 
+       /*
+        * mlx5_vdpa vDPA devices currently don't support reporting or
+        * setting the speed or duplex.
+        */
+       config->speed  = SPEED_UNKNOWN;
+       config->duplex = DUPLEX_UNKNOWN;
+
        if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
                err = config_func_mtu(mdev, add_config->net.mtu);
                if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
        return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+                                       struct virtio_net_config *config)
+{
+       __le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+       return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+                                       struct virtio_net_config *config)
+{
+       u8 duplex = DUPLEX_UNKNOWN;
+
+       return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
        struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
        if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
                return -EMSGSIZE;
 
+       if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+               return -EMSGSIZE;
+
+       if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+               return -EMSGSIZE;
+
        return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
Quoted 13 lines

include/uapi/linux/vdpa.h enum vdpa_attr { · line 47

Quoted 10 lines
include/uapi/linux/vdpa.h +2 -0
index 842bf1201ac4..1c64ee0dd7b1 100644
@@ -43,6 +43,8 @@ enum vdpa_attr {
        VDPA_ATTR_DEV_NET_STATUS,               /* u8 */
        VDPA_ATTR_DEV_NET_CFG_MAX_VQP,          /* u16 */
        VDPA_ATTR_DEV_NET_CFG_MTU,              /* u16 */
+       VDPA_ATTR_DEV_NET_CFG_SPEED,            /* u32 */
+       VDPA_ATTR_DEV_NET_CFG_DUPLEX,           /* u8 */

This should be an independent patch as it allows vdpa tool to provision speed and duplex.

or same patch, but document this more clearly:
when subj starts with mlx5 I expect it only affects mlx5.

Quoted 1 line

But a fundamental question is if we need such provisioning?

why not?

Quoted 8 lines

Thanks

Quoted 6 lines
include/uapi/linux/vdpa.h +0 -1
        VDPA_ATTR_DEV_NEGOTIATED_FEATURES,      /* u64 */
        VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,          /* u32 */
--

2.34.1

#3 lore raw
In reply to Carlos Bilbao
Quoted 6 lines · Carlos Bilbao

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

As Jason points out, commit log and subject should says what the patch does.

Quoted 87 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
index fa78e8288ebb..319f5c6121de 100644
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 	init_rwsem(&ndev->reslock);
 	config = &ndev->config;
 
+	/*
+	 * mlx5_vdpa vDPA devices currently don't support reporting or
+	 * setting the speed or duplex.
+	 */
+	config->speed  = SPEED_UNKNOWN;
+	config->duplex = DUPLEX_UNKNOWN;
+
 	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
 		err = config_func_mtu(mdev, add_config->net.mtu);
 		if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	__le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	u8 duplex = DUPLEX_UNKNOWN;
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
 	struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 	if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
+	if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
include/uapi/linux/vdpa.h +2 -0
index 842bf1201ac4..1c64ee0dd7b1 100644
@@ -43,6 +43,8 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_NET_STATUS,		/* u8 */
 	VDPA_ATTR_DEV_NET_CFG_MAX_VQP,		/* u16 */
 	VDPA_ATTR_DEV_NET_CFG_MTU,		/* u16 */
+	VDPA_ATTR_DEV_NET_CFG_SPEED,		/* u32 */
+	VDPA_ATTR_DEV_NET_CFG_DUPLEX,		/* u8 */
 
 	VDPA_ATTR_DEV_NEGOTIATED_FEATURES,	/* u64 */
 	VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,		/* u32 */
Signature · 1 line
2.34.1
maintainer
#4 lore raw
In reply to Carlos Bilbao
Quoted 17 lines · Carlos Bilbao

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
index fa78e8288ebb..319f5c6121de 100644

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, · line 3804

Quoted 10 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 	init_rwsem(&ndev->reslock);
 	config = &ndev->config;
 
+	/*
+	 * mlx5_vdpa vDPA devices currently don't support reporting or
+	 * setting the speed or duplex.
+	 */
+	config->speed  = SPEED_UNKNOWN;
+	config->duplex = DUPLEX_UNKNOWN;
+

The values in virtio_net_config are little endian so you'll need to explicitly convert them. As speed is a u32, you'll need to add a cpu_to_mlx5vdpa32() helper.

Thanks,
Dragos

Quoted 64 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
 	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
 		err = config_func_mtu(mdev, add_config->net.mtu);
 		if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	__le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	u8 duplex = DUPLEX_UNKNOWN;
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
 	struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 	if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
+	if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
include/uapi/linux/vdpa.h +2 -0
index 842bf1201ac4..1c64ee0dd7b1 100644
@@ -43,6 +43,8 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_NET_STATUS,		/* u8 */
 	VDPA_ATTR_DEV_NET_CFG_MAX_VQP,		/* u16 */
 	VDPA_ATTR_DEV_NET_CFG_MTU,		/* u16 */
+	VDPA_ATTR_DEV_NET_CFG_SPEED,		/* u32 */
+	VDPA_ATTR_DEV_NET_CFG_DUPLEX,		/* u8 */
 
 	VDPA_ATTR_DEV_NEGOTIATED_FEATURES,	/* u64 */
 	VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,		/* u32 */
#5 lore raw

Hello,

Quoted 97 lines · Dragos Tatulea
Quoted 17 lines · Carlos Bilbao

From: Carlos Bilbao <[email protected]>

mlx5_vdpa vDPA devices currently don't support reporting or setting the speed and duplex and hence should be UNKNOWN instead of zero.

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  7 +++++++
 drivers/vdpa/vdpa.c               | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h         |  2 ++
 3 files changed, 32 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
index fa78e8288ebb..319f5c6121de 100644

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, · line 3804

Quoted 10 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +7 -0
@@ -3795,6 +3795,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 	init_rwsem(&ndev->reslock);
 	config = &ndev->config;
 
+	/*
+	 * mlx5_vdpa vDPA devices currently don't support reporting or
+	 * setting the speed or duplex.
+	 */
+	config->speed  = SPEED_UNKNOWN;
+	config->duplex = DUPLEX_UNKNOWN;
+

The values in virtio_net_config are little endian so you'll need to explicitly convert them. As speed is a u32, you'll need to add a cpu_to_mlx5vdpa32() helper.

Thanks,
Dragos

Quoted 62 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
 	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
 		err = config_func_mtu(mdev, add_config->net.mtu);
 		if (err)
drivers/vdpa/vdpa.c +23 -0
index 4dbd2e55a288..abde23e0041d 100644
@@ -15,6 +15,7 @@
 #include <net/genetlink.h>
 #include <linux/mod_devicetable.h>
 #include <linux/virtio_ids.h>
+#include <uapi/linux/ethtool.h>
 
 static LIST_HEAD(mdev_head);
 /* A global mutex that protects vdpa management device and device level operations. */
@@ -919,6 +920,22 @@ static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
 }
 
+static int vdpa_dev_net_speed_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	__le32 speed = cpu_to_le32(SPEED_UNKNOWN);
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_SPEED, sizeof(speed), &speed);
+}
+
+static int vdpa_dev_net_duplex_config_fill(struct sk_buff *msg, u64 features,
+					struct virtio_net_config *config)
+{
+	u8 duplex = DUPLEX_UNKNOWN;
+
+	return nla_put(msg, VDPA_ATTR_DEV_NET_CFG_DUPLEX, sizeof(duplex), &duplex);
+}
+
 static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
 {
 	struct virtio_net_config config = {};
@@ -941,6 +958,12 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 	if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_net_speed_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
+	if (vdpa_dev_net_duplex_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
include/uapi/linux/vdpa.h +2 -0
index 842bf1201ac4..1c64ee0dd7b1 100644
@@ -43,6 +43,8 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_NET_STATUS,		/* u8 */
 	VDPA_ATTR_DEV_NET_CFG_MAX_VQP,		/* u16 */
 	VDPA_ATTR_DEV_NET_CFG_MTU,		/* u16 */
+	VDPA_ATTR_DEV_NET_CFG_SPEED,		/* u32 */
+	VDPA_ATTR_DEV_NET_CFG_DUPLEX,		/* u8 */
 
Quoted 2 lines

include/uapi/linux/vdpa.h enum vdpa_attr { · line 50

Quoted 2 lines
include/uapi/linux/vdpa.h +0 -0
 	VDPA_ATTR_DEV_NEGOTIATED_FEATURES,	/* u64 */
 	VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,		/* u32 */

Thank you all for the feedback, everyone. I will prepare a patch set with two commits:

 - One to set speed and duplex to UNKNOWN (in little-endian format, thank you, Dragos).

 - Another to update the vDPA tool to allow setting the values for speed and duplex, including support in set_config(). I'll add a comment clarifying that this support isn't fully implemented at the hardware level yet.

Regards,
Carlos