import iproute-5.15.0-4.el8
This commit is contained in:
parent
28e53d790f
commit
743b1a03fc
397
SOURCES/0014-Update-kernel-headers-and-import-virtio_net.patch
Normal file
397
SOURCES/0014-Update-kernel-headers-and-import-virtio_net.patch
Normal file
@ -0,0 +1,397 @@
|
||||
From e62789f726b0d7fb1f3102e7cb26f2a59fd74231 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e62789f726b0d7fb1f3102e7cb26f2a59fd74231.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:01:57 +0100
|
||||
Subject: [PATCH] Update kernel headers and import virtio_net
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2.git commit 5cb7ec0c
|
||||
Conflicts: cherry-picked virtio_net header update, exclude unrelated bpf
|
||||
and mptcp parts.
|
||||
|
||||
commit 5cb7ec0c8d554a7ea32c2f924d7a2fc66af4544a
|
||||
Author: David Ahern <dsahern@kernel.org>
|
||||
Date: Sat Dec 18 14:00:29 2021 -0700
|
||||
|
||||
Update kernel headers and import virtio_net
|
||||
|
||||
Update kernel headers to commit:
|
||||
f85b244ee395 ("xdp: move the if dev statements to the first")
|
||||
|
||||
and import virtio_net.h for vdpa.
|
||||
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
include/uapi/linux/virtio_net.h | 358 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 358 insertions(+)
|
||||
create mode 100644 include/uapi/linux/virtio_net.h
|
||||
|
||||
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
|
||||
new file mode 100644
|
||||
index 00000000..ab08237f
|
||||
--- /dev/null
|
||||
+++ b/include/uapi/linux/virtio_net.h
|
||||
@@ -0,0 +1,358 @@
|
||||
+#ifndef _LINUX_VIRTIO_NET_H
|
||||
+#define _LINUX_VIRTIO_NET_H
|
||||
+/* 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 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 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 OF
|
||||
+ * SUCH DAMAGE. */
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/virtio_ids.h>
|
||||
+#include <linux/virtio_config.h>
|
||||
+#include <linux/virtio_types.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+
|
||||
+/* The feature bitmap for virtio net */
|
||||
+#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
|
||||
+#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
|
||||
+#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */
|
||||
+#define VIRTIO_NET_F_MTU 3 /* Initial MTU advice */
|
||||
+#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
|
||||
+#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
|
||||
+#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
|
||||
+#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
|
||||
+#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
|
||||
+#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
|
||||
+#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
|
||||
+#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
|
||||
+#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
|
||||
+#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
|
||||
+#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
|
||||
+#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
|
||||
+#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
|
||||
+#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
|
||||
+#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
|
||||
+#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
|
||||
+ * network */
|
||||
+#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
|
||||
+ * Steering */
|
||||
+#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
|
||||
+
|
||||
+#define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */
|
||||
+#define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */
|
||||
+#define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */
|
||||
+#define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device
|
||||
+ * with the same MAC.
|
||||
+ */
|
||||
+#define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */
|
||||
+
|
||||
+#ifndef VIRTIO_NET_NO_LEGACY
|
||||
+#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
|
||||
+#endif /* VIRTIO_NET_NO_LEGACY */
|
||||
+
|
||||
+#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
|
||||
+#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
|
||||
+
|
||||
+/* supported/enabled hash types */
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7)
|
||||
+#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8)
|
||||
+
|
||||
+struct virtio_net_config {
|
||||
+ /* The config defining mac address (if VIRTIO_NET_F_MAC) */
|
||||
+ __u8 mac[ETH_ALEN];
|
||||
+ /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
|
||||
+ __virtio16 status;
|
||||
+ /* Maximum number of each of transmit and receive queues;
|
||||
+ * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ.
|
||||
+ * Legal values are between 1 and 0x8000
|
||||
+ */
|
||||
+ __virtio16 max_virtqueue_pairs;
|
||||
+ /* Default maximum transmit unit advice */
|
||||
+ __virtio16 mtu;
|
||||
+ /*
|
||||
+ * speed, in units of 1Mb. All values 0 to INT_MAX are legal.
|
||||
+ * Any other value stands for unknown.
|
||||
+ */
|
||||
+ __le32 speed;
|
||||
+ /*
|
||||
+ * 0x00 - half duplex
|
||||
+ * 0x01 - full duplex
|
||||
+ * Any other value stands for unknown.
|
||||
+ */
|
||||
+ __u8 duplex;
|
||||
+ /* maximum size of RSS key */
|
||||
+ __u8 rss_max_key_size;
|
||||
+ /* maximum number of indirection table entries */
|
||||
+ __le16 rss_max_indirection_table_length;
|
||||
+ /* bitmask of supported VIRTIO_NET_RSS_HASH_ types */
|
||||
+ __le32 supported_hash_types;
|
||||
+} __attribute__((packed));
|
||||
+
|
||||
+/*
|
||||
+ * This header comes first in the scatter-gather list. If you don't
|
||||
+ * specify GSO or CSUM features, you can simply ignore the header.
|
||||
+ *
|
||||
+ * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf,
|
||||
+ * only flattened.
|
||||
+ */
|
||||
+struct virtio_net_hdr_v1 {
|
||||
+#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
|
||||
+#define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */
|
||||
+#define VIRTIO_NET_HDR_F_RSC_INFO 4 /* rsc info in csum_ fields */
|
||||
+ __u8 flags;
|
||||
+#define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */
|
||||
+#define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */
|
||||
+#define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */
|
||||
+#define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */
|
||||
+#define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */
|
||||
+ __u8 gso_type;
|
||||
+ __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
|
||||
+ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
|
||||
+ union {
|
||||
+ struct {
|
||||
+ __virtio16 csum_start;
|
||||
+ __virtio16 csum_offset;
|
||||
+ };
|
||||
+ /* Checksum calculation */
|
||||
+ struct {
|
||||
+ /* Position to start checksumming from */
|
||||
+ __virtio16 start;
|
||||
+ /* Offset after that to place checksum */
|
||||
+ __virtio16 offset;
|
||||
+ } csum;
|
||||
+ /* Receive Segment Coalescing */
|
||||
+ struct {
|
||||
+ /* Number of coalesced segments */
|
||||
+ __le16 segments;
|
||||
+ /* Number of duplicated acks */
|
||||
+ __le16 dup_acks;
|
||||
+ } rsc;
|
||||
+ };
|
||||
+ __virtio16 num_buffers; /* Number of merged rx buffers */
|
||||
+};
|
||||
+
|
||||
+struct virtio_net_hdr_v1_hash {
|
||||
+ struct virtio_net_hdr_v1 hdr;
|
||||
+ __le32 hash_value;
|
||||
+#define VIRTIO_NET_HASH_REPORT_NONE 0
|
||||
+#define VIRTIO_NET_HASH_REPORT_IPv4 1
|
||||
+#define VIRTIO_NET_HASH_REPORT_TCPv4 2
|
||||
+#define VIRTIO_NET_HASH_REPORT_UDPv4 3
|
||||
+#define VIRTIO_NET_HASH_REPORT_IPv6 4
|
||||
+#define VIRTIO_NET_HASH_REPORT_TCPv6 5
|
||||
+#define VIRTIO_NET_HASH_REPORT_UDPv6 6
|
||||
+#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7
|
||||
+#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8
|
||||
+#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9
|
||||
+ __le16 hash_report;
|
||||
+ __le16 padding;
|
||||
+};
|
||||
+
|
||||
+#ifndef VIRTIO_NET_NO_LEGACY
|
||||
+/* This header comes first in the scatter-gather list.
|
||||
+ * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
|
||||
+ * be the first element of the scatter-gather list. If you don't
|
||||
+ * specify GSO or CSUM features, you can simply ignore the header. */
|
||||
+struct virtio_net_hdr {
|
||||
+ /* See VIRTIO_NET_HDR_F_* */
|
||||
+ __u8 flags;
|
||||
+ /* See VIRTIO_NET_HDR_GSO_* */
|
||||
+ __u8 gso_type;
|
||||
+ __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
|
||||
+ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
|
||||
+ __virtio16 csum_start; /* Position to start checksumming from */
|
||||
+ __virtio16 csum_offset; /* Offset after that to place checksum */
|
||||
+};
|
||||
+
|
||||
+/* This is the version of the header to use when the MRG_RXBUF
|
||||
+ * feature has been negotiated. */
|
||||
+struct virtio_net_hdr_mrg_rxbuf {
|
||||
+ struct virtio_net_hdr hdr;
|
||||
+ __virtio16 num_buffers; /* Number of merged rx buffers */
|
||||
+};
|
||||
+#endif /* ...VIRTIO_NET_NO_LEGACY */
|
||||
+
|
||||
+/*
|
||||
+ * Control virtqueue data structures
|
||||
+ *
|
||||
+ * The control virtqueue expects a header in the first sg entry
|
||||
+ * and an ack/status response in the last entry. Data for the
|
||||
+ * command goes in between.
|
||||
+ */
|
||||
+struct virtio_net_ctrl_hdr {
|
||||
+ __u8 class;
|
||||
+ __u8 cmd;
|
||||
+} __attribute__((packed));
|
||||
+
|
||||
+typedef __u8 virtio_net_ctrl_ack;
|
||||
+
|
||||
+#define VIRTIO_NET_OK 0
|
||||
+#define VIRTIO_NET_ERR 1
|
||||
+
|
||||
+/*
|
||||
+ * Control the RX mode, ie. promisucous, allmulti, etc...
|
||||
+ * All commands require an "out" sg entry containing a 1 byte
|
||||
+ * state value, zero = disable, non-zero = enable. Commands
|
||||
+ * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature.
|
||||
+ * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA.
|
||||
+ */
|
||||
+#define VIRTIO_NET_CTRL_RX 0
|
||||
+ #define VIRTIO_NET_CTRL_RX_PROMISC 0
|
||||
+ #define VIRTIO_NET_CTRL_RX_ALLMULTI 1
|
||||
+ #define VIRTIO_NET_CTRL_RX_ALLUNI 2
|
||||
+ #define VIRTIO_NET_CTRL_RX_NOMULTI 3
|
||||
+ #define VIRTIO_NET_CTRL_RX_NOUNI 4
|
||||
+ #define VIRTIO_NET_CTRL_RX_NOBCAST 5
|
||||
+
|
||||
+/*
|
||||
+ * Control the MAC
|
||||
+ *
|
||||
+ * The MAC filter table is managed by the hypervisor, the guest should
|
||||
+ * assume the size is infinite. Filtering should be considered
|
||||
+ * non-perfect, ie. based on hypervisor resources, the guest may
|
||||
+ * received packets from sources not specified in the filter list.
|
||||
+ *
|
||||
+ * In addition to the class/cmd header, the TABLE_SET command requires
|
||||
+ * two out scatterlists. Each contains a 4 byte count of entries followed
|
||||
+ * by a concatenated byte stream of the ETH_ALEN MAC addresses. The
|
||||
+ * first sg list contains unicast addresses, the second is for multicast.
|
||||
+ * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature
|
||||
+ * is available.
|
||||
+ *
|
||||
+ * The ADDR_SET command requests one out scatterlist, it contains a
|
||||
+ * 6 bytes MAC address. This functionality is present if the
|
||||
+ * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
|
||||
+ */
|
||||
+struct virtio_net_ctrl_mac {
|
||||
+ __virtio32 entries;
|
||||
+ __u8 macs[][ETH_ALEN];
|
||||
+} __attribute__((packed));
|
||||
+
|
||||
+#define VIRTIO_NET_CTRL_MAC 1
|
||||
+ #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
|
||||
+ #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1
|
||||
+
|
||||
+/*
|
||||
+ * Control VLAN filtering
|
||||
+ *
|
||||
+ * The VLAN filter table is controlled via a simple ADD/DEL interface.
|
||||
+ * VLAN IDs not added may be filterd by the hypervisor. Del is the
|
||||
+ * opposite of add. Both commands expect an out entry containing a 2
|
||||
+ * byte VLAN ID. VLAN filterting is available with the
|
||||
+ * VIRTIO_NET_F_CTRL_VLAN feature bit.
|
||||
+ */
|
||||
+#define VIRTIO_NET_CTRL_VLAN 2
|
||||
+ #define VIRTIO_NET_CTRL_VLAN_ADD 0
|
||||
+ #define VIRTIO_NET_CTRL_VLAN_DEL 1
|
||||
+
|
||||
+/*
|
||||
+ * Control link announce acknowledgement
|
||||
+ *
|
||||
+ * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
|
||||
+ * driver has recevied the notification; device would clear the
|
||||
+ * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
|
||||
+ * this command.
|
||||
+ */
|
||||
+#define VIRTIO_NET_CTRL_ANNOUNCE 3
|
||||
+ #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
|
||||
+
|
||||
+/*
|
||||
+ * Control Receive Flow Steering
|
||||
+ */
|
||||
+#define VIRTIO_NET_CTRL_MQ 4
|
||||
+/*
|
||||
+ * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
|
||||
+ * enables Receive Flow Steering, specifying the number of the transmit and
|
||||
+ * receive queues that will be used. After the command is consumed and acked by
|
||||
+ * the device, the device will not steer new packets on receive virtqueues
|
||||
+ * other than specified nor read from transmit virtqueues other than specified.
|
||||
+ * Accordingly, driver should not transmit new packets on virtqueues other than
|
||||
+ * specified.
|
||||
+ */
|
||||
+struct virtio_net_ctrl_mq {
|
||||
+ __virtio16 virtqueue_pairs;
|
||||
+};
|
||||
+
|
||||
+ #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
|
||||
+ #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
|
||||
+ #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
|
||||
+
|
||||
+/*
|
||||
+ * The command VIRTIO_NET_CTRL_MQ_RSS_CONFIG has the same effect as
|
||||
+ * VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET does and additionally configures
|
||||
+ * the receive steering to use a hash calculated for incoming packet
|
||||
+ * to decide on receive virtqueue to place the packet. The command
|
||||
+ * also provides parameters to calculate a hash and receive virtqueue.
|
||||
+ */
|
||||
+struct virtio_net_rss_config {
|
||||
+ __le32 hash_types;
|
||||
+ __le16 indirection_table_mask;
|
||||
+ __le16 unclassified_queue;
|
||||
+ __le16 indirection_table[1/* + indirection_table_mask */];
|
||||
+ __le16 max_tx_vq;
|
||||
+ __u8 hash_key_length;
|
||||
+ __u8 hash_key_data[/* hash_key_length */];
|
||||
+};
|
||||
+
|
||||
+ #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1
|
||||
+
|
||||
+/*
|
||||
+ * The command VIRTIO_NET_CTRL_MQ_HASH_CONFIG requests the device
|
||||
+ * to include in the virtio header of the packet the value of the
|
||||
+ * calculated hash and the report type of hash. It also provides
|
||||
+ * parameters for hash calculation. The command requires feature
|
||||
+ * VIRTIO_NET_F_HASH_REPORT to be negotiated to extend the
|
||||
+ * layout of virtio header as defined in virtio_net_hdr_v1_hash.
|
||||
+ */
|
||||
+struct virtio_net_hash_config {
|
||||
+ __le32 hash_types;
|
||||
+ /* for compatibility with virtio_net_rss_config */
|
||||
+ __le16 reserved[4];
|
||||
+ __u8 hash_key_length;
|
||||
+ __u8 hash_key_data[/* hash_key_length */];
|
||||
+};
|
||||
+
|
||||
+ #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
|
||||
+
|
||||
+/*
|
||||
+ * Control network offloads
|
||||
+ *
|
||||
+ * Reconfigures the network offloads that Guest can handle.
|
||||
+ *
|
||||
+ * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit.
|
||||
+ *
|
||||
+ * Command data format matches the feature bit mask exactly.
|
||||
+ *
|
||||
+ * See VIRTIO_NET_F_GUEST_* for the list of offloads
|
||||
+ * that can be enabled/disabled.
|
||||
+ */
|
||||
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
|
||||
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
|
||||
+
|
||||
+#endif /* _LINUX_VIRTIO_NET_H */
|
||||
--
|
||||
2.35.1
|
||||
|
||||
51
SOURCES/0015-uapi-update-vdpa.h.patch
Normal file
51
SOURCES/0015-uapi-update-vdpa.h.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 28786edf9fd1e0d188190cb7029ddde2bdcd8ad8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <28786edf9fd1e0d188190cb7029ddde2bdcd8ad8.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] uapi: update vdpa.h
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2.git commit 885e281e
|
||||
|
||||
commit 885e281eadc238e30f7c3a42ad366ea123c03a83
|
||||
Author: Stephen Hemminger <stephen@networkplumber.org>
|
||||
Date: Fri Mar 11 19:16:25 2022 -0800
|
||||
|
||||
uapi: update vdpa.h
|
||||
|
||||
Update header from upstream.
|
||||
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
---
|
||||
vdpa/include/uapi/linux/vdpa.h | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/vdpa/include/uapi/linux/vdpa.h b/vdpa/include/uapi/linux/vdpa.h
|
||||
index b7eab069..cc575a82 100644
|
||||
--- a/vdpa/include/uapi/linux/vdpa.h
|
||||
+++ b/vdpa/include/uapi/linux/vdpa.h
|
||||
@@ -23,6 +23,9 @@ enum vdpa_command {
|
||||
enum vdpa_attr {
|
||||
VDPA_ATTR_UNSPEC,
|
||||
|
||||
+ /* Pad attribute for 64b alignment */
|
||||
+ VDPA_ATTR_PAD = 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 */
|
||||
@@ -40,6 +43,9 @@ enum vdpa_attr {
|
||||
VDPA_ATTR_DEV_NET_CFG_MAX_VQP, /* u16 */
|
||||
VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */
|
||||
|
||||
+ VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */
|
||||
+ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */
|
||||
+ VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */
|
||||
/* new attributes must be added above here */
|
||||
VDPA_ATTR_MAX,
|
||||
};
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
From a2ffc58207b80608f57299a297704d1e409829a5 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a2ffc58207b80608f57299a297704d1e409829a5.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] vdpa: Remove unsupported command line option
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2-next.git commit 2d1954c8
|
||||
|
||||
commit 2d1954c8a54b61ec271ab5b36976c4efdcf30066
|
||||
Author: Eli Cohen <elic@nvidia.com>
|
||||
Date: Sun Mar 13 19:12:16 2022 +0200
|
||||
|
||||
vdpa: Remove unsupported command line option
|
||||
|
||||
"-v[erbose]" option is not supported.
|
||||
Remove it.
|
||||
|
||||
Reviewed-by: Parav Pandit <parav@nvidia.com>
|
||||
Reviewed-by: Jianbo Liu <jianbol@mellanox.com>
|
||||
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
||||
Acked-by: Jason Wang <jasowang@redhat.com>
|
||||
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
vdpa/vdpa.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
|
||||
index f048e470..4ccb5648 100644
|
||||
--- a/vdpa/vdpa.c
|
||||
+++ b/vdpa/vdpa.c
|
||||
@@ -711,7 +711,7 @@ static void help(void)
|
||||
fprintf(stderr,
|
||||
"Usage: vdpa [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
"where OBJECT := { mgmtdev | dev }\n"
|
||||
- " OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] }\n");
|
||||
+ " OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] }\n");
|
||||
}
|
||||
|
||||
static int vdpa_cmd(struct vdpa *vdpa, int argc, char **argv)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,224 @@
|
||||
From fab19f1e5fe9ccf1d180874d5b0d86c99c7e16cb Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fab19f1e5fe9ccf1d180874d5b0d86c99c7e16cb.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] vdpa: Allow for printing negotiated features of a device
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2-next.git commit bd91c764
|
||||
|
||||
commit bd91c764718997adaa1d86eee5c585e67ca85356
|
||||
Author: Eli Cohen <elic@nvidia.com>
|
||||
Date: Sun Mar 13 19:12:17 2022 +0200
|
||||
|
||||
vdpa: Allow for printing negotiated features of a device
|
||||
|
||||
When reading the configuration of a vdpa device, check if the
|
||||
VDPA_ATTR_DEV_NEGOTIATED_FEATURES is available. If it is, parse the
|
||||
feature bits and print a string representation of each of the feature
|
||||
bits.
|
||||
|
||||
We keep the strings in two different arrays. One for net device related
|
||||
devices and one for generic feature bits.
|
||||
|
||||
In this patch we parse only net device specific features. Support for
|
||||
other devices can be added later. If the device queried is not a net
|
||||
device, we print its bit number only.
|
||||
|
||||
Examples:
|
||||
1. Standard presentation
|
||||
$ vdpa dev config show vdpa-a
|
||||
vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 2 mtu 9000
|
||||
negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
|
||||
CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
|
||||
|
||||
2. json output
|
||||
$ vdpa -j dev config show vdpa-a
|
||||
{"config":{"vdpa-a":{"mac":"00:00:00:00:88:88","link":"up","link_announce":false,\
|
||||
"max_vq_pairs":2,"mtu":9000,"negotiated_features":["CSUM","GUEST_CSUM",\
|
||||
"MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR",\
|
||||
"VERSION_1","ACCESS_PLATFORM"]}}}
|
||||
|
||||
3. Pretty json
|
||||
$ vdpa -jp dev config show vdpa-a
|
||||
{
|
||||
"config": {
|
||||
"vdpa-a": {
|
||||
"mac": "00:00:00:00:88:88",
|
||||
"link ": "up",
|
||||
"link_announce ": false,
|
||||
"max_vq_pairs": 2,
|
||||
"mtu": 9000,
|
||||
"negotiated_features": [
|
||||
"CSUM","GUEST_CSUM","MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ",\
|
||||
"MQ","CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com>
|
||||
Acked-by: Jason Wang <jasowang@redhat.com>
|
||||
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
vdpa/vdpa.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 103 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
|
||||
index 4ccb5648..40078b1c 100644
|
||||
--- a/vdpa/vdpa.c
|
||||
+++ b/vdpa/vdpa.c
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <linux/virtio_net.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <libmnl/libmnl.h>
|
||||
+#include <linux/virtio_ring.h>
|
||||
+#include <linux/virtio_config.h>
|
||||
#include "mnl_utils.h"
|
||||
#include <rt_names.h>
|
||||
|
||||
@@ -78,6 +80,7 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
|
||||
[VDPA_ATTR_DEV_VENDOR_ID] = MNL_TYPE_U32,
|
||||
[VDPA_ATTR_DEV_MAX_VQS] = MNL_TYPE_U32,
|
||||
[VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16,
|
||||
+ [VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64,
|
||||
};
|
||||
|
||||
static int attr_cb(const struct nlattr *attr, void *data)
|
||||
@@ -385,6 +388,94 @@ static const char *parse_class(int num)
|
||||
return class ? class : "< unknown class >";
|
||||
}
|
||||
|
||||
+static const char * const net_feature_strs[64] = {
|
||||
+ [VIRTIO_NET_F_CSUM] = "CSUM",
|
||||
+ [VIRTIO_NET_F_GUEST_CSUM] = "GUEST_CSUM",
|
||||
+ [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS] = "CTRL_GUEST_OFFLOADS",
|
||||
+ [VIRTIO_NET_F_MTU] = "MTU",
|
||||
+ [VIRTIO_NET_F_MAC] = "MAC",
|
||||
+ [VIRTIO_NET_F_GUEST_TSO4] = "GUEST_TSO4",
|
||||
+ [VIRTIO_NET_F_GUEST_TSO6] = "GUEST_TSO6",
|
||||
+ [VIRTIO_NET_F_GUEST_ECN] = "GUEST_ECN",
|
||||
+ [VIRTIO_NET_F_GUEST_UFO] = "GUEST_UFO",
|
||||
+ [VIRTIO_NET_F_HOST_TSO4] = "HOST_TSO4",
|
||||
+ [VIRTIO_NET_F_HOST_TSO6] = "HOST_TSO6",
|
||||
+ [VIRTIO_NET_F_HOST_ECN] = "HOST_ECN",
|
||||
+ [VIRTIO_NET_F_HOST_UFO] = "HOST_UFO",
|
||||
+ [VIRTIO_NET_F_MRG_RXBUF] = "MRG_RXBUF",
|
||||
+ [VIRTIO_NET_F_STATUS] = "STATUS",
|
||||
+ [VIRTIO_NET_F_CTRL_VQ] = "CTRL_VQ",
|
||||
+ [VIRTIO_NET_F_CTRL_RX] = "CTRL_RX",
|
||||
+ [VIRTIO_NET_F_CTRL_VLAN] = "CTRL_VLAN",
|
||||
+ [VIRTIO_NET_F_CTRL_RX_EXTRA] = "CTRL_RX_EXTRA",
|
||||
+ [VIRTIO_NET_F_GUEST_ANNOUNCE] = "GUEST_ANNOUNCE",
|
||||
+ [VIRTIO_NET_F_MQ] = "MQ",
|
||||
+ [VIRTIO_F_NOTIFY_ON_EMPTY] = "NOTIFY_ON_EMPTY",
|
||||
+ [VIRTIO_NET_F_CTRL_MAC_ADDR] = "CTRL_MAC_ADDR",
|
||||
+ [VIRTIO_F_ANY_LAYOUT] = "ANY_LAYOUT",
|
||||
+ [VIRTIO_NET_F_RSC_EXT] = "RSC_EXT",
|
||||
+ [VIRTIO_NET_F_HASH_REPORT] = "HASH_REPORT",
|
||||
+ [VIRTIO_NET_F_RSS] = "RSS",
|
||||
+ [VIRTIO_NET_F_STANDBY] = "STANDBY",
|
||||
+ [VIRTIO_NET_F_SPEED_DUPLEX] = "SPEED_DUPLEX",
|
||||
+};
|
||||
+
|
||||
+#define VIRTIO_F_IN_ORDER 35
|
||||
+#define VIRTIO_F_NOTIFICATION_DATA 38
|
||||
+#define VDPA_EXT_FEATURES_SZ (VIRTIO_TRANSPORT_F_END - \
|
||||
+ VIRTIO_TRANSPORT_F_START + 1)
|
||||
+
|
||||
+static const char * const ext_feature_strs[VDPA_EXT_FEATURES_SZ] = {
|
||||
+ [VIRTIO_RING_F_INDIRECT_DESC - VIRTIO_TRANSPORT_F_START] = "RING_INDIRECT_DESC",
|
||||
+ [VIRTIO_RING_F_EVENT_IDX - VIRTIO_TRANSPORT_F_START] = "RING_EVENT_IDX",
|
||||
+ [VIRTIO_F_VERSION_1 - VIRTIO_TRANSPORT_F_START] = "VERSION_1",
|
||||
+ [VIRTIO_F_ACCESS_PLATFORM - VIRTIO_TRANSPORT_F_START] = "ACCESS_PLATFORM",
|
||||
+ [VIRTIO_F_RING_PACKED - VIRTIO_TRANSPORT_F_START] = "RING_PACKED",
|
||||
+ [VIRTIO_F_IN_ORDER - VIRTIO_TRANSPORT_F_START] = "IN_ORDER",
|
||||
+ [VIRTIO_F_ORDER_PLATFORM - VIRTIO_TRANSPORT_F_START] = "ORDER_PLATFORM",
|
||||
+ [VIRTIO_F_SR_IOV - VIRTIO_TRANSPORT_F_START] = "SR_IOV",
|
||||
+ [VIRTIO_F_NOTIFICATION_DATA - VIRTIO_TRANSPORT_F_START] = "NOTIFICATION_DATA",
|
||||
+};
|
||||
+
|
||||
+static const char * const *dev_to_feature_str[] = {
|
||||
+ [VIRTIO_ID_NET] = net_feature_strs,
|
||||
+};
|
||||
+
|
||||
+#define NUM_FEATURE_BITS 64
|
||||
+
|
||||
+static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
|
||||
+ uint16_t dev_id)
|
||||
+{
|
||||
+ const char * const *feature_strs = NULL;
|
||||
+ const char *s;
|
||||
+ int i;
|
||||
+
|
||||
+ if (dev_id < ARRAY_SIZE(dev_to_feature_str))
|
||||
+ feature_strs = dev_to_feature_str[dev_id];
|
||||
+
|
||||
+ if (mgmtdevf)
|
||||
+ pr_out_array_start(vdpa, "dev_features");
|
||||
+ else
|
||||
+ pr_out_array_start(vdpa, "negotiated_features");
|
||||
+
|
||||
+ for (i = 0; i < NUM_FEATURE_BITS; i++) {
|
||||
+ if (!(features & (1ULL << i)))
|
||||
+ continue;
|
||||
+
|
||||
+ if (i < VIRTIO_TRANSPORT_F_START || i > VIRTIO_TRANSPORT_F_END)
|
||||
+ s = feature_strs ? feature_strs[i] : NULL;
|
||||
+ else
|
||||
+ s = ext_feature_strs[i - VIRTIO_TRANSPORT_F_START];
|
||||
+
|
||||
+ if (!s)
|
||||
+ print_uint(PRINT_ANY, NULL, " bit_%d", i);
|
||||
+ else
|
||||
+ print_string(PRINT_ANY, NULL, " %s", s);
|
||||
+ }
|
||||
+
|
||||
+ pr_out_array_end(vdpa);
|
||||
+}
|
||||
+
|
||||
static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
@@ -579,9 +670,10 @@ static int cmd_dev_del(struct vdpa *vdpa, int argc, char **argv)
|
||||
return mnlu_gen_socket_sndrcv(&vdpa->nlg, nlh, NULL, NULL);
|
||||
}
|
||||
|
||||
-static void pr_out_dev_net_config(struct nlattr **tb)
|
||||
+static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
|
||||
{
|
||||
SPRINT_BUF(macaddr);
|
||||
+ uint64_t val_u64;
|
||||
uint16_t val_u16;
|
||||
|
||||
if (tb[VDPA_ATTR_DEV_NET_CFG_MACADDR]) {
|
||||
@@ -610,6 +702,15 @@ static void pr_out_dev_net_config(struct nlattr **tb)
|
||||
val_u16 = mnl_attr_get_u16(tb[VDPA_ATTR_DEV_NET_CFG_MTU]);
|
||||
print_uint(PRINT_ANY, "mtu", "mtu %d ", val_u16);
|
||||
}
|
||||
+ if (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]) {
|
||||
+ uint16_t dev_id = 0;
|
||||
+
|
||||
+ if (tb[VDPA_ATTR_DEV_ID])
|
||||
+ dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
|
||||
+
|
||||
+ val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
|
||||
+ print_features(vdpa, val_u64, false, dev_id);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
|
||||
@@ -619,7 +720,7 @@ static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
|
||||
pr_out_vdev_handle_start(vdpa, tb);
|
||||
switch (device_id) {
|
||||
case VIRTIO_ID_NET:
|
||||
- pr_out_dev_net_config(tb);
|
||||
+ pr_out_dev_net_config(vdpa, tb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
From b49cd0103978e0e05ca5be4d7369ab62622ff42f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b49cd0103978e0e05ca5be4d7369ab62622ff42f.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] vdpa: Support for configuring max VQ pairs for a device
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2-next.git commit 16482fd4
|
||||
|
||||
commit 16482fd4df1132749575c49797c8d167c316d3f7
|
||||
Author: Eli Cohen <elic@nvidia.com>
|
||||
Date: Sun Mar 13 19:12:18 2022 +0200
|
||||
|
||||
vdpa: Support for configuring max VQ pairs for a device
|
||||
|
||||
Use VDPA_ATTR_DEV_MGMTDEV_MAX_VQS to specify max number of virtqueue
|
||||
pairs to configure for a vdpa device when adding a device.
|
||||
|
||||
Examples:
|
||||
1. Create a device with 3 virtqueue pairs:
|
||||
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 3
|
||||
|
||||
2. Read the configuration of a vdpa device
|
||||
$ vdpa dev config show vdpa-a
|
||||
vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 3 \
|
||||
mtu 1500
|
||||
negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
|
||||
CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
|
||||
|
||||
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
||||
Acked-by: Jason Wang <jasowang@redhat.com>
|
||||
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
vdpa/vdpa.c | 25 ++++++++++++++++++++++++-
|
||||
1 file changed, 24 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
|
||||
index 40078b1c..9985b6ca 100644
|
||||
--- a/vdpa/vdpa.c
|
||||
+++ b/vdpa/vdpa.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#define VDPA_OPT_VDEV_HANDLE BIT(3)
|
||||
#define VDPA_OPT_VDEV_MAC BIT(4)
|
||||
#define VDPA_OPT_VDEV_MTU BIT(5)
|
||||
+#define VDPA_OPT_MAX_VQP BIT(6)
|
||||
|
||||
struct vdpa_opts {
|
||||
uint64_t present; /* flags of present items */
|
||||
@@ -34,6 +35,7 @@ struct vdpa_opts {
|
||||
unsigned int device_id;
|
||||
char mac[ETH_ALEN];
|
||||
uint16_t mtu;
|
||||
+ uint16_t max_vqp;
|
||||
};
|
||||
|
||||
struct vdpa {
|
||||
@@ -81,6 +83,7 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
|
||||
[VDPA_ATTR_DEV_MAX_VQS] = MNL_TYPE_U32,
|
||||
[VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16,
|
||||
[VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64,
|
||||
+ [VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32,
|
||||
};
|
||||
|
||||
static int attr_cb(const struct nlattr *attr, void *data)
|
||||
@@ -222,6 +225,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa)
|
||||
sizeof(opts->mac), opts->mac);
|
||||
if (opts->present & VDPA_OPT_VDEV_MTU)
|
||||
mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MTU, opts->mtu);
|
||||
+ if (opts->present & VDPA_OPT_MAX_VQP)
|
||||
+ mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, opts->max_vqp);
|
||||
}
|
||||
|
||||
static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
|
||||
@@ -290,6 +295,14 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
|
||||
|
||||
NEXT_ARG_FWD();
|
||||
o_found |= VDPA_OPT_VDEV_MTU;
|
||||
+ } else if ((matches(*argv, "max_vqp") == 0) && (o_optional & VDPA_OPT_MAX_VQP)) {
|
||||
+ NEXT_ARG_FWD();
|
||||
+ err = vdpa_argv_u16(vdpa, argc, argv, &opts->max_vqp);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ NEXT_ARG_FWD();
|
||||
+ o_found |= VDPA_OPT_MAX_VQP;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown option \"%s\"\n", *argv);
|
||||
return -EINVAL;
|
||||
@@ -499,6 +512,14 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
||||
pr_out_array_end(vdpa);
|
||||
}
|
||||
|
||||
+ if (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS]) {
|
||||
+ uint32_t num_vqs;
|
||||
+
|
||||
+ print_nl();
|
||||
+ num_vqs = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS]);
|
||||
+ print_uint(PRINT_ANY, "max_supported_vqs", " max_supported_vqs %d", num_vqs);
|
||||
+ }
|
||||
+
|
||||
pr_out_handle_end(vdpa);
|
||||
}
|
||||
|
||||
@@ -559,6 +580,7 @@ static void cmd_dev_help(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: vdpa dev show [ DEV ]\n");
|
||||
fprintf(stderr, " vdpa dev add name NAME mgmtdev MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ]\n");
|
||||
+ fprintf(stderr, " [ max_vqp MAX_VQ_PAIRS ]\n");
|
||||
fprintf(stderr, " vdpa dev del DEV\n");
|
||||
fprintf(stderr, "Usage: vdpa dev config COMMAND [ OPTIONS ]\n");
|
||||
}
|
||||
@@ -648,7 +670,8 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv)
|
||||
NLM_F_REQUEST | NLM_F_ACK);
|
||||
err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
|
||||
VDPA_OPT_VDEV_MGMTDEV_HANDLE | VDPA_OPT_VDEV_NAME,
|
||||
- VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU);
|
||||
+ VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU |
|
||||
+ VDPA_OPT_MAX_VQP);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
99
SOURCES/0019-vdpa-Support-reading-device-features.patch
Normal file
99
SOURCES/0019-vdpa-Support-reading-device-features.patch
Normal file
@ -0,0 +1,99 @@
|
||||
From c98dd268d17c4faa19dac141f69597096bf0dfa4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c98dd268d17c4faa19dac141f69597096bf0dfa4.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] vdpa: Support reading device features
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2-next.git commit 56eb8bf4
|
||||
|
||||
commit 56eb8bf45aa3d509eb119201341d0323ea81ef84
|
||||
Author: Eli Cohen <elic@nvidia.com>
|
||||
Date: Sun Mar 13 19:12:19 2022 +0200
|
||||
|
||||
vdpa: Support reading device features
|
||||
|
||||
When showing the available management devices, check if
|
||||
VDPA_ATTR_DEV_SUPPORTED_FEATURES feature is available and print the
|
||||
supported features for a management device.
|
||||
|
||||
Examples:
|
||||
$ vdpa mgmtdev show
|
||||
auxiliary/mlx5_core.sf.1:
|
||||
supported_classes net
|
||||
max_supported_vqs 257
|
||||
dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
|
||||
CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
|
||||
|
||||
$ vdpa -jp mgmtdev show
|
||||
{
|
||||
"mgmtdev": {
|
||||
"auxiliary/mlx5_core.sf.1": {
|
||||
"supported_classes": [ "net" ],
|
||||
"max_supported_vqs": 257,
|
||||
"dev_features": [
|
||||
"CSUM","GUEST_CSUM","MTU","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ",\
|
||||
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
||||
Acked-by: Jason Wang <jasowang@redhat.com>
|
||||
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
vdpa/vdpa.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
|
||||
index 9985b6ca..3ae1b78f 100644
|
||||
--- a/vdpa/vdpa.c
|
||||
+++ b/vdpa/vdpa.c
|
||||
@@ -84,6 +84,7 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
|
||||
[VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16,
|
||||
[VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64,
|
||||
[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32,
|
||||
+ [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
|
||||
};
|
||||
|
||||
static int attr_cb(const struct nlattr *attr, void *data)
|
||||
@@ -492,14 +493,14 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
|
||||
static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
+ uint64_t classes = 0;
|
||||
const char *class;
|
||||
unsigned int i;
|
||||
|
||||
pr_out_handle_start(vdpa, tb);
|
||||
|
||||
if (tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]) {
|
||||
- uint64_t classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
|
||||
-
|
||||
+ classes = mnl_attr_get_u64(tb[VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES]);
|
||||
pr_out_array_start(vdpa, "supported_classes");
|
||||
|
||||
for (i = 1; i < 64; i++) {
|
||||
@@ -520,6 +521,16 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,
|
||||
print_uint(PRINT_ANY, "max_supported_vqs", " max_supported_vqs %d", num_vqs);
|
||||
}
|
||||
|
||||
+ if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]) {
|
||||
+ uint64_t features;
|
||||
+
|
||||
+ features = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES]);
|
||||
+ if (classes & BIT(VIRTIO_ID_NET))
|
||||
+ print_features(vdpa, features, true, VIRTIO_ID_NET);
|
||||
+ else
|
||||
+ print_features(vdpa, features, true, 0);
|
||||
+ }
|
||||
+
|
||||
pr_out_handle_end(vdpa);
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
From b72f22efc837d0c3e917186a4179158c35e9e690 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b72f22efc837d0c3e917186a4179158c35e9e690.1647872200.git.aclaudi@redhat.com>
|
||||
In-Reply-To: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
References: <b30268eda844bdebbb8e5e4f5735e3b1bb666368.1647872200.git.aclaudi@redhat.com>
|
||||
From: Andrea Claudi <aclaudi@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 15:03:16 +0100
|
||||
Subject: [PATCH] vdpa: Update man page with added support to configure max vq
|
||||
pair
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056827
|
||||
Upstream Status: iproute2-next.git commit 8130653d
|
||||
|
||||
commit 8130653dabe6726b46b7b19c31d85e33a67175e3
|
||||
Author: Eli Cohen <elic@nvidia.com>
|
||||
Date: Tue Mar 15 15:13:58 2022 +0200
|
||||
|
||||
vdpa: Update man page with added support to configure max vq pair
|
||||
|
||||
Update man page to include information how to configure the max
|
||||
virtqueue pairs for a vdpa device when creating one.
|
||||
|
||||
Signed-off-by: Eli Cohen <elic@nvidia.com>
|
||||
Signed-off-by: David Ahern <dsahern@kernel.org>
|
||||
---
|
||||
man/man8/vdpa-dev.8 | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/man/man8/vdpa-dev.8 b/man/man8/vdpa-dev.8
|
||||
index aa21ae3a..432867c6 100644
|
||||
--- a/man/man8/vdpa-dev.8
|
||||
+++ b/man/man8/vdpa-dev.8
|
||||
@@ -33,6 +33,7 @@ vdpa-dev \- vdpa device configuration
|
||||
.I MGMTDEV
|
||||
.RI "[ mac " MACADDR " ]"
|
||||
.RI "[ mtu " MTU " ]"
|
||||
+.RI "[ max_vqp " MAX_VQ_PAIRS " ]"
|
||||
|
||||
.ti -8
|
||||
.B vdpa dev del
|
||||
@@ -119,6 +120,11 @@ vdpa dev add name foo mgmtdev vdpa_sim_net mac 00:11:22:33:44:55 mtu 9000
|
||||
Add the vdpa device named foo on the management device vdpa_sim_net with mac address of 00:11:22:33:44:55 and mtu of 9000 bytes.
|
||||
.RE
|
||||
.PP
|
||||
+vdpa dev add name foo mgmtdev auxiliary/mlx5_core.sf.1 mac 00:11:22:33:44:55 max_vqp 8
|
||||
+.RS 4
|
||||
+Add the vdpa device named foo on the management device auxiliary/mlx5_core.sf.1 with mac address of 00:11:22:33:44:55 and max 8 virtqueue pairs
|
||||
+.RE
|
||||
+.PP
|
||||
vdpa dev del foo
|
||||
.RS 4
|
||||
Delete the vdpa device named foo which was previously created.
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: Advanced IP routing and network device configuration tools
|
||||
Name: iproute
|
||||
Version: 5.15.0
|
||||
Release: 3%{?dist}%{?buildid}
|
||||
Release: 4%{?dist}%{?buildid}
|
||||
%if 0%{?rhel}
|
||||
Group: Applications/System
|
||||
%endif
|
||||
@ -21,6 +21,13 @@ Patch9: 0010-vdpa-Enable-user-to-set-mac-address-of-vdpa-device.patc
|
||||
Patch10: 0011-vdpa-Enable-user-to-set-mtu-of-the-vdpa-device.patch
|
||||
Patch11: 0012-tc-u32-add-support-for-json-output.patch
|
||||
Patch12: 0013-tc-u32-add-json-support-in-print_raw-print_ipv4-prin.patch
|
||||
Patch13: 0014-Update-kernel-headers-and-import-virtio_net.patch
|
||||
Patch14: 0015-uapi-update-vdpa.h.patch
|
||||
Patch15: 0016-vdpa-Remove-unsupported-command-line-option.patch
|
||||
Patch16: 0017-vdpa-Allow-for-printing-negotiated-features-of-a-dev.patch
|
||||
Patch17: 0018-vdpa-Support-for-configuring-max-VQ-pairs-for-a-devi.patch
|
||||
Patch18: 0019-vdpa-Support-reading-device-features.patch
|
||||
Patch19: 0020-vdpa-Update-man-page-with-added-support-to-configure.patch
|
||||
|
||||
License: GPLv2+ and Public Domain
|
||||
BuildRequires: bison
|
||||
@ -139,6 +146,15 @@ cat %{SOURCE1} >>%{buildroot}%{_sysconfdir}/iproute2/rt_dsfield
|
||||
%{_includedir}/iproute2/bpf_elf.h
|
||||
|
||||
%changelog
|
||||
* Mon Mar 21 2022 Andrea Claudi <aclaudi@redhat.com> - 5.15.0-4.el8
|
||||
- vdpa: Update man page with added support to configure max vq pair (Andrea Claudi) [2056827]
|
||||
- vdpa: Support reading device features (Andrea Claudi) [2056827]
|
||||
- vdpa: Support for configuring max VQ pairs for a device (Andrea Claudi) [2056827]
|
||||
- vdpa: Allow for printing negotiated features of a device (Andrea Claudi) [2056827]
|
||||
- vdpa: Remove unsupported command line option (Andrea Claudi) [2056827]
|
||||
- uapi: update vdpa.h (Andrea Claudi) [2056827]
|
||||
- Update kernel headers and import virtio_net (Andrea Claudi) [2056827]
|
||||
|
||||
* Mon Feb 07 2022 Andrea Claudi <aclaudi@redhat.com> - 5.15.0-3.el8
|
||||
- tc: u32: add json support in `print_raw`, `print_ipv4`, `print_ipv6` (Andrea Claudi) [1989591]
|
||||
- tc: u32: add support for json output (Andrea Claudi) [1989591]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user