Skip to contentSkip to conversation

uapi: add missing virtio related headers

PATCH Applied Stephen Hemminger 5 participants 7 messages Apr 23, 2021 – Jun 15, 2021

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

PATCH 1/1 uapi: add missing virtio related headers

The build of iproute2 relies on having correct copy of santized kernel headers. The vdpa utility introduced a dependency on the vdpa related headers, but these headers were not present in iproute2 repo.

Fixes c2ecc82b9d4c ("vdpa: Add vdpa tool")
---
 include/uapi/linux/vdpa.h       | 40 +++++++++++++++++++++++
 include/uapi/linux/virtio_ids.h | 58 +++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 include/uapi/linux/vdpa.h
 create mode 100644 include/uapi/linux/virtio_ids.h
include/uapi/linux/vdpa.h new file +40 -0
new file mode 100644
index 000000000000..37ae26b6ba26
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+/*
+ * vdpa device management interface
+ * Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved.
+ */
+
+#ifndef _LINUX_VDPA_H_
+#define _LINUX_VDPA_H_
+
+#define VDPA_GENL_NAME "vdpa"
+#define VDPA_GENL_VERSION 0x1
+
+enum vdpa_command {
+	VDPA_CMD_UNSPEC,
+	VDPA_CMD_MGMTDEV_NEW,
+	VDPA_CMD_MGMTDEV_GET,		/* can dump */
+	VDPA_CMD_DEV_NEW,
+	VDPA_CMD_DEV_DEL,
+	VDPA_CMD_DEV_GET,		/* can dump */
+};
+
+enum vdpa_attr {
+	VDPA_ATTR_UNSPEC,
+
+	/* bus name (optional) + dev name together make the parent device handle */
+	VDPA_ATTR_MGMTDEV_BUS_NAME,		/* string */
+	VDPA_ATTR_MGMTDEV_DEV_NAME,		/* string */
+	VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,	/* u64 */
+
+	VDPA_ATTR_DEV_NAME,			/* string */
+	VDPA_ATTR_DEV_ID,			/* u32 */
+	VDPA_ATTR_DEV_VENDOR_ID,		/* u32 */
+	VDPA_ATTR_DEV_MAX_VQS,			/* u32 */
+	VDPA_ATTR_DEV_MAX_VQ_SIZE,		/* u16 */
+
+	/* new attributes must be added above here */
+	VDPA_ATTR_MAX,
+};
+
+#endif
include/uapi/linux/virtio_ids.h new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to iproute2/iproute2.git (refs/heads/main):

Hello:

This patch was applied to iproute2/iproute2.git (refs/heads/main):

Quoted 9 lines · On Fri, 23 Apr 2021 10:40:11 -0700 you wrote:

The build of iproute2 relies on having correct copy of santized kernel headers. The vdpa utility introduced a dependency on the vdpa related headers, but these headers were not present in iproute2 repo.

Fixes c2ecc82b9d4c ("vdpa: Add vdpa tool")

[...]

Here is the summary with links:
- [iproute2] uapi: add missing virtio related headers
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=b5a6ed9cc9fc

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

#2 lore raw
In reply to Stephen Hemminger

Hi Stephen,

vdpa headers were present in commit c2ecc82b9d4c at [1].

I added them at [1] after David's recommendation in [2].

Should we remove [1]?
Did you face compilation problem without this fix?

[1] ./vdpa/include/uapi/linux/vdpa.h
[2] https://lore.kernel.org/netdev/[email protected]/

Parav

Quoted 152 lines

From: Stephen Hemminger <[email protected]>
Sent: Friday, April 23, 2021 11:10 PM

The build of iproute2 relies on having correct copy of santized kernel headers. The vdpa utility introduced a dependency on the vdpa related headers, but these headers were not present in iproute2 repo.

Fixes c2ecc82b9d4c ("vdpa: Add vdpa tool")
---
 include/uapi/linux/vdpa.h       | 40 +++++++++++++++++++++++
 include/uapi/linux/virtio_ids.h | 58
+++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 include/uapi/linux/vdpa.h  create mode 100644

include/uapi/linux/virtio_ids.h

include/uapi/linux/vdpa.h new file renamed from include/uapi/linux/vdpa.h +0 -0

mode 100644 index 000000000000..37ae26b6ba26

include/uapi/linux/vdpa.h new file +25 -0
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+/*
+ * vdpa device management interface
+ * Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved.
+ */
+
+#ifndef _LINUX_VDPA_H_
+#define _LINUX_VDPA_H_
+
+#define VDPA_GENL_NAME "vdpa"
+#define VDPA_GENL_VERSION 0x1
+
+enum vdpa_command {
+	VDPA_CMD_UNSPEC,
+	VDPA_CMD_MGMTDEV_NEW,
+	VDPA_CMD_MGMTDEV_GET,		/* can dump */
+	VDPA_CMD_DEV_NEW,
+	VDPA_CMD_DEV_DEL,
+	VDPA_CMD_DEV_GET,		/* can dump */
+};
+
+enum vdpa_attr {
+	VDPA_ATTR_UNSPEC,
+
+	/* bus name (optional) + dev name together make the parent device

handle */

include/uapi/linux/vdpa.h new file +15 -0
+	VDPA_ATTR_MGMTDEV_BUS_NAME,		/* string */
+	VDPA_ATTR_MGMTDEV_DEV_NAME,		/* string */
+	VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,	/* u64 */
+
+	VDPA_ATTR_DEV_NAME,			/* string */
+	VDPA_ATTR_DEV_ID,			/* u32 */
+	VDPA_ATTR_DEV_VENDOR_ID,		/* u32 */
+	VDPA_ATTR_DEV_MAX_VQS,			/* u32 */
+	VDPA_ATTR_DEV_MAX_VQ_SIZE,		/* u16 */
+
+	/* new attributes must be added above here */
+	VDPA_ATTR_MAX,
+};
+
+#endif
include/uapi/linux/virtio_ids.h new file +19 -0
new file mode 100644 index 000000000000..bc1c0621f5ed
@@ -0,0 +1,58 @@
+#ifndef _LINUX_VIRTIO_IDS_H
+#define _LINUX_VIRTIO_IDS_H
+/*
+ * Virtio IDs
+ *
+ * This header is BSD licensed so anyone can use the definitions to
+implement
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this

software
+ * without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR

include/uapi/linux/virtio_ids.h new file +5 -0
+PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

SUBSTITUTE

include/uapi/linux/virtio_ids.h new file +4 -0
+GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

CONTRACT,
+STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY

include/uapi/linux/virtio_ids.h new file +10 -0
+OF
+ * SUCH DAMAGE. */
+
+#define VIRTIO_ID_NET			1 /* virtio net */
+#define VIRTIO_ID_BLOCK			2 /* virtio block */
+#define VIRTIO_ID_CONSOLE		3 /* virtio console */
+#define VIRTIO_ID_RNG			4 /* virtio rng */
+#define VIRTIO_ID_BALLOON		5 /* virtio balloon */
+#define VIRTIO_ID_IOMEM			6 /* virtio ioMemory */
+#define VIRTIO_ID_RPMSG			7 /* virtio remote processor

messaging */

include/uapi/linux/virtio_ids.h new file +3 -0
+#define VIRTIO_ID_SCSI			8 /* virtio scsi */
+#define VIRTIO_ID_9P			9 /* 9p virtio console */
+#define VIRTIO_ID_MAC80211_WLAN		10 /* virtio WLAN

MAC */
+#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial
link */

include/uapi/linux/virtio_ids.h new file +2 -0
+#define VIRTIO_ID_CAIF			12 /* Virtio caif */
+#define VIRTIO_ID_MEMORY_BALLOON	13 /* virtio memory balloon

*/

include/uapi/linux/virtio_ids.h new file +6 -0
+#define VIRTIO_ID_GPU			16 /* virtio GPU */
+#define VIRTIO_ID_CLOCK			17 /* virtio clock/timer */
+#define VIRTIO_ID_INPUT			18 /* virtio input */
+#define VIRTIO_ID_VSOCK			19 /* virtio vsock transport */
+#define VIRTIO_ID_CRYPTO		20 /* virtio crypto */
+#define VIRTIO_ID_SIGNAL_DIST		21 /* virtio signal distribution

device */

include/uapi/linux/virtio_ids.h new file +6 -0
+#define VIRTIO_ID_PSTORE		22 /* virtio pstore device */
+#define VIRTIO_ID_IOMMU			23 /* virtio IOMMU */
+#define VIRTIO_ID_MEM			24 /* virtio mem */
+#define VIRTIO_ID_FS			26 /* virtio filesystem */
+#define VIRTIO_ID_PMEM			27 /* virtio pmem */
+#define VIRTIO_ID_MAC80211_HWSIM	29 /* virtio mac80211-hwsim

*/

include/uapi/linux/virtio_ids.h new file +2 -1
+
+#endif /* _LINUX_VIRTIO_IDS_H */
--

2.30.2

#3 lore raw
Quoted 6 lines · Parav Pandit

Hi Stephen,

vdpa headers were present in commit c2ecc82b9d4c at [1].

I added them at [1] after David's recommendation in [2].

Quoted 7 lines

Should we remove [1]?
Did you face compilation problem without this fix?

[1] ./vdpa/include/uapi/linux/vdpa.h
[2] https://lore.kernel.org/netdev/[email protected]/

Parav

Stephen: Did you hit a compile issue? vdpa goes beyond networking and features go through other trees AIUI so the decision was to put the uapi file under the vdpa command similar to what rdma is doing.

#4 lore raw
Quoted 10 lines · On Thu, 10 Jun 2021 20:54:45 -0600 David Ahern <[email protected]> wrote:
Quoted 9 lines · Parav Pandit

Hi Stephen,

vdpa headers were present in commit c2ecc82b9d4c at [1].

I added them at [1] after David's recommendation in [2].

Should we remove [1]?
Did you face compilation problem without this fix?

Quoted 9 lines
Quoted 4 lines

[1] ./vdpa/include/uapi/linux/vdpa.h
[2] https://lore.kernel.org/netdev/[email protected]/

Parav

Stephen: Did you hit a compile issue? vdpa goes beyond networking and features go through other trees AIUI so the decision was to put the uapi file under the vdpa command similar to what rdma is doing.

In iproute2, all kernel headers used during the build should come from include/uapi. If new command or function needs a new header, then the sanitized version should be included.

I update these with an automated script, and making special case for vdpa seems to be needless effort. Please just let iproute's include/uapi just be a copy of what kernel "make install_headers" generates.

#5 lore raw
Quoted 23 lines · Stephen Hemminger
Quoted 10 lines · On Thu, 10 Jun 2021 20:54:45 -0600 David Ahern <[email protected]> wrote:
Quoted 9 lines · Parav Pandit

Hi Stephen,

vdpa headers were present in commit c2ecc82b9d4c at [1].

I added them at [1] after David's recommendation in [2].

Should we remove [1]?
Did you face compilation problem without this fix?

Quoted 9 lines
Quoted 4 lines

[1] ./vdpa/include/uapi/linux/vdpa.h
[2] https://lore.kernel.org/netdev/[email protected]/

Parav

Stephen: Did you hit a compile issue? vdpa goes beyond networking and features go through other trees AIUI so the decision was to put the uapi file under the vdpa command similar to what rdma is doing.

Quoted 8 lines

In iproute2, all kernel headers used during the build should come from include/uapi. If new command or function needs a new header, then the sanitized version should be included.

I update these with an automated script, and making special case for vdpa seems to be needless effort. Please just let iproute's include/uapi just be a copy of what kernel "make install_headers" generates.

an exception was made for rdma because of the order in which uapi updates hit the net-next tree. The same exception was being made for vdpa for the same reason.

#6 lore raw
Quoted 28 lines · David Ahern
Quoted 27 lines · Stephen Hemminger
Quoted 10 lines · On Thu, 10 Jun 2021 20:54:45 -0600 David Ahern <[email protected]> wrote:
Quoted 9 lines · Parav Pandit

Hi Stephen,

vdpa headers were present in commit c2ecc82b9d4c at [1].

I added them at [1] after David's recommendation in [2].

Should we remove [1]?
Did you face compilation problem without this fix?

Quoted 9 lines
Quoted 4 lines

[1] ./vdpa/include/uapi/linux/vdpa.h
[2] https://lore.kernel.org/netdev/[email protected]/

Parav

Stephen: Did you hit a compile issue? vdpa goes beyond networking and features go through other trees AIUI so the decision was to put the uapi file under the vdpa command similar to what rdma is doing.

In iproute2, all kernel headers used during the build should come from include/uapi. If new command or function needs a new header, then the sanitized version should be included.

Quoted 8 lines
Quoted 4 lines

I update these with an automated script, and making special case for vdpa seems to be needless effort. Please just let iproute's include/uapi just be a copy of what kernel "make install_headers" generates.

an exception was made for rdma because of the order in which uapi updates hit the net-next tree. The same exception was being made for vdpa for the same reason.

Right, and almost all RDMA features are accompanied by the commit like this which brings headers cycle earlier than they will appear in net-next.

commit 212e2c1d0cb27f0d1f87b9cc6454b8afbeb2d467

Author: Gal Pressman <[email protected]>
Date:   Thu Apr 29 09:48:02 2021 +0300

rdma: update uapi headers

Update rdma_netlink.h file upto kernel commit
6cc9e215eb27 ("RDMA/nldev: Add copy-on-fork attribute to get sys command")