* Re: [PATCH 1/3] netlink: fix NETLINK_RECV_NO_ENOBUFS in netlink_set_err()
From: Patrick McHardy @ 2010-03-22 15:38 UTC (permalink / raw)
To: David Miller; +Cc: pablo, netdev
In-Reply-To: <20100320.143027.116368032.davem@davemloft.net>
David Miller wrote:
> From: Pablo Neira Ayuso <pablo@netfilter.org>
> Date: Fri, 19 Mar 2010 01:24:42 +0100
>
>
>> Patrick McHardy wrote:
>>
>>> Generally the logic seems inverted, you should return an error
>>> to conntrack if userspace wasn't notified of the error.
>>>
>> Indeed, thanks. Are you OK with this patch instead?
>>
>
> I went over all of this and now the patches #1 and #2 look
> correct to me, so I've applied them to net-2.6
>
> Patrick let me know if you think any follow-on tidy ups
> are still necessary and we can add them.
The patch looks fine to me as well, thanks Dave.
^ permalink raw reply
* Re: linux-next: Tree for March 22 (net-sysfs.c)
From: Randy Dunlap @ 2010-03-22 15:31 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, LKML, Netdev
In-Reply-To: <20100322171937.d753bdba.sfr@canb.auug.org.au>
On 03/21/10 23:19, Stephen Rothwell wrote:
> Hi all,
>
> Changes since 20100319:
>
>
> The net tree lost its build failures.
When CONFIG_SYSFS is not enabled:
net/core/net-sysfs.c:742: error: implicit declaration of function 'rx_queue_remove_kobjects'
net/core/net-sysfs.c:783: error: implicit declaration of function 'rx_queue_register_kobjects'
--
~Randy
^ permalink raw reply
* Re: Add PGM protocol support to the IP stack
From: Christoph Lameter @ 2010-03-22 14:24 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: David Miller, andi, netdev, linux-kernel
In-Reply-To: <4BA3FA1D.8050204@zytor.com>
On Fri, 19 Mar 2010, H. Peter Anvin wrote:
> On 03/19/2010 02:53 PM, David Miller wrote:
> > But I also don't consider what openpbm has to do right now to
> > be all that much of a restriction. You need privileges to
> > add the protocol to the kernel, you need privileges to run
> > the userspace variant, there is no real difference.
>
> The real difference is if multiplex is needed between multiple
> unprivileged users.
It is needed. PGM ports exist and work similarly to UDP and TCP ports.
PGM as provided by openpgm and other solutions avoids native PGM and
instead uses PGM over UDP. But the routers do not support PGM over UDP in
the same way as native PGM. So the NAK suppression and other advanced
features available in Juniper and Cisco switches cannot be used.
openpbm can work with the native PGM protocol via a raw socket but then
one cannot run multiple processes communicating via different ports
effectively.
The fragmentation of packets and the assembly etc in user space is a pain.
^ permalink raw reply
* Re: Add PGM protocol support to the IP stack
From: Christoph Lameter @ 2010-03-22 14:20 UTC (permalink / raw)
To: Andi Kleen; +Cc: David Miller, netdev, linux-kernel
In-Reply-To: <87tysccjrn.fsf@basil.nowhere.org>
On Fri, 19 Mar 2010, Andi Kleen wrote:
> Christoph Lameter <cl@linux-foundation.org> writes:
> >
> > I know about the openpgm implementation. Openpbm does this at the user
> > level and requires linking to a library. It is essentially a communication
> > protocol done in user space. It has privilege issues because it has to
> > create PGM packets via a raw socket.
>
> That seems like a poor reason alone to put something into the kernel
> Perhaps you rather need some way to have unpriviledged raw sockets?
Not the only reason. There are also performance implications. NAKing and
other control messages from user space are a pain and the available
implementations add numerous threads just to control the timing of control
messages and the expiration of data etc. Its difficult to listen to a PGM
port from user space. You have to get all messages for the PGM protocol
and then filter in each process.
PGM operates on the same level as TCP and UDP.
> The classical way to do this is to start suid root, only open
> the socket and then drop privileges.
Yes those solutions exist and the experience with their limitations are
the reason to try to get PGM in the kernel.
^ permalink raw reply
* [PATCH] rxrpc: Check allocation failure.
From: David Howells @ 2010-03-22 13:50 UTC (permalink / raw)
To: torvalds, akpm; +Cc: netdev, Tetsuo Handa, David Howells
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
alloc_skb() can return NULL.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: David Howells <dhowells@redhat.com>
---
net/rxrpc/ar-accept.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c
index 77228f2..2d744f2 100644
--- a/net/rxrpc/ar-accept.c
+++ b/net/rxrpc/ar-accept.c
@@ -88,6 +88,11 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
/* get a notification message to send to the server app */
notification = alloc_skb(0, GFP_NOFS);
+ if (!notification) {
+ _debug("no memory");
+ ret = -ENOMEM;
+ goto error_nofree;
+ }
rxrpc_new_skb(notification);
notification->mark = RXRPC_SKB_MARK_NEW_CALL;
@@ -189,6 +194,7 @@ invalid_service:
ret = -ECONNREFUSED;
error:
rxrpc_free_skb(notification);
+error_nofree:
_leave(" = %d", ret);
return ret;
}
^ permalink raw reply related
* Re: [PATCH] Improved network performance by balancing Rx against other work
From: Nick Piggin @ 2010-03-22 13:27 UTC (permalink / raw)
To: Peter Chubb; +Cc: netdev
In-Reply-To: <87tysfu05d.wl%peterc@chubb.wattle.id.au>
On Wed, Mar 17, 2010 at 01:55:58PM +1100, Peter Chubb wrote:
> +static int e1000_intr_thread(void *data)
> +{
> + struct net_device *netdev = data;
> + struct e1000_adapter *adapter = netdev_priv(netdev);
> + const int budget = 32; // FIXME should be auto-tuneable
> + int tx_clean_complete = 0, work_done = 0;
> +
> + while(!e1000_wait_for_intr(adapter)) {
> + do {
> + work_done = 0;
> +
> + tx_clean_complete = e1000_clean_tx_irq(adapter, &adapter->tx_ring[0]);
> + adapter->clean_rx(adapter, &adapter->rx_ring[0], &work_done, budget);
> + if (!tx_clean_complete)
> + work_done = budget;
> +
> + if (work_done == budget) {
> + /*
> + * Give up the rest of the timeslice to allow
> + * userspace to make forward progress
> + */
> + sys_sched_yield();
sched_yield literally has undefined semantics if you are in SCHED_OTHER
priority (which your thread is). sched_yield use in userspace and even
kernel has caused headaches whenever the scheduler changes
significantly.
Please use anything but sched_yield. cond_resched() looks appropriate
here, it gives a simple resched point on !PREEMPT kernels. Then the
scheduler nice levels and newer resource controls should give sufficient
flexibility to fine tune CPU allocation after that.
> + }
> + } while (work_done == budget);
> +
> + /* If budget not fully consumed, wait for an interrupt */
> + adapter->last_icr = 0;
> + if (likely(adapter->itr_setting & 3))
> + e1000_set_itr(adapter);
> + if (!test_bit(__E1000_DOWN, &adapter->flags))
> + e1000_irq_enable(adapter);
> + }
> + return 0;
> +}
^ permalink raw reply
* [net-next-2.6 PATCH] ipoib: remove addrlen check for mc addresses
From: Jiri Pirko @ 2010-03-22 13:21 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, ogerlitz-smomgflXvOZWk0Htik3J/w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, monis-smomgflXvOZWk0Htik3J/w,
jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
Finally this bit can be removed. Currently, after the bonding driver is
changed/fixed (32a806c194ea112cfab00f558482dd97bee5e44e net-next-2.6),
that's not possible for an addr with different length than dev->addr_len
to be present in list. Removing this check as in new mc_list there will be
no addrlen in the record.
Signed-off-by: Jiri Pirko <jpirko-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index d41ea27..19eba3c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -767,11 +767,8 @@ void ipoib_mcast_dev_flush(struct net_device *dev)
}
}
-static int ipoib_mcast_addr_is_valid(const u8 *addr, unsigned int addrlen,
- const u8 *broadcast)
+static int ipoib_mcast_addr_is_valid(const u8 *addr, const u8 *broadcast)
{
- if (addrlen != INFINIBAND_ALEN)
- return 0;
/* reserved QPN, prefix, scope */
if (memcmp(addr, broadcast, 6))
return 0;
@@ -815,7 +812,6 @@ void ipoib_mcast_restart_task(struct work_struct *work)
union ib_gid mgid;
if (!ipoib_mcast_addr_is_valid(mclist->dmi_addr,
- mclist->dmi_addrlen,
dev->broadcast))
continue;
--
1.6.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: -next Mar 22: s390 build failure (drivers/s390/net/qeth_l3)
From: Blaschka @ 2010-03-22 13:00 UTC (permalink / raw)
To: Sachin Sant; +Cc: netdev, linux-s390, davem
In-Reply-To: <4BA73423.6080101@in.ibm.com>
On Mon, Mar 22, 2010 at 02:40:59PM +0530, Sachin Sant wrote:
> Todays next fails to build on a s390 box with
>
> CC [M] drivers/s390/net/qeth_l3_main.o
> drivers/s390/net/qeth_l3_main.c: In function 'qeth_l3_free_vlan_addresses6':
> drivers/s390/net/qeth_l3_main.c:1931: error: incompatible types in
> assignment
> drivers/s390/net/qeth_l3_main.c:1931: error: 'struct inet6_ifaddr' has no
> member named 'lst_next'
> make[2]: *** [drivers/s390/net/qeth_l3_main.o] Error 1
>
Hi, this patch should fix the problem
Thanks
Frank
---
[PATCH] qeth: l3 fix build error in ipv6 addr list handling
From: Frank Blaschka <frank.blaschka@de.ibm.com>
Adapt qeth l3 to:
commit c2e21293c054817c42eb5fa9c613d2ad51954136
(ipv6: convert addrconf list to hlist)
converted lst_next member of inet6_ifaddr struct to a hlist.
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
---
drivers/s390/net/qeth_l3_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1928,7 +1928,7 @@ static void qeth_l3_free_vlan_addresses6
in6_dev = in6_dev_get(vlan_group_get_device(card->vlangrp, vid));
if (!in6_dev)
return;
- for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next) {
+ list_for_each_entry(ifa, &in6_dev->addr_list, if_list) {
addr = qeth_l3_get_addr_buffer(QETH_PROT_IPV6);
if (addr) {
memcpy(&addr->u.a6.addr, &ifa->addr,
^ permalink raw reply
* Re: [Patch] netconsole: do not depend on experimental
From: Neil Horman @ 2010-03-22 12:59 UTC (permalink / raw)
To: Amerigo Wang; +Cc: linux-kernel, netdev, David Miller
In-Reply-To: <20100322100305.5518.29500.sendpatchset@localhost.localdomain>
On Mon, Mar 22, 2010 at 05:59:23AM -0400, Amerigo Wang wrote:
>
> Nowadays, most distributions enable netconsole by default,
> including RHEL, Fedora, Debian, Arch, Opensuse. And
> we don't have any bug reports about it. So I think there
> is no need to mark it as experimental any more.
>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: WANG Cong <amwang@redhat.com>
>
> ---
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 0ba5b8e..e3d6c52 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -3252,15 +3252,14 @@ config NET_FC
> "SCSI generic support".
>
> config NETCONSOLE
> - tristate "Network console logging support (EXPERIMENTAL)"
> - depends on EXPERIMENTAL
> + tristate "Network console logging support"
> ---help---
> If you want to log kernel messages over the network, enable this.
> See <file:Documentation/networking/netconsole.txt> for details.
>
> config NETCONSOLE_DYNAMIC
> - bool "Dynamic reconfiguration of logging targets (EXPERIMENTAL)"
> - depends on NETCONSOLE && SYSFS && EXPERIMENTAL
> + bool "Dynamic reconfiguration of logging targets"
> + depends on NETCONSOLE && SYSFS
> select CONFIGFS_FS
> help
> This option enables the ability to dynamically reconfigure target
> --
Seems reasonable. Netconsole seems pretty mature.
Acked-by: Neil Horman <nhorman@tuxdriver.com>
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply
* Re: [Patch v2] netpoll: warn when there are spaces in parameters
From: Neil Horman @ 2010-03-22 12:30 UTC (permalink / raw)
To: Amerigo Wang; +Cc: linux-kernel, netdev, elendil, David Miller
In-Reply-To: <20100322090341.5289.10770.sendpatchset@localhost.localdomain>
On Mon, Mar 22, 2010 at 04:59:58AM -0400, Amerigo Wang wrote:
> v2: update according to Frans' comments.
>
> Currently, if we leave spaces before dst port,
> netconsole will silently accept it as 0. Warn about this.
>
> Also, when spaces appear in other places, make them
> visible in error messages.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: David Miller <davem@davemloft.net>
>
> ---
>
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index 7aa6972..6df1863 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -614,7 +614,7 @@ void netpoll_print_options(struct netpoll *np)
> np->name, np->local_port);
> printk(KERN_INFO "%s: local IP %pI4\n",
> np->name, &np->local_ip);
> - printk(KERN_INFO "%s: interface %s\n",
> + printk(KERN_INFO "%s: interface '%s'\n",
> np->name, np->dev_name);
> printk(KERN_INFO "%s: remote port %d\n",
> np->name, np->remote_port);
> @@ -661,6 +661,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
> if ((delim = strchr(cur, '@')) == NULL)
> goto parse_failed;
> *delim = 0;
> + if (*cur == ' ' || *cur == '\t')
> + printk(KERN_INFO "%s: warning: whitespace"
> + "is not allowed\n", np->name);
> np->remote_port = simple_strtol(cur, NULL, 10);
> cur = delim;
> }
> @@ -708,7 +711,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
> return 0;
>
> parse_failed:
> - printk(KERN_INFO "%s: couldn't parse config at %s!\n",
> + printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
> np->name, cur);
> return -1;
> }
Acked-by: Neil Horman <nhorman@tuxdriver.com>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply
* Re: [net-next-2.6 PATCH] bonding: flush unicast and multicast lists when changing type
From: Jiri Pirko @ 2010-03-22 12:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev, fubar, bonding-devel
In-Reply-To: <20100321.183220.220048937.davem@davemloft.net>
Mon, Mar 22, 2010 at 02:32:20AM CET, davem@davemloft.net wrote:
>From: Jiri Pirko <jpirko@redhat.com>
>Date: Fri, 19 Mar 2010 15:00:23 +0100
>
>> After the type change, addresses in unicast and multicast lists wouldn't make
>> sense, not to mention possible different lenghts. So flush both lists here.
>>
>> Note "dev_addr_discard" will be very soon replaced by "dev_mc_flush" (once
>> mc_list conversion will be done).
>>
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>
>Applied, but maybe these should be EXPORT_SYMBOL_GPL? Just
>asking...
I would keep them EXPORT_SYMBOL as other uc/mc list functions...
^ permalink raw reply
* [patch] korina: use resource_size()
From: Dan Carpenter @ 2010-03-22 12:11 UTC (permalink / raw)
To: netdev
Cc: kernel-janitors, David S. Miller, Phil Sutter, Jiri Pirko,
Stephen Hemminger, Joe Perches
This size calculation is wrong. It should be end - start + 1.
Use resource_size() to calculate it correctly.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have a way to test this, or even to compile it. :/
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 300c224..edaedc7 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -1135,7 +1135,7 @@ static int korina_probe(struct platform_device *pdev)
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_regs");
dev->base_addr = r->start;
- lp->eth_regs = ioremap_nocache(r->start, r->end - r->start);
+ lp->eth_regs = ioremap_nocache(r->start, resource_size(r));
if (!lp->eth_regs) {
printk(KERN_ERR DRV_NAME ": cannot remap registers\n");
rc = -ENXIO;
@@ -1143,7 +1143,7 @@ static int korina_probe(struct platform_device *pdev)
}
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_dma_rx");
- lp->rx_dma_regs = ioremap_nocache(r->start, r->end - r->start);
+ lp->rx_dma_regs = ioremap_nocache(r->start, resource_size(r));
if (!lp->rx_dma_regs) {
printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n");
rc = -ENXIO;
@@ -1151,7 +1151,7 @@ static int korina_probe(struct platform_device *pdev)
}
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_dma_tx");
- lp->tx_dma_regs = ioremap_nocache(r->start, r->end - r->start);
+ lp->tx_dma_regs = ioremap_nocache(r->start, resource_size(r));
if (!lp->tx_dma_regs) {
printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n");
rc = -ENXIO;
^ permalink raw reply related
* [patch] stmmac: use resource_size()
From: Dan Carpenter @ 2010-03-22 12:11 UTC (permalink / raw)
To: netdev
Cc: Giuseppe Cavallaro, Joe Perches, linux-kernel, kernel-janitors,
David S. Miller
The size calculation is not correct. It should be end - start + 1.
Use resource_size() to calculate it instead.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index a673361..92bef30 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1685,8 +1685,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
}
pr_info("done!\n");
- if (!request_mem_region(res->start, (res->end - res->start),
- pdev->name)) {
+ if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
pr_err("%s: ERROR: memory allocation failed"
"cannot get the I/O addr 0x%x\n",
__func__, (unsigned int)res->start);
@@ -1694,9 +1693,9 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
goto out;
}
- addr = ioremap(res->start, (res->end - res->start));
+ addr = ioremap(res->start, resource_size(res));
if (!addr) {
- pr_err("%s: ERROR: memory mapping failed \n", __func__);
+ pr_err("%s: ERROR: memory mapping failed\n", __func__);
ret = -ENOMEM;
goto out;
}
@@ -1774,7 +1773,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
out:
if (ret < 0) {
platform_set_drvdata(pdev, NULL);
- release_mem_region(res->start, (res->end - res->start));
+ release_mem_region(res->start, resource_size(res));
if (addr != NULL)
iounmap(addr);
}
@@ -1812,7 +1811,7 @@ static int stmmac_dvr_remove(struct platform_device *pdev)
iounmap((void *)ndev->base_addr);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(res->start, (res->end - res->start));
+ release_mem_region(res->start, resource_size(res));
free_netdev(ndev);
^ permalink raw reply related
* [patch] ewrk3: range checking problem
From: Dan Carpenter @ 2010-03-22 12:07 UTC (permalink / raw)
To: netdev
Cc: Stephen Hemminger, Patrick McHardy, Jiri Pirko, Alexey Dobriyan,
linux-kernel, kernel-janitors, David S. Miller
The range checking here is wrong. It should be HASH_TABLE_LEN which
is 512.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 91e59f3..ae02de1 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -1776,8 +1776,7 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break;
case EWRK3_SET_MCA: /* Set a multicast address */
if (capable(CAP_NET_ADMIN)) {
- if (ioc->len > 1024)
- {
+ if (ioc->len > HASH_TABLE_LEN) {
status = -EINVAL;
break;
}
^ permalink raw reply related
* 8021p to dscp remarking
From: Smital Desai @ 2010-03-22 11:54 UTC (permalink / raw)
To: netdev@vger.kernel.org
Hello
Is it possible to support 8021p -> Dscp remarking in kernel for the routers that
are not supporting such kind of remarking mechanism at hardware level ?
Any such support available in latest kernel ?
Any help / suggestions will be appreciated .
Thanks,
Smital Desai
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
^ permalink raw reply
* Re: Performance hit with IP-tunnels
From: Eric Dumazet @ 2010-03-22 11:06 UTC (permalink / raw)
To: Kristian Evensen; +Cc: netdev, linux-ppp
In-Reply-To: <000301cac9a8$dcd53750$967fa5f0$@no>
Le lundi 22 mars 2010 à 11:17 +0100, Kristian Evensen a écrit :
> Hello,
>
> I am currently comparing different IP-tunneling protocols/implementations,
> and have stumbled upon something I am not able to explain. Regardless of
> which tunneling technology I use, the latency increases with a couple of 10s
> of ms and I see a significant degradation of throughput (compared to when no
> tunnels are used). The only exception is IP-in-IP, where I get similar
> performance with and without tunnels, but it does unfortunately not work in
> my scenario.
>
> First, I thought this was caused by the different tunneling software, but
> after measuring the processing time of the applications (xl2tp and
> pptp-client) and when the packets are seen by the different iptables chains
> (using LOG), these delays seem to be acceptable. However, one delay sticks
> out. After the packet has been decapsulated and fed to PPP, it takes a
> "long" time before it is seen again. My question is, can PPP be the cause of
> the higher latency and lower throughput?
>
> Similar observations are made at both ends of the tunnel.
A soon as a round trip on a user process is requested to handle a
packet, you can have delay because of scheduling constraints.
You could try latencytop and check if something strange raises, 10 ms
seems excessive.
IP-TIP tunnels dont use a user space program, they are immune to
scheduler latencies.
^ permalink raw reply
* tc download always to "default"
From: Mihamina Rakotomandimby @ 2010-03-22 10:44 UTC (permalink / raw)
To: netdev
Manao ahoana, Hello, Bonjour,
This is my simple topology:
LAN <--> (eth1)[gateway](eth2) <--> Internet
The gataway NATs (Masquerade) but there is no trouble about this.
I would like to limit the DOWNLOAD bandwidth per host.
Download is:
Internet -> gateway -> eth1 -> LAN Host
LAN is 10.150.0.128/25
There are sample lines of my "tc" ruleset:
http://pastebin.org/119806
My problem is all the traffic is caught by "classid 1:10", the default
class.
Nothing is trapped by "classid 1:301" -> "classid 1:426"
At a first glance, would you see something wrong in these?
Misaotra, Thanks, Merci.
--
Architecte Informatique chez Blueline/Gulfsat:
Administration Systeme, Recherche & Developpement
+261 34 29 155 34 / +261 33 11 207 36
^ permalink raw reply
* Performance hit with IP-tunnels
From: Kristian Evensen @ 2010-03-22 10:17 UTC (permalink / raw)
To: netdev, linux-ppp
Hello,
I am currently comparing different IP-tunneling protocols/implementations,
and have stumbled upon something I am not able to explain. Regardless of
which tunneling technology I use, the latency increases with a couple of 10s
of ms and I see a significant degradation of throughput (compared to when no
tunnels are used). The only exception is IP-in-IP, where I get similar
performance with and without tunnels, but it does unfortunately not work in
my scenario.
First, I thought this was caused by the different tunneling software, but
after measuring the processing time of the applications (xl2tp and
pptp-client) and when the packets are seen by the different iptables chains
(using LOG), these delays seem to be acceptable. However, one delay sticks
out. After the packet has been decapsulated and fed to PPP, it takes a
"long" time before it is seen again. My question is, can PPP be the cause of
the higher latency and lower throughput?
Similar observations are made at both ends of the tunnel.
Thanks in advance for any help,
Kristian
^ permalink raw reply
* [Patch] netconsole: do not depend on experimental
From: Amerigo Wang @ 2010-03-22 9:59 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev, Amerigo Wang, David Miller
Nowadays, most distributions enable netconsole by default,
including RHEL, Fedora, Debian, Arch, Opensuse. And
we don't have any bug reports about it. So I think there
is no need to mark it as experimental any more.
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: WANG Cong <amwang@redhat.com>
---
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 0ba5b8e..e3d6c52 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -3252,15 +3252,14 @@ config NET_FC
"SCSI generic support".
config NETCONSOLE
- tristate "Network console logging support (EXPERIMENTAL)"
- depends on EXPERIMENTAL
+ tristate "Network console logging support"
---help---
If you want to log kernel messages over the network, enable this.
See <file:Documentation/networking/netconsole.txt> for details.
config NETCONSOLE_DYNAMIC
- bool "Dynamic reconfiguration of logging targets (EXPERIMENTAL)"
- depends on NETCONSOLE && SYSFS && EXPERIMENTAL
+ bool "Dynamic reconfiguration of logging targets"
+ depends on NETCONSOLE && SYSFS
select CONFIGFS_FS
help
This option enables the ability to dynamically reconfigure target
^ permalink raw reply related
* -next Mar 22: s390 build failure (drivers/s390/net/qeth_l3)
From: Sachin Sant @ 2010-03-22 9:10 UTC (permalink / raw)
To: linux-s390
Cc: linux-next, netdev, ursula.braun, Stephen Hemminger,
Heiko Carstens
In-Reply-To: <20100322171937.d753bdba.sfr@canb.auug.org.au>
Todays next fails to build on a s390 box with
CC [M] drivers/s390/net/qeth_l3_main.o
drivers/s390/net/qeth_l3_main.c: In function 'qeth_l3_free_vlan_addresses6':
drivers/s390/net/qeth_l3_main.c:1931: error: incompatible types in assignment
drivers/s390/net/qeth_l3_main.c:1931: error: 'struct inet6_ifaddr' has no member named 'lst_next'
make[2]: *** [drivers/s390/net/qeth_l3_main.o] Error 1
commit c2e21293c054817c42eb5fa9c613d2ad51954136
(ipv6: convert addrconf list to hlist)
converted lst_next member of inet6_ifaddr struct to a hlist.
Thanks
-Sachin
--
---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------
^ permalink raw reply
* [Patch v2] netpoll: warn when there are spaces in parameters
From: Amerigo Wang @ 2010-03-22 8:59 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev, elendil, Amerigo Wang, David Miller
v2: update according to Frans' comments.
Currently, if we leave spaces before dst port,
netconsole will silently accept it as 0. Warn about this.
Also, when spaces appear in other places, make them
visible in error messages.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David Miller <davem@davemloft.net>
---
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 7aa6972..6df1863 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -614,7 +614,7 @@ void netpoll_print_options(struct netpoll *np)
np->name, np->local_port);
printk(KERN_INFO "%s: local IP %pI4\n",
np->name, &np->local_ip);
- printk(KERN_INFO "%s: interface %s\n",
+ printk(KERN_INFO "%s: interface '%s'\n",
np->name, np->dev_name);
printk(KERN_INFO "%s: remote port %d\n",
np->name, np->remote_port);
@@ -661,6 +661,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
+ if (*cur == ' ' || *cur == '\t')
+ printk(KERN_INFO "%s: warning: whitespace"
+ "is not allowed\n", np->name);
np->remote_port = simple_strtol(cur, NULL, 10);
cur = delim;
}
@@ -708,7 +711,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
return 0;
parse_failed:
- printk(KERN_INFO "%s: couldn't parse config at %s!\n",
+ printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
np->name, cur);
return -1;
}
^ permalink raw reply related
* [RFC Patch 3/3] bonding: make bonding support netpoll
From: Amerigo Wang @ 2010-03-22 8:17 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, bridge, Andy Gospodarek, Neil Horman, Amerigo Wang,
Stephen Hemminger, bonding-devel, Jay Vosburgh, David Miller
In-Reply-To: <20100322082059.4967.63492.sendpatchset@localhost.localdomain>
Based on Andy's work, but I modify a lot.
Similar to the patch for bridge, this patch does:
1) implement the 4 methods to support netpoll for bonding;
2) modify netpoll during forwarding packets in bonding;
3) disable netpoll support of bridge when a netpoll-unabled device
is added to bonding;
4) enable netpoll support when all underlying devices support netpoll.
Cc: Andy Gospodarek <gospo@redhat.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: WANG Cong <amwang@redhat.com>
---
Index: linux-2.6/drivers/net/bonding/bond_main.c
===================================================================
--- linux-2.6.orig/drivers/net/bonding/bond_main.c
+++ linux-2.6/drivers/net/bonding/bond_main.c
@@ -59,6 +59,7 @@
#include <linux/uaccess.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
+#include <linux/netpoll.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/etherdevice.h>
@@ -430,7 +431,17 @@ int bond_dev_queue_xmit(struct bonding *
}
skb->priority = 1;
- dev_queue_xmit(skb);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (bond->dev->priv_flags & IFF_IN_NETPOLL) {
+ bond->dev->npinfo->netpoll->dev = skb->dev;
+ if (!slave_dev->npinfo)
+ slave_dev->npinfo = bond->dev->npinfo;
+ slave_dev->priv_flags |= IFF_IN_NETPOLL;
+ netpoll_send_skb(bond->dev->npinfo->netpoll, skb);
+ slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
+ } else
+#endif
+ dev_queue_xmit(skb);
return 0;
}
@@ -1324,6 +1335,87 @@ static void bond_detach_slave(struct bon
bond->slave_cnt--;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static bool slaves_support_netpoll(struct net_device *bond_dev)
+{
+ struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave;
+ int i = 0;
+ bool ret = true;
+
+ read_lock_bh(&bond->lock);
+ bond_for_each_slave(bond, slave, i) {
+ if ((slave->dev->priv_flags & IFF_DISABLE_NETPOLL)
+ || !slave->dev->netdev_ops->ndo_poll_controller)
+ ret = false;
+ }
+ read_unlock_bh(&bond->lock);
+ return i != 0 && ret;
+}
+
+static void bond_poll_controller(struct net_device *bond_dev)
+{
+ struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave;
+ int i;
+
+ read_lock(&bond->lock);
+ bond_for_each_slave(bond, slave, i) {
+ if (slave->dev->netdev_ops->ndo_poll_controller)
+ netpoll_poll_dev(slave->dev);
+ }
+ read_unlock(&bond->lock);
+}
+
+static void bond_netpoll_setup(struct net_device *bond_dev,
+ struct netpoll_info *npinfo)
+{
+ struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave;
+ int i;
+
+ write_lock_bh(&bond->lock);
+ bond_for_each_slave(bond, slave, i) {
+ if (slave->dev)
+ slave->dev->npinfo = npinfo;
+ }
+ write_unlock_bh(&bond->lock);
+}
+
+static void bond_netpoll_cleanup(struct net_device *bond_dev)
+{
+ struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave;
+ const struct net_device_ops *ops;
+ int i;
+
+ write_lock_bh(&bond->lock);
+ bond_dev->npinfo = NULL;
+ bond_for_each_slave(bond, slave, i) {
+ if (slave->dev) {
+ ops = slave->dev->netdev_ops;
+ if (ops->ndo_netpoll_cleanup)
+ ops->ndo_netpoll_cleanup(slave->dev);
+ else
+ slave->dev->npinfo = NULL;
+ }
+ }
+ write_unlock_bh(&bond->lock);
+}
+
+static int bond_netpoll_xmit(struct netpoll *np, struct sk_buff *skb,
+ struct net_device *dev)
+{
+ int ret;
+
+ dev->priv_flags |= IFF_IN_NETPOLL;
+ ret = dev->netdev_ops->ndo_start_xmit(skb, dev);
+ np->dev = dev;
+ dev->priv_flags &= ~IFF_IN_NETPOLL;
+ return ret;
+}
+#endif
+
/*---------------------------------- IOCTL ----------------------------------*/
static int bond_sethwaddr(struct net_device *bond_dev,
@@ -1741,6 +1833,18 @@ int bond_enslave(struct net_device *bond
new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (slaves_support_netpoll(bond_dev)) {
+ bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
+ if (bond_dev->npinfo)
+ slave_dev->npinfo = bond_dev->npinfo;
+ } else if (!(bond_dev->priv_flags & IFF_DISABLE_NETPOLL)) {
+ bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
+ pr_info("New slave device %s does not support netpoll\n",
+ slave_dev->name);
+ pr_info("Disabling netpoll support for %s\n", bond_dev->name);
+ }
+#endif
/* enslave is successful */
return 0;
@@ -1924,6 +2028,15 @@ int bond_release(struct net_device *bond
netdev_set_master(slave_dev, NULL);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (slaves_support_netpoll(bond_dev))
+ bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
+ if (slave_dev->netdev_ops->ndo_netpoll_cleanup)
+ slave_dev->netdev_ops->ndo_netpoll_cleanup(slave_dev);
+ else
+ slave_dev->npinfo = NULL;
+#endif
+
/* close slave before restoring its mac address */
dev_close(slave_dev);
@@ -2032,6 +2145,9 @@ static int bond_release_all(struct net_d
netdev_set_master(slave_dev, NULL);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ slave_dev->npinfo = NULL;
+#endif
/* close slave before restoring its mac address */
dev_close(slave_dev);
@@ -4424,6 +4540,12 @@ static const struct net_device_ops bond_
.ndo_vlan_rx_register = bond_vlan_rx_register,
.ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_netpoll_setup = bond_netpoll_setup,
+ .ndo_netpoll_xmit = bond_netpoll_xmit,
+ .ndo_netpoll_cleanup = bond_netpoll_cleanup,
+ .ndo_poll_controller = bond_poll_controller,
+#endif
};
static void bond_setup(struct net_device *bond_dev)
^ permalink raw reply
* [RFC Patch 2/3] bridge: make bridge support netpoll
From: Amerigo Wang @ 2010-03-22 8:17 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, bridge, Andy Gospodarek, Neil Horman, Amerigo Wang,
Stephen Hemminger, bonding-devel, Jay Vosburgh, David Miller
In-Reply-To: <20100322082059.4967.63492.sendpatchset@localhost.localdomain>
Based on the previous patch, make bridge support netpoll by:
1) implement the 4 methods to support netpoll for bridge;
2) modify netpoll during forwarding packets in bridge;
3) disable netpoll support of bridge when a netpoll-unabled device
is added to bridge;
4) enable netpoll support when all underlying devices support netpoll.
Cc: David Miller <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: WANG Cong <amwang@redhat.com>
---
Index: linux-2.6/net/bridge/br_device.c
===================================================================
--- linux-2.6.orig/net/bridge/br_device.c
+++ linux-2.6/net/bridge/br_device.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/netdevice.h>
+#include <linux/netpoll.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
@@ -162,6 +163,87 @@ static int br_set_tx_csum(struct net_dev
return 0;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+bool br_devices_support_netpoll(struct net_bridge *br)
+{
+ struct net_bridge_port *p;
+ bool ret = true;
+ int count = 0;
+ unsigned long flags;
+
+ spin_lock_irqsave(&br->lock, flags);
+ list_for_each_entry(p, &br->port_list, list) {
+ count++;
+ if (p->dev->priv_flags & IFF_DISABLE_NETPOLL
+ || !p->dev->netdev_ops->ndo_poll_controller)
+ ret = false;
+ }
+ spin_unlock_irqrestore(&br->lock, flags);
+ return count != 0 && ret;
+}
+
+static void br_poll_controller(struct net_device *br_dev)
+{
+ struct net_bridge *br = netdev_priv(br_dev);
+ struct net_bridge_port *p;
+ unsigned long flags;
+
+ spin_lock_irqsave(&br->lock, flags);
+ list_for_each_entry(p, &br->port_list, list) {
+ if (p->dev->netdev_ops->ndo_poll_controller)
+ netpoll_poll_dev(p->dev);
+ }
+ spin_unlock_irqrestore(&br->lock, flags);
+}
+
+static void br_netpoll_setup(struct net_device *br_dev, struct netpoll_info *npinfo)
+{
+ struct net_bridge *br = netdev_priv(br_dev);
+ struct net_bridge_port *p;
+ unsigned long flags;
+
+ spin_lock_irqsave(&br->lock, flags);
+ list_for_each_entry(p, &br->port_list, list) {
+ if (p->dev)
+ p->dev->npinfo = npinfo;
+ }
+ spin_unlock_irqrestore(&br->lock, flags);
+}
+
+static void br_netpoll_cleanup(struct net_device *br_dev)
+{
+ struct net_bridge *br = netdev_priv(br_dev);
+ struct net_bridge_port *p;
+ const struct net_device_ops *ops;
+ unsigned long flags;
+
+ spin_lock_irqsave(&br->lock, flags);
+ br->dev->npinfo = NULL;
+ list_for_each_entry(p, &br->port_list, list) {
+ if (p->dev) {
+ ops = p->dev->netdev_ops;
+ if (ops->ndo_netpoll_cleanup)
+ ops->ndo_netpoll_cleanup(p->dev);
+ else
+ p->dev->npinfo = NULL;
+ }
+ }
+ spin_unlock_irqrestore(&br->lock, flags);
+}
+
+static int br_netpoll_xmit(struct netpoll *np, struct sk_buff *skb, struct net_device *dev)
+{
+ int ret;
+
+ dev->priv_flags |= IFF_IN_NETPOLL;
+ ret = dev->netdev_ops->ndo_start_xmit(skb, dev);
+ np->dev = dev;
+ dev->priv_flags &= ~IFF_IN_NETPOLL;
+ return ret;
+}
+
+#endif
+
static const struct ethtool_ops br_ethtool_ops = {
.get_drvinfo = br_getinfo,
.get_link = ethtool_op_get_link,
@@ -184,6 +266,12 @@ static const struct net_device_ops br_ne
.ndo_set_multicast_list = br_dev_set_multicast_list,
.ndo_change_mtu = br_change_mtu,
.ndo_do_ioctl = br_dev_ioctl,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_netpoll_setup = br_netpoll_setup,
+ .ndo_netpoll_xmit = br_netpoll_xmit,
+ .ndo_netpoll_cleanup = br_netpoll_cleanup,
+ .ndo_poll_controller = br_poll_controller,
+#endif
};
void br_dev_setup(struct net_device *dev)
Index: linux-2.6/net/bridge/br_forward.c
===================================================================
--- linux-2.6.orig/net/bridge/br_forward.c
+++ linux-2.6/net/bridge/br_forward.c
@@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
+#include <linux/netpoll.h>
#include <linux/skbuff.h>
#include <linux/if_vlan.h>
#include <linux/netfilter_bridge.h>
@@ -44,7 +45,13 @@ int br_dev_queue_push_xmit(struct sk_buf
else {
skb_push(skb, ETH_HLEN);
- dev_queue_xmit(skb);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (skb->dev->priv_flags & IFF_IN_NETPOLL) {
+ netpoll_send_skb(skb->dev->npinfo->netpoll, skb);
+ skb->dev->priv_flags &= ~IFF_IN_NETPOLL;
+ } else
+#endif
+ dev_queue_xmit(skb);
}
}
@@ -60,6 +67,16 @@ int br_forward_finish(struct sk_buff *sk
static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
{
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ struct net_bridge *br = to->br;
+ if (br->dev->priv_flags & IFF_IN_NETPOLL) {
+ skb->dev->npinfo->netpoll->dev = to->dev;
+ if (!to->dev->npinfo)
+ to->dev->npinfo = skb->dev->npinfo;
+
+ to->dev->priv_flags |= IFF_IN_NETPOLL;
+ }
+#endif
skb->dev = to->dev;
NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
br_forward_finish);
Index: linux-2.6/net/bridge/br_if.c
===================================================================
--- linux-2.6.orig/net/bridge/br_if.c
+++ linux-2.6/net/bridge/br_if.c
@@ -19,6 +19,7 @@
#include <linux/init.h>
#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
+#include <linux/netpoll.h>
#include <net/sock.h>
#include "br_private.h"
@@ -152,6 +153,14 @@ static void del_nbp(struct net_bridge_po
kobject_uevent(&p->kobj, KOBJ_REMOVE);
kobject_del(&p->kobj);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (br_devices_support_netpoll(br))
+ br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
+ if (br->dev->netdev_ops->ndo_netpoll_cleanup)
+ br->dev->netdev_ops->ndo_netpoll_cleanup(br->dev);
+ else
+ dev->npinfo = NULL;
+#endif
call_rcu(&p->rcu, destroy_nbp_rcu);
}
@@ -437,6 +446,20 @@ int br_add_if(struct net_bridge *br, str
kobject_uevent(&p->kobj, KOBJ_ADD);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (br_devices_support_netpoll(br)) {
+ br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
+ if (br->dev->npinfo)
+ dev->npinfo = br->dev->npinfo;
+ } else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
+ br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
+ printk(KERN_INFO "New device %s does not support netpoll\n",
+ dev->name);
+ printk(KERN_INFO "Disabling netpoll for %s\n",
+ br->dev->name);
+ }
+#endif
+
return 0;
err2:
br_fdb_delete_by_port(br, p, 1);
Index: linux-2.6/net/bridge/br_private.h
===================================================================
--- linux-2.6.orig/net/bridge/br_private.h
+++ linux-2.6/net/bridge/br_private.h
@@ -225,6 +225,7 @@ static inline int br_is_root_bridge(cons
extern void br_dev_setup(struct net_device *dev);
extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
struct net_device *dev);
+extern bool br_devices_support_netpoll(struct net_bridge *br);
/* br_fdb.c */
extern int br_fdb_init(void);
^ permalink raw reply
* [RFC Patch 1/3] netpoll: add generic support for bridge and bonding devices
From: Amerigo Wang @ 2010-03-22 8:17 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, bridge, Andy Gospodarek, Neil Horman, Amerigo Wang,
Stephen Hemminger, bonding-devel, Jay Vosburgh, David Miller
This whole patchset is for adding netpoll support to bridge and bonding
devices. I already tested it for bridge, bonding, bridge over bonding,
and bonding over bridge. It looks fine now.
Please comment.
To make bridge and bonding support netpoll, we need to adjust
some netpoll generic code. This patch does the following things:
1) introduce two new priv_flags for struct net_device:
IFF_IN_NETPOLL which identifies we are processing a netpoll;
IFF_DISABLE_NETPOLL is used to disable netpoll support for a device
at run-time;
2) introduce three new methods for netdev_ops:
->ndo_netpoll_setup() is used to setup netpoll for a device;
->ndo_netpoll_xmit() is used to transmit netpoll requests;
->ndo_netpoll_cleanup() is used to clean up netpoll when a device is
removed.
3) introduce netpoll_poll_dev() which takes a struct net_device * parameter;
4) export netpoll_send_skb() and netpoll_poll_dev() which will be used later;
5) hide a pointer to struct netpoll in struct netpoll_info, ditto.
Cc: David Miller <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
---
Index: linux-2.6/include/linux/if.h
===================================================================
--- linux-2.6.orig/include/linux/if.h
+++ linux-2.6/include/linux/if.h
@@ -71,6 +71,8 @@
* release skb->dst
*/
#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
+#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
+#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
#define IF_GET_IFACE 0x0001 /* for querying only */
#define IF_GET_PROTO 0x0002
Index: linux-2.6/include/linux/netdevice.h
===================================================================
--- linux-2.6.orig/include/linux/netdevice.h
+++ linux-2.6/include/linux/netdevice.h
@@ -530,6 +530,8 @@ struct netdev_queue {
unsigned long tx_dropped;
} ____cacheline_aligned_in_smp;
+struct netpoll;
+struct netpoll_info;
/*
* This structure defines the management hooks for network devices.
@@ -667,6 +669,12 @@ struct net_device_ops {
unsigned short vid);
#ifdef CONFIG_NET_POLL_CONTROLLER
void (*ndo_poll_controller)(struct net_device *dev);
+ void (*ndo_netpoll_setup)(struct net_device *dev,
+ struct netpoll_info *npinfo);
+ int (*ndo_netpoll_xmit)(struct netpoll *np,
+ struct sk_buff *skb,
+ struct net_device *dev);
+ void (*ndo_netpoll_cleanup)(struct net_device *dev);
#endif
int (*ndo_set_vf_mac)(struct net_device *dev,
int queue, u8 *mac);
Index: linux-2.6/include/linux/netpoll.h
===================================================================
--- linux-2.6.orig/include/linux/netpoll.h
+++ linux-2.6/include/linux/netpoll.h
@@ -36,8 +36,11 @@ struct netpoll_info {
struct sk_buff_head txq;
struct delayed_work tx_work;
+
+ struct netpoll *netpoll;
};
+void netpoll_poll_dev(struct net_device *dev);
void netpoll_poll(struct netpoll *np);
void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
void netpoll_print_options(struct netpoll *np);
@@ -47,6 +50,7 @@ int netpoll_trap(void);
void netpoll_set_trap(int trap);
void netpoll_cleanup(struct netpoll *np);
int __netpoll_rx(struct sk_buff *skb);
+void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
#ifdef CONFIG_NETPOLL
Index: linux-2.6/net/core/netpoll.c
===================================================================
--- linux-2.6.orig/net/core/netpoll.c
+++ linux-2.6/net/core/netpoll.c
@@ -178,9 +178,8 @@ static void service_arp_queue(struct net
}
}
-void netpoll_poll(struct netpoll *np)
+void netpoll_poll_dev(struct net_device *dev)
{
- struct net_device *dev = np->dev;
const struct net_device_ops *ops;
if (!dev || !netif_running(dev))
@@ -200,6 +199,13 @@ void netpoll_poll(struct netpoll *np)
zap_completion_queue();
}
+void netpoll_poll(struct netpoll *np)
+{
+ if (!np->dev)
+ return;
+ netpoll_poll_dev(np->dev);
+}
+
static void refill_skbs(void)
{
struct sk_buff *skb;
@@ -281,7 +287,7 @@ static int netpoll_owner_active(struct n
return 0;
}
-static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
+void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
{
int status = NETDEV_TX_BUSY;
unsigned long tries;
@@ -307,7 +313,10 @@ static void netpoll_send_skb(struct netp
tries > 0; --tries) {
if (__netif_tx_trylock(txq)) {
if (!netif_tx_queue_stopped(txq)) {
- status = ops->ndo_start_xmit(skb, dev);
+ if (ops->ndo_netpoll_xmit)
+ status = ops->ndo_netpoll_xmit(np, skb, dev);
+ else
+ status = ops->ndo_start_xmit(skb, dev);
if (status == NETDEV_TX_OK)
txq_trans_update(txq);
}
@@ -752,7 +761,10 @@ int netpoll_setup(struct netpoll *np)
atomic_inc(&npinfo->refcnt);
}
- if (!ndev->netdev_ops->ndo_poll_controller) {
+ npinfo->netpoll = np;
+
+ if (ndev->priv_flags & IFF_DISABLE_NETPOLL
+ || !ndev->netdev_ops->ndo_poll_controller) {
printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
np->name, np->dev_name);
err = -ENOTSUPP;
@@ -830,6 +842,9 @@ int netpoll_setup(struct netpoll *np)
/* last thing to do is link it to the net device structure */
ndev->npinfo = npinfo;
+ if (ndev->netdev_ops->ndo_netpoll_setup)
+ ndev->netdev_ops->ndo_netpoll_setup(ndev, npinfo);
+
/* avoid racing with NAPI reading npinfo */
synchronize_rcu();
@@ -904,6 +919,7 @@ void netpoll_set_trap(int trap)
atomic_dec(&trapped);
}
+EXPORT_SYMBOL(netpoll_send_skb);
EXPORT_SYMBOL(netpoll_set_trap);
EXPORT_SYMBOL(netpoll_trap);
EXPORT_SYMBOL(netpoll_print_options);
@@ -911,4 +927,5 @@ EXPORT_SYMBOL(netpoll_parse_options);
EXPORT_SYMBOL(netpoll_setup);
EXPORT_SYMBOL(netpoll_cleanup);
EXPORT_SYMBOL(netpoll_send_udp);
+EXPORT_SYMBOL(netpoll_poll_dev);
EXPORT_SYMBOL(netpoll_poll);
^ permalink raw reply
* Re: why does there need to lock?
From: Eric Dumazet @ 2010-03-22 8:05 UTC (permalink / raw)
To: 杨硕; +Cc: netdev
In-Reply-To: <ffe582101003211741v59da3c56yaffdaa151a6821be@mail.gmail.com>
Le lundi 22 mars 2010 à 08:41 +0800, 杨硕 a écrit :
> Hi, i'm confused about why does "rcu_assign_pointer(dev->ip_ptr,
> in_dev);" need to rcu lock?
>
I am confused by your question
rcu_assign_pointer doesnt need rcu lock.
It only makes sure all previous memory changes are committed to memory
before the "dev->ip_ptr = in_dev;" assignement, so that concurrent
readers cannot find the new pointer and read previous values of
dev->ip_ptr->fields
> TIA :)
>
> static struct in_device *inetdev_init(struct net_device *dev)
> {
> struct in_device *in_dev;
>
> ASSERT_RTNL();
>
> in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL);
> if (!in_dev)
> goto out;
> memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
> sizeof(in_dev->cnf));
> in_dev->cnf.sysctl = NULL;
> in_dev->dev = dev;
> if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL)
> goto out_kfree;
> if (IPV4_DEVCONF(in_dev->cnf, FORWARDING))
> dev_disable_lro(dev);
> /* Reference in_dev->dev */
> dev_hold(dev);
> /* Account for reference dev->ip_ptr (below) */
> in_dev_hold(in_dev);
>
> devinet_sysctl_register(in_dev);
> ip_mc_init_dev(in_dev);
> if (dev->flags & IFF_UP)
> ip_mc_up(in_dev);
>
> /* we can receive as soon as ip_ptr is set -- do this last */
> rcu_assign_pointer(dev->ip_ptr, in_dev);
> out:
> return in_dev;
> out_kfree:
> kfree(in_dev);
> in_dev = NULL;
> goto out;
> }
^ permalink raw reply
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