summaryrefslogtreecommitdiff
path: root/src/network/networkd-sriov.h
blob: d9668d7b65fd975b39a41d0a7e77395932df9c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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);