@@ -219,6 +219,19 @@ mlxsw_core_flood_mode(struct mlxsw_core *mlxsw_core)
}
EXPORT_SYMBOL(mlxsw_core_flood_mode);
+void mlxsw_core_bus_port_init(struct mlxsw_core *mlxsw_core, u16 local_port,
+ struct net_device *netdev)
+{
+ mlxsw_core->bus->port_init(mlxsw_core->bus_priv, local_port, netdev);
+}
+EXPORT_SYMBOL(mlxsw_core_bus_port_init);
+
+void mlxsw_core_bus_port_fini(struct mlxsw_core *mlxsw_core, u16 local_port)
+{
+ mlxsw_core->bus->port_fini(mlxsw_core->bus_priv, local_port);
+}
+EXPORT_SYMBOL(mlxsw_core_bus_port_fini);
+
void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core)
{
return mlxsw_core->driver_priv;
@@ -40,6 +40,9 @@ enum mlxsw_cmd_mbox_config_profile_lag_mode
mlxsw_core_lag_mode(struct mlxsw_core *mlxsw_core);
enum mlxsw_cmd_mbox_config_profile_flood_mode
mlxsw_core_flood_mode(struct mlxsw_core *mlxsw_core);
+void mlxsw_core_bus_port_init(struct mlxsw_core *mlxsw_core, u16 local_port,
+ struct net_device *netdev);
+void mlxsw_core_bus_port_fini(struct mlxsw_core *mlxsw_core, u16 local_port);
void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core);
@@ -495,6 +498,9 @@ struct mlxsw_bus {
u32 (*read_frc_l)(void *bus_priv);
u32 (*read_utc_sec)(void *bus_priv);
u32 (*read_utc_nsec)(void *bus_priv);
+ void (*port_init)(void *bus_priv, u16 local_port,
+ struct net_device *netdev);
+ void (*port_fini)(void *bus_priv, u16 local_port);
enum mlxsw_cmd_mbox_config_profile_lag_mode (*lag_mode)(void *bus_priv);
enum mlxsw_cmd_mbox_config_profile_flood_mode (*flood_mode)(void *priv);
u8 features;
@@ -2434,6 +2434,25 @@ mlxsw_pci_flood_mode(void *bus_priv)
return mlxsw_pci->flood_mode;
}
+static void mlxsw_pci_port_init(void *bus_priv, u16 local_port,
+ struct net_device *netdev)
+{
+ struct mlxsw_pci *mlxsw_pci = bus_priv;
+ struct mlxsw_pci_port *pci_port;
+
+ pci_port = &mlxsw_pci->pci_ports[local_port];
+ pci_port->netdev = netdev;
+}
+
+static void mlxsw_pci_port_fini(void *bus_priv, u16 local_port)
+{
+ struct mlxsw_pci *mlxsw_pci = bus_priv;
+ struct mlxsw_pci_port *pci_port;
+
+ pci_port = &mlxsw_pci->pci_ports[local_port];
+ pci_port->netdev = NULL;
+}
+
static const struct mlxsw_bus mlxsw_pci_bus = {
.kind = "pci",
.init = mlxsw_pci_init,
@@ -2445,6 +2464,8 @@ static const struct mlxsw_bus mlxsw_pci_bus = {
.read_frc_l = mlxsw_pci_read_frc_l,
.read_utc_sec = mlxsw_pci_read_utc_sec,
.read_utc_nsec = mlxsw_pci_read_utc_nsec,
+ .port_init = mlxsw_pci_port_init,
+ .port_fini = mlxsw_pci_port_fini,
.lag_mode = mlxsw_pci_lag_mode,
.flood_mode = mlxsw_pci_flood_mode,
.features = MLXSW_BUS_F_TXRX | MLXSW_BUS_F_RESET,