mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
cddd459140
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
143 lines
4.0 KiB
Diff
143 lines
4.0 KiB
Diff
From ef0cc7d01f3eeca37c6bf864903af1c0cf0a792d Mon Sep 17 00:00:00 2001
|
|
From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
|
|
Date: Fri, 5 May 2017 18:11:08 +0300
|
|
Subject: [PATCH] dpaa2-eth: Add Tx shaping support
|
|
|
|
Add support in sysfs for controlling DPNI Tx shaping
|
|
parameters: rate limit (in Mbps) and max burst size (in bytes).
|
|
The settings are per port.
|
|
|
|
TODO: See how to integrate Tx shaping support using
|
|
standard Linux tools (ethtool)
|
|
|
|
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
|
|
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
|
|
---
|
|
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 80 ++++++++++++++++++++++++
|
|
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 4 ++
|
|
2 files changed, 84 insertions(+)
|
|
|
|
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
|
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
|
@@ -3771,6 +3771,83 @@ const struct dcbnl_rtnl_ops dpaa2_eth_dc
|
|
};
|
|
#endif
|
|
|
|
+/* SysFS support */
|
|
+static ssize_t dpaa2_eth_show_tx_shaping(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct dpaa2_eth_priv *priv = netdev_priv(to_net_dev(dev));
|
|
+ /* No MC API for getting the shaping config. We're stateful. */
|
|
+ struct dpni_tx_shaping_cfg *scfg = &priv->shaping_cfg;
|
|
+
|
|
+ return sprintf(buf, "%u %hu\n", scfg->rate_limit, scfg->max_burst_size);
|
|
+}
|
|
+
|
|
+static ssize_t dpaa2_eth_write_tx_shaping(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ int err, items;
|
|
+ struct dpaa2_eth_priv *priv = netdev_priv(to_net_dev(dev));
|
|
+ struct dpni_tx_shaping_cfg scfg;
|
|
+
|
|
+ items = sscanf(buf, "%u %hu", &scfg.rate_limit, &scfg.max_burst_size);
|
|
+ if (items != 2) {
|
|
+ pr_err("Expected format: \"rate_limit(Mbps) max_burst_size(bytes)\"\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ /* Size restriction as per MC API documentation */
|
|
+ if (scfg.max_burst_size > DPAA2_ETH_MAX_BURST_SIZE) {
|
|
+ pr_err("max_burst_size must be <= %d\n",
|
|
+ DPAA2_ETH_MAX_BURST_SIZE);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ err = dpni_set_tx_shaping(priv->mc_io, 0, priv->mc_token, &scfg);
|
|
+ if (err) {
|
|
+ dev_err(dev, "dpni_set_tx_shaping() failed\n");
|
|
+ return -EPERM;
|
|
+ }
|
|
+ /* If successful, save the current configuration for future inquiries */
|
|
+ priv->shaping_cfg = scfg;
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+static struct device_attribute dpaa2_eth_attrs[] = {
|
|
+ __ATTR(tx_shaping,
|
|
+ 0600,
|
|
+ dpaa2_eth_show_tx_shaping,
|
|
+ dpaa2_eth_write_tx_shaping),
|
|
+};
|
|
+
|
|
+static void dpaa2_eth_sysfs_init(struct device *dev)
|
|
+{
|
|
+ int i, err;
|
|
+
|
|
+ for (i = 0; i < ARRAY_SIZE(dpaa2_eth_attrs); i++) {
|
|
+ err = device_create_file(dev, &dpaa2_eth_attrs[i]);
|
|
+ if (err) {
|
|
+ dev_err(dev, "ERROR creating sysfs file\n");
|
|
+ goto undo;
|
|
+ }
|
|
+ }
|
|
+ return;
|
|
+
|
|
+undo:
|
|
+ while (i > 0)
|
|
+ device_remove_file(dev, &dpaa2_eth_attrs[--i]);
|
|
+}
|
|
+
|
|
+static void dpaa2_eth_sysfs_remove(struct device *dev)
|
|
+{
|
|
+ int i;
|
|
+
|
|
+ for (i = 0; i < ARRAY_SIZE(dpaa2_eth_attrs); i++)
|
|
+ device_remove_file(dev, &dpaa2_eth_attrs[i]);
|
|
+}
|
|
+
|
|
static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev)
|
|
{
|
|
struct device *dev;
|
|
@@ -3890,6 +3967,7 @@ static int dpaa2_eth_probe(struct fsl_mc
|
|
#ifdef CONFIG_DEBUG_FS
|
|
dpaa2_dbg_add(priv);
|
|
#endif
|
|
+ dpaa2_eth_sysfs_init(&net_dev->dev);
|
|
|
|
dev_info(dev, "Probed interface %s\n", net_dev->name);
|
|
return 0;
|
|
@@ -3937,6 +4015,8 @@ static int dpaa2_eth_remove(struct fsl_m
|
|
#ifdef CONFIG_DEBUG_FS
|
|
dpaa2_dbg_remove(priv);
|
|
#endif
|
|
+ dpaa2_eth_sysfs_remove(&net_dev->dev);
|
|
+
|
|
unregister_netdev(net_dev);
|
|
|
|
if (priv->do_link_poll)
|
|
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
|
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
|
@@ -42,6 +42,9 @@
|
|
*/
|
|
#define DPAA2_ETH_FQ_TAILDROP_THRESH (1024 * 1024)
|
|
|
|
+/* Maximum burst size value for Tx shaping */
|
|
+#define DPAA2_ETH_MAX_BURST_SIZE 0xF7FF
|
|
+
|
|
/* Maximum number of Tx confirmation frames to be processed
|
|
* in a single NAPI call
|
|
*/
|
|
@@ -444,6 +447,7 @@ struct dpaa2_eth_priv {
|
|
#ifdef CONFIG_DEBUG_FS
|
|
struct dpaa2_debugfs dbg;
|
|
#endif
|
|
+ struct dpni_tx_shaping_cfg shaping_cfg;
|
|
};
|
|
|
|
#define DPAA2_RXH_SUPPORTED (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO \
|