1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2013 Red Hat, Inc.
4 */
5
6#ifndef __NM_SETTING_DCB_H__
7#define __NM_SETTING_DCB_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_DCB (nm_setting_dcb_get_type())
18#define NM_SETTING_DCB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_DCB, NMSettingDcb))
19#define NM_SETTING_DCB_CLASS(klass) \
20 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
21#define NM_IS_SETTING_DCB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_DCB))
22#define NM_IS_SETTING_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_DCB))
23#define NM_SETTING_DCB_GET_CLASS(obj) \
24 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
25
26#define NM_SETTING_DCB_SETTING_NAME "dcb"
27
28/**
29 * NMSettingDcbFlags:
30 * @NM_SETTING_DCB_FLAG_NONE: no flag
31 * @NM_SETTING_DCB_FLAG_ENABLE: the feature is enabled
32 * @NM_SETTING_DCB_FLAG_ADVERTISE: the feature is advertised
33 * @NM_SETTING_DCB_FLAG_WILLING: the feature is willing to change based on
34 * peer configuration advertisements
35 *
36 * DCB feature flags.
37 **/
38typedef enum { /*< flags >*/
39 NM_SETTING_DCB_FLAG_NONE = 0x00000000,
40 NM_SETTING_DCB_FLAG_ENABLE = 0x00000001,
41 NM_SETTING_DCB_FLAG_ADVERTISE = 0x00000002,
42 NM_SETTING_DCB_FLAG_WILLING = 0x00000004
43} NMSettingDcbFlags;
44
45/**
46 * NM_SETTING_DCB_FCOE_MODE_FABRIC:
47 *
48 * Indicates that the FCoE controller should use "fabric" mode (default)
49 */
50#define NM_SETTING_DCB_FCOE_MODE_FABRIC "fabric"
51
52/**
53 * NM_SETTING_DCB_FCOE_MODE_VN2VN:
54 *
55 * Indicates that the FCoE controller should use "VN2VN" mode.
56 */
57#define NM_SETTING_DCB_FCOE_MODE_VN2VN "vn2vn"
58
59/* Properties */
60#define NM_SETTING_DCB_APP_FCOE_FLAGS "app-fcoe-flags"
61#define NM_SETTING_DCB_APP_FCOE_PRIORITY "app-fcoe-priority"
62#define NM_SETTING_DCB_APP_FCOE_MODE "app-fcoe-mode"
63
64#define NM_SETTING_DCB_APP_ISCSI_FLAGS "app-iscsi-flags"
65#define NM_SETTING_DCB_APP_ISCSI_PRIORITY "app-iscsi-priority"
66
67#define NM_SETTING_DCB_APP_FIP_FLAGS "app-fip-flags"
68#define NM_SETTING_DCB_APP_FIP_PRIORITY "app-fip-priority"
69
70#define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS "priority-flow-control-flags"
71#define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL "priority-flow-control"
72
73#define NM_SETTING_DCB_PRIORITY_GROUP_FLAGS "priority-group-flags"
74#define NM_SETTING_DCB_PRIORITY_GROUP_ID "priority-group-id"
75#define NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH "priority-group-bandwidth"
76#define NM_SETTING_DCB_PRIORITY_BANDWIDTH "priority-bandwidth"
77#define NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH "priority-strict-bandwidth"
78#define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS "priority-traffic-class"
79
80typedef struct _NMSettingDcbClass NMSettingDcbClass;
81
82GType nm_setting_dcb_get_type(void);
83
84NMSetting *nm_setting_dcb_new(void);
85
86NMSettingDcbFlags nm_setting_dcb_get_app_fcoe_flags(NMSettingDcb *setting);
87int nm_setting_dcb_get_app_fcoe_priority(NMSettingDcb *setting);
88const char *nm_setting_dcb_get_app_fcoe_mode(NMSettingDcb *setting);
89
90NMSettingDcbFlags nm_setting_dcb_get_app_iscsi_flags(NMSettingDcb *setting);
91int nm_setting_dcb_get_app_iscsi_priority(NMSettingDcb *setting);
92
93NMSettingDcbFlags nm_setting_dcb_get_app_fip_flags(NMSettingDcb *setting);
94int nm_setting_dcb_get_app_fip_priority(NMSettingDcb *setting);
95
96/* Priority Flow Control */
97NMSettingDcbFlags nm_setting_dcb_get_priority_flow_control_flags(NMSettingDcb *setting);
98gboolean nm_setting_dcb_get_priority_flow_control(NMSettingDcb *setting, guint user_priority);
99void nm_setting_dcb_set_priority_flow_control(NMSettingDcb *setting,
100 guint user_priority,
101 gboolean enabled);
102
103/* Priority Groups */
104NMSettingDcbFlags nm_setting_dcb_get_priority_group_flags(NMSettingDcb *setting);
105
106guint nm_setting_dcb_get_priority_group_id(NMSettingDcb *setting, guint user_priority);
107void
108nm_setting_dcb_set_priority_group_id(NMSettingDcb *setting, guint user_priority, guint group_id);
109
110guint nm_setting_dcb_get_priority_group_bandwidth(NMSettingDcb *setting, guint group_id);
111void nm_setting_dcb_set_priority_group_bandwidth(NMSettingDcb *setting,
112 guint group_id,
113 guint bandwidth_percent);
114
115guint nm_setting_dcb_get_priority_bandwidth(NMSettingDcb *setting, guint user_priority);
116void nm_setting_dcb_set_priority_bandwidth(NMSettingDcb *setting,
117 guint user_priority,
118 guint bandwidth_percent);
119
120gboolean nm_setting_dcb_get_priority_strict_bandwidth(NMSettingDcb *setting, guint user_priority);
121void nm_setting_dcb_set_priority_strict_bandwidth(NMSettingDcb *setting,
122 guint user_priority,
123 gboolean strict);
124
125guint nm_setting_dcb_get_priority_traffic_class(NMSettingDcb *setting, guint user_priority);
126void nm_setting_dcb_set_priority_traffic_class(NMSettingDcb *setting,
127 guint user_priority,
128 guint traffic_class);
129
130G_END_DECLS
131
132#endif /* __NM_SETTING_DCB_H__ */
133

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