* [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
* 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
* 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 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
* [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
* [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 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 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
* 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
* 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 iproute2 net-next] tc: flower: support matching flags
From: Jiri Benc @ 2017-01-04 11:55 UTC (permalink / raw)
To: Paul Blakey
Cc: Simon Horman, netdev, Stephen Hemminger, David S. Miller,
Hadar Hen Zion, Or Gerlitz, Roi Dayan
In-Reply-To: <82df989f-09a7-a89a-a675-c45d190b049e@mellanox.com>
On Wed, 4 Jan 2017 13:51:13 +0200, Paul Blakey wrote:
> 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?
What Simon says makes sense to me. ip_flags and tcp_flags sounds like
the best solution so far (even better than my original suggestion).
Thanks,
Jiri
^ permalink raw reply
* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Paul Blakey @ 2017-01-04 11:45 UTC (permalink / raw)
To: Simon Horman
Cc: paulb, Jamal Hadi Salim, John Fastabend, David S. Miller, netdev,
Jiri Pirko, Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak
In-Reply-To: <20170104101437.GB24762@penelope.horms.nl>
On 04/01/2017 12:14, Simon Horman wrote:
> 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.
Right, its for the output ports, OVS uses ovs port numbers and mirred
action uses the device ifindex, so there is need
to translate it back to OVS port on dump.
>
>> 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
* [PATCH 0/2] sh_eth: E-MAC interrupt handler cleanups
From: Sergei Shtylyov @ 2017-01-04 12:09 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
Hello.
Here's a set of 3 patches against DaveM's 'net-next.git' repo. I'm cleaning
up the E-MAC interrupt handling with the main goal of factoring out the E-MAC
interrupt handler into a separate function.
[1/3] sh_eth: handle only enabled E-MAC interrupts
[2/3] sh_eth: no need for *else* after *goto*
[3/3] sh_eth: factor out sh_eth_emac_interrupt()
MBR, Sergei
^ permalink raw reply
* [PATCH 1/3] sh_eth: handle only enabled E-MAC interrupts
From: Sergei Shtylyov @ 2017-01-04 12:10 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>
The driver should only handle the enabled E-MAC interrupts, like it does
for the E-DMAC interrupts since commit 3893b27345ac ("sh_eth: workaround
for spurious ECI interrupt"), so mask ECSR with ECSIPR when reading it
in sh_eth_error().
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1535,7 +1535,8 @@ static void sh_eth_error(struct net_devi
u32 mask;
if (intr_status & EESR_ECI) {
- felic_stat = sh_eth_read(ndev, ECSR);
+ felic_stat = sh_eth_read(ndev, ECSR) &
+ sh_eth_read(ndev, ECSIPR);
sh_eth_write(ndev, felic_stat, ECSR); /* clear int */
if (felic_stat & ECSR_ICD)
ndev->stats.tx_carrier_errors++;
^ permalink raw reply
* [PATCH 2/3] sh_eth: no need for *else* after *goto*
From: Sergei Shtylyov @ 2017-01-04 12:10 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>
Well, checkpatch.pl complains about *else* after *return* and *break* but
not after *goto*... and it probably should have complained about the code
in sh_eth_error(). Win couple LoCs by removing that *else*. :-)
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1542,13 +1542,11 @@ static void sh_eth_error(struct net_devi
ndev->stats.tx_carrier_errors++;
if (felic_stat & ECSR_LCHNG) {
/* Link Changed */
- if (mdp->cd->no_psr || mdp->no_ether_link) {
+ if (mdp->cd->no_psr || mdp->no_ether_link)
goto ignore_link;
- } else {
- link_stat = (sh_eth_read(ndev, PSR));
- if (mdp->ether_link_active_low)
- link_stat = ~link_stat;
- }
+ link_stat = sh_eth_read(ndev, PSR);
+ if (mdp->ether_link_active_low)
+ link_stat = ~link_stat;
if (!(link_stat & PHY_ST_LINK)) {
sh_eth_rcv_snd_disable(ndev);
} else {
^ permalink raw reply
* [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:11 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>
The E-MAC interrupt (EESR.ECI) is not always caused by an error condition,
so it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
interrupt handler, sh_eth_emac_interrupt(), removing the ECI bit from the
EESR's values throughout the driver...
Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
copyright, while at it...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 102 +++++++++++++++++-----------------
drivers/net/ethernet/renesas/sh_eth.h | 2
2 files changed, 53 insertions(+), 51 deletions(-)
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1,9 +1,9 @@
/* SuperH Ethernet device driver
*
- * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2014 Renesas Electronics Corporation
* Copyright (C) 2006-2012 Nobuhiro Iwamatsu
* Copyright (C) 2008-2014 Renesas Solutions Corp.
- * Copyright (C) 2013-2016 Cogent Embedded, Inc.
+ * Copyright (C) 2013-2017 Cogent Embedded, Inc.
* Copyright (C) 2014 Codethink Limited
*
* This program is free software; you can redistribute it and/or modify it
@@ -523,7 +523,7 @@ static struct sh_eth_cpu_data r7s72100_d
.tx_check = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
- EESR_TDE | EESR_ECI,
+ EESR_TDE,
.fdr_value = 0x0000070f,
.no_psr = 1,
@@ -562,7 +562,7 @@ static struct sh_eth_cpu_data r8a7740_da
.tx_check = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
- EESR_TDE | EESR_ECI,
+ EESR_TDE,
.fdr_value = 0x0000070f,
.apr = 1,
@@ -607,8 +607,7 @@ static struct sh_eth_cpu_data r8a777x_da
.tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
.eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
- EESR_ECI,
+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
.fdr_value = 0x00000f0f,
.apr = 1,
@@ -630,8 +629,7 @@ static struct sh_eth_cpu_data r8a779x_da
.tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
.eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
- EESR_ECI,
+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
.fdr_value = 0x00000f0f,
.trscer_err_mask = DESC_I_RINT8,
@@ -671,8 +669,7 @@ static struct sh_eth_cpu_data sh7724_dat
.tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
.eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
- EESR_ECI,
+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
.apr = 1,
.mpr = 1,
@@ -707,8 +704,7 @@ static struct sh_eth_cpu_data sh7757_dat
.tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
.eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
- EESR_ECI,
+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
.irq_flags = IRQF_SHARED,
.apr = 1,
@@ -776,7 +772,7 @@ static struct sh_eth_cpu_data sh7757_dat
.tx_check = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
- EESR_TDE | EESR_ECI,
+ EESR_TDE,
.fdr_value = 0x0000072f,
.irq_flags = IRQF_SHARED,
@@ -807,7 +803,7 @@ static struct sh_eth_cpu_data sh7734_dat
.tx_check = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
- EESR_TDE | EESR_ECI,
+ EESR_TDE,
.apr = 1,
.mpr = 1,
@@ -835,8 +831,7 @@ static struct sh_eth_cpu_data sh7763_dat
.tx_check = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
- EESR_ECI,
+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
.apr = 1,
.mpr = 1,
@@ -1526,43 +1521,44 @@ static void sh_eth_rcv_snd_enable(struct
sh_eth_modify(ndev, ECMR, ECMR_RE | ECMR_TE, ECMR_RE | ECMR_TE);
}
-/* error control function */
-static void sh_eth_error(struct net_device *ndev, u32 intr_status)
+/* E-MAC interrupt handler */
+static void sh_eth_emac_interrupt(struct net_device *ndev)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
u32 felic_stat;
u32 link_stat;
- u32 mask;
- if (intr_status & EESR_ECI) {
- felic_stat = sh_eth_read(ndev, ECSR) &
- sh_eth_read(ndev, ECSIPR);
- sh_eth_write(ndev, felic_stat, ECSR); /* clear int */
- if (felic_stat & ECSR_ICD)
- ndev->stats.tx_carrier_errors++;
- if (felic_stat & ECSR_LCHNG) {
- /* Link Changed */
- if (mdp->cd->no_psr || mdp->no_ether_link)
- goto ignore_link;
- link_stat = sh_eth_read(ndev, PSR);
- if (mdp->ether_link_active_low)
- link_stat = ~link_stat;
- if (!(link_stat & PHY_ST_LINK)) {
- sh_eth_rcv_snd_disable(ndev);
- } else {
- /* Link Up */
- sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, 0);
- /* clear int */
- sh_eth_modify(ndev, ECSR, 0, 0);
- sh_eth_modify(ndev, EESIPR, DMAC_M_ECI,
- DMAC_M_ECI);
- /* enable tx and rx */
- sh_eth_rcv_snd_enable(ndev);
- }
+ felic_stat = sh_eth_read(ndev, ECSR) & sh_eth_read(ndev, ECSIPR);
+ sh_eth_write(ndev, felic_stat, ECSR); /* clear int */
+ if (felic_stat & ECSR_ICD)
+ ndev->stats.tx_carrier_errors++;
+ if (felic_stat & ECSR_LCHNG) {
+ /* Link Changed */
+ if (mdp->cd->no_psr || mdp->no_ether_link)
+ return;
+ link_stat = sh_eth_read(ndev, PSR);
+ if (mdp->ether_link_active_low)
+ link_stat = ~link_stat;
+ if (!(link_stat & PHY_ST_LINK)) {
+ sh_eth_rcv_snd_disable(ndev);
+ } else {
+ /* Link Up */
+ sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, 0);
+ /* clear int */
+ sh_eth_modify(ndev, ECSR, 0, 0);
+ sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, DMAC_M_ECI);
+ /* enable tx and rx */
+ sh_eth_rcv_snd_enable(ndev);
}
}
+}
+
+/* error control function */
+static void sh_eth_error(struct net_device *ndev, u32 intr_status)
+{
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+ u32 mask;
-ignore_link:
if (intr_status & EESR_TWB) {
/* Unused write back interrupt */
if (intr_status & EESR_TABT) { /* Transmit Abort int */
@@ -1643,14 +1639,16 @@ static irqreturn_t sh_eth_interrupt(int
/* Get interrupt status */
intr_status = sh_eth_read(ndev, EESR);
- /* Mask it with the interrupt mask, forcing ECI interrupt to be always
- * enabled since it's the one that comes thru regardless of the mask,
- * and we need to fully handle it in sh_eth_error() in order to quench
- * it as it doesn't get cleared by just writing 1 to the ECI bit...
+ /* Mask it with the interrupt mask, forcing ECI interrupt to be always
+ * enabled since it's the one that comes thru regardless of the mask,
+ * and we need to fully handle it in sh_eth_emac_interrupt() in order
+ * to quench it as it doesn't get cleared by just writing 1 to the ECI
+ * bit...
*/
intr_enable = sh_eth_read(ndev, EESIPR);
intr_status &= intr_enable | DMAC_M_ECI;
- if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check))
+ if (intr_status & (EESR_RX_CHECK | cd->tx_check | EESR_ECI |
+ cd->eesr_err_check))
ret = IRQ_HANDLED;
else
goto out;
@@ -1682,6 +1680,10 @@ static irqreturn_t sh_eth_interrupt(int
netif_wake_queue(ndev);
}
+ /* E-MAC interrupt */
+ if (intr_status & EESR_ECI)
+ sh_eth_emac_interrupt(ndev);
+
if (intr_status & cd->eesr_err_check) {
/* Clear error interrupts */
sh_eth_write(ndev, intr_status & cd->eesr_err_check, EESR);
Index: renesas/drivers/net/ethernet/renesas/sh_eth.h
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ renesas/drivers/net/ethernet/renesas/sh_eth.h
@@ -265,7 +265,7 @@ enum EESR_BIT {
EESR_RTO)
#define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | \
EESR_RDE | EESR_RFRMER | EESR_ADE | \
- EESR_TFE | EESR_TDE | EESR_ECI)
+ EESR_TFE | EESR_TDE)
/* EESIPR */
enum DMAC_IM_BIT {
^ permalink raw reply
* Re: [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:13 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <2316251.zKWDf5AMHG@wasted.cogentembedded.com>
On 01/04/2017 03:11 PM, Sergei Shtylyov wrote:
> The E-MAC interrupt (EESR.ECI) is not always caused by an error condition,
> so it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
> interrupt handler, sh_eth_emac_interrupt(), removing the ECI bit from the
> EESR's values throughout the driver...
>
> Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
> copyright, while at it...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Scrap it, I've just realized I never enable EESR.ECI...
MBR, Sergei
^ permalink raw reply
* Re: [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:20 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <cab4c624-2225-beed-25f5-7bcf25b16e9b@cogentembedded.com>
On 01/04/2017 03:13 PM, Sergei Shtylyov wrote:
>> The E-MAC interrupt (EESR.ECI) is not always caused by an error condition,
>> so it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
>> interrupt handler, sh_eth_emac_interrupt(), removing the ECI bit from the
>> EESR's values throughout the driver...
>>
>> Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
>> copyright, while at it...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> Scrap it, I've just realized I never enable EESR.ECI...
Heh, hat was false alarm -- I didn't change the .eesipr_value in the
patch, so everything's OK, you can merge this series.
I'll look into avoiding bare numbers in the .eesipr_value initializers.
MBR, Sergei
^ permalink raw reply
* Re: [PATCH RFC ipsec-next 4/5] net: Prepare for IPsec GRO
From: Eric Dumazet @ 2017-01-04 12:34 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David Miller, netdev, Sowmini Varadhan, Ilan Tayari
In-Reply-To: <1483518230-6777-5-git-send-email-steffen.klassert@secunet.com>
On Wed, 2017-01-04 at 09:23 +0100, Steffen Klassert wrote:
> This patch prepares the generic codepath for IPsec GRO.
> We introduce a new GRO_CONSUMED notifier to reflect that
> IPsec can return asynchronous. On IPsec GRO we grab the
> packet and reinject it back to layer 2 after IPsec
> processing. We also use one xfrm_gro bit on the sk_buff
> that will be set from IPsec to notify about GRO. If this
> bit is set, we call napi_gro_receive for the backlog device
> instead of __netif_receive_skb.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
> include/linux/netdevice.h | 1 +
> include/linux/skbuff.h | 14 +++++++++++++-
> net/core/dev.c | 17 ++++++++++++++++-
> net/xfrm/Kconfig | 4 ++++
> 4 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index ecd78b3..89bad76 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -352,6 +352,7 @@ enum gro_result {
> GRO_HELD,
> GRO_NORMAL,
> GRO_DROP,
> + GRO_CONSUMED,
> };
> typedef enum gro_result gro_result_t;
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index b53c0cf..a78cd90 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -749,7 +749,10 @@ struct sk_buff {
> #ifdef CONFIG_NET_SWITCHDEV
> __u8 offload_fwd_mark:1;
> #endif
> - /* 2, 4 or 5 bit hole */
> +#ifdef CONFIG_XFRM_OFFLOAD
> + __u8 xfrm_gro:1;
Arg, yet another skb bit.
> +#endif
> + /* 1 to 5 bits hole */
>
> #ifdef CONFIG_NET_SCHED
> __u16 tc_index; /* traffic control index */
> @@ -3698,6 +3701,15 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
> #endif
> }
>
>
> @@ -4843,7 +4853,12 @@ static int process_backlog(struct napi_struct *napi, int quota)
>
> while ((skb = __skb_dequeue(&sd->process_queue))) {
> rcu_read_lock();
> - __netif_receive_skb(skb);
> +
> + if (skb_xfrm_gro(skb))
> + napi_gro_receive(napi, skb);
> + else
> + __netif_receive_skb(skb);
> +
But napi here is device independent. It is a fake NAPI, per cpu.
I am not sure of the various implications of using it at this point,
this looks quite dangerous/invasive to me, compared to the gro_cells
infra which was designed to have no impact on core code paths.
To me, the caller should call napi_gro_receive() skb, instead of letting
core networking stack add this extra skb bit and extra conditional.
( Also I am not sure device dismantle will be properly managed by your
changes. It is really tricky to get it right. )
Thanks.
^ permalink raw reply
* Re: [PATCH net-next] net/hyperv: remove use of VLAN_TAG_PRESENT
From: Vitaly Kuznetsov @ 2017-01-04 12:48 UTC (permalink / raw)
To: Michał Mirosław; +Cc: netdev, Haiyang Zhang, devel
In-Reply-To: <85c211f16e696607c9f61f96b8234684a2a2385b.1483487888.git.mirq-linux@rere.qmqm.pl>
Michał Mirosław <mirq-linux@rere.qmqm.pl> writes:
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Can we have a non-empty description please?
> ---
> drivers/net/hyperv/hyperv_net.h | 2 +-
> drivers/net/hyperv/netvsc_drv.c | 13 ++++++-------
> drivers/net/hyperv/rndis_filter.c | 4 ++--
> 3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 3958adade7eb..b53729e85a79 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -186,7 +186,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
> void **data,
> struct ndis_tcp_ip_checksum_info *csum_info,
> struct vmbus_channel *channel,
> - u16 vlan_tci);
> + u16 vlan_tci, bool vlan_present);
> void netvsc_channel_cb(void *context);
> int rndis_filter_open(struct netvsc_device *nvdev);
> int rndis_filter_close(struct netvsc_device *nvdev);
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index c9414c054852..6597d7901929 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -595,7 +595,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
> static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
> struct hv_netvsc_packet *packet,
> struct ndis_tcp_ip_checksum_info *csum_info,
> - void *data, u16 vlan_tci)
> + void *data)
> {
> struct sk_buff *skb;
>
> @@ -625,10 +625,6 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
> skb->ip_summed = CHECKSUM_UNNECESSARY;
> }
>
> - if (vlan_tci & VLAN_TAG_PRESENT)
> - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
> - vlan_tci);
> -
> return skb;
> }
>
> @@ -641,7 +637,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
> void **data,
> struct ndis_tcp_ip_checksum_info *csum_info,
> struct vmbus_channel *channel,
> - u16 vlan_tci)
> + u16 vlan_tci, bool vlan_present)
> {
> struct net_device *net = hv_get_drvdata(device_obj);
> struct net_device_context *net_device_ctx = netdev_priv(net);
> @@ -664,12 +660,15 @@ int netvsc_recv_callback(struct hv_device *device_obj,
> net = vf_netdev;
>
> /* Allocate a skb - TODO direct I/O to pages? */
> - skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data, vlan_tci);
> + skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data);
> if (unlikely(!skb)) {
> ++net->stats.rx_dropped;
> return NVSP_STAT_FAIL;
> }
>
> + if (vlan_present)
> + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
> +
> if (net != vf_netdev)
> skb_record_rx_queue(skb,
> channel->offermsg.offer.sub_channel_index);
> diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
> index 8d90904e0e49..7f7b410a41c2 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -381,13 +381,13 @@ static int rndis_filter_receive_data(struct rndis_device *dev,
>
> vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
> if (vlan) {
> - vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
> + vlan_tci = vlan->vlanid |
> (vlan->pri << VLAN_PRIO_SHIFT);
> }
>
> csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO);
> return netvsc_recv_callback(net_device_ctx->device_ctx, pkt, data,
> - csum_info, channel, vlan_tci);
> + csum_info, channel, vlan_tci, vlan);
> }
>
> int rndis_filter_receive(struct hv_device *dev,
--
Vitaly
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply
* Re: [PATCH] tcp: provide tx timestamps for partial writes
From: Eric Dumazet @ 2017-01-04 12:55 UTC (permalink / raw)
To: Soheil Hassas Yeganeh
Cc: David Miller, netdev, Willem de Bruijn, Yuchung Cheng,
Eric Dumazet, Neal Cardwell, Martin KaFai Lau
In-Reply-To: <CACSApvYN48nRSdV5OQmrS+6BqJBMRocZ1LypziOj9jk4aTc7Pg@mail.gmail.com>
On Tue, 2017-01-03 at 10:22 -0500, Soheil Hassas Yeganeh wrote:
> On Mon, Jan 2, 2017 at 3:23 PM, Soheil Hassas Yeganeh <soheil@google.com> wrote:
> > On Mon, Jan 2, 2017 at 3:20 PM, Soheil Hassas Yeganeh
> > <soheil.kdev@gmail.com> wrote:
> >> From: Soheil Hassas Yeganeh <soheil@google.com>
> >>
> >> For TCP sockets, tx timestamps are only captured when the user data
> >> is successfully and fully written to the socket. In many cases,
> >> however, TCP writes can be partial for which no timestamp is
> >> collected.
> >>
> >> Collect timestamps when the user data is partially copied into
> >> the socket.
> >>
> >> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> >> Cc: Willem de Bruijn <willemb@google.com>
> >> Cc: Yuchung Cheng <ycheng@google.com>
> >> Cc: Eric Dumazet <edumazet@google.com>
> >> Cc: Neal Cardwell <ncardwell@google.com>
> >> Cc: Martin KaFai Lau <kafai@fb.com>
> >> ---
> >> net/ipv4/tcp.c | 8 ++++++--
> >> 1 file changed, 6 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> >> index 2e3807d..c207b16 100644
> >> --- a/net/ipv4/tcp.c
> >> +++ b/net/ipv4/tcp.c
> >> @@ -992,8 +992,10 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
> >> return copied;
> >>
> >> do_error:
> >> - if (copied)
> >> + if (copied) {
> >> + tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
> >> goto out;
> >> + }
> >> out_err:
> >> /* make sure we wake any epoll edge trigger waiter */
> >> if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
> >> @@ -1329,8 +1331,10 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> >> }
> >>
> >> do_error:
> >> - if (copied + copied_syn)
> >> + if (copied + copied_syn) {
> >> + tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
>
> Thanks to Willem for noting that this should be sockc.tsflags and not
> sk->sk_tsflags. I'll send V2 to fix.
Also, why not factorizing a bit and have a single point calling
tcp_tx_timestamp() ?
This would ease code review quite a bit.
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4a044964da6670829e5c47fef52d2cd76360b59f..11357f3bd1f82fa29129dd3ecf4d270feb4a6b1d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -958,10 +958,8 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
copied += copy;
offset += copy;
size -= copy;
- if (!size) {
- tcp_tx_timestamp(sk, sk->sk_tsflags, skb);
+ if (!size)
goto out;
- }
if (skb->len < size_goal || (flags & MSG_OOB))
continue;
@@ -987,8 +985,11 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
}
out:
- if (copied && !(flags & MSG_SENDPAGE_NOTLAST))
- tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+ if (copied) {
+ tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
+ if (!(flags & MSG_SENDPAGE_NOTLAST))
+ tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+ }
return copied;
do_error:
@@ -1281,7 +1282,6 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
copied += copy;
if (!msg_data_left(msg)) {
- tcp_tx_timestamp(sk, sockc.tsflags, skb);
if (unlikely(flags & MSG_EOR))
TCP_SKB_CB(skb)->eor = 1;
goto out;
@@ -1312,8 +1312,10 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
}
out:
- if (copied)
+ if (copied) {
+ tcp_tx_timestamp(sk, sockc.tsflags, tcp_write_queue_tail(sk));
tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+ }
out_nopush:
release_sock(sk);
return copied + copied_syn;
^ permalink raw reply related
* Re: [PATCH net-next 5/6] net/bpf_jit: SPARC: split VLAN_PRESENT bit handling from VLAN_TCI
From: kbuild test robot @ 2017-01-04 12:59 UTC (permalink / raw)
To: Michał Mirosław; +Cc: kbuild-all, netdev, David S. Miller, sparclinux
In-Reply-To: <b4e1dcbeed867f958e90551263865d4eb046ae25.1483492355.git.mirq-linux@rere.qmqm.pl>
[-- Attachment #1: Type: text/plain, Size: 3258 bytes --]
Hi Michał,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/Prepare-BPF-for-VLAN_TAG_PRESENT-cleanup/20170104-190258
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All error/warnings (new ones prefixed by >>):
In file included from include/linux/compiler.h:58:0,
from include/uapi/linux/stddef.h:1,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from include/linux/moduleloader.h:5,
from arch/sparc/net/bpf_jit_comp.c:1:
arch/sparc/net/bpf_jit_comp.c: In function 'bpf_jit_compile':
>> include/linux/compiler-gcc.h:159:2: error: 'struct sk_buff' has no member named '__pkt_vlan_present_offset'; did you mean '__pkt_type_offset'?
__builtin_offsetof(a, b)
^
include/linux/stddef.h:16:32: note: in expansion of macro '__compiler_offsetof'
#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
^~~~~~~~~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:228:26: note: in expansion of macro 'offsetof'
do { unsigned int _off = offsetof(STRUCT, FIELD); \
^~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:270:2: note: in expansion of macro '__emit_load8'
__emit_load8(r_SKB, struct sk_buff, FIELD, DEST)
^~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:611:5: note: in expansion of macro '__emit_skb_load8'
__emit_skb_load8(__pkt_vlan_present_offset, r_A);
^~~~~~~~~~~~~~~~
vim +159 include/linux/compiler-gcc.h
cb984d10 Joe Perches 2015-06-25 153 # error Your version of gcc miscompiles the __weak directive
cb984d10 Joe Perches 2015-06-25 154 # endif
cb984d10 Joe Perches 2015-06-25 155 #endif
cb984d10 Joe Perches 2015-06-25 156
cb984d10 Joe Perches 2015-06-25 157 #define __used __attribute__((__used__))
cb984d10 Joe Perches 2015-06-25 158 #define __compiler_offsetof(a, b) \
cb984d10 Joe Perches 2015-06-25 @159 __builtin_offsetof(a, b)
cb984d10 Joe Perches 2015-06-25 160
0d025d27 Josh Poimboeuf 2016-08-30 161 #if GCC_VERSION >= 40100
cb984d10 Joe Perches 2015-06-25 162 # define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
:::::: The code at line 159 was first introduced by commit
:::::: cb984d101b30eb7478d32df56a0023e4603cba7f compiler-gcc: integrate the various compiler-gcc[345].h files
:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48625 bytes --]
^ permalink raw reply
* Re: [PATCH 2/3] stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure
From: kbuild test robot @ 2017-01-04 13:01 UTC (permalink / raw)
To: Joao Pinto
Cc: kbuild-all, davem, lars.persson, niklass, swarren, treding,
netdev, Joao Pinto
In-Reply-To: <54ae15f7be4b1b476f10556742d2534b071f89b1.1483372523.git.jpinto@synopsys.com>
[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]
Hi Joao,
[auto build test ERROR on net-next/master]
[also build test ERROR on next-20170104]
[cannot apply to v4.10-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Joao-Pinto/adding-new-glue-driver-dwmac-dwc-qos-eth/20170104-200013
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 'socfpga_dwmac_probe':
>> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:344:28: error: 'struct stmmac_priv' has no member named 'stmmac_rst'
dwmac->stmmac_rst = stpriv->stmmac_rst;
^~
vim +344 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
50ac64cf Johan Hovold 2016-11-30 338 stpriv = netdev_priv(ndev);
70cb136f Joachim Eastwood 2016-05-01 339
50ac64cf Johan Hovold 2016-11-30 340 /* The socfpga driver needs to control the stmmac reset to set the phy
50ac64cf Johan Hovold 2016-11-30 341 * mode. Create a copy of the core reset handle so it can be used by
50ac64cf Johan Hovold 2016-11-30 342 * the driver later.
70cb136f Joachim Eastwood 2016-05-01 343 */
70cb136f Joachim Eastwood 2016-05-01 @344 dwmac->stmmac_rst = stpriv->stmmac_rst;
70cb136f Joachim Eastwood 2016-05-01 345
0f400a87 Joachim Eastwood 2016-05-01 346 ret = socfpga_dwmac_set_phy_mode(dwmac);
50ac64cf Johan Hovold 2016-11-30 347 if (ret)
:::::: The code at line 344 was first introduced by commit
:::::: 70cb136f7730830aa1134925a941e3ad96e3a846 stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data
:::::: TO: Joachim Eastwood <manabian@gmail.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54048 bytes --]
^ permalink raw reply
* Re: [PATCH v3] net: ethernet: faraday: To support device tree usage.
From: Arnd Bergmann @ 2017-01-04 13:23 UTC (permalink / raw)
To: Greentime Hu
Cc: Florian Fainelli, netdev, devicetree, Andrew Lunn, linux-kernel,
Jiri Pirko, jonas.jensen, davem
In-Reply-To: <CAEbi=3f7pf59YjNha-bpK+GZw4BSdevngi=fekd9uNLMVXDVnQ@mail.gmail.com>
On Wednesday, January 4, 2017 9:49:51 AM CET Greentime Hu wrote:
> On Tue, Jan 3, 2017 at 9:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> > On Tuesday, January 3, 2017 2:05:47 PM CET Greentime Hu wrote:
> > > I am not sure if atmac and moxa-art are exactly hardware compatible
> > though
> > > they are based on faraday ftmac.
> > > It may be better if we use 2 different device tree binding documents to
> > > describe for these 2 different drivers to use.
> >
> > They are probably slightly different, but close enough to have the same
> > binding document, as there is no technical reason to have two separate
> > drivers for them. The binding should be about the hardware type, not the
> > way that Linux currently implements the drivers.
> >
> > Arnd
> >
> >
> OK.
>
> How about this?
>
> rename
> Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
> to
> Documentation/devicetree/bindings/net/faraday,ftmac.txt
>
> and the content to
> Faraday Ethernet Controller
Sounds good. Note that you can use 'git patch -M' to produce
this as a renaming patch.
>
> Required properties:
>
> - compatible : Must be "moxa,moxart-mac" or "andestech,atmac" or
> "faraday,ftmac"
I'd write this as
compatible: Must contain "faraday,ftmac", as well as one of
the SoC specific identifiers:
"andestec,atmac"
"moxa,moxart-mac"
This makes it easier to extend, plus it makes the generic string
mandatory.
Arnd
^ permalink raw reply
* Re: [RFC 3/4] net-next: dsa: Add support for multiple cpu ports.
From: Andrew Lunn @ 2017-01-04 13:22 UTC (permalink / raw)
To: John Crispin; +Cc: David S. Miller, Florian Fainelli, Vivien Didelot, netdev
In-Reply-To: <1483515484-21793-4-git-send-email-john@phrozen.org>
On Wed, Jan 04, 2017 at 08:38:03AM +0100, John Crispin wrote:
> static int dsa_user_port_apply(struct device_node *port, u32 index,
> @@ -475,6 +475,28 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
>
> dst->rcv = dst->tag_ops->rcv;
>
> + dev_hold(ethernet_dev);
> + ds->cd->port_ethernet[index] = ethernet_dev;
> +
> + return 0;
> +}
> +
> +static int dsa_user_parse(struct device_node *port, u32 index,
> + struct dsa_switch *ds)
> +{
Please put this function next to dsa_cpu_parse(). All the
apply/unapply functions are together, and all the _parse functions
should be together.
> + struct device_node *cpu_port;
> + const unsigned int *cpu_port_reg;
> + int cpu_port_index;
> +
> + cpu_port = of_parse_phandle(port, "cpu", 0);
> + if (cpu_port) {
> + cpu_port_reg = of_get_property(cpu_port, "reg", NULL);
> + if (!cpu_port_reg)
> + return -EINVAL;
> + cpu_port_index = be32_to_cpup(cpu_port_reg);
> + ds->cd->port_cpu[index] = cpu_port_index;
> + }
> +
> return 0;
> }
>
> @@ -482,18 +504,20 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
> {
> struct device_node *port;
> u32 index;
> - int err;
> + int err = 0;
>
> for (index = 0; index < DSA_MAX_PORTS; index++) {
> port = ds->ports[index].dn;
> if (!port)
> continue;
>
> - if (dsa_port_is_cpu(port)) {
> + if (dsa_port_is_cpu(port))
> err = dsa_cpu_parse(port, index, dst, ds);
> - if (err)
> - return err;
> - }
> + else if (!dsa_port_is_dsa(port))
> + err = dsa_user_parse(port, index, ds);
> +
> + if (err)
> + return err;
Having this if (err) here is correct, but it goes against the general
pattern we have in the code. Please indent it so it is under the
err =, and remove the initialisation of err.
Also, if one branch of an if/else has {}, the coding style says the
other branch should also use {}.
Just to make this code look nicer, i would be tempted to add a helper,
dsa_port_is_user().
> }
>
> pr_info("DSA: switch %d %d parsed\n", dst->tree, ds->index);
Thanks
Andrew
^ 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