net: systemport: DMA and MAC fixes
Subsystems (3)
cover net: systemport: DMA and MAC fixes
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(-)
Signature · 1 line
1.9.1
PATCH 1/2 net: systemport: fix dma_unmap_single() len
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.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -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;
Signature · 1 line
1.9.1
PATCH 2/2 net: systemport: wait for packet in umac_enable_set()
In reply to Florian FainelliWhen 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.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/broadcom/bcmsysport.c +6 -0
@@ -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)
Signature · 1 line
1.9.1
David Miller
maintainerFrom: Florian Fainelli <[email protected]>
Date: Thu, 15 May 2014 14:33:51 -0700
Quoted 3 lines
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.