Skip to content

Commit 5ca63ff

Browse files
rohangt07davem330
authored andcommitted
net: stmmac: Report taprio offload status
Report taprio offload status. This includes per txq and global counters of window_drops and tx_overruns. Window_drops count include count of frames dropped because of queueMaxSDU setting and HLBF error. Transmission overrun counter inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.DWMAC IPs takes care Transmission overrun won't happen hence this is always 0. Signed-off-by: Rohan G Thomas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fd5a6a7 commit 5ca63ff

File tree

1 file changed

+58
-4
lines changed

1 file changed

+58
-4
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ static void tc_taprio_map_maxsdu_txq(struct stmmac_priv *priv,
937937
}
938938
}
939939

940-
static int tc_setup_taprio(struct stmmac_priv *priv,
941-
struct tc_taprio_qopt_offload *qopt)
940+
static int tc_taprio_configure(struct stmmac_priv *priv,
941+
struct tc_taprio_qopt_offload *qopt)
942942
{
943943
u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep;
944944
struct plat_stmmacenet_data *plat = priv->plat;
@@ -990,8 +990,6 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
990990

991991
if (qopt->cmd == TAPRIO_CMD_DESTROY)
992992
goto disable;
993-
else if (qopt->cmd != TAPRIO_CMD_REPLACE)
994-
return -EOPNOTSUPP;
995993

996994
if (qopt->num_entries >= dep)
997995
return -EINVAL;
@@ -1102,6 +1100,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
11021100
priv->plat->est->enable = false;
11031101
stmmac_est_configure(priv, priv, priv->plat->est,
11041102
priv->plat->clk_ptp_rate);
1103+
/* Reset taprio status */
1104+
for (i = 0; i < priv->plat->tx_queues_to_use; i++) {
1105+
priv->xstats.max_sdu_txq_drop[i] = 0;
1106+
priv->xstats.mtl_est_txq_hlbf[i] = 0;
1107+
}
11051108
mutex_unlock(&priv->plat->est->lock);
11061109
}
11071110

@@ -1119,6 +1122,57 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
11191122
return ret;
11201123
}
11211124

1125+
static void tc_taprio_stats(struct stmmac_priv *priv,
1126+
struct tc_taprio_qopt_offload *qopt)
1127+
{
1128+
u64 window_drops = 0;
1129+
int i = 0;
1130+
1131+
for (i = 0; i < priv->plat->tx_queues_to_use; i++)
1132+
window_drops += priv->xstats.max_sdu_txq_drop[i] +
1133+
priv->xstats.mtl_est_txq_hlbf[i];
1134+
qopt->stats.window_drops = window_drops;
1135+
1136+
/* Transmission overrun doesn't happen for stmmac, hence always 0 */
1137+
qopt->stats.tx_overruns = 0;
1138+
}
1139+
1140+
static void tc_taprio_queue_stats(struct stmmac_priv *priv,
1141+
struct tc_taprio_qopt_offload *qopt)
1142+
{
1143+
struct tc_taprio_qopt_queue_stats *q_stats = &qopt->queue_stats;
1144+
int queue = qopt->queue_stats.queue;
1145+
1146+
q_stats->stats.window_drops = priv->xstats.max_sdu_txq_drop[queue] +
1147+
priv->xstats.mtl_est_txq_hlbf[queue];
1148+
1149+
/* Transmission overrun doesn't happen for stmmac, hence always 0 */
1150+
q_stats->stats.tx_overruns = 0;
1151+
}
1152+
1153+
static int tc_setup_taprio(struct stmmac_priv *priv,
1154+
struct tc_taprio_qopt_offload *qopt)
1155+
{
1156+
int err = 0;
1157+
1158+
switch (qopt->cmd) {
1159+
case TAPRIO_CMD_REPLACE:
1160+
case TAPRIO_CMD_DESTROY:
1161+
err = tc_taprio_configure(priv, qopt);
1162+
break;
1163+
case TAPRIO_CMD_STATS:
1164+
tc_taprio_stats(priv, qopt);
1165+
break;
1166+
case TAPRIO_CMD_QUEUE_STATS:
1167+
tc_taprio_queue_stats(priv, qopt);
1168+
break;
1169+
default:
1170+
err = -EOPNOTSUPP;
1171+
}
1172+
1173+
return err;
1174+
}
1175+
11221176
static int tc_setup_etf(struct stmmac_priv *priv,
11231177
struct tc_etf_qopt_offload *qopt)
11241178
{

0 commit comments

Comments
 (0)