Skip to content

Commit 15d8a40

Browse files
Furong Xukuba-moo
authored andcommitted
net: stmmac: support fp parameter of tc-taprio
tc-taprio can select whether traffic classes are express or preemptible. 0) tc qdisc add dev eth1 parent root handle 100 taprio \ num_tc 4 \ map 0 1 2 3 2 2 2 2 2 2 2 2 2 2 2 3 \ queues 1@0 1@1 1@2 1@3 \ base-time 1000000000 \ sched-entry S 03 10000000 \ sched-entry S 0e 10000000 \ flags 0x2 fp P E E E 1) After some traffic tests, MAC merge layer statistics are all good. Local device: [ { "ifname": "eth1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 0, "MACMergeFragCountRx": 0, "MACMergeFragCountTx": 17837, "MACMergeHoldCount": 18639 } } ] Remote device: [ { "ifname": "end1", "pmac-enabled": true, "tx-enabled": true, "tx-active": true, "tx-min-frag-size": 60, "rx-min-frag-size": 60, "verify-enabled": true, "verify-time": 100, "max-verify-time": 128, "verify-status": "SUCCEEDED", "statistics": { "MACMergeFrameAssErrorCount": 0, "MACMergeFrameSmdErrorCount": 0, "MACMergeFrameAssOkCount": 17189, "MACMergeFragCountRx": 17837, "MACMergeFragCountTx": 0, "MACMergeHoldCount": 0 } } ] Tested on DWMAC CORE 5.10a Signed-off-by: Furong Xu <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/0d21ae356fb3cab77337527e87d46748a4852055.1725631883.git.0x1207@gmail.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 195e4f4 commit 15d8a40

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,9 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
931931
struct tc_taprio_qopt_offload *qopt)
932932
{
933933
u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep;
934+
struct netlink_ext_ack *extack = qopt->mqprio.extack;
934935
struct timespec64 time, current_time, qopt_time;
935936
ktime_t current_time_ns;
936-
bool fpe = false;
937937
int i, ret = 0;
938938
u64 ctr;
939939

@@ -1018,16 +1018,12 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
10181018

10191019
switch (qopt->entries[i].command) {
10201020
case TC_TAPRIO_CMD_SET_GATES:
1021-
if (fpe)
1022-
return -EINVAL;
10231021
break;
10241022
case TC_TAPRIO_CMD_SET_AND_HOLD:
10251023
gates |= BIT(0);
1026-
fpe = true;
10271024
break;
10281025
case TC_TAPRIO_CMD_SET_AND_RELEASE:
10291026
gates &= ~BIT(0);
1030-
fpe = true;
10311027
break;
10321028
default:
10331029
return -EOPNOTSUPP;
@@ -1058,11 +1054,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
10581054

10591055
tc_taprio_map_maxsdu_txq(priv, qopt);
10601056

1061-
if (fpe && !priv->dma_cap.fpesel) {
1062-
mutex_unlock(&priv->est_lock);
1063-
return -EOPNOTSUPP;
1064-
}
1065-
10661057
ret = stmmac_est_configure(priv, priv, priv->est,
10671058
priv->plat->clk_ptp_rate);
10681059
mutex_unlock(&priv->est_lock);
@@ -1071,6 +1062,11 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
10711062
goto disable;
10721063
}
10731064

1065+
ret = stmmac_fpe_map_preemption_class(priv, priv->dev, extack,
1066+
qopt->mqprio.preemptible_tcs);
1067+
if (ret)
1068+
goto disable;
1069+
10741070
netdev_info(priv->dev, "configured EST\n");
10751071

10761072
return 0;
@@ -1089,11 +1085,8 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
10891085
mutex_unlock(&priv->est_lock);
10901086
}
10911087

1092-
stmmac_fpe_configure(priv, priv->ioaddr,
1093-
&priv->fpe_cfg,
1094-
priv->plat->tx_queues_to_use,
1095-
priv->plat->rx_queues_to_use,
1096-
false, false);
1088+
stmmac_fpe_map_preemption_class(priv, priv->dev, extack, 0);
1089+
10971090
netdev_info(priv->dev, "disabled FPE\n");
10981091

10991092
return ret;
@@ -1150,6 +1143,18 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
11501143
return err;
11511144
}
11521145

1146+
static int tc_setup_taprio_without_fpe(struct stmmac_priv *priv,
1147+
struct tc_taprio_qopt_offload *qopt)
1148+
{
1149+
if (!qopt->mqprio.preemptible_tcs)
1150+
return tc_setup_taprio(priv, qopt);
1151+
1152+
NL_SET_ERR_MSG_MOD(qopt->mqprio.extack,
1153+
"taprio with FPE is not implemented for this MAC");
1154+
1155+
return -EOPNOTSUPP;
1156+
}
1157+
11531158
static int tc_setup_etf(struct stmmac_priv *priv,
11541159
struct tc_etf_qopt_offload *qopt)
11551160
{
@@ -1266,7 +1271,7 @@ const struct stmmac_tc_ops dwmac4_tc_ops = {
12661271
.setup_cls_u32 = tc_setup_cls_u32,
12671272
.setup_cbs = tc_setup_cbs,
12681273
.setup_cls = tc_setup_cls,
1269-
.setup_taprio = tc_setup_taprio,
1274+
.setup_taprio = tc_setup_taprio_without_fpe,
12701275
.setup_etf = tc_setup_etf,
12711276
.query_caps = tc_query_caps,
12721277
.setup_mqprio = tc_setup_mqprio_unimplemented,
@@ -1288,7 +1293,7 @@ const struct stmmac_tc_ops dwxgmac_tc_ops = {
12881293
.setup_cls_u32 = tc_setup_cls_u32,
12891294
.setup_cbs = tc_setup_cbs,
12901295
.setup_cls = tc_setup_cls,
1291-
.setup_taprio = tc_setup_taprio,
1296+
.setup_taprio = tc_setup_taprio_without_fpe,
12921297
.setup_etf = tc_setup_etf,
12931298
.query_caps = tc_query_caps,
12941299
.setup_mqprio = tc_setup_mqprio_unimplemented,

0 commit comments

Comments
 (0)