summaryrefslogtreecommitdiff
path: root/src/network/networkd-sriov.h
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2020-06-21 11:17:34 +0000
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-07-01 13:51:33 +0900
commit518cd6b52700b1206ea2b268602b7da7073f160f (patch)
treeed3a13285ec67883b4816becd7ef87880ccc5e8a /src/network/networkd-sriov.h
parent5908ddd763509194d8a33e04d9fb43307bfe4cdd (diff)
downloadsystemd-518cd6b52700b1206ea2b268602b7da7073f160f.tar.gz
network: Introduce SR-IOV
SR-IOV provides the ability to partition a single physical PCI resource into virtual PCI functions which can then be injected in to a VM. In the case of network VFs, SR-IOV improves north-south n etwork performance (that is, traffic with endpoints outside the host machine) by allowing traffic to bypass the host machine’s network stack.
Diffstat (limited to 'src/network/networkd-sriov.h')
-rw-r--r--src/network/networkd-sriov.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/network/networkd-sriov.h b/src/network/networkd-sriov.h
new file mode 100644
index 0000000000..d9668d7b65
--- /dev/null
+++ b/src/network/networkd-sriov.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: LGPL-2.1+
+ * Copyright © 2020 VMware, Inc. */
+#pragma once
+
+#include <linux/if_link.h>
+
+#include "conf-parser.h"
+#include "networkd-link.h"
+#include "networkd-network.h"
+#include "networkd-util.h"
+
+typedef enum SRIOVLinkState {
+ SR_IOV_LINK_STATE_AUTO = IFLA_VF_LINK_STATE_AUTO,
+ SR_IOV_LINK_STATE_ENABLE = IFLA_VF_LINK_STATE_ENABLE,
+ SR_IOV_LINK_STATE_DISABLE = IFLA_VF_LINK_STATE_DISABLE,
+ _SR_IOV_LINK_STATE_MAX,
+ _SR_IOV_LINK_STATE_INVALID = -1,
+} SRIOVLinkState;
+
+typedef struct SRIOV {
+ NetworkConfigSection *section;
+ Network *network;
+
+ uint32_t vf; /* 0 - 2147483646 */
+ uint32_t vlan; /* 0 - 4095, 0 disables VLAN filter */
+ uint32_t qos;
+ int vf_spoof_check_setting;
+ int query_rss;
+ int trust;
+ SRIOVLinkState link_state;
+} SRIOV;
+
+SRIOV *sr_iov_free(SRIOV *sr_iov);
+
+int sr_iov_configure(Link *link, SRIOV *sr_iov);
+int sr_iov_section_verify(SRIOV *sr_iov);
+
+DEFINE_NETWORK_SECTION_FUNCTIONS(SRIOV, sr_iov_free);
+
+CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_uint32);
+CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_boolean);
+CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_link_state);