* [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
@ 2017-02-09 0:07 Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 1/2] net: ethernet: ti: cpsw: fix cpsw assignment in resume Ivan Khoronzhuk
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Ivan Khoronzhuk @ 2017-02-09 0:07 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
AStarikovskiy, Ivan Khoronzhuk
These two patches fix suspend/resume chain.
Ivan Khoronzhuk (2):
net: ethernet: ti: cpsw: fix cpsw assignment in resume
net: ethernet: ti: cpsw: fix resume because of usage count
drivers/net/ethernet/ti/cpsw.c | 44 +++++++++++++-----------------------------
1 file changed, 13 insertions(+), 31 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] net: ethernet: ti: cpsw: fix cpsw assignment in resume
2017-02-09 0:07 [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume Ivan Khoronzhuk
@ 2017-02-09 0:07 ` Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix resume because of usage count Ivan Khoronzhuk
2017-02-09 22:21 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume David Miller
2 siblings, 0 replies; 9+ messages in thread
From: Ivan Khoronzhuk @ 2017-02-09 0:07 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
AStarikovskiy, Ivan Khoronzhuk
There is a copy-paste error, which hides breaking of resume
for CPSW driver: there was replaced netdev_priv() to ndev_to_cpsw(ndev)
in suspend, but left it unchanged in resume.
Fixes: 606f39939595a4d4540406bfc11f265b2036af6d
(ti: cpsw: move platform data and slaves info to cpsw_common)
Reported-by: Alexey Starikovskiy <AStarikovskiy@topcon.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 4d1c0c3..9714fab 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -3225,7 +3225,7 @@ static int cpsw_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev = platform_get_drvdata(pdev);
- struct cpsw_common *cpsw = netdev_priv(ndev);
+ struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
/* Select default pin state */
pinctrl_pm_select_default_state(dev);
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] net: ethernet: ti: cpsw: fix resume because of usage count
2017-02-09 0:07 [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 1/2] net: ethernet: ti: cpsw: fix cpsw assignment in resume Ivan Khoronzhuk
@ 2017-02-09 0:07 ` Ivan Khoronzhuk
2017-02-09 22:21 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume David Miller
2 siblings, 0 replies; 9+ messages in thread
From: Ivan Khoronzhuk @ 2017-02-09 0:07 UTC (permalink / raw)
To: mugunthanvnm
Cc: grygorii.strashko, netdev, linux-omap, linux-kernel,
AStarikovskiy, Ivan Khoronzhuk
The usage count function is based on ndev_running flag that is
updated before calling ndo_open/close, but if ndo is called in
another place, in this case in suspend/resume, the counter is not
changed, that breaks sus/resume. For common resource no difference
which device is using it, does matter only device count. So, replace
usage count function on var and inc and dec it in ndo_open/close.
Fixes: 03fd01ad0eead23eb79294b6fb4d71dcac493855
"net: ethernet: ti: cpsw: don't duplicate ndev_running"
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 42 ++++++++++++------------------------------
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 9714fab..1ffaad1 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -399,6 +399,7 @@ struct cpsw_common {
struct cpts *cpts;
int rx_ch_num, tx_ch_num;
int speed;
+ int usage_count;
};
struct cpsw_priv {
@@ -671,18 +672,6 @@ static void cpsw_intr_disable(struct cpsw_common *cpsw)
return;
}
-static int cpsw_get_usage_count(struct cpsw_common *cpsw)
-{
- u32 i;
- u32 usage_count = 0;
-
- for (i = 0; i < cpsw->data.slaves; i++)
- if (cpsw->slaves[i].ndev && netif_running(cpsw->slaves[i].ndev))
- usage_count++;
-
- return usage_count;
-}
-
static void cpsw_tx_handler(void *token, int len, int status)
{
struct netdev_queue *txq;
@@ -716,8 +705,7 @@ static void cpsw_rx_handler(void *token, int len, int status)
if (unlikely(status < 0) || unlikely(!netif_running(ndev))) {
/* In dual emac mode check for all interfaces */
- if (cpsw->data.dual_emac &&
- cpsw_get_usage_count(cpsw) &&
+ if (cpsw->data.dual_emac && cpsw->usage_count &&
(status >= 0)) {
/* The packet received is for the interface which
* is already down and the other interface is up
@@ -1492,11 +1480,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
CPSW_MAJOR_VERSION(reg), CPSW_MINOR_VERSION(reg),
CPSW_RTL_VERSION(reg));
- /* Initialize host and slave ports.
- * Given ndev is marked as opened already, so init port only if 1 ndev
- * is opened
- */
- if (cpsw_get_usage_count(cpsw) < 2)
+ /* Initialize host and slave ports */
+ if (!cpsw->usage_count)
cpsw_init_host_port(priv);
for_each_slave(priv, cpsw_slave_open, priv);
@@ -1507,10 +1492,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpsw_ale_add_vlan(cpsw->ale, cpsw->data.default_vlan,
ALE_ALL_PORTS, ALE_ALL_PORTS, 0, 0);
- /* Given ndev is marked as opened already, so if more ndev
- * are opened - no need to init shared resources.
- */
- if (cpsw_get_usage_count(cpsw) < 2) {
+ /* initialize shared resources for every ndev */
+ if (!cpsw->usage_count) {
/* disable priority elevation */
__raw_writel(0, &cpsw->regs->ptype);
@@ -1552,6 +1535,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
cpdma_ctlr_start(cpsw->dma);
cpsw_intr_enable(cpsw);
+ cpsw->usage_count++;
return 0;
@@ -1572,10 +1556,7 @@ static int cpsw_ndo_stop(struct net_device *ndev)
netif_tx_stop_all_queues(priv->ndev);
netif_carrier_off(priv->ndev);
- /* Given ndev is marked as close already,
- * so disable shared resources if no open devices
- */
- if (!cpsw_get_usage_count(cpsw)) {
+ if (cpsw->usage_count <= 1) {
napi_disable(&cpsw->napi_rx);
napi_disable(&cpsw->napi_tx);
cpts_unregister(cpsw->cpts);
@@ -1588,6 +1569,7 @@ static int cpsw_ndo_stop(struct net_device *ndev)
if (cpsw_need_resplit(cpsw))
cpsw_split_res(ndev);
+ cpsw->usage_count--;
pm_runtime_put_sync(cpsw->dev);
return 0;
}
@@ -2393,7 +2375,7 @@ static int cpsw_resume_data_pass(struct net_device *ndev)
netif_dormant_off(slave->ndev);
/* After this receive is started */
- if (cpsw_get_usage_count(cpsw)) {
+ if (cpsw->usage_count) {
ret = cpsw_fill_rx_channels(priv);
if (ret)
return ret;
@@ -2447,7 +2429,7 @@ static int cpsw_set_channels(struct net_device *ndev,
}
}
- if (cpsw_get_usage_count(cpsw))
+ if (cpsw->usage_count)
cpsw_split_res(ndev);
ret = cpsw_resume_data_pass(ndev);
@@ -2529,7 +2511,7 @@ static int cpsw_set_ringparam(struct net_device *ndev,
cpdma_set_num_rx_descs(cpsw->dma, ering->rx_pending);
- if (cpsw_get_usage_count(cpsw))
+ if (cpsw->usage_count)
cpdma_chan_split_pool(cpsw->dma);
ret = cpsw_resume_data_pass(ndev);
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
2017-02-09 0:07 [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 1/2] net: ethernet: ti: cpsw: fix cpsw assignment in resume Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix resume because of usage count Ivan Khoronzhuk
@ 2017-02-09 22:21 ` David Miller
2017-02-09 22:54 ` Ivan Khoronzhuk
2 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2017-02-09 22:21 UTC (permalink / raw)
To: ivan.khoronzhuk
Cc: mugunthanvnm, grygorii.strashko, netdev, linux-omap,
linux-kernel, AStarikovskiy
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Thu, 9 Feb 2017 02:07:34 +0200
> These two patches fix suspend/resume chain.
Patch 2 doesn't apply cleanly to the 'net' tree, please
respin this series.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
2017-02-09 22:21 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume David Miller
@ 2017-02-09 22:54 ` Ivan Khoronzhuk
2017-02-10 1:45 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Ivan Khoronzhuk @ 2017-02-09 22:54 UTC (permalink / raw)
To: David Miller
Cc: mugunthanvnm, grygorii.strashko, netdev, linux-omap,
linux-kernel, AStarikovskiy
On Thu, Feb 09, 2017 at 05:21:26PM -0500, David Miller wrote:
> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> Date: Thu, 9 Feb 2017 02:07:34 +0200
>
> > These two patches fix suspend/resume chain.
>
> Patch 2 doesn't apply cleanly to the 'net' tree, please
> respin this series.
Strange, I've just checked it on net-next/master, it was applied w/o any
warnings.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
2017-02-09 22:54 ` Ivan Khoronzhuk
@ 2017-02-10 1:45 ` David Miller
2017-02-10 18:05 ` Grygorii Strashko
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2017-02-10 1:45 UTC (permalink / raw)
To: ivan.khoronzhuk
Cc: mugunthanvnm, grygorii.strashko, netdev, linux-omap,
linux-kernel, AStarikovskiy
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Fri, 10 Feb 2017 00:54:24 +0200
> On Thu, Feb 09, 2017 at 05:21:26PM -0500, David Miller wrote:
>> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>> Date: Thu, 9 Feb 2017 02:07:34 +0200
>>
>> > These two patches fix suspend/resume chain.
>>
>> Patch 2 doesn't apply cleanly to the 'net' tree, please
>> respin this series.
>
> Strange, I've just checked it on net-next/master, it was applied w/o any
> warnings.
It makes no sense to test "net-next" when I am telling you that it is
the "net" tree it doesn't apply to.
This is a bug fix, so it should be targetting the "net" tree.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
2017-02-10 1:45 ` David Miller
@ 2017-02-10 18:05 ` Grygorii Strashko
0 siblings, 0 replies; 9+ messages in thread
From: Grygorii Strashko @ 2017-02-10 18:05 UTC (permalink / raw)
To: David Miller, ivan.khoronzhuk
Cc: mugunthanvnm, netdev, linux-omap, linux-kernel, AStarikovskiy
On 02/09/2017 07:45 PM, David Miller wrote:
> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> Date: Fri, 10 Feb 2017 00:54:24 +0200
>
>> On Thu, Feb 09, 2017 at 05:21:26PM -0500, David Miller wrote:
>>> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>>> Date: Thu, 9 Feb 2017 02:07:34 +0200
>>>
>>>> These two patches fix suspend/resume chain.
>>>
>>> Patch 2 doesn't apply cleanly to the 'net' tree, please
>>> respin this series.
>>
>> Strange, I've just checked it on net-next/master, it was applied w/o any
>> warnings.
>
> It makes no sense to test "net-next" when I am telling you that it is
> the "net" tree it doesn't apply to.
>
> This is a bug fix, so it should be targetting the "net" tree.
>
Looks like the first fix is for net, but the second one is for net-next
I do not see
03fd01ad0eead23eb79294b6fb4d71dcac493855
"net: ethernet: ti: cpsw: don't duplicate ndev_running"
in net.
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
@ 2017-02-10 18:05 ` Grygorii Strashko
0 siblings, 0 replies; 9+ messages in thread
From: Grygorii Strashko @ 2017-02-10 18:05 UTC (permalink / raw)
To: David Miller, ivan.khoronzhuk
Cc: mugunthanvnm, netdev, linux-omap, linux-kernel, AStarikovskiy
On 02/09/2017 07:45 PM, David Miller wrote:
> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> Date: Fri, 10 Feb 2017 00:54:24 +0200
>
>> On Thu, Feb 09, 2017 at 05:21:26PM -0500, David Miller wrote:
>>> From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>>> Date: Thu, 9 Feb 2017 02:07:34 +0200
>>>
>>>> These two patches fix suspend/resume chain.
>>>
>>> Patch 2 doesn't apply cleanly to the 'net' tree, please
>>> respin this series.
>>
>> Strange, I've just checked it on net-next/master, it was applied w/o any
>> warnings.
>
> It makes no sense to test "net-next" when I am telling you that it is
> the "net" tree it doesn't apply to.
>
> This is a bug fix, so it should be targetting the "net" tree.
>
Looks like the first fix is for net, but the second one is for net-next
I do not see
03fd01ad0eead23eb79294b6fb4d71dcac493855
"net: ethernet: ti: cpsw: don't duplicate ndev_running"
in net.
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume
2017-02-10 18:05 ` Grygorii Strashko
(?)
@ 2017-02-11 0:01 ` Ivan Khoronzhuk
-1 siblings, 0 replies; 9+ messages in thread
From: Ivan Khoronzhuk @ 2017-02-11 0:01 UTC (permalink / raw)
To: Grygorii Strashko
Cc: David Miller, mugunthanvnm, netdev, linux-omap, linux-kernel,
AStarikovskiy
On Fri, Feb 10, 2017 at 12:05:07PM -0600, Grygorii Strashko wrote:
>
>
> On 02/09/2017 07:45 PM, David Miller wrote:
> >From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> >Date: Fri, 10 Feb 2017 00:54:24 +0200
> >
> >>On Thu, Feb 09, 2017 at 05:21:26PM -0500, David Miller wrote:
> >>>From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> >>>Date: Thu, 9 Feb 2017 02:07:34 +0200
> >>>
> >>>>These two patches fix suspend/resume chain.
> >>>
> >>>Patch 2 doesn't apply cleanly to the 'net' tree, please
> >>>respin this series.
> >>
> >>Strange, I've just checked it on net-next/master, it was applied w/o any
> >>warnings.
> >
> >It makes no sense to test "net-next" when I am telling you that it is
> >the "net" tree it doesn't apply to.
> >
> >This is a bug fix, so it should be targetting the "net" tree.
> >
>
> Looks like the first fix is for net, but the second one is for net-next
> I do not see
> 03fd01ad0eead23eb79294b6fb4d71dcac493855
> "net: ethernet: ti: cpsw: don't duplicate ndev_running"
> in net.
There is dependency, both for net-next and only first is for net tree
>
> --
> regards,
> -grygorii
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-02-11 1:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 0:07 [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 1/2] net: ethernet: ti: cpsw: fix cpsw assignment in resume Ivan Khoronzhuk
2017-02-09 0:07 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix resume because of usage count Ivan Khoronzhuk
2017-02-09 22:21 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix susp/resume David Miller
2017-02-09 22:54 ` Ivan Khoronzhuk
2017-02-10 1:45 ` David Miller
2017-02-10 18:05 ` Grygorii Strashko
2017-02-10 18:05 ` Grygorii Strashko
2017-02-11 0:01 ` Ivan Khoronzhuk
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.