* Re: [PATCH net-next-2.6] ipv6: reduce per device ICMP mib sizes
From: David Miller @ 2011-05-19 20:19 UTC (permalink / raw)
To: eric.dumazet; +Cc: denys, netdev
In-Reply-To: <1305803663.3028.39.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 19 May 2011 13:14:23 +0200
> [PATCH net-next-2.6] ipv6: reduce per device ICMP mib sizes.
>
> ipv6 has per device ICMP SNMP counters, taking too much space because
> they use percpu storage.
>
> needed size per device is :
> (512+4)*sizeof(long)*number_of_possible_cpus*2
>
> On a 32bit kernel, 16 possible cpus, this wastes more than 64kbytes of
> memory per ipv6 enabled network device, taken in vmalloc pool.
>
> Since ICMP messages are rare, just use shared counters (atomic_long_t)
>
> Per network space ICMP counters are still using percpu memory, we might
> also convert them to shared counters in a future patch.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH 0/4] rps: Look into tunnels to get hash
From: David Miller @ 2011-05-19 20:19 UTC (permalink / raw)
To: therbert; +Cc: netdev
In-Reply-To: <alpine.DEB.2.00.1105190833050.13026@pokey.mtv.corp.google.com>
From: Tom Herbert <therbert@google.com>
Date: Thu, 19 May 2011 08:38:57 -0700 (PDT)
> The patches in this series are to look into encapsulated packets
> to compute the rx hash for RPS. Before these patches, all packets
> received on the same tunnel would wind up on the same RPS CPU-- this
> can lead to very poor loading, and make RFS ineffective on these
> packets.
>
> This patch supports getting the rxhash out of a GRE encapsulated packet.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH FINAL] SCTP: fix race between sctp_bind_addr_free() and sctp_bind_addr_conflict()
From: David Miller @ 2011-05-19 20:19 UTC (permalink / raw)
To: eric.dumazet; +Cc: difrost.kernel, vladislav.yasevich, netdev
In-Reply-To: <1305835101.3156.6.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 19 May 2011 21:58:21 +0200
> Le jeudi 19 mai 2011 à 21:55 +0200, Jacek Luczak a écrit :
>> During the sctp_close() call, we do not use rcu primitives to
>> destroy the address list attached to the endpoint. At the same
>> time, we do the removal of addresses from this list before
>> attempting to remove the socket from the port hash
>>
>> As a result, it is possible for another process to find the socket
>> in the port hash that is in the process of being closed. It then
>> proceeds to traverse the address list to find the conflict, only
>> to have that address list suddenly disappear without rcu() critical
>> section.
>>
>> Fix issue by closing address list removal inside RCU critical
>> section.
>>
>> Race can result in a kernel crash with general protection fault or
>> kernel NULL pointer dereference:
>>
>
>> Signed-off-by: Jacek Luczak <luczak.jacek@gmail.com>
>> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>> CC: Eric Dumazet <eric.dumazet@gmail.com>
>>
>> ---
>> net/sctp/bind_addr.c | 10 ++++------
>> 1 files changed, 4 insertions(+), 6 deletions(-)
>>
>
> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH v4] ipconfig wait for carrier
From: David Miller @ 2011-05-19 20:19 UTC (permalink / raw)
To: micha; +Cc: netdev
In-Reply-To: <1305836046-21136-1-git-send-email-micha@neli.hopto.org>
From: Micha Nelissen <micha@neli.hopto.org>
Date: Thu, 19 May 2011 22:14:06 +0200
> v3 -> v4: fix return boolean false instead of 0 for ic_is_init_dev
>
> Currently the ip auto configuration has a hardcoded delay of 1 second.
> When (ethernet) link takes longer to come up (e.g. more than 3 seconds),
> nfs root may not be found.
>
> Remove the hardcoded delay, and wait for carrier on at least one network
> device.
>
> Signed-off-by: Micha Nelissen <micha@neli.hopto.org>
> Cc: David Miller <davem@davemloft.net>
Ok, I've applied this, let's see what happens.
^ permalink raw reply
* Re: [PATCH 1/4] rps: Some minor cleanup in get_rps_cpus
From: Eric Dumazet @ 2011-05-19 20:21 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <alpine.DEB.2.00.1105190827480.12796@pokey.mtv.corp.google.com>
Le jeudi 19 mai 2011 à 08:39 -0700, Tom Herbert a écrit :
> Use some variables for clarity and extensibility.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> net/core/dev.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
^ permalink raw reply
* Re: [PATCH 1/2] net: ping: make local functions static
From: David Miller @ 2011-05-19 20:18 UTC (permalink / raw)
To: xiaosuo; +Cc: kuznet, pekkas, jmorris, yoshfuji, kaber, netdev
In-Reply-To: <1305789361-5366-1-git-send-email-xiaosuo@gmail.com>
From: Changli Gao <xiaosuo@gmail.com>
Date: Thu, 19 May 2011 15:16:00 +0800
> As these functions are only used in this file.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2] net: ping: fix the coding style
From: David Miller @ 2011-05-19 20:18 UTC (permalink / raw)
To: xiaosuo; +Cc: kuznet, pekkas, jmorris, yoshfuji, kaber, netdev
In-Reply-To: <1305789361-5366-2-git-send-email-xiaosuo@gmail.com>
From: Changli Gao <xiaosuo@gmail.com>
Date: Thu, 19 May 2011 15:16:01 +0800
> The characters in a line should be no more than 80.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/4] rps: Add flag to skb to indicate rxhash is on L4 tuple
From: Eric Dumazet @ 2011-05-19 20:26 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <alpine.DEB.2.00.1105190827240.12799@pokey.mtv.corp.google.com>
Le jeudi 19 mai 2011 à 08:39 -0700, Tom Herbert a écrit :
> The l4_rxhash flag was added to the skb structure to indicate
> that the rxhash value was computed over the 4 tuple for the
> packet which includes the port information in the encapsulated
> transport packet. This is used by the stack to preserve the
> rxhash value in __skb_rx_tunnel.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> include/linux/skbuff.h | 5 +++--
> include/net/dst.h | 9 ++++++++-
> include/net/sock.h | 14 +++++++++++---
> net/core/dev.c | 17 +++++++++++------
> net/core/skbuff.c | 1 +
> net/ipv4/tcp_ipv4.c | 4 ++--
> net/ipv4/udp.c | 4 ++--
> 7 files changed, 38 insertions(+), 16 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 79aafbb..4fab336 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -397,6 +397,7 @@ struct sk_buff {
> __u8 ndisc_nodetype:2;
> #endif
> __u8 ooo_okay:1;
> + __u8 l4_rxhash:1;
> kmemcheck_bitfield_end(flags2);
>
> /* 0/13 bit hole */
> @@ -555,11 +556,11 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
> unsigned int to, struct ts_config *config,
> struct ts_state *state);
>
> -extern __u32 __skb_get_rxhash(struct sk_buff *skb);
> +extern void __skb_get_rxhash(struct sk_buff *skb);
> static inline __u32 skb_get_rxhash(struct sk_buff *skb)
> {
> if (!skb->rxhash)
> - skb->rxhash = __skb_get_rxhash(skb);
> + __skb_get_rxhash(skb);
>
> return skb->rxhash;
> }
> diff --git a/include/net/dst.h b/include/net/dst.h
> index 07a0402..17ff602 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
> @@ -307,7 +307,14 @@ static inline void skb_dst_force(struct sk_buff *skb)
> static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
> {
> skb->dev = dev;
> - skb->rxhash = 0;
> +
> + /*
> + * Clear rxhash so that we can reculate the hash for the
typo ?
> + * encapsulated packet, unless we have already determine the hash
> + * over the L4 4-tuple.
> + */
> + if (!skb->l4_rxhash)
> + skb->rxhash = 0;
> skb_set_queue_mapping(skb, 0);
> skb_dst_drop(skb);
> nf_reset(skb);
> diff --git a/include/net/sock.h b/include/net/sock.h
> index f2046e4..e670c41 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -685,16 +685,24 @@ static inline void sock_rps_reset_flow(const struct sock *sk)
> #endif
> }
>
> -static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash)
> +static inline void sock_rps_save_rxhash(struct sock *sk, struct sk_buff *skb)
const struct sk_buff *skb ?
> {
> #ifdef CONFIG_RPS
> - if (unlikely(sk->sk_rxhash != rxhash)) {
> + if (unlikely(sk->sk_rxhash != skb->rxhash)) {
> sock_rps_reset_flow(sk);
> - sk->sk_rxhash = rxhash;
> + sk->sk_rxhash = skb->rxhash;
> }
> #endif
> }
>
> +static inline void sock_rps_reset_rxhash(struct sock *sk)
> +{
> +#ifdef CONFIG_RPS
> + sock_rps_reset_flow(sk);
> + sk->sk_rxhash = 0;
> +#endif
> +}
> +
> #define sk_wait_event(__sk, __timeo, __condition) \
> ({ int __rc; \
> release_sock(__sk); \
> diff --git a/net/core/dev.c b/net/core/dev.c
> index a40eea9..37ddece 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2014,8 +2014,10 @@ static inline void skb_orphan_try(struct sk_buff *skb)
> /* skb_tx_hash() wont be able to get sk.
> * We copy sk_hash into skb->rxhash
> */
> - if (!skb->rxhash)
> + if (!skb->rxhash) {
> skb->rxhash = sk->sk_hash;
> + skb->l4_rxhash = 1;
Why do you set l4_rxhash here ?
> + }
> skb_orphan(skb);
> }
> }
> @@ -2499,12 +2501,13 @@ static inline void ____napi_schedule(struct softnet_data *sd,
>
> /*
> * __skb_get_rxhash: calculate a flow hash based on src/dst addresses
> - * and src/dst port numbers. Returns a non-zero hash number on success
> - * and 0 on failure.
> + * and src/dst port numbers. Sets rxhash in skb to non-zero hash value
> + * on success, zero indicates no valid hash. Also, sets l4_rxhash in skb
> + * if hash is a canonical 4-tuple hash over transport ports.
> */
> -__u32 __skb_get_rxhash(struct sk_buff *skb)
> +void __skb_get_rxhash(struct sk_buff *skb)
> {
> - int nhoff, hash = 0, poff;
> + int nhoff, hash = 0, l4hash = 0, poff;
> const struct ipv6hdr *ip6;
> const struct iphdr *ip;
> u8 ip_proto;
> @@ -2554,6 +2557,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
> ports.v32 = * (__force u32 *) (skb->data + nhoff);
> if (ports.v16[1] < ports.v16[0])
> swap(ports.v16[0], ports.v16[1]);
> + l4hash = 1;
maybe directly set skb->l4_rxhash = 1 here ?
> }
> }
>
> @@ -2566,7 +2570,8 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
> hash = 1;
>
> done:
> - return hash;
> + skb->rxhash = hash;
> + skb->l4_rxhash = l4hash;
and remove this line. (gcc is pretty expensive here for a one bit
field)
Thanks
^ permalink raw reply
* Re: [PATCH 3/4] rps: Infrastructure in __skb_get_rxhash for deep inspection
From: Eric Dumazet @ 2011-05-19 20:27 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <alpine.DEB.2.00.1105190828001.12835@pokey.mtv.corp.google.com>
Le jeudi 19 mai 2011 à 08:39 -0700, Tom Herbert a écrit :
> Basics for looking for ports in encapsulated packets in tunnels.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> net/core/dev.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
^ permalink raw reply
* Re: [PATCH] tcp: Implement a two-level initial RTO as per draft RFC 2988bis-02.
From: tsuna @ 2011-05-19 20:30 UTC (permalink / raw)
To: David Miller
Cc: alexander.zimmermann, hagen, kuznet, pekkas, jmorris, yoshfuji,
kaber, eric.dumazet, netdev, linux-kernel
In-Reply-To: <20110519.152703.1327182804872376183.davem@davemloft.net>
On Thu, May 19, 2011 at 12:27 PM, David Miller <davem@davemloft.net> wrote:
> So using SCTP as an example of "see we do this already over here" is a
> non-starter. Don't do it.
Fair enough. I hope that the "there's no one-size-fits-all solution"
argument has more weight than "hey SCTP does it". :)
--
Benoit "tsuna" Sigoure
Software Engineer @ www.StumbleUpon.com
^ permalink raw reply
* GRE RPS patch set
From: David Miller @ 2011-05-19 21:14 UTC (permalink / raw)
To: therbert; +Cc: netdev
I reverted all of it, besides Eric's feedback, I'd like to know if
grep is not working on your computer?
net/ipv6/udp.c: In function ‘udpv6_queue_rcv_skb’:
net/ipv6/udp.c:509:3: warning: passing argument 2 of ‘sock_rps_save_rxhash’ makes pointer from integer without a cast
include/net/sock.h:688:20: note: expected ‘struct sk_buff *’ but argument is of type ‘__u32’
Updating all call sites of a function when you change it's arguments
isn't rocket science. :-)
^ permalink raw reply
* Re: ath5k regression associating with APs in 2.6.38
From: Seth Forshee @ 2011-05-19 21:28 UTC (permalink / raw)
To: Nick Kossifidis
Cc: John W. Linville, Jiri Slaby, Luis R. Rodriguez, Bob Copeland,
linux-wireless, ath5k-devel, netdev, linux-kernel
In-Reply-To: <20110517185032.GC9258@thinkpad-t410>
On Tue, May 17, 2011 at 01:50:32PM -0500, Seth Forshee wrote:
> On Tue, May 17, 2011 at 08:14:34PM +0300, Nick Kossifidis wrote:
> > 2011/5/17 Seth Forshee <seth.forshee@canonical.com>:
> > > On Mon, May 09, 2011 at 09:02:30AM +0200, Seth Forshee wrote:
> > >> On Thu, May 05, 2011 at 05:30:42PM +0300, Nick Kossifidis wrote:
> > >> > Hmm I don't see any errors from reset/phy code, can you disable
> > >> > Network Manager/wpa-supplicant and test connection on an open network
> > >> > using iw ? It 'll give us a better picture...
> > >> >
> > >> > If iw doesn't return any scan results we are probably hitting a PHY/RF
> > >> > error specific to your device (not all vendors follow the reference
> > >> > design). Maybe we should follow a blacklist/whitelist approach for
> > >> > this feature.
> > >>
> > >> I got the results back from my tester. He was able to get scan results,
> > >> but it took multiple tries and the direct probe failures appear in the
> > >> log. He didn't enable ATH5K_DEBUG_RESET this time; let me know if you
> > >> need that and I'll request he retest with the extra debug logs enabled.
> > >
> > > I got some more feedback. Most of the time iw does not get scan results,
> > > but even when it does connecting to the AP isn't always successful. The
> > > tester did note that he doesn't seem to have any trouble if his machine
> > > is within a few feet of his AP. Let me know if you'd like something else
> > > tested.
> > >
> > > I noticed that bugzilla #31922 (ath5k: Decreased throughput in IBSS or
> > > 802.11n mode) is also fixed by reverting 8aec7af9. It seems like the
> > > synth-only channel changes are resulting in poor connection quality.
> > > Maybe that patch needs to be reverted?
> > >
> > > Thanks,
> > > Seth
> > >
> > >
> >
> > http://www.kernel.org/pub/linux/kernel/people/mickflemm/01-fast-chan-switch-modparm
>
> That looks like it should do the trick. I'll request some testing with
> it and let you know how it goes. Thanks!
I've received feedback from a number of testers that the patch fixes the
wireless problems they've been seeing since upgrading to 2.6.38, so this
fix looks good from my perspective.
Thanks,
Seth
^ permalink raw reply
* [PATCH 01/23] add register_chrdev_ids() to char_dev.c, API
From: Jim Cromie @ 2011-05-19 21:33 UTC (permalink / raw)
To: linux-kernel
Cc: Anil Ravindranath, linux-sh, Heiko Carstens, Hans J. Koch,
linux-mtd, Sean Hefty, devel, linux-s390, David Brownell,
linux-scsi, linux-rdma, Paul Mundt, linux-input, osst-users,
Hal Rosenstock, linux-media, Doug Gilbert, Roland Dreier,
rtc-linux, Matthew Wilcox, Boaz Harrosh, Chris Metcalf,
Mauro Carvalho Chehab, Martin Schwidefsky,
subscribers-only <linuxp
In-Reply-To: <1305840792-25877-1-git-send-email-jim.cromie@gmail.com>
register_chrdev_ids() replaces and deprecates register_chrdev_region()
and alloc_chrdev_region() with a single function that works for both
dynamic and static major numbers.
Like alloc_chrdev_region(), 1st arg is a dev_t*, but its an in/out
parameter, and expects both major and minor to be preset, and thus the
separate minor arg is dropped. If major == 0, a dynamic major is
reserved, saved into 1st arg, and thus available to caller afterwards.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
cc: Alessandro Zummo <a.zummo@towertech.it>
cc: Alexander Viro <viro@zeniv.linux.org.uk>
cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
cc: Benny Halevy <bhalevy@panasas.com>
cc: Boaz Harrosh <bharrosh@panasas.com>
cc: Chris Metcalf <cmetcalf@tilera.com>
cc: David Brownell <dbrownell@users.sourceforge.net>
cc: "David S. Miller" <davem@davemloft.net>
cc: David Woodhouse <dwmw2@infradead.org>
cc: devel@driverdev.osuosl.org
cc: Doug Gilbert <dgilbert@interlog.com>
cc: Greg Kroah-Hartman <gregkh@suse.de>
cc: Hal Rosenstock <hal.rosenstock@gmail.com>
cc: "Hans J. Koch" <hjk@hansjkoch.de>
cc: Heiko Carstens <heiko.carstens@de.ibm.com>
cc: Jens Axboe <axboe@kernel.dk>
cc: Jim Cromie <jim.cromie@gmail.com>
cc: Jiri Kosina <jkosina@suse.cz>
cc: Jiri Slaby <jirislaby@gmail.com>
cc: linux390@de.ibm.com
cc: linux-fsdevel@vger.kernel.org
cc: linux-input@vger.kernel.org
cc: linux-kernel@vger.kernel.org
cc: linux-media@vger.kernel.org
cc: linux-mtd@lists.infradead.org
cc: linuxpps@ml.enneenne.com (subscribers-only)
cc: linux-rdma@vger.kernel.org
cc: linux-s390@vger.kernel.org
cc: linux-scsi@vger.kernel.org
cc: linux-sh@vger.kernel.org
cc: linux-usb@vger.kernel.org
cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
cc: Matthew Wilcox <matthew@wil.cx>
cc: Mauro Carvalho Chehab <mchehab@infradead.org>
cc: netdev@vger.kernel.org
cc: osd-dev@open-osd.org
cc: osst-users@lists.sourceforge.net
cc: Paul Mundt <lethal@linux-sh.org>
cc: Rodolfo Giometti <giometti@enneenne.com>
cc: Roland Dreier <roland@kernel.org>
cc: rtc-linux@googlegroups.com
cc: Sean Hefty <sean.hefty@intel.com>
cc: Willem Riede <osst@riede.org>
---
fs/char_dev.c | 33 +++++++++++++++++++++++++++++----
include/linux/fs.h | 6 ++++--
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/fs/char_dev.c b/fs/char_dev.c
index dca9e5e..9149b7c 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -93,7 +93,7 @@ void chrdev_show(struct seq_file *f, off_t offset)
*/
static struct char_device_struct *
__register_chrdev_region(unsigned int major, unsigned int baseminor,
- int minorct, const char *name)
+ int minorct, const char *name)
{
struct char_device_struct *cd, **cp;
int ret = 0;
@@ -193,7 +193,8 @@ __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct)
*
* Return value is zero on success, a negative error code on failure.
*/
-int register_chrdev_region(dev_t from, unsigned count, const char *name)
+int __deprecated
+register_chrdev_region(dev_t from, unsigned count, const char *name)
{
struct char_device_struct *cd;
dev_t to = from + count;
@@ -229,8 +230,9 @@ fail:
* chosen dynamically, and returned (along with the first minor number)
* in @dev. Returns zero or a negative error code.
*/
-int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
- const char *name)
+int __deprecated
+alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
+ const char *name)
{
struct char_device_struct *cd;
cd = __register_chrdev_region(0, baseminor, count, name);
@@ -241,6 +243,28 @@ int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
}
/**
+ * register_chrdev_ids() - register a range of char device numbers
+ * @dev: in/output parameter for requested/claimed device major, minor
+ * @count: the number of minor numbers required
+ * @name: the name of the associated device or driver
+ *
+ * Allocates a range of char device numbers. The major number will be
+ * chosen dynamically if passed as 0, or reserved specifically otherwize,
+ * with reserved numbers written into @dev.
+ * Returns zero, or a negative error code.
+ */
+int register_chrdev_ids(dev_t *dev, unsigned count, const char *name)
+{
+ struct char_device_struct *cd;
+
+ cd = __register_chrdev_region(MAJOR(*dev), MINOR(*dev), count, name);
+ if (IS_ERR(cd))
+ return PTR_ERR(cd);
+ *dev = MKDEV(cd->major, cd->baseminor);
+ return 0;
+}
+
+/**
* __register_chrdev() - create and register a cdev occupying a range of minors
* @major: major device number or 0 for dynamic allocation
* @baseminor: first of the requested range of minor numbers
@@ -566,6 +590,7 @@ void __init chrdev_init(void)
EXPORT_SYMBOL(register_chrdev_region);
EXPORT_SYMBOL(unregister_chrdev_region);
EXPORT_SYMBOL(alloc_chrdev_region);
+EXPORT_SYMBOL(register_chrdev_ids);
EXPORT_SYMBOL(cdev_init);
EXPORT_SYMBOL(cdev_alloc);
EXPORT_SYMBOL(cdev_del);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cdf9495..e72de48 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2075,8 +2075,10 @@ static inline void bd_unlink_disk_holder(struct block_device *bdev,
/* fs/char_dev.c */
#define CHRDEV_MAJOR_HASH_SIZE 255
-extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
-extern int register_chrdev_region(dev_t, unsigned, const char *);
+extern int register_chrdev_ids(dev_t *, unsigned, const char *);
+extern int __deprecated alloc_chrdev_region(dev_t *, unsigned, unsigned,
+ const char *);
+extern int __deprecated register_chrdev_region(dev_t, unsigned, const char *);
extern int __register_chrdev(unsigned int major, unsigned int baseminor,
unsigned int count, const char *name,
const struct file_operations *fops);
--
1.7.4.4
^ permalink raw reply related
* [PATCH] 9p: Kill set but not used variable 'ret' in parse_opts()
From: David Miller @ 2011-05-19 21:39 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/9p/trans_fd.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index aa5672b..4a90843 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -716,7 +716,6 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
substring_t args[MAX_OPT_ARGS];
int option;
char *options, *tmp_options;
- int ret;
opts->port = P9_PORT;
opts->rfd = ~0;
@@ -744,7 +743,6 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
if (r < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
continue;
}
}
--
1.7.4.4
^ permalink raw reply related
* CAIF transmit bug
From: David Miller @ 2011-05-19 21:44 UTC (permalink / raw)
To: sjur.brandeland; +Cc: netdev
net/caif/cfctrl.c:cfctrl_enum_req() does not check the return value of
the ->transmit() method.
The documentation for this method states that one error, ownership
of the packet is transferred back to the caller, which means that we
have a leak here.
Please fix this bug.
^ permalink raw reply
* [PATCH] 9p: Kill unused variable 'ret' in trans_rdma.c:parse_opts()
From: David Miller @ 2011-05-19 21:45 UTC (permalink / raw)
To: netdev
Probably just cut and pasted from the other parse_opts() implementations
in the 9p sources.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/9p/trans_rdma.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 150e0c4..844a7a5 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -167,7 +167,6 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
substring_t args[MAX_OPT_ARGS];
int option;
char *options, *tmp_options;
- int ret;
opts->port = P9_PORT;
opts->sq_depth = P9_RDMA_SQ_DEPTH;
@@ -195,7 +194,6 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
if (r < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
continue;
}
switch (token) {
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 03/13] tg3: Fix 57765 B0 data corruption
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
The PCIe max FTS limit is too aggressive on these chips. This patch
loosens the limit a little to eliminate data corruption issues.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 16 ++++++++++++++++
drivers/net/tg3.h | 4 ++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b2b1ba1..09f2c11 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7990,6 +7990,22 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
tw32(GRC_MODE, grc_mode);
}
+ if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
+ u32 grc_mode = tr32(GRC_MODE);
+
+ /* Access the lower 1K of DL PCIE block registers. */
+ val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
+ tw32(GRC_MODE, val | GRC_MODE_PCIE_DL_SEL);
+
+ val = tr32(TG3_PCIE_TLDLPL_PORT +
+ TG3_PCIE_DL_LO_FTSMAX);
+ val &= ~TG3_PCIE_DL_LO_FTSMAX_MSK;
+ tw32(TG3_PCIE_TLDLPL_PORT + TG3_PCIE_DL_LO_FTSMAX,
+ val | TG3_PCIE_DL_LO_FTSMAX_VAL);
+
+ tw32(GRC_MODE, grc_mode);
+ }
+
val = tr32(TG3_CPMU_LSPD_10MB_CLK);
val &= ~CPMU_LSPD_10MB_MACCLK_MASK;
val |= CPMU_LSPD_10MB_MACCLK_6_25;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index ce010cd3..330959b 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -180,6 +180,7 @@
#define CHIPREV_5750_BX 0x41
#define CHIPREV_5784_AX 0x57840
#define CHIPREV_5761_AX 0x57610
+#define CHIPREV_57765_AX 0x577650
#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff)
#define METAL_REV_A0 0x00
#define METAL_REV_A1 0x01
@@ -1951,6 +1952,9 @@
/* Alternate PCIE definitions */
#define TG3_PCIE_TLDLPL_PORT 0x00007c00
+#define TG3_PCIE_DL_LO_FTSMAX 0x0000000c
+#define TG3_PCIE_DL_LO_FTSMAX_MSK 0x000000ff
+#define TG3_PCIE_DL_LO_FTSMAX_VAL 0x0000002c
#define TG3_PCIE_PL_LO_PHYCTL1 0x00000004
#define TG3_PCIE_PL_LO_PHYCTL1_L1PLLPD_EN 0x00001000
#define TG3_PCIE_PL_LO_PHYCTL5 0x00000014
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 01/13] tg3: Set tx bug flags for more devices
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
It has been recently discovered that all tg3 devices have a 4Gb boundary
DMA problem, and that all 5755 and newer devices can't handle fragments
less than or equal to 8 bytes in size. This patch adjusts the flags and
removes tg3_start_xmit(). tg3_start_xmit_dma_bug() has been renamed to
tg3_start_xmit().
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 262 +++++++----------------------------------------------
1 files changed, 33 insertions(+), 229 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d5a1f9e..4c44168 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5735,7 +5735,28 @@ static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping,
#endif
}
-static void tg3_set_txd(struct tg3_napi *, int, dma_addr_t, int, u32, u32);
+static void tg3_set_txd(struct tg3_napi *tnapi, int entry,
+ dma_addr_t mapping, int len, u32 flags,
+ u32 mss_and_is_end)
+{
+ struct tg3_tx_buffer_desc *txd = &tnapi->tx_ring[entry];
+ int is_end = (mss_and_is_end & 0x1);
+ u32 mss = (mss_and_is_end >> 1);
+ u32 vlan_tag = 0;
+
+ if (is_end)
+ flags |= TXD_FLAG_END;
+ if (flags & TXD_FLAG_VLAN) {
+ vlan_tag = flags >> 16;
+ flags &= 0xffff;
+ }
+ vlan_tag |= (mss << TXD_MSS_SHIFT);
+
+ txd->addr_hi = ((u64) mapping >> 32);
+ txd->addr_lo = ((u64) mapping & 0xffffffff);
+ txd->len_flags = (len << TXD_LEN_SHIFT) | flags;
+ txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT;
+}
/* Workaround 4GB and 40-bit hardware DMA bugs. */
static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
@@ -5818,202 +5839,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
return ret;
}
-static void tg3_set_txd(struct tg3_napi *tnapi, int entry,
- dma_addr_t mapping, int len, u32 flags,
- u32 mss_and_is_end)
-{
- struct tg3_tx_buffer_desc *txd = &tnapi->tx_ring[entry];
- int is_end = (mss_and_is_end & 0x1);
- u32 mss = (mss_and_is_end >> 1);
- u32 vlan_tag = 0;
-
- if (is_end)
- flags |= TXD_FLAG_END;
- if (flags & TXD_FLAG_VLAN) {
- vlan_tag = flags >> 16;
- flags &= 0xffff;
- }
- vlan_tag |= (mss << TXD_MSS_SHIFT);
-
- txd->addr_hi = ((u64) mapping >> 32);
- txd->addr_lo = ((u64) mapping & 0xffffffff);
- txd->len_flags = (len << TXD_LEN_SHIFT) | flags;
- txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT;
-}
-
-/* hard_start_xmit for devices that don't have any bugs and
- * support TG3_FLAG_HW_TSO_2 and TG3_FLAG_HW_TSO_3 only.
- */
-static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
- struct net_device *dev)
-{
- struct tg3 *tp = netdev_priv(dev);
- u32 len, entry, base_flags, mss;
- dma_addr_t mapping;
- struct tg3_napi *tnapi;
- struct netdev_queue *txq;
- unsigned int i, last;
-
- txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
- tnapi = &tp->napi[skb_get_queue_mapping(skb)];
- if (tg3_flag(tp, ENABLE_TSS))
- tnapi++;
-
- /* We are running in BH disabled context with netif_tx_lock
- * and TX reclaim runs via tp->napi.poll inside of a software
- * interrupt. Furthermore, IRQ processing runs lockless so we have
- * no IRQ context deadlocks to worry about either. Rejoice!
- */
- if (unlikely(tg3_tx_avail(tnapi) <= (skb_shinfo(skb)->nr_frags + 1))) {
- if (!netif_tx_queue_stopped(txq)) {
- netif_tx_stop_queue(txq);
-
- /* This is a hard error, log it. */
- netdev_err(dev,
- "BUG! Tx Ring full when queue awake!\n");
- }
- return NETDEV_TX_BUSY;
- }
-
- entry = tnapi->tx_prod;
- base_flags = 0;
- mss = skb_shinfo(skb)->gso_size;
- if (mss) {
- int tcp_opt_len, ip_tcp_len;
- u32 hdrlen;
-
- if (skb_header_cloned(skb) &&
- pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
- dev_kfree_skb(skb);
- goto out_unlock;
- }
-
- if (skb_is_gso_v6(skb)) {
- hdrlen = skb_headlen(skb) - ETH_HLEN;
- } else {
- struct iphdr *iph = ip_hdr(skb);
-
- tcp_opt_len = tcp_optlen(skb);
- ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
-
- iph->check = 0;
- iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
- hdrlen = ip_tcp_len + tcp_opt_len;
- }
-
- if (tg3_flag(tp, HW_TSO_3)) {
- mss |= (hdrlen & 0xc) << 12;
- if (hdrlen & 0x10)
- base_flags |= 0x00000010;
- base_flags |= (hdrlen & 0x3e0) << 5;
- } else
- mss |= hdrlen << 9;
-
- base_flags |= (TXD_FLAG_CPU_PRE_DMA |
- TXD_FLAG_CPU_POST_DMA);
-
- tcp_hdr(skb)->check = 0;
-
- } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
- base_flags |= TXD_FLAG_TCPUDP_CSUM;
- }
-
- if (vlan_tx_tag_present(skb))
- base_flags |= (TXD_FLAG_VLAN |
- (vlan_tx_tag_get(skb) << 16));
-
- len = skb_headlen(skb);
-
- /* Queue skb data, a.k.a. the main skb fragment. */
- mapping = pci_map_single(tp->pdev, skb->data, len, PCI_DMA_TODEVICE);
- if (pci_dma_mapping_error(tp->pdev, mapping)) {
- dev_kfree_skb(skb);
- goto out_unlock;
- }
-
- tnapi->tx_buffers[entry].skb = skb;
- dma_unmap_addr_set(&tnapi->tx_buffers[entry], mapping, mapping);
-
- if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
- !mss && skb->len > VLAN_ETH_FRAME_LEN)
- base_flags |= TXD_FLAG_JMB_PKT;
-
- tg3_set_txd(tnapi, entry, mapping, len, base_flags,
- (skb_shinfo(skb)->nr_frags == 0) | (mss << 1));
-
- entry = NEXT_TX(entry);
-
- /* Now loop through additional data fragments, and queue them. */
- if (skb_shinfo(skb)->nr_frags > 0) {
- last = skb_shinfo(skb)->nr_frags - 1;
- for (i = 0; i <= last; i++) {
- skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-
- len = frag->size;
- mapping = pci_map_page(tp->pdev,
- frag->page,
- frag->page_offset,
- len, PCI_DMA_TODEVICE);
- if (pci_dma_mapping_error(tp->pdev, mapping))
- goto dma_error;
-
- tnapi->tx_buffers[entry].skb = NULL;
- dma_unmap_addr_set(&tnapi->tx_buffers[entry], mapping,
- mapping);
-
- tg3_set_txd(tnapi, entry, mapping, len,
- base_flags, (i == last) | (mss << 1));
-
- entry = NEXT_TX(entry);
- }
- }
-
- /* Packets are ready, update Tx producer idx local and on card. */
- tw32_tx_mbox(tnapi->prodmbox, entry);
-
- tnapi->tx_prod = entry;
- if (unlikely(tg3_tx_avail(tnapi) <= (MAX_SKB_FRAGS + 1))) {
- netif_tx_stop_queue(txq);
-
- /* netif_tx_stop_queue() must be done before checking
- * checking tx index in tg3_tx_avail() below, because in
- * tg3_tx(), we update tx index before checking for
- * netif_tx_queue_stopped().
- */
- smp_mb();
- if (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi))
- netif_tx_wake_queue(txq);
- }
-
-out_unlock:
- mmiowb();
-
- return NETDEV_TX_OK;
-
-dma_error:
- last = i;
- entry = tnapi->tx_prod;
- tnapi->tx_buffers[entry].skb = NULL;
- pci_unmap_single(tp->pdev,
- dma_unmap_addr(&tnapi->tx_buffers[entry], mapping),
- skb_headlen(skb),
- PCI_DMA_TODEVICE);
- for (i = 0; i <= last; i++) {
- skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
- entry = NEXT_TX(entry);
-
- pci_unmap_page(tp->pdev,
- dma_unmap_addr(&tnapi->tx_buffers[entry],
- mapping),
- frag->size, PCI_DMA_TODEVICE);
- }
-
- dev_kfree_skb(skb);
- return NETDEV_TX_OK;
-}
-
-static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *,
- struct net_device *);
+static netdev_tx_t tg3_start_xmit(struct sk_buff *, struct net_device *);
/* Use GSO to workaround a rare TSO bug that may be triggered when the
* TSO header is greater than 80 bytes.
@@ -6047,7 +5873,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
nskb = segs;
segs = segs->next;
nskb->next = NULL;
- tg3_start_xmit_dma_bug(nskb, tp->dev);
+ tg3_start_xmit(nskb, tp->dev);
} while (segs);
tg3_tso_bug_end:
@@ -6059,8 +5885,7 @@ tg3_tso_bug_end:
/* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and
* support TG3_FLAG_HW_TSO_1 or firmware TSO only.
*/
-static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
- struct net_device *dev)
+static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct tg3 *tp = netdev_priv(dev);
u32 len, entry, base_flags, mss;
@@ -13857,14 +13682,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
}
}
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
+ /* All chips can get confused if TX buffers
+ * straddle the 4GB address boundary.
+ */
+ tg3_flag_set(tp, 4G_DMA_BNDRY_BUG);
+
+ if (tg3_flag(tp, 5755_PLUS))
tg3_flag_set(tp, SHORT_DMA_BUG);
- else if (!tg3_flag(tp, 5755_PLUS)) {
- tg3_flag_set(tp, 4G_DMA_BNDRY_BUG);
+ else
tg3_flag_set(tp, 40BIT_DMA_LIMIT_BUG);
- }
if (tg3_flag(tp, 5717_PLUS))
tg3_flag_set(tp, LRG_PROD_RING_CAP);
@@ -15092,23 +14918,6 @@ static const struct net_device_ops tg3_netdev_ops = {
#endif
};
-static const struct net_device_ops tg3_netdev_ops_dma_bug = {
- .ndo_open = tg3_open,
- .ndo_stop = tg3_close,
- .ndo_start_xmit = tg3_start_xmit_dma_bug,
- .ndo_get_stats64 = tg3_get_stats64,
- .ndo_validate_addr = eth_validate_addr,
- .ndo_set_multicast_list = tg3_set_rx_mode,
- .ndo_set_mac_address = tg3_set_mac_addr,
- .ndo_do_ioctl = tg3_ioctl,
- .ndo_tx_timeout = tg3_tx_timeout,
- .ndo_change_mtu = tg3_change_mtu,
- .ndo_set_features = tg3_set_features,
-#ifdef CONFIG_NET_POLL_CONTROLLER
- .ndo_poll_controller = tg3_poll_controller,
-#endif
-};
-
static int __devinit tg3_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -15205,6 +15014,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
dev->ethtool_ops = &tg3_ethtool_ops;
dev->watchdog_timeo = TG3_TX_TIMEOUT;
+ dev->netdev_ops = &tg3_netdev_ops;
dev->irq = pdev->irq;
err = tg3_get_invariants(tp);
@@ -15214,12 +15024,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
goto err_out_iounmap;
}
- if (tg3_flag(tp, 5755_PLUS) && !tg3_flag(tp, 5717_PLUS))
- dev->netdev_ops = &tg3_netdev_ops;
- else
- dev->netdev_ops = &tg3_netdev_ops_dma_bug;
-
-
/* The EPB bridge inside 5714, 5715, and 5780 and any
* device behind the EPB cannot support DMA addresses > 40-bit.
* On 64-bit systems with IOMMU, use 40-bit dma_mask.
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 13/13] tg3: Update version to 3.119
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch updates the tg3 version to 3.119.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8311f8e..012ce70 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -88,10 +88,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
#define DRV_MODULE_NAME "tg3"
#define TG3_MAJ_NUM 3
-#define TG3_MIN_NUM 118
+#define TG3_MIN_NUM 119
#define DRV_MODULE_VERSION \
__stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
-#define DRV_MODULE_RELDATE "April 22, 2011"
+#define DRV_MODULE_RELDATE "May 18, 2011"
#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 10/13] tg3: Consolidate all netdev feature assignments
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch consolidates all the netdev feature bit assignments to one
location.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 51 ++++++++++++++++++++++++---------------------------
1 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 09fe067..5bf2ce1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -13602,19 +13602,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tg3_flag(tp, 5750_PLUS))
tg3_flag_set(tp, 5705_PLUS);
- /* 5700 B0 chips do not support checksumming correctly due
- * to hardware bugs.
- */
- if (tp->pci_chip_rev_id != CHIPREV_ID_5700_B0) {
- u32 features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
-
- if (tg3_flag(tp, 5755_PLUS))
- features |= NETIF_F_IPV6_CSUM;
- tp->dev->features |= features;
- tp->dev->hw_features |= features;
- tp->dev->vlan_features |= features;
- }
-
/* Determine TSO capabilities */
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
; /* Do nothing. HW bug. */
@@ -14922,7 +14909,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
u32 sndmbx, rcvmbx, intmbx;
char str[40];
u64 dma_mask, persist_dma_mask;
- u32 hw_features = 0;
+ u32 features = 0;
printk_once(KERN_INFO "%s\n", version);
@@ -14958,8 +14945,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
SET_NETDEV_DEV(dev, &pdev->dev);
- dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-
tp = netdev_priv(dev);
tp->pdev = pdev;
tp->dev = dev;
@@ -15039,7 +15024,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
if (dma_mask > DMA_BIT_MASK(32)) {
err = pci_set_dma_mask(pdev, dma_mask);
if (!err) {
- dev->features |= NETIF_F_HIGHDMA;
+ features |= NETIF_F_HIGHDMA;
err = pci_set_consistent_dma_mask(pdev,
persist_dma_mask);
if (err < 0) {
@@ -15060,6 +15045,18 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
tg3_init_bufmgr_config(tp);
+ features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+
+ /* 5700 B0 chips do not support checksumming correctly due
+ * to hardware bugs.
+ */
+ if (tp->pci_chip_rev_id != CHIPREV_ID_5700_B0) {
+ features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+
+ if (tg3_flag(tp, 5755_PLUS))
+ features |= NETIF_F_IPV6_CSUM;
+ }
+
/* TSO is on by default on chips that support hardware TSO.
* Firmware TSO on older chips gives lower performance, so it
* is off by default, but can be enabled using ethtool.
@@ -15067,24 +15064,20 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
if ((tg3_flag(tp, HW_TSO_1) ||
tg3_flag(tp, HW_TSO_2) ||
tg3_flag(tp, HW_TSO_3)) &&
- (dev->features & NETIF_F_IP_CSUM))
- hw_features |= NETIF_F_TSO;
+ (features & NETIF_F_IP_CSUM))
+ features |= NETIF_F_TSO;
if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) {
- if (dev->features & NETIF_F_IPV6_CSUM)
- hw_features |= NETIF_F_TSO6;
+ if (features & NETIF_F_IPV6_CSUM)
+ features |= NETIF_F_TSO6;
if (tg3_flag(tp, HW_TSO_3) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
- hw_features |= NETIF_F_TSO_ECN;
+ features |= NETIF_F_TSO_ECN;
}
- dev->hw_features |= hw_features;
- dev->features |= hw_features;
- dev->vlan_features |= hw_features;
-
/*
* Add loopback capability only for a subset of devices that support
* MAC-LOOPBACK. Eventually this need to be enhanced to allow INT-PHY
@@ -15093,7 +15086,11 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780 &&
!tg3_flag(tp, CPMU_PRESENT))
/* Add the loopback capability */
- dev->hw_features |= NETIF_F_LOOPBACK;
+ features |= NETIF_F_LOOPBACK;
+
+ dev->features |= features;
+ dev->hw_features |= features;
+ dev->vlan_features |= features;
if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 &&
!tg3_flag(tp, TSO_CAPABLE) &&
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 11/13] tg3: Remove excessive parenthesis
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch removes some excessive parenthesizing.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5bf2ce1..eb8dc7b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -553,7 +553,7 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
{
unsigned long flags;
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) &&
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
(off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC))
return;
@@ -578,7 +578,7 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
{
unsigned long flags;
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) &&
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
(off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) {
*val = 0;
return;
@@ -2806,7 +2806,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
CLOCK_CTRL_PWRDOWN_PLL133, 40);
} else if (tg3_flag(tp, 5780_CLASS) ||
tg3_flag(tp, CPMU_PRESENT) ||
- (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)) {
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
/* do nothing */
} else if (!(tg3_flag(tp, 5750_PLUS) && tg3_flag(tp, ENABLE_ASF))) {
u32 newbits1, newbits2;
@@ -8646,7 +8646,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
}
if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
- (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) {
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) {
u32 tmp;
tmp = tr32(SERDES_RX_CTRL);
@@ -11636,7 +11636,7 @@ static void __devinit tg3_get_nvram_info(struct tg3 *tp)
tw32(NVRAM_CFG1, nvcfg1);
}
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) ||
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
tg3_flag(tp, 5780_CLASS)) {
switch (nvcfg1 & NVRAM_CFG1_VENDOR_MASK) {
case FLASH_VENDOR_ATMEL_FLASH_BUFFERED:
@@ -12640,9 +12640,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
tg3_read_mem(tp, NIC_SRAM_DATA_VER, &ver);
ver >>= NIC_SRAM_DATA_VER_SHIFT;
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) &&
- (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) &&
- (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5703) &&
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
+ GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701 &&
+ GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5703 &&
(ver > 0) && (ver < 0x100))
tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &cfg2);
@@ -13498,7 +13498,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
}
}
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) {
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
static struct tg3_dev_id {
u32 vendor;
u32 device;
@@ -13598,7 +13598,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tg3_flag(tp, 5780_CLASS))
tg3_flag_set(tp, 5750_PLUS);
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) ||
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
tg3_flag(tp, 5750_PLUS))
tg3_flag_set(tp, 5705_PLUS);
@@ -13627,9 +13627,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
}
/* Selectively allow TSO based on operating conditions */
- if ((tg3_flag(tp, HW_TSO_1) ||
- tg3_flag(tp, HW_TSO_2) ||
- tg3_flag(tp, HW_TSO_3)) ||
+ if (tg3_flag(tp, HW_TSO_1) ||
+ tg3_flag(tp, HW_TSO_2) ||
+ tg3_flag(tp, HW_TSO_3) ||
(tp->fw_needed && !tg3_flag(tp, ENABLE_ASF)))
tg3_flag_set(tp, TSO_CAPABLE);
else {
@@ -13891,7 +13891,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
* It is also used as eeprom write protect on LOMs.
*/
tp->grc_local_ctrl = GRC_LCLCTRL_INT_ON_ATTN | GRC_LCLCTRL_AUTO_SEEPROM;
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
tg3_flag(tp, EEPROM_WRITE_PROT))
tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
GRC_LCLCTRL_GPIO_OUTPUT1);
@@ -13943,8 +13943,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->phy_flags |= TG3_PHYFLG_IS_FET;
/* A few boards don't want Ethernet@WireSpeed phy feature */
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
- ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
+ (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
(tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
(tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) ||
(tp->phy_flags & TG3_PHYFLG_IS_FET) ||
@@ -14064,7 +14064,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tg3_flag_set(tp, IS_5788);
if (!tg3_flag(tp, IS_5788) &&
- (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700))
+ GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
tg3_flag_set(tp, TAGGED_STATUS);
if (tg3_flag(tp, TAGGED_STATUS)) {
tp->coalesce_mode |= (HOSTCC_MODE_CLRTICK_RXBD |
@@ -14215,7 +14215,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
#endif
mac_offset = 0x7c;
- if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
tg3_flag(tp, 5780_CLASS)) {
if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID)
mac_offset = 0xcc;
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 09/13] tg3: Move TSO_CAPABLE assignment
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch moves the code that asserts the TSO_CAPABLE flag closer to
where the TSO capabilities flags are set. There isn't a good enough
reason for the code to be separated.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 574fe97..09fe067 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -13639,6 +13639,21 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->fw_needed = FIRMWARE_TG3TSO;
}
+ /* Selectively allow TSO based on operating conditions */
+ if ((tg3_flag(tp, HW_TSO_1) ||
+ tg3_flag(tp, HW_TSO_2) ||
+ tg3_flag(tp, HW_TSO_3)) ||
+ (tp->fw_needed && !tg3_flag(tp, ENABLE_ASF)))
+ tg3_flag_set(tp, TSO_CAPABLE);
+ else {
+ tg3_flag_clear(tp, TSO_CAPABLE);
+ tg3_flag_clear(tp, TSO_BUG);
+ tp->fw_needed = NULL;
+ }
+
+ if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0)
+ tp->fw_needed = FIRMWARE_TG3;
+
tp->irq_max = 1;
if (tg3_flag(tp, 5750_PLUS)) {
@@ -13705,6 +13720,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
tg3_flag_clear(tp, HW_TSO_2);
+ tg3_flag_clear(tp, TSO_CAPABLE);
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
tp->pci_chip_rev_id == CHIPREV_ID_57780_A0 ||
@@ -15044,21 +15060,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
tg3_init_bufmgr_config(tp);
- /* Selectively allow TSO based on operating conditions */
- if ((tg3_flag(tp, HW_TSO_1) ||
- tg3_flag(tp, HW_TSO_2) ||
- tg3_flag(tp, HW_TSO_3)) ||
- (tp->fw_needed && !tg3_flag(tp, ENABLE_ASF)))
- tg3_flag_set(tp, TSO_CAPABLE);
- else {
- tg3_flag_clear(tp, TSO_CAPABLE);
- tg3_flag_clear(tp, TSO_BUG);
- tp->fw_needed = NULL;
- }
-
- if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0)
- tp->fw_needed = FIRMWARE_TG3;
-
/* TSO is on by default on chips that support hardware TSO.
* Firmware TSO on older chips gives lower performance, so it
* is off by default, but can be enabled using ethtool.
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 00/13] tg3: Latest bugfixes
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patchset integrates some of our latest bugfixes.
^ permalink raw reply
* [PATCH net-next 12/13] tg3: Apply rx_discards fix to 5719/5720
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
Commit 4d95847381228639844c7197deb8b2211274ef22, entitled
"tg3: Workaround rx_discards stat bug", was intended to be applied to
the 5717, 5718, 5719_A0, and 5720 A0 chip revisions. The implementation
missed the latter two when applying the fix in a critical area. This
patch fixes the problem.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
---
drivers/net/tg3.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index eb8dc7b..8311f8e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8797,7 +8797,9 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp)
TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE);
TG3_STAT_ADD32(&sp->rxbds_empty, RCVLPC_NO_RCV_BD_CNT);
- if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) {
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717 &&
+ tp->pci_chip_rev_id != CHIPREV_ID_5719_A0 &&
+ tp->pci_chip_rev_id != CHIPREV_ID_5720_A0) {
TG3_STAT_ADD32(&sp->rx_discards, RCVLPC_IN_DISCARDS_CNT);
} else {
u32 val = tr32(HOSTCC_FLOW_ATTN);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 08/13] tg3: Fix stats for 5704 and later devices
From: Matt Carlson @ 2011-05-19 22:12 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
Commit 4d95847381228639844c7197deb8b2211274ef22, entitled
"tg3: Workaround rx_discards stat bug" modified the hardware statistics
data structure. The modification shifted the statistics so that the
labels no longer corresponded to the counter values. This patch fixes
the problem by utilizing reserved space for the new counters.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 7 +++++--
drivers/net/tg3.h | 10 ++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d05c6a0..574fe97 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -364,7 +364,6 @@ static const struct {
{ "dma_write_prioq_full" },
{ "rxbds_empty" },
{ "rx_discards" },
- { "mbuf_lwm_thresh_hit" },
{ "rx_errors" },
{ "rx_threshold_hit" },
@@ -376,7 +375,9 @@ static const struct {
{ "ring_status_update" },
{ "nic_irqs" },
{ "nic_avoided_irqs" },
- { "nic_tx_threshold_hit" }
+ { "nic_tx_threshold_hit" },
+
+ { "mbuf_lwm_thresh_hit" },
};
#define TG3_NUM_STATS ARRAY_SIZE(ethtool_stats_keys)
@@ -9546,6 +9547,8 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
ESTAT_ADD(nic_avoided_irqs);
ESTAT_ADD(nic_tx_threshold_hit);
+ ESTAT_ADD(mbuf_lwm_thresh_hit);
+
return estats;
}
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 83f45bf..5b3d2f3 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2620,7 +2620,6 @@ struct tg3_hw_stats {
tg3_stat64_t dma_write_prioq_full;
tg3_stat64_t rxbds_empty;
tg3_stat64_t rx_discards;
- tg3_stat64_t mbuf_lwm_thresh_hit;
tg3_stat64_t rx_errors;
tg3_stat64_t rx_threshold_hit;
@@ -2639,7 +2638,12 @@ struct tg3_hw_stats {
tg3_stat64_t nic_avoided_irqs;
tg3_stat64_t nic_tx_threshold_hit;
- u8 __reserved4[0xb00-0x9c0];
+ /* NOT a part of the hardware statistics block format.
+ * These stats are here as storage for tg3_periodic_fetch_stats().
+ */
+ tg3_stat64_t mbuf_lwm_thresh_hit;
+
+ u8 __reserved4[0xb00-0x9c8];
};
/* 'mapping' is superfluous as the chip does not write into
@@ -2771,6 +2775,8 @@ struct tg3_ethtool_stats {
u64 nic_irqs;
u64 nic_avoided_irqs;
u64 nic_tx_threshold_hit;
+
+ u64 mbuf_lwm_thresh_hit;
};
struct tg3_rx_prodring_set {
--
1.7.3.4
^ 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