Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/3] net: phy: micrel: Staticize ksz8873mll_read_status()
From: Jingoo Han @ 2013-08-06  8:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Hector Palacios, David J. Choi, Jingoo Han

ksz8873mll_read_status() is used only in this file.
Fix the following sparse warning:

drivers/net/phy/micrel.c:147:5: warning: symbol 'ksz8873mll_read_status' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/net/phy/micrel.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 2510435..9ca4945 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -144,7 +144,7 @@ static int ks8051_config_init(struct phy_device *phydev)
 #define KSZ8873MLL_GLOBAL_CONTROL_4	0x06
 #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX	(1 << 6)
 #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED	(1 << 4)
-int ksz8873mll_read_status(struct phy_device *phydev)
+static int ksz8873mll_read_status(struct phy_device *phydev)
 {
 	int regval;
 
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH net-next 2/3] netdevice: remove useless else keyword
From: Daniel Borkmann @ 2013-08-06  8:20 UTC (permalink / raw)
  To: Jean Sacren; +Cc: netdev
In-Reply-To: <1375774371-831-2-git-send-email-sakiwit@gmail.com>

On 08/06/2013 09:32 AM, Jean Sacren wrote:
> Clean up multiple useless else keywords. Add empty lines for
> readability.

Hmm, don't really think this is actually needed or makes things better.

> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> ---
>   net/core/dev.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 58eb802..1b0bea8 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1062,9 +1062,11 @@ static int dev_get_valid_name(struct net *net,
>
>   	if (strchr(name, '%'))
>   		return dev_alloc_name_ns(net, dev, name);
> -	else if (__dev_get_by_name(net, name))
> +
> +	if (__dev_get_by_name(net, name))
>   		return -EEXIST;
> -	else if (dev->name != name)
> +
> +	if (dev->name != name)
>   		strlcpy(dev->name, name, IFNAMSIZ);
>
>   	return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: [net-next,1/3] bonding: fix vlan 0 addition and removal
From: Nikolay Aleksandrov @ 2013-08-06  8:16 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, fubar, andy, davem, kaber
In-Reply-To: <20130805215126.GB3859@redhat.com>

On 08/05/2013 11:51 PM, Veaceslav Falico wrote:
> On Mon, Aug 05, 2013 at 03:28:22PM +0200, nikolay@redhat.com wrote:
> ...snip...
>> This is fixed by forbidding the addition/removal of vlan 0 through the
>> bond's ndo_vlan_rx_add/kill_vid functions, and adding/removing it only when
>> vlan 0 is in fact being created (or destroyed) on top of a bond interface
>> in the bond's netdev handling function.
> 
> Isn't that a bit too intrusive/hacky? I don't think we should treat vlan id
> 0 somehow differently in terms of adding/removing, though I might be
> wrong...
> 
I didn't want to touch the vlan code, so I solved the problem entirely in
the bonding, mind you there's still a bug when loading the 8021q module
we'll bump up every slave's vlan 0 refcnt without adding the vlan, and it
won't get bumped down.
In my patch that problem still persists but only when an actual vlan 0 is
being created.

> Maybe we should just fix the bond_vlan_used() function? Something like
> this (I've done only basic testing, can do more thorough if needed), though
> it's also not a really clean fix:
> 
Yes, that would be optimal and I agree.

> From 1c89abefebe90568ed52d2df59fcfdd650bc4696 Mon Sep 17 00:00:00 2001
> From: Veaceslav Falico <vfalico@redhat.com>
> Date: Mon, 5 Aug 2013 23:29:12 +0200
> Subject: [PATCH] bonding: add vlan_uses_dev_rcu() and make bond_vlan_used()
> use it
> 
> Currently, bond_vlan_used() looks for any vlan, including the pseudo-vlan
> id 0, and always returns true if 8021q is loaded. This creates several bad
> situations - some warnings in __bond_release_one() because it thinks that
> we still have vlans while removing, sending LB packets with vlan id 0 and,
> possibly, other caused by vlan id 0.
> 
> Fix it by adding a new call, vlan_uses_dev_rcu(), which is the same as
> vlan_uses_dev(), but uses rcu_dereference() instead of rtnl, and thus we
> can use it in bond_vlan_used() wrapped in rcu_read_lock().
> 
> Also, use the pure vlan_uses_dev() in __bond_release_one() cause the rtnl
> lock is held there.
> 
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> CC: Patrick McHardy <kaber@trash.net>
> CC: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
> ---
I'm okay with this fix, if Dave is also okay with this version then you can
submit it as a patch, I'll re-base my third one later and resubmit.

^ permalink raw reply

* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
From: Daniel Borkmann @ 2013-08-06  8:13 UTC (permalink / raw)
  To: Jean Sacren; +Cc: netdev
In-Reply-To: <1375774371-831-3-git-send-email-sakiwit@gmail.com>

On 08/06/2013 09:32 AM, Jean Sacren wrote:
> In commit 900ff8c6 ("net: move procfs code to net/core/net-procfs.c"),
> it changed the correct linkage of ptype_base and ptype_all symbols to
> the wrong one in net/core/dev.c, yet failed to change to the correct
> linkage of those two in net/core/net-procfs.c.
>
> Fix the wrong linkage by setting static specifier to both sets of the
> symbols so that they could have coherent internal linkage by themselves
> to avoid interference with each other.

Ho? I do not think this is correct, what makes you think so?

The net-procfs.c usage of ptype_* is there to show current pf_packet users
via seq_files in procfs. Your patch will just break this.

> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> ---
>   net/core/dev.c        | 4 ++--
>   net/core/net-procfs.c | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index dfd9f5d..d85e5e1 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -142,8 +142,8 @@
>
>   static DEFINE_SPINLOCK(ptype_lock);
>   static DEFINE_SPINLOCK(offload_lock);
> -struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> -struct list_head ptype_all __read_mostly;	/* Taps */
> +static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> +static struct list_head ptype_all __read_mostly;	/* Taps */
>   static struct list_head offload_base __read_mostly;
>
>   /*
> diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
> index 2bf8329..e57cd63 100644
> --- a/net/core/net-procfs.c
> +++ b/net/core/net-procfs.c
> @@ -9,8 +9,8 @@
>   #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
>   #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
>
> -extern struct list_head ptype_all __read_mostly;
> -extern struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> +static struct list_head ptype_all __read_mostly;
> +static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
>
>   static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
>   {
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: [PATCH net] xfrm: Delete hold_timer when destroy policy
From: Steffen Klassert @ 2013-08-06  8:05 UTC (permalink / raw)
  To: Fan Du; +Cc: davem, netdev
In-Reply-To: <51FB09C0.7090807@windriver.com>

On Fri, Aug 02, 2013 at 09:22:08AM +0800, Fan Du wrote:
> 
> 
> On 2013年08月01日 20:01, Steffen Klassert wrote:
> >On Thu, Aug 01, 2013 at 06:08:36PM +0800, Fan Du wrote:
> >>Both policy timer and hold_timer need to be deleted when destroy policy
> >>Bad mood today, maybe I'm wrong about this...
> >>
> >>Signed-off-by: Fan Du<fan.du@windriver.com>
> >>---
> >>  net/xfrm/xfrm_policy.c |    2 +-
> >>  1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >>diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> >>index d8da6b8..f7078eb 100644
> >>--- a/net/xfrm/xfrm_policy.c
> >>+++ b/net/xfrm/xfrm_policy.c
> >>@@ -308,7 +308,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
> >>  {
> >>  	BUG_ON(!policy->walk.dead);
> >>
> >>-	if (del_timer(&policy->timer))
> >>+	if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer))
> >>  		BUG();
> >>
> >
> >The timers should be already deleted when xfrm_policy_destroy() is
> >called. This is just to check if that really happened and to
> >catch this bug if not. So it's not a bug fix, it just helps to
> >catch a potential bug. I'll consider to take this into ipsec-next
> >after some testing.
> >
> 
> On the contrary, please take a look at callers of xfrm_policy_destroy.
> Code flow is as below:
> 
>   xfrm_policy_alloc() /* setup timer/hold_timer here */ (1)
> 
>   /* do something with this policy, insert or something else */
> 
>   goto err; /* bail out if bad things happens */
> 
>   return ok
> 
> err:
>   xfrm_policy_destroy() /*So both timers in (1) need to be deleted */
> 

setup_timer() does not arm the timer, it just initializes the timer.
So the timer is not pending when xfrm_policy_destroy() is called
on error. The del_timer() in xfrm_policy_destroy() is really just
to catch a bug. That's also the reason why we call BUG() if we
delete a pending timer.

Anyway, applied to ipsec-next.

Thanks!

^ permalink raw reply

* [PATCH net-next] xfrm: Remove rebundant address family checking
From: Fan Du @ 2013-08-06  7:50 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

present_and_same_family has checked addresses family validness for both
SADB_EXT_ADDRESS_SRC and SADB_EXT_ADDRESS_DST in the beginning.
Thereafter pfkey_sadb_addr2xfrm_addr doesn't need to do the checking again.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/key/af_key.c |    8 --------
 1 file changed, 8 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index ab8bd2c..dd40377 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1196,10 +1196,6 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
 
 	x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
 						    &x->props.saddr);
-	if (!x->props.family) {
-		err = -EAFNOSUPPORT;
-		goto out;
-	}
 	pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1],
 				  &x->id.daddr);
 
@@ -2205,10 +2201,6 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
 
 	sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1];
 	xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr);
-	if (!xp->family) {
-		err = -EINVAL;
-		goto out;
-	}
 	xp->selector.family = xp->family;
 	xp->selector.prefixlen_s = sa->sadb_address_prefixlen;
 	xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
-- 
1.7.9.5

^ permalink raw reply related

* Re: low latency/busy poll feedback and bugs
From: Eliezer Tamir @ 2013-08-06  7:41 UTC (permalink / raw)
  To: Shawn Bohrer; +Cc: Amir Vadai, netdev
In-Reply-To: <20130805212257.GB6904@sbohrermbp13-local.rgmadvisors.com>

On 06/08/2013 00:22, Shawn Bohrer wrote:
> 1) I'm testing with a Mellanox ConnectX-3 card.

There's your problem ;)

> 2) Why is LowLatencyRxPackets reported as a TcpExt stat?  Perhaps I've
> been confused and misguided but I've always assumed those are
> statistics related to TCP and this feature is protocol neutral.  I'm
> not entirely sure where it should be moved to perhaps IpExt?

Actually, after all of the rewrite this has gone through,
it's now at the Ethernet level, not even IP specific.

So where should it go?

Should we also rename this to BusyPollRxPackets?

> 3) I don't know if this was intentional, an oversight, or simply a
> missing feature but UDP multicast currently is not supported.  In
> order to add support I believe you would need to call
> sk_mark_napi_id() in __udp4_lib_mcast_deliver().  Assuming there isn't
> some intentional reason this wasn't done I'd be happy to test this and
> send a patch.

This is still WIP, so our goal was to make it easy to extend for new
cases and protocols.

For multicast, it is possible that incoming packets to come from more
than one port (and therefore more than one queue).
I'm not sure how we could handle that, but what we have today won't do
well for that use-case.

What do you use for testing?

-Eliezer

^ permalink raw reply

* [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375774371-831-1-git-send-email-sakiwit@gmail.com>

In commit 900ff8c6 ("net: move procfs code to net/core/net-procfs.c"),
it changed the correct linkage of ptype_base and ptype_all symbols to
the wrong one in net/core/dev.c, yet failed to change to the correct
linkage of those two in net/core/net-procfs.c.

Fix the wrong linkage by setting static specifier to both sets of the
symbols so that they could have coherent internal linkage by themselves
to avoid interference with each other.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/dev.c        | 4 ++--
 net/core/net-procfs.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index dfd9f5d..d85e5e1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -142,8 +142,8 @@
 
 static DEFINE_SPINLOCK(ptype_lock);
 static DEFINE_SPINLOCK(offload_lock);
-struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
-struct list_head ptype_all __read_mostly;	/* Taps */
+static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
+static struct list_head ptype_all __read_mostly;	/* Taps */
 static struct list_head offload_base __read_mostly;
 
 /*
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index 2bf8329..e57cd63 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -9,8 +9,8 @@
 #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
 #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
 
-extern struct list_head ptype_all __read_mostly;
-extern struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
+static struct list_head ptype_all __read_mostly;
+static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
 
 static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
 {

^ permalink raw reply related

* [PATCH net-next 2/3] netdevice: remove useless else keyword
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375774371-831-1-git-send-email-sakiwit@gmail.com>

Clean up multiple useless else keywords. Add empty lines for
readability.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 58eb802..1b0bea8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1062,9 +1062,11 @@ static int dev_get_valid_name(struct net *net,
 
 	if (strchr(name, '%'))
 		return dev_alloc_name_ns(net, dev, name);
-	else if (__dev_get_by_name(net, name))
+
+	if (__dev_get_by_name(net, name))
 		return -EEXIST;
-	else if (dev->name != name)
+
+	if (dev->name != name)
 		strlcpy(dev->name, name, IFNAMSIZ);
 
 	return 0;

^ permalink raw reply related

* [PATCH net-next 1/3] sock: fix a typo in the comment
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev

Correct 'transfert' to 'transfer' to better deliver the original
author's message.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 83667de..811de47 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1579,7 +1579,7 @@ EXPORT_SYMBOL(sock_wfree);
 void skb_orphan_partial(struct sk_buff *skb)
 {
 	/* TCP stack sets skb->ooo_okay based on sk_wmem_alloc,
-	 * so we do not completely orphan skb, but transfert all
+	 * so we do not completely orphan skb, but transfer all
 	 * accounted bytes but one, to avoid unexpected reorders.
 	 */
 	if (skb->destructor == sock_wfree

^ permalink raw reply related

* Re: [PATCH net-next] net: Add low-latency/polling support for UDP multicast
From: Eliezer Tamir @ 2013-08-06  7:13 UTC (permalink / raw)
  To: Shawn Bohrer; +Cc: davem, netdev, Amir Vadai, tomk
In-Reply-To: <1375741001-20553-1-git-send-email-sbohrer@rgmadvisors.com>

On 06/08/2013 01:16, Shawn Bohrer wrote:
> Set the napi id for each socket in the multicast path to enable
> low-latency/polling support.
> 
> Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
> ---
>  net/ipv4/udp.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 766e6ba..0d0da17 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1596,6 +1596,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
>  	dif = skb->dev->ifindex;
>  	sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
>  	while (sk) {
> +		sk_mark_napi_id(sk, skb);
>  		stack[count++] = sk;
>  		sk = udp_v4_mcast_next(net, sk_nulls_next(sk), uh->dest,
>  				       daddr, uh->source, saddr, dif);
> 

Looks OK.
To be complete, you want to do the same for __udp6_lib_mcast_deliver().

-Eliezer

^ permalink raw reply

* [PATCH net-next] xfrm: Make xfrm_state timer monotonic
From: Fan Du @ 2013-08-06  6:57 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

xfrm_state timer should be independent of system clock change,
so switch to monotonic clock base.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 78f66fa..e57ab07 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -499,7 +499,7 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
 		INIT_HLIST_NODE(&x->bydst);
 		INIT_HLIST_NODE(&x->bysrc);
 		INIT_HLIST_NODE(&x->byspi);
-		tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_REALTIME, HRTIMER_MODE_ABS);
+		tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 		setup_timer(&x->rtimer, xfrm_replay_timer_handler,
 				(unsigned long)x);
 		x->curlft.add_time = get_seconds();
-- 
1.7.9.5

^ permalink raw reply related

* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Kinley Dorji @ 2013-08-06  6:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20130805225752.14e843f7@nehalam.linuxnetplumber.net>

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

I'm attaching the source code for what looks like the relevant conky
code related to the variables.


On Tue, Aug 6, 2013 at 11:57 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Tue, 6 Aug 2013 11:31:39 +0600
> Kinley Dorji <kinleyd@gmail.com> wrote:
>
>> Hi,
>>
>> I'd like to report a bug that has been introduced since the mainlining
>> of the NIC drivers originally in the package AUR/dkms-alx pertaining
>> to the above mentioned network cards.
>>
>> Kernels affected: 3.10.1 - 3.10.5
>> All worked well for kernels <= 3.9.9
>>
>> Environment in which it occurs:
>>
>> kernel: >= 3.10
>> conky: any version (gui/cli)
>> NIC: Any one of the above family
>>
>> conky variables that probe the NIC all return nothing or 0: eg:
>> upspeed, upspeedgraph, downspeed, downspeedgraph
>>
>> A small discussion on the issue:
>> https://bbs.archlinux.org/viewtopic.php?id=166555
>>
>> Network connectivity itself is not a problem - connection works and is stable
>>
>> Conky isn't the problem because it works in kernels <= 3.9.9 with dkms-alx.
>>
>
> What is conky using to read the variables. Perhaps looking at
> CLI tools like:
>   ip -s -d li show dev eth0
> or
>   ethtool -S eth0
>
> would give some indication of which variables are not being incremented.
>

[-- Attachment #2: net_stat.c --]
[-- Type: text/x-csrc, Size: 10152 bytes --]

/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
 * vim: ts=4 sw=4 noet ai cindent syntax=c
 *
 * Conky, a system monitor, based on torsmo
 *
 * Any original torsmo code is licensed under the BSD license
 *
 * All code written since the fork of torsmo is licensed under the GPL
 *
 * Please see COPYING for details
 *
 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
 * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
 *	(see AUTHORS)
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "config.h"
#include "conky.h"
#include "logging.h"
#include "specials.h"
#include "net/if.h"
#include "text_object.h"
#include "net_stat.h"
#include <netinet/in.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>

/* network interface stuff */

struct net_stat netstats[MAX_NET_INTERFACES];

struct net_stat *get_net_stat(const char *dev, void *free_at_crash1, void *free_at_crash2)
{
	unsigned int i;

	if (!dev) {
		return 0;
	}

	/* find interface stat */
	for (i = 0; i < MAX_NET_INTERFACES; i++) {
		if (netstats[i].dev && strcmp(netstats[i].dev, dev) == 0) {
			return &netstats[i];
		}
	}

	/* wasn't found? add it */
	for (i = 0; i < MAX_NET_INTERFACES; i++) {
		if (netstats[i].dev == 0) {
			netstats[i].dev = strndup(dev, text_buffer_size);
			return &netstats[i];
		}
	}

	CRIT_ERR(free_at_crash1, free_at_crash2, "too many interfaces used (limit is %d)", MAX_NET_INTERFACES);
	return 0;
}

void parse_net_stat_arg(struct text_object *obj, const char *arg, void *free_at_crash)
{
	if (!arg)
		arg = DEFAULTNETDEV;

	obj->data.opaque = get_net_stat(arg, obj, free_at_crash);
}

void parse_net_stat_bar_arg(struct text_object *obj, const char *arg, void *free_at_crash)
{
	if (arg) {
		arg = scan_bar(obj, arg);
		obj->data.opaque = get_net_stat(arg, obj, free_at_crash);
	} else {
		// default to DEFAULTNETDEV
		char *buf = strndup(DEFAULTNETDEV, text_buffer_size);
		obj->data.opaque = get_net_stat(buf, obj, free_at_crash);
		free(buf);
	}
}

void print_downspeed(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	human_readable(ns->recv_speed, p, p_max_size);
}

void print_downspeedf(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	spaced_print(p, p_max_size, "%.1f", 8, ns->recv_speed / 1024.0);
}

void print_upspeed(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	human_readable(ns->trans_speed, p, p_max_size);
}

void print_upspeedf(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	spaced_print(p, p_max_size, "%.1f", 8, ns->trans_speed / 1024.0);
}

void print_totaldown(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	human_readable(ns->recv, p, p_max_size);
}

void print_totalup(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	human_readable(ns->trans, p, p_max_size);
}

void print_addr(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	if ((ns->addr.sa_data[2] & 255) == 0 &&
	    (ns->addr.sa_data[3] & 255) == 0 &&
	    (ns->addr.sa_data[4] & 255) == 0 &&
	    (ns->addr.sa_data[5] & 255) == 0) {
		snprintf(p, p_max_size, "No Address");
	} else {
		snprintf(p, p_max_size, "%u.%u.%u.%u",
		         ns->addr.sa_data[2] & 255,
		         ns->addr.sa_data[3] & 255,
		         ns->addr.sa_data[4] & 255,
		         ns->addr.sa_data[5] & 255);
	}
}

#ifdef __linux__
void print_addrs(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	if (NULL != ns->addrs && strlen(ns->addrs) > 2) {
		ns->addrs[strlen(ns->addrs) - 2] = 0; /* remove ", " from end of string */
		strncpy(p, ns->addrs, p_max_size);
	} else {
		strncpy(p, "0.0.0.0", p_max_size);
	}
}
#endif /* __linux__ */

#ifdef X11
void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, void *free_at_crash)
{
	char *buf = 0;
	buf = scan_graph(obj, arg, 0);

	// default to DEFAULTNETDEV
	if (buf) {
		obj->data.opaque = get_net_stat(buf, obj, free_at_crash);
		free(buf);
		return;
	}
	obj->data.opaque = get_net_stat(DEFAULTNETDEV, obj, free_at_crash);
}

void print_downspeedgraph(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns || !p_max_size)
		return;

	new_graph(obj, p, p_max_size, ns->recv_speed / 1024.0);
}

void print_upspeedgraph(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns || !p_max_size)
		return;

	new_graph(obj, p, p_max_size, ns->trans_speed / 1024.0);
}
#endif /* X11 */

#ifdef __linux__
#ifdef HAVE_IWLIB
void print_wireless_essid(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	snprintf(p, p_max_size, "%s", ns->essid);
}
void print_wireless_mode(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	snprintf(p, p_max_size, "%s", ns->mode);
}
void print_wireless_bitrate(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	snprintf(p, p_max_size, "%s", ns->bitrate);
}
void print_wireless_ap(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	snprintf(p, p_max_size, "%s", ns->ap);
}
void print_wireless_link_qual(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	spaced_print(p, p_max_size, "%d", 4, ns->link_qual);
}
void print_wireless_link_qual_max(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	spaced_print(p, p_max_size, "%d", 4, ns->link_qual_max);
}
void print_wireless_link_qual_perc(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	if (ns->link_qual_max > 0) {
		spaced_print(p, p_max_size, "%.0f", 5,
				(double) ns->link_qual /
				ns->link_qual_max * 100);
	} else {
		spaced_print(p, p_max_size, "unk", 5);
	}
}
void print_wireless_link_bar(struct text_object *obj, char *p, int p_max_size)
{
	struct net_stat *ns = obj->data.opaque;

	if (!ns)
		return;

	new_bar(obj, p, p_max_size,
			((double) ns->link_qual / ns->link_qual_max) * 255.0);
}
#endif /* HAVE_IWLIB */
#endif /* __linux__ */

void clear_net_stats(void)
{
	int i;
	for (i = 0; i < MAX_NET_INTERFACES; i++) {
		if (netstats[i].dev) {
			free(netstats[i].dev);
		}
	}
	memset(netstats, 0, sizeof(netstats));
}

void parse_if_up_arg(struct text_object *obj, const char *arg)
{
	obj->data.opaque = strndup(arg, text_buffer_size);
}

void free_if_up(struct text_object *obj)
{
	if (obj->data.opaque) {
		free(obj->data.opaque);
		obj->data.opaque = NULL;
	}
}

/* We should check if this is ok with OpenBSD and NetBSD as well. */
int interface_up(struct text_object *obj)
{
	int fd;
	struct ifreq ifr;
	char *dev = obj->data.opaque;

	if (!dev)
		return 0;

	if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
		CRIT_ERR(NULL, NULL, "could not create sockfd");
		return 0;
	}
	strncpy(ifr.ifr_name, dev, IFNAMSIZ);
	if (ioctl(fd, SIOCGIFFLAGS, &ifr)) {
		/* if device does not exist, treat like not up */
		if (errno != ENODEV && errno != ENXIO)
			perror("SIOCGIFFLAGS");
		goto END_FALSE;
	}

	if (!(ifr.ifr_flags & IFF_UP)) /* iface is not up */
		goto END_FALSE;
	if (ifup_strictness == IFUP_UP)
		goto END_TRUE;

	if (!(ifr.ifr_flags & IFF_RUNNING))
		goto END_FALSE;
	if (ifup_strictness == IFUP_LINK)
		goto END_TRUE;

	if (ioctl(fd, SIOCGIFADDR, &ifr)) {
		perror("SIOCGIFADDR");
		goto END_FALSE;
	}
	if (((struct sockaddr_in *)&(ifr.ifr_ifru.ifru_addr))->sin_addr.s_addr)
		goto END_TRUE;

END_FALSE:
	close(fd);
	return 0;
END_TRUE:
	close(fd);
	return 1;
}

static struct {
        int nscount;
        char **ns_list;
} dns_data = {
	.nscount = 0,
	.ns_list = NULL,
};

void free_dns_data(void)
{
	int i;
	for (i = 0; i < dns_data.nscount; i++)
		free(dns_data.ns_list[i]);
	if (dns_data.ns_list)
		free(dns_data.ns_list);
	memset(&dns_data, 0, sizeof(dns_data));
}

int update_dns_data(void)
{
	FILE *fp;
	char line[256];
	//static double last_dns_update = 0.0;

	/* maybe updating too often causes higher load because of /etc lying on a real FS
	if (current_update_time - last_dns_update < 10.0)
		return;

	last_dns_update = current_update_time;
	*/

	free_dns_data();

	if ((fp = fopen("/etc/resolv.conf", "r")) == NULL)
		return 0;
	while(!feof(fp)) {
		if (fgets(line, 255, fp) == NULL) {
			break;
		}
		if (!strncmp(line, "nameserver ", 11)) {
			line[strlen(line) - 1] = '\0';	// remove trailing newline
			dns_data.nscount++;
			dns_data.ns_list = realloc(dns_data.ns_list, dns_data.nscount * sizeof(char *));
			dns_data.ns_list[dns_data.nscount - 1] = strndup(line + 11, text_buffer_size);
		}
	}
	fclose(fp);
	return 0;
}

void parse_nameserver_arg(struct text_object *obj, const char *arg)
{
	obj->data.l = arg ? atoi(arg) : 0;
}

void print_nameserver(struct text_object *obj, char *p, int p_max_size)
{
	if (dns_data.nscount > obj->data.l)
		snprintf(p, p_max_size, "%s", dns_data.ns_list[obj->data.l]);
}

[-- Attachment #3: net_stat.h --]
[-- Type: text/x-chdr, Size: 3693 bytes --]

/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
 * vim: ts=4 sw=4 noet ai cindent syntax=c
 *
 * Conky, a system monitor, based on torsmo
 *
 * Any original torsmo code is licensed under the BSD license
 *
 * All code written since the fork of torsmo is licensed under the GPL
 *
 * Please see COPYING for details
 *
 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
 * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
 *	(see AUTHORS)
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _NET_STAT_H
#define _NET_STAT_H

#include <sys/socket.h>	/* struct sockaddr */

struct net_stat {
        char *dev;
        int up;
        long long last_read_recv, last_read_trans;
        long long recv, trans;
        double recv_speed, trans_speed;
        struct sockaddr addr;
#if defined(__linux__)
        char addrs[17 * MAX_NET_INTERFACES + 1];
#endif /* __linux__ */
        double net_rec[15], net_trans[15];
        // wireless extensions
        char essid[32];
        char bitrate[16];
        char mode[16];
        int link_qual;
        int link_qual_max;
        char ap[18];
};

extern struct net_stat netstats[];

struct net_stat *get_net_stat(const char *, void *, void *);

void parse_net_stat_arg(struct text_object *, const char *, void *);
void parse_net_stat_bar_arg(struct text_object *, const char *, void *);
void print_downspeed(struct text_object *, char *, int);
void print_downspeedf(struct text_object *, char *, int);
void print_upspeed(struct text_object *, char *, int);
void print_upspeedf(struct text_object *, char *, int);
void print_totaldown(struct text_object *, char *, int);
void print_totalup(struct text_object *, char *, int);
void print_addr(struct text_object *, char *, int);
#ifdef __linux__
void print_addrs(struct text_object *, char *, int);
#endif /* __linux__ */
#ifdef X11
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
void print_downspeedgraph(struct text_object *, char *, int);
void print_upspeedgraph(struct text_object *, char *, int);
#endif /* X11 */
#ifdef __linux__
#ifdef HAVE_IWLIB
void print_wireless_essid(struct text_object *, char *, int);
void print_wireless_mode(struct text_object *, char *, int);
void print_wireless_bitrate(struct text_object *, char *, int);
void print_wireless_ap(struct text_object *, char *, int);
void print_wireless_link_qual(struct text_object *, char *, int);
void print_wireless_link_qual_max(struct text_object *, char *, int);
void print_wireless_link_qual_perc(struct text_object *, char *, int);
void print_wireless_link_bar(struct text_object *, char *, int);
#endif /* HAVE_IWLIB */
#endif /* __linux__ */

void clear_net_stats(void);

void parse_if_up_arg(struct text_object *, const char *);
int interface_up(struct text_object *);
void free_if_up(struct text_object *);

void free_dns_data(void);
int update_dns_data(void);
void parse_nameserver_arg(struct text_object *, const char *);
void print_nameserver(struct text_object *, char *, int);

#endif /* _NET_STAT_H */

^ permalink raw reply

* Re: [PATCH] ipvs: fixed style errors in ip_vs_dh
From: Simon Horman @ 2013-08-06  6:20 UTC (permalink / raw)
  To: Dragos Foianu
  Cc: wensong, ja, pablo, kaber, kadlec, davem, netdev, lvs-devel,
	netfilter-devel, netfilter, coreteam, linux-kernel
In-Reply-To: <1373570144-4785-1-git-send-email-dragos.foianu@gmail.com>

On Thu, Jul 11, 2013 at 10:15:44PM +0300, Dragos Foianu wrote:
> found with the help of checkpatch.pl

Thanks for your contribution and sorry for taking so long to look at it.

While in principle I have no problem with these changes.
I would like them to be be accompanied by more descriptive changelogs.

In the case of this patch there seem to be two fixes.

1. Fix whitespace associated with for statements.
2. Place opening '{' of structure initialiser on its won line.

I'm sure that the wording above can be improved, but as a minimum
I would like something like that included in the changelog.

I think that I would also prefer each of the two changes in their own
patch, rather than grouping them together because they happen to be in the
same file.

Likewise for the following patches that you also submitted:

* [PATCH] ipvs: fixed style error in ip_vs_sched
* [PATCH] ipvs: fixed style errors and warnings in ip_vs_conn

I would not object if you grouped together the same change in multiple
files into a single patch.

> Signed-off-by: Dragos Foianu <dragos.foianu@gmail.com>
> ---
>  net/netfilter/ipvs/ip_vs_dh.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c
> index c3b8454..8ab2fc8 100644
> --- a/net/netfilter/ipvs/ip_vs_dh.c
> +++ b/net/netfilter/ipvs/ip_vs_dh.c
> @@ -110,7 +110,7 @@ ip_vs_dh_reassign(struct ip_vs_dh_state *s, struct ip_vs_service *svc)
>  	b = &s->buckets[0];
>  	p = &svc->destinations;
>  	empty = list_empty(p);
> -	for (i=0; i<IP_VS_DH_TAB_SIZE; i++) {
> +	for (i = 0; i < IP_VS_DH_TAB_SIZE; i++) {
>  		dest = rcu_dereference_protected(b->dest, 1);
>  		if (dest)
>  			ip_vs_dest_put(dest);
> @@ -142,7 +142,7 @@ static void ip_vs_dh_flush(struct ip_vs_dh_state *s)
>  	struct ip_vs_dest *dest;
>  
>  	b = &s->buckets[0];
> -	for (i=0; i<IP_VS_DH_TAB_SIZE; i++) {
> +	for (i = 0; i < IP_VS_DH_TAB_SIZE; i++) {
>  		dest = rcu_dereference_protected(b->dest, 1);
>  		if (dest) {
>  			ip_vs_dest_put(dest);
> @@ -244,8 +244,7 @@ ip_vs_dh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
>  /*
>   *      IPVS DH Scheduler structure
>   */
> -static struct ip_vs_scheduler ip_vs_dh_scheduler =
> -{
> +static struct ip_vs_scheduler ip_vs_dh_scheduler = {
>  	.name =			"dh",
>  	.refcnt =		ATOMIC_INIT(0),
>  	.module =		THIS_MODULE,
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH] ipvs: fixed spacing at for statements
From: Simon Horman @ 2013-08-06  6:12 UTC (permalink / raw)
  To: Dragos Foianu
  Cc: wensong, linux-kernel, coreteam, netfilter, netfilter-devel,
	lvs-devel, netdev, davem, kadlec, kaber, pablo, ja
In-Reply-To: <1373525142-9099-1-git-send-email-dragos.foianu@gmail.com>

On Thu, Jul 11, 2013 at 09:45:42AM +0300, Dragos Foianu wrote:
> found using checkpatch.pl

This seems reasonable to me. I will queue it up in the ipvs-next tree.

> 
> Signed-off-by: Dragos Foianu <dragos.foianu@gmail.com>
> ---
>  net/netfilter/ipvs/ip_vs_lblcr.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
> index 3cd85b2..5199448 100644
> --- a/net/netfilter/ipvs/ip_vs_lblcr.c
> +++ b/net/netfilter/ipvs/ip_vs_lblcr.c
> @@ -414,7 +414,7 @@ static void ip_vs_lblcr_flush(struct ip_vs_service *svc)
>  
>  	spin_lock_bh(&svc->sched_lock);
>  	tbl->dead = 1;
> -	for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) {
> +	for (i = 0; i < IP_VS_LBLCR_TAB_SIZE; i++) {
>  		hlist_for_each_entry_safe(en, next, &tbl->bucket[i], list) {
>  			ip_vs_lblcr_free(en);
>  		}
> @@ -440,7 +440,7 @@ static inline void ip_vs_lblcr_full_check(struct ip_vs_service *svc)
>  	struct ip_vs_lblcr_entry *en;
>  	struct hlist_node *next;
>  
> -	for (i=0, j=tbl->rover; i<IP_VS_LBLCR_TAB_SIZE; i++) {
> +	for (i = 0, j = tbl->rover; i < IP_VS_LBLCR_TAB_SIZE; i++) {
>  		j = (j + 1) & IP_VS_LBLCR_TAB_MASK;
>  
>  		spin_lock(&svc->sched_lock);
> @@ -495,7 +495,7 @@ static void ip_vs_lblcr_check_expire(unsigned long data)
>  	if (goal > tbl->max_size/2)
>  		goal = tbl->max_size/2;
>  
> -	for (i=0, j=tbl->rover; i<IP_VS_LBLCR_TAB_SIZE; i++) {
> +	for (i = 0, j = tbl->rover; i < IP_VS_LBLCR_TAB_SIZE; i++) {
>  		j = (j + 1) & IP_VS_LBLCR_TAB_MASK;
>  
>  		spin_lock(&svc->sched_lock);
> @@ -536,7 +536,7 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
>  	/*
>  	 *    Initialize the hash buckets
>  	 */
> -	for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) {
> +	for (i = 0; i < IP_VS_LBLCR_TAB_SIZE; i++) {
>  		INIT_HLIST_HEAD(&tbl->bucket[i]);
>  	}
>  	tbl->max_size = IP_VS_LBLCR_TAB_SIZE*16;
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Kinley Dorji @ 2013-08-06  6:05 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20130805225752.14e843f7@nehalam.linuxnetplumber.net>

No sure what conky is using to read them. This is what I get

$ ip -s -d li show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT qlen 1000
    link/ether 90:2b:34:da:42:fd brd ff:ff:ff:ff:ff:ff promiscuity 0
    RX: bytes  packets  errors  dropped overrun mcast
    0          0        0       62      0       0
    TX: bytes  packets  errors  dropped carrier collsns
    0          0        0       0       0       0

$ ethtool -S eth0
no stats available

On Tue, Aug 6, 2013 at 11:57 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Tue, 6 Aug 2013 11:31:39 +0600
> Kinley Dorji <kinleyd@gmail.com> wrote:
>
>> Hi,
>>
>> I'd like to report a bug that has been introduced since the mainlining
>> of the NIC drivers originally in the package AUR/dkms-alx pertaining
>> to the above mentioned network cards.
>>
>> Kernels affected: 3.10.1 - 3.10.5
>> All worked well for kernels <= 3.9.9
>>
>> Environment in which it occurs:
>>
>> kernel: >= 3.10
>> conky: any version (gui/cli)
>> NIC: Any one of the above family
>>
>> conky variables that probe the NIC all return nothing or 0: eg:
>> upspeed, upspeedgraph, downspeed, downspeedgraph
>>
>> A small discussion on the issue:
>> https://bbs.archlinux.org/viewtopic.php?id=166555
>>
>> Network connectivity itself is not a problem - connection works and is stable
>>
>> Conky isn't the problem because it works in kernels <= 3.9.9 with dkms-alx.
>>
>
> What is conky using to read the variables. Perhaps looking at
> CLI tools like:
>   ip -s -d li show dev eth0
> or
>   ethtool -S eth0
>
> would give some indication of which variables are not being incremented.
>

^ permalink raw reply

* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Stephen Hemminger @ 2013-08-06  5:57 UTC (permalink / raw)
  To: Kinley Dorji; +Cc: netdev
In-Reply-To: <CACtZaFJZCWigdT6_vsP9BTRSORzumu33xUtyPtpiDuNn3DQi+w@mail.gmail.com>

On Tue, 6 Aug 2013 11:31:39 +0600
Kinley Dorji <kinleyd@gmail.com> wrote:

> Hi,
> 
> I'd like to report a bug that has been introduced since the mainlining
> of the NIC drivers originally in the package AUR/dkms-alx pertaining
> to the above mentioned network cards.
> 
> Kernels affected: 3.10.1 - 3.10.5
> All worked well for kernels <= 3.9.9
> 
> Environment in which it occurs:
> 
> kernel: >= 3.10
> conky: any version (gui/cli)
> NIC: Any one of the above family
> 
> conky variables that probe the NIC all return nothing or 0: eg:
> upspeed, upspeedgraph, downspeed, downspeedgraph
> 
> A small discussion on the issue:
> https://bbs.archlinux.org/viewtopic.php?id=166555
> 
> Network connectivity itself is not a problem - connection works and is stable
> 
> Conky isn't the problem because it works in kernels <= 3.9.9 with dkms-alx.
> 

What is conky using to read the variables. Perhaps looking at
CLI tools like:
  ip -s -d li show dev eth0
or
  ethtool -S eth0

would give some indication of which variables are not being incremented.

^ permalink raw reply

* [PATCH 2/2 net-next] ip_tunnel: operstate support and link state transfer
From: Stephen Hemminger @ 2013-08-06  5:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Pravin B Shelar, David Miller, netdev
In-Reply-To: <20130805225137.6c934d7f@nehalam.linuxnetplumber.net>

Tunnel devices should reflect the carrier state of the lower device.
I.e if carrier goes down on the lower (ethernet) device, it should
change on the tunnel as well.

This patch also adds full RFC2863 compatible state so that the
tunnel state can be controlled from user space as described in
Documentation/networking/operstats.txt

Example of usage:
ip li add tnl1 mode dormant \
  type gretap remote 172.19.20.21 local 172.16.17.18 dev eth1
ip li set dev tnl1 up
ip li set dev tnl1 state UP

In real life, this would be managed by tunnel broker, not
iproute2 shell commands.


Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 include/net/ip_tunnels.h |    4 ++++
 net/ipv4/ip_gre.c        |   35 +++++++++++++++++++++++++++++++++++
 net/ipv4/ip_tunnel.c     |   41 +++++++++++++++++++++++++++++++++++++----
 net/ipv4/ip_vti.c        |   23 +++++++++++++++++++++++
 net/ipv4/ipip.c          |   22 ++++++++++++++++++++++
 5 files changed, 121 insertions(+), 4 deletions(-)

--- a/include/net/ip_tunnels.h	2013-08-05 16:49:31.965828932 -0700
+++ b/include/net/ip_tunnels.h	2013-08-05 16:49:34.001797670 -0700
@@ -41,6 +41,7 @@ struct ip_tunnel_prl_entry {
 struct ip_tunnel {
 	struct ip_tunnel __rcu	*next;
 	struct hlist_node hash_node;
+	struct hlist_node hash_dev;
 	struct net_device	*dev;
 	struct net		*net;	/* netns for packet i/o */
 
@@ -92,6 +93,7 @@ struct tnl_ptk_info {
 struct ip_tunnel_net {
 	struct net_device *fb_tunnel_dev;
 	struct hlist_head tunnels[IP_TNL_HASH_SIZE];
+	struct hlist_head lower_dev[NETDEV_HASHENTRIES];
 };
 
 #ifdef CONFIG_INET
@@ -101,6 +103,8 @@ void ip_tunnel_uninit(struct net_device
 void  ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
 int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
 		       struct rtnl_link_ops *ops, char *devname);
+void ip_tunnel_stacked_transfer(struct ip_tunnel_net *itn,
+				struct net_device *dev);
 
 void ip_tunnel_delete_net(struct ip_tunnel_net *itn);
 
--- a/net/ipv4/ip_gre.c	2013-08-05 07:58:55.521573667 -0700
+++ b/net/ipv4/ip_gre.c	2013-08-05 22:41:10.879993567 -0700
@@ -777,6 +777,32 @@ static struct pernet_operations ipgre_ta
 	.size = sizeof(struct ip_tunnel_net),
 };
 
+/* If lower device changes state, reflect that to the tunnel. */
+static int ipgre_notify(struct notifier_block *unused,
+			unsigned long event, void *ptr)
+{
+	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+	struct net *net = dev_net(dev);
+	struct ip_tunnel_net *itn;
+
+	if (event != NETDEV_CHANGE)
+		return NOTIFY_DONE;
+
+	if (dev->type == ARPHRD_IPGRE)
+		itn = net_generic(net, ipgre_net_id);
+	else if (dev->type == ARPHRD_ETHER)
+		itn = net_generic(net, gre_tap_net_id);
+	else
+		return NOTIFY_DONE;
+
+	ip_tunnel_stacked_transfer(itn, dev);
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ipgre_notifier = {
+	.notifier_call = ipgre_notify,
+};
+
 static int __init ipgre_init(void)
 {
 	int err;
@@ -805,8 +831,14 @@ static int __init ipgre_init(void)
 	if (err < 0)
 		goto tap_ops_failed;
 
+	err = register_netdevice_notifier(&ipgre_notifier);
+	if (err < 0)
+		goto notify_failed;
+
 	return 0;
 
+notify_failed:
+	rtnl_link_unregister(&ipgre_tap_ops);
 tap_ops_failed:
 	rtnl_link_unregister(&ipgre_link_ops);
 rtnl_link_failed:
@@ -820,6 +852,7 @@ pnet_tap_faied:
 
 static void __exit ipgre_fini(void)
 {
+	unregister_netdevice_notifier(&ipgre_notifier);
 	rtnl_link_unregister(&ipgre_tap_ops);
 	rtnl_link_unregister(&ipgre_link_ops);
 	gre_cisco_unregister(&ipgre_protocol);
--- a/net/ipv4/ip_tunnel.c	2013-08-05 16:49:31.965828932 -0700
+++ b/net/ipv4/ip_tunnel.c	2013-08-05 22:46:06.578307707 -0700
@@ -243,12 +243,32 @@ static void ip_tunnel_add(struct ip_tunn
 	struct hlist_head *head = ip_bucket(itn, &t->parms);
 
 	hlist_add_head_rcu(&t->hash_node, head);
+	if (t->parms.link) {
+		unsigned hash = t->parms.link & (NETDEV_HASHENTRIES - 1);
+		hlist_add_head(&t->hash_dev, &itn->lower_dev[hash]);
+	}
 }
 
 static void ip_tunnel_del(struct ip_tunnel *t)
 {
 	hlist_del_init_rcu(&t->hash_node);
+	hlist_del_init(&t->hash_dev);
+}
+
+void ip_tunnel_stacked_transfer(struct ip_tunnel_net *itn,
+				struct net_device *dev)
+{
+	struct ip_tunnel *t;
+	unsigned devhash = dev->ifindex & (NETDEV_HASHENTRIES - 1);
+
+	ASSERT_RTNL();
+
+	hlist_for_each_entry(t, &itn->lower_dev[devhash], hash_dev) {
+		if (t->parms.link == dev->ifindex)
+			netif_stacked_transfer_operstate(dev, t->dev);
+	}
 }
+EXPORT_SYMBOL(ip_tunnel_stacked_transfer);
 
 static struct ip_tunnel *ip_tunnel_find(struct ip_tunnel_net *itn,
 					struct ip_tunnel_parm *parms,
@@ -310,6 +330,7 @@ static struct net_device *__ip_tunnel_cr
 	if (err)
 		goto failed_free;
 
+	linkwatch_fire_event(dev);	/* call rfc2863_policy */
 	return dev;
 
 failed_free:
@@ -334,7 +355,7 @@ static inline struct rtable *ip_route_ou
 	return ip_route_output_key(net, fl4);
 }
 
-static int ip_tunnel_bind_dev(struct net_device *dev)
+static int ip_tunnel_bind_dev(struct ip_tunnel_net *itn, struct net_device *dev)
 {
 	struct net_device *tdev = NULL;
 	struct ip_tunnel *tunnel = netdev_priv(dev);
@@ -370,6 +391,9 @@ static int ip_tunnel_bind_dev(struct net
 	if (tdev) {
 		hlen = tdev->hard_header_len + tdev->needed_headroom;
 		mtu = tdev->mtu;
+
+		netif_stacked_transfer_operstate(tdev, dev);
+		linkwatch_fire_event(dev); /* call rfc2863_policy() */
 	}
 	dev->iflink = tunnel->parms.link;
 
@@ -395,7 +419,7 @@ static struct ip_tunnel *ip_tunnel_creat
 	if (IS_ERR(dev))
 		return NULL;
 
-	dev->mtu = ip_tunnel_bind_dev(dev);
+	dev->mtu = ip_tunnel_bind_dev(itn, dev);
 
 	nt = netdev_priv(dev);
 	ip_tunnel_add(itn, nt);
@@ -695,7 +719,7 @@ static void ip_tunnel_update(struct ip_t
 		int mtu;
 
 		t->parms.link = p->link;
-		mtu = ip_tunnel_bind_dev(dev);
+		mtu = ip_tunnel_bind_dev(itn, dev);
 		if (set_mtu)
 			dev->mtu = mtu;
 	}
@@ -914,7 +938,7 @@ int ip_tunnel_newlink(struct net_device
 	if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS])
 		eth_hw_addr_random(dev);
 
-	mtu = ip_tunnel_bind_dev(dev);
+	mtu = ip_tunnel_bind_dev(itn, dev);
 	if (!tb[IFLA_MTU])
 		dev->mtu = mtu;
 
--- a/net/ipv4/ip_vti.c	2013-08-05 07:58:55.521573667 -0700
+++ b/net/ipv4/ip_vti.c	2013-08-05 22:39:39.068790171 -0700
@@ -429,6 +429,22 @@ static struct rtnl_link_ops vti_link_ops
 	.fill_info	= vti_fill_info,
 };
 
+static int vti_notify(struct notifier_block *unused,
+		      unsigned long event, void *ptr)
+{
+	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+	struct ip_tunnel_net *itn = net_generic(dev_net(dev), vti_net_id);
+
+	if (event == NETDEV_CHANGE)
+		ip_tunnel_stacked_transfer(itn, dev);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block vti_notifier = {
+	.notifier_call = vti_notify,
+};
+
 static int __init vti_init(void)
 {
 	int err;
@@ -448,8 +464,14 @@ static int __init vti_init(void)
 	if (err < 0)
 		goto rtnl_link_failed;
 
+	err = register_netdevice_notifier(&vti_notifier);
+	if (err < 0)
+		goto notify_failed;
+
 	return err;
 
+notify_failed:
+	rtnl_link_unregister(&vti_link_ops);
 rtnl_link_failed:
 	xfrm4_mode_tunnel_input_deregister(&vti_handler);
 	unregister_pernet_device(&vti_net_ops);
@@ -458,6 +480,7 @@ rtnl_link_failed:
 
 static void __exit vti_fini(void)
 {
+	unregister_netdevice_notifier(&vti_notifier);
 	rtnl_link_unregister(&vti_link_ops);
 	if (xfrm4_mode_tunnel_input_deregister(&vti_handler))
 		pr_info("vti close: can't deregister tunnel\n");
--- a/net/ipv4/ipip.c	2013-08-05 07:58:55.521573667 -0700
+++ b/net/ipv4/ipip.c	2013-08-05 22:39:05.253137638 -0700
@@ -447,6 +447,22 @@ static struct pernet_operations ipip_net
 	.size = sizeof(struct ip_tunnel_net),
 };
 
+static int ipip_notify(struct notifier_block *unused,
+		      unsigned long event, void *ptr)
+{
+	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+	struct ip_tunnel_net *itn = net_generic(dev_net(dev), ipip_net_id);
+
+	if (event == NETDEV_CHANGE)
+		ip_tunnel_stacked_transfer(itn, dev);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ipip_notifier = {
+	.notifier_call = ipip_notify,
+};
+
 static int __init ipip_init(void)
 {
 	int err;
@@ -465,9 +481,14 @@ static int __init ipip_init(void)
 	if (err < 0)
 		goto rtnl_link_failed;
 
+	err = register_netdevice_notifier(&ipip_notifier);
+	if (err < 0)
+		goto notify_failed;
 out:
 	return err;
 
+notify_failed:
+	rtnl_link_unregister(&ipip_link_ops);
 rtnl_link_failed:
 	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
 xfrm_tunnel_failed:
@@ -477,6 +498,7 @@ xfrm_tunnel_failed:
 
 static void __exit ipip_fini(void)
 {
+	unregister_netdevice_notifier(&ipip_notifier);
 	rtnl_link_unregister(&ipip_link_ops);
 	if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
 		pr_info("%s: can't deregister tunnel\n", __func__);

^ permalink raw reply

* [PATCH net-next 1/2] ip_tunnel: embed hash list head
From: Stephen Hemminger @ 2013-08-06  5:51 UTC (permalink / raw)
  To: Pravin B Shelar, David Miller; +Cc: netdev

The IP tunnel hash heads can be embedded in the per-net structure
since it is a fixed size. Reduce the size so that the total structure
fits in a page size. The original size was overly large, even NETDEV_HASHBITS
is only 8 bits!

Also, add some white space for readability.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--- a/net/ipv4/ip_tunnel.c	2013-07-20 10:25:11.207494774 -0700
+++ b/net/ipv4/ip_tunnel.c	2013-07-24 08:40:11.025668961 -0700
@@ -838,15 +838,16 @@ int ip_tunnel_init_net(struct net *net,
 {
 	struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id);
 	struct ip_tunnel_parm parms;
+	unsigned int i;
 
-	itn->tunnels = kzalloc(IP_TNL_HASH_SIZE * sizeof(struct hlist_head), GFP_KERNEL);
-	if (!itn->tunnels)
-		return -ENOMEM;
+	for (i = 0; i < IP_TNL_HASH_SIZE; i++)
+		INIT_HLIST_HEAD(&itn->tunnels[i]);
 
 	if (!ops) {
 		itn->fb_tunnel_dev = NULL;
 		return 0;
 	}
+
 	memset(&parms, 0, sizeof(parms));
 	if (devname)
 		strlcpy(parms.name, devname, IFNAMSIZ);
@@ -854,10 +855,9 @@ int ip_tunnel_init_net(struct net *net,
 	rtnl_lock();
 	itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
 	rtnl_unlock();
-	if (IS_ERR(itn->fb_tunnel_dev)) {
-		kfree(itn->tunnels);
+
+	if (IS_ERR(itn->fb_tunnel_dev))
 		return PTR_ERR(itn->fb_tunnel_dev);
-	}
 
 	return 0;
 }
@@ -887,7 +887,6 @@ void ip_tunnel_delete_net(struct ip_tunn
 	ip_tunnel_destroy(itn, &list);
 	unregister_netdevice_many(&list);
 	rtnl_unlock();
-	kfree(itn->tunnels);
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_delete_net);
 
--- a/include/net/ip_tunnels.h	2013-06-28 08:16:54.093005290 -0700
+++ b/include/net/ip_tunnels.h	2013-07-24 08:39:20.822260842 -0700
@@ -86,12 +86,12 @@ struct tnl_ptk_info {
 #define PACKET_RCVD	0
 #define PACKET_REJECT	1
 
-#define IP_TNL_HASH_BITS   10
+#define IP_TNL_HASH_BITS   7
 #define IP_TNL_HASH_SIZE   (1 << IP_TNL_HASH_BITS)
 
 struct ip_tunnel_net {
-	struct hlist_head *tunnels;
 	struct net_device *fb_tunnel_dev;
+	struct hlist_head tunnels[IP_TNL_HASH_SIZE];
 };
 
 #ifdef CONFIG_INET

^ permalink raw reply

* Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Kinley Dorji @ 2013-08-06  5:31 UTC (permalink / raw)
  To: netdev

Hi,

I'd like to report a bug that has been introduced since the mainlining
of the NIC drivers originally in the package AUR/dkms-alx pertaining
to the above mentioned network cards.

Kernels affected: 3.10.1 - 3.10.5
All worked well for kernels <= 3.9.9

Environment in which it occurs:

kernel: >= 3.10
conky: any version (gui/cli)
NIC: Any one of the above family

conky variables that probe the NIC all return nothing or 0: eg:
upspeed, upspeedgraph, downspeed, downspeedgraph

A small discussion on the issue:
https://bbs.archlinux.org/viewtopic.php?id=166555

Network connectivity itself is not a problem - connection works and is stable

Conky isn't the problem because it works in kernels <= 3.9.9 with dkms-alx.

Hope it can be resolved, at your convenience.

Thank you for the good work you do,

Kinley

^ permalink raw reply

* [PATCH net-next 7/7] be2net: update driver version
From: Sathya Perla @ 2013-08-06  3:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375761441-22343-1-git-send-email-sathya.perla@emulex.com>


Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index c827b1b..11c815d 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -34,7 +34,7 @@
 #include "be_hw.h"
 #include "be_roce.h"
 
-#define DRV_VER			"4.6.62.0u"
+#define DRV_VER			"4.9.134.0u"
 #define DRV_NAME		"be2net"
 #define BE_NAME			"Emulex BladeEngine2"
 #define BE3_NAME		"Emulex BladeEngine3"
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 6/7] be2net: Initialize "status" in be_cmd_get_die_temperature()
From: Sathya Perla @ 2013-08-06  3:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375761441-22343-1-git-send-email-sathya.perla@emulex.com>

From: Vasundhara Volam <vasundhara.volam@emulex.com>

Uninitialized value was being returned in the non-failure case.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 9f04dac..1e0a05d 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1532,7 +1532,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter)
 {
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_req_get_cntl_addnl_attribs *req;
-	int status;
+	int status = 0;
 
 	spin_lock_bh(&adapter->mcc_lock);
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 5/7] be2net: fixup log msgs for async events
From: Sathya Perla @ 2013-08-06  3:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375761441-22343-1-git-send-email-sathya.perla@emulex.com>

From: Vasundhara Volam <vasundhara.volam@emulex.com>

Log the event type for unknown async events

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 53541a9..9f04dac 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -258,7 +258,8 @@ static void be_async_grp5_evt_process(struct be_adapter *adapter,
 		(struct be_async_event_grp5_pvid_state *)evt);
 	break;
 	default:
-		dev_warn(&adapter->pdev->dev, "Unknown grp5 event!\n");
+		dev_warn(&adapter->pdev->dev, "Unknown grp5 event 0x%x!\n",
+			 event_type);
 		break;
 	}
 }
@@ -279,7 +280,8 @@ static void be_async_dbg_evt_process(struct be_adapter *adapter,
 		adapter->flags |= BE_FLAGS_QNQ_ASYNC_EVT_RCVD;
 	break;
 	default:
-		dev_warn(&adapter->pdev->dev, "Unknown debug event\n");
+		dev_warn(&adapter->pdev->dev, "Unknown debug event 0x%x!\n",
+			 event_type);
 	break;
 	}
 }
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 4/7] be2net: Fix displaying supported speeds for BE2
From: Sathya Perla @ 2013-08-06  3:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375761441-22343-1-git-send-email-sathya.perla@emulex.com>

From: Vasundhara Volam <vasundhara.volam@emulex.com>

The BE2 FW GET_PHY_DETAILS cmd does not return fixed speeds supported.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index bef25b7..53541a9 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2454,6 +2454,12 @@ int be_cmd_get_phy_info(struct be_adapter *adapter)
 			le16_to_cpu(resp_phy_info->fixed_speeds_supported);
 		adapter->phy.misc_params =
 			le32_to_cpu(resp_phy_info->misc_params);
+
+		if (BE2_chip(adapter)) {
+			adapter->phy.fixed_speeds_supported =
+				BE_SUPPORTED_SPEED_10GBPS |
+				BE_SUPPORTED_SPEED_1GBPS;
+		}
 	}
 	pci_free_consistent(adapter->pdev, cmd.size,
 				cmd.va, cmd.dma);
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next 3/7] be2net: don't limit max MAC and VLAN counts
From: Sathya Perla @ 2013-08-06  3:57 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1375761441-22343-1-git-send-email-sathya.perla@emulex.com>

From: Vasundhara Volam <vasundhara.volam@emulex.com>

For SH-R and Lancer-R, use the FW supported values for Max unicast MACs,
Max VLANs and Max multicast MACs.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 834f77b..dc45e1a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2995,13 +2995,6 @@ static void be_get_resources(struct be_adapter *adapter)
 	}
 
 	if (profile_present) {
-		/* Sanity fixes for Lancer */
-		adapter->max_pmac_cnt = min_t(u16, adapter->max_pmac_cnt,
-					      BE_UC_PMAC_COUNT);
-		adapter->max_vlans = min_t(u16, adapter->max_vlans,
-					   BE_NUM_VLANS_SUPPORTED);
-		adapter->max_mcast_mac = min_t(u16, adapter->max_mcast_mac,
-					       BE_MAX_MC);
 		adapter->max_tx_queues = min_t(u16, adapter->max_tx_queues,
 					       MAX_TX_QS);
 		adapter->max_rss_queues = min_t(u16, adapter->max_rss_queues,
-- 
1.7.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox