Skip to content

Commit dce97cb

Browse files
Marcin Szycikanguy11
authored andcommitted
ice: Fix switchdev slow-path in LAG
Ever since removing switchdev control VSI and using PF for port representor Tx/Rx, switchdev slow-path has been working improperly after failover in SR-IOV LAG. LAG assumes that the first uplink to be added to the aggregate will own VFs and have switchdev configured. After failing-over to the other uplink, representors are still configured to Tx through the uplink they are set up on, which fails because that uplink is now down. On failover, update all PRs on primary uplink to use the currently active uplink for Tx. Call netif_keep_dst(), as the secondary uplink might not be in switchdev mode. Also make sure to call ice_eswitch_set_target_vsi() if uplink is in LAG. On the Rx path, representors are already working properly, because default Tx from VFs is set to PF owning the eswitch. After failover the same PF is receiving traffic from VFs, even though link is down. Fixes: defd524 ("ice: do Tx through PF netdev in slow-path") Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 23d97f1 commit dce97cb

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

drivers/net/ethernet/intel/ice/ice_lag.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,28 @@ static void ice_lag_link(struct ice_lag *lag)
10001000
netdev_info(lag->netdev, "Shared SR-IOV resources in bond are active\n");
10011001
}
10021002

1003+
/**
1004+
* ice_lag_config_eswitch - configure eswitch to work with LAG
1005+
* @lag: lag info struct
1006+
* @netdev: active network interface device struct
1007+
*
1008+
* Updates all port representors in eswitch to use @netdev for Tx.
1009+
*
1010+
* Configures the netdev to keep dst metadata (also used in representor Tx).
1011+
* This is required for an uplink without switchdev mode configured.
1012+
*/
1013+
static void ice_lag_config_eswitch(struct ice_lag *lag,
1014+
struct net_device *netdev)
1015+
{
1016+
struct ice_repr *repr;
1017+
unsigned long id;
1018+
1019+
xa_for_each(&lag->pf->eswitch.reprs, id, repr)
1020+
repr->dst->u.port_info.lower_dev = netdev;
1021+
1022+
netif_keep_dst(netdev);
1023+
}
1024+
10031025
/**
10041026
* ice_lag_unlink - handle unlink event
10051027
* @lag: LAG info struct
@@ -1021,6 +1043,9 @@ static void ice_lag_unlink(struct ice_lag *lag)
10211043
ice_lag_move_vf_nodes(lag, act_port, pri_port);
10221044
lag->primary = false;
10231045
lag->active_port = ICE_LAG_INVALID_PORT;
1046+
1047+
/* Config primary's eswitch back to normal operation. */
1048+
ice_lag_config_eswitch(lag, lag->netdev);
10241049
} else {
10251050
struct ice_lag *primary_lag;
10261051

@@ -1419,6 +1444,7 @@ static void ice_lag_monitor_active(struct ice_lag *lag, void *ptr)
14191444
ice_lag_move_vf_nodes(lag, prim_port,
14201445
event_port);
14211446
lag->active_port = event_port;
1447+
ice_lag_config_eswitch(lag, event_netdev);
14221448
return;
14231449
}
14241450

@@ -1428,6 +1454,7 @@ static void ice_lag_monitor_active(struct ice_lag *lag, void *ptr)
14281454
/* new active port */
14291455
ice_lag_move_vf_nodes(lag, lag->active_port, event_port);
14301456
lag->active_port = event_port;
1457+
ice_lag_config_eswitch(lag, event_netdev);
14311458
} else {
14321459
/* port not set as currently active (e.g. new active port
14331460
* has already claimed the nodes and filters

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2424,7 +2424,9 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_tx_ring *tx_ring)
24242424
ICE_TXD_CTX_QW1_CMD_S);
24252425

24262426
ice_tstamp(tx_ring, skb, first, &offload);
2427-
if (ice_is_switchdev_running(vsi->back) && vsi->type != ICE_VSI_SF)
2427+
if ((ice_is_switchdev_running(vsi->back) ||
2428+
ice_lag_is_switchdev_running(vsi->back)) &&
2429+
vsi->type != ICE_VSI_SF)
24282430
ice_eswitch_set_target_vsi(skb, &offload);
24292431

24302432
if (offload.cd_qw1 & ICE_TX_DESC_DTYPE_CTX) {

0 commit comments

Comments
 (0)