1 /* SPDX-License-Identifier: LGPL-2.1-or-later
2 * Copyright © 2020 VMware, Inc. */
5 #include <linux/if_link.h>
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"
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,
21 typedef struct SRIOV
{
22 NetworkConfigSection
*section
;
25 uint32_t vf
; /* 0 - 2147483646 */
26 uint32_t vlan
; /* 0 - 4095, 0 disables VLAN filter */
28 uint16_t vlan_proto
; /* ETH_P_8021Q or ETH_P_8021AD */
29 int vf_spoof_check_setting
;
32 SRIOVLinkState link_state
;
33 struct ether_addr mac
;
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
);
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
);