* Re: [PATCH net-next] net: reinstate rtnl in call_netdevice_notifiers()
From: Eric W. Biederman @ 2012-08-23 8:16 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, gaofeng, netdev, therbert, maheshb
In-Reply-To: <1345708259.5904.178.camel@edumazet-glaptop>
Eric Dumazet <eric.dumazet@gmail.com> writes:
> From: Eric Dumazet <edumazet@google.com>
>
> Eric Biederman pointed out that not holding RTNL while calling
> call_netdevice_notifiers() was racy.
>
> This patch is a direct transcription his feedback
> against commit 0115e8e30d6fc (net: remove delay at device dismantle)
>
> Thanks Eric !
Looks good to me.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Tom Herbert <therbert@google.com>
> Cc: Mahesh Bandewar <maheshb@google.com>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Cc: Gao feng <gaofeng@cn.fujitsu.com>
> ---
> Note: After this patch, it seems less risky to push these fixes for 3.6,
> since notifiers have the guarantee that RTNL is held.
>
> net/core/dev.c | 9 +++++++--
> net/core/fib_rules.c | 3 +--
> net/ipv4/devinet.c | 6 +-----
> net/ipv4/fib_frontend.c | 7 ++-----
> net/ipv6/addrconf.c | 6 +-----
> 5 files changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0640d2a..bc857fe 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1466,8 +1466,7 @@ EXPORT_SYMBOL(unregister_netdevice_notifier);
>
> int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
> {
> - if (val != NETDEV_UNREGISTER_FINAL)
> - ASSERT_RTNL();
> + ASSERT_RTNL();
> return raw_notifier_call_chain(&netdev_chain, val, dev);
> }
> EXPORT_SYMBOL(call_netdevice_notifiers);
> @@ -5782,7 +5781,11 @@ static void netdev_wait_allrefs(struct net_device *dev)
>
> /* Rebroadcast unregister notification */
> call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
> +
> + __rtnl_unlock();
> rcu_barrier();
> + rtnl_lock();
> +
> call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev);
> if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
> &dev->state)) {
> @@ -5855,7 +5858,9 @@ void netdev_run_todo(void)
> = list_first_entry(&list, struct net_device, todo_list);
> list_del(&dev->todo_list);
>
> + rtnl_lock();
> call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev);
> + __rtnl_unlock();
>
> if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
> pr_err("network todo '%s' but state %d\n",
> diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> index 5850937..ab7db83 100644
> --- a/net/core/fib_rules.c
> +++ b/net/core/fib_rules.c
> @@ -711,16 +711,15 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event,
> struct net *net = dev_net(dev);
> struct fib_rules_ops *ops;
>
> + ASSERT_RTNL();
>
> switch (event) {
> case NETDEV_REGISTER:
> - ASSERT_RTNL();
> list_for_each_entry(ops, &net->rules_ops, list)
> attach_rules(&ops->rules_list, dev);
> break;
>
> case NETDEV_UNREGISTER:
> - ASSERT_RTNL();
> list_for_each_entry(ops, &net->rules_ops, list)
> detach_rules(&ops->rules_list, dev);
> break;
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 6a5e6e4..adf273f 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -1147,12 +1147,8 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
> void *ptr)
> {
> struct net_device *dev = ptr;
> - struct in_device *in_dev;
> -
> - if (event == NETDEV_UNREGISTER_FINAL)
> - goto out;
> + struct in_device *in_dev = __in_dev_get_rtnl(dev);
>
> - in_dev = __in_dev_get_rtnl(dev);
> ASSERT_RTNL();
>
> if (!in_dev) {
> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index fd7d9ae..acdee32 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -1050,9 +1050,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
> return NOTIFY_DONE;
> }
>
> - if (event == NETDEV_UNREGISTER_FINAL)
> - return NOTIFY_DONE;
> -
> in_dev = __in_dev_get_rtnl(dev);
>
> switch (event) {
> @@ -1064,14 +1061,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
> fib_sync_up(dev);
> #endif
> atomic_inc(&net->ipv4.dev_addr_genid);
> - rt_cache_flush(dev_net(dev), -1);
> + rt_cache_flush(net, -1);
> break;
> case NETDEV_DOWN:
> fib_disable_ip(dev, 0, 0);
> break;
> case NETDEV_CHANGEMTU:
> case NETDEV_CHANGE:
> - rt_cache_flush(dev_net(dev), 0);
> + rt_cache_flush(net, 0);
> break;
> }
> return NOTIFY_DONE;
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index e581009..6bc85f7 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -2566,14 +2566,10 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
> void *data)
> {
> struct net_device *dev = (struct net_device *) data;
> - struct inet6_dev *idev;
> + struct inet6_dev *idev = __in6_dev_get(dev);
> int run_pending = 0;
> int err;
>
> - if (event == NETDEV_UNREGISTER_FINAL)
> - return NOTIFY_DONE;
> -
> - idev = __in6_dev_get(dev);
> switch (event) {
> case NETDEV_REGISTER:
> if (!idev && dev->mtu >= IPV6_MIN_MTU) {
^ permalink raw reply
* Re: [patch net-next] team: add support for non-ethernet devices
From: Jiri Pirko @ 2012-08-23 8:04 UTC (permalink / raw)
To: Or Gerlitz; +Cc: netdev, davem, Or Gerlitz
In-Reply-To: <CAJZOPZLzL5KMF=HjJ=HZYNUerBXV2Es0cDq9rdP=ZYvsEJv7gA@mail.gmail.com>
Thu, Aug 23, 2012 at 09:37:40AM CEST, or.gerlitz@gmail.com wrote:
>On Fri, Aug 17, 2012 at 5:00 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>> This is resolved by two things:
>> 1) allow dev_addr of different length than ETH_ALEN
>> 2) during port add, check for dev->type and change it if necessary
>> +static void team_setup_by_port(struct net_device *dev,
>> + struct net_device *port_dev)
>> +{
>> + dev->header_ops = port_dev->header_ops;
>> + dev->type = port_dev->type;
>> + dev->hard_header_len = port_dev->hard_header_len;
>> + dev->addr_len = port_dev->addr_len;
>> + dev->mtu = port_dev->mtu;
>> + memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len);
>> + memcpy(dev->dev_addr, port_dev->dev_addr, port_dev->addr_len);
>> + dev->addr_assign_type &= ~NET_ADDR_RANDOM;
>> +}
>
>Hi Jiri,
>
>I'm not sure if here, or in the area where this is called, but, aren't
>we missing re-computation of the team device features
>that follows what the port supports?
>
>I've been playing a bit with the patch and IPoIB, using iproute2/ip I
>was able to create team device and set/unset it as the master of IPoIB
>devices. I had little configuration problem with building libteam
>(will comm off list to fix that) which means that teaming was fully
>using its defaults. I had set IP address for the team device and
>issued a ping, I don't see that team attempts to xmit the ARPs through
>the ib0 port though, the team drop counter keeps increasing. Could
>that be me falling into a non-supported area, since I didn't
>explicitly set mode used by teaming?
The problem is that by default, no mode is selected. You have to select
the mode either by team_manual_control or preferably by using teamd.
>
>Also, re the features issue, I was able to trigger a concrete problem,
>with IPoIB vlans are implemented with child devices that use IB
>partitions, and hence IPoIB advertized being vlan challenged. I was
>able to create a 8021q vlan device over a teaming device that has
>IPoIB port, which shouldn't be the case.
You are right. NETIF_F_VLAN_CHALLENGED feature needs to be considered in
team code.
>
>Here are some logs, basically, there's some failure print here which I
>wasn't sure to follow
>
>IPv6: ADDRCONF(NETDEV_UP): ib0: link is not ready
>IPv6: ADDRCONF(NETDEV_CHANGE): ib0: link becomes ready
>(unregistered net_device): Failed to send options change via netlink (err -3)
I agree this is misleading. I will change/remove this message.
Thanks!
Jiri
>team0: Device ib0 is up. Set it down before adding it as a team port
>8021q: adding VLAN 0 to HW filter on device team0
>
>the sequence I used is
>
>$ ip link add name team0 type team
>$ ip link set master team0
>$ ifconfig team0 192.168.20.18/24 up
>$ vconfig add team0 51
>
>Or.
^ permalink raw reply
* Re: NULL deref in bnx2 / crashes ? ( was: netconsole leads to stalled CPU task )
From: Cong Wang @ 2012-08-23 7:57 UTC (permalink / raw)
To: netdev
In-Reply-To: <CAF6-1L7nRoG10P=+QRb=LfL4O8K877zUD6L6d5EoCq-QNt1FWA@mail.gmail.com>
On Wed, 22 Aug 2012 at 14:29 GMT, Sylvain Munaut <s.munaut@whatever-company.com> wrote:
> Hi,
>
>
> The machine with the intel card still hard freeze (no output / no nothing ...)
> The machine with the bnx2 don't crash anymore and no NULL deref, but
> the modprobe still hangs and I get this every 180 sec or so :
The NULL-deref can be reproduced easily, and Eric's patch could fix it.
So, Eric, can you resend your patch with your SOB?
I can't reproduce the hang as it is net driver specific, it is
probably related with my patch:
commit 6bdb7fe31046ac50b47e83c35cd6c6b6160a475d
Author: Amerigo Wang <amwang@redhat.com>
Date: Fri Aug 10 01:24:50 2012 +0000
netpoll: re-enable irq in poll_napi()
^ permalink raw reply
* [PATCH net-next] net: reinstate rtnl in call_netdevice_notifiers()
From: Eric Dumazet @ 2012-08-23 7:50 UTC (permalink / raw)
To: David Miller; +Cc: gaofeng, netdev, therbert, maheshb, ebiederm
From: Eric Dumazet <edumazet@google.com>
Eric Biederman pointed out that not holding RTNL while calling
call_netdevice_notifiers() was racy.
This patch is a direct transcription his feedback
against commit 0115e8e30d6fc (net: remove delay at device dismantle)
Thanks Eric !
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Mahesh Bandewar <maheshb@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
---
Note: After this patch, it seems less risky to push these fixes for 3.6,
since notifiers have the guarantee that RTNL is held.
net/core/dev.c | 9 +++++++--
net/core/fib_rules.c | 3 +--
net/ipv4/devinet.c | 6 +-----
net/ipv4/fib_frontend.c | 7 ++-----
net/ipv6/addrconf.c | 6 +-----
5 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 0640d2a..bc857fe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1466,8 +1466,7 @@ EXPORT_SYMBOL(unregister_netdevice_notifier);
int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
{
- if (val != NETDEV_UNREGISTER_FINAL)
- ASSERT_RTNL();
+ ASSERT_RTNL();
return raw_notifier_call_chain(&netdev_chain, val, dev);
}
EXPORT_SYMBOL(call_netdevice_notifiers);
@@ -5782,7 +5781,11 @@ static void netdev_wait_allrefs(struct net_device *dev)
/* Rebroadcast unregister notification */
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
+
+ __rtnl_unlock();
rcu_barrier();
+ rtnl_lock();
+
call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev);
if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
&dev->state)) {
@@ -5855,7 +5858,9 @@ void netdev_run_todo(void)
= list_first_entry(&list, struct net_device, todo_list);
list_del(&dev->todo_list);
+ rtnl_lock();
call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev);
+ __rtnl_unlock();
if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
pr_err("network todo '%s' but state %d\n",
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 5850937..ab7db83 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -711,16 +711,15 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event,
struct net *net = dev_net(dev);
struct fib_rules_ops *ops;
+ ASSERT_RTNL();
switch (event) {
case NETDEV_REGISTER:
- ASSERT_RTNL();
list_for_each_entry(ops, &net->rules_ops, list)
attach_rules(&ops->rules_list, dev);
break;
case NETDEV_UNREGISTER:
- ASSERT_RTNL();
list_for_each_entry(ops, &net->rules_ops, list)
detach_rules(&ops->rules_list, dev);
break;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 6a5e6e4..adf273f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1147,12 +1147,8 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = ptr;
- struct in_device *in_dev;
-
- if (event == NETDEV_UNREGISTER_FINAL)
- goto out;
+ struct in_device *in_dev = __in_dev_get_rtnl(dev);
- in_dev = __in_dev_get_rtnl(dev);
ASSERT_RTNL();
if (!in_dev) {
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index fd7d9ae..acdee32 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1050,9 +1050,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
return NOTIFY_DONE;
}
- if (event == NETDEV_UNREGISTER_FINAL)
- return NOTIFY_DONE;
-
in_dev = __in_dev_get_rtnl(dev);
switch (event) {
@@ -1064,14 +1061,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
fib_sync_up(dev);
#endif
atomic_inc(&net->ipv4.dev_addr_genid);
- rt_cache_flush(dev_net(dev), -1);
+ rt_cache_flush(net, -1);
break;
case NETDEV_DOWN:
fib_disable_ip(dev, 0, 0);
break;
case NETDEV_CHANGEMTU:
case NETDEV_CHANGE:
- rt_cache_flush(dev_net(dev), 0);
+ rt_cache_flush(net, 0);
break;
}
return NOTIFY_DONE;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e581009..6bc85f7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2566,14 +2566,10 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
void *data)
{
struct net_device *dev = (struct net_device *) data;
- struct inet6_dev *idev;
+ struct inet6_dev *idev = __in6_dev_get(dev);
int run_pending = 0;
int err;
- if (event == NETDEV_UNREGISTER_FINAL)
- return NOTIFY_DONE;
-
- idev = __in6_dev_get(dev);
switch (event) {
case NETDEV_REGISTER:
if (!idev && dev->mtu >= IPV6_MIN_MTU) {
^ permalink raw reply related
* Re: [patch net-next] team: add support for non-ethernet devices
From: Or Gerlitz @ 2012-08-23 7:37 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, Or Gerlitz
In-Reply-To: <1345212048-1378-1-git-send-email-jiri@resnulli.us>
On Fri, Aug 17, 2012 at 5:00 PM, Jiri Pirko <jiri@resnulli.us> wrote:
> This is resolved by two things:
> 1) allow dev_addr of different length than ETH_ALEN
> 2) during port add, check for dev->type and change it if necessary
> +static void team_setup_by_port(struct net_device *dev,
> + struct net_device *port_dev)
> +{
> + dev->header_ops = port_dev->header_ops;
> + dev->type = port_dev->type;
> + dev->hard_header_len = port_dev->hard_header_len;
> + dev->addr_len = port_dev->addr_len;
> + dev->mtu = port_dev->mtu;
> + memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len);
> + memcpy(dev->dev_addr, port_dev->dev_addr, port_dev->addr_len);
> + dev->addr_assign_type &= ~NET_ADDR_RANDOM;
> +}
Hi Jiri,
I'm not sure if here, or in the area where this is called, but, aren't
we missing re-computation of the team device features
that follows what the port supports?
I've been playing a bit with the patch and IPoIB, using iproute2/ip I
was able to create team device and set/unset it as the master of IPoIB
devices. I had little configuration problem with building libteam
(will comm off list to fix that) which means that teaming was fully
using its defaults. I had set IP address for the team device and
issued a ping, I don't see that team attempts to xmit the ARPs through
the ib0 port though, the team drop counter keeps increasing. Could
that be me falling into a non-supported area, since I didn't
explicitly set mode used by teaming?
Also, re the features issue, I was able to trigger a concrete problem,
with IPoIB vlans are implemented with child devices that use IB
partitions, and hence IPoIB advertized being vlan challenged. I was
able to create a 8021q vlan device over a teaming device that has
IPoIB port, which shouldn't be the case.
Here are some logs, basically, there's some failure print here which I
wasn't sure to follow
IPv6: ADDRCONF(NETDEV_UP): ib0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): ib0: link becomes ready
(unregistered net_device): Failed to send options change via netlink (err -3)
team0: Device ib0 is up. Set it down before adding it as a team port
8021q: adding VLAN 0 to HW filter on device team0
the sequence I used is
$ ip link add name team0 type team
$ ip link set master team0
$ ifconfig team0 192.168.20.18/24 up
$ vconfig add team0 51
Or.
^ permalink raw reply
* Re: bonding: time limits too tight in bond_ab_arp_inspect
From: Petr Tesarik @ 2012-08-23 7:34 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: Chris Friesen, Jiri Bohac, Andy Gospodarek, netdev
In-Reply-To: <24655.1345660922@death.nxdomain>
Dne St 22. srpna 2012 20:42:02 Jay Vosburgh napsal(a):
> Chris Friesen <chris.friesen@genband.com> wrote:
> >On 08/22/2012 11:45 AM, Jiri Bohac wrote:
> >> This code is run from bond_activebackup_arp_mon() about
> >> delta_in_ticks jiffies after the previous ARP probe has been
> >> sent. If the delayed work gets executed exactly in delta_in_ticks
> >> jiffies, there is a chance the slave will be brought up. If the
> >> delayed work runs one jiffy later, the slave will stay down.
>
> Presumably the ARP reply is coming back in less than one jiffy,
> then, so the slave_last_rx() value is the same jiffy as when the
> _inspect was previously called?
Yes, that's what happens. Keep in mind that the backup slave validates the
original ARP query, so on a fast network, you get it more or less immediately
(for my case, I can see a delay of ~70us).
Anyway, why do we have to wait until the next ARP send? Couldn't we simply
kick the work queue when we receive a valid packet on a down interface?
Petr Tesarik
SUSE Linux
^ permalink raw reply
* Re: Which one is chosen on multiple default gateway set?
From: Wei Huang @ 2012-08-23 7:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, netfilter
In-Reply-To: <20120822.233808.1184757734447108096.davem@davemloft.net>
On Thu, Aug 23, 2012 at 2:38 PM, David Miller <davem@davemloft.net> wrote:
> The problem is that when a nexthop becomes unresponsive we need
> to wait for an event to timeout the routing cache entry.
>
> In 3.6.0-rc1 and later, this inconsistent behavior will happen less
> often, because the routing cache has been removed so we will do the
> full default route resolution on every route lookup. The only problem
> at that point is socket cached routes, those will still need to wait
> for a timeout before the next default gateway will be tried.
Thanks a lot, David!
I'm using 2.6.16. Could you tell me where the code is, that detects
nexthop unresponsive, sends an event, and timeout the cache? Or are
there procs or sysctl to adjust the timer values?
Another thing I found is that the route looking-up seems to update the
routing cache entry. Is that true? In my example in the first mail,
after a while, the default gateway should have been switched to the
second one. If I ping 8.8.8.8 then, the second active gateway should
be used. But instead, if I look for the route first with "ip r get
8.8.8.8", the first inactive gateway will be the result, and it will
be used if I ping now.
Will the route looking-up even influence the behavior? Will there be a
work around way for this?
Thanks,
Wei
^ permalink raw reply
* [PATCH net-next] w5300: using eth_hw_addr_random() for random MAC and set device flag
From: Wei Yongjun @ 2012-08-23 7:28 UTC (permalink / raw)
To: davem; +Cc: yongjun_wei, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using eth_hw_addr_random() to generate a random Ethernet address
(MAC) to be used by a net device and set addr_assign_type.
Not need to duplicating its implementation.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/ethernet/wiznet/w5300.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index bdd8891..88943d9 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -557,8 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
if (data && is_valid_ether_addr(data->mac_addr)) {
memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN);
} else {
- eth_random_addr(ndev->dev_addr);
- ndev->addr_assign_type |= NET_ADDR_RANDOM;
+ eth_hw_addr_random(ndev);
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
^ permalink raw reply related
* [PATCH (net.git)] stmmac: add header inclusion protection
From: Giuseppe CAVALLARO @ 2012-08-23 7:28 UTC (permalink / raw)
To: netdev; +Cc: Rayagond Kokatanur
From: Rayagond Kokatanur <rayagond@vayavyalabs.com>
This patch adds "#ifndef __<header>_H" for protecting header from double
inclusion.
Signed-off-by: Rayagond Kokatanur <rayagond@vayavyalabs.com>
Hacked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/descs.h | 6 ++++++
drivers/net/ethernet/stmicro/stmmac/descs_com.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/dwmac100.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 3 +++
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/mmc.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 +++++
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h | 4 ++++
9 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index e2d0832..719be39 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -22,6 +22,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
@@ -366,3 +369,5 @@ extern void stmmac_set_mac(void __iomem *ioaddr, bool enable);
extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
extern const struct stmmac_ring_mode_ops ring_mode_ops;
+
+#endif /* __COMMON_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs.h b/drivers/net/ethernet/stmicro/stmmac/descs.h
index 9820ec8..223adf9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/descs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/descs.h
@@ -20,6 +20,10 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+
+#ifndef __DESCS_H__
+#define __DESCS_H__
+
struct dma_desc {
/* Receive descriptor */
union {
@@ -166,3 +170,5 @@ enum tdes_csum_insertion {
* is not calculated */
cic_full = 3, /* IP header and pseudoheader */
};
+
+#endif /* __DESCS_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
index dd8d6e1..7ee9499 100644
--- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h
+++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
@@ -27,6 +27,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __DESC_COM_H__
+#define __DESC_COM_H__
+
#if defined(CONFIG_STMMAC_RING)
static inline void ehn_desc_rx_set_on_ring_chain(struct dma_desc *p, int end)
{
@@ -124,3 +127,5 @@ static inline void norm_set_tx_desc_len(struct dma_desc *p, int len)
p->des01.tx.buffer1_size = len;
}
#endif
+
+#endif /* __DESC_COM_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
index 7c6d857..2ec6aea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
@@ -22,6 +22,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __DWMAC100_H__
+#define __DWMAC100_H__
+
#include <linux/phy.h>
#include "common.h"
@@ -119,3 +122,5 @@ enum ttc_control {
#define DMA_MISSED_FRAME_M_CNTR 0x0000ffff /* Missed Frame Couinter */
extern const struct stmmac_dma_ops dwmac100_dma_ops;
+
+#endif /* __DWMAC100_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index b4c44a5..0e4cace 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -19,6 +19,8 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __DWMAC1000_H__
+#define __DWMAC1000_H__
#include <linux/phy.h>
#include "common.h"
@@ -232,3 +234,4 @@ enum rtc_control {
#define DWMAC_CORE_3_40 0x34
extern const struct stmmac_dma_ops dwmac1000_dma_ops;
+#endif /* __DWMAC1000_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
index e678ce3..e49c9a0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
@@ -22,6 +22,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __DWMAC_DMA_H__
+#define __DWMAC_DMA_H__
+
/* DMA CRS Control and Status Register Mapping */
#define DMA_BUS_MODE 0x00001000 /* Bus Mode */
#define DMA_XMT_POLL_DEMAND 0x00001004 /* Transmit Poll Demand */
@@ -109,3 +112,5 @@ extern void dwmac_dma_start_rx(void __iomem *ioaddr);
extern void dwmac_dma_stop_rx(void __iomem *ioaddr);
extern int dwmac_dma_interrupt(void __iomem *ioaddr,
struct stmmac_extra_stats *x);
+
+#endif /* __DWMAC_DMA_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h
index a383520..67995ef 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc.h
+++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h
@@ -22,6 +22,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __MMC_H__
+#define __MMC_H__
+
/* MMC control register */
/* When set, all counter are reset */
#define MMC_CNTRL_COUNTER_RESET 0x1
@@ -129,3 +132,5 @@ struct stmmac_counters {
extern void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode);
extern void dwmac_mmc_intr_all_mask(void __iomem *ioaddr);
extern void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc);
+
+#endif /* __MMC_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index f2d3665..e872e1d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -20,6 +20,9 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __STMMAC_H__
+#define __STMMAC_H__
+
#define STMMAC_RESOURCE_NAME "stmmaceth"
#define DRV_MODULE_VERSION "March_2012"
@@ -166,3 +169,5 @@ static inline void stmmac_unregister_pci(void)
{
}
#endif /* CONFIG_STMMAC_PCI */
+
+#endif /* __STMMAC_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
index 6863590..aea9b14 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
@@ -21,6 +21,8 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#ifndef __STMMAC_TIMER_H__
+#define __STMMAC_TIMER_H__
struct stmmac_timer {
void (*timer_start) (unsigned int new_freq);
@@ -40,3 +42,5 @@ void stmmac_schedule(struct net_device *dev);
extern int tmu2_register_user(void *fnt, void *data);
extern void tmu2_unregister_user(void);
#endif
+
+#endif /* __STMMAC_TIMER_H__ */
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next] w5100: using eth_hw_addr_random() for random MAC and set device flag
From: Wei Yongjun @ 2012-08-23 7:28 UTC (permalink / raw)
To: davem; +Cc: yongjun_wei, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using eth_hw_addr_random() to generate a random Ethernet address
(MAC) to be used by a net device and set addr_assign_type.
Not need to duplicating its implementation.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/ethernet/wiznet/w5100.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index a5826a3..2c08bf6 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -637,8 +637,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)
if (data && is_valid_ether_addr(data->mac_addr)) {
memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN);
} else {
- eth_random_addr(ndev->dev_addr);
- ndev->addr_assign_type |= NET_ADDR_RANDOM;
+ eth_hw_addr_random(ndev);
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
^ permalink raw reply related
* [PATCH] airo: use is_zero_ether_addr() and is_broadcast_ether_addr()
From: Wei Yongjun @ 2012-08-23 7:17 UTC (permalink / raw)
To: linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() and is_broadcast_ether_addr() instead of
directly use memcmp() to determine if the ethernet address is all zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/airo.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index f9f15bb..17c599d 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5976,13 +5976,11 @@ static int airo_set_wap(struct net_device *dev,
Cmd cmd;
Resp rsp;
APListRid APList_rid;
- static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
- static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
if (awrq->sa_family != ARPHRD_ETHER)
return -EINVAL;
- else if (!memcmp(any, awrq->sa_data, ETH_ALEN) ||
- !memcmp(off, awrq->sa_data, ETH_ALEN)) {
+ else if (is_broadcast_ether_addr(awrq->sa_data) ||
+ is_zero_ether_addr(awrq->sa_data)) {
memset(&cmd, 0, sizeof(cmd));
cmd.cmd=CMD_LOSE_SYNC;
if (down_interruptible(&local->sem))
^ permalink raw reply related
* [PATCH] drivers/net: use is_zero_ether_addr() instead of memcmp()
From: Wei Yongjun @ 2012-08-23 7:16 UTC (permalink / raw)
To: j, linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/hostap/hostap_info.c | 4 ++--
drivers/net/wireless/hostap/hostap_main.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c
index 47932b2..970a48b 100644
--- a/drivers/net/wireless/hostap/hostap_info.c
+++ b/drivers/net/wireless/hostap/hostap_info.c
@@ -4,6 +4,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/export.h>
+#include <linux/etherdevice.h>
#include "hostap_wlan.h"
#include "hostap.h"
#include "hostap_ap.h"
@@ -463,8 +464,7 @@ static void handle_info_queue_scanresults(local_info_t *local)
prism2_host_roaming(local);
if (local->host_roaming == 2 && local->iw_mode == IW_MODE_INFRA &&
- memcmp(local->preferred_ap, "\x00\x00\x00\x00\x00\x00",
- ETH_ALEN) != 0) {
+ !is_zero_ether_addr(local->preferred_ap)) {
/*
* Firmware seems to be getting into odd state in host_roaming
* mode 2 when hostscan is used without join command, so try
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 627bc12..15f0fad 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -1084,7 +1084,7 @@ int prism2_sta_deauth(local_info_t *local, u16 reason)
__le16 val = cpu_to_le16(reason);
if (local->iw_mode != IW_MODE_INFRA ||
- memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 ||
+ is_zero_ether_addr(local->bssid) ||
memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0)
return 0;
^ permalink raw reply related
* Re: [PATCH v2] net: add new QCA alx ethernet driver
From: David Miller @ 2012-08-23 7:13 UTC (permalink / raw)
To: xiong; +Cc: cjren, netdev, linux-kernel, qca-linux-team, nic-devel, rodrigue
In-Reply-To: <157393863283F442885425D2C45428562A4F519A@nasanexd02f.na.qualcomm.com>
From: "Huang, Xiong" <xiong@qca.qualcomm.com>
Date: Thu, 23 Aug 2012 06:56:51 +0000
> I'm afraid someone also rejects my request to add such operation to
> ethtool
If you don't design it properly, we certainly will ask you to make
changes.
But it stands a chance of actually being accepted, whereas your
debugfs thing absolutely does not.
^ permalink raw reply
* Re: [PATCH net-next v3] net: remove delay at device dismantle
From: Eric Dumazet @ 2012-08-23 7:00 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: David Miller, gaofeng, netdev, maheshb, therbert
In-Reply-To: <87txvum80h.fsf@xmission.com>
On Wed, 2012-08-22 at 23:34 -0700, Eric W. Biederman wrote:
> raw_notifier_call_chain isn't safe without holding some sort of lock.
> So removing the ASSERT_RTNL assert here is papering over a bug elsewhere
> in this patch.
>
> Without holding a lock for traversing the notifier chain there will
> be races with network module load and unload that could corrupt
> this list while we are traversing it.
> load/unlod.
>
> You already have one of your NETDEV_UNREGISTER_FINAL calls under the
> rtnl_lock so it doesn't look like a burden to put the other call under
> the rtnl_lock as well.
Hmm right, I have been fooled by the rcu_dereference_raw() calls in
notifier_call_chain()
I'll send an update, thanks !
^ permalink raw reply
* RE: [PATCH v2] net: add new QCA alx ethernet driver
From: Huang, Xiong @ 2012-08-23 6:56 UTC (permalink / raw)
To: David Miller
Cc: Ren, Cloud, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
qca-linux-team, nic-devel, Rodriguez, Luis
In-Reply-To: <20120822.234019.1546353507351890178.davem@davemloft.net>
>
> Then add a new ethtool operation to support your use case, that's exactly
> what I was telling you to do.
>
> Did it really not occur to you that you perhaps you should extend existing
> generic facilities to suit your needs instead of creating private facilities that no
> other driver can use?
I'm afraid someone also rejects my request to add such operation to ethtool
By your same reason.
before adding this interface, we had searched the kernel, marvell driver also
Uses it, we had thought could be ok.
Of course, we will respect your opinion if it's not appropriated.
Thanks
Xiong
^ permalink raw reply
* Re: TIPC handling of ethernet mac address change
From: Ying Xue @ 2012-08-23 6:56 UTC (permalink / raw)
To: Chris Friesen; +Cc: Allan Stephens, Jon Maloy, netdev
In-Reply-To: <5034FC88.8030403@genband.com>
Hi Chris,
You are right.
Currently TIPC does not handle the change of mac address.
So I will submit a related patch to fix the issue to net-next tree.
Thanks for your report.
Regards,
Ying
Chris Friesen wrote:
> Hi,
>
> I'm pretty new to tipc so pardon me if I use the wrong terminology. :)
>
> I'm using TIPC 1.7.7 and bonding. I'm seeing some strange behaviour
> when the bond MAC address changes--the tipc LINK_CONFIG messages still
> contain the old MAC address embedded in them. This causes the other
> end to send back to us on the wrong MAC and the packets get dropped.
>
> I see recv_notification() has a case for NETDEV_CHANGEADDR so it looks
> like MAC address change was intended to be handled, but I'm not
> entirely clear on where the MAC address is supposed to be changed.
>
> Any assistance on debugging/patching this would be appreciated.
>
> Chris
>
>
^ permalink raw reply
* [PATCH] orinoco: use is_zero_ether_addr() instead of memcmp()
From: Wei Yongjun @ 2012-08-23 6:55 UTC (permalink / raw)
To: linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/orinoco/wext.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 33747e1..3b5508f 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -7,6 +7,7 @@
#include <linux/if_arp.h>
#include <linux/wireless.h>
#include <linux/ieee80211.h>
+#include <linux/etherdevice.h>
#include <net/iw_handler.h>
#include <net/cfg80211.h>
#include <net/cfg80211-wext.h>
@@ -159,15 +160,13 @@ static int orinoco_ioctl_setwap(struct net_device *dev,
struct orinoco_private *priv = ndev_priv(dev);
int err = -EINPROGRESS; /* Call commit handler */
unsigned long flags;
- static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
if (orinoco_lock(priv, &flags) != 0)
return -EBUSY;
/* Enable automatic roaming - no sanity checks are needed */
- if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
- memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
+ if (is_zero_ether_addr(ap_addr->sa_data) ||
+ is_broadcast_ether_addr(ap_addr->sa_data)) {
priv->bssid_fixed = 0;
memset(priv->desired_bssid, 0, ETH_ALEN);
^ permalink raw reply related
* [PATCH] mwifiex: use is_zero_ether_addr() instead of memcmp()
From: Wei Yongjun @ 2012-08-23 6:54 UTC (permalink / raw)
To: bzhao, linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/mwifiex/sta_cmdresp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 0b09004..a2a33dc 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -17,6 +17,8 @@
* this warranty disclaimer.
*/
+#include <linux/etherdevice.h>
+
#include "decl.h"
#include "ioctl.h"
#include "util.h"
@@ -736,7 +738,6 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
{
struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
&(resp->params.ibss_coalescing);
- u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
return 0;
@@ -745,7 +746,7 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
"info: new BSSID %pM\n", ibss_coal_resp->bssid);
/* If rsp has NULL BSSID, Just return..... No Action */
- if (!memcmp(ibss_coal_resp->bssid, zero_mac, ETH_ALEN)) {
+ if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
dev_warn(priv->adapter->dev, "new BSSID is NULL\n");
return 0;
}
^ permalink raw reply related
* [PATCH] ipw2200: use is_zero_ether_addr() and is_broadcast_ether_addr()
From: Wei Yongjun @ 2012-08-23 6:54 UTC (permalink / raw)
To: stas.yakovlev, linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() and is_broadcast_ether_addr() instead of
directly use memcmp() to determine if the ethernet address is all zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/ipw2x00/ipw2200.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 0df4591..935120f 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -9037,18 +9037,11 @@ static int ipw_wx_set_wap(struct net_device *dev,
{
struct ipw_priv *priv = libipw_priv(dev);
- static const unsigned char any[] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- };
- static const unsigned char off[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
if (wrqu->ap_addr.sa_family != ARPHRD_ETHER)
return -EINVAL;
mutex_lock(&priv->mutex);
- if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) ||
- !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) {
+ if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) ||
+ is_zero_ether_addr(wrqu->ap_addr.sa_data)) {
/* we disable mandatory BSSID association */
IPW_DEBUG_WX("Setting AP BSSID to ANY\n");
priv->config &= ~CFG_STATIC_BSSID;
^ permalink raw reply related
* [PATCH] ipw2100: use is_zero_ether_addr() and is_broadcast_ether_addr()
From: Wei Yongjun @ 2012-08-23 6:53 UTC (permalink / raw)
To: stas.yakovlev, linville; +Cc: yongjun_wei, linux-wireless, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() and is_broadcast_ether_addr() instead of
directly use memcmp() to determine if the ethernet address is all zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wireless/ipw2x00/ipw2100.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 95aa8e1..c3e14b2 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -6963,13 +6963,6 @@ static int ipw2100_wx_set_wap(struct net_device *dev,
struct ipw2100_priv *priv = libipw_priv(dev);
int err = 0;
- static const unsigned char any[] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- };
- static const unsigned char off[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
// sanity checks
if (wrqu->ap_addr.sa_family != ARPHRD_ETHER)
return -EINVAL;
@@ -6980,8 +6973,8 @@ static int ipw2100_wx_set_wap(struct net_device *dev,
goto done;
}
- if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) ||
- !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) {
+ if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) ||
+ is_zero_ether_addr(wrqu->ap_addr.sa_data)) {
/* we disable mandatory BSSID association */
IPW_DEBUG_WX("exit - disable mandatory BSSID\n");
priv->config &= ~CFG_STATIC_BSSID;
^ permalink raw reply related
* [PATCH] wimax/i2400m: use is_zero_ether_addr() instead of memcmp()
From: Wei Yongjun @ 2012-08-23 6:49 UTC (permalink / raw)
To: inaky.perez-gonzalez; +Cc: yongjun_wei, linux-wimax, wimax, netdev
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/net/wimax/i2400m/driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 0254261..9c34d2f 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -222,7 +222,6 @@ int i2400m_check_mac_addr(struct i2400m *i2400m)
struct sk_buff *skb;
const struct i2400m_tlv_detailed_device_info *ddi;
struct net_device *net_dev = i2400m->wimax_dev.net_dev;
- const unsigned char zeromac[ETH_ALEN] = { 0 };
d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
skb = i2400m_get_device_info(i2400m);
@@ -244,7 +243,7 @@ int i2400m_check_mac_addr(struct i2400m *i2400m)
"to that of boot mode's\n");
dev_warn(dev, "device reports %pM\n", ddi->mac_address);
dev_warn(dev, "boot mode reported %pM\n", net_dev->perm_addr);
- if (!memcmp(zeromac, ddi->mac_address, sizeof(zeromac)))
+ if (is_zero_ether_addr(ddi->mac_address))
dev_err(dev, "device reports an invalid MAC address, "
"not updating\n");
else {
^ permalink raw reply related
* Re: [PATCH V2 09/12] net/eipoib: Add main driver functionality
From: Or Gerlitz @ 2012-08-23 6:45 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Eric W. Biederman, davem, roland, netdev, Ali Ayoub, sean.hefty,
Erez Shitrit, Doug Ledford, Shlomo Pongratz
In-Reply-To: <20120820185625.GA5234@redhat.com>
On 20/08/2012 21:57, Michael S. Tsirkin wrote:
> On Sun, Aug 12, 2012 at 11:54:57PM +0300, Michael S. Tsirkin wrote:
>
>> If you want this, then you really want a limited form of IPoIB bridging.
>
> And to clarify that statement, here is how I would make such IPoIB "bridging" work:
>
> Guest side:
>
> - Implement virtio-ipoib. This would be a device like virtio-net,
> but instead of ethernet packets, it would pass packets
> that consist of:
> IPoIB destination address
> IP packet
>
> - this is passed to/from host without modifications, possibly with addition
> of header such as virtio net header
>
> - flags such as broadcast can also be added to header
>
> - like virtio net get capabilities from host and expose
> as netdev capabilities
>
> Host side:
> - create macvtap -passthrough like device that can sit on top of an
> ipoib interface
> - expose this device QPN and GID to guest as hardware address
> - as we get packet forward it on UD QPN or CM as appropriate
> depending on size,checksum and admin preference
> - expose capabilities such as TSO
> - can expose capability such as max MTU to guest too
>
> Above means hardware address changes with migration.
> So we need to notify guest when this happens.
>
> This can be addressed from host by notifying all neighbours.
>
> Alternatively guest can notify all neighbours.
>
> Notification can be done by broadcast.
> This second option seems preferable.
>
> this ipoib-vtap can support two modes
> - bridge like mode:
> guest to guest and guest to host packets
> can be detected by macvtap and passed
> to/from guest directly like macvlan bridge mode
>
> - vepa like mode
> guest to guest and guest to host packets
> are sent out and looped back by IB switch
> like macvlan vepa mode
>
> As compared to the custom protocol I sent, it has -
> Advantages: interoperates cleanly with ipoib
> Disadvantages: no support for legacy (ethernet-only) guest
>
Hi Michael,
As you mentioned, the approach doesn't address legacy guests, who either
don't have the virtio
driver, or don't have a virtio driver patched to support virtio-ipoib
-- which doesn't go inline
with a strong requirement I got.
Other than this giant obstacle, I liked the suggestion and it seems
valid and viable -- BTW IB HW has
loopback capability, so the VM/VM packets wouldn't actually go to the IB
switch, but remain within the
HCA.
Or.
^ permalink raw reply
* Re: [PATCH v2] net: add new QCA alx ethernet driver
From: David Miller @ 2012-08-23 6:40 UTC (permalink / raw)
To: xiong; +Cc: cjren, netdev, linux-kernel, qca-linux-team, nic-devel, rodrigue
In-Reply-To: <157393863283F442885425D2C45428562A4F5169@nasanexd02f.na.qualcomm.com>
From: "Huang, Xiong" <xiong@qca.qualcomm.com>
Date: Thu, 23 Aug 2012 06:35:40 +0000
>> This is why we require that portable, sane, interfaces are added to ethtool for
>> driver diagnostics. That way users can perform a task in the same way
>> regardless of what hardware and driver are underneath.
>
> I quite agree you on using ethtool to implement it. we did consider it.
> But ethtool has some limitation, for example, the NIC has built-in OTP (TWSI interface)
> And Flash (External SPI interface), their properties are quite different with EEPROM which
> Ethtool supports.
> To support such memory (OTP/Flash), we need additional input parameters.
Then add a new ethtool operation to support your use case, that's
exactly what I was telling you to do.
Did it really not occur to you that you perhaps you should extend
existing generic facilities to suit your needs instead of creating
private facilities that no other driver can use?
^ permalink raw reply
* Re: Which one is chosen on multiple default gateway set?
From: David Miller @ 2012-08-23 6:38 UTC (permalink / raw)
To: daviseago; +Cc: netdev, netfilter
In-Reply-To: <CAJPS4yY7sqqsOfhiouqjmfuW3Kof-ZzHEBs9E1+QoYYce01U4Q@mail.gmail.com>
From: Wei Huang <daviseago@gmail.com>
Date: Thu, 23 Aug 2012 14:31:26 +0800
> If multiple default gateways are set, which one will be chosen? And if
> the chosen one is down, will others take over?
Yes.
> It works sometime, but not most of the time. (example below) The
> behavior is inconsistent.
The problem is that when a nexthop becomes unresponsive we need
to wait for an event to timeout the routing cache entry.
In 3.6.0-rc1 and later, this inconsistent behavior will happen less
often, because the routing cache has been removed so we will do the
full default route resolution on every route lookup. The only problem
at that point is socket cached routes, those will still need to wait
for a timeout before the next default gateway will be tried.
^ permalink raw reply
* Re: [PATCH 0/8] netdev/MIPS: Improvements to octeon_mgmt Ethernet driver.
From: John Crispin @ 2012-08-23 6:35 UTC (permalink / raw)
To: ddaney.cavm; +Cc: linux-mips, ralf, netdev, linux-kernel, david.daney
In-Reply-To: <20120822.191654.1727215659090597701.davem@davemloft.net>
On 23/08/12 04:16, David Miller wrote:
> From: David Daney <ddaney.cavm@gmail.com>
> Date: Tue, 21 Aug 2012 11:45:04 -0700
>
>> From: David Daney <david.daney@cavium.com>
>>
>> Recent additions to the OCTEON SoC family have included enhancements
>> to the MIX (octeon_mgmt) Ethernet hardware. These include:
>>
>> o 1Gig support (up from 100M).
>>
>> o Hardware timestamping for PTP.
>>
>> Here we add support for these two features as well as some ethtool
>> improvements and cleanup of the MAC address handling.
>>
>> Patch 1/8 is a prerequisite for the rest, and lives in the MIPS
>> architecture part of the tree. Since octeon_mgmt devices are only
>> found in OCTEON SoCs we could merge the whole set via Ralf's tree, or
>> get Ralf to affix his Acked-by and have it go via the netdev tree.
>
> You can send this all via the MIPS tree, and feel free to add my:
>
> Acked-by: David S. Miller <davem@davemloft.net>
Thanks, queued for 3.7
John
^ 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