2020-01-13 16:27:39

by Jose Abreu

[permalink] [raw]
Subject: [PATCH net-next v3 0/8] net: stmmac: ETF support

This series adds the support for ETF scheduler in stmmac.

1) Starts adding the support by implementing Enhanced Descriptors in stmmac
main core. This is needed for ETF feature in XGMAC and QoS cores.

2) Integrates the ETF logic into stmmac TC core.

3) and 4) adds the HW specific support for ETF in XGMAC and QoS cores. The
IP feature is called TBS (Time Based Scheduling).

5) Enables ETF in GMAC5 IPK PCI entry for all Queues except Queue 0.

6) Adds the new TBS feature and even more information into the debugFS
HW features file.

7) Switches the selftests mechanism to use dev_direct_xmit() so that we can
send packets on specific Queues.

8) Adds a new test for TBS feature.

---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---

Jose Abreu (8):
net: stmmac: Initial support for TBS
net: stmmac: tc: Add support for ETF Scheduler using TBS
net: stmmac: xgmac: Add TBS support
net: stmmac: gmac4+: Add TBS support
net: stmmac: pci: Enable TBS on GMAC5 IPK PCI entry
net: stmmac: Add missing information in DebugFS capabilities file
net: stmmac: selftests: Switch to dev_direct_xmit()
net: stmmac: selftests: Add a test for TBS feature

drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
drivers/net/ethernet/stmicro/stmmac/descs.h | 9 +
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 10 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.h | 7 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 21 +++
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 7 +
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 13 ++
.../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 9 +
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 24 +++
drivers/net/ethernet/stmicro/stmmac/hwif.h | 12 ++
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 207 ++++++++++++++-------
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 2 +
.../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 96 ++++++++--
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 21 +++
include/linux/stmmac.h | 1 +
17 files changed, 362 insertions(+), 84 deletions(-)

--
2.7.4


2020-01-13 16:27:42

by Jose Abreu

[permalink] [raw]
Subject: [PATCH net-next v3 2/8] net: stmmac: tc: Add support for ETF Scheduler using TBS

Adds the support for ETF scheduler using TBS feature which is available
in XGMAC and QoS IPs.

Changes from v2:
- Fix checkpatch issues (Jakub)
- Use the TBS bitfield

Signed-off-by: Jose Abreu <[email protected]>

---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 21 +++++++++++++++++++++
4 files changed, 29 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 31003b67d24f..487099092693 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -368,6 +368,7 @@ struct dma_features {
unsigned int estdep;
unsigned int estsel;
unsigned int fpesel;
+ unsigned int tbssel;
};

/* RX Buffer size must be multiple of 4/8/16 bytes */
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 71c23cbd7af8..df63b0367aff 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -533,6 +533,7 @@ struct tc_cls_u32_offload;
struct tc_cbs_qopt_offload;
struct flow_cls_offload;
struct tc_taprio_qopt_offload;
+struct tc_etf_qopt_offload;

struct stmmac_tc_ops {
int (*init)(struct stmmac_priv *priv);
@@ -544,6 +545,8 @@ struct stmmac_tc_ops {
struct flow_cls_offload *cls);
int (*setup_taprio)(struct stmmac_priv *priv,
struct tc_taprio_qopt_offload *qopt);
+ int (*setup_etf)(struct stmmac_priv *priv,
+ struct tc_etf_qopt_offload *qopt);
};

#define stmmac_tc_init(__priv, __args...) \
@@ -556,6 +559,8 @@ struct stmmac_tc_ops {
stmmac_do_callback(__priv, tc, setup_cls, __args)
#define stmmac_tc_setup_taprio(__priv, __args...) \
stmmac_do_callback(__priv, tc, setup_taprio, __args)
+#define stmmac_tc_setup_etf(__priv, __args...) \
+ stmmac_do_callback(__priv, tc, setup_etf, __args)

struct stmmac_counters;

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index baffb4e8d99a..43af4fc5ab8f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4159,6 +4159,8 @@ static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
return stmmac_tc_setup_cbs(priv, priv, type_data);
case TC_SETUP_QDISC_TAPRIO:
return stmmac_tc_setup_taprio(priv, priv, type_data);
+ case TC_SETUP_QDISC_ETF:
+ return stmmac_tc_setup_etf(priv, priv, type_data);
default:
return -EOPNOTSUPP;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 6c4686b77516..a4ce165af36b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -727,10 +727,31 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
return ret;
}

+static int tc_setup_etf(struct stmmac_priv *priv,
+ struct tc_etf_qopt_offload *qopt)
+{
+ if (!priv->dma_cap.tbssel)
+ return -EOPNOTSUPP;
+ if (qopt->queue >= priv->plat->tx_queues_to_use)
+ return -EINVAL;
+ if (!(priv->tx_queue[qopt->queue].tbs & STMMAC_TBS_AVAIL))
+ return -EINVAL;
+
+ if (qopt->enable)
+ priv->tx_queue[qopt->queue].tbs |= STMMAC_TBS_EN;
+ else
+ priv->tx_queue[qopt->queue].tbs &= ~STMMAC_TBS_EN;
+
+ netdev_info(priv->dev, "%s ETF for Queue %d\n",
+ qopt->enable ? "enabled" : "disabled", qopt->queue);
+ return 0;
+}
+
const struct stmmac_tc_ops dwmac510_tc_ops = {
.init = tc_init,
.setup_cls_u32 = tc_setup_cls_u32,
.setup_cbs = tc_setup_cbs,
.setup_cls = tc_setup_cls,
.setup_taprio = tc_setup_taprio,
+ .setup_etf = tc_setup_etf,
};
--
2.7.4

2020-01-14 03:47:23

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net-next v3 0/8] net: stmmac: ETF support

On Mon, 13 Jan 2020 17:24:08 +0100, Jose Abreu wrote:
> This series adds the support for ETF scheduler in stmmac.
>
> 1) Starts adding the support by implementing Enhanced Descriptors in stmmac
> main core. This is needed for ETF feature in XGMAC and QoS cores.
>
> 2) Integrates the ETF logic into stmmac TC core.
>
> 3) and 4) adds the HW specific support for ETF in XGMAC and QoS cores. The
> IP feature is called TBS (Time Based Scheduling).
>
> 5) Enables ETF in GMAC5 IPK PCI entry for all Queues except Queue 0.
>
> 6) Adds the new TBS feature and even more information into the debugFS
> HW features file.
>
> 7) Switches the selftests mechanism to use dev_direct_xmit() so that we can
> send packets on specific Queues.
>
> 8) Adds a new test for TBS feature.

Applied, thank you!