Lines Matching refs:mlxsw_sp

178 int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp,  in mlxsw_sp_flow_counter_get()  argument
187 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(mgpc), mgpc_pl); in mlxsw_sp_flow_counter_get()
197 static int mlxsw_sp_flow_counter_clear(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_flow_counter_clear() argument
204 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mgpc), mgpc_pl); in mlxsw_sp_flow_counter_clear()
207 int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_flow_counter_alloc() argument
212 err = mlxsw_sp_counter_alloc(mlxsw_sp, MLXSW_SP_COUNTER_SUB_POOL_FLOW, in mlxsw_sp_flow_counter_alloc()
216 err = mlxsw_sp_flow_counter_clear(mlxsw_sp, *p_counter_index); in mlxsw_sp_flow_counter_alloc()
222 mlxsw_sp_counter_free(mlxsw_sp, MLXSW_SP_COUNTER_SUB_POOL_FLOW, in mlxsw_sp_flow_counter_alloc()
227 void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_flow_counter_free() argument
230 mlxsw_sp_counter_free(mlxsw_sp, MLXSW_SP_COUNTER_SUB_POOL_FLOW, in mlxsw_sp_flow_counter_free()
305 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_txhdr_handle() local
312 return mlxsw_sp->ptp_ops->txhdr_construct(mlxsw_core, in mlxsw_sp_txhdr_handle()
346 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vid_stp_set() local
356 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spms), spms_pl); in mlxsw_sp_port_vid_stp_set()
361 static int mlxsw_sp_base_mac_get(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_base_mac_get() argument
366 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(spad), spad_pl); in mlxsw_sp_base_mac_get()
369 mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_sp->base_mac); in mlxsw_sp_base_mac_get()
376 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_admin_status_set() local
382 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(paos), paos_pl); in mlxsw_sp_port_admin_status_set()
388 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dev_addr_set() local
393 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppad), ppad_pl); in mlxsw_sp_port_dev_addr_set()
398 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_dev_addr_init() local
400 eth_hw_addr_gen(mlxsw_sp_port->dev, mlxsw_sp->base_mac, in mlxsw_sp_port_dev_addr_init()
408 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_max_mtu_get() local
413 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pmtu), pmtu_pl); in mlxsw_sp_port_max_mtu_get()
423 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_mtu_set() local
431 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmtu), pmtu_pl); in mlxsw_sp_port_mtu_set()
434 static int mlxsw_sp_port_swid_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_swid_set() argument
440 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pspa), pspa_pl); in mlxsw_sp_port_swid_set()
445 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vp_mode_set() local
449 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svpe), svpe_pl); in mlxsw_sp_port_vp_mode_set()
455 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vid_learning_set() local
464 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvmlr), spvmlr_pl); in mlxsw_sp_port_vid_learning_set()
488 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_egress_ethtype_set() local
498 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spevet), spevet_pl); in mlxsw_sp_port_egress_ethtype_set()
504 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_pvid_set() local
516 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvid), spvid_pl); in __mlxsw_sp_port_pvid_set()
522 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_allow_untagged_set() local
526 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spaft), spaft_pl); in mlxsw_sp_port_allow_untagged_set()
558 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_system_port_mapping_set() local
562 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sspr), sspr_pl); in mlxsw_sp_port_system_port_mapping_set()
566 mlxsw_sp_port_module_info_parse(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_module_info_parse() argument
584 …dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: width value is not power of … in mlxsw_sp_port_module_info_parse()
591 …dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: contains multiple modules\n", in mlxsw_sp_port_module_info_parse()
596 …dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: contains multiple slot index… in mlxsw_sp_port_module_info_parse()
603 …dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: TX and RX lane numbers are d… in mlxsw_sp_port_module_info_parse()
608 …dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: TX and RX lane numbers are n… in mlxsw_sp_port_module_info_parse()
623 mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_port_module_info_get() argument
630 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pmlp), pmlp_pl); in mlxsw_sp_port_module_info_get()
633 return mlxsw_sp_port_module_info_parse(mlxsw_sp, local_port, in mlxsw_sp_port_module_info_get()
638 mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_port_module_map() argument
644 mlxsw_env_module_port_map(mlxsw_sp->core, port_mapping->slot_index, in mlxsw_sp_port_module_map()
656 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmlp), pmlp_pl); in mlxsw_sp_port_module_map()
662 mlxsw_env_module_port_unmap(mlxsw_sp->core, port_mapping->slot_index, in mlxsw_sp_port_module_map()
667 static void mlxsw_sp_port_module_unmap(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_port_module_unmap() argument
674 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmlp), pmlp_pl); in mlxsw_sp_port_module_unmap()
675 mlxsw_env_module_port_unmap(mlxsw_sp->core, slot_index, module); in mlxsw_sp_port_module_unmap()
681 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_open() local
684 err = mlxsw_env_module_port_up(mlxsw_sp->core, in mlxsw_sp_port_open()
696 mlxsw_env_module_port_down(mlxsw_sp->core, in mlxsw_sp_port_open()
705 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_stop() local
709 mlxsw_env_module_port_down(mlxsw_sp->core, in mlxsw_sp_port_stop()
719 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_xmit() local
730 if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info)) in mlxsw_sp_port_xmit()
738 err = mlxsw_sp_txhdr_handle(mlxsw_sp->core, mlxsw_sp_port, skb, in mlxsw_sp_port_xmit()
751 err = mlxsw_core_skb_transmit(mlxsw_sp->core, skb, &tx_info); in mlxsw_sp_port_xmit()
873 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_get_stats_raw() local
876 return mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ppcnt), ppcnt_pl); in mlxsw_sp_port_get_stats_raw()
1002 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_vlan_set() local
1012 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvm), spvm_pl); in __mlxsw_sp_port_vlan_set()
1206 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pplr), in mlxsw_sp_feature_loopback()
1266 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_get_devlink_port() local
1268 return mlxsw_core_port_devlink_port_get(mlxsw_sp->core, in mlxsw_sp_port_get_devlink_port()
1281 err = mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_set(mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_set()
1298 err = mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_get(mlxsw_sp_port, in mlxsw_sp_port_hwtstamp_get()
1313 mlxsw_sp_port->mlxsw_sp->ptp_ops->hwtstamp_set(mlxsw_sp_port, &config); in mlxsw_sp_port_ptp_clear()
1352 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_speed_by_width_set() local
1359 ops = mlxsw_sp->port_type_speed_ops; 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()
1366 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); in mlxsw_sp_port_speed_by_width_set()
1370 ops->reg_ptys_eth_unpack(mlxsw_sp, ptys_pl, &eth_proto_cap, 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()
1376 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); in mlxsw_sp_port_speed_by_width_set()
1382 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_speed_get() local
1387 port_type_speed_ops = mlxsw_sp->port_type_speed_ops; in mlxsw_sp_port_speed_get()
1388 port_type_speed_ops->reg_ptys_eth_pack(mlxsw_sp, ptys_pl, in mlxsw_sp_port_speed_get()
1391 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); in mlxsw_sp_port_speed_get()
1394 port_type_speed_ops->reg_ptys_eth_unpack(mlxsw_sp, ptys_pl, NULL, NULL, in mlxsw_sp_port_speed_get()
1396 *speed = port_type_speed_ops->from_ptys_speed(mlxsw_sp, eth_proto_oper); in mlxsw_sp_port_speed_get()
1404 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_ets_set() local
1412 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl); in mlxsw_sp_port_ets_set()
1419 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_ets_maxrate_set() local
1427 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl); in mlxsw_sp_port_ets_maxrate_set()
1434 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_min_bw_set() local
1442 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl); in mlxsw_sp_port_min_bw_set()
1448 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_prio_tc_set() local
1453 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qtct), qtct_pl); in mlxsw_sp_port_prio_tc_set()
1545 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_tc_mc_mode_set() local
1549 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qtctm), qtctm_pl); in mlxsw_sp_port_tc_mc_mode_set()
1554 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_overheat_init_val_set() local
1560 err = mlxsw_env_module_overheat_counter_get(mlxsw_sp->core, slot_index, in mlxsw_sp_port_overheat_init_val_set()
1574 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlan_classification_set() local
1579 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvc), spvc_pl); in mlxsw_sp_port_vlan_classification_set()
1582 static int mlxsw_sp_port_label_info_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_label_info_get() argument
1591 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pllp), pllp_pl); in mlxsw_sp_port_label_info_get()
1599 static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_port_create() argument
1613 err = mlxsw_sp_port_module_map(mlxsw_sp, local_port, port_mapping); in mlxsw_sp_port_create()
1615 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to map module\n", in mlxsw_sp_port_create()
1620 err = mlxsw_sp_port_swid_set(mlxsw_sp, local_port, 0); in mlxsw_sp_port_create()
1622 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", in mlxsw_sp_port_create()
1627 err = mlxsw_sp_port_label_info_get(mlxsw_sp, local_port, &port_number, in mlxsw_sp_port_create()
1630 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to get port label information\n", in mlxsw_sp_port_create()
1636 err = mlxsw_core_port_init(mlxsw_sp->core, local_port, slot_index, in mlxsw_sp_port_create()
1638 splittable, lanes, mlxsw_sp->base_mac, in mlxsw_sp_port_create()
1639 sizeof(mlxsw_sp->base_mac)); in mlxsw_sp_port_create()
1641 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to init core port\n", in mlxsw_sp_port_create()
1651 SET_NETDEV_DEV(dev, mlxsw_sp->bus_info->dev); in mlxsw_sp_port_create()
1652 dev_net_set(dev, mlxsw_sp_net(mlxsw_sp)); in mlxsw_sp_port_create()
1655 mlxsw_sp_port->mlxsw_sp = mlxsw_sp; in mlxsw_sp_port_create()
1678 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", in mlxsw_sp_port_create()
1699 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set system port mapping\n", in mlxsw_sp_port_create()
1706 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", in mlxsw_sp_port_create()
1711 err = mlxsw_sp->port_type_speed_ops->ptys_max_speed(mlxsw_sp_port, in mlxsw_sp_port_create()
1714 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to get maximum speed\n", in mlxsw_sp_port_create()
1721 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to get maximum MTU\n", in mlxsw_sp_port_create()
1728 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set MTU\n", in mlxsw_sp_port_create()
1739 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize buffers\n", in mlxsw_sp_port_create()
1746 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize ETS\n", in mlxsw_sp_port_create()
1753 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize TC MC mode\n", in mlxsw_sp_port_create()
1761 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize DCB\n", in mlxsw_sp_port_create()
1768 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize FIDs\n", in mlxsw_sp_port_create()
1775 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize TC qdiscs\n", in mlxsw_sp_port_create()
1783 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to clear VLAN filter\n", in mlxsw_sp_port_create()
1790 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n", in mlxsw_sp_port_create()
1798 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set PVID\n", in mlxsw_sp_port_create()
1806 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to create VID 1\n", in mlxsw_sp_port_create()
1818 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set default VLAN classification\n", in mlxsw_sp_port_create()
1824 mlxsw_sp->ptp_ops->shaper_work); in mlxsw_sp_port_create()
1826 mlxsw_sp->ports[local_port] = mlxsw_sp_port; in mlxsw_sp_port_create()
1830 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set overheat initial value\n", in mlxsw_sp_port_create()
1837 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to register netdev\n", in mlxsw_sp_port_create()
1842 mlxsw_core_port_eth_set(mlxsw_sp->core, mlxsw_sp_port->local_port, in mlxsw_sp_port_create()
1851 mlxsw_sp->ports[local_port] = NULL; in mlxsw_sp_port_create()
1880 mlxsw_core_port_fini(mlxsw_sp->core, local_port); in mlxsw_sp_port_create()
1883 mlxsw_sp_port_swid_set(mlxsw_sp, local_port, in mlxsw_sp_port_create()
1886 mlxsw_sp_port_module_unmap(mlxsw_sp, local_port, in mlxsw_sp_port_create()
1892 static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u16 local_port) in mlxsw_sp_port_remove() argument
1894 struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_port_remove()
1900 mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); in mlxsw_sp_port_remove()
1904 mlxsw_sp->ports[local_port] = NULL; in mlxsw_sp_port_remove()
1915 mlxsw_core_port_fini(mlxsw_sp->core, local_port); in mlxsw_sp_port_remove()
1916 mlxsw_sp_port_swid_set(mlxsw_sp, local_port, in mlxsw_sp_port_remove()
1918 mlxsw_sp_port_module_unmap(mlxsw_sp, local_port, slot_index, module); in mlxsw_sp_port_remove()
1921 static int mlxsw_sp_cpu_port_create(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_cpu_port_create() argument
1930 mlxsw_sp_port->mlxsw_sp = mlxsw_sp; in mlxsw_sp_cpu_port_create()
1933 err = mlxsw_core_cpu_port_init(mlxsw_sp->core, in mlxsw_sp_cpu_port_create()
1935 mlxsw_sp->base_mac, in mlxsw_sp_cpu_port_create()
1936 sizeof(mlxsw_sp->base_mac)); in mlxsw_sp_cpu_port_create()
1938 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize core CPU port\n"); in mlxsw_sp_cpu_port_create()
1942 mlxsw_sp->ports[MLXSW_PORT_CPU_PORT] = mlxsw_sp_port; in mlxsw_sp_cpu_port_create()
1950 static void mlxsw_sp_cpu_port_remove(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_cpu_port_remove() argument
1953 mlxsw_sp->ports[MLXSW_PORT_CPU_PORT]; in mlxsw_sp_cpu_port_remove()
1955 mlxsw_core_cpu_port_fini(mlxsw_sp->core); in mlxsw_sp_cpu_port_remove()
1956 mlxsw_sp->ports[MLXSW_PORT_CPU_PORT] = NULL; in mlxsw_sp_cpu_port_remove()
1965 static bool mlxsw_sp_port_created(struct mlxsw_sp *mlxsw_sp, u16 local_port) in mlxsw_sp_port_created() argument
1969 return mlxsw_sp->ports[local_port] != NULL; in mlxsw_sp_port_created()
1972 static int mlxsw_sp_port_mapping_event_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_mapping_event_set() argument
1980 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmecr), pmecr_pl); in mlxsw_sp_port_mapping_event_set()
1993 struct mlxsw_sp *mlxsw_sp; in mlxsw_sp_port_mapping_events_work() local
2000 mlxsw_sp = container_of(events, struct mlxsw_sp, port_mapping_events); in mlxsw_sp_port_mapping_events_work()
2001 devlink = priv_to_devlink(mlxsw_sp->core); in mlxsw_sp_port_mapping_events_work()
2009 err = mlxsw_sp_port_module_info_parse(mlxsw_sp, local_port, in mlxsw_sp_port_mapping_events_work()
2019 if (!mlxsw_sp_port_created(mlxsw_sp, local_port)) in mlxsw_sp_port_mapping_events_work()
2020 mlxsw_sp_port_create(mlxsw_sp, local_port, in mlxsw_sp_port_mapping_events_work()
2027 mlxsw_sp->port_mapping[local_port] = port_mapping; in mlxsw_sp_port_mapping_events_work()
2040 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_port_mapping_listener_func() local
2044 if (WARN_ON_ONCE(!mlxsw_sp_local_port_is_valid(mlxsw_sp, local_port))) in mlxsw_sp_port_mapping_listener_func()
2047 events = &mlxsw_sp->port_mapping_events; in mlxsw_sp_port_mapping_listener_func()
2059 __mlxsw_sp_port_mapping_events_cancel(struct mlxsw_sp *mlxsw_sp) in __mlxsw_sp_port_mapping_events_cancel() argument
2064 events = &mlxsw_sp->port_mapping_events; in __mlxsw_sp_port_mapping_events_cancel()
2074 static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_ports_remove() argument
2076 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_ports_remove()
2080 mlxsw_sp_port_mapping_event_set(mlxsw_sp, i, false); in mlxsw_sp_ports_remove()
2082 __mlxsw_sp_port_mapping_events_cancel(mlxsw_sp); in mlxsw_sp_ports_remove()
2085 if (mlxsw_sp_port_created(mlxsw_sp, i)) in mlxsw_sp_ports_remove()
2086 mlxsw_sp_port_remove(mlxsw_sp, i); in mlxsw_sp_ports_remove()
2087 mlxsw_sp_cpu_port_remove(mlxsw_sp); in mlxsw_sp_ports_remove()
2088 kfree(mlxsw_sp->ports); in mlxsw_sp_ports_remove()
2089 mlxsw_sp->ports = NULL; in mlxsw_sp_ports_remove()
2097 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_ports_remove_selected() local
2102 if (mlxsw_sp_port_created(mlxsw_sp, i) && selector(priv, i)) in mlxsw_sp_ports_remove_selected()
2103 mlxsw_sp_port_remove(mlxsw_sp, i); in mlxsw_sp_ports_remove_selected()
2106 static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_ports_create() argument
2108 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_ports_create()
2116 mlxsw_sp->ports = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_ports_create()
2117 if (!mlxsw_sp->ports) in mlxsw_sp_ports_create()
2120 events = &mlxsw_sp->port_mapping_events; in mlxsw_sp_ports_create()
2126 err = mlxsw_sp_port_mapping_event_set(mlxsw_sp, i, true); in mlxsw_sp_ports_create()
2131 err = mlxsw_sp_cpu_port_create(mlxsw_sp); in mlxsw_sp_ports_create()
2136 port_mapping = &mlxsw_sp->port_mapping[i]; in mlxsw_sp_ports_create()
2139 err = mlxsw_sp_port_create(mlxsw_sp, i, false, port_mapping); in mlxsw_sp_ports_create()
2147 if (mlxsw_sp_port_created(mlxsw_sp, i)) in mlxsw_sp_ports_create()
2148 mlxsw_sp_port_remove(mlxsw_sp, i); in mlxsw_sp_ports_create()
2150 mlxsw_sp_cpu_port_remove(mlxsw_sp); in mlxsw_sp_ports_create()
2154 mlxsw_sp_port_mapping_event_set(mlxsw_sp, i, false); in mlxsw_sp_ports_create()
2156 __mlxsw_sp_port_mapping_events_cancel(mlxsw_sp); in mlxsw_sp_ports_create()
2157 kfree(mlxsw_sp->ports); in mlxsw_sp_ports_create()
2158 mlxsw_sp->ports = NULL; in mlxsw_sp_ports_create()
2162 static int mlxsw_sp_port_module_info_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_port_module_info_init() argument
2164 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_port_module_info_init()
2169 mlxsw_sp->port_mapping = kcalloc(max_ports, in mlxsw_sp_port_module_info_init()
2172 if (!mlxsw_sp->port_mapping) in mlxsw_sp_port_module_info_init()
2176 port_mapping = &mlxsw_sp->port_mapping[i]; in mlxsw_sp_port_module_info_init()
2177 err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, port_mapping); in mlxsw_sp_port_module_info_init()
2184 kfree(mlxsw_sp->port_mapping); in mlxsw_sp_port_module_info_init()
2188 static void mlxsw_sp_port_module_info_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_port_module_info_fini() argument
2190 kfree(mlxsw_sp->port_mapping); in mlxsw_sp_port_module_info_fini()
2194 mlxsw_sp_port_split_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_split_create() argument
2209 err = mlxsw_sp_port_create(mlxsw_sp, s_local_port, in mlxsw_sp_port_split_create()
2222 if (mlxsw_sp_port_created(mlxsw_sp, s_local_port)) in mlxsw_sp_port_split_create()
2223 mlxsw_sp_port_remove(mlxsw_sp, s_local_port); in mlxsw_sp_port_split_create()
2228 static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_unsplit_create() argument
2239 port_mapping = &mlxsw_sp->port_mapping[local_port]; in mlxsw_sp_port_unsplit_create()
2242 mlxsw_sp_port_create(mlxsw_sp, local_port, in mlxsw_sp_port_unsplit_create()
2248 mlxsw_sp_port_get_by_local_port(struct mlxsw_sp *mlxsw_sp, u16 local_port) in mlxsw_sp_port_get_by_local_port() argument
2250 if (mlxsw_sp->ports && mlxsw_sp->ports[local_port]) in mlxsw_sp_port_get_by_local_port()
2251 return mlxsw_sp->ports[local_port]; in mlxsw_sp_port_get_by_local_port()
2259 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); 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()
2269 dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n", in mlxsw_sp_port_split()
2301 if (mlxsw_sp_port_created(mlxsw_sp, s_local_port)) in mlxsw_sp_port_split()
2302 mlxsw_sp_port_remove(mlxsw_sp, s_local_port); in mlxsw_sp_port_split()
2305 err = mlxsw_sp_port_split_create(mlxsw_sp, &port_mapping, in mlxsw_sp_port_split()
2308 dev_err(mlxsw_sp->bus_info->dev, "Failed to create split ports\n"); in mlxsw_sp_port_split()
2315 mlxsw_sp_port_unsplit_create(mlxsw_sp, count, pmtdb_pl); in mlxsw_sp_port_split()
2323 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); 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()
2332 dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n", in mlxsw_sp_port_unsplit()
2359 if (mlxsw_sp_port_created(mlxsw_sp, s_local_port)) in mlxsw_sp_port_unsplit()
2360 mlxsw_sp_port_remove(mlxsw_sp, s_local_port); in mlxsw_sp_port_unsplit()
2363 mlxsw_sp_port_unsplit_create(mlxsw_sp, count, pmtdb_pl); in mlxsw_sp_port_unsplit()
2380 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_pude_event_func() local
2387 if (WARN_ON_ONCE(!mlxsw_sp_local_port_is_valid(mlxsw_sp, local_port))) in mlxsw_sp_pude_event_func()
2389 mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_pude_event_func()
2405 static void mlxsw_sp1_ptp_fifo_event_func(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp1_ptp_fifo_event_func() argument
2423 mlxsw_sp1_ptp_got_timestamp(mlxsw_sp, ingress, local_port, in mlxsw_sp1_ptp_fifo_event_func()
2432 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp1_ptp_ing_fifo_event_func() local
2434 mlxsw_sp1_ptp_fifo_event_func(mlxsw_sp, mtpptr_pl, true); in mlxsw_sp1_ptp_ing_fifo_event_func()
2440 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp1_ptp_egr_fifo_event_func() local
2442 mlxsw_sp1_ptp_fifo_event_func(mlxsw_sp, mtpptr_pl, false); in mlxsw_sp1_ptp_egr_fifo_event_func()
2448 struct mlxsw_sp *mlxsw_sp = priv; in mlxsw_sp_rx_listener_no_mark_func() local
2449 struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_rx_listener_no_mark_func()
2453 dev_warn_ratelimited(mlxsw_sp->bus_info->dev, "Port %d: skb received for non-existent port\n", in mlxsw_sp_rx_listener_no_mark_func()
2485 void mlxsw_sp_ptp_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb, in mlxsw_sp_ptp_receive() argument
2488 mlxsw_sp->ptp_ops->receive(mlxsw_sp, skb, local_port); in mlxsw_sp_ptp_receive()
2545 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_cpu_policers_set() local
2573 __set_bit(i, mlxsw_sp->trap->policers_usage); in mlxsw_sp_cpu_policers_set()
2631 static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_traps_init() argument
2637 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_CPU_POLICERS)) in mlxsw_sp_traps_init()
2639 max_policers = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_CPU_POLICERS); in mlxsw_sp_traps_init()
2645 mlxsw_sp->trap = trap; in mlxsw_sp_traps_init()
2647 err = mlxsw_sp_cpu_policers_set(mlxsw_sp->core); in mlxsw_sp_traps_init()
2651 err = mlxsw_sp_trap_groups_set(mlxsw_sp->core); in mlxsw_sp_traps_init()
2655 err = mlxsw_core_traps_register(mlxsw_sp->core, mlxsw_sp_listener, in mlxsw_sp_traps_init()
2657 mlxsw_sp); in mlxsw_sp_traps_init()
2661 err = mlxsw_core_traps_register(mlxsw_sp->core, mlxsw_sp->listeners, in mlxsw_sp_traps_init()
2662 mlxsw_sp->listeners_count, mlxsw_sp); in mlxsw_sp_traps_init()
2669 mlxsw_core_traps_unregister(mlxsw_sp->core, mlxsw_sp_listener, in mlxsw_sp_traps_init()
2671 mlxsw_sp); in mlxsw_sp_traps_init()
2679 static void mlxsw_sp_traps_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_traps_fini() argument
2681 mlxsw_core_traps_unregister(mlxsw_sp->core, mlxsw_sp->listeners, in mlxsw_sp_traps_fini()
2682 mlxsw_sp->listeners_count, in mlxsw_sp_traps_fini()
2683 mlxsw_sp); in mlxsw_sp_traps_fini()
2684 mlxsw_core_traps_unregister(mlxsw_sp->core, mlxsw_sp_listener, in mlxsw_sp_traps_fini()
2685 ARRAY_SIZE(mlxsw_sp_listener), mlxsw_sp); in mlxsw_sp_traps_fini()
2686 kfree(mlxsw_sp->trap); in mlxsw_sp_traps_fini()
2691 static int mlxsw_sp_lag_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_lag_init() argument
2698 seed = jhash(mlxsw_sp->base_mac, sizeof(mlxsw_sp->base_mac), in mlxsw_sp_lag_init()
2709 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcr), slcr_pl); in mlxsw_sp_lag_init()
2713 err = mlxsw_core_max_lag(mlxsw_sp->core, &max_lag); in mlxsw_sp_lag_init()
2717 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_LAG_MEMBERS)) in mlxsw_sp_lag_init()
2720 mlxsw_sp->lags = kcalloc(max_lag, sizeof(struct mlxsw_sp_upper), in mlxsw_sp_lag_init()
2722 if (!mlxsw_sp->lags) in mlxsw_sp_lag_init()
2728 static void mlxsw_sp_lag_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_lag_fini() argument
2730 kfree(mlxsw_sp->lags); in mlxsw_sp_lag_fini()
2810 mlxsw_sp_sample_trigger_params_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sample_trigger_params_lookup() argument
2817 trigger_node = rhashtable_lookup(&mlxsw_sp->sample_trigger_ht, &key, in mlxsw_sp_sample_trigger_params_lookup()
2826 mlxsw_sp_sample_trigger_node_init(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sample_trigger_node_init() argument
2841 err = rhashtable_insert_fast(&mlxsw_sp->sample_trigger_ht, in mlxsw_sp_sample_trigger_node_init()
2855 mlxsw_sp_sample_trigger_node_fini(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sample_trigger_node_fini() argument
2858 rhashtable_remove_fast(&mlxsw_sp->sample_trigger_ht, in mlxsw_sp_sample_trigger_node_fini()
2865 mlxsw_sp_sample_trigger_params_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sample_trigger_params_set() argument
2877 trigger_node = rhashtable_lookup_fast(&mlxsw_sp->sample_trigger_ht, in mlxsw_sp_sample_trigger_params_set()
2881 return mlxsw_sp_sample_trigger_node_init(mlxsw_sp, &key, in mlxsw_sp_sample_trigger_params_set()
2903 mlxsw_sp_sample_trigger_params_unset(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sample_trigger_params_unset() argument
2913 trigger_node = rhashtable_lookup_fast(&mlxsw_sp->sample_trigger_ht, in mlxsw_sp_sample_trigger_params_unset()
2922 mlxsw_sp_sample_trigger_node_fini(mlxsw_sp, trigger_node); in mlxsw_sp_sample_trigger_params_unset()
2932 static void mlxsw_sp_parsing_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_parsing_init() argument
2934 mlxsw_sp->parsing.parsing_depth = MLXSW_SP_DEFAULT_PARSING_DEPTH; in mlxsw_sp_parsing_init()
2935 mlxsw_sp->parsing.vxlan_udp_dport = MLXSW_SP_DEFAULT_VXLAN_UDP_DPORT; in mlxsw_sp_parsing_init()
2936 mutex_init(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_init()
2939 static void mlxsw_sp_parsing_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_parsing_fini() argument
2941 mutex_destroy(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_fini()
2959 mlxsw_sp_ipv6_addr_init(struct mlxsw_sp *mlxsw_sp, const struct in6_addr *addr6, in mlxsw_sp_ipv6_addr_init() argument
2966 err = mlxsw_sp_kvdl_alloc(mlxsw_sp, in mlxsw_sp_ipv6_addr_init()
2973 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rips), rips_pl); in mlxsw_sp_ipv6_addr_init()
2987 err = rhashtable_insert_fast(&mlxsw_sp->ipv6_addr_ht, in mlxsw_sp_ipv6_addr_init()
2999 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_IPV6_ADDRESS, 1, in mlxsw_sp_ipv6_addr_init()
3004 static void mlxsw_sp_ipv6_addr_fini(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_ipv6_addr_fini() argument
3009 rhashtable_remove_fast(&mlxsw_sp->ipv6_addr_ht, &node->ht_node, in mlxsw_sp_ipv6_addr_fini()
3012 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_IPV6_ADDRESS, 1, in mlxsw_sp_ipv6_addr_fini()
3016 int mlxsw_sp_ipv6_addr_kvdl_index_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_ipv6_addr_kvdl_index_get() argument
3023 mutex_lock(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_kvdl_index_get()
3024 node = rhashtable_lookup_fast(&mlxsw_sp->ipv6_addr_ht, addr6, in mlxsw_sp_ipv6_addr_kvdl_index_get()
3032 err = mlxsw_sp_ipv6_addr_init(mlxsw_sp, addr6, p_kvdl_index); in mlxsw_sp_ipv6_addr_kvdl_index_get()
3035 mutex_unlock(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_kvdl_index_get()
3040 mlxsw_sp_ipv6_addr_put(struct mlxsw_sp *mlxsw_sp, const struct in6_addr *addr6) in mlxsw_sp_ipv6_addr_put() argument
3044 mutex_lock(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_put()
3045 node = rhashtable_lookup_fast(&mlxsw_sp->ipv6_addr_ht, addr6, in mlxsw_sp_ipv6_addr_put()
3053 mlxsw_sp_ipv6_addr_fini(mlxsw_sp, node); in mlxsw_sp_ipv6_addr_put()
3056 mutex_unlock(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_put()
3059 static int mlxsw_sp_ipv6_addr_ht_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_ipv6_addr_ht_init() argument
3063 err = rhashtable_init(&mlxsw_sp->ipv6_addr_ht, in mlxsw_sp_ipv6_addr_ht_init()
3068 mutex_init(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_ht_init()
3072 static void mlxsw_sp_ipv6_addr_ht_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_ipv6_addr_ht_fini() argument
3074 mutex_destroy(&mlxsw_sp->ipv6_addr_ht_lock); in mlxsw_sp_ipv6_addr_ht_fini()
3075 rhashtable_destroy(&mlxsw_sp->ipv6_addr_ht); in mlxsw_sp_ipv6_addr_ht_fini()
3082 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_init() local
3085 mlxsw_sp->core = mlxsw_core; in mlxsw_sp_init()
3086 mlxsw_sp->bus_info = mlxsw_bus_info; in mlxsw_sp_init()
3088 mlxsw_sp_parsing_init(mlxsw_sp); in mlxsw_sp_init()
3091 err = mlxsw_sp_base_mac_get(mlxsw_sp); in mlxsw_sp_init()
3093 dev_err(mlxsw_sp->bus_info->dev, "Failed to get base mac\n"); in mlxsw_sp_init()
3097 err = mlxsw_sp_kvdl_init(mlxsw_sp); in mlxsw_sp_init()
3099 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize KVDL\n"); in mlxsw_sp_init()
3103 err = mlxsw_sp_pgt_init(mlxsw_sp); in mlxsw_sp_init()
3105 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize PGT\n"); in mlxsw_sp_init()
3109 err = mlxsw_sp_fids_init(mlxsw_sp); in mlxsw_sp_init()
3111 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize FIDs\n"); in mlxsw_sp_init()
3115 err = mlxsw_sp_policers_init(mlxsw_sp); in mlxsw_sp_init()
3117 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize policers\n"); in mlxsw_sp_init()
3121 err = mlxsw_sp_traps_init(mlxsw_sp); in mlxsw_sp_init()
3123 dev_err(mlxsw_sp->bus_info->dev, "Failed to set traps\n"); in mlxsw_sp_init()
3127 err = mlxsw_sp_devlink_traps_init(mlxsw_sp); in mlxsw_sp_init()
3129 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize devlink traps\n"); in mlxsw_sp_init()
3133 err = mlxsw_sp_buffers_init(mlxsw_sp); in mlxsw_sp_init()
3135 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize buffers\n"); in mlxsw_sp_init()
3139 err = mlxsw_sp_lag_init(mlxsw_sp); in mlxsw_sp_init()
3141 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize LAG\n"); in mlxsw_sp_init()
3148 err = mlxsw_sp_span_init(mlxsw_sp); in mlxsw_sp_init()
3150 dev_err(mlxsw_sp->bus_info->dev, "Failed to init span system\n"); in mlxsw_sp_init()
3154 err = mlxsw_sp_switchdev_init(mlxsw_sp); in mlxsw_sp_init()
3156 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); in mlxsw_sp_init()
3160 err = mlxsw_sp_counter_pool_init(mlxsw_sp); in mlxsw_sp_init()
3162 dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n"); in mlxsw_sp_init()
3166 err = mlxsw_sp_afa_init(mlxsw_sp); in mlxsw_sp_init()
3168 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize ACL actions\n"); in mlxsw_sp_init()
3172 err = mlxsw_sp_ipv6_addr_ht_init(mlxsw_sp); in mlxsw_sp_init()
3174 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize hash table for IPv6 addresses\n"); in mlxsw_sp_init()
3178 err = mlxsw_sp_nve_init(mlxsw_sp); in mlxsw_sp_init()
3180 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize NVE\n"); in mlxsw_sp_init()
3184 err = mlxsw_sp_acl_init(mlxsw_sp); in mlxsw_sp_init()
3186 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize ACL\n"); in mlxsw_sp_init()
3190 err = mlxsw_sp_router_init(mlxsw_sp, extack); in mlxsw_sp_init()
3192 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize router\n"); in mlxsw_sp_init()
3196 if (mlxsw_sp->bus_info->read_clock_capable) { in mlxsw_sp_init()
3198 mlxsw_sp->clock = in mlxsw_sp_init()
3199 mlxsw_sp->ptp_ops->clock_init(mlxsw_sp, in mlxsw_sp_init()
3200 mlxsw_sp->bus_info->dev); in mlxsw_sp_init()
3201 if (IS_ERR(mlxsw_sp->clock)) { in mlxsw_sp_init()
3202 err = PTR_ERR(mlxsw_sp->clock); in mlxsw_sp_init()
3203 dev_err(mlxsw_sp->bus_info->dev, "Failed to init ptp clock\n"); in mlxsw_sp_init()
3208 if (mlxsw_sp->clock) { in mlxsw_sp_init()
3210 mlxsw_sp->ptp_state = mlxsw_sp->ptp_ops->init(mlxsw_sp); in mlxsw_sp_init()
3211 if (IS_ERR(mlxsw_sp->ptp_state)) { in mlxsw_sp_init()
3212 err = PTR_ERR(mlxsw_sp->ptp_state); in mlxsw_sp_init()
3213 dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize PTP\n"); in mlxsw_sp_init()
3221 mlxsw_sp->netdevice_nb.notifier_call = mlxsw_sp_netdevice_event; in mlxsw_sp_init()
3222 err = register_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), in mlxsw_sp_init()
3223 &mlxsw_sp->netdevice_nb); in mlxsw_sp_init()
3225 dev_err(mlxsw_sp->bus_info->dev, "Failed to register netdev notifier\n"); in mlxsw_sp_init()
3229 err = mlxsw_sp_dpipe_init(mlxsw_sp); in mlxsw_sp_init()
3231 dev_err(mlxsw_sp->bus_info->dev, "Failed to init pipeline debug\n"); in mlxsw_sp_init()
3235 err = mlxsw_sp_port_module_info_init(mlxsw_sp); in mlxsw_sp_init()
3237 dev_err(mlxsw_sp->bus_info->dev, "Failed to init port module info\n"); in mlxsw_sp_init()
3241 err = rhashtable_init(&mlxsw_sp->sample_trigger_ht, in mlxsw_sp_init()
3244 dev_err(mlxsw_sp->bus_info->dev, "Failed to init sampling trigger hashtable\n"); in mlxsw_sp_init()
3248 err = mlxsw_sp_ports_create(mlxsw_sp); in mlxsw_sp_init()
3250 dev_err(mlxsw_sp->bus_info->dev, "Failed to create ports\n"); in mlxsw_sp_init()
3257 rhashtable_destroy(&mlxsw_sp->sample_trigger_ht); in mlxsw_sp_init()
3259 mlxsw_sp_port_module_info_fini(mlxsw_sp); in mlxsw_sp_init()
3261 mlxsw_sp_dpipe_fini(mlxsw_sp); in mlxsw_sp_init()
3263 unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), in mlxsw_sp_init()
3264 &mlxsw_sp->netdevice_nb); in mlxsw_sp_init()
3266 if (mlxsw_sp->clock) in mlxsw_sp_init()
3267 mlxsw_sp->ptp_ops->fini(mlxsw_sp->ptp_state); in mlxsw_sp_init()
3269 if (mlxsw_sp->clock) in mlxsw_sp_init()
3270 mlxsw_sp->ptp_ops->clock_fini(mlxsw_sp->clock); in mlxsw_sp_init()
3272 mlxsw_sp_router_fini(mlxsw_sp); in mlxsw_sp_init()
3274 mlxsw_sp_acl_fini(mlxsw_sp); in mlxsw_sp_init()
3276 mlxsw_sp_nve_fini(mlxsw_sp); in mlxsw_sp_init()
3278 mlxsw_sp_ipv6_addr_ht_fini(mlxsw_sp); in mlxsw_sp_init()
3280 mlxsw_sp_afa_fini(mlxsw_sp); in mlxsw_sp_init()
3282 mlxsw_sp_counter_pool_fini(mlxsw_sp); in mlxsw_sp_init()
3284 mlxsw_sp_switchdev_fini(mlxsw_sp); in mlxsw_sp_init()
3286 mlxsw_sp_span_fini(mlxsw_sp); in mlxsw_sp_init()
3288 mlxsw_sp_lag_fini(mlxsw_sp); in mlxsw_sp_init()
3290 mlxsw_sp_buffers_fini(mlxsw_sp); in mlxsw_sp_init()
3292 mlxsw_sp_devlink_traps_fini(mlxsw_sp); in mlxsw_sp_init()
3294 mlxsw_sp_traps_fini(mlxsw_sp); in mlxsw_sp_init()
3296 mlxsw_sp_policers_fini(mlxsw_sp); in mlxsw_sp_init()
3298 mlxsw_sp_fids_fini(mlxsw_sp); in mlxsw_sp_init()
3300 mlxsw_sp_pgt_fini(mlxsw_sp); in mlxsw_sp_init()
3302 mlxsw_sp_kvdl_fini(mlxsw_sp); in mlxsw_sp_init()
3303 mlxsw_sp_parsing_fini(mlxsw_sp); in mlxsw_sp_init()
3311 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp1_init() local
3313 mlxsw_sp->switchdev_ops = &mlxsw_sp1_switchdev_ops; in mlxsw_sp1_init()
3314 mlxsw_sp->kvdl_ops = &mlxsw_sp1_kvdl_ops; in mlxsw_sp1_init()
3315 mlxsw_sp->afa_ops = &mlxsw_sp1_act_afa_ops; in mlxsw_sp1_init()
3316 mlxsw_sp->afk_ops = &mlxsw_sp1_afk_ops; in mlxsw_sp1_init()
3317 mlxsw_sp->mr_tcam_ops = &mlxsw_sp1_mr_tcam_ops; in mlxsw_sp1_init()
3318 mlxsw_sp->acl_rulei_ops = &mlxsw_sp1_acl_rulei_ops; in mlxsw_sp1_init()
3319 mlxsw_sp->acl_tcam_ops = &mlxsw_sp1_acl_tcam_ops; in mlxsw_sp1_init()
3320 mlxsw_sp->nve_ops_arr = mlxsw_sp1_nve_ops_arr; in mlxsw_sp1_init()
3321 mlxsw_sp->mac_mask = mlxsw_sp1_mac_mask; in mlxsw_sp1_init()
3322 mlxsw_sp->sb_vals = &mlxsw_sp1_sb_vals; in mlxsw_sp1_init()
3323 mlxsw_sp->sb_ops = &mlxsw_sp1_sb_ops; in mlxsw_sp1_init()
3324 mlxsw_sp->port_type_speed_ops = &mlxsw_sp1_port_type_speed_ops; in mlxsw_sp1_init()
3325 mlxsw_sp->ptp_ops = &mlxsw_sp1_ptp_ops; in mlxsw_sp1_init()
3326 mlxsw_sp->span_ops = &mlxsw_sp1_span_ops; in mlxsw_sp1_init()
3327 mlxsw_sp->policer_core_ops = &mlxsw_sp1_policer_core_ops; in mlxsw_sp1_init()
3328 mlxsw_sp->trap_ops = &mlxsw_sp1_trap_ops; in mlxsw_sp1_init()
3329 mlxsw_sp->mall_ops = &mlxsw_sp1_mall_ops; in mlxsw_sp1_init()
3330 mlxsw_sp->router_ops = &mlxsw_sp1_router_ops; in mlxsw_sp1_init()
3331 mlxsw_sp->listeners = mlxsw_sp1_listener; in mlxsw_sp1_init()
3332 mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp1_listener); in mlxsw_sp1_init()
3333 mlxsw_sp->fid_family_arr = mlxsw_sp1_fid_family_arr; in mlxsw_sp1_init()
3334 mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1; in mlxsw_sp1_init()
3335 mlxsw_sp->pgt_smpe_index_valid = true; in mlxsw_sp1_init()
3344 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp2_init() local
3346 mlxsw_sp->switchdev_ops = &mlxsw_sp2_switchdev_ops; in mlxsw_sp2_init()
3347 mlxsw_sp->kvdl_ops = &mlxsw_sp2_kvdl_ops; in mlxsw_sp2_init()
3348 mlxsw_sp->afa_ops = &mlxsw_sp2_act_afa_ops; in mlxsw_sp2_init()
3349 mlxsw_sp->afk_ops = &mlxsw_sp2_afk_ops; in mlxsw_sp2_init()
3350 mlxsw_sp->mr_tcam_ops = &mlxsw_sp2_mr_tcam_ops; in mlxsw_sp2_init()
3351 mlxsw_sp->acl_rulei_ops = &mlxsw_sp2_acl_rulei_ops; in mlxsw_sp2_init()
3352 mlxsw_sp->acl_tcam_ops = &mlxsw_sp2_acl_tcam_ops; in mlxsw_sp2_init()
3353 mlxsw_sp->acl_bf_ops = &mlxsw_sp2_acl_bf_ops; in mlxsw_sp2_init()
3354 mlxsw_sp->nve_ops_arr = mlxsw_sp2_nve_ops_arr; in mlxsw_sp2_init()
3355 mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask; in mlxsw_sp2_init()
3356 mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals; in mlxsw_sp2_init()
3357 mlxsw_sp->sb_ops = &mlxsw_sp2_sb_ops; in mlxsw_sp2_init()
3358 mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops; in mlxsw_sp2_init()
3359 mlxsw_sp->ptp_ops = &mlxsw_sp2_ptp_ops; in mlxsw_sp2_init()
3360 mlxsw_sp->span_ops = &mlxsw_sp2_span_ops; in mlxsw_sp2_init()
3361 mlxsw_sp->policer_core_ops = &mlxsw_sp2_policer_core_ops; in mlxsw_sp2_init()
3362 mlxsw_sp->trap_ops = &mlxsw_sp2_trap_ops; in mlxsw_sp2_init()
3363 mlxsw_sp->mall_ops = &mlxsw_sp2_mall_ops; in mlxsw_sp2_init()
3364 mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; in mlxsw_sp2_init()
3365 mlxsw_sp->listeners = mlxsw_sp2_listener; in mlxsw_sp2_init()
3366 mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); in mlxsw_sp2_init()
3367 mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; in mlxsw_sp2_init()
3368 mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2; in mlxsw_sp2_init()
3369 mlxsw_sp->pgt_smpe_index_valid = false; in mlxsw_sp2_init()
3378 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp3_init() local
3380 mlxsw_sp->switchdev_ops = &mlxsw_sp2_switchdev_ops; in mlxsw_sp3_init()
3381 mlxsw_sp->kvdl_ops = &mlxsw_sp2_kvdl_ops; in mlxsw_sp3_init()
3382 mlxsw_sp->afa_ops = &mlxsw_sp2_act_afa_ops; in mlxsw_sp3_init()
3383 mlxsw_sp->afk_ops = &mlxsw_sp2_afk_ops; in mlxsw_sp3_init()
3384 mlxsw_sp->mr_tcam_ops = &mlxsw_sp2_mr_tcam_ops; in mlxsw_sp3_init()
3385 mlxsw_sp->acl_rulei_ops = &mlxsw_sp2_acl_rulei_ops; in mlxsw_sp3_init()
3386 mlxsw_sp->acl_tcam_ops = &mlxsw_sp2_acl_tcam_ops; in mlxsw_sp3_init()
3387 mlxsw_sp->acl_bf_ops = &mlxsw_sp2_acl_bf_ops; in mlxsw_sp3_init()
3388 mlxsw_sp->nve_ops_arr = mlxsw_sp2_nve_ops_arr; in mlxsw_sp3_init()
3389 mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask; in mlxsw_sp3_init()
3390 mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals; in mlxsw_sp3_init()
3391 mlxsw_sp->sb_ops = &mlxsw_sp3_sb_ops; in mlxsw_sp3_init()
3392 mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops; in mlxsw_sp3_init()
3393 mlxsw_sp->ptp_ops = &mlxsw_sp2_ptp_ops; in mlxsw_sp3_init()
3394 mlxsw_sp->span_ops = &mlxsw_sp3_span_ops; in mlxsw_sp3_init()
3395 mlxsw_sp->policer_core_ops = &mlxsw_sp2_policer_core_ops; in mlxsw_sp3_init()
3396 mlxsw_sp->trap_ops = &mlxsw_sp2_trap_ops; in mlxsw_sp3_init()
3397 mlxsw_sp->mall_ops = &mlxsw_sp2_mall_ops; in mlxsw_sp3_init()
3398 mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; in mlxsw_sp3_init()
3399 mlxsw_sp->listeners = mlxsw_sp2_listener; in mlxsw_sp3_init()
3400 mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); in mlxsw_sp3_init()
3401 mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; in mlxsw_sp3_init()
3402 mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3; in mlxsw_sp3_init()
3403 mlxsw_sp->pgt_smpe_index_valid = false; in mlxsw_sp3_init()
3412 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp4_init() local
3414 mlxsw_sp->switchdev_ops = &mlxsw_sp2_switchdev_ops; in mlxsw_sp4_init()
3415 mlxsw_sp->kvdl_ops = &mlxsw_sp2_kvdl_ops; in mlxsw_sp4_init()
3416 mlxsw_sp->afa_ops = &mlxsw_sp2_act_afa_ops; in mlxsw_sp4_init()
3417 mlxsw_sp->afk_ops = &mlxsw_sp4_afk_ops; in mlxsw_sp4_init()
3418 mlxsw_sp->mr_tcam_ops = &mlxsw_sp2_mr_tcam_ops; in mlxsw_sp4_init()
3419 mlxsw_sp->acl_rulei_ops = &mlxsw_sp2_acl_rulei_ops; in mlxsw_sp4_init()
3420 mlxsw_sp->acl_tcam_ops = &mlxsw_sp2_acl_tcam_ops; in mlxsw_sp4_init()
3421 mlxsw_sp->acl_bf_ops = &mlxsw_sp4_acl_bf_ops; in mlxsw_sp4_init()
3422 mlxsw_sp->nve_ops_arr = mlxsw_sp2_nve_ops_arr; in mlxsw_sp4_init()
3423 mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask; in mlxsw_sp4_init()
3424 mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals; in mlxsw_sp4_init()
3425 mlxsw_sp->sb_ops = &mlxsw_sp3_sb_ops; in mlxsw_sp4_init()
3426 mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops; in mlxsw_sp4_init()
3427 mlxsw_sp->ptp_ops = &mlxsw_sp4_ptp_ops; in mlxsw_sp4_init()
3428 mlxsw_sp->span_ops = &mlxsw_sp3_span_ops; in mlxsw_sp4_init()
3429 mlxsw_sp->policer_core_ops = &mlxsw_sp2_policer_core_ops; in mlxsw_sp4_init()
3430 mlxsw_sp->trap_ops = &mlxsw_sp2_trap_ops; in mlxsw_sp4_init()
3431 mlxsw_sp->mall_ops = &mlxsw_sp2_mall_ops; in mlxsw_sp4_init()
3432 mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; in mlxsw_sp4_init()
3433 mlxsw_sp->listeners = mlxsw_sp2_listener; in mlxsw_sp4_init()
3434 mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); in mlxsw_sp4_init()
3435 mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; in mlxsw_sp4_init()
3436 mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP4; in mlxsw_sp4_init()
3437 mlxsw_sp->pgt_smpe_index_valid = false; in mlxsw_sp4_init()
3444 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_fini() local
3446 mlxsw_sp_ports_remove(mlxsw_sp); in mlxsw_sp_fini()
3447 rhashtable_destroy(&mlxsw_sp->sample_trigger_ht); in mlxsw_sp_fini()
3448 mlxsw_sp_port_module_info_fini(mlxsw_sp); in mlxsw_sp_fini()
3449 mlxsw_sp_dpipe_fini(mlxsw_sp); in mlxsw_sp_fini()
3450 unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), in mlxsw_sp_fini()
3451 &mlxsw_sp->netdevice_nb); in mlxsw_sp_fini()
3452 if (mlxsw_sp->clock) { in mlxsw_sp_fini()
3453 mlxsw_sp->ptp_ops->fini(mlxsw_sp->ptp_state); in mlxsw_sp_fini()
3454 mlxsw_sp->ptp_ops->clock_fini(mlxsw_sp->clock); in mlxsw_sp_fini()
3456 mlxsw_sp_router_fini(mlxsw_sp); in mlxsw_sp_fini()
3457 mlxsw_sp_acl_fini(mlxsw_sp); in mlxsw_sp_fini()
3458 mlxsw_sp_nve_fini(mlxsw_sp); in mlxsw_sp_fini()
3459 mlxsw_sp_ipv6_addr_ht_fini(mlxsw_sp); in mlxsw_sp_fini()
3460 mlxsw_sp_afa_fini(mlxsw_sp); in mlxsw_sp_fini()
3461 mlxsw_sp_counter_pool_fini(mlxsw_sp); in mlxsw_sp_fini()
3462 mlxsw_sp_switchdev_fini(mlxsw_sp); in mlxsw_sp_fini()
3463 mlxsw_sp_span_fini(mlxsw_sp); in mlxsw_sp_fini()
3464 mlxsw_sp_lag_fini(mlxsw_sp); in mlxsw_sp_fini()
3465 mlxsw_sp_buffers_fini(mlxsw_sp); in mlxsw_sp_fini()
3466 mlxsw_sp_devlink_traps_fini(mlxsw_sp); in mlxsw_sp_fini()
3467 mlxsw_sp_traps_fini(mlxsw_sp); in mlxsw_sp_fini()
3468 mlxsw_sp_policers_fini(mlxsw_sp); in mlxsw_sp_fini()
3469 mlxsw_sp_fids_fini(mlxsw_sp); in mlxsw_sp_fini()
3470 mlxsw_sp_pgt_fini(mlxsw_sp); in mlxsw_sp_fini()
3471 mlxsw_sp_kvdl_fini(mlxsw_sp); in mlxsw_sp_fini()
3472 mlxsw_sp_parsing_fini(mlxsw_sp); in mlxsw_sp_fini()
3864 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_params_acl_region_rehash_intrvl_get() local
3866 ctx->val.vu32 = mlxsw_sp_acl_region_rehash_intrvl_get(mlxsw_sp); in mlxsw_sp_params_acl_region_rehash_intrvl_get()
3875 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_params_acl_region_rehash_intrvl_set() local
3877 return mlxsw_sp_acl_region_rehash_intrvl_set(mlxsw_sp, ctx->val.vu32); in mlxsw_sp_params_acl_region_rehash_intrvl_set()
3918 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_ptp_transmitted() local
3921 mlxsw_sp->ptp_ops->transmitted(mlxsw_sp, skb, local_port); in mlxsw_sp_ptp_transmitted()
3926 .priv_size = sizeof(struct mlxsw_sp),
3963 .priv_size = sizeof(struct mlxsw_sp),
4002 .priv_size = sizeof(struct mlxsw_sp),
4041 .priv_size = sizeof(struct mlxsw_sp),
4108 struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev) in mlxsw_sp_lower_get()
4113 return mlxsw_sp_port ? mlxsw_sp_port->mlxsw_sp : NULL; in mlxsw_sp_lower_get()
4148 int mlxsw_sp_parsing_depth_inc(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_parsing_depth_inc() argument
4153 mutex_lock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_depth_inc()
4155 if (refcount_inc_not_zero(&mlxsw_sp->parsing.parsing_depth_ref)) in mlxsw_sp_parsing_depth_inc()
4159 mlxsw_sp->parsing.vxlan_udp_dport); in mlxsw_sp_parsing_depth_inc()
4160 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mprs), mprs_pl); in mlxsw_sp_parsing_depth_inc()
4164 mlxsw_sp->parsing.parsing_depth = MLXSW_SP_INCREASED_PARSING_DEPTH; in mlxsw_sp_parsing_depth_inc()
4165 refcount_set(&mlxsw_sp->parsing.parsing_depth_ref, 1); in mlxsw_sp_parsing_depth_inc()
4168 mutex_unlock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_depth_inc()
4172 void mlxsw_sp_parsing_depth_dec(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_parsing_depth_dec() argument
4176 mutex_lock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_depth_dec()
4178 if (!refcount_dec_and_test(&mlxsw_sp->parsing.parsing_depth_ref)) in mlxsw_sp_parsing_depth_dec()
4182 mlxsw_sp->parsing.vxlan_udp_dport); in mlxsw_sp_parsing_depth_dec()
4183 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mprs), mprs_pl); in mlxsw_sp_parsing_depth_dec()
4184 mlxsw_sp->parsing.parsing_depth = MLXSW_SP_DEFAULT_PARSING_DEPTH; in mlxsw_sp_parsing_depth_dec()
4187 mutex_unlock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_depth_dec()
4190 int mlxsw_sp_parsing_vxlan_udp_dport_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_parsing_vxlan_udp_dport_set() argument
4196 mutex_lock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_vxlan_udp_dport_set()
4198 mlxsw_reg_mprs_pack(mprs_pl, mlxsw_sp->parsing.parsing_depth, in mlxsw_sp_parsing_vxlan_udp_dport_set()
4200 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mprs), mprs_pl); in mlxsw_sp_parsing_vxlan_udp_dport_set()
4204 mlxsw_sp->parsing.vxlan_udp_dport = be16_to_cpu(udp_dport); in mlxsw_sp_parsing_vxlan_udp_dport_set()
4207 mutex_unlock(&mlxsw_sp->parsing.lock); in mlxsw_sp_parsing_vxlan_udp_dport_set()
4230 static int mlxsw_sp_lag_create(struct mlxsw_sp *mlxsw_sp, u16 lag_id) in mlxsw_sp_lag_create() argument
4235 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sldr), sldr_pl); in mlxsw_sp_lag_create()
4238 static int mlxsw_sp_lag_destroy(struct mlxsw_sp *mlxsw_sp, u16 lag_id) in mlxsw_sp_lag_destroy() argument
4243 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sldr), sldr_pl); in mlxsw_sp_lag_destroy()
4249 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_add() local
4254 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcor), slcor_pl); in mlxsw_sp_lag_col_port_add()
4260 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_remove() local
4265 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcor), slcor_pl); in mlxsw_sp_lag_col_port_remove()
4271 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_enable() local
4276 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcor), slcor_pl); in mlxsw_sp_lag_col_port_enable()
4282 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_col_port_disable() local
4287 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcor), slcor_pl); in mlxsw_sp_lag_col_port_disable()
4290 static int mlxsw_sp_lag_index_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_lag_index_get() argument
4299 err = mlxsw_core_max_lag(mlxsw_sp->core, &max_lag); in mlxsw_sp_lag_index_get()
4304 lag = mlxsw_sp_lag_get(mlxsw_sp, i); in mlxsw_sp_lag_index_get()
4321 mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_master_lag_check() argument
4328 if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) { in mlxsw_sp_master_lag_check()
4339 static int mlxsw_sp_port_lag_index_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_port_lag_index_get() argument
4345 max_lag_members = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_port_lag_index_get()
4348 if (!mlxsw_sp_port_lagged_get(mlxsw_sp, lag_id, i)) { in mlxsw_sp_port_lag_index_get()
4360 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_lag_join() local
4366 err = mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id); in mlxsw_sp_port_lag_join()
4369 lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id); in mlxsw_sp_port_lag_join()
4371 err = mlxsw_sp_lag_create(mlxsw_sp, lag_id); in mlxsw_sp_port_lag_join()
4377 err = mlxsw_sp_port_lag_index_get(mlxsw_sp, lag_id, &port_index); in mlxsw_sp_port_lag_join()
4384 mlxsw_core_lag_mapping_set(mlxsw_sp->core, lag_id, port_index, in mlxsw_sp_port_lag_join()
4405 mlxsw_core_lag_mapping_clear(mlxsw_sp->core, lag_id, in mlxsw_sp_port_lag_join()
4410 mlxsw_sp_lag_destroy(mlxsw_sp, lag_id); in mlxsw_sp_port_lag_join()
4417 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_lag_leave() local
4423 lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id); in mlxsw_sp_port_lag_leave()
4437 mlxsw_sp_lag_destroy(mlxsw_sp, lag_id); in mlxsw_sp_port_lag_leave()
4439 mlxsw_core_lag_mapping_clear(mlxsw_sp->core, lag_id, in mlxsw_sp_port_lag_leave()
4452 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_dist_port_add() local
4457 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sldr), sldr_pl); in mlxsw_sp_lag_dist_port_add()
4463 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_lag_dist_port_remove() local
4468 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sldr), sldr_pl); in mlxsw_sp_lag_dist_port_remove()
4526 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_stp_set() local
4543 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spms), spms_pl); in mlxsw_sp_port_stp_set()
4666 struct mlxsw_sp *mlxsw_sp; in mlxsw_sp_netdevice_port_upper_event() local
4671 mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_netdevice_port_upper_event()
4690 !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, upper_dev) && in mlxsw_sp_netdevice_port_upper_event()
4696 !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, in mlxsw_sp_netdevice_port_upper_event()
4702 !mlxsw_sp_master_lag_check(mlxsw_sp, upper_dev, in mlxsw_sp_netdevice_port_upper_event()
4715 !mlxsw_sp_rif_exists(mlxsw_sp, lower_dev)) { in mlxsw_sp_netdevice_port_upper_event()
4786 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); in mlxsw_sp_netdevice_port_upper_event()
4870 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_netdevice_port_vlan_event() local
4890 !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, upper_dev) && in mlxsw_sp_netdevice_port_vlan_event()
4896 !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, in mlxsw_sp_netdevice_port_vlan_event()
4902 !mlxsw_sp_rif_exists(mlxsw_sp, vlan_dev)) { in mlxsw_sp_netdevice_port_vlan_event()
4921 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); in mlxsw_sp_netdevice_port_vlan_event()
4956 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(vlan_dev); in mlxsw_sp_netdevice_bridge_vlan_event() local
4961 if (!mlxsw_sp) in mlxsw_sp_netdevice_bridge_vlan_event()
4977 !mlxsw_sp_rif_exists(mlxsw_sp, vlan_dev)) { in mlxsw_sp_netdevice_bridge_vlan_event()
4987 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); in mlxsw_sp_netdevice_bridge_vlan_event()
5017 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(br_dev); in mlxsw_sp_netdevice_bridge_event() local
5023 if (!mlxsw_sp) in mlxsw_sp_netdevice_bridge_event()
5052 !mlxsw_sp_rif_exists(mlxsw_sp, br_dev)) { in mlxsw_sp_netdevice_bridge_event()
5062 mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, upper_dev); in mlxsw_sp_netdevice_bridge_event()
5064 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); in mlxsw_sp_netdevice_bridge_event()
5074 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(macvlan_dev); in mlxsw_sp_netdevice_macvlan_event() local
5079 if (!mlxsw_sp || event != NETDEV_PRECHANGEUPPER) in mlxsw_sp_netdevice_macvlan_event()
5093 static int mlxsw_sp_netdevice_vxlan_event(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_netdevice_vxlan_event() argument
5125 return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, in mlxsw_sp_netdevice_vxlan_event()
5133 mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, dev); in mlxsw_sp_netdevice_vxlan_event()
5144 return mlxsw_sp_bridge_vxlan_join(mlxsw_sp, upper_dev, dev, 0, in mlxsw_sp_netdevice_vxlan_event()
5154 mlxsw_sp_bridge_vxlan_leave(mlxsw_sp, dev); in mlxsw_sp_netdevice_vxlan_event()
5166 struct mlxsw_sp *mlxsw_sp; in mlxsw_sp_netdevice_event() local
5169 mlxsw_sp = container_of(nb, struct mlxsw_sp, netdevice_nb); in mlxsw_sp_netdevice_event()
5171 span_entry = mlxsw_sp_span_entry_find_by_port(mlxsw_sp, dev); in mlxsw_sp_netdevice_event()
5173 mlxsw_sp_span_entry_invalidate(mlxsw_sp, span_entry); in mlxsw_sp_netdevice_event()
5175 mlxsw_sp_span_respin(mlxsw_sp); in mlxsw_sp_netdevice_event()
5178 err = mlxsw_sp_netdevice_vxlan_event(mlxsw_sp, dev, event, ptr); in mlxsw_sp_netdevice_event()