* [PATCH (net.git) 0/5] Spare stmmac fixes
@ 2015-11-26 7:35 Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 1/5] stmmac: fix a filter problem after resuming Giuseppe Cavallaro
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
These are some fixes for the stmmac d.d. tested on STi platforms.
They are for some part of the PM, STi glue and rx path when test
Jumbo.
Giuseppe Cavallaro (5):
stmmac: fix a filter problem after resuming.
stmmac: fix csr clock divisor for 300MHz
stmmac: dwmac-sti: fix st,tx-retime-src check
stmmac: fix PHY reset during resume
stmmac: fix oversized frame reception
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 13 +++++----
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++-
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 28 +++++++++-----------
3 files changed, 28 insertions(+), 22 deletions(-)
--
1.7.4.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH (net.git) 1/5] stmmac: fix a filter problem after resuming.
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
@ 2015-11-26 7:35 ` Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 2/5] stmmac: fix csr clock divisor for 300MHz Giuseppe Cavallaro
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
When resume the HW is re-configured but some settings can be lost.
For example, the MAC Address_X High/Low Registers used for VLAN tagging..
So, while resuming, the set_filter callback needs to be invoked to
re-program perfect and hash-table registers.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 64d8aa4..e3d96f2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3102,6 +3102,7 @@ int stmmac_resume(struct net_device *ndev)
init_dma_desc_rings(ndev, GFP_ATOMIC);
stmmac_hw_setup(ndev, false);
stmmac_init_tx_coalesce(priv);
+ stmmac_set_rx_mode(ndev);
napi_enable(&priv->napi);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH (net.git) 2/5] stmmac: fix csr clock divisor for 300MHz
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 1/5] stmmac: fix a filter problem after resuming Giuseppe Cavallaro
@ 2015-11-26 7:35 ` Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 3/5] stmmac: dwmac-sti: fix st,tx-retime-src check Giuseppe Cavallaro
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
This patch is to fix the csr clock in case of 300MHz is provided.
Reported-by: Kent Borg <Kent.Borg@csr.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e3d96f2..6256b32 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -185,7 +185,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
priv->clk_csr = STMMAC_CSR_100_150M;
else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M))
priv->clk_csr = STMMAC_CSR_150_250M;
- else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M))
+ else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M))
priv->clk_csr = STMMAC_CSR_250_300M;
}
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH (net.git) 3/5] stmmac: dwmac-sti: fix st,tx-retime-src check
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 1/5] stmmac: fix a filter problem after resuming Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 2/5] stmmac: fix csr clock divisor for 300MHz Giuseppe Cavallaro
@ 2015-11-26 7:35 ` Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 4/5] stmmac: fix PHY reset during resume Giuseppe Cavallaro
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
In case of the st,tx-retime-src is missing from device-tree
(it's an optional field) the driver will invoke the strcasecmp to check
which clock has been selected and this is a bug; the else condition
is needed.
In the dwmac_setup, the "rs" variable, passed to the strcasecmp, was not
initialized and the compiler, depending on the options adopted, could
take it in some different part of the stack generating the hang in such
configuration.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 7f6f4a4..58c05ac 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -299,16 +299,17 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) {
const char *rs;
+ dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
+
err = of_property_read_string(np, "st,tx-retime-src", &rs);
if (err < 0) {
dev_warn(dev, "Use internal clock source\n");
- dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
- } else if (!strcasecmp(rs, "clk_125")) {
- dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
- } else if (!strcasecmp(rs, "txclk")) {
- dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
+ } else {
+ if (!strcasecmp(rs, "clk_125"))
+ dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
+ else if (!strcasecmp(rs, "txclk"))
+ dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
}
-
dwmac->speed = SPEED_1000;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH (net.git) 4/5] stmmac: fix PHY reset during resume
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
` (2 preceding siblings ...)
2015-11-26 7:35 ` [PATCH (net.git) 3/5] stmmac: dwmac-sti: fix st,tx-retime-src check Giuseppe Cavallaro
@ 2015-11-26 7:35 ` Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 5/5] stmmac: fix oversized frame reception Giuseppe Cavallaro
2015-11-30 19:54 ` [PATCH (net.git) 0/5] Spare stmmac fixes David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro, Pankaj Dev
When stmmac_mdio_reset, was called from stmmac_resume, it was not
resetting the PHY due to which MAC was not getting reset properly and
hence ethernet interface not was resumed properly.
The issue was currently only reproducible on stih301-b2204.
Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 28 +++++++++-----------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index ebf6abc..bba670c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -138,7 +138,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
#ifdef CONFIG_OF
if (priv->device->of_node) {
- int reset_gpio, active_low;
if (data->reset_gpio < 0) {
struct device_node *np = priv->device->of_node;
@@ -154,24 +153,23 @@ int stmmac_mdio_reset(struct mii_bus *bus)
"snps,reset-active-low");
of_property_read_u32_array(np,
"snps,reset-delays-us", data->delays, 3);
- }
- reset_gpio = data->reset_gpio;
- active_low = data->active_low;
+ if (gpio_request(data->reset_gpio, "mdio-reset"))
+ return 0;
+ }
- if (!gpio_request(reset_gpio, "mdio-reset")) {
- gpio_direction_output(reset_gpio, active_low ? 1 : 0);
- if (data->delays[0])
- msleep(DIV_ROUND_UP(data->delays[0], 1000));
+ gpio_direction_output(data->reset_gpio,
+ data->active_low ? 1 : 0);
+ if (data->delays[0])
+ msleep(DIV_ROUND_UP(data->delays[0], 1000));
- gpio_set_value(reset_gpio, active_low ? 0 : 1);
- if (data->delays[1])
- msleep(DIV_ROUND_UP(data->delays[1], 1000));
+ gpio_set_value(data->reset_gpio, data->active_low ? 0 : 1);
+ if (data->delays[1])
+ msleep(DIV_ROUND_UP(data->delays[1], 1000));
- gpio_set_value(reset_gpio, active_low ? 1 : 0);
- if (data->delays[2])
- msleep(DIV_ROUND_UP(data->delays[2], 1000));
- }
+ gpio_set_value(data->reset_gpio, data->active_low ? 1 : 0);
+ if (data->delays[2])
+ msleep(DIV_ROUND_UP(data->delays[2], 1000));
}
#endif
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH (net.git) 5/5] stmmac: fix oversized frame reception
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
` (3 preceding siblings ...)
2015-11-26 7:35 ` [PATCH (net.git) 4/5] stmmac: fix PHY reset during resume Giuseppe Cavallaro
@ 2015-11-26 7:35 ` Giuseppe Cavallaro
2015-11-30 19:54 ` [PATCH (net.git) 0/5] Spare stmmac fixes David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2015-11-26 7:35 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro, Alexandre TORGUE
The receive skb buffers can be preallocated when the link is opened
according to mtu size.
While testing on a network environment with not standard MTU (e.g. 3000),
a panic occurred if an incoming packet had a length greater than rx skb
buffer size. This is because the HW is programmed to copy, from the DMA,
an Jumbo frame and the Sw must check if the allocated buffer is enough to
store the frame.
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 6256b32..3c6549a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2232,6 +2232,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
+ /* check if frame_len fits the preallocated memory */
+ if (frame_len > priv->dma_buf_sz) {
+ priv->dev->stats.rx_length_errors++;
+ break;
+ }
+
/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
* Type frames (LLC/LLC-SNAP)
*/
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH (net.git) 0/5] Spare stmmac fixes
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
` (4 preceding siblings ...)
2015-11-26 7:35 ` [PATCH (net.git) 5/5] stmmac: fix oversized frame reception Giuseppe Cavallaro
@ 2015-11-30 19:54 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-11-30 19:54 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Thu, 26 Nov 2015 08:35:40 +0100
> These are some fixes for the stmmac d.d. tested on STi platforms.
> They are for some part of the PM, STi glue and rx path when test
> Jumbo.
Series applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-11-30 19:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 7:35 [PATCH (net.git) 0/5] Spare stmmac fixes Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 1/5] stmmac: fix a filter problem after resuming Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 2/5] stmmac: fix csr clock divisor for 300MHz Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 3/5] stmmac: dwmac-sti: fix st,tx-retime-src check Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 4/5] stmmac: fix PHY reset during resume Giuseppe Cavallaro
2015-11-26 7:35 ` [PATCH (net.git) 5/5] stmmac: fix oversized frame reception Giuseppe Cavallaro
2015-11-30 19:54 ` [PATCH (net.git) 0/5] Spare stmmac fixes David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.