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 | |
15 | G_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 | |
39 | typedef struct _NMSettingSriovClass NMSettingSriovClass; |
40 | typedef 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 | */ |
51 | typedef enum { |
52 | NM_SRIOV_VF_VLAN_PROTOCOL_802_1Q = 0, |
53 | NM_SRIOV_VF_VLAN_PROTOCOL_802_1AD = 1, |
54 | } NMSriovVFVlanProtocol; |
55 | |
56 | NM_AVAILABLE_IN_1_14 |
57 | GType nm_setting_sriov_get_type(void); |
58 | NM_AVAILABLE_IN_1_14 |
59 | NMSetting *nm_setting_sriov_new(void); |
60 | NM_AVAILABLE_IN_1_14 |
61 | guint nm_setting_sriov_get_total_vfs(NMSettingSriov *setting); |
62 | NM_AVAILABLE_IN_1_14 |
63 | guint nm_setting_sriov_get_num_vfs(NMSettingSriov *setting); |
64 | NM_AVAILABLE_IN_1_14 |
65 | NMSriovVF *nm_setting_sriov_get_vf(NMSettingSriov *setting, guint idx); |
66 | NM_AVAILABLE_IN_1_14 |
67 | void nm_setting_sriov_add_vf(NMSettingSriov *setting, NMSriovVF *vf); |
68 | NM_AVAILABLE_IN_1_14 |
69 | void nm_setting_sriov_remove_vf(NMSettingSriov *setting, guint idx); |
70 | NM_AVAILABLE_IN_1_14 |
71 | gboolean nm_setting_sriov_remove_vf_by_index(NMSettingSriov *setting, guint index); |
72 | NM_AVAILABLE_IN_1_14 |
73 | void nm_setting_sriov_clear_vfs(NMSettingSriov *setting); |
74 | NM_AVAILABLE_IN_1_14 |
75 | NMTernary nm_setting_sriov_get_autoprobe_drivers(NMSettingSriov *setting); |
76 | |
77 | NM_AVAILABLE_IN_1_14 |
78 | gboolean nm_sriov_vf_add_vlan(NMSriovVF *vf, guint vlan_id); |
79 | NM_AVAILABLE_IN_1_14 |
80 | gboolean nm_sriov_vf_remove_vlan(NMSriovVF *vf, guint vlan_id); |
81 | NM_AVAILABLE_IN_1_14 |
82 | const guint *nm_sriov_vf_get_vlan_ids(const NMSriovVF *vf, guint *length); |
83 | NM_AVAILABLE_IN_1_14 |
84 | void nm_sriov_vf_set_vlan_qos(NMSriovVF *vf, guint vlan_id, guint32 qos); |
85 | NM_AVAILABLE_IN_1_14 |
86 | void nm_sriov_vf_set_vlan_protocol(NMSriovVF *vf, guint vlan_id, NMSriovVFVlanProtocol protocol); |
87 | NM_AVAILABLE_IN_1_14 |
88 | guint32 nm_sriov_vf_get_vlan_qos(const NMSriovVF *vf, guint vlan_id); |
89 | NM_AVAILABLE_IN_1_14 |
90 | NMSriovVFVlanProtocol nm_sriov_vf_get_vlan_protocol(const NMSriovVF *vf, guint vlan_id); |
91 | |
92 | NM_AVAILABLE_IN_1_14 |
93 | GType nm_sriov_vf_get_type(void); |
94 | NM_AVAILABLE_IN_1_14 |
95 | NMSriovVF *nm_sriov_vf_new(guint index); |
96 | NM_AVAILABLE_IN_1_14 |
97 | void nm_sriov_vf_ref(NMSriovVF *vf); |
98 | NM_AVAILABLE_IN_1_14 |
99 | void nm_sriov_vf_unref(NMSriovVF *vf); |
100 | NM_AVAILABLE_IN_1_14 |
101 | gboolean nm_sriov_vf_equal(const NMSriovVF *vf, const NMSriovVF *other); |
102 | NM_AVAILABLE_IN_1_14 |
103 | NMSriovVF *nm_sriov_vf_dup(const NMSriovVF *vf); |
104 | NM_AVAILABLE_IN_1_14 |
105 | guint nm_sriov_vf_get_index(const NMSriovVF *vf); |
106 | NM_AVAILABLE_IN_1_14 |
107 | void nm_sriov_vf_set_attribute(NMSriovVF *vf, const char *name, GVariant *value); |
108 | NM_AVAILABLE_IN_1_14 |
109 | const char **nm_sriov_vf_get_attribute_names(const NMSriovVF *vf); |
110 | NM_AVAILABLE_IN_1_14 |
111 | GVariant *nm_sriov_vf_get_attribute(const NMSriovVF *vf, const char *name); |
112 | NM_AVAILABLE_IN_1_14 |
113 | gboolean |
114 | nm_sriov_vf_attribute_validate(const char *name, GVariant *value, gboolean *known, GError **error); |
115 | |
116 | G_END_DECLS |
117 | |
118 | #endif /* NM_SETTING_SRIOV_H */ |
119 | |