* [PATCH net-next 0/2] net: systemport: DMA and MAC fixes
@ 2014-05-15 21:33 Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 1/2] net: systemport: fix dma_unmap_single() len Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Florian Fainelli @ 2014-05-15 21:33 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
Hi David,
This patch series contains a critical fix in how the DMA unmapping of packet
is done, as well as a less critical fix in how we disable the Ethernet MAC
RX/TX functions.
Thanks!
Florian Fainelli (2):
net: systemport: fix dma_unmap_single() len
net: systemport: wait for packet in umac_enable_set()
drivers/net/ethernet/broadcom/bcmsysport.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: systemport: fix dma_unmap_single() len
2014-05-15 21:33 [PATCH net-next 0/2] net: systemport: DMA and MAC fixes Florian Fainelli
@ 2014-05-15 21:33 ` Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 2/2] net: systemport: wait for packet in umac_enable_set() Florian Fainelli
2014-05-16 20:42 ` [PATCH net-next 0/2] net: systemport: DMA and MAC fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2014-05-15 21:33 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
dma_unmap_single() was called with dma_unmap_len(cb, dma_len),
unfortunately we failed to assign this length field in
bcm_sysport_rx_refill() or bcm_sysport_alloc_rx_bufs() using
dma_unmap_len_set().
This causes packet contents corruption because are we not invoking the
cache invalidation routines with the proper length. Fix this by using
the full RX buffer size (RX_BUF_LENGTH) because the mappings for the RX
bufers are created with that size.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 8edc0980cdf5..26030d67518b 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -479,7 +479,7 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
cb = &priv->rx_cbs[priv->rx_read_ptr];
skb = cb->skb;
dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
- dma_unmap_len(cb, dma_len), DMA_FROM_DEVICE);
+ RX_BUF_LENGTH, DMA_FROM_DEVICE);
/* Extract the Receive Status Block prepended */
rsb = (struct rsb *)skb->data;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: systemport: wait for packet in umac_enable_set()
2014-05-15 21:33 [PATCH net-next 0/2] net: systemport: DMA and MAC fixes Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 1/2] net: systemport: fix dma_unmap_single() len Florian Fainelli
@ 2014-05-15 21:33 ` Florian Fainelli
2014-05-16 20:42 ` [PATCH net-next 0/2] net: systemport: DMA and MAC fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2014-05-15 21:33 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
When umac_enable_set() is used to disable the UniMAC receiver or
transmitter, we need to make sure that we wait for a full-sized packet
to be processed because the UniMAC hardware stops on a packet boundary,
not immediately.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 26030d67518b..d40c5b969e9e 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1244,6 +1244,12 @@ static inline void umac_enable_set(struct bcm_sysport_priv *priv,
else
reg &= ~(CMD_RX_EN | CMD_TX_EN);
umac_writel(priv, reg, UMAC_CMD);
+
+ /* UniMAC stops on a packet boundary, wait for a full-sized packet
+ * to be processed (1 msec).
+ */
+ if (enable == 0)
+ usleep_range(1000, 2000);
}
static inline int umac_reset(struct bcm_sysport_priv *priv)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] net: systemport: DMA and MAC fixes
2014-05-15 21:33 [PATCH net-next 0/2] net: systemport: DMA and MAC fixes Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 1/2] net: systemport: fix dma_unmap_single() len Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 2/2] net: systemport: wait for packet in umac_enable_set() Florian Fainelli
@ 2014-05-16 20:42 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-05-16 20:42 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 15 May 2014 14:33:51 -0700
> This patch series contains a critical fix in how the DMA unmapping of packet
> is done, as well as a less critical fix in how we disable the Ethernet MAC
> RX/TX functions.
Series applied, thanks Florian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-16 20:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-15 21:33 [PATCH net-next 0/2] net: systemport: DMA and MAC fixes Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 1/2] net: systemport: fix dma_unmap_single() len Florian Fainelli
2014-05-15 21:33 ` [PATCH net-next 2/2] net: systemport: wait for packet in umac_enable_set() Florian Fainelli
2014-05-16 20:42 ` [PATCH net-next 0/2] net: systemport: DMA and MAC fixes David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).