2016-12-18 20:38:17

by Pavel Machek

[permalink] [raw]
Subject: [PATCH] stmmac: fix memory barriers


Fix up memory barriers in stmmac driver. They are meant to protect
against DMA engine, so smp_ variants are certainly wrong, and dma_
variants are preferable.

Signed-off-by: Pavel Machek <[email protected]>

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index a340fc8..8816515 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -334,7 +334,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
* descriptors for the same frame has to be set before, to
* avoid race condition.
*/
- wmb();
+ dma_wmb();

p->des3 = cpu_to_le32(tdes3);
}
@@ -377,7 +377,7 @@ static void dwmac4_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
* descriptors for the same frame has to be set before, to
* avoid race condition.
*/
- wmb();
+ dma_wmb();

p->des3 = cpu_to_le32(tdes3);
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index ce97e52..f0d8632 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -350,7 +350,7 @@ static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
* descriptors for the same frame has to be set before, to
* avoid race condition.
*/
- wmb();
+ dma_wmb();

p->des0 = cpu_to_le32(tdes0);
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3e40578..bb40382 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2125,7 +2125,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
* descriptor and then barrier is needed to make sure that
* all is coherent before granting the DMA engine.
*/
- smp_wmb();
+ dma_wmb();

if (netif_msg_pktdata(priv)) {
pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
@@ -2338,7 +2338,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
* descriptor and then barrier is needed to make sure that
* all is coherent before granting the DMA engine.
*/
- smp_wmb();
+ dma_wmb();
}

netdev_sent_queue(dev, skb->len);
@@ -2443,14 +2443,14 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
netif_dbg(priv, rx_status, priv->dev,
"refill entry #%d\n", entry);
}
- wmb();
+ dma_wmb();

if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0);
else
priv->hw->desc->set_rx_owner(p);

- wmb();
+ dma_wmb();

entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
}

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (2.88 kB)
signature.asc (181.00 B)
Digital signature
Download all attachments

2016-12-19 15:08:24

by Niklas Cassel

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers

Tested-by: Niklas Cassel <[email protected]>

On 12/18/2016 09:38 PM, Pavel Machek wrote:
> Fix up memory barriers in stmmac driver. They are meant to protect
> against DMA engine, so smp_ variants are certainly wrong, and dma_
> variants are preferable.
>
> Signed-off-by: Pavel Machek <[email protected]>
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> index a340fc8..8816515 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> @@ -334,7 +334,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des3 = cpu_to_le32(tdes3);
> }
> @@ -377,7 +377,7 @@ static void dwmac4_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des3 = cpu_to_le32(tdes3);
> }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> index ce97e52..f0d8632 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> @@ -350,7 +350,7 @@ static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des0 = cpu_to_le32(tdes0);
> }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3e40578..bb40382 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2125,7 +2125,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
> * descriptor and then barrier is needed to make sure that
> * all is coherent before granting the DMA engine.
> */
> - smp_wmb();
> + dma_wmb();
>
> if (netif_msg_pktdata(priv)) {
> pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
> @@ -2338,7 +2338,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
> * descriptor and then barrier is needed to make sure that
> * all is coherent before granting the DMA engine.
> */
> - smp_wmb();
> + dma_wmb();
> }
>
> netdev_sent_queue(dev, skb->len);
> @@ -2443,14 +2443,14 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
> netif_dbg(priv, rx_status, priv->dev,
> "refill entry #%d\n", entry);
> }
> - wmb();
> + dma_wmb();
>
> if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
> priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0);
> else
> priv->hw->desc->set_rx_owner(p);
>
> - wmb();
> + dma_wmb();
>
> entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
> }
>

2016-12-19 15:37:27

by Peppe CAVALLARO

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers

On 12/18/2016 9:38 PM, Pavel Machek wrote:
>
> Fix up memory barriers in stmmac driver. They are meant to protect
> against DMA engine, so smp_ variants are certainly wrong, and dma_
> variants are preferable.
>
> Signed-off-by: Pavel Machek <[email protected]>

Acked-by: Giuseppe Cavallaro <[email protected]>

>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> index a340fc8..8816515 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> @@ -334,7 +334,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des3 = cpu_to_le32(tdes3);
> }
> @@ -377,7 +377,7 @@ static void dwmac4_rd_prepare_tso_tx_desc(struct dma_desc *p, int is_fs,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des3 = cpu_to_le32(tdes3);
> }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> index ce97e52..f0d8632 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> @@ -350,7 +350,7 @@ static void enh_desc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
> * descriptors for the same frame has to be set before, to
> * avoid race condition.
> */
> - wmb();
> + dma_wmb();
>
> p->des0 = cpu_to_le32(tdes0);
> }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3e40578..bb40382 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2125,7 +2125,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
> * descriptor and then barrier is needed to make sure that
> * all is coherent before granting the DMA engine.
> */
> - smp_wmb();
> + dma_wmb();
>
> if (netif_msg_pktdata(priv)) {
> pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
> @@ -2338,7 +2338,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
> * descriptor and then barrier is needed to make sure that
> * all is coherent before granting the DMA engine.
> */
> - smp_wmb();
> + dma_wmb();
> }
>
> netdev_sent_queue(dev, skb->len);
> @@ -2443,14 +2443,14 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
> netif_dbg(priv, rx_status, priv->dev,
> "refill entry #%d\n", entry);
> }
> - wmb();
> + dma_wmb();
>
> if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
> priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0);
> else
> priv->hw->desc->set_rx_owner(p);
>
> - wmb();
> + dma_wmb();
>
> entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
> }
>

2016-12-19 16:07:23

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers

From: Pavel Machek <[email protected]>
Date: Sun, 18 Dec 2016 21:38:12 +0100

> Fix up memory barriers in stmmac driver. They are meant to protect
> against DMA engine, so smp_ variants are certainly wrong, and dma_
> variants are preferable.
>
> Signed-off-by: Pavel Machek <[email protected]>

Applied.

2016-12-19 17:10:25

by Joao Pinto

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers

Hi,

I am trying to built net-next git tree and it is failing:

CC drivers/pnp/card.o
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function
?stmmac_hw_fix_mac_speed?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:224:34: error: ?struct
stmmac_priv? has no member named ?phydev?
struct phy_device *phydev = priv->phydev;
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_eee_init?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:298:24: error: ?struct
stmmac_priv? has no member named ?phydev?
if (phy_init_eee(priv->phydev, 1)) {
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:330:44: error: ?struct
stmmac_priv? has no member named ?phydev?
priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:672:2: error: void value not
ignored as it ought to be
return stmmac_ptp_register(priv);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_adjust_link?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:694:34: error: ?struct
stmmac_priv? has no member named ?phydev?
struct phy_device *phydev = priv->phydev;
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_phy?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:884:6: error: ?struct
stmmac_priv? has no member named ?phydev?
priv->phydev = phydev;
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_open?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1810:10: error: ?struct
stmmac_priv? has no member named ?phydev?
if (priv->phydev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1811:17: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_start(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1858:10: error: ?struct
stmmac_priv? has no member named ?phydev?
if (priv->phydev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1859:22: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_disconnect(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_release?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1878:10: error: ?struct
stmmac_priv? has no member named ?phydev?
if (priv->phydev) {
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1879:16: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_stop(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1880:22: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_disconnect(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1881:7: error: ?struct
stmmac_priv? has no member named ?phydev?
priv->phydev = NULL;
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_ioctl?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2883:12: error: ?struct
stmmac_priv? has no member named ?phydev?
if (!priv->phydev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2885:27: error: ?struct
stmmac_priv? has no member named ?phydev?
ret = phy_mii_ioctl(priv->phydev, rq, cmd);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_suspend?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3438:10: error: ?struct
stmmac_priv? has no member named ?phydev?
if (priv->phydev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3439:16: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_stop(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_resume?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3533:10: error: ?struct
stmmac_priv? has no member named ?phydev?
if (priv->phydev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3534:17: error: ?struct
stmmac_priv? has no member named ?phydev?
phy_start(priv->phydev);
^
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:673:1: warning: control
reaches end of non-void function [-Wreturn-type]
}
^
CC drivers/pnp/driver.o
make[5]: *** [drivers/net/ethernet/stmicro/stmmac/stmmac_main.o] Error 1
make[4]: *** [drivers/net/ethernet/stmicro/stmmac] Error 2
make[3]: *** [drivers/net/ethernet/stmicro] Error 2
make[3]: *** Waiting for unfinished jobs....
CC drivers/pnp/resource.o

Thanks,
Joao

?s 4:06 PM de 12/19/2016, David Miller escreveu:
> From: Pavel Machek <[email protected]>
> Date: Sun, 18 Dec 2016 21:38:12 +0100
>
>> Fix up memory barriers in stmmac driver. They are meant to protect
>> against DMA engine, so smp_ variants are certainly wrong, and dma_
>> variants are preferable.
>>
>> Signed-off-by: Pavel Machek <[email protected]>
>
> Applied.
>

2016-12-19 17:19:25

by Niklas Cassel

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers

On 12/19/2016 06:10 PM, Joao Pinto wrote:
> Hi,
>
> I am trying to built net-next git tree and it is failing:
>
> CC drivers/pnp/card.o
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function
> ?stmmac_hw_fix_mac_speed?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:224:34: error: ?struct
> stmmac_priv? has no member named ?phydev?
> struct phy_device *phydev = priv->phydev;

Are you really building net-next?
http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c#n224

The phy_device initializer does not appear to match your output.

> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_eee_init?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:298:24: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (phy_init_eee(priv->phydev, 1)) {
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:330:44: error: ?struct
> stmmac_priv? has no member named ?phydev?
> priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:672:2: error: void value not
> ignored as it ought to be
> return stmmac_ptp_register(priv);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_adjust_link?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:694:34: error: ?struct
> stmmac_priv? has no member named ?phydev?
> struct phy_device *phydev = priv->phydev;
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_phy?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:884:6: error: ?struct
> stmmac_priv? has no member named ?phydev?
> priv->phydev = phydev;
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_open?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1810:10: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (priv->phydev)
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1811:17: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_start(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1858:10: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (priv->phydev)
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1859:22: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_disconnect(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_release?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1878:10: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (priv->phydev) {
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1879:16: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_stop(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1880:22: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_disconnect(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1881:7: error: ?struct
> stmmac_priv? has no member named ?phydev?
> priv->phydev = NULL;
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_ioctl?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2883:12: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (!priv->phydev)
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2885:27: error: ?struct
> stmmac_priv? has no member named ?phydev?
> ret = phy_mii_ioctl(priv->phydev, rq, cmd);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_suspend?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3438:10: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (priv->phydev)
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3439:16: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_stop(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_resume?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3533:10: error: ?struct
> stmmac_priv? has no member named ?phydev?
> if (priv->phydev)
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3534:17: error: ?struct
> stmmac_priv? has no member named ?phydev?
> phy_start(priv->phydev);
> ^
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:673:1: warning: control
> reaches end of non-void function [-Wreturn-type]
> }
> ^
> CC drivers/pnp/driver.o
> make[5]: *** [drivers/net/ethernet/stmicro/stmmac/stmmac_main.o] Error 1
> make[4]: *** [drivers/net/ethernet/stmicro/stmmac] Error 2
> make[3]: *** [drivers/net/ethernet/stmicro] Error 2
> make[3]: *** Waiting for unfinished jobs....
> CC drivers/pnp/resource.o
>
> Thanks,
> Joao
>
> ?s 4:06 PM de 12/19/2016, David Miller escreveu:
>> From: Pavel Machek <[email protected]>
>> Date: Sun, 18 Dec 2016 21:38:12 +0100
>>
>>> Fix up memory barriers in stmmac driver. They are meant to protect
>>> against DMA engine, so smp_ variants are certainly wrong, and dma_
>>> variants are preferable.
>>>
>>> Signed-off-by: Pavel Machek <[email protected]>
>> Applied.
>>

2016-12-19 17:25:22

by Joao Pinto

[permalink] [raw]
Subject: Re: [PATCH] stmmac: fix memory barriers



?s 5:19 PM de 12/19/2016, Niklas Cassel escreveu:
> On 12/19/2016 06:10 PM, Joao Pinto wrote:
>> Hi,
>>
>> I am trying to built net-next git tree and it is failing:
>>
>> CC drivers/pnp/card.o
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function
>> ?stmmac_hw_fix_mac_speed?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:224:34: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> struct phy_device *phydev = priv->phydev;
>
> Are you really building net-next?
> https://urldefense.proofpoint.com/v2/url?u=http-3A__git.kernel.org_cgit_linux_kernel_git_davem_net-2Dnext.git_tree_drivers_net_ethernet_stmicro_stmmac_stmmac-5Fmain.c-23n224&d=DgID-g&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=4j4xIgbdV5gZT6wNKZXizwY4xE3ZoFeyGzRKeNvDsN0&s=vY4rQn8skcuhsdzk3vdZEyYF2TL8r5Dxc0gDGRjqLTQ&e=
>
> The phy_device initializer does not appear to match your output.

Spookie! The fetch process left half merge! I will try it again! Thanks!

>
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_eee_init?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:298:24: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (phy_init_eee(priv->phydev, 1)) {
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:330:44: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:672:2: error: void value not
>> ignored as it ought to be
>> return stmmac_ptp_register(priv);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_adjust_link?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:694:34: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> struct phy_device *phydev = priv->phydev;
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_phy?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:884:6: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> priv->phydev = phydev;
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_open?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1810:10: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (priv->phydev)
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1811:17: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_start(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1858:10: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (priv->phydev)
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1859:22: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_disconnect(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_release?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1878:10: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (priv->phydev) {
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1879:16: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_stop(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1880:22: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_disconnect(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1881:7: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> priv->phydev = NULL;
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_ioctl?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2883:12: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (!priv->phydev)
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2885:27: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> ret = phy_mii_ioctl(priv->phydev, rq, cmd);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_suspend?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3438:10: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (priv->phydev)
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3439:16: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_stop(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_resume?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3533:10: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> if (priv->phydev)
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3534:17: error: ?struct
>> stmmac_priv? has no member named ?phydev?
>> phy_start(priv->phydev);
>> ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function ?stmmac_init_ptp?:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:673:1: warning: control
>> reaches end of non-void function [-Wreturn-type]
>> }
>> ^
>> CC drivers/pnp/driver.o
>> make[5]: *** [drivers/net/ethernet/stmicro/stmmac/stmmac_main.o] Error 1
>> make[4]: *** [drivers/net/ethernet/stmicro/stmmac] Error 2
>> make[3]: *** [drivers/net/ethernet/stmicro] Error 2
>> make[3]: *** Waiting for unfinished jobs....
>> CC drivers/pnp/resource.o
>>
>> Thanks,
>> Joao
>>
>> ?s 4:06 PM de 12/19/2016, David Miller escreveu:
>>> From: Pavel Machek <[email protected]>
>>> Date: Sun, 18 Dec 2016 21:38:12 +0100
>>>
>>>> Fix up memory barriers in stmmac driver. They are meant to protect
>>>> against DMA engine, so smp_ variants are certainly wrong, and dma_
>>>> variants are preferable.
>>>>
>>>> Signed-off-by: Pavel Machek <[email protected]>
>>> Applied.
>>>
>