1 /* SPDX-License-Identifier: LGPL-2.1+
2 * Copyright © 2020 VMware, Inc. */
5 #include <linux/if_link.h>
7 #include "conf-parser.h"
8 #include "networkd-link.h"
9 #include "networkd-network.h"
10 #include "networkd-util.h"
12 typedef enum SRIOVLinkState
{
13 SR_IOV_LINK_STATE_AUTO
= IFLA_VF_LINK_STATE_AUTO
,
14 SR_IOV_LINK_STATE_ENABLE
= IFLA_VF_LINK_STATE_ENABLE
,
15 SR_IOV_LINK_STATE_DISABLE
= IFLA_VF_LINK_STATE_DISABLE
,
16 _SR_IOV_LINK_STATE_MAX
,
17 _SR_IOV_LINK_STATE_INVALID
= -1,
20 typedef struct SRIOV
{
21 NetworkConfigSection
*section
;
24 uint32_t vf
; /* 0 - 2147483646 */
25 uint32_t vlan
; /* 0 - 4095, 0 disables VLAN filter */
27 uint16_t vlan_proto
; /* ETH_P_8021Q or ETH_P_8021AD */
28 int vf_spoof_check_setting
;
31 SRIOVLinkState link_state
;
32 struct ether_addr mac
;
35 SRIOV
*sr_iov_free(SRIOV
*sr_iov
);
37 int sr_iov_configure(Link
*link
, SRIOV
*sr_iov
);
38 int sr_iov_section_verify(SRIOV
*sr_iov
);
40 DEFINE_NETWORK_SECTION_FUNCTIONS(SRIOV
, sr_iov_free
);
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
);