From: Yinghai Lu <Yinghai.Lu@Sun.COM>
To: Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@suse.de>, Greg KH <greg@kroah.com>,
rientjes@google.com, Christoph Lameter <clameter@sgi.com>,
Christoph Hellwig <hch@infradead.org>,
David Miller <davem@davemloft.net>,
Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/5] net: make forcedeth to use kmalloc_node and netdev_alloc_skb for skb allocation
Date: Tue, 10 Jul 2007 16:48:05 -0700 [thread overview]
Message-ID: <200707101648.05873.yinghai.lu@sun.com> (raw)
In-Reply-To: <200707101641.17672.yinghai.lu@sun.com>
[PATCH 3/5] net: make forcedeth to use kmalloc_node and netdev_alloc_skb for skb allocation
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 42ba1c0..3f4f559 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -1383,7 +1383,8 @@ static int nv_alloc_rx(struct net_device *dev)
less_rx = np->last_rx.orig;
while (np->put_rx.orig != less_rx) {
- struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD);
+ struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz +
+ NV_RX_ALLOC_PAD);
if (skb) {
np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
@@ -1415,7 +1416,8 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
less_rx = np->last_rx.ex;
while (np->put_rx.ex != less_rx) {
- struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD);
+ struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz +
+ NV_RX_ALLOC_PAD);
if (skb) {
np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
@@ -3976,8 +3978,10 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ri
sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending),
&ring_addr);
}
- rx_skbuff = kmalloc(sizeof(struct nv_skb_map) * ring->rx_pending, GFP_KERNEL);
- tx_skbuff = kmalloc(sizeof(struct nv_skb_map) * ring->tx_pending, GFP_KERNEL);
+ rx_skbuff = kmalloc_node(sizeof(struct nv_skb_map) * ring->rx_pending,
+ GFP_KERNEL, dev_to_node(&dev->dev));
+ tx_skbuff = kmalloc_node(sizeof(struct nv_skb_map) * ring->tx_pending,
+ GFP_KERNEL, dev_to_node(&dev->dev));
if (!rxtx_ring || !rx_skbuff || !tx_skbuff) {
/* fall back to old rings */
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
@@ -4372,9 +4376,9 @@ static int nv_loopback_test(struct net_device *dev)
/* setup packet for tx */
pkt_len = ETH_DATA_LEN;
- tx_skb = dev_alloc_skb(pkt_len);
+ tx_skb = netdev_alloc_skb(dev, pkt_len);
if (!tx_skb) {
- printk(KERN_ERR "dev_alloc_skb() failed during loopback test"
+ printk(KERN_ERR "netdev_alloc_skb() failed during loopback test"
" of %s\n", dev->name);
ret = 0;
goto out;
@@ -4976,6 +4980,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
dev->base_addr = (unsigned long)np->base;
dev->irq = pci_dev->irq;
+ printk(KERN_INFO "nv_probe: numa_node : %02d\n",
+ dev_to_node(&pci_dev->dev));
np->rx_ring_size = RX_RING_DEFAULT;
np->tx_ring_size = TX_RING_DEFAULT;
@@ -4995,8 +5001,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
goto out_unmap;
np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size];
}
- np->rx_skb = kmalloc(sizeof(struct nv_skb_map) * np->rx_ring_size, GFP_KERNEL);
- np->tx_skb = kmalloc(sizeof(struct nv_skb_map) * np->tx_ring_size, GFP_KERNEL);
+ np->rx_skb = kmalloc_node(sizeof(struct nv_skb_map) * np->rx_ring_size,
+ GFP_KERNEL, dev_to_node(&pci_dev->dev));
+ np->tx_skb = kmalloc_node(sizeof(struct nv_skb_map) * np->tx_ring_size,
+ GFP_KERNEL, dev_to_node(&pci_dev->dev));
+
if (!np->rx_skb || !np->tx_skb)
goto out_freering;
memset(np->rx_skb, 0, sizeof(struct nv_skb_map) * np->rx_ring_size);
next parent reply other threads:[~2007-07-11 0:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200707101641.17672.yinghai.lu@sun.com>
2007-07-10 23:48 ` Yinghai Lu [this message]
2007-07-10 23:52 ` [PATCH 1/5] try parent numa_node at first before using default Yinghai Lu
2007-07-11 10:54 ` Stefan Richter
2007-07-11 11:03 ` Stefan Richter
2007-07-11 21:08 ` Greg KH
2007-07-11 21:28 ` Yinghai Lu
2007-07-12 2:47 ` Stefan Richter
2007-07-12 3:01 ` Yinghai Lu
2007-07-12 5:47 ` Stefan Richter
2007-07-12 7:15 ` Cornelia Huck
2007-07-12 11:30 ` Stefan Richter
2007-07-12 15:23 ` Cornelia Huck
2007-07-12 17:59 ` [PATCH] " Yinghai Lu
2007-07-12 18:31 ` Greg KH
2007-07-12 19:06 ` Yinghai Lu
2007-07-13 3:16 ` Greg KH
2007-07-13 4:42 ` Yinghai Lu
2007-07-13 5:48 ` Cornelia Huck
2007-07-13 19:27 ` [PATCH] try parent numa_node at first before using default v2 Yinghai Lu
2007-07-10 23:52 ` [PATCH 4/5] net: show numa_node for net_device in /sys Yinghai Lu
2007-07-10 23:53 ` [PATCH 5/5] dma: use dev_to_node to get node for device in dma_alloc_pages Yinghai Lu
2007-07-23 19:30 ` Christoph Lameter
2007-07-11 0:05 ` [PATCH 2/5] net: use numa_node in net_devcice->dev instead of parent Yinghai Lu
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=200707101648.05873.yinghai.lu@sun.com \
--to=yinghai.lu@sun.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=davem@davemloft.net \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=stefanr@s5r6.in-berlin.de \
/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