Lines Matching refs:mlxsw_sp_port
252 struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_txhdr_ptp_data_construct() argument
284 this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); in mlxsw_sp_txhdr_ptp_data_construct()
301 struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_txhdr_handle() argument
313 mlxsw_sp_port, skb, in mlxsw_sp_txhdr_handle()
317 this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); in mlxsw_sp_txhdr_handle()
342 int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, in mlxsw_sp_port_vid_stp_set() argument
346 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vid_stp_set()
353 mlxsw_reg_spms_pack(spms_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_vid_stp_set()
373 int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_admin_status_set() argument
376 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_admin_status_set()
379 mlxsw_reg_paos_pack(paos_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_admin_status_set()
385 static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_dev_addr_set() argument
388 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dev_addr_set()
391 mlxsw_reg_ppad_pack(ppad_pl, true, mlxsw_sp_port->local_port); in mlxsw_sp_port_dev_addr_set()
396 static int mlxsw_sp_port_dev_addr_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dev_addr_init() argument
398 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dev_addr_init()
400 eth_hw_addr_gen(mlxsw_sp_port->dev, mlxsw_sp->base_mac, in mlxsw_sp_port_dev_addr_init()
401 mlxsw_sp_port->local_port); in mlxsw_sp_port_dev_addr_init()
402 return mlxsw_sp_port_dev_addr_set(mlxsw_sp_port, in mlxsw_sp_port_dev_addr_init()
403 mlxsw_sp_port->dev->dev_addr); in mlxsw_sp_port_dev_addr_init()
406 static int mlxsw_sp_port_max_mtu_get(struct mlxsw_sp_port *mlxsw_sp_port, int *p_max_mtu) in mlxsw_sp_port_max_mtu_get() argument
408 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_max_mtu_get()
412 mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sp_port->local_port, 0); in mlxsw_sp_port_max_mtu_get()
421 static int mlxsw_sp_port_mtu_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) in mlxsw_sp_port_mtu_set() argument
423 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_mtu_set()
427 if (mtu > mlxsw_sp_port->max_mtu) in mlxsw_sp_port_mtu_set()
430 mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sp_port->local_port, mtu); in mlxsw_sp_port_mtu_set()
443 int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable) in mlxsw_sp_port_vp_mode_set() argument
445 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vp_mode_set()
448 mlxsw_reg_svpe_pack(svpe_pl, mlxsw_sp_port->local_port, enable); in mlxsw_sp_port_vp_mode_set()
452 int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, in mlxsw_sp_port_vid_learning_set() argument
455 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vid_learning_set()
462 mlxsw_reg_spvmlr_pack(spvmlr_pl, mlxsw_sp_port->local_port, vid, vid, in mlxsw_sp_port_vid_learning_set()
485 int mlxsw_sp_port_egress_ethtype_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_egress_ethtype_set() argument
488 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_egress_ethtype_set()
497 mlxsw_reg_spevet_pack(spevet_pl, mlxsw_sp_port->local_port, sver_type); in mlxsw_sp_port_egress_ethtype_set()
501 static int __mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, in __mlxsw_sp_port_pvid_set() argument
504 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_pvid_set()
513 mlxsw_reg_spvid_pack(spvid_pl, mlxsw_sp_port->local_port, vid, in __mlxsw_sp_port_pvid_set()
519 static int mlxsw_sp_port_allow_untagged_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_allow_untagged_set() argument
522 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_allow_untagged_set()
525 mlxsw_reg_spaft_pack(spaft_pl, mlxsw_sp_port->local_port, allow); in mlxsw_sp_port_allow_untagged_set()
529 int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, in mlxsw_sp_port_pvid_set() argument
535 err = mlxsw_sp_port_allow_untagged_set(mlxsw_sp_port, false); in mlxsw_sp_port_pvid_set()
539 err = __mlxsw_sp_port_pvid_set(mlxsw_sp_port, vid, ethtype); in mlxsw_sp_port_pvid_set()
542 err = mlxsw_sp_port_allow_untagged_set(mlxsw_sp_port, true); in mlxsw_sp_port_pvid_set()
547 mlxsw_sp_port->pvid = vid; in mlxsw_sp_port_pvid_set()
551 __mlxsw_sp_port_pvid_set(mlxsw_sp_port, mlxsw_sp_port->pvid, ethtype); in mlxsw_sp_port_pvid_set()
556 mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_system_port_mapping_set() argument
558 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_system_port_mapping_set()
561 mlxsw_reg_sspr_pack(sspr_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_system_port_mapping_set()
680 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_open() local
681 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_open()
685 mlxsw_sp_port->mapping.slot_index, in mlxsw_sp_port_open()
686 mlxsw_sp_port->mapping.module); in mlxsw_sp_port_open()
689 err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); in mlxsw_sp_port_open()
697 mlxsw_sp_port->mapping.slot_index, in mlxsw_sp_port_open()
698 mlxsw_sp_port->mapping.module); in mlxsw_sp_port_open()
704 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_stop() local
705 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_stop()
708 mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); in mlxsw_sp_port_stop()
710 mlxsw_sp_port->mapping.slot_index, in mlxsw_sp_port_stop()
711 mlxsw_sp_port->mapping.module); in mlxsw_sp_port_stop()
718 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_xmit() local
719 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_xmit()
722 .local_port = mlxsw_sp_port->local_port, in mlxsw_sp_port_xmit()
734 this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); in mlxsw_sp_port_xmit()
738 err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb, in mlxsw_sp_port_xmit()
754 pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats); in mlxsw_sp_port_xmit()
760 this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); in mlxsw_sp_port_xmit()
772 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_set_mac_address() local
779 err = mlxsw_sp_port_dev_addr_set(mlxsw_sp_port, addr->sa_data); in mlxsw_sp_port_set_mac_address()
788 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_change_mtu() local
793 orig_hdroom = *mlxsw_sp_port->hdroom; in mlxsw_sp_port_change_mtu()
797 mlxsw_sp_hdroom_bufs_reset_sizes(mlxsw_sp_port, &hdroom); in mlxsw_sp_port_change_mtu()
799 err = mlxsw_sp_hdroom_configure(mlxsw_sp_port, &hdroom); in mlxsw_sp_port_change_mtu()
805 err = mlxsw_sp_port_mtu_set(mlxsw_sp_port, mtu); in mlxsw_sp_port_change_mtu()
812 mlxsw_sp_hdroom_configure(mlxsw_sp_port, &orig_hdroom); in mlxsw_sp_port_change_mtu()
820 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_get_sw_stats64() local
828 p = per_cpu_ptr(mlxsw_sp_port->pcpu_stats, i); in mlxsw_sp_port_get_sw_stats64()
872 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_get_stats_raw() local
873 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_get_stats_raw()
875 mlxsw_reg_ppcnt_pack(ppcnt_pl, mlxsw_sp_port->local_port, grp, prio); in mlxsw_sp_port_get_stats_raw()
966 struct mlxsw_sp_port *mlxsw_sp_port = in update_stats_cache() local
967 container_of(work, struct mlxsw_sp_port, in update_stats_cache()
970 if (!netif_carrier_ok(mlxsw_sp_port->dev)) in update_stats_cache()
976 mlxsw_sp_port_get_hw_stats(mlxsw_sp_port->dev, in update_stats_cache()
977 &mlxsw_sp_port->periodic_hw_stats.stats); in update_stats_cache()
978 mlxsw_sp_port_get_hw_xstats(mlxsw_sp_port->dev, in update_stats_cache()
979 &mlxsw_sp_port->periodic_hw_stats.xstats); in update_stats_cache()
982 mlxsw_core_schedule_dw(&mlxsw_sp_port->periodic_hw_stats.update_dw, in update_stats_cache()
993 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_get_stats64() local
995 memcpy(stats, &mlxsw_sp_port->periodic_hw_stats.stats, sizeof(*stats)); in mlxsw_sp_port_get_stats64()
998 static int __mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, in __mlxsw_sp_port_vlan_set() argument
1002 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_vlan_set()
1010 mlxsw_reg_spvm_pack(spvm_pl, mlxsw_sp_port->local_port, vid_begin, in __mlxsw_sp_port_vlan_set()
1017 int mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid_begin, in mlxsw_sp_port_vlan_set() argument
1028 err = __mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid_e, in mlxsw_sp_port_vlan_set()
1037 static void mlxsw_sp_port_vlan_flush(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_vlan_flush() argument
1043 &mlxsw_sp_port->vlans_list, list) { in mlxsw_sp_port_vlan_flush()
1061 mlxsw_sp_port_vlan_create(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid) in mlxsw_sp_port_vlan_create() argument
1067 mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid); in mlxsw_sp_port_vlan_create()
1071 err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid, true, untagged); in mlxsw_sp_port_vlan_create()
1081 mlxsw_sp_port_vlan->mlxsw_sp_port = mlxsw_sp_port; in mlxsw_sp_port_vlan_create()
1083 list_add(&mlxsw_sp_port_vlan->list, &mlxsw_sp_port->vlans_list); in mlxsw_sp_port_vlan_create()
1088 mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid, false, false); in mlxsw_sp_port_vlan_create()
1094 struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port; in mlxsw_sp_port_vlan_destroy() local
1100 mlxsw_sp_port_vlan_set(mlxsw_sp_port, vid, vid, false, false); in mlxsw_sp_port_vlan_destroy()
1106 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_add_vid() local
1114 return PTR_ERR_OR_ZERO(mlxsw_sp_port_vlan_create(mlxsw_sp_port, vid)); in mlxsw_sp_port_add_vid()
1120 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_kill_vid() local
1129 mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid); in mlxsw_sp_port_kill_vid()
1137 static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_setup_tc_block() argument
1142 return mlxsw_sp_setup_tc_block_clsact(mlxsw_sp_port, f, true); in mlxsw_sp_setup_tc_block()
1144 return mlxsw_sp_setup_tc_block_clsact(mlxsw_sp_port, f, false); in mlxsw_sp_setup_tc_block()
1146 return mlxsw_sp_setup_tc_block_qevent_early_drop(mlxsw_sp_port, f); in mlxsw_sp_setup_tc_block()
1148 return mlxsw_sp_setup_tc_block_qevent_mark(mlxsw_sp_port, f); in mlxsw_sp_setup_tc_block()
1157 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_setup_tc() local
1161 return mlxsw_sp_setup_tc_block(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1163 return mlxsw_sp_setup_tc_red(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1165 return mlxsw_sp_setup_tc_prio(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1167 return mlxsw_sp_setup_tc_ets(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1169 return mlxsw_sp_setup_tc_tbf(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1171 return mlxsw_sp_setup_tc_fifo(mlxsw_sp_port, type_data); in mlxsw_sp_setup_tc()
1179 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_feature_hw_tc() local
1182 if (mlxsw_sp_flow_block_rule_count(mlxsw_sp_port->ing_flow_block) || in mlxsw_sp_feature_hw_tc()
1183 mlxsw_sp_flow_block_rule_count(mlxsw_sp_port->eg_flow_block)) { in mlxsw_sp_feature_hw_tc()
1187 mlxsw_sp_flow_block_disable_inc(mlxsw_sp_port->ing_flow_block); in mlxsw_sp_feature_hw_tc()
1188 mlxsw_sp_flow_block_disable_inc(mlxsw_sp_port->eg_flow_block); in mlxsw_sp_feature_hw_tc()
1190 mlxsw_sp_flow_block_disable_dec(mlxsw_sp_port->ing_flow_block); in mlxsw_sp_feature_hw_tc()
1191 mlxsw_sp_flow_block_disable_dec(mlxsw_sp_port->eg_flow_block); in mlxsw_sp_feature_hw_tc()
1198 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_feature_loopback() local
1203 mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); in mlxsw_sp_feature_loopback()
1205 mlxsw_reg_pplr_pack(pplr_pl, mlxsw_sp_port->local_port, enable); in mlxsw_sp_feature_loopback()
1206 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pplr), in mlxsw_sp_feature_loopback()
1210 mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); in mlxsw_sp_feature_loopback()
1265 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_get_devlink_port() local
1266 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_get_devlink_port()
1269 mlxsw_sp_port->local_port); in mlxsw_sp_port_get_devlink_port()
1272 static int mlxsw_sp_port_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_set() argument
1281 err = mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_set(mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_set()
1292 static int mlxsw_sp_port_hwtstamp_get(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_get() argument
1298 err = mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_get(mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_get()
1309 static inline void mlxsw_sp_port_ptp_clear(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ptp_clear() argument
1313 mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_set(mlxsw_sp_port, &config); in mlxsw_sp_port_ptp_clear()
1319 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_ioctl() local
1323 return mlxsw_sp_port_hwtstamp_set(mlxsw_sp_port, ifr); in mlxsw_sp_port_ioctl()
1325 return mlxsw_sp_port_hwtstamp_get(mlxsw_sp_port, ifr); in mlxsw_sp_port_ioctl()
1350 mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_speed_by_width_set() argument
1352 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_speed_by_width_set()
1364 ops->reg_ptys_eth_pack(mlxsw_sp, ptys_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_speed_by_width_set()
1373 ops->reg_ptys_eth_pack(mlxsw_sp, ptys_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_speed_by_width_set()
1375 mlxsw_sp_port->link.autoneg); in mlxsw_sp_port_speed_by_width_set()
1379 int mlxsw_sp_port_speed_get(struct mlxsw_sp_port *mlxsw_sp_port, u32 *speed) in mlxsw_sp_port_speed_get() argument
1382 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_speed_get()
1389 mlxsw_sp_port->local_port, 0, in mlxsw_sp_port_speed_get()
1400 int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_ets_set() argument
1404 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_ets_set()
1407 mlxsw_reg_qeec_pack(qeec_pl, mlxsw_sp_port->local_port, hr, index, in mlxsw_sp_port_ets_set()
1415 int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_ets_maxrate_set() argument
1419 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_ets_maxrate_set()
1422 mlxsw_reg_qeec_pack(qeec_pl, mlxsw_sp_port->local_port, hr, index, in mlxsw_sp_port_ets_maxrate_set()
1430 static int mlxsw_sp_port_min_bw_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_min_bw_set() argument
1434 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_min_bw_set()
1437 mlxsw_reg_qeec_pack(qeec_pl, mlxsw_sp_port->local_port, hr, index, in mlxsw_sp_port_min_bw_set()
1445 int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_prio_tc_set() argument
1448 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_prio_tc_set()
1451 mlxsw_reg_qtct_pack(qtct_pl, mlxsw_sp_port->local_port, switch_prio, in mlxsw_sp_port_prio_tc_set()
1456 static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ets_init() argument
1463 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1468 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1475 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1481 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1493 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1499 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1507 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1514 err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1524 err = mlxsw_sp_port_min_bw_set(mlxsw_sp_port, in mlxsw_sp_port_ets_init()
1534 err = mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, 0); in mlxsw_sp_port_ets_init()
1542 static int mlxsw_sp_port_tc_mc_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_tc_mc_mode_set() argument
1545 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_tc_mc_mode_set()
1548 mlxsw_reg_qtctm_pack(qtctm_pl, mlxsw_sp_port->local_port, enable); in mlxsw_sp_port_tc_mc_mode_set()
1552 static int mlxsw_sp_port_overheat_init_val_set(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_overheat_init_val_set() argument
1554 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_overheat_init_val_set()
1555 u8 slot_index = mlxsw_sp_port->mapping.slot_index; in mlxsw_sp_port_overheat_init_val_set()
1556 u8 module = mlxsw_sp_port->mapping.module; in mlxsw_sp_port_overheat_init_val_set()
1565 mlxsw_sp_port->module_overheat_initial_val = overheat_counter; in mlxsw_sp_port_overheat_init_val_set()
1570 mlxsw_sp_port_vlan_classification_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_vlan_classification_set() argument
1574 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlan_classification_set()
1577 mlxsw_reg_spvc_pack(spvc_pl, mlxsw_sp_port->local_port, in mlxsw_sp_port_vlan_classification_set()
1604 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_port_create() local
1646 dev = alloc_etherdev(sizeof(struct mlxsw_sp_port)); in mlxsw_sp_port_create()
1653 mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_port_create()
1654 mlxsw_sp_port->dev = dev; in mlxsw_sp_port_create()
1655 mlxsw_sp_port->mlxsw_sp = mlxsw_sp; in mlxsw_sp_port_create()
1656 mlxsw_sp_port->local_port = local_port; in mlxsw_sp_port_create()
1657 mlxsw_sp_port->pvid = MLXSW_SP_DEFAULT_VID; in mlxsw_sp_port_create()
1658 mlxsw_sp_port->split = split; in mlxsw_sp_port_create()
1659 mlxsw_sp_port->mapping = *port_mapping; in mlxsw_sp_port_create()
1660 mlxsw_sp_port->link.autoneg = 1; in mlxsw_sp_port_create()
1661 INIT_LIST_HEAD(&mlxsw_sp_port->vlans_list); in mlxsw_sp_port_create()
1663 mlxsw_sp_port->pcpu_stats = in mlxsw_sp_port_create()
1665 if (!mlxsw_sp_port->pcpu_stats) { in mlxsw_sp_port_create()
1670 INIT_DELAYED_WORK(&mlxsw_sp_port->periodic_hw_stats.update_dw, in mlxsw_sp_port_create()
1676 err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1679 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1697 err = mlxsw_sp_port_system_port_mapping_set(mlxsw_sp_port); in mlxsw_sp_port_create()
1700 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1704 err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port); in mlxsw_sp_port_create()
1707 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1711 err = mlxsw_sp->port_type_speed_ops->ptys_max_speed(mlxsw_sp_port, in mlxsw_sp_port_create()
1712 &mlxsw_sp_port->max_speed); in mlxsw_sp_port_create()
1715 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1719 err = mlxsw_sp_port_max_mtu_get(mlxsw_sp_port, &mlxsw_sp_port->max_mtu); in mlxsw_sp_port_create()
1722 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1726 err = mlxsw_sp_port_mtu_set(mlxsw_sp_port, ETH_DATA_LEN); in mlxsw_sp_port_create()
1729 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1733 err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); in mlxsw_sp_port_create()
1737 err = mlxsw_sp_port_buffers_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1740 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1744 err = mlxsw_sp_port_ets_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1747 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1751 err = mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port, true); in mlxsw_sp_port_create()
1754 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1759 err = mlxsw_sp_port_dcb_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1762 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1766 err = mlxsw_sp_port_fids_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1769 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1773 err = mlxsw_sp_tc_qdisc_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1776 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1780 err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 0, VLAN_N_VID - 1, false, in mlxsw_sp_port_create()
1784 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1788 err = mlxsw_sp_port_nve_init(mlxsw_sp_port); in mlxsw_sp_port_create()
1791 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1795 err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, MLXSW_SP_DEFAULT_VID, in mlxsw_sp_port_create()
1799 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1803 mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port, in mlxsw_sp_port_create()
1807 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1811 mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; in mlxsw_sp_port_create()
1816 err = mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, false, true); in mlxsw_sp_port_create()
1823 INIT_DELAYED_WORK(&mlxsw_sp_port->ptp.shaper_dw, in mlxsw_sp_port_create()
1826 mlxsw_sp->ports[local_port] = mlxsw_sp_port; in mlxsw_sp_port_create()
1828 err = mlxsw_sp_port_overheat_init_val_set(mlxsw_sp_port); in mlxsw_sp_port_create()
1831 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1838 mlxsw_sp_port->local_port); in mlxsw_sp_port_create()
1842 mlxsw_core_port_eth_set(mlxsw_sp->core, mlxsw_sp_port->local_port, in mlxsw_sp_port_create()
1843 mlxsw_sp_port, dev); in mlxsw_sp_port_create()
1844 mlxsw_core_schedule_dw(&mlxsw_sp_port->periodic_hw_stats.update_dw, 0); in mlxsw_sp_port_create()
1849 mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, true, true); in mlxsw_sp_port_create()
1855 mlxsw_sp_port_nve_fini(mlxsw_sp_port); in mlxsw_sp_port_create()
1858 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); in mlxsw_sp_port_create()
1860 mlxsw_sp_port_fids_fini(mlxsw_sp_port); in mlxsw_sp_port_create()
1862 mlxsw_sp_port_dcb_fini(mlxsw_sp_port); in mlxsw_sp_port_create()
1864 mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port, false); in mlxsw_sp_port_create()
1867 mlxsw_sp_port_buffers_fini(mlxsw_sp_port); in mlxsw_sp_port_create()
1876 free_percpu(mlxsw_sp_port->pcpu_stats); in mlxsw_sp_port_create()
1894 struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_port_remove() local
1895 u8 slot_index = mlxsw_sp_port->mapping.slot_index; in mlxsw_sp_port_remove()
1896 u8 module = mlxsw_sp_port->mapping.module; in mlxsw_sp_port_remove()
1898 cancel_delayed_work_sync(&mlxsw_sp_port->periodic_hw_stats.update_dw); in mlxsw_sp_port_remove()
1899 cancel_delayed_work_sync(&mlxsw_sp_port->ptp.shaper_dw); in mlxsw_sp_port_remove()
1901 unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ in mlxsw_sp_port_remove()
1902 mlxsw_sp_port_ptp_clear(mlxsw_sp_port); in mlxsw_sp_port_remove()
1903 mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, true, true); in mlxsw_sp_port_remove()
1905 mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); in mlxsw_sp_port_remove()
1906 mlxsw_sp_port_nve_fini(mlxsw_sp_port); in mlxsw_sp_port_remove()
1907 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); in mlxsw_sp_port_remove()
1908 mlxsw_sp_port_fids_fini(mlxsw_sp_port); in mlxsw_sp_port_remove()
1909 mlxsw_sp_port_dcb_fini(mlxsw_sp_port); in mlxsw_sp_port_remove()
1910 mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port, false); in mlxsw_sp_port_remove()
1911 mlxsw_sp_port_buffers_fini(mlxsw_sp_port); in mlxsw_sp_port_remove()
1912 free_percpu(mlxsw_sp_port->pcpu_stats); in mlxsw_sp_port_remove()
1913 WARN_ON_ONCE(!list_empty(&mlxsw_sp_port->vlans_list)); in mlxsw_sp_port_remove()
1914 free_netdev(mlxsw_sp_port->dev); in mlxsw_sp_port_remove()
1923 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_cpu_port_create() local
1926 mlxsw_sp_port = kzalloc(sizeof(*mlxsw_sp_port), GFP_KERNEL); in mlxsw_sp_cpu_port_create()
1927 if (!mlxsw_sp_port) in mlxsw_sp_cpu_port_create()
1930 mlxsw_sp_port->mlxsw_sp = mlxsw_sp; in mlxsw_sp_cpu_port_create()
1931 mlxsw_sp_port->local_port = MLXSW_PORT_CPU_PORT; in mlxsw_sp_cpu_port_create()
1934 mlxsw_sp_port, in mlxsw_sp_cpu_port_create()
1942 mlxsw_sp->ports[MLXSW_PORT_CPU_PORT] = mlxsw_sp_port; in mlxsw_sp_cpu_port_create()
1946 kfree(mlxsw_sp_port); in mlxsw_sp_cpu_port_create()
1952 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_cpu_port_remove() local
1957 kfree(mlxsw_sp_port); in mlxsw_sp_cpu_port_remove()
2115 alloc_size = sizeof(struct mlxsw_sp_port *) * max_ports; in mlxsw_sp_ports_create()
2247 static struct mlxsw_sp_port *
2261 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_port_split() local
2267 mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port); in mlxsw_sp_port_split()
2268 if (!mlxsw_sp_port) { in mlxsw_sp_port_split()
2275 if (mlxsw_sp_port->split) { in mlxsw_sp_port_split()
2280 mlxsw_reg_pmtdb_pack(pmtdb_pl, mlxsw_sp_port->mapping.slot_index, in mlxsw_sp_port_split()
2281 mlxsw_sp_port->mapping.module, in mlxsw_sp_port_split()
2282 mlxsw_sp_port->mapping.module_width / count, in mlxsw_sp_port_split()
2296 port_mapping = mlxsw_sp_port->mapping; in mlxsw_sp_port_split()
2324 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_port_unsplit() local
2330 mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port); in mlxsw_sp_port_unsplit()
2331 if (!mlxsw_sp_port) { in mlxsw_sp_port_unsplit()
2338 if (!mlxsw_sp_port->split) { in mlxsw_sp_port_unsplit()
2343 count = mlxsw_sp_port->mapping.module_width / in mlxsw_sp_port_unsplit()
2344 mlxsw_sp_port->mapping.width; in mlxsw_sp_port_unsplit()
2346 mlxsw_reg_pmtdb_pack(pmtdb_pl, mlxsw_sp_port->mapping.slot_index, in mlxsw_sp_port_unsplit()
2347 mlxsw_sp_port->mapping.module, in mlxsw_sp_port_unsplit()
2348 mlxsw_sp_port->mapping.module_width / count, in mlxsw_sp_port_unsplit()
2369 mlxsw_sp_port_down_wipe_counters(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_down_wipe_counters() argument
2374 mlxsw_sp_port->periodic_hw_stats.xstats.backlog[i] = 0; in mlxsw_sp_port_down_wipe_counters()
2381 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_pude_event_func() local
2389 mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_pude_event_func()
2390 if (!mlxsw_sp_port) in mlxsw_sp_pude_event_func()
2395 netdev_info(mlxsw_sp_port->dev, "link up\n"); in mlxsw_sp_pude_event_func()
2396 netif_carrier_on(mlxsw_sp_port->dev); in mlxsw_sp_pude_event_func()
2397 mlxsw_core_schedule_dw(&mlxsw_sp_port->ptp.shaper_dw, 0); in mlxsw_sp_pude_event_func()
2399 netdev_info(mlxsw_sp_port->dev, "link down\n"); in mlxsw_sp_pude_event_func()
2400 netif_carrier_off(mlxsw_sp_port->dev); in mlxsw_sp_pude_event_func()
2401 mlxsw_sp_port_down_wipe_counters(mlxsw_sp_port); in mlxsw_sp_pude_event_func()
2449 struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_rx_listener_no_mark_func() local
2452 if (unlikely(!mlxsw_sp_port)) { in mlxsw_sp_rx_listener_no_mark_func()
2458 skb->dev = mlxsw_sp_port->dev; in mlxsw_sp_rx_listener_no_mark_func()
2460 pcpu_stats = this_cpu_ptr(mlxsw_sp_port->pcpu_stats); in mlxsw_sp_rx_listener_no_mark_func()
4094 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev) in mlxsw_sp_port_dev_lower_find()
4105 return (struct mlxsw_sp_port *)priv.data; in mlxsw_sp_port_dev_lower_find()
4110 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_lower_get() local
4112 mlxsw_sp_port = mlxsw_sp_port_dev_lower_find(dev); in mlxsw_sp_lower_get()
4113 return mlxsw_sp_port ? mlxsw_sp_port->mlxsw_sp : NULL; in mlxsw_sp_lower_get()
4116 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev) in mlxsw_sp_port_dev_lower_find_rcu()
4128 return (struct mlxsw_sp_port *)priv.data; in mlxsw_sp_port_dev_lower_find_rcu()
4131 struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev) in mlxsw_sp_port_lower_dev_hold()
4133 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_port_lower_dev_hold() local
4136 mlxsw_sp_port = mlxsw_sp_port_dev_lower_find_rcu(dev); in mlxsw_sp_port_lower_dev_hold()
4137 if (mlxsw_sp_port) in mlxsw_sp_port_lower_dev_hold()
4138 dev_hold(mlxsw_sp_port->dev); in mlxsw_sp_port_lower_dev_hold()
4140 return mlxsw_sp_port; in mlxsw_sp_port_lower_dev_hold()
4143 void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_dev_put() argument
4145 dev_put(mlxsw_sp_port->dev); in mlxsw_sp_port_dev_put()
4212 mlxsw_sp_port_lag_uppers_cleanup(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_lag_uppers_cleanup() argument
4220 mlxsw_sp_port_bridge_leave(mlxsw_sp_port, lag_dev, br_dev); in mlxsw_sp_port_lag_uppers_cleanup()
4226 mlxsw_sp_port_bridge_leave(mlxsw_sp_port, upper_dev, br_dev); in mlxsw_sp_port_lag_uppers_cleanup()
4246 static int mlxsw_sp_lag_col_port_add(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_col_port_add() argument
4249 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_add()
4252 mlxsw_reg_slcor_port_add_pack(slcor_pl, mlxsw_sp_port->local_port, in mlxsw_sp_lag_col_port_add()
4257 static int mlxsw_sp_lag_col_port_remove(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_col_port_remove() argument
4260 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_remove()
4263 mlxsw_reg_slcor_port_remove_pack(slcor_pl, mlxsw_sp_port->local_port, in mlxsw_sp_lag_col_port_remove()
4268 static int mlxsw_sp_lag_col_port_enable(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_col_port_enable() argument
4271 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_enable()
4274 mlxsw_reg_slcor_col_enable_pack(slcor_pl, mlxsw_sp_port->local_port, in mlxsw_sp_lag_col_port_enable()
4279 static int mlxsw_sp_lag_col_port_disable(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_col_port_disable() argument
4282 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_disable()
4285 mlxsw_reg_slcor_col_disable_pack(slcor_pl, mlxsw_sp_port->local_port, in mlxsw_sp_lag_col_port_disable()
4356 static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_lag_join() argument
4360 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_lag_join()
4380 err = mlxsw_sp_lag_col_port_add(mlxsw_sp_port, lag_id, port_index); in mlxsw_sp_port_lag_join()
4385 mlxsw_sp_port->local_port); in mlxsw_sp_port_lag_join()
4386 mlxsw_sp_port->lag_id = lag_id; in mlxsw_sp_port_lag_join()
4387 mlxsw_sp_port->lagged = 1; in mlxsw_sp_port_lag_join()
4391 if (mlxsw_sp_port->default_vlan->fid) in mlxsw_sp_port_lag_join()
4392 mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port->default_vlan); in mlxsw_sp_port_lag_join()
4395 err = mlxsw_sp_port_vlan_router_join(mlxsw_sp_port->default_vlan, in mlxsw_sp_port_lag_join()
4404 mlxsw_sp_port->lagged = 0; in mlxsw_sp_port_lag_join()
4406 mlxsw_sp_port->local_port); in mlxsw_sp_port_lag_join()
4407 mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id); in mlxsw_sp_port_lag_join()
4414 static void mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_lag_leave() argument
4417 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_lag_leave()
4418 u16 lag_id = mlxsw_sp_port->lag_id; in mlxsw_sp_port_lag_leave()
4421 if (!mlxsw_sp_port->lagged) in mlxsw_sp_port_lag_leave()
4426 mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id); in mlxsw_sp_port_lag_leave()
4429 mlxsw_sp_port_vlan_flush(mlxsw_sp_port, false); in mlxsw_sp_port_lag_leave()
4430 mlxsw_sp_port_vlan_cleanup(mlxsw_sp_port->default_vlan); in mlxsw_sp_port_lag_leave()
4434 mlxsw_sp_port_lag_uppers_cleanup(mlxsw_sp_port, lag_dev); in mlxsw_sp_port_lag_leave()
4440 mlxsw_sp_port->local_port); in mlxsw_sp_port_lag_leave()
4441 mlxsw_sp_port->lagged = 0; in mlxsw_sp_port_lag_leave()
4445 mlxsw_sp_port_pvid_set(mlxsw_sp_port, MLXSW_SP_DEFAULT_VID, in mlxsw_sp_port_lag_leave()
4449 static int mlxsw_sp_lag_dist_port_add(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_dist_port_add() argument
4452 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_dist_port_add()
4456 mlxsw_sp_port->local_port); in mlxsw_sp_lag_dist_port_add()
4460 static int mlxsw_sp_lag_dist_port_remove(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_lag_dist_port_remove() argument
4463 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_dist_port_remove()
4467 mlxsw_sp_port->local_port); in mlxsw_sp_lag_dist_port_remove()
4472 mlxsw_sp_port_lag_col_dist_enable(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_lag_col_dist_enable() argument
4476 err = mlxsw_sp_lag_col_port_enable(mlxsw_sp_port, in mlxsw_sp_port_lag_col_dist_enable()
4477 mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_enable()
4481 err = mlxsw_sp_lag_dist_port_add(mlxsw_sp_port, mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_enable()
4488 mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_enable()
4493 mlxsw_sp_port_lag_col_dist_disable(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_lag_col_dist_disable() argument
4497 err = mlxsw_sp_lag_dist_port_remove(mlxsw_sp_port, in mlxsw_sp_port_lag_col_dist_disable()
4498 mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_disable()
4502 err = mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, in mlxsw_sp_port_lag_col_dist_disable()
4503 mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_disable()
4510 mlxsw_sp_lag_dist_port_add(mlxsw_sp_port, mlxsw_sp_port->lag_id); in mlxsw_sp_port_lag_col_dist_disable()
4514 static int mlxsw_sp_port_lag_changed(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_lag_changed() argument
4518 return mlxsw_sp_port_lag_col_dist_enable(mlxsw_sp_port); in mlxsw_sp_port_lag_changed()
4520 return mlxsw_sp_port_lag_col_dist_disable(mlxsw_sp_port); in mlxsw_sp_port_lag_changed()
4523 static int mlxsw_sp_port_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_stp_set() argument
4526 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_stp_set()
4538 mlxsw_reg_spms_pack(spms_pl, mlxsw_sp_port->local_port); in mlxsw_sp_port_stp_set()
4548 static int mlxsw_sp_port_ovs_join(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ovs_join() argument
4553 err = mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, true); in mlxsw_sp_port_ovs_join()
4556 err = mlxsw_sp_port_stp_set(mlxsw_sp_port, true); in mlxsw_sp_port_ovs_join()
4559 err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 1, VLAN_N_VID - 2, in mlxsw_sp_port_ovs_join()
4565 err = mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, in mlxsw_sp_port_ovs_join()
4575 mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true); in mlxsw_sp_port_ovs_join()
4577 mlxsw_sp_port_stp_set(mlxsw_sp_port, false); in mlxsw_sp_port_ovs_join()
4579 mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, false); in mlxsw_sp_port_ovs_join()
4583 static void mlxsw_sp_port_ovs_leave(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_ovs_leave() argument
4588 mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, in mlxsw_sp_port_ovs_leave()
4591 mlxsw_sp_port_vlan_set(mlxsw_sp_port, 1, VLAN_N_VID - 2, in mlxsw_sp_port_ovs_leave()
4593 mlxsw_sp_port_stp_set(mlxsw_sp_port, false); in mlxsw_sp_port_ovs_leave()
4594 mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, false); in mlxsw_sp_port_ovs_leave()
4663 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_netdevice_port_upper_event() local
4670 mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_netdevice_port_upper_event()
4671 mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_netdevice_port_upper_event()
4762 err = mlxsw_sp_port_bridge_join(mlxsw_sp_port, in mlxsw_sp_netdevice_port_upper_event()
4767 mlxsw_sp_port_bridge_leave(mlxsw_sp_port, in mlxsw_sp_netdevice_port_upper_event()
4772 err = mlxsw_sp_port_lag_join(mlxsw_sp_port, in mlxsw_sp_netdevice_port_upper_event()
4775 mlxsw_sp_port_lag_col_dist_disable(mlxsw_sp_port); in mlxsw_sp_netdevice_port_upper_event()
4776 mlxsw_sp_port_lag_leave(mlxsw_sp_port, in mlxsw_sp_netdevice_port_upper_event()
4781 err = mlxsw_sp_port_ovs_join(mlxsw_sp_port); in mlxsw_sp_netdevice_port_upper_event()
4783 mlxsw_sp_port_ovs_leave(mlxsw_sp_port); in mlxsw_sp_netdevice_port_upper_event()
4795 mlxsw_sp_port_bridge_leave(mlxsw_sp_port, upper_dev, in mlxsw_sp_netdevice_port_upper_event()
4808 struct mlxsw_sp_port *mlxsw_sp_port; in mlxsw_sp_netdevice_port_lower_event() local
4811 mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_netdevice_port_lower_event()
4816 if (netif_is_lag_port(dev) && mlxsw_sp_port->lagged) { in mlxsw_sp_netdevice_port_lower_event()
4817 err = mlxsw_sp_port_lag_changed(mlxsw_sp_port, in mlxsw_sp_netdevice_port_lower_event()
4869 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); in mlxsw_sp_netdevice_port_vlan_event() local
4870 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_netdevice_port_vlan_event()
4911 err = mlxsw_sp_port_bridge_join(mlxsw_sp_port, in mlxsw_sp_netdevice_port_vlan_event()
4916 mlxsw_sp_port_bridge_leave(mlxsw_sp_port, in mlxsw_sp_netdevice_port_vlan_event()