8#include "dcbsetting_p.h"
12NetworkManager::DcbSettingPrivate::DcbSettingPrivate()
13 : name(NM_SETTING_DCB_SETTING_NAME)
14 , appFcoeMode(NM_SETTING_DCB_FCOE_MODE_FABRIC)
17 , appIscsiPriority(-1)
18 , priorityFlowControl({0, 0, 0, 0, 0, 0, 0, 0})
19 , priorityBandwidth({0, 0, 0, 0, 0, 0, 0, 0})
20 , priorityGroupBandwidth({0, 0, 0, 0, 0, 0, 0, 0})
21 , priorityGroupId({0, 0, 0, 0, 0, 0, 0, 0})
22 , priorityStrictBandwidth({0, 0, 0, 0, 0, 0, 0, 0})
23 , priorityTrafficClass({0, 0, 0, 0, 0, 0, 0, 0})
27NetworkManager::DcbSetting::DcbSetting()
28 : Setting(Setting::Dcb)
29 , d_ptr(new DcbSettingPrivate())
33NetworkManager::DcbSetting::DcbSetting(
const Ptr &other)
35 , d_ptr(new DcbSettingPrivate())
37 setAppFcoeMode(other->appFcoeMode());
38 setAppFcoePriority(other->appFcoePriority());
39 setAppFipPriority(other->appFipPriority());
40 setAppIscsiPriority(other->appIscsiPriority());
41 setAppFcoeFlags(other->appFcoeFlags());
42 setAppFipFlags(other->appFipFlags());
43 setAppIscsiFlags(other->appIscsiFlags());
44 setPriorityGroupFlags(other->priorityGroupFlags());
45 setPriorityFlowControlFlags(other->priorityFlowControlFlags());
46 setPriorityFlowControl(other->priorityFlowControl());
47 setPriorityBandwidth(other->priorityBandwidth());
48 setPriorityGroupBandwidth(other->priorityGroupBandwidth());
49 setPriorityGroupId(other->priorityGroupId());
50 setPriorityStrictBandwidth(other->priorityStrictBandwidth());
51 setPriorityTrafficClass(other->priorityTrafficClass());
54NetworkManager::DcbSetting::~DcbSetting()
66void NetworkManager::DcbSetting::setAppFcoeMode(
const QString &mode)
70 d->appFcoeMode = mode;
73QString NetworkManager::DcbSetting::appFcoeMode()
const
75 Q_D(
const DcbSetting);
77 return d->appFcoeMode;
80void NetworkManager::DcbSetting::setAppFcoePriority(qint32 priority)
84 d->appFcoePriority = priority;
87qint32 NetworkManager::DcbSetting::appFcoePriority()
const
89 Q_D(
const DcbSetting);
91 return d->appFcoePriority;
94void NetworkManager::DcbSetting::setAppFipPriority(qint32 priority)
98 d->appFipPriority = priority;
101qint32 NetworkManager::DcbSetting::appFipPriority()
const
103 Q_D(
const DcbSetting);
105 return d->appFipPriority;
108void NetworkManager::DcbSetting::setAppIscsiPriority(qint32 priority)
112 d->appIscsiPriority = priority;
115qint32 NetworkManager::DcbSetting::appIscsiPriority()
const
117 Q_D(
const DcbSetting);
119 return d->appIscsiPriority;
126 d->appFcoeFlags = flags;
131 Q_D(
const DcbSetting);
133 return d->appFcoeFlags;
140 d->appFipFlags = flags;
145 Q_D(
const DcbSetting);
147 return d->appFipFlags;
154 d->appIscsiFlags = flags;
159 Q_D(
const DcbSetting);
161 return d->appIscsiFlags;
168 d->priorityGroupFlags = flags;
173 Q_D(
const DcbSetting);
175 return d->priorityGroupFlags;
182 d->priorityFlowControlFlags = flags;
187 Q_D(
const DcbSetting);
189 return d->priorityFlowControlFlags;
192void NetworkManager::DcbSetting::setPriorityFlowControl(quint32 userPriority,
bool enabled)
196 if (userPriority < 8) {
197 d->priorityFlowControl[userPriority] = enabled;
201bool NetworkManager::DcbSetting::priorityFlowControl(quint32 userPriority)
const
203 Q_D(
const DcbSetting);
205 if (userPriority < 8) {
206 return d->priorityFlowControl.value(userPriority);
211void NetworkManager::DcbSetting::setPriorityFlowControl(
const UIntList &list)
215 d->priorityFlowControl =
list;
218UIntList NetworkManager::DcbSetting::priorityFlowControl()
const
220 Q_D(
const DcbSetting);
222 return d->priorityFlowControl;
225void NetworkManager::DcbSetting::setPriorityBandwidth(quint32 userPriority, quint32 bandwidthPercent)
229 if (userPriority < 8) {
230 d->priorityBandwidth[userPriority] = bandwidthPercent;
234quint32 NetworkManager::DcbSetting::priorityBandwidth(quint32 userPriority)
const
236 Q_D(
const DcbSetting);
238 if (userPriority < 8) {
239 return d->priorityBandwidth.value(userPriority);
244void NetworkManager::DcbSetting::setPriorityBandwidth(
const UIntList &list)
248 d->priorityBandwidth =
list;
251UIntList NetworkManager::DcbSetting::priorityBandwidth()
const
253 Q_D(
const DcbSetting);
255 return d->priorityBandwidth;
258void NetworkManager::DcbSetting::setPriorityGroupBandwidth(quint32 groupId, quint32 bandwidthPercent)
263 d->priorityGroupBandwidth[groupId] = bandwidthPercent;
267quint32 NetworkManager::DcbSetting::priorityGroupBandwidth(quint32 groupId)
const
269 Q_D(
const DcbSetting);
272 return d->priorityGroupBandwidth.value(groupId);
277void NetworkManager::DcbSetting::setPriorityGroupBandwidth(
const UIntList &list)
281 d->priorityGroupBandwidth =
list;
284UIntList NetworkManager::DcbSetting::priorityGroupBandwidth()
const
286 Q_D(
const DcbSetting);
288 return d->priorityGroupBandwidth;
291void NetworkManager::DcbSetting::setPriorityGroupId(quint32 userPriority, quint32 groupId)
295 if (userPriority < 8) {
296 d->priorityGroupId[userPriority] = groupId;
300quint32 NetworkManager::DcbSetting::priorityGroupId(quint32 userPriority)
const
302 Q_D(
const DcbSetting);
304 if (userPriority < 8) {
305 return d->priorityGroupId.value(userPriority);
310void NetworkManager::DcbSetting::setPriorityGroupId(
const UIntList &list)
314 d->priorityGroupId =
list;
317UIntList NetworkManager::DcbSetting::priorityGroupId()
const
319 Q_D(
const DcbSetting);
321 return d->priorityGroupId;
324void NetworkManager::DcbSetting::setPriorityStrictBandwidth(quint32 userPriority,
bool strict)
328 if (userPriority < 8) {
329 d->priorityStrictBandwidth[userPriority] = strict;
333bool NetworkManager::DcbSetting::priorityStrictBandwidth(quint32 userPriority)
const
335 Q_D(
const DcbSetting);
337 if (userPriority < 8) {
338 return d->priorityStrictBandwidth.value(userPriority);
343void NetworkManager::DcbSetting::setPriorityStrictBandwidth(
const UIntList &list)
347 d->priorityStrictBandwidth =
list;
350UIntList NetworkManager::DcbSetting::priorityStrictBandwidth()
const
352 Q_D(
const DcbSetting);
354 return d->priorityStrictBandwidth;
357void NetworkManager::DcbSetting::setPriorityTrafficClass(quint32 userPriority, quint32 trafficClass)
361 if (userPriority < 8) {
362 d->priorityTrafficClass[userPriority] = trafficClass;
366quint32 NetworkManager::DcbSetting::priorityTrafficClass(quint32 userPriority)
const
368 Q_D(
const DcbSetting);
370 if (userPriority < 8) {
371 return d->priorityTrafficClass.value(userPriority);
376void NetworkManager::DcbSetting::setPriorityTrafficClass(
const UIntList &list)
380 d->priorityTrafficClass =
list;
383UIntList NetworkManager::DcbSetting::priorityTrafficClass()
const
385 Q_D(
const DcbSetting);
387 return d->priorityTrafficClass;
392 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_FCOE_MODE))) {
393 setAppFcoeMode(setting.value(
QLatin1String(NM_SETTING_DCB_APP_FCOE_MODE)).toString());
396 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_FCOE_PRIORITY))) {
397 setAppFcoePriority(setting.value(
QLatin1String(NM_SETTING_DCB_APP_FCOE_PRIORITY)).toInt());
400 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_FIP_PRIORITY))) {
401 setAppFipPriority(setting.value(
QLatin1String(NM_SETTING_DCB_APP_FIP_PRIORITY)).toInt());
404 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_PRIORITY))) {
405 setAppIscsiPriority(setting.value(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_PRIORITY)).toInt());
408 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_FCOE_FLAGS))) {
409 setAppFcoeFlags(
static_cast<DcbFlags>(setting.value(
QLatin1String(NM_SETTING_DCB_APP_FCOE_FLAGS)).toUInt()));
412 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_FIP_FLAGS))) {
413 setAppFipFlags(
static_cast<DcbFlags>(setting.value(
QLatin1String(NM_SETTING_DCB_APP_FIP_FLAGS)).toUInt()));
416 if (setting.contains(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_FLAGS))) {
417 setAppIscsiFlags(
static_cast<DcbFlags>(setting.value(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_FLAGS)).toUInt()));
420 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_FLAGS))) {
421 setPriorityGroupFlags(
static_cast<DcbFlags>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_FLAGS)).toUInt()));
424 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS))) {
425 setPriorityFlowControlFlags(
static_cast<DcbFlags>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS)).toUInt()));
428 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_FLOW_CONTROL))) {
429 setPriorityFlowControl(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_FLOW_CONTROL))));
432 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_BANDWIDTH))) {
433 setPriorityBandwidth(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_BANDWIDTH))));
436 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH))) {
437 setPriorityGroupBandwidth(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH))));
440 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_ID))) {
441 setPriorityGroupId(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_ID))));
444 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH))) {
445 setPriorityStrictBandwidth(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH))));
448 if (setting.contains(
QLatin1String(NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS))) {
449 setPriorityTrafficClass(qdbus_cast<UIntList>(setting.value(
QLatin1String(NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS))));
457 if (!appFcoeMode().isEmpty()) {
458 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_FCOE_MODE), appFcoeMode());
461 if (appFcoePriority() >= 0) {
462 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_FCOE_PRIORITY), appFcoePriority());
465 if (appFipPriority() >= 0) {
466 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_FIP_PRIORITY), appFipPriority());
469 if (appIscsiPriority() >= 0) {
470 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_PRIORITY), appIscsiPriority());
473 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_FCOE_FLAGS), (
int)appFcoeFlags());
474 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_FIP_FLAGS), (
int)appFipFlags());
475 setting.insert(
QLatin1String(NM_SETTING_DCB_APP_ISCSI_FLAGS), (
int)appIscsiFlags());
476 setting.insert(
QLatin1String(NM_SETTING_DCB_PRIORITY_GROUP_FLAGS), (
int)priorityGroupFlags());
477 setting.insert(
QLatin1String(NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS), (
int)priorityFlowControlFlags());
491 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
492 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
494 dbg.
nospace() << NM_SETTING_DCB_APP_FCOE_MODE <<
": " << setting.appFcoeMode() <<
'\n';
495 dbg.
nospace() << NM_SETTING_DCB_APP_FCOE_PRIORITY <<
": " << setting.appFcoePriority() <<
'\n';
496 dbg.
nospace() << NM_SETTING_DCB_APP_FIP_PRIORITY <<
": " << setting.appFipPriority() <<
'\n';
497 dbg.
nospace() << NM_SETTING_DCB_APP_ISCSI_PRIORITY <<
": " << setting.appIscsiPriority() <<
'\n';
498 dbg.
nospace() << NM_SETTING_DCB_APP_FCOE_FLAGS <<
": " << setting.appFcoeFlags() <<
'\n';
499 dbg.
nospace() << NM_SETTING_DCB_APP_FIP_FLAGS <<
": " << setting.appFipFlags() <<
'\n';
500 dbg.
nospace() << NM_SETTING_DCB_APP_ISCSI_FLAGS <<
": " << setting.appIscsiFlags() <<
'\n';
501 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_GROUP_FLAGS <<
": " << setting.priorityGroupFlags() <<
'\n';
502 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS <<
": " << setting.priorityFlowControlFlags() <<
'\n';
504 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_FLOW_CONTROL <<
": ";
505 const auto flowControlList = setting.priorityFlowControl();
506 for (
const quint32 enabled : flowControlList) {
507 dbg.
nospace() << enabled <<
' ';
511 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_BANDWIDTH <<
": ";
512 const auto bwList = setting.priorityBandwidth();
513 for (
const quint32 bandwidthPercent : bwList) {
514 dbg.
nospace() << bandwidthPercent <<
' ';
518 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH <<
": ";
519 const auto gbwList = setting.priorityGroupBandwidth();
520 for (
const quint32 bandwidthPercent : gbwList) {
521 dbg.
nospace() << bandwidthPercent <<
' ';
525 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_GROUP_ID <<
": ";
526 const auto groupIds = setting.priorityGroupId();
527 for (
const quint32 groupId : groupIds) {
528 dbg.
nospace() << groupId <<
' ';
532 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH <<
": ";
533 const auto strictList = setting.priorityStrictBandwidth();
534 for (
const quint32 strict : strictList) {
535 dbg.
nospace() << strict <<
' ';
539 dbg.
nospace() << NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS <<
": ";
540 const auto trafficList = setting.priorityTrafficClass();
541 for (
const quint32 trafficClass : trafficList) {
542 dbg.
nospace() << trafficClass <<
' ';
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QVariant fromValue(T &&value)