* Re: [PATCH iproute2 net-next] tc: flower: support matching flags
From: Paul Blakey @ 2017-01-04 11:51 UTC (permalink / raw)
To: Simon Horman
Cc: paulb, Jiri Benc, netdev, Stephen Hemminger, David S. Miller,
Hadar Hen Zion, Or Gerlitz, Roi Dayan
In-Reply-To: <20170104103301.GA30008@penelope.horms.nl>
On 04/01/2017 12:33, Simon Horman wrote:
> On Tue, Jan 03, 2017 at 01:54:34PM +0200, Paul Blakey wrote:
>
> ...
>
> Hi Paul,
>
>> Matching name was from the idea that we are doing is matching.
>> And regarding documentation/flag names I didn't want tc tool to be need of a
>> update each time a new flag is introduced,
>> But I guess I can add two options like with ip_proto where you can specify
>> known flags by name but can also give a value.
>> What do you think about that?
>>
>> flags <FLAGS> / <HEX'/'HEX>
>> FLAGS => frag/no_frag/tcp_syn/no_tcp_syn ['|'<FLAGS>]*
>> e.g: flags frag|no_tcp_syn or flags 0x01/0x15
>> and the mask will have a on bits corresponds only to those flags specified.
> I suppose a flag is a flag and bitwise masking allows arbitrary matching
> on one or more flags. But I wonder if, as per your example above,
> it makes sense to mix IP (frag) and TCP flags in the same field of the
> classifier.
It mimics the kernel packing of flags, I have no problem either way
(flags, or ip_flags/tcp_flags pairs), what do you think jiri?
^ permalink raw reply
* Re: [PATCH 3/3] stmmac: adding new glue driver dwmac-dwc-qos-eth
From: Joao Pinto @ 2017-01-04 11:49 UTC (permalink / raw)
To: Niklas Cassel, Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <e7436459-cd90-9fc9-b65e-2c9a2f4d7d37@axis.com>
Às 11:24 AM de 1/4/2017, Niklas Cassel escreveu:
>
>
> On 01/04/2017 12:08 PM, Joao Pinto wrote:
>> Hi Niklas,
>>
>> Às 10:59 AM de 1/4/2017, Niklas Cassel escreveu:
>>> Hello Joao
>>>
>>> I just tested this series using the dwc_eth_qos DT bindings.
>>> Good work!
>>>
>>> Unfortunately I get the following error:
>>>
>>> <3>[ 12.032463] dwc-eth-dwmac f8010000.ethernet eth0: stmmac_open: ERROR: allocating the WoL IRQ -1098801248 (-22)
>>>
>>>
>>> This appears to be because of a corner case in stmmac_platform.c
>>> where wol_irq can differ from the normal irq.
>>>
>>> Adding the following one liner fixes the problem:
>>>
>>>
>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>> @@ -125,6 +125,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
>>> }
>>> return stmmac_res.irq;
>>> }
>>> + stmmac_res.wol_irq = stmmac_res.irq;
>>>
>>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>>>
>> Ok, I'll add this fix to the patch and give a check to the clks.
>> I already sent a v1 patch set to net-dev, and I am now going to generate v2 so
>> it would be great to have your tested.by tag to push it faster :) Thanks!
>
> Send your V2, and I will test it, and reply with a Tested-by tag.
> I can't reply with a Tested-by tag on V1, since it gives an
> error during open.
>
> If I reply with a Tested-by tag, on your V2, patchwork
> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.ozlabs.org_project_netdev_list_&d=DgID-g&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=Ne_JFvbqIwFj_Tokwm6Yv1pv3wETnoD3iG7TjxJqLaQ&s=7hU48UexRw1mb7Y3V4ly3tX0yErTXUW_k4gSZVGe4yE&e=
> will append it to the patch automatically.
> Since Dave fetches patches from patchwork,
> it will be there when it's time to be applied.
Ok, great! Just sent you v2. Thanks.
>
>>
>>>
>>>
>>> I have one comment about clocks interleaved as well
>>>
>>>
>>>
>>> On 01/04/2017 10:44 AM, Joao Pinto wrote:
>>>> This patch adds a new glue driver called dwmac-dwc-qos-eth which
>>>> was based in the dwc_eth_qos as is. To assure retro-compatibility a slight
>>>> tweak was also added to stmmac_platform.
>>>>
>>>> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
>>>> Reviewed-by: Lars Persson <larper@axis.com>
>>>> ---
>>>> .../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
>>>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
>>>> drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
>>>> .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 199 +++++++++++++++++++++
>>>> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 15 +-
>>>> 5 files changed, 224 insertions(+), 3 deletions(-)
>>>> create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>>> index d93f71c..21d27aa 100644
>>>> --- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>>> +++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>>> @@ -1,5 +1,8 @@
>>>> * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
>>>>
>>>> +This binding is deprecated, but it continues to be supported, but new
>>>> +features should be preferably added to the stmmac binding document.
>>>> +
>>>> This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
>>>> IP block. The IP supports multiple options for bus type, clocking and reset
>>>> structure, and feature list. Consequently, a number of properties and list
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>>> index ab66248..99594e3 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>>> @@ -29,6 +29,15 @@ config STMMAC_PLATFORM
>>>>
>>>> if STMMAC_PLATFORM
>>>>
>>>> +config DWMAC_DWC_QOS_ETH
>>>> + tristate "Support for snps,dwc-qos-ethernet.txt DT binding."
>>>> + select PHYLIB
>>>> + select CRC32
>>>> + select MII
>>>> + depends on OF && HAS_DMA
>>>> + help
>>>> + Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
>>>> +
>>>> config DWMAC_GENERIC
>>>> tristate "Generic driver for DWMAC"
>>>> default STMMAC_PLATFORM
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>>> index 8f83a86..700c603 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>>> @@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
>>>> obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
>>>> obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
>>>> obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
>>>> +obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
>>>> obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
>>>> stmmac-platform-objs:= stmmac_platform.o
>>>> dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>>> new file mode 100644
>>>> index 0000000..8a6ac06
>>>> --- /dev/null
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>>> @@ -0,0 +1,199 @@
>>>> +/*
>>>> + * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
>>>> + *
>>>> + * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com>
>>>> + *
>>>> + * This program is free software; you can redistribute it and/or modify
>>>> + * it under the terms of the GNU General Public License version 2 as
>>>> + * published by the Free Software Foundation.
>>>> + *
>>>> + * You should have received a copy of the GNU General Public License
>>>> + * along with this program. If not, see <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_licenses_&d=DgIC-g&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=DrobFP08nu4hh6e05EgeOl1xD34OacyiZ-be_GG829Q&s=WLSkpBK06KCu-_kvN305yE6YncNYcDG_Bk0pgqSBG1o&e=>.
>>>> + */
>>>> +
>>>> +#include <linux/clk.h>
>>>> +#include <linux/clk-provider.h>
>>>> +#include <linux/device.h>
>>>> +#include <linux/ethtool.h>
>>>> +#include <linux/io.h>
>>>> +#include <linux/ioport.h>
>>>> +#include <linux/module.h>
>>>> +#include <linux/of_net.h>
>>>> +#include <linux/mfd/syscon.h>
>>>> +#include <linux/platform_device.h>
>>>> +#include <linux/stmmac.h>
>>>> +
>>>> +#include "stmmac_platform.h"
>>>> +
>>>> +static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
>>>> + struct plat_stmmacenet_data *plat_dat)
>>>> +{
>>>> + struct device_node *np = pdev->dev.of_node;
>>>> + u32 burst_map = 0;
>>>> + u32 bit_index = 0;
>>>> + u32 a_index = 0;
>>>> +
>>>> + if (!plat_dat->axi) {
>>>> + plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
>>>> +
>>>> + if (!plat_dat->axi)
>>>> + return -ENOMEM;
>>>> + }
>>>> +
>>>> + plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
>>>> + if (of_property_read_u32(np, "snps,write-requests",
>>>> + &plat_dat->axi->axi_wr_osr_lmt)) {
>>>> + /**
>>>> + * Since the register has a reset value of 1, if property
>>>> + * is missing, default to 1.
>>>> + */
>>>> + plat_dat->axi->axi_wr_osr_lmt = 1;
>>>> + } else {
>>>> + /**
>>>> + * If property exists, to keep the behavior from dwc_eth_qos,
>>>> + * subtract one after parsing.
>>>> + */
>>>> + plat_dat->axi->axi_wr_osr_lmt--;
>>>> + }
>>>> +
>>>> + if (of_property_read_u32(np, "read,read-requests",
>>>> + &plat_dat->axi->axi_rd_osr_lmt)) {
>>>> + /**
>>>> + * Since the register has a reset value of 1, if property
>>>> + * is missing, default to 1.
>>>> + */
>>>> + plat_dat->axi->axi_rd_osr_lmt = 1;
>>>> + } else {
>>>> + /**
>>>> + * If property exists, to keep the behavior from dwc_eth_qos,
>>>> + * subtract one after parsing.
>>>> + */
>>>> + plat_dat->axi->axi_rd_osr_lmt--;
>>>> + }
>>>> + of_property_read_u32(np, "snps,burst-map", &burst_map);
>>>> +
>>>> + /* converts burst-map bitmask to burst array */
>>>> + for (bit_index = 0; bit_index < 7; bit_index++) {
>>>> + if (burst_map & (1 << bit_index)) {
>>>> + switch (bit_index) {
>>>> + case 0:
>>>> + plat_dat->axi->axi_blen[a_index] = 4; break;
>>>> + case 1:
>>>> + plat_dat->axi->axi_blen[a_index] = 8; break;
>>>> + case 2:
>>>> + plat_dat->axi->axi_blen[a_index] = 16; break;
>>>> + case 3:
>>>> + plat_dat->axi->axi_blen[a_index] = 32; break;
>>>> + case 4:
>>>> + plat_dat->axi->axi_blen[a_index] = 64; break;
>>>> + case 5:
>>>> + plat_dat->axi->axi_blen[a_index] = 128; break;
>>>> + case 6:
>>>> + plat_dat->axi->axi_blen[a_index] = 256; break;
>>>> + default:
>>>> + break;
>>>> + }
>>>> + a_index++;
>>>> + }
>>>> + }
>>>> +
>>>> + /* dwc-qos needs GMAC4, AAL, TSO and PMT */
>>>> + plat_dat->has_gmac4 = 1;
>>>> + plat_dat->dma_cfg->aal = 1;
>>>> + plat_dat->tso_en = 1;
>>>> + plat_dat->pmt = 1;
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int dwc_eth_dwmac_probe(struct platform_device *pdev)
>>>> +{
>>>> + struct plat_stmmacenet_data *plat_dat;
>>>> + struct stmmac_resources stmmac_res;
>>>> + struct resource *res;
>>>> + int ret;
>>>> +
>>>> + /**
>>>> + * Since stmmac_platform supports name IRQ only, basic platform
>>>> + * resource initialization is done in the glue logic.
>>>> + */
>>>> + stmmac_res.irq = platform_get_irq(pdev, 0);
>>>> + if (stmmac_res.irq < 0) {
>>>> + if (stmmac_res.irq != -EPROBE_DEFER) {
>>>> + dev_err(&pdev->dev,
>>>> + "IRQ configuration information not found\n");
>>>> + }
>>>> + return stmmac_res.irq;
>>>> + }
>>>> +
>>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> + stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>>>> + if (IS_ERR(stmmac_res.addr))
>>>> + return PTR_ERR(stmmac_res.addr);
>>>> +
>>>> + plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
>>>> + if (IS_ERR(plat_dat))
>>>> + return PTR_ERR(plat_dat);
>>>> +
>>>> + plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>>>> + if (IS_ERR(plat_dat->stmmac_clk)) {
>>>> + dev_err(&pdev->dev, "apb_pclk clock not found.\n");
>>> Error message does not match the devm_clk_get.
>>>
>>> Looking at synopsys/dwc_eth_qos.c
>>> phy_ref_clk is just a dummy, used for verbosity.
>>> apb_pclk is the clock which is actually used for setting csr etc.
>>>
>>> So it should be
>>>
>>> plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
>>>
>>>
>>> So that way the warning is already correct :)
>>>
>>>
>>>
>>>> + ret = PTR_ERR(plat_dat->stmmac_clk);
>>>> + plat_dat->stmmac_clk = NULL;
>>>> + goto err_remove_config_dt;
>>>> + }
>>>> + clk_prepare_enable(plat_dat->stmmac_clk);
>>>> +
>>>> + plat_dat->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
>>>> + if (IS_ERR(plat_dat->pclk)) {
>>>> + dev_err(&pdev->dev, "phy_ref_clk clock not found.\n");
>>> Error message does not match the devm_clk_get,
>>> however, since this should be
>>>
>>> plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>>>
>>> the warning is correct :)
>>>
>>>> + ret = PTR_ERR(plat_dat->pclk);
>>>> + plat_dat->pclk = NULL;
>>>> + goto err_out_clk_dis_phy;
>>>> + }
>>>> + clk_prepare_enable(plat_dat->pclk);
>>>> +
>>>> + ret = dwc_eth_dwmac_config_dt(pdev, plat_dat);
>>>> + if (ret)
>>>> + goto err_out_clk_dis_aper;
>>>> +
>>>> + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
>>>> + if (ret)
>>>> + goto err_out_clk_dis_aper;
>>>> +
>>>> + return 0;
>>>> +
>>>> +err_out_clk_dis_aper:
>>>> + clk_disable_unprepare(plat_dat->pclk);
>>>> +err_out_clk_dis_phy:
>>>> + clk_disable_unprepare(plat_dat->stmmac_clk);
>>>> +err_remove_config_dt:
>>>> + stmmac_remove_config_dt(pdev, plat_dat);
>>>> +
>>>> + return ret;
>>>> +}
>>>> +
>>>> +static int dwc_eth_dwmac_remove(struct platform_device *pdev)
>>>> +{
>>>> + return stmmac_pltfr_remove(pdev);
>>>> +}
>>>> +
>>>> +static const struct of_device_id dwc_eth_dwmac_match[] = {
>>>> + { .compatible = "snps,dwc-qos-ethernet-4.10", },
>>>> + { }
>>>> +};
>>>> +MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
>>>> +
>>>> +static struct platform_driver dwc_eth_dwmac_driver = {
>>>> + .probe = dwc_eth_dwmac_probe,
>>>> + .remove = dwc_eth_dwmac_remove,
>>>> + .driver = {
>>>> + .name = "dwc-eth-dwmac",
>>>> + .of_match_table = dwc_eth_dwmac_match,
>>>> + },
>>>> +};
>>>> +module_platform_driver(dwc_eth_dwmac_driver);
>>>> +
>>>> +MODULE_AUTHOR("Joao Pinto <jpinto@synopsys.com>");
>>>> +MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");
>>>> +MODULE_LICENSE("GPL v2");
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> index 4e44f9c..00c0f8d 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> @@ -181,10 +181,19 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>>>> mdio = false;
>>>> }
>>>>
>>>> - /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
>>>> - for_each_child_of_node(np, plat->mdio_node) {
>>>> - if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
>>>> + /* exception for dwmac-dwc-qos-eth glue logic */
>>>> + if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
>>>> + plat->mdio_node = of_get_child_by_name(np, "mdio");
>>>> + } else {
>>>> + /**
>>>> + * If snps,dwmac-mdio is passed from DT, always register
>>>> + * the MDIO
>>>> + */
>>>> + for_each_child_of_node(np, plat->mdio_node) {
>>>> + if (of_device_is_compatible(plat->mdio_node,
>>>> + "snps,dwmac-mdio"))
>>>> break;
>>>> + }
>>>> }
>>>>
>>>> if (plat->mdio_node) {
>
^ permalink raw reply
* [PATCH v2 3/3] stmmac: adding new glue driver dwmac-dwc-qos-eth
From: Joao Pinto @ 2017-01-04 11:48 UTC (permalink / raw)
To: davem; +Cc: lars.persson, niklass, swarren, treding, netdev, Joao Pinto
In-Reply-To: <cover.1483530191.git.jpinto@synopsys.com>
This patch adds a new glue driver called dwmac-dwc-qos-eth which
was based in the dwc_eth_qos as is. To assure retro-compatibility a slight
tweak was also added to stmmac_platform.
Signed-off-by: Joao Pinto <jpinto@synopsys.com>
---
changes v1 -> v2:
- WOL was not declared in the new glue driver
- clocks were switched and now fixed (apb_pclk and phy_ref_clk)
.../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
.../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 200 +++++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 15 +-
5 files changed, 225 insertions(+), 3 deletions(-)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
index d93f71c..21d27aa 100644
--- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
+++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
@@ -1,5 +1,8 @@
* Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
+This binding is deprecated, but it continues to be supported, but new
+features should be preferably added to the stmmac binding document.
+
This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
IP block. The IP supports multiple options for bus type, clocking and reset
structure, and feature list. Consequently, a number of properties and list
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index ab66248..99594e3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -29,6 +29,15 @@ config STMMAC_PLATFORM
if STMMAC_PLATFORM
+config DWMAC_DWC_QOS_ETH
+ tristate "Support for snps,dwc-qos-ethernet.txt DT binding."
+ select PHYLIB
+ select CRC32
+ select MII
+ depends on OF && HAS_DMA
+ help
+ Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
+
config DWMAC_GENERIC
tristate "Generic driver for DWMAC"
default STMMAC_PLATFORM
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 8f83a86..700c603 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
+obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
stmmac-platform-objs:= stmmac_platform.o
dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
new file mode 100644
index 0000000..4532a7c
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -0,0 +1,200 @@
+/*
+ * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
+ *
+ * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/ethtool.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
+#include <linux/of_net.h>
+#include <linux/mfd/syscon.h>
+#include <linux/platform_device.h>
+#include <linux/stmmac.h>
+
+#include "stmmac_platform.h"
+
+static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat_dat)
+{
+ struct device_node *np = pdev->dev.of_node;
+ u32 burst_map = 0;
+ u32 bit_index = 0;
+ u32 a_index = 0;
+
+ if (!plat_dat->axi) {
+ plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
+
+ if (!plat_dat->axi)
+ return -ENOMEM;
+ }
+
+ plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
+ if (of_property_read_u32(np, "snps,write-requests",
+ &plat_dat->axi->axi_wr_osr_lmt)) {
+ /**
+ * Since the register has a reset value of 1, if property
+ * is missing, default to 1.
+ */
+ plat_dat->axi->axi_wr_osr_lmt = 1;
+ } else {
+ /**
+ * If property exists, to keep the behavior from dwc_eth_qos,
+ * subtract one after parsing.
+ */
+ plat_dat->axi->axi_wr_osr_lmt--;
+ }
+
+ if (of_property_read_u32(np, "read,read-requests",
+ &plat_dat->axi->axi_rd_osr_lmt)) {
+ /**
+ * Since the register has a reset value of 1, if property
+ * is missing, default to 1.
+ */
+ plat_dat->axi->axi_rd_osr_lmt = 1;
+ } else {
+ /**
+ * If property exists, to keep the behavior from dwc_eth_qos,
+ * subtract one after parsing.
+ */
+ plat_dat->axi->axi_rd_osr_lmt--;
+ }
+ of_property_read_u32(np, "snps,burst-map", &burst_map);
+
+ /* converts burst-map bitmask to burst array */
+ for (bit_index = 0; bit_index < 7; bit_index++) {
+ if (burst_map & (1 << bit_index)) {
+ switch (bit_index) {
+ case 0:
+ plat_dat->axi->axi_blen[a_index] = 4; break;
+ case 1:
+ plat_dat->axi->axi_blen[a_index] = 8; break;
+ case 2:
+ plat_dat->axi->axi_blen[a_index] = 16; break;
+ case 3:
+ plat_dat->axi->axi_blen[a_index] = 32; break;
+ case 4:
+ plat_dat->axi->axi_blen[a_index] = 64; break;
+ case 5:
+ plat_dat->axi->axi_blen[a_index] = 128; break;
+ case 6:
+ plat_dat->axi->axi_blen[a_index] = 256; break;
+ default:
+ break;
+ }
+ a_index++;
+ }
+ }
+
+ /* dwc-qos needs GMAC4, AAL, TSO and PMT */
+ plat_dat->has_gmac4 = 1;
+ plat_dat->dma_cfg->aal = 1;
+ plat_dat->tso_en = 1;
+ plat_dat->pmt = 1;
+
+ return 0;
+}
+
+static int dwc_eth_dwmac_probe(struct platform_device *pdev)
+{
+ struct plat_stmmacenet_data *plat_dat;
+ struct stmmac_resources stmmac_res;
+ struct resource *res;
+ int ret;
+
+ /**
+ * Since stmmac_platform supports name IRQ only, basic platform
+ * resource initialization is done in the glue logic.
+ */
+ stmmac_res.irq = platform_get_irq(pdev, 0);
+ if (stmmac_res.irq < 0) {
+ if (stmmac_res.irq != -EPROBE_DEFER) {
+ dev_err(&pdev->dev,
+ "IRQ configuration information not found\n");
+ }
+ return stmmac_res.irq;
+ }
+ stmmac_res.wol_irq = stmmac_res.irq;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(stmmac_res.addr))
+ return PTR_ERR(stmmac_res.addr);
+
+ plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
+ if (IS_ERR(plat_dat))
+ return PTR_ERR(plat_dat);
+
+ plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
+ if (IS_ERR(plat_dat->stmmac_clk)) {
+ dev_err(&pdev->dev, "apb_pclk clock not found.\n");
+ ret = PTR_ERR(plat_dat->stmmac_clk);
+ plat_dat->stmmac_clk = NULL;
+ goto err_remove_config_dt;
+ }
+ clk_prepare_enable(plat_dat->stmmac_clk);
+
+ plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
+ if (IS_ERR(plat_dat->pclk)) {
+ dev_err(&pdev->dev, "phy_ref_clk clock not found.\n");
+ ret = PTR_ERR(plat_dat->pclk);
+ plat_dat->pclk = NULL;
+ goto err_out_clk_dis_phy;
+ }
+ clk_prepare_enable(plat_dat->pclk);
+
+ ret = dwc_eth_dwmac_config_dt(pdev, plat_dat);
+ if (ret)
+ goto err_out_clk_dis_aper;
+
+ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+ if (ret)
+ goto err_out_clk_dis_aper;
+
+ return 0;
+
+err_out_clk_dis_aper:
+ clk_disable_unprepare(plat_dat->pclk);
+err_out_clk_dis_phy:
+ clk_disable_unprepare(plat_dat->stmmac_clk);
+err_remove_config_dt:
+ stmmac_remove_config_dt(pdev, plat_dat);
+
+ return ret;
+}
+
+static int dwc_eth_dwmac_remove(struct platform_device *pdev)
+{
+ return stmmac_pltfr_remove(pdev);
+}
+
+static const struct of_device_id dwc_eth_dwmac_match[] = {
+ { .compatible = "snps,dwc-qos-ethernet-4.10", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
+
+static struct platform_driver dwc_eth_dwmac_driver = {
+ .probe = dwc_eth_dwmac_probe,
+ .remove = dwc_eth_dwmac_remove,
+ .driver = {
+ .name = "dwc-eth-dwmac",
+ .of_match_table = dwc_eth_dwmac_match,
+ },
+};
+module_platform_driver(dwc_eth_dwmac_driver);
+
+MODULE_AUTHOR("Joao Pinto <jpinto@synopsys.com>");
+MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 4e44f9c..00c0f8d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -181,10 +181,19 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
mdio = false;
}
- /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
- for_each_child_of_node(np, plat->mdio_node) {
- if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
+ /* exception for dwmac-dwc-qos-eth glue logic */
+ if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
+ plat->mdio_node = of_get_child_by_name(np, "mdio");
+ } else {
+ /**
+ * If snps,dwmac-mdio is passed from DT, always register
+ * the MDIO
+ */
+ for_each_child_of_node(np, plat->mdio_node) {
+ if (of_device_is_compatible(plat->mdio_node,
+ "snps,dwmac-mdio"))
break;
+ }
}
if (plat->mdio_node) {
--
2.9.3
^ permalink raw reply related
* [PATCH v2 2/3] stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure
From: Joao Pinto @ 2017-01-04 11:48 UTC (permalink / raw)
To: davem; +Cc: lars.persson, niklass, swarren, treding, netdev, Joao Pinto
In-Reply-To: <cover.1483530191.git.jpinto@synopsys.com>
This patch moves stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to the
plat_stmmacenet_data structure. It also moves these platform variables
initialization to stmmac_platform. This was done for two reasons:
a) If PCI is used, platform related code is being executed in stmmac_main
resulting in warnings that have no sense and conceptually was not right
b) stmmac as a synopsys reference ethernet driver stack will be hosting
more and more drivers to its structure like synopsys/dwc_eth_qos.c.
These drivers have their own DT bindings that are not compatible with
stmmac's. One of the most important are the clock names, and so they need
to be parsed in the glue logic and initialized there, and that is the main
reason why the clocks were passed to the platform structure.
Signed-off-by: Joao Pinto <jpinto@synopsys.com>
---
changes v1 -> v2:
- nothing changed. Just to keep up with patch set version
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 --
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 82 ++++------------------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 47 +++++++++++++
include/linux/stmmac.h | 5 ++
5 files changed, 69 insertions(+), 74 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index eab04ae..bf8a83e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -106,9 +106,6 @@ struct stmmac_priv {
u32 msg_enable;
int wolopts;
int wol_irq;
- struct clk *stmmac_clk;
- struct clk *pclk;
- struct reset_control *stmmac_rst;
int clk_csr;
struct timer_list eee_ctrl_timer;
int lpi_irq;
@@ -120,8 +117,6 @@ struct stmmac_priv {
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_ops;
unsigned int default_addend;
- struct clk *clk_ptp_ref;
- unsigned int clk_ptp_rate;
u32 adv_ts;
int use_riwt;
int irq_wake;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 699ee1d..322e5c6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -712,7 +712,7 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
{
- unsigned long clk = clk_get_rate(priv->stmmac_clk);
+ unsigned long clk = clk_get_rate(priv->plat->stmmac_clk);
if (!clk)
return 0;
@@ -722,7 +722,7 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv)
{
- unsigned long clk = clk_get_rate(priv->stmmac_clk);
+ unsigned long clk = clk_get_rate(priv->plat->stmmac_clk);
if (!clk)
return 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f1a0afc..6e6e9dc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -158,7 +158,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
{
u32 clk_rate;
- clk_rate = clk_get_rate(priv->stmmac_clk);
+ clk_rate = clk_get_rate(priv->plat->stmmac_clk);
/* Platform provided default clk_csr would be assumed valid
* for all other cases except for the below mentioned ones.
@@ -607,7 +607,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
/* program Sub Second Increment reg */
sec_inc = priv->hw->ptp->config_sub_second_increment(
- priv->ptpaddr, priv->clk_ptp_rate,
+ priv->ptpaddr, priv->plat->clk_ptp_rate,
priv->plat->has_gmac4);
temp = div_u64(1000000000ULL, sec_inc);
@@ -617,7 +617,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
* where, freq_div_ratio = 1e9ns/sec_inc
*/
temp = (u64)(temp << 32);
- priv->default_addend = div_u64(temp, priv->clk_ptp_rate);
+ priv->default_addend = div_u64(temp, priv->plat->clk_ptp_rate);
priv->hw->ptp->config_addend(priv->ptpaddr,
priv->default_addend);
@@ -645,18 +645,6 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))
return -EOPNOTSUPP;
- /* Fall-back to main clock in case of no PTP ref is passed */
- priv->clk_ptp_ref = devm_clk_get(priv->device, "clk_ptp_ref");
- if (IS_ERR(priv->clk_ptp_ref)) {
- priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk);
- priv->clk_ptp_ref = NULL;
- netdev_dbg(priv->dev, "PTP uses main clock\n");
- } else {
- clk_prepare_enable(priv->clk_ptp_ref);
- priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref);
- netdev_dbg(priv->dev, "PTP rate %d\n", priv->clk_ptp_rate);
- }
-
priv->adv_ts = 0;
/* Check if adv_ts can be enabled for dwmac 4.x core */
if (priv->plat->has_gmac4 && priv->dma_cap.atime_stamp)
@@ -683,8 +671,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
static void stmmac_release_ptp(struct stmmac_priv *priv)
{
- if (priv->clk_ptp_ref)
- clk_disable_unprepare(priv->clk_ptp_ref);
+ if (priv->plat->clk_ptp_ref)
+ clk_disable_unprepare(priv->plat->clk_ptp_ref);
stmmac_ptp_unregister(priv);
}
@@ -3278,44 +3266,8 @@ int stmmac_dvr_probe(struct device *device,
if ((phyaddr >= 0) && (phyaddr <= 31))
priv->plat->phy_addr = phyaddr;
- priv->stmmac_clk = devm_clk_get(priv->device, STMMAC_RESOURCE_NAME);
- if (IS_ERR(priv->stmmac_clk)) {
- netdev_warn(priv->dev, "%s: warning: cannot get CSR clock\n",
- __func__);
- /* If failed to obtain stmmac_clk and specific clk_csr value
- * is NOT passed from the platform, probe fail.
- */
- if (!priv->plat->clk_csr) {
- ret = PTR_ERR(priv->stmmac_clk);
- goto error_clk_get;
- } else {
- priv->stmmac_clk = NULL;
- }
- }
- clk_prepare_enable(priv->stmmac_clk);
-
- priv->pclk = devm_clk_get(priv->device, "pclk");
- if (IS_ERR(priv->pclk)) {
- if (PTR_ERR(priv->pclk) == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
- goto error_pclk_get;
- }
- priv->pclk = NULL;
- }
- clk_prepare_enable(priv->pclk);
-
- priv->stmmac_rst = devm_reset_control_get(priv->device,
- STMMAC_RESOURCE_NAME);
- if (IS_ERR(priv->stmmac_rst)) {
- if (PTR_ERR(priv->stmmac_rst) == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
- goto error_hw_init;
- }
- dev_info(priv->device, "no reset control found\n");
- priv->stmmac_rst = NULL;
- }
- if (priv->stmmac_rst)
- reset_control_deassert(priv->stmmac_rst);
+ if (priv->plat->stmmac_rst)
+ reset_control_deassert(priv->plat->stmmac_rst);
/* Init MAC and get the capabilities */
ret = stmmac_hw_init(priv);
@@ -3406,10 +3358,6 @@ int stmmac_dvr_probe(struct device *device,
error_netdev_register:
netif_napi_del(&priv->napi);
error_hw_init:
- clk_disable_unprepare(priv->pclk);
-error_pclk_get:
- clk_disable_unprepare(priv->stmmac_clk);
-error_clk_get:
free_netdev(ndev);
return ret;
@@ -3435,10 +3383,10 @@ int stmmac_dvr_remove(struct device *dev)
stmmac_set_mac(priv->ioaddr, false);
netif_carrier_off(ndev);
unregister_netdev(ndev);
- if (priv->stmmac_rst)
- reset_control_assert(priv->stmmac_rst);
- clk_disable_unprepare(priv->pclk);
- clk_disable_unprepare(priv->stmmac_clk);
+ if (priv->plat->stmmac_rst)
+ reset_control_assert(priv->plat->stmmac_rst);
+ clk_disable_unprepare(priv->plat->pclk);
+ clk_disable_unprepare(priv->plat->stmmac_clk);
if (priv->hw->pcs != STMMAC_PCS_RGMII &&
priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI)
@@ -3487,8 +3435,8 @@ int stmmac_suspend(struct device *dev)
stmmac_set_mac(priv->ioaddr, false);
pinctrl_pm_select_sleep_state(priv->device);
/* Disable clock in case of PWM is off */
- clk_disable(priv->pclk);
- clk_disable(priv->stmmac_clk);
+ clk_disable(priv->plat->pclk);
+ clk_disable(priv->plat->stmmac_clk);
}
spin_unlock_irqrestore(&priv->lock, flags);
@@ -3528,8 +3476,8 @@ int stmmac_resume(struct device *dev)
} else {
pinctrl_pm_select_default_state(priv->device);
/* enable the clk prevously disabled */
- clk_enable(priv->stmmac_clk);
- clk_enable(priv->pclk);
+ clk_enable(priv->plat->stmmac_clk);
+ clk_enable(priv->plat->pclk);
/* reset the phy so that it's ready */
if (priv->mii)
stmmac_mdio_reset(priv->mii);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 6064fcc..4e44f9c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -336,7 +336,54 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
plat->axi = stmmac_axi_setup(pdev);
+ /* clock setup */
+ plat->stmmac_clk = devm_clk_get(&pdev->dev,
+ STMMAC_RESOURCE_NAME);
+ if (IS_ERR(plat->stmmac_clk)) {
+ dev_warn(&pdev->dev, "Cannot get CSR clock\n");
+ plat->stmmac_clk = NULL;
+ }
+ clk_prepare_enable(plat->stmmac_clk);
+
+ plat->pclk = devm_clk_get(&pdev->dev, "pclk");
+ if (IS_ERR(plat->pclk)) {
+ if (PTR_ERR(plat->pclk) == -EPROBE_DEFER) {
+ goto error_pclk_get;
+ }
+ plat->pclk = NULL;
+ }
+ clk_prepare_enable(plat->pclk);
+
+ /* Fall-back to main clock in case of no PTP ref is passed */
+ plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "clk_ptp_ref");
+ if (IS_ERR(plat->clk_ptp_ref)) {
+ plat->clk_ptp_rate = clk_get_rate(plat->stmmac_clk);
+ plat->clk_ptp_ref = NULL;
+ dev_warn(&pdev->dev, "PTP uses main clock\n");
+ } else {
+ clk_prepare_enable(plat->clk_ptp_ref);
+ plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
+ dev_info(&pdev->dev, "No reset control found\n");
+ }
+
+ plat->stmmac_rst = devm_reset_control_get(&pdev->dev,
+ STMMAC_RESOURCE_NAME);
+ if (IS_ERR(plat->stmmac_rst)) {
+ if (PTR_ERR(plat->stmmac_rst) == -EPROBE_DEFER) {
+ goto error_hw_init;
+ }
+ dev_info(&pdev->dev, "no reset control found\n");
+ plat->stmmac_rst = NULL;
+ }
+
return plat;
+
+error_hw_init:
+ clk_disable_unprepare(plat->pclk);
+error_pclk_get:
+ clk_disable_unprepare(plat->stmmac_clk);
+
+ return ERR_PTR(-EPROBE_DEFER);
}
/**
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 90fefde..e29e7b8 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -139,6 +139,11 @@ struct plat_stmmacenet_data {
int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv);
void *bsp_priv;
+ struct clk *stmmac_clk;
+ struct clk *pclk;
+ struct clk *clk_ptp_ref;
+ unsigned int clk_ptp_rate;
+ struct reset_control *stmmac_rst;
struct stmmac_axi *axi;
int has_gmac4;
bool tso_en;
--
2.9.3
^ permalink raw reply related
* [PATCH v2 1/3] stmmac: adding DT parameter for LPI tx clock gating
From: Joao Pinto @ 2017-01-04 11:48 UTC (permalink / raw)
To: davem; +Cc: lars.persson, niklass, swarren, treding, netdev, Joao Pinto
In-Reply-To: <cover.1483530191.git.jpinto@synopsys.com>
This patch adds a new parameter to the stmmac DT: snps,en-tx-lpi-clockgating.
It was ported from synopsys/dwc_eth_qos.c and it is useful if lpi tx clock
gating is needed by stmmac users also.
Signed-off-by: Joao Pinto <jpinto@synopsys.com>
---
changes v1 -> v2:
- nothing changed. Just to keep up with patch set version
Documentation/devicetree/bindings/net/stmmac.txt | 2 ++
drivers/net/ethernet/stmicro/stmmac/common.h | 3 ++-
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 5 ++++-
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 +++++-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +++
include/linux/stmmac.h | 1 +
8 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
index 128da75..a0c749f 100644
--- a/Documentation/devicetree/bindings/net/stmmac.txt
+++ b/Documentation/devicetree/bindings/net/stmmac.txt
@@ -49,6 +49,8 @@ Optional properties:
- snps,force_sf_dma_mode Force DMA to use the Store and Forward
mode for both tx and rx. This flag is
ignored if force_thresh_dma_mode is set.
+- snps,en-tx-lpi-clockgating Enable gating of the MAC TX clock during
+ TX low-power mode
- snps,multicast-filter-bins: Number of multicast filter hash bins
supported by this device instance
- snps,perfect-filter-entries: Number of perfect filter entries supported
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 6c96291..75e2666 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -476,7 +476,8 @@ struct stmmac_ops {
unsigned int reg_n);
void (*get_umac_addr)(struct mac_device_info *hw, unsigned char *addr,
unsigned int reg_n);
- void (*set_eee_mode)(struct mac_device_info *hw);
+ void (*set_eee_mode)(struct mac_device_info *hw,
+ bool en_tx_lpi_clockgating);
void (*reset_eee_mode)(struct mac_device_info *hw);
void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw);
void (*set_eee_pls)(struct mac_device_info *hw, int link);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index be3c91c..a5ffca1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -343,11 +343,14 @@ static int dwmac1000_irq_status(struct mac_device_info *hw,
return ret;
}
-static void dwmac1000_set_eee_mode(struct mac_device_info *hw)
+static void dwmac1000_set_eee_mode(struct mac_device_info *hw,
+ bool en_tx_lpi_clockgating)
{
void __iomem *ioaddr = hw->pcsr;
u32 value;
+ /*TODO - en_tx_lpi_clockgating treatment */
+
/* Enable the link status receive on RGMII, SGMII ore SMII
* receive path and instruct the transmit to enter in LPI
* state.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 73d1dab..db45134 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -98,6 +98,7 @@ enum power_event {
#define GMAC4_LPI_TIMER_CTRL 0xd4
/* LPI control and status defines */
+#define GMAC4_LPI_CTRL_STATUS_LPITCSE BIT(21) /* LPI Tx Clock Stop Enable */
#define GMAC4_LPI_CTRL_STATUS_LPITXA BIT(19) /* Enable LPI TX Automate */
#define GMAC4_LPI_CTRL_STATUS_PLS BIT(17) /* PHY Link Status */
#define GMAC4_LPI_CTRL_STATUS_LPIEN BIT(16) /* LPI Enable */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 02eab79..834f40f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -137,7 +137,8 @@ static void dwmac4_get_umac_addr(struct mac_device_info *hw,
GMAC_ADDR_LOW(reg_n));
}
-static void dwmac4_set_eee_mode(struct mac_device_info *hw)
+static void dwmac4_set_eee_mode(struct mac_device_info *hw,
+ bool en_tx_lpi_clockgating)
{
void __iomem *ioaddr = hw->pcsr;
u32 value;
@@ -149,6 +150,9 @@ static void dwmac4_set_eee_mode(struct mac_device_info *hw)
value = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
value |= GMAC4_LPI_CTRL_STATUS_LPIEN | GMAC4_LPI_CTRL_STATUS_LPITXA;
+ if (en_tx_lpi_clockgating)
+ value |= GMAC4_LPI_CTRL_STATUS_LPITCSE;
+
writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c97870f..f1a0afc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -239,7 +239,8 @@ static void stmmac_enable_eee_mode(struct stmmac_priv *priv)
/* Check and enter in LPI mode */
if ((priv->dirty_tx == priv->cur_tx) &&
(priv->tx_path_in_lpi_mode == false))
- priv->hw->mac->set_eee_mode(priv->hw);
+ priv->hw->mac->set_eee_mode(priv->hw,
+ priv->plat->en_tx_lpi_clockgating);
}
/**
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 082cd48..6064fcc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -249,6 +249,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
plat->force_sf_dma_mode =
of_property_read_bool(np, "snps,force_sf_dma_mode");
+ plat->en_tx_lpi_clockgating =
+ of_property_read_bool(np, "snps,en-tx-lpi-clockgating");
+
/* Set the maxmtu to a default of JUMBO_LEN in case the
* parameter is not present in the device tree.
*/
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 266dab9..90fefde 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -143,5 +143,6 @@ struct plat_stmmacenet_data {
int has_gmac4;
bool tso_en;
int mac_port_sel_speed;
+ bool en_tx_lpi_clockgating;
};
#endif
--
2.9.3
^ permalink raw reply related
* [PATCH v2 0/3] adding new glue driver dwmac-dwc-qos-eth
From: Joao Pinto @ 2017-01-04 11:48 UTC (permalink / raw)
To: davem; +Cc: lars.persson, niklass, swarren, treding, netdev, Joao Pinto
This patch set contains the porting of the synopsys/dwc_eth_qos.c driver
to the stmmac structure. This operation resulted in the creation of a new
platform glue driver called dwmac-dwc-qos-eth which was based in the
dwc_eth_qos as is.
dwmac-dwc-qos-eth inherited dwc_eth_qos DT bindings, to assure that current
and old users can continue to use it as before. We can see this driver as
being deprecated, since all new development will be done in stmmac.
Please check each patch for implementation details.
Joao Pinto (3):
stmmac: adding DT parameter for LPI tx clock gating
stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform
structure
stmmac: adding new glue driver dwmac-dwc-qos-eth
.../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
Documentation/devicetree/bindings/net/stmmac.txt | 2 +
drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
drivers/net/ethernet/stmicro/stmmac/common.h | 3 +-
.../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 200 +++++++++++++++++++++
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 5 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 -
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 85 ++-------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 65 ++++++-
include/linux/stmmac.h | 6 +
14 files changed, 314 insertions(+), 81 deletions(-)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
--
2.9.3
^ permalink raw reply
* Re: [PATCH ipsec] xfrm: trivial typos
From: Steffen Klassert @ 2017-01-04 11:40 UTC (permalink / raw)
To: Alexander Alemayhu; +Cc: netdev
In-Reply-To: <20170103161320.1372-1-alexander@alemayhu.com>
On Tue, Jan 03, 2017 at 05:13:20PM +0100, Alexander Alemayhu wrote:
> o s/descentant/descendant
> o s/workarbound/workaround
>
> Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
Patch applied to ipsec-next, thanks!
^ permalink raw reply
* RE: [PATCH net-next v2 04/27] qlcnic: remove assumption that vlan_tci != 0
From: Chopra, Manish @ 2017-01-04 11:29 UTC (permalink / raw)
To: Michał Mirosław, netdev@vger.kernel.org
Cc: Patil, Harish, Dept-GE Linux NIC Dev
In-Reply-To: <7ccac9ab645244db2797490cad10a42979d78a32.1483475202.git.mirq-linux@rere.qmqm.pl>
> -----Original Message-----
> From: Michał Mirosław [mailto:mirq-linux@rere.qmqm.pl]
> Sent: Wednesday, January 04, 2017 2:23 AM
> To: netdev@vger.kernel.org
> Cc: Patil, Harish <Harish.Patil@cavium.com>; Chopra, Manish
> <Manish.Chopra@cavium.com>; Dept-GE Linux NIC Dev <Dept-
> GELinuxNICDev@cavium.com>
> Subject: [PATCH net-next v2 04/27] qlcnic: remove assumption that vlan_tci != 0
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> index fedd7366713c..c3cc707cc265 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> @@ -459,7 +459,7 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter,
> struct cmd_desc_type0 *first_desc, struct sk_buff *skb,
> struct qlcnic_host_tx_ring *tx_ring)
> {
> - u8 l4proto, opcode = 0, hdr_len = 0;
> + u8 l4proto, opcode = 0, hdr_len = 0, tag_vlan = 0;
> u16 flags = 0, vlan_tci = 0;
> int copied, offset, copy_len, size;
> struct cmd_desc_type0 *hwdesc;
> @@ -472,14 +472,16 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter
> *adapter,
> flags = QLCNIC_FLAGS_VLAN_TAGGED;
> vlan_tci = ntohs(vh->h_vlan_TCI);
> protocol = ntohs(vh->h_vlan_encapsulated_proto);
> + tag_vlan = 1;
> } else if (skb_vlan_tag_present(skb)) {
> flags = QLCNIC_FLAGS_VLAN_OOB;
> vlan_tci = skb_vlan_tag_get(skb);
> + tag_vlan = 1;
> }
> if (unlikely(adapter->tx_pvid)) {
> - if (vlan_tci && !(adapter->flags &
> QLCNIC_TAGGING_ENABLED))
> + if (tag_vlan && !(adapter->flags &
> QLCNIC_TAGGING_ENABLED))
> return -EIO;
> - if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED))
> + if (tag_vlan && (adapter->flags &
> QLCNIC_TAGGING_ENABLED))
> goto set_flags;
>
> flags = QLCNIC_FLAGS_VLAN_OOB;
> --
> 2.11.0
>
It's possible that earlier driver tx flow for zero vlan_tci is handled differently by the driver and hence hardware.
Doing this change would cause changing the driver TX flow for zero vlan_tci [specially setting the things in the TX descriptors would be changed now for zero vlan_tci].
Is it really necessary to change the driver behavior for such change until unless there is functional problem with the driver or hardware in handling zero vlan_tci ?
Thanks.
^ permalink raw reply
* Re: [PATCH 3/3] stmmac: adding new glue driver dwmac-dwc-qos-eth
From: Niklas Cassel @ 2017-01-04 11:24 UTC (permalink / raw)
To: Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <899bbfca-3596-c239-a1e7-baa3e057e8f0@synopsys.com>
On 01/04/2017 12:08 PM, Joao Pinto wrote:
> Hi Niklas,
>
> Às 10:59 AM de 1/4/2017, Niklas Cassel escreveu:
>> Hello Joao
>>
>> I just tested this series using the dwc_eth_qos DT bindings.
>> Good work!
>>
>> Unfortunately I get the following error:
>>
>> <3>[ 12.032463] dwc-eth-dwmac f8010000.ethernet eth0: stmmac_open: ERROR: allocating the WoL IRQ -1098801248 (-22)
>>
>>
>> This appears to be because of a corner case in stmmac_platform.c
>> where wol_irq can differ from the normal irq.
>>
>> Adding the following one liner fixes the problem:
>>
>>
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> @@ -125,6 +125,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
>> }
>> return stmmac_res.irq;
>> }
>> + stmmac_res.wol_irq = stmmac_res.irq;
>>
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>>
> Ok, I'll add this fix to the patch and give a check to the clks.
> I already sent a v1 patch set to net-dev, and I am now going to generate v2 so
> it would be great to have your tested.by tag to push it faster :) Thanks!
Send your V2, and I will test it, and reply with a Tested-by tag.
I can't reply with a Tested-by tag on V1, since it gives an
error during open.
If I reply with a Tested-by tag, on your V2, patchwork
https://patchwork.ozlabs.org/project/netdev/list/
will append it to the patch automatically.
Since Dave fetches patches from patchwork,
it will be there when it's time to be applied.
>
>>
>>
>> I have one comment about clocks interleaved as well
>>
>>
>>
>> On 01/04/2017 10:44 AM, Joao Pinto wrote:
>>> This patch adds a new glue driver called dwmac-dwc-qos-eth which
>>> was based in the dwc_eth_qos as is. To assure retro-compatibility a slight
>>> tweak was also added to stmmac_platform.
>>>
>>> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
>>> Reviewed-by: Lars Persson <larper@axis.com>
>>> ---
>>> .../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
>>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
>>> drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
>>> .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 199 +++++++++++++++++++++
>>> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 15 +-
>>> 5 files changed, 224 insertions(+), 3 deletions(-)
>>> create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>> index d93f71c..21d27aa 100644
>>> --- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>> +++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>>> @@ -1,5 +1,8 @@
>>> * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
>>>
>>> +This binding is deprecated, but it continues to be supported, but new
>>> +features should be preferably added to the stmmac binding document.
>>> +
>>> This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
>>> IP block. The IP supports multiple options for bus type, clocking and reset
>>> structure, and feature list. Consequently, a number of properties and list
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>> index ab66248..99594e3 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>>> @@ -29,6 +29,15 @@ config STMMAC_PLATFORM
>>>
>>> if STMMAC_PLATFORM
>>>
>>> +config DWMAC_DWC_QOS_ETH
>>> + tristate "Support for snps,dwc-qos-ethernet.txt DT binding."
>>> + select PHYLIB
>>> + select CRC32
>>> + select MII
>>> + depends on OF && HAS_DMA
>>> + help
>>> + Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
>>> +
>>> config DWMAC_GENERIC
>>> tristate "Generic driver for DWMAC"
>>> default STMMAC_PLATFORM
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> index 8f83a86..700c603 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> @@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
>>> obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
>>> obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
>>> obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
>>> +obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
>>> obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
>>> stmmac-platform-objs:= stmmac_platform.o
>>> dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>> new file mode 100644
>>> index 0000000..8a6ac06
>>> --- /dev/null
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>> @@ -0,0 +1,199 @@
>>> +/*
>>> + * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
>>> + *
>>> + * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2 as
>>> + * published by the Free Software Foundation.
>>> + *
>>> + * You should have received a copy of the GNU General Public License
>>> + * along with this program. If not, see <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_licenses_&d=DgIC-g&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=DrobFP08nu4hh6e05EgeOl1xD34OacyiZ-be_GG829Q&s=WLSkpBK06KCu-_kvN305yE6YncNYcDG_Bk0pgqSBG1o&e= >.
>>> + */
>>> +
>>> +#include <linux/clk.h>
>>> +#include <linux/clk-provider.h>
>>> +#include <linux/device.h>
>>> +#include <linux/ethtool.h>
>>> +#include <linux/io.h>
>>> +#include <linux/ioport.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of_net.h>
>>> +#include <linux/mfd/syscon.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/stmmac.h>
>>> +
>>> +#include "stmmac_platform.h"
>>> +
>>> +static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
>>> + struct plat_stmmacenet_data *plat_dat)
>>> +{
>>> + struct device_node *np = pdev->dev.of_node;
>>> + u32 burst_map = 0;
>>> + u32 bit_index = 0;
>>> + u32 a_index = 0;
>>> +
>>> + if (!plat_dat->axi) {
>>> + plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
>>> +
>>> + if (!plat_dat->axi)
>>> + return -ENOMEM;
>>> + }
>>> +
>>> + plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
>>> + if (of_property_read_u32(np, "snps,write-requests",
>>> + &plat_dat->axi->axi_wr_osr_lmt)) {
>>> + /**
>>> + * Since the register has a reset value of 1, if property
>>> + * is missing, default to 1.
>>> + */
>>> + plat_dat->axi->axi_wr_osr_lmt = 1;
>>> + } else {
>>> + /**
>>> + * If property exists, to keep the behavior from dwc_eth_qos,
>>> + * subtract one after parsing.
>>> + */
>>> + plat_dat->axi->axi_wr_osr_lmt--;
>>> + }
>>> +
>>> + if (of_property_read_u32(np, "read,read-requests",
>>> + &plat_dat->axi->axi_rd_osr_lmt)) {
>>> + /**
>>> + * Since the register has a reset value of 1, if property
>>> + * is missing, default to 1.
>>> + */
>>> + plat_dat->axi->axi_rd_osr_lmt = 1;
>>> + } else {
>>> + /**
>>> + * If property exists, to keep the behavior from dwc_eth_qos,
>>> + * subtract one after parsing.
>>> + */
>>> + plat_dat->axi->axi_rd_osr_lmt--;
>>> + }
>>> + of_property_read_u32(np, "snps,burst-map", &burst_map);
>>> +
>>> + /* converts burst-map bitmask to burst array */
>>> + for (bit_index = 0; bit_index < 7; bit_index++) {
>>> + if (burst_map & (1 << bit_index)) {
>>> + switch (bit_index) {
>>> + case 0:
>>> + plat_dat->axi->axi_blen[a_index] = 4; break;
>>> + case 1:
>>> + plat_dat->axi->axi_blen[a_index] = 8; break;
>>> + case 2:
>>> + plat_dat->axi->axi_blen[a_index] = 16; break;
>>> + case 3:
>>> + plat_dat->axi->axi_blen[a_index] = 32; break;
>>> + case 4:
>>> + plat_dat->axi->axi_blen[a_index] = 64; break;
>>> + case 5:
>>> + plat_dat->axi->axi_blen[a_index] = 128; break;
>>> + case 6:
>>> + plat_dat->axi->axi_blen[a_index] = 256; break;
>>> + default:
>>> + break;
>>> + }
>>> + a_index++;
>>> + }
>>> + }
>>> +
>>> + /* dwc-qos needs GMAC4, AAL, TSO and PMT */
>>> + plat_dat->has_gmac4 = 1;
>>> + plat_dat->dma_cfg->aal = 1;
>>> + plat_dat->tso_en = 1;
>>> + plat_dat->pmt = 1;
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static int dwc_eth_dwmac_probe(struct platform_device *pdev)
>>> +{
>>> + struct plat_stmmacenet_data *plat_dat;
>>> + struct stmmac_resources stmmac_res;
>>> + struct resource *res;
>>> + int ret;
>>> +
>>> + /**
>>> + * Since stmmac_platform supports name IRQ only, basic platform
>>> + * resource initialization is done in the glue logic.
>>> + */
>>> + stmmac_res.irq = platform_get_irq(pdev, 0);
>>> + if (stmmac_res.irq < 0) {
>>> + if (stmmac_res.irq != -EPROBE_DEFER) {
>>> + dev_err(&pdev->dev,
>>> + "IRQ configuration information not found\n");
>>> + }
>>> + return stmmac_res.irq;
>>> + }
>>> +
>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> + stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>>> + if (IS_ERR(stmmac_res.addr))
>>> + return PTR_ERR(stmmac_res.addr);
>>> +
>>> + plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
>>> + if (IS_ERR(plat_dat))
>>> + return PTR_ERR(plat_dat);
>>> +
>>> + plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>>> + if (IS_ERR(plat_dat->stmmac_clk)) {
>>> + dev_err(&pdev->dev, "apb_pclk clock not found.\n");
>> Error message does not match the devm_clk_get.
>>
>> Looking at synopsys/dwc_eth_qos.c
>> phy_ref_clk is just a dummy, used for verbosity.
>> apb_pclk is the clock which is actually used for setting csr etc.
>>
>> So it should be
>>
>> plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
>>
>>
>> So that way the warning is already correct :)
>>
>>
>>
>>> + ret = PTR_ERR(plat_dat->stmmac_clk);
>>> + plat_dat->stmmac_clk = NULL;
>>> + goto err_remove_config_dt;
>>> + }
>>> + clk_prepare_enable(plat_dat->stmmac_clk);
>>> +
>>> + plat_dat->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
>>> + if (IS_ERR(plat_dat->pclk)) {
>>> + dev_err(&pdev->dev, "phy_ref_clk clock not found.\n");
>> Error message does not match the devm_clk_get,
>> however, since this should be
>>
>> plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>>
>> the warning is correct :)
>>
>>> + ret = PTR_ERR(plat_dat->pclk);
>>> + plat_dat->pclk = NULL;
>>> + goto err_out_clk_dis_phy;
>>> + }
>>> + clk_prepare_enable(plat_dat->pclk);
>>> +
>>> + ret = dwc_eth_dwmac_config_dt(pdev, plat_dat);
>>> + if (ret)
>>> + goto err_out_clk_dis_aper;
>>> +
>>> + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
>>> + if (ret)
>>> + goto err_out_clk_dis_aper;
>>> +
>>> + return 0;
>>> +
>>> +err_out_clk_dis_aper:
>>> + clk_disable_unprepare(plat_dat->pclk);
>>> +err_out_clk_dis_phy:
>>> + clk_disable_unprepare(plat_dat->stmmac_clk);
>>> +err_remove_config_dt:
>>> + stmmac_remove_config_dt(pdev, plat_dat);
>>> +
>>> + return ret;
>>> +}
>>> +
>>> +static int dwc_eth_dwmac_remove(struct platform_device *pdev)
>>> +{
>>> + return stmmac_pltfr_remove(pdev);
>>> +}
>>> +
>>> +static const struct of_device_id dwc_eth_dwmac_match[] = {
>>> + { .compatible = "snps,dwc-qos-ethernet-4.10", },
>>> + { }
>>> +};
>>> +MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
>>> +
>>> +static struct platform_driver dwc_eth_dwmac_driver = {
>>> + .probe = dwc_eth_dwmac_probe,
>>> + .remove = dwc_eth_dwmac_remove,
>>> + .driver = {
>>> + .name = "dwc-eth-dwmac",
>>> + .of_match_table = dwc_eth_dwmac_match,
>>> + },
>>> +};
>>> +module_platform_driver(dwc_eth_dwmac_driver);
>>> +
>>> +MODULE_AUTHOR("Joao Pinto <jpinto@synopsys.com>");
>>> +MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");
>>> +MODULE_LICENSE("GPL v2");
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> index 4e44f9c..00c0f8d 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> @@ -181,10 +181,19 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>>> mdio = false;
>>> }
>>>
>>> - /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
>>> - for_each_child_of_node(np, plat->mdio_node) {
>>> - if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
>>> + /* exception for dwmac-dwc-qos-eth glue logic */
>>> + if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
>>> + plat->mdio_node = of_get_child_by_name(np, "mdio");
>>> + } else {
>>> + /**
>>> + * If snps,dwmac-mdio is passed from DT, always register
>>> + * the MDIO
>>> + */
>>> + for_each_child_of_node(np, plat->mdio_node) {
>>> + if (of_device_is_compatible(plat->mdio_node,
>>> + "snps,dwmac-mdio"))
>>> break;
>>> + }
>>> }
>>>
>>> if (plat->mdio_node) {
^ permalink raw reply
* [PATCH 2/2] dpaa_eth: Initialize CGR structure before init
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, davem, linux-kernel
In-Reply-To: <1483528890-8621-1-git-send-email-madalin.bucur@nxp.com>
From: Roy Pledge <roy.pledge@nxp.com>
The QBMan CGR options needs to be zeroed before calling the init
function
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 77517aa..c9b7ad6 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv)
priv->cgr_data.cgr.cb = dpaa_eth_cgscn;
/* Enable Congestion State Change Notifications and CS taildrop */
+ memset(&initcgr, 0, sizeof(initcgr));
initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES);
initcgr.cgr.cscn_en = QM_CGR_EN;
@@ -2422,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
}
/* Enable CS TD, but disable Congestion State Change Notifications. */
+ memset(&initcgr, 0, sizeof(initcgr));
initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES);
initcgr.cgr.cscn_en = QM_CGR_EN;
cs_th = DPAA_INGRESS_CS_THRESHOLD;
--
2.1.0
^ permalink raw reply related
* [PATCH 1/2] dpaa_eth: cleanup after init_phy() failure
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, davem, linux-kernel
In-Reply-To: <1483528890-8621-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 624ba90..77517aa 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2291,7 +2291,8 @@ static int dpaa_open(struct net_device *net_dev)
net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
if (!net_dev->phydev) {
netif_err(priv, ifup, net_dev, "init_phy() failed\n");
- return -ENODEV;
+ err = -ENODEV;
+ goto phy_init_failed;
}
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -2314,6 +2315,7 @@ static int dpaa_open(struct net_device *net_dev)
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++)
fman_port_disable(mac_dev->port[i]);
+phy_init_failed:
dpaa_eth_napi_disable(priv);
return err;
--
2.1.0
^ permalink raw reply related
* [PATCH 0/2] dpaa_eth: a couple of fixes
From: Madalin Bucur @ 2017-01-04 11:21 UTC (permalink / raw)
To: netdev; +Cc: davem, linuxppc-dev, linux-kernel
Add cleanup on PHY initialization failure path, avoid using
uninitialized memory at CGR init.
Madalin Bucur (1):
dpaa_eth: cleanup after init_phy() failure
Roy Pledge (1):
dpaa_eth: Initialize CGR structure before init
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--
2.1.0
^ permalink raw reply
* [PATCH iproute2/net-next] tc: flower: Update dest UDP port documentation
From: Simon Horman @ 2017-01-04 11:02 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, Dinan Gunawardena, Hadar Hen Zion, Simon Horman
Since 41aa17ff4668 ("tc/cls_flower: Add dest UDP port to tunnel params")
tc flower supports setting the dest UDP port.
* Use "port_number" to be consistent with other man-page text
* Re-add "enc_dst_port" documentation to manpage which was
accidently removed by b2a1f740aa4d ("tc: flower: document that *_ip
parameters take a PREFIX as an argument.")
Cc: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
man/man8/tc-flower.8 | 4 +++-
tc/f_flower.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8
index 33104963696c..5904a9ecafdf 100644
--- a/man/man8/tc-flower.8
+++ b/man/man8/tc-flower.8
@@ -40,7 +40,7 @@ flower \- flow based traffic control filter
.BR enc_dst_ip " | " enc_src_ip " } { "
.IR ipv4_address " | " ipv6_address " } | "
.B enc_dst_port
-.IR UDP-PORT " | "
+.IR port_number
.SH DESCRIPTION
The
.B flower
@@ -136,6 +136,8 @@ which have to be specified in beforehand.
.BI enc_dst_ip " PREFIX"
.TQ
.BI enc_src_ip " PREFIX"
+.TQ
+.BI enc_dst_port " NUMBER"
Match on IP tunnel metadata. Key id
.I NUMBER
is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel).
diff --git a/tc/f_flower.c b/tc/f_flower.c
index ba8b756b8a9e..99f5f8163ee0 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -58,7 +58,7 @@ static void explain(void)
" enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n"
" enc_key_id [ KEY-ID ] |\n"
" matching_flags MATCHING-FLAGS | \n"
- " enc_dst_port [ UDP-PORT ] }\n"
+ " enc_dst_port [ port_number ] }\n"
" FILTERID := X:Y:Z\n"
" MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n"
" ACTION-SPEC := ... look at individual actions\n"
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related
* Re: [PATCH 3/3] stmmac: adding new glue driver dwmac-dwc-qos-eth
From: Joao Pinto @ 2017-01-04 11:08 UTC (permalink / raw)
To: Niklas Cassel, Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <9bd69052-c5bb-731c-c01e-de42d1968718@axis.com>
Hi Niklas,
Às 10:59 AM de 1/4/2017, Niklas Cassel escreveu:
> Hello Joao
>
> I just tested this series using the dwc_eth_qos DT bindings.
> Good work!
>
> Unfortunately I get the following error:
>
> <3>[ 12.032463] dwc-eth-dwmac f8010000.ethernet eth0: stmmac_open: ERROR: allocating the WoL IRQ -1098801248 (-22)
>
>
> This appears to be because of a corner case in stmmac_platform.c
> where wol_irq can differ from the normal irq.
>
> Adding the following one liner fixes the problem:
>
>
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> @@ -125,6 +125,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
> }
> return stmmac_res.irq;
> }
> + stmmac_res.wol_irq = stmmac_res.irq;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>
Ok, I'll add this fix to the patch and give a check to the clks.
I already sent a v1 patch set to net-dev, and I am now going to generate v2 so
it would be great to have your tested.by tag to push it faster :) Thanks!
>
>
>
> I have one comment about clocks interleaved as well
>
>
>
> On 01/04/2017 10:44 AM, Joao Pinto wrote:
>> This patch adds a new glue driver called dwmac-dwc-qos-eth which
>> was based in the dwc_eth_qos as is. To assure retro-compatibility a slight
>> tweak was also added to stmmac_platform.
>>
>> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
>> Reviewed-by: Lars Persson <larper@axis.com>
>> ---
>> .../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
>> drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
>> .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 199 +++++++++++++++++++++
>> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 15 +-
>> 5 files changed, 224 insertions(+), 3 deletions(-)
>> create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>
>> diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>> index d93f71c..21d27aa 100644
>> --- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>> +++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
>> @@ -1,5 +1,8 @@
>> * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
>>
>> +This binding is deprecated, but it continues to be supported, but new
>> +features should be preferably added to the stmmac binding document.
>> +
>> This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
>> IP block. The IP supports multiple options for bus type, clocking and reset
>> structure, and feature list. Consequently, a number of properties and list
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>> index ab66248..99594e3 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
>> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
>> @@ -29,6 +29,15 @@ config STMMAC_PLATFORM
>>
>> if STMMAC_PLATFORM
>>
>> +config DWMAC_DWC_QOS_ETH
>> + tristate "Support for snps,dwc-qos-ethernet.txt DT binding."
>> + select PHYLIB
>> + select CRC32
>> + select MII
>> + depends on OF && HAS_DMA
>> + help
>> + Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
>> +
>> config DWMAC_GENERIC
>> tristate "Generic driver for DWMAC"
>> default STMMAC_PLATFORM
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
>> index 8f83a86..700c603 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
>> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
>> @@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
>> obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
>> obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
>> obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
>> +obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
>> obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
>> stmmac-platform-objs:= stmmac_platform.o
>> dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> new file mode 100644
>> index 0000000..8a6ac06
>> --- /dev/null
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> @@ -0,0 +1,199 @@
>> +/*
>> + * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
>> + *
>> + * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program. If not, see <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_licenses_&d=DgIC-g&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=DrobFP08nu4hh6e05EgeOl1xD34OacyiZ-be_GG829Q&s=WLSkpBK06KCu-_kvN305yE6YncNYcDG_Bk0pgqSBG1o&e= >.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/device.h>
>> +#include <linux/ethtool.h>
>> +#include <linux/io.h>
>> +#include <linux/ioport.h>
>> +#include <linux/module.h>
>> +#include <linux/of_net.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/stmmac.h>
>> +
>> +#include "stmmac_platform.h"
>> +
>> +static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
>> + struct plat_stmmacenet_data *plat_dat)
>> +{
>> + struct device_node *np = pdev->dev.of_node;
>> + u32 burst_map = 0;
>> + u32 bit_index = 0;
>> + u32 a_index = 0;
>> +
>> + if (!plat_dat->axi) {
>> + plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
>> +
>> + if (!plat_dat->axi)
>> + return -ENOMEM;
>> + }
>> +
>> + plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
>> + if (of_property_read_u32(np, "snps,write-requests",
>> + &plat_dat->axi->axi_wr_osr_lmt)) {
>> + /**
>> + * Since the register has a reset value of 1, if property
>> + * is missing, default to 1.
>> + */
>> + plat_dat->axi->axi_wr_osr_lmt = 1;
>> + } else {
>> + /**
>> + * If property exists, to keep the behavior from dwc_eth_qos,
>> + * subtract one after parsing.
>> + */
>> + plat_dat->axi->axi_wr_osr_lmt--;
>> + }
>> +
>> + if (of_property_read_u32(np, "read,read-requests",
>> + &plat_dat->axi->axi_rd_osr_lmt)) {
>> + /**
>> + * Since the register has a reset value of 1, if property
>> + * is missing, default to 1.
>> + */
>> + plat_dat->axi->axi_rd_osr_lmt = 1;
>> + } else {
>> + /**
>> + * If property exists, to keep the behavior from dwc_eth_qos,
>> + * subtract one after parsing.
>> + */
>> + plat_dat->axi->axi_rd_osr_lmt--;
>> + }
>> + of_property_read_u32(np, "snps,burst-map", &burst_map);
>> +
>> + /* converts burst-map bitmask to burst array */
>> + for (bit_index = 0; bit_index < 7; bit_index++) {
>> + if (burst_map & (1 << bit_index)) {
>> + switch (bit_index) {
>> + case 0:
>> + plat_dat->axi->axi_blen[a_index] = 4; break;
>> + case 1:
>> + plat_dat->axi->axi_blen[a_index] = 8; break;
>> + case 2:
>> + plat_dat->axi->axi_blen[a_index] = 16; break;
>> + case 3:
>> + plat_dat->axi->axi_blen[a_index] = 32; break;
>> + case 4:
>> + plat_dat->axi->axi_blen[a_index] = 64; break;
>> + case 5:
>> + plat_dat->axi->axi_blen[a_index] = 128; break;
>> + case 6:
>> + plat_dat->axi->axi_blen[a_index] = 256; break;
>> + default:
>> + break;
>> + }
>> + a_index++;
>> + }
>> + }
>> +
>> + /* dwc-qos needs GMAC4, AAL, TSO and PMT */
>> + plat_dat->has_gmac4 = 1;
>> + plat_dat->dma_cfg->aal = 1;
>> + plat_dat->tso_en = 1;
>> + plat_dat->pmt = 1;
>> +
>> + return 0;
>> +}
>> +
>> +static int dwc_eth_dwmac_probe(struct platform_device *pdev)
>> +{
>> + struct plat_stmmacenet_data *plat_dat;
>> + struct stmmac_resources stmmac_res;
>> + struct resource *res;
>> + int ret;
>> +
>> + /**
>> + * Since stmmac_platform supports name IRQ only, basic platform
>> + * resource initialization is done in the glue logic.
>> + */
>> + stmmac_res.irq = platform_get_irq(pdev, 0);
>> + if (stmmac_res.irq < 0) {
>> + if (stmmac_res.irq != -EPROBE_DEFER) {
>> + dev_err(&pdev->dev,
>> + "IRQ configuration information not found\n");
>> + }
>> + return stmmac_res.irq;
>> + }
>> +
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR(stmmac_res.addr))
>> + return PTR_ERR(stmmac_res.addr);
>> +
>> + plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
>> + if (IS_ERR(plat_dat))
>> + return PTR_ERR(plat_dat);
>> +
>> + plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>> + if (IS_ERR(plat_dat->stmmac_clk)) {
>> + dev_err(&pdev->dev, "apb_pclk clock not found.\n");
>
> Error message does not match the devm_clk_get.
>
> Looking at synopsys/dwc_eth_qos.c
> phy_ref_clk is just a dummy, used for verbosity.
> apb_pclk is the clock which is actually used for setting csr etc.
>
> So it should be
>
> plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
>
>
> So that way the warning is already correct :)
>
>
>
>> + ret = PTR_ERR(plat_dat->stmmac_clk);
>> + plat_dat->stmmac_clk = NULL;
>> + goto err_remove_config_dt;
>> + }
>> + clk_prepare_enable(plat_dat->stmmac_clk);
>> +
>> + plat_dat->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
>> + if (IS_ERR(plat_dat->pclk)) {
>> + dev_err(&pdev->dev, "phy_ref_clk clock not found.\n");
>
> Error message does not match the devm_clk_get,
> however, since this should be
>
> plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
>
> the warning is correct :)
>
>> + ret = PTR_ERR(plat_dat->pclk);
>> + plat_dat->pclk = NULL;
>> + goto err_out_clk_dis_phy;
>> + }
>> + clk_prepare_enable(plat_dat->pclk);
>> +
>> + ret = dwc_eth_dwmac_config_dt(pdev, plat_dat);
>> + if (ret)
>> + goto err_out_clk_dis_aper;
>> +
>> + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
>> + if (ret)
>> + goto err_out_clk_dis_aper;
>> +
>> + return 0;
>> +
>> +err_out_clk_dis_aper:
>> + clk_disable_unprepare(plat_dat->pclk);
>> +err_out_clk_dis_phy:
>> + clk_disable_unprepare(plat_dat->stmmac_clk);
>> +err_remove_config_dt:
>> + stmmac_remove_config_dt(pdev, plat_dat);
>> +
>> + return ret;
>> +}
>> +
>> +static int dwc_eth_dwmac_remove(struct platform_device *pdev)
>> +{
>> + return stmmac_pltfr_remove(pdev);
>> +}
>> +
>> +static const struct of_device_id dwc_eth_dwmac_match[] = {
>> + { .compatible = "snps,dwc-qos-ethernet-4.10", },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
>> +
>> +static struct platform_driver dwc_eth_dwmac_driver = {
>> + .probe = dwc_eth_dwmac_probe,
>> + .remove = dwc_eth_dwmac_remove,
>> + .driver = {
>> + .name = "dwc-eth-dwmac",
>> + .of_match_table = dwc_eth_dwmac_match,
>> + },
>> +};
>> +module_platform_driver(dwc_eth_dwmac_driver);
>> +
>> +MODULE_AUTHOR("Joao Pinto <jpinto@synopsys.com>");
>> +MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");
>> +MODULE_LICENSE("GPL v2");
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> index 4e44f9c..00c0f8d 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -181,10 +181,19 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>> mdio = false;
>> }
>>
>> - /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
>> - for_each_child_of_node(np, plat->mdio_node) {
>> - if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
>> + /* exception for dwmac-dwc-qos-eth glue logic */
>> + if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
>> + plat->mdio_node = of_get_child_by_name(np, "mdio");
>> + } else {
>> + /**
>> + * If snps,dwmac-mdio is passed from DT, always register
>> + * the MDIO
>> + */
>> + for_each_child_of_node(np, plat->mdio_node) {
>> + if (of_device_is_compatible(plat->mdio_node,
>> + "snps,dwmac-mdio"))
>> break;
>> + }
>> }
>>
>> if (plat->mdio_node) {
>
^ permalink raw reply
* Re: [patch net-next v2 5/8] Introduce sample tc action
From: Simon Horman @ 2017-01-04 11:04 UTC (permalink / raw)
To: Yotam Gigi
Cc: Roopa Prabhu, Jiri Pirko, netdev@vger.kernel.org,
davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, jhs@mojatatu.com, geert+renesas@glider.be,
stephen@networkplumber.org, xiyou.wangcong@gmail.com,
linux@roeck-us.net, john.fastabend@gmail.com
In-Reply-To: <DB3PR05MB0764CDAD9E240CCD3438EE8BAC610@DB3PR05MB0764.eurprd05.prod.outlook.com>
On Wed, Jan 04, 2017 at 11:01:46AM +0000, Yotam Gigi wrote:
> >-----Original Message-----
> >From: Simon Horman [mailto:simon.horman@netronome.com]
> >Sent: Wednesday, January 04, 2017 12:43 PM
> >To: Yotam Gigi <yotamg@mellanox.com>
> >Cc: Roopa Prabhu <roopa@cumulusnetworks.com>; Jiri Pirko <jiri@resnulli.us>;
> >netdev@vger.kernel.org; davem@davemloft.net; Ido Schimmel
> ><idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
> ><nogahf@mellanox.com>; Or Gerlitz <orlitz@mellanox.com>;
> >jhs@mojatatu.com; geert+renesas@glider.be; stephen@networkplumber.org;
> >xiyou.wangcong@gmail.com; linux@roeck-us.net; john.fastabend@gmail.com
> >Subject: Re: [patch net-next v2 5/8] Introduce sample tc action
> >
> >On Wed, Nov 16, 2016 at 04:26:44PM +0000, Yotam Gigi wrote:
> >> >-----Original Message-----
> >> >From: Roopa Prabhu [mailto:roopa@cumulusnetworks.com]
> >> >Sent: Wednesday, November 16, 2016 6:15 PM
> >> >To: Jiri Pirko <jiri@resnulli.us>
> >> >Cc: netdev@vger.kernel.org; davem@davemloft.net; Yotam Gigi
> >> ><yotamg@mellanox.com>; Ido Schimmel <idosch@mellanox.com>; Elad Raz
> >> ><eladr@mellanox.com>; Nogah Frankel <nogahf@mellanox.com>; Or Gerlitz
> >> ><ogerlitz@mellanox.com>; jhs@mojatatu.com; geert+renesas@glider.be;
> >> >stephen@networkplumber.org; xiyou.wangcong@gmail.com; linux@roeck-
> >us.net;
> >> >john.fastabend@gmail.com; simon.horman@netronome.com
> >> >Subject: Re: [patch net-next v2 5/8] Introduce sample tc action
> >> >
> >> >On 11/14/16, 7:00 AM, Jiri Pirko wrote:
> >> >> From: Yotam Gigi <yotamg@mellanox.com>
> >> >>
> >> >> This action allow the user to sample traffic matched by tc classifier.
> >> >> The sampling consists of choosing packets randomly, truncating them,
> >> >> adding some informative metadata regarding the interface and the original
> >> >> packet size and mark them with specific mark, to allow further tc rules to
> >> >> match and process. The marked sample packets are then injected into the
> >> >> device ingress qdisc using netif_receive_skb.
> >> >>
> >> >> The packets metadata is packed using the ife encapsulation protocol, and
> >> >> the outer packet's ethernet dest, source and eth_type, along with the
> >> >> rate, mark and the optional truncation size can be configured from
> >> >> userspace.
> >> >>
> >> >> Example:
> >> >> To sample ingress traffic from interface eth1, and redirect the sampled
> >> >> the sampled packets to interface dummy0, one may use the commands:
> >> >>
> >> >> tc qdisc add dev eth1 handle ffff: ingress
> >> >>
> >> >> tc filter add dev eth1 parent ffff: \
> >> >> matchall action sample rate 12 mark 17
> >> >
> >> >Yotham, I am guessing in the future if one does not want to use mark,
> >> >the sample api is extensible to allow for other actions to be added.
> >> >This is from the general concern we had on using mark: some may not want to
> >use
> >> >mark.
> >> >As long as the api is extensible to allow an alternate way in the future,
> >> > we should be good. (We would prefer to not go down the path of having to
> >> >introduce
> >> >a new 'action sample' if this limits us in some way).
> >>
> >> The code is extensible - if one does want to add another action to sample, he
> >> totally can :)
> >>
> >> By the way, one of the reasons we removed the patches for now is that we
> >> consider adding mirroring functionality to it instead of heaving two tc-rules.
> >
> >Hi Yotham,
> >
> >I see that this action combines several discrete sub-actions, some of which
> >duplicate functionality present in existing actions:
> >
> >* sample
> >* truncate
> >* IFE encapsulation with metadata
> >* mark
> >* output (proposed)
> >
> >I wonder if it would make sense to provided a mechanism whereby sampled
> >packets can be passed on to other actions. Something similar to the
> >existing pipe mechanism but allowing for the sampled and the original packets
> >to continue to be processed separately.
> >
> >If so, it may be worth white-listing actions for which sampled packets are
> >known to work well to limit the scope for unforseen side effects.
>
> Hi Simon,
>
> The patches were removed and we intend to propose a different implementation for
> that, using a dedicated sampling netlink channel, thus removing the need to
> mark, mirror and IFE-pack the packets.
>
> We intend to send in the next few weeks, so I guess you can comment on the new
> version.
Hi Yotham,
thanks, I look forward to seeing the new approach.
^ permalink raw reply
* RE: [patch net-next v2 5/8] Introduce sample tc action
From: Yotam Gigi @ 2017-01-04 11:01 UTC (permalink / raw)
To: Simon Horman
Cc: Roopa Prabhu, Jiri Pirko, netdev@vger.kernel.org,
davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, jhs@mojatatu.com, geert+renesas@glider.be,
stephen@networkplumber.org, xiyou.wangcong@gmail.com,
linux@roeck-us.net, john.fastabend@gmail.com
In-Reply-To: <20170104104251.GB30008@penelope.horms.nl>
>-----Original Message-----
>From: Simon Horman [mailto:simon.horman@netronome.com]
>Sent: Wednesday, January 04, 2017 12:43 PM
>To: Yotam Gigi <yotamg@mellanox.com>
>Cc: Roopa Prabhu <roopa@cumulusnetworks.com>; Jiri Pirko <jiri@resnulli.us>;
>netdev@vger.kernel.org; davem@davemloft.net; Ido Schimmel
><idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
><nogahf@mellanox.com>; Or Gerlitz <orlitz@mellanox.com>;
>jhs@mojatatu.com; geert+renesas@glider.be; stephen@networkplumber.org;
>xiyou.wangcong@gmail.com; linux@roeck-us.net; john.fastabend@gmail.com
>Subject: Re: [patch net-next v2 5/8] Introduce sample tc action
>
>On Wed, Nov 16, 2016 at 04:26:44PM +0000, Yotam Gigi wrote:
>> >-----Original Message-----
>> >From: Roopa Prabhu [mailto:roopa@cumulusnetworks.com]
>> >Sent: Wednesday, November 16, 2016 6:15 PM
>> >To: Jiri Pirko <jiri@resnulli.us>
>> >Cc: netdev@vger.kernel.org; davem@davemloft.net; Yotam Gigi
>> ><yotamg@mellanox.com>; Ido Schimmel <idosch@mellanox.com>; Elad Raz
>> ><eladr@mellanox.com>; Nogah Frankel <nogahf@mellanox.com>; Or Gerlitz
>> ><ogerlitz@mellanox.com>; jhs@mojatatu.com; geert+renesas@glider.be;
>> >stephen@networkplumber.org; xiyou.wangcong@gmail.com; linux@roeck-
>us.net;
>> >john.fastabend@gmail.com; simon.horman@netronome.com
>> >Subject: Re: [patch net-next v2 5/8] Introduce sample tc action
>> >
>> >On 11/14/16, 7:00 AM, Jiri Pirko wrote:
>> >> From: Yotam Gigi <yotamg@mellanox.com>
>> >>
>> >> This action allow the user to sample traffic matched by tc classifier.
>> >> The sampling consists of choosing packets randomly, truncating them,
>> >> adding some informative metadata regarding the interface and the original
>> >> packet size and mark them with specific mark, to allow further tc rules to
>> >> match and process. The marked sample packets are then injected into the
>> >> device ingress qdisc using netif_receive_skb.
>> >>
>> >> The packets metadata is packed using the ife encapsulation protocol, and
>> >> the outer packet's ethernet dest, source and eth_type, along with the
>> >> rate, mark and the optional truncation size can be configured from
>> >> userspace.
>> >>
>> >> Example:
>> >> To sample ingress traffic from interface eth1, and redirect the sampled
>> >> the sampled packets to interface dummy0, one may use the commands:
>> >>
>> >> tc qdisc add dev eth1 handle ffff: ingress
>> >>
>> >> tc filter add dev eth1 parent ffff: \
>> >> matchall action sample rate 12 mark 17
>> >
>> >Yotham, I am guessing in the future if one does not want to use mark,
>> >the sample api is extensible to allow for other actions to be added.
>> >This is from the general concern we had on using mark: some may not want to
>use
>> >mark.
>> >As long as the api is extensible to allow an alternate way in the future,
>> > we should be good. (We would prefer to not go down the path of having to
>> >introduce
>> >a new 'action sample' if this limits us in some way).
>>
>> The code is extensible - if one does want to add another action to sample, he
>> totally can :)
>>
>> By the way, one of the reasons we removed the patches for now is that we
>> consider adding mirroring functionality to it instead of heaving two tc-rules.
>
>Hi Yotham,
>
>I see that this action combines several discrete sub-actions, some of which
>duplicate functionality present in existing actions:
>
>* sample
>* truncate
>* IFE encapsulation with metadata
>* mark
>* output (proposed)
>
>I wonder if it would make sense to provided a mechanism whereby sampled
>packets can be passed on to other actions. Something similar to the
>existing pipe mechanism but allowing for the sampled and the original packets
>to continue to be processed separately.
>
>If so, it may be worth white-listing actions for which sampled packets are
>known to work well to limit the scope for unforseen side effects.
Hi Simon,
The patches were removed and we intend to propose a different implementation for
that, using a dedicated sampling netlink channel, thus removing the need to
mark, mirror and IFE-pack the packets.
We intend to send in the next few weeks, so I guess you can comment on the new
version.
Thanks!
^ permalink raw reply
* Re: [RFC PATCH 2/4] page_pool: basic implementation of page_pool
From: Jesper Dangaard Brouer @ 2017-01-04 11:00 UTC (permalink / raw)
To: Vlastimil Babka
Cc: linux-mm, Alexander Duyck, willemdebruijn.kernel, netdev,
john.fastabend, Saeed Mahameed, bjorn.topel, Alexei Starovoitov,
Tariq Toukan, brouer, Mel Gorman
In-Reply-To: <52478d40-8c34-4354-c9d8-286020eb26a6@suse.cz>
On Tue, 3 Jan 2017 17:07:49 +0100 Vlastimil Babka <vbabka@suse.cz> wrote:
> On 12/20/2016 02:28 PM, Jesper Dangaard Brouer wrote:
> > The focus in this patch is getting the API around page_pool figured out.
> >
> > The internal data structures for returning page_pool pages is not optimal.
> > This implementation use ptr_ring for recycling, which is known not to scale
> > in case of multiple remote CPUs releasing/returning pages.
>
> Just few very quick impressions...
>
> > A bulking interface into the page allocator is also left for later. (This
> > requires cooperation will Mel Gorman, who just send me some PoC patches for this).
> > ---
[...]
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index 4424784ac374..11b4d8fb280b 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
[...]
> > @@ -765,6 +766,11 @@ static inline void put_page(struct page *page)
> > {
> > page = compound_head(page);
> >
> > + if (PagePool(page)) {
> > + page_pool_put_page(page);
> > + return;
> > + }
>
> Can't say I'm thrilled about a new page flag and a test in put_page().
In patch 4/4, I'm scaling this back. Avoiding to modify the inlined
put_page(), by letting refcnt reach zero and catching pages belonging to
a page_pool in __free_pages_ok() and free_hot_cold_page(). (Result
in being more dependent on page-refcnt and loosing some performance).
Still needing a new page flag, or some other method of identifying when
a page belongs to a page_pool.
> I don't know the full life cycle here, but isn't it that these pages
> will be specifically allocated and used in page pool aware drivers,
> so maybe they can be also specifically freed there without hooking to
> the generic page refcount mechanism?
Drivers are already manipulating refcnt, to "splitup" the page (to
save memory) for storing more RX frames per page. Which is something
the page_pool still need to support. (XDP can request one page per
packet and gain the direct recycle optimization and instead waste mem).
Notice, a page_pool aware driver doesn't handle the "free-side". Free
happens when the packet/page is being consumed, spliced or transmitted
out another non-page_pool-aware NIC driver. An interresting case is
packet-page waiting for DMA TX completion (on another NIC), thus need
to async-store info on page_pool and DMA-addr.
Could extend the SKB (with a page_pool pointer)... BUT it defeats the
purpose of avoiding to allocate the SKB. E.g. in the cases where XDP
takes the route-decision and transmit/forward the "raw"-page (out
another NIC or into a "raw" socket), then we don't have a meta-data
structure to store this info in. Thus, this info is stored in struct
page.
More arguing why a tight MM integration is prefered here[1]
[1] http://prototype-kernel.readthedocs.io/en/latest/vm/page_pool/design/design.html#memory-model
besides in makes it easier to convert drivers to use a page_pool.
> > +
> > if (put_page_testzero(page))
> > __put_page(page);
> >
> > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > index 08d947fc4c59..c74dea967f99 100644
> > --- a/include/linux/mm_types.h
> > +++ b/include/linux/mm_types.h
> > @@ -47,6 +47,12 @@ struct page {
> > unsigned long flags; /* Atomic flags, some possibly
> > * updated asynchronously */
> > union {
> > + /* DISCUSS: Considered moving page_pool pointer here,
> > + * but I'm unsure if 'mapping' is needed for userspace
> > + * mapping the page, as this is a use-case the
> > + * page_pool need to support in the future. (Basically
> > + * mapping a NIC RX ring into userspace).
>
> I think so, but might be wrong here. In any case mapping usually goes with
> index, and you put dma_addr in union with index below...
Good point, thanks.
> > + */
> > struct address_space *mapping; /* If low bit clear, points to
> > * inode address_space, or NULL.
> > * If page mapped as anonymous
> > @@ -63,6 +69,7 @@ struct page {
> > union {
> > pgoff_t index; /* Our offset within mapping. */
> > void *freelist; /* sl[aou]b first free object */
> > + dma_addr_t dma_addr; /* used by page_pool */
> > /* page_deferred_list().prev -- second tail page */
> > };
> >
> > @@ -117,6 +124,8 @@ struct page {
> > * avoid collision and false-positive PageTail().
> > */
> > union {
> > + /* XXX: Idea reuse lru list, in page_pool to align with PCP */
> > +
> > struct list_head lru; /* Pageout list, eg. active_list
> > * protected by zone_lru_lock !
> > * Can be used as a generic list
Guess, I can move it here, as the page cannot be on the LRU-list, while
being used (or VMA mapped). Right?
> > @@ -189,6 +198,8 @@ struct page {
> > #endif
> > #endif
> > struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
> > + /* XXX: Sure page_pool will have no users of "private"? */
> > + struct page_pool *pool;
> > };
> >
> > #ifdef CONFIG_MEMCG
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH 3/3] stmmac: adding new glue driver dwmac-dwc-qos-eth
From: Niklas Cassel @ 2017-01-04 10:59 UTC (permalink / raw)
To: Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <b8d09f96a128107ac64f65d1d27b7693e7ddbb3e.1483372523.git.jpinto@synopsys.com>
Hello Joao
I just tested this series using the dwc_eth_qos DT bindings.
Good work!
Unfortunately I get the following error:
<3>[ 12.032463] dwc-eth-dwmac f8010000.ethernet eth0: stmmac_open: ERROR: allocating the WoL IRQ -1098801248 (-22)
This appears to be because of a corner case in stmmac_platform.c
where wol_irq can differ from the normal irq.
Adding the following one liner fixes the problem:
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -125,6 +125,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
}
return stmmac_res.irq;
}
+ stmmac_res.wol_irq = stmmac_res.irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
I have one comment about clocks interleaved as well
On 01/04/2017 10:44 AM, Joao Pinto wrote:
> This patch adds a new glue driver called dwmac-dwc-qos-eth which
> was based in the dwc_eth_qos as is. To assure retro-compatibility a slight
> tweak was also added to stmmac_platform.
>
> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
> Reviewed-by: Lars Persson <larper@axis.com>
> ---
> .../bindings/net/snps,dwc-qos-ethernet.txt | 3 +
> drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
> drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
> .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 199 +++++++++++++++++++++
> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 15 +-
> 5 files changed, 224 insertions(+), 3 deletions(-)
> create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
> index d93f71c..21d27aa 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
> +++ b/Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
> @@ -1,5 +1,8 @@
> * Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
>
> +This binding is deprecated, but it continues to be supported, but new
> +features should be preferably added to the stmmac binding document.
> +
> This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
> IP block. The IP supports multiple options for bus type, clocking and reset
> structure, and feature list. Consequently, a number of properties and list
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index ab66248..99594e3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -29,6 +29,15 @@ config STMMAC_PLATFORM
>
> if STMMAC_PLATFORM
>
> +config DWMAC_DWC_QOS_ETH
> + tristate "Support for snps,dwc-qos-ethernet.txt DT binding."
> + select PHYLIB
> + select CRC32
> + select MII
> + depends on OF && HAS_DMA
> + help
> + Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
> +
> config DWMAC_GENERIC
> tristate "Generic driver for DWMAC"
> default STMMAC_PLATFORM
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
> index 8f83a86..700c603 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
> obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
> obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
> obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
> +obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
> obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
> stmmac-platform-objs:= stmmac_platform.o
> dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> new file mode 100644
> index 0000000..8a6ac06
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> @@ -0,0 +1,199 @@
> +/*
> + * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
> + *
> + * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/clk-provider.h>
> +#include <linux/device.h>
> +#include <linux/ethtool.h>
> +#include <linux/io.h>
> +#include <linux/ioport.h>
> +#include <linux/module.h>
> +#include <linux/of_net.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/platform_device.h>
> +#include <linux/stmmac.h>
> +
> +#include "stmmac_platform.h"
> +
> +static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
> + struct plat_stmmacenet_data *plat_dat)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + u32 burst_map = 0;
> + u32 bit_index = 0;
> + u32 a_index = 0;
> +
> + if (!plat_dat->axi) {
> + plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
> +
> + if (!plat_dat->axi)
> + return -ENOMEM;
> + }
> +
> + plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
> + if (of_property_read_u32(np, "snps,write-requests",
> + &plat_dat->axi->axi_wr_osr_lmt)) {
> + /**
> + * Since the register has a reset value of 1, if property
> + * is missing, default to 1.
> + */
> + plat_dat->axi->axi_wr_osr_lmt = 1;
> + } else {
> + /**
> + * If property exists, to keep the behavior from dwc_eth_qos,
> + * subtract one after parsing.
> + */
> + plat_dat->axi->axi_wr_osr_lmt--;
> + }
> +
> + if (of_property_read_u32(np, "read,read-requests",
> + &plat_dat->axi->axi_rd_osr_lmt)) {
> + /**
> + * Since the register has a reset value of 1, if property
> + * is missing, default to 1.
> + */
> + plat_dat->axi->axi_rd_osr_lmt = 1;
> + } else {
> + /**
> + * If property exists, to keep the behavior from dwc_eth_qos,
> + * subtract one after parsing.
> + */
> + plat_dat->axi->axi_rd_osr_lmt--;
> + }
> + of_property_read_u32(np, "snps,burst-map", &burst_map);
> +
> + /* converts burst-map bitmask to burst array */
> + for (bit_index = 0; bit_index < 7; bit_index++) {
> + if (burst_map & (1 << bit_index)) {
> + switch (bit_index) {
> + case 0:
> + plat_dat->axi->axi_blen[a_index] = 4; break;
> + case 1:
> + plat_dat->axi->axi_blen[a_index] = 8; break;
> + case 2:
> + plat_dat->axi->axi_blen[a_index] = 16; break;
> + case 3:
> + plat_dat->axi->axi_blen[a_index] = 32; break;
> + case 4:
> + plat_dat->axi->axi_blen[a_index] = 64; break;
> + case 5:
> + plat_dat->axi->axi_blen[a_index] = 128; break;
> + case 6:
> + plat_dat->axi->axi_blen[a_index] = 256; break;
> + default:
> + break;
> + }
> + a_index++;
> + }
> + }
> +
> + /* dwc-qos needs GMAC4, AAL, TSO and PMT */
> + plat_dat->has_gmac4 = 1;
> + plat_dat->dma_cfg->aal = 1;
> + plat_dat->tso_en = 1;
> + plat_dat->pmt = 1;
> +
> + return 0;
> +}
> +
> +static int dwc_eth_dwmac_probe(struct platform_device *pdev)
> +{
> + struct plat_stmmacenet_data *plat_dat;
> + struct stmmac_resources stmmac_res;
> + struct resource *res;
> + int ret;
> +
> + /**
> + * Since stmmac_platform supports name IRQ only, basic platform
> + * resource initialization is done in the glue logic.
> + */
> + stmmac_res.irq = platform_get_irq(pdev, 0);
> + if (stmmac_res.irq < 0) {
> + if (stmmac_res.irq != -EPROBE_DEFER) {
> + dev_err(&pdev->dev,
> + "IRQ configuration information not found\n");
> + }
> + return stmmac_res.irq;
> + }
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(stmmac_res.addr))
> + return PTR_ERR(stmmac_res.addr);
> +
> + plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
> + if (IS_ERR(plat_dat))
> + return PTR_ERR(plat_dat);
> +
> + plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "phy_ref_clk");
> + if (IS_ERR(plat_dat->stmmac_clk)) {
> + dev_err(&pdev->dev, "apb_pclk clock not found.\n");
Error message does not match the devm_clk_get.
Looking at synopsys/dwc_eth_qos.c
phy_ref_clk is just a dummy, used for verbosity.
apb_pclk is the clock which is actually used for setting csr etc.
So it should be
plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
So that way the warning is already correct :)
> + ret = PTR_ERR(plat_dat->stmmac_clk);
> + plat_dat->stmmac_clk = NULL;
> + goto err_remove_config_dt;
> + }
> + clk_prepare_enable(plat_dat->stmmac_clk);
> +
> + plat_dat->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
> + if (IS_ERR(plat_dat->pclk)) {
> + dev_err(&pdev->dev, "phy_ref_clk clock not found.\n");
Error message does not match the devm_clk_get,
however, since this should be
plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
the warning is correct :)
> + ret = PTR_ERR(plat_dat->pclk);
> + plat_dat->pclk = NULL;
> + goto err_out_clk_dis_phy;
> + }
> + clk_prepare_enable(plat_dat->pclk);
> +
> + ret = dwc_eth_dwmac_config_dt(pdev, plat_dat);
> + if (ret)
> + goto err_out_clk_dis_aper;
> +
> + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
> + if (ret)
> + goto err_out_clk_dis_aper;
> +
> + return 0;
> +
> +err_out_clk_dis_aper:
> + clk_disable_unprepare(plat_dat->pclk);
> +err_out_clk_dis_phy:
> + clk_disable_unprepare(plat_dat->stmmac_clk);
> +err_remove_config_dt:
> + stmmac_remove_config_dt(pdev, plat_dat);
> +
> + return ret;
> +}
> +
> +static int dwc_eth_dwmac_remove(struct platform_device *pdev)
> +{
> + return stmmac_pltfr_remove(pdev);
> +}
> +
> +static const struct of_device_id dwc_eth_dwmac_match[] = {
> + { .compatible = "snps,dwc-qos-ethernet-4.10", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
> +
> +static struct platform_driver dwc_eth_dwmac_driver = {
> + .probe = dwc_eth_dwmac_probe,
> + .remove = dwc_eth_dwmac_remove,
> + .driver = {
> + .name = "dwc-eth-dwmac",
> + .of_match_table = dwc_eth_dwmac_match,
> + },
> +};
> +module_platform_driver(dwc_eth_dwmac_driver);
> +
> +MODULE_AUTHOR("Joao Pinto <jpinto@synopsys.com>");
> +MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 4e44f9c..00c0f8d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -181,10 +181,19 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
> mdio = false;
> }
>
> - /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
> - for_each_child_of_node(np, plat->mdio_node) {
> - if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
> + /* exception for dwmac-dwc-qos-eth glue logic */
> + if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
> + plat->mdio_node = of_get_child_by_name(np, "mdio");
> + } else {
> + /**
> + * If snps,dwmac-mdio is passed from DT, always register
> + * the MDIO
> + */
> + for_each_child_of_node(np, plat->mdio_node) {
> + if (of_device_is_compatible(plat->mdio_node,
> + "snps,dwmac-mdio"))
> break;
> + }
> }
>
> if (plat->mdio_node) {
^ permalink raw reply
* Re: [patch net-next v2 5/8] Introduce sample tc action
From: Simon Horman @ 2017-01-04 10:42 UTC (permalink / raw)
To: Yotam Gigi
Cc: Roopa Prabhu, Jiri Pirko, netdev@vger.kernel.org,
davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, jhs@mojatatu.com, geert+renesas@glider.be,
stephen@networkplumber.org, xiyou.wangcong@gmail.com,
linux@roeck-us.net, john.fastabend@gmail.com
In-Reply-To: <DB3PR05MB0764183033BE8FFDAC8B6896ACBE0@DB3PR05MB0764.eurprd05.prod.outlook.com>
On Wed, Nov 16, 2016 at 04:26:44PM +0000, Yotam Gigi wrote:
> >-----Original Message-----
> >From: Roopa Prabhu [mailto:roopa@cumulusnetworks.com]
> >Sent: Wednesday, November 16, 2016 6:15 PM
> >To: Jiri Pirko <jiri@resnulli.us>
> >Cc: netdev@vger.kernel.org; davem@davemloft.net; Yotam Gigi
> ><yotamg@mellanox.com>; Ido Schimmel <idosch@mellanox.com>; Elad Raz
> ><eladr@mellanox.com>; Nogah Frankel <nogahf@mellanox.com>; Or Gerlitz
> ><ogerlitz@mellanox.com>; jhs@mojatatu.com; geert+renesas@glider.be;
> >stephen@networkplumber.org; xiyou.wangcong@gmail.com; linux@roeck-us.net;
> >john.fastabend@gmail.com; simon.horman@netronome.com
> >Subject: Re: [patch net-next v2 5/8] Introduce sample tc action
> >
> >On 11/14/16, 7:00 AM, Jiri Pirko wrote:
> >> From: Yotam Gigi <yotamg@mellanox.com>
> >>
> >> This action allow the user to sample traffic matched by tc classifier.
> >> The sampling consists of choosing packets randomly, truncating them,
> >> adding some informative metadata regarding the interface and the original
> >> packet size and mark them with specific mark, to allow further tc rules to
> >> match and process. The marked sample packets are then injected into the
> >> device ingress qdisc using netif_receive_skb.
> >>
> >> The packets metadata is packed using the ife encapsulation protocol, and
> >> the outer packet's ethernet dest, source and eth_type, along with the
> >> rate, mark and the optional truncation size can be configured from
> >> userspace.
> >>
> >> Example:
> >> To sample ingress traffic from interface eth1, and redirect the sampled
> >> the sampled packets to interface dummy0, one may use the commands:
> >>
> >> tc qdisc add dev eth1 handle ffff: ingress
> >>
> >> tc filter add dev eth1 parent ffff: \
> >> matchall action sample rate 12 mark 17
> >
> >Yotham, I am guessing in the future if one does not want to use mark,
> >the sample api is extensible to allow for other actions to be added.
> >This is from the general concern we had on using mark: some may not want to use
> >mark.
> >As long as the api is extensible to allow an alternate way in the future,
> > we should be good. (We would prefer to not go down the path of having to
> >introduce
> >a new 'action sample' if this limits us in some way).
>
> The code is extensible - if one does want to add another action to sample, he
> totally can :)
>
> By the way, one of the reasons we removed the patches for now is that we
> consider adding mirroring functionality to it instead of heaving two tc-rules.
Hi Yotham,
I see that this action combines several discrete sub-actions, some of which
duplicate functionality present in existing actions:
* sample
* truncate
* IFE encapsulation with metadata
* mark
* output (proposed)
I wonder if it would make sense to provided a mechanism whereby sampled
packets can be passed on to other actions. Something similar to the
existing pipe mechanism but allowing for the sampled and the original packets
to continue to be processed separately.
If so, it may be worth white-listing actions for which sampled packets are
known to work well to limit the scope for unforseen side effects.
^ permalink raw reply
* Re: [PATCH] Introduce a sysctl that modifies the value of PROT_SOCK.
From: Krister Johansen @ 2017-01-04 10:19 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Krister Johansen, David S. Miller, netdev
In-Reply-To: <20161231125505.7f0c7dff@xeon-e3>
On Sat, Dec 31, 2016 at 12:55:05PM -0800, Stephen Hemminger wrote:
> On Fri, 30 Dec 2016 20:11:11 -0800
> Krister Johansen <kjlx@templeofstupid.com> wrote:
>
> >
> > +config LOWPORT_SYSCTL
> > + bool "Adjust reserved port range via sysctl"
> > + depends on SYSCTL
> > + help
> > + This allows the administrator to adjust the reserved port range
> > + using a sysctl.
>
> This looks like a good idea, and makes a lot of sense.
>
> Please don't introduce yet another config option. All distro's will enable it anyway.
> Having more config options doesn't help reliability or testability.
>
> Do or do not, please no new config options.
I'd be happy to take it out. It simplifies things for me. I had
anticipated that there would be objections to permitting software to get
around the current priviliged port restrictions, and thought that
perhaps as a compromise having it be compile time option would ease some
of those concerns.
-K
^ permalink raw reply
* Re: [PATCH] Ipvlan should return an error when an address is already in use.
From: Krister Johansen @ 2017-01-04 10:04 UTC (permalink / raw)
To: David Miller; +Cc: kjlx, maheshb, netdev
In-Reply-To: <20170101.222632.843875843588487678.davem@davemloft.net>
On Sun, Jan 01, 2017 at 10:26:32PM -0500, David Miller wrote:
> From: Krister Johansen <kjlx@templeofstupid.com>
> Date: Fri, 30 Dec 2016 20:10:58 -0800
>
> > The ipvlan code already knows how to detect when a duplicate address is
> > about to be assigned to an ipvlan device. However, that failure is not
> > propogated outward and leads to a silent failure. This teaches the ip
> > address addition functions how to report this error to the user
> > applications so that a notifier chain failure during ip address addition
> > will not appear to succeed when it actually has not.
> >
> > This can be especially useful if it is necessary to provision many
> > ipvlans in containers. The provisioning software (or operator) can use
> > this to detect situations where an ip address is unexpectedly in use.
> >
> > Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
>
> Your patch isn't handling the case of primary address promotions,
> which also issue NETDEV_UP events on these notifier chains.
>
> But on a more basic level, it's extremely important that once you
> start using the notifier_{from,to}_errno() handling for a notifier,
> you must start doing so for all such cases of that notifier.
Thanks for taking a look. I'm relatively new to this area of the code.
I do appreciate the feedback.
In terms of interpreting your final comment, does that mean any call on
the inetaddr_chain or inet6addr_chain, and if so would that include all
callers of call_netdevice_notifiers()?
Another concern that I had with my approach was that the
blocking_notifier_call_chain() occurs after a rtmsg_ifa(RTM_NEWADDR)
call. In the places where I put rollback code, the address delete ends
up generating a corresponding rtmsg_ifa(RTM_DELADDR). This is likely to
emit messages that make it look like the address was created and
deleted, except that the validation failed before creation was
completed. Is the rtmsg_ifa() call consumed by other listeners in the
kernel, or is this purely a generation of a rtnetlink message for
applications listening in userland?
More generally, is using the notifier_call_chain a reasonable way of
getting this error information back to userland or would a different
approach be better? I'm also concerned about the cases where the code
currently treats these invocations as atomic. I had considered
introducing an alternate chain that might allow us to check that the
operation is valid prior to committing the change, but that seemed
potentially racy and that it might involve a lot of extra mechanism.
-K
^ permalink raw reply
* Re: [PATCH] Ipvlan should return an error when an address is already in use.
From: Krister Johansen @ 2017-01-04 10:09 UTC (permalink / raw)
To: Aaron Conole; +Cc: David Miller, kjlx, maheshb, netdev
In-Reply-To: <f7ta8b87xqc.fsf@redhat.com>
On Tue, Jan 03, 2017 at 02:24:43PM -0500, Aaron Conole wrote:
> David Miller <davem@davemloft.net> writes:
>
> > From: Aaron Conole <aconole@redhat.com>
> > Date: Tue, 03 Jan 2017 10:50:00 -0500
> >
> >>> @@ -489,7 +490,12 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
> >>> Notifier will trigger FIB update, so that
> >>> listeners of netlink will know about new ifaddr */
> >>> rtmsg_ifa(RTM_NEWADDR, ifa, nlh, portid);
> >>> - blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
> >>> + ret = blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
> >>
> >> Why are you doing this assignment if you aren't using the result?
> >>
> >>> + ret = notifier_to_errno(ret);
> >>> + if (ret) {
> >>> + __inet_del_ifa(in_dev, ifap, 1, NULL, portid);
> >>> + return ret;
> >>> + }
> >
> > 'ret' assignment is being used, via notifier_to_errno().
>
> d'oh! should have had more coffee - sorry for the noise.
No worries, and thanks for taking a look. That was from checkpatch,
which complained when I wrote it as:
if ((ret = notifier_to_errno(ret)) != 0) {
-K
^ permalink raw reply
* Re: ping: What's the purpose of rate limit?
From: Guan Xin @ 2017-01-04 10:27 UTC (permalink / raw)
To: Cong Wang; +Cc: Linux Kernel Network Developers
In-Reply-To: <CAM_iQpWBs1eUwfLprSsEFAtpMUWPY-jgXswzoHGck0DxxPQdZQ@mail.gmail.com>
On Wed, Jan 4, 2017 at 7:45 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> Hi,
>
> On Sat, Dec 31, 2016 at 4:04 AM, Guan Xin <guanx.bac@gmail.com> wrote:
>> Hello,
>>
>> Excuse me, I searched but didn't find an answer --
>>
>> What's the purpose of setting a limit to the "-i" and "-l" parameters
>> of ping for non-root users?
>>
>> It seems that this is only intended to prevent accidental misuse
>> because these restrictions can be easily worked around by starting
>> multiple instances or wrapping the program in a loop, e.g.,
>> while true; do ping -l3 -c3 192.168.0.1; done
>>
>
> I think the purpose of "-i" is not for rate limit, but for either hear beating
> or monitoring latency periodically.
>
Thanks for the reply! Probably I didn't make myself clear --
I meant the limit of 0.2s of the argument to -i for non-root users.
(Please Cc to me because I'm not subscribed to this list. Thanks!)
Regards,
Guan
^ permalink raw reply
* Re: [PATCH iproute2 net-next] tc: flower: support matching flags
From: Simon Horman @ 2017-01-04 10:33 UTC (permalink / raw)
To: Paul Blakey
Cc: Jiri Benc, netdev, Stephen Hemminger, David S. Miller,
Hadar Hen Zion, Or Gerlitz, Roi Dayan
In-Reply-To: <1ec4f4ca-08e0-84fc-34c6-b3868d756050@mellanox.com>
On Tue, Jan 03, 2017 at 01:54:34PM +0200, Paul Blakey wrote:
...
Hi Paul,
> Matching name was from the idea that we are doing is matching.
> And regarding documentation/flag names I didn't want tc tool to be need of a
> update each time a new flag is introduced,
> But I guess I can add two options like with ip_proto where you can specify
> known flags by name but can also give a value.
> What do you think about that?
>
> flags <FLAGS> / <HEX'/'HEX>
> FLAGS => frag/no_frag/tcp_syn/no_tcp_syn ['|'<FLAGS>]*
> e.g: flags frag|no_tcp_syn or flags 0x01/0x15
> and the mask will have a on bits corresponds only to those flags specified.
I suppose a flag is a flag and bitwise masking allows arbitrary matching
on one or more flags. But I wonder if, as per your example above,
it makes sense to mix IP (frag) and TCP flags in the same field of the
classifier.
^ permalink raw reply
* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Simon Horman @ 2017-01-04 10:14 UTC (permalink / raw)
To: Paul Blakey
Cc: Jamal Hadi Salim, John Fastabend, David S. Miller, netdev,
Jiri Pirko, Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak
In-Reply-To: <606f64cb-1744-d44f-8fd1-a4bdb1ca872f@mellanox.com>
On Tue, Jan 03, 2017 at 02:22:05PM +0200, Paul Blakey wrote:
>
>
> On 03/01/2017 13:44, Jamal Hadi Salim wrote:
> >On 17-01-02 11:33 PM, John Fastabend wrote:
> >>On 17-01-02 05:22 PM, Jamal Hadi Salim wrote:
> >
> >[..]
> >>>Like all cookie semantics it is for storing state. The receiver
> >>>(kernel)
> >>>is not just store it and not intepret it. The user when reading it back
> >>>simplifies what they have to do for their processing.
> >>>
> >>>>
> >>>>The tuple <ifindex:qdisc:prio:handle> really should be unique why
> >>>>not use this for system wide mappings?
> >>>>
> >>>
> >>>I think on a single machine should be enough, however:
> >>>typically the user wants to define the value in a manner that
> >>>in a distributed system it is unique. It would be trickier to
> >>>do so with well defined values such as above.
> >>>
> >>
> >>Just extend the tuple <hostname:ifindex:qdisc:prio:handle> that
> >>should be unique in the domain of hostname's, or use some other domain
> >>wide machine identifier.
> >>
> >
> >May work for the case of filter identification. The nice thing for
> >allowing cookies is you can let the user define it define their
> >own scheme.
> >
> >>Although actions can be shared so the cookie can be shared across
> >>filters. Maybe its useful but it doesn't uniquely identify a filter
> >>in the shared case but the user would have to specify that case
> >>so maybe its not important.
> >>
> >
> >Note: the action cookies and filter cookies are unrelated/orthogonal.
> >Their basic concept of stashing something in the cookie to help improve
> >what user space does (in our case millions of actions of which some are
> >used for accounting) is similar.
> >I have no objections to the flow cookies; my main concern was it should
> >be applicable to all classifiers not just flower. And the arbitrary size
> >of the cookie that you pointed out is questionable.
> >
> >cheers,
> >jamal
>
>
> Hi all,
> Our use case is replacing OVS rules with TC filters for HW offload, and
> you're are right the cookie would
> have saved us the mapping from OVS rule ufid to the tc filter handle/prio...
> that was generated for it.
> It also was going to be used to store other info like which OVS output port
> corresponds to the ifindex,
Possibly off-topic but I am curious to know why you need to store the port.
My possibly naïve assumption is that a filter is attached to the netdev
corresponding to the input port and mirred or other actions are used to output
to netdevs corresponding to output ports.
> so we need 128+32 for now. It helps us with dumping the the flows back, when
> we lose data on crash
> or restarting the user space daemon.
> HW hints is another thing that might be helpful.
> Its binary blob because user/app specifc and its usage might change in the
> future and its and that's why there
> is some headroom with size as well.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox