* Re: bnx2 is spamming dmesg
From: David Miller @ 2010-10-13 21:37 UTC (permalink / raw)
To: kmannth; +Cc: netdev, mchan
In-Reply-To: <1287005434.8004.32.camel@keith-laptop>
From: Keith Mannthey <kmannth@us.ibm.com>
Date: Wed, 13 Oct 2010 14:30:34 -0700
> For the last couple of months (since at least 2.6.35 somewhere) I have
> been seeing
It's not the bnx2 driver, it's the intel-iommu driver.
This is coming from a pr_debug() statement, so turn off
CONFIG_PCI_DEBUG to get rid of the "DEBUG" define that
gets added to the kernel build command line which causes
that line to print the message unconditionally.
^ permalink raw reply
* Re: [PATCH] b44: fix resume, request_irq after hw reset
From: James Hogan @ 2010-10-13 21:39 UTC (permalink / raw)
To: David Miller
Cc: zambrano, jpirko, fujita.tomonori, hauke, Larry.Finger, netdev,
linux-kernel
In-Reply-To: <20101013.094659.226765041.davem@davemloft.net>
On Wednesday 13 October 2010 17:46:59 David Miller wrote:
> From: James Hogan <james@albanarts.com>
> Date: Tue, 12 Oct 2010 00:22:12 +0100
>
> > @@ -2309,6 +2303,12 @@ static int b44_resume(struct ssb_device *sdev)
> >
> > netif_device_attach(bp->dev);
> > spin_unlock_irq(&bp->lock);
> >
> > + rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name,
dev);
> > + if (rc) {
> > + netdev_err(dev, "request_irq failed\n");
> > + return rc;
> > + }
> > +
> >
> > b44_enable_ints(bp);
> > netif_wake_queue(dev);
>
> Since you've moved the request_irq() down, you'll need to adjust
> the error handling so that it undoes side effects made by this
> function up until this point.
>
> F.e. netif_device_attach() has to be undone for one thing.
>
> Next, b44_init_rings() allocates memory that you must now free.
>
> Etc. etc. etc.
>
> This change is not so simple. :-)
Very good point!
Does the ssb_bus_powerup need undoing as well? I'm guessing not since it
wasn't undone before.
How's the patch (at the bottom) looking? it does some better error handling
and leaves the netif_device_attach(bp->dev); until after the irq is obtained.
I just noticed I actually get the following in my log after resume, so it
appears something's going wrong even without the request_irq failing. Any idea
what could be causing the padding to be overwritten? (my experience of net
drivers and DMA are both non existent). If the net device is closed before
suspend, this happens on open instead of resume.
Thanks
James
=============================================================================
BUG kmalloc_dma-2048: Padding overwritten.
0xffff88000003fda8-0xffff88000003fdff
-----------------------------------------------------------------------------
INFO: Slab 0xffffea0000000c40 objects=15 used=1 fp=0xffff880000038000
flags=0x40c1
Pid: 21848, comm: bash Not tainted 2.6.36-rc7-custom+ #18
Call Trace:
[<ffffffff8111582d>] slab_err+0xaa/0xcc
[<ffffffff81006666>] ? xen_set_pud+0x18/0x49
[<ffffffff811171f4>] ? unfreeze_slab+0x53/0xb0
[<ffffffff8111756c>] ? get_partial_node+0x20/0x79
[<ffffffff81115cbd>] slab_pad_check+0xd2/0x124
[<ffffffff81115da4>] check_slab+0x95/0x9c
[<ffffffff811178eb>] __slab_alloc+0x326/0x42a
[<ffffffff813d9096>] ? __netdev_alloc_skb+0x34/0x52
[<ffffffff812467c6>] ? should_fail+0x91/0xf3
[<ffffffff81119abb>] __kmalloc_node_track_caller+0x115/0x193
[<ffffffff813d9096>] ? __netdev_alloc_skb+0x34/0x52
[<ffffffff813d8076>] __alloc_skb+0x83/0x141
[<ffffffff813d9096>] __netdev_alloc_skb+0x34/0x52
[<ffffffffa030f6cf>] b44_alloc_rx_skb+0xf9/0x247 [b44]
[<ffffffffa03b8000>] ? ssb_device_resume+0x0/0x36 [ssb]
[<ffffffffa030f8b0>] b44_init_rings+0x93/0xa8 [b44]
[<ffffffffa030fab3>] b44_resume+0x86/0x142 [b44]
[<ffffffffa03b8030>] ssb_device_resume+0x30/0x36 [ssb]
[<ffffffff813031df>] legacy_resume+0x24/0x5c
[<ffffffff81303b9e>] device_resume+0xcd/0x1ba
[<ffffffff81303dc3>] dpm_resume_end+0x138/0x3d8
[<ffffffff8108db83>] suspend_devices_and_enter+0x1ba/0x203
[<ffffffff8108dcb3>] enter_state+0xe7/0x12e
[<ffffffff8108d3a5>] state_store+0xb6/0xd3
[<ffffffff81235877>] kobj_attr_store+0x17/0x19
[<ffffffff81183223>] sysfs_write_file+0x108/0x144
[<ffffffff81126330>] vfs_write+0xae/0x10a
[<ffffffff8112644f>] sys_write+0x4d/0x74
[<ffffffff81009c32>] system_call_fastpath+0x16/0x1b
Padding 0xffff88000003fa38: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
ZZZZZZZZZZZZZZZZ
<snip>
Padding 0xffff88000003fd98: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a
ZZZZZZZZZZZZZZZZ
Padding 0xffff88000003fda8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Padding 0xffff88000003fdb8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Padding 0xffff88000003fdc8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Padding 0xffff88000003fdd8: 00 00 00 00 5a 5a 5a 5a 00 00 00 00 00 00 00 00
....ZZZZ........
Padding 0xffff88000003fde8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Padding 0xffff88000003fdf8: 64 2a 8b 00 00 00 00 00
d*......
---
drivers/net/b44.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 1e620e2..5fd251c 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -2296,16 +2296,22 @@ static int b44_resume(struct ssb_device *sdev)
if (!netif_running(dev))
return 0;
+ spin_lock_irq(&bp->lock);
+ b44_init_rings(bp);
+ b44_init_hw(bp, B44_FULL_RESET);
+ spin_unlock_irq(&bp->lock);
+
rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev);
if (rc) {
netdev_err(dev, "request_irq failed\n");
+ spin_lock_irq(&bp->lock);
+ b44_halt(bp);
+ b44_free_rings(bp);
+ spin_unlock_irq(&bp->lock);
return rc;
}
spin_lock_irq(&bp->lock);
-
- b44_init_rings(bp);
- b44_init_hw(bp, B44_FULL_RESET);
netif_device_attach(bp->dev);
spin_unlock_irq(&bp->lock);
--
1.7.2.3
^ permalink raw reply related
* Re: [PATCH V2] Phonet: 'connect' socket implementation for Pipe controller
From: David Miller @ 2010-10-13 21:41 UTC (permalink / raw)
To: remi
Cc: kumar.sanghvi, remi.denis-courmont, netdev, linus.walleij,
gulshan.karmani, sudeep.divakaran
In-Reply-To: <ec51036a9c6fbbb550fa5ef7ae7f13e3@chewa.net>
From: Rémi Denis-Courmont <remi@remlab.net>
Date: Wed, 13 Oct 2010 09:18:51 +0200
>> Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
>
> Acked-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Applied.
^ permalink raw reply
* Re: [PATCH] Documentation: Update Phonet doc for Pipe controller changes
From: David Miller @ 2010-10-13 21:41 UTC (permalink / raw)
To: remi
Cc: kumar.sanghvi, remi.denis-courmont, netdev, linus.walleij,
gulshan.karmani, sudeep.divakaran
In-Reply-To: <c0eb9fcfec2efac3da8ce45c4dbd23cb@chewa.net>
From: Rémi Denis-Courmont <remi@remlab.net>
Date: Wed, 13 Oct 2010 09:19:51 +0200
>
>
>
> On Wed, 13 Oct 2010 11:47:25 +0530, Kumar A Sanghvi
> <kumar.sanghvi@stericsson.com> wrote:
>> From: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
>>
>> Updates to Phonet doc for Pipe controller 'connect' socket
>> implementation and changes related to socket options.
>>
>> Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
>
> Acked-by Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: allocate skbs on local node
From: Christoph Lameter @ 2010-10-13 21:43 UTC (permalink / raw)
To: David Rientjes
Cc: Pekka Enberg, Andrew Morton, Eric Dumazet, David Miller, netdev,
Michael Chan, Eilon Greenstein, Christoph Hellwig, LKML,
Nick Piggin
In-Reply-To: <alpine.DEB.2.00.1010131342310.15185@chino.kir.corp.google.com>
On Wed, 13 Oct 2010, David Rientjes wrote:
> > Basically have slab.c with the basic functions and then slab_queueing.c
> > and slab_noqueue.c for SLAB/SLUB with the particulars of the allocation
> > strategy?
> >
>
> I was going to mention that as an idea, but I thought storing the metadata
> for certain debugging features might differ from the two allocators so
> substantially that it would be even more convoluted and difficult to
> maintain?
We could have some callbacks to store allocator specific metadata?
^ permalink raw reply
* [PATCH 2.6.35-rc6] net-next: Add multiqueue support to vmxnet3 driver
From: Shreyas Bhatewara @ 2010-10-13 21:47 UTC (permalink / raw)
To: netdev, pv-drivers, linux-kernel
In-Reply-To: <alpine.LRH.2.00.1009290104130.464@sbhatewara-dev1.eng.vmware.com>
Add multiqueue support to vmxnet3 driver
This change adds Multiqueue and thus receive side scaling support
to vmxnet3 device driver. Number of rx queues is limited to 1 in cases
where
- MSI is not configured or
- One MSIx vector is not available per rx queue
By default 1 tx and 1 rx queue will be initialized. module parameters can
be used to configure tx and rx upto a maximum of 8 queues.
Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
---
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index e04dc10..48058fc 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -44,6 +44,50 @@ MODULE_DEVICE_TABLE(pci, vmxnet3_pciid_table);
static atomic_t devices_found;
+#ifdef VMXNET3_RSS
+static unsigned int num_rss_entries;
+#define VMXNET3_MAX_DEVICES 10
+
+static int rss_ind_table[VMXNET3_MAX_DEVICES *
+ VMXNET3_RSS_IND_TABLE_SIZE + 1] = {
+ [0 ... VMXNET3_MAX_DEVICES * VMXNET3_RSS_IND_TABLE_SIZE] = -1 };
+#endif
+static int num_tqs[VMXNET3_MAX_DEVICES + 1] = {
+ [0 ... VMXNET3_MAX_DEVICES] = 1 };
+static int num_rqs[VMXNET3_MAX_DEVICES + 1] = {
+ [0 ... VMXNET3_MAX_DEVICES] = 1 };
+static int share_tx_intr[VMXNET3_MAX_DEVICES + 1] = {
+ [0 ... VMXNET3_MAX_DEVICES] = 0 };
+static int buddy_intr[VMXNET3_MAX_DEVICES + 1] = {
+ [0 ... VMXNET3_MAX_DEVICES] = 1 };
+
+static unsigned int num_adapters;
+module_param_array(share_tx_intr, int, &num_adapters, 0400);
+MODULE_PARM_DESC(share_tx_intr, "Share one IRQ among all tx queue completions. "
+ "Comma separated list of 1s and 0s - one for each NIC. "
+ "1 to share, 0 to not, default is 0");
+module_param_array(buddy_intr, int, &num_adapters, 0400);
+MODULE_PARM_DESC(buddy_intr, "Share one IRQ among corresponding tx and rx "
+ "queues. Comma separated list of 1s and 0s - one for each "
+ "NIC. 1 to share, 0 to not, default is 1");
+module_param_array(num_tqs, int, &num_adapters, 0400);
+MODULE_PARM_DESC(num_tqs, "Number of transmit queues in each adapter. Comma "
+ "separated list of integers. Setting this to 0 makes number"
+ " of queues same as number of CPUs. Default is 1.");
+
+#ifdef VMXNET3_RSS
+module_param_array(rss_ind_table, int, &num_rss_entries, 0400);
+MODULE_PARM_DESC(rss_ind_table, "RSS Indirection table. Number of entries "
+ "per NIC should be 32. Each integer in a comma separated list"
+ " is an rx queue number starting with 0. Repeat the same for"
+ " all NICs.");
+module_param_array(num_rqs, int, &num_adapters, 0400);
+MODULE_PARM_DESC(num_rqs, "Number of receive queues in each adapter. Comma "
+ " separated list of integers. Setting this to 0 makes number"
+ " of queues same as number of CPUs. Default is 1.");
+
+#endif /* VMXNET3_RSS */
+
/*
* Enable/Disable the given intr
@@ -107,7 +151,7 @@ static void
vmxnet3_tq_start(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
{
tq->stopped = false;
- netif_start_queue(adapter->netdev);
+ netif_start_subqueue(adapter->netdev, tq - adapter->tx_queue);
}
@@ -115,7 +159,7 @@ static void
vmxnet3_tq_wake(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
{
tq->stopped = false;
- netif_wake_queue(adapter->netdev);
+ netif_wake_subqueue(adapter->netdev, (tq - adapter->tx_queue));
}
@@ -124,7 +168,7 @@ vmxnet3_tq_stop(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter)
{
tq->stopped = true;
tq->num_stop++;
- netif_stop_queue(adapter->netdev);
+ netif_stop_subqueue(adapter->netdev, (tq - adapter->tx_queue));
}
@@ -135,6 +179,7 @@ static void
vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue)
{
u32 ret;
+ int i;
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
@@ -145,22 +190,28 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue)
if (!netif_carrier_ok(adapter->netdev))
netif_carrier_on(adapter->netdev);
- if (affectTxQueue)
- vmxnet3_tq_start(&adapter->tx_queue, adapter);
+ if (affectTxQueue) {
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_start(&adapter->tx_queue[i],
+ adapter);
+ }
} else {
printk(KERN_INFO "%s: NIC Link is Down\n",
adapter->netdev->name);
if (netif_carrier_ok(adapter->netdev))
netif_carrier_off(adapter->netdev);
- if (affectTxQueue)
- vmxnet3_tq_stop(&adapter->tx_queue, adapter);
+ if (affectTxQueue) {
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_stop(&adapter->tx_queue[i], adapter);
+ }
}
}
static void
vmxnet3_process_events(struct vmxnet3_adapter *adapter)
{
+ int i;
u32 events = le32_to_cpu(adapter->shared->ecr);
if (!events)
return;
@@ -176,16 +227,18 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_GET_QUEUE_STATUS);
- if (adapter->tqd_start->status.stopped) {
- printk(KERN_ERR "%s: tq error 0x%x\n",
- adapter->netdev->name,
- le32_to_cpu(adapter->tqd_start->status.error));
- }
- if (adapter->rqd_start->status.stopped) {
- printk(KERN_ERR "%s: rq error 0x%x\n",
- adapter->netdev->name,
- adapter->rqd_start->status.error);
- }
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ if (adapter->tqd_start[i].status.stopped)
+ dev_dbg(&adapter->netdev->dev,
+ "%s: tq[%d] error 0x%x\n",
+ adapter->netdev->name, i, le32_to_cpu(
+ adapter->tqd_start[i].status.error));
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ if (adapter->rqd_start[i].status.stopped)
+ dev_dbg(&adapter->netdev->dev,
+ "%s: rq[%d] error 0x%x\n",
+ adapter->netdev->name, i,
+ adapter->rqd_start[i].status.error);
schedule_work(&adapter->work);
}
@@ -410,7 +463,7 @@ vmxnet3_tq_cleanup(struct vmxnet3_tx_queue *tq,
}
-void
+static void
vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq,
struct vmxnet3_adapter *adapter)
{
@@ -518,6 +571,14 @@ err:
return -ENOMEM;
}
+static void
+vmxnet3_tq_cleanup_all(struct vmxnet3_adapter *adapter)
+{
+ int i;
+
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_cleanup(&adapter->tx_queue[i], adapter);
+}
/*
* starting from ring->next2fill, allocate rx buffers for the given ring
@@ -621,27 +682,14 @@ vmxnet3_append_frag(struct sk_buff *skb, struct Vmxnet3_RxCompDesc *rcd,
skb_shinfo(skb)->nr_frags++;
}
-
-/*
- * Free any pages which were attached to the frags of the spare skb. This can
- * happen when the spare skb is attached to the rx ring to prevent starvation,
- * but there was no issue with page allocation.
- */
-
-static void
-vmxnet3_rx_spare_skb_free_frags(struct vmxnet3_adapter *adapter)
+/* Destroy all tx queues */
+void
+vmxnet3_tq_destroy_all(struct vmxnet3_adapter *adapter)
{
- struct sk_buff *skb = adapter->rx_queue.spare_skb;
int i;
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
- struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
- BUG_ON(frag->page != 0);
- put_page(frag->page);
- frag->page = 0;
- frag->size = 0;
- }
- skb_shinfo(skb)->nr_frags = 0;
- skb->data_len = 0;
+
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_destroy(&adapter->tx_queue[i], adapter);
}
@@ -760,6 +808,17 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
}
+/* Init all tx queues */
+static void
+vmxnet3_tq_init_all(struct vmxnet3_adapter *adapter)
+{
+ int i;
+
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_init(&adapter->tx_queue[i], adapter);
+}
+
+
/*
* parse and copy relevant protocol headers:
* For a tso pkt, relevant headers are L2/3/4 including options
@@ -1028,8 +1087,8 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
if (le32_to_cpu(tq->shared->txNumDeferred) >=
le32_to_cpu(tq->shared->txThreshold)) {
tq->shared->txNumDeferred = 0;
- VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD,
- tq->tx_ring.next2fill);
+ VMXNET3_WRITE_BAR0_REG(adapter, (VMXNET3_REG_TXPROD +
+ tq->qid * 8), tq->tx_ring.next2fill);
}
return NETDEV_TX_OK;
@@ -1048,7 +1107,10 @@ vmxnet3_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
- return vmxnet3_tq_xmit(skb, &adapter->tx_queue, adapter, netdev);
+ BUG_ON(skb->queue_mapping > adapter->num_tx_queues);
+ return vmxnet3_tq_xmit(skb,
+ &adapter->tx_queue[skb->queue_mapping],
+ adapter, netdev);
}
@@ -1100,10 +1162,7 @@ vmxnet3_rx_error(struct vmxnet3_rx_queue *rq, struct Vmxnet3_RxCompDesc *rcd,
* desc for the pkt
*/
if (ctx->skb) {
- if (ctx->skb == rq->spare_skb)
- vmxnet3_rx_spare_skb_free_frags(adapter);
- else
- dev_kfree_skb_irq(ctx->skb);
+ dev_kfree_skb_irq(ctx->skb);
}
ctx->skb = NULL;
@@ -1138,9 +1197,9 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
break;
}
num_rxd++;
-
+ BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2);
idx = rcd->rxdIdx;
- ring_idx = rcd->rqID == rq->qid ? 0 : 1;
+ ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1;
vmxnet3_getRxDesc(rxd, &rq->rx_ring[ring_idx].base[idx].rxd,
&rxCmdDesc);
rbi = rq->buf_info[ring_idx] + idx;
@@ -1202,12 +1261,6 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
skb = ctx->skb;
if (rcd->eop) {
- if (skb == rq->spare_skb) {
- rq->stats.drop_total++;
- vmxnet3_rx_spare_skb_free_frags(adapter);
- ctx->skb = NULL;
- goto rcd_done;
- }
skb->len += skb->data_len;
skb->truesize += skb->data_len;
@@ -1292,17 +1345,18 @@ vmxnet3_rq_cleanup(struct vmxnet3_rx_queue *rq,
rq->rx_ring[ring_idx].next2comp = 0;
rq->uncommitted[ring_idx] = 0;
}
+ rq->comp_ring.gen = VMXNET3_INIT_GEN;
+ rq->comp_ring.next2proc = 0;
+}
- /* free starvation prevention skb if allocated */
- if (rq->spare_skb) {
- vmxnet3_rx_spare_skb_free_frags(adapter);
- dev_kfree_skb(rq->spare_skb);
- rq->spare_skb = NULL;
- }
+static void
+vmxnet3_rq_cleanup_all(struct vmxnet3_adapter *adapter)
+{
+ int i;
- rq->comp_ring.gen = VMXNET3_INIT_GEN;
- rq->comp_ring.next2proc = 0;
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ vmxnet3_rq_cleanup(&adapter->rx_queue[i], adapter);
}
@@ -1406,6 +1460,25 @@ vmxnet3_rq_init(struct vmxnet3_rx_queue *rq,
static int
+vmxnet3_rq_init_all(struct vmxnet3_adapter *adapter)
+{
+ int i, err = 0;
+
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ err = vmxnet3_rq_init(&adapter->rx_queue[i], adapter);
+ if (unlikely(err)) {
+ dev_err(&adapter->netdev->dev, "%s: failed to "
+ "initialize rx queue%i\n",
+ adapter->netdev->name, i);
+ break;
+ }
+ }
+ return err;
+
+}
+
+
+static int
vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter)
{
int i;
@@ -1453,33 +1526,177 @@ err:
static int
+vmxnet3_rq_create_all(struct vmxnet3_adapter *adapter)
+{
+ int i, err = 0;
+
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ err = vmxnet3_rq_create(&adapter->rx_queue[i], adapter);
+ if (unlikely(err)) {
+ dev_err(&adapter->netdev->dev,
+ "%s: failed to create rx queue%i\n",
+ adapter->netdev->name, i);
+ goto err_out;
+ }
+ }
+ return err;
+err_out:
+ vmxnet3_rq_destroy_all(adapter);
+ return err;
+
+}
+
+/* Multiple queue aware polling function for tx and rx */
+
+static int
vmxnet3_do_poll(struct vmxnet3_adapter *adapter, int budget)
{
+ int rcd_done = 0, i;
if (unlikely(adapter->shared->ecr))
vmxnet3_process_events(adapter);
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ vmxnet3_tq_tx_complete(&adapter->tx_queue[i], adapter);
- vmxnet3_tq_tx_complete(&adapter->tx_queue, adapter);
- return vmxnet3_rq_rx_complete(&adapter->rx_queue, adapter, budget);
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ rcd_done += vmxnet3_rq_rx_complete(&adapter->rx_queue[i],
+ adapter, budget);
+ return rcd_done;
}
static int
vmxnet3_poll(struct napi_struct *napi, int budget)
{
- struct vmxnet3_adapter *adapter = container_of(napi,
- struct vmxnet3_adapter, napi);
+ struct vmxnet3_rx_queue *rx_queue = container_of(napi,
+ struct vmxnet3_rx_queue, napi);
+ int rxd_done;
+
+ rxd_done = vmxnet3_do_poll(rx_queue->adapter, budget);
+
+ if (rxd_done < budget) {
+ napi_complete(napi);
+ vmxnet3_enable_all_intrs(rx_queue->adapter);
+ }
+ return rxd_done;
+}
+
+/*
+ * NAPI polling function for MSI-X mode with multiple Rx queues
+ * Returns the # of the NAPI credit consumed (# of rx descriptors processed)
+ */
+
+static int
+vmxnet3_poll_rx_only(struct napi_struct *napi, int budget)
+{
+ struct vmxnet3_rx_queue *rq = container_of(napi,
+ struct vmxnet3_rx_queue, napi);
+ struct vmxnet3_adapter *adapter = rq->adapter;
int rxd_done;
- rxd_done = vmxnet3_do_poll(adapter, budget);
+ /* When sharing interrupt with corresponding tx queue, process
+ * tx completions in that queue as well
+ */
+ if (adapter->share_intr == VMXNET3_INTR_BUDDYSHARE) {
+ struct vmxnet3_tx_queue *tq =
+ &adapter->tx_queue[rq - adapter->rx_queue];
+ vmxnet3_tq_tx_complete(tq, adapter);
+ }
+
+ rxd_done = vmxnet3_rq_rx_complete(rq, adapter, budget);
if (rxd_done < budget) {
napi_complete(napi);
- vmxnet3_enable_intr(adapter, 0);
+ vmxnet3_enable_intr(adapter, rq->comp_ring.intr_idx);
}
return rxd_done;
}
+#ifdef CONFIG_PCI_MSI
+
+/*
+ * Handle completion interrupts on tx queues
+ * Returns whether or not the intr is handled
+ */
+
+static irqreturn_t
+vmxnet3_msix_tx(int irq, void *data)
+{
+ struct vmxnet3_tx_queue *tq = data;
+ struct vmxnet3_adapter *adapter = tq->adapter;
+
+ if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
+ vmxnet3_disable_intr(adapter, tq->comp_ring.intr_idx);
+
+ /* Handle the case where only one irq is allocate for all tx queues */
+ if (adapter->share_intr == VMXNET3_INTR_TXSHARE) {
+ int i;
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ struct vmxnet3_tx_queue *txq = &adapter->tx_queue[i];
+ vmxnet3_tq_tx_complete(txq, adapter);
+ }
+ } else {
+ vmxnet3_tq_tx_complete(tq, adapter);
+ }
+ vmxnet3_enable_intr(adapter, tq->comp_ring.intr_idx);
+
+ return IRQ_HANDLED;
+}
+
+
+/*
+ * Handle completion interrupts on rx queues. Returns whether or not the
+ * intr is handled
+ */
+
+static irqreturn_t
+vmxnet3_msix_rx(int irq, void *data)
+{
+ struct vmxnet3_rx_queue *rq = data;
+ struct vmxnet3_adapter *adapter = rq->adapter;
+
+ /* disable intr if needed */
+ if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
+ vmxnet3_disable_intr(adapter, rq->comp_ring.intr_idx);
+ napi_schedule(&rq->napi);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ *----------------------------------------------------------------------------
+ *
+ * vmxnet3_msix_event --
+ *
+ * vmxnet3 msix event intr handler
+ *
+ * Result:
+ * whether or not the intr is handled
+ *
+ *----------------------------------------------------------------------------
+ */
+
+static irqreturn_t
+vmxnet3_msix_event(int irq, void *data)
+{
+ struct net_device *dev = data;
+ struct vmxnet3_adapter *adapter = netdev_priv(dev);
+
+ /* disable intr if needed */
+ if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
+ vmxnet3_disable_intr(adapter, adapter->intr.event_intr_idx);
+
+ if (adapter->shared->ecr)
+ vmxnet3_process_events(adapter);
+
+ vmxnet3_enable_intr(adapter, adapter->intr.event_intr_idx);
+
+ return IRQ_HANDLED;
+}
+
+#endif /* CONFIG_PCI_MSI */
+
+
/* Interrupt handler for vmxnet3 */
static irqreturn_t
vmxnet3_intr(int irq, void *dev_id)
@@ -1487,7 +1704,7 @@ vmxnet3_intr(int irq, void *dev_id)
struct net_device *dev = dev_id;
struct vmxnet3_adapter *adapter = netdev_priv(dev);
- if (unlikely(adapter->intr.type == VMXNET3_IT_INTX)) {
+ if (adapter->intr.type == VMXNET3_IT_INTX) {
u32 icr = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ICR);
if (unlikely(icr == 0))
/* not ours */
@@ -1497,77 +1714,136 @@ vmxnet3_intr(int irq, void *dev_id)
/* disable intr if needed */
if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
- vmxnet3_disable_intr(adapter, 0);
+ vmxnet3_disable_all_intrs(adapter);
- napi_schedule(&adapter->napi);
+ napi_schedule(&adapter->rx_queue[0].napi);
return IRQ_HANDLED;
}
#ifdef CONFIG_NET_POLL_CONTROLLER
-
/* netpoll callback. */
static void
vmxnet3_netpoll(struct net_device *netdev)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
- int irq;
-#ifdef CONFIG_PCI_MSI
- if (adapter->intr.type == VMXNET3_IT_MSIX)
- irq = adapter->intr.msix_entries[0].vector;
- else
-#endif
- irq = adapter->pdev->irq;
+ if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
+ vmxnet3_disable_all_intrs(adapter);
+
+ vmxnet3_do_poll(adapter, adapter->rx_queue[0].rx_ring[0].size);
+ vmxnet3_enable_all_intrs(adapter);
- disable_irq(irq);
- vmxnet3_intr(irq, netdev);
- enable_irq(irq);
}
-#endif
+#endif /* CONFIG_NET_POLL_CONTROLLER */
static int
vmxnet3_request_irqs(struct vmxnet3_adapter *adapter)
{
- int err;
+ struct vmxnet3_intr *intr = &adapter->intr;
+ int err = 0, i;
+ int vector = 0;
#ifdef CONFIG_PCI_MSI
if (adapter->intr.type == VMXNET3_IT_MSIX) {
- /* we only use 1 MSI-X vector */
- err = request_irq(adapter->intr.msix_entries[0].vector,
- vmxnet3_intr, 0, adapter->netdev->name,
- adapter->netdev);
- } else if (adapter->intr.type == VMXNET3_IT_MSI) {
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ sprintf(adapter->tx_queue[i].name, "%s:v%d-%s",
+ adapter->netdev->name, vector, "Tx");
+ if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE)
+ err = request_irq(
+ intr->msix_entries[vector].vector,
+ vmxnet3_msix_tx, 0,
+ adapter->tx_queue[i].name,
+ &adapter->tx_queue[i]);
+ if (err) {
+ dev_err(&adapter->netdev->dev,
+ "Failed to request irq for MSIX, %s, "
+ "error %d\n",
+ adapter->tx_queue[i].name, err);
+ return err;
+ }
+
+ /* Handle the case where only 1 MSIx was allocated for
+ * all tx queues */
+ if (adapter->share_intr == VMXNET3_INTR_TXSHARE) {
+ for (; i < adapter->num_tx_queues; i++)
+ adapter->tx_queue[i].comp_ring.intr_idx
+ = vector;
+ vector++;
+ break;
+ } else {
+ adapter->tx_queue[i].comp_ring.intr_idx
+ = vector++;
+ }
+ }
+ if (adapter->share_intr == VMXNET3_INTR_BUDDYSHARE)
+ vector = 0;
+
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ sprintf(adapter->rx_queue[i].name, "%s:v%d-%s",
+ adapter->netdev->name, vector, "Rx");
+ err = request_irq(intr->msix_entries[vector].vector,
+ vmxnet3_msix_rx, 0,
+ adapter->rx_queue[i].name,
+ &(adapter->rx_queue[i]));
+ if (err) {
+ printk(KERN_ERR "Failed to request irq for MSIX"
+ ", %s, error %d\n",
+ adapter->rx_queue[i].name, err);
+ return err;
+ }
+
+ adapter->rx_queue[i].comp_ring.intr_idx = vector++;
+ }
+
+ sprintf(intr->event_msi_vector_name, "%s:v%d-event",
+ adapter->netdev->name, vector);
+ err = request_irq(intr->msix_entries[vector].vector,
+ vmxnet3_msix_event, 0,
+ intr->event_msi_vector_name, adapter->netdev);
+ intr->event_intr_idx = vector;
+
+ } else if (intr->type == VMXNET3_IT_MSI) {
+ adapter->num_rx_queues = 1;
err = request_irq(adapter->pdev->irq, vmxnet3_intr, 0,
adapter->netdev->name, adapter->netdev);
- } else
+ } else {
#endif
- {
+ adapter->num_rx_queues = 1;
err = request_irq(adapter->pdev->irq, vmxnet3_intr,
IRQF_SHARED, adapter->netdev->name,
adapter->netdev);
+#ifdef CONFIG_PCI_MSI
}
-
- if (err)
+#endif
+ intr->num_intrs = vector + 1;
+ if (err) {
printk(KERN_ERR "Failed to request irq %s (intr type:%d), error"
- ":%d\n", adapter->netdev->name, adapter->intr.type, err);
+ ":%d\n", adapter->netdev->name, intr->type, err);
+ } else {
+ /* Number of rx queues will not change after this */
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i];
+ rq->qid = i;
+ rq->qid2 = i + adapter->num_rx_queues;
+ }
- if (!err) {
- int i;
- /* init our intr settings */
- for (i = 0; i < adapter->intr.num_intrs; i++)
- adapter->intr.mod_levels[i] = UPT1_IML_ADAPTIVE;
- /* next setup intr index for all intr sources */
- adapter->tx_queue.comp_ring.intr_idx = 0;
- adapter->rx_queue.comp_ring.intr_idx = 0;
- adapter->intr.event_intr_idx = 0;
+ /* init our intr settings */
+ for (i = 0; i < intr->num_intrs; i++)
+ intr->mod_levels[i] = UPT1_IML_ADAPTIVE;
+ if (adapter->intr.type != VMXNET3_IT_MSIX) {
+ adapter->intr.event_intr_idx = 0;
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ adapter->tx_queue[i].comp_ring.intr_idx = 0;
+ adapter->rx_queue[0].comp_ring.intr_idx = 0;
+ }
printk(KERN_INFO "%s: intr type %u, mode %u, %u vectors "
- "allocated\n", adapter->netdev->name, adapter->intr.type,
- adapter->intr.mask_mode, adapter->intr.num_intrs);
+ "allocated\n", adapter->netdev->name, intr->type,
+ intr->mask_mode, intr->num_intrs);
}
return err;
@@ -1577,18 +1853,32 @@ vmxnet3_request_irqs(struct vmxnet3_adapter *adapter)
static void
vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
{
- BUG_ON(adapter->intr.type == VMXNET3_IT_AUTO ||
- adapter->intr.num_intrs <= 0);
+ struct vmxnet3_intr *intr = &adapter->intr;
+ BUG_ON(intr->type == VMXNET3_IT_AUTO || intr->num_intrs <= 0);
- switch (adapter->intr.type) {
+ switch (intr->type) {
#ifdef CONFIG_PCI_MSI
case VMXNET3_IT_MSIX:
{
- int i;
+ int i, vector = 0;
+
+ if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE) {
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ free_irq(intr->msix_entries[vector++].vector,
+ &(adapter->tx_queue[i]));
+ if (adapter->share_intr == VMXNET3_INTR_TXSHARE)
+ break;
+ }
+ }
- for (i = 0; i < adapter->intr.num_intrs; i++)
- free_irq(adapter->intr.msix_entries[i].vector,
- adapter->netdev);
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ free_irq(intr->msix_entries[vector++].vector,
+ &(adapter->rx_queue[i]));
+ }
+
+ free_irq(intr->msix_entries[vector].vector,
+ adapter->netdev);
+ BUG_ON(vector >= intr->num_intrs);
break;
}
#endif
@@ -1801,6 +2091,15 @@ vmxnet3_set_mc(struct net_device *netdev)
kfree(new_table);
}
+void
+vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter)
+{
+ int i;
+
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ vmxnet3_rq_destroy(&adapter->rx_queue[i], adapter);
+}
+
/*
* Set up driver_shared based on settings in adapter.
@@ -1848,40 +2147,87 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
devRead->misc.queueDescPA = cpu_to_le64(adapter->queue_desc_pa);
devRead->misc.queueDescLen = cpu_to_le32(
- sizeof(struct Vmxnet3_TxQueueDesc) +
- sizeof(struct Vmxnet3_RxQueueDesc));
+ adapter->num_tx_queues * sizeof(struct Vmxnet3_TxQueueDesc) +
+ adapter->num_rx_queues * sizeof(struct Vmxnet3_RxQueueDesc));
/* tx queue settings */
- BUG_ON(adapter->tx_queue.tx_ring.base == NULL);
-
- devRead->misc.numTxQueues = 1;
- tqc = &adapter->tqd_start->conf;
- tqc->txRingBasePA = cpu_to_le64(adapter->tx_queue.tx_ring.basePA);
- tqc->dataRingBasePA = cpu_to_le64(adapter->tx_queue.data_ring.basePA);
- tqc->compRingBasePA = cpu_to_le64(adapter->tx_queue.comp_ring.basePA);
- tqc->ddPA = cpu_to_le64(virt_to_phys(
- adapter->tx_queue.buf_info));
- tqc->txRingSize = cpu_to_le32(adapter->tx_queue.tx_ring.size);
- tqc->dataRingSize = cpu_to_le32(adapter->tx_queue.data_ring.size);
- tqc->compRingSize = cpu_to_le32(adapter->tx_queue.comp_ring.size);
- tqc->ddLen = cpu_to_le32(sizeof(struct vmxnet3_tx_buf_info) *
- tqc->txRingSize);
- tqc->intrIdx = adapter->tx_queue.comp_ring.intr_idx;
+ devRead->misc.numTxQueues = adapter->num_tx_queues;
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ struct vmxnet3_tx_queue *tq = &adapter->tx_queue[i];
+ BUG_ON(adapter->tx_queue[i].tx_ring.base == NULL);
+ tqc = &adapter->tqd_start[i].conf;
+ tqc->txRingBasePA = cpu_to_le64(tq->tx_ring.basePA);
+ tqc->dataRingBasePA = cpu_to_le64(tq->data_ring.basePA);
+ tqc->compRingBasePA = cpu_to_le64(tq->comp_ring.basePA);
+ tqc->ddPA = cpu_to_le64(virt_to_phys(tq->buf_info));
+ tqc->txRingSize = cpu_to_le32(tq->tx_ring.size);
+ tqc->dataRingSize = cpu_to_le32(tq->data_ring.size);
+ tqc->compRingSize = cpu_to_le32(tq->comp_ring.size);
+ tqc->ddLen = cpu_to_le32(
+ sizeof(struct vmxnet3_tx_buf_info) *
+ tqc->txRingSize);
+ tqc->intrIdx = tq->comp_ring.intr_idx;
+ }
/* rx queue settings */
- devRead->misc.numRxQueues = 1;
- rqc = &adapter->rqd_start->conf;
- rqc->rxRingBasePA[0] = cpu_to_le64(adapter->rx_queue.rx_ring[0].basePA);
- rqc->rxRingBasePA[1] = cpu_to_le64(adapter->rx_queue.rx_ring[1].basePA);
- rqc->compRingBasePA = cpu_to_le64(adapter->rx_queue.comp_ring.basePA);
- rqc->ddPA = cpu_to_le64(virt_to_phys(
- adapter->rx_queue.buf_info));
- rqc->rxRingSize[0] = cpu_to_le32(adapter->rx_queue.rx_ring[0].size);
- rqc->rxRingSize[1] = cpu_to_le32(adapter->rx_queue.rx_ring[1].size);
- rqc->compRingSize = cpu_to_le32(adapter->rx_queue.comp_ring.size);
- rqc->ddLen = cpu_to_le32(sizeof(struct vmxnet3_rx_buf_info) *
- (rqc->rxRingSize[0] + rqc->rxRingSize[1]));
- rqc->intrIdx = adapter->rx_queue.comp_ring.intr_idx;
+ devRead->misc.numRxQueues = adapter->num_rx_queues;
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i];
+ rqc = &adapter->rqd_start[i].conf;
+ rqc->rxRingBasePA[0] = cpu_to_le64(rq->rx_ring[0].basePA);
+ rqc->rxRingBasePA[1] = cpu_to_le64(rq->rx_ring[1].basePA);
+ rqc->compRingBasePA = cpu_to_le64(rq->comp_ring.basePA);
+ rqc->ddPA = cpu_to_le64(virt_to_phys(
+ rq->buf_info));
+ rqc->rxRingSize[0] = cpu_to_le32(rq->rx_ring[0].size);
+ rqc->rxRingSize[1] = cpu_to_le32(rq->rx_ring[1].size);
+ rqc->compRingSize = cpu_to_le32(rq->comp_ring.size);
+ rqc->ddLen = cpu_to_le32(
+ sizeof(struct vmxnet3_rx_buf_info) *
+ (rqc->rxRingSize[0] +
+ rqc->rxRingSize[1]));
+ rqc->intrIdx = rq->comp_ring.intr_idx;
+ }
+
+#ifdef VMXNET3_RSS
+ memset(adapter->rss_conf, 0, sizeof(*adapter->rss_conf));
+
+ if (adapter->rss) {
+ struct UPT1_RSSConf *rssConf = adapter->rss_conf;
+ devRead->misc.uptFeatures |= UPT1_F_RSS;
+ devRead->misc.numRxQueues = adapter->num_rx_queues;
+ rssConf->hashType = UPT1_RSS_HASH_TYPE_TCP_IPV4 |
+ UPT1_RSS_HASH_TYPE_IPV4 |
+ UPT1_RSS_HASH_TYPE_TCP_IPV6 |
+ UPT1_RSS_HASH_TYPE_IPV6;
+ rssConf->hashFunc = UPT1_RSS_HASH_FUNC_TOEPLITZ;
+ rssConf->hashKeySize = UPT1_RSS_MAX_KEY_SIZE;
+ rssConf->indTableSize = VMXNET3_RSS_IND_TABLE_SIZE;
+ get_random_bytes(&rssConf->hashKey[0], rssConf->hashKeySize);
+ if (num_rss_entries >= adapter->dev_number *
+ VMXNET3_RSS_IND_TABLE_SIZE) {
+ int j = (adapter->dev_number) *
+ VMXNET3_RSS_IND_TABLE_SIZE;
+ for (i = 0; i < rssConf->indTableSize; i++, j++) {
+ if (rss_ind_table[j] >= 0 &&
+ rss_ind_table[j] < adapter->num_rx_queues)
+ rssConf->indTable[i] = rss_ind_table[j];
+ else
+ rssConf->indTable[i] = i %
+ adapter->num_rx_queues;
+ }
+ } else {
+ for (i = 0; i < rssConf->indTableSize; i++)
+ rssConf->indTable[i] = i %
+ adapter->num_rx_queues;
+ }
+
+ devRead->rssConfDesc.confVer = 1;
+ devRead->rssConfDesc.confLen = sizeof(*rssConf);
+ devRead->rssConfDesc.confPA = virt_to_phys(rssConf);
+ }
+
+#endif /* VMXNET3_RSS */
/* intr settings */
devRead->intrConf.autoMask = adapter->intr.mask_mode ==
@@ -1903,18 +2249,18 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
int
vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
{
- int err;
+ int err, i;
u32 ret;
- dev_dbg(&adapter->netdev->dev,
- "%s: skb_buf_size %d, rx_buf_per_pkt %d, ring sizes"
- " %u %u %u\n", adapter->netdev->name, adapter->skb_buf_size,
- adapter->rx_buf_per_pkt, adapter->tx_queue.tx_ring.size,
- adapter->rx_queue.rx_ring[0].size,
- adapter->rx_queue.rx_ring[1].size);
-
- vmxnet3_tq_init(&adapter->tx_queue, adapter);
- err = vmxnet3_rq_init(&adapter->rx_queue, adapter);
+ dev_dbg(&adapter->netdev->dev, "%s: skb_buf_size %d, rx_buf_per_pkt %d,"
+ " ring sizes %u %u %u\n", adapter->netdev->name,
+ adapter->skb_buf_size, adapter->rx_buf_per_pkt,
+ adapter->tx_queue[0].tx_ring.size,
+ adapter->rx_queue[0].rx_ring[0].size,
+ adapter->rx_queue[0].rx_ring[1].size);
+
+ vmxnet3_tq_init_all(adapter);
+ err = vmxnet3_rq_init_all(adapter);
if (err) {
printk(KERN_ERR "Failed to init rx queue for %s: error %d\n",
adapter->netdev->name, err);
@@ -1944,10 +2290,15 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
err = -EINVAL;
goto activate_err;
}
- VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD,
- adapter->rx_queue.rx_ring[0].next2fill);
- VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD2,
- adapter->rx_queue.rx_ring[1].next2fill);
+
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ VMXNET3_WRITE_BAR0_REG(adapter, (VMXNET3_REG_RXPROD +
+ (i * VMXNET3_REG_ALIGN)),
+ adapter->rx_queue[i].rx_ring[0].next2fill);
+ VMXNET3_WRITE_BAR0_REG(adapter, (VMXNET3_REG_RXPROD2 +
+ (i * VMXNET3_REG_ALIGN)),
+ adapter->rx_queue[i].rx_ring[1].next2fill);
+ }
/* Apply the rx filter settins last. */
vmxnet3_set_mc(adapter->netdev);
@@ -1957,8 +2308,8 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
* tx queue if the link is up.
*/
vmxnet3_check_link(adapter, true);
-
- napi_enable(&adapter->napi);
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ napi_enable(&adapter->rx_queue[i].napi);
vmxnet3_enable_all_intrs(adapter);
clear_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
return 0;
@@ -1970,7 +2321,7 @@ activate_err:
irq_err:
rq_err:
/* free up buffers we allocated */
- vmxnet3_rq_cleanup(&adapter->rx_queue, adapter);
+ vmxnet3_rq_cleanup_all(adapter);
return err;
}
@@ -1985,6 +2336,7 @@ vmxnet3_reset_dev(struct vmxnet3_adapter *adapter)
int
vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter)
{
+ int i;
if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state))
return 0;
@@ -1993,13 +2345,14 @@ vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter)
VMXNET3_CMD_QUIESCE_DEV);
vmxnet3_disable_all_intrs(adapter);
- napi_disable(&adapter->napi);
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ napi_disable(&adapter->rx_queue[i].napi);
netif_tx_disable(adapter->netdev);
adapter->link_speed = 0;
netif_carrier_off(adapter->netdev);
- vmxnet3_tq_cleanup(&adapter->tx_queue, adapter);
- vmxnet3_rq_cleanup(&adapter->rx_queue, adapter);
+ vmxnet3_tq_cleanup_all(adapter);
+ vmxnet3_rq_cleanup_all(adapter);
vmxnet3_free_irqs(adapter);
return 0;
}
@@ -2121,7 +2474,9 @@ vmxnet3_free_pci_resources(struct vmxnet3_adapter *adapter)
static void
vmxnet3_adjust_rx_ring_size(struct vmxnet3_adapter *adapter)
{
- size_t sz;
+ size_t sz, i, ring0_size, ring1_size, comp_size;
+ struct vmxnet3_rx_queue *rq = &adapter->rx_queue[0];
+
if (adapter->netdev->mtu <= VMXNET3_MAX_SKB_BUF_SIZE -
VMXNET3_MAX_ETH_HDR_SIZE) {
@@ -2143,11 +2498,19 @@ vmxnet3_adjust_rx_ring_size(struct vmxnet3_adapter *adapter)
* rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN
*/
sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
- adapter->rx_queue.rx_ring[0].size = (adapter->rx_queue.rx_ring[0].size +
- sz - 1) / sz * sz;
- adapter->rx_queue.rx_ring[0].size = min_t(u32,
- adapter->rx_queue.rx_ring[0].size,
- VMXNET3_RX_RING_MAX_SIZE / sz * sz);
+ ring0_size = adapter->rx_queue[0].rx_ring[0].size;
+ ring0_size = (ring0_size + sz - 1) / sz * sz;
+ ring0_size = min_t(u32, rq->rx_ring[0].size, VMXNET3_RX_RING_MAX_SIZE /
+ sz * sz);
+ ring1_size = adapter->rx_queue[0].rx_ring[1].size;
+ comp_size = ring0_size + ring1_size;
+
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ rq = &adapter->rx_queue[i];
+ rq->rx_ring[0].size = ring0_size;
+ rq->rx_ring[1].size = ring1_size;
+ rq->comp_ring.size = comp_size;
+ }
}
@@ -2155,29 +2518,53 @@ int
vmxnet3_create_queues(struct vmxnet3_adapter *adapter, u32 tx_ring_size,
u32 rx_ring_size, u32 rx_ring2_size)
{
- int err;
-
- adapter->tx_queue.tx_ring.size = tx_ring_size;
- adapter->tx_queue.data_ring.size = tx_ring_size;
- adapter->tx_queue.comp_ring.size = tx_ring_size;
- adapter->tx_queue.shared = &adapter->tqd_start->ctrl;
- adapter->tx_queue.stopped = true;
- err = vmxnet3_tq_create(&adapter->tx_queue, adapter);
- if (err)
- return err;
+ int err = 0, i;
+
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ struct vmxnet3_tx_queue *tq = &adapter->tx_queue[i];
+ tq->tx_ring.size = tx_ring_size;
+ tq->data_ring.size = tx_ring_size;
+ tq->comp_ring.size = tx_ring_size;
+ tq->shared = &adapter->tqd_start[i].ctrl;
+ tq->stopped = true;
+ tq->adapter = adapter;
+ tq->qid = i;
+ err = vmxnet3_tq_create(tq, adapter);
+ /*
+ * Too late to change num_tx_queues. We cannot do away with
+ * lesser number of queues than what we asked for
+ */
+ if (err)
+ goto queue_err;
+ }
- adapter->rx_queue.rx_ring[0].size = rx_ring_size;
- adapter->rx_queue.rx_ring[1].size = rx_ring2_size;
+ adapter->rx_queue[0].rx_ring[0].size = rx_ring_size;
+ adapter->rx_queue[0].rx_ring[1].size = rx_ring2_size;
vmxnet3_adjust_rx_ring_size(adapter);
- adapter->rx_queue.comp_ring.size = adapter->rx_queue.rx_ring[0].size +
- adapter->rx_queue.rx_ring[1].size;
- adapter->rx_queue.qid = 0;
- adapter->rx_queue.qid2 = 1;
- adapter->rx_queue.shared = &adapter->rqd_start->ctrl;
- err = vmxnet3_rq_create(&adapter->rx_queue, adapter);
- if (err)
- vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
-
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i];
+ /* qid and qid2 for rx queues will be assigned later when num
+ * of rx queues is finalized after allocating intrs */
+ rq->shared = &adapter->rqd_start[i].ctrl;
+ rq->adapter = adapter;
+ err = vmxnet3_rq_create(rq, adapter);
+ if (err) {
+ if (i == 0) {
+ printk(KERN_ERR "Could not allocate any rx"
+ "queues. Aborting.\n");
+ goto queue_err;
+ } else {
+ printk(KERN_INFO "Number of rx queues changed "
+ "to : %d.\n", i);
+ adapter->num_rx_queues = i;
+ err = 0;
+ break;
+ }
+ }
+ }
+ return err;
+queue_err:
+ vmxnet3_tq_destroy_all(adapter);
return err;
}
@@ -2185,11 +2572,12 @@ static int
vmxnet3_open(struct net_device *netdev)
{
struct vmxnet3_adapter *adapter;
- int err;
+ int err, i;
adapter = netdev_priv(netdev);
- spin_lock_init(&adapter->tx_queue.tx_lock);
+ for (i = 0; i < adapter->num_tx_queues; i++)
+ spin_lock_init(&adapter->tx_queue[i].tx_lock);
err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE,
VMXNET3_DEF_RX_RING_SIZE,
@@ -2204,8 +2592,8 @@ vmxnet3_open(struct net_device *netdev)
return 0;
activate_err:
- vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
- vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
+ vmxnet3_rq_destroy_all(adapter);
+ vmxnet3_tq_destroy_all(adapter);
queue_err:
return err;
}
@@ -2225,8 +2613,8 @@ vmxnet3_close(struct net_device *netdev)
vmxnet3_quiesce_dev(adapter);
- vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
- vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
+ vmxnet3_rq_destroy_all(adapter);
+ vmxnet3_tq_destroy_all(adapter);
clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
@@ -2238,6 +2626,8 @@ vmxnet3_close(struct net_device *netdev)
void
vmxnet3_force_close(struct vmxnet3_adapter *adapter)
{
+ int i;
+
/*
* we must clear VMXNET3_STATE_BIT_RESETTING, otherwise
* vmxnet3_close() will deadlock.
@@ -2245,7 +2635,8 @@ vmxnet3_force_close(struct vmxnet3_adapter *adapter)
BUG_ON(test_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state));
/* we need to enable NAPI, otherwise dev_close will deadlock */
- napi_enable(&adapter->napi);
+ for (i = 0; i < adapter->num_rx_queues; i++)
+ napi_enable(&adapter->rx_queue[i].napi);
dev_close(adapter->netdev);
}
@@ -2276,14 +2667,11 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
vmxnet3_reset_dev(adapter);
/* we need to re-create the rx queue based on the new mtu */
- vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
+ vmxnet3_rq_destroy_all(adapter);
vmxnet3_adjust_rx_ring_size(adapter);
- adapter->rx_queue.comp_ring.size =
- adapter->rx_queue.rx_ring[0].size +
- adapter->rx_queue.rx_ring[1].size;
- err = vmxnet3_rq_create(&adapter->rx_queue, adapter);
+ err = vmxnet3_rq_create_all(adapter);
if (err) {
- printk(KERN_ERR "%s: failed to re-create rx queue,"
+ printk(KERN_ERR "%s: failed to re-create rx queues,"
" error %d. Closing it.\n", netdev->name, err);
goto out;
}
@@ -2348,6 +2736,55 @@ vmxnet3_read_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac)
mac[5] = (tmp >> 8) & 0xff;
}
+#ifdef CONFIG_PCI_MSI
+
+/*
+ * Enable MSIx vectors.
+ * Returns :
+ * 0 on successful enabling of required vectors,
+ * VMXNET3_LINUX_MIN_MSIX_VECT when only minumum number of vectors required
+ * could be enabled.
+ * number of vectors which can be enabled otherwise (this number is smaller
+ * than VMXNET3_LINUX_MIN_MSIX_VECT)
+ */
+
+static int
+vmxnet3_acquire_msix_vectors(struct vmxnet3_adapter *adapter,
+ int vectors)
+{
+ int err = 0, vector_threshold;
+ vector_threshold = VMXNET3_LINUX_MIN_MSIX_VECT;
+
+ while (vectors >= vector_threshold) {
+ err = pci_enable_msix(adapter->pdev, adapter->intr.msix_entries,
+ vectors);
+ if (!err) {
+ adapter->intr.num_intrs = vectors;
+ return 0;
+ } else if (err < 0) {
+ printk(KERN_ERR "Failed to enable MSI-X for %s, error"
+ " %d\n", adapter->netdev->name, err);
+ vectors = 0;
+ } else if (err < vector_threshold) {
+ break;
+ } else {
+ /* If fails to enable required number of MSI-x vectors
+ * try enabling 3 of them. One each for rx, tx and event
+ */
+ vectors = vector_threshold;
+ printk(KERN_ERR "Failed to enable %d MSI-X for %s, try"
+ " %d instead\n", vectors, adapter->netdev->name,
+ vector_threshold);
+ }
+ }
+
+ printk(KERN_INFO "Number of MSI-X interrupts which can be allocatedi"
+ " are lower than min threshold required.\n");
+ return err;
+}
+
+
+#endif /* CONFIG_PCI_MSI */
static void
vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
@@ -2367,16 +2804,47 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
#ifdef CONFIG_PCI_MSI
if (adapter->intr.type == VMXNET3_IT_MSIX) {
- int err;
-
- adapter->intr.msix_entries[0].entry = 0;
- err = pci_enable_msix(adapter->pdev, adapter->intr.msix_entries,
- VMXNET3_LINUX_MAX_MSIX_VECT);
- if (!err) {
- adapter->intr.num_intrs = 1;
- adapter->intr.type = VMXNET3_IT_MSIX;
+ int vector, err = 0;
+
+ adapter->intr.num_intrs = (adapter->share_intr ==
+ VMXNET3_INTR_TXSHARE) ? 1 :
+ adapter->num_tx_queues;
+ adapter->intr.num_intrs += (adapter->share_intr ==
+ VMXNET3_INTR_BUDDYSHARE) ? 0 :
+ adapter->num_rx_queues;
+ adapter->intr.num_intrs += 1; /* for link event */
+
+ adapter->intr.num_intrs = (adapter->intr.num_intrs >
+ VMXNET3_LINUX_MIN_MSIX_VECT
+ ? adapter->intr.num_intrs :
+ VMXNET3_LINUX_MIN_MSIX_VECT);
+
+ for (vector = 0; vector < adapter->intr.num_intrs; vector++)
+ adapter->intr.msix_entries[vector].entry = vector;
+
+ err = vmxnet3_acquire_msix_vectors(adapter,
+ adapter->intr.num_intrs);
+ /* If we cannot allocate one MSIx vector per queue
+ * then limit the number of rx queues to 1
+ */
+ if (err == VMXNET3_LINUX_MIN_MSIX_VECT) {
+ if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE
+ || adapter->num_rx_queues != 2) {
+ adapter->share_intr = VMXNET3_INTR_TXSHARE;
+ printk(KERN_ERR "Number of rx queues : 1\n");
+ adapter->num_rx_queues = 1;
+ adapter->intr.num_intrs =
+ VMXNET3_LINUX_MIN_MSIX_VECT;
+ }
return;
}
+ if (!err)
+ return;
+
+ /* If we cannot allocate MSIx vectors use only one rx queue */
+ printk(KERN_INFO "Failed to enable MSI-X for %s, error %d."
+ "#rx queues : 1, try MSI\n", adapter->netdev->name, err);
+
adapter->intr.type = VMXNET3_IT_MSI;
}
@@ -2384,12 +2852,15 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
int err;
err = pci_enable_msi(adapter->pdev);
if (!err) {
+ adapter->num_rx_queues = 1;
adapter->intr.num_intrs = 1;
return;
}
}
#endif /* CONFIG_PCI_MSI */
+ adapter->num_rx_queues = 1;
+ printk(KERN_INFO "Using INTx interrupt, #Rx queues: 1.\n");
adapter->intr.type = VMXNET3_IT_INTX;
/* INT-X related setting */
@@ -2417,6 +2888,7 @@ vmxnet3_tx_timeout(struct net_device *netdev)
printk(KERN_ERR "%s: tx hang\n", adapter->netdev->name);
schedule_work(&adapter->work);
+ netif_wake_queue(adapter->netdev);
}
@@ -2473,8 +2945,32 @@ vmxnet3_probe_device(struct pci_dev *pdev,
struct net_device *netdev;
struct vmxnet3_adapter *adapter;
u8 mac[ETH_ALEN];
+ int size;
+ int num_tx_queues = num_tqs[atomic_read(&devices_found)];
+ int num_rx_queues = num_rqs[atomic_read(&devices_found)];
+
+#ifdef VMXNET3_RSS
+ if (num_rx_queues <= 0)
+ num_rx_queues = min(VMXNET3_DEVICE_MAX_RX_QUEUES,
+ (int)num_online_cpus());
+ else
+ num_rx_queues = min(VMXNET3_DEVICE_MAX_RX_QUEUES,
+ num_rx_queues);
+#else
+ num_rx_queues = 1;
+#endif
+
+ if (num_tx_queues <= 0)
+ num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
+ (int)num_online_cpus());
+ else
+ num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
+ num_tx_queues);
+ netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter),
+ num_tx_queues);
+ printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n",
+ num_tx_queues, num_rx_queues);
- netdev = alloc_etherdev(sizeof(struct vmxnet3_adapter));
if (!netdev) {
printk(KERN_ERR "Failed to alloc ethernet device for adapter "
"%s\n", pci_name(pdev));
@@ -2496,9 +2992,12 @@ vmxnet3_probe_device(struct pci_dev *pdev,
goto err_alloc_shared;
}
- adapter->tqd_start = pci_alloc_consistent(adapter->pdev,
- sizeof(struct Vmxnet3_TxQueueDesc) +
- sizeof(struct Vmxnet3_RxQueueDesc),
+ adapter->num_rx_queues = num_rx_queues;
+ adapter->num_tx_queues = num_tx_queues;
+
+ size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues;
+ size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues;
+ adapter->tqd_start = pci_alloc_consistent(adapter->pdev, size,
&adapter->queue_desc_pa);
if (!adapter->tqd_start) {
@@ -2507,8 +3006,8 @@ vmxnet3_probe_device(struct pci_dev *pdev,
err = -ENOMEM;
goto err_alloc_queue_desc;
}
- adapter->rqd_start = (struct Vmxnet3_RxQueueDesc *)(adapter->tqd_start
- + 1);
+ adapter->rqd_start = (struct Vmxnet3_RxQueueDesc *)(adapter->tqd_start +
+ adapter->num_tx_queues);
adapter->pm_conf = kmalloc(sizeof(struct Vmxnet3_PMConf), GFP_KERNEL);
if (adapter->pm_conf == NULL) {
@@ -2518,6 +3017,17 @@ vmxnet3_probe_device(struct pci_dev *pdev,
goto err_alloc_pm;
}
+#ifdef VMXNET3_RSS
+
+ adapter->rss_conf = kmalloc(sizeof(struct UPT1_RSSConf), GFP_KERNEL);
+ if (adapter->rss_conf == NULL) {
+ printk(KERN_ERR "Failed to allocate memory for %s\n",
+ pci_name(pdev));
+ err = -ENOMEM;
+ goto err_alloc_rss;
+ }
+#endif /* VMXNET3_RSS */
+
err = vmxnet3_alloc_pci_resources(adapter, &dma64);
if (err < 0)
goto err_alloc_pci;
@@ -2545,8 +3055,32 @@ vmxnet3_probe_device(struct pci_dev *pdev,
vmxnet3_declare_features(adapter, dma64);
adapter->dev_number = atomic_read(&devices_found);
+
+ /*
+ * Sharing intr between corresponding tx and rx queues gets priority
+ * over all tx queues sharing an intr. Also, to use buddy interrupts
+ * number of tx queues should be same as number of rx queues.
+ */
+ if (share_tx_intr[adapter->dev_number] == 1)
+ adapter->share_intr = VMXNET3_INTR_TXSHARE;
+ else if (buddy_intr[adapter->dev_number] == 1 &&
+ adapter->num_tx_queues == adapter->num_rx_queues)
+ adapter->share_intr = VMXNET3_INTR_BUDDYSHARE;
+ else
+ adapter->share_intr = VMXNET3_INTR_DONTSHARE;
+
vmxnet3_alloc_intr_resources(adapter);
+#ifdef VMXNET3_RSS
+ if (adapter->num_rx_queues > 1 &&
+ adapter->intr.type == VMXNET3_IT_MSIX) {
+ adapter->rss = true;
+ printk(KERN_INFO "RSS is enabled.\n");
+ } else {
+ adapter->rss = false;
+ }
+#endif
+
vmxnet3_read_mac_addr(adapter, mac);
memcpy(netdev->dev_addr, mac, netdev->addr_len);
@@ -2556,7 +3090,18 @@ vmxnet3_probe_device(struct pci_dev *pdev,
INIT_WORK(&adapter->work, vmxnet3_reset_work);
- netif_napi_add(netdev, &adapter->napi, vmxnet3_poll, 64);
+ if (adapter->intr.type == VMXNET3_IT_MSIX) {
+ int i;
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ netif_napi_add(adapter->netdev,
+ &adapter->rx_queue[i].napi,
+ vmxnet3_poll_rx_only, 64);
+ }
+ } else {
+ netif_napi_add(adapter->netdev, &adapter->rx_queue[0].napi,
+ vmxnet3_poll, 64);
+ }
+
SET_NETDEV_DEV(netdev, &pdev->dev);
err = register_netdev(netdev);
@@ -2576,11 +3121,14 @@ err_register:
err_ver:
vmxnet3_free_pci_resources(adapter);
err_alloc_pci:
+#ifdef VMXNET3_RSS
+ kfree(adapter->rss_conf);
+err_alloc_rss:
+#endif
kfree(adapter->pm_conf);
err_alloc_pm:
- pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) +
- sizeof(struct Vmxnet3_RxQueueDesc),
- adapter->tqd_start, adapter->queue_desc_pa);
+ pci_free_consistent(adapter->pdev, size, adapter->tqd_start,
+ adapter->queue_desc_pa);
err_alloc_queue_desc:
pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared),
adapter->shared, adapter->shared_pa);
@@ -2596,6 +3144,19 @@ vmxnet3_remove_device(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
+ int size = 0;
+ int num_rx_queues = num_rqs[adapter->dev_number];
+
+#ifdef VMXNET3_RSS
+ if (num_rx_queues <= 0)
+ num_rx_queues = min(VMXNET3_DEVICE_MAX_RX_QUEUES,
+ (int)num_online_cpus());
+ else
+ num_rx_queues = min(VMXNET3_DEVICE_MAX_RX_QUEUES,
+ num_rx_queues);
+#else
+ num_rx_queues = 1;
+#endif
flush_scheduled_work();
@@ -2603,10 +3164,15 @@ vmxnet3_remove_device(struct pci_dev *pdev)
vmxnet3_free_intr_resources(adapter);
vmxnet3_free_pci_resources(adapter);
+#ifdef VMXNET3_RSS
+ kfree(adapter->rss_conf);
+#endif
kfree(adapter->pm_conf);
- pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) +
- sizeof(struct Vmxnet3_RxQueueDesc),
- adapter->tqd_start, adapter->queue_desc_pa);
+
+ size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues;
+ size += sizeof(struct Vmxnet3_RxQueueDesc) * num_rx_queues;
+ pci_free_consistent(adapter->pdev, size, adapter->tqd_start,
+ adapter->queue_desc_pa);
pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared),
adapter->shared, adapter->shared_pa);
free_netdev(netdev);
@@ -2637,7 +3203,7 @@ vmxnet3_suspend(struct device *device)
vmxnet3_free_intr_resources(adapter);
netif_device_detach(netdev);
- netif_stop_queue(netdev);
+ netif_tx_stop_all_queues(netdev);
/* Create wake-up filters. */
pmConf = adapter->pm_conf;
@@ -2782,6 +3348,7 @@ vmxnet3_init_module(void)
{
printk(KERN_INFO "%s - version %s\n", VMXNET3_DRIVER_DESC,
VMXNET3_DRIVER_VERSION_REPORT);
+ atomic_set(&devices_found, 0);
return pci_register_driver(&vmxnet3_driver);
}
@@ -2800,3 +3367,5 @@ MODULE_AUTHOR("VMware, Inc.");
MODULE_DESCRIPTION(VMXNET3_DRIVER_DESC);
MODULE_LICENSE("GPL v2");
MODULE_VERSION(VMXNET3_DRIVER_VERSION_STRING);
+
+
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 7e4b5a8..c429793 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -153,44 +153,42 @@ vmxnet3_get_stats(struct net_device *netdev)
struct UPT1_TxStats *devTxStats;
struct UPT1_RxStats *devRxStats;
struct net_device_stats *net_stats = &netdev->stats;
+ int i;
adapter = netdev_priv(netdev);
/* Collect the dev stats into the shared area */
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
- /* Assuming that we have a single queue device */
- devTxStats = &adapter->tqd_start->stats;
- devRxStats = &adapter->rqd_start->stats;
-
- /* Get access to the driver stats per queue */
- drvTxStats = &adapter->tx_queue.stats;
- drvRxStats = &adapter->rx_queue.stats;
-
memset(net_stats, 0, sizeof(*net_stats));
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ devTxStats = &adapter->tqd_start[i].stats;
+ drvTxStats = &adapter->tx_queue[i].stats;
+ net_stats->tx_packets += devTxStats->ucastPktsTxOK +
+ devTxStats->mcastPktsTxOK +
+ devTxStats->bcastPktsTxOK;
+ net_stats->tx_bytes += devTxStats->ucastBytesTxOK +
+ devTxStats->mcastBytesTxOK +
+ devTxStats->bcastBytesTxOK;
+ net_stats->tx_errors += devTxStats->pktsTxError;
+ net_stats->tx_dropped += drvTxStats->drop_total;
+ }
- net_stats->rx_packets = devRxStats->ucastPktsRxOK +
- devRxStats->mcastPktsRxOK +
- devRxStats->bcastPktsRxOK;
-
- net_stats->tx_packets = devTxStats->ucastPktsTxOK +
- devTxStats->mcastPktsTxOK +
- devTxStats->bcastPktsTxOK;
-
- net_stats->rx_bytes = devRxStats->ucastBytesRxOK +
- devRxStats->mcastBytesRxOK +
- devRxStats->bcastBytesRxOK;
-
- net_stats->tx_bytes = devTxStats->ucastBytesTxOK +
- devTxStats->mcastBytesTxOK +
- devTxStats->bcastBytesTxOK;
+ for (i = 0; i < adapter->num_rx_queues; i++) {
+ devRxStats = &adapter->rqd_start[i].stats;
+ drvRxStats = &adapter->rx_queue[i].stats;
+ net_stats->rx_packets += devRxStats->ucastPktsRxOK +
+ devRxStats->mcastPktsRxOK +
+ devRxStats->bcastPktsRxOK;
- net_stats->rx_errors = devRxStats->pktsRxError;
- net_stats->tx_errors = devTxStats->pktsTxError;
- net_stats->rx_dropped = drvRxStats->drop_total;
- net_stats->tx_dropped = drvTxStats->drop_total;
- net_stats->multicast = devRxStats->mcastPktsRxOK;
+ net_stats->rx_bytes += devRxStats->ucastBytesRxOK +
+ devRxStats->mcastBytesRxOK +
+ devRxStats->bcastBytesRxOK;
+ net_stats->rx_errors += devRxStats->pktsRxError;
+ net_stats->rx_dropped += drvRxStats->drop_total;
+ net_stats->multicast += devRxStats->mcastPktsRxOK;
+ }
return net_stats;
}
@@ -309,24 +307,26 @@ vmxnet3_get_ethtool_stats(struct net_device *netdev,
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u8 *base;
int i;
+ int j = 0;
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
/* this does assume each counter is 64-bit wide */
+/* TODO change this for multiple queues */
- base = (u8 *)&adapter->tqd_start->stats;
+ base = (u8 *)&adapter->tqd_start[j].stats;
for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
*buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset);
- base = (u8 *)&adapter->tx_queue.stats;
+ base = (u8 *)&adapter->tx_queue[j].stats;
for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
*buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset);
- base = (u8 *)&adapter->rqd_start->stats;
+ base = (u8 *)&adapter->rqd_start[j].stats;
for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
*buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset);
- base = (u8 *)&adapter->rx_queue.stats;
+ base = (u8 *)&adapter->rx_queue[j].stats;
for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
*buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset);
@@ -341,6 +341,7 @@ vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u32 *buf = p;
+ int i = 0;
memset(p, 0, vmxnet3_get_regs_len(netdev));
@@ -349,28 +350,29 @@ vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
/* Update vmxnet3_get_regs_len if we want to dump more registers */
/* make each ring use multiple of 16 bytes */
- buf[0] = adapter->tx_queue.tx_ring.next2fill;
- buf[1] = adapter->tx_queue.tx_ring.next2comp;
- buf[2] = adapter->tx_queue.tx_ring.gen;
+/* TODO change this for multiple queues */
+ buf[0] = adapter->tx_queue[i].tx_ring.next2fill;
+ buf[1] = adapter->tx_queue[i].tx_ring.next2comp;
+ buf[2] = adapter->tx_queue[i].tx_ring.gen;
buf[3] = 0;
- buf[4] = adapter->tx_queue.comp_ring.next2proc;
- buf[5] = adapter->tx_queue.comp_ring.gen;
- buf[6] = adapter->tx_queue.stopped;
+ buf[4] = adapter->tx_queue[i].comp_ring.next2proc;
+ buf[5] = adapter->tx_queue[i].comp_ring.gen;
+ buf[6] = adapter->tx_queue[i].stopped;
buf[7] = 0;
- buf[8] = adapter->rx_queue.rx_ring[0].next2fill;
- buf[9] = adapter->rx_queue.rx_ring[0].next2comp;
- buf[10] = adapter->rx_queue.rx_ring[0].gen;
+ buf[8] = adapter->rx_queue[i].rx_ring[0].next2fill;
+ buf[9] = adapter->rx_queue[i].rx_ring[0].next2comp;
+ buf[10] = adapter->rx_queue[i].rx_ring[0].gen;
buf[11] = 0;
- buf[12] = adapter->rx_queue.rx_ring[1].next2fill;
- buf[13] = adapter->rx_queue.rx_ring[1].next2comp;
- buf[14] = adapter->rx_queue.rx_ring[1].gen;
+ buf[12] = adapter->rx_queue[i].rx_ring[1].next2fill;
+ buf[13] = adapter->rx_queue[i].rx_ring[1].next2comp;
+ buf[14] = adapter->rx_queue[i].rx_ring[1].gen;
buf[15] = 0;
- buf[16] = adapter->rx_queue.comp_ring.next2proc;
- buf[17] = adapter->rx_queue.comp_ring.gen;
+ buf[16] = adapter->rx_queue[i].comp_ring.next2proc;
+ buf[17] = adapter->rx_queue[i].comp_ring.gen;
buf[18] = 0;
buf[19] = 0;
}
@@ -437,8 +439,10 @@ vmxnet3_get_ringparam(struct net_device *netdev,
param->rx_mini_max_pending = 0;
param->rx_jumbo_max_pending = 0;
- param->rx_pending = adapter->rx_queue.rx_ring[0].size;
- param->tx_pending = adapter->tx_queue.tx_ring.size;
+ param->rx_pending = adapter->rx_queue[0].rx_ring[0].size *
+ adapter->num_rx_queues;
+ param->tx_pending = adapter->tx_queue[0].tx_ring.size *
+ adapter->num_tx_queues;
param->rx_mini_pending = 0;
param->rx_jumbo_pending = 0;
}
@@ -482,8 +486,8 @@ vmxnet3_set_ringparam(struct net_device *netdev,
sz) != 0)
return -EINVAL;
- if (new_tx_ring_size == adapter->tx_queue.tx_ring.size &&
- new_rx_ring_size == adapter->rx_queue.rx_ring[0].size) {
+ if (new_tx_ring_size == adapter->tx_queue[0].tx_ring.size &&
+ new_rx_ring_size == adapter->rx_queue[0].rx_ring[0].size) {
return 0;
}
@@ -500,11 +504,12 @@ vmxnet3_set_ringparam(struct net_device *netdev,
/* recreate the rx queue and the tx queue based on the
* new sizes */
- vmxnet3_tq_destroy(&adapter->tx_queue, adapter);
- vmxnet3_rq_destroy(&adapter->rx_queue, adapter);
+ vmxnet3_tq_destroy_all(adapter);
+ vmxnet3_rq_destroy_all(adapter);
err = vmxnet3_create_queues(adapter, new_tx_ring_size,
new_rx_ring_size, VMXNET3_DEF_RX_RING_SIZE);
+
if (err) {
/* failed, most likely because of OOM, try default
* size */
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index f4ec597..c7f8332 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -68,11 +68,15 @@
/*
* Version numbers
*/
-#define VMXNET3_DRIVER_VERSION_STRING "1.0.14.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING "1.0.16.0-k"
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM 0x01000E00
+#define VMXNET3_DRIVER_VERSION_NUM 0x01001000
+#if defined(CONFIG_PCI_MSI)
+ /* RSS only makes sense if MSI-X is supported. */
+ #define VMXNET3_RSS
+#endif
/*
* Capabilities
@@ -225,16 +229,19 @@ struct vmxnet3_tx_ctx {
};
struct vmxnet3_tx_queue {
+ char name[IFNAMSIZ+8]; /* To identify interrupt */
+ struct vmxnet3_adapter *adapter;
spinlock_t tx_lock;
struct vmxnet3_cmd_ring tx_ring;
- struct vmxnet3_tx_buf_info *buf_info;
+ struct vmxnet3_tx_buf_info *buf_info;
struct vmxnet3_tx_data_ring data_ring;
struct vmxnet3_comp_ring comp_ring;
- struct Vmxnet3_TxQueueCtrl *shared;
+ struct Vmxnet3_TxQueueCtrl *shared;
struct vmxnet3_tq_driver_stats stats;
bool stopped;
int num_stop; /* # of times the queue is
* stopped */
+ int qid;
} __attribute__((__aligned__(SMP_CACHE_BYTES)));
enum vmxnet3_rx_buf_type {
@@ -266,6 +273,9 @@ struct vmxnet3_rq_driver_stats {
};
struct vmxnet3_rx_queue {
+ char name[IFNAMSIZ + 8]; /* To identify interrupt */
+ struct vmxnet3_adapter *adapter;
+ struct napi_struct napi;
struct vmxnet3_cmd_ring rx_ring[2];
struct vmxnet3_comp_ring comp_ring;
struct vmxnet3_rx_ctx rx_ctx;
@@ -279,7 +289,16 @@ struct vmxnet3_rx_queue {
struct sk_buff *spare_skb; /* starvation skb */
} __attribute__((__aligned__(SMP_CACHE_BYTES)));
-#define VMXNET3_LINUX_MAX_MSIX_VECT 1
+#define VMXNET3_DEVICE_MAX_TX_QUEUES 8
+#define VMXNET3_DEVICE_MAX_RX_QUEUES 8 /* Keep this value as a power of 2 */
+
+/* Should be less than UPT1_RSS_MAX_IND_TABLE_SIZE */
+#define VMXNET3_RSS_IND_TABLE_SIZE (VMXNET3_DEVICE_MAX_RX_QUEUES * 4)
+
+#define VMXNET3_LINUX_MAX_MSIX_VECT (VMXNET3_DEVICE_MAX_TX_QUEUES + \
+ VMXNET3_DEVICE_MAX_RX_QUEUES + 1)
+#define VMXNET3_LINUX_MIN_MSIX_VECT 3 /* 1 for each : tx, rx and event */
+
struct vmxnet3_intr {
enum vmxnet3_intr_mask_mode mask_mode;
@@ -287,28 +306,32 @@ struct vmxnet3_intr {
u8 num_intrs; /* # of intr vectors */
u8 event_intr_idx; /* idx of the intr vector for event */
u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */
+ char event_msi_vector_name[IFNAMSIZ+11];
#ifdef CONFIG_PCI_MSI
struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT];
#endif
};
+/* Interrupt sharing schemes, share_intr */
+#define VMXNET3_INTR_DONTSHARE 0 /* each queue has its own irq */
+#define VMXNET3_INTR_TXSHARE 1 /* All tx queues share one irq */
+#define VMXNET3_INTR_BUDDYSHARE 2 /* Corresponding tx,rx queues share irq */
+
#define VMXNET3_STATE_BIT_RESETTING 0
#define VMXNET3_STATE_BIT_QUIESCED 1
-struct vmxnet3_adapter {
- struct vmxnet3_tx_queue tx_queue;
- struct vmxnet3_rx_queue rx_queue;
- struct napi_struct napi;
- struct vlan_group *vlan_grp;
-
- struct vmxnet3_intr intr;
-
- struct Vmxnet3_DriverShared *shared;
- struct Vmxnet3_PMConf *pm_conf;
- struct Vmxnet3_TxQueueDesc *tqd_start; /* first tx queue desc */
- struct Vmxnet3_RxQueueDesc *rqd_start; /* first rx queue desc */
- struct net_device *netdev;
- struct pci_dev *pdev;
+struct vmxnet3_adapter {
+ struct vmxnet3_tx_queue tx_queue[VMXNET3_DEVICE_MAX_TX_QUEUES];
+ struct vmxnet3_rx_queue rx_queue[VMXNET3_DEVICE_MAX_RX_QUEUES];
+ struct vlan_group *vlan_grp;
+ struct vmxnet3_intr intr;
+ struct Vmxnet3_DriverShared *shared;
+ struct Vmxnet3_PMConf *pm_conf;
+ struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */
+ struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */
+ struct net_device *netdev;
+ struct net_device_stats net_stats;
+ struct pci_dev *pdev;
u8 *hw_addr0; /* for BAR 0 */
u8 *hw_addr1; /* for BAR 1 */
@@ -316,6 +339,12 @@ struct vmxnet3_adapter {
bool rxcsum;
bool lro;
bool jumbo_frame;
+#ifdef VMXNET3_RSS
+ struct UPT1_RSSConf *rss_conf;
+ bool rss;
+#endif
+ u32 num_rx_queues;
+ u32 num_tx_queues;
/* rx buffer related */
unsigned skb_buf_size;
@@ -335,6 +364,7 @@ struct vmxnet3_adapter {
unsigned long state; /* VMXNET3_STATE_BIT_xxx */
int dev_number;
+ int share_intr;
};
#define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \
@@ -378,12 +408,10 @@ void
vmxnet3_reset_dev(struct vmxnet3_adapter *adapter);
void
-vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq,
- struct vmxnet3_adapter *adapter);
+vmxnet3_tq_destroy_all(struct vmxnet3_adapter *adapter);
void
-vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
- struct vmxnet3_adapter *adapter);
+vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter);
int
vmxnet3_create_queues(struct vmxnet3_adapter *adapter,
^ permalink raw reply related
* Re: [PATCH 2.6.35-rc6] net-next: Add multiqueue support to vmxnet3 driver
From: Stephen Hemminger @ 2010-10-13 21:57 UTC (permalink / raw)
To: Shreyas Bhatewara; +Cc: netdev, pv-drivers, linux-kernel
In-Reply-To: <alpine.LRH.2.00.1010131445080.25989@sbhatewara-dev1.eng.vmware.com>
On Wed, 13 Oct 2010 14:47:05 -0700 (PDT)
Shreyas Bhatewara <sbhatewara@vmware.com> wrote:
> #ifdef VMXNET3_RSS
> +static unsigned int num_rss_entries;
> +#define VMXNET3_MAX_DEVICES 10
> +
> +static int rss_ind_table[VMXNET3_MAX_DEVICES *
> + VMXNET3_RSS_IND_TABLE_SIZE + 1] = {
> + [0 ... VMXNET3_MAX_DEVICES * VMXNET3_RSS_IND_TABLE_SIZE] = -1 };
> +#endif
> +static int num_tqs[VMXNET3_MAX_DEVICES + 1] = {
> + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> +static int num_rqs[VMXNET3_MAX_DEVICES + 1] = {
> + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> +static int share_tx_intr[VMXNET3_MAX_DEVICES + 1] = {
> + [0 ... VMXNET3_MAX_DEVICES] = 0 };
> +static int buddy_intr[VMXNET3_MAX_DEVICES + 1] = {
> + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> +
> +static unsigned int num_adapters;
> +module_param_array(share_tx_intr, int, &num_adapters, 0400);
> +MODULE_PARM_DESC(share_tx_intr, "Share one IRQ among all tx queue completions. "
> + "Comma separated list of 1s and 0s - one for each NIC. "
> + "1 to share, 0 to not, default is 0");
> +module_param_array(buddy_intr, int, &num_adapters, 0400);
> +MODULE_PARM_DESC(buddy_intr, "Share one IRQ among corresponding tx and rx "
> + "queues. Comma separated list of 1s and 0s - one for each "
> + "NIC. 1 to share, 0 to not, default is 1");
> +module_param_array(num_tqs, int, &num_adapters, 0400);
> +MODULE_PARM_DESC(num_tqs, "Number of transmit queues in each adapter. Comma "
> + "separated list of integers. Setting this to 0 makes number"
> + " of queues same as number of CPUs. Default is 1.");
> +
> +#ifdef VMXNET3_RSS
> +module_param_array(rss_ind_table, int, &num_rss_entries, 0400);
> +MODULE_PARM_DESC(rss_ind_table, "RSS Indirection table. Number of entries "
> + "per NIC should be 32. Each integer in a comma separated list"
> + " is an rx queue number starting with 0. Repeat the same for"
> + " all NICs.");
> +module_param_array(num_rqs, int, &num_adapters, 0400);
> +MODULE_PARM_DESC(num_rqs, "Number of receive queues in each adapter. Comma "
> + " separated list of integers. Setting this to 0 makes number"
> + " of queues same as number of CPUs. Default is 1.");
Module parameters are not right for this. They lead to different API
for interacting with each driver vendor. Is there a another better API?
Does it have to be this tweakable in a production environment.
--
^ permalink raw reply
* Re: BUG ? ipip unregister_netdevice_many()
From: David Miller @ 2010-10-13 21:58 UTC (permalink / raw)
To: jarkao2; +Cc: ebiederm, hans.schillstrom, daniel.lezcano, netdev
In-Reply-To: <20101013111946.GA9529@ff.dom.local>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Wed, 13 Oct 2010 11:19:47 +0000
>> -static void rt_do_flush(int process_context)
>> +static void rt_do_flush(struct net *net, int process_context)
>> {
>> unsigned int i;
>> struct rtable *rth, *next;
>> - struct rtable * tail;
>>
>> for (i = 0; i <= rt_hash_mask; i++) {
>> + struct rtable *list, **pprev;
>
> Isn't "list = NULL" needed here?
Yes it is, thanks for catching that.
^ permalink raw reply
* Re: BUG ? ipip unregister_netdevice_many()
From: Daniel Lezcano @ 2010-10-13 22:16 UTC (permalink / raw)
To: David Miller; +Cc: ebiederm, hans.schillstrom, netdev
In-Reply-To: <20101012.130520.48517464.davem@davemloft.net>
On 10/12/2010 10:05 PM, David Miller wrote:
> From: ebiederm@xmission.com (Eric W. Biederman)
> Date: Fri, 08 Oct 2010 10:32:40 -0700
>
>
>> It is just dealing with not flushing the entire routing cache, just the
>> routes that have expired. Which prevents one network namespace from
>> flushing it's routes and DOS'ing another.
>>
> That's a very indirect and obfuscated way of handling it.
>
I agree.
> And I still don't know why we let the first contiguous set of expired
> entries in the chain get freed outside of the lock, and the rest
> inside the lock. That really isn't explained by anything I've read.
>
> How about we just do exactly what's intended, and with no ifdefs?
>
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Dave,
do you mind to wait I test the patch before merging it ?
I would like to stress a bit this routine with multiple containers.
Thanks
-- Daniel
> Signed-off-by: David S. Miller<davem@davemloft.net>
>
> diff --git a/include/net/route.h b/include/net/route.h
> index 7e5e73b..8d24761 100644
> --- a/include/net/route.h
> +++ b/include/net/route.h
> @@ -106,7 +106,7 @@ extern int ip_rt_init(void);
> extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
> __be32 src, struct net_device *dev);
> extern void rt_cache_flush(struct net *net, int how);
> -extern void rt_cache_flush_batch(void);
> +extern void rt_cache_flush_batch(struct net *net);
> extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
> extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
> extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index 919f2ad..4039f56 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
> rt_cache_flush(dev_net(dev), 0);
> break;
> case NETDEV_UNREGISTER_BATCH:
> - rt_cache_flush_batch();
> + rt_cache_flush_batch(dev_net(dev));
> break;
> }
> return NOTIFY_DONE;
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 0755aa4..6ad730c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -712,13 +712,14 @@ static inline int rt_is_expired(struct rtable *rth)
> * Can be called by a softirq or a process.
> * In the later case, we want to be reschedule if necessary
> */
> -static void rt_do_flush(int process_context)
> +static void rt_do_flush(struct net *net, int process_context)
> {
> unsigned int i;
> struct rtable *rth, *next;
> - struct rtable * tail;
>
> for (i = 0; i<= rt_hash_mask; i++) {
> + struct rtable *list, **pprev;
> +
> if (process_context&& need_resched())
> cond_resched();
> rth = rt_hash_table[i].chain;
> @@ -726,41 +727,27 @@ static void rt_do_flush(int process_context)
> continue;
>
> spin_lock_bh(rt_hash_lock_addr(i));
> -#ifdef CONFIG_NET_NS
> - {
> - struct rtable ** prev, * p;
>
> - rth = rt_hash_table[i].chain;
> + pprev =&rt_hash_table[i].chain;
> + rth = *pprev;
> + while (rth) {
> + next = rth->dst.rt_next;
> + if (dev_net(rth->dst.dev) == net) {
> + *pprev = next;
>
> - /* defer releasing the head of the list after spin_unlock */
> - for (tail = rth; tail; tail = tail->dst.rt_next)
> - if (!rt_is_expired(tail))
> - break;
> - if (rth != tail)
> - rt_hash_table[i].chain = tail;
> -
> - /* call rt_free on entries after the tail requiring flush */
> - prev =&rt_hash_table[i].chain;
> - for (p = *prev; p; p = next) {
> - next = p->dst.rt_next;
> - if (!rt_is_expired(p)) {
> - prev =&p->dst.rt_next;
> - } else {
> - *prev = next;
> - rt_free(p);
> - }
> - }
> + rth->dst.rt_next = list;
> + list = rth;
> + } else
> + pprev =&rth->dst.rt_next;
> +
> + rth = next;
> }
> -#else
> - rth = rt_hash_table[i].chain;
> - rt_hash_table[i].chain = NULL;
> - tail = NULL;
> -#endif
> +
> spin_unlock_bh(rt_hash_lock_addr(i));
>
> - for (; rth != tail; rth = next) {
> - next = rth->dst.rt_next;
> - rt_free(rth);
> + for (; list; list = next) {
> + next = list->dst.rt_next;
> + rt_free(list);
> }
> }
> }
> @@ -906,13 +893,13 @@ void rt_cache_flush(struct net *net, int delay)
> {
> rt_cache_invalidate(net);
> if (delay>= 0)
> - rt_do_flush(!in_softirq());
> + rt_do_flush(net, !in_softirq());
> }
>
> /* Flush previous cache invalidated entries from the cache */
> -void rt_cache_flush_batch(void)
> +void rt_cache_flush_batch(struct net *net)
> {
> - rt_do_flush(!in_softirq());
> + rt_do_flush(net, !in_softirq());
> }
>
> static void rt_emergency_hash_rebuild(struct net *net)
>
>
^ permalink raw reply
* CMO ASIA WINNER
From: Dr R L Bhatia, CEO @ 2010-10-13 22:18 UTC (permalink / raw)
$1.1 MILLION USD 2010 AWARD NOTIFICATION
^ permalink raw reply
* RE: [PATCH 2.6.35-rc6] net-next: Add multiqueue support to vmxnet3 driver
From: Shreyas Bhatewara @ 2010-10-13 22:26 UTC (permalink / raw)
To: Stephen Hemminger
Cc: netdev@vger.kernel.org, pv-drivers@vmware.com,
linux-kernel@vger.kernel.org
In-Reply-To: <20101013145732.7d69d0f3@nehalam>
> -----Original Message-----
> From: Stephen Hemminger [mailto:shemminger@vyatta.com]
> Sent: Wednesday, October 13, 2010 2:58 PM
> To: Shreyas Bhatewara
> Cc: netdev@vger.kernel.org; pv-drivers@vmware.com; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 2.6.35-rc6] net-next: Add multiqueue support to
> vmxnet3 driver
>
> On Wed, 13 Oct 2010 14:47:05 -0700 (PDT)
> Shreyas Bhatewara <sbhatewara@vmware.com> wrote:
>
> > #ifdef VMXNET3_RSS
> > +static unsigned int num_rss_entries;
> > +#define VMXNET3_MAX_DEVICES 10
> > +
> > +static int rss_ind_table[VMXNET3_MAX_DEVICES *
> > + VMXNET3_RSS_IND_TABLE_SIZE + 1] = {
> > + [0 ... VMXNET3_MAX_DEVICES * VMXNET3_RSS_IND_TABLE_SIZE] = -1 };
> > +#endif
> > +static int num_tqs[VMXNET3_MAX_DEVICES + 1] = {
> > + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> > +static int num_rqs[VMXNET3_MAX_DEVICES + 1] = {
> > + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> > +static int share_tx_intr[VMXNET3_MAX_DEVICES + 1] = {
> > + [0 ... VMXNET3_MAX_DEVICES] = 0 };
> > +static int buddy_intr[VMXNET3_MAX_DEVICES + 1] = {
> > + [0 ... VMXNET3_MAX_DEVICES] = 1 };
> > +
> > +static unsigned int num_adapters;
> > +module_param_array(share_tx_intr, int, &num_adapters, 0400);
> > +MODULE_PARM_DESC(share_tx_intr, "Share one IRQ among all tx queue
> completions. "
> > + "Comma separated list of 1s and 0s - one for each NIC. "
> > + "1 to share, 0 to not, default is 0");
> > +module_param_array(buddy_intr, int, &num_adapters, 0400);
> > +MODULE_PARM_DESC(buddy_intr, "Share one IRQ among corresponding tx
> and rx "
> > + "queues. Comma separated list of 1s and 0s - one for each
> "
> > + "NIC. 1 to share, 0 to not, default is 1");
> > +module_param_array(num_tqs, int, &num_adapters, 0400);
> > +MODULE_PARM_DESC(num_tqs, "Number of transmit queues in each
> adapter. Comma "
> > + "separated list of integers. Setting this to 0 makes
> number"
> > + " of queues same as number of CPUs. Default is 1.");
> > +
> > +#ifdef VMXNET3_RSS
> > +module_param_array(rss_ind_table, int, &num_rss_entries, 0400);
> > +MODULE_PARM_DESC(rss_ind_table, "RSS Indirection table. Number of
> entries "
> > + "per NIC should be 32. Each integer in a comma separated
> list"
> > + " is an rx queue number starting with 0. Repeat the same
> for"
> > + " all NICs.");
> > +module_param_array(num_rqs, int, &num_adapters, 0400);
> > +MODULE_PARM_DESC(num_rqs, "Number of receive queues in each adapter.
> Comma "
> > + " separated list of integers. Setting this to 0 makes
> number"
> > + " of queues same as number of CPUs. Default is 1.");
>
> Module parameters are not right for this. They lead to different API
> for interacting with each driver vendor. Is there a another better API?
AFAIK, ethtool does not offer any API to program number of rx/tx queues. I saw a patch sent to netdev (http://www.mail-archive.com/netdev@vger.kernel.org/msg43923.html) to support multiqueue in ethtool but do not see it making into the mailine kernel.
> Does it have to be this tweakable in a production environment.
rss_ind_table, share_tx_intr, buddy_intr can probably be done away with. They offer flexibility to users to tune performance to their needs though. It would be better to have them and not be used than not have them and be needed. (They are ordered in increasing order of preference/usability according to me). Would you rather have them removed ?
Thanks.
->Shreyas
>
> --
^ permalink raw reply
* Re: [RFC PATCH net-next] drivers/net Documentation/networking: Create directory intel_wired_lan
From: Joe Perches @ 2010-10-13 22:28 UTC (permalink / raw)
To: Jeff Kirsher
Cc: Don, e1000-devel, Bruce Allan, Jesse Brandeburg, linux-kernel,
Greg Rose, John Ronciak, netdev
In-Reply-To: <1286841648.26045.17.camel@Joe-Laptop>
On Mon, 2010-10-11 at 17:00 -0700, Joe Perches wrote:
> On Mon, 2010-10-11 at 16:52 -0700, Jeff Kirsher wrote:
> > On Sun, Oct 10, 2010 at 13:42, Joe Perches <joe@perches.com> wrote:
> > > Perhaps it's better to move drivers from the very populated
> > > drivers/net directory into vendor specific directories similar
> > > to the Atheros approach used for drivers/net/wireless/ath/
> > NAK
> > First, I think we need to keep the documentation in /Documentation/networking.
> > Second, the changes are extensive and would create a lot of regression testing.
> I don't see any actual changes here other than layout.
> What kind of regression testing do you think necessary?
Jeff?
What regression testing would actually be done?
Any new objects are trivially validated against existing
objects.
> > We have been looking at solutions like this for future
> > drivers/hardware and is on the list of items we are currently working
> > on, but feel it should not be made retroactively due to the regression
> > testing and massive changes that would need to be made.
>
> Might as well start somewhere.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply
* Re: [Bugme-new] [Bug 20292] New: unable to handle kernel NULL pointer dereference in skb_dequeue
From: gvs @ 2010-10-13 22:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: netdev, bugzilla-daemon, bugme-daemon, Michal Ostrowski
In-Reply-To: <20101013123332.72cf90f8.akpm@linux-foundation.org>
I had no problems getting it to work properly in 2.6.35.7. However, when
I booted back into rc7 I was unable to reproduce the problem. I believe
I was running multiple pppd's that failed to authenticate at the time
the bug occured.
I'll leave it running rc7 and see if everything stays stable.
gvs
On Wed, Oct 13, 2010 at 12:33:32PM -0700, Andrew Morton wrote:
>
> (switched to email. Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
>
> On Wed, 13 Oct 2010 19:24:53 GMT
> bugzilla-daemon@bugzilla.kernel.org wrote:
>
> > https://bugzilla.kernel.org/show_bug.cgi?id=20292
> >
> > Summary: unable to handle kernel NULL pointer dereference in
> > skb_dequeue
> > Product: Networking
> > Version: 2.5
> > Kernel Version: 2.6.36-rc7
>
> Thanks. Do you know if this is a regression? Did it work OK on 2.6.35?
>
> > Platform: All
> > OS/Version: Linux
> > Tree: Mainline
> > Status: NEW
> > Severity: blocking
> > Priority: P1
> > Component: Other
> > AssignedTo: acme@ghostprotocols.net
> > ReportedBy: gvs@zemos.net
> > Regression: No
> >
> >
> > Created an attachment (id=33512)
> > --> (https://bugzilla.kernel.org/attachment.cgi?id=33512)
> > Kernel config (gzipped)
> >
> > I was trying to get pppoe working (the 'pon' command seemed to hang) and then
> > this happened:
> >
> > Oct 13 20:57:07 bes kernel: BUG: unable to handle kernel NULL pointer
> > dereference at (null)
> > Oct 13 20:57:07 bes kernel: IP: [<c1241674>] skb_dequeue+0x24/0x40
> > Oct 13 20:57:07 bes kernel: *pde = 00000000
> > Oct 13 20:57:07 bes kernel: Oops: 0002 [#1]
> > Oct 13 20:57:07 bes kernel: last sysfs file:
> > /sys/devices/virtual/net/ppp0/uevent
> > Oct 13 20:57:07 bes kernel: Modules linked in: xt_TCPMSS xt_tcpmss xt_tcpudp
> > iptable_mangle pppoe pppox ppp_generic slhc cpufreq_conservative
> > cpufreq_userspace cpufreq_powersave fuse ipt_MASQUERADE iptable_nat nf_nat
> > nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables
> > x_tables loop sd_mod usb_storage usblp i2c_viapro uhci_hcd fan ehci_hcd button
> > i2c_core
> > Oct 13 20:57:07 bes kernel:
> > Oct 13 20:57:07 bes kernel: Pid: 5495, comm: pppd Not tainted 2.6.36-rc7 #12
> > VX800 /VX800
> > Oct 13 20:57:07 bes kernel: EIP: 0060:[<c1241674>] EFLAGS: 00010046 CPU: 0
> > Oct 13 20:57:07 bes kernel: EIP is at skb_dequeue+0x24/0x40
> > Oct 13 20:57:07 bes kernel: EAX: 00000000 EBX: 00000202 ECX: f6ba4cc0 EDX:
> > 00000000
> > Oct 13 20:57:07 bes kernel: ESI: f6c93bc0 EDI: f6adfee4 EBP: f6ade000 ESP:
> > f6adfe68
> > Oct 13 20:57:07 bes kernel: DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
> > Oct 13 20:57:07 bes kernel: Process pppd (pid: 5495, ti=f6ade000 task=f70f2200
> > task.ti=f6ade000)
> > Oct 13 20:57:07 bes kernel: Stack:
> > Oct 13 20:57:07 bes kernel: f68836c4 c1243a94 f68836c0 f866825b 00000000
> > f72e4a00 f72e4a00 f86761cb
> > Oct 13 20:57:07 bes kernel: <0> f72e4a00 f8683c97 c143ea14 ffffffea c12ba92d
> > 00000286 f68f7d7c f6adfee4
> > Oct 13 20:57:07 bes kernel: <0> f68f7bfc 00000286 00000000 00000000 00000000
> > f68f7b9c f6adff68 f6adff64
> > Oct 13 20:57:07 bes kernel: Call Trace:
> > Oct 13 20:57:07 bes kernel: [<c1243a94>] ? skb_queue_purge+0x14/0x30
> > Oct 13 20:57:07 bes kernel: [<f866825b>] ? ppp_destroy_channel+0x1b/0x50
> > [ppp_generic]
> > Oct 13 20:57:07 bes kernel: [<f86761cb>] ? pppox_unbind_sock+0x1b/0x24 [pppox]
> > Oct 13 20:57:07 bes kernel: [<f8683c97>] ? pppoe_connect+0x87/0x4b0 [pppoe]
> > Oct 13 20:57:07 bes kernel: [<c12ba92d>] ? schedule_timeout+0xfd/0x150
> > Oct 13 20:57:07 bes kernel: [<c123d4d4>] ? sys_connect+0x84/0xd0
> > Oct 13 20:57:07 bes kernel: [<c10ba730>] ? do_lock_file_wait+0x30/0xf0
> > Oct 13 20:57:07 bes kernel: [<c10ba9f9>] ? fcntl_setlk+0x59/0x1b0
> > Oct 13 20:57:07 bes kernel: [<c123e5a4>] ? sys_socketcall+0x294/0x2c0
> > Oct 13 20:57:07 bes kernel: [<c1002a10>] ? sysenter_do_call+0x12/0x26
> > Oct 13 20:57:07 bes kernel: Code: 81 a8 00 00 00 5b c3 53 9c 5b fa 8b 08 39 c8
> > 74 25 85 c9 74 1b 83 68 08 01 8b 11 8b 41 04 c7 01 00 00 00 00 c7 41 04 00 00
> > 00 00 <89> 10 89 42 04 53 9d 89 c8 5b c3 31 c9 eb f6 8d b6 00 00 00 00
> > Oct 13 20:57:07 bes kernel: EIP: [<c1241674>] skb_dequeue+0x24/0x40 SS:ESP
> > 0068:f6adfe68
> > Oct 13 20:57:07 bes kernel: CR2: 0000000000000000
> > Oct 13 20:57:07 bes kernel: ---[ end trace 4914adf67d1ace25 ]---
> >
> > Oct 13 20:57:30 bes kernel: BUG: unable to handle kernel NULL pointer
> > dereference at (null)
> > Oct 13 20:57:30 bes kernel: IP: [<c1241674>] skb_dequeue+0x24/0x40
> > Oct 13 20:57:30 bes kernel: *pde = 00000000
> > Oct 13 20:57:30 bes kernel: Oops: 0002 [#2]
> > Oct 13 20:57:30 bes kernel: last sysfs file:
> > /sys/devices/virtual/net/ppp0/uevent
> > Oct 13 20:57:30 bes kernel: Modules linked in: xt_TCPMSS xt_tcpmss xt_tcpudp
> > iptable_mangle pppoe pppox ppp_generic slhc cpufreq_conservative
> > cpufreq_userspace cpufreq_powersave fuse ipt_MASQUERADE iptable_nat nf_nat
> > nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables
> > x_tables loop sd_mod usb_storage usblp i2c_viapro uhci_hcd fan ehci_hcd button
> > i2c_core
> > Oct 13 20:57:30 bes kernel:
> > Oct 13 20:57:30 bes kernel: Pid: 5445, comm: pppd Tainted: G D
> > 2.6.36-rc7 #12 VX800 /VX800
> > Oct 13 20:57:30 bes kernel: EIP: 0060:[<c1241674>] EFLAGS: 00010046 CPU: 0
> > Oct 13 20:57:30 bes kernel: EIP is at skb_dequeue+0x24/0x40
> > Oct 13 20:57:30 bes kernel: EAX: 00000000 EBX: 00000202 ECX: f6ae7200 EDX:
> > 00000000
> > Oct 13 20:57:30 bes kernel: ESI: f6c99080 EDI: f7161ee4 EBP: f7160000 ESP:
> > f7161e68
> > Oct 13 20:57:30 bes kernel: DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
> > Oct 13 20:57:30 bes kernel: Process pppd (pid: 5445, ti=f7160000 task=f7107280
> > task.ti=f7160000)
> > Oct 13 20:57:30 bes kernel: Stack:
> > Oct 13 20:57:30 bes kernel: f6883344 c1243a94 f6883340 f866825b 00000000
> > f72e4c00 f72e4c00 f86761cb
> > Oct 13 20:57:30 bes kernel: <0> f72e4c00 f8683c97 c143ea14 ffffffea c12ba92d
> > 00000286 f68f73bc f7161ee4
> > Oct 13 20:57:30 bes kernel: <0> f68f753c 00000286 00000000 00000000 00000000
> > f68f759c f7161f68 f7161f64
> > Oct 13 20:57:30 bes kernel: [<c1243a94>] ? skb_queue_purge+0x14/0x30
> > Oct 13 20:57:30 bes kernel: [<f866825b>] ? ppp_destroy_channel+0x1b/0x50
> > [ppp_generic]
> > Oct 13 20:57:30 bes kernel: [<f86761cb>] ? pppox_unbind_sock+0x1b/0x24 [pppox]
> > Oct 13 20:57:30 bes kernel: [<f8683c97>] ? pppoe_connect+0x87/0x4b0 [pppoe]
> > Oct 13 20:57:30 bes kernel: [<c12ba92d>] ? schedule_timeout+0xfd/0x150
> > Oct 13 20:57:30 bes kernel: [<c123d4d4>] ? sys_connect+0x84/0xd0
> > Oct 13 20:57:30 bes kernel: [<c10ba730>] ? do_lock_file_wait+0x30/0xf0
> > Oct 13 20:57:30 bes kernel: [<c10ba9f9>] ? fcntl_setlk+0x59/0x1b0
> > Oct 13 20:57:30 bes kernel: [<c123e5a4>] ? sys_socketcall+0x294/0x2c0
> > Oct 13 20:57:30 bes kernel: [<c1002a10>] ? sysenter_do_call+0x12/0x26
> > Oct 13 20:57:30 bes kernel: Code: 81 a8 00 00 00 5b c3 53 9c 5b fa 8b 08 39 c8
> > 74 25 85 c9 74 1b 83 68 08 01 8b 11 8b 41 04 c7 01 00 00 00 00 c7 41 04 00 00
> > 00 00 <89> 10 89 42 04 53 9d 89 c8 5b c3 31 c9 eb f6 8d b6 00 00 00 00
> > Oct 13 20:57:30 bes kernel: EIP: [<c1241674>] skb_dequeue+0x24/0x40 SS:ESP
> > 0068:f7161e68
> > Oct 13 20:57:30 bes kernel: CR2: 0000000000000000
> > Oct 13 20:57:30 bes kernel: ---[ end trace 4914adf67d1ace26 ]---
> > Oct 13 20:57:30 bes kernel: ------------[ cut here ]------------
> > Oct 13 20:57:30 bes kernel: WARNING: at kernel/softirq.c:143
> > local_bh_enable+0x60/0x90()
> > Oct 13 20:57:30 bes kernel: Hardware name: VX800
> > Oct 13 20:57:30 bes kernel: Modules linked in: xt_TCPMSS xt_tcpmss xt_tcpudp
> > iptable_mangle pppoe pppox ppp_generic slhc cpufreq_conservative
> > cpufreq_userspace cpufreq_powersave fuse ipt_MASQUERADE iptable_nat nf_nat
> > nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables
> > x_tables loop sd_mod usb_storage usblp i2c_viapro uhci_hcd fan ehci_hcd button
> > i2c_core
> > Oct 13 20:57:30 bes kernel: Pid: 5445, comm: pppd Tainted: G D
> > 2.6.36-rc7 #12
> > Oct 13 20:57:30 bes kernel: Call Trace:
> > Oct 13 20:57:30 bes kernel: [<c1028640>] ? local_bh_enable+0x60/0x90
> > Oct 13 20:57:30 bes kernel: [<c1028640>] ? local_bh_enable+0x60/0x90
> > Oct 13 20:57:30 bes kernel: [<c1023a1e>] ? warn_slowpath_common+0x7e/0xc0
> > Oct 13 20:57:30 bes kernel: [<c1028640>] ? local_bh_enable+0x60/0x90
> > Oct 13 20:57:30 bes kernel: [<c1023a7b>] ? warn_slowpath_null+0x1b/0x20
> > Oct 13 20:57:30 bes kernel: [<c1028640>] ? local_bh_enable+0x60/0x90
> > Oct 13 20:57:30 bes kernel: [<c12a5bb5>] ? unix_release_sock+0x45/0x1f0
> > Oct 13 20:57:30 bes kernel: [<c123dc4a>] ? sock_release+0x1a/0x80
> > Oct 13 20:57:30 bes kernel: [<c123dcbf>] ? sock_close+0xf/0x30
> > Oct 13 20:57:30 bes kernel: [<c1089cd9>] ? fput+0xb9/0x200
> > Oct 13 20:57:30 bes kernel: [<c1086f7e>] ? filp_close+0x3e/0x70
> > Oct 13 20:57:30 bes kernel: [<c10254b2>] ? put_files_struct+0x62/0xb0
> > Oct 13 20:57:30 bes kernel: [<c1026c47>] ? do_exit+0x567/0x630
> > Oct 13 20:57:30 bes kernel: [<c12ba037>] ? printk+0x17/0x20
> > Oct 13 20:57:30 bes kernel: [<c1005477>] ? oops_end+0x87/0x90
> > Oct 13 20:57:30 bes kernel: [<c12ba037>] ? printk+0x17/0x20
> > Oct 13 20:57:30 bes kernel: [<c10194a2>] ? no_context+0xc2/0x160
> > Oct 13 20:57:30 bes kernel: [<c10195a5>] ? __bad_area_nosemaphore+0x65/0x180
> > Oct 13 20:57:30 bes kernel: [<c1249a3b>] ? dev_txq_stats_fold+0x8b/0xf0
> > Oct 13 20:57:30 bes kernel: [<c117dc80>] ? __nla_reserve+0x40/0x60
> > Oct 13 20:57:30 bes kernel: [<c1255c33>] ? rtnl_fill_ifinfo+0x413/0x8d0
> > Oct 13 20:57:30 bes kernel: [<c101971a>] ? bad_area+0x3a/0x50
> > Oct 13 20:57:30 bes kernel: [<c1019b8e>] ? do_page_fault+0x33e/0x390
> > Oct 13 20:57:30 bes kernel: [<c101e6ab>] ? wakeup_preempt_entity+0x3b/0xa0
> > Oct 13 20:57:30 bes kernel: [<c101e79a>] ? check_preempt_wakeup+0x8a/0xe0
> > Oct 13 20:57:30 bes kernel: [<c1097675>] ? pollwake+0x65/0x80
> > Oct 13 20:57:30 bes kernel: [<c1021170>] ? default_wake_function+0x0/0x10
> > Oct 13 20:57:30 bes kernel: [<c1019850>] ? do_page_fault+0x0/0x390
> > Oct 13 20:57:30 bes kernel: [<c12bbcf0>] ? error_code+0x58/0x60
> > Oct 13 20:57:30 bes kernel: [<c1019850>] ? do_page_fault+0x0/0x390
> > Oct 13 20:57:30 bes kernel: [<c1241674>] ? skb_dequeue+0x24/0x40
> > Oct 13 20:57:30 bes kernel: [<c1243a94>] ? skb_queue_purge+0x14/0x30
> > Oct 13 20:57:30 bes kernel: [<f866825b>] ? ppp_destroy_channel+0x1b/0x50
> > [ppp_generic]
> > Oct 13 20:57:30 bes kernel: [<f86761cb>] ? pppox_unbind_sock+0x1b/0x24 [pppox]
> > Oct 13 20:57:30 bes kernel: [<f8683c97>] ? pppoe_connect+0x87/0x4b0 [pppoe]
> > Oct 13 20:57:30 bes kernel: [<c12ba92d>] ? schedule_timeout+0xfd/0x150
> > Oct 13 20:57:30 bes kernel: [<c123d4d4>] ? sys_connect+0x84/0xd0
> > Oct 13 20:57:30 bes kernel: [<c10ba730>] ? do_lock_file_wait+0x30/0xf0
> > Oct 13 20:57:30 bes kernel: [<c10ba9f9>] ? fcntl_setlk+0x59/0x1b0
> > Oct 13 20:57:30 bes kernel: [<c123e5a4>] ? sys_socketcall+0x294/0x2c0
> > Oct 13 20:57:30 bes kernel: [<c1002a10>] ? sysenter_do_call+0x12/0x26
> > Oct 13 20:57:30 bes kernel: ---[ end trace 4914adf67d1ace27 ]---
> >
> > Some other information:
> > /proc/version:
> > Linux version 2.6.36-rc7 (root@bes) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #12
> > Sun Oct 10 21:12:58 CEST 2010
> >
> > ver_linux:
> > Linux bes 2.6.36-rc7 #12 Sun Oct 10 21:12:58 CEST 2010 i686 GNU/Linux
> >
> > Gnu C 4.4.5
> > Gnu make 3.81
> > binutils 2.20.1
> > util-linux 2.17.2
> > mount support
> > module-init-tools 3.12
> > e2fsprogs 1.41.12
> > PPP 2.4.5
> > Linux C Library 2.11.2
> > Dynamic linker (ldd) 2.11.2
> > Procps 3.2.8
> > Net-tools 1.60
> > Console-tools 0.2.3
> > Sh-utils 8.5
> > Modules Loaded cpufreq_conservative cpufreq_userspace cpufreq_powersave
> > fuse ppp_generic slhc ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4
> > nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables x_tables loop
> > sd_mod usb_storage usblp i2c_viapro uhci_hcd fan i2c_core ehci_hcd button
> >
> > cpuinfo:
> > processor : 0
> > vendor_id : CentaurHauls
> > cpu family : 6
> > model : 13
> > model name : VIA Eden Processor 1600MHz
> > stepping : 0
> > cpu MHz : 800.000
> > cache size : 128 KB
> > fdiv_bug : no
> > hlt_bug : no
> > f00f_bug : no
> > coma_bug : no
> > fpu : yes
> > fpu_exception : yes
> > cpuid level : 1
> > wp : yes
> > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov pat
> > clflush acpi mmx fxsr sse sse2 tm nx pni est tm2 xtpr rng rng_en ace ace_en
> > ace2 ace2_en phe phe_en pmm pmm_en
> > bogomips : 1599.76
> > clflush size : 64
> > cache_alignment : 64
> > address sizes : 36 bits physical, 32 bits virtual
> > power management:
> >
> > If anything else is needed I'd be happy to assist.
> >
>
^ permalink raw reply
* Re: [PATCH net-next] net: allocate skbs on local node
From: David Rientjes @ 2010-10-13 22:41 UTC (permalink / raw)
To: Christoph Lameter
Cc: Pekka Enberg, Andrew Morton, Eric Dumazet, David Miller, netdev,
Michael Chan, Eilon Greenstein, Christoph Hellwig, LKML,
Nick Piggin
In-Reply-To: <alpine.DEB.2.00.1010131642220.8351@router.home>
On Wed, 13 Oct 2010, Christoph Lameter wrote:
> > I was going to mention that as an idea, but I thought storing the metadata
> > for certain debugging features might differ from the two allocators so
> > substantially that it would be even more convoluted and difficult to
> > maintain?
>
> We could have some callbacks to store allocator specific metadata?
>
It depends on whether we could share the same base for both slab (unified
allocator) and slub, which you snipped from your reply, that would make
this cleaner.
^ permalink raw reply
* [GIT PATCH] ioat2: fix performance regression
From: Dan Williams @ 2010-10-13 23:03 UTC (permalink / raw)
To: akpm, torvalds
Cc: Dave Jiang, Linus Walleij, netdev, Maciej Sosnowski,
Jesse Brandeburg, linux-kernel, stable, Richard Scobie
Commit 0793448 "DMAENGINE: generic channel status v2" changed the interface for
how dma channel progress is retrieved. It inadvertently exported an internal
helper function ioat_tx_status() instead of ioat_dma_tx_status(). The latter
polls the hardware to get the latest completion state, while the helper just
evaluates the current state without touching hardware. The effect is that we
end up waiting for completion timeouts or descriptor allocation errors before
the completion state is updated.
iperf (before fix):
[SUM] 0.0-41.3 sec 364 MBytes 73.9 Mbits/sec
iperf (after fix):
[SUM] 0.0- 4.5 sec 499 MBytes 940 Mbits/sec
This is a regression starting with 2.6.35.
Cc: <stable@kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Reported-by: Richard Scobie <richard@sauce.co.nz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Late breaking fix that can hopefully get into 2.6.36. I will queue a
cleanup to clarify this confusing naming convention for 2.6.37.
Also available via git:
git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git fixes
Dan Williams (1):
ioat2: fix performance regression
drivers/dma/ioat/dma_v2.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 216f9d3..effd140 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -879,7 +879,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca)
dma->device_issue_pending = ioat2_issue_pending;
dma->device_alloc_chan_resources = ioat2_alloc_chan_resources;
dma->device_free_chan_resources = ioat2_free_chan_resources;
- dma->device_tx_status = ioat_tx_status;
+ dma->device_tx_status = ioat_dma_tx_status;
err = ioat_probe(device);
if (err)
^ permalink raw reply related
* [PATCH net-next] tipc: cleanup function namespace
From: Stephen Hemminger @ 2010-10-13 23:20 UTC (permalink / raw)
To: David Miller, paul.gortmaker; +Cc: nhorman, netdev, allan.stephens
In-Reply-To: <20101013.142834.226768662.davem@davemloft.net>
Do some cleanups of TIPC based on make namespacecheck
1. Don't export unused symbols
2. Eliminate dead code
3. Make functions and variables local
4. Rename buf_acquire to tipc_buf_acquire since it is used in several files
Compile tested only.
This make break out of tree kernel modules that depend on TIPC routines.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
include/net/tipc/tipc.h | 71 -------------
include/net/tipc/tipc_port.h | 2
net/tipc/addr.c | 5
net/tipc/bcast.c | 10 +
net/tipc/bcast.h | 3
net/tipc/cluster.c | 21 ---
net/tipc/cluster.h | 2
net/tipc/config.c | 7 +
net/tipc/config.h | 6 -
net/tipc/core.c | 28 +----
net/tipc/core.h | 9 -
net/tipc/dbg.c | 13 +-
net/tipc/dbg.h | 3
net/tipc/discover.c | 16 --
net/tipc/discover.h | 2
net/tipc/link.c | 45 ++++----
net/tipc/link.h | 4
net/tipc/msg.c | 2
net/tipc/name_distr.c | 2
net/tipc/node.c | 19 ---
net/tipc/node.h | 1
net/tipc/port.c | 234 ++++---------------------------------------
net/tipc/port.h | 2
net/tipc/ref.c | 17 ---
net/tipc/ref.h | 1
net/tipc/subscr.c | 9 -
net/tipc/zone.c | 11 --
net/tipc/zone.h | 1
28 files changed, 84 insertions(+), 462 deletions(-)
--- a/include/net/tipc/tipc.h 2010-10-13 15:43:50.025580173 -0700
+++ b/include/net/tipc/tipc.h 2010-10-13 16:14:33.731207018 -0700
@@ -50,8 +50,6 @@
* TIPC operating mode routines
*/
-u32 tipc_get_addr(void);
-
#define TIPC_NOT_RUNNING 0
#define TIPC_NODE_MODE 1
#define TIPC_NET_MODE 2
@@ -62,8 +60,6 @@ int tipc_attach(unsigned int *userref, t
void tipc_detach(unsigned int userref);
-int tipc_get_mode(void);
-
/*
* TIPC port manipulation routines
*/
@@ -153,12 +149,6 @@ int tipc_disconnect(u32 portref);
int tipc_shutdown(u32 ref);
-int tipc_isconnected(u32 portref, int *isconnected);
-
-int tipc_peer(u32 portref, struct tipc_portid *peer);
-
-int tipc_ref_valid(u32 portref);
-
/*
* TIPC messaging routines
*/
@@ -170,38 +160,12 @@ int tipc_send(u32 portref,
unsigned int num_sect,
struct iovec const *msg_sect);
-int tipc_send_buf(u32 portref,
- struct sk_buff *buf,
- unsigned int dsz);
-
int tipc_send2name(u32 portref,
struct tipc_name const *name,
u32 domain,
unsigned int num_sect,
struct iovec const *msg_sect);
-int tipc_send_buf2name(u32 portref,
- struct tipc_name const *name,
- u32 domain,
- struct sk_buff *buf,
- unsigned int dsz);
-
-int tipc_forward2name(u32 portref,
- struct tipc_name const *name,
- u32 domain,
- unsigned int section_count,
- struct iovec const *msg_sect,
- struct tipc_portid const *origin,
- unsigned int importance);
-
-int tipc_forward_buf2name(u32 portref,
- struct tipc_name const *name,
- u32 domain,
- struct sk_buff *buf,
- unsigned int dsz,
- struct tipc_portid const *orig,
- unsigned int importance);
-
int tipc_send2port(u32 portref,
struct tipc_portid const *dest,
unsigned int num_sect,
@@ -212,46 +176,11 @@ int tipc_send_buf2port(u32 portref,
struct sk_buff *buf,
unsigned int dsz);
-int tipc_forward2port(u32 portref,
- struct tipc_portid const *dest,
- unsigned int num_sect,
- struct iovec const *msg_sect,
- struct tipc_portid const *origin,
- unsigned int importance);
-
-int tipc_forward_buf2port(u32 portref,
- struct tipc_portid const *dest,
- struct sk_buff *buf,
- unsigned int dsz,
- struct tipc_portid const *orig,
- unsigned int importance);
-
int tipc_multicast(u32 portref,
struct tipc_name_seq const *seq,
u32 domain, /* currently unused */
unsigned int section_count,
struct iovec const *msg);
-
-#if 0
-int tipc_multicast_buf(u32 portref,
- struct tipc_name_seq const *seq,
- u32 domain,
- void *buf,
- unsigned int size);
-#endif
-
-/*
- * TIPC subscription routines
- */
-
-int tipc_ispublished(struct tipc_name const *name);
-
-/*
- * Get number of available nodes within specified domain (excluding own node)
- */
-
-unsigned int tipc_available_nodes(const u32 domain);
-
#endif
#endif
--- a/net/tipc/bcast.c 2010-10-13 15:34:09.359325773 -0700
+++ b/net/tipc/bcast.c 2010-10-13 15:58:43.362005611 -0700
@@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);
const char tipc_bclink_name[] = "broadcast-link";
+static void tipc_nmap_diff(struct tipc_node_map *nm_a,
+ struct tipc_node_map *nm_b,
+ struct tipc_node_map *nm_diff);
static u32 buf_seqno(struct sk_buff *buf)
{
@@ -287,7 +290,7 @@ static void bclink_send_nack(struct tipc
if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
return;
- buf = buf_acquire(INT_H_SIZE);
+ buf = tipc_buf_acquire(INT_H_SIZE);
if (buf) {
msg = buf_msg(buf);
tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
@@ -871,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_m
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
*/
-void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
- struct tipc_node_map *nm_diff)
+static void tipc_nmap_diff(struct tipc_node_map *nm_a,
+ struct tipc_node_map *nm_b,
+ struct tipc_node_map *nm_diff)
{
int stop = ARRAY_SIZE(nm_a->map);
int w;
--- a/net/tipc/bcast.h 2010-10-13 15:34:39.167747046 -0700
+++ b/net/tipc/bcast.h 2010-10-13 15:42:10.321560582 -0700
@@ -84,9 +84,6 @@ static inline int tipc_nmap_equal(struct
return !memcmp(nm_a, nm_b, sizeof(*nm_a));
}
-void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
- struct tipc_node_map *nm_diff);
-
void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
void tipc_port_list_free(struct port_list *pl_ptr);
--- a/net/tipc/cluster.c 2010-10-13 15:44:43.583143953 -0700
+++ b/net/tipc/cluster.c 2010-10-13 16:03:22.148331782 -0700
@@ -113,25 +113,6 @@ void tipc_cltr_delete(struct cluster *c_
kfree(c_ptr);
}
-u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
-{
- struct tipc_node *n_ptr;
- u32 n_num = tipc_node(addr) + 1;
-
- if (!c_ptr)
- return addr;
- for (; n_num <= c_ptr->highest_node; n_num++) {
- n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && tipc_node_has_active_links(n_ptr))
- return n_ptr->addr;
- }
- for (n_num = 1; n_num < tipc_node(addr); n_num++) {
- n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && tipc_node_has_active_links(n_ptr))
- return n_ptr->addr;
- }
- return 0;
-}
void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
{
@@ -232,7 +213,7 @@ struct tipc_node *tipc_cltr_select_node(
static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
{
u32 size = INT_H_SIZE + data_size;
- struct sk_buff *buf = buf_acquire(size);
+ struct sk_buff *buf = tipc_buf_acquire(size);
struct tipc_msg *msg;
if (buf) {
--- a/net/tipc/config.c 2010-10-13 15:35:16.359281659 -0700
+++ b/net/tipc/config.c 2010-10-13 16:07:20.471544155 -0700
@@ -95,7 +95,7 @@ int tipc_cfg_append_tlv(struct sk_buff *
return 1;
}
-struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
+static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
{
struct sk_buff *buf;
__be32 value_net;
@@ -109,6 +109,11 @@ struct sk_buff *tipc_cfg_reply_unsigned_
return buf;
}
+static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
+{
+ return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
+}
+
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
{
struct sk_buff *buf;
--- a/net/tipc/config.h 2010-10-13 15:43:36.031261839 -0700
+++ b/net/tipc/config.h 2010-10-13 15:49:35.868009966 -0700
@@ -45,7 +45,6 @@
struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
void *tlv_data, int tlv_data_size);
-struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
static inline struct sk_buff *tipc_cfg_reply_none(void)
@@ -53,11 +52,6 @@ static inline struct sk_buff *tipc_cfg_r
return tipc_cfg_reply_alloc(0);
}
-static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
-{
- return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
-}
-
static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
{
return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
--- a/net/tipc/core.c 2010-10-13 15:32:35.750562985 -0700
+++ b/net/tipc/core.c 2010-10-13 16:00:58.197719377 -0700
@@ -96,13 +96,13 @@ int tipc_net_id;
int tipc_remote_management;
-int tipc_get_mode(void)
+static int tipc_get_mode(void)
{
return tipc_mode;
}
/**
- * buf_acquire - creates a TIPC message buffer
+ * tipc_buf_acquire - creates a TIPC message buffer
* @size: message size (including TIPC header)
*
* Returns a new buffer with data pointers set to the specified size.
@@ -111,7 +111,7 @@ int tipc_get_mode(void)
* There may also be unrequested tailroom present at the buffer's end.
*/
-struct sk_buff *buf_acquire(u32 size)
+struct sk_buff *tipc_buf_acquire(u32 size)
{
struct sk_buff *skb;
unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
@@ -129,7 +129,7 @@ struct sk_buff *buf_acquire(u32 size)
* tipc_core_stop_net - shut down TIPC networking sub-systems
*/
-void tipc_core_stop_net(void)
+static void tipc_core_stop_net(void)
{
tipc_eth_media_stop();
tipc_net_stop();
@@ -154,7 +154,7 @@ int tipc_core_start_net(unsigned long ad
* tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
*/
-void tipc_core_stop(void)
+static void tipc_core_stop(void)
{
if (tipc_mode != TIPC_NODE_MODE)
return;
@@ -176,7 +176,7 @@ void tipc_core_stop(void)
* tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
*/
-int tipc_core_start(void)
+static int tipc_core_start(void)
{
int res;
@@ -246,7 +246,6 @@ MODULE_VERSION(TIPC_MOD_VER);
EXPORT_SYMBOL(tipc_attach);
EXPORT_SYMBOL(tipc_detach);
-EXPORT_SYMBOL(tipc_get_addr);
EXPORT_SYMBOL(tipc_get_mode);
EXPORT_SYMBOL(tipc_createport);
EXPORT_SYMBOL(tipc_deleteport);
@@ -262,23 +261,10 @@ EXPORT_SYMBOL(tipc_withdraw);
EXPORT_SYMBOL(tipc_connect2port);
EXPORT_SYMBOL(tipc_disconnect);
EXPORT_SYMBOL(tipc_shutdown);
-EXPORT_SYMBOL(tipc_isconnected);
-EXPORT_SYMBOL(tipc_peer);
-EXPORT_SYMBOL(tipc_ref_valid);
EXPORT_SYMBOL(tipc_send);
-EXPORT_SYMBOL(tipc_send_buf);
EXPORT_SYMBOL(tipc_send2name);
-EXPORT_SYMBOL(tipc_forward2name);
-EXPORT_SYMBOL(tipc_send_buf2name);
-EXPORT_SYMBOL(tipc_forward_buf2name);
EXPORT_SYMBOL(tipc_send2port);
-EXPORT_SYMBOL(tipc_forward2port);
-EXPORT_SYMBOL(tipc_send_buf2port);
-EXPORT_SYMBOL(tipc_forward_buf2port);
EXPORT_SYMBOL(tipc_multicast);
-/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
-EXPORT_SYMBOL(tipc_ispublished);
-EXPORT_SYMBOL(tipc_available_nodes);
/* TIPC API for external bearers (see tipc_bearer.h) */
@@ -295,6 +281,4 @@ EXPORT_SYMBOL(tipc_createport_raw);
EXPORT_SYMBOL(tipc_reject_msg);
EXPORT_SYMBOL(tipc_send_buf_fast);
EXPORT_SYMBOL(tipc_acknowledge);
-EXPORT_SYMBOL(tipc_get_port);
-EXPORT_SYMBOL(tipc_get_handle);
--- a/net/tipc/core.h 2010-10-13 15:36:36.237690119 -0700
+++ b/net/tipc/core.h 2010-10-13 16:07:56.727164658 -0700
@@ -83,9 +83,7 @@
* Note: TIPC_LOG is configured to echo its output to the system console;
* user-defined buffers can be configured to do the same thing.
*/
-
extern struct print_buf *const TIPC_NULL;
-extern struct print_buf *const TIPC_CONS;
extern struct print_buf *const TIPC_LOG;
void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -204,10 +202,7 @@ extern atomic_t tipc_user_count;
* Routines available to privileged subsystems
*/
-extern int tipc_core_start(void);
-extern void tipc_core_stop(void);
-extern int tipc_core_start_net(unsigned long addr);
-extern void tipc_core_stop_net(void);
+extern int tipc_core_start_net(unsigned long);
extern int tipc_handler_start(void);
extern void tipc_handler_stop(void);
extern int tipc_netlink_start(void);
@@ -328,7 +323,7 @@ static inline struct tipc_msg *buf_msg(s
return (struct tipc_msg *)skb->data;
}
-extern struct sk_buff *buf_acquire(u32 size);
+extern struct sk_buff *tipc_buf_acquire(u32 size);
/**
* buf_discard - frees a TIPC message buffer
--- a/net/tipc/dbg.c 2010-10-13 15:35:34.049157629 -0700
+++ b/net/tipc/dbg.c 2010-10-13 15:58:43.362005611 -0700
@@ -52,7 +52,7 @@ static struct print_buf null_buf = { NUL
struct print_buf *const TIPC_NULL = &null_buf;
static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
-struct print_buf *const TIPC_CONS = &cons_buf;
+static struct print_buf *const TIPC_CONS = &cons_buf;
static struct print_buf log_buf = { NULL, 0, NULL, 1 };
struct print_buf *const TIPC_LOG = &log_buf;
@@ -76,6 +76,10 @@ struct print_buf *const TIPC_LOG = &log_
static char print_string[TIPC_PB_MAX_STR];
static DEFINE_SPINLOCK(print_lock);
+static void tipc_printbuf_reset(struct print_buf *pb);
+static int tipc_printbuf_empty(struct print_buf *pb);
+static void tipc_printbuf_move(struct print_buf *pb_to,
+ struct print_buf *pb_from);
#define FORMAT(PTR,LEN,FMT) \
{\
@@ -116,7 +120,7 @@ void tipc_printbuf_init(struct print_buf
* @pb: pointer to print buffer structure
*/
-void tipc_printbuf_reset(struct print_buf *pb)
+static void tipc_printbuf_reset(struct print_buf *pb)
{
if (pb->buf) {
pb->crs = pb->buf;
@@ -132,7 +136,7 @@ void tipc_printbuf_reset(struct print_bu
* Returns non-zero if print buffer is empty.
*/
-int tipc_printbuf_empty(struct print_buf *pb)
+static int tipc_printbuf_empty(struct print_buf *pb)
{
return !pb->buf || (pb->crs == pb->buf);
}
@@ -181,7 +185,8 @@ int tipc_printbuf_validate(struct print_
* Source print buffer becomes empty if a successful move occurs.
*/
-void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
+static void tipc_printbuf_move(struct print_buf *pb_to,
+ struct print_buf *pb_from)
{
int len;
--- a/net/tipc/dbg.h 2010-10-13 15:37:37.134376966 -0700
+++ b/net/tipc/dbg.h 2010-10-13 15:42:09.489660536 -0700
@@ -56,10 +56,7 @@ struct print_buf {
#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
-void tipc_printbuf_reset(struct print_buf *pb);
-int tipc_printbuf_empty(struct print_buf *pb);
int tipc_printbuf_validate(struct print_buf *pb);
-void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
int tipc_log_resize(int log_size);
--- a/net/tipc/discover.c 2010-10-13 15:38:16.357666201 -0700
+++ b/net/tipc/discover.c 2010-10-13 15:52:14.740906596 -0700
@@ -68,20 +68,6 @@ struct link_req {
unsigned int timer_intv;
};
-
-/*
- * disc_lost_link(): A link has lost contact
- */
-
-void tipc_disc_link_event(u32 addr, char *name, int up)
-{
- if (in_own_cluster(addr))
- return;
- /*
- * Code for inter cluster link setup here
- */
-}
-
/**
* tipc_disc_init_msg - initialize a link setup message
* @type: message type (request or response)
@@ -95,7 +81,7 @@ static struct sk_buff *tipc_disc_init_ms
u32 dest_domain,
struct bearer *b_ptr)
{
- struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
+ struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE);
struct tipc_msg *msg;
if (buf) {
--- a/net/tipc/discover.h 2010-10-13 15:47:41.609746110 -0700
+++ b/net/tipc/discover.h 2010-10-13 15:47:50.604664821 -0700
@@ -50,6 +50,4 @@ void tipc_disc_stop_link_req(struct link
void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
-void tipc_disc_link_event(u32 addr, char *name, int up);
-
#endif
--- a/net/tipc/link.c 2010-10-13 15:38:30.243998362 -0700
+++ b/net/tipc/link.c 2010-10-13 15:53:47.961684397 -0700
@@ -112,6 +112,9 @@ static void link_state_event(struct link
static void link_reset_statistics(struct link *l_ptr);
static void link_print(struct link *l_ptr, struct print_buf *buf,
const char *str);
+static void link_start(struct link *l_ptr);
+static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
+
/*
* Debugging code used by link routines only
@@ -442,7 +445,7 @@ struct link *tipc_link_create(struct bea
k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
list_add_tail(&l_ptr->link_list, &b_ptr->links);
- tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
+ tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
@@ -482,9 +485,9 @@ void tipc_link_delete(struct link *l_ptr
kfree(l_ptr);
}
-void tipc_link_start(struct link *l_ptr)
+static void link_start(struct link *l_ptr)
{
- dbg("tipc_link_start %x\n", l_ptr);
+ dbg("link_start %x\n", l_ptr);
link_state_event(l_ptr, STARTING_EVT);
}
@@ -1000,7 +1003,7 @@ int tipc_link_send_buf(struct link *l_pt
/* Fragmentation needed ? */
if (size > max_packet)
- return tipc_link_send_long_buf(l_ptr, buf);
+ return link_send_long_buf(l_ptr, buf);
/* Packet can be queued or sent: */
@@ -1036,7 +1039,7 @@ int tipc_link_send_buf(struct link *l_pt
/* Try creating a new bundle */
if (size <= max_packet * 2 / 3) {
- struct sk_buff *bundler = buf_acquire(max_packet);
+ struct sk_buff *bundler = tipc_buf_acquire(max_packet);
struct tipc_msg bundler_hdr;
if (bundler) {
@@ -1312,7 +1315,7 @@ again:
/* Prepare header of first fragment: */
- buf_chain = buf = buf_acquire(max_pkt);
+ buf_chain = buf = tipc_buf_acquire(max_pkt);
if (!buf)
return -ENOMEM;
buf->next = NULL;
@@ -1369,7 +1372,7 @@ error:
msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
msg_set_fragm_no(&fragm_hdr, ++fragm_no);
prev = buf;
- buf = buf_acquire(fragm_sz + INT_H_SIZE);
+ buf = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
if (!buf)
goto error;
@@ -2145,7 +2148,7 @@ void tipc_link_send_proto_msg(struct lin
if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
if (!l_ptr->proto_msg_queue) {
l_ptr->proto_msg_queue =
- buf_acquire(sizeof(l_ptr->proto_msg));
+ tipc_buf_acquire(sizeof(l_ptr->proto_msg));
}
buf = l_ptr->proto_msg_queue;
if (!buf)
@@ -2159,7 +2162,7 @@ void tipc_link_send_proto_msg(struct lin
msg_dbg(msg, ">>");
- buf = buf_acquire(msg_size);
+ buf = tipc_buf_acquire(msg_size);
if (!buf)
return;
@@ -2318,10 +2321,10 @@ exit:
* tipc_link_tunnel(): Send one message via a link belonging to
* another bearer. Owner node is locked.
*/
-void tipc_link_tunnel(struct link *l_ptr,
- struct tipc_msg *tunnel_hdr,
- struct tipc_msg *msg,
- u32 selector)
+static void tipc_link_tunnel(struct link *l_ptr,
+ struct tipc_msg *tunnel_hdr,
+ struct tipc_msg *msg,
+ u32 selector)
{
struct link *tunnel;
struct sk_buff *buf;
@@ -2334,7 +2337,7 @@ void tipc_link_tunnel(struct link *l_ptr
return;
}
msg_set_size(tunnel_hdr, length + INT_H_SIZE);
- buf = buf_acquire(length + INT_H_SIZE);
+ buf = tipc_buf_acquire(length + INT_H_SIZE);
if (!buf) {
warn("Link changeover error, "
"unable to send tunnel msg\n");
@@ -2380,7 +2383,7 @@ void tipc_link_changeover(struct link *l
if (!l_ptr->first_out) {
struct sk_buff *buf;
- buf = buf_acquire(INT_H_SIZE);
+ buf = tipc_buf_acquire(INT_H_SIZE);
if (buf) {
skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
msg_set_size(&tunnel_hdr, INT_H_SIZE);
@@ -2441,7 +2444,7 @@ void tipc_link_send_duplicate(struct lin
msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
- outbuf = buf_acquire(length + INT_H_SIZE);
+ outbuf = tipc_buf_acquire(length + INT_H_SIZE);
if (outbuf == NULL) {
warn("Link changeover error, "
"unable to send duplicate msg\n");
@@ -2477,7 +2480,7 @@ static struct sk_buff *buf_extract(struc
u32 size = msg_size(msg);
struct sk_buff *eb;
- eb = buf_acquire(size);
+ eb = tipc_buf_acquire(size);
if (eb)
skb_copy_to_linear_data(eb, msg, size);
return eb;
@@ -2605,11 +2608,11 @@ void tipc_link_recv_bundle(struct sk_buf
/*
- * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
+ * link_send_long_buf: Entry for buffers needing fragmentation.
* The buffer is complete, inclusive total message length.
* Returns user data length.
*/
-int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
+static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
{
struct tipc_msg *inmsg = buf_msg(buf);
struct tipc_msg fragm_hdr;
@@ -2648,7 +2651,7 @@ int tipc_link_send_long_buf(struct link
fragm_sz = rest;
msg_set_type(&fragm_hdr, LAST_FRAGMENT);
}
- fragm = buf_acquire(fragm_sz + INT_H_SIZE);
+ fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
if (fragm == NULL) {
warn("Link unable to fragment message\n");
dsz = -ENOMEM;
@@ -2753,7 +2756,7 @@ int tipc_link_recv_fragment(struct sk_bu
buf_discard(fbuf);
return 0;
}
- pbuf = buf_acquire(msg_size(imsg));
+ pbuf = tipc_buf_acquire(msg_size(imsg));
if (pbuf != NULL) {
pbuf->next = *pending;
*pending = pbuf;
--- a/net/tipc/link.h 2010-10-13 15:51:49.403953468 -0700
+++ b/net/tipc/link.h 2010-10-13 15:52:06.877852172 -0700
@@ -225,7 +225,6 @@ void tipc_link_send_duplicate(struct lin
void tipc_link_reset_fragments(struct link *l_ptr);
int tipc_link_is_up(struct link *l_ptr);
int tipc_link_is_active(struct link *l_ptr);
-void tipc_link_start(struct link *l_ptr);
u32 tipc_link_push_packet(struct link *l_ptr);
void tipc_link_stop(struct link *l_ptr);
struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
@@ -239,9 +238,6 @@ int tipc_link_send_sections_fast(struct
struct iovec const *msg_sect,
const u32 num_sect,
u32 destnode);
-int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
-void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
- struct tipc_msg *msg, u32 selector);
void tipc_link_recv_bundle(struct sk_buff *buf);
int tipc_link_recv_fragment(struct sk_buff **pending,
struct sk_buff **fb,
--- a/net/tipc/msg.c 2010-10-13 15:45:42.760031835 -0700
+++ b/net/tipc/msg.c 2010-10-13 15:45:52.410871897 -0700
@@ -112,7 +112,7 @@ int tipc_msg_build(struct tipc_msg *hdr,
return dsz;
}
- *buf = buf_acquire(sz);
+ *buf = tipc_buf_acquire(sz);
if (!(*buf))
return -ENOMEM;
skb_copy_to_linear_data(*buf, hdr, hsz);
--- a/net/tipc/name_distr.c 2010-10-13 15:45:56.098428684 -0700
+++ b/net/tipc/name_distr.c 2010-10-13 15:46:05.505298048 -0700
@@ -98,7 +98,7 @@ static void publ_to_item(struct distr_it
static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
{
- struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size);
+ struct sk_buff *buf = tipc_buf_acquire(LONG_H_SIZE + size);
struct tipc_msg *msg;
if (buf != NULL) {
--- a/net/tipc/node.c 2010-10-13 15:39:25.165401568 -0700
+++ b/net/tipc/node.c 2010-10-13 16:03:21.564402314 -0700
@@ -50,7 +50,8 @@ void node_print(struct print_buf *buf, s
static void node_lost_contact(struct tipc_node *n_ptr);
static void node_established_contact(struct tipc_node *n_ptr);
-struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
+/* sorted list of nodes within cluster */
+static struct tipc_node *tipc_nodes = NULL;
static DEFINE_SPINLOCK(node_create_lock);
@@ -587,22 +588,6 @@ void tipc_node_remove_router(struct tipc
node_lost_contact(n_ptr);
}
-u32 tipc_available_nodes(const u32 domain)
-{
- struct tipc_node *n_ptr;
- u32 cnt = 0;
-
- read_lock_bh(&tipc_net_lock);
- for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
- if (!tipc_in_scope(domain, n_ptr->addr))
- continue;
- if (tipc_node_is_up(n_ptr))
- cnt++;
- }
- read_unlock_bh(&tipc_net_lock);
- return cnt;
-}
-
struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
{
u32 domain;
--- a/net/tipc/node.h 2010-10-13 15:54:01.616035253 -0700
+++ b/net/tipc/node.h 2010-10-13 15:54:11.830801530 -0700
@@ -96,7 +96,6 @@ struct tipc_node {
} bclink;
};
-extern struct tipc_node *tipc_nodes;
extern u32 tipc_own_tag;
struct tipc_node *tipc_node_create(u32 addr);
--- a/net/tipc/port.c 2010-10-13 15:40:52.362926772 -0700
+++ b/net/tipc/port.c 2010-10-13 16:16:41.435779874 -0700
@@ -293,34 +293,6 @@ int tipc_deleteport(u32 ref)
return 0;
}
-/**
- * tipc_get_port() - return port associated with 'ref'
- *
- * Note: Port is not locked.
- */
-
-struct tipc_port *tipc_get_port(const u32 ref)
-{
- return (struct tipc_port *)tipc_ref_deref(ref);
-}
-
-/**
- * tipc_get_handle - return user handle associated to port 'ref'
- */
-
-void *tipc_get_handle(const u32 ref)
-{
- struct port *p_ptr;
- void * handle;
-
- p_ptr = tipc_port_lock(ref);
- if (!p_ptr)
- return NULL;
- handle = p_ptr->publ.usr_handle;
- tipc_port_unlock(p_ptr);
- return handle;
-}
-
static int port_unreliable(struct port *p_ptr)
{
return msg_src_droppable(&p_ptr->publ.phdr);
@@ -392,7 +364,7 @@ static struct sk_buff *port_build_proto_
struct sk_buff *buf;
struct tipc_msg *msg;
- buf = buf_acquire(LONG_H_SIZE);
+ buf = tipc_buf_acquire(LONG_H_SIZE);
if (buf) {
msg = buf_msg(buf);
tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
@@ -433,7 +405,7 @@ int tipc_reject_msg(struct sk_buff *buf,
hdr_sz = MCAST_H_SIZE;
else
hdr_sz = LONG_H_SIZE;
- rbuf = buf_acquire(data_sz + hdr_sz);
+ rbuf = tipc_buf_acquire(data_sz + hdr_sz);
if (rbuf == NULL) {
buf_discard(buf);
return data_sz;
@@ -1242,50 +1214,13 @@ int tipc_shutdown(u32 ref)
return tipc_disconnect(ref);
}
-int tipc_isconnected(u32 ref, int *isconnected)
-{
- struct port *p_ptr;
-
- p_ptr = tipc_port_lock(ref);
- if (!p_ptr)
- return -EINVAL;
- *isconnected = p_ptr->publ.connected;
- tipc_port_unlock(p_ptr);
- return 0;
-}
-
-int tipc_peer(u32 ref, struct tipc_portid *peer)
-{
- struct port *p_ptr;
- int res;
-
- p_ptr = tipc_port_lock(ref);
- if (!p_ptr)
- return -EINVAL;
- if (p_ptr->publ.connected) {
- peer->ref = port_peerport(p_ptr);
- peer->node = port_peernode(p_ptr);
- res = 0;
- } else
- res = -ENOTCONN;
- tipc_port_unlock(p_ptr);
- return res;
-}
-
-int tipc_ref_valid(u32 ref)
-{
- /* Works irrespective of type */
- return !!tipc_ref_deref(ref);
-}
-
-
/*
* tipc_port_recv_sections(): Concatenate and deliver sectioned
* message for this node.
*/
-int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
- struct iovec const *msg_sect)
+static int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
+ struct iovec const *msg_sect)
{
struct sk_buff *buf;
int res;
@@ -1336,65 +1271,16 @@ int tipc_send(u32 ref, unsigned int num_
}
/**
- * tipc_send_buf - send message buffer on connection
- */
-
-int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
-{
- struct port *p_ptr;
- struct tipc_msg *msg;
- u32 destnode;
- u32 hsz;
- u32 sz;
- u32 res;
-
- p_ptr = tipc_port_deref(ref);
- if (!p_ptr || !p_ptr->publ.connected)
- return -EINVAL;
-
- msg = &p_ptr->publ.phdr;
- hsz = msg_hdr_sz(msg);
- sz = hsz + dsz;
- msg_set_size(msg, sz);
- if (skb_cow(buf, hsz))
- return -ENOMEM;
-
- skb_push(buf, hsz);
- skb_copy_to_linear_data(buf, msg, hsz);
- destnode = msg_destnode(msg);
- p_ptr->publ.congested = 1;
- if (!tipc_port_congested(p_ptr)) {
- if (likely(destnode != tipc_own_addr))
- res = tipc_send_buf_fast(buf, destnode);
- else {
- tipc_port_recv_msg(buf);
- res = sz;
- }
- if (likely(res != -ELINKCONG)) {
- port_incr_out_seqno(p_ptr);
- p_ptr->sent++;
- p_ptr->publ.congested = 0;
- return res;
- }
- }
- if (port_unreliable(p_ptr)) {
- p_ptr->publ.congested = 0;
- return dsz;
- }
- return -ELINKCONG;
-}
-
-/**
* tipc_forward2name - forward message sections to port name
*/
-int tipc_forward2name(u32 ref,
- struct tipc_name const *name,
- u32 domain,
- u32 num_sect,
- struct iovec const *msg_sect,
- struct tipc_portid const *orig,
- unsigned int importance)
+static int tipc_forward2name(u32 ref,
+ struct tipc_name const *name,
+ u32 domain,
+ u32 num_sect,
+ struct iovec const *msg_sect,
+ struct tipc_portid const *orig,
+ unsigned int importance)
{
struct port *p_ptr;
struct tipc_msg *msg;
@@ -1457,89 +1343,15 @@ int tipc_send2name(u32 ref,
}
/**
- * tipc_forward_buf2name - forward message buffer to port name
- */
-
-int tipc_forward_buf2name(u32 ref,
- struct tipc_name const *name,
- u32 domain,
- struct sk_buff *buf,
- unsigned int dsz,
- struct tipc_portid const *orig,
- unsigned int importance)
-{
- struct port *p_ptr;
- struct tipc_msg *msg;
- u32 destnode = domain;
- u32 destport;
- int res;
-
- p_ptr = (struct port *)tipc_ref_deref(ref);
- if (!p_ptr || p_ptr->publ.connected)
- return -EINVAL;
-
- msg = &p_ptr->publ.phdr;
- if (importance <= TIPC_CRITICAL_IMPORTANCE)
- msg_set_importance(msg, importance);
- msg_set_type(msg, TIPC_NAMED_MSG);
- msg_set_orignode(msg, orig->node);
- msg_set_origport(msg, orig->ref);
- msg_set_nametype(msg, name->type);
- msg_set_nameinst(msg, name->instance);
- msg_set_lookup_scope(msg, tipc_addr_scope(domain));
- msg_set_hdr_sz(msg, LONG_H_SIZE);
- msg_set_size(msg, LONG_H_SIZE + dsz);
- destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
- msg_set_destnode(msg, destnode);
- msg_set_destport(msg, destport);
- msg_dbg(msg, "forw2name ==> ");
- if (skb_cow(buf, LONG_H_SIZE))
- return -ENOMEM;
- skb_push(buf, LONG_H_SIZE);
- skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
- msg_dbg(buf_msg(buf),"PREP:");
- if (likely(destport)) {
- p_ptr->sent++;
- if (destnode == tipc_own_addr)
- return tipc_port_recv_msg(buf);
- res = tipc_send_buf_fast(buf, destnode);
- if (likely(res != -ELINKCONG))
- return res;
- if (port_unreliable(p_ptr))
- return dsz;
- return -ELINKCONG;
- }
- return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
-}
-
-/**
- * tipc_send_buf2name - send message buffer to port name
- */
-
-int tipc_send_buf2name(u32 ref,
- struct tipc_name const *dest,
- u32 domain,
- struct sk_buff *buf,
- unsigned int dsz)
-{
- struct tipc_portid orig;
-
- orig.ref = ref;
- orig.node = tipc_own_addr;
- return tipc_forward_buf2name(ref, dest, domain, buf, dsz, &orig,
- TIPC_PORT_IMPORTANCE);
-}
-
-/**
* tipc_forward2port - forward message sections to port identity
*/
-int tipc_forward2port(u32 ref,
- struct tipc_portid const *dest,
- unsigned int num_sect,
- struct iovec const *msg_sect,
- struct tipc_portid const *orig,
- unsigned int importance)
+static int tipc_forward2port(u32 ref,
+ struct tipc_portid const *dest,
+ unsigned int num_sect,
+ struct iovec const *msg_sect,
+ struct tipc_portid const *orig,
+ unsigned int importance)
{
struct port *p_ptr;
struct tipc_msg *msg;
@@ -1591,12 +1403,12 @@ int tipc_send2port(u32 ref,
/**
* tipc_forward_buf2port - forward message buffer to port identity
*/
-int tipc_forward_buf2port(u32 ref,
- struct tipc_portid const *dest,
- struct sk_buff *buf,
- unsigned int dsz,
- struct tipc_portid const *orig,
- unsigned int importance)
+static int tipc_forward_buf2port(u32 ref,
+ struct tipc_portid const *dest,
+ struct sk_buff *buf,
+ unsigned int dsz,
+ struct tipc_portid const *orig,
+ unsigned int importance)
{
struct port *p_ptr;
struct tipc_msg *msg;
--- a/net/tipc/port.h 2010-10-13 15:48:09.502393058 -0700
+++ b/net/tipc/port.h 2010-10-13 16:14:00.819182858 -0700
@@ -109,8 +109,6 @@ struct port {
extern spinlock_t tipc_port_list_lock;
struct port_list;
-int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
- struct iovec const *msg_sect);
int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect,
int err);
--- a/net/tipc/ref.c 2010-10-13 15:41:13.468391212 -0700
+++ b/net/tipc/ref.c 2010-10-13 16:03:20.908481542 -0700
@@ -282,23 +282,6 @@ void *tipc_ref_lock(u32 ref)
return NULL;
}
-/**
- * tipc_ref_unlock - unlock referenced object
- */
-
-void tipc_ref_unlock(u32 ref)
-{
- if (likely(tipc_ref_table.entries)) {
- struct reference *entry;
-
- entry = &tipc_ref_table.entries[ref &
- tipc_ref_table.index_mask];
- if (likely((entry->ref == ref) && (entry->object)))
- spin_unlock_bh(&entry->lock);
- else
- err("Attempt to unlock non-existent reference\n");
- }
-}
/**
* tipc_ref_deref - return pointer referenced object (without locking it)
--- a/net/tipc/ref.h 2010-10-13 15:47:56.028012866 -0700
+++ b/net/tipc/ref.h 2010-10-13 15:48:04.642977233 -0700
@@ -44,7 +44,6 @@ u32 tipc_ref_acquire(void *object, spinl
void tipc_ref_discard(u32 ref);
void *tipc_ref_lock(u32 ref);
-void tipc_ref_unlock(u32 ref);
void *tipc_ref_deref(u32 ref);
#endif
--- a/net/tipc/zone.c 2010-10-13 15:41:49.324083397 -0700
+++ b/net/tipc/zone.c 2010-10-13 15:54:26.329050453 -0700
@@ -160,14 +160,3 @@ u32 tipc_zone_select_router(struct _zone
}
return 0;
}
-
-
-u32 tipc_zone_next_node(u32 addr)
-{
- struct cluster *c_ptr = tipc_cltr_find(addr);
-
- if (c_ptr)
- return tipc_cltr_next_node(c_ptr, addr);
- return 0;
-}
-
--- a/net/tipc/zone.h 2010-10-13 15:48:24.460594837 -0700
+++ b/net/tipc/zone.h 2010-10-13 15:48:33.715482229 -0700
@@ -61,7 +61,6 @@ void tipc_zone_send_external_routes(stru
struct _zone *tipc_zone_create(u32 addr);
void tipc_zone_delete(struct _zone *z_ptr);
void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
-u32 tipc_zone_next_node(u32 addr);
static inline struct _zone *tipc_zone_find(u32 addr)
{
--- a/net/tipc/addr.c 2010-10-13 15:33:41.742641197 -0700
+++ b/net/tipc/addr.c 2010-10-13 16:02:50.348172914 -0700
@@ -41,11 +41,6 @@
#include "cluster.h"
#include "net.h"
-u32 tipc_get_addr(void)
-{
- return tipc_own_addr;
-}
-
/**
* tipc_addr_domain_valid - validates a network domain address
*
--- a/net/tipc/cluster.h 2010-10-13 16:01:44.276153671 -0700
+++ b/net/tipc/cluster.h 2010-10-13 16:01:56.218711152 -0700
@@ -75,7 +75,7 @@ void tipc_cltr_attach_node(struct cluste
void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
void tipc_cltr_broadcast(struct sk_buff *buf);
int tipc_cltr_init(void);
-u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
+
void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
--- a/net/tipc/subscr.c 2010-10-13 16:01:08.020532905 -0700
+++ b/net/tipc/subscr.c 2010-10-13 16:03:03.330604772 -0700
@@ -598,12 +598,3 @@ void tipc_subscr_stop(void)
topsrv.user_ref = 0;
}
}
-
-
-int tipc_ispublished(struct tipc_name const *name)
-{
- u32 domain = 0;
-
- return tipc_nametbl_translate(name->type, name->instance, &domain) != 0;
-}
-
--- a/include/net/tipc/tipc_port.h 2010-10-13 16:05:35.080274751 -0700
+++ b/include/net/tipc/tipc_port.h 2010-10-13 16:06:14.247543618 -0700
@@ -88,8 +88,6 @@ void tipc_acknowledge(u32 port_ref,u32 a
struct tipc_port *tipc_get_port(const u32 ref);
-void *tipc_get_handle(const u32 ref);
-
/*
* The following routines require that the port be locked on entry
*/
^ permalink raw reply
* Re: BUG ? ipip unregister_netdevice_many()
From: David Miller @ 2010-10-13 23:23 UTC (permalink / raw)
To: daniel.lezcano; +Cc: ebiederm, hans.schillstrom, netdev
In-Reply-To: <4CB62FAF.1030009@free.fr>
From: Daniel Lezcano <daniel.lezcano@free.fr>
Date: Thu, 14 Oct 2010 00:16:15 +0200
> do you mind to wait I test the patch before merging it ?
> I would like to stress a bit this routine with multiple containers.
Yes, it would be great if you could test this.
Please make sure you get the fix for the bug that
Jarek found ('list' needs to be initialized to NULL)
I've included the latest version below:
diff --git a/include/net/route.h b/include/net/route.h
index 7e5e73b..8d24761 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -106,7 +106,7 @@ extern int ip_rt_init(void);
extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
__be32 src, struct net_device *dev);
extern void rt_cache_flush(struct net *net, int how);
-extern void rt_cache_flush_batch(void);
+extern void rt_cache_flush_batch(struct net *net);
extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 919f2ad..4039f56 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
rt_cache_flush(dev_net(dev), 0);
break;
case NETDEV_UNREGISTER_BATCH:
- rt_cache_flush_batch();
+ rt_cache_flush_batch(dev_net(dev));
break;
}
return NOTIFY_DONE;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0755aa4..6ad730c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -712,13 +712,14 @@ static inline int rt_is_expired(struct rtable *rth)
* Can be called by a softirq or a process.
* In the later case, we want to be reschedule if necessary
*/
-static void rt_do_flush(int process_context)
+static void rt_do_flush(struct net *net, int process_context)
{
unsigned int i;
struct rtable *rth, *next;
- struct rtable * tail;
for (i = 0; i <= rt_hash_mask; i++) {
+ struct rtable *list = NULL, **pprev;
+
if (process_context && need_resched())
cond_resched();
rth = rt_hash_table[i].chain;
@@ -726,41 +727,27 @@ static void rt_do_flush(int process_context)
continue;
spin_lock_bh(rt_hash_lock_addr(i));
-#ifdef CONFIG_NET_NS
- {
- struct rtable ** prev, * p;
- rth = rt_hash_table[i].chain;
+ pprev = &rt_hash_table[i].chain;
+ rth = *pprev;
+ while (rth) {
+ next = rth->dst.rt_next;
+ if (dev_net(rth->dst.dev) == net) {
+ *pprev = next;
- /* defer releasing the head of the list after spin_unlock */
- for (tail = rth; tail; tail = tail->dst.rt_next)
- if (!rt_is_expired(tail))
- break;
- if (rth != tail)
- rt_hash_table[i].chain = tail;
-
- /* call rt_free on entries after the tail requiring flush */
- prev = &rt_hash_table[i].chain;
- for (p = *prev; p; p = next) {
- next = p->dst.rt_next;
- if (!rt_is_expired(p)) {
- prev = &p->dst.rt_next;
- } else {
- *prev = next;
- rt_free(p);
- }
- }
+ rth->dst.rt_next = list;
+ list = rth;
+ } else
+ pprev = &rth->dst.rt_next;
+
+ rth = next;
}
-#else
- rth = rt_hash_table[i].chain;
- rt_hash_table[i].chain = NULL;
- tail = NULL;
-#endif
+
spin_unlock_bh(rt_hash_lock_addr(i));
- for (; rth != tail; rth = next) {
- next = rth->dst.rt_next;
- rt_free(rth);
+ for (; list; list = next) {
+ next = list->dst.rt_next;
+ rt_free(list);
}
}
}
@@ -906,13 +893,13 @@ void rt_cache_flush(struct net *net, int delay)
{
rt_cache_invalidate(net);
if (delay >= 0)
- rt_do_flush(!in_softirq());
+ rt_do_flush(net, !in_softirq());
}
/* Flush previous cache invalidated entries from the cache */
-void rt_cache_flush_batch(void)
+void rt_cache_flush_batch(struct net *net)
{
- rt_do_flush(!in_softirq());
+ rt_do_flush(net, !in_softirq());
}
static void rt_emergency_hash_rebuild(struct net *net)
^ permalink raw reply related
* Re: [PATCH net-next] tipc: cleanup function namespace
From: Paul Gortmaker @ 2010-10-14 0:23 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, nhorman, netdev, allan.stephens
In-Reply-To: <20101013162035.0c2e8123@nehalam>
On 10-10-13 07:20 PM, Stephen Hemminger wrote:
> Do some cleanups of TIPC based on make namespacecheck
> 1. Don't export unused symbols
> 2. Eliminate dead code
> 3. Make functions and variables local
> 4. Rename buf_acquire to tipc_buf_acquire since it is used in several files
>
> Compile tested only.
> This make break out of tree kernel modules that depend on TIPC routines.
Hi Stephen,
When I first started looking at TIPC code, I too came to the
same conclusion as you did and was about to do #1,2,3 -- but
then I was told that the exported symbols were part of an API
and might be in use by folks here and there as per this thread:
http://www.mail-archive.com/netdev@vger.kernel.org/msg30208.html
I'm generally the 1st one to agree that the kernel should not
be libc, and that exporting all sorts of functions without a
clearly defined use case so that one can insert all sorts of
brewed up modules is *not* the way to go -- and was asking if
we could phase this API out if nobody was using it:
http://sourceforge.net/mailarchive/message.php?msg_name=29C1DC0826876849BDD9F1C67ABA294308C1FEB6%40ala-mail09.corp.ad.wrs.com
...but apparently there are a couple of API users out there.
I'd like to better understand their use case(es) and what parts
of this API they use, but I haven't got that far yet, since
there are a bunch of other TIPC bugfixes and changes queued on
sourceforge which need cleaning and integration into mainline.
I was thinking one idea would be to wrap them in a TIPC specific
Kconfig (off by default) so that it would at least highlight
this atypical use case for EXPORT_SYMBOL -- which might help
bring these users to the surface so we can learn about their
use cases. Having it as a Kconfig option would also help in
giving us something to point our finger at for the feature
removal file, if indeed we could find a better way for these
users to get done whatever it is that they are doing.
In any event, I think your #2 (dead code) and #3 (add static)
are items considered dead or candidates for static because
of #1, i.e. tossing the API exports out.
I've already tossed out the explicitly dead code in #if 0
blocks -- Dave just merged that today. But the #4 from your
list seems to make sense, and we can do that as a standalone
item of course.
Thanks,
Paul.
>
> Signed-off-by: Stephen Hemminger<shemminger@vyatta.com>
>
> ---
> include/net/tipc/tipc.h | 71 -------------
> include/net/tipc/tipc_port.h | 2
> net/tipc/addr.c | 5
> net/tipc/bcast.c | 10 +
> net/tipc/bcast.h | 3
> net/tipc/cluster.c | 21 ---
> net/tipc/cluster.h | 2
> net/tipc/config.c | 7 +
> net/tipc/config.h | 6 -
> net/tipc/core.c | 28 +----
> net/tipc/core.h | 9 -
> net/tipc/dbg.c | 13 +-
> net/tipc/dbg.h | 3
> net/tipc/discover.c | 16 --
> net/tipc/discover.h | 2
> net/tipc/link.c | 45 ++++----
> net/tipc/link.h | 4
> net/tipc/msg.c | 2
> net/tipc/name_distr.c | 2
> net/tipc/node.c | 19 ---
> net/tipc/node.h | 1
> net/tipc/port.c | 234 ++++---------------------------------------
> net/tipc/port.h | 2
> net/tipc/ref.c | 17 ---
> net/tipc/ref.h | 1
> net/tipc/subscr.c | 9 -
> net/tipc/zone.c | 11 --
> net/tipc/zone.h | 1
> 28 files changed, 84 insertions(+), 462 deletions(-)
>
> --- a/include/net/tipc/tipc.h 2010-10-13 15:43:50.025580173 -0700
> +++ b/include/net/tipc/tipc.h 2010-10-13 16:14:33.731207018 -0700
> @@ -50,8 +50,6 @@
> * TIPC operating mode routines
> */
>
> -u32 tipc_get_addr(void);
> -
> #define TIPC_NOT_RUNNING 0
> #define TIPC_NODE_MODE 1
> #define TIPC_NET_MODE 2
> @@ -62,8 +60,6 @@ int tipc_attach(unsigned int *userref, t
>
> void tipc_detach(unsigned int userref);
>
> -int tipc_get_mode(void);
> -
> /*
> * TIPC port manipulation routines
> */
> @@ -153,12 +149,6 @@ int tipc_disconnect(u32 portref);
>
> int tipc_shutdown(u32 ref);
>
> -int tipc_isconnected(u32 portref, int *isconnected);
> -
> -int tipc_peer(u32 portref, struct tipc_portid *peer);
> -
> -int tipc_ref_valid(u32 portref);
> -
> /*
> * TIPC messaging routines
> */
> @@ -170,38 +160,12 @@ int tipc_send(u32 portref,
> unsigned int num_sect,
> struct iovec const *msg_sect);
>
> -int tipc_send_buf(u32 portref,
> - struct sk_buff *buf,
> - unsigned int dsz);
> -
> int tipc_send2name(u32 portref,
> struct tipc_name const *name,
> u32 domain,
> unsigned int num_sect,
> struct iovec const *msg_sect);
>
> -int tipc_send_buf2name(u32 portref,
> - struct tipc_name const *name,
> - u32 domain,
> - struct sk_buff *buf,
> - unsigned int dsz);
> -
> -int tipc_forward2name(u32 portref,
> - struct tipc_name const *name,
> - u32 domain,
> - unsigned int section_count,
> - struct iovec const *msg_sect,
> - struct tipc_portid const *origin,
> - unsigned int importance);
> -
> -int tipc_forward_buf2name(u32 portref,
> - struct tipc_name const *name,
> - u32 domain,
> - struct sk_buff *buf,
> - unsigned int dsz,
> - struct tipc_portid const *orig,
> - unsigned int importance);
> -
> int tipc_send2port(u32 portref,
> struct tipc_portid const *dest,
> unsigned int num_sect,
> @@ -212,46 +176,11 @@ int tipc_send_buf2port(u32 portref,
> struct sk_buff *buf,
> unsigned int dsz);
>
> -int tipc_forward2port(u32 portref,
> - struct tipc_portid const *dest,
> - unsigned int num_sect,
> - struct iovec const *msg_sect,
> - struct tipc_portid const *origin,
> - unsigned int importance);
> -
> -int tipc_forward_buf2port(u32 portref,
> - struct tipc_portid const *dest,
> - struct sk_buff *buf,
> - unsigned int dsz,
> - struct tipc_portid const *orig,
> - unsigned int importance);
> -
> int tipc_multicast(u32 portref,
> struct tipc_name_seq const *seq,
> u32 domain, /* currently unused */
> unsigned int section_count,
> struct iovec const *msg);
> -
> -#if 0
> -int tipc_multicast_buf(u32 portref,
> - struct tipc_name_seq const *seq,
> - u32 domain,
> - void *buf,
> - unsigned int size);
> -#endif
> -
> -/*
> - * TIPC subscription routines
> - */
> -
> -int tipc_ispublished(struct tipc_name const *name);
> -
> -/*
> - * Get number of available nodes within specified domain (excluding own node)
> - */
> -
> -unsigned int tipc_available_nodes(const u32 domain);
> -
> #endif
>
> #endif
> --- a/net/tipc/bcast.c 2010-10-13 15:34:09.359325773 -0700
> +++ b/net/tipc/bcast.c 2010-10-13 15:58:43.362005611 -0700
> @@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);
>
> const char tipc_bclink_name[] = "broadcast-link";
>
> +static void tipc_nmap_diff(struct tipc_node_map *nm_a,
> + struct tipc_node_map *nm_b,
> + struct tipc_node_map *nm_diff);
>
> static u32 buf_seqno(struct sk_buff *buf)
> {
> @@ -287,7 +290,7 @@ static void bclink_send_nack(struct tipc
> if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
> return;
>
> - buf = buf_acquire(INT_H_SIZE);
> + buf = tipc_buf_acquire(INT_H_SIZE);
> if (buf) {
> msg = buf_msg(buf);
> tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
> @@ -871,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_m
> * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
> */
>
> -void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
> - struct tipc_node_map *nm_diff)
> +static void tipc_nmap_diff(struct tipc_node_map *nm_a,
> + struct tipc_node_map *nm_b,
> + struct tipc_node_map *nm_diff)
> {
> int stop = ARRAY_SIZE(nm_a->map);
> int w;
> --- a/net/tipc/bcast.h 2010-10-13 15:34:39.167747046 -0700
> +++ b/net/tipc/bcast.h 2010-10-13 15:42:10.321560582 -0700
> @@ -84,9 +84,6 @@ static inline int tipc_nmap_equal(struct
> return !memcmp(nm_a, nm_b, sizeof(*nm_a));
> }
>
> -void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
> - struct tipc_node_map *nm_diff);
> -
> void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
> void tipc_port_list_free(struct port_list *pl_ptr);
>
> --- a/net/tipc/cluster.c 2010-10-13 15:44:43.583143953 -0700
> +++ b/net/tipc/cluster.c 2010-10-13 16:03:22.148331782 -0700
> @@ -113,25 +113,6 @@ void tipc_cltr_delete(struct cluster *c_
> kfree(c_ptr);
> }
>
> -u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
> -{
> - struct tipc_node *n_ptr;
> - u32 n_num = tipc_node(addr) + 1;
> -
> - if (!c_ptr)
> - return addr;
> - for (; n_num<= c_ptr->highest_node; n_num++) {
> - n_ptr = c_ptr->nodes[n_num];
> - if (n_ptr&& tipc_node_has_active_links(n_ptr))
> - return n_ptr->addr;
> - }
> - for (n_num = 1; n_num< tipc_node(addr); n_num++) {
> - n_ptr = c_ptr->nodes[n_num];
> - if (n_ptr&& tipc_node_has_active_links(n_ptr))
> - return n_ptr->addr;
> - }
> - return 0;
> -}
>
> void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
> {
> @@ -232,7 +213,7 @@ struct tipc_node *tipc_cltr_select_node(
> static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
> {
> u32 size = INT_H_SIZE + data_size;
> - struct sk_buff *buf = buf_acquire(size);
> + struct sk_buff *buf = tipc_buf_acquire(size);
> struct tipc_msg *msg;
>
> if (buf) {
> --- a/net/tipc/config.c 2010-10-13 15:35:16.359281659 -0700
> +++ b/net/tipc/config.c 2010-10-13 16:07:20.471544155 -0700
> @@ -95,7 +95,7 @@ int tipc_cfg_append_tlv(struct sk_buff *
> return 1;
> }
>
> -struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
> +static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
> {
> struct sk_buff *buf;
> __be32 value_net;
> @@ -109,6 +109,11 @@ struct sk_buff *tipc_cfg_reply_unsigned_
> return buf;
> }
>
> +static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
> +{
> + return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
> +}
> +
> struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
> {
> struct sk_buff *buf;
> --- a/net/tipc/config.h 2010-10-13 15:43:36.031261839 -0700
> +++ b/net/tipc/config.h 2010-10-13 15:49:35.868009966 -0700
> @@ -45,7 +45,6 @@
> struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
> int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
> void *tlv_data, int tlv_data_size);
> -struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
> struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
>
> static inline struct sk_buff *tipc_cfg_reply_none(void)
> @@ -53,11 +52,6 @@ static inline struct sk_buff *tipc_cfg_r
> return tipc_cfg_reply_alloc(0);
> }
>
> -static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
> -{
> - return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
> -}
> -
> static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
> {
> return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
> --- a/net/tipc/core.c 2010-10-13 15:32:35.750562985 -0700
> +++ b/net/tipc/core.c 2010-10-13 16:00:58.197719377 -0700
> @@ -96,13 +96,13 @@ int tipc_net_id;
> int tipc_remote_management;
>
>
> -int tipc_get_mode(void)
> +static int tipc_get_mode(void)
> {
> return tipc_mode;
> }
>
> /**
> - * buf_acquire - creates a TIPC message buffer
> + * tipc_buf_acquire - creates a TIPC message buffer
> * @size: message size (including TIPC header)
> *
> * Returns a new buffer with data pointers set to the specified size.
> @@ -111,7 +111,7 @@ int tipc_get_mode(void)
> * There may also be unrequested tailroom present at the buffer's end.
> */
>
> -struct sk_buff *buf_acquire(u32 size)
> +struct sk_buff *tipc_buf_acquire(u32 size)
> {
> struct sk_buff *skb;
> unsigned int buf_size = (BUF_HEADROOM + size + 3)& ~3u;
> @@ -129,7 +129,7 @@ struct sk_buff *buf_acquire(u32 size)
> * tipc_core_stop_net - shut down TIPC networking sub-systems
> */
>
> -void tipc_core_stop_net(void)
> +static void tipc_core_stop_net(void)
> {
> tipc_eth_media_stop();
> tipc_net_stop();
> @@ -154,7 +154,7 @@ int tipc_core_start_net(unsigned long ad
> * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
> */
>
> -void tipc_core_stop(void)
> +static void tipc_core_stop(void)
> {
> if (tipc_mode != TIPC_NODE_MODE)
> return;
> @@ -176,7 +176,7 @@ void tipc_core_stop(void)
> * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
> */
>
> -int tipc_core_start(void)
> +static int tipc_core_start(void)
> {
> int res;
>
> @@ -246,7 +246,6 @@ MODULE_VERSION(TIPC_MOD_VER);
>
> EXPORT_SYMBOL(tipc_attach);
> EXPORT_SYMBOL(tipc_detach);
> -EXPORT_SYMBOL(tipc_get_addr);
> EXPORT_SYMBOL(tipc_get_mode);
> EXPORT_SYMBOL(tipc_createport);
> EXPORT_SYMBOL(tipc_deleteport);
> @@ -262,23 +261,10 @@ EXPORT_SYMBOL(tipc_withdraw);
> EXPORT_SYMBOL(tipc_connect2port);
> EXPORT_SYMBOL(tipc_disconnect);
> EXPORT_SYMBOL(tipc_shutdown);
> -EXPORT_SYMBOL(tipc_isconnected);
> -EXPORT_SYMBOL(tipc_peer);
> -EXPORT_SYMBOL(tipc_ref_valid);
> EXPORT_SYMBOL(tipc_send);
> -EXPORT_SYMBOL(tipc_send_buf);
> EXPORT_SYMBOL(tipc_send2name);
> -EXPORT_SYMBOL(tipc_forward2name);
> -EXPORT_SYMBOL(tipc_send_buf2name);
> -EXPORT_SYMBOL(tipc_forward_buf2name);
> EXPORT_SYMBOL(tipc_send2port);
> -EXPORT_SYMBOL(tipc_forward2port);
> -EXPORT_SYMBOL(tipc_send_buf2port);
> -EXPORT_SYMBOL(tipc_forward_buf2port);
> EXPORT_SYMBOL(tipc_multicast);
> -/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
> -EXPORT_SYMBOL(tipc_ispublished);
> -EXPORT_SYMBOL(tipc_available_nodes);
>
> /* TIPC API for external bearers (see tipc_bearer.h) */
>
> @@ -295,6 +281,4 @@ EXPORT_SYMBOL(tipc_createport_raw);
> EXPORT_SYMBOL(tipc_reject_msg);
> EXPORT_SYMBOL(tipc_send_buf_fast);
> EXPORT_SYMBOL(tipc_acknowledge);
> -EXPORT_SYMBOL(tipc_get_port);
> -EXPORT_SYMBOL(tipc_get_handle);
>
> --- a/net/tipc/core.h 2010-10-13 15:36:36.237690119 -0700
> +++ b/net/tipc/core.h 2010-10-13 16:07:56.727164658 -0700
> @@ -83,9 +83,7 @@
> * Note: TIPC_LOG is configured to echo its output to the system console;
> * user-defined buffers can be configured to do the same thing.
> */
> -
> extern struct print_buf *const TIPC_NULL;
> -extern struct print_buf *const TIPC_CONS;
> extern struct print_buf *const TIPC_LOG;
>
> void tipc_printf(struct print_buf *, const char *fmt, ...);
> @@ -204,10 +202,7 @@ extern atomic_t tipc_user_count;
> * Routines available to privileged subsystems
> */
>
> -extern int tipc_core_start(void);
> -extern void tipc_core_stop(void);
> -extern int tipc_core_start_net(unsigned long addr);
> -extern void tipc_core_stop_net(void);
> +extern int tipc_core_start_net(unsigned long);
> extern int tipc_handler_start(void);
> extern void tipc_handler_stop(void);
> extern int tipc_netlink_start(void);
> @@ -328,7 +323,7 @@ static inline struct tipc_msg *buf_msg(s
> return (struct tipc_msg *)skb->data;
> }
>
> -extern struct sk_buff *buf_acquire(u32 size);
> +extern struct sk_buff *tipc_buf_acquire(u32 size);
>
> /**
> * buf_discard - frees a TIPC message buffer
> --- a/net/tipc/dbg.c 2010-10-13 15:35:34.049157629 -0700
> +++ b/net/tipc/dbg.c 2010-10-13 15:58:43.362005611 -0700
> @@ -52,7 +52,7 @@ static struct print_buf null_buf = { NUL
> struct print_buf *const TIPC_NULL =&null_buf;
>
> static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
> -struct print_buf *const TIPC_CONS =&cons_buf;
> +static struct print_buf *const TIPC_CONS =&cons_buf;
>
> static struct print_buf log_buf = { NULL, 0, NULL, 1 };
> struct print_buf *const TIPC_LOG =&log_buf;
> @@ -76,6 +76,10 @@ struct print_buf *const TIPC_LOG =&log_
> static char print_string[TIPC_PB_MAX_STR];
> static DEFINE_SPINLOCK(print_lock);
>
> +static void tipc_printbuf_reset(struct print_buf *pb);
> +static int tipc_printbuf_empty(struct print_buf *pb);
> +static void tipc_printbuf_move(struct print_buf *pb_to,
> + struct print_buf *pb_from);
>
> #define FORMAT(PTR,LEN,FMT) \
> {\
> @@ -116,7 +120,7 @@ void tipc_printbuf_init(struct print_buf
> * @pb: pointer to print buffer structure
> */
>
> -void tipc_printbuf_reset(struct print_buf *pb)
> +static void tipc_printbuf_reset(struct print_buf *pb)
> {
> if (pb->buf) {
> pb->crs = pb->buf;
> @@ -132,7 +136,7 @@ void tipc_printbuf_reset(struct print_bu
> * Returns non-zero if print buffer is empty.
> */
>
> -int tipc_printbuf_empty(struct print_buf *pb)
> +static int tipc_printbuf_empty(struct print_buf *pb)
> {
> return !pb->buf || (pb->crs == pb->buf);
> }
> @@ -181,7 +185,8 @@ int tipc_printbuf_validate(struct print_
> * Source print buffer becomes empty if a successful move occurs.
> */
>
> -void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
> +static void tipc_printbuf_move(struct print_buf *pb_to,
> + struct print_buf *pb_from)
> {
> int len;
>
> --- a/net/tipc/dbg.h 2010-10-13 15:37:37.134376966 -0700
> +++ b/net/tipc/dbg.h 2010-10-13 15:42:09.489660536 -0700
> @@ -56,10 +56,7 @@ struct print_buf {
> #define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
>
> void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
> -void tipc_printbuf_reset(struct print_buf *pb);
> -int tipc_printbuf_empty(struct print_buf *pb);
> int tipc_printbuf_validate(struct print_buf *pb);
> -void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
>
> int tipc_log_resize(int log_size);
>
> --- a/net/tipc/discover.c 2010-10-13 15:38:16.357666201 -0700
> +++ b/net/tipc/discover.c 2010-10-13 15:52:14.740906596 -0700
> @@ -68,20 +68,6 @@ struct link_req {
> unsigned int timer_intv;
> };
>
> -
> -/*
> - * disc_lost_link(): A link has lost contact
> - */
> -
> -void tipc_disc_link_event(u32 addr, char *name, int up)
> -{
> - if (in_own_cluster(addr))
> - return;
> - /*
> - * Code for inter cluster link setup here
> - */
> -}
> -
> /**
> * tipc_disc_init_msg - initialize a link setup message
> * @type: message type (request or response)
> @@ -95,7 +81,7 @@ static struct sk_buff *tipc_disc_init_ms
> u32 dest_domain,
> struct bearer *b_ptr)
> {
> - struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
> + struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE);
> struct tipc_msg *msg;
>
> if (buf) {
> --- a/net/tipc/discover.h 2010-10-13 15:47:41.609746110 -0700
> +++ b/net/tipc/discover.h 2010-10-13 15:47:50.604664821 -0700
> @@ -50,6 +50,4 @@ void tipc_disc_stop_link_req(struct link
>
> void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
>
> -void tipc_disc_link_event(u32 addr, char *name, int up);
> -
> #endif
> --- a/net/tipc/link.c 2010-10-13 15:38:30.243998362 -0700
> +++ b/net/tipc/link.c 2010-10-13 15:53:47.961684397 -0700
> @@ -112,6 +112,9 @@ static void link_state_event(struct link
> static void link_reset_statistics(struct link *l_ptr);
> static void link_print(struct link *l_ptr, struct print_buf *buf,
> const char *str);
> +static void link_start(struct link *l_ptr);
> +static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
> +
>
> /*
> * Debugging code used by link routines only
> @@ -442,7 +445,7 @@ struct link *tipc_link_create(struct bea
>
> k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
> list_add_tail(&l_ptr->link_list,&b_ptr->links);
> - tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
> + tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
>
> dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
> l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
> @@ -482,9 +485,9 @@ void tipc_link_delete(struct link *l_ptr
> kfree(l_ptr);
> }
>
> -void tipc_link_start(struct link *l_ptr)
> +static void link_start(struct link *l_ptr)
> {
> - dbg("tipc_link_start %x\n", l_ptr);
> + dbg("link_start %x\n", l_ptr);
> link_state_event(l_ptr, STARTING_EVT);
> }
>
> @@ -1000,7 +1003,7 @@ int tipc_link_send_buf(struct link *l_pt
> /* Fragmentation needed ? */
>
> if (size> max_packet)
> - return tipc_link_send_long_buf(l_ptr, buf);
> + return link_send_long_buf(l_ptr, buf);
>
> /* Packet can be queued or sent: */
>
> @@ -1036,7 +1039,7 @@ int tipc_link_send_buf(struct link *l_pt
> /* Try creating a new bundle */
>
> if (size<= max_packet * 2 / 3) {
> - struct sk_buff *bundler = buf_acquire(max_packet);
> + struct sk_buff *bundler = tipc_buf_acquire(max_packet);
> struct tipc_msg bundler_hdr;
>
> if (bundler) {
> @@ -1312,7 +1315,7 @@ again:
>
> /* Prepare header of first fragment: */
>
> - buf_chain = buf = buf_acquire(max_pkt);
> + buf_chain = buf = tipc_buf_acquire(max_pkt);
> if (!buf)
> return -ENOMEM;
> buf->next = NULL;
> @@ -1369,7 +1372,7 @@ error:
> msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
> msg_set_fragm_no(&fragm_hdr, ++fragm_no);
> prev = buf;
> - buf = buf_acquire(fragm_sz + INT_H_SIZE);
> + buf = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
> if (!buf)
> goto error;
>
> @@ -2145,7 +2148,7 @@ void tipc_link_send_proto_msg(struct lin
> if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
> if (!l_ptr->proto_msg_queue) {
> l_ptr->proto_msg_queue =
> - buf_acquire(sizeof(l_ptr->proto_msg));
> + tipc_buf_acquire(sizeof(l_ptr->proto_msg));
> }
> buf = l_ptr->proto_msg_queue;
> if (!buf)
> @@ -2159,7 +2162,7 @@ void tipc_link_send_proto_msg(struct lin
>
> msg_dbg(msg, ">>");
>
> - buf = buf_acquire(msg_size);
> + buf = tipc_buf_acquire(msg_size);
> if (!buf)
> return;
>
> @@ -2318,10 +2321,10 @@ exit:
> * tipc_link_tunnel(): Send one message via a link belonging to
> * another bearer. Owner node is locked.
> */
> -void tipc_link_tunnel(struct link *l_ptr,
> - struct tipc_msg *tunnel_hdr,
> - struct tipc_msg *msg,
> - u32 selector)
> +static void tipc_link_tunnel(struct link *l_ptr,
> + struct tipc_msg *tunnel_hdr,
> + struct tipc_msg *msg,
> + u32 selector)
> {
> struct link *tunnel;
> struct sk_buff *buf;
> @@ -2334,7 +2337,7 @@ void tipc_link_tunnel(struct link *l_ptr
> return;
> }
> msg_set_size(tunnel_hdr, length + INT_H_SIZE);
> - buf = buf_acquire(length + INT_H_SIZE);
> + buf = tipc_buf_acquire(length + INT_H_SIZE);
> if (!buf) {
> warn("Link changeover error, "
> "unable to send tunnel msg\n");
> @@ -2380,7 +2383,7 @@ void tipc_link_changeover(struct link *l
> if (!l_ptr->first_out) {
> struct sk_buff *buf;
>
> - buf = buf_acquire(INT_H_SIZE);
> + buf = tipc_buf_acquire(INT_H_SIZE);
> if (buf) {
> skb_copy_to_linear_data(buf,&tunnel_hdr, INT_H_SIZE);
> msg_set_size(&tunnel_hdr, INT_H_SIZE);
> @@ -2441,7 +2444,7 @@ void tipc_link_send_duplicate(struct lin
> msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
> msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
> msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
> - outbuf = buf_acquire(length + INT_H_SIZE);
> + outbuf = tipc_buf_acquire(length + INT_H_SIZE);
> if (outbuf == NULL) {
> warn("Link changeover error, "
> "unable to send duplicate msg\n");
> @@ -2477,7 +2480,7 @@ static struct sk_buff *buf_extract(struc
> u32 size = msg_size(msg);
> struct sk_buff *eb;
>
> - eb = buf_acquire(size);
> + eb = tipc_buf_acquire(size);
> if (eb)
> skb_copy_to_linear_data(eb, msg, size);
> return eb;
> @@ -2605,11 +2608,11 @@ void tipc_link_recv_bundle(struct sk_buf
>
>
> /*
> - * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
> + * link_send_long_buf: Entry for buffers needing fragmentation.
> * The buffer is complete, inclusive total message length.
> * Returns user data length.
> */
> -int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
> +static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
> {
> struct tipc_msg *inmsg = buf_msg(buf);
> struct tipc_msg fragm_hdr;
> @@ -2648,7 +2651,7 @@ int tipc_link_send_long_buf(struct link
> fragm_sz = rest;
> msg_set_type(&fragm_hdr, LAST_FRAGMENT);
> }
> - fragm = buf_acquire(fragm_sz + INT_H_SIZE);
> + fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
> if (fragm == NULL) {
> warn("Link unable to fragment message\n");
> dsz = -ENOMEM;
> @@ -2753,7 +2756,7 @@ int tipc_link_recv_fragment(struct sk_bu
> buf_discard(fbuf);
> return 0;
> }
> - pbuf = buf_acquire(msg_size(imsg));
> + pbuf = tipc_buf_acquire(msg_size(imsg));
> if (pbuf != NULL) {
> pbuf->next = *pending;
> *pending = pbuf;
> --- a/net/tipc/link.h 2010-10-13 15:51:49.403953468 -0700
> +++ b/net/tipc/link.h 2010-10-13 15:52:06.877852172 -0700
> @@ -225,7 +225,6 @@ void tipc_link_send_duplicate(struct lin
> void tipc_link_reset_fragments(struct link *l_ptr);
> int tipc_link_is_up(struct link *l_ptr);
> int tipc_link_is_active(struct link *l_ptr);
> -void tipc_link_start(struct link *l_ptr);
> u32 tipc_link_push_packet(struct link *l_ptr);
> void tipc_link_stop(struct link *l_ptr);
> struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
> @@ -239,9 +238,6 @@ int tipc_link_send_sections_fast(struct
> struct iovec const *msg_sect,
> const u32 num_sect,
> u32 destnode);
> -int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
> -void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
> - struct tipc_msg *msg, u32 selector);
> void tipc_link_recv_bundle(struct sk_buff *buf);
> int tipc_link_recv_fragment(struct sk_buff **pending,
> struct sk_buff **fb,
> --- a/net/tipc/msg.c 2010-10-13 15:45:42.760031835 -0700
> +++ b/net/tipc/msg.c 2010-10-13 15:45:52.410871897 -0700
> @@ -112,7 +112,7 @@ int tipc_msg_build(struct tipc_msg *hdr,
> return dsz;
> }
>
> - *buf = buf_acquire(sz);
> + *buf = tipc_buf_acquire(sz);
> if (!(*buf))
> return -ENOMEM;
> skb_copy_to_linear_data(*buf, hdr, hsz);
> --- a/net/tipc/name_distr.c 2010-10-13 15:45:56.098428684 -0700
> +++ b/net/tipc/name_distr.c 2010-10-13 15:46:05.505298048 -0700
> @@ -98,7 +98,7 @@ static void publ_to_item(struct distr_it
>
> static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
> {
> - struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size);
> + struct sk_buff *buf = tipc_buf_acquire(LONG_H_SIZE + size);
> struct tipc_msg *msg;
>
> if (buf != NULL) {
> --- a/net/tipc/node.c 2010-10-13 15:39:25.165401568 -0700
> +++ b/net/tipc/node.c 2010-10-13 16:03:21.564402314 -0700
> @@ -50,7 +50,8 @@ void node_print(struct print_buf *buf, s
> static void node_lost_contact(struct tipc_node *n_ptr);
> static void node_established_contact(struct tipc_node *n_ptr);
>
> -struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
> +/* sorted list of nodes within cluster */
> +static struct tipc_node *tipc_nodes = NULL;
>
> static DEFINE_SPINLOCK(node_create_lock);
>
> @@ -587,22 +588,6 @@ void tipc_node_remove_router(struct tipc
> node_lost_contact(n_ptr);
> }
>
> -u32 tipc_available_nodes(const u32 domain)
> -{
> - struct tipc_node *n_ptr;
> - u32 cnt = 0;
> -
> - read_lock_bh(&tipc_net_lock);
> - for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
> - if (!tipc_in_scope(domain, n_ptr->addr))
> - continue;
> - if (tipc_node_is_up(n_ptr))
> - cnt++;
> - }
> - read_unlock_bh(&tipc_net_lock);
> - return cnt;
> -}
> -
> struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
> {
> u32 domain;
> --- a/net/tipc/node.h 2010-10-13 15:54:01.616035253 -0700
> +++ b/net/tipc/node.h 2010-10-13 15:54:11.830801530 -0700
> @@ -96,7 +96,6 @@ struct tipc_node {
> } bclink;
> };
>
> -extern struct tipc_node *tipc_nodes;
> extern u32 tipc_own_tag;
>
> struct tipc_node *tipc_node_create(u32 addr);
> --- a/net/tipc/port.c 2010-10-13 15:40:52.362926772 -0700
> +++ b/net/tipc/port.c 2010-10-13 16:16:41.435779874 -0700
> @@ -293,34 +293,6 @@ int tipc_deleteport(u32 ref)
> return 0;
> }
>
> -/**
> - * tipc_get_port() - return port associated with 'ref'
> - *
> - * Note: Port is not locked.
> - */
> -
> -struct tipc_port *tipc_get_port(const u32 ref)
> -{
> - return (struct tipc_port *)tipc_ref_deref(ref);
> -}
> -
> -/**
> - * tipc_get_handle - return user handle associated to port 'ref'
> - */
> -
> -void *tipc_get_handle(const u32 ref)
> -{
> - struct port *p_ptr;
> - void * handle;
> -
> - p_ptr = tipc_port_lock(ref);
> - if (!p_ptr)
> - return NULL;
> - handle = p_ptr->publ.usr_handle;
> - tipc_port_unlock(p_ptr);
> - return handle;
> -}
> -
> static int port_unreliable(struct port *p_ptr)
> {
> return msg_src_droppable(&p_ptr->publ.phdr);
> @@ -392,7 +364,7 @@ static struct sk_buff *port_build_proto_
> struct sk_buff *buf;
> struct tipc_msg *msg;
>
> - buf = buf_acquire(LONG_H_SIZE);
> + buf = tipc_buf_acquire(LONG_H_SIZE);
> if (buf) {
> msg = buf_msg(buf);
> tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
> @@ -433,7 +405,7 @@ int tipc_reject_msg(struct sk_buff *buf,
> hdr_sz = MCAST_H_SIZE;
> else
> hdr_sz = LONG_H_SIZE;
> - rbuf = buf_acquire(data_sz + hdr_sz);
> + rbuf = tipc_buf_acquire(data_sz + hdr_sz);
> if (rbuf == NULL) {
> buf_discard(buf);
> return data_sz;
> @@ -1242,50 +1214,13 @@ int tipc_shutdown(u32 ref)
> return tipc_disconnect(ref);
> }
>
> -int tipc_isconnected(u32 ref, int *isconnected)
> -{
> - struct port *p_ptr;
> -
> - p_ptr = tipc_port_lock(ref);
> - if (!p_ptr)
> - return -EINVAL;
> - *isconnected = p_ptr->publ.connected;
> - tipc_port_unlock(p_ptr);
> - return 0;
> -}
> -
> -int tipc_peer(u32 ref, struct tipc_portid *peer)
> -{
> - struct port *p_ptr;
> - int res;
> -
> - p_ptr = tipc_port_lock(ref);
> - if (!p_ptr)
> - return -EINVAL;
> - if (p_ptr->publ.connected) {
> - peer->ref = port_peerport(p_ptr);
> - peer->node = port_peernode(p_ptr);
> - res = 0;
> - } else
> - res = -ENOTCONN;
> - tipc_port_unlock(p_ptr);
> - return res;
> -}
> -
> -int tipc_ref_valid(u32 ref)
> -{
> - /* Works irrespective of type */
> - return !!tipc_ref_deref(ref);
> -}
> -
> -
> /*
> * tipc_port_recv_sections(): Concatenate and deliver sectioned
> * message for this node.
> */
>
> -int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
> - struct iovec const *msg_sect)
> +static int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
> + struct iovec const *msg_sect)
> {
> struct sk_buff *buf;
> int res;
> @@ -1336,65 +1271,16 @@ int tipc_send(u32 ref, unsigned int num_
> }
>
> /**
> - * tipc_send_buf - send message buffer on connection
> - */
> -
> -int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
> -{
> - struct port *p_ptr;
> - struct tipc_msg *msg;
> - u32 destnode;
> - u32 hsz;
> - u32 sz;
> - u32 res;
> -
> - p_ptr = tipc_port_deref(ref);
> - if (!p_ptr || !p_ptr->publ.connected)
> - return -EINVAL;
> -
> - msg =&p_ptr->publ.phdr;
> - hsz = msg_hdr_sz(msg);
> - sz = hsz + dsz;
> - msg_set_size(msg, sz);
> - if (skb_cow(buf, hsz))
> - return -ENOMEM;
> -
> - skb_push(buf, hsz);
> - skb_copy_to_linear_data(buf, msg, hsz);
> - destnode = msg_destnode(msg);
> - p_ptr->publ.congested = 1;
> - if (!tipc_port_congested(p_ptr)) {
> - if (likely(destnode != tipc_own_addr))
> - res = tipc_send_buf_fast(buf, destnode);
> - else {
> - tipc_port_recv_msg(buf);
> - res = sz;
> - }
> - if (likely(res != -ELINKCONG)) {
> - port_incr_out_seqno(p_ptr);
> - p_ptr->sent++;
> - p_ptr->publ.congested = 0;
> - return res;
> - }
> - }
> - if (port_unreliable(p_ptr)) {
> - p_ptr->publ.congested = 0;
> - return dsz;
> - }
> - return -ELINKCONG;
> -}
> -
> -/**
> * tipc_forward2name - forward message sections to port name
> */
>
> -int tipc_forward2name(u32 ref,
> - struct tipc_name const *name,
> - u32 domain,
> - u32 num_sect,
> - struct iovec const *msg_sect,
> - struct tipc_portid const *orig,
> - unsigned int importance)
> +static int tipc_forward2name(u32 ref,
> + struct tipc_name const *name,
> + u32 domain,
> + u32 num_sect,
> + struct iovec const *msg_sect,
> + struct tipc_portid const *orig,
> + unsigned int importance)
> {
> struct port *p_ptr;
> struct tipc_msg *msg;
> @@ -1457,89 +1343,15 @@ int tipc_send2name(u32 ref,
> }
>
> /**
> - * tipc_forward_buf2name - forward message buffer to port name
> - */
> -
> -int tipc_forward_buf2name(u32 ref,
> - struct tipc_name const *name,
> - u32 domain,
> - struct sk_buff *buf,
> - unsigned int dsz,
> - struct tipc_portid const *orig,
> - unsigned int importance)
> -{
> - struct port *p_ptr;
> - struct tipc_msg *msg;
> - u32 destnode = domain;
> - u32 destport;
> - int res;
> -
> - p_ptr = (struct port *)tipc_ref_deref(ref);
> - if (!p_ptr || p_ptr->publ.connected)
> - return -EINVAL;
> -
> - msg =&p_ptr->publ.phdr;
> - if (importance<= TIPC_CRITICAL_IMPORTANCE)
> - msg_set_importance(msg, importance);
> - msg_set_type(msg, TIPC_NAMED_MSG);
> - msg_set_orignode(msg, orig->node);
> - msg_set_origport(msg, orig->ref);
> - msg_set_nametype(msg, name->type);
> - msg_set_nameinst(msg, name->instance);
> - msg_set_lookup_scope(msg, tipc_addr_scope(domain));
> - msg_set_hdr_sz(msg, LONG_H_SIZE);
> - msg_set_size(msg, LONG_H_SIZE + dsz);
> - destport = tipc_nametbl_translate(name->type, name->instance,&destnode);
> - msg_set_destnode(msg, destnode);
> - msg_set_destport(msg, destport);
> - msg_dbg(msg, "forw2name ==> ");
> - if (skb_cow(buf, LONG_H_SIZE))
> - return -ENOMEM;
> - skb_push(buf, LONG_H_SIZE);
> - skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
> - msg_dbg(buf_msg(buf),"PREP:");
> - if (likely(destport)) {
> - p_ptr->sent++;
> - if (destnode == tipc_own_addr)
> - return tipc_port_recv_msg(buf);
> - res = tipc_send_buf_fast(buf, destnode);
> - if (likely(res != -ELINKCONG))
> - return res;
> - if (port_unreliable(p_ptr))
> - return dsz;
> - return -ELINKCONG;
> - }
> - return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
> -}
> -
> -/**
> - * tipc_send_buf2name - send message buffer to port name
> - */
> -
> -int tipc_send_buf2name(u32 ref,
> - struct tipc_name const *dest,
> - u32 domain,
> - struct sk_buff *buf,
> - unsigned int dsz)
> -{
> - struct tipc_portid orig;
> -
> - orig.ref = ref;
> - orig.node = tipc_own_addr;
> - return tipc_forward_buf2name(ref, dest, domain, buf, dsz,&orig,
> - TIPC_PORT_IMPORTANCE);
> -}
> -
> -/**
> * tipc_forward2port - forward message sections to port identity
> */
>
> -int tipc_forward2port(u32 ref,
> - struct tipc_portid const *dest,
> - unsigned int num_sect,
> - struct iovec const *msg_sect,
> - struct tipc_portid const *orig,
> - unsigned int importance)
> +static int tipc_forward2port(u32 ref,
> + struct tipc_portid const *dest,
> + unsigned int num_sect,
> + struct iovec const *msg_sect,
> + struct tipc_portid const *orig,
> + unsigned int importance)
> {
> struct port *p_ptr;
> struct tipc_msg *msg;
> @@ -1591,12 +1403,12 @@ int tipc_send2port(u32 ref,
> /**
> * tipc_forward_buf2port - forward message buffer to port identity
> */
> -int tipc_forward_buf2port(u32 ref,
> - struct tipc_portid const *dest,
> - struct sk_buff *buf,
> - unsigned int dsz,
> - struct tipc_portid const *orig,
> - unsigned int importance)
> +static int tipc_forward_buf2port(u32 ref,
> + struct tipc_portid const *dest,
> + struct sk_buff *buf,
> + unsigned int dsz,
> + struct tipc_portid const *orig,
> + unsigned int importance)
> {
> struct port *p_ptr;
> struct tipc_msg *msg;
> --- a/net/tipc/port.h 2010-10-13 15:48:09.502393058 -0700
> +++ b/net/tipc/port.h 2010-10-13 16:14:00.819182858 -0700
> @@ -109,8 +109,6 @@ struct port {
> extern spinlock_t tipc_port_list_lock;
> struct port_list;
>
> -int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
> - struct iovec const *msg_sect);
> int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
> struct iovec const *msg_sect, u32 num_sect,
> int err);
> --- a/net/tipc/ref.c 2010-10-13 15:41:13.468391212 -0700
> +++ b/net/tipc/ref.c 2010-10-13 16:03:20.908481542 -0700
> @@ -282,23 +282,6 @@ void *tipc_ref_lock(u32 ref)
> return NULL;
> }
>
> -/**
> - * tipc_ref_unlock - unlock referenced object
> - */
> -
> -void tipc_ref_unlock(u32 ref)
> -{
> - if (likely(tipc_ref_table.entries)) {
> - struct reference *entry;
> -
> - entry =&tipc_ref_table.entries[ref&
> - tipc_ref_table.index_mask];
> - if (likely((entry->ref == ref)&& (entry->object)))
> - spin_unlock_bh(&entry->lock);
> - else
> - err("Attempt to unlock non-existent reference\n");
> - }
> -}
>
> /**
> * tipc_ref_deref - return pointer referenced object (without locking it)
> --- a/net/tipc/ref.h 2010-10-13 15:47:56.028012866 -0700
> +++ b/net/tipc/ref.h 2010-10-13 15:48:04.642977233 -0700
> @@ -44,7 +44,6 @@ u32 tipc_ref_acquire(void *object, spinl
> void tipc_ref_discard(u32 ref);
>
> void *tipc_ref_lock(u32 ref);
> -void tipc_ref_unlock(u32 ref);
> void *tipc_ref_deref(u32 ref);
>
> #endif
> --- a/net/tipc/zone.c 2010-10-13 15:41:49.324083397 -0700
> +++ b/net/tipc/zone.c 2010-10-13 15:54:26.329050453 -0700
> @@ -160,14 +160,3 @@ u32 tipc_zone_select_router(struct _zone
> }
> return 0;
> }
> -
> -
> -u32 tipc_zone_next_node(u32 addr)
> -{
> - struct cluster *c_ptr = tipc_cltr_find(addr);
> -
> - if (c_ptr)
> - return tipc_cltr_next_node(c_ptr, addr);
> - return 0;
> -}
> -
> --- a/net/tipc/zone.h 2010-10-13 15:48:24.460594837 -0700
> +++ b/net/tipc/zone.h 2010-10-13 15:48:33.715482229 -0700
> @@ -61,7 +61,6 @@ void tipc_zone_send_external_routes(stru
> struct _zone *tipc_zone_create(u32 addr);
> void tipc_zone_delete(struct _zone *z_ptr);
> void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
> -u32 tipc_zone_next_node(u32 addr);
>
> static inline struct _zone *tipc_zone_find(u32 addr)
> {
> --- a/net/tipc/addr.c 2010-10-13 15:33:41.742641197 -0700
> +++ b/net/tipc/addr.c 2010-10-13 16:02:50.348172914 -0700
> @@ -41,11 +41,6 @@
> #include "cluster.h"
> #include "net.h"
>
> -u32 tipc_get_addr(void)
> -{
> - return tipc_own_addr;
> -}
> -
> /**
> * tipc_addr_domain_valid - validates a network domain address
> *
> --- a/net/tipc/cluster.h 2010-10-13 16:01:44.276153671 -0700
> +++ b/net/tipc/cluster.h 2010-10-13 16:01:56.218711152 -0700
> @@ -75,7 +75,7 @@ void tipc_cltr_attach_node(struct cluste
> void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
> void tipc_cltr_broadcast(struct sk_buff *buf);
> int tipc_cltr_init(void);
> -u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
> +
> void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
> void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
> void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
> --- a/net/tipc/subscr.c 2010-10-13 16:01:08.020532905 -0700
> +++ b/net/tipc/subscr.c 2010-10-13 16:03:03.330604772 -0700
> @@ -598,12 +598,3 @@ void tipc_subscr_stop(void)
> topsrv.user_ref = 0;
> }
> }
> -
> -
> -int tipc_ispublished(struct tipc_name const *name)
> -{
> - u32 domain = 0;
> -
> - return tipc_nametbl_translate(name->type, name->instance,&domain) != 0;
> -}
> -
> --- a/include/net/tipc/tipc_port.h 2010-10-13 16:05:35.080274751 -0700
> +++ b/include/net/tipc/tipc_port.h 2010-10-13 16:06:14.247543618 -0700
> @@ -88,8 +88,6 @@ void tipc_acknowledge(u32 port_ref,u32 a
>
> struct tipc_port *tipc_get_port(const u32 ref);
>
> -void *tipc_get_handle(const u32 ref);
> -
> /*
> * The following routines require that the port be locked on entry
> */
>
>
^ permalink raw reply
* Re: [PATCH RFC] tun: dma engine support
From: Dan Williams @ 2010-10-14 0:27 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Linus Walleij, Anatolij Gustschin, Magnus Damm, Andrew Morton,
Tejun Heo, David S. Miller, Herbert Xu, Eric Dumazet, Joe Perches,
linux-kernel, netdev, kvm, Sosnowski, Maciej
In-Reply-To: <20101011205208.GA8527@redhat.com>
[ added Maciej ]
On Mon, Oct 11, 2010 at 1:52 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> Simple hack to use dma engine for tun RX.
> Only one skb in flight at the moment.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> I am still looking at handling multiple skbs, but
> sending this out for early flames and improvement suggestions.
>
> Loopback testing seems to show only minor performance gains:
> this is not really suprising as data is hot in cache already.
> Where I would expect this to help more is with incoming
> traffic from an external NIC. This still needs to be tested.
Actually it is interesting that you did not see a performance loss
because the dma performs the transfer in memory so the destination
will be cache cold in the dma case compared to a cpu copy.
[..]
> +int tun_dma_copybreak = 0x10000;
> +module_param_named(dma_copybreak, tun_dma_copybreak, int, 0644);
What platform are you using for testing? If this proves beneficial we
may need to adjust this value to have a platform specific default,
similar to how ioatdma sets tcp_dma_copybreak depending on the
hardware version. You will notice that on Nehalem class hardware
(drivers/dma/ioat/dma_v3.c) the default is set to 256K effectively
disabling offload as the overhead of managing the dma engine
overshadows any offload advantage.
--
Dan
^ permalink raw reply
* Re: [PATCH net-next] tipc: cleanup function namespace
From: Stephen Hemminger @ 2010-10-14 0:32 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: David Miller, nhorman, netdev, allan.stephens
In-Reply-To: <4CB64D7C.1080004@windriver.com>
On Wed, 13 Oct 2010 20:23:24 -0400
Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> On 10-10-13 07:20 PM, Stephen Hemminger wrote:
> > Do some cleanups of TIPC based on make namespacecheck
> > 1. Don't export unused symbols
> > 2. Eliminate dead code
> > 3. Make functions and variables local
> > 4. Rename buf_acquire to tipc_buf_acquire since it is used in several files
> >
> > Compile tested only.
> > This make break out of tree kernel modules that depend on TIPC routines.
>
> Hi Stephen,
>
> When I first started looking at TIPC code, I too came to the
> same conclusion as you did and was about to do #1,2,3 -- but
> then I was told that the exported symbols were part of an API
> and might be in use by folks here and there as per this thread:
>
> http://www.mail-archive.com/netdev@vger.kernel.org/msg30208.html
>
> I'm generally the 1st one to agree that the kernel should not
> be libc, and that exporting all sorts of functions without a
> clearly defined use case so that one can insert all sorts of
> brewed up modules is *not* the way to go -- and was asking if
> we could phase this API out if nobody was using it:
>
> http://sourceforge.net/mailarchive/message.php?msg_name=29C1DC0826876849BDD9F1C67ABA294308C1FEB6%40ala-mail09.corp.ad.wrs.com
>
> ...but apparently there are a couple of API users out there.
>
> I'd like to better understand their use case(es) and what parts
> of this API they use, but I haven't got that far yet, since
> there are a bunch of other TIPC bugfixes and changes queued on
> sourceforge which need cleaning and integration into mainline.
>
> I was thinking one idea would be to wrap them in a TIPC specific
> Kconfig (off by default) so that it would at least highlight
> this atypical use case for EXPORT_SYMBOL -- which might help
> bring these users to the surface so we can learn about their
> use cases. Having it as a Kconfig option would also help in
> giving us something to point our finger at for the feature
> removal file, if indeed we could find a better way for these
> users to get done whatever it is that they are doing.
>
> In any event, I think your #2 (dead code) and #3 (add static)
> are items considered dead or candidates for static because
> of #1, i.e. tossing the API exports out.
>
> I've already tossed out the explicitly dead code in #if 0
> blocks -- Dave just merged that today. But the #4 from your
> list seems to make sense, and we can do that as a standalone
> item of course.
>
> Thanks,
> Paul.
>
> >
> > Signed-off-by: Stephen Hemminger<shemminger@vyatta.com>
> >
The kernel is does not have or support API's just for out
of tree code. Any code that needs the API should be submitted for
inclusion or risks getting broken at any time!
^ permalink raw reply
* [PATCH net-next 1/2]: stmmac: make ethtool functions local
From: Stephen Hemminger @ 2010-10-14 0:50 UTC (permalink / raw)
To: David Miller, Giuseppe Cavallaro, Deepak SIKRI; +Cc: netdev
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/stmmac/stmmac_ethtool.c 2010-10-13 17:39:03.228159654 -0700
+++ b/drivers/net/stmmac/stmmac_ethtool.c 2010-10-13 17:41:07.317236754 -0700
@@ -89,8 +89,8 @@ static const struct stmmac_stats stmmac
};
#define STMMAC_STATS_LEN ARRAY_SIZE(stmmac_gstrings_stats)
-void stmmac_ethtool_getdrvinfo(struct net_device *dev,
- struct ethtool_drvinfo *info)
+static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info)
{
struct stmmac_priv *priv = netdev_priv(dev);
@@ -104,7 +104,8 @@ void stmmac_ethtool_getdrvinfo(struct ne
info->n_stats = STMMAC_STATS_LEN;
}
-int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int stmmac_ethtool_getsettings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
{
struct stmmac_priv *priv = netdev_priv(dev);
struct phy_device *phy = priv->phydev;
@@ -126,7 +127,8 @@ int stmmac_ethtool_getsettings(struct ne
return rc;
}
-int stmmac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int stmmac_ethtool_setsettings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
{
struct stmmac_priv *priv = netdev_priv(dev);
struct phy_device *phy = priv->phydev;
@@ -139,32 +141,32 @@ int stmmac_ethtool_setsettings(struct ne
return rc;
}
-u32 stmmac_ethtool_getmsglevel(struct net_device *dev)
+static u32 stmmac_ethtool_getmsglevel(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);
return priv->msg_enable;
}
-void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)
+static void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)
{
struct stmmac_priv *priv = netdev_priv(dev);
priv->msg_enable = level;
}
-int stmmac_check_if_running(struct net_device *dev)
+static int stmmac_check_if_running(struct net_device *dev)
{
if (!netif_running(dev))
return -EBUSY;
return 0;
}
-int stmmac_ethtool_get_regs_len(struct net_device *dev)
+static int stmmac_ethtool_get_regs_len(struct net_device *dev)
{
return REG_SPACE_SIZE;
}
-void stmmac_ethtool_gregs(struct net_device *dev,
+static void stmmac_ethtool_gregs(struct net_device *dev,
struct ethtool_regs *regs, void *space)
{
int i;
@@ -195,7 +197,7 @@ void stmmac_ethtool_gregs(struct net_dev
}
}
-int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
+static int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
{
if (data)
netdev->features |= NETIF_F_HW_CSUM;
@@ -205,7 +207,7 @@ int stmmac_ethtool_set_tx_csum(struct ne
return 0;
}
-u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
+static u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);
^ permalink raw reply
* [PATCH net-next 2/2] stmmac: make function tables const
From: Stephen Hemminger @ 2010-10-14 0:51 UTC (permalink / raw)
To: David Miller, Giuseppe Cavallaro, Deepak SIKRI; +Cc: netdev
In-Reply-To: <20101013175031.41c29349@nehalam>
These tables only contain function pointers.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/net/stmmac/common.h | 6 +++---
drivers/net/stmmac/dwmac100.h | 2 +-
drivers/net/stmmac/dwmac1000.h | 2 +-
drivers/net/stmmac/dwmac1000_core.c | 2 +-
drivers/net/stmmac/dwmac1000_dma.c | 2 +-
drivers/net/stmmac/dwmac100_core.c | 2 +-
drivers/net/stmmac/dwmac100_dma.c | 2 +-
drivers/net/stmmac/enh_desc.c | 2 +-
drivers/net/stmmac/norm_desc.c | 2 +-
drivers/net/stmmac/stmmac.h | 4 ++--
10 files changed, 13 insertions(+), 13 deletions(-)
--- a/drivers/net/stmmac/common.h 2010-10-13 17:42:30.599219840 -0700
+++ b/drivers/net/stmmac/common.h 2010-10-13 17:43:28.068306957 -0700
@@ -235,9 +235,9 @@ struct mii_regs {
};
struct mac_device_info {
- struct stmmac_ops *mac;
- struct stmmac_desc_ops *desc;
- struct stmmac_dma_ops *dma;
+ const struct stmmac_ops *mac;
+ const struct stmmac_desc_ops *desc;
+ const struct stmmac_dma_ops *dma;
struct mii_regs mii; /* MII register Addresses */
struct mac_link link;
};
--- a/drivers/net/stmmac/dwmac1000_core.c 2010-10-13 17:42:30.615217915 -0700
+++ b/drivers/net/stmmac/dwmac1000_core.c 2010-10-13 17:43:05.115068037 -0700
@@ -212,7 +212,7 @@ static void dwmac1000_irq_status(void __
}
}
-struct stmmac_ops dwmac1000_ops = {
+static const struct stmmac_ops dwmac1000_ops = {
.core_init = dwmac1000_core_init,
.rx_coe = dwmac1000_rx_coe_supported,
.dump_regs = dwmac1000_dump_regs,
--- a/drivers/net/stmmac/dwmac1000_dma.c 2010-10-13 17:44:34.880269557 -0700
+++ b/drivers/net/stmmac/dwmac1000_dma.c 2010-10-13 17:45:54.670669930 -0700
@@ -138,7 +138,7 @@ static void dwmac1000_dump_dma_regs(void
}
}
-struct stmmac_dma_ops dwmac1000_dma_ops = {
+const struct stmmac_dma_ops dwmac1000_dma_ops = {
.init = dwmac1000_dma_init,
.dump_regs = dwmac1000_dump_dma_regs,
.dma_mode = dwmac1000_dma_operation_mode,
--- a/drivers/net/stmmac/dwmac100_core.c 2010-10-13 17:42:30.631215991 -0700
+++ b/drivers/net/stmmac/dwmac100_core.c 2010-10-13 17:42:45.377442238 -0700
@@ -168,7 +168,7 @@ static void dwmac100_pmt(void __iomem *i
return;
}
-struct stmmac_ops dwmac100_ops = {
+static const struct stmmac_ops dwmac100_ops = {
.core_init = dwmac100_core_init,
.rx_coe = dwmac100_rx_coe_supported,
.dump_regs = dwmac100_dump_mac_regs,
--- a/drivers/net/stmmac/dwmac100_dma.c 2010-10-13 17:44:45.351009875 -0700
+++ b/drivers/net/stmmac/dwmac100_dma.c 2010-10-13 17:45:26.334079236 -0700
@@ -126,7 +126,7 @@ static void dwmac100_dma_diagnostic_fr(v
}
}
-struct stmmac_dma_ops dwmac100_dma_ops = {
+const struct stmmac_dma_ops dwmac100_dma_ops = {
.init = dwmac100_dma_init,
.dump_regs = dwmac100_dump_dma_regs,
.dma_mode = dwmac100_dma_operation_mode,
--- a/drivers/net/stmmac/enh_desc.c 2010-10-13 17:43:40.150853494 -0700
+++ b/drivers/net/stmmac/enh_desc.c 2010-10-13 17:46:25.390973687 -0700
@@ -318,7 +318,7 @@ static int enh_desc_get_rx_frame_len(str
return p->des01.erx.frame_length;
}
-struct stmmac_desc_ops enh_desc_ops = {
+const struct stmmac_desc_ops enh_desc_ops = {
.tx_status = enh_desc_get_tx_status,
.rx_status = enh_desc_get_rx_status,
.get_tx_len = enh_desc_get_tx_len,
--- a/drivers/net/stmmac/norm_desc.c 2010-10-13 17:44:05.363820440 -0700
+++ b/drivers/net/stmmac/norm_desc.c 2010-10-13 17:46:28.978542024 -0700
@@ -202,7 +202,7 @@ static int ndesc_get_rx_frame_len(struct
return p->des01.rx.frame_length;
}
-struct stmmac_desc_ops ndesc_ops = {
+const struct stmmac_desc_ops ndesc_ops = {
.tx_status = ndesc_get_tx_status,
.rx_status = ndesc_get_rx_status,
.get_tx_len = ndesc_get_tx_len,
--- a/drivers/net/stmmac/dwmac100.h 2010-10-13 17:47:08.289811886 -0700
+++ b/drivers/net/stmmac/dwmac100.h 2010-10-13 17:47:14.477067381 -0700
@@ -118,4 +118,4 @@ enum ttc_control {
#define DMA_MISSED_FRAME_OVE_M 0x00010000 /* Missed Frame Overflow */
#define DMA_MISSED_FRAME_M_CNTR 0x0000ffff /* Missed Frame Couinter */
-extern struct stmmac_dma_ops dwmac100_dma_ops;
+extern const struct stmmac_dma_ops dwmac100_dma_ops;
--- a/drivers/net/stmmac/dwmac1000.h 2010-10-13 17:46:53.607578558 -0700
+++ b/drivers/net/stmmac/dwmac1000.h 2010-10-13 17:46:59.630853799 -0700
@@ -205,4 +205,4 @@ enum rtc_control {
#define GMAC_MMC_TX_INTR 0x108
#define GMAC_MMC_RX_CSUM_OFFLOAD 0x208
-extern struct stmmac_dma_ops dwmac1000_dma_ops;
+extern const struct stmmac_dma_ops dwmac1000_dma_ops;
--- a/drivers/net/stmmac/stmmac.h 2010-10-13 17:47:30.415149545 -0700
+++ b/drivers/net/stmmac/stmmac.h 2010-10-13 17:47:40.497936258 -0700
@@ -121,5 +121,5 @@ static inline int stmmac_claim_resource(
extern int stmmac_mdio_unregister(struct net_device *ndev);
extern int stmmac_mdio_register(struct net_device *ndev);
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
-extern struct stmmac_desc_ops enh_desc_ops;
-extern struct stmmac_desc_ops ndesc_ops;
+extern const struct stmmac_desc_ops enh_desc_ops;
+extern const struct stmmac_desc_ops ndesc_ops;
^ permalink raw reply
* [PATCH 1/8 net-next] cnic: Add common cnic_request_irq()
From: Michael Chan @ 2010-10-14 0:06 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1287014811-10979-1-git-send-email-mchan@broadcom.com>
to reduce some duplicate code. Also, use tasklet_kill() in
cnic_free_irq() to wait for the cnic_irq_task to complete.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/cnic.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 27449bf..0fab720 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3428,11 +3428,24 @@ static void cnic_free_irq(struct cnic_dev *dev)
if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) {
cp->disable_int_sync(dev);
- tasklet_disable(&cp->cnic_irq_task);
+ tasklet_kill(&cp->cnic_irq_task);
free_irq(ethdev->irq_arr[0].vector, dev);
}
}
+static int cnic_request_irq(struct cnic_dev *dev)
+{
+ struct cnic_local *cp = dev->cnic_priv;
+ struct cnic_eth_dev *ethdev = cp->ethdev;
+ int err;
+
+ err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0, "cnic", dev);
+ if (err)
+ tasklet_disable(&cp->cnic_irq_task);
+
+ return err;
+}
+
static int cnic_init_bnx2_irq(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
@@ -3453,12 +3466,10 @@ static int cnic_init_bnx2_irq(struct cnic_dev *dev)
cp->last_status_idx = cp->status_blk.bnx2->status_idx;
tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2_msix,
(unsigned long) dev);
- err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0,
- "cnic", dev);
- if (err) {
- tasklet_disable(&cp->cnic_irq_task);
+ err = cnic_request_irq(dev);
+ if (err)
return err;
- }
+
while (cp->status_blk.bnx2->status_completion_producer_index &&
i < 10) {
CNIC_WR(dev, BNX2_HC_COALESCE_NOW,
@@ -3860,12 +3871,9 @@ static int cnic_init_bnx2x_irq(struct cnic_dev *dev)
tasklet_init(&cp->cnic_irq_task, cnic_service_bnx2x_bh,
(unsigned long) dev);
- if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) {
- err = request_irq(ethdev->irq_arr[0].vector, cnic_irq, 0,
- "cnic", dev);
- if (err)
- tasklet_disable(&cp->cnic_irq_task);
- }
+ if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)
+ err = cnic_request_irq(dev);
+
return err;
}
--
1.6.4.GIT
^ permalink raw reply related
* [PATCH 7/8 net-next] cnic: Decouple uio close from cnic shutdown
From: Michael Chan @ 2010-10-14 0:06 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1287014811-10979-7-git-send-email-mchan@broadcom.com>
During cnic shutdown, the original driver code requires userspace to
close the uio device within a few seconds. This doesn't always happen
as the userapp may be hung or otherwise take a long time to close. The
system may crash when this happens.
We fix the problem by decoupling the uio structures from the cnic
structures during cnic shutdown. We do not unregister the uio device
until the cnic driver is unloaded. This eliminates the unreliable wait
loop for uio to close.
All uio structures are kept in a linked list. If the device is shutdown
and later brought back up again, the uio strcture will be found in the
linked list and coupled back to the cnic structures.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/cnic.c | 56 +++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index e8f2836..3f923a7 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -60,6 +60,7 @@ MODULE_LICENSE("GPL");
MODULE_VERSION(CNIC_MODULE_VERSION);
static LIST_HEAD(cnic_dev_list);
+static LIST_HEAD(cnic_udev_list);
static DEFINE_RWLOCK(cnic_dev_lock);
static DEFINE_MUTEX(cnic_lock);
@@ -101,13 +102,14 @@ static int cnic_uio_open(struct uio_info *uinfo, struct inode *inode)
rtnl_lock();
dev = udev->dev;
- if (!test_bit(CNIC_F_CNIC_UP, &dev->flags)) {
+ if (!dev || !test_bit(CNIC_F_CNIC_UP, &dev->flags)) {
rtnl_unlock();
return -ENODEV;
}
udev->uio_dev = iminor(inode);
+ cnic_shutdown_rings(dev);
cnic_init_rings(dev);
rtnl_unlock();
@@ -117,9 +119,6 @@ static int cnic_uio_open(struct uio_info *uinfo, struct inode *inode)
static int cnic_uio_close(struct uio_info *uinfo, struct inode *inode)
{
struct cnic_uio_dev *udev = uinfo->priv;
- struct cnic_dev *dev = udev->dev;
-
- cnic_shutdown_rings(dev);
udev->uio_dev = -1;
return 0;
@@ -787,6 +786,9 @@ static void __cnic_free_uio(struct cnic_uio_dev *udev)
udev->l2_ring, udev->l2_ring_map);
udev->l2_ring = NULL;
}
+
+ pci_dev_put(udev->pdev);
+ kfree(udev);
}
static void cnic_free_uio(struct cnic_uio_dev *udev)
@@ -794,6 +796,9 @@ static void cnic_free_uio(struct cnic_uio_dev *udev)
if (!udev)
return;
+ write_lock(&cnic_dev_lock);
+ list_del_init(&udev->list);
+ write_unlock(&cnic_dev_lock);
__cnic_free_uio(udev);
}
@@ -801,14 +806,9 @@ static void cnic_free_resc(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
struct cnic_uio_dev *udev = cp->udev;
- int i = 0;
if (udev) {
- while (udev->uio_dev != -1 && i < 15) {
- msleep(100);
- i++;
- }
- cnic_free_uio(udev);
+ udev->dev = NULL;
cp->udev = NULL;
}
@@ -916,6 +916,17 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
struct cnic_local *cp = dev->cnic_priv;
struct cnic_uio_dev *udev;
+ read_lock(&cnic_dev_lock);
+ list_for_each_entry(udev, &cnic_udev_list, list) {
+ if (udev->pdev == dev->pcidev) {
+ udev->dev = dev;
+ cp->udev = udev;
+ read_unlock(&cnic_dev_lock);
+ return 0;
+ }
+ }
+ read_unlock(&cnic_dev_lock);
+
udev = kzalloc(sizeof(struct cnic_uio_dev), GFP_ATOMIC);
if (!udev)
return -ENOMEM;
@@ -939,6 +950,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
if (!udev->l2_buf)
return -ENOMEM;
+ write_lock(&cnic_dev_lock);
+ list_add(&udev->list, &cnic_udev_list);
+ write_unlock(&cnic_dev_lock);
+
+ pci_dev_get(udev->pdev);
+
cp->udev = udev;
return 0;
@@ -954,8 +971,6 @@ static int cnic_init_uio(struct cnic_dev *dev)
if (!udev)
return -ENOMEM;
- udev->uio_dev = -1;
-
uinfo = &udev->cnic_uinfo;
uinfo->mem[0].addr = dev->netdev->base_addr;
@@ -996,9 +1011,15 @@ static int cnic_init_uio(struct cnic_dev *dev)
uinfo->open = cnic_uio_open;
uinfo->release = cnic_uio_close;
- uinfo->priv = udev;
+ if (udev->uio_dev == -1) {
+ if (!uinfo->priv) {
+ uinfo->priv = udev;
- ret = uio_register_device(&udev->pdev->dev, uinfo);
+ ret = uio_register_device(&udev->pdev->dev, uinfo);
+ }
+ } else {
+ cnic_init_rings(dev);
+ }
return ret;
}
@@ -4559,6 +4580,7 @@ static void cnic_stop_hw(struct cnic_dev *dev)
msleep(100);
i++;
}
+ cnic_shutdown_rings(dev);
clear_bit(CNIC_F_CNIC_UP, &dev->flags);
rcu_assign_pointer(cp->ulp_ops[CNIC_ULP_L4], NULL);
synchronize_rcu();
@@ -4834,6 +4856,7 @@ static struct notifier_block cnic_netdev_notifier = {
static void cnic_release(void)
{
struct cnic_dev *dev;
+ struct cnic_uio_dev *udev;
while (!list_empty(&cnic_dev_list)) {
dev = list_entry(cnic_dev_list.next, struct cnic_dev, list);
@@ -4847,6 +4870,11 @@ static void cnic_release(void)
list_del_init(&dev->list);
cnic_free_dev(dev);
}
+ while (!list_empty(&cnic_udev_list)) {
+ udev = list_entry(cnic_udev_list.next, struct cnic_uio_dev,
+ list);
+ cnic_free_uio(udev);
+ }
}
static int __init cnic_init(void)
--
1.6.4.GIT
^ permalink raw reply related
* [PATCH 2/8 net-next] cnic: Convert ctx_flags to bit fields
From: Michael Chan @ 2010-10-14 0:06 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1287014811-10979-2-git-send-email-mchan@broadcom.com>
so that we can additional bit definitions without requiring a spinlock.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/cnic.c | 4 ++--
drivers/net/cnic.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 0fab720..311b2e6 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -1721,7 +1721,7 @@ static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
struct kcqe *cqes[1];
u32 hw_cid, type;
- if (!(ctx->ctx_flags & CTX_FL_OFFLD_START))
+ if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
goto skip_cfc_delete;
while (!time_after(jiffies, ctx->timestamp + (2 * HZ)))
@@ -1943,7 +1943,7 @@ static int cnic_bnx2x_connect(struct cnic_dev *dev, struct kwqe *wqes[],
ret = cnic_submit_kwqe_16(dev, L5CM_RAMROD_CMD_ID_TCP_CONNECT,
kwqe1->cid, ISCSI_CONNECTION_TYPE, &l5_data);
if (!ret)
- ctx->ctx_flags |= CTX_FL_OFFLD_START;
+ set_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags);
return ret;
}
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 676d008..9907cc2 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -168,8 +168,8 @@ struct cnic_context {
wait_queue_head_t waitq;
int wait_cond;
unsigned long timestamp;
- u32 ctx_flags;
-#define CTX_FL_OFFLD_START 0x00000001
+ unsigned long ctx_flags;
+#define CTX_FL_OFFLD_START 0
u8 ulp_proto_id;
union {
struct cnic_iscsi *iscsi;
--
1.6.4.GIT
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox