From: David Dillow <dave@thedillows.org>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH] net: clean up rx_copybreak handling
Date: Fri, 08 Jul 2011 21:37:49 -0400 [thread overview]
Message-ID: <1310175469.26320.9.camel@obelisk.thedillows.org> (raw)
In-Reply-To: <f73b8ed0717151cd2c72e5c23d275cc0de28d277.1310167326.git.mirq-linux@rere.qmqm.pl>
On Sat, 2011-07-09 at 01:27 +0200, Michał Mirosław wrote:
> diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
> @@ -1675,25 +1674,14 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read
>
> pkt_len = le16_to_cpu(rx->frameLen);
>
> - if(pkt_len < rx_copybreak &&
> - (new_skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
> - skb_reserve(new_skb, 2);
> - pci_dma_sync_single_for_cpu(tp->pdev, dma_addr,
> - PKT_BUF_SZ,
> - PCI_DMA_FROMDEVICE);
> - skb_copy_to_linear_data(new_skb, skb->data, pkt_len);
> - pci_dma_sync_single_for_device(tp->pdev, dma_addr,
> - PKT_BUF_SZ,
> - PCI_DMA_FROMDEVICE);
> - skb_put(new_skb, pkt_len);
> + new_skb = dev_skb_finish_rx_dma(&rxb->skb,
> + pkt_len, rx_copybreak,
> + &tp->pdev->dev, dma_addr, PKT_BUF_SZ);
Needs a few more tabs in front of the arguments. It looks like
new_skb = dev_skb_finish_rx_dma(&rxb->skb, pkt_len,
rx_copybreak, &tp->pdev->dev,
dma_addr, PKT_BUF_SZ);
would fit the style around it better.
> + if (!rxb->skb)
> typhoon_recycle_rx_skb(tp, idx);
I think you either meant
if (rxb->skb)
typhoon_recycle_rx_skb(tp, idx);
or to swap typhoon_{recycle,alloc}_rx_skb(). As it stands, you'll reload
the NIC with a NULL skb pointer, and it will DMA to the old location
when it eventually uses this descriptor.
> - } else {
> - new_skb = skb;
> - skb_put(new_skb, pkt_len);
> - pci_unmap_single(tp->pdev, dma_addr, PKT_BUF_SZ,
> - PCI_DMA_FROMDEVICE);
> + else
> typhoon_alloc_rx_skb(tp, idx);
next prev parent reply other threads:[~2011-07-09 1:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-08 23:27 [RFC PATCH] net: clean up rx_copybreak handling Michał Mirosław
2011-07-09 1:37 ` David Dillow [this message]
2011-07-09 8:54 ` Michał Mirosław
2011-07-09 9:57 ` David Miller
2011-07-09 10:44 ` Michał Mirosław
2011-07-09 10:47 ` [PATCH] net: wrap common patterns of rx handler code Michał Mirosław
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310175469.26320.9.camel@obelisk.thedillows.org \
--to=dave@thedillows.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).