* [PATCH v2] net/unix: Add secdata to unix_stream msgs
From: Pat Kane @ 2011-03-23 0:38 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev, Pat Kane
The unix_dgram routines add secdata to socket messages,
but the unix_stream routines do not. I have added the
two missing lines of code.
Signed-off-by: Pat Kane <pekane52@gmail.com>
---
net/unix/af_unix.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 1663e1a..8753cdd 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1642,6 +1642,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
max_level = err + 1;
fds_sent = true;
+ unix_get_secdata(siocb->scm, skb);
+
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
if (err) {
kfree_skb(skb);
@@ -1930,6 +1932,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
} else {
/* Copy credentials */
scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
+ unix_set_secdata(siocb->scm, skb);
check_creds = 1;
}
--
1.7.1
^ permalink raw reply related
* Re: bnx2 vlan issue
From: Jesse Gross @ 2011-03-22 23:19 UTC (permalink / raw)
To: Seblu; +Cc: netdev
In-Reply-To: <AANLkTi=7ETnRWOLRVAWhv=3BHZdzUnLvAqzxXOz399Xx@mail.gmail.com>
On Tue, Mar 22, 2011 at 3:59 AM, Seblu <seblu@seblu.net> wrote:
> On Tue, Mar 22, 2011 at 3:05 AM, Jesse Gross <jesse@nicira.com> wrote:
>> On Thu, Mar 17, 2011 at 4:22 PM, Seblu <seblu@seblu.net> wrote:
>>> On Thu, Mar 17, 2011 at 8:16 PM, Jesse Gross <jesse@nicira.com> wrote:
>>>> On Thu, Mar 17, 2011 at 11:02 AM, Seblu <seblu@seblu.net> wrote:
>>>>> On Thu, Mar 17, 2011 at 3:51 PM, Seblu <seblu@seblu.net> wrote:
>>> How can I create a bridge with the untagged vlan from an interface?
>>>
>>>> * bridge on interface, vlans on bridge device. This gives you a
>>>> bridge with all packets and vlan devices can give you specific vlans.
>>> I cannot use this schema, i used bridge to bring together vnet
>>> interface and vlan interface.
>>
>> I'm not sure I understand why you say you can't use this. You can
>> combine vlans and bridging pretty much arbitrarily, including stacking
>> multiple layers.
> I don't see _how I can bridge an interface with an untagged vlan from
> another interface_.
>
> I little example is maybe more clear:
> My dekstop have 2 NIC (eth0, eth1). I receive from network admin 2
> vlans. 20 untag and 21 tagged. My laptop is plugged to eth1.
> I want "export" untagged vlan 20 to eth1.
> Before 2.6.37, i do something like br0 = (eth0 + eth1). I put an ip on
> br0 and on eth0.21. And br0 just have untagged frame from eth0 which
> was transmitted to eth1. eth0.21 have only tagged frame from vlan 21.
> eth1 did not receive tagged vlan 21.
> After 2.6.37, i can do a bridge like before (br0 = eth0 + eth1) but i
> must use br0.21 to have access to vlan 21 network in my desktop. But,
> my laptop can also access to tagged vlan 21, and i don't want this.
>
> A lot of old xen based setup use this behaviour.
> About my kvm test, I'm looking to the pci passtrough and macvtap, but
> this requires configuration that supports it.
> Why cannot have a eth0.U with only untagged frames?
>
>>
>>>
>>>> * Use ebtables rules in the bridge to accept/reject certain packets as desired.
>>> I don't see how use ebtables to push untagged frame to a dedicated
>>> iface which can be added in a bridge.
>>
>> You could have a bridge on the raw interface and connect all of the
>> VMs that need untagged traffic. If you add an ebtables rule to reject
>> tagged traffic then vlan devices on the interface will continue to
>> work as before.
>>
> If I ignores the fact that the name of the card is not fixed, i see.
> But performance will follow? I don't believe this kind of config will
> allow ~7/8Gbit/s of traffic.
> Traversing ebtables rules is not free. And starting filtering traffic
> is a really different job than just bridge cards together.
I don't necessarily disagree that there should be a better way to do
this, though as of the moment the above is probably your best bet.
To me, the most important thing is to have consistent behavior across
different cards. In 2.6.37 that behavior was standardized on the way
non-accelerated NICs used to do but the other way is more common and
perhaps better. Eric B. posted a patch yesterday that better unifies
the code paths. This would be the first step to such a change because
it would make it easier to move the handling logic for both at the
same time.
^ permalink raw reply
* [PATCH v2 1/1] Use VPI.VCI notation consistently in solos-pci driver
From: Philip Prindeville @ 2011-03-22 22:33 UTC (permalink / raw)
To: Netdev
Use VPI/VCI notation consistently.
Signed-off-by: Philip Prindeville<philipp@redfish-solutions.com>
---
drivers/atm/solos-pci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 25ef1a4..2c4146a 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -710,8 +710,8 @@ void solos_bh(unsigned long card_arg)
le16_to_cpu(header->vci));
if (!vcc) {
if (net_ratelimit())
- dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n",
- le16_to_cpu(header->vci), le16_to_cpu(header->vpi),
+ dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n",
+ le16_to_cpu(header->vpi), le16_to_cpu(header->vci),
port);
continue;
}
^ permalink raw reply related
* [PATCH 1/1] ipv6: ip6_route_output does not modify sk parameter, so make it const
From: Florian Westphal @ 2011-03-22 22:01 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
This avoids explicit cast to avoid 'discards qualifiers'
compiler warning in a netfilter patch that i've been working on.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/net/ip6_route.h | 2 +-
net/ipv6/route.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 642a80b..c850e5f 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -70,7 +70,7 @@ static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
extern void ip6_route_input(struct sk_buff *skb);
extern struct dst_entry * ip6_route_output(struct net *net,
- struct sock *sk,
+ const struct sock *sk,
struct flowi6 *fl6);
extern int ip6_route_init(void);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6814c87..843406f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -854,7 +854,7 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table
return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags);
}
-struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
+struct dst_entry * ip6_route_output(struct net *net, const struct sock *sk,
struct flowi6 *fl6)
{
int flags = 0;
--
1.7.3.4
^ permalink raw reply related
* Re: [slab poison overwritten] Re: [GIT] Networking
From: Simon Horman @ 2011-03-22 21:52 UTC (permalink / raw)
To: Eric Dumazet
Cc: Ingo Molnar, David Miller, torvalds, akpm, netdev, linux-kernel,
Peter Zijlstra, Thomas Gleixner, Arnd Bergmann, Pekka Enberg,
Julian Anastasov
In-Reply-To: <1300788039.3084.0.camel@edumazet-laptop>
On Tue, Mar 22, 2011 at 11:00:39AM +0100, Eric Dumazet wrote:
> Le mardi 22 mars 2011 à 10:56 +0100, Ingo Molnar a écrit :
> > * Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > > [PATCH] ipvs: fix a typo in __ip_vs_control_init()
> >
> > This fix and Simon's:
> >
> > IPVS: Use global mutex in ip_vs_app.c
> >
> > Did the trick here, the IPVS related SLAB corruptions are now gone.
> >
> > Thanks guys!
>
> Thanks for testing Ingo ;)
Yes, thanks Ingo.
^ permalink raw reply
* Re: build breakage due to br_multicast.c referencing ipv6_dev_get_saddr()
From: Linus Lüssing @ 2011-03-22 21:40 UTC (permalink / raw)
To: Jan Beulich; +Cc: davem, shemminger, bridge, netdev
In-Reply-To: <4D80BC5B0200007800036D85@vpn.id2.novell.com>
> One unrelated other observation with this change of yours:
> daddr is an input argument to ipv6_dev_get_saddr(), yet
> it gets initialized only after the function was called. Is that
> really correct?
Hmm, that wasn't intentional. I tested that again and so far I still always
got the right source address. I had a little deeper look at ipv6_dev_get_saddr()
and seems like it could get racy the way it is now, so I'm attaching a patch
for that. Thanks for reporting, Jan.
And I hope I didn't cause too much inconvience with the build breakage,
didn't think of testing BRIDGE=y and IPV6=m.
Cheers, Linus
^ permalink raw reply
* [PATCH] bridge: Fix possibly wrong MLD queries' ethernet source address
From: Linus Lüssing @ 2011-03-22 21:40 UTC (permalink / raw)
To: Jan Beulich; +Cc: davem, shemminger, bridge, netdev, Linus Lüssing
In-Reply-To: <1300830032-6727-1-git-send-email-linus.luessing@web.de>
The ipv6_dev_get_saddr() is currently called with an uninitialized
destination address. Although in tests it usually seemed to nevertheless
always fetch the right source address, there seems to be a possible race
condition.
Therefore this commit changes this, first setting the destination
address and only after that fetching the source address.
Reported-by: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
net/bridge/br_multicast.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 030a002..f61eb2e 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -445,9 +445,9 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
ip6h->payload_len = htons(8 + sizeof(*mldq));
ip6h->nexthdr = IPPROTO_HOPOPTS;
ip6h->hop_limit = 1;
+ ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1));
ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0,
&ip6h->saddr);
- ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1));
ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
hopopt = (u8 *)(ip6h + 1);
--
1.5.6.5
^ permalink raw reply related
* Re: pull request: wireless-2.6 2011-03-22
From: David Miller @ 2011-03-22 21:36 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20110322174616.GB2512@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Tue, 22 Mar 2011 13:46:17 -0400
> Here is a batch of fixes intended for 2.6.39. Included are a lock
> leak fix for iwlwifi, a "hold the lock longer" fix for orinoco, an
> rtlwifi fix for a memset argument ordering problem, a sta structure
> initialization fix for mac80211, an ath9k NULL pointer fix, a
> kernel-doc fix, and a handful of device IDs.
Pulled, thanks a lot John.
^ permalink raw reply
* Re: [PATCH v2] net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules
From: Eric Paris @ 2011-03-22 20:47 UTC (permalink / raw)
To: Vasiliy Kulikov
Cc: linux-kernel, mjt, arnd, mirqus, netdev, Ben Hutchings,
David Miller, kuznet, pekkas, jmorris, yoshfuji, kaber,
eric.dumazet, therbert, xiaosuo, jesse, kees.cook, eugene,
dan.j.rosenberg, akpm, Greg KH, Stephen Smalley, LSM List,
Daniel J Walsh, David Howells
In-Reply-To: <20110301213313.GA6507@albatros>
On Tue, Mar 1, 2011 at 4:33 PM, Vasiliy Kulikov <segoon@openwall.com> wrote:
> Since a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c any process with
> CAP_NET_ADMIN may load any module from /lib/modules/. This doesn't mean
> that CAP_NET_ADMIN is a superset of CAP_SYS_MODULE as modules are
> limited to /lib/modules/**. However, CAP_NET_ADMIN capability shouldn't
> allow anybody load any module not related to networking.
>
> This patch restricts an ability of autoloading modules to netdev modules
> with explicit aliases. This fixes CVE-2011-1019.
>
> Arnd Bergmann suggested to leave untouched the old pre-v2.6.32 behavior
> of loading netdev modules by name (without any prefix) for processes
> with CAP_SYS_MODULE to maintain the compatibility with network scripts
> that use autoloading netdev modules by aliases like "eth0", "wlan0".
>
> Currently there are only three users of the feature in the upstream
> kernel: ipip, ip_gre and sit.
This patch is causing a bit of a problem in Fedora. The problem lies
mostly in the fact that we, by means of using SELinux, grant very very
few domains CAP_SYS_MODULE (and we record when domains attempt to use
this permission). Unlike most other distros in which uid==0 is for
all intensive purposes == CAP_FULL_SET and there is no logging of
failures to use capabilities. What happened is that as soon as we
instituted this change we started getting SELinux denials because lots
of domains (libvirt, udev, iw, NetworkManager) all the sudden started
trying to use CAP_SYS_MODULE. It took me a minute to make sure this
patch was the problem because I wasn't seeing any printk messages. I
had to make some changes to the patch to print every time a task got
into the CAP_SYS_MODULE case in order to get an idea what was causing
the problem. I found on my machine I hit the problem 3 times trying
to load "reg", "wifi0", and "virbr0" None of these are actual
modules in userspace so the upcall failed.
I'm trying to figure out how I should be dealing with this.
My first idea is changing the capable(CAP_SYS_MODULE) into a
has_capability_noaudit(). Which will not audit the access attempt.
I'm not sure I like that since it uses the read cred, it doesn't set
PF_SUPERPRIV, and it means we could likely miss recording a problem if
a task is doing this intentionally...
The next idea is I guess figuring out what's causing these and fix
them there, but I'm not certain a good way to debug it. I know from
our audit logs that wpa_supplicant is calling SIOCGIFINDEX which is
causing one of these, libvirt is calling SIOCGIFFLAGS. I'm not sure
what udev->iw is doing to trigger it's problem.....
If the name in question is not coming from direct userspace request I
guess I need help figuring out what is causing them....
So while this patch might not necessarily be breaking things it
certainly is not regression free and could potentially be breaking
systems with fine grained capabilities controls....
-Eric
> root@albatros:~# capsh --drop=$(seq -s, 0 11),$(seq -s, 13 34) --
> root@albatros:~# grep Cap /proc/$$/status
> CapInh: 0000000000000000
> CapPrm: fffffff800001000
> CapEff: fffffff800001000
> CapBnd: fffffff800001000
> root@albatros:~# modprobe xfs
> FATAL: Error inserting xfs
> (/lib/modules/2.6.38-rc6-00001-g2bf4ca3/kernel/fs/xfs/xfs.ko): Operation not permitted
> root@albatros:~# lsmod | grep xfs
> root@albatros:~# ifconfig xfs
> xfs: error fetching interface information: Device not found
> root@albatros:~# lsmod | grep xfs
> root@albatros:~# lsmod | grep sit
> root@albatros:~# ifconfig sit
> sit: error fetching interface information: Device not found
> root@albatros:~# lsmod | grep sit
> root@albatros:~# ifconfig sit0
> sit0 Link encap:IPv6-in-IPv4
> NOARP MTU:1480 Metric:1
>
> root@albatros:~# lsmod | grep sit
> sit 10457 0
> tunnel4 2957 1 sit
>
> For CAP_SYS_MODULE module loading is still relaxed:
>
> root@albatros:~# grep Cap /proc/$$/status
> CapInh: 0000000000000000
> CapPrm: ffffffffffffffff
> CapEff: ffffffffffffffff
> CapBnd: ffffffffffffffff
> root@albatros:~# ifconfig xfs
> xfs: error fetching interface information: Device not found
> root@albatros:~# lsmod | grep xfs
> xfs 745319 0
>
> Reference: https://lkml.org/lkml/2011/2/24/203
>
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
> v2 - use pr_err()
> - don't try to load $name if netdev-$name is loaded
>
> include/linux/netdevice.h | 3 +++
> net/core/dev.c | 12 ++++++++++--
> net/ipv4/ip_gre.c | 2 +-
> net/ipv4/ipip.c | 2 +-
> net/ipv6/sit.c | 2 +-
> 5 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index d971346..71caf7a 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2392,6 +2392,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...)
> extern int netdev_info(const struct net_device *dev, const char *format, ...)
> __attribute__ ((format (printf, 2, 3)));
>
> +#define MODULE_ALIAS_NETDEV(device) \
> + MODULE_ALIAS("netdev-" device)
> +
> #if defined(DEBUG)
> #define netdev_dbg(__dev, format, args...) \
> netdev_printk(KERN_DEBUG, __dev, format, ##args)
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8ae6631..6561021 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1114,13 +1114,21 @@ EXPORT_SYMBOL(netdev_bonding_change);
> void dev_load(struct net *net, const char *name)
> {
> struct net_device *dev;
> + int no_module;
>
> rcu_read_lock();
> dev = dev_get_by_name_rcu(net, name);
> rcu_read_unlock();
>
> - if (!dev && capable(CAP_NET_ADMIN))
> - request_module("%s", name);
> + no_module = !dev;
> + if (no_module && capable(CAP_NET_ADMIN))
> + no_module = request_module("netdev-%s", name);
> + if (no_module && capable(CAP_SYS_MODULE)) {
> + if (!request_module("%s", name))
> + pr_err("Loading kernel module for a network device "
> +"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s "
> +"instead\n", name);
> + }
> }
> EXPORT_SYMBOL(dev_load);
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 6613edf..d1d0e2c 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -1765,4 +1765,4 @@ module_exit(ipgre_fini);
> MODULE_LICENSE("GPL");
> MODULE_ALIAS_RTNL_LINK("gre");
> MODULE_ALIAS_RTNL_LINK("gretap");
> -MODULE_ALIAS("gre0");
> +MODULE_ALIAS_NETDEV("gre0");
> diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
> index 988f52f..a5f58e7 100644
> --- a/net/ipv4/ipip.c
> +++ b/net/ipv4/ipip.c
> @@ -913,4 +913,4 @@ static void __exit ipip_fini(void)
> module_init(ipip_init);
> module_exit(ipip_fini);
> MODULE_LICENSE("GPL");
> -MODULE_ALIAS("tunl0");
> +MODULE_ALIAS_NETDEV("tunl0");
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index 8ce38f1..d2c16e1 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -1290,4 +1290,4 @@ static int __init sit_init(void)
> module_init(sit_init);
> module_exit(sit_cleanup);
> MODULE_LICENSE("GPL");
> -MODULE_ALIAS("sit0");
> +MODULE_ALIAS_NETDEV("sit0");
> --
> 1.7.0.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" 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-2.6] bonding: fix rx_handler locking
From: Nicolas de Pesloüan @ 2011-03-22 20:35 UTC (permalink / raw)
To: Andy Gospodarek; +Cc: Jiri Pirko, netdev, davem, fubar
In-Reply-To: <20110322202634.GA11864@gospo.rdu.redhat.com>
Le 22/03/2011 21:26, Andy Gospodarek a écrit :
> On Tue, Mar 22, 2011 at 01:38:12PM +0100, Jiri Pirko wrote:
>> This prevents possible race between bond_enslave and bond_handle_frame
>> as reported by Nicolas by moving rx_handler register/unregister.
>> slave->bond is added to hold pointer to master bonding sructure. That
>> way dev->master is no longer used in bond_handler_frame.
>> Also, this removes "BUG: scheduling while atomic" message
>>
>> Reported-by: Nicolas de Pesloüan<nicolas.2p.debian@gmail.com>
>> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>
> Signed-off-by: Andy Gospodarek<andy@greyhouse.net>
>
> This seems reasonable. I presume Nicolas was able to test it and verify
> it resolved his issue?
Unfortunately, not yet. I plan to give it a try tonight... or tomorrow on the worst case.
Nicolas.
^ permalink raw reply
* Re: [patch net-2.6] bonding: fix rx_handler locking
From: Andy Gospodarek @ 2011-03-22 20:26 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, nicolas.2p.debian, andy, fubar
In-Reply-To: <1300797492-16128-1-git-send-email-jpirko@redhat.com>
On Tue, Mar 22, 2011 at 01:38:12PM +0100, Jiri Pirko wrote:
> This prevents possible race between bond_enslave and bond_handle_frame
> as reported by Nicolas by moving rx_handler register/unregister.
> slave->bond is added to hold pointer to master bonding sructure. That
> way dev->master is no longer used in bond_handler_frame.
> Also, this removes "BUG: scheduling while atomic" message
>
> Reported-by: Nicolas de Pesloüan <nicolas.2p.debian@gmail.com>
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
This seems reasonable. I presume Nicolas was able to test it and verify
it resolved his issue?
^ permalink raw reply
* RE: [RFC][PATCH]: e1000e: If ASPM L0s needs to be disabled, do it prior to enabling device
From: Allan, Bruce W @ 2011-03-22 20:16 UTC (permalink / raw)
To: Naga Chumbalkar, davem@davemloft.net
Cc: netdev@vger.kernel.org, Kirsher, Jeffrey T
In-Reply-To: <20110322194437.3043.97757.sendpatchset@nchumbalkar.americas.hpqcorp.net>
>-----Original Message-----
>From: Naga Chumbalkar [mailto:nagananda.chumbalkar@hp.com]
>Sent: Tuesday, March 22, 2011 12:49 PM
>To: davem@davemloft.net
>Cc: netdev@vger.kernel.org; Naga Chumbalkar; Allan, Bruce W
>Subject: [RFC][PATCH]: e1000e: If ASPM L0s needs to be disabled, do it prior to
>enabling device
>
>If ASPM L0s needs to be disabled due to HW errata, do it prior to
>"enabling" the device. This way if the kernel ever defaults its
>aspm_policy to POLICY_POWERSAVE, then the e1000e driver will get a
>chance to disable ASPM on the misbehaving device *prior* to calling
>pci_enable_device_mem(). This will be useful in situations
>where the BIOS indicates ASPM support on the server by clearing the
>ACPI FADT "ASPM Controls" bit.
>
>Note:
>The kernel (2.6.38) currently uses the BIOS "default" as its aspm_policy.
>However, Linux distros can diverge from that and set the default to "powersave".
>
>Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
>Cc: Bruce Allan <bruce.w.allan@intel.com>
>
>---
> drivers/net/e1000e/82571.c | 10 +++++-----
> drivers/net/e1000e/e1000.h | 1 +
> drivers/net/e1000e/netdev.c | 25 +++++++++++++++++++++----
> 3 files changed, 27 insertions(+), 9 deletions(-)
>
>diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
>index 89a6903..5fddc94 100644
>--- a/drivers/net/e1000e/82571.c
>+++ b/drivers/net/e1000e/82571.c
>@@ -431,9 +431,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter
>*adapter)
> case e1000_82573:
> case e1000_82574:
> case e1000_82583:
>- /* Disable ASPM L0s due to hardware errata */
>- e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S);
>-
> if (pdev->device == E1000_DEV_ID_82573L) {
> adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
> adapter->max_hw_frame_size = DEFAULT_JUMBO;
>@@ -2066,7 +2063,8 @@ struct e1000_info e1000_82573_info = {
> | FLAG_HAS_SMART_POWER_DOWN
> | FLAG_HAS_AMT
> | FLAG_HAS_SWSM_ON_LOAD,
>- .flags2 = FLAG2_DISABLE_ASPM_L1,
>+ .flags2 = FLAG2_DISABLE_ASPM_L1
>+ | FLAG2_DISABLE_ASPM_L0S,
> .pba = 20,
> .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
> .get_variants = e1000_get_variants_82571,
>@@ -2086,7 +2084,8 @@ struct e1000_info e1000_82574_info = {
> | FLAG_HAS_SMART_POWER_DOWN
> | FLAG_HAS_AMT
> | FLAG_HAS_CTRLEXT_ON_LOAD,
>- .flags2 = FLAG2_CHECK_PHY_HANG,
>+ .flags2 = FLAG2_CHECK_PHY_HANG
>+ | FLAG2_DISABLE_ASPM_L0S,
> .pba = 32,
> .max_hw_frame_size = DEFAULT_JUMBO,
> .get_variants = e1000_get_variants_82571,
>@@ -2104,6 +2103,7 @@ struct e1000_info e1000_82583_info = {
> | FLAG_HAS_SMART_POWER_DOWN
> | FLAG_HAS_AMT
> | FLAG_HAS_CTRLEXT_ON_LOAD,
>+ .flags2 = FLAG2_DISABLE_ASPM_L0S,
> .pba = 32,
> .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
> .get_variants = e1000_get_variants_82571,
>diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
>index 00bf595..ff224a7 100644
>--- a/drivers/net/e1000e/e1000.h
>+++ b/drivers/net/e1000e/e1000.h
>@@ -458,6 +458,7 @@ struct e1000_info {
> #define FLAG2_DMA_BURST (1 << 6)
> #define FLAG2_DISABLE_AIM (1 << 8)
> #define FLAG2_CHECK_PHY_HANG (1 << 9)
>+#define FLAG2_DISABLE_ASPM_L0S (1 << 10)
>
> #define E1000_RX_DESC_PS(R, i) \
> (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
>diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
>index a39d4a4..f60deec 100644
>--- a/drivers/net/e1000e/netdev.c
>+++ b/drivers/net/e1000e/netdev.c
>@@ -5393,13 +5393,19 @@ static int __e1000_resume(struct pci_dev *pdev)
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct e1000_adapter *adapter = netdev_priv(netdev);
> struct e1000_hw *hw = &adapter->hw;
>+ static int aspm_disable_flag;
> u32 err;
>
>+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S)
>+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
>+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
>+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
>+ if (aspm_disable_flag)
>+ e1000e_disable_aspm(pdev, aspm_disable_flag);
>+
> pci_set_power_state(pdev, PCI_D0);
> pci_restore_state(pdev);
> pci_save_state(pdev);
>- if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
>- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
>
> e1000e_set_interrupt_capability(adapter);
> if (netif_running(netdev)) {
>@@ -5643,11 +5649,17 @@ static pci_ers_result_t e1000_io_slot_reset(struct
>pci_dev *pdev)
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct e1000_adapter *adapter = netdev_priv(netdev);
> struct e1000_hw *hw = &adapter->hw;
>+ static int aspm_disable_flag;
> int err;
> pci_ers_result_t result;
>
>+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S)
>+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
> if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
>- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
>+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
>+ if (aspm_disable_flag)
>+ e1000e_disable_aspm(pdev, aspm_disable_flag);
>+
> err = pci_enable_device_mem(pdev);
> if (err) {
> dev_err(&pdev->dev,
>@@ -5789,12 +5801,17 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
> resource_size_t flash_start, flash_len;
>
> static int cards_found;
>+ static int aspm_disable_flag;
> int i, err, pci_using_dac;
> u16 eeprom_data = 0;
> u16 eeprom_apme_mask = E1000_EEPROM_APME;
>
>+ if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S)
>+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
> if (ei->flags2 & FLAG2_DISABLE_ASPM_L1)
>- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
>+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
>+ if (aspm_disable_flag)
>+ e1000e_disable_aspm(pdev, aspm_disable_flag);
>
> err = pci_enable_device_mem(pdev);
> if (err)
>--
>1.7.1.2
Yeah, I was thinking this very thing was needed after seeing the patchset
from Naga yesterday on linux-pci/lkml, but was beaten to it ;-)
Jeff Kirsher, when you pull this into your tree for Intel validation, you
can add my ACK to it.
Thanks Naga,
Bruce.
^ permalink raw reply
* [RFC][PATCH]: e1000e: If ASPM L0s needs to be disabled, do it prior to enabling device
From: Naga Chumbalkar @ 2011-03-22 19:48 UTC (permalink / raw)
To: davem; +Cc: netdev, Naga Chumbalkar, bruce.w.allan
If ASPM L0s needs to be disabled due to HW errata, do it prior to
"enabling" the device. This way if the kernel ever defaults its
aspm_policy to POLICY_POWERSAVE, then the e1000e driver will get a
chance to disable ASPM on the misbehaving device *prior* to calling
pci_enable_device_mem(). This will be useful in situations
where the BIOS indicates ASPM support on the server by clearing the
ACPI FADT "ASPM Controls" bit.
Note:
The kernel (2.6.38) currently uses the BIOS "default" as its aspm_policy.
However, Linux distros can diverge from that and set the default to "powersave".
Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
Cc: Bruce Allan <bruce.w.allan@intel.com>
---
drivers/net/e1000e/82571.c | 10 +++++-----
drivers/net/e1000e/e1000.h | 1 +
drivers/net/e1000e/netdev.c | 25 +++++++++++++++++++++----
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 89a6903..5fddc94 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -431,9 +431,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
case e1000_82573:
case e1000_82574:
case e1000_82583:
- /* Disable ASPM L0s due to hardware errata */
- e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S);
-
if (pdev->device == E1000_DEV_ID_82573L) {
adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
adapter->max_hw_frame_size = DEFAULT_JUMBO;
@@ -2066,7 +2063,8 @@ struct e1000_info e1000_82573_info = {
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_SWSM_ON_LOAD,
- .flags2 = FLAG2_DISABLE_ASPM_L1,
+ .flags2 = FLAG2_DISABLE_ASPM_L1
+ | FLAG2_DISABLE_ASPM_L0S,
.pba = 20,
.max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
.get_variants = e1000_get_variants_82571,
@@ -2086,7 +2084,8 @@ struct e1000_info e1000_82574_info = {
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_CTRLEXT_ON_LOAD,
- .flags2 = FLAG2_CHECK_PHY_HANG,
+ .flags2 = FLAG2_CHECK_PHY_HANG
+ | FLAG2_DISABLE_ASPM_L0S,
.pba = 32,
.max_hw_frame_size = DEFAULT_JUMBO,
.get_variants = e1000_get_variants_82571,
@@ -2104,6 +2103,7 @@ struct e1000_info e1000_82583_info = {
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_CTRLEXT_ON_LOAD,
+ .flags2 = FLAG2_DISABLE_ASPM_L0S,
.pba = 32,
.max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
.get_variants = e1000_get_variants_82571,
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 00bf595..ff224a7 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -458,6 +458,7 @@ struct e1000_info {
#define FLAG2_DMA_BURST (1 << 6)
#define FLAG2_DISABLE_AIM (1 << 8)
#define FLAG2_CHECK_PHY_HANG (1 << 9)
+#define FLAG2_DISABLE_ASPM_L0S (1 << 10)
#define E1000_RX_DESC_PS(R, i) \
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index a39d4a4..f60deec 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5393,13 +5393,19 @@ static int __e1000_resume(struct pci_dev *pdev)
struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
+ static int aspm_disable_flag;
u32 err;
+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S)
+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
+ if (aspm_disable_flag)
+ e1000e_disable_aspm(pdev, aspm_disable_flag);
+
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
pci_save_state(pdev);
- if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
e1000e_set_interrupt_capability(adapter);
if (netif_running(netdev)) {
@@ -5643,11 +5649,17 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
+ static int aspm_disable_flag;
int err;
pci_ers_result_t result;
+ if (adapter->flags2 & FLAG2_DISABLE_ASPM_L0S)
+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1)
- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
+ if (aspm_disable_flag)
+ e1000e_disable_aspm(pdev, aspm_disable_flag);
+
err = pci_enable_device_mem(pdev);
if (err) {
dev_err(&pdev->dev,
@@ -5789,12 +5801,17 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
resource_size_t flash_start, flash_len;
static int cards_found;
+ static int aspm_disable_flag;
int i, err, pci_using_dac;
u16 eeprom_data = 0;
u16 eeprom_apme_mask = E1000_EEPROM_APME;
+ if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S)
+ aspm_disable_flag = PCIE_LINK_STATE_L0S;
if (ei->flags2 & FLAG2_DISABLE_ASPM_L1)
- e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1);
+ aspm_disable_flag |= PCIE_LINK_STATE_L1;
+ if (aspm_disable_flag)
+ e1000e_disable_aspm(pdev, aspm_disable_flag);
err = pci_enable_device_mem(pdev);
if (err)
--
1.7.1.2
^ permalink raw reply related
* Re: [PATCH] can: make struct proto const
From: Kurt Van Dijck @ 2011-03-22 19:00 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: David Miller, Linux Netdev List
In-Reply-To: <4D88EA0D.3090601@hartkopp.net>
On Tue, Mar 22, 2011 at 07:27:25PM +0100, Oliver Hartkopp wrote:
> can_ioctl is the only reason for struct proto to be non-const.
> script/check-patch.pl suggests struct proto be const.
>
> Setting the reference to the common can_ioctl() in all CAN protocols directly
> removes the need to make the struct proto writable in af_can.c
>
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
>
Good idea to take this apart from my J1939 series.
Kurt
^ permalink raw reply
* [PATCH] can: make struct proto const
From: Oliver Hartkopp @ 2011-03-22 18:27 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Kurt Van Dijck
can_ioctl is the only reason for struct proto to be non-const.
script/check-patch.pl suggests struct proto be const.
Setting the reference to the common can_ioctl() in all CAN protocols directly
removes the need to make the struct proto writable in af_can.c
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 6c507be..6f70a6d 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -36,10 +36,10 @@
* @prot: pointer to struct proto structure.
*/
struct can_proto {
- int type;
- int protocol;
- struct proto_ops *ops;
- struct proto *prot;
+ int type;
+ int protocol;
+ const struct proto_ops *ops;
+ struct proto *prot;
};
/* function prototypes for the CAN networklayer core (af_can.c) */
@@ -58,5 +58,6 @@ extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
void *data);
extern int can_send(struct sk_buff *skb, int loop);
+extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
#endif /* CAN_CORE_H */
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 702be5a..733d66f 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -95,7 +95,7 @@ struct s_pstats can_pstats; /* receive list statistics */
* af_can socket functions
*/
-static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
@@ -108,6 +108,7 @@ static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return -ENOIOCTLCMD;
}
}
+EXPORT_SYMBOL(can_ioctl);
static void can_sock_destruct(struct sock *sk)
{
@@ -698,13 +699,9 @@ int can_proto_register(struct can_proto *cp)
printk(KERN_ERR "can: protocol %d already registered\n",
proto);
err = -EBUSY;
- } else {
+ } else
proto_tab[proto] = cp;
- /* use generic ioctl function if not defined by module */
- if (!cp->ops->ioctl)
- cp->ops->ioctl = can_ioctl;
- }
spin_unlock(&proto_tab_lock);
if (err < 0)
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 092dc88..871a0ad 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1569,7 +1569,7 @@ static int bcm_recvmsg(struct kiocb *iocb, struct socket *sock,
return size;
}
-static struct proto_ops bcm_ops __read_mostly = {
+static const struct proto_ops bcm_ops = {
.family = PF_CAN,
.release = bcm_release,
.bind = sock_no_bind,
@@ -1578,7 +1578,7 @@ static struct proto_ops bcm_ops __read_mostly = {
.accept = sock_no_accept,
.getname = sock_no_getname,
.poll = datagram_poll,
- .ioctl = NULL, /* use can_ioctl() from af_can.c */
+ .ioctl = can_ioctl, /* use can_ioctl() from af_can.c */
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,
diff --git a/net/can/raw.c b/net/can/raw.c
index 883e9d7..649acfa 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -742,7 +742,7 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
return size;
}
-static struct proto_ops raw_ops __read_mostly = {
+static const struct proto_ops raw_ops = {
.family = PF_CAN,
.release = raw_release,
.bind = raw_bind,
@@ -751,7 +751,7 @@ static struct proto_ops raw_ops __read_mostly = {
.accept = sock_no_accept,
.getname = raw_getname,
.poll = datagram_poll,
- .ioctl = NULL, /* use can_ioctl() from af_can.c */
+ .ioctl = can_ioctl, /* use can_ioctl() from af_can.c */
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = raw_setsockopt,
^ permalink raw reply related
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jamie Iles @ 2011-03-22 17:55 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
linux-arm-kernel, Andrew Victor, Peter Korsgaard
In-Reply-To: <20110322163917.GD10058@pulham.picochip.com>
Hi Jean-Christophe,
On Tue, Mar 22, 2011 at 04:39:17PM +0000, Jamie Iles wrote:
> Hi Jean-Christophe,
>
> On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 11:18 Mon 21 Mar , Jamie Iles wrote:
> > > I have an existing tree for this at
> > >
> > > git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> > >
> > > based off of 2.6.38 (with your ACK's now added) and I'd be happy with
> > > either route.
> > but we must detect the gem via the version register and ditto for macb for
> > avr32 and at91
> >
> > so please rebase it over my patch
> >
> > and you get my sob too
>
> Would you mind respinning your patch without the changes to the clk
> stuff? Otherwise we're changing it from compile time to version based,
> only to completely remove it in subsequent patches.
Actually, this patch doesn't work anyway as the version register is
being read before the clks are enabled so the device isn't accessible
(and the registers haven't yet been ioremap()'d).
> Also, can you confirm that the module ID's that you are using to
> differentiate between AT91 and AVR32 won't clash with MACB uses in
> other, non-at91/avr32 chips, or that it doesn't matter?
If this does work, then it would be nice if we made the else path of the
RMII AT91 tests also test for avr32 too so we aren't driving the USRIO
pins on platforms that aren't at91 but also aren't avr32. So something
the patch below instead.
Jamie
8<---
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 79ccb54..55b81f5 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -22,7 +22,6 @@
#include <linux/phy.h>
#include <mach/board.h>
-#include <mach/cpu.h>
#include "macb.h"
@@ -1169,6 +1168,7 @@ static int __init macb_probe(struct platform_device *pdev)
err = -ENOMEM;
goto err_out_disable_clocks;
}
+ bp->version = macb_readl(bp, VERSION);
dev->irq = platform_get_irq(pdev, 0);
err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
@@ -1201,18 +1201,18 @@ static int __init macb_probe(struct platform_device *pdev)
macb_get_hwaddr(bp);
pdata = pdev->dev.platform_data;
- if (pdata && pdata->is_rmii)
-#if defined(CONFIG_ARCH_AT91)
- macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
-#else
- macb_writel(bp, USRIO, 0);
-#endif
- else
-#if defined(CONFIG_ARCH_AT91)
- macb_writel(bp, USRIO, MACB_BIT(CLKEN));
-#else
- macb_writel(bp, USRIO, MACB_BIT(MII));
-#endif
+ if (pdata && pdata->is_rmii) {
+ if (macb_is_at91(bp))
+ macb_writel(bp, USRIO,
+ (MACB_BIT(RMII) | MACB_BIT(CLKEN)));
+ else if (macb_is_avr32(bp))
+ macb_writel(bp, USRIO, 0);
+ } else {
+ if (macb_is_at91(bp))
+ macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+ else if (macb_is_avr32(bp))
+ macb_writel(bp, USRIO, MACB_BIT(MII));
+ }
bp->tx_pending = DEF_TX_RING_PENDING;
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index d3212f6..56a4fcb 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -59,6 +59,7 @@
#define MACB_TPQ 0x00bc
#define MACB_USRIO 0x00c0
#define MACB_WOL 0x00c4
+#define MACB_VERSION 0x00fc
/* Bitfields in NCR */
#define MACB_LB_OFFSET 0
@@ -389,6 +390,14 @@ struct macb {
unsigned int link;
unsigned int speed;
unsigned int duplex;
+
+ uint32_t version;
};
+#define MACB_VERSION_MASK 0xffff0000
+#define macb_is_at91(bp) \
+ (((bp)->version & MACB_VERSION_MASK) == 0x06010000)
+#define macb_is_avr32(bp) \
+ (((bp)->version & MACB_VERSION_MASK) == 0x00010000)
+
#endif /* _MACB_H */
^ permalink raw reply related
* pull request: wireless-2.6 2011-03-22
From: John W. Linville @ 2011-03-22 17:46 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
Dave,
Here is a batch of fixes intended for 2.6.39. Included are a lock
leak fix for iwlwifi, a "hold the lock longer" fix for orinoco, an
rtlwifi fix for a memset argument ordering problem, a sta structure
initialization fix for mac80211, an ath9k NULL pointer fix, a
kernel-doc fix, and a handful of device IDs.
Please let me know if there are problems!
Thanks,
John
---
The following changes since commit 736561a01f11114146b1b7f82d486fa9c95828ef:
IPVS: Use global mutex in ip_vs_app.c (2011-03-21 20:39:24 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git master
Dan Carpenter (1):
iwlwifi: missing unlock on error path
Felix Fietkau (1):
mac80211: initialize sta->last_rx in sta_info_alloc
Ilia Mirkin (1):
rtlwifi: Fix memset argument order
Joe Gunn (1):
orinoco: Maintain lock until entry removed from list
Mohammed Shafi Shajakhan (1):
ath9k: Fix kernel panic in AR2427
Peter Lemenkov (4):
rt2x00: Add rt2870 device id
rt2x00: Add Planex Communications, Inc. RT8070
rt2x00: Add 2L Central Europe BV 8070
rt2x00: Add unknown Toshiba device
Randy Dunlap (1):
wireless: fix 80211 kernel-doc warnings
Tõnu Samuel (1):
zd1211rw: TrendNet TEW-509UB id added
drivers/net/wireless/ath/ath9k/xmit.c | 4 ++--
drivers/net/wireless/iwlwifi/iwl-agn.c | 7 +++++--
drivers/net/wireless/orinoco/main.c | 2 +-
drivers/net/wireless/rt2x00/rt2800usb.c | 7 ++++++-
drivers/net/wireless/rtlwifi/efuse.c | 31 +++++++++++++++----------------
drivers/net/wireless/zd1211rw/zd_usb.c | 1 +
include/net/cfg80211.h | 3 ++-
include/net/mac80211.h | 2 +-
net/mac80211/sta_info.c | 1 +
9 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index ef22096..26734e5 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1725,8 +1725,8 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
u8 tidno;
spin_lock_bh(&txctl->txq->axq_lock);
-
- if (ieee80211_is_data_qos(hdr->frame_control) && txctl->an) {
+ if ((sc->sc_flags & SC_OP_TXAGGR) && txctl->an &&
+ ieee80211_is_data_qos(hdr->frame_control)) {
tidno = ieee80211_get_qos_ctl(hdr)[0] &
IEEE80211_QOS_CTL_TID_MASK;
tid = ATH_AN_2_TID(txctl->an, tidno);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 581dc9f..321b18b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3009,14 +3009,17 @@ static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw)
mutex_lock(&priv->mutex);
- if (!priv->_agn.offchan_tx_skb)
- return -EINVAL;
+ if (!priv->_agn.offchan_tx_skb) {
+ ret = -EINVAL;
+ goto unlock;
+ }
priv->_agn.offchan_tx_skb = NULL;
ret = iwl_scan_cancel_timeout(priv, 200);
if (ret)
ret = -EIO;
+unlock:
mutex_unlock(&priv->mutex);
return ret;
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index f3d396e..62c6b2b 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1376,13 +1376,13 @@ static void orinoco_process_scan_results(struct work_struct *work)
spin_lock_irqsave(&priv->scan_lock, flags);
list_for_each_entry_safe(sd, temp, &priv->scan_list, list) {
- spin_unlock_irqrestore(&priv->scan_lock, flags);
buf = sd->buf;
len = sd->len;
type = sd->type;
list_del(&sd->list);
+ spin_unlock_irqrestore(&priv->scan_lock, flags);
kfree(sd);
if (len > 0) {
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index f1a9214..4e36865 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -719,6 +719,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x0b05, 0x1732), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x0b05, 0x1742), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x0b05, 0x1784), USB_DEVICE_DATA(&rt2800usb_ops) },
+ { USB_DEVICE(0x1761, 0x0b05), USB_DEVICE_DATA(&rt2800usb_ops) },
/* AzureWave */
{ USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -913,7 +914,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x0b05, 0x1790), USB_DEVICE_DATA(&rt2800usb_ops) },
- { USB_DEVICE(0x1761, 0x0b05), USB_DEVICE_DATA(&rt2800usb_ops) },
/* AzureWave */
{ USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x13d3, 0x3284), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -937,6 +937,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x07d1, 0x3c15), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x07d1, 0x3c17), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Edimax */
+ { USB_DEVICE(0x7392, 0x4085), USB_DEVICE_DATA(&rt2800usb_ops) },
/* Encore */
{ USB_DEVICE(0x203d, 0x14a1), USB_DEVICE_DATA(&rt2800usb_ops) },
/* Gemtek */
@@ -961,6 +963,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
{ USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
/* Planex */
+ { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
/* Qcom */
{ USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -972,6 +975,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
/* Sweex */
{ USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) },
{ USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) },
+ /* Toshiba */
+ { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
/* Zyxel */
{ USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) },
#endif
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index 4f92cba..f74a870 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -410,8 +410,8 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
if (!efuse_shadow_update_chk(hw)) {
efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]);
- memcpy((void *)&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
- (void *)&rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
+ memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
+ &rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
@@ -446,9 +446,9 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
if (word_en != 0x0F) {
u8 tmpdata[8];
- memcpy((void *)tmpdata,
- (void *)(&rtlefuse->
- efuse_map[EFUSE_MODIFY_MAP][base]), 8);
+ memcpy(tmpdata,
+ &rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base],
+ 8);
RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD,
("U-efuse\n"), tmpdata, 8);
@@ -465,8 +465,8 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
efuse_power_switch(hw, true, false);
efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]);
- memcpy((void *)&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
- (void *)&rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
+ memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
+ &rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, ("<---\n"));
@@ -479,13 +479,12 @@ void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw)
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
if (rtlefuse->autoload_failflag == true) {
- memset((void *)(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0]), 128,
- 0xFF);
+ memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF, 128);
} else
efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]);
- memcpy((void *)&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
- (void *)&rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
+ memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0],
+ &rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
}
@@ -694,8 +693,8 @@ static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, u8 *data)
if (offset > 15)
return false;
- memset((void *)data, PGPKT_DATA_SIZE * sizeof(u8), 0xff);
- memset((void *)tmpdata, PGPKT_DATA_SIZE * sizeof(u8), 0xff);
+ memset(data, 0xff, PGPKT_DATA_SIZE * sizeof(u8));
+ memset(tmpdata, 0xff, PGPKT_DATA_SIZE * sizeof(u8));
while (bcontinual && (efuse_addr < EFUSE_MAX_SIZE)) {
if (readstate & PG_STATE_HEADER) {
@@ -862,7 +861,7 @@ static void efuse_write_data_case2(struct ieee80211_hw *hw, u16 *efuse_addr,
tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en);
- memset((void *)originaldata, 8 * sizeof(u8), 0xff);
+ memset(originaldata, 0xff, 8 * sizeof(u8));
if (efuse_pg_packet_read(hw, tmp_pkt.offset, originaldata)) {
badworden = efuse_word_enable_data_write(hw,
@@ -917,7 +916,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
target_pkt.offset = offset;
target_pkt.word_en = word_en;
- memset((void *)target_pkt.data, 8 * sizeof(u8), 0xFF);
+ memset(target_pkt.data, 0xFF, 8 * sizeof(u8));
efuse_word_enable_data_read(word_en, data, target_pkt.data);
target_word_cnts = efuse_calculate_word_cnts(target_pkt.word_en);
@@ -1022,7 +1021,7 @@ static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw,
u8 badworden = 0x0F;
u8 tmpdata[8];
- memset((void *)tmpdata, PGPKT_DATA_SIZE, 0xff);
+ memset(tmpdata, 0xff, PGPKT_DATA_SIZE);
RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
("word_en = %x efuse_addr=%x\n", word_en, efuse_addr));
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 81e8048..58236e6 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -60,6 +60,7 @@ static struct usb_device_id usb_ids[] = {
{ USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 },
{ USB_DEVICE(0x157e, 0x300b), .driver_info = DEVICE_ZD1211 },
{ USB_DEVICE(0x157e, 0x3204), .driver_info = DEVICE_ZD1211 },
+ { USB_DEVICE(0x157e, 0x3207), .driver_info = DEVICE_ZD1211 },
{ USB_DEVICE(0x1740, 0x2000), .driver_info = DEVICE_ZD1211 },
{ USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 },
/* ZD1211B */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 60f7876..b2b9d28 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -486,7 +486,8 @@ struct rate_info {
* @plink_state: mesh peer link state
* @signal: signal strength of last received packet in dBm
* @signal_avg: signal strength average in dBm
- * @txrate: current unicast bitrate to this station
+ * @txrate: current unicast bitrate from this station
+ * @rxrate: current unicast bitrate to this station
* @rx_packets: packets received from this station
* @tx_packets: packets transmitted to this station
* @tx_retries: cumulative retry counts
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8650e7b..cefe1b3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1160,7 +1160,7 @@ enum ieee80211_hw_flags {
* @napi_weight: weight used for NAPI polling. You must specify an
* appropriate value here if a napi_poll operation is provided
* by your driver.
-
+ *
* @max_rx_aggregation_subframes: maximum buffer size (number of
* sub-frames) to be used for A-MPDU block ack receiver
* aggregation.
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 5a11078..d0311a3 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -243,6 +243,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
memcpy(sta->sta.addr, addr, ETH_ALEN);
sta->local = local;
sta->sdata = sdata;
+ sta->last_rx = jiffies;
ewma_init(&sta->avg_signal, 1024, 8);
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply related
* Re: [PATCH 02/36] scsi,rcu: convert call_rcu(fc_rport_free_rcu) to kfree_rcu()
From: Robert Love @ 2011-03-22 17:28 UTC (permalink / raw)
To: Lai Jiangshan
Cc: Paul E. McKenney, Ingo Molnar, Jens Axboe, James E.J. Bottomley,
Neil Horman, David S. Miller, Alexey Kuznetsov,
Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Eric Dumazet, Stephen Hemminger, Tejun Heo,
Jarek Poplawski, linux-kernel@vger.kernel.org,
devel@open-fcoe.org, linux-scsi@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <4D82D45A.30102@cn.fujitsu.com>
On Thu, 2011-03-17 at 20:41 -0700, Lai Jiangshan wrote:
>
> The rcu callback fc_rport_free_rcu() just calls a kfree(),
> so we use kfree_rcu() instead of the call_rcu(fc_rport_free_rcu).
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> drivers/scsi/libfc/fc_rport.c | 14 +-------------
> 1 files changed, 1 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
> index a7175ad..29abab0 100644
> --- a/drivers/scsi/libfc/fc_rport.c
> +++ b/drivers/scsi/libfc/fc_rport.c
> @@ -151,18 +151,6 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
> }
>
> /**
> - * fc_rport_free_rcu() - Free a remote port
> - * @rcu: The rcu_head structure inside the remote port
> - */
> -static void fc_rport_free_rcu(struct rcu_head *rcu)
> -{
> - struct fc_rport_priv *rdata;
> -
> - rdata = container_of(rcu, struct fc_rport_priv, rcu);
> - kfree(rdata);
> -}
> -
> -/**
> * fc_rport_destroy() - Free a remote port after last reference is released
> * @kref: The remote port's kref
> */
> @@ -171,7 +159,7 @@ static void fc_rport_destroy(struct kref *kref)
> struct fc_rport_priv *rdata;
>
> rdata = container_of(kref, struct fc_rport_priv, kref);
> - call_rcu(&rdata->rcu, fc_rport_free_rcu);
> + kfree_rcu(rdata, rcu);
I think this last line should be:
kfree_rcu(rdata, &rdata->rcu);
Thanks, //Rob
^ permalink raw reply
* [PATCH 1/3] drivers/net/ariadne.c: Convert release_resource to release_region/release_mem_region
From: Julia Lawall @ 2011-03-22 17:15 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, Eric Dumazet, Tejun Heo, Jinqiu Yang,
Geert Uytterhoeven, netdev, linux-kernel
Request_mem_region should be used with release_mem_region, not
release_resource.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,E;
@@
*x = request_mem_region(...)
... when != release_mem_region(x)
when != x = E
* release_resource(x);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/ariadne.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index 7ca0ede..b7f45cd 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -182,14 +182,14 @@ static int __devinit ariadne_init_one(struct zorro_dev *z,
return -EBUSY;
r2 = request_mem_region(mem_start, ARIADNE_RAM_SIZE, "RAM");
if (!r2) {
- release_resource(r1);
+ release_mem_region(base_addr, sizeof(struct Am79C960));
return -EBUSY;
}
dev = alloc_etherdev(sizeof(struct ariadne_private));
if (dev == NULL) {
- release_resource(r1);
- release_resource(r2);
+ release_mem_region(base_addr, sizeof(struct Am79C960));
+ release_mem_region(mem_start, ARIADNE_RAM_SIZE);
return -ENOMEM;
}
@@ -213,8 +213,8 @@ static int __devinit ariadne_init_one(struct zorro_dev *z,
err = register_netdev(dev);
if (err) {
- release_resource(r1);
- release_resource(r2);
+ release_mem_region(base_addr, sizeof(struct Am79C960));
+ release_mem_region(mem_start, ARIADNE_RAM_SIZE);
free_netdev(dev);
return err;
}
^ permalink raw reply related
* [PATCH 3/3] drivers/net/a2065.c: Convert release_resource to release_region/release_mem_region
From: Julia Lawall @ 2011-03-22 17:15 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, Eric Dumazet, Tejun Heo, Jiri Pirko,
Geert Uytterhoeven, netdev, linux-kernel
Request_mem_region should be used with release_mem_region, not
release_resource.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,E;
@@
*x = request_mem_region(...)
... when != release_mem_region(x)
when != x = E
* release_resource(x);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/a2065.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index f142cc2..deaa8bc 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -711,14 +711,14 @@ static int __devinit a2065_init_one(struct zorro_dev *z,
return -EBUSY;
r2 = request_mem_region(mem_start, A2065_RAM_SIZE, "RAM");
if (!r2) {
- release_resource(r1);
+ release_mem_region(base_addr, sizeof(struct lance_regs));
return -EBUSY;
}
dev = alloc_etherdev(sizeof(struct lance_private));
if (dev == NULL) {
- release_resource(r1);
- release_resource(r2);
+ release_mem_region(base_addr, sizeof(struct lance_regs));
+ release_mem_region(mem_start, A2065_RAM_SIZE);
return -ENOMEM;
}
@@ -764,8 +764,8 @@ static int __devinit a2065_init_one(struct zorro_dev *z,
err = register_netdev(dev);
if (err) {
- release_resource(r1);
- release_resource(r2);
+ release_mem_region(base_addr, sizeof(struct lance_regs));
+ release_mem_region(mem_start, A2065_RAM_SIZE);
free_netdev(dev);
return err;
}
^ permalink raw reply related
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jamie Iles @ 2011-03-22 16:39 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Jamie Iles, Nicolas Ferre, David Miller, Russell King - ARM Linux,
netdev, linux-arm-kernel, Andrew Victor, Peter Korsgaard
In-Reply-To: <20110322161811.GF6466@game.jcrosoft.org>
Hi Jean-Christophe,
On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:18 Mon 21 Mar , Jamie Iles wrote:
> > I have an existing tree for this at
> >
> > git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> >
> > based off of 2.6.38 (with your ACK's now added) and I'd be happy with
> > either route.
> but we must detect the gem via the version register and ditto for macb for
> avr32 and at91
>
> so please rebase it over my patch
>
> and you get my sob too
Would you mind respinning your patch without the changes to the clk
stuff? Otherwise we're changing it from compile time to version based,
only to completely remove it in subsequent patches.
Also, can you confirm that the module ID's that you are using to
differentiate between AT91 and AVR32 won't clash with MACB uses in
other, non-at91/avr32 chips, or that it doesn't matter?
Jamie
^ permalink raw reply
* can: c_can: TX handling
From: Jan Altenberg @ 2011-03-22 15:59 UTC (permalink / raw)
To: bhupesh.sharma; +Cc: wg, kurt.van.dijck, b.spranger, netdev
Hi all,
I did some more testing on the SocketCAN driver for the Bosch c_can
controller and I observed some strange behaviour for the TX handling.
First of all the TX bytes are not accounted correctly. The reason for that
seems to be quite obvious if we look into c_can_do_tx():
[...]
c_can_inval_msg_object(dev, 0, msg_obj_no);
val = c_can_read_reg32(priv, &priv->regs->txrqst1);
if (!(val & (1 << msg_obj_no))) {
can_get_echo_skb(dev,
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
stats->tx_bytes += priv->read_reg(priv,
&priv->regs->ifregs[0].msg_cntrl)
& IF_MCONT_DLC_MASK;
So, we first invalidate the message object and afterwards we read the DLC
value from the msg_cntrl (which is 0 after invalidating the
message object) to account the TX bytes. So tx_bytes will always be 0. The
fix should be easy, I think, we can just move
c_can_inval_msg_object to the end of that loop.
The second problem is related to tx_next, which should hold the number of
the oldest CAN frame, which was not on the line:
for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
msg_obj_no = get_tx_echo_msg_obj(priv);
c_can_inval_msg_object(dev, 0, msg_obj_no);
val = c_can_read_reg32(priv, &priv->regs->txrqst1);
if (!(val & (1 << msg_obj_no))) {
can_get_echo_skb(dev,
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
stats->tx_bytes += priv->read_reg(priv,
&priv->regs->ifregs[0].msg_cntrl)
& IF_MCONT_DLC_MASK;
stats->tx_packets++;
}
}
But tx_echo is incremented unconditionally and we don't actually track the
number of the oldest unsent frame.
Let's assume the following scenario: We bring up can0 and send 3
frames: TX object: 0, 1, 2; 1 and 2 make it on the line, but 0 is
still pending. If we go through the above loop in that situation, we will
skip message object 0, because the txrqst bit is still set. We will
account message object 1 and 2. That's correct, but afterwards tx_echo is
set to 2, BUT the oldest message which is pending is 0. Am I right or did
I get something wrong?
The operation of c_can_do_tx() is described as follows: "We iterate from
priv->tx_echo to priv->tx_next and check if the packet has been
transmitted, echo it back to the CAN framework. If we discover a not yet
transmitted package, stop looking for more." The actual
implementation doesn't seem to stop if we discover a not yet
transmitted package. But I'm not sure if just stopping might be a
good idea, because in that case, the echo skb for already transmitted
messages might be delayed by not yet transmitted messages.
Cheers,
Jan
^ permalink raw reply
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-22 16:18 UTC (permalink / raw)
To: Jamie Iles
Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
linux-arm-kernel, Andrew Victor, Peter Korsgaard
In-Reply-To: <20110321111838.GC2610@pulham.picochip.com>
On 11:18 Mon 21 Mar , Jamie Iles wrote:
> On Mon, Mar 21, 2011 at 02:38:18PM +0800, Nicolas Ferre wrote:
> > On 3/17/2011 4:17 AM, David Miller :
> > > From: Jamie Iles <jamie@jamieiles.com>
> > > Date: Tue, 15 Mar 2011 10:14:47 +0000
> > >
> > >> This patch series extends the Atmel MACB driver to support the Cadence
> > >> GEM (Gigabit Ethernet MAC) to support 10/100 operation. The GEM is
> > >> based on the MACB block but has a few moved registers and bitfields.
> > >> This patch series attempts to use the MACB accessors where block
> > >> functionallity is identical and only overrides to GEM specific
> > >> acccessors when needed.
> > >>
> > >> This has been runtested on a board with a Cadence GEM and compile tested
> > >> for all at91 configurations and a number of avr32 configurations.
> > >>
> > >> Changes since v1:
> > >> - AT91 now provides a fake "hclk" and "macb_clk" has been
> > >> renamed to "pclk" to be consistent with AVR32.
> > >> - Configurable GEM receive buffer size support has been added.
> > >> - pr_foo() and dev_foo() have been converted to netdev_foo()
> > >> where appropriate.
> > >> - New conditional accessors (macb_or_gem_{read,write}l) have
> > >> been introduced that do the conditional accesses dependent on
> > >> macb/gem type.
> > >> - GEM is now dynamically detected from the module ID rather than
> > >> platform device name.
> > >>
> > >> Jean-Christophe, I haven't based this on your conditional clock patch as
> > >> I wasn't sure what decision had been made on that and whether the
> > >> at91/avr32 detection is reliable.
> > >
> > > I'm happy to ACK this so you guys can merge this via one of the
> > > ARM trees:
> > >
> > > Acked-by: David S. Miller <davem@davemloft.net>
> >
> > I add my:
> >
> > Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> >
> > Now, tell me if we need to setup a git tree with this and make it
> > handled by linux-next (we do not have for at91 yet)?
> > or Russell can take the series in a "devel" branch?
>
> Thanks for testing Nicolas!
>
> I have an existing tree for this at
>
> git://github.com/jamieiles/linux-2.6-ji.git macb-gem
>
> based off of 2.6.38 (with your ACK's now added) and I'd be happy with
> either route.
but we must detect the gem via the version register and ditto for macb for
avr32 and at91
so please rebase it over my patch
and you get my sob too
Best Regards,
J.
^ permalink raw reply
* RE: [PATCHv2] net: davinci_emac:Fix translation logic for buffer descriptor
From: Nori, Sekhar @ 2011-03-22 14:40 UTC (permalink / raw)
To: Govindarajan, Sriramakrishnan, netdev@vger.kernel.org
Cc: davinci-linux-open-source@linux.davincidsp.com,
davem@davemloft.net, sshtylyov@mvista.com
In-Reply-To: <1300797063-13558-1-git-send-email-srk@ti.com>
On Tue, Mar 22, 2011 at 18:01:03, Govindarajan, Sriramakrishnan wrote:
> With recent changes to the driver(switch to new cpdma layer),
> the support for buffer descriptor address translation logic
> is broken. This affects platforms where the physical address of
> the descriptors as seen by the DMA engine is different from the
> physical address.
>
> Original Patch adding translation logic support:
> Commit: ad021ae8862209864dc8ebd3b7d3a55ce84b9ea2
>
> Signed-off-by: Sriramakrishnan A G <srk@ti.com>
> ---
> Addresses review comments from Sergei. Generated against tip of Linus tree.
Just tested this patch on DM6446 EVM. Successfully
tried an NFS boot.
Tested-By: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply
* Re: [PATCH 3/3, v2] fs_enet: Add PHY interface selection for MPC5121 fs_enet.
From: vooon341 @ 2011-03-22 14:10 UTC (permalink / raw)
To: linuxppc-dev; +Cc: netdev, linux-kernel, Vitaly Bordug
Add PHY interface selection for MPC5121 fs_enet.
Adds phy-connection-type optional property for ethernet node.
It should be rmii or mii.
Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
---
v2:
- replace Kconfig to device tree
- add phy-connection-type for mpc5121-fec nodes
---
drivers/net/fs_enet/fec.h | 6 ++++--
drivers/net/fs_enet/fs_enet-main.c | 14 ++++++++++++--
drivers/net/fs_enet/mac-fec.c | 9 ++++++---
3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/net/fs_enet/fec.h b/drivers/net/fs_enet/fec.h
index e980527..9fd1ff5 100644
--- a/drivers/net/fs_enet/fec.h
+++ b/drivers/net/fs_enet/fec.h
@@ -23,6 +23,10 @@
#define FEC_ECNTRL_ETHER_EN 0x00000002
#define FEC_ECNTRL_RESET 0x00000001
+/* RMII mode enabled only when MII_MODE bit is set too. */
+#define FEC_RCNTRL_RMII_MODE (0x00000100 | \
+ FEC_RCNTRL_MII_MODE | FEC_RCNTRL_FCE)
+#define FEC_RCNTRL_FCE 0x00000020
#define FEC_RCNTRL_BC_REJ 0x00000010
#define FEC_RCNTRL_PROM 0x00000008
#define FEC_RCNTRL_MII_MODE 0x00000004
@@ -33,8 +37,6 @@
#define FEC_TCNTRL_HBC 0x00000002
#define FEC_TCNTRL_GTS 0x00000001
-
-
/*
* Delay to wait for FEC reset command to complete (in us)
*/
diff --git a/drivers/net/fs_enet/fs_enet-main.c
b/drivers/net/fs_enet/fs_enet-main.c
index 24cb953..c424159 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -788,16 +788,20 @@ static int fs_init_phy(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
struct phy_device *phydev;
+ phy_interface_t iface;
fep->oldlink = 0;
fep->oldspeed = 0;
fep->oldduplex = -1;
+ iface = (fep->fpi->use_rmii) ?
+ PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII;
+
phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
- PHY_INTERFACE_MODE_MII);
+ iface);
if (!phydev) {
phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
- PHY_INTERFACE_MODE_MII);
+ iface);
}
if (!phydev) {
dev_err(&dev->dev, "Could not attach to PHY\n");
@@ -1005,6 +1009,7 @@ static int __devinit fs_enet_probe(struct
platform_device *ofdev)
struct fs_platform_info *fpi;
const u32 *data;
const u8 *mac_addr;
+ char *phy_connection_type;
int privsize, len, ret = -ENODEV;
if (!ofdev->dev.of_match)
@@ -1032,6 +1037,11 @@ static int __devinit fs_enet_probe(struct
platform_device *ofdev)
NULL)))
goto out_free_fpi;
+ phy_connection_type = of_get_property(ofdev->dev.of_node,
+ "phy-connection-type", NULL);
+ if (phy_connection_type && strcmp("rmii", phy_connection_type) == 0)
+ fpi->use_rmii = 1;
+
privsize = sizeof(*fep) +
sizeof(struct sk_buff **) *
(fpi->rx_ring + fpi->tx_ring);
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 61035fc..7ba36c1 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -322,10 +322,11 @@ static void restart(struct net_device *dev)
FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
#else
/*
- * Only set MII mode - do not touch maximum frame length
+ * Only set MII/RMII mode - do not touch maximum frame length
* configured before.
*/
- FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE);
+ FS(fecp, r_cntrl, (fpi->use_rmii) ?
+ FEC_RCNTRL_RMII_MODE : FEC_RCNTRL_MII_MODE);
#endif
/*
* adjust to duplex mode
@@ -381,7 +382,9 @@ static void stop(struct net_device *dev)
/* shut down FEC1? that's where the mii bus is */
if (fpi->has_phy) {
- FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
+ FS(fecp, r_cntrl, (fpi->use_rmii) ?
+ FEC_RCNTRL_RMII_MODE :
+ FEC_RCNTRL_MII_MODE); /* MII/RMII enable */
FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN);
FW(fecp, ievent, FEC_ENET_MII);
FW(fecp, mii_speed, feci->mii_speed);
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox