From: Wang Chen <wangchen@cn•fujitsu.com>
To: Stephen Hemminger <shemminger@vyatta•com>
Cc: Jeff Garzik <jgarzik@pobox•com>,
Francois Romieu <romieu@fr•zoreil.com>,
netdev@vger•kernel.org
Subject: Re: [PATCH 06/13] sis190: use netdev_alloc_skb
Date: Thu, 17 Apr 2008 09:04:55 +0800 [thread overview]
Message-ID: <4806A237.2060601@cn.fujitsu.com> (raw)
In-Reply-To: <20080416233757.391517921@vyatta.com>
Stephen Hemminger said the following on 2008-4-17 7:37:
> Use netdev_alloc_skb. This sets skb->dev and allows arch specific
> allocation.
>
> Compile tested only.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
>
> --- a/drivers/net/sis190.c 2008-04-16 15:21:05.000000000 -0700
> +++ b/drivers/net/sis190.c 2008-04-16 16:31:30.000000000 -0700
> @@ -480,30 +480,28 @@ static inline void sis190_make_unusable_
> desc->status = 0x0;
> }
>
> -static int sis190_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
> - struct RxDesc *desc, u32 rx_buf_sz)
> +static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev,
> + struct net_device *dev,
> + struct RxDesc *desc, u32 rx_buf_sz)
> {
> struct sk_buff *skb;
> dma_addr_t mapping;
> int ret = 0;
>
ret no longer be used.
> - skb = dev_alloc_skb(rx_buf_sz);
> + skb = netdev_alloc_skb(dev, rx_buf_sz);
> if (!skb)
> goto err_out;
>
> - *sk_buff = skb;
> -
> mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
> PCI_DMA_FROMDEVICE);
>
> sis190_map_to_asic(desc, mapping, rx_buf_sz);
> -out:
> - return ret;
> + return skb;
>
> err_out:
> ret = -ENOMEM;
ret no longer be used.
> sis190_make_unusable_by_asic(desc);
> - goto out;
> + return NULL;
> }
>
> static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
> @@ -512,30 +510,32 @@ static u32 sis190_rx_fill(struct sis190_
> u32 cur;
>
> for (cur = start; cur < end; cur++) {
> - int ret, i = cur % NUM_RX_DESC;
> + int i = cur % NUM_RX_DESC;
>
> if (tp->Rx_skbuff[i])
> continue;
>
> - ret = sis190_alloc_rx_skb(tp->pci_dev, tp->Rx_skbuff + i,
> - tp->RxDescRing + i, tp->rx_buf_sz);
> - if (ret < 0)
> + tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev, dev,
> + tp->RxDescRing + i,
> + tp->rx_buf_sz);
> + if (!tp->Rx_skbuff[i])
> break;
> }
> return cur - start;
> }
>
> -static inline int sis190_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
> - struct RxDesc *desc, int rx_buf_sz)
> +static int sis190_try_rx_copy(struct net_device *dev,
> + struct sk_buff **sk_buff, int pkt_size,
> + struct RxDesc *desc, int rx_buf_sz)
> {
> - int ret = -1;
> + int ret = 01;
>
> if (pkt_size < rx_copybreak) {
> struct sk_buff *skb;
>
> - skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN);
> + skb = netdev_alloc_skb(dev, pkt_size + 2);
> if (skb) {
> - skb_reserve(skb, NET_IP_ALIGN);
> + skb_reserve(skb, 2);
> skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size);
> *sk_buff = skb;
> sis190_give_to_asic(desc, rx_buf_sz);
> @@ -610,7 +610,7 @@ static int sis190_rx_interrupt(struct ne
> le32_to_cpu(desc->addr), tp->rx_buf_sz,
> PCI_DMA_FROMDEVICE);
>
> - if (sis190_try_rx_copy(&skb, pkt_size, desc,
> + if (sis190_try_rx_copy(dev, &skb, pkt_size, desc,
> tp->rx_buf_sz)) {
> pci_action = pci_unmap_single;
> tp->Rx_skbuff[entry] = NULL;
>
next prev parent reply other threads:[~2008-04-17 1:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-16 23:37 [PATCH 00/13] Network driver changes for 2.6.26 Stephen Hemminger
2008-04-16 23:37 ` [PATCH 04/13] via-velocity: use netdev_alloc_skb Stephen Hemminger
2008-04-16 23:37 ` [PATCH 05/13] via-velocity: use memmove Stephen Hemminger
2008-04-16 23:37 ` [PATCH 06/13] sis190: use netdev_alloc_skb Stephen Hemminger
2008-04-17 1:04 ` Wang Chen [this message]
2008-04-17 2:16 ` Wang Chen
2008-04-17 2:59 ` Stephen Hemminger
2008-04-17 6:50 ` Francois Romieu
2008-04-16 23:37 ` [PATCH 07/13] sb1250: " Stephen Hemminger
2008-05-05 12:34 ` Maciej W. Rozycki
2008-04-16 23:37 ` [PATCH 08/13] ns8320: " Stephen Hemminger
2008-05-31 2:20 ` Jeff Garzik
2008-04-16 23:37 ` [PATCH 09/13] myri: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 10/13] ixp2000: " Stephen Hemminger
2008-04-17 13:53 ` Lennert Buytenhek
2008-04-16 23:37 ` [PATCH 11/13] hamachi: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 12/13] dl2k: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 13/13] acenic: " Stephen Hemminger
2008-05-31 2:21 ` Jeff Garzik
[not found] ` <20080416233757.090004281@vyatta.com>
2008-04-17 2:33 ` [PATCH 02/13] atl1: " Jay Cliburn
[not found] ` <20080416233757.015978466@vyatta.com>
2008-05-22 18:13 ` [PATCH 01/13] tg3: remove unneeded semicolons Jeff Garzik
[not found] ` <20080416233757.166190217@vyatta.com>
2008-05-31 2:20 ` [PATCH 03/13] ts108: use netdev_alloc_skb Jeff Garzik
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=4806A237.2060601@cn.fujitsu.com \
--to=wangchen@cn$(echo .)fujitsu.com \
--cc=jgarzik@pobox$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=romieu@fr$(echo .)zoreil.com \
--cc=shemminger@vyatta$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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