1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /* Copyright (c) 2016-2018 Mellanox Technologies. All rights reserved */
4 #include <linux/netdevice.h>
5 #include <linux/string.h>
6 #include <linux/bitops.h>
12 static u8 mlxsw_sp_dcbnl_getdcbx(struct net_device __always_unused *dev)
14 return DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE;
17 static u8 mlxsw_sp_dcbnl_setdcbx(struct net_device __always_unused *dev,
20 return (mode != (DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE)) ? 1 : 0;
23 static int mlxsw_sp_dcbnl_ieee_getets(struct net_device *dev,
26 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
28 memcpy(ets, mlxsw_sp_port->dcb.ets, sizeof(*ets));
33 static int mlxsw_sp_port_ets_validate(struct mlxsw_sp_port *mlxsw_sp_port,
36 struct net_device *dev = mlxsw_sp_port->dev;
37 bool has_ets_tc = false;
40 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
41 switch (ets->tc_tsa[i]) {
42 case IEEE_8021QAZ_TSA_STRICT:
44 case IEEE_8021QAZ_TSA_ETS:
46 tx_bw_sum += ets->tc_tx_bw[i];
49 netdev_err(dev, "Only strict priority and ETS are supported\n");
53 if (ets->prio_tc[i] >= IEEE_8021QAZ_MAX_TCS) {
54 netdev_err(dev, "Invalid TC\n");
59 if (has_ets_tc && tx_bw_sum != 100) {
60 netdev_err(dev, "Total ETS bandwidth should equal 100\n");
67 static int mlxsw_sp_port_pg_prio_map(struct mlxsw_sp_port *mlxsw_sp_port,
70 char pptb_pl[MLXSW_REG_PPTB_LEN];
73 mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port);
74 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
75 mlxsw_reg_pptb_prio_to_buff_pack(pptb_pl, i, prio_tc[i]);
77 return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb),
81 static bool mlxsw_sp_ets_has_pg(u8 *prio_tc, u8 pg)
85 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
91 static int mlxsw_sp_port_pg_destroy(struct mlxsw_sp_port *mlxsw_sp_port,
92 u8 *old_prio_tc, u8 *new_prio_tc)
94 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
95 char pbmc_pl[MLXSW_REG_PBMC_LEN];
98 mlxsw_reg_pbmc_pack(pbmc_pl, mlxsw_sp_port->local_port, 0, 0);
99 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
103 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
104 u8 pg = old_prio_tc[i];
106 if (!mlxsw_sp_ets_has_pg(new_prio_tc, pg))
107 mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, pg, 0);
110 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
113 static int mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port,
114 struct ieee_ets *ets)
116 bool pause_en = mlxsw_sp_port_is_pause_en(mlxsw_sp_port);
117 struct ieee_ets *my_ets = mlxsw_sp_port->dcb.ets;
118 struct net_device *dev = mlxsw_sp_port->dev;
121 /* Create the required PGs, but don't destroy existing ones, as
122 * traffic is still directed to them.
124 err = __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu,
125 ets->prio_tc, pause_en,
126 mlxsw_sp_port->dcb.pfc);
128 netdev_err(dev, "Failed to configure port's headroom\n");
132 err = mlxsw_sp_port_pg_prio_map(mlxsw_sp_port, ets->prio_tc);
134 netdev_err(dev, "Failed to set PG-priority mapping\n");
135 goto err_port_prio_pg_map;
138 err = mlxsw_sp_port_pg_destroy(mlxsw_sp_port, my_ets->prio_tc,
141 netdev_warn(dev, "Failed to remove unused PGs\n");
145 err_port_prio_pg_map:
146 mlxsw_sp_port_pg_destroy(mlxsw_sp_port, ets->prio_tc, my_ets->prio_tc);
150 static int __mlxsw_sp_dcbnl_ieee_setets(struct mlxsw_sp_port *mlxsw_sp_port,
151 struct ieee_ets *ets)
153 struct ieee_ets *my_ets = mlxsw_sp_port->dcb.ets;
154 struct net_device *dev = mlxsw_sp_port->dev;
157 /* Egress configuration. */
158 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
159 bool dwrr = ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS;
160 u8 weight = ets->tc_tx_bw[i];
162 err = mlxsw_sp_port_ets_set(mlxsw_sp_port,
163 MLXSW_REG_QEEC_HR_SUBGROUP, i,
166 netdev_err(dev, "Failed to link subgroup ETS element %d to group\n",
168 goto err_port_ets_set;
172 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
173 err = mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i,
176 netdev_err(dev, "Failed to map prio %d to TC %d\n", i,
178 goto err_port_prio_tc_set;
182 /* Ingress configuration. */
183 err = mlxsw_sp_port_headroom_set(mlxsw_sp_port, ets);
185 goto err_port_headroom_set;
189 err_port_headroom_set:
190 i = IEEE_8021QAZ_MAX_TCS;
191 err_port_prio_tc_set:
192 for (i--; i >= 0; i--)
193 mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, my_ets->prio_tc[i]);
194 i = IEEE_8021QAZ_MAX_TCS;
196 for (i--; i >= 0; i--) {
197 bool dwrr = my_ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS;
198 u8 weight = my_ets->tc_tx_bw[i];
200 err = mlxsw_sp_port_ets_set(mlxsw_sp_port,
201 MLXSW_REG_QEEC_HR_SUBGROUP, i,
207 static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev,
208 struct ieee_ets *ets)
210 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
213 err = mlxsw_sp_port_ets_validate(mlxsw_sp_port, ets);
217 err = __mlxsw_sp_dcbnl_ieee_setets(mlxsw_sp_port, ets);
221 memcpy(mlxsw_sp_port->dcb.ets, ets, sizeof(*ets));
222 mlxsw_sp_port->dcb.ets->ets_cap = IEEE_8021QAZ_MAX_TCS;
227 static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev,
232 if (app->priority >= IEEE_8021QAZ_MAX_TCS) {
233 netdev_err(dev, "APP entry with priority value %u is invalid\n",
238 switch (app->selector) {
239 case IEEE_8021QAZ_APP_SEL_DSCP:
240 if (app->protocol >= 64) {
241 netdev_err(dev, "DSCP APP entry with protocol value %u is invalid\n",
246 /* Warn about any DSCP APP entries with the same PID. */
247 prio = fls(dcb_ieee_getapp_mask(dev, app));
249 if (prio < app->priority)
250 netdev_warn(dev, "Choosing priority %d for DSCP %d in favor of previously-active value of %d\n",
251 app->priority, app->protocol, prio);
252 else if (prio > app->priority)
253 netdev_warn(dev, "Ignoring new priority %d for DSCP %d in favor of current value of %d\n",
254 app->priority, app->protocol, prio);
258 case IEEE_8021QAZ_APP_SEL_ETHERTYPE:
260 netdev_err(dev, "EtherType APP entries with protocol value != 0 not supported\n");
266 netdev_err(dev, "APP entries with selector %u not supported\n",
275 mlxsw_sp_port_dcb_app_default_prio(struct mlxsw_sp_port *mlxsw_sp_port)
279 prio_mask = dcb_ieee_getapp_default_prio_mask(mlxsw_sp_port->dev);
281 /* Take the highest configured priority. */
282 return fls(prio_mask) - 1;
288 mlxsw_sp_port_dcb_app_dscp_prio_map(struct mlxsw_sp_port *mlxsw_sp_port,
290 struct dcb_ieee_app_dscp_map *map)
294 dcb_ieee_getapp_dscp_prio_mask_map(mlxsw_sp_port->dev, map);
295 for (i = 0; i < ARRAY_SIZE(map->map); ++i) {
297 map->map[i] = fls(map->map[i]) - 1;
299 map->map[i] = default_prio;
304 mlxsw_sp_port_dcb_app_prio_dscp_map(struct mlxsw_sp_port *mlxsw_sp_port,
305 struct dcb_ieee_app_prio_map *map)
307 bool have_dscp = false;
310 dcb_ieee_getapp_prio_dscp_mask_map(mlxsw_sp_port->dev, map);
311 for (i = 0; i < ARRAY_SIZE(map->map); ++i) {
313 map->map[i] = fls64(map->map[i]) - 1;
322 mlxsw_sp_port_dcb_app_update_qpts(struct mlxsw_sp_port *mlxsw_sp_port,
323 enum mlxsw_reg_qpts_trust_state ts)
325 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
326 char qpts_pl[MLXSW_REG_QPTS_LEN];
328 mlxsw_reg_qpts_pack(qpts_pl, mlxsw_sp_port->local_port, ts);
329 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpts), qpts_pl);
333 mlxsw_sp_port_dcb_app_update_qrwe(struct mlxsw_sp_port *mlxsw_sp_port,
336 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
337 char qrwe_pl[MLXSW_REG_QRWE_LEN];
339 mlxsw_reg_qrwe_pack(qrwe_pl, mlxsw_sp_port->local_port,
340 false, rewrite_dscp);
341 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qrwe), qrwe_pl);
345 mlxsw_sp_port_dcb_toggle_trust(struct mlxsw_sp_port *mlxsw_sp_port,
346 enum mlxsw_reg_qpts_trust_state ts)
348 bool rewrite_dscp = ts == MLXSW_REG_QPTS_TRUST_STATE_DSCP;
351 if (mlxsw_sp_port->dcb.trust_state == ts)
354 err = mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port, ts);
358 err = mlxsw_sp_port_dcb_app_update_qrwe(mlxsw_sp_port, rewrite_dscp);
360 goto err_update_qrwe;
362 mlxsw_sp_port->dcb.trust_state = ts;
366 mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port,
367 mlxsw_sp_port->dcb.trust_state);
372 mlxsw_sp_port_dcb_app_update_qpdp(struct mlxsw_sp_port *mlxsw_sp_port,
375 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
376 char qpdp_pl[MLXSW_REG_QPDP_LEN];
378 mlxsw_reg_qpdp_pack(qpdp_pl, mlxsw_sp_port->local_port, default_prio);
379 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpdp), qpdp_pl);
383 mlxsw_sp_port_dcb_app_update_qpdpm(struct mlxsw_sp_port *mlxsw_sp_port,
384 struct dcb_ieee_app_dscp_map *map)
386 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
387 char qpdpm_pl[MLXSW_REG_QPDPM_LEN];
390 mlxsw_reg_qpdpm_pack(qpdpm_pl, mlxsw_sp_port->local_port);
391 for (i = 0; i < ARRAY_SIZE(map->map); ++i)
392 mlxsw_reg_qpdpm_dscp_pack(qpdpm_pl, i, map->map[i]);
393 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpdpm), qpdpm_pl);
397 mlxsw_sp_port_dcb_app_update_qpdsm(struct mlxsw_sp_port *mlxsw_sp_port,
398 struct dcb_ieee_app_prio_map *map)
400 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
401 char qpdsm_pl[MLXSW_REG_QPDSM_LEN];
404 mlxsw_reg_qpdsm_pack(qpdsm_pl, mlxsw_sp_port->local_port);
405 for (i = 0; i < ARRAY_SIZE(map->map); ++i)
406 mlxsw_reg_qpdsm_prio_pack(qpdsm_pl, i, map->map[i]);
407 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpdsm), qpdsm_pl);
410 static int mlxsw_sp_port_dcb_app_update(struct mlxsw_sp_port *mlxsw_sp_port)
412 struct dcb_ieee_app_prio_map prio_map;
413 struct dcb_ieee_app_dscp_map dscp_map;
418 default_prio = mlxsw_sp_port_dcb_app_default_prio(mlxsw_sp_port);
419 err = mlxsw_sp_port_dcb_app_update_qpdp(mlxsw_sp_port, default_prio);
421 netdev_err(mlxsw_sp_port->dev, "Couldn't configure port default priority\n");
425 have_dscp = mlxsw_sp_port_dcb_app_prio_dscp_map(mlxsw_sp_port,
428 mlxsw_sp_port_dcb_app_dscp_prio_map(mlxsw_sp_port, default_prio,
430 err = mlxsw_sp_port_dcb_app_update_qpdpm(mlxsw_sp_port,
433 netdev_err(mlxsw_sp_port->dev, "Couldn't configure priority map\n");
437 err = mlxsw_sp_port_dcb_app_update_qpdsm(mlxsw_sp_port,
440 netdev_err(mlxsw_sp_port->dev, "Couldn't configure DSCP rewrite map\n");
445 err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port,
446 MLXSW_REG_QPTS_TRUST_STATE_PCP);
448 netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L2\n");
452 err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port,
453 MLXSW_REG_QPTS_TRUST_STATE_DSCP);
455 /* A failure to set trust DSCP means that the QPDPM and QPDSM
456 * maps installed above are not in effect. And since we are here
457 * attempting to set trust DSCP, we couldn't have attempted to
458 * switch trust to PCP. Thus no cleanup is necessary.
460 netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L3\n");
467 static int mlxsw_sp_dcbnl_ieee_setapp(struct net_device *dev,
470 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
473 err = mlxsw_sp_dcbnl_app_validate(dev, app);
477 err = dcb_ieee_setapp(dev, app);
481 err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port);
488 dcb_ieee_delapp(dev, app);
492 static int mlxsw_sp_dcbnl_ieee_delapp(struct net_device *dev,
495 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
498 err = dcb_ieee_delapp(dev, app);
502 err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port);
504 netdev_err(dev, "Failed to update DCB APP configuration\n");
508 static int mlxsw_sp_dcbnl_ieee_getmaxrate(struct net_device *dev,
509 struct ieee_maxrate *maxrate)
511 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
513 memcpy(maxrate, mlxsw_sp_port->dcb.maxrate, sizeof(*maxrate));
518 static int mlxsw_sp_dcbnl_ieee_setmaxrate(struct net_device *dev,
519 struct ieee_maxrate *maxrate)
521 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
522 struct ieee_maxrate *my_maxrate = mlxsw_sp_port->dcb.maxrate;
525 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
526 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
527 MLXSW_REG_QEEC_HR_SUBGROUP,
529 maxrate->tc_maxrate[i], 0);
531 netdev_err(dev, "Failed to set maxrate for TC %d\n", i);
532 goto err_port_ets_maxrate_set;
536 memcpy(mlxsw_sp_port->dcb.maxrate, maxrate, sizeof(*maxrate));
540 err_port_ets_maxrate_set:
541 for (i--; i >= 0; i--)
542 mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
543 MLXSW_REG_QEEC_HR_SUBGROUP,
545 my_maxrate->tc_maxrate[i], 0);
549 static int mlxsw_sp_port_pfc_cnt_get(struct mlxsw_sp_port *mlxsw_sp_port,
552 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
553 struct ieee_pfc *my_pfc = mlxsw_sp_port->dcb.pfc;
554 char ppcnt_pl[MLXSW_REG_PPCNT_LEN];
557 mlxsw_reg_ppcnt_pack(ppcnt_pl, mlxsw_sp_port->local_port,
558 MLXSW_REG_PPCNT_PRIO_CNT, prio);
559 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ppcnt), ppcnt_pl);
563 my_pfc->requests[prio] = mlxsw_reg_ppcnt_tx_pause_get(ppcnt_pl);
564 my_pfc->indications[prio] = mlxsw_reg_ppcnt_rx_pause_get(ppcnt_pl);
569 static int mlxsw_sp_dcbnl_ieee_getpfc(struct net_device *dev,
570 struct ieee_pfc *pfc)
572 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
575 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
576 err = mlxsw_sp_port_pfc_cnt_get(mlxsw_sp_port, i);
578 netdev_err(dev, "Failed to get PFC count for priority %d\n",
584 memcpy(pfc, mlxsw_sp_port->dcb.pfc, sizeof(*pfc));
589 static int mlxsw_sp_port_pfc_set(struct mlxsw_sp_port *mlxsw_sp_port,
590 struct ieee_pfc *pfc)
592 char pfcc_pl[MLXSW_REG_PFCC_LEN];
594 mlxsw_reg_pfcc_pack(pfcc_pl, mlxsw_sp_port->local_port);
595 mlxsw_reg_pfcc_pprx_set(pfcc_pl, mlxsw_sp_port->link.rx_pause);
596 mlxsw_reg_pfcc_pptx_set(pfcc_pl, mlxsw_sp_port->link.tx_pause);
597 mlxsw_reg_pfcc_prio_pack(pfcc_pl, pfc->pfc_en);
599 return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pfcc),
603 static int mlxsw_sp_dcbnl_ieee_setpfc(struct net_device *dev,
604 struct ieee_pfc *pfc)
606 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
607 bool pause_en = mlxsw_sp_port_is_pause_en(mlxsw_sp_port);
610 if (pause_en && pfc->pfc_en) {
611 netdev_err(dev, "PAUSE frames already enabled on port\n");
615 err = __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu,
616 mlxsw_sp_port->dcb.ets->prio_tc,
619 netdev_err(dev, "Failed to configure port's headroom for PFC\n");
623 err = mlxsw_sp_port_pfc_set(mlxsw_sp_port, pfc);
625 netdev_err(dev, "Failed to configure PFC\n");
626 goto err_port_pfc_set;
629 memcpy(mlxsw_sp_port->dcb.pfc, pfc, sizeof(*pfc));
630 mlxsw_sp_port->dcb.pfc->pfc_cap = IEEE_8021QAZ_MAX_TCS;
635 __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu,
636 mlxsw_sp_port->dcb.ets->prio_tc, pause_en,
637 mlxsw_sp_port->dcb.pfc);
641 static const struct dcbnl_rtnl_ops mlxsw_sp_dcbnl_ops = {
642 .ieee_getets = mlxsw_sp_dcbnl_ieee_getets,
643 .ieee_setets = mlxsw_sp_dcbnl_ieee_setets,
644 .ieee_getmaxrate = mlxsw_sp_dcbnl_ieee_getmaxrate,
645 .ieee_setmaxrate = mlxsw_sp_dcbnl_ieee_setmaxrate,
646 .ieee_getpfc = mlxsw_sp_dcbnl_ieee_getpfc,
647 .ieee_setpfc = mlxsw_sp_dcbnl_ieee_setpfc,
648 .ieee_setapp = mlxsw_sp_dcbnl_ieee_setapp,
649 .ieee_delapp = mlxsw_sp_dcbnl_ieee_delapp,
651 .getdcbx = mlxsw_sp_dcbnl_getdcbx,
652 .setdcbx = mlxsw_sp_dcbnl_setdcbx,
655 static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port)
657 mlxsw_sp_port->dcb.ets = kzalloc(sizeof(*mlxsw_sp_port->dcb.ets),
659 if (!mlxsw_sp_port->dcb.ets)
662 mlxsw_sp_port->dcb.ets->ets_cap = IEEE_8021QAZ_MAX_TCS;
667 static void mlxsw_sp_port_ets_fini(struct mlxsw_sp_port *mlxsw_sp_port)
669 kfree(mlxsw_sp_port->dcb.ets);
672 static int mlxsw_sp_port_maxrate_init(struct mlxsw_sp_port *mlxsw_sp_port)
676 mlxsw_sp_port->dcb.maxrate = kmalloc(sizeof(*mlxsw_sp_port->dcb.maxrate),
678 if (!mlxsw_sp_port->dcb.maxrate)
681 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
682 mlxsw_sp_port->dcb.maxrate->tc_maxrate[i] = MLXSW_REG_QEEC_MAS_DIS;
687 static void mlxsw_sp_port_maxrate_fini(struct mlxsw_sp_port *mlxsw_sp_port)
689 kfree(mlxsw_sp_port->dcb.maxrate);
692 static int mlxsw_sp_port_pfc_init(struct mlxsw_sp_port *mlxsw_sp_port)
694 mlxsw_sp_port->dcb.pfc = kzalloc(sizeof(*mlxsw_sp_port->dcb.pfc),
696 if (!mlxsw_sp_port->dcb.pfc)
699 mlxsw_sp_port->dcb.pfc->pfc_cap = IEEE_8021QAZ_MAX_TCS;
704 static void mlxsw_sp_port_pfc_fini(struct mlxsw_sp_port *mlxsw_sp_port)
706 kfree(mlxsw_sp_port->dcb.pfc);
709 int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port)
713 err = mlxsw_sp_port_ets_init(mlxsw_sp_port);
716 err = mlxsw_sp_port_maxrate_init(mlxsw_sp_port);
718 goto err_port_maxrate_init;
719 err = mlxsw_sp_port_pfc_init(mlxsw_sp_port);
721 goto err_port_pfc_init;
723 mlxsw_sp_port->dcb.trust_state = MLXSW_REG_QPTS_TRUST_STATE_PCP;
724 mlxsw_sp_port->dev->dcbnl_ops = &mlxsw_sp_dcbnl_ops;
729 mlxsw_sp_port_maxrate_fini(mlxsw_sp_port);
730 err_port_maxrate_init:
731 mlxsw_sp_port_ets_fini(mlxsw_sp_port);
735 void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port)
737 mlxsw_sp_port_pfc_fini(mlxsw_sp_port);
738 mlxsw_sp_port_maxrate_fini(mlxsw_sp_port);
739 mlxsw_sp_port_ets_fini(mlxsw_sp_port);