* Re: [PATCH net-next-2.6] loopback: Implement 64bit stats on 32bit arches
From: Nick Piggin @ 2010-06-15 6:49 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, bhutchings
In-Reply-To: <20100614.231412.39191304.davem@davemloft.net>
On Mon, Jun 14, 2010 at 11:14:12PM -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 14 Jun 2010 17:59:22 +0200
>
> > Uses a seqcount_t to synchronize stat producer and consumer, for packets
> > and bytes counter, now u64 types.
> >
> > (dropped counter being rarely used, stay a native "unsigned long" type)
> >
> > No noticeable performance impact on x86, as it only adds two increments
> > per frame. It might be more expensive on arches where smp_wmb() is not
> > free.
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Applied, but I suspect we might end up eventually needing to
> abstract this kind of technique in a common place so other
> spots can use it.
Check i_size stuff in include/linux/fs.h if you consider doing this.
And keep preempt in mind too. I assume you can't be preempted at this
point, but if you're prone to change the locking, it might be worth
the (small) cost of doing explicit preempt_disable() (and maybe to
help the sanity of the -rt guys too).
^ permalink raw reply
* Re: [net-next PATCH] bnx2x: Fix link problem with some DACs
From: David Miller @ 2010-06-15 6:25 UTC (permalink / raw)
To: yanivr; +Cc: netdev, ole, eilong
In-Reply-To: <1276590163.13056.32.camel@lb-tlvb-yanivr.il.broadcom.com>
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Tue, 15 Jun 2010 11:22:43 +0300
> Change 2wire transfer rate of SFP+ module EEPROM from 400Khz to 100Khz since some DACs(direct attached cables) do not work at 400Khz.
>
> Reported-by: Krzysztof Oldzki <ole@ans.pl>
> Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Applied, thanks.
^ permalink raw reply
* [net-next PATCH] bnx2x: Fix link problem with some DACs
From: Yaniv Rosner @ 2010-06-15 8:22 UTC (permalink / raw)
To: davem; +Cc: netdev, ole, eilong
Change 2wire transfer rate of SFP+ module EEPROM from 400Khz to 100Khz since some DACs(direct attached cables) do not work at 400Khz.
Reported-by: Krzysztof Oldzki <ole@ans.pl>
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index ff70be8..0383e30 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -4266,14 +4266,16 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
MDIO_PMA_REG_10G_CTRL2, 0x0008);
}
- /* Set 2-wire transfer rate to 400Khz since 100Khz
- is not operational */
+ /* Set 2-wire transfer rate of SFP+ module EEPROM
+ * to 100Khz since some DACs(direct attached cables) do
+ * not work at 400Khz.
+ */
bnx2x_cl45_write(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_PMA_DEVAD,
MDIO_PMA_REG_8727_TWO_WIRE_SLAVE_ADDR,
- 0xa101);
+ 0xa001);
/* Set TX PreEmphasis if needed */
if ((params->feature_config_flags &
^ permalink raw reply related
* udp: Add UFO to NETIF_F_SOFTWARE_GSO
From: Herbert Xu @ 2010-06-15 6:21 UTC (permalink / raw)
To: David S. Miller, netdev
Hi:
udp: Add UFO to NETIF_F_SOFTWARE_GSO
This patch adds UFO to the list of GSO features with a software
fallback. This allows UFO to be used even if the hardware does
not support it.
In particular, this allows us to test the UFO fallback, as it
has been reported to not work in some cases.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 40291f3..ea48a43 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -847,7 +847,8 @@ struct net_device {
#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
/* List of features with software fallbacks. */
-#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
+#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
+ NETIF_F_TSO6 | NETIF_F_UFO)
#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related
* Re: [PATCH net-next-2.6] ipv6: avoid two atomics in ipv6_rthdr_rcv()
From: David Miller @ 2010-06-15 6:14 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1276526367.2478.98.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Jun 2010 16:39:27 +0200
> Use __in6_dev_get() instead of in6_dev_get()/in6_dev_put()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
From: David Miller @ 2010-06-15 6:14 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1276526780.2478.101.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Jun 2010 16:46:20 +0200
> Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
> and ip6_dst_hoplimit()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next-2.6] loopback: Implement 64bit stats on 32bit arches
From: David Miller @ 2010-06-15 6:14 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, bhutchings
In-Reply-To: <1276531162.2478.121.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Jun 2010 17:59:22 +0200
> Uses a seqcount_t to synchronize stat producer and consumer, for packets
> and bytes counter, now u64 types.
>
> (dropped counter being rarely used, stay a native "unsigned long" type)
>
> No noticeable performance impact on x86, as it only adds two increments
> per frame. It might be more expensive on arches where smp_wmb() is not
> free.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, but I suspect we might end up eventually needing to
abstract this kind of technique in a common place so other
spots can use it.
^ permalink raw reply
* Re: [PATCH] ethtool: Revert incorrect indentation changes
From: David Miller @ 2010-06-15 6:13 UTC (permalink / raw)
To: bhutchings; +Cc: chavey, netdev
In-Reply-To: <1276541606.2074.12.camel@achroite.uk.solarflarecom.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 14 Jun 2010 19:53:26 +0100
> commit 97f8aefbbfb5aa5c9944e5fa8149f1fdaf71c7b6 "net: fix ethtool
> coding style errors and warnings" changed the indentation of several
> macro definitions in ethtool.h. These definitions line up in the diff
> where there is an extra character at the start of each line, but not
> in the resulting file.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: various changes
From: David Miller @ 2010-06-15 6:13 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1276580121.30434.322.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 15 Jun 2010 07:35:21 +0200
> Try to reduce cache line contentions in peer management, to reduce IP
> defragmentation overhead.
>
> - peer_fake_node is marked 'const' to make sure its not modified.
> (tested with CONFIG_DEBUG_RODATA=y)
>
> - Group variables in two structures to reduce number of dirtied cache
> lines. One named "peers" for avl tree root, its number of entries, and
> associated lock. (candidate for RCU conversion)
>
> - A second one named "unused_peers" for unused list and its lock
>
> - Add a !list_empty() test in unlink_from_unused() to avoid taking lock
> when entry is not unused.
>
> - Use atomic_dec_and_lock() in inet_putpeer() to avoid taking lock in
> some cases.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
From: Eric Dumazet @ 2010-06-15 6:12 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: David Miller, netdev, YOSHIFUJI Hideaki
In-Reply-To: <4C164840.5010900@yoshifuji.org>
Le mardi 15 juin 2010 à 00:18 +0900, YOSHIFUJI Hideaki a écrit :
> (2010/06/14 23:46), Eric Dumazet wrote:
> > Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
> > and ip6_dst_hoplimit()
> >
> > Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>
> --yoshfuji
Gah, sorry not having CC you at least for ipv6 stuff !
Thanks !
^ permalink raw reply
* RE: [net-next PATCH] bnx2x: Fix link problem with some DACs
From: Yaniv Rosner @ 2010-06-15 6:12 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <20100614.230728.189694464.davem@davemloft.net>
Sure Dave,
I'll fix and send it again.
-----Original Message-----
From: David Miller [mailto:davem@davemloft.net]
Sent: Tuesday, June 15, 2010 9:07 AM
To: Yaniv Rosner
Cc: netdev@vger.kernel.org
Subject: Re: [net-next PATCH] bnx2x: Fix link problem with some DACs
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Mon, 14 Jun 2010 13:26:28 +0300
> - /* Set 2-wire transfer rate to 400Khz since 100Khz
> - is not operational */
> + /* Set 2-wire transfer rate of SFP+ module EEPROM
> + to 100Khz since some DACs(direct attached cables) do
> + not work at 400Khz.*/
This is not the correct way to format a multi-line comment.
It should be:
/* Set 2-wire transfer rate of SFP+ module EEPROM
* to 100Khz since some DACs(direct attached cables) do
* not work at 400Khz.
*/
^ permalink raw reply
* Re: [net-next PATCH] bnx2x: Fix link problem with some DACs
From: David Miller @ 2010-06-15 6:07 UTC (permalink / raw)
To: yanivr; +Cc: netdev
In-Reply-To: <1276511188.13056.26.camel@lb-tlvb-yanivr.il.broadcom.com>
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Mon, 14 Jun 2010 13:26:28 +0300
> - /* Set 2-wire transfer rate to 400Khz since 100Khz
> - is not operational */
> + /* Set 2-wire transfer rate of SFP+ module EEPROM
> + to 100Khz since some DACs(direct attached cables) do
> + not work at 400Khz.*/
This is not the correct way to format a multi-line comment.
It should be:
/* Set 2-wire transfer rate of SFP+ module EEPROM
* to 100Khz since some DACs(direct attached cables) do
* not work at 400Khz.
*/
^ permalink raw reply
* Re: [RFC patch net/next] net: Hoist assigns from if?
From: David Miller @ 2010-06-15 5:59 UTC (permalink / raw)
To: eric.dumazet; +Cc: joe, netdev
In-Reply-To: <1276580526.30434.330.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 15 Jun 2010 07:42:06 +0200
> Quite honestly, this kind of patch sucks, because it pollutes 'git
> blame' output. Its hard to point out the origin of a particular
> bug/code, and we have to spend precious time playing with complex git
> commands to go over cleanup patches.
I have to agree with Eric on this.
Pundits of these changes will argue that this is a deficiency in
git itself.
But that to me just means that until git has a friendlier way to
walk backwards through blame information for a line to skip past
the cleanup crapola, we shouldn't make a lot of these kinds of
changes.
So that means I'm really not excited to see this kind of patch
submitted, it's just noise that hurts scanning through history
and thus hurts development.
^ permalink raw reply
* Re: [RFC patch net/next] net: Hoist assigns from if?
From: Eric Dumazet @ 2010-06-15 5:42 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev, David Miller
In-Reply-To: <1276561234.4897.38.camel@Joe-Laptop.home>
Le lundi 14 juin 2010 à 17:20 -0700, Joe Perches a écrit :
> Awhile back I posted a script to reformat source code,
> similar to Lindent, but able to select in a piecemeal
> manner what source code style to convert.
>
> http://lkml.org/lkml/2010/3/24/447
>
> One of the options is to convert code from:
> if ((err = function(args)) != NULL) {
> to:
> err = function(args);
> if (err != NULL) {
>
> I ran this script against net/ and get this result:
>
> $ grep -rPl --include=*.[ch] "\bif\s*\(\s*\(" net/ | \
> grep -v netfilter | \
> xargs ./scripts/cvt_kernel_style.pl -o -convert=hoist_assigns_from_if
>
> and after a little cleanup, compilation verification, etc
> I get the diffstat below. Should I post the actual patch?
>
I'll answer for myself, but wait for David answer ;)
Quite honestly, this kind of patch sucks, because it pollutes 'git
blame' output. Its hard to point out the origin of a particular
bug/code, and we have to spend precious time playing with complex git
commands to go over cleanup patches.
Maybe its possible to mark a patch with a 'cleanups only' git qualifier
that can be ignored by 'git blame' ?
If not, that would be a nice git improvement to work on.
Alternatively, you could change real old stuff only (marked as the
original commit from Linus (1da177e4c3f4), creation of the known
universe back in 2005.
^ permalink raw reply
* [PATCH net-next-2.6] inetpeer: various changes
From: Eric Dumazet @ 2010-06-15 5:35 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Try to reduce cache line contentions in peer management, to reduce IP
defragmentation overhead.
- peer_fake_node is marked 'const' to make sure its not modified.
(tested with CONFIG_DEBUG_RODATA=y)
- Group variables in two structures to reduce number of dirtied cache
lines. One named "peers" for avl tree root, its number of entries, and
associated lock. (candidate for RCU conversion)
- A second one named "unused_peers" for unused list and its lock
- Add a !list_empty() test in unlink_from_unused() to avoid taking lock
when entry is not unused.
- Use atomic_dec_and_lock() in inet_putpeer() to avoid taking lock in
some cases.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/ipv4/inetpeer.c | 94 +++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 38 deletions(-)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 6bcfe52..035673f 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -70,17 +70,25 @@
static struct kmem_cache *peer_cachep __read_mostly;
#define node_height(x) x->avl_height
-static struct inet_peer peer_fake_node = {
- .avl_left = &peer_fake_node,
- .avl_right = &peer_fake_node,
+
+#define peer_avl_empty ((struct inet_peer *)&peer_fake_node)
+static const struct inet_peer peer_fake_node = {
+ .avl_left = peer_avl_empty,
+ .avl_right = peer_avl_empty,
.avl_height = 0
};
-#define peer_avl_empty (&peer_fake_node)
-static struct inet_peer *peer_root = peer_avl_empty;
-static DEFINE_RWLOCK(peer_pool_lock);
+
+static struct {
+ struct inet_peer *root;
+ rwlock_t lock;
+ int total;
+} peers = {
+ .root = peer_avl_empty,
+ .lock = __RW_LOCK_UNLOCKED(peers.lock),
+ .total = 0,
+};
#define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */
-static int peer_total;
/* Exported for sysctl_net_ipv4. */
int inet_peer_threshold __read_mostly = 65536 + 128; /* start to throw entries more
* aggressively at this stage */
@@ -89,8 +97,13 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min
int inet_peer_gc_mintime __read_mostly = 10 * HZ;
int inet_peer_gc_maxtime __read_mostly = 120 * HZ;
-static LIST_HEAD(unused_peers);
-static DEFINE_SPINLOCK(inet_peer_unused_lock);
+static struct {
+ struct list_head list;
+ spinlock_t lock;
+} unused_peers = {
+ .list = LIST_HEAD_INIT(unused_peers.list),
+ .lock = __SPIN_LOCK_UNLOCKED(unused_peers.lock),
+};
static void peer_check_expire(unsigned long dummy);
static DEFINE_TIMER(peer_periodic_timer, peer_check_expire, 0, 0);
@@ -131,9 +144,11 @@ void __init inet_initpeers(void)
/* Called with or without local BH being disabled. */
static void unlink_from_unused(struct inet_peer *p)
{
- spin_lock_bh(&inet_peer_unused_lock);
- list_del_init(&p->unused);
- spin_unlock_bh(&inet_peer_unused_lock);
+ if (!list_empty(&p->unused)) {
+ spin_lock_bh(&unused_peers.lock);
+ list_del_init(&p->unused);
+ spin_unlock_bh(&unused_peers.lock);
+ }
}
/*
@@ -146,9 +161,9 @@ static void unlink_from_unused(struct inet_peer *p)
struct inet_peer *u, **v; \
if (_stack != NULL) { \
stackptr = _stack; \
- *stackptr++ = &peer_root; \
+ *stackptr++ = &peers.root; \
} \
- for (u = peer_root; u != peer_avl_empty; ) { \
+ for (u = peers.root; u != peer_avl_empty; ) { \
if (_daddr == u->v4daddr) \
break; \
if ((__force __u32)_daddr < (__force __u32)u->v4daddr) \
@@ -262,7 +277,7 @@ do { \
n->avl_right = peer_avl_empty; \
**--stackptr = n; \
peer_avl_rebalance(stack, stackptr); \
-} while(0)
+} while (0)
/* May be called with local BH enabled. */
static void unlink_from_pool(struct inet_peer *p)
@@ -271,7 +286,7 @@ static void unlink_from_pool(struct inet_peer *p)
do_free = 0;
- write_lock_bh(&peer_pool_lock);
+ write_lock_bh(&peers.lock);
/* Check the reference counter. It was artificially incremented by 1
* in cleanup() function to prevent sudden disappearing. If the
* reference count is still 1 then the node is referenced only as `p'
@@ -303,10 +318,10 @@ static void unlink_from_pool(struct inet_peer *p)
delp[1] = &t->avl_left; /* was &p->avl_left */
}
peer_avl_rebalance(stack, stackptr);
- peer_total--;
+ peers.total--;
do_free = 1;
}
- write_unlock_bh(&peer_pool_lock);
+ write_unlock_bh(&peers.lock);
if (do_free)
kmem_cache_free(peer_cachep, p);
@@ -326,16 +341,16 @@ static int cleanup_once(unsigned long ttl)
struct inet_peer *p = NULL;
/* Remove the first entry from the list of unused nodes. */
- spin_lock_bh(&inet_peer_unused_lock);
- if (!list_empty(&unused_peers)) {
+ spin_lock_bh(&unused_peers.lock);
+ if (!list_empty(&unused_peers.list)) {
__u32 delta;
- p = list_first_entry(&unused_peers, struct inet_peer, unused);
+ p = list_first_entry(&unused_peers.list, struct inet_peer, unused);
delta = (__u32)jiffies - p->dtime;
if (delta < ttl) {
/* Do not prune fresh entries. */
- spin_unlock_bh(&inet_peer_unused_lock);
+ spin_unlock_bh(&unused_peers.lock);
return -1;
}
@@ -345,7 +360,7 @@ static int cleanup_once(unsigned long ttl)
* before unlink_from_pool() call. */
atomic_inc(&p->refcnt);
}
- spin_unlock_bh(&inet_peer_unused_lock);
+ spin_unlock_bh(&unused_peers.lock);
if (p == NULL)
/* It means that the total number of USED entries has
@@ -364,11 +379,11 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr;
/* Look up for the address quickly. */
- read_lock_bh(&peer_pool_lock);
+ read_lock_bh(&peers.lock);
p = lookup(daddr, NULL);
if (p != peer_avl_empty)
atomic_inc(&p->refcnt);
- read_unlock_bh(&peer_pool_lock);
+ read_unlock_bh(&peers.lock);
if (p != peer_avl_empty) {
/* The existing node has been found. */
@@ -390,7 +405,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
atomic_set(&n->ip_id_count, secure_ip_id(daddr));
n->tcp_ts_stamp = 0;
- write_lock_bh(&peer_pool_lock);
+ write_lock_bh(&peers.lock);
/* Check if an entry has suddenly appeared. */
p = lookup(daddr, stack);
if (p != peer_avl_empty)
@@ -399,10 +414,10 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
/* Link the node. */
link_to_pool(n);
INIT_LIST_HEAD(&n->unused);
- peer_total++;
- write_unlock_bh(&peer_pool_lock);
+ peers.total++;
+ write_unlock_bh(&peers.lock);
- if (peer_total >= inet_peer_threshold)
+ if (peers.total >= inet_peer_threshold)
/* Remove one less-recently-used entry. */
cleanup_once(0);
@@ -411,7 +426,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
out_free:
/* The appropriate node is already in the pool. */
atomic_inc(&p->refcnt);
- write_unlock_bh(&peer_pool_lock);
+ write_unlock_bh(&peers.lock);
/* Remove the entry from unused list if it was there. */
unlink_from_unused(p);
/* Free preallocated the preallocated node. */
@@ -425,12 +440,12 @@ static void peer_check_expire(unsigned long dummy)
unsigned long now = jiffies;
int ttl;
- if (peer_total >= inet_peer_threshold)
+ if (peers.total >= inet_peer_threshold)
ttl = inet_peer_minttl;
else
ttl = inet_peer_maxttl
- (inet_peer_maxttl - inet_peer_minttl) / HZ *
- peer_total / inet_peer_threshold * HZ;
+ peers.total / inet_peer_threshold * HZ;
while (!cleanup_once(ttl)) {
if (jiffies != now)
break;
@@ -439,22 +454,25 @@ static void peer_check_expire(unsigned long dummy)
/* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime
* interval depending on the total number of entries (more entries,
* less interval). */
- if (peer_total >= inet_peer_threshold)
+ if (peers.total >= inet_peer_threshold)
peer_periodic_timer.expires = jiffies + inet_peer_gc_mintime;
else
peer_periodic_timer.expires = jiffies
+ inet_peer_gc_maxtime
- (inet_peer_gc_maxtime - inet_peer_gc_mintime) / HZ *
- peer_total / inet_peer_threshold * HZ;
+ peers.total / inet_peer_threshold * HZ;
add_timer(&peer_periodic_timer);
}
void inet_putpeer(struct inet_peer *p)
{
- spin_lock_bh(&inet_peer_unused_lock);
- if (atomic_dec_and_test(&p->refcnt)) {
- list_add_tail(&p->unused, &unused_peers);
+ local_bh_disable();
+
+ if (atomic_dec_and_lock(&p->refcnt, &unused_peers.lock)) {
+ list_add_tail(&p->unused, &unused_peers.list);
p->dtime = (__u32)jiffies;
+ spin_unlock(&unused_peers.lock);
}
- spin_unlock_bh(&inet_peer_unused_lock);
+
+ local_bh_enable();
}
^ permalink raw reply related
* Re: [PATCH] virtio_net: implements ethtool_ops.get_drvinfo
From: Taku Izumi @ 2010-06-15 5:20 UTC (permalink / raw)
To: Rusty Russell; +Cc: David S. Miller, netdev@vger.kernel.org, Michael S. Tsirkin
In-Reply-To: <201006151358.12071.rusty@rustcorp.com.au>
Hi Rusty,
(2010/06/15 13:28), Rusty Russell wrote:
> On Fri, 11 Jun 2010 10:59:02 am Taku Izumi wrote:
>> This patch implements ethtool_ops.get_drvinfo interface of virtio_net driver.
>>
>> Signed-off-by: Taku Izumi<izumi.taku@jp.fujitsu.com>
>
> Hi Taku!
>
> Does this have any useful effect?
I often use "ethtool -i" command to check what driver controls the ehternet device.
But because current virtio_net driver doesn't support "ethtool -i", it becomes the
following:
# ethtool -i eth3
Cannot get driver information: Operation not supported
My patch simply adds the "ethtool -i" support. The following is the result when
using the virtio_net driver with my patch applied to.
# ethtool -i eth3
driver: virtio_net
version: N/A
firmware-version: N/A
bus-info: virtio0
Personally, "-i" is one of the most frequently-used option, and
most network drivers support "ethtool -i", so I think virtio_net also should do.
Taku Izumi <izumi.taku@jp.fujitsu.com>
^ permalink raw reply
* Re: [PATCH] virtio_net: implements ethtool_ops.get_drvinfo
From: Rusty Russell @ 2010-06-15 4:28 UTC (permalink / raw)
To: Taku Izumi; +Cc: David S. Miller, netdev@vger.kernel.org, Michael S. Tsirkin
In-Reply-To: <4C11915E.6090201@jp.fujitsu.com>
On Fri, 11 Jun 2010 10:59:02 am Taku Izumi wrote:
> This patch implements ethtool_ops.get_drvinfo interface of virtio_net driver.
>
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Hi Taku!
Does this have any useful effect?
Thanks,
Rusty.
> ---
> drivers/net/virtio_net.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> Index: net-next.35/drivers/net/virtio_net.c
> ===================================================================
> --- net-next.35.orig/drivers/net/virtio_net.c
> +++ net-next.35/drivers/net/virtio_net.c
> @@ -701,6 +701,18 @@ static int virtnet_close(struct net_devi
> return 0;
> }
>
> +static void virtnet_get_drvinfo(struct net_device *dev,
> + struct ethtool_drvinfo *drvinfo)
> +{
> + struct virtnet_info *vi = netdev_priv(dev);
> + struct virtio_device *vdev = vi->vdev;
> +
> + strncpy(drvinfo->driver, KBUILD_MODNAME, 32);
> + strncpy(drvinfo->version, "N/A", 32);
> + strncpy(drvinfo->fw_version, "N/A", 32);
> + strncpy(drvinfo->bus_info, dev_name(&vdev->dev), 32);
> +}
> +
> static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
> {
> struct virtnet_info *vi = netdev_priv(dev);
> @@ -813,6 +825,7 @@ static void virtnet_vlan_rx_kill_vid(str
> }
>
> static const struct ethtool_ops virtnet_ethtool_ops = {
> + .get_drvinfo = virtnet_get_drvinfo,
> .set_tx_csum = virtnet_set_tx_csum,
> .set_sg = ethtool_op_set_sg,
> .set_tso = ethtool_op_set_tso,
>
^ permalink raw reply
* Re: [PATCH for-2.6.35] virtio_net: fix oom handling on tx
From: Rusty Russell @ 2010-06-15 4:23 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Stephen Hemminger, Sridhar Samudrala, virtualization, Jiri Pirko,
Shirley Ma, netdev, linux-kernel
In-Reply-To: <20100610190343.GC4044@redhat.com>
On Fri, 11 Jun 2010 04:33:43 am Michael S. Tsirkin wrote:
> On Thu, Jun 10, 2010 at 10:46:53AM -0700, Stephen Hemminger wrote:
> > It makes more sense to have the device increment tx_droppped,
> > and return NETDEV_TX_OK. Skip the message (or make it a pr_debug()).
> > Network devices do not guarantee packet delivery, and if out of
> > resources then holding more data in the
> > queue is going to hurt not help the situation.
Yes, actually oom should be a ratelimited message and TX_OK, the other
case is a "should never happen" logic bug which warrants an error and
I don't care what it returns (whatever's easiest).
Please fix both at once since you're touching it.
Thanks,
Rusty.
^ permalink raw reply
* Re: linux-next: build failure after merge of the net tree
From: Stephen Rothwell @ 2010-06-15 3:42 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-next, linux-kernel, andy, emil.s.tantilov,
jeffrey.t.kirsher
In-Reply-To: <20100614.191356.193722104.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
Hi Dave,
On Mon, 14 Jun 2010 19:13:56 -0700 (PDT) David Miller <davem@davemloft.net> wrote:
>
> I'll incorporate your merge and build fixups when I merge net-2.6 into
> net-next-2.6 later tonight, thanks Stephen!
Great, thanks.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: linux-next: build failure after merge of the net tree
From: David Miller @ 2010-06-15 2:13 UTC (permalink / raw)
To: sfr
Cc: netdev, linux-next, linux-kernel, andy, emil.s.tantilov,
jeffrey.t.kirsher
In-Reply-To: <20100615120052.7202f20d.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 15 Jun 2010 12:00:52 +1000
> Hi Dave,
>
> After merging the wireless tree, today's linux-next build (powerpc ppc64_defconfig)
> failed like this:
>
> drivers/net/ixgbe/ixgbe_ethtool.c: In function 'ixgbe_set_flags':
> drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: implicit declaration of function 'DPRINTK'
> drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: 'PROBE' undeclared (first use in this function)
> drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: 'INFO' undeclared (first use in this function)
>
> Commit 28c8e4790ca5ef75f54895ca46437f9fbb433ddf ("ixgbe: fix automatic
> LRO/RSC settings for low latency") from the net-current tree added
> another use of DPRINTK which needs comverting to e_info(). I applied the
> following patch:
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 15 Jun 2010 11:43:33 +1000
> Subject: [PATCH] net: ixgbe_ethtool merge fix up
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
I'll incorporate your merge and build fixups when I merge net-2.6 into
net-next-2.6 later tonight, thanks Stephen!
^ permalink raw reply
* linux-next: build failure after merge of the net tree
From: Stephen Rothwell @ 2010-06-15 2:00 UTC (permalink / raw)
To: David Miller, netdev
Cc: linux-next, linux-kernel, Andy Gospodarek, Emil Tantilov,
Jeff Kirsher
Hi Dave,
After merging the wireless tree, today's linux-next build (powerpc ppc64_defconfig)
failed like this:
drivers/net/ixgbe/ixgbe_ethtool.c: In function 'ixgbe_set_flags':
drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: implicit declaration of function 'DPRINTK'
drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: 'PROBE' undeclared (first use in this function)
drivers/net/ixgbe/ixgbe_ethtool.c:2232: error: 'INFO' undeclared (first use in this function)
Commit 28c8e4790ca5ef75f54895ca46437f9fbb433ddf ("ixgbe: fix automatic
LRO/RSC settings for low latency") from the net-current tree added
another use of DPRINTK which needs comverting to e_info(). I applied the
following patch:
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 15 Jun 2010 11:43:33 +1000
Subject: [PATCH] net: ixgbe_ethtool merge fix up
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/net/ixgbe/ixgbe_ethtool.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 65fe1f5..093461b 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -2229,7 +2229,7 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
} else if (!adapter->rx_itr_setting) {
netdev->features &= ~ETH_FLAG_LRO;
if (data & ETH_FLAG_LRO)
- DPRINTK(PROBE, INFO, "rx-usecs set to 0, "
+ e_info("rx-usecs set to 0, "
"LRO/RSC cannot be enabled.\n");
}
}
--
1.7.1
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
^ permalink raw reply related
* linux-next: manual merge of the net tree with the net-current tree
From: Stephen Rothwell @ 2010-06-15 2:00 UTC (permalink / raw)
To: David Miller, netdev
Cc: linux-next, linux-kernel, Emil Tantilov, Jeff Kirsher,
Andy Gospodarek
Hi all,
Today's linux-next merge of the net tree got a conflict in
drivers/net/ixgbe/ixgbe_ethtool.c between commit
28c8e4790ca5ef75f54895ca46437f9fbb433ddf ("ixgbe: fix automatic LRO/RSC
settings for low latency") from the net-current tree and commit
849c45423c0c108e08d67644728cc9b0ed225fa1 ("ixgbe: Use netdev_<level>,
dev_<level>, pr_<level>") from the net tree.
I fixed it up (see below) and can carry the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/net/ixgbe/ixgbe_ethtool.c
index 3a93a81,644e3d2..0000000
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@@ -2132,11 -2155,9 +2130,10 @@@ static int ixgbe_set_coalesce(struct ne
*/
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
- netdev->features &= ~NETIF_F_LRO;
- e_info("rx-usecs set to 0, disabling RSC\n");
-
+ if (netdev->features & NETIF_F_LRO) {
+ netdev->features &= ~NETIF_F_LRO;
- DPRINTK(PROBE, INFO, "rx-usecs set to 0, "
- "disabling LRO/RSC\n");
++ e_info("rx-usecs set to 0, disabling LRO/RSC\n");
+ }
need_reset = true;
}
}
^ permalink raw reply
* suspend/resume not working in MSIX mode
From: Michael Chan @ 2010-06-15 1:13 UTC (permalink / raw)
To: linux-pci, netdev
I'm debugging the bnx2 driver which doesn't work after suspend/resume if
it is running in MSI-X mode. The problem is that during suspend, the
MSI-X vectors are disabled by the following sequence on x86:
take_cpu_down() -> cpu_disable_common() -> fixup_irqs()
The MSI-X address/data used to disable the vectors are remembered in the
above sequence. During resume, these address/data are then programmed
back to the device during pci_restore_state(), causing all the vectors
to remain disabled.
Some drivers call free_irq() during suspend and request_irq() during
resume, and that should avoid the problem. bnx2 and some other drivers
do not do that. These drivers rely on pci_restore_state() to restore
the MSI-X vectors to the same working state before suspend.
What's the right way to fix this? Thanks.
^ permalink raw reply
* [RFC patch net/next] net: Hoist assigns from if?
From: Joe Perches @ 2010-06-15 0:20 UTC (permalink / raw)
To: netdev; +Cc: David Miller
Awhile back I posted a script to reformat source code,
similar to Lindent, but able to select in a piecemeal
manner what source code style to convert.
http://lkml.org/lkml/2010/3/24/447
One of the options is to convert code from:
if ((err = function(args)) != NULL) {
to:
err = function(args);
if (err != NULL) {
I ran this script against net/ and get this result:
$ grep -rPl --include=*.[ch] "\bif\s*\(\s*\(" net/ | \
grep -v netfilter | \
xargs ./scripts/cvt_kernel_style.pl -o -convert=hoist_assigns_from_if
and after a little cleanup, compilation verification, etc
I get the diffstat below. Should I post the actual patch?
net/802/tr.c | 3 +-
net/appletalk/ddp.c | 15 +++++---
net/ax25/af_ax25.c | 34 ++++++++++++------
net/ax25/ax25_addr.c | 3 +-
net/ax25/ax25_dev.c | 18 ++++++---
net/ax25/ax25_ds_subr.c | 3 +-
net/ax25/ax25_iface.c | 3 +-
net/ax25/ax25_in.c | 12 ++++--
net/ax25/ax25_ip.c | 9 +++--
net/ax25/ax25_out.c | 21 +++++++----
net/ax25/ax25_route.c | 27 +++++++++-----
net/ax25/ax25_subr.c | 6 ++-
net/ax25/ax25_uid.c | 3 +-
net/ax25/sysctl_net_ax25.c | 3 +-
net/bluetooth/cmtp/capi.c | 3 +-
net/bluetooth/cmtp/core.c | 9 +++--
net/bluetooth/hci_conn.c | 21 +++++++----
net/bluetooth/hci_core.c | 45 ++++++++++++++++--------
net/bluetooth/hci_event.c | 18 ++++++---
net/bluetooth/hci_sock.c | 15 +++++---
net/bluetooth/rfcomm/sock.c | 3 +-
net/bluetooth/rfcomm/tty.c | 15 +++++---
net/bluetooth/sco.c | 15 +++++---
net/bridge/br_ioctl.c | 9 +++--
net/core/datagram.c | 24 ++++++++----
net/core/net-sysfs.c | 3 +-
net/core/netpoll.c | 30 +++++++++++-----
net/core/skbuff.c | 36 +++++++++++++------
net/dccp/ccids/ccid3.c | 3 +-
net/dccp/ipv4.c | 3 +-
net/dccp/proto.c | 6 ++-
net/decnet/af_decnet.c | 6 ++-
net/decnet/dn_dev.c | 36 +++++++++++++------
net/decnet/dn_fib.c | 15 +++++---
net/decnet/dn_nsp_in.c | 6 ++-
net/decnet/dn_nsp_out.c | 30 +++++++++++-----
net/decnet/dn_route.c | 24 ++++++++----
net/decnet/dn_table.c | 6 ++-
net/econet/af_econet.c | 17 +++++----
net/ipv4/ah4.c | 6 ++-
net/ipv4/arp.c | 18 ++++++---
net/ipv4/esp4.c | 6 ++-
net/ipv4/fib_hash.c | 3 +-
net/ipv4/fib_rules.c | 3 +-
net/ipv4/fib_semantics.c | 15 +++++---
net/ipv4/ip_fragment.c | 6 ++-
net/ipv4/ip_gre.c | 20 +++++++----
net/ipv4/ip_input.c | 3 +-
net/ipv4/ip_output.c | 21 +++++++----
net/ipv4/ipconfig.c | 45 ++++++++++++++++--------
net/ipv4/ipip.c | 20 +++++++----
net/ipv4/ipmr.c | 9 +++--
net/ipv4/route.c | 6 ++-
net/ipv4/tcp.c | 24 ++++++++----
net/ipv4/tcp_ipv4.c | 3 +-
net/ipv4/tcp_minisocks.c | 3 +-
net/ipv4/tcp_output.c | 6 ++-
net/ipv4/udp.c | 3 +-
net/ipv6/addrconf.c | 12 ++++--
net/ipv6/addrlabel.c | 8 +++--
net/ipv6/af_inet6.c | 12 ++++--
net/ipv6/ah6.c | 6 ++-
net/ipv6/datagram.c | 3 +-
net/ipv6/esp6.c | 6 ++-
net/ipv6/icmp.c | 6 ++-
net/ipv6/inet6_connection_sock.c | 3 +-
net/ipv6/ip6_input.c | 6 ++-
net/ipv6/ip6_output.c | 18 ++++++---
net/ipv6/ip6_tunnel.c | 23 +++++++-----
net/ipv6/raw.c | 3 +-
net/ipv6/reassembly.c | 3 +-
net/ipv6/sit.c | 15 +++++---
net/ipv6/tcp_ipv6.c | 12 ++++--
net/ipv6/udp.c | 6 ++-
net/ipx/af_ipx.c | 3 +-
net/irda/af_irda.c | 12 ++++--
net/irda/ircomm/ircomm_tty.c | 3 +-
net/irda/irlap_frame.c | 6 ++-
net/irda/irnet/irnet_irda.c | 6 ++-
net/irda/irqueue.c | 3 +-
net/key/af_key.c | 42 +++++++++++++++-------
net/lapb/lapb_out.c | 3 +-
net/lapb/lapb_subr.c | 6 ++-
net/netrom/af_netrom.c | 24 ++++++++----
net/netrom/nr_in.c | 3 +-
net/netrom/nr_loopback.c | 6 ++-
net/netrom/nr_out.c | 12 ++++--
net/netrom/nr_route.c | 30 +++++++++++-----
net/netrom/nr_subr.c | 6 ++-
net/packet/af_packet.c | 3 +-
net/rose/af_rose.c | 21 +++++++----
net/rose/rose_dev.c | 3 +-
net/rose/rose_link.c | 9 +++--
net/rose/rose_loopback.c | 3 +-
net/rose/rose_out.c | 3 +-
net/rose/rose_route.c | 39 ++++++++++++++-------
net/rose/rose_subr.c | 3 +-
net/sched/act_api.c | 3 +-
net/sched/act_ipt.c | 3 +-
net/sched/cls_api.c | 9 +++--
net/sched/cls_route.c | 21 +++++++----
net/sched/cls_rsvp.h | 6 ++-
net/sched/cls_u32.c | 3 +-
net/sched/sch_api.c | 30 +++++++++++-----
net/sched/sch_cbq.c | 33 +++++++++++------
net/sched/sch_gred.c | 3 +-
net/sched/sch_hfsc.c | 12 ++++--
net/sched/sch_htb.c | 24 ++++++++----
net/sched/sch_prio.c | 3 +-
net/sched/sch_teql.c | 9 +++--
net/sctp/input.c | 3 +-
net/sctp/inqueue.c | 3 +-
net/sctp/ipv6.c | 3 +-
net/sctp/protocol.c | 6 ++-
net/sctp/sm_make_chunk.c | 3 +-
net/sctp/socket.c | 4 +-
net/sunrpc/auth.c | 9 +++--
net/sunrpc/auth_gss/auth_gss.c | 9 +++--
net/sunrpc/auth_gss/gss_generic_token.c | 20 +++++++----
net/sunrpc/auth_gss/gss_krb5_seqnum.c | 3 +-
net/sunrpc/auth_gss/gss_mech_switch.c | 3 +-
net/sunrpc/auth_gss/gss_spkm3_token.c | 3 +-
net/sunrpc/auth_gss/gss_spkm3_unseal.c | 3 +-
net/sunrpc/clnt.c | 9 +++--
net/sunrpc/svcsock.c | 17 ++++++---
net/sunrpc/xdr.c | 3 +-
net/sunrpc/xprtsock.c | 18 ++++++---
net/tipc/bearer.c | 3 +-
net/tipc/core.c | 3 +-
net/tipc/link.c | 15 +++++---
net/tipc/net.c | 3 +-
net/tipc/socket.c | 18 ++++++---
net/tipc/user_reg.c | 3 +-
net/wireless/wext-core.c | 3 +-
net/x25/af_x25.c | 9 +++--
net/x25/x25_dev.c | 6 ++-
net/x25/x25_forward.c | 21 +++++++----
net/x25/x25_in.c | 3 +-
net/x25/x25_link.c | 6 ++-
net/x25/x25_out.c | 10 +++--
net/x25/x25_subr.c | 3 +-
net/xfrm/xfrm_policy.c | 21 +++++++----
net/xfrm/xfrm_state.c | 3 +-
net/xfrm/xfrm_user.c | 58 ++++++++++++++----------------
144 files changed, 1071 insertions(+), 564 deletions(-)
^ permalink raw reply
* Re: [PATCH] KVM: add schedule check to napi_enable call
From: Bruce Rogers @ 2010-06-14 20:44 UTC (permalink / raw)
To: Herbert Xu; +Cc: rusty, netdev
In-Reply-To: <20100606094048.GA1979@gondor.apana.org.au>
>>> On 6/6/2010 at 03:40 AM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Bruce Rogers <brogers@novell.com> wrote:
>> Please consider this patch for the 2.6.32, 2.6.33, and 2.6.34 stable trees
> as well as current development trees. (I've only tested on 2.6.32 however)
>>
>> virtio_net: Add schedule check to napi_enable call
>> Under harsh testing conditions, including low memory, the guest would
>> stop receiving packets. With this patch applied we no longer see any
>> problems in the driver while performing these tests for extended periods
>> of time.
>>
>> Make sure napi is scheduled subsequent to each napi_enable.
>>
>> Signed-off-by: Bruce Rogers <brogers@novell.com>
>> Signed-off-by: Olaf Kirch <okir@suse.de>
>> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: stable@kernel.org
>
> Looks good to me.
>
> Thanks!
Thanks for the review.
We are hoping to get this into our 2.6.32 based sle11 sp1 maintenance update. Are there any concerns with this patch?
Bruce
^ 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