Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da95b2d4 authored by Simon Kagstrom's avatar Simon Kagstrom Committed by David S. Miller
Browse files

via-velocity: Correct 64-byte alignment for rx buffers



(From the VIA driver). The current code does not guarantee 64-byte
alignment since it simply does

        int add = skb->data & 63;

        skb->data += add;

(via skb_reserve). So for example, if the skb->data address would be
0x10, this would result in 32-byte alignment (0x10 + 0x10).

Correct by adding

        64 - (skb->data & 63)

instead.

Signed-off-by: default avatarSimon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 350f7596
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1470,7 +1470,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
	 *	Do the gymnastics to get the buffer head for data at
	 *	64byte alignment.
	 */
	skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->data & 63);
	skb_reserve(rd_info->skb,
			64 - ((unsigned long) rd_info->skb->data & 63));
	rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data,
					vptr->rx.buf_sz, PCI_DMA_FROMDEVICE);