Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH V4] Export ACPI _DSM provided firmware instance number and string name to sysfs
From: Narendra_K @ 2011-03-04 16:28 UTC (permalink / raw)
  To: linux-pci, linux-hotplug
  Cc: netdev, mjg, Matt_Domsch, Charles_Rose, Jordan_Hargrave,
	Shyam_Iyer, sfr
In-Reply-To: <20110302172508.GA2794@fedora14-r610.oslab.blr.amer.dell.com>

On Wed, Mar 02, 2011 at 10:34:17PM +0530, K, Narendra wrote:
> On Wed, Feb 23, 2011 at 06:06:42PM +0530, K, Narendra wrote:
> > Hello,
> >
> > This patch exports ACPI _DSM provided firmware instance number and
> > string name to sysfs.
> >
> > V1 -> V2:
> > The attribute 'index' is changed to 'acpi_index' as the semantics of
> > SMBIOS provided device type instance and ACPI _DSM provided firmware
> > instance number are different.
> >
> > V2 -> V3:
> > Matthew Garrett pointed out that 'sysfs_create_groups' does return an
> > error when there are no ACPI _DSM attributes available and because of
> > that the fallback to SMBIOS will not happen. As a result SMBIOS provided
> > attributes are not created. This version of the patch addresses the issue.
> >
> 
> V3 -> V4:
> Select NLS if (DMI || ACPI) in drivers/pci/Kconfig to prevent build
> breakage from an 'allmodconfig'
> 
> Matthew,
> Thanks for the suggestion.
> 
> From: Narendra K <narendra_k@dell.com>
> Subject: [PATCH] Export ACPI _DSM provided firmware instance number and string to sysfs
>

Hi Jesse,

Does Version 4 of the patch look good for inclusion ? Please let us know
if there are any concerns.

With regards,
Narendra K 

^ permalink raw reply

* Re: [PATCH] net: Enter net/ipv6/ even if CONFIG_IPV6=n
From: Randy Dunlap @ 2011-03-04 17:01 UTC (permalink / raw)
  To: davem, Patrick McHardy, Stephen Rothwell, netdev, linux-next
In-Reply-To: <20110304093507.GG10761@canuck.infradead.org>

On 03/04/11 01:35, Thomas Graf wrote:
> exthdrs_core.c and addrconf_core.c in net/ipv6/ contain bits which
> must be made available even if IPv6 is disabled.
> 
> net/ipv6/Makefile already correctly includes them if CONFIG_IPV6=n
> but net/Makefile prevents entering the subdirectory.
> 
> Signed-off-by: Thomas Graf <tgraf@infradead.org>

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

Thanks.

> 
> diff --git a/net/Makefile b/net/Makefile
> index a3330eb..a51d946 100644
> --- a/net/Makefile
> +++ b/net/Makefile
> @@ -19,9 +19,7 @@ obj-$(CONFIG_NETFILTER)		+= netfilter/
>  obj-$(CONFIG_INET)		+= ipv4/
>  obj-$(CONFIG_XFRM)		+= xfrm/
>  obj-$(CONFIG_UNIX)		+= unix/
> -ifneq ($(CONFIG_IPV6),)
> -obj-y				+= ipv6/
> -endif
> +obj-$(CONFIG_NET)		+= ipv6/
>  obj-$(CONFIG_PACKET)		+= packet/
>  obj-$(CONFIG_NET_KEY)		+= key/
>  obj-$(CONFIG_BRIDGE)		+= bridge/


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: [PATCH] sched: QFQ - quick fair queue scheduler (v4)
From: Stephen Hemminger @ 2011-03-04 17:17 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Fabio Checconi, Luigi Rizzo, netdev
In-Reply-To: <1299221426.2547.47.camel@edumazet-laptop>

On Fri, 04 Mar 2011 07:50:26 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le jeudi 03 mars 2011 à 16:30 -0800, Stephen Hemminger a écrit :
> > This is an implementation of the Quick Fair Queue scheduler developed
> > by Fabio Checconi. The same algorithm is already implemented in ipfw
> > in FreeBSD. Fabio had an earlier version developed on Linux, I just
> > cleaned it up.  Thanks to Eric Dumazet for doing the testing and
> > finding bugs.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > 
> > ---
> > v4 - change slots[] to hlist from simple linked list
> > 
> >  include/linux/pkt_sched.h |   15 
> >  net/sched/Kconfig         |   11 
> >  net/sched/Makefile        |    1 
> >  net/sched/sch_qfq.c       | 1133 ++++++++++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 1160 insertions(+)
> 
> Thanks
> 
> Still crashing hard here in qfq_reset_qdisc(), when packets are present
> in queues.
> 
> Probably hlist_for_each_entry_safe() is needed, since
> qfq_deactivate_class() is called ...
> 
> Also rename cl->next to cl->hnode so that following is clearer ?
> 
> -	hlist_for_each_entry(cl, n, &grp->slots[j], next) {
> +	hlist_for_each_entry_safe(cl, n, next, &grp->slots[j], hnode) {
> 
> Fabio, any idea why everything is blocked after a few packets for me ?
> 
> Here is script to reproduce the problem :
> 
> # cat qfq_setup.sh
> modprobe dummy
> 
> ifconfig dummy0 10.2.2.254 netmask 255.255.255.0 up
> 
> for i in `seq 1 16`
> do
>  arp -H ether -i dummy0 -s 10.2.2.$i 00:00:0c:07:ac:$(printf %02x $i)
> done
> 
> DEV=dummy0
> RATE="rate 40Mbit"
> TNETS="10.2.2.0/25"
> ALLOT="allot 20000"
> 
> tc qdisc del dev dummy0 root 2>/dev/null
> 
> tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 rate 1000Mbit \
> 	bandwidth 1000Mbit
> tc class add dev $DEV parent 1: classid 1:1 \
> 	est 1sec 8sec cbq allot 10000 mpu 64 \
> 	rate 1000Mbit prio 1 avpkt 1500 bounded
> 
> # output to test nets :  40 Mbit limit
> tc class add dev $DEV parent 1:1 classid 1:11 \
> 	est 1sec 8sec cbq $ALLOT mpu 64      \
> 	$RATE prio 2 avpkt 1400 bounded
> 
> tc qdisc add dev $DEV parent 1:11 handle 11:  \
> 	est 1sec 8sec qfq
> 
> tc filter add dev $DEV protocol ip parent 11: handle 3 \
> 	flow hash keys rxhash divisor 8
> 
> for i in `seq 1 8`
> do
>  classid=11:$(printf %x $i)
>  tc class add dev $DEV classid $classid qfq 
>  tc qdisc add dev $DEV parent $classid pfifo limit 30
> done
> 
> 
> for privnet in $TNETS
> do
> 	tc filter add dev $DEV parent 1: protocol ip prio 100 u32 \
> 		match ip dst $privnet flowid 1:11
> done
> 
> tc filter add dev $DEV parent 1: protocol ip prio 100 u32 \
> 	match ip protocol 0 0x00 flowid 1:1
> 
> 
> iperf -u -c 10.2.2.1 -P 32 -l 50
> 
> 
> ------------------------------------------------------------------------------
> 
> After a run I get only 5 packets sent, 240 queued in backlog, and all
> other packets dropped.
> 
> # tc -s -d qdisc show dev dummy0
> qdisc cbq 1: root refcnt 2 rate 1000Mbit cell 8b (bounded,isolated) prio
> no-transmit/8 weight 1000Mbit allot 1514b 
> level 2 ewma 5 avpkt 1000b maxidle 0us 
>  Sent 460 bytes 5 pkt (dropped 198800, overlimits 199043 requeues 0) 
>  backlog 0b 240p requeues 0 
>   borrowed 0 overactions 0 avgidle 125 undertime 0
> qdisc qfq 11: parent 1:11 
>  Sent 460 bytes 5 pkt (dropped 198800, overlimits 0 requeues 0) 
>  rate 0bit 0pps backlog 0b 240p requeues 0 
> qdisc pfifo 8011: parent 11:1 limit 30p
>  Sent 0 bytes 0 pkt (dropped 6178, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8012: parent 11:2 limit 30p
>  Sent 92 bytes 1 pkt (dropped 37048, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8013: parent 11:3 limit 30p
>  Sent 0 bytes 0 pkt (dropped 24856, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8014: parent 11:4 limit 30p
>  Sent 276 bytes 3 pkt (dropped 37358, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8015: parent 11:5 limit 30p
>  Sent 0 bytes 0 pkt (dropped 24934, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8016: parent 11:6 limit 30p
>  Sent 0 bytes 0 pkt (dropped 24882, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8017: parent 11:7 limit 30p
>  Sent 0 bytes 0 pkt (dropped 12328, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> qdisc pfifo 8018: parent 11:8 limit 30p
>  Sent 92 bytes 1 pkt (dropped 31216, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> 
> 
> and :
> 
> # tc -s -d class show dev dummy0
> class cbq 1:11 parent 1:1 leaf 11: rate 40000Kbit cell 128b mpu 64b
> (bounded) prio 2/2 weight 40000Kbit allot 20000b 
> level 0 ewma 5 avpkt 1400b maxidle 0us 
>  Sent 460 bytes 5 pkt (dropped 198800, overlimits 15 requeues 0) 
>  rate 0bit 0pps backlog 0b 240p requeues 0 
>   borrowed 0 overactions 3 avgidle -225 undertime -6.46702e+07
> class cbq 1: root rate 1000Mbit cell 8b (bounded,isolated) prio
> no-transmit/8 weight 1000Mbit allot 1514b 
> level 2 ewma 5 avpkt 1000b maxidle 0us 
>  Sent 460 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) 
>  backlog 0b 0p requeues 0 
>   borrowed 0 overactions 0 avgidle 125 undertime 0
> class cbq 1:1 parent 1: rate 1000Mbit cell 64b mpu 64b (bounded) prio
> 1/1 weight 1000Mbit allot 10000b 
> level 1 ewma 5 avpkt 1500b maxidle 0us 
>  Sent 460 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) 
>  rate 0bit 0pps backlog 0b 0p requeues 0 
>   borrowed 0 overactions 0 avgidle 125 undertime 0
> class qfq 11:1 root leaf 8011: weight 1 maxpkt 2048 
>  Sent 2760 bytes 30 pkt (dropped 6178, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:2 root leaf 8012: weight 1 maxpkt 2048 
>  Sent 2852 bytes 31 pkt (dropped 37048, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:3 root leaf 8013: weight 1 maxpkt 2048 
>  Sent 2760 bytes 30 pkt (dropped 24856, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:4 root leaf 8014: weight 1 maxpkt 2048 
>  Sent 3036 bytes 33 pkt (dropped 37358, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:5 root leaf 8015: weight 1 maxpkt 2048 
>  Sent 2760 bytes 30 pkt (dropped 24934, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:6 root leaf 8016: weight 1 maxpkt 2048 
>  Sent 2760 bytes 30 pkt (dropped 24882, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:7 root leaf 8017: weight 1 maxpkt 2048 
>  Sent 2760 bytes 30 pkt (dropped 12328, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> class qfq 11:8 root leaf 8018: weight 1 maxpkt 2048 
>  Sent 2852 bytes 31 pkt (dropped 31216, overlimits 0 requeues 0) 
>  backlog 2760b 30p requeues 0 
> 
> 
> 
> 
> Then this crashes :
> 
> # tc qdisc del dev dummy0 root

hlist_for_each_entry_safe fixes that.

Can you reproduce without putting cbq on the root?

-- 

^ permalink raw reply

* Re: [PATCH] sched: QFQ - quick fair queue scheduler (v4)
From: Stephen Hemminger @ 2011-03-04 17:18 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Fabio Checconi, Luigi Rizzo, netdev
In-Reply-To: <1299221426.2547.47.camel@edumazet-laptop>

On Fri, 04 Mar 2011 07:50:26 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le jeudi 03 mars 2011 à 16:30 -0800, Stephen Hemminger a écrit :
> > This is an implementation of the Quick Fair Queue scheduler developed
> > by Fabio Checconi. The same algorithm is already implemented in ipfw
> > in FreeBSD. Fabio had an earlier version developed on Linux, I just
> > cleaned it up.  Thanks to Eric Dumazet for doing the testing and
> > finding bugs.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > 
> > ---
> > v4 - change slots[] to hlist from simple linked list
> > 
> >  include/linux/pkt_sched.h |   15 
> >  net/sched/Kconfig         |   11 
> >  net/sched/Makefile        |    1 
> >  net/sched/sch_qfq.c       | 1133 ++++++++++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 1160 insertions(+)
> 
> Thanks
> 
> Still crashing hard here in qfq_reset_qdisc(), when packets are present
> in queues.
> 
> Probably hlist_for_each_entry_safe() is needed, since
> qfq_deactivate_class() is called ...
> 
> Also rename cl->next to cl->hnode so that following is clearer ?
> 
> -	hlist_for_each_entry(cl, n, &grp->slots[j], next) {
> +	hlist_for_each_entry_safe(cl, n, next, &grp->slots[j], hnode) {
> 
> Fabio, any idea why everything is blocked after a few packets for me ?
> 
> Here is script to reproduce the problem :
> 
> # cat qfq_setup.sh
> modprobe dummy
> 
> ifconfig dummy0 10.2.2.254 netmask 255.255.255.0 up
> 
> for i in `seq 1 16`
> do
>  arp -H ether -i dummy0 -s 10.2.2.$i 00:00:0c:07:ac:$(printf %02x $i)
> done
> 
> DEV=dummy0
> RATE="rate 40Mbit"
> TNETS="10.2.2.0/25"
> ALLOT="allot 20000"
> 
> tc qdisc del dev dummy0 root 2>/dev/null
> 
> tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 rate 1000Mbit \
> 	bandwidth 1000Mbit

QFQ is non work conserving, it may choose to send a smaller packet
ahead of a larger packet in other flow...


-- 

^ permalink raw reply

* QFQ debugfs
From: Stephen Hemminger @ 2011-03-04 17:20 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Fabio Checconi, Luigi Rizzo, netdev
In-Reply-To: <1299221426.2547.47.camel@edumazet-laptop>

This is quick hack to put a debugfs hook on:
  debug/qfq/<device>

dumps internal state

---
 net/sched/sch_qfq.c |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

--- a/net/sched/sch_qfq.c	2011-03-04 08:24:39.138728524 -0800
+++ b/net/sched/sch_qfq.c	2011-03-04 08:44:10.889972934 -0800
@@ -14,6 +14,7 @@
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/pkt_sched.h>
+#include <linux/debugfs.h>
 #include <net/sch_generic.h>
 #include <net/pkt_sched.h>
 #include <net/pkt_cls.h>
@@ -144,6 +145,7 @@ struct qfq_group {
 struct qfq_sched {
 	struct tcf_proto *filter_list;
 	struct Qdisc_class_hash clhash;
+	struct dentry	     *debugfs;
 
 	u64		V;		/* Precise virtual time. */
 	u32		wsum;		/* weight sum */
@@ -1025,6 +1027,55 @@ static unsigned int qfq_drop(struct Qdis
 	return 0;
 }
 
+static struct dentry *qfq_debug;
+
+static int qfq_debug_show(struct seq_file *seq, void *v)
+{
+	struct Qdisc *sch = seq->private;
+	const struct qfq_sched *q = qdisc_priv(sch);
+	unsigned int i, j;
+
+	seq_printf(seq, "V=%llu wsum=%u\n", q->V, q->wsum);
+	for (i = 0; i < QFQ_MAX_STATE; i++)
+		seq_printf(seq, "%lx%c", q->bitmaps[i],
+			   (i & 3) == 3 ? '\n' : ' ');
+
+	for (i = 0; i <= QFQ_MAX_INDEX; i++) {
+		const struct qfq_group *grp = &q->groups[i];
+		seq_printf(seq, "%d: S=%llu F=%llu shift=%u index=%u front=%u full=%#lx\n",
+			   i, (unsigned long long)grp->S,
+			   (unsigned long long)grp->F,
+			   grp->slot_shift, grp->index,
+			   grp->front, grp->full_slots);
+
+		for (j = 0; j < QFQ_MAX_SLOTS; j++) {
+			const struct qfq_class *cl;
+			struct hlist_node *n;
+
+			hlist_for_each_entry(cl, n, &grp->slots[j], next) {
+				seq_printf(seq, "  %d: S=%llu F=%llu inv_w=%u lmax=%u\n",
+					   j, cl->S, cl->F,
+					   cl->inv_w, cl->lmax);
+			}
+		}
+	}
+	return 0;
+}
+
+static int qfq_debug_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, qfq_debug_show, inode->i_private);
+}
+
+static const struct file_operations qfq_debug_fops = {
+	.owner		= THIS_MODULE,
+	.open		= qfq_debug_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
+
 static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
 {
 	struct qfq_sched *q = qdisc_priv(sch);
@@ -1042,6 +1093,9 @@ static int qfq_init_qdisc(struct Qdisc *
 			INIT_HLIST_HEAD(&grp->slots[j]);
 	}
 
+	q->debugfs = debugfs_create_file(sch->dev_queue->dev->name,
+					 S_IRUGO, qfq_debug, sch,
+					 &qfq_debug_fops);
 	return 0;
 }
 
@@ -1121,11 +1175,16 @@ static struct Qdisc_ops qfq_qdisc_ops __
 
 static int __init qfq_init(void)
 {
+	qfq_debug = debugfs_create_dir("qfq", NULL);
+
 	return register_qdisc(&qfq_qdisc_ops);
 }
 
 static void __exit qfq_exit(void)
 {
+	if (qfq_debug)
+		debugfs_remove(qfq_debug);
+
 	unregister_qdisc(&qfq_qdisc_ops);
 }
 

^ permalink raw reply

* mii_bus->read return checking in phy_device.c
From: Florian Fainelli @ 2011-03-04 17:25 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Andy Fleming

Hello Andy,

While debugging a PHY probing issue with the au1000_eth, I stumbled upon this 
in drivers/net/phy/phy_device.c:

        phy_reg = bus->read(bus, addr, MII_PHYSID1);                                                  
                                   
        if (phy_reg < 0)                        
                return -EIO;

most drivers implement phylib's mdio_read callback by simply returning the 
contents of their MDIO register after a readl, ioread ... which is unsigned. 
Would not it rather make sense to check for phy_reg <= 0 instead?

This can lead for instance to believing that a PHY is present at a wrong 
address because the MDIO read function returns 0 for that particular register, 
which is logical because no PHY is present at that address.

I am asking in case I just miss something.

Thank you.
--
Florian

^ permalink raw reply

* Re: [PATCH 1/2 net-next][v2] bonding: fix incorrect transmit queue offset
From: Jay Vosburgh @ 2011-03-04 17:37 UTC (permalink / raw)
  To: Phil Oester; +Cc: Andy Gospodarek, David Miller, bhutchings, netdev
In-Reply-To: <20110302014009.GA2045@linuxace.com>

Phil Oester <kernel@linuxace.com> wrote:

>On Tue, Mar 01, 2011 at 10:31:36AM -0500, Andy Gospodarek wrote:
>> > The patch works as expected.  Do we have any agreement on a final version?
>> >
>>
>> Thanks for the testing, Phil.
>>
>> I'm in favor of this patch as it does alert the admin that bonding may
>> not have enough default queues, but it is not as verbose (backtrace et
>> al) and likely to create bug reports as a message from WARN_ON.
>> +             if (net_ratelimit())
>> +                     pr_warning("%s selects invalid tx queue %d.  Consider"
>> +                                " setting module option tx_queues > %d.",
>> +                                dev->name, txq, dev->real_num_tx_queues);
>
>It is unclear why we need to alert the admin to this situation (repeatedly).  
>Say the incoming nic has 32 queues, and is headed out a bond (with 16).
>With your patch, we will log 50% of the time, no?  What benefit is this
>log spew?
>
>While WARN_ONCE may be a bit extreme due to the backtrace, perhaps we
>should at least throw a 'static bool warned' variable in there to lessen
>the nuisance?

	I'm also concerned that the log messages will be excessive.

	Should we instead create a bonding driver-private ethtool
statistics and count these events that way?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

^ permalink raw reply

* [Patch] ariadne: fix possible null dereference
From: j223yang @ 2011-03-04 17:46 UTC (permalink / raw)
  To: davem, netdev; +Cc: linux-kernel

This patch fixes bugzilla #13853:
https://bugzilla.kernel.org/show_bug.cgi?id=13853

The patch removes dereference of 'dev' after testing for NULL.
The source code ariadne.c uses spaces instead of tabs, so the patch
uses spaces too.

Signed-off-by: Jinqiu Yang<crindy646@gmail.com>
---
 drivers/net/ariadne.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -420,7 +420,7 @@ static inline void ariadne_reset(struct
 static irqreturn_t ariadne_interrupt(int irq, void *data)
 {
     struct net_device *dev = (struct net_device *)data;
-    volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
+    volatile struct Am79C960 *lance;
     struct ariadne_private *priv;
     int csr0, boguscnt;
     int handled = 0;
@@ -430,6 +430,7 @@ static irqreturn_t ariadne_interrupt(int
        return IRQ_NONE;
     }

+    lance = (struct Am79C960 *)dev->base_addr;
     lance->RAP = CSR0;                 /* PCnet-ISA Controller Status */

     if (!(lance->RDP & INTR))          /* Check if any interrupt has been */

^ permalink raw reply

* Re: [RFC] Keep track of interrupt URB status and resubmit in bh if necessary
From: Paul Stewart @ 2011-03-04 18:01 UTC (permalink / raw)
  To: Indrek Peri; +Cc: netdev@vger.kernel.org, David Brownell
In-Reply-To: <4D70C699.8000606@Ericsson.com>

Thanks for helping clear this up a bit.  I'm still a little foggy on
the details, especially when it comes to selective suspend (although I
currently don't work with a system that is actively using it, so I
might not see these issues).

On Fri, Mar 4, 2011 at 3:01 AM, Indrek Peri <Indrek.Peri@ericsson.com> wrote:
>
> To my understanding usbnet has design questions, like EVENT_DEV_ASLEEP,
> device states and events. In struct "flags" member holds an event to
> execute deferred work. Actually, in usbnet_bh, EVENT_DEV_ASLEEP is
> really needed in if-statement. Without that, in selective suspend
> case driver crashes.
>
> Another problem was that "suspend" removed interrupt URB. I tought in
> the same way as Paul, I added insertion of interrupt URB. Paul added
> it in usbnet_bh and I in "resume". I do not see a problem to add
> interrupt URB in "resume". My patch had a typo, in "resume" we
> should use GFP_ATOMIC in usb_submit_urb. Now is the question is
> this good design? My interpretation of David is that driver needs
> "resume driver" transition where RX and INT URBs are activated.

My interpretation of his statement "shouldn't this be just another
part of the "resume driver" action, like refilling the RX urb queue?"
was implicitly asking "shouldn't you move this to usbnet_bh, which is
where the RX urb queue is refilled?"  This is why I moved things
there.  Hopefully David can shed some light on it (now that I think
I've typed in his email address correctly. :-)

Now, I am also seeing what appear to be RX stalls with some
probability after suspend/resume, so it seems even with the current bh
there is still work to be done...

> I guess that usbnet needs a redesign and rewriting.
> usbnet is used by many USB-Ethernet devices that actually do not
> use selective suspend.
>
> BR, Indrek
>
>
>
> On 03/03/2011 06:45 AM, Paul Stewart wrote:
>> It appears that a patch from Indrek Peri similar to the one below
>> without resolution.  I'm new to this problem (suspend-resume causing
>> interrupt URBs to stop delivering) and am curious about what the correct
>> solution would should like.  Before becoming aware of this thread, I
>> just added a "usb_submit_urb" of "dev->interrupt" into "usbnet_resume()"
>> and that worked to solve the issue I was having.  Apparently this isn't
>> the correct solution though, from David's response to Indrek.  So, I'm
>> curious about what the right code should be.
>>
>> I'll note is that submitting the interrupt URB seems fairly benign.  If
>> we are in a situation where we should not have sent an URB (e.g, the
>> netif wasn't running) intr_complete correctly handles this case and does
>> not re-submit the URB, so at most we get one "rogue" interrupt URB after
>> resume-from-suspend.  The only nasty thing is that this URB should
>> probably not be submitted from interrupt, which the resume function
>> almost certainly is.  I'm guessing this is part of why David NAKed
>> Indrek's patch.  Am I correct?
>>
>> Does something like the patch below seem like a resonable solution?
>>
>> Cc: David Brownell <dbrownell@users.sourceforge.org>
>> Cc: Indrek Peri <Indrek.Peri@Ericsson.com>
>> Signed-off-by: Paul Stewart <pstew@google.com>
>> ---
>>  drivers/net/usb/usbnet.c   |   21 +++++++++++++++++++--
>>  include/linux/usb/usbnet.h |    1 +
>>  2 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> index 02d25c7..bc6a8e0 100644
>> --- a/drivers/net/usb/usbnet.c
>> +++ b/drivers/net/usb/usbnet.c
>> @@ -471,6 +471,8 @@ static void intr_complete (struct urb *urb)
>>       struct usbnet   *dev = urb->context;
>>       int             status = urb->status;
>>
>> +     dev->interrupt_urb_running = 0;
>> +
>>       switch (status) {
>>       /* success */
>>       case 0:
>> @@ -497,7 +499,9 @@ static void intr_complete (struct urb *urb)
>>
>>       memset(urb->transfer_buffer, 0, urb->transfer_buffer_length);
>>       status = usb_submit_urb (urb, GFP_ATOMIC);
>> -     if (status != 0 && netif_msg_timer (dev))
>> +     if (status == 0)
>> +             dev->interrupt_urb_running = 1;
>> +     else if (netif_msg_timer (dev))
>>               deverr(dev, "intr resubmit --> %d", status);
>>  }
>>
>> @@ -580,6 +584,7 @@ static int usbnet_stop (struct net_device *net)
>>       remove_wait_queue (&unlink_wakeup, &wait);
>>
>>       usb_kill_urb(dev->interrupt);
>> +     dev->interrupt_urb_running = 0;
>>
>>       /* deferred work (task, timer, softirq) must also stop.
>>        * can't flush_scheduled_work() until we drop rtnl (later),
>> @@ -640,7 +645,8 @@ static int usbnet_open (struct net_device *net)
>>                       if (netif_msg_ifup (dev))
>>                               deverr (dev, "intr submit %d", retval);
>>                       goto done;
>> -             }
>> +             } else
>> +                     dev->interrupt_urb_running = 1;
>>       }
>>
>>       netif_start_queue (net);
>> @@ -1065,6 +1071,17 @@ static void usbnet_bh (unsigned long param)
>>               if (dev->txq.qlen < TX_QLEN (dev))
>>                       netif_wake_queue (dev->net);
>>       }
>> +
>> +     // Do we need to re-enable interrupt URBs?
>> +     if (netif_running (dev->net) &&
>> +         netif_device_present (dev->net) &&
>> +         dev->interrupt_urb_running == 0) {
>> +             usb_submit_urb (dev->interrupt, GFP_KERNEL);
>> +
>> +             /* Unconditionally mark as running so we don't retry */
>> +             dev->interrupt_urb_running = 1;
>> +     }
>> +
>>  }
>>
>>
>> diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
>> index ba09fe8..1b8ed8a 100644
>> --- a/include/linux/usb/usbnet.h
>> +++ b/include/linux/usb/usbnet.h
>> @@ -49,6 +49,7 @@ struct usbnet {
>>       u32                     hard_mtu;       /* count any extra framing */
>>       size_t                  rx_urb_size;    /* size for rx urbs */
>>       struct mii_if_info      mii;
>> +     int                     interrupt_urb_running;
>>
>>       /* various kinds of pending driver work */
>>       struct sk_buff_head     rxq;
>
>

^ permalink raw reply

* Re: [PATCH] e1000: power off PHY after reset when interface is down
From: Prasanna Panchamukhi @ 2011-03-04 18:03 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: Allan, Bruce W, Pieper, Jeffrey E,
	e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
In-Reply-To: <AANLkTim-T99r+npYWCLH8ry+hbtCNBOM4WUev8soaoM6@mail.gmail.com>

On 03/04/2011 12:19 AM, Jeff Kirsher wrote:
> On Wed, Feb 23, 2011 at 16:02, Jeff Kirsher<jeffrey.t.kirsher@intel.com>  wrote:
>> On Tue, 2011-02-22 at 17:25 -0800, prasanna.panchamukhi@riverbed.com
>> wrote:
>>> From: Prasanna S. Panchamukhi<prasanna.panchamukhi@riverbed.com>
>>>
>>> Some Phys supported by the e1000 driver do not remain powered off
>>> across
>>> a reset of the device when the interface is down, e.g. on 82546.
>>> This patch powers down (only when WoL is disabled) the PHY after reset
>>> if
>>> the interface is down and ethtool diagnostics are not currently
>>> running.
>>>
>>> Similar problem was see on 82571 controller and was fixed in e1000e
>>> driver
>>> by Bruce Allan.
>>> Please refer commit 31dbe5b4ac6fca72dec946e4d0fa7f0913f1d9b1 for
>>> details.
>>>
>>> Signed-off-by: Prasanna S. Panchamukhi
>>> <prasanna.panchamukhi@riverbed.com>
>>> ---
>>>   drivers/net/e1000/e1000_ethtool.c |   27 +++++++++++++++++++--------
>>>   drivers/net/e1000/e1000_main.c    |    7 +++++++
>>>   2 files changed, 26 insertions(+), 8 deletions(-)
>> Thanks Prasanna!  I have added the patch to my queue of e1000 patches.
>>
> Prasanna-
> Here is what we found during validating your patch:
>
> The behavior of 82546 device(s) seems to be identical with/without this patch
> applied. 82546GB (LOM), dev_id 1079 powers down (with wol disabled) after
> ifdown, but powers back up after approx. 10 seconds. 82546EB (NIC), dev_id
> 1010 powers down (with wol disabled) after ifdown. Both of the above
> behaviors are the same with and without the patch applied. Also, if this patch
> DID work as expected, it should print a message after a reset, such as "Cannot
> restart autonegotiation: Resource temporarily unavailable", which would mirror
> the behavior of e1000e.
>
Hi Jeff,

Below is the test case we run verify this fix:

$ ethtool -s eth0 wol d
$ ifconfig eth0 up
$ mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok
$ ifconfig eth0 down
$ mii-tool eth0
eth0: no link
$ ethtool -s eth0 autoneg on  (doesn't really matter what we do here)
$ mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok (this should be: eth0: no link)

I will re-run the test&  check if does not fix this.

Thanks
Prasanna




^ permalink raw reply

* Re: mii_bus->read return checking in phy_device.c
From: Fleming Andy-AFLEMING @ 2011-03-04 18:06 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev@vger.kernel.org, David Miller
In-Reply-To: <201103041825.48765.florian@openwrt.org>



On Mar 4, 2011, at 11:24, "Florian Fainelli" <florian@openwrt.org> wrote:

> Hello Andy,
> 
> While debugging a PHY probing issue with the au1000_eth, I stumbled upon this 
> in drivers/net/phy/phy_device.c:
> 
>        phy_reg = bus->read(bus, addr, MII_PHYSID1);                                                  
> 
>        if (phy_reg < 0)                        
>                return -EIO;
> 
> most drivers implement phylib's mdio_read callback by simply returning the 
> contents of their MDIO register after a readl, ioread ... which is unsigned. 
> Would not it rather make sense to check for phy_reg <= 0 instead?


That isn't a check for a non-existent PHY.  PHY registers are unsigned 16-bit quantities.  The negative 32-bit return value would be the result of something going wrong in the bus transaction.

Notice that later the code actually checks to see if the read value was mostly 1s...


> 
> This can lead for instance to believing that a PHY is present at a wrong 
> address because the MDIO read function returns 0 for that particular register, 
> which is logical because no PHY is present at that address.
> 
> I am asking in case I just miss something.
> 
> Thank you.
> --
> Florian
> 


^ permalink raw reply

* Re: mii_bus->read return checking in phy_device.c
From: Florian Fainelli @ 2011-03-04 18:12 UTC (permalink / raw)
  To: Fleming Andy-AFLEMING; +Cc: netdev@vger.kernel.org, David Miller
In-Reply-To: <1FBC63C1-A8CE-4EFA-8864-62E12C0CFCB3@freescale.com>

On Friday 04 March 2011 19:06:20 Fleming Andy-AFLEMING wrote:
> On Mar 4, 2011, at 11:24, "Florian Fainelli" <florian@openwrt.org> wrote:
> > Hello Andy,
> > 
> > While debugging a PHY probing issue with the au1000_eth, I stumbled upon
> > this
> > 
> > in drivers/net/phy/phy_device.c:
> >        phy_reg = bus->read(bus, addr, MII_PHYSID1);
> >        
> >        if (phy_reg < 0)
> >        
> >                return -EIO;
> > 
> > most drivers implement phylib's mdio_read callback by simply returning
> > the contents of their MDIO register after a readl, ioread ... which is
> > unsigned. Would not it rather make sense to check for phy_reg <= 0
> > instead?
> 
> That isn't a check for a non-existent PHY.  PHY registers are unsigned
> 16-bit quantities.  The negative 32-bit return value would be the result
> of something going wrong in the bus transaction.

Ok, but 0 is not an acceptable value either for both ID1 and ID2.

> 
> Notice that later the code actually checks to see if the read value was
> mostly 1s...

What if the MDIO bus returns 0 instead of 1? Should that be fixed to return 
0xffff instead in the driver?

> 
> > This can lead for instance to believing that a PHY is present at a wrong
> > address because the MDIO read function returns 0 for that particular
> > register, which is logical because no PHY is present at that address.
> > 
> > I am asking in case I just miss something.
> > 
> > Thank you.
> > --
> > Florian
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Bugme-new] [Bug 29712] New: Bonding Driver(version : 3.5.0) - Problem with ARP monitoring in active backup mode
From: Jay Vosburgh @ 2011-03-04 18:18 UTC (permalink / raw)
  To: Harsha R02
  Cc: Brian Haley, Andrew Morton, bugzilla-daemon, bugme-daemon, netdev
In-Reply-To: <E351E450E8B9F54684A699D42DC5ADF2103267E5@MPBAGVEX02.corp.mphasis.com>

Harsha R02 <Harsha.R02@mphasis.com> wrote:

>We found that the patch that is presented here has some issues and we
>cannot go with this solution.
>
>In function "bond_ab_arp_probe" in addition to sending arp probes for
>the currently active slave we should also 
>be sending arp probes for the primary_slave if the link status of the
>primary slave is up correct ?
>
>I have made changes as below :
>
>static void bond_ab_arp_probe(struct bonding *bond)
>{
>        struct slave *slave;
>        int i;
>
>        read_lock(&bond->curr_slave_lock);
>
>        if (bond->current_arp_slave && bond->curr_active_slave)
>                pr_info(DRV_NAME "PROBE: c_arp %s && cas %s BAD\n",
>                       bond->current_arp_slave->dev->name,
>                       bond->curr_active_slave->dev->name);
>
>        if (bond->curr_active_slave) {
>+                if((bond->curr_active_slave != bond->primary_slave) &&
>+                   (IS_UP(bond->primary_slave->dev))) {
>+                    bond_arp_send_all(bond, bond->primary_slave);
>+                }
>                bond_arp_send_all(bond, bond->curr_active_slave);
>                read_unlock(&bond->curr_slave_lock);

	No, we can't do this; if we send ARP probes out from an inactive
slave (which the primary would be at this point) it will confuse
switches that snoop traffic to determine the switch port's MAC addresses
(the switches will believe that the "primary" slave is the port to use
to reach the bond's MAC address).

	I think your problem is that your configuration (two systems,
back to back, no switch) is not a configuration the ARP monitor is
designed to work with.

	The ARP monitor determines the availability of backup slaves
based on traffic received by the backup slaves.  The usual source of
this traffic is the ARP broadcast requests being sent out the active
slave and then forwarded by the switch to all switch ports, including
the backup slave's port.  I'm guessing that your system isn't forwarding
these packets like a switch would, and so the primary slave isn't seeing
any incoming packets at all.

	If your primary slave (which is an inactive slave at the moment)
is not receiving traffic, bonding will never believe it is available.

	I've never experimented with using the ARP monitor in a
back-to-back confguration; I'm thinking through how the ARP monitor
functions, and I'm not sure it can be reliable when set up like this.

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

^ permalink raw reply

* Re: mii_bus->read return checking in phy_device.c
From: Fleming Andy-AFLEMING @ 2011-03-04 18:19 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev@vger.kernel.org, David Miller
In-Reply-To: <201103041912.10252.florian@openwrt.org>



On Mar 4, 2011, at 12:10, "Florian Fainelli" <florian@openwrt.org> wrote:

> On Friday 04 March 2011 19:06:20 Fleming Andy-AFLEMING wrote:
>> On Mar 4, 2011, at 11:24, "Florian Fainelli" <florian@openwrt.org> wrote:
>>> Hello Andy,
>>> 
>>> While debugging a PHY probing issue with the au1000_eth, I stumbled upon
>>> this
>>> 
>>> in drivers/net/phy/phy_device.c:
>>>       phy_reg = bus->read(bus, addr, MII_PHYSID1);
>>> 
>>>       if (phy_reg < 0)
>>> 
>>>               return -EIO;
>>> 
>>> most drivers implement phylib's mdio_read callback by simply returning
>>> the contents of their MDIO register after a readl, ioread ... which is
>>> unsigned. Would not it rather make sense to check for phy_reg <= 0
>>> instead?
>> 
>> That isn't a check for a non-existent PHY.  PHY registers are unsigned
>> 16-bit quantities.  The negative 32-bit return value would be the result
>> of something going wrong in the bus transaction.
> 
> Ok, but 0 is not an acceptable value either for both ID1 and ID2.


I don't remember the exact details, but i recall we had a discussion about this several years ago, and decided that 0 should not be interpreted as a non-existent PHY. I know I have a part that has an internal PHY which doesnt have anything in the ID registers.  If your driver is aware that it did not get a response from the PHY, it should return 0xffff.  Otherwise, you can return 0, and just be aware that the PHY subsystem will believe there's a PHY there.


> 
>> 
>> Notice that later the code actually checks to see if the read value was
>> mostly 1s...
> 
> What if the MDIO bus returns 0 instead of 1? Should that be fixed to return 
> 0xffff instead in the driver?
> 
>> 
>>> This can lead for instance to believing that a PHY is present at a wrong
>>> address because the MDIO read function returns 0 for that particular
>>> register, which is logical because no PHY is present at that address.
>>> 
>>> I am asking in case I just miss something.
>>> 
>>> Thank you.
>>> --
>>> Florian
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply

* Re: [Patch] ariadne: fix possible null dereference
From: Randy Dunlap @ 2011-03-04 18:31 UTC (permalink / raw)
  To: j223yang; +Cc: davem, netdev, linux-kernel
In-Reply-To: <20110304174625.GA31042@asset.uwaterloo.ca>

On Fri, 4 Mar 2011 12:46:26 -0500 j223yang@asset.uwaterloo.ca wrote:

> This patch fixes bugzilla #13853:
> https://bugzilla.kernel.org/show_bug.cgi?id=13853
> 
> The patch removes dereference of 'dev' after testing for NULL.
> The source code ariadne.c uses spaces instead of tabs, so the patch
> uses spaces too.

Sorry for the confusion here, but (while I agree with the fix in this
patch), this patch still does not apply cleanly.

If a line in the source code file uses spaces, then use spaces.
If a line in the source code file uses tabs, then use tabs.

You cannot exchange one for the other in your generated patch.
Using 'diff' creates the patch correctly, so I guess that your patch
generation tool still needs some work.

Please take your patch and test applying it:

> cd linux-2.6.38-rc7
> patch -p1 --dry-run < ~/tmp/ariadne.patch
patching file drivers/net/ariadne.c
Hunk #2 FAILED at 430.
1 out of 2 hunks FAILED -- saving rejects to file drivers/net/ariadne.c.rej


> Signed-off-by: Jinqiu Yang<crindy646@gmail.com>
> ---
>  drivers/net/ariadne.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
> --- a/drivers/net/ariadne.c
> +++ b/drivers/net/ariadne.c
> @@ -420,7 +420,7 @@ static inline void ariadne_reset(struct
>  static irqreturn_t ariadne_interrupt(int irq, void *data)
>  {
>      struct net_device *dev = (struct net_device *)data;
> -    volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
> +    volatile struct Am79C960 *lance;
>      struct ariadne_private *priv;
>      int csr0, boguscnt;
>      int handled = 0;
> @@ -430,6 +430,7 @@ static irqreturn_t ariadne_interrupt(int
>         return IRQ_NONE;
>      }
> 
> +    lance = (struct Am79C960 *)dev->base_addr;
>      lance->RAP = CSR0;                 /* PCnet-ISA Controller Status */
> 
>      if (!(lance->RDP & INTR))          /* Check if any interrupt has been */
> 
> --

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: [PATCH V4] Export ACPI _DSM provided firmware instance number and string name to sysfs
From: Jesse Barnes @ 2011-03-04 18:38 UTC (permalink / raw)
  To: Narendra_K
  Cc: linux-pci, linux-hotplug, netdev, mjg, Matt_Domsch, Charles_Rose,
	Jordan_Hargrave, Shyam_Iyer, sfr
In-Reply-To: <20110304164957.GA2913@fedora14-r610.oslab.blr.amer.dell.com>

On Fri, 4 Mar 2011 08:28:59 -0800
<Narendra_K@Dell.com> wrote:

> On Wed, Mar 02, 2011 at 10:34:17PM +0530, K, Narendra wrote:
> > On Wed, Feb 23, 2011 at 06:06:42PM +0530, K, Narendra wrote:
> > > Hello,
> > >
> > > This patch exports ACPI _DSM provided firmware instance number and
> > > string name to sysfs.
> > >
> > > V1 -> V2:
> > > The attribute 'index' is changed to 'acpi_index' as the semantics of
> > > SMBIOS provided device type instance and ACPI _DSM provided firmware
> > > instance number are different.
> > >
> > > V2 -> V3:
> > > Matthew Garrett pointed out that 'sysfs_create_groups' does return an
> > > error when there are no ACPI _DSM attributes available and because of
> > > that the fallback to SMBIOS will not happen. As a result SMBIOS provided
> > > attributes are not created. This version of the patch addresses the issue.
> > >
> > 
> > V3 -> V4:
> > Select NLS if (DMI || ACPI) in drivers/pci/Kconfig to prevent build
> > breakage from an 'allmodconfig'
> > 
> > Matthew,
> > Thanks for the suggestion.
> > 
> > From: Narendra K <narendra_k@dell.com>
> > Subject: [PATCH] Export ACPI _DSM provided firmware instance number and string to sysfs
> >
> 
> Hi Jesse,
> 
> Does Version 4 of the patch look good for inclusion ? Please let us know
> if there are any concerns.

Oh sorry, I was looking in the wrong mailbox, I'll pull this one in now.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply

* Re: pull request: wireless-next-2.6 2011-02-22
From: John W. Linville @ 2011-03-04 18:40 UTC (permalink / raw)
  To: Shan Wei
  Cc: Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4D706C2E.40307-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>

On Fri, Mar 04, 2011 at 12:35:58PM +0800, Shan Wei wrote:
> John W. Linville wrote, at 02/23/2011 05:52 AM:
> > Please let me know if there are problems!
> 
> Fail to compile with attached config under net-next tree.
>  
> ======Error Begin================================================================
> drivers/net/wireless/rtlwifi/rtl8192cu/built-in.o: In function `rtl92c_phy_sw_chnl':
> /data2/net-next-2.6/drivers/net/wireless/rtlwifi/rtl8192cu/../rtl8192c/phy_common.c:803: multiple definition of `rtl92c_phy_sw_chnl'
> drivers/net/wireless/rtlwifi/rtl8192ce/built-in.o:/data2/net-next-2.6/drivers/net/wireless/rtlwifi/rtl8192ce/../rtl8192c/phy_common.c:803: first defined here
> drivers/net/wireless/rtlwifi/rtl8192cu/built-in.o: In function `rtl92c_fill_h2c_cmd':

This is already fixed in wireless-next-2.6:

commit 1472d3a87586eb7529d1d85f7c888055650b7208
Author: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Date:   Wed Feb 23 10:24:58 2011 -0600

    rtlwifi: rtl8192ce: rtl8192cu: Fix multiple def errors for allyesconfig buil
    
    As noted by Stephan Rothwell, an allyesconfig build fails since rtl8192cu
    was merged with failures such as:
    
    drivers/net/wireless/rtlwifi/rtl8192cu/built-in.o: In function `rtl92c_phy_s
    (.opd+0xf30): multiple definition of `rtl92c_phy_sw_chnl'
    drivers/net/wireless/rtlwifi/rtl8192ce/built-in.o:(.opd+0xb70): first define
    drivers/net/wireless/rtlwifi/rtl8192cu/built-in.o: In function `rtl92c_fill_
    (.opd+0x288): multiple definition of `rtl92c_fill_h2c_cmd'
    drivers/net/wireless/rtlwifi/rtl8192ce/built-in.o:(.opd+0x288): first define
    
    These are caused because the code shared between rtl8192ce and rtl8192cu
    is included in both drivers. This has been fixed by creating a new modue tha
    contains the shared code.
    
    Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
    Signed-off-by: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>

It will be in my next pull request to Dave.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH V4] Export ACPI _DSM provided firmware instance number and string name to sysfs
From: Jesse Barnes @ 2011-03-04 18:43 UTC (permalink / raw)
  To: Narendra_K
  Cc: linux-pci, linux-hotplug, netdev, mjg, Matt_Domsch, Charles_Rose,
	Jordan_Hargrave, Shyam_Iyer, sfr
In-Reply-To: <20110302172508.GA2794@fedora14-r610.oslab.blr.amer.dell.com>

On Wed, 2 Mar 2011 22:34:17 +0530
<Narendra_K@Dell.com> wrote:

> On Wed, Feb 23, 2011 at 06:06:42PM +0530, K, Narendra wrote:
> > Hello,
> > 
> > This patch exports ACPI _DSM provided firmware instance number and
> > string name to sysfs.
> > 
> > V1 -> V2:
> > The attribute 'index' is changed to 'acpi_index' as the semantics of
> > SMBIOS provided device type instance and ACPI _DSM provided firmware
> > instance number are different.
> > 
> > V2 -> V3:
> > Matthew Garrett pointed out that 'sysfs_create_groups' does return an
> > error when there are no ACPI _DSM attributes available and because of
> > that the fallback to SMBIOS will not happen. As a result SMBIOS provided
> > attributes are not created. This version of the patch addresses the issue.
> > 
> 
> V3 -> V4:
> Select NLS if (DMI || ACPI) in drivers/pci/Kconfig to prevent build
> breakage from an 'allmodconfig'

Applied, fingers crossed this time. :)

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply

* Re: [ethtool PATCH 2/2] Add RX packet classification interface
From: Alexander Duyck @ 2011-03-04 19:09 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Santwona Behera, netdev@vger.kernel.org
In-Reply-To: <1298939712.2569.43.camel@bwh-desktop>

On 2/28/2011 4:35 PM, Ben Hutchings wrote:
> On Tue, 2011-02-22 at 12:52 -0800, Alexander Duyck wrote:

[...]

>>>>                                 } else
>>>>                                         show_usage(1);
>>>>                                 break;
>>>
>>> I don't think the same options (-n, -N) should be used both for flow
>>> hashing and n-tuple flow steering/filtering.  This command-line
>>> interface and the structure used in the ethtool API just seem to reflect
>>> the implementation in the niu driver.
>>>
>>> (In fact I would much prefer it if the -u and -U options could be used
>>> for both the rxnfc and rxntuple interfaces.  But I haven't thought about
>>> how the differences in functionality would be exposed to or hidden from
>>> the user.)
>>
>> I was kind of thinking about merging the two interfaces too, but I was
>> looking at it more from the perspective of moving away from ntuple more
>> towards this newer interface.  My main motivation being that the filter
>> display option is so badly broken for ntuple that it would be easier to
>> make ntuple a subset of the flow classifier instead of the other way around.
>>
>> What would you think of using the "flow-type" keyword to indicate legacy
>> ntuple support, and then adding something like "class-rule-add", and
>> "class-rule-del" to add support for the network flow classifier calls?
>
> I really don't want to introduce different syntax for functionality that
> is common between the two command sets.  The user should not have to
> know that driver A implements interface I and driver B implements
> interface J, except that since version 2.6.y driver A implements
> interface J too.
>
> Surely it is possible to try one interface, then the other, when the
> requested filter can be implemented either way?

The problem is that the interfaces are different in the way they 
implement their masks.  N-tuple defines the mask as 0s mean inclusion, 
1s, mean exclusion.  The network flow classifier filters are the exact 
opposite.  As such we really need to know which type of filter we are 
dealing with before we start setting up values.  In addition there are 
options such as location which exist in network flow classifier rules, 
but not in ntuple rules.

Thanks,

Alex


^ permalink raw reply

* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: David Miller @ 2011-03-04 19:17 UTC (permalink / raw)
  To: eric.dumazet; +Cc: xiaosuo, netdev
In-Reply-To: <1299251348.2676.16.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 04 Mar 2011 16:09:08 +0100

> Here is a patch to implement this idea.

Applied, thanks Eric!

^ permalink raw reply

* Re: [net-next-2.6 PATCH 02/10] ethtool: add ntuple flow specifier to network flow classifier
From: Alexander Duyck @ 2011-03-04 19:30 UTC (permalink / raw)
  To: Dimitrios Michailidis
  Cc: Ben Hutchings, Alexander Duyck, davem@davemloft.net,
	Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <8A71B368A89016469F72CD08050AD334091C1FCF@maui.asicdesigners.com>

On 3/2/2011 12:03 PM, Dimitrios Michailidis wrote:
> Ben Hutchings wrote:
>> On Wed, 2011-03-02 at 11:11 -0800, Dimitrios Michailidis wrote:
>>> Ben Hutchings wrote:
>>>> /**
>>>>   * struct ethtool_flow_ext - flow spec common extension fields
>>>>   * @vlan_etype: EtherType for vlan tagged packet to match
>>>>   * @vlan_tci: VLAN tag to match
>>>>   * @data: Driver-dependent data to match
>>>>   *
>>>>   * Note: Additional fields may be inserted before @vlan_etype in future,
>>>>   * but the offset of the existing fields within the containing structure
>>>>   * (&struct ethtool_rx_flow_spec) will be stable.
>>>>   */
>>>> struct ethtool_flow_ext {
>>>> 	__be16	vlan_etype;
>>>> 	__be16	vlan_tci;
>>>> 	__be32	data[2];
>>>> };
>>>
>>> I am wondering about the semantics of these vlan_* fields.  Is vlan_etype the
>>> Ethertype in the VLAN header or the type after it?
>>
>> It would be the the type in the VLAN tag.  The nested ethertype is
>> normally implied by flow_type to be ETH_P_IP.
>>
>> This does leave the question of what this would mean:
>>
>> struct ethtool_rx_flow_spec fs = {
>> 	.flow_type = ... | FLOW_EXT,
>> 	...
>> 	.h_ext.vlan_tci = htons(0x1234),
>> 	.m_ext.vlan_etype = 0xffff,
>> };
>>
>> This says the TCI must be == 0x1234 but the type can be anything.  But
>> the type surely has to be be one assigned for use in VLAN tags.  Should
>> we leave it to the driver/hardware to determine what those valid types
>> are, or should we reject this as valid?
>
> Right.  Devices have some internal rules for what qualifies as a VLAN frame.
> If users are given the option to specify vlan_etype what do they get?
> At least we need to specify what is expected so drivers can decide if they can support it.

The basic idea I had is similar to what Ben described.  Basically the 
vlan_etype can be used to determine the Ethertype for the VLAN to be 
compared.  The reason for this is specifically the VLAN 0 case since 
without the VLAN Ethertype check VLAN 0 on ixgbe hardware will match an 
untagged frame and that may not be a desired result.  As such we can 
specify the VLAN Ethertype and then we will only match VLAN tagged 
frames without any false hits.

Thanks,

Alex


^ permalink raw reply

* Re: 2.6.37 regression: adding main interface to a bridge breaks vlan interface RX
From: chriss @ 2011-03-04 19:32 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20110301215252.GA13336@electric-eye.fr.zoreil.com>

Francois Romieu <romieu <at> fr.zoreil.com> writes:

> 
> Chriss, can you give it a try against current -rc / -git and see if it makes
> a difference ?
> 

I hope i'm doing it right. i checked out the
'git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git'

and will try to apply the patch you provided. please correct me if i'm wrong.
I will report back.

regards//chriss


^ permalink raw reply

* pull request: wireless-next-2.6 2011-03-04
From: John W. Linville @ 2011-03-04 19:40 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Dave,

Yet another batch of new wireless bits intended for 2.6.39... :-)

Highlights in this round include AP-mode support for wl12xx, some
rtlwifi fixes (many build-related), some more b43 N-phy support
advancement, a big batch of ath9k_htc updates, and the refactoring of
iwlwifi to separate iwl3945 and iwl4965 support out into a new iwlegacy
driver.  Mixed-in, of course, is the usual batch of various driver and
mac80211 updates and fixes.

Please let me know if there are problems!

John

---

The following changes since commit 29546a6404e3a4b5d13f0a9586eb5cf1c3b25167:

  ipv6: Use ERR_CAST in addrconf_dst_alloc. (2011-03-03 12:10:37 -0800)

are available in the git repository at:
  ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6.git for-davem

Alessio Igor Bogani (2):
      rtlwifi: Add the missing rcu_read_lock/unlock
      rtlwifi: fix places where uninitialized data is used

Arik Nemtsov (9):
      wl12xx: avoid blocking while holding rcu lock on bss info change
      wl12xx: fix potential race condition with TX queue watermark
      wl12xx: AP-mode - fix race condition on sta connection
      wl12xx: AP-mode - TX queue per link in AC
      wl12xx: report invalid TX rate when returning non-TX-ed skbs
      wl12xx: AP-mode - support HW based link PS monitoring
      wl12xx: AP mode - fix bug in cleanup of wl1271_op_sta_add()
      wl12xx: AP-mode - count free FW TX blocks per link
      wl12xx: AP-mode - management of links in PS-mode

Chaoming Li (1):
      rtlwifi: Fix error registering rate-control

Christian Lamparter (1):
      p54: implement set_coverage_class

Dan Carpenter (2):
      wl12xx: change type from u8 to int
      iwlwifi: remove duplicate initialization

Eliad Peller (4):
      wl12xx: fix identification of beacon packets (debug)
      wl12xx: declare support for IEEE80211_HW_REPORTS_TX_ACK_STATUS
      wl12xx: use standard ALIGN() macro
      wl12xx: always set mac_address when configuring ht caps

Felix Fietkau (4):
      p54: fix a NULL pointer dereference bug
      ath9k: use generic mac80211 LED blinking code
      cfg80211: add a field for the bitrate of the last rx data packet from a station
      mac80211: add support for showing the last rx bitrate

Gery Kahn (1):
      wl12xx: update PLT initialization for new firmware

Gustavo F. Padovan (1):
      Bluetooth: Fix BT_L2CAP and BT_SCO in Kconfig

Joe Gunn (1):
      orinoco: Drop scan results with unknown channels

Johannes Berg (8):
      mac80211: rename RX_FLAG_TSFT
      rtl8192c: fix compilation errors
      mac80211: make tx() operation return void
      mac80211: remove IBSS merge delay
      mac80211: copy peer MCS TX parameters
      iwlagn: fix iwlagn_check_needed_chains
      mac80211: support direct offchannel TX offload
      mac80211: make rate control Kconfig warning depend on mac80211

John W. Linville (6):
      Merge branch 'wireless-next-2.6' of git://git.kernel.org/.../iwlwifi/iwlwifi-2.6
      Merge branch 'for-linville' of git://git.kernel.org/.../luca/wl12xx
      iwlegacy: change some symbols duplicated from iwlwifi directory
      at76c50x-usb: fix warning caused by at76_mac80211_tx now returning void
      Merge branch 'wireless-next-2.6' of git://git.kernel.org/.../iwlwifi/iwlwifi-2.6
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next-2.6 into for-davem

Larry Finger (1):
      rtlwifi: rtl8192ce: rtl8192cu: Fix multiple def errors for allyesconfig build

Luciano Coelho (1):
      wl12xx: fix MODULE_AUTHOR email address

Nishant Sarmukadam (3):
      mwl8k: fix rf_antenna rx argument for AP
      mwl8k: Tell mac80211 we have rate adaptation in FW
      mwl8k: Invert tx queues for set_hw_spec and set_edca_params

Rafał Miłecki (5):
      b43: N-PHY: fix 0x2055 radio workaround condition
      b43: N-PHY: rev1: enable some gain ctl workarounds
      b43: N-PHY: rev1: restore PHY state after RSSI operations
      b43: fill PHY ctl word1 in TX header for N-PHY
      b43: N-PHY: rev3+: add static tables

Senthil Balasubramanian (1):
      ath9k: Fix incorrect GPIO LED pin for AR9485

Stanislaw Gruszka (7):
      iwlegacy: do not set tx power when channel is changing
      mac80211: better fix for conn_mon_timer running after disassociate
      iwlwifi: fix dma mappings and skbs leak
      iwlegacy: fix dma mappings and skbs leak
      iwlwifi: add {ack,plpc}_check module parameters
      iwlwifi: move check health code into iwl-rx.c
      iwlwifi: move remaining iwl-agn-rx.c code into iwl-rx.c

Sujith Manoharan (22):
      ath9k_htc: Handle storage devices
      ath9k_htc: Allow upto two simultaneous interfaces
      ath9k_htc: Unify target capability updating
      ath9k_htc: Fix error handling in add_interface
      ath9k_htc: Remove OP_PREAMBLE_SHORT
      ath9k_htc: Remove OP_PROTECT_ENABLE
      ath9k_htc: Remove OP_ASSOCIATED variable
      ath9k_htc: Set the BSSID mask for multiple interfaces
      ath9k_htc: Make sequence number calculation per-VIF
      ath9k_htc: Use VIF from the packet's control data
      ath9k_htc: Protect ampdu_action with a mutex
      ath9k_htc: Maintain individual counters for interfaces
      ath9k_htc: Allow AP interface to be created
      ath9k_htc: Calculate and set the HW opmode
      ath9k_htc: Add ANI for AP mode
      ath9k_htc: Configure beacon timers in AP mode
      ath9k_htc: Fix TBTT calculation for IBSS mode
      ath9k_htc: Fix host RX initialization
      ath9k_htc: Fix RX filters
      ath9k_htc: Add debug code to print endpoint mapping
      ath9k_htc: Fix error path in URB allocation
      ath9k_htc: Handle BSSID/AID for multiple interfaces

Vivek Natarajan (4):
      mac80211: Fix a race on enabling power save.
      ath9k_hw: Fix pcie_serdes setting for AR9485 1.1 version.
      ath9k: Cancel pll_work while disabling radio.
      ath9k: Fix compilation warning.

Wey-Yi Guy (11):
      iwlwifi: Limit number of firmware reload
      iwlwifi: Loading correct uCode again when fail to load
      iwlwifi: enable 2-wire bt coex support for non-combo device
      iwlwifi: split the drivers for agn and legacy devices 3945/4965
      Revert "iwlwifi: split the drivers for agn and legacy devices 3945/4965"
      iwlwifi: split the drivers for agn and legacy devices 3945/4965
      iwlagn: name change for BT config command
      iwlagn: add bt config structure support for 2000 series
      iwlagn: add BT Session Activity 2 UART message (BT -> WiFi)
      iwlagn: split BT page and inquiry UART msg
      iwlagn: enable BT session 2 type UART for 2000 series

Willy Tarreau (4):
      rtlwifi: Fix build when RTL8192CU is selected, but RTL8192CE is not
      rtl8192cu: fix build error (vmalloc/vfree undefined)
      rtlwifi: Let rtlwifi build when PCI is not enabled
      rtlwifi: Eliminate udelay calls with too large values

 drivers/net/wireless/Kconfig                       |    1 +
 drivers/net/wireless/Makefile                      |    5 +-
 drivers/net/wireless/adm8211.c                     |    4 +-
 drivers/net/wireless/at76c50x-usb.c                |   10 +-
 drivers/net/wireless/ath/ar9170/ar9170.h           |    2 +-
 drivers/net/wireless/ath/ar9170/main.c             |    5 +-
 drivers/net/wireless/ath/ath5k/ath5k.h             |    4 +-
 drivers/net/wireless/ath/ath5k/base.c              |    7 +-
 drivers/net/wireless/ath/ath5k/mac80211-ops.c      |    6 +-
 drivers/net/wireless/ath/ath9k/ar9003_hw.c         |    8 +-
 drivers/net/wireless/ath/ath9k/ath9k.h             |   43 +-
 drivers/net/wireless/ath/ath9k/gpio.c              |  166 +-
 drivers/net/wireless/ath/ath9k/hif_usb.c           |   78 +-
 drivers/net/wireless/ath/ath9k/htc.h               |   77 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c    |  170 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c      |   19 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c      |  452 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c      |   84 +-
 drivers/net/wireless/ath/ath9k/init.c              |   22 +
 drivers/net/wireless/ath/ath9k/main.c              |   15 +-
 drivers/net/wireless/ath/ath9k/recv.c              |    2 +-
 drivers/net/wireless/ath/ath9k/reg.h               |    1 +
 drivers/net/wireless/ath/ath9k/wmi.c               |    4 -
 drivers/net/wireless/ath/carl9170/carl9170.h       |    2 +-
 drivers/net/wireless/ath/carl9170/tx.c             |    5 +-
 drivers/net/wireless/b43/main.c                    |    6 +-
 drivers/net/wireless/b43/phy_n.c                   |   28 +-
 drivers/net/wireless/b43/tables_nphy.c             | 1106 ++++++-
 drivers/net/wireless/b43/tables_nphy.h             |   27 +
 drivers/net/wireless/b43/xmit.c                    |   75 +-
 drivers/net/wireless/b43/xmit.h                    |    6 +
 drivers/net/wireless/b43legacy/main.c              |    5 +-
 drivers/net/wireless/b43legacy/xmit.c              |    2 +-
 drivers/net/wireless/iwlegacy/Kconfig              |  116 +
 drivers/net/wireless/iwlegacy/Makefile             |   25 +
 .../{iwlwifi => iwlegacy}/iwl-3945-debugfs.c       |   11 +-
 .../{iwlwifi => iwlegacy}/iwl-3945-debugfs.h       |    4 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-3945-fh.h   |    5 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-3945-hw.h   |    9 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-3945-led.c  |    4 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-3945-led.h  |    2 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-3945-rs.c   |   41 +-
 .../net/wireless/{iwlwifi => iwlegacy}/iwl-3945.c  |  253 +-
 .../net/wireless/{iwlwifi => iwlegacy}/iwl-3945.h  |   12 +-
 drivers/net/wireless/iwlegacy/iwl-4965-calib.c     |  967 ++++++
 .../iwl-legacy.h => iwlegacy/iwl-4965-calib.h}     |   30 +-
 drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c   |  774 +++++
 .../iwl-4965-debugfs.h}                            |   35 +-
 .../iwl-legacy.h => iwlegacy/iwl-4965-eeprom.c}    |  107 +-
 .../wireless/{iwlwifi => iwlegacy}/iwl-4965-hw.h   |   26 +-
 .../iwl-3945-led.c => iwlegacy/iwl-4965-led.c}     |   30 +-
 .../rtl8192cu/fw.c => iwlegacy/iwl-4965-led.h}     |   17 +-
 drivers/net/wireless/iwlegacy/iwl-4965-lib.c       | 1260 +++++++
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c        | 2870 ++++++++++++++++
 .../iwl-agn-rx.c => iwlegacy/iwl-4965-rx.c}        |  172 +-
 drivers/net/wireless/iwlegacy/iwl-4965-sta.c       |  721 ++++
 drivers/net/wireless/iwlegacy/iwl-4965-tx.c        | 1369 ++++++++
 drivers/net/wireless/iwlegacy/iwl-4965-ucode.c     |  166 +
 .../net/wireless/{iwlwifi => iwlegacy}/iwl-4965.c  |  806 +----
 drivers/net/wireless/iwlegacy/iwl-4965.h           |  282 ++
 drivers/net/wireless/iwlegacy/iwl-commands.h       | 3405 ++++++++++++++++++
 drivers/net/wireless/iwlegacy/iwl-core.c           | 2674 ++++++++++++++
 drivers/net/wireless/iwlegacy/iwl-core.h           |  646 ++++
 drivers/net/wireless/iwlegacy/iwl-csr.h            |  422 +++
 drivers/net/wireless/iwlegacy/iwl-debug.h          |  198 ++
 drivers/net/wireless/iwlegacy/iwl-debugfs.c        | 1467 ++++++++
 drivers/net/wireless/iwlegacy/iwl-dev.h            | 1426 ++++++++
 .../iwl-3945-led.h => iwlegacy/iwl-devtrace.c}     |   23 +-
 drivers/net/wireless/iwlegacy/iwl-devtrace.h       |  270 ++
 drivers/net/wireless/iwlegacy/iwl-eeprom.c         |  561 +++
 drivers/net/wireless/iwlegacy/iwl-eeprom.h         |  344 ++
 drivers/net/wireless/iwlegacy/iwl-fh.h             |  513 +++
 drivers/net/wireless/iwlegacy/iwl-hcmd.c           |  271 ++
 drivers/net/wireless/iwlegacy/iwl-helpers.h        |  181 +
 drivers/net/wireless/iwlegacy/iwl-io.h             |  545 +++
 drivers/net/wireless/iwlegacy/iwl-led.c            |  188 +
 .../{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-led.h} |   34 +-
 drivers/net/wireless/iwlegacy/iwl-legacy-rs.h      |  456 +++
 drivers/net/wireless/iwlegacy/iwl-power.c          |  165 +
 .../iwl-3945-led.c => iwlegacy/iwl-power.h}        |   61 +-
 drivers/net/wireless/iwlegacy/iwl-prph.h           |  523 +++
 drivers/net/wireless/iwlegacy/iwl-rx.c             |  302 ++
 drivers/net/wireless/iwlegacy/iwl-scan.c           |  625 ++++
 drivers/net/wireless/iwlegacy/iwl-spectrum.h       |   92 +
 drivers/net/wireless/iwlegacy/iwl-sta.c            |  816 +++++
 drivers/net/wireless/iwlegacy/iwl-sta.h            |  148 +
 drivers/net/wireless/iwlegacy/iwl-tx.c             |  660 ++++
 .../wireless/{iwlwifi => iwlegacy}/iwl3945-base.c  |  543 ++--
 drivers/net/wireless/iwlegacy/iwl4965-base.c       | 3632 ++++++++++++++++++++
 drivers/net/wireless/iwlwifi/Kconfig               |  124 +-
 drivers/net/wireless/iwlwifi/Makefile              |   41 +-
 drivers/net/wireless/iwlwifi/iwl-1000.c            |    2 -
 drivers/net/wireless/iwlwifi/iwl-2000.c            |    3 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c            |    4 -
 drivers/net/wireless/iwlwifi/iwl-6000.c            |    4 -
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c         |   81 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c        |   58 +-
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c          |   12 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c             |  110 +-
 drivers/net/wireless/iwlwifi/iwl-agn.h             |    6 +-
 drivers/net/wireless/iwlwifi/iwl-commands.h        |  108 +-
 drivers/net/wireless/iwlwifi/iwl-core.c            |   76 +-
 drivers/net/wireless/iwlwifi/iwl-core.h            |   14 +-
 drivers/net/wireless/iwlwifi/iwl-debugfs.c         |    2 -
 drivers/net/wireless/iwlwifi/iwl-dev.h             |   13 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom.c          |    8 -
 drivers/net/wireless/iwlwifi/iwl-hcmd.c            |    5 -
 drivers/net/wireless/iwlwifi/iwl-led.c             |    2 -
 drivers/net/wireless/iwlwifi/iwl-legacy.c          |  657 ----
 drivers/net/wireless/iwlwifi/iwl-power.c           |    3 -
 drivers/net/wireless/iwlwifi/iwl-rx.c              |  392 ++-
 drivers/net/wireless/iwlwifi/iwl-scan.c            |   10 -
 drivers/net/wireless/iwlwifi/iwl-sta.c             |   11 -
 drivers/net/wireless/iwlwifi/iwl-tx.c              |   78 +-
 drivers/net/wireless/libertas_tf/main.c            |    3 +-
 drivers/net/wireless/mac80211_hwsim.c              |    5 +-
 drivers/net/wireless/mwl8k.c                       |   54 +-
 drivers/net/wireless/orinoco/scan.c                |    5 +
 drivers/net/wireless/p54/eeprom.c                  |    7 +-
 drivers/net/wireless/p54/fwio.c                    |    9 +-
 drivers/net/wireless/p54/lmac.h                    |    2 +-
 drivers/net/wireless/p54/main.c                    |   14 +-
 drivers/net/wireless/p54/p54.h                     |    1 +
 drivers/net/wireless/p54/txrx.c                    |   13 +-
 drivers/net/wireless/rt2x00/rt2x00.h               |    2 +-
 drivers/net/wireless/rt2x00/rt2x00mac.c            |    5 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c         |   10 +-
 drivers/net/wireless/rtl818x/rtl8187/dev.c         |    8 +-
 drivers/net/wireless/rtlwifi/Kconfig               |    7 +
 drivers/net/wireless/rtlwifi/Makefile              |    8 +-
 drivers/net/wireless/rtlwifi/base.c                |   15 +-
 drivers/net/wireless/rtlwifi/core.c                |    9 +-
 drivers/net/wireless/rtlwifi/efuse.c               |   18 -
 drivers/net/wireless/rtlwifi/efuse.h               |    3 -
 drivers/net/wireless/rtlwifi/rtl8192c/Makefile     |    9 +
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c  |   12 +-
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h  |  204 ++
 .../{rtl8192ce/fw.c => rtl8192c/fw_common.c}       |   13 +-
 .../{rtl8192ce/fw.h => rtl8192c/fw_common.h}       |    0
 .../rtlwifi/{rtl8192cu/fw.h => rtl8192c/main.c}    |   11 +-
 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c |  137 +-
 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h |  246 ++
 drivers/net/wireless/rtlwifi/rtl8192ce/Makefile    |    1 -
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.c        |    7 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.h        |    2 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/hw.c        |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/hw.h        |   11 +
 drivers/net/wireless/rtlwifi/rtl8192ce/phy.c       |   31 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/phy.h       |   28 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.c        |   10 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h        |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c        |   15 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.h        |   12 +
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c       |   13 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/Makefile    |    1 -
 drivers/net/wireless/rtlwifi/rtl8192cu/dm.c        |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/dm.h        |    2 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c        |    7 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.h        |    9 +
 drivers/net/wireless/rtlwifi/rtl8192cu/phy.c       |   38 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/phy.h       |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c        |   12 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h        |   19 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c        |   17 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.h        |   18 +
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c       |    7 +-
 drivers/net/wireless/rtlwifi/wifi.h                |   12 +
 drivers/net/wireless/wl1251/main.c                 |    4 +-
 drivers/net/wireless/wl1251/rx.c                   |    2 +-
 drivers/net/wireless/wl12xx/acx.c                  |   28 +-
 drivers/net/wireless/wl12xx/acx.h                  |    9 +
 drivers/net/wireless/wl12xx/init.c                 |    2 +-
 drivers/net/wireless/wl12xx/main.c                 |  151 +-
 drivers/net/wireless/wl12xx/ps.c                   |   78 +
 drivers/net/wireless/wl12xx/ps.h                   |    2 +
 drivers/net/wireless/wl12xx/rx.c                   |    6 +-
 drivers/net/wireless/wl12xx/rx.h                   |    4 -
 drivers/net/wireless/wl12xx/tx.c                   |  237 ++-
 drivers/net/wireless/wl12xx/tx.h                   |    5 +-
 drivers/net/wireless/wl12xx/wl12xx.h               |   37 +
 drivers/net/wireless/zd1211rw/zd_mac.c             |    5 +-
 drivers/staging/brcm80211/sys/wl_mac80211.c        |   28 +-
 drivers/staging/brcm80211/sys/wlc_mac80211.c       |    5 +-
 drivers/staging/winbond/wbusb.c                    |    7 +-
 include/linux/nl80211.h                            |    3 +
 include/net/cfg80211.h                             |    5 +-
 include/net/mac80211.h                             |   21 +-
 net/bluetooth/Kconfig                              |    6 +-
 net/mac80211/Kconfig                               |    2 +-
 net/mac80211/cfg.c                                 |   68 +-
 net/mac80211/driver-ops.h                          |   35 +-
 net/mac80211/driver-trace.h                        |   33 +
 net/mac80211/ht.c                                  |    5 +-
 net/mac80211/ibss.c                                |    7 +-
 net/mac80211/ieee80211_i.h                         |    1 +
 net/mac80211/mlme.c                                |   23 +-
 net/mac80211/rx.c                                  |   15 +-
 net/mac80211/sta_info.h                            |    4 +
 net/mac80211/status.c                              |    6 +-
 net/mac80211/tx.c                                  |  164 +-
 net/wireless/nl80211.c                             |   56 +-
 201 files changed, 34374 insertions(+), 3387 deletions(-)
 create mode 100644 drivers/net/wireless/iwlegacy/Kconfig
 create mode 100644 drivers/net/wireless/iwlegacy/Makefile
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-debugfs.c (99%)
 copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-debugfs.h (95%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-fh.h (98%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-hw.h (96%)
 copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-led.c (94%)
 copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-led.h (95%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-rs.c (96%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945.c (92%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945.h (97%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-calib.c
 copy drivers/net/wireless/{iwlwifi/iwl-legacy.h => iwlegacy/iwl-4965-calib.h} (80%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
 rename drivers/net/wireless/{iwlwifi/iwl-3945-debugfs.h => iwlegacy/iwl-4965-debugfs.h} (61%)
 rename drivers/net/wireless/{iwlwifi/iwl-legacy.h => iwlegacy/iwl-4965-eeprom.c} (53%)
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-4965-hw.h (97%)
 copy drivers/net/wireless/{iwlwifi/iwl-3945-led.c => iwlegacy/iwl-4965-led.c} (73%)
 rename drivers/net/wireless/{rtlwifi/rtl8192cu/fw.c => iwlegacy/iwl-4965-led.h} (71%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-lib.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-rs.c
 rename drivers/net/wireless/{iwlwifi/iwl-agn-rx.c => iwlegacy/iwl-4965-rx.c} (60%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-sta.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-tx.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-4965.c (71%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-commands.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-core.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-core.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-csr.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-debug.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-debugfs.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-dev.h
 copy drivers/net/wireless/{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-devtrace.c} (59%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-devtrace.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-eeprom.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-eeprom.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-fh.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-hcmd.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-helpers.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-io.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-led.c
 rename drivers/net/wireless/{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-led.h} (59%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-power.c
 rename drivers/net/wireless/{iwlwifi/iwl-3945-led.c => iwlegacy/iwl-power.h} (56%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-prph.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-rx.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-scan.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-spectrum.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-sta.c
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-sta.h
 create mode 100644 drivers/net/wireless/iwlegacy/iwl-tx.c
 rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl3945-base.c (90%)
 create mode 100644 drivers/net/wireless/iwlegacy/iwl4965-base.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-legacy.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/Makefile
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
 rename drivers/net/wireless/rtlwifi/{rtl8192ce/fw.c => rtl8192c/fw_common.c} (98%)
 rename drivers/net/wireless/rtlwifi/{rtl8192ce/fw.h => rtl8192c/fw_common.h} (100%)
 rename drivers/net/wireless/rtlwifi/{rtl8192cu/fw.h => rtl8192c/main.c} (75%)
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h

Omnibus patch available here:

	http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6-2011-03-04.patch.bz2

-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [RFC PATCH v2 10/12] netdev: mdio-octeon.c: Convert to use device tree.
From: David Daney @ 2011-03-04 19:42 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Daney, David S. Miller
In-Reply-To: <1299267744-17278-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>

Get the MDIO bus controller addresses from the device tree.

Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 arch/mips/cavium-octeon/octeon-platform.c |   30 ---------
 drivers/net/phy/mdio-octeon.c             |   92 +++++++++++++++++++---------
 2 files changed, 62 insertions(+), 60 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 0533351..ce471bd 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -168,36 +168,6 @@ out:
 }
 device_initcall(octeon_rng_device_init);
 
-/* Octeon SMI/MDIO interface.  */
-static int __init octeon_mdiobus_device_init(void)
-{
-	struct platform_device *pd;
-	int ret = 0;
-
-	if (octeon_is_simulation())
-		return 0; /* No mdio in the simulator. */
-
-	/* The bus number is the platform_device id.  */
-	pd = platform_device_alloc("mdio-octeon", 0);
-	if (!pd) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	ret = platform_device_add(pd);
-	if (ret)
-		goto fail;
-
-	return ret;
-fail:
-	platform_device_put(pd);
-
-out:
-	return ret;
-
-}
-device_initcall(octeon_mdiobus_device_init);
-
 /* Octeon mgmt port Ethernet interface.  */
 static int __init octeon_mgmt_device_init(void)
 {
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
index bd12ba9..dd33023 100644
--- a/drivers/net/phy/mdio-octeon.c
+++ b/drivers/net/phy/mdio-octeon.c
@@ -3,13 +3,15 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2009 Cavium Networks
+ * Copyright (C) 2009, 2010, 2011 Cavium Networks
  */
 
-#include <linux/gfp.h>
-#include <linux/init.h>
-#include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/of_mdio.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/gfp.h>
 #include <linux/phy.h>
 
 #include <asm/octeon/octeon.h>
@@ -18,9 +20,17 @@
 #define DRV_VERSION "1.0"
 #define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver"
 
+#define SMI_CMD		0x0
+#define SMI_WR_DAT	0x8
+#define SMI_RD_DAT	0x10
+#define SMI_CLK		0x18
+#define SMI_EN		0x20
+
 struct octeon_mdiobus {
 	struct mii_bus *mii_bus;
-	int unit;
+	u64 register_base;
+	resource_size_t mdio_phys;
+	resource_size_t regsize;
 	int phy_irq[PHY_MAX_ADDR];
 };
 
@@ -35,15 +45,15 @@ static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum)
 	smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */
 	smi_cmd.s.phy_adr = phy_id;
 	smi_cmd.s.reg_adr = regnum;
-	cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
+	cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64);
 
 	do {
 		/*
 		 * Wait 1000 clocks so we don't saturate the RSL bus
 		 * doing reads.
 		 */
-		cvmx_wait(1000);
-		smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit));
+		__delay(1000);
+		smi_rd.u64 = cvmx_read_csr(p->register_base + SMI_RD_DAT);
 	} while (smi_rd.s.pending && --timeout);
 
 	if (smi_rd.s.val)
@@ -62,21 +72,21 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
 
 	smi_wr.u64 = 0;
 	smi_wr.s.dat = val;
-	cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64);
+	cvmx_write_csr(p->register_base + SMI_WR_DAT, smi_wr.u64);
 
 	smi_cmd.u64 = 0;
 	smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */
 	smi_cmd.s.phy_adr = phy_id;
 	smi_cmd.s.reg_adr = regnum;
-	cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
+	cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64);
 
 	do {
 		/*
 		 * Wait 1000 clocks so we don't saturate the RSL bus
 		 * doing reads.
 		 */
-		cvmx_wait(1000);
-		smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit));
+		__delay(1000);
+		smi_wr.u64 = cvmx_read_csr(p->register_base + SMI_WR_DAT);
 	} while (smi_wr.s.pending && --timeout);
 
 	if (timeout <= 0)
@@ -88,8 +98,8 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
 static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
 {
 	struct octeon_mdiobus *bus;
+	struct resource *res_mem;
 	union cvmx_smix_en smi_en;
-	int i;
 	int err = -ENOENT;
 
 	bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
@@ -97,28 +107,36 @@ static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* The platform_device id is our unit number.  */
-	bus->unit = pdev->id;
+	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+	if (res_mem == NULL) {
+		dev_err(&pdev->dev, "found no memory resource\n");
+		err = -ENXIO;
+		goto fail_region;
+	}
+	bus->mdio_phys = res_mem->start;
+	bus->regsize = resource_size(res_mem);
+	if (!devm_request_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize,
+				     res_mem->name)) {
+		dev_err(&pdev->dev, "request_mem_region failed\n");
+		goto fail_region;
+	}
+	bus->register_base = (u64)ioremap(bus->mdio_phys, bus->regsize);
 
 	bus->mii_bus = mdiobus_alloc();
 
 	if (!bus->mii_bus)
-		goto err;
+		goto fail_mdio_alloc;
 
 	smi_en.u64 = 0;
 	smi_en.s.en = 1;
-	cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+	cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
 
-	/*
-	 * Standard Octeon evaluation boards don't support phy
-	 * interrupts, we need to poll.
-	 */
-	for (i = 0; i < PHY_MAX_ADDR; i++)
-		bus->phy_irq[i] = PHY_POLL;
 
 	bus->mii_bus->priv = bus;
 	bus->mii_bus->irq = bus->phy_irq;
 	bus->mii_bus->name = "mdio-octeon";
-	snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%x", bus->unit);
+	snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base);
 	bus->mii_bus->parent = &pdev->dev;
 
 	bus->mii_bus->read = octeon_mdiobus_read;
@@ -126,20 +144,23 @@ static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(&pdev->dev, bus);
 
-	err = mdiobus_register(bus->mii_bus);
+	err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node);
 	if (err)
-		goto err_register;
+		goto fail_register;
 
 	dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
 
 	return 0;
-err_register:
+fail_register:
 	mdiobus_free(bus->mii_bus);
 
-err:
-	devm_kfree(&pdev->dev, bus);
+fail_mdio_alloc:
+	devm_release_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize);
+
+fail_region:
 	smi_en.u64 = 0;
-	cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+	cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
+	devm_kfree(&pdev->dev, bus);
 	return err;
 }
 
@@ -152,15 +173,26 @@ static int __devexit octeon_mdiobus_remove(struct platform_device *pdev)
 
 	mdiobus_unregister(bus->mii_bus);
 	mdiobus_free(bus->mii_bus);
+	devm_release_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize);
 	smi_en.u64 = 0;
-	cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+	cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
+	devm_kfree(&pdev->dev, bus);
 	return 0;
 }
 
+static struct of_device_id octeon_mdiobus_match[] = {
+	{
+		.compatible = "cavium,octeon-3860-mdio",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, octeon_mdiobus_match);
+
 static struct platform_driver octeon_mdiobus_driver = {
 	.driver = {
 		.name		= "mdio-octeon",
 		.owner		= THIS_MODULE,
+		.of_match_table = octeon_mdiobus_match,
 	},
 	.probe		= octeon_mdiobus_probe,
 	.remove		= __devexit_p(octeon_mdiobus_remove),
-- 
1.7.2.3

^ permalink raw reply related

* [RFC PATCH v2 11/12] netdev: octeon_mgmt: Convert to use device tree.
From: David Daney @ 2011-03-04 19:42 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Daney, David S. Miller
In-Reply-To: <1299267744-17278-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>

The device tree will supply the register bank base addresses, make
register addressing relative to those.  PHY connection is now
described by the device tree.

Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 arch/mips/cavium-octeon/octeon-platform.c |   62 ------
 drivers/net/octeon/octeon_mgmt.c          |  321 +++++++++++++++++++----------
 2 files changed, 217 insertions(+), 166 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index ce471bd..104713c 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -168,68 +168,6 @@ out:
 }
 device_initcall(octeon_rng_device_init);
 
-/* Octeon mgmt port Ethernet interface.  */
-static int __init octeon_mgmt_device_init(void)
-{
-	struct platform_device *pd;
-	int ret = 0;
-	int port, num_ports;
-
-	struct resource mgmt_port_resource = {
-		.flags	= IORESOURCE_IRQ,
-		.start	= -1,
-		.end	= -1
-	};
-
-	if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX))
-		return 0;
-
-	if (OCTEON_IS_MODEL(OCTEON_CN56XX))
-		num_ports = 1;
-	else
-		num_ports = 2;
-
-	for (port = 0; port < num_ports; port++) {
-		pd = platform_device_alloc("octeon_mgmt", port);
-		if (!pd) {
-			ret = -ENOMEM;
-			goto out;
-		}
-		/* No DMA restrictions */
-		pd->dev.coherent_dma_mask = DMA_BIT_MASK(64);
-		pd->dev.dma_mask = &pd->dev.coherent_dma_mask;
-
-		switch (port) {
-		case 0:
-			mgmt_port_resource.start = OCTEON_IRQ_MII0;
-			break;
-		case 1:
-			mgmt_port_resource.start = OCTEON_IRQ_MII1;
-			break;
-		default:
-			BUG();
-		}
-		mgmt_port_resource.end = mgmt_port_resource.start;
-
-		ret = platform_device_add_resources(pd, &mgmt_port_resource, 1);
-
-		if (ret)
-			goto fail;
-
-		ret = platform_device_add(pd);
-		if (ret)
-			goto fail;
-	}
-	return ret;
-fail:
-	platform_device_put(pd);
-
-out:
-	return ret;
-
-}
-device_initcall(octeon_mgmt_device_init);
-
 #ifdef CONFIG_USB
 
 static int __init octeon_ehci_device_init(void)
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
index b264f0f..17be326 100644
--- a/drivers/net/octeon/octeon_mgmt.c
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -6,16 +6,18 @@
  * Copyright (C) 2009 Cavium Networks
  */
 
-#include <linux/capability.h>
-#include <linux/dma-mapping.h>
-#include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/netdevice.h>
+#include <linux/dma-mapping.h>
 #include <linux/etherdevice.h>
+#include <linux/capability.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
 #include <linux/if_vlan.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/phy.h>
-#include <linux/spinlock.h>
 
 #include <asm/octeon/octeon.h>
 #include <asm/octeon/cvmx-mixx-defs.h>
@@ -55,8 +57,56 @@ union mgmt_port_ring_entry {
 	} s;
 };
 
+#define MIX_ORING1	0x0
+#define MIX_ORING2	0x8
+#define MIX_IRING1	0x10
+#define MIX_IRING2	0x18
+#define MIX_CTL		0x20
+#define MIX_IRHWM	0x28
+#define MIX_IRCNT	0x30
+#define MIX_ORHWM	0x38
+#define MIX_ORCNT	0x40
+#define MIX_ISR		0x48
+#define MIX_INTENA	0x50
+#define MIX_REMCNT	0x58
+#define MIX_BIST	0x78
+
+#define AGL_GMX_PRT_CFG			0x10
+#define AGL_GMX_RX_FRM_CTL		0x18
+#define AGL_GMX_RX_FRM_MAX		0x30
+#define AGL_GMX_RX_JABBER		0x38
+#define AGL_GMX_RX_STATS_CTL		0x50
+
+#define AGL_GMX_RX_STATS_PKTS_DRP	0xb0
+#define AGL_GMX_RX_STATS_OCTS_DRP	0xb8
+#define AGL_GMX_RX_STATS_PKTS_BAD	0xc0
+
+#define AGL_GMX_RX_ADR_CTL		0x100
+#define AGL_GMX_RX_ADR_CAM_EN		0x108
+#define AGL_GMX_RX_ADR_CAM0		0x180
+#define AGL_GMX_RX_ADR_CAM1		0x188
+#define AGL_GMX_RX_ADR_CAM2		0x190
+#define AGL_GMX_RX_ADR_CAM3		0x198
+#define AGL_GMX_RX_ADR_CAM4		0x1a0
+#define AGL_GMX_RX_ADR_CAM5		0x1a8
+
+#define AGL_GMX_TX_STATS_CTL		0x268
+#define AGL_GMX_TX_CTL			0x270
+#define AGL_GMX_TX_STAT0		0x280
+#define AGL_GMX_TX_STAT1		0x288
+#define AGL_GMX_TX_STAT2		0x290
+#define AGL_GMX_TX_STAT3		0x298
+#define AGL_GMX_TX_STAT4		0x2a0
+#define AGL_GMX_TX_STAT5		0x2a8
+#define AGL_GMX_TX_STAT6		0x2b0
+#define AGL_GMX_TX_STAT7		0x2b8
+#define AGL_GMX_TX_STAT8		0x2c0
+#define AGL_GMX_TX_STAT9		0x2c8
+
 struct octeon_mgmt {
 	struct net_device *netdev;
+	u64 mix;
+	u64 agl;
 	int port;
 	int irq;
 	u64 *tx_ring;
@@ -82,31 +132,34 @@ struct octeon_mgmt {
 	struct napi_struct napi;
 	struct tasklet_struct tx_clean_tasklet;
 	struct phy_device *phydev;
+	struct device_node *phy_np;
+	resource_size_t mix_phys;
+	resource_size_t mix_size;
+	resource_size_t agl_phys;
+	resource_size_t agl_size;
 };
 
 static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable)
 {
-	int port = p->port;
 	union cvmx_mixx_intena mix_intena;
 	unsigned long flags;
 
 	spin_lock_irqsave(&p->lock, flags);
-	mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
+	mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA);
 	mix_intena.s.ithena = enable ? 1 : 0;
-	cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+	cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
 	spin_unlock_irqrestore(&p->lock, flags);
 }
 
 static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable)
 {
-	int port = p->port;
 	union cvmx_mixx_intena mix_intena;
 	unsigned long flags;
 
 	spin_lock_irqsave(&p->lock, flags);
-	mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
+	mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA);
 	mix_intena.s.othena = enable ? 1 : 0;
-	cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+	cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
 	spin_unlock_irqrestore(&p->lock, flags);
 }
 
@@ -143,7 +196,6 @@ static unsigned int ring_size_to_bytes(unsigned int ring_size)
 static void octeon_mgmt_rx_fill_ring(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 
 	while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) {
 		unsigned int size;
@@ -174,24 +226,23 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev)
 			(p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE;
 		p->rx_current_fill++;
 		/* Ring the bell.  */
-		cvmx_write_csr(CVMX_MIXX_IRING2(port), 1);
+		cvmx_write_csr(p->mix + MIX_IRING2, 1);
 	}
 }
 
 static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
 {
-	int port = p->port;
 	union cvmx_mixx_orcnt mix_orcnt;
 	union mgmt_port_ring_entry re;
 	struct sk_buff *skb;
 	int cleaned = 0;
 	unsigned long flags;
 
-	mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+	mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
 	while (mix_orcnt.s.orcnt) {
 		spin_lock_irqsave(&p->tx_list.lock, flags);
 
-		mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+		mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
 
 		if (mix_orcnt.s.orcnt == 0) {
 			spin_unlock_irqrestore(&p->tx_list.lock, flags);
@@ -211,7 +262,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
 		mix_orcnt.s.orcnt = 1;
 
 		/* Acknowledge to hardware that we have the buffer.  */
-		cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64);
+		cvmx_write_csr(p->mix + MIX_ORCNT, mix_orcnt.u64);
 		p->tx_current_fill--;
 
 		spin_unlock_irqrestore(&p->tx_list.lock, flags);
@@ -221,7 +272,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
 		dev_kfree_skb_any(skb);
 		cleaned++;
 
-		mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+		mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
 	}
 
 	if (cleaned && netif_queue_stopped(p->netdev))
@@ -238,13 +289,12 @@ static void octeon_mgmt_clean_tx_tasklet(unsigned long arg)
 static void octeon_mgmt_update_rx_stats(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	unsigned long flags;
 	u64 drop, bad;
 
 	/* These reads also clear the count registers.  */
-	drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port));
-	bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port));
+	drop = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP);
+	bad = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD);
 
 	if (drop || bad) {
 		/* Do an atomic update. */
@@ -258,15 +308,14 @@ static void octeon_mgmt_update_rx_stats(struct net_device *netdev)
 static void octeon_mgmt_update_tx_stats(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	unsigned long flags;
 
 	union cvmx_agl_gmx_txx_stat0 s0;
 	union cvmx_agl_gmx_txx_stat1 s1;
 
 	/* These reads also clear the count registers.  */
-	s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port));
-	s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port));
+	s0.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT0);
+	s1.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT1);
 
 	if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) {
 		/* Do an atomic update. */
@@ -305,7 +354,6 @@ static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p,
 
 static int octeon_mgmt_receive_one(struct octeon_mgmt *p)
 {
-	int port = p->port;
 	struct net_device *netdev = p->netdev;
 	union cvmx_mixx_ircnt mix_ircnt;
 	union mgmt_port_ring_entry re;
@@ -378,18 +426,17 @@ done:
 	/* Tell the hardware we processed a packet.  */
 	mix_ircnt.u64 = 0;
 	mix_ircnt.s.ircnt = 1;
-	cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64);
+	cvmx_write_csr(p->mix + MIX_IRCNT, mix_ircnt.u64);
 	return rc;
 }
 
 static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget)
 {
-	int port = p->port;
 	unsigned int work_done = 0;
 	union cvmx_mixx_ircnt mix_ircnt;
 	int rc;
 
-	mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
+	mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT);
 	while (work_done < budget && mix_ircnt.s.ircnt) {
 
 		rc = octeon_mgmt_receive_one(p);
@@ -397,7 +444,7 @@ static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget)
 			work_done++;
 
 		/* Check for more packets. */
-		mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
+		mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT);
 	}
 
 	octeon_mgmt_rx_fill_ring(p->netdev);
@@ -431,16 +478,16 @@ static void octeon_mgmt_reset_hw(struct octeon_mgmt *p)
 	union cvmx_agl_gmx_bist agl_gmx_bist;
 
 	mix_ctl.u64 = 0;
-	cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
+	cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
 	do {
-		mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port));
+		mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
 	} while (mix_ctl.s.busy);
 	mix_ctl.s.reset = 1;
-	cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
-	cvmx_read_csr(CVMX_MIXX_CTL(p->port));
+	cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
+	cvmx_read_csr(p->mix + MIX_CTL);
 	cvmx_wait(64);
 
-	mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port));
+	mix_bist.u64 = cvmx_read_csr(p->mix + MIX_BIST);
 	if (mix_bist.u64)
 		dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n",
 			(unsigned long long)mix_bist.u64);
@@ -471,7 +518,6 @@ static void octeon_mgmt_cam_state_add(struct octeon_mgmt_cam_state *cs,
 static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	union cvmx_agl_gmx_rxx_adr_ctl adr_ctl;
 	union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx;
 	unsigned long flags;
@@ -517,29 +563,29 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
 	spin_lock_irqsave(&p->lock, flags);
 
 	/* Disable packet I/O. */
-	agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+	agl_gmx_prtx.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 	prev_packet_enable = agl_gmx_prtx.s.en;
 	agl_gmx_prtx.s.en = 0;
-	cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64);
 
 	adr_ctl.u64 = 0;
 	adr_ctl.s.cam_mode = cam_mode;
 	adr_ctl.s.mcst = multicast_mode;
 	adr_ctl.s.bcst = 1;     /* Allow broadcast */
 
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CTL, adr_ctl.u64);
 
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM0, cam_state.cam[0]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM1, cam_state.cam[1]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM2, cam_state.cam[2]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM3, cam_state.cam[3]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM4, cam_state.cam[4]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM5, cam_state.cam[5]);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM_EN, cam_state.cam_mask);
 
 	/* Restore packet I/O. */
 	agl_gmx_prtx.s.en = prev_packet_enable;
-	cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64);
 
 	spin_unlock_irqrestore(&p->lock, flags);
 }
@@ -561,7 +607,6 @@ static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr)
 static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM;
 
 	/*
@@ -577,8 +622,8 @@ static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
 
 	netdev->mtu = new_mtu;
 
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port),
+	cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_MAX, size_without_fcs);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_JABBER,
 		       (size_without_fcs + 7) & 0xfff8);
 
 	return 0;
@@ -588,14 +633,13 @@ static irqreturn_t octeon_mgmt_interrupt(int cpl, void *dev_id)
 {
 	struct net_device *netdev = dev_id;
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	union cvmx_mixx_isr mixx_isr;
 
-	mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port));
+	mixx_isr.u64 = cvmx_read_csr(p->mix + MIX_ISR);
 
 	/* Clear any pending interrupts */
-	cvmx_write_csr(CVMX_MIXX_ISR(port), mixx_isr.u64);
-	cvmx_read_csr(CVMX_MIXX_ISR(port));
+	cvmx_write_csr(p->mix + MIX_ISR, mixx_isr.u64);
+	cvmx_read_csr(p->mix + MIX_ISR);
 
 	if (mixx_isr.s.irthresh) {
 		octeon_mgmt_disable_rx_irq(p);
@@ -626,7 +670,6 @@ static int octeon_mgmt_ioctl(struct net_device *netdev,
 static void octeon_mgmt_adjust_link(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	union cvmx_agl_gmx_prtx_cfg prtx_cfg;
 	unsigned long flags;
 	int link_changed = 0;
@@ -637,11 +680,9 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
 			link_changed = 1;
 		if (p->last_duplex != p->phydev->duplex) {
 			p->last_duplex = p->phydev->duplex;
-			prtx_cfg.u64 =
-				cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+			prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 			prtx_cfg.s.duplex = p->phydev->duplex;
-			cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port),
-				       prtx_cfg.u64);
+			cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
 		}
 	} else {
 		if (p->last_link)
@@ -667,18 +708,16 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
 static int octeon_mgmt_init_phy(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	char phy_id[20];
 
-	if (octeon_is_simulation()) {
+	if (octeon_is_simulation() || p->phy_np == NULL) {
 		/* No PHYs in the simulator. */
 		netif_carrier_on(netdev);
 		return 0;
 	}
 
-	snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port);
-
-	p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
-				PHY_INTERFACE_MODE_MII);
+	p->phydev = of_phy_connect(netdev, p->phy_np,
+				   octeon_mgmt_adjust_link, 0,
+				   PHY_INTERFACE_MODE_MII);
 
 	if (IS_ERR(p->phydev)) {
 		p->phydev = NULL;
@@ -734,14 +773,14 @@ static int octeon_mgmt_open(struct net_device *netdev)
 
 	octeon_mgmt_reset_hw(p);
 
-	mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
+	mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
 
 	/* Bring it out of reset if needed. */
 	if (mix_ctl.s.reset) {
 		mix_ctl.s.reset = 0;
-		cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
+		cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
 		do {
-			mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
+			mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
 		} while (mix_ctl.s.reset);
 	}
 
@@ -752,17 +791,17 @@ static int octeon_mgmt_open(struct net_device *netdev)
 	oring1.u64 = 0;
 	oring1.s.obase = p->tx_ring_handle >> 3;
 	oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE;
-	cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64);
+	cvmx_write_csr(p->mix + MIX_ORING1, oring1.u64);
 
 	iring1.u64 = 0;
 	iring1.s.ibase = p->rx_ring_handle >> 3;
 	iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE;
-	cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64);
+	cvmx_write_csr(p->mix + MIX_IRING1, iring1.u64);
 
 	/* Disable packet I/O. */
-	prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+	prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 	prtx_cfg.s.en = 0;
-	cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
 
 	memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN);
 	octeon_mgmt_set_mac_address(netdev, &sa);
@@ -779,7 +818,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
 	mix_ctl.s.nbtarb = 0;       /* Arbitration mode */
 	/* MII CB-request FIFO programmable high watermark */
 	mix_ctl.s.mrq_hwm = 1;
-	cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
+	cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
 
 	if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
 	    || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) {
@@ -806,16 +845,16 @@ static int octeon_mgmt_open(struct net_device *netdev)
 
 	/* Clear statistics. */
 	/* Clear on read. */
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0);
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_CTL, 1);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP, 0);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD, 0);
 
-	cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1);
-	cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0);
-	cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0);
+	cvmx_write_csr(p->agl + AGL_GMX_TX_STATS_CTL, 1);
+	cvmx_write_csr(p->agl + AGL_GMX_TX_STAT0, 0);
+	cvmx_write_csr(p->agl + AGL_GMX_TX_STAT1, 0);
 
 	/* Clear any pending interrupts */
-	cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port)));
+	cvmx_write_csr(p->mix + MIX_ISR, cvmx_read_csr(p->mix + MIX_ISR));
 
 	if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name,
 			netdev)) {
@@ -826,18 +865,18 @@ static int octeon_mgmt_open(struct net_device *netdev)
 	/* Interrupt every single RX packet */
 	mix_irhwm.u64 = 0;
 	mix_irhwm.s.irhwm = 0;
-	cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64);
+	cvmx_write_csr(p->mix + MIX_IRHWM, mix_irhwm.u64);
 
 	/* Interrupt when we have 1 or more packets to clean.  */
 	mix_orhwm.u64 = 0;
 	mix_orhwm.s.orhwm = 1;
-	cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64);
+	cvmx_write_csr(p->mix + MIX_ORHWM, mix_orhwm.u64);
 
 	/* Enable receive and transmit interrupts */
 	mix_intena.u64 = 0;
 	mix_intena.s.ithena = 1;
 	mix_intena.s.othena = 1;
-	cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+	cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
 
 
 	/* Enable packet I/O. */
@@ -868,7 +907,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
 	 * frame.  GMX checks that the PREAMBLE is sent correctly.
 	 */
 	rxx_frm_ctl.s.pre_chk = 1;
-	cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_CTL, rxx_frm_ctl.u64);
 
 	/* Enable the AGL block */
 	agl_gmx_inf_mode.u64 = 0;
@@ -876,13 +915,13 @@ static int octeon_mgmt_open(struct net_device *netdev)
 	cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64);
 
 	/* Configure the port duplex and enables */
-	prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+	prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 	prtx_cfg.s.tx_en = 1;
 	prtx_cfg.s.rx_en = 1;
 	prtx_cfg.s.en = 1;
 	p->last_duplex = 1;
 	prtx_cfg.s.duplex = p->last_duplex;
-	cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
+	cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
 
 	p->last_link = 0;
 	netif_carrier_off(netdev);
@@ -946,7 +985,6 @@ static int octeon_mgmt_stop(struct net_device *netdev)
 static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	int port = p->port;
 	union mgmt_port_ring_entry re;
 	unsigned long flags;
 	int rv = NETDEV_TX_BUSY;
@@ -990,7 +1028,7 @@ static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
 	netdev->stats.tx_bytes += skb->len;
 
 	/* Ring the bell.  */
-	cvmx_write_csr(CVMX_MIXX_ORING2(port), 1);
+	cvmx_write_csr(p->mix + MIX_ORING2, 1);
 
 	rv = NETDEV_TX_OK;
 out:
@@ -1069,10 +1107,14 @@ static const struct net_device_ops octeon_mgmt_ops = {
 
 static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
 {
-	struct resource *res_irq;
 	struct net_device *netdev;
 	struct octeon_mgmt *p;
-	int i;
+	const __be32 *data;
+	const u8 *mac;
+	struct resource *res_mix;
+	struct resource *res_agl;
+	int len;
+	int result;
 
 	netdev = alloc_etherdev(sizeof(struct octeon_mgmt));
 	if (netdev == NULL)
@@ -1086,14 +1128,63 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
 	p->netdev = netdev;
 	p->dev = &pdev->dev;
 
-	p->port = pdev->id;
+	data = of_get_property(pdev->dev.of_node, "cell-index", &len);
+	if (data && len == sizeof(*data)) {
+		p->port = be32_to_cpup(data);
+	} else {
+		dev_err(&pdev->dev, "no 'cell-index' property\n");
+		result = -ENXIO;
+		goto err;
+	}
+
 	snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port);
 
-	res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res_irq)
+	result = platform_get_irq(pdev, 0);
+	if (result < 0)
+		goto err;
+
+	p->irq = result;
+
+	res_mix = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res_mix == NULL) {
+		dev_err(&pdev->dev, "no 'reg' resource\n");
+		result = -ENXIO;
+		goto err;
+	}
+
+	res_agl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (res_agl == NULL) {
+		dev_err(&pdev->dev, "no 'reg' resource\n");
+		result = -ENXIO;
 		goto err;
+	}
+
+	p->mix_phys = res_mix->start;
+	p->mix_size = resource_size(res_mix);
+	p->agl_phys = res_agl->start;
+	p->agl_size = resource_size(res_agl);
+
+
+	if (!devm_request_mem_region(&pdev->dev, p->mix_phys, p->mix_size,
+				     res_mix->name)) {
+		dev_err(&pdev->dev, "request_mem_region (%s) failed\n",
+			res_mix->name);
+		result = -ENXIO;
+		goto err;
+	}
+
+	if (!devm_request_mem_region(&pdev->dev, p->agl_phys, p->agl_size,
+				     res_agl->name)) {
+		result = -ENXIO;
+		dev_err(&pdev->dev, "request_mem_region (%s) failed\n",
+			res_agl->name);
+		goto fail_region1;
+	}
+
+
+	p->mix = (u64)ioremap(p->mix_phys, p->mix_size);
+	p->agl = (u64)ioremap(p->agl_phys, p->agl_size);
 
-	p->irq = res_irq->start;
 	spin_lock_init(&p->lock);
 
 	skb_queue_head_init(&p->tx_list);
@@ -1104,39 +1195,61 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
 	netdev->netdev_ops = &octeon_mgmt_ops;
 	netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;
 
-	/* The mgmt ports get the first N MACs.  */
-	for (i = 0; i < 6; i++)
-		netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i];
-	netdev->dev_addr[5] += p->port;
+	mac = of_get_mac_address(pdev->dev.of_node);
 
-	if (p->port >= octeon_bootinfo->mac_addr_count)
-		dev_err(&pdev->dev,
-			"Error %s: Using MAC outside of the assigned range: %pM\n",
-			netdev->name, netdev->dev_addr);
+	if (mac)
+		memcpy(netdev->dev_addr, mac, 6);
 
-	if (register_netdev(netdev))
-		goto err;
+	p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
+
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
+	pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+
+	result = register_netdev(netdev);
+	if (result)
+		goto fail_region2;
 
 	dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
 	return 0;
+
+fail_region2:
+	iounmap((void *)p->agl);
+	iounmap((void *)p->mix);
+	devm_release_mem_region(&pdev->dev, p->agl_phys, p->agl_size);
+fail_region1:
+	devm_release_mem_region(&pdev->dev, p->mix_phys, p->mix_size);
 err:
 	free_netdev(netdev);
-	return -ENOENT;
+	return result;
 }
 
 static int __devexit octeon_mgmt_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = dev_get_drvdata(&pdev->dev);
+	struct octeon_mgmt *p = netdev_priv(netdev);
 
 	unregister_netdev(netdev);
+	iounmap((void *)p->agl);
+	iounmap((void *)p->mix);
+	devm_release_mem_region(&pdev->dev, p->agl_phys, p->agl_size);
+	devm_release_mem_region(&pdev->dev, p->mix_phys, p->mix_size);
 	free_netdev(netdev);
 	return 0;
 }
 
+static struct of_device_id octeon_mgmt_match[] = {
+	{
+		.compatible = "cavium,octeon-5750-mix",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, octeon_mgmt_match);
+
 static struct platform_driver octeon_mgmt_driver = {
 	.driver = {
 		.name		= "octeon_mgmt",
 		.owner		= THIS_MODULE,
+		.of_match_table = octeon_mgmt_match,
 	},
 	.probe		= octeon_mgmt_probe,
 	.remove		= __devexit_p(octeon_mgmt_remove),
-- 
1.7.2.3

^ permalink raw reply related


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