public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/1] vdpa: Add support for setting the MAC address in vDPA tool
@ 2024-10-29  8:40 Cindy Lu
  2024-10-29  8:40 ` [PATCH v4 1/1] " Cindy Lu
  2024-10-29 23:30 ` [PATCH v4 0/1] " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Cindy Lu @ 2024-10-29  8:40 UTC (permalink / raw)
  To: lulu, dtatulea, mst, jasowang, parav, dsahern, netdev,
	linux-kernel

This patch is add support for set MAC address in vdpa tool

changset in v4
1. Sync with the latest upstream code.
2. Address the comments in v2 and remove the MTU-related code,
   as this part was missed in the previous version.
   
Tested in Mellanox ConnectX-6 Dx card

Cindy Lu (1):
  vdpa: Add support for setting the MAC address in vDPA tool.

 man/man8/vdpa-dev.8 | 20 ++++++++++++++++++++
 vdpa/vdpa.c         | 18 ++++++++++++++++++
 2 files changed, 38 insertions(+)

-- 
2.45.0


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

* [PATCH v4 1/1] vdpa: Add support for setting the MAC address in vDPA tool.
  2024-10-29  8:40 [PATCH v4 0/1] vdpa: Add support for setting the MAC address in vDPA tool Cindy Lu
@ 2024-10-29  8:40 ` Cindy Lu
  2024-10-29 23:30 ` [PATCH v4 0/1] " patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Cindy Lu @ 2024-10-29  8:40 UTC (permalink / raw)
  To: lulu, dtatulea, mst, jasowang, parav, dsahern, netdev,
	linux-kernel

Add a new function in vDPA tool to support set MAC address.
Currently, the kernel only supports setting the MAC address.

Update the man page to include usage for setting the MAC address.

The usage is: vdpa dev set name vdpa_name mac **:**:**:**:**

here is example:
root@L1# vdpa -jp dev config show vdpa0
{
    "config": {
        "vdpa0": {
            "mac": "82:4d:e9:5d:d7:e6",
            "link ": "up",
            "link_announce ": false,
            "mtu": 1500
        }
    }
}

root@L1# vdpa dev set name vdpa0 mac 00:11:22:33:44:55

root@L1# vdpa -jp dev config show vdpa0
{
    "config": {
        "vdpa0": {
            "mac": "00:11:22:33:44:55",
            "link ": "up",
            "link_announce ": false,
            "mtu": 1500
        }
    }
}

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 man/man8/vdpa-dev.8 | 20 ++++++++++++++++++++
 vdpa/vdpa.c         | 18 ++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/man/man8/vdpa-dev.8 b/man/man8/vdpa-dev.8
index 43e5bf48..718f40b2 100644
--- a/man/man8/vdpa-dev.8
+++ b/man/man8/vdpa-dev.8
@@ -50,6 +50,12 @@ vdpa-dev \- vdpa device configuration
 .B qidx
 .I QUEUE_INDEX
 
+.ti -8
+.B vdpa dev set
+.B name
+.I NAME
+.B mac
+.RI "[ " MACADDR " ]"
 
 .SH "DESCRIPTION"
 .SS vdpa dev show - display vdpa device attributes
@@ -120,6 +126,15 @@ VDPA_DEVICE_NAME
 .BI qidx " QUEUE_INDEX"
 - specifies the virtqueue index to query
 
+.SS vdpa dev set - set the configuration to the vdpa device.
+
+.BI name " NAME"
+-Name of the vdpa device to configure.
+
+.BI mac " MACADDR"
+- specifies the mac address for the vdpa device.
+This is applicable only for the network type of vdpa device.
+
 .SH "EXAMPLES"
 .PP
 vdpa dev show
@@ -171,6 +186,11 @@ vdpa dev vstats show vdpa0 qidx 1
 .RS 4
 Shows vendor specific statistics information for vdpa device vdpa0 and virtqueue index 1
 .RE
+.PP
+vdpa dev set name vdpa0 mac 00:11:22:33:44:55
+.RS 4
+Set a specific MAC address to vdpa device vdpa0
+.RE
 
 .SH SEE ALSO
 .BR vdpa (8),
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
index 43f87824..e2b0a5b1 100644
--- a/vdpa/vdpa.c
+++ b/vdpa/vdpa.c
@@ -759,6 +759,22 @@ static int cmd_dev_del(struct vdpa *vdpa,  int argc, char **argv)
 	return mnlu_gen_socket_sndrcv(&vdpa->nlg, nlh, NULL, NULL);
 }
 
+static int cmd_dev_set(struct vdpa *vdpa, int argc, char **argv)
+{
+	struct nlmsghdr *nlh;
+	int err;
+
+	nlh = mnlu_gen_socket_cmd_prepare(&vdpa->nlg, VDPA_CMD_DEV_ATTR_SET,
+					  NLM_F_REQUEST | NLM_F_ACK);
+	err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
+				  VDPA_OPT_VDEV_NAME,
+				  VDPA_OPT_VDEV_MAC);
+	if (err)
+		return err;
+
+	return mnlu_gen_socket_sndrcv(&vdpa->nlg, nlh, NULL, NULL);
+}
+
 static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
 {
 	SPRINT_BUF(macaddr);
@@ -1028,6 +1044,8 @@ static int cmd_dev(struct vdpa *vdpa, int argc, char **argv)
 		return cmd_dev_config(vdpa, argc - 1, argv + 1);
 	} else if (!strcmp(*argv, "vstats")) {
 		return cmd_dev_vstats(vdpa, argc - 1, argv + 1);
+	} else if (!strcmp(*argv, "set")) {
+		return cmd_dev_set(vdpa, argc - 1, argv + 1);
 	}
 	fprintf(stderr, "Command \"%s\" not found\n", *argv);
 	return -ENOENT;
-- 
2.45.0


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

* Re: [PATCH v4 0/1] vdpa: Add support for setting the MAC address in vDPA tool
  2024-10-29  8:40 [PATCH v4 0/1] vdpa: Add support for setting the MAC address in vDPA tool Cindy Lu
  2024-10-29  8:40 ` [PATCH v4 1/1] " Cindy Lu
@ 2024-10-29 23:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-29 23:30 UTC (permalink / raw)
  To: Cindy Lu; +Cc: dtatulea, mst, jasowang, parav, dsahern, netdev, linux-kernel

Hello:

This patch was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Tue, 29 Oct 2024 16:40:06 +0800 you wrote:
> This patch is add support for set MAC address in vdpa tool
> 
> changset in v4
> 1. Sync with the latest upstream code.
> 2. Address the comments in v2 and remove the MTU-related code,
>    as this part was missed in the previous version.
> 
> [...]

Here is the summary with links:
  - [v4,1/1] vdpa: Add support for setting the MAC address in vDPA tool.
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=9fe68807db20

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-10-29 23:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  8:40 [PATCH v4 0/1] vdpa: Add support for setting the MAC address in vDPA tool Cindy Lu
2024-10-29  8:40 ` [PATCH v4 1/1] " Cindy Lu
2024-10-29 23:30 ` [PATCH v4 0/1] " patchwork-bot+netdevbpf

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