• Home
  • Raw
  • Download

Lines Matching refs:mlxsw_sp_port

26 	struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);  in mlxsw_sp_dcbnl_ieee_getets()  local
28 memcpy(ets, mlxsw_sp_port->dcb.ets, sizeof(*ets)); in mlxsw_sp_dcbnl_ieee_getets()
33 static int mlxsw_sp_port_ets_validate(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_ets_validate() argument
36 struct net_device *dev = mlxsw_sp_port->dev; in mlxsw_sp_port_ets_validate()
67 static int mlxsw_sp_port_pg_prio_map(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_pg_prio_map() argument
73 mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_pg_prio_map()
77 return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), in mlxsw_sp_port_pg_prio_map()
91 static int mlxsw_sp_port_pg_destroy(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_pg_destroy() argument
94 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_pg_destroy()
98 mlxsw_reg_pbmc_pack(pbmc_pl, mlxsw_sp_port->local_port, 0, 0); in mlxsw_sp_port_pg_destroy()
113 static int mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_headroom_set() argument
116 bool pause_en = mlxsw_sp_port_is_pause_en(mlxsw_sp_port); in mlxsw_sp_port_headroom_set()
117 struct ieee_ets *my_ets = mlxsw_sp_port->dcb.ets; in mlxsw_sp_port_headroom_set()
118 struct net_device *dev = mlxsw_sp_port->dev; in mlxsw_sp_port_headroom_set()
124 err = __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu, in mlxsw_sp_port_headroom_set()
126 mlxsw_sp_port->dcb.pfc); in mlxsw_sp_port_headroom_set()
132 err = mlxsw_sp_port_pg_prio_map(mlxsw_sp_port, ets->prio_tc); in mlxsw_sp_port_headroom_set()
138 err = mlxsw_sp_port_pg_destroy(mlxsw_sp_port, my_ets->prio_tc, in mlxsw_sp_port_headroom_set()
146 mlxsw_sp_port_pg_destroy(mlxsw_sp_port, ets->prio_tc, my_ets->prio_tc); in mlxsw_sp_port_headroom_set()
150 static int __mlxsw_sp_dcbnl_ieee_setets(struct mlxsw_sp_port *mlxsw_sp_port, in __mlxsw_sp_dcbnl_ieee_setets() argument
153 struct ieee_ets *my_ets = mlxsw_sp_port->dcb.ets; in __mlxsw_sp_dcbnl_ieee_setets()
154 struct net_device *dev = mlxsw_sp_port->dev; in __mlxsw_sp_dcbnl_ieee_setets()
162 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in __mlxsw_sp_dcbnl_ieee_setets()
173 err = mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, in __mlxsw_sp_dcbnl_ieee_setets()
183 err = mlxsw_sp_port_headroom_set(mlxsw_sp_port, ets); in __mlxsw_sp_dcbnl_ieee_setets()
193 mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, my_ets->prio_tc[i]); in __mlxsw_sp_dcbnl_ieee_setets()
200 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in __mlxsw_sp_dcbnl_ieee_setets()
210 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_setets() local
213 err = mlxsw_sp_port_ets_validate(mlxsw_sp_port, ets); in mlxsw_sp_dcbnl_ieee_setets()
217 err = __mlxsw_sp_dcbnl_ieee_setets(mlxsw_sp_port, ets); in mlxsw_sp_dcbnl_ieee_setets()
221 memcpy(mlxsw_sp_port->dcb.ets, ets, sizeof(*ets)); in mlxsw_sp_dcbnl_ieee_setets()
222 mlxsw_sp_port->dcb.ets->ets_cap = IEEE_8021QAZ_MAX_TCS; in mlxsw_sp_dcbnl_ieee_setets()
275 mlxsw_sp_port_dcb_app_default_prio(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dcb_app_default_prio() argument
279 prio_mask = dcb_ieee_getapp_default_prio_mask(mlxsw_sp_port->dev); in mlxsw_sp_port_dcb_app_default_prio()
288 mlxsw_sp_port_dcb_app_dscp_prio_map(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_dscp_prio_map() argument
294 dcb_ieee_getapp_dscp_prio_mask_map(mlxsw_sp_port->dev, map); in mlxsw_sp_port_dcb_app_dscp_prio_map()
304 mlxsw_sp_port_dcb_app_prio_dscp_map(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_prio_dscp_map() argument
310 dcb_ieee_getapp_prio_dscp_mask_map(mlxsw_sp_port->dev, map); in mlxsw_sp_port_dcb_app_prio_dscp_map()
322 mlxsw_sp_port_dcb_app_update_qpts(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update_qpts() argument
325 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dcb_app_update_qpts()
328 mlxsw_reg_qpts_pack(qpts_pl, mlxsw_sp_port->local_port, ts); in mlxsw_sp_port_dcb_app_update_qpts()
333 mlxsw_sp_port_dcb_app_update_qrwe(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update_qrwe() argument
336 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dcb_app_update_qrwe()
339 mlxsw_reg_qrwe_pack(qrwe_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_dcb_app_update_qrwe()
345 mlxsw_sp_port_dcb_toggle_trust(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_toggle_trust() argument
351 if (mlxsw_sp_port->dcb.trust_state == ts) in mlxsw_sp_port_dcb_toggle_trust()
354 err = mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port, ts); in mlxsw_sp_port_dcb_toggle_trust()
358 err = mlxsw_sp_port_dcb_app_update_qrwe(mlxsw_sp_port, rewrite_dscp); in mlxsw_sp_port_dcb_toggle_trust()
362 mlxsw_sp_port->dcb.trust_state = ts; in mlxsw_sp_port_dcb_toggle_trust()
366 mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port, in mlxsw_sp_port_dcb_toggle_trust()
367 mlxsw_sp_port->dcb.trust_state); in mlxsw_sp_port_dcb_toggle_trust()
372 mlxsw_sp_port_dcb_app_update_qpdpm(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update_qpdpm() argument
375 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dcb_app_update_qpdpm()
379 mlxsw_reg_qpdpm_pack(qpdpm_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_dcb_app_update_qpdpm()
386 mlxsw_sp_port_dcb_app_update_qpdsm(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update_qpdsm() argument
389 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dcb_app_update_qpdsm()
393 mlxsw_reg_qpdsm_pack(qpdsm_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_dcb_app_update_qpdsm()
399 static int mlxsw_sp_port_dcb_app_update(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dcb_app_update() argument
407 default_prio = mlxsw_sp_port_dcb_app_default_prio(mlxsw_sp_port); in mlxsw_sp_port_dcb_app_update()
408 have_dscp = mlxsw_sp_port_dcb_app_prio_dscp_map(mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update()
411 mlxsw_sp_port_dcb_app_dscp_prio_map(mlxsw_sp_port, default_prio, in mlxsw_sp_port_dcb_app_update()
413 err = mlxsw_sp_port_dcb_app_update_qpdpm(mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update()
416 netdev_err(mlxsw_sp_port->dev, "Couldn't configure priority map\n"); in mlxsw_sp_port_dcb_app_update()
420 err = mlxsw_sp_port_dcb_app_update_qpdsm(mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update()
423 netdev_err(mlxsw_sp_port->dev, "Couldn't configure DSCP rewrite map\n"); in mlxsw_sp_port_dcb_app_update()
428 err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update()
431 netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L2\n"); in mlxsw_sp_port_dcb_app_update()
435 err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port, in mlxsw_sp_port_dcb_app_update()
443 netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L3\n"); in mlxsw_sp_port_dcb_app_update()
453 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_setapp() local
464 err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port); in mlxsw_sp_dcbnl_ieee_setapp()
478 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_delapp() local
485 err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port); in mlxsw_sp_dcbnl_ieee_delapp()
494 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_getmaxrate() local
496 memcpy(maxrate, mlxsw_sp_port->dcb.maxrate, sizeof(*maxrate)); in mlxsw_sp_dcbnl_ieee_getmaxrate()
504 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_setmaxrate() local
505 struct ieee_maxrate *my_maxrate = mlxsw_sp_port->dcb.maxrate; in mlxsw_sp_dcbnl_ieee_setmaxrate()
509 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_dcbnl_ieee_setmaxrate()
519 memcpy(mlxsw_sp_port->dcb.maxrate, maxrate, sizeof(*maxrate)); in mlxsw_sp_dcbnl_ieee_setmaxrate()
525 mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_dcbnl_ieee_setmaxrate()
531 static int mlxsw_sp_port_pfc_cnt_get(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_pfc_cnt_get() argument
534 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_pfc_cnt_get()
535 struct ieee_pfc *my_pfc = mlxsw_sp_port->dcb.pfc; in mlxsw_sp_port_pfc_cnt_get()
539 mlxsw_reg_ppcnt_pack(ppcnt_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_pfc_cnt_get()
554 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_getpfc() local
558 err = mlxsw_sp_port_pfc_cnt_get(mlxsw_sp_port, i); in mlxsw_sp_dcbnl_ieee_getpfc()
566 memcpy(pfc, mlxsw_sp_port->dcb.pfc, sizeof(*pfc)); in mlxsw_sp_dcbnl_ieee_getpfc()
571 static int mlxsw_sp_port_pfc_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_pfc_set() argument
576 mlxsw_reg_pfcc_pack(pfcc_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_pfc_set()
577 mlxsw_reg_pfcc_pprx_set(pfcc_pl, mlxsw_sp_port->link.rx_pause); in mlxsw_sp_port_pfc_set()
578 mlxsw_reg_pfcc_pptx_set(pfcc_pl, mlxsw_sp_port->link.tx_pause); in mlxsw_sp_port_pfc_set()
581 return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pfcc), in mlxsw_sp_port_pfc_set()
588 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_dcbnl_ieee_setpfc() local
589 bool pause_en = mlxsw_sp_port_is_pause_en(mlxsw_sp_port); in mlxsw_sp_dcbnl_ieee_setpfc()
597 err = __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu, in mlxsw_sp_dcbnl_ieee_setpfc()
598 mlxsw_sp_port->dcb.ets->prio_tc, in mlxsw_sp_dcbnl_ieee_setpfc()
605 err = mlxsw_sp_port_pfc_set(mlxsw_sp_port, pfc); in mlxsw_sp_dcbnl_ieee_setpfc()
611 memcpy(mlxsw_sp_port->dcb.pfc, pfc, sizeof(*pfc)); in mlxsw_sp_dcbnl_ieee_setpfc()
612 mlxsw_sp_port->dcb.pfc->pfc_cap = IEEE_8021QAZ_MAX_TCS; in mlxsw_sp_dcbnl_ieee_setpfc()
617 __mlxsw_sp_port_headroom_set(mlxsw_sp_port, dev->mtu, in mlxsw_sp_dcbnl_ieee_setpfc()
618 mlxsw_sp_port->dcb.ets->prio_tc, pause_en, in mlxsw_sp_dcbnl_ieee_setpfc()
619 mlxsw_sp_port->dcb.pfc); in mlxsw_sp_dcbnl_ieee_setpfc()
637 static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ets_init() argument
639 mlxsw_sp_port->dcb.ets = kzalloc(sizeof(*mlxsw_sp_port->dcb.ets), in mlxsw_sp_port_ets_init()
641 if (!mlxsw_sp_port->dcb.ets) in mlxsw_sp_port_ets_init()
644 mlxsw_sp_port->dcb.ets->ets_cap = IEEE_8021QAZ_MAX_TCS; in mlxsw_sp_port_ets_init()
649 static void mlxsw_sp_port_ets_fini(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ets_fini() argument
651 kfree(mlxsw_sp_port->dcb.ets); in mlxsw_sp_port_ets_fini()
654 static int mlxsw_sp_port_maxrate_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_maxrate_init() argument
658 mlxsw_sp_port->dcb.maxrate = kmalloc(sizeof(*mlxsw_sp_port->dcb.maxrate), in mlxsw_sp_port_maxrate_init()
660 if (!mlxsw_sp_port->dcb.maxrate) in mlxsw_sp_port_maxrate_init()
664 mlxsw_sp_port->dcb.maxrate->tc_maxrate[i] = MLXSW_REG_QEEC_MAS_DIS; in mlxsw_sp_port_maxrate_init()
669 static void mlxsw_sp_port_maxrate_fini(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_maxrate_fini() argument
671 kfree(mlxsw_sp_port->dcb.maxrate); in mlxsw_sp_port_maxrate_fini()
674 static int mlxsw_sp_port_pfc_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_pfc_init() argument
676 mlxsw_sp_port->dcb.pfc = kzalloc(sizeof(*mlxsw_sp_port->dcb.pfc), in mlxsw_sp_port_pfc_init()
678 if (!mlxsw_sp_port->dcb.pfc) in mlxsw_sp_port_pfc_init()
681 mlxsw_sp_port->dcb.pfc->pfc_cap = IEEE_8021QAZ_MAX_TCS; in mlxsw_sp_port_pfc_init()
686 static void mlxsw_sp_port_pfc_fini(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_pfc_fini() argument
688 kfree(mlxsw_sp_port->dcb.pfc); in mlxsw_sp_port_pfc_fini()
691 int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dcb_init() argument
695 err = mlxsw_sp_port_ets_init(mlxsw_sp_port); in mlxsw_sp_port_dcb_init()
698 err = mlxsw_sp_port_maxrate_init(mlxsw_sp_port); in mlxsw_sp_port_dcb_init()
701 err = mlxsw_sp_port_pfc_init(mlxsw_sp_port); in mlxsw_sp_port_dcb_init()
705 mlxsw_sp_port->dcb.trust_state = MLXSW_REG_QPTS_TRUST_STATE_PCP; in mlxsw_sp_port_dcb_init()
706 mlxsw_sp_port->dev->dcbnl_ops = &mlxsw_sp_dcbnl_ops; in mlxsw_sp_port_dcb_init()
711 mlxsw_sp_port_maxrate_fini(mlxsw_sp_port); in mlxsw_sp_port_dcb_init()
713 mlxsw_sp_port_ets_fini(mlxsw_sp_port); in mlxsw_sp_port_dcb_init()
717 void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dcb_fini() argument
719 mlxsw_sp_port_pfc_fini(mlxsw_sp_port); in mlxsw_sp_port_dcb_fini()
720 mlxsw_sp_port_maxrate_fini(mlxsw_sp_port); in mlxsw_sp_port_dcb_fini()
721 mlxsw_sp_port_ets_fini(mlxsw_sp_port); in mlxsw_sp_port_dcb_fini()