2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later
|
2020-06-21 13:17:34 +02:00
|
|
|
* Copyright © 2020 VMware, Inc. */
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <linux/if_link.h>
|
|
|
|
|
|
|
|
#include "conf-parser.h"
|
2020-09-29 19:24:02 +02:00
|
|
|
#include "ether-addr-util.h"
|
2020-06-21 13:17:34 +02:00
|
|
|
#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;
|
2020-06-22 12:26:31 +02:00
|
|
|
uint16_t vlan_proto; /* ETH_P_8021Q or ETH_P_8021AD */
|
2020-06-21 13:17:34 +02:00
|
|
|
int vf_spoof_check_setting;
|
|
|
|
int query_rss;
|
|
|
|
int trust;
|
|
|
|
SRIOVLinkState link_state;
|
2020-06-22 12:48:33 +02:00
|
|
|
struct ether_addr mac;
|
2020-06-21 13:17:34 +02:00
|
|
|
} SRIOV;
|
|
|
|
|
|
|
|
SRIOV *sr_iov_free(SRIOV *sr_iov);
|
2020-10-02 10:51:14 +02:00
|
|
|
int link_configure_sr_iov(Link *link);
|
2020-10-06 20:21:59 +02:00
|
|
|
void network_drop_invalid_sr_iov(Network *network);
|
2020-06-21 13:17:34 +02:00
|
|
|
|
|
|
|
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);
|
2020-06-22 12:26:31 +02:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_vlan_proto);
|
2020-06-22 12:48:33 +02:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_sr_iov_mac);
|