@@ -289,7 +289,7 @@ static int dpaa2_switch_port_add_vlan(struct ethsw_port_priv *port_priv,
289
289
int err ;
290
290
291
291
if (port_priv -> vlans [vid ]) {
292
- netdev_warn (netdev , "VLAN %d already configured\n" , vid );
292
+ netdev_err (netdev , "VLAN %d already configured\n" , vid );
293
293
return - EEXIST ;
294
294
}
295
295
@@ -1509,9 +1509,9 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
1509
1509
struct device * dev = (struct device * )arg ;
1510
1510
struct ethsw_core * ethsw = dev_get_drvdata (dev );
1511
1511
struct ethsw_port_priv * port_priv ;
1512
- u32 status = ~0 ;
1513
1512
int err , if_id ;
1514
1513
bool had_mac ;
1514
+ u32 status ;
1515
1515
1516
1516
err = dpsw_get_irq_status (ethsw -> mc_io , 0 , ethsw -> dpsw_handle ,
1517
1517
DPSW_IRQ_INDEX_IF , & status );
@@ -1523,12 +1523,11 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
1523
1523
if_id = (status & 0xFFFF0000 ) >> 16 ;
1524
1524
port_priv = ethsw -> ports [if_id ];
1525
1525
1526
- if (status & DPSW_IRQ_EVENT_LINK_CHANGED ) {
1526
+ if (status & DPSW_IRQ_EVENT_LINK_CHANGED )
1527
1527
dpaa2_switch_port_link_state_update (port_priv -> netdev );
1528
- dpaa2_switch_port_set_mac_addr (port_priv );
1529
- }
1530
1528
1531
1529
if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED ) {
1530
+ dpaa2_switch_port_set_mac_addr (port_priv );
1532
1531
/* We can avoid locking because the "endpoint changed" IRQ
1533
1532
* handler is the only one who changes priv->mac at runtime,
1534
1533
* so we are not racing with anyone.
@@ -1540,20 +1539,20 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
1540
1539
dpaa2_switch_port_connect_mac (port_priv );
1541
1540
}
1542
1541
1543
- out :
1544
1542
err = dpsw_clear_irq_status (ethsw -> mc_io , 0 , ethsw -> dpsw_handle ,
1545
1543
DPSW_IRQ_INDEX_IF , status );
1546
1544
if (err )
1547
1545
dev_err (dev , "Can't clear irq status (err %d)\n" , err );
1548
1546
1547
+ out :
1549
1548
return IRQ_HANDLED ;
1550
1549
}
1551
1550
1552
1551
static int dpaa2_switch_setup_irqs (struct fsl_mc_device * sw_dev )
1553
1552
{
1553
+ u32 mask = DPSW_IRQ_EVENT_LINK_CHANGED | DPSW_IRQ_EVENT_ENDPOINT_CHANGED ;
1554
1554
struct device * dev = & sw_dev -> dev ;
1555
1555
struct ethsw_core * ethsw = dev_get_drvdata (dev );
1556
- u32 mask = DPSW_IRQ_EVENT_LINK_CHANGED ;
1557
1556
struct fsl_mc_device_irq * irq ;
1558
1557
int err ;
1559
1558
@@ -1775,8 +1774,10 @@ int dpaa2_switch_port_vlans_add(struct net_device *netdev,
1775
1774
/* Make sure that the VLAN is not already configured
1776
1775
* on the switch port
1777
1776
*/
1778
- if (port_priv -> vlans [vlan -> vid ] & ETHSW_VLAN_MEMBER )
1777
+ if (port_priv -> vlans [vlan -> vid ] & ETHSW_VLAN_MEMBER ) {
1778
+ netdev_err (netdev , "VLAN %d already configured\n" , vlan -> vid );
1779
1779
return - EEXIST ;
1780
+ }
1780
1781
1781
1782
/* Check if there is space for a new VLAN */
1782
1783
err = dpsw_get_attributes (ethsw -> mc_io , 0 , ethsw -> dpsw_handle ,
@@ -2003,25 +2004,11 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
2003
2004
struct netlink_ext_ack * extack )
2004
2005
{
2005
2006
struct ethsw_port_priv * port_priv = netdev_priv (netdev );
2007
+ struct dpaa2_switch_fdb * old_fdb = port_priv -> fdb ;
2006
2008
struct ethsw_core * ethsw = port_priv -> ethsw_data ;
2007
- struct ethsw_port_priv * other_port_priv ;
2008
- struct net_device * other_dev ;
2009
- struct list_head * iter ;
2010
2009
bool learn_ena ;
2011
2010
int err ;
2012
2011
2013
- netdev_for_each_lower_dev (upper_dev , other_dev , iter ) {
2014
- if (!dpaa2_switch_port_dev_check (other_dev ))
2015
- continue ;
2016
-
2017
- other_port_priv = netdev_priv (other_dev );
2018
- if (other_port_priv -> ethsw_data != port_priv -> ethsw_data ) {
2019
- NL_SET_ERR_MSG_MOD (extack ,
2020
- "Interface from a different DPSW is in the bridge already" );
2021
- return - EINVAL ;
2022
- }
2023
- }
2024
-
2025
2012
/* Delete the previously manually installed VLAN 1 */
2026
2013
err = dpaa2_switch_port_del_vlan (port_priv , 1 );
2027
2014
if (err )
@@ -2039,6 +2026,11 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
2039
2026
if (err )
2040
2027
goto err_egress_flood ;
2041
2028
2029
+ /* Recreate the egress flood domain of the FDB that we just left. */
2030
+ err = dpaa2_switch_fdb_set_egress_flood (ethsw , old_fdb -> fdb_id );
2031
+ if (err )
2032
+ goto err_egress_flood ;
2033
+
2042
2034
err = switchdev_bridge_port_offload (netdev , netdev , NULL ,
2043
2035
NULL , NULL , false, extack );
2044
2036
if (err )
@@ -2155,6 +2147,10 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
2155
2147
struct net_device * upper_dev ,
2156
2148
struct netlink_ext_ack * extack )
2157
2149
{
2150
+ struct ethsw_port_priv * port_priv = netdev_priv (netdev );
2151
+ struct ethsw_port_priv * other_port_priv ;
2152
+ struct net_device * other_dev ;
2153
+ struct list_head * iter ;
2158
2154
int err ;
2159
2155
2160
2156
if (!br_vlan_enabled (upper_dev )) {
@@ -2169,54 +2165,93 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
2169
2165
return 0 ;
2170
2166
}
2171
2167
2168
+ netdev_for_each_lower_dev (upper_dev , other_dev , iter ) {
2169
+ if (!dpaa2_switch_port_dev_check (other_dev ))
2170
+ continue ;
2171
+
2172
+ other_port_priv = netdev_priv (other_dev );
2173
+ if (other_port_priv -> ethsw_data != port_priv -> ethsw_data ) {
2174
+ NL_SET_ERR_MSG_MOD (extack ,
2175
+ "Interface from a different DPSW is in the bridge already" );
2176
+ return - EINVAL ;
2177
+ }
2178
+ }
2179
+
2172
2180
return 0 ;
2173
2181
}
2174
2182
2175
- static int dpaa2_switch_port_netdevice_event (struct notifier_block * nb ,
2176
- unsigned long event , void * ptr )
2183
+ static int dpaa2_switch_port_prechangeupper (struct net_device * netdev ,
2184
+ struct netdev_notifier_changeupper_info * info )
2177
2185
{
2178
- struct net_device * netdev = netdev_notifier_info_to_dev (ptr );
2179
- struct netdev_notifier_changeupper_info * info = ptr ;
2180
2186
struct netlink_ext_ack * extack ;
2181
2187
struct net_device * upper_dev ;
2182
- int err = 0 ;
2188
+ int err ;
2183
2189
2184
2190
if (!dpaa2_switch_port_dev_check (netdev ))
2185
- return NOTIFY_DONE ;
2191
+ return 0 ;
2186
2192
2187
2193
extack = netdev_notifier_info_to_extack (& info -> info );
2188
-
2189
- switch (event ) {
2190
- case NETDEV_PRECHANGEUPPER :
2191
- upper_dev = info -> upper_dev ;
2192
- if (!netif_is_bridge_master (upper_dev ))
2193
- break ;
2194
-
2194
+ upper_dev = info -> upper_dev ;
2195
+ if (netif_is_bridge_master (upper_dev )) {
2195
2196
err = dpaa2_switch_prechangeupper_sanity_checks (netdev ,
2196
2197
upper_dev ,
2197
2198
extack );
2198
2199
if (err )
2199
- goto out ;
2200
+ return err ;
2200
2201
2201
2202
if (!info -> linking )
2202
2203
dpaa2_switch_port_pre_bridge_leave (netdev );
2204
+ }
2205
+
2206
+ return 0 ;
2207
+ }
2208
+
2209
+ static int dpaa2_switch_port_changeupper (struct net_device * netdev ,
2210
+ struct netdev_notifier_changeupper_info * info )
2211
+ {
2212
+ struct netlink_ext_ack * extack ;
2213
+ struct net_device * upper_dev ;
2214
+
2215
+ if (!dpaa2_switch_port_dev_check (netdev ))
2216
+ return 0 ;
2217
+
2218
+ extack = netdev_notifier_info_to_extack (& info -> info );
2219
+
2220
+ upper_dev = info -> upper_dev ;
2221
+ if (netif_is_bridge_master (upper_dev )) {
2222
+ if (info -> linking )
2223
+ return dpaa2_switch_port_bridge_join (netdev ,
2224
+ upper_dev ,
2225
+ extack );
2226
+ else
2227
+ return dpaa2_switch_port_bridge_leave (netdev );
2228
+ }
2229
+
2230
+ return 0 ;
2231
+ }
2232
+
2233
+ static int dpaa2_switch_port_netdevice_event (struct notifier_block * nb ,
2234
+ unsigned long event , void * ptr )
2235
+ {
2236
+ struct net_device * netdev = netdev_notifier_info_to_dev (ptr );
2237
+ int err = 0 ;
2238
+
2239
+ switch (event ) {
2240
+ case NETDEV_PRECHANGEUPPER :
2241
+ err = dpaa2_switch_port_prechangeupper (netdev , ptr );
2242
+ if (err )
2243
+ return notifier_from_errno (err );
2203
2244
2204
2245
break ;
2205
2246
case NETDEV_CHANGEUPPER :
2206
- upper_dev = info -> upper_dev ;
2207
- if (netif_is_bridge_master (upper_dev )) {
2208
- if (info -> linking )
2209
- err = dpaa2_switch_port_bridge_join (netdev ,
2210
- upper_dev ,
2211
- extack );
2212
- else
2213
- err = dpaa2_switch_port_bridge_leave (netdev );
2214
- }
2247
+ err = dpaa2_switch_port_changeupper (netdev , ptr );
2248
+ if (err )
2249
+ return notifier_from_errno (err );
2250
+
2215
2251
break ;
2216
2252
}
2217
2253
2218
- out :
2219
- return notifier_from_errno (err );
2254
+ return NOTIFY_DONE ;
2220
2255
}
2221
2256
2222
2257
struct ethsw_switchdev_event_work {
@@ -3294,6 +3329,7 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw,
3294
3329
port_netdev -> features = NETIF_F_HW_VLAN_CTAG_FILTER |
3295
3330
NETIF_F_HW_VLAN_STAG_FILTER |
3296
3331
NETIF_F_HW_TC ;
3332
+ port_netdev -> priv_flags |= IFF_LIVE_ADDR_CHANGE ;
3297
3333
3298
3334
err = dpaa2_switch_port_init (port_priv , port_idx );
3299
3335
if (err )
0 commit comments