Lines Matching refs:mlxsw_sx_port
58 struct mlxsw_sx_port;
61 struct mlxsw_sx_port **ports;
76 struct mlxsw_sx_port { struct
187 static int mlxsw_sx_port_admin_status_set(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_admin_status_set() argument
190 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_admin_status_set()
193 mlxsw_reg_paos_pack(paos_pl, mlxsw_sx_port->local_port, in mlxsw_sx_port_admin_status_set()
199 static int mlxsw_sx_port_oper_status_get(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_oper_status_get() argument
202 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_oper_status_get()
207 mlxsw_reg_paos_pack(paos_pl, mlxsw_sx_port->local_port, 0); in mlxsw_sx_port_oper_status_get()
216 static int mlxsw_sx_port_mtu_set(struct mlxsw_sx_port *mlxsw_sx_port, u16 mtu) in mlxsw_sx_port_mtu_set() argument
218 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_mtu_set()
224 mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sx_port->local_port, 0); in mlxsw_sx_port_mtu_set()
233 mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sx_port->local_port, mtu); in mlxsw_sx_port_mtu_set()
237 static int mlxsw_sx_port_swid_set(struct mlxsw_sx_port *mlxsw_sx_port, u8 swid) in mlxsw_sx_port_swid_set() argument
239 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_swid_set()
242 mlxsw_reg_pspa_pack(pspa_pl, swid, mlxsw_sx_port->local_port); in mlxsw_sx_port_swid_set()
247 mlxsw_sx_port_system_port_mapping_set(struct mlxsw_sx_port *mlxsw_sx_port) in mlxsw_sx_port_system_port_mapping_set() argument
249 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_system_port_mapping_set()
252 mlxsw_reg_sspr_pack(sspr_pl, mlxsw_sx_port->local_port); in mlxsw_sx_port_system_port_mapping_set()
256 static int mlxsw_sx_port_module_check(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_module_check() argument
259 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_module_check()
263 mlxsw_reg_pmlp_pack(pmlp_pl, mlxsw_sx_port->local_port); in mlxsw_sx_port_module_check()
273 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_open() local
276 err = mlxsw_sx_port_admin_status_set(mlxsw_sx_port, true); in mlxsw_sx_port_open()
285 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_stop() local
288 return mlxsw_sx_port_admin_status_set(mlxsw_sx_port, false); in mlxsw_sx_port_stop()
294 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_xmit() local
295 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_xmit()
298 .local_port = mlxsw_sx_port->local_port, in mlxsw_sx_port_xmit()
312 this_cpu_inc(mlxsw_sx_port->pcpu_stats->tx_dropped); in mlxsw_sx_port_xmit()
325 pcpu_stats = this_cpu_ptr(mlxsw_sx_port->pcpu_stats); in mlxsw_sx_port_xmit()
331 this_cpu_inc(mlxsw_sx_port->pcpu_stats->tx_dropped); in mlxsw_sx_port_xmit()
339 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_change_mtu() local
342 err = mlxsw_sx_port_mtu_set(mlxsw_sx_port, mtu); in mlxsw_sx_port_change_mtu()
353 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_get_stats64() local
361 p = per_cpu_ptr(mlxsw_sx_port->pcpu_stats, i); in mlxsw_sx_port_get_stats64()
392 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_get_drvinfo() local
393 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_get_drvinfo()
513 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_get_stats() local
514 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_get_stats()
519 mlxsw_reg_ppcnt_pack(ppcnt_pl, mlxsw_sx_port->local_port); in mlxsw_sx_port_get_stats()
731 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_get_settings() local
732 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_get_settings()
739 mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, 0); in mlxsw_sx_port_get_settings()
790 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_set_settings() local
791 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_set_settings()
806 mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, 0); in mlxsw_sx_port_set_settings()
822 mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, eth_proto_new); in mlxsw_sx_port_set_settings()
829 err = mlxsw_sx_port_oper_status_get(mlxsw_sx_port, &is_up); in mlxsw_sx_port_set_settings()
837 err = mlxsw_sx_port_admin_status_set(mlxsw_sx_port, false); in mlxsw_sx_port_set_settings()
843 err = mlxsw_sx_port_admin_status_set(mlxsw_sx_port, true); in mlxsw_sx_port_set_settings()
865 struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_attr_get() local
866 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_attr_get()
896 static int mlxsw_sx_port_dev_addr_get(struct mlxsw_sx_port *mlxsw_sx_port) in mlxsw_sx_port_dev_addr_get() argument
898 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_dev_addr_get()
899 struct net_device *dev = mlxsw_sx_port->dev; in mlxsw_sx_port_dev_addr_get()
912 dev->dev_addr[ETH_ALEN - 1] += mlxsw_sx_port->local_port; in mlxsw_sx_port_dev_addr_get()
916 static int mlxsw_sx_port_stp_state_set(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_stp_state_set() argument
919 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_stp_state_set()
926 mlxsw_reg_spms_pack(spms_pl, mlxsw_sx_port->local_port); in mlxsw_sx_port_stp_state_set()
933 static int mlxsw_sx_port_speed_set(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_speed_set() argument
936 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_speed_set()
939 mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, speed); in mlxsw_sx_port_speed_set()
944 mlxsw_sx_port_mac_learning_mode_set(struct mlxsw_sx_port *mlxsw_sx_port, in mlxsw_sx_port_mac_learning_mode_set() argument
947 struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; in mlxsw_sx_port_mac_learning_mode_set()
950 mlxsw_reg_spmlr_pack(spmlr_pl, mlxsw_sx_port->local_port, mode); in mlxsw_sx_port_mac_learning_mode_set()
956 struct mlxsw_sx_port *mlxsw_sx_port; in mlxsw_sx_port_create() local
961 dev = alloc_etherdev(sizeof(struct mlxsw_sx_port)); in mlxsw_sx_port_create()
964 mlxsw_sx_port = netdev_priv(dev); in mlxsw_sx_port_create()
965 mlxsw_sx_port->dev = dev; in mlxsw_sx_port_create()
966 mlxsw_sx_port->mlxsw_sx = mlxsw_sx; in mlxsw_sx_port_create()
967 mlxsw_sx_port->local_port = local_port; in mlxsw_sx_port_create()
969 mlxsw_sx_port->pcpu_stats = in mlxsw_sx_port_create()
971 if (!mlxsw_sx_port->pcpu_stats) { in mlxsw_sx_port_create()
980 err = mlxsw_sx_port_dev_addr_get(mlxsw_sx_port); in mlxsw_sx_port_create()
983 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
997 err = mlxsw_sx_port_module_check(mlxsw_sx_port, &usable); in mlxsw_sx_port_create()
1000 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1006 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1010 err = mlxsw_sx_port_system_port_mapping_set(mlxsw_sx_port); in mlxsw_sx_port_create()
1013 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1017 err = mlxsw_sx_port_swid_set(mlxsw_sx_port, 0); in mlxsw_sx_port_create()
1020 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1024 err = mlxsw_sx_port_speed_set(mlxsw_sx_port, in mlxsw_sx_port_create()
1028 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1032 err = mlxsw_sx_port_mtu_set(mlxsw_sx_port, ETH_DATA_LEN); in mlxsw_sx_port_create()
1035 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1039 err = mlxsw_sx_port_admin_status_set(mlxsw_sx_port, false); in mlxsw_sx_port_create()
1043 err = mlxsw_sx_port_stp_state_set(mlxsw_sx_port, in mlxsw_sx_port_create()
1048 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1052 err = mlxsw_sx_port_mac_learning_mode_set(mlxsw_sx_port, in mlxsw_sx_port_create()
1056 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1063 mlxsw_sx_port->local_port); in mlxsw_sx_port_create()
1067 mlxsw_sx->ports[local_port] = mlxsw_sx_port; in mlxsw_sx_port_create()
1081 free_percpu(mlxsw_sx_port->pcpu_stats); in mlxsw_sx_port_create()
1089 struct mlxsw_sx_port *mlxsw_sx_port = mlxsw_sx->ports[local_port]; in mlxsw_sx_port_remove() local
1091 if (!mlxsw_sx_port) in mlxsw_sx_port_remove()
1093 unregister_netdev(mlxsw_sx_port->dev); /* This calls ndo_stop */ in mlxsw_sx_port_remove()
1094 mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT); in mlxsw_sx_port_remove()
1095 free_percpu(mlxsw_sx_port->pcpu_stats); in mlxsw_sx_port_remove()
1096 free_netdev(mlxsw_sx_port->dev); in mlxsw_sx_port_remove()
1114 alloc_size = sizeof(struct mlxsw_sx_port *) * MLXSW_PORT_MAX_PORTS; in mlxsw_sx_ports_create()
1137 struct mlxsw_sx_port *mlxsw_sx_port; in mlxsw_sx_pude_event_func() local
1142 mlxsw_sx_port = mlxsw_sx->ports[local_port]; in mlxsw_sx_pude_event_func()
1143 if (!mlxsw_sx_port) { in mlxsw_sx_pude_event_func()
1151 netdev_info(mlxsw_sx_port->dev, "link up\n"); in mlxsw_sx_pude_event_func()
1152 netif_carrier_on(mlxsw_sx_port->dev); in mlxsw_sx_pude_event_func()
1154 netdev_info(mlxsw_sx_port->dev, "link down\n"); in mlxsw_sx_pude_event_func()
1155 netif_carrier_off(mlxsw_sx_port->dev); in mlxsw_sx_pude_event_func()
1209 struct mlxsw_sx_port *mlxsw_sx_port = mlxsw_sx->ports[local_port]; in mlxsw_sx_rx_listener_func() local
1212 if (unlikely(!mlxsw_sx_port)) { in mlxsw_sx_rx_listener_func()
1218 skb->dev = mlxsw_sx_port->dev; in mlxsw_sx_rx_listener_func()
1220 pcpu_stats = this_cpu_ptr(mlxsw_sx_port->pcpu_stats); in mlxsw_sx_rx_listener_func()