Skip to content

Commit b9e7fc0

Browse files
Faizal Rahimkuba-moo
authored andcommitted
igc: Fix double reset adapter triggered from a single taprio cmd
Following the implementation of "igc: Add TransmissionOverrun counter" patch, when a taprio command is triggered by user, igc processes two commands: TAPRIO_CMD_REPLACE followed by TAPRIO_CMD_STATS. However, both commands unconditionally pass through igc_tsn_offload_apply() which evaluates and triggers reset adapter. The double reset causes issues in the calculation of adapter->qbv_count in igc. TAPRIO_CMD_REPLACE command is expected to reset the adapter since it activates qbv. It's unexpected for TAPRIO_CMD_STATS to do the same because it doesn't configure any driver-specific TSN settings. So, the evaluation in igc_tsn_offload_apply() isn't needed for TAPRIO_CMD_STATS. To address this, commands parsing are relocated to igc_tsn_enable_qbv_scheduling(). Commands that don't require an adapter reset will exit after processing, thus avoiding igc_tsn_offload_apply(). Fixes: d375007 ("igc: Add TransmissionOverrun counter") Signed-off-by: Faizal Rahim <[email protected]> Acked-by: Vinicius Costa Gomes <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Tested-by: Mor Bar-Gabay <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4efce72 commit b9e7fc0

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6306,21 +6306,6 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
63066306
size_t n;
63076307
int i;
63086308

6309-
switch (qopt->cmd) {
6310-
case TAPRIO_CMD_REPLACE:
6311-
break;
6312-
case TAPRIO_CMD_DESTROY:
6313-
return igc_tsn_clear_schedule(adapter);
6314-
case TAPRIO_CMD_STATS:
6315-
igc_taprio_stats(adapter->netdev, &qopt->stats);
6316-
return 0;
6317-
case TAPRIO_CMD_QUEUE_STATS:
6318-
igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats);
6319-
return 0;
6320-
default:
6321-
return -EOPNOTSUPP;
6322-
}
6323-
63246309
if (qopt->base_time < 0)
63256310
return -ERANGE;
63266311

@@ -6429,7 +6414,23 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
64296414
if (hw->mac.type != igc_i225)
64306415
return -EOPNOTSUPP;
64316416

6432-
err = igc_save_qbv_schedule(adapter, qopt);
6417+
switch (qopt->cmd) {
6418+
case TAPRIO_CMD_REPLACE:
6419+
err = igc_save_qbv_schedule(adapter, qopt);
6420+
break;
6421+
case TAPRIO_CMD_DESTROY:
6422+
err = igc_tsn_clear_schedule(adapter);
6423+
break;
6424+
case TAPRIO_CMD_STATS:
6425+
igc_taprio_stats(adapter->netdev, &qopt->stats);
6426+
return 0;
6427+
case TAPRIO_CMD_QUEUE_STATS:
6428+
igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats);
6429+
return 0;
6430+
default:
6431+
return -EOPNOTSUPP;
6432+
}
6433+
64336434
if (err)
64346435
return err;
64356436

0 commit comments

Comments
 (0)