1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2018 Red Hat, Inc.
4 */
5
6#ifndef NM_SETTING_SRIOV_H
7#define NM_SETTING_SRIOV_H
8
9#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
10#error "Only <NetworkManager.h> can be included directly."
11#endif
12
13#include "nm-setting.h"
14
15G_BEGIN_DECLS
16
17#define NM_TYPE_SETTING_SRIOV (nm_setting_sriov_get_type())
18#define NM_SETTING_SRIOV(obj) \
19 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_SRIOV, NMSettingSriov))
20#define NM_SETTING_SRIOV_CLASS(klass) \
21 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_SRIOV, NMSettingSriovClass))
22#define NM_IS_SETTING_SRIOV(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_SRIOV))
23#define NM_IS_SETTING_SRIOV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_SRIOV))
24#define NM_SETTING_SRIOV_GET_CLASS(obj) \
25 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_SRIOV, NMSettingSriovClass))
26
27#define NM_SETTING_SRIOV_SETTING_NAME "sriov"
28
29#define NM_SETTING_SRIOV_TOTAL_VFS "total-vfs"
30#define NM_SETTING_SRIOV_VFS "vfs"
31#define NM_SETTING_SRIOV_AUTOPROBE_DRIVERS "autoprobe-drivers"
32
33#define NM_SRIOV_VF_ATTRIBUTE_MAC "mac"
34#define NM_SRIOV_VF_ATTRIBUTE_SPOOF_CHECK "spoof-check"
35#define NM_SRIOV_VF_ATTRIBUTE_TRUST "trust"
36#define NM_SRIOV_VF_ATTRIBUTE_MIN_TX_RATE "min-tx-rate"
37#define NM_SRIOV_VF_ATTRIBUTE_MAX_TX_RATE "max-tx-rate"
38
39typedef struct _NMSettingSriovClass NMSettingSriovClass;
40typedef struct _NMSriovVF NMSriovVF;
41
42/**
43 * NMSriovVFVlanProtocol:
44 * @NM_SRIOV_VF_VLAN_PROTOCOL_802_1Q: use 802.1Q
45 * @NM_SRIOV_VF_VLAN_PROTOCOL_802_1AD: use 802.1ad
46 *
47 * #NMSriovVFVlanProtocol indicates the VLAN protocol to use.
48 *
49 * Since: 1.14
50 */
51typedef enum {
52 NM_SRIOV_VF_VLAN_PROTOCOL_802_1Q = 0,
53 NM_SRIOV_VF_VLAN_PROTOCOL_802_1AD = 1,
54} NMSriovVFVlanProtocol;
55
56NM_AVAILABLE_IN_1_14
57GType nm_setting_sriov_get_type(void);
58NM_AVAILABLE_IN_1_14
59NMSetting *nm_setting_sriov_new(void);
60NM_AVAILABLE_IN_1_14
61guint nm_setting_sriov_get_total_vfs(NMSettingSriov *setting);
62NM_AVAILABLE_IN_1_14
63guint nm_setting_sriov_get_num_vfs(NMSettingSriov *setting);
64NM_AVAILABLE_IN_1_14
65NMSriovVF *nm_setting_sriov_get_vf(NMSettingSriov *setting, guint idx);
66NM_AVAILABLE_IN_1_14
67void nm_setting_sriov_add_vf(NMSettingSriov *setting, NMSriovVF *vf);
68NM_AVAILABLE_IN_1_14
69void nm_setting_sriov_remove_vf(NMSettingSriov *setting, guint idx);
70NM_AVAILABLE_IN_1_14
71gboolean nm_setting_sriov_remove_vf_by_index(NMSettingSriov *setting, guint index);
72NM_AVAILABLE_IN_1_14
73void nm_setting_sriov_clear_vfs(NMSettingSriov *setting);
74NM_AVAILABLE_IN_1_14
75NMTernary nm_setting_sriov_get_autoprobe_drivers(NMSettingSriov *setting);
76
77NM_AVAILABLE_IN_1_14
78gboolean nm_sriov_vf_add_vlan(NMSriovVF *vf, guint vlan_id);
79NM_AVAILABLE_IN_1_14
80gboolean nm_sriov_vf_remove_vlan(NMSriovVF *vf, guint vlan_id);
81NM_AVAILABLE_IN_1_14
82const guint *nm_sriov_vf_get_vlan_ids(const NMSriovVF *vf, guint *length);
83NM_AVAILABLE_IN_1_14
84void nm_sriov_vf_set_vlan_qos(NMSriovVF *vf, guint vlan_id, guint32 qos);
85NM_AVAILABLE_IN_1_14
86void nm_sriov_vf_set_vlan_protocol(NMSriovVF *vf, guint vlan_id, NMSriovVFVlanProtocol protocol);
87NM_AVAILABLE_IN_1_14
88guint32 nm_sriov_vf_get_vlan_qos(const NMSriovVF *vf, guint vlan_id);
89NM_AVAILABLE_IN_1_14
90NMSriovVFVlanProtocol nm_sriov_vf_get_vlan_protocol(const NMSriovVF *vf, guint vlan_id);
91
92NM_AVAILABLE_IN_1_14
93GType nm_sriov_vf_get_type(void);
94NM_AVAILABLE_IN_1_14
95NMSriovVF *nm_sriov_vf_new(guint index);
96NM_AVAILABLE_IN_1_14
97void nm_sriov_vf_ref(NMSriovVF *vf);
98NM_AVAILABLE_IN_1_14
99void nm_sriov_vf_unref(NMSriovVF *vf);
100NM_AVAILABLE_IN_1_14
101gboolean nm_sriov_vf_equal(const NMSriovVF *vf, const NMSriovVF *other);
102NM_AVAILABLE_IN_1_14
103NMSriovVF *nm_sriov_vf_dup(const NMSriovVF *vf);
104NM_AVAILABLE_IN_1_14
105guint nm_sriov_vf_get_index(const NMSriovVF *vf);
106NM_AVAILABLE_IN_1_14
107void nm_sriov_vf_set_attribute(NMSriovVF *vf, const char *name, GVariant *value);
108NM_AVAILABLE_IN_1_14
109const char **nm_sriov_vf_get_attribute_names(const NMSriovVF *vf);
110NM_AVAILABLE_IN_1_14
111GVariant *nm_sriov_vf_get_attribute(const NMSriovVF *vf, const char *name);
112NM_AVAILABLE_IN_1_14
113gboolean
114nm_sriov_vf_attribute_validate(const char *name, GVariant *value, gboolean *known, GError **error);
115
116G_END_DECLS
117
118#endif /* NM_SETTING_SRIOV_H */
119

source code of include/libnm/nm-setting-sriov.h