]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-sriov.h
license: LGPL-2.1+ -> LGPL-2.1-or-later
[thirdparty/systemd.git] / src / network / networkd-sriov.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later
2 * Copyright © 2020 VMware, Inc. */
3 #pragma once
4
5 #include <linux/if_link.h>
6
7 #include "conf-parser.h"
8 #include "ether-addr-util.h"
9 #include "networkd-link.h"
10 #include "networkd-network.h"
11 #include "networkd-util.h"
12
13 typedef enum SRIOVLinkState {
14 SR_IOV_LINK_STATE_AUTO = IFLA_VF_LINK_STATE_AUTO,
15 SR_IOV_LINK_STATE_ENABLE = IFLA_VF_LINK_STATE_ENABLE,
16 SR_IOV_LINK_STATE_DISABLE = IFLA_VF_LINK_STATE_DISABLE,
17 _SR_IOV_LINK_STATE_MAX,
18 _SR_IOV_LINK_STATE_INVALID = -1,
19 } SRIOVLinkState;
20
21 typedef struct SRIOV {
22 NetworkConfigSection *section;
23 Network *network;
24
25 uint32_t vf; /* 0 - 2147483646 */
26 uint32_t vlan; /* 0 - 4095, 0 disables VLAN filter */
27 uint32_t qos;
28 uint16_t vlan_proto; /* ETH_P_8021Q or ETH_P_8021AD */
29 int vf_spoof_check_setting;
30 int query_rss;
31 int trust;
32 SRIOVLinkState link_state;
33 struct ether_addr mac;
34 } SRIOV;
35
36 SRIOV *sr_iov_free(SRIOV *sr_iov);
37 int link_configure_sr_iov(Link *link);
38 void network_drop_invalid_sr_iov(Network *network);
39
40 DEFINE_NETWORK_SECTION_FUNCTIONS(SRIOV, sr_iov_free);
41
42 CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_uint32);
43 CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_boolean);
44 CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_link_state);
45 CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_vlan_proto);
46 CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_mac);