Skip to content

Commit 908b637

Browse files
ralfbaechleJeff Garzik
authored andcommitted
Alignment in mv643xx_eth
The driver contains this little piece of candy: #if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_NOT_COHERENT_CACHE) #define ETH_DMA_ALIGN L1_CACHE_BYTES #else #define ETH_DMA_ALIGN 8 #endif Any reason why we're not using dma_get_cache_alignment() instead? Ralf Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent 92b0c4e commit 908b637

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

drivers/net/mv643xx_eth.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ static void mv643xx_eth_rx_refill_descs(struct net_device *dev)
147147
int unaligned;
148148

149149
while (mp->rx_desc_count < mp->rx_ring_size) {
150-
skb = dev_alloc_skb(ETH_RX_SKB_SIZE + ETH_DMA_ALIGN);
150+
skb = dev_alloc_skb(ETH_RX_SKB_SIZE + dma_get_cache_alignment());
151151
if (!skb)
152152
break;
153153
mp->rx_desc_count++;
154-
unaligned = (u32)skb->data & (ETH_DMA_ALIGN - 1);
154+
unaligned = (u32)skb->data & (dma_get_cache_alignment() - 1);
155155
if (unaligned)
156-
skb_reserve(skb, ETH_DMA_ALIGN - unaligned);
156+
skb_reserve(skb, dma_get_cache_alignment() - unaligned);
157157
pkt_info.cmd_sts = ETH_RX_ENABLE_INTERRUPT;
158158
pkt_info.byte_cnt = ETH_RX_SKB_SIZE;
159159
pkt_info.buf_ptr = dma_map_single(NULL, skb->data,

drivers/net/mv643xx_eth.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,6 @@
4242
#define MAX_DESCS_PER_SKB 1
4343
#endif
4444

45-
/*
46-
* The MV643XX HW requires 8-byte alignment. However, when I/O
47-
* is non-cache-coherent, we need to ensure that the I/O buffers
48-
* we use don't share cache lines with other data.
49-
*/
50-
#if defined(CONFIG_DMA_NONCOHERENT) || defined(CONFIG_NOT_COHERENT_CACHE)
51-
#define ETH_DMA_ALIGN L1_CACHE_BYTES
52-
#else
53-
#define ETH_DMA_ALIGN 8
54-
#endif
55-
5645
#define ETH_VLAN_HLEN 4
5746
#define ETH_FCS_LEN 4
5847
#define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */

0 commit comments

Comments
 (0)