Hi Rafał:
Should this:
/* Poison the old skb */
rx->len = cpu_to_le16(0xdead);
rx->flags = cpu_to_le16(0xbeef);
Be moved to here:
/* Make the header back accessible to the hardware */
if (resync_skb) {
/* Poison the header */
rx->len = cpu_to_le16(0xdead);
rx->flags = cpu_to_le16(0xbeef);
dma_sync_single_for_device(dma_dev, slot->dma_addr,
sizeof(struct bgmac_rx_header), DMA_FROM_DEVICE);
}
There's another path through the code that will get you here (if the allocation
for the new skb fails).
Also, in bgmac_dma_rx_skb_for_slot, should't it only update the "slot->skb" if
the allocation of the skb was successful? If the allocation fails,
bgmac_dma_rx_read continues on as if the old skb is still being used; but the
slot->skb has been overwritten with a null pointer.
Nathan
----------------------------------------
> Date: Sun, 11 Aug 2013 22:11:01 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [OpenWrt-Devel] [RFC][PATCH 2/2] bgmac: pass received packet to
> the netif instead of copying it
>
> 2013/8/11 Nathan Hintz <[email protected]>:
>> Is there a penalty in synchronizing (DMA) more of the buffer than is needed?
>> Here's a modified version of the patch that mostly eliminates the unneeded
>> synchronization (there is another 24 bytes of pad in the RX header that
>> could be eliminated - in both directions); this hasn't been tested in any
>> way (not even compiled)
>
> Nice trick, I didn't think about it. Will give it a try.
>
> --
> Rafał
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel