Netdev List
 help / color / mirror / Atom feed
* Re: [RFC:] struct net_device_ops: Add function pointer to fill device specific ndisc information
From: Waskiewicz Jr, Peter P @ 2013-01-20 21:22 UTC (permalink / raw)
  To: Stephan Gatzka; +Cc: linux1394-devel, netdev, yoshfuji, stefanr, davem
In-Reply-To: <50FC2EE4.3080705@gmail.com>

On Sun, Jan 20, 2013 at 06:52:36PM +0100, Stephan Gatzka wrote:
> I've implemented IPv6 over firewire. Right now I'm facing the
> problem that the corresponding RFC3146 requires very firewire
> specific information sent during neighborhood discovery.
> 
> There was already a discussion on the linux1394 mailing list
> (http://sourceforge.net/mailarchive/message.php?msg_id=30342089 and http://sourceforge.net/mailarchive/forum.php?thread_name=50E4A3E5.8080304%40gmail.com&forum_name=linux1394-devel)
> 
> 
> During that discussion all participants agreed that it makes no
> sense to introduce a dependency between the ndisc code and the
> firewire net driver.
> 
> So the most appealing option seems to be to introduce on more
> callback routine either in struct net_device or struct
> net_device_ops:
> 
> int (*ndo_fill_llao)(void *llao);
> 
> Because I'm not so familiar with the structure of the whole network
> infrastructure in Linux, I need some advice if struct net_device or
> struct net_device_ops is the right place.
> 
> Maybe it's worth to generalize this and do the same for IPv4/ARP
> because right now the ARP packets are mangled in the firewire net
> driver.
> 
> Nevertheless, I've to admit that right now it seems that only IPv6
> over firewire requires such a callback routine.

I'm no expert on firewire requirements, but if you go down the path
of adding a net_device_ops member, I'd recommend adding a pointer
to your own struct of ops.  This would be similar to wireless ops.

Only a suggestion, since you may still need to add more ops later
on, and this way you can contain the inflation to a firewire-specific
struct of function pointers.

Cheers,
-PJ

^ permalink raw reply

* Re: [RFC:] struct net_device_ops: Add function pointer to fill device specific ndisc information
From: Stephan Gatzka @ 2013-01-20 21:23 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, linux1394-devel, David Miller
In-Reply-To: <50FC3BB1.4070005@linux-ipv6.org>

On 01/20/2013 07:47 PM, YOSHIFUJI Hideaki wrote:

> My current position is to change "mac address" to
>
> struct fwnet_hwaddr {
> 	u8	guid[8];
> 	u8	max_rec;
> 	u8	sspd;
> 	u8	fifo[6];
> };
>

That is something I'm not really convinced of. As Stefan Richter pointed 
out clearly, the fifo address might be different between IPv4 and IPv6 
communication.

Stephan

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012

^ permalink raw reply

* Re: [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure
From: Shmulik Ladkani @ 2013-01-20 21:38 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: netdev, bridge, davem, shemminger, mst
In-Reply-To: <1358360289-23249-3-git-send-email-vyasevic@redhat.com>

Hi Vlad,

On Wed, 16 Jan 2013 13:17:57 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
> @@ -156,6 +183,7 @@ struct net_bridge_port
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	struct netpoll			*np;
>  #endif
> +	struct net_port_vlans		vlan_info;

(here and at 'struct net_bridge' as well)

Not sure what the policy is; Isn't it preferred to enclose the new
fields under CONFIG_BRIDGE_VLAN_FILTERING?

> +static inline struct net_bridge *vlans_to_bridge(struct net_port_vlans *vlans)
> +{
> +	struct net_bridge *br;
> +
> +	if (!vlans->port_idx)
> +		br = container_of((vlans), struct net_bridge, vlan_info);
> +	else
> +		br = vlans_to_port(vlans)->br;
> +
> +	return br;
> +}

Guess it would simplify things if the bridge "master port" had an 'nbp'
representation of its own ;-)

> +extern struct net_bridge_vlan *br_vlan_find(struct net_bridge *br, u16 vid);

Seems 'br_vlan_find' can be declared static within br_vlan.c.

> +extern void br_vlan_flush(struct net_bridge *br);

According to your preference, consider s/br_vlan_flush/br_vlans_flush/
since it better suggest acting on all bridge's vlans.

> +extern void nbp_vlan_flush(struct net_port_vlans *vlans);

According to your preference, consider s/nbp_vlan_flush/nbp_vlans_flush/
since it better suggest acting on all port's vlans.

> +void br_vlan_flush(struct net_bridge *br)
> +{
> +	struct net_bridge_vlan *vlan;
> +	struct hlist_node *node;
> +	struct hlist_node *tmp;
> +	int i;
> +
> +	nbp_vlan_flush(&br->vlan_info);
> +
> +	/* Make sure that there are no vlans left in the bridge after
> +	* all the ports have been removed.
> +	*/

Improper indent.

> +	for (i = 0; i < BR_VID_HASH_SIZE; i++) {
> +		hlist_for_each_entry_safe(vlan, node, tmp,
> +					  &br->vlan_hlist[i], hlist) {
> +			br_vlan_del(vlan);

Can there be any vlans left at that point? Shouldn't del_nbp() on all
ports take care of that?
Also, if there _were_ any vlans left (whose bitmap isn't cleared),
'br_vlan_del' won't do a thing.
Am I missing something?

Regards,
Shmulik

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Steven Rostedt @ 2013-01-20 22:07 UTC (permalink / raw)
  To: Tom St Denis
  Cc: Borislav Petkov, Eric Dumazet, Waskiewicz Jr, Peter P,
	David Miller, steffen klassert, herbert, linux-kernel, netdev,
	Michal Kubecek, Mike Galbraith
In-Reply-To: <313650836.93071.1358686587647.JavaMail.root@elliptictech.com>

On Sun, Jan 20, 2013 at 07:56:27AM -0500, Tom St Denis wrote:
> 
> You should really try running checkpatch.pl over code that's already in the kernel before you call out new contributors on it.
> 
> How is this supposed to not be adversarial when I can't even use the Kernel source itself as a reference?

So there's a lot of crap code in the kernel (that we are trying to clean
up when we have the time... see Kernel Janitors). But that's still no
excuse to allow more crap code to enter. That means adding more crap to
clean up.

-- Steve

^ permalink raw reply

* Re: [PATCH] tcp: fix incorrect LOCKDROPPEDICMPS counter
From: David Miller @ 2013-01-20 22:22 UTC (permalink / raw)
  To: ncardwell; +Cc: eric.dumazet, netdev, maze
In-Reply-To: <CADVnQynpupJ3HTmSP3dxEE6MGi0bpq=B_WQMqdxnmxNSQLq3OA@mail.gmail.com>

From: Neal Cardwell <ncardwell@google.com>
Date: Sat, 19 Jan 2013 23:19:14 -0500

> On Sat, Jan 19, 2013 at 9:10 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> From: Eric Dumazet <edumazet@google.com>
>>
>> commit 563d34d057 (tcp: dont drop MTU reduction indications)
>> added an error leading to incorrect accounting of
>> LINUX_MIB_LOCKDROPPEDICMPS
>>
>> If socket is owned by the user, we want to increment
>> this SNMP counter, unless the message is a
>> (ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED) one.
>>
>> Reported-by: Maciej Żenczykowski <maze@google.com>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> Cc: Neal Cardwell <ncardwell@google.com>
> 
> Acked-by: Neal Cardwell <ncardwell@google.com>

Applied, thanks everyone.

^ permalink raw reply

* Re: [PATCH net-next V6 03/14] bridge: Validate that vlan is permitted on ingress
From: Shmulik Ladkani @ 2013-01-20 22:27 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: netdev, bridge, davem, shemminger, mst
In-Reply-To: <1358360289-23249-4-git-send-email-vyasevic@redhat.com>

Hi Vlad,

On Wed, 16 Jan 2013 13:17:58 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
> @@ -45,6 +45,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
>  	brstats->tx_bytes += skb->len;
>  	u64_stats_update_end(&brstats->syncp);
>  
> +	if (!br_allowed_ingress(&br->vlan_info, skb))
> +		goto out;
> +

Shouldn't you consume the 'skb' in case "not allowed"? the 'out' label
doesn't take care of that.

> +bool br_allowed_ingress(struct net_port_vlans *v, struct sk_buff *skb)
> +{
> +	struct net_port_vlan *pve;
> +	u16 vid;
> +
> +	/* If there are no vlan in the permitted list, all packets are
> +	 * permitted.
> +	 */
> +	if (list_empty(&v->vlan_list))
> +		return true;

Rethinking this, after discussed at [1].
The above means the port having no vlans is actually a member of every
possible vlan.
IMO it might not be what users expect, and may complicate things.

Maybe we should adapt a simpler approach:
If the bridge is a vlan enabled bridge, and the port is not a member of
the given vid, drop.
If the bridge is "vlan disabled", then all packets are permitted.

Regards,
Shmulik

[1]
http://marc.info/?l=linux-netdev&m=135602065425514&w=2

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Steven Rostedt @ 2013-01-20 22:54 UTC (permalink / raw)
  To: Tom St Denis; +Cc: David Dillow, linux-kernel, netdev
In-Reply-To: <391440283.93368.1358707621420.JavaMail.root@elliptictech.com>

On Sun, Jan 20, 2013 at 01:47:01PM -0500, Tom St Denis wrote:
> 
> 
> > 
> > You mean the content at http://lkml.org/lkml/2012/12/11/369 ?
> > 
> > Funny how posting to an mailing list works...
> 
> I posted that in December ... it wasn't till January that I got the first reply back about it failing to meet the coding "standards."  Do you honestly expect people to sit on their hands for a month each time simple requests float by?

You posted in mid December. Guess what, that's a high time for people to
take off for vacations. Also it's a time where a lot of year end work
needs to get done and yes, new code does get pushed to the bottom of the
priority list.

A polite "ping" is allowed if you don't hear back within a week. But
still, this time of year is not the best for new work to be added.

BTW, how much is your company paying David Miller to fix your
submissions?  If you're not paying him, don't expect things to get done
at your convenience, or at all.

> 
> Furthermore, it's not merged into mainline.  So no, you don't have the content.  

Seems nobody (besides you) cares at the moment. When someone comes by
and wants this feature, as you so nicely posted it to LKML, it's out
there. They can then clean it up to David's liking, and it will be
added. There is no harm on our side.

You on the other hand need to constantly send patches to your customers.
Seems that the one being hurt by not including these patches is still
you.

> 
> > >  And the only reason you don't is because someone with pull-request
> > > authority is too lazy [or apathetic] to make minor cosmetic changes
> > > and get the change pushed through the process.
> > 
> > Someone like the author?
> 
> You mean the maintainer right?  If I have to do all of the work I should get all of the credit.

You do get credit for the code that you submit. I have people send me
code for a new feature, and I expect them to still maintain it. They
usually have their name at the top of the file as the author.

But the maintainer of the subsystem has the right to control how things
get added to their system, as they are the ones ultimately responsible
for the code out there. If there's a bug, the maintainer is the one that
gets the notice. That's what they maintain, not cleaning up code from
people that want new features. A maintainer is the one that has to make
sure that the code continues to work.

>   
> > > Furthermore I don't think you get how the business side of this
> > > works.
> > 
> > I've been doing both kernel and proprietary development for close to
> > two
> > decades, so you might be surprised. I see it the other way around --
> > you
> > don't see how the open source part works, and are expecting to
> > substitute your proprietary process -- where crap code that "works"
> > is
> > preferred, to hell with trying to maintain consistency,
> > maintainability,
> > or even readability.
> 
> Um ok that's uncalled for.  What part of the fact my CMAC code is like 90% verbatim copied from the XCBC code do you not understand?

So what?

That code is there. There's a lot of code in the kernel that needs to be
cleaned up. I've done exactly as you did. I copied code, submitted it to
the maintainer, and it was rejected because things have changed since the
time of the code I copied. Did I bitch to the maintainer saying "hey, I
copied this and you should accept it because you have that there." No, I
did not. Actually what I did was fix my patch to what was the right way
to do things, and then I FIXED THE CODE I COPIED!!!


>If you think the CMAC patch was bad then you better call up the authors of the XCBC code and call them out for it too.  Stop being hypocritical.

Oh shut up!

The XCBC code is in there today. And yes, if you submitted patches to
clean that code up, I'm sure those will be accepted. But changing code
in the kernel does take work, including removing said code. But that's
still no reason to allow more code that will need to be cleaned up in
the future. Fix it before it gets in.


> 
> You claimed my code fails to maintain "consistency" ... IT'S COPIED FROM EXISTING CODE.  Your complaint makes no sense not to mention it's insulting.

He's not the one calling people lazy. Frankly sir, you're the one being
offensive and a hypocrite.

> 
> Furthermore, as someone who ran OSS projects (some of which are in millions of devices around the world) I understood to cherish user contributions.  Even if they needed polishing up.  I did the bitch work of documenting, testing, packaging, development, debugging, and support.  It's far far far too common to see OSS developers shy away from the less fun side of software development...

I maintain OSS projects too. And because there's very few people that
contribute, I cherish submissions as well, and will do a lot of the
grunt work that really should be done by the contributor. But the Linux
kernel is much bigger. It changes something like 3000 lines of code a day!

Maintainers do not scale well with such a project, and yes, it's up to
the contributors to take up the slack.


> 
> I called out the maintainers here because because not only do they not maintain the integrity of the code for which they claim authority but they are hostile towards outside contributions with ridiculous standards that they themselves don't even adhere to.  Code that they work on in the kernel doesn't meet ANY of the standards set forth that I was supposed to magically divine applied here..

My God, you sound like a 2 year old.

Suck it up, and do the fixes. It's not the time you are worried about,
as you most definitely spent more time bitching to everyone than it
would have taken you to clean up your work.

>  
> > You sold your boss a bill of goods, then -- that may fly in your
> > shop,
> > but that doesn't work here. It is well known that there is likely to
> > be
> > several rounds of review, and this isn't a new thing.
> 
> Ok sure but why does that involve me re-writing the patch for cosmetic reasons?

Because you are the one that cares about it being submitted. If someone
else cares, they'll take your code and fix it, to get it in.

>I agreed that adding the () around the ^/& expressions would be a good idea.  However, how is it a good use of my time to re-write the patch (which includes lines of code I didn't write in the first place) for coding styles that are not actually used in the kernel?

It's better on your time than the maintainers. Do not try to compare
your little OSS project to the Linux Kernel. They are two different
beasts.

> 
> I **COPIED** existing code.  Yet somehow my code isn't good enough?

And that's the perfect time to clean it up.

> 
> > I do know this, and I also know that the kernel is much better
> > documented than the most of the closed source code bases I've looked
> > at
> > in my career.
> 
> That's not really an excuse for lack of documentation/comments.  

We can always use more documentation and comments. And actually, the
kernel has been getting better at this regard. New code usually does get
better comments than what is currently in the kernel from years past.

> 
> > You think davem is lazy? Gruff, sure, but lazy? Well, thank you for
> > illuminating your grasp of reality.
> 
> I was a one man shop running open source math/crypto libraries yet I wrote tons of well commented code, 100s of pages of documentation, ran user support, and did all the other things real developers do.  
> 
> If they can't add missing ()'s (which aren't strictly needed btw) on their own and merge the code into maintain then they're not much of developers now are they?

Because honestly I doubt Dave cares about it. Again, how much are you
paying him?  You're the one that wants this feature. If someone else
wants it, they'll do this without the 2 year old bitch rant.

> 
> > There's a difference between patching an existing file, and
> > introducing
> > a new one. Should you have introduced a new file based on AH, I
> > suspect
> > it would also need some cleaning up.
> 
> Except when the motto is "use the source luke" you shouldn't be surprised when ... people use the source as a template for getting work done.  If you guys have such a damn problem with this you should maintain your code so it serves as an example to others.  Stop being a hypocrite.

Fix the source Luke! It's not a big deal.

> 
> > Anyways, I'll stop feeding the troll now. You've made it quite clear
> > that no one is going to convince you, and calling the maintainers
> > lazy
> > and hypocrites isn't going to convince them.
> 
> I'm sure I'll re-write the patch [when I can't say].  I'm not in a position to sell the AH-AEAD work to my bosses because the ROI just won't be there.  For now we and our customers will have access to CMAC and nobody else will which is just a crying shame.

And when someone wants it, they will either fix up what you did, or pay
someone to do it for them.

> 
> I'm not trying to pick a fight I'm trying to point out flaws in the system.  That you guys are so immobile on it is a shame.  I'd love to sell the idea to my bosses of cleaning up the CryptoAPI/IPsec maybe down the road merging our hardware drivers into mainline but it's not a case I can really make right now.  We make due quite fine with a private GPL tree of code but that's the opposite of how this should work.

You did a good job at picking a fight here. I don't see a flaw in the
system. I see a way to get new code in at a higher standard than the old
code, and over time fix the old code so that it catches up with what's
there today. This is what kernel janitors was created for.

-- Steve

^ permalink raw reply

* [PATCH 1/5] drivers: atm: checkpatch.pl fixed coding style errors in eni.c
From: Patrik Karlin @ 2013-01-20 23:12 UTC (permalink / raw)
  To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Patrik Karlin

This patch removes all space after , errors in eni.c

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
---
 drivers/atm/eni.c |  632 ++++++++++++++++++++++++++---------------------------
 1 file changed, 316 insertions(+), 316 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index c1eb6fa..6ae0d89 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -32,7 +32,7 @@
 
 #if !defined(__i386__) && !defined(__x86_64__)
 #ifndef ioremap_nocache
-#define ioremap_nocache(X,Y) ioremap(X,Y)
+#define ioremap_nocache(X, Y) ioremap(X, Y)
 #endif 
 #endif
 
@@ -62,9 +62,9 @@
 
 
 #if 0
-#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
+#define DPRINTK(format, args...) printk(KERN_DEBUG format, ##args)
 #else
-#define DPRINTK(format,args...)
+#define DPRINTK(format, args...)
 #endif
 
 
@@ -79,7 +79,7 @@
 
 #define NULLCHECK(x)
 
-#define EVENT(s,a,b)
+#define EVENT(s, a, b)
 
 
 static void event_dump(void)
@@ -96,7 +96,7 @@ static void event_dump(void)
 
 #define NULLCHECK(x) \
 	if ((unsigned long) (x) < 0x30) \
-		printk(KERN_CRIT #x "==0x%lx\n",(unsigned long) (x))
+		printk(KERN_CRIT #x "==0x%lx\n", (unsigned long) (x))
 
 /*
  * Very extensive activity logging. Greatly improves bug detection speed but
@@ -106,11 +106,11 @@ static void event_dump(void)
 #define EV 64
 
 static const char *ev[EV];
-static unsigned long ev_a[EV],ev_b[EV];
+static unsigned long ev_a[EV], ev_b[EV];
 static int ec = 0;
 
 
-static void EVENT(const char *s,unsigned long a,unsigned long b)
+static void EVENT(const char *s, unsigned long a, unsigned long b)
 {
 	ev[ec] = s; 
 	ev_a[ec] = a;
@@ -121,12 +121,12 @@ static void EVENT(const char *s,unsigned long a,unsigned long b)
 
 static void event_dump(void)
 {
-	int n,i;
+	int n, i;
 
 	for (n = 0; n < EV; n++) {
 		i = (ec+n) % EV;
 		printk(KERN_NOTICE);
-		printk(ev[i] ? ev[i] : "(null)",ev_a[i],ev_b[i]);
+		printk(ev[i] ? ev[i] : "(null)", ev_a[i], ev_b[i]);
 	}
 }
 
@@ -141,23 +141,23 @@ static void event_dump(void)
  * xxPMOK operating on a circular buffer of "c" words
  */
 
-#define NEPJOK(a0,a1,b) \
+#define NEPJOK(a0, a1, b) \
     ((a0) < (a1) ? (b) <= (a0) || (b) > (a1) : (b) <= (a0) && (b) > (a1))
-#define EEPJOK(a0,a1,b) \
+#define EEPJOK(a0, a1, b) \
     ((a0) < (a1) ? (b) < (a0) || (b) >= (a1) : (b) < (a0) && (b) >= (a1))
-#define NEPMOK(a0,d,b,c) NEPJOK(a0,(a0+d) & (c-1),b)
-#define EEPMOK(a0,d,b,c) EEPJOK(a0,(a0+d) & (c-1),b)
+#define NEPMOK(a0, d, b, c) NEPJOK(a0, (a0+d) & (c-1), b)
+#define EEPMOK(a0, d, b, c) EEPJOK(a0, (a0+d) & (c-1), b)
 
 
-static int tx_complete = 0,dma_complete = 0,queued = 0,requeued = 0,
-  backlogged = 0,rx_enqueued = 0,rx_dequeued = 0,pushed = 0,submitted = 0,
+static int tx_complete = 0, dma_complete = 0, queued = 0, requeued = 0,
+  backlogged = 0, rx_enqueued = 0, rx_dequeued = 0, pushed = 0, submitted = 0,
   putting = 0;
 
 static struct atm_dev *eni_boards = NULL;
 
 /* Read/write registers on card */
 #define eni_in(r)	readl(eni_dev->reg+(r)*4)
-#define eni_out(v,r)	writel((v),eni_dev->reg+(r)*4)
+#define eni_out(v, r)	writel((v), eni_dev->reg+(r)*4)
 
 
 /*-------------------------------- utilities --------------------------------*/
@@ -168,7 +168,7 @@ static void dump_mem(struct eni_dev *eni_dev)
 	int i;
 
 	for (i = 0; i < eni_dev->free_len; i++)
-		printk(KERN_DEBUG "  %d: %p %d\n",i,
+		printk(KERN_DEBUG "  %d: %p %d\n", i,
 		    eni_dev->free_list[i].start,
 		    1 << eni_dev->free_list[i].order);
 }
@@ -186,12 +186,12 @@ static void dump(struct atm_dev *dev)
 	printk(KERN_NOTICE "TX buffers\n");
 	for (i = 0; i < NR_CHAN; i++)
 		if (eni_dev->tx[i].send)
-			printk(KERN_NOTICE "  TX %d @ %p: %ld\n",i,
-			    eni_dev->tx[i].send,eni_dev->tx[i].words*4);
+			printk(KERN_NOTICE "  TX %d @ %p: %ld\n", i,
+			    eni_dev->tx[i].send, eni_dev->tx[i].words*4);
 	printk(KERN_NOTICE "RX buffers\n");
 	for (i = 0; i < 1024; i++)
 		if (eni_dev->rx_map[i] && ENI_VCC(eni_dev->rx_map[i])->rx)
-			printk(KERN_NOTICE "  RX %d @ %p: %ld\n",i,
+			printk(KERN_NOTICE "  RX %d @ %p: %ld\n", i,
 			    ENI_VCC(eni_dev->rx_map[i])->recv,
 			    ENI_VCC(eni_dev->rx_map[i])->words*4);
 	printk(KERN_NOTICE "----\n");
@@ -202,16 +202,16 @@ static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start,
     unsigned long size)
 {
 	struct eni_free *list;
-	int len,order;
+	int len, order;
 
-	DPRINTK("init 0x%lx+%ld(0x%lx)\n",start,size,size);
+	DPRINTK("init 0x%lx+%ld(0x%lx)\n", start, size, size);
 	start += eni_dev->base_diff;
 	list = eni_dev->free_list;
 	len = eni_dev->free_len;
 	while (size) {
 		if (len >= eni_dev->free_list_size) {
 			printk(KERN_CRIT "eni_put_free overflow (%p,%ld)\n",
-			    start,size);
+			    start, size);
 			break;
 		}
 		for (order = 0; !(((unsigned long)start | size) & (1 << order)); order++);
@@ -235,14 +235,14 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 {
 	struct eni_free *list;
 	void __iomem *start;
-	int len,i,order,best_order,index;
+	int len, i, order, best_order, index;
 
 	list = eni_dev->free_list;
 	len = eni_dev->free_len;
 	if (*size < MID_MIN_BUF_SIZE) *size = MID_MIN_BUF_SIZE;
 	if (*size > MID_MAX_BUF_SIZE) return NULL;
 	for (order = 0; (1 << order) < *size; order++);
-	DPRINTK("trying: %ld->%d\n",*size,order);
+	DPRINTK("trying: %ld->%d\n", *size, order);
 	best_order = 65; /* we don't have more than 2^64 of anything ... */
 	index = 0; /* silence GCC */
 	for (i = 0; i < len; i++)
@@ -260,9 +260,9 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 	list[index] = list[--len];
 	eni_dev->free_len = len;
 	*size = 1 << order;
-	eni_put_free(eni_dev,start+*size,(1 << best_order)-*size);
-	DPRINTK("%ld bytes (order %d) at 0x%lx\n",*size,order,start);
-	memset_io(start,0,*size);       /* never leak data */
+	eni_put_free(eni_dev, start+*size, (1 << best_order)-*size);
+	DPRINTK("%ld bytes (order %d) at 0x%lx\n", *size, order, start);
+	memset_io(start, 0, *size);       /* never leak data */
 	/*dump_mem(eni_dev);*/
 	return start;
 }
@@ -272,18 +272,18 @@ static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
     unsigned long size)
 {
 	struct eni_free *list;
-	int len,i,order;
+	int len, i, order;
 
 	start += eni_dev->base_diff;
 	list = eni_dev->free_list;
 	len = eni_dev->free_len;
 	for (order = -1; size; order++) size >>= 1;
-	DPRINTK("eni_free_mem: %p+0x%lx (order %d)\n",start,size,order);
+	DPRINTK("eni_free_mem: %p+0x%lx (order %d)\n", start, size, order);
 	for (i = 0; i < len; i++)
 		if (((unsigned long) list[i].start) == ((unsigned long)start^(1 << order)) &&
 		    list[i].order == order) {
-			DPRINTK("match[%d]: 0x%lx/0x%lx(0x%x), %d/%d\n",i,
-			    list[i].start,start,1 << order,list[i].order,order);
+			DPRINTK("match[%d]: 0x%lx/0x%lx(0x%x), %d/%d\n", i,
+			    list[i].start, start, 1 << order, list[i].order, order);
 			list[i] = list[--len];
 			start = (void __iomem *) ((unsigned long) start & ~(unsigned long) (1 << order));
 			order++;
@@ -291,7 +291,7 @@ static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
 			continue;
 		}
 	if (len >= eni_dev->free_list_size) {
-		printk(KERN_ALERT "eni_free_mem overflow (%p,%d)\n",start,
+		printk(KERN_ALERT "eni_free_mem overflow (%p,%d)\n", start,
 		    order);
 		return;
 	}
@@ -318,19 +318,19 @@ static void rx_ident_err(struct atm_vcc *vcc)
 	eni_dev = ENI_DEV(dev);
 	/* immediately halt adapter */
 	eni_out(eni_in(MID_MC_S) &
-	    ~(MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE),MID_MC_S);
+	    ~(MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE), MID_MC_S);
 	/* dump useful information */
 	eni_vcc = ENI_VCC(vcc);
 	printk(KERN_ALERT DEV_LABEL "(itf %d): driver error - RX ident "
-	    "mismatch\n",dev->number);
-	printk(KERN_ALERT "  VCI %d, rxing %d, words %ld\n",vcc->vci,
-	    eni_vcc->rxing,eni_vcc->words);
+	    "mismatch\n", dev->number);
+	printk(KERN_ALERT "  VCI %d, rxing %d, words %ld\n", vcc->vci,
+	    eni_vcc->rxing, eni_vcc->words);
 	printk(KERN_ALERT "  host descr 0x%lx, rx pos 0x%lx, descr value "
-	    "0x%x\n",eni_vcc->descr,eni_vcc->rx_pos,
+	    "0x%x\n", eni_vcc->descr, eni_vcc->rx_pos,
 	    (unsigned) readl(eni_vcc->recv+eni_vcc->descr*4));
-	printk(KERN_ALERT "  last %p, servicing %d\n",eni_vcc->last,
+	printk(KERN_ALERT "  last %p, servicing %d\n", eni_vcc->last,
 	    eni_vcc->servicing);
-	EVENT("---dump ends here---\n",0,0);
+	EVENT("---dump ends here---\n", 0, 0);
 	printk(KERN_NOTICE "---recent events---\n");
 	event_dump();
 	ENI_DEV(dev)->fast = NULL; /* really stop it */
@@ -339,28 +339,28 @@ static void rx_ident_err(struct atm_vcc *vcc)
 }
 
 
-static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
-    unsigned long skip,unsigned long size,unsigned long eff)
+static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
+                     unsigned long skip, unsigned long size, unsigned long eff)
 {
 	struct eni_dev *eni_dev;
 	struct eni_vcc *eni_vcc;
-	u32 dma_rd,dma_wr;
+	u32 dma_rd, dma_wr;
 	u32 dma[RX_DMA_BUF*2];
 	dma_addr_t paddr;
 	unsigned long here;
-	int i,j;
+	int i, j;
 
 	eni_dev = ENI_DEV(vcc->dev);
 	eni_vcc = ENI_VCC(vcc);
 	paddr = 0; /* GCC, shut up */
 	if (skb) {
-		paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len,
+		paddr = pci_map_single(eni_dev->pci_dev, skb->data, skb->len,
 		    PCI_DMA_FROMDEVICE);
 		ENI_PRV_PADDR(skb) = paddr;
 		if (paddr & 3)
 			printk(KERN_CRIT DEV_LABEL "(itf %d): VCI %d has "
-			    "mis-aligned RX data (0x%lx)\n",vcc->dev->number,
-			    vcc->vci,(unsigned long) paddr);
+			    "mis-aligned RX data (0x%lx)\n", vcc->dev->number,
+			    vcc->vci, (unsigned long) paddr);
 		ENI_PRV_SIZE(skb) = size+skip;
 		    /* PDU plus descriptor */
 		ATM_SKB(skb)->vcc = vcc;
@@ -380,7 +380,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
 		if (!size) {
 			DPRINTK("strange things happen ...\n");
 			EVENT("strange things happen ... (skip=%ld,eff=%ld)\n",
-			    size,eff);
+			    size, eff);
 		}
 		words = eff;
 		if (paddr & 15) {
@@ -457,42 +457,42 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
 	 * Can I move the dma_wr pointer by 2j+1 positions without overwriting
 	 * data that hasn't been read (position of dma_rd) yet ?
 	 */
-	if (!NEPMOK(dma_wr,j+j+1,dma_rd,NR_DMA_RX)) { /* @@@ +1 is ugly */
+	if (!NEPMOK(dma_wr, j+j+1, dma_rd, NR_DMA_RX)) { /* @@@ +1 is ugly */
 		printk(KERN_WARNING DEV_LABEL "(itf %d): RX DMA full\n",
 		    vcc->dev->number);
 		goto trouble;
 	}
         for (i = 0; i < j; i++) {
-		writel(dma[i*2],eni_dev->rx_dma+dma_wr*8);
-		writel(dma[i*2+1],eni_dev->rx_dma+dma_wr*8+4);
+		writel(dma[i*2], eni_dev->rx_dma+dma_wr*8);
+		writel(dma[i*2+1], eni_dev->rx_dma+dma_wr*8+4);
 		dma_wr = (dma_wr+1) & (NR_DMA_RX-1);
         }
 	if (skb) {
 		ENI_PRV_POS(skb) = eni_vcc->descr+size+1;
-		skb_queue_tail(&eni_dev->rx_queue,skb);
+		skb_queue_tail(&eni_dev->rx_queue, skb);
 		eni_vcc->last = skb;
 rx_enqueued++;
 	}
 	eni_vcc->descr = here;
-	eni_out(dma_wr,MID_DMA_WR_RX);
+	eni_out(dma_wr, MID_DMA_WR_RX);
 	return 0;
 
 trouble:
 	if (paddr)
-		pci_unmap_single(eni_dev->pci_dev,paddr,skb->len,
+		pci_unmap_single(eni_dev->pci_dev, paddr, skb->len,
 		    PCI_DMA_FROMDEVICE);
 	if (skb) dev_kfree_skb_irq(skb);
 	return -1;
 }
 
 
-static void discard(struct atm_vcc *vcc,unsigned long size)
+static void discard(struct atm_vcc *vcc, unsigned long size)
 {
 	struct eni_vcc *eni_vcc;
 
 	eni_vcc = ENI_VCC(vcc);
-	EVENT("discard (size=%ld)\n",size,0);
-	while (do_rx_dma(vcc,NULL,1,size,0)) EVENT("BUSY LOOP",0,0);
+	EVENT("discard (size=%ld)\n", size, 0);
+	while (do_rx_dma(vcc, NULL, 1, size, 0)) EVENT("BUSY LOOP", 0, 0);
 	    /* could do a full fallback, but that might be more expensive */
 	if (eni_vcc->rxing) ENI_PRV_POS(eni_vcc->last) += size+1;
 	else eni_vcc->rx_pos = (eni_vcc->rx_pos+size+1) & (eni_vcc->words-1);
@@ -527,15 +527,15 @@ static int rx_aal0(struct atm_vcc *vcc)
 	else {
 		length = ATM_CELL_SIZE-1; /* no HEC */
 	}
-	skb = length ? atm_alloc_charge(vcc,length,GFP_ATOMIC) : NULL;
+	skb = length ? atm_alloc_charge(vcc, length, GFP_ATOMIC) : NULL;
 	if (!skb) {
-		discard(vcc,length >> 2);
+		discard(vcc, length >> 2);
 		return 0;
 	}
-	skb_put(skb,length);
+	skb_put(skb, length);
 	skb->tstamp = eni_vcc->timestamp;
-	DPRINTK("got len %ld\n",length);
-	if (do_rx_dma(vcc,skb,1,length >> 2,length >> 2)) return 1;
+	DPRINTK("got len %ld\n", length);
+	if (do_rx_dma(vcc, skb, 1, length >> 2, length >> 2)) return 1;
 	eni_vcc->rxing++;
 	return 0;
 }
@@ -545,10 +545,10 @@ static int rx_aal5(struct atm_vcc *vcc)
 {
 	struct eni_vcc *eni_vcc;
 	unsigned long descr;
-	unsigned long size,eff,length;
+	unsigned long size, eff, length;
 	struct sk_buff *skb;
 
-	EVENT("rx_aal5\n",0,0);
+	EVENT("rx_aal5\n", 0, 0);
 	DPRINTK(">rx_aal5\n");
 	eni_vcc = ENI_VCC(vcc);
 	descr = readl(eni_vcc->recv+eni_vcc->descr*4);
@@ -558,7 +558,7 @@ static int rx_aal5(struct atm_vcc *vcc)
 	}
 	if (descr & (MID_RED_T | MID_RED_CRC_ERR)) {
 		if (descr & MID_RED_T) {
-			EVENT("empty cell (descr=0x%lx)\n",descr,0);
+			EVENT("empty cell (descr=0x%lx)\n", descr, 0);
 			DPRINTK(DEV_LABEL "(itf %d): trashing empty cell\n",
 			    vcc->dev->number);
 			size = 0;
@@ -573,7 +573,7 @@ static int rx_aal5(struct atm_vcc *vcc)
 				silence = (jiffies+2*HZ)|1;
 			}
 			size = (descr & MID_RED_COUNT)*(ATM_CELL_PAYLOAD >> 2);
-			EVENT("CRC error (descr=0x%lx,size=%ld)\n",descr,
+			EVENT("CRC error (descr=0x%lx,size=%ld)\n", descr,
 			    size);
 		}
 		eff = length = 0;
@@ -581,30 +581,30 @@ static int rx_aal5(struct atm_vcc *vcc)
 	}
 	else {
 		size = (descr & MID_RED_COUNT)*(ATM_CELL_PAYLOAD >> 2);
-		DPRINTK("size=%ld\n",size);
+		DPRINTK("size=%ld\n", size);
 		length = readl(eni_vcc->recv+(((eni_vcc->descr+size-1) &
 		    (eni_vcc->words-1)))*4) & 0xffff;
 				/* -trailer(2)+header(1) */
 		if (length && length <= (size << 2)-8 && length <=
 		  ATM_MAX_AAL5_PDU) eff = (length+3) >> 2;
 		else {				 /* ^ trailer length (8) */
-			EVENT("bad PDU (descr=0x08%lx,length=%ld)\n",descr,
-			    length);
+			EVENT("bad PDU (descr=0x08%lx,length=%ld)\n", descr,
+                              length);
 			printk(KERN_ERR DEV_LABEL "(itf %d): bad AAL5 PDU "
 			    "(VCI=%d,length=%ld,size=%ld (descr 0x%lx))\n",
-			    vcc->dev->number,vcc->vci,length,size << 2,descr);
+			    vcc->dev->number, vcc->vci, length, size << 2, descr);
 			length = eff = 0;
 			atomic_inc(&vcc->stats->rx_err);
 		}
 	}
-	skb = eff ? atm_alloc_charge(vcc,eff << 2,GFP_ATOMIC) : NULL;
+	skb = eff ? atm_alloc_charge(vcc, eff << 2, GFP_ATOMIC) : NULL;
 	if (!skb) {
-		discard(vcc,size);
+		discard(vcc, size);
 		return 0;
 	}
-	skb_put(skb,length);
-	DPRINTK("got len %ld\n",length);
-	if (do_rx_dma(vcc,skb,1,size,eff)) return 1;
+	skb_put(skb, length);
+	DPRINTK("got len %ld\n", length);
+	if (do_rx_dma(vcc, skb, 1, size, eff)) return 1;
 	eni_vcc->rxing++;
 	return 0;
 }
@@ -618,29 +618,29 @@ static inline int rx_vcc(struct atm_vcc *vcc)
 
 	eni_vcc = ENI_VCC(vcc);
 	vci_dsc = ENI_DEV(vcc->dev)->vci+vcc->vci*16;
-	EVENT("rx_vcc(1)\n",0,0);
+	EVENT("rx_vcc(1)\n", 0, 0);
 	while (eni_vcc->descr != (tmp = (readl(vci_dsc+4) & MID_VCI_DESCR) >>
 	    MID_VCI_DESCR_SHIFT)) {
 		EVENT("rx_vcc(2: host dsc=0x%lx, nic dsc=0x%lx)\n",
-		    eni_vcc->descr,tmp);
-		DPRINTK("CB_DESCR %ld REG_DESCR %d\n",ENI_VCC(vcc)->descr,
+		    eni_vcc->descr, tmp);
+		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
 		    (((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
 		    MID_VCI_DESCR_SHIFT));
 		if (ENI_VCC(vcc)->rx(vcc)) return 1;
 	}
 	/* clear IN_SERVICE flag */
-	writel(readl(vci_dsc) & ~MID_VCI_IN_SERVICE,vci_dsc);
+	writel(readl(vci_dsc) & ~MID_VCI_IN_SERVICE, vci_dsc);
 	/*
 	 * If new data has arrived between evaluating the while condition and
 	 * clearing IN_SERVICE, we wouldn't be notified until additional data
 	 * follows. So we have to loop again to be sure.
 	 */
-	EVENT("rx_vcc(3)\n",0,0);
+	EVENT("rx_vcc(3)\n", 0, 0);
 	while (ENI_VCC(vcc)->descr != (tmp = (readl(vci_dsc+4) & MID_VCI_DESCR)
 	    >> MID_VCI_DESCR_SHIFT)) {
 		EVENT("rx_vcc(4: host dsc=0x%lx, nic dsc=0x%lx)\n",
-		    eni_vcc->descr,tmp);
-		DPRINTK("CB_DESCR %ld REG_DESCR %d\n",ENI_VCC(vcc)->descr,
+		    eni_vcc->descr, tmp);
+		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
 		    (((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
 		    MID_VCI_DESCR_SHIFT));
 		if (ENI_VCC(vcc)->rx(vcc)) return 1;
@@ -656,7 +656,7 @@ static void poll_rx(struct atm_dev *dev)
 
 	eni_dev = ENI_DEV(dev);
 	while ((curr = eni_dev->fast)) {
-		EVENT("poll_rx.fast\n",0,0);
+		EVENT("poll_rx.fast\n", 0, 0);
 		if (rx_vcc(curr)) return;
 		eni_dev->fast = ENI_VCC(curr)->next;
 		ENI_VCC(curr)->next = ENI_VCC_NOS;
@@ -664,7 +664,7 @@ static void poll_rx(struct atm_dev *dev)
 		ENI_VCC(curr)->servicing--;
 	}
 	while ((curr = eni_dev->slow)) {
-		EVENT("poll_rx.slow\n",0,0);
+		EVENT("poll_rx.slow\n", 0, 0);
 		if (rx_vcc(curr)) return;
 		eni_dev->slow = ENI_VCC(curr)->next;
 		ENI_VCC(curr)->next = ENI_VCC_NOS;
@@ -688,14 +688,14 @@ static void get_service(struct atm_dev *dev)
 		vcc = eni_dev->rx_map[vci & 1023];
 		if (!vcc) {
 			printk(KERN_CRIT DEV_LABEL "(itf %d): VCI %ld not "
-			    "found\n",dev->number,vci);
+			    "found\n", dev->number, vci);
 			continue; /* nasty but we try to go on anyway */
 			/* @@@ nope, doesn't work */
 		}
-		EVENT("getting from service\n",0,0);
+		EVENT("getting from service\n", 0, 0);
 		if (ENI_VCC(vcc)->next != ENI_VCC_NOS) {
-			EVENT("double service\n",0,0);
-			DPRINTK("Grr, servicing VCC %ld twice\n",vci);
+			EVENT("double service\n", 0, 0);
+			DPRINTK("Grr, servicing VCC %ld twice\n", vci);
 			continue;
 		}
 		ENI_VCC(vcc)->timestamp = ktime_get_real();
@@ -734,37 +734,37 @@ static void dequeue_rx(struct atm_dev *dev)
 		if (!skb) {
 			if (first) {
 				DPRINTK(DEV_LABEL "(itf %d): RX but not "
-				    "rxing\n",dev->number);
-				EVENT("nothing to dequeue\n",0,0);
+				    "rxing\n", dev->number);
+				EVENT("nothing to dequeue\n", 0, 0);
 			}
 			break;
 		}
-		EVENT("dequeued (size=%ld,pos=0x%lx)\n",ENI_PRV_SIZE(skb),
-		    ENI_PRV_POS(skb));
+		EVENT("dequeued (size=%ld,pos=0x%lx)\n", ENI_PRV_SIZE(skb),
+                      ENI_PRV_POS(skb));
 rx_dequeued++;
 		vcc = ATM_SKB(skb)->vcc;
 		eni_vcc = ENI_VCC(vcc);
 		first = 0;
 		vci_dsc = eni_dev->vci+vcc->vci*16;
-		if (!EEPMOK(eni_vcc->rx_pos,ENI_PRV_SIZE(skb),
+		if (!EEPMOK(eni_vcc->rx_pos, ENI_PRV_SIZE(skb),
 		    (readl(vci_dsc+4) & MID_VCI_READ) >> MID_VCI_READ_SHIFT,
 		    eni_vcc->words)) {
-			EVENT("requeuing\n",0,0);
-			skb_queue_head(&eni_dev->rx_queue,skb);
+			EVENT("requeuing\n", 0, 0);
+			skb_queue_head(&eni_dev->rx_queue, skb);
 			break;
 		}
 		eni_vcc->rxing--;
 		eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1);
-		pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len,
-		    PCI_DMA_TODEVICE);
+		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
+                                 PCI_DMA_TODEVICE);
 		if (!skb->len) dev_kfree_skb_irq(skb);
 		else {
-			EVENT("pushing (len=%ld)\n",skb->len,0);
+			EVENT("pushing (len=%ld)\n", skb->len, 0);
 			if (vcc->qos.aal == ATM_AAL0)
 				*(unsigned long *) skb->data =
 				    ntohl(*(unsigned long *) skb->data);
-			memset(skb->cb,0,sizeof(struct eni_skb_prv));
-			vcc->push(vcc,skb);
+			memset(skb->cb, 0, sizeof(struct eni_skb_prv));
+			vcc->push(vcc, skb);
 			pushed++;
 		}
 		atomic_inc(&vcc->stats->rx);
@@ -788,8 +788,8 @@ static int open_rx_first(struct atm_vcc *vcc)
 	if (size > MID_MAX_BUF_SIZE && vcc->qos.rxtp.max_sdu <=
 	    MID_MAX_BUF_SIZE)
 		size = MID_MAX_BUF_SIZE;
-	eni_vcc->recv = eni_alloc_mem(eni_dev,&size);
-	DPRINTK("rx at 0x%lx\n",eni_vcc->recv);
+	eni_vcc->recv = eni_alloc_mem(eni_dev, &size);
+	DPRINTK("rx at 0x%lx\n", eni_vcc->recv);
 	eni_vcc->words = size >> 2;
 	if (!eni_vcc->recv) return -ENOBUFS;
 	eni_vcc->rx = vcc->qos.aal == ATM_AAL5 ? rx_aal5 : rx_aal0;
@@ -816,26 +816,26 @@ static int open_rx_second(struct atm_vcc *vcc)
 	if (!eni_vcc->rx) return 0;
 	/* set up VCI descriptor */
 	here = eni_dev->vci+vcc->vci*16;
-	DPRINTK("loc 0x%x\n",(unsigned) (eni_vcc->recv-eni_dev->ram)/4);
+	DPRINTK("loc 0x%x\n", (unsigned) (eni_vcc->recv-eni_dev->ram)/4);
 	size = eni_vcc->words >> 8;
 	for (order = -1; size; order++) size >>= 1;
-	writel(0,here+4); /* descr, read = 0 */
-	writel(0,here+8); /* write, state, count = 0 */
+	writel(0, here+4); /* descr, read = 0 */
+	writel(0, here+8); /* write, state, count = 0 */
 	if (eni_dev->rx_map[vcc->vci])
 		printk(KERN_CRIT DEV_LABEL "(itf %d): BUG - VCI %d already "
-		    "in use\n",vcc->dev->number,vcc->vci);
+		    "in use\n", vcc->dev->number, vcc->vci);
 	eni_dev->rx_map[vcc->vci] = vcc; /* now it counts */
 	writel(((vcc->qos.aal != ATM_AAL5 ? MID_MODE_RAW : MID_MODE_AAL5) <<
 	    MID_VCI_MODE_SHIFT) | MID_VCI_PTI_MODE |
 	    (((eni_vcc->recv-eni_dev->ram) >> (MID_LOC_SKIP+2)) <<
-	    MID_VCI_LOCATION_SHIFT) | (order << MID_VCI_SIZE_SHIFT),here);
+	    MID_VCI_LOCATION_SHIFT) | (order << MID_VCI_SIZE_SHIFT), here);
 	return 0;
 }
 
 
 static void close_rx(struct atm_vcc *vcc)
 {
-	DECLARE_WAITQUEUE(wait,current);
+	DECLARE_WAITQUEUE(wait, current);
 	void __iomem *here;
 	struct eni_dev *eni_dev;
 	struct eni_vcc *eni_vcc;
@@ -847,17 +847,17 @@ static void close_rx(struct atm_vcc *vcc)
 		here = eni_dev->vci+vcc->vci*16;
 		/* block receiver */
 		writel((readl(here) & ~MID_VCI_MODE) | (MID_MODE_TRASH <<
-		    MID_VCI_MODE_SHIFT),here);
+		    MID_VCI_MODE_SHIFT), here);
 		/* wait for receiver to become idle */
 		udelay(27);
 		/* discard pending cell */
-		writel(readl(here) & ~MID_VCI_IN_SERVICE,here);
+		writel(readl(here) & ~MID_VCI_IN_SERVICE, here);
 		/* don't accept any new ones */
 		eni_dev->rx_map[vcc->vci] = NULL;
 		/* wait for RX queue to drain */
 		DPRINTK("eni_close: waiting for RX ...\n");
-		EVENT("RX closing\n",0,0);
-		add_wait_queue(&eni_dev->rx_wait,&wait);
+		EVENT("RX closing\n", 0, 0);
+		add_wait_queue(&eni_dev->rx_wait, &wait);
 		set_current_state(TASK_UNINTERRUPTIBLE);
 		barrier();
 		for (;;) {
@@ -866,9 +866,9 @@ static void close_rx(struct atm_vcc *vcc)
 				barrier();
 				if (!eni_vcc->rxing) break;
 			}
-			EVENT("drain PDUs (rx %ld, serv %ld)\n",eni_vcc->rxing,
+			EVENT("drain PDUs (rx %ld, serv %ld)\n", eni_vcc->rxing,
 			    eni_vcc->servicing);
-			printk(KERN_INFO "%d+%d RX left\n",eni_vcc->servicing,
+			printk(KERN_INFO "%d+%d RX left\n", eni_vcc->servicing,
 			    eni_vcc->rxing);
 			schedule();
 			set_current_state(TASK_UNINTERRUPTIBLE);
@@ -883,16 +883,16 @@ static void close_rx(struct atm_vcc *vcc)
 			tasklet_enable(&eni_dev->task);
 			if (at_end) break;
 			EVENT("drain discard (host 0x%lx, nic 0x%lx)\n",
-			    eni_vcc->rx_pos,tmp);
+			    eni_vcc->rx_pos, tmp);
 			printk(KERN_INFO "draining RX: host 0x%lx, nic 0x%x\n",
-			    eni_vcc->rx_pos,tmp);
+			    eni_vcc->rx_pos, tmp);
 			schedule();
 			set_current_state(TASK_UNINTERRUPTIBLE);
 		}
 		set_current_state(TASK_RUNNING);
-		remove_wait_queue(&eni_dev->rx_wait,&wait);
+		remove_wait_queue(&eni_dev->rx_wait, &wait);
 	}
-	eni_free_mem(eni_dev,eni_vcc->recv,eni_vcc->words << 2);
+	eni_free_mem(eni_dev, eni_vcc->recv, eni_vcc->words << 2);
 	eni_vcc->rx = NULL;
 }
 
@@ -915,7 +915,7 @@ static int start_rx(struct atm_dev *dev)
 	init_waitqueue_head(&eni_dev->rx_wait);
 	skb_queue_head_init(&eni_dev->rx_queue);
 	eni_dev->serv_read = eni_in(MID_SERV_WRITE);
-	eni_out(0,MID_DMA_WR_RX);
+	eni_out(0, MID_DMA_WR_RX);
 	return 0;
 }
 
@@ -923,27 +923,27 @@ static int start_rx(struct atm_dev *dev)
 /*----------------------------------- TX ------------------------------------*/
 
 
-enum enq_res { enq_ok,enq_next,enq_jam };
+enum enq_res { enq_ok, enq_next, enq_jam };
 
 
-static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
-    u32 size)
+static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
+                           u32 size)
 {
-	u32 init,words;
+	u32 init, words;
 
-	DPRINTK("put_dma: 0x%lx+0x%x\n",(unsigned long) paddr,size);
-	EVENT("put_dma: 0x%lx+0x%lx\n",(unsigned long) paddr,size);
+	DPRINTK("put_dma: 0x%lx+0x%x\n", (unsigned long) paddr, size);
+	EVENT("put_dma: 0x%lx+0x%lx\n", (unsigned long) paddr, size);
 #if 0 /* don't complain anymore */
 	if (paddr & 3)
-		printk(KERN_ERR "put_dma: unaligned addr (0x%lx)\n",paddr);
+		printk(KERN_ERR "put_dma: unaligned addr (0x%lx)\n", paddr);
 	if (size & 3)
-		printk(KERN_ERR "put_dma: unaligned size (0x%lx)\n",size);
+		printk(KERN_ERR "put_dma: unaligned size (0x%lx)\n", size);
 #endif
 	if (paddr & 3) {
 		init = 4-(paddr & 3);
 		if (init > size || size < 7) init = size;
 		DPRINTK("put_dma: %lx DMA: %d/%d bytes\n",
-		    (unsigned long) paddr,init,size);
+		    (unsigned long) paddr, init, size);
 		dma[(*j)++] = MID_DT_BYTE | (init << MID_DMA_COUNT_SHIFT) |
 		    (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -956,7 +956,7 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 		init = 8-((paddr & 31) >> 2);
 		if (init > words) init = words;
 		DPRINTK("put_dma: %lx DMA: %d/%d words\n",
-		    (unsigned long) paddr,init,words);
+		    (unsigned long) paddr, init, words);
 		dma[(*j)++] = MID_DT_WORD | (init << MID_DMA_COUNT_SHIFT) |
 		    (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -966,7 +966,7 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_16W /* may work with some PCI chipsets ... */
 	if (words & ~15) {
 		DPRINTK("put_dma: %lx DMA: %d*16/%d words\n",
-		    (unsigned long) paddr,words >> 4,words);
+		    (unsigned long) paddr, words >> 4, words);
 		dma[(*j)++] = MID_DT_16W | ((words >> 4) << MID_DMA_COUNT_SHIFT)
 		    | (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -977,7 +977,7 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_8W /* recommended */
 	if (words & ~7) {
 		DPRINTK("put_dma: %lx DMA: %d*8/%d words\n",
-		    (unsigned long) paddr,words >> 3,words);
+		    (unsigned long) paddr, words >> 3, words);
 		dma[(*j)++] = MID_DT_8W | ((words >> 3) << MID_DMA_COUNT_SHIFT)
 		    | (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -988,7 +988,7 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_4W /* probably useless if TX_8W or TX_16W */
 	if (words & ~3) {
 		DPRINTK("put_dma: %lx DMA: %d*4/%d words\n",
-		    (unsigned long) paddr,words >> 2,words);
+		    (unsigned long) paddr, words >> 2, words);
 		dma[(*j)++] = MID_DT_4W | ((words >> 2) << MID_DMA_COUNT_SHIFT)
 		    | (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -999,7 +999,7 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_2W /* probably useless if TX_4W, TX_8W, ... */
 	if (words & ~1) {
 		DPRINTK("put_dma: %lx DMA: %d*2/%d words\n",
-		    (unsigned long) paddr,words >> 1,words);
+		    (unsigned long) paddr, words >> 1, words);
 		dma[(*j)++] = MID_DT_2W | ((words >> 1) << MID_DMA_COUNT_SHIFT)
 		    | (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -1008,16 +1008,16 @@ static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
 	}
 #endif
 	if (words) {
-		DPRINTK("put_dma: %lx DMA: %d words\n",(unsigned long) paddr,
-		    words);
+		DPRINTK("put_dma: %lx DMA: %d words\n", (unsigned long) paddr,
+                        words);
 		dma[(*j)++] = MID_DT_WORD | (words << MID_DMA_COUNT_SHIFT) |
 		    (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += words << 2;
 	}
 	if (size) {
-		DPRINTK("put_dma: %lx DMA: %d bytes\n",(unsigned long) paddr,
-		    size);
+		DPRINTK("put_dma: %lx DMA: %d bytes\n", (unsigned long) paddr,
+                        size);
 		dma[(*j)++] = MID_DT_BYTE | (size << MID_DMA_COUNT_SHIFT) |
 		    (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
@@ -1032,13 +1032,13 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	struct eni_vcc *eni_vcc;
 	struct eni_tx *tx;
 	dma_addr_t paddr;
-	u32 dma_rd,dma_wr;
+	u32 dma_rd, dma_wr;
 	u32 size; /* in words */
-	int aal5,dma_size,i,j;
+	int aal5, dma_size, i, j;
 
 	DPRINTK(">do_tx\n");
 	NULLCHECK(skb);
-	EVENT("do_tx: skb=0x%lx, %ld bytes\n",(unsigned long) skb,skb->len);
+	EVENT("do_tx: skb=0x%lx, %ld bytes\n", (unsigned long) skb, skb->len);
 	vcc = ATM_SKB(skb)->vcc;
 	NULLCHECK(vcc);
 	eni_dev = ENI_DEV(vcc->dev);
@@ -1059,7 +1059,7 @@ static enum enq_res do_tx(struct sk_buff *skb)
 #if 0 /* should work now */
 	if ((unsigned long) skb->data & 3)
 		printk(KERN_ERR DEV_LABEL "(itf %d): VCI %d has mis-aligned "
-		    "TX data\n",vcc->dev->number,vcc->vci);
+		    "TX data\n", vcc->dev->number, vcc->vci);
 #endif
 	/*
 	 * Potential future IP speedup: make hard_header big enough to put
@@ -1084,10 +1084,10 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	 * to the read pointer ? TX_GAP means to leave some space for what
 	 * the manual calls "too close".
 	 */
-	if (!NEPMOK(tx->tx_pos,size+TX_GAP,
-	    eni_in(MID_TX_RDPTR(tx->index)),tx->words)) {
+	if (!NEPMOK(tx->tx_pos, size+TX_GAP,
+	    eni_in(MID_TX_RDPTR(tx->index)), tx->words)) {
 		DPRINTK(DEV_LABEL "(itf %d): TX full (size %d)\n",
-		    vcc->dev->number,size);
+		    vcc->dev->number, size);
 		return enq_next;
 	}
 	/* check DMA */
@@ -1095,22 +1095,22 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	dma_rd = eni_in(MID_DMA_RD_TX);
 	dma_size = 3; /* JK for descriptor and final fill, plus final size
 			 mis-alignment fix */
-DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags);
+DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
 	if (!skb_shinfo(skb)->nr_frags) dma_size += 5;
 	else dma_size += 5*(skb_shinfo(skb)->nr_frags+1);
 	if (dma_size > TX_DMA_BUF) {
 		printk(KERN_CRIT DEV_LABEL "(itf %d): needs %d DMA entries "
-		    "(got only %d)\n",vcc->dev->number,dma_size,TX_DMA_BUF);
+		    "(got only %d)\n", vcc->dev->number, dma_size, TX_DMA_BUF);
 	}
-	DPRINTK("dma_wr is %d, tx_pos is %ld\n",dma_wr,tx->tx_pos);
+	DPRINTK("dma_wr is %d, tx_pos is %ld\n", dma_wr, tx->tx_pos);
 	if (dma_wr != dma_rd && ((dma_rd+NR_DMA_TX-dma_wr) & (NR_DMA_TX-1)) <
 	     dma_size) {
 		printk(KERN_WARNING DEV_LABEL "(itf %d): TX DMA full\n",
-		    vcc->dev->number);
+                       vcc->dev->number);
 		return enq_jam;
 	}
-	paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len,
-	    PCI_DMA_TODEVICE);
+	paddr = pci_map_single(eni_dev->pci_dev, skb->data, skb->len,
+                               PCI_DMA_TODEVICE);
 	ENI_PRV_PADDR(skb) = paddr;
 	/* prepare DMA queue entries */
 	j = 0;
@@ -1119,20 +1119,20 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags);
 	     MID_DT_JK;
 	j++;
 	if (!skb_shinfo(skb)->nr_frags)
-		if (aal5) put_dma(tx->index,eni_dev->dma,&j,paddr,skb->len);
-		else put_dma(tx->index,eni_dev->dma,&j,paddr+4,skb->len-4);
+		if (aal5) put_dma(tx->index, eni_dev->dma, &j, paddr, skb->len);
+		else put_dma(tx->index, eni_dev->dma, &j, paddr+4, skb->len-4);
 	else {
-DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
+                DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
 		for (i = -1; i < skb_shinfo(skb)->nr_frags; i++)
 			if (i == -1)
-				put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
-				    skb->data,
-				    skb_headlen(skb));
+				put_dma(tx->index, eni_dev->dma, &j, (unsigned long)
+                                        skb->data,
+                                        skb_headlen(skb));
 			else
-				put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
-				    skb_frag_page(&skb_shinfo(skb)->frags[i]) +
+				put_dma(tx->index, eni_dev->dma, &j, (unsigned long)
+                                        skb_frag_page(&skb_shinfo(skb)->frags[i]) +
 					skb_shinfo(skb)->frags[i].page_offset,
-				    skb_frag_size(&skb_shinfo(skb)->frags[i]));
+                                        skb_frag_size(&skb_shinfo(skb)->frags[i]));
 	}
 	if (skb->len & 3) {
 		put_dma(tx->index, eni_dev->dma, &j, eni_dev->zero.dma,
@@ -1143,34 +1143,34 @@ DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
 	     MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
 	     MID_DMA_END | MID_DT_JK;
 	j++;
-	DPRINTK("DMA at end: %d\n",j);
+	DPRINTK("DMA at end: %d\n", j);
 	/* store frame */
 	writel((MID_SEG_TX_ID << MID_SEG_ID_SHIFT) |
 	    (aal5 ? MID_SEG_AAL5 : 0) | (tx->prescaler << MID_SEG_PR_SHIFT) |
 	    (tx->resolution << MID_SEG_RATE_SHIFT) |
-	    (size/(ATM_CELL_PAYLOAD/4)),tx->send+tx->tx_pos*4);
+	    (size/(ATM_CELL_PAYLOAD/4)), tx->send+tx->tx_pos*4);
 /*printk("dsc = 0x%08lx\n",(unsigned long) readl(tx->send+tx->tx_pos*4));*/
 	writel((vcc->vci << MID_SEG_VCI_SHIFT) |
             (aal5 ? 0 : (skb->data[3] & 0xf)) |
 	    (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ? MID_SEG_CLP : 0),
 	    tx->send+((tx->tx_pos+1) & (tx->words-1))*4);
-	DPRINTK("size: %d, len:%d\n",size,skb->len);
+	DPRINTK("size: %d, len:%d\n", size, skb->len);
 	if (aal5)
-		writel(skb->len,tx->send+
+		writel(skb->len, tx->send+
                     ((tx->tx_pos+size-AAL5_TRAILER) & (tx->words-1))*4);
 	j = j >> 1;
 	for (i = 0; i < j; i++) {
-		writel(eni_dev->dma[i*2],eni_dev->tx_dma+dma_wr*8);
-		writel(eni_dev->dma[i*2+1],eni_dev->tx_dma+dma_wr*8+4);
+		writel(eni_dev->dma[i*2], eni_dev->tx_dma+dma_wr*8);
+		writel(eni_dev->dma[i*2+1], eni_dev->tx_dma+dma_wr*8+4);
 		dma_wr = (dma_wr+1) & (NR_DMA_TX-1);
 	}
 	ENI_PRV_POS(skb) = tx->tx_pos;
 	ENI_PRV_SIZE(skb) = size;
 	ENI_VCC(vcc)->txing += size;
 	tx->tx_pos = (tx->tx_pos+size) & (tx->words-1);
-	DPRINTK("dma_wr set to %d, tx_pos is now %ld\n",dma_wr,tx->tx_pos);
-	eni_out(dma_wr,MID_DMA_WR_TX);
-	skb_queue_tail(&eni_dev->tx_queue,skb);
+	DPRINTK("dma_wr set to %d, tx_pos is now %ld\n", dma_wr, tx->tx_pos);
+	eni_out(dma_wr, MID_DMA_WR_TX);
+	skb_queue_tail(&eni_dev->tx_queue, skb);
 queued++;
 	return enq_ok;
 }
@@ -1191,7 +1191,7 @@ static void poll_tx(struct atm_dev *dev)
 				res = do_tx(skb);
 				if (res == enq_ok) continue;
 				DPRINTK("re-queuing TX PDU\n");
-				skb_queue_head(&tx->backlog,skb);
+				skb_queue_head(&tx->backlog, skb);
 requeued++;
 				if (res == enq_jam) return;
 				break;
@@ -1215,17 +1215,17 @@ static void dequeue_tx(struct atm_dev *dev)
 		NULLCHECK(vcc);
 		tx = ENI_VCC(vcc)->tx;
 		NULLCHECK(ENI_VCC(vcc)->tx);
-		DPRINTK("dequeue_tx: next 0x%lx curr 0x%x\n",ENI_PRV_POS(skb),
+		DPRINTK("dequeue_tx: next 0x%lx curr 0x%x\n", ENI_PRV_POS(skb),
 		    (unsigned) eni_in(MID_TX_DESCRSTART(tx->index)));
 		if (ENI_VCC(vcc)->txing < tx->words && ENI_PRV_POS(skb) ==
 		    eni_in(MID_TX_DESCRSTART(tx->index))) {
-			skb_queue_head(&eni_dev->tx_queue,skb);
+			skb_queue_head(&eni_dev->tx_queue, skb);
 			break;
 		}
 		ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb);
-		pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len,
-		    PCI_DMA_TODEVICE);
-		if (vcc->pop) vcc->pop(vcc,skb);
+		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
+                                 PCI_DMA_TODEVICE);
+		if (vcc->pop) vcc->pop(vcc, skb);
 		else dev_kfree_skb_irq(skb);
 		atomic_inc(&vcc->stats->tx);
 		wake_up(&eni_dev->tx_wait);
@@ -1234,7 +1234,7 @@ dma_complete++;
 }
 
 
-static struct eni_tx *alloc_tx(struct eni_dev *eni_dev,int ubr)
+static struct eni_tx *alloc_tx(struct eni_dev *eni_dev, int ubr)
 {
 	int i;
 
@@ -1244,10 +1244,10 @@ static struct eni_tx *alloc_tx(struct eni_dev *eni_dev,int ubr)
 }
 
 
-static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
-    int *res,int unlimited)
+static int comp_tx(struct eni_dev *eni_dev, int *pcr, int reserved, int *pre,
+                   int *res, int unlimited)
 {
-	static const int pre_div[] = { 4,16,128,2048 };
+	static const int pre_div[] = { 4, 16, 128, 2048 };
 	    /* 2^(((x+2)^2-(x+2))/2+1) */
 
 	if (unlimited) *pre = *res = 0;
@@ -1258,7 +1258,7 @@ static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
 			for (*pre = 0; *pre < 3; (*pre)++)
 				if (TS_CLOCK/pre_div[*pre]/64 <= *pcr) break;
 			div = pre_div[*pre]**pcr;
-			DPRINTK("min div %d\n",div);
+			DPRINTK("min div %d\n", div);
 			*res = TS_CLOCK/div-1;
 		}
 		else {
@@ -1269,28 +1269,28 @@ static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
 				if (TS_CLOCK/pre_div[*pre]/64 > -*pcr) break;
 			if (*pre < 3) (*pre)++; /* else fail later */
 			div = pre_div[*pre]*-*pcr;
-			DPRINTK("max div %d\n",div);
+			DPRINTK("max div %d\n", div);
 			*res = DIV_ROUND_UP(TS_CLOCK, div)-1;
 		}
 		if (*res < 0) *res = 0;
 		if (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE;
 	}
 	*pcr = TS_CLOCK/pre_div[*pre]/(*res+1);
-	DPRINTK("out pcr: %d (%d:%d)\n",*pcr,*pre,*res);
+	DPRINTK("out pcr: %d (%d:%d)\n", *pcr, *pre, *res);
 	return 0;
 }
 
 
-static int reserve_or_set_tx(struct atm_vcc *vcc,struct atm_trafprm *txtp,
-    int set_rsv,int set_shp)
+static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
+                             int set_rsv, int set_shp)
 {
 	struct eni_dev *eni_dev = ENI_DEV(vcc->dev);
 	struct eni_vcc *eni_vcc = ENI_VCC(vcc);
 	struct eni_tx *tx;
 	unsigned long size;
 	void __iomem *mem;
-	int rate,ubr,unlimited,new_tx;
-	int pre,res,order;
+	int rate, ubr, unlimited, new_tx;
+	int pre, res, order;
 	int error;
 
 	rate = atm_pcr_goal(txtp);
@@ -1315,26 +1315,26 @@ static int reserve_or_set_tx(struct atm_vcc *vcc,struct atm_trafprm *txtp,
 	mem = NULL; /* for gcc */
 	if (!new_tx) tx = eni_vcc->tx;
 	else {
-		mem = eni_alloc_mem(eni_dev,&size);
+		mem = eni_alloc_mem(eni_dev, &size);
 		if (!mem) return -ENOBUFS;
-		tx = alloc_tx(eni_dev,unlimited);
+		tx = alloc_tx(eni_dev, unlimited);
 		if (!tx) {
-			eni_free_mem(eni_dev,mem,size);
+			eni_free_mem(eni_dev, mem, size);
 			return -EBUSY;
 		}
-		DPRINTK("got chan %d\n",tx->index);
+		DPRINTK("got chan %d\n", tx->index);
 		tx->reserved = tx->shaping = 0;
 		tx->send = mem;
 		tx->words = size >> 2;
 		skb_queue_head_init(&tx->backlog);
 		for (order = 0; size > (1 << (order+10)); order++);
 		eni_out((order << MID_SIZE_SHIFT) |
-		    ((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)),
-		    MID_TX_PLACE(tx->index));
+                        ((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)),
+                        MID_TX_PLACE(tx->index));
 		tx->tx_pos = eni_in(MID_TX_DESCRSTART(tx->index)) &
 		    MID_DESCR_START;
 	}
-	error = comp_tx(eni_dev,&rate,tx->reserved,&pre,&res,unlimited);
+	error = comp_tx(eni_dev, &rate, tx->reserved, &pre, &res, unlimited);
 	if (!error  && txtp->min_pcr > rate) error = -EINVAL;
 	if (!error && txtp->max_pcr && txtp->max_pcr != ATM_MAX_PCR &&
 	    txtp->max_pcr < rate) error = -EINVAL;
@@ -1347,7 +1347,7 @@ static int reserve_or_set_tx(struct atm_vcc *vcc,struct atm_trafprm *txtp,
 	if (error) {
 		if (new_tx) {
 			tx->send = NULL;
-			eni_free_mem(eni_dev,mem,size);
+			eni_free_mem(eni_dev, mem, size);
 		}
 		return error;
 	}
@@ -1364,7 +1364,7 @@ static int reserve_or_set_tx(struct atm_vcc *vcc,struct atm_trafprm *txtp,
 		tx->shaping = rate;
 	}
 	if (set_shp) eni_vcc->tx = tx;
-	DPRINTK("rsv %d shp %d\n",tx->reserved,tx->shaping);
+	DPRINTK("rsv %d shp %d\n", tx->reserved, tx->shaping);
 	return 0;
 }
 
@@ -1374,7 +1374,7 @@ static int open_tx_first(struct atm_vcc *vcc)
 	ENI_VCC(vcc)->tx = NULL;
 	if (vcc->qos.txtp.traffic_class == ATM_NONE) return 0;
 	ENI_VCC(vcc)->txing = 0;
-	return reserve_or_set_tx(vcc,&vcc->qos.txtp,1,1);
+	return reserve_or_set_tx(vcc, &vcc->qos.txtp, 1, 1);
 }
 
 
@@ -1386,7 +1386,7 @@ static int open_tx_second(struct atm_vcc *vcc)
 
 static void close_tx(struct atm_vcc *vcc)
 {
-	DECLARE_WAITQUEUE(wait,current);
+	DECLARE_WAITQUEUE(wait, current);
 	struct eni_dev *eni_dev;
 	struct eni_vcc *eni_vcc;
 
@@ -1395,7 +1395,7 @@ static void close_tx(struct atm_vcc *vcc)
 	eni_dev = ENI_DEV(vcc->dev);
 	/* wait for TX queue to drain */
 	DPRINTK("eni_close: waiting for TX ...\n");
-	add_wait_queue(&eni_dev->tx_wait,&wait);
+	add_wait_queue(&eni_dev->tx_wait, &wait);
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	for (;;) {
 		int txing;
@@ -1404,12 +1404,12 @@ static void close_tx(struct atm_vcc *vcc)
 		txing = skb_peek(&eni_vcc->tx->backlog) || eni_vcc->txing;
 		tasklet_enable(&eni_dev->task);
 		if (!txing) break;
-		DPRINTK("%d TX left\n",eni_vcc->txing);
+		DPRINTK("%d TX left\n", eni_vcc->txing);
 		schedule();
 		set_current_state(TASK_UNINTERRUPTIBLE);
 	}
 	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&eni_dev->tx_wait,&wait);
+	remove_wait_queue(&eni_dev->tx_wait, &wait);
 	if (eni_vcc->tx != eni_dev->ubr) {
 		/*
 		 * Looping a few times in here is probably far cheaper than
@@ -1419,7 +1419,7 @@ static void close_tx(struct atm_vcc *vcc)
 		while (eni_in(MID_TX_RDPTR(eni_vcc->tx->index)) !=
 		    eni_in(MID_TX_DESCRSTART(eni_vcc->tx->index)))
 			schedule();
-		eni_free_mem(eni_dev,eni_vcc->tx->send,eni_vcc->tx->words << 2);
+		eni_free_mem(eni_dev, eni_vcc->tx->send, eni_vcc->tx->words << 2);
 		eni_vcc->tx->send = NULL;
 		eni_dev->tx_bw += eni_vcc->tx->reserved;
 	}
@@ -1439,7 +1439,7 @@ static int start_tx(struct atm_dev *dev)
 	init_waitqueue_head(&eni_dev->tx_wait);
 	eni_dev->ubr = NULL;
 	skb_queue_head_init(&eni_dev->tx_queue);
-	eni_out(0,MID_DMA_WR_TX);
+	eni_out(0, MID_DMA_WR_TX);
 	for (i = 0; i < NR_CHAN; i++) {
 		eni_dev->tx[i].send = NULL;
 		eni_dev->tx[i].index = i;
@@ -1458,33 +1458,33 @@ static void foo(void)
 printk(KERN_INFO
   "tx_complete=%d,dma_complete=%d,queued=%d,requeued=%d,sub=%d,\n"
   "backlogged=%d,rx_enqueued=%d,rx_dequeued=%d,putting=%d,pushed=%d\n",
-  tx_complete,dma_complete,queued,requeued,submitted,backlogged,
-  rx_enqueued,rx_dequeued,putting,pushed);
-if (eni_boards) printk(KERN_INFO "loss: %ld\n",ENI_DEV(eni_boards)->lost);
+  tx_complete, dma_complete, queued, requeued, submitted, backlogged,
+  rx_enqueued, rx_dequeued, putting, pushed);
+if (eni_boards) printk(KERN_INFO "loss: %ld\n", ENI_DEV(eni_boards)->lost);
 }
 
 #endif
 
 
-static void bug_int(struct atm_dev *dev,unsigned long reason)
+static void bug_int(struct atm_dev *dev, unsigned long reason)
 {
 	DPRINTK(">bug_int\n");
 	if (reason & MID_DMA_ERR_ACK)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - DMA "
-		    "error\n",dev->number);
+		    "error\n", dev->number);
 	if (reason & MID_TX_IDENT_MISM)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - ident "
-		    "mismatch\n",dev->number);
+		    "mismatch\n", dev->number);
 	if (reason & MID_TX_DMA_OVFL)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - DMA "
-		    "overflow\n",dev->number);
-	EVENT("---dump ends here---\n",0,0);
+		    "overflow\n", dev->number);
+	EVENT("---dump ends here---\n", 0, 0);
 	printk(KERN_NOTICE "---recent events---\n");
 	event_dump();
 }
 
 
-static irqreturn_t eni_int(int irq,void *dev_id)
+static irqreturn_t eni_int(int irq, void *dev_id)
 {
 	struct atm_dev *dev;
 	struct eni_dev *eni_dev;
@@ -1494,7 +1494,7 @@ static irqreturn_t eni_int(int irq,void *dev_id)
 	dev = dev_id;
 	eni_dev = ENI_DEV(dev);
 	reason = eni_in(MID_ISA);
-	DPRINTK(DEV_LABEL ": int 0x%lx\n",(unsigned long) reason);
+	DPRINTK(DEV_LABEL ": int 0x%lx\n", (unsigned long) reason);
 	/*
 	 * Must handle these two right now, because reading ISA doesn't clear
 	 * them, so they re-occur and we never make it to the tasklet. Since
@@ -1502,11 +1502,11 @@ static irqreturn_t eni_int(int irq,void *dev_id)
 	 * with eni_dev->events == 0.
 	 */
 	if (reason & MID_STAT_OVFL) {
-		EVENT("stat overflow\n",0,0);
+		EVENT("stat overflow\n", 0, 0);
 		eni_dev->lost += eni_in(MID_STAT) & MID_OVFL_TRASH;
 	}
 	if (reason & MID_SUNI_INT) {
-		EVENT("SUNI int\n",0,0);
+		EVENT("SUNI int\n", 0, 0);
 		dev->phy->interrupt(dev);
 #if 0
 		foo();
@@ -1527,38 +1527,38 @@ static void eni_tasklet(unsigned long data)
 	unsigned long flags;
 	u32 events;
 
-	DPRINTK("eni_tasklet (dev %p)\n",dev);
-	spin_lock_irqsave(&eni_dev->lock,flags);
-	events = xchg(&eni_dev->events,0);
-	spin_unlock_irqrestore(&eni_dev->lock,flags);
+	DPRINTK("eni_tasklet (dev %p)\n", dev);
+	spin_lock_irqsave(&eni_dev->lock, flags);
+	events = xchg(&eni_dev->events, 0);
+	spin_unlock_irqrestore(&eni_dev->lock, flags);
 	if (events & MID_RX_DMA_COMPLETE) {
-		EVENT("INT: RX DMA complete, starting dequeue_rx\n",0,0);
+		EVENT("INT: RX DMA complete, starting dequeue_rx\n", 0, 0);
 		dequeue_rx(dev);
-		EVENT("dequeue_rx done, starting poll_rx\n",0,0);
+		EVENT("dequeue_rx done, starting poll_rx\n", 0, 0);
 		poll_rx(dev);
-		EVENT("poll_rx done\n",0,0);
+		EVENT("poll_rx done\n", 0, 0);
 		/* poll_tx ? */
 	}
 	if (events & MID_SERVICE) {
-		EVENT("INT: service, starting get_service\n",0,0);
+		EVENT("INT: service, starting get_service\n", 0, 0);
 		get_service(dev);
-		EVENT("get_service done, starting poll_rx\n",0,0);
+		EVENT("get_service done, starting poll_rx\n", 0, 0);
 		poll_rx(dev);
-		EVENT("poll_rx done\n",0,0);
+		EVENT("poll_rx done\n", 0, 0);
 	}
  	if (events & MID_TX_DMA_COMPLETE) {
-		EVENT("INT: TX DMA COMPLETE\n",0,0);
+		EVENT("INT: TX DMA COMPLETE\n", 0, 0);
 		dequeue_tx(dev);
 	}
 	if (events & MID_TX_COMPLETE) {
-		EVENT("INT: TX COMPLETE\n",0,0);
+		EVENT("INT: TX COMPLETE\n", 0, 0);
 tx_complete++;
 		wake_up(&eni_dev->tx_wait);
 		/* poll_rx ? */
 	}
 	if (events & (MID_DMA_ERR_ACK | MID_TX_IDENT_MISM | MID_TX_DMA_OVFL)) {
-		EVENT("bug interrupt\n",0,0);
-		bug_int(dev,events);
+		EVENT("bug interrupt\n", 0, 0);
+		bug_int(dev, events);
 	}
 	poll_tx(dev);
 }
@@ -1570,7 +1570,7 @@ tx_complete++;
 static char * const media_name[] = {
     "MMF", "SMF", "MMF", "03?", /*  0- 3 */
     "UTP", "05?", "06?", "07?", /*  4- 7 */
-    "TAXI","09?", "10?", "11?", /*  8-11 */
+    "TAXI", "09?", "10?", "11?", /*  8-11 */
     "12?", "13?", "14?", "15?", /* 12-15 */
     "MMF", "SMF", "18?", "19?", /* 16-19 */
     "UTP", "21?", "22?", "23?", /* 20-23 */
@@ -1581,12 +1581,12 @@ static char * const media_name[] = {
 
 #define SET_SEPROM \
   ({ if (!error && !pci_error) { \
-    pci_error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,tonga); \
+    pci_error = pci_write_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, tonga); \
     udelay(10); /* 10 usecs */ \
   } })
 #define GET_SEPROM \
   ({ if (!error && !pci_error) { \
-    pci_error = pci_read_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,&tonga); \
+    pci_error = pci_read_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, &tonga); \
     udelay(10); /* 10 usecs */ \
   } })
 
@@ -1595,8 +1595,8 @@ static int get_esi_asic(struct atm_dev *dev)
 {
 	struct eni_dev *eni_dev;
 	unsigned char tonga;
-	int error,failed,pci_error;
-	int address,i,j;
+	int error, failed, pci_error;
+	int address, i, j;
 
 	eni_dev = ENI_DEV(dev);
 	error = pci_error = 0;
@@ -1672,7 +1672,7 @@ static int get_esi_asic(struct atm_dev *dev)
 	}
 	if (pci_error) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): error reading ESI "
-		    "(0x%02x)\n",dev->number,pci_error);
+		    "(0x%02x)\n", dev->number, pci_error);
 		error = -EIO;
 	}
 	return error;
@@ -1701,7 +1701,7 @@ static int eni_do_init(struct atm_dev *dev)
 	struct pci_dev *pci_dev;
 	unsigned long real_base;
 	void __iomem *base;
-	int error,i,last;
+	int error, i, last;
 
 	DPRINTK(">eni_init\n");
 	dev->ci_range.vpi_bits = 0;
@@ -1711,19 +1711,19 @@ static int eni_do_init(struct atm_dev *dev)
 	pci_dev = eni_dev->pci_dev;
 	real_base = pci_resource_start(pci_dev, 0);
 	eni_dev->irq = pci_dev->irq;
-	if ((error = pci_write_config_word(pci_dev,PCI_COMMAND,
+	if ((error = pci_write_config_word(pci_dev, PCI_COMMAND,
 	    PCI_COMMAND_MEMORY |
 	    (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't enable memory "
-		    "(0x%02x)\n",dev->number,error);
+		    "(0x%02x)\n", dev->number, error);
 		return -EIO;
 	}
 	printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,",
-	    dev->number,pci_dev->revision,real_base,eni_dev->irq);
-	if (!(base = ioremap_nocache(real_base,MAP_MAX_SIZE))) {
+	    dev->number, pci_dev->revision, real_base, eni_dev->irq);
+	if (!(base = ioremap_nocache(real_base, MAP_MAX_SIZE))) {
 		printk("\n");
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
-		    "mapping\n",dev->number);
+		    "mapping\n", dev->number);
 		return error;
 	}
 	eni_dev->ioaddr = base;
@@ -1746,35 +1746,35 @@ static int eni_do_init(struct atm_dev *dev)
 	eni_dev->ram = base+RAM_BASE;
 	last = MAP_MAX_SIZE-RAM_BASE;
 	for (i = last-RAM_INCREMENT; i >= 0; i -= RAM_INCREMENT) {
-		writel(0x55555555,eni_dev->ram+i);
+		writel(0x55555555, eni_dev->ram+i);
 		if (readl(eni_dev->ram+i) != 0x55555555) last = i;
 		else {
-			writel(0xAAAAAAAA,eni_dev->ram+i);
+			writel(0xAAAAAAAA, eni_dev->ram+i);
 			if (readl(eni_dev->ram+i) != 0xAAAAAAAA) last = i;
-			else writel(i,eni_dev->ram+i);
+			else writel(i, eni_dev->ram+i);
 		}
 	}
 	for (i = 0; i < last; i += RAM_INCREMENT)
 		if (readl(eni_dev->ram+i) != i) break;
 	eni_dev->mem = i;
-	memset_io(eni_dev->ram,0,eni_dev->mem);
+	memset_io(eni_dev->ram, 0, eni_dev->mem);
 	/* TODO: should shrink allocation now */
-	printk("mem=%dkB (",eni_dev->mem >> 10);
+	printk("mem=%dkB (", eni_dev->mem >> 10);
 	/* TODO: check for non-SUNI, check for TAXI ? */
 	if (!(eni_in(MID_RES_ID_MCON) & 0x200) != !eni_dev->asic) {
 		printk(")\n");
 		printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n",
-		    dev->number,(unsigned) eni_in(MID_RES_ID_MCON));
+		    dev->number, (unsigned) eni_in(MID_RES_ID_MCON));
 		error = -EINVAL;
 		goto unmap;
 	}
-	error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
+	error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev, base);
 	if (error)
 		goto unmap;
 	for (i = 0; i < ESI_LEN; i++)
-		printk("%s%02X",i ? "-" : "",dev->esi[i]);
+		printk("%s%02X", i ? "-" : "", dev->esi[i]);
 	printk(")\n");
-	printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n",dev->number,
+	printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n", dev->number,
 	    eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
 	    media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
 
@@ -1807,24 +1807,24 @@ static int eni_start(struct atm_dev *dev)
 
 	DPRINTK(">eni_start\n");
 	eni_dev = ENI_DEV(dev);
-	if (request_irq(eni_dev->irq,&eni_int,IRQF_SHARED,DEV_LABEL,dev)) {
+	if (request_irq(eni_dev->irq, &eni_int, IRQF_SHARED, DEV_LABEL, dev)) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
-		    dev->number,eni_dev->irq);
+		    dev->number, eni_dev->irq);
 		error = -EAGAIN;
 		goto out;
 	}
 	pci_set_master(eni_dev->pci_dev);
-	if ((error = pci_write_config_word(eni_dev->pci_dev,PCI_COMMAND,
+	if ((error = pci_write_config_word(eni_dev->pci_dev, PCI_COMMAND,
 	    PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
 	    (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't enable memory+"
-		    "master (0x%02x)\n",dev->number,error);
+		    "master (0x%02x)\n", dev->number, error);
 		goto free_irq;
 	}
-	if ((error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,
-	    END_SWAP_DMA))) {
+	if ((error = pci_write_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL,
+                                           END_SWAP_DMA))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap "
-		    "(0x%02x)\n",dev->number,error);
+		    "(0x%02x)\n", dev->number, error);
 		goto free_irq;
 	}
 	/* determine addresses of internal tables */
@@ -1834,16 +1834,16 @@ static int eni_start(struct atm_dev *dev)
 	eni_dev->service = eni_dev->tx_dma+NR_DMA_TX*8;
 	buf = eni_dev->service+NR_SERVICE*4;
 	DPRINTK("vci 0x%lx,rx 0x%lx, tx 0x%lx,srv 0x%lx,buf 0x%lx\n",
-	     eni_dev->vci,eni_dev->rx_dma,eni_dev->tx_dma,
-	     eni_dev->service,buf);
+	     eni_dev->vci, eni_dev->rx_dma, eni_dev->tx_dma,
+	     eni_dev->service, buf);
 	spin_lock_init(&eni_dev->lock);
-	tasklet_init(&eni_dev->task,eni_tasklet,(unsigned long) dev);
+	tasklet_init(&eni_dev->task, eni_tasklet, (unsigned long) dev);
 	eni_dev->events = 0;
 	/* initialize memory management */
 	buffer_mem = eni_dev->mem - (buf - eni_dev->ram);
 	eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2;
 	eni_dev->free_list = kmalloc(
-	    sizeof(struct eni_free)*(eni_dev->free_list_size+1),GFP_KERNEL);
+                sizeof(struct eni_free)*(eni_dev->free_list_size+1), GFP_KERNEL);
 	if (!eni_dev->free_list) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
 		    dev->number);
@@ -1851,8 +1851,8 @@ static int eni_start(struct atm_dev *dev)
 		goto free_irq;
 	}
 	eni_dev->free_len = 0;
-	eni_put_free(eni_dev,buf,buffer_mem);
-	memset_io(eni_dev->vci,0,16*NR_VCI); /* clear VCI table */
+	eni_put_free(eni_dev, buf, buffer_mem);
+	memset_io(eni_dev->vci, 0, 16*NR_VCI); /* clear VCI table */
 	/*
 	 * byte_addr  free (k)
 	 * 0x00000000     512  VCI table
@@ -1862,7 +1862,7 @@ static int eni_start(struct atm_dev *dev)
 	 * 0x00007000	  484  buffers
 	 * 0x00080000	    0  end (512kB)
 	 */
-	eni_out(0xffffffff,MID_IE);
+	eni_out(0xffffffff, MID_IE);
 	error = start_tx(dev);
 	if (error) goto free_list;
 	error = start_rx(dev);
@@ -1891,14 +1891,14 @@ static void eni_close(struct atm_vcc *vcc)
 {
 	DPRINTK(">eni_close\n");
 	if (!ENI_VCC(vcc)) return;
-	clear_bit(ATM_VF_READY,&vcc->flags);
+	clear_bit(ATM_VF_READY, &vcc->flags);
 	close_rx(vcc);
 	close_tx(vcc);
 	DPRINTK("eni_close: done waiting\n");
 	/* deallocate memory */
 	kfree(ENI_VCC(vcc));
 	vcc->dev_data = NULL;
-	clear_bit(ATM_VF_ADDR,&vcc->flags);
+	clear_bit(ATM_VF_ADDR, &vcc->flags);
 	/*foo();*/
 }
 
@@ -1911,17 +1911,17 @@ static int eni_open(struct atm_vcc *vcc)
 	int vci = vcc->vci;
 
 	DPRINTK(">eni_open\n");
-	EVENT("eni_open\n",0,0);
-	if (!test_bit(ATM_VF_PARTIAL,&vcc->flags))
+	EVENT("eni_open\n", 0, 0);
+	if (!test_bit(ATM_VF_PARTIAL, &vcc->flags))
 		vcc->dev_data = NULL;
 	if (vci != ATM_VPI_UNSPEC && vpi != ATM_VCI_UNSPEC)
-		set_bit(ATM_VF_ADDR,&vcc->flags);
+		set_bit(ATM_VF_ADDR, &vcc->flags);
 	if (vcc->qos.aal != ATM_AAL0 && vcc->qos.aal != ATM_AAL5)
 		return -EINVAL;
-	DPRINTK(DEV_LABEL "(itf %d): open %d.%d\n",vcc->dev->number,vcc->vpi,
-	    vcc->vci);
-	if (!test_bit(ATM_VF_PARTIAL,&vcc->flags)) {
-		eni_vcc = kmalloc(sizeof(struct eni_vcc),GFP_KERNEL);
+	DPRINTK(DEV_LABEL "(itf %d): open %d.%d\n", vcc->dev->number, vcc->vpi,
+                vcc->vci);
+	if (!test_bit(ATM_VF_PARTIAL, &vcc->flags)) {
+		eni_vcc = kmalloc(sizeof(struct eni_vcc), GFP_KERNEL);
 		if (!eni_vcc) return -ENOMEM;
 		vcc->dev_data = eni_vcc;
 		eni_vcc->tx = NULL; /* for eni_close after open_rx */
@@ -1943,18 +1943,18 @@ static int eni_open(struct atm_vcc *vcc)
 		eni_close(vcc);
 		return error;
 	}
-	set_bit(ATM_VF_READY,&vcc->flags);
+	set_bit(ATM_VF_READY, &vcc->flags);
 	/* should power down SUNI while !ref_count @@@ */
 	return 0;
 }
 
 
-static int eni_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flgs)
+static int eni_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flgs)
 {
 	struct eni_dev *eni_dev = ENI_DEV(vcc->dev);
 	struct eni_tx *tx = ENI_VCC(vcc)->tx;
 	struct sk_buff *skb;
-	int error,rate,rsv,shp;
+	int error, rate, rsv, shp;
 
 	if (qos->txtp.traffic_class == ATM_NONE) return 0;
 	if (tx == eni_dev->ubr) return -EBADFD;
@@ -1966,7 +1966,7 @@ static int eni_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flgs)
 	if ((flgs & ATM_MF_DEC_SHP) && rate && rate < tx->shaping) shp = 1;
 	if ((flgs & ATM_MF_INC_SHP) && (!rate || rate > tx->shaping)) shp = 1;
 	if (!rsv && !shp) return 0;
-	error = reserve_or_set_tx(vcc,&qos->txtp,rsv,shp);
+	error = reserve_or_set_tx(vcc, &qos->txtp, rsv, shp);
 	if (error) return error;
 	if (shp && !(flgs & ATM_MF_IMMED)) return 0;
 	/*
@@ -1988,14 +1988,14 @@ static int eni_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flgs)
 }
 
 
-static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
+static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 {
 	struct eni_dev *eni_dev = ENI_DEV(dev);
 
 	if (cmd == ENI_MEMDUMP) {
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
 		printk(KERN_WARNING "Please use /proc/atm/" DEV_LABEL ":%d "
-		    "instead of obsolete ioctl ENI_MEMDUMP\n",dev->number);
+		    "instead of obsolete ioctl ENI_MEMDUMP\n", dev->number);
 		dump(dev);
 		return 0;
 	}
@@ -2016,7 +2016,7 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 	if (cmd == ATM_SETCIRANGE) {
 		struct atm_cirange ci;
 
-		if (copy_from_user(&ci, arg,sizeof(struct atm_cirange)))
+		if (copy_from_user(&ci, arg, sizeof(struct atm_cirange)))
 			return -EFAULT;
 		if ((ci.vpi_bits == 0 || ci.vpi_bits == ATM_CI_MAX) &&
 		    (ci.vci_bits == NR_VCI_LD || ci.vpi_bits == ATM_CI_MAX))
@@ -2024,42 +2024,42 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 		return -EINVAL;
 	}
 	if (!dev->phy->ioctl) return -ENOIOCTLCMD;
-	return dev->phy->ioctl(dev,cmd,arg);
+	return dev->phy->ioctl(dev, cmd, arg);
 }
 
 
-static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname,
-    void __user *optval,int optlen)
+static int eni_getsockopt(struct atm_vcc *vcc, int level, int optname,
+                          void __user *optval, int optlen)
 {
 	return -EINVAL;
 }
 
 
-static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname,
-    void __user *optval,unsigned int optlen)
+static int eni_setsockopt(struct atm_vcc *vcc, int level, int optname,
+                          void __user *optval, unsigned int optlen)
 {
 	return -EINVAL;
 }
 
 
-static int eni_send(struct atm_vcc *vcc,struct sk_buff *skb)
+static int eni_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
 	enum enq_res res;
 
 	DPRINTK(">eni_send\n");
 	if (!ENI_VCC(vcc)->tx) {
-		if (vcc->pop) vcc->pop(vcc,skb);
+		if (vcc->pop) vcc->pop(vcc, skb);
 		else dev_kfree_skb(skb);
 		return -EINVAL;
 	}
 	if (!skb) {
 		printk(KERN_CRIT "!skb in eni_send ?\n");
-		if (vcc->pop) vcc->pop(vcc,skb);
+		if (vcc->pop) vcc->pop(vcc, skb);
 		return -EINVAL;
 	}
 	if (vcc->qos.aal == ATM_AAL0) {
 		if (skb->len != ATM_CELL_SIZE-1) {
-			if (vcc->pop) vcc->pop(vcc,skb);
+			if (vcc->pop) vcc->pop(vcc, skb);
 			else dev_kfree_skb(skb);
 			return -EINVAL;
 		}
@@ -2071,42 +2071,42 @@ submitted++;
 	res = do_tx(skb);
 	tasklet_enable(&ENI_DEV(vcc->dev)->task);
 	if (res == enq_ok) return 0;
-	skb_queue_tail(&ENI_VCC(vcc)->tx->backlog,skb);
+	skb_queue_tail(&ENI_VCC(vcc)->tx->backlog, skb);
 backlogged++;
 	tasklet_schedule(&ENI_DEV(vcc->dev)->task);
 	return 0;
 }
 
-static void eni_phy_put(struct atm_dev *dev,unsigned char value,
-    unsigned long addr)
+static void eni_phy_put(struct atm_dev *dev, unsigned char value,
+                        unsigned long addr)
 {
-	writel(value,ENI_DEV(dev)->phy+addr*4);
+	writel(value, ENI_DEV(dev)->phy+addr*4);
 }
 
 
 
-static unsigned char eni_phy_get(struct atm_dev *dev,unsigned long addr)
+static unsigned char eni_phy_get(struct atm_dev *dev, unsigned long addr)
 {
 	return readl(ENI_DEV(dev)->phy+addr*4);
 }
 
 
-static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
+static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 {
 	struct hlist_node *node;
 	struct sock *s;
-	static const char *signal[] = { "LOST","unknown","okay" };
+	static const char *signal[] = { "LOST", "unknown", "okay" };
 	struct eni_dev *eni_dev = ENI_DEV(dev);
 	struct atm_vcc *vcc;
-	int left,i;
+	int left, i;
 
 	left = *pos;
 	if (!left)
-		return sprintf(page,DEV_LABEL "(itf %d) signal %s, %dkB, "
-		    "%d cps remaining\n",dev->number,signal[(int) dev->signal],
-		    eni_dev->mem >> 10,eni_dev->tx_bw);
+		return sprintf(page, DEV_LABEL "(itf %d) signal %s, %dkB, "
+		    "%d cps remaining\n", dev->number, signal[(int) dev->signal],
+		    eni_dev->mem >> 10, eni_dev->tx_bw);
 	if (!--left)
-		return sprintf(page,"%4sBursts: TX"
+		return sprintf(page, "%4sBursts: TX"
 #if !defined(CONFIG_ATM_ENI_BURST_TX_16W) && \
     !defined(CONFIG_ATM_ENI_BURST_TX_8W) && \
     !defined(CONFIG_ATM_ENI_BURST_TX_4W) && \
@@ -2147,24 +2147,24 @@ static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
 #ifndef CONFIG_ATM_ENI_TUNE_BURST
 		    " (default)"
 #endif
-		    "\n","");
+		    "\n", "");
 	if (!--left) 
-		return sprintf(page,"%4sBuffer multipliers: tx %d%%, rx %d%%\n",
-		    "",eni_dev->tx_mult,eni_dev->rx_mult);
+		return sprintf(page, "%4sBuffer multipliers: tx %d%%, rx %d%%\n",
+		    "", eni_dev->tx_mult, eni_dev->rx_mult);
 	for (i = 0; i < NR_CHAN; i++) {
 		struct eni_tx *tx = eni_dev->tx+i;
 
 		if (!tx->send) continue;
 		if (!--left) {
-			return sprintf(page,"tx[%d]:    0x%ld-0x%ld "
-			    "(%6ld bytes), rsv %d cps, shp %d cps%s\n",i,
+			return sprintf(page, "tx[%d]:    0x%ld-0x%ld "
+			    "(%6ld bytes), rsv %d cps, shp %d cps%s\n", i,
 			    (unsigned long) (tx->send - eni_dev->ram),
-			    tx->send-eni_dev->ram+tx->words*4-1,tx->words*4,
-			    tx->reserved,tx->shaping,
+			    tx->send-eni_dev->ram+tx->words*4-1, tx->words*4,
+			    tx->reserved, tx->shaping,
 			    tx == eni_dev->ubr ? " (UBR)" : "");
 		}
 		if (--left) continue;
-		return sprintf(page,"%10sbacklog %u packets\n","",
+		return sprintf(page, "%10sbacklog %u packets\n", "",
 		    skb_queue_len(&tx->backlog));
 	}
 	read_lock(&vcc_sklist_lock);
@@ -2180,18 +2180,18 @@ static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
 				continue;
 			eni_vcc = ENI_VCC(vcc);
 			if (--left) continue;
-			length = sprintf(page,"vcc %4d: ",vcc->vci);
+			length = sprintf(page, "vcc %4d: ", vcc->vci);
 			if (eni_vcc->rx) {
-				length += sprintf(page+length,"0x%ld-0x%ld "
+				length += sprintf(page+length, "0x%ld-0x%ld "
 				    "(%6ld bytes)",
 				    (unsigned long) (eni_vcc->recv - eni_dev->ram),
 				    eni_vcc->recv-eni_dev->ram+eni_vcc->words*4-1,
 				    eni_vcc->words*4);
-				if (eni_vcc->tx) length += sprintf(page+length,", ");
+				if (eni_vcc->tx) length += sprintf(page+length, ", ");
 			}
 			if (eni_vcc->tx)
-				length += sprintf(page+length,"tx[%d], txing %d bytes",
-				    eni_vcc->tx->index,eni_vcc->txing);
+				length += sprintf(page+length, "tx[%d], txing %d bytes",
+				    eni_vcc->tx->index, eni_vcc->txing);
 			page[length] = '\n';
 			read_unlock(&vcc_sklist_lock);
 			return length+1;
@@ -2204,8 +2204,8 @@ static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
 
 		if (--left) continue;
 		offset = (unsigned long) eni_dev->ram+eni_dev->base_diff;
-		return sprintf(page,"free      %p-%p (%6d bytes)\n",
-		    fe->start-offset,fe->start-offset+(1 << fe->order)-1,
+		return sprintf(page, "free      %p-%p (%6d bytes)\n",
+		    fe->start-offset, fe->start-offset+(1 << fe->order)-1,
 		    1 << fe->order);
 	}
 	return 0;
@@ -2289,7 +2289,7 @@ static struct pci_device_id eni_pci_tbl[] = {
 	{ PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_ASIC), 1 /* ASIC */ },
 	{ 0, }
 };
-MODULE_DEVICE_TABLE(pci,eni_pci_tbl);
+MODULE_DEVICE_TABLE(pci, eni_pci_tbl);
 
 
 static void eni_remove_one(struct pci_dev *pdev)
@@ -2320,7 +2320,7 @@ static int __init eni_init(void)
 
 	if (sizeof(skb->cb) < sizeof(struct eni_skb_prv)) {
 		printk(KERN_ERR "eni_detect: skb->cb is too small (%Zd < %Zd)\n",
-		    sizeof(skb->cb),sizeof(struct eni_skb_prv));
+		    sizeof(skb->cb), sizeof(struct eni_skb_prv));
 		return -EIO;
 	}
 	return pci_register_driver(&eni_driver);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 2/5] drivers: atm: checkpatch.pl fixes removed all trailing whitespaces in eni.c
From: Patrik Karlin @ 2013-01-20 23:12 UTC (permalink / raw)
  To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Patrik Karlin
In-Reply-To: <1358723575-8345-1-git-send-email-patrik.karlin@gmail.com>

This patch removes all trailing whitespace's in eni.c
as sugested by checkpatch.pl

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
---
 drivers/atm/eni.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 6ae0d89..1d5adc2 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1,7 +1,7 @@
 /* drivers/atm/eni.c - Efficient Networks ENI155P device driver */
- 
+
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
- 
+
 
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -33,7 +33,7 @@
 #if !defined(__i386__) && !defined(__x86_64__)
 #ifndef ioremap_nocache
 #define ioremap_nocache(X, Y) ioremap(X, Y)
-#endif 
+#endif
 #endif
 
 /*
@@ -90,7 +90,7 @@ static void event_dump(void)
 #else
 
 
-/* 
+/*
  * NULL pointer checking
  */
 
@@ -112,7 +112,7 @@ static int ec = 0;
 
 static void EVENT(const char *s, unsigned long a, unsigned long b)
 {
-	ev[ec] = s; 
+	ev[ec] = s;
 	ev_a[ec] = a;
 	ev_b[ec] = b;
 	ec = (ec+1) % EV;
@@ -1800,7 +1800,7 @@ static void eni_do_release(struct atm_dev *dev)
 static int eni_start(struct atm_dev *dev)
 {
 	struct eni_dev *eni_dev;
-	
+
 	void __iomem *buf;
 	unsigned long buffer_mem;
 	int error;
@@ -2148,7 +2148,7 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 		    " (default)"
 #endif
 		    "\n", "");
-	if (!--left) 
+	if (!--left)
 		return sprintf(page, "%4sBuffer multipliers: tx %d%%, rx %d%%\n",
 		    "", eni_dev->tx_mult, eni_dev->rx_mult);
 	for (i = 0; i < NR_CHAN; i++) {
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 3/5] drivers: atm: checkpatch.pl fixed tabbed indentation in eni.c
From: Patrik Karlin @ 2013-01-20 23:12 UTC (permalink / raw)
  To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Patrik Karlin
In-Reply-To: <1358723575-8345-1-git-send-email-patrik.karlin@gmail.com>

This removes all dont use spaces att beginning of lines errors
from checkpatch.pl

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
---
 drivers/atm/eni.c |  512 ++++++++++++++++++++++++++---------------------------
 1 file changed, 256 insertions(+), 256 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 1d5adc2..f4a136a 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -94,8 +94,8 @@ static void event_dump(void)
  * NULL pointer checking
  */
 
-#define NULLCHECK(x) \
-	if ((unsigned long) (x) < 0x30) \
+#define NULLCHECK(x)							\
+	if ((unsigned long) (x) < 0x30)					\
 		printk(KERN_CRIT #x "==0x%lx\n", (unsigned long) (x))
 
 /*
@@ -135,23 +135,23 @@ static void event_dump(void)
 
 
 /*
- * NExx   must not be equal at end
- * EExx   may be equal at end
+ * NExx	  must not be equal at end
+ * EExx	  may be equal at end
  * xxPJOK verify validity of pointer jumps
  * xxPMOK operating on a circular buffer of "c" words
  */
 
-#define NEPJOK(a0, a1, b) \
-    ((a0) < (a1) ? (b) <= (a0) || (b) > (a1) : (b) <= (a0) && (b) > (a1))
-#define EEPJOK(a0, a1, b) \
-    ((a0) < (a1) ? (b) < (a0) || (b) >= (a1) : (b) < (a0) && (b) >= (a1))
+#define NEPJOK(a0, a1, b)						\
+	((a0) < (a1) ? (b) <= (a0) || (b) > (a1) : (b) <= (a0) && (b) > (a1))
+#define EEPJOK(a0, a1, b)						\
+	((a0) < (a1) ? (b) < (a0) || (b) >= (a1) : (b) < (a0) && (b) >= (a1))
 #define NEPMOK(a0, d, b, c) NEPJOK(a0, (a0+d) & (c-1), b)
 #define EEPMOK(a0, d, b, c) EEPJOK(a0, (a0+d) & (c-1), b)
 
 
 static int tx_complete = 0, dma_complete = 0, queued = 0, requeued = 0,
-  backlogged = 0, rx_enqueued = 0, rx_dequeued = 0, pushed = 0, submitted = 0,
-  putting = 0;
+	backlogged = 0, rx_enqueued = 0, rx_dequeued = 0, pushed = 0, submitted = 0,
+	putting = 0;
 
 static struct atm_dev *eni_boards = NULL;
 
@@ -166,11 +166,11 @@ static struct atm_dev *eni_boards = NULL;
 static void dump_mem(struct eni_dev *eni_dev)
 {
 	int i;
-
+	
 	for (i = 0; i < eni_dev->free_len; i++)
 		printk(KERN_DEBUG "  %d: %p %d\n", i,
-		    eni_dev->free_list[i].start,
-		    1 << eni_dev->free_list[i].order);
+		       eni_dev->free_list[i].start,
+		       1 << eni_dev->free_list[i].order);
 }
 
 
@@ -187,19 +187,19 @@ static void dump(struct atm_dev *dev)
 	for (i = 0; i < NR_CHAN; i++)
 		if (eni_dev->tx[i].send)
 			printk(KERN_NOTICE "  TX %d @ %p: %ld\n", i,
-			    eni_dev->tx[i].send, eni_dev->tx[i].words*4);
+			       eni_dev->tx[i].send, eni_dev->tx[i].words*4);
 	printk(KERN_NOTICE "RX buffers\n");
 	for (i = 0; i < 1024; i++)
 		if (eni_dev->rx_map[i] && ENI_VCC(eni_dev->rx_map[i])->rx)
 			printk(KERN_NOTICE "  RX %d @ %p: %ld\n", i,
-			    ENI_VCC(eni_dev->rx_map[i])->recv,
-			    ENI_VCC(eni_dev->rx_map[i])->words*4);
+			       ENI_VCC(eni_dev->rx_map[i])->recv,
+			       ENI_VCC(eni_dev->rx_map[i])->words*4);
 	printk(KERN_NOTICE "----\n");
 }
 
 
 static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start,
-    unsigned long size)
+			 unsigned long size)
 {
 	struct eni_free *list;
 	int len, order;
@@ -211,13 +211,13 @@ static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start,
 	while (size) {
 		if (len >= eni_dev->free_list_size) {
 			printk(KERN_CRIT "eni_put_free overflow (%p,%ld)\n",
-			    start, size);
+			       start, size);
 			break;
 		}
 		for (order = 0; !(((unsigned long)start | size) & (1 << order)); order++);
 		if (MID_MIN_BUF_SIZE > (1 << order)) {
 			printk(KERN_CRIT "eni_put_free: order %d too small\n",
-			    order);
+			       order);
 			break;
 		}
 		list[len].start = (void __iomem *) start;
@@ -252,9 +252,9 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 			break;
 		}
 		else if (best_order > list[i].order && list[i].order > order) {
-				best_order = list[i].order;
-				index = i;
-			}
+			best_order = list[i].order;
+			index = i;
+		}
 	if (best_order == 65) return NULL;
 	start = list[index].start-eni_dev->base_diff;
 	list[index] = list[--len];
@@ -262,14 +262,14 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 	*size = 1 << order;
 	eni_put_free(eni_dev, start+*size, (1 << best_order)-*size);
 	DPRINTK("%ld bytes (order %d) at 0x%lx\n", *size, order, start);
-	memset_io(start, 0, *size);       /* never leak data */
+	memset_io(start, 0, *size);	  /* never leak data */
 	/*dump_mem(eni_dev);*/
 	return start;
 }
 
 
 static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
-    unsigned long size)
+			 unsigned long size)
 {
 	struct eni_free *list;
 	int len, i, order;
@@ -283,7 +283,7 @@ static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
 		if (((unsigned long) list[i].start) == ((unsigned long)start^(1 << order)) &&
 		    list[i].order == order) {
 			DPRINTK("match[%d]: 0x%lx/0x%lx(0x%x), %d/%d\n", i,
-			    list[i].start, start, 1 << order, list[i].order, order);
+				list[i].start, start, 1 << order, list[i].order, order);
 			list[i] = list[--len];
 			start = (void __iomem *) ((unsigned long) start & ~(unsigned long) (1 << order));
 			order++;
@@ -292,7 +292,7 @@ static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
 		}
 	if (len >= eni_dev->free_list_size) {
 		printk(KERN_ALERT "eni_free_mem overflow (%p,%d)\n", start,
-		    order);
+		       order);
 		return;
 	}
 	list[len].start = start;
@@ -318,18 +318,18 @@ static void rx_ident_err(struct atm_vcc *vcc)
 	eni_dev = ENI_DEV(dev);
 	/* immediately halt adapter */
 	eni_out(eni_in(MID_MC_S) &
-	    ~(MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE), MID_MC_S);
+		~(MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE), MID_MC_S);
 	/* dump useful information */
 	eni_vcc = ENI_VCC(vcc);
 	printk(KERN_ALERT DEV_LABEL "(itf %d): driver error - RX ident "
-	    "mismatch\n", dev->number);
+	       "mismatch\n", dev->number);
 	printk(KERN_ALERT "  VCI %d, rxing %d, words %ld\n", vcc->vci,
-	    eni_vcc->rxing, eni_vcc->words);
+	       eni_vcc->rxing, eni_vcc->words);
 	printk(KERN_ALERT "  host descr 0x%lx, rx pos 0x%lx, descr value "
-	    "0x%x\n", eni_vcc->descr, eni_vcc->rx_pos,
-	    (unsigned) readl(eni_vcc->recv+eni_vcc->descr*4));
+	       "0x%x\n", eni_vcc->descr, eni_vcc->rx_pos,
+	       (unsigned) readl(eni_vcc->recv+eni_vcc->descr*4));
 	printk(KERN_ALERT "  last %p, servicing %d\n", eni_vcc->last,
-	    eni_vcc->servicing);
+	       eni_vcc->servicing);
 	EVENT("---dump ends here---\n", 0, 0);
 	printk(KERN_NOTICE "---recent events---\n");
 	event_dump();
@@ -340,7 +340,7 @@ static void rx_ident_err(struct atm_vcc *vcc)
 
 
 static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
-                     unsigned long skip, unsigned long size, unsigned long eff)
+		     unsigned long skip, unsigned long size, unsigned long eff)
 {
 	struct eni_dev *eni_dev;
 	struct eni_vcc *eni_vcc;
@@ -355,21 +355,21 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 	paddr = 0; /* GCC, shut up */
 	if (skb) {
 		paddr = pci_map_single(eni_dev->pci_dev, skb->data, skb->len,
-		    PCI_DMA_FROMDEVICE);
+				       PCI_DMA_FROMDEVICE);
 		ENI_PRV_PADDR(skb) = paddr;
 		if (paddr & 3)
 			printk(KERN_CRIT DEV_LABEL "(itf %d): VCI %d has "
-			    "mis-aligned RX data (0x%lx)\n", vcc->dev->number,
-			    vcc->vci, (unsigned long) paddr);
+			       "mis-aligned RX data (0x%lx)\n", vcc->dev->number,
+			       vcc->vci, (unsigned long) paddr);
 		ENI_PRV_SIZE(skb) = size+skip;
-		    /* PDU plus descriptor */
+		/* PDU plus descriptor */
 		ATM_SKB(skb)->vcc = vcc;
 	}
 	j = 0;
 	if ((eff && skip) || 1) { /* @@@ actually, skip is always == 1 ... */
 		here = (eni_vcc->descr+skip) & (eni_vcc->words-1);
 		dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci
-		    << MID_DMA_VCI_SHIFT) | MID_DT_JK;
+							    << MID_DMA_VCI_SHIFT) | MID_DT_JK;
 		j++;
 	}
 	here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
@@ -380,7 +380,7 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 		if (!size) {
 			DPRINTK("strange things happen ...\n");
 			EVENT("strange things happen ... (skip=%ld,eff=%ld)\n",
-			    size, eff);
+			      size, eff);
 		}
 		words = eff;
 		if (paddr & 15) {
@@ -389,7 +389,7 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 			init = 4-((paddr & 15) >> 2);
 			if (init > words) init = words;
 			dma[j++] = MID_DT_WORD | (init << MID_DMA_COUNT_SHIFT) |
-			    (vcc->vci << MID_DMA_VCI_SHIFT);
+				(vcc->vci << MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 			paddr += init << 2;
 			words -= init;
@@ -397,8 +397,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 #ifdef CONFIG_ATM_ENI_BURST_RX_16W /* may work with some PCI chipsets ... */
 		if (words & ~15) {
 			dma[j++] = MID_DT_16W | ((words >> 4) <<
-			    MID_DMA_COUNT_SHIFT) | (vcc->vci <<
-			    MID_DMA_VCI_SHIFT);
+						 MID_DMA_COUNT_SHIFT) | (vcc->vci <<
+									 MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 			paddr += (words & ~15) << 2;
 			words &= 15;
@@ -407,8 +407,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 #ifdef CONFIG_ATM_ENI_BURST_RX_8W  /* works only with *some* PCI chipsets ... */
 		if (words & ~7) {
 			dma[j++] = MID_DT_8W | ((words >> 3) <<
-			    MID_DMA_COUNT_SHIFT) | (vcc->vci <<
-			    MID_DMA_VCI_SHIFT);
+						MID_DMA_COUNT_SHIFT) | (vcc->vci <<
+									MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 			paddr += (words & ~7) << 2;
 			words &= 7;
@@ -417,8 +417,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 #ifdef CONFIG_ATM_ENI_BURST_RX_4W /* recommended */
 		if (words & ~3) {
 			dma[j++] = MID_DT_4W | ((words >> 2) <<
-			    MID_DMA_COUNT_SHIFT) | (vcc->vci <<
-			    MID_DMA_VCI_SHIFT);
+						MID_DMA_COUNT_SHIFT) | (vcc->vci <<
+									MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 			paddr += (words & ~3) << 2;
 			words &= 3;
@@ -427,8 +427,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 #ifdef CONFIG_ATM_ENI_BURST_RX_2W /* probably useless if RX_4W, RX_8W, ... */
 		if (words & ~1) {
 			dma[j++] = MID_DT_2W | ((words >> 1) <<
-			    MID_DMA_COUNT_SHIFT) | (vcc->vci <<
-			    MID_DMA_VCI_SHIFT);
+						MID_DMA_COUNT_SHIFT) | (vcc->vci <<
+									MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 			paddr += (words & ~1) << 2;
 			words &= 1;
@@ -436,13 +436,13 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 #endif
 		if (words) {
 			dma[j++] = MID_DT_WORD | (words << MID_DMA_COUNT_SHIFT)
-			    | (vcc->vci << MID_DMA_VCI_SHIFT);
+				| (vcc->vci << MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
 		}
 	}
 	if (size != eff) {
 		dma[j++] = (here << MID_DMA_COUNT_SHIFT) |
-		    (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
+			(vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
 		j++;
 	}
 	if (!j || j > 2*RX_DMA_BUF) {
@@ -459,19 +459,19 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 	 */
 	if (!NEPMOK(dma_wr, j+j+1, dma_rd, NR_DMA_RX)) { /* @@@ +1 is ugly */
 		printk(KERN_WARNING DEV_LABEL "(itf %d): RX DMA full\n",
-		    vcc->dev->number);
+		       vcc->dev->number);
 		goto trouble;
 	}
-        for (i = 0; i < j; i++) {
+	for (i = 0; i < j; i++) {
 		writel(dma[i*2], eni_dev->rx_dma+dma_wr*8);
 		writel(dma[i*2+1], eni_dev->rx_dma+dma_wr*8+4);
 		dma_wr = (dma_wr+1) & (NR_DMA_RX-1);
-        }
+	}
 	if (skb) {
 		ENI_PRV_POS(skb) = eni_vcc->descr+size+1;
 		skb_queue_tail(&eni_dev->rx_queue, skb);
 		eni_vcc->last = skb;
-rx_enqueued++;
+		rx_enqueued++;
 	}
 	eni_vcc->descr = here;
 	eni_out(dma_wr, MID_DMA_WR_RX);
@@ -480,7 +480,7 @@ rx_enqueued++;
 trouble:
 	if (paddr)
 		pci_unmap_single(eni_dev->pci_dev, paddr, skb->len,
-		    PCI_DMA_FROMDEVICE);
+				 PCI_DMA_FROMDEVICE);
 	if (skb) dev_kfree_skb_irq(skb);
 	return -1;
 }
@@ -493,7 +493,7 @@ static void discard(struct atm_vcc *vcc, unsigned long size)
 	eni_vcc = ENI_VCC(vcc);
 	EVENT("discard (size=%ld)\n", size, 0);
 	while (do_rx_dma(vcc, NULL, 1, size, 0)) EVENT("BUSY LOOP", 0, 0);
-	    /* could do a full fallback, but that might be more expensive */
+	/* could do a full fallback, but that might be more expensive */
 	if (eni_vcc->rxing) ENI_PRV_POS(eni_vcc->last) += size+1;
 	else eni_vcc->rx_pos = (eni_vcc->rx_pos+size+1) & (eni_vcc->words-1);
 }
@@ -520,7 +520,7 @@ static int rx_aal0(struct atm_vcc *vcc)
 	}
 	if (descr & MID_RED_T) {
 		DPRINTK(DEV_LABEL "(itf %d): trashing empty cell\n",
-		    vcc->dev->number);
+			vcc->dev->number);
 		length = 0;
 		atomic_inc(&vcc->stats->rx_err);
 	}
@@ -560,7 +560,7 @@ static int rx_aal5(struct atm_vcc *vcc)
 		if (descr & MID_RED_T) {
 			EVENT("empty cell (descr=0x%lx)\n", descr, 0);
 			DPRINTK(DEV_LABEL "(itf %d): trashing empty cell\n",
-			    vcc->dev->number);
+				vcc->dev->number);
 			size = 0;
 		}
 		else {
@@ -568,13 +568,13 @@ static int rx_aal5(struct atm_vcc *vcc)
 
 			if (time_after(jiffies, silence) || silence == 0) {
 				printk(KERN_WARNING DEV_LABEL "(itf %d): "
-				    "discarding PDU(s) with CRC error\n",
-				    vcc->dev->number);
+				       "discarding PDU(s) with CRC error\n",
+				       vcc->dev->number);
 				silence = (jiffies+2*HZ)|1;
 			}
 			size = (descr & MID_RED_COUNT)*(ATM_CELL_PAYLOAD >> 2);
 			EVENT("CRC error (descr=0x%lx,size=%ld)\n", descr,
-			    size);
+			      size);
 		}
 		eff = length = 0;
 		atomic_inc(&vcc->stats->rx_err);
@@ -583,16 +583,16 @@ static int rx_aal5(struct atm_vcc *vcc)
 		size = (descr & MID_RED_COUNT)*(ATM_CELL_PAYLOAD >> 2);
 		DPRINTK("size=%ld\n", size);
 		length = readl(eni_vcc->recv+(((eni_vcc->descr+size-1) &
-		    (eni_vcc->words-1)))*4) & 0xffff;
-				/* -trailer(2)+header(1) */
+					       (eni_vcc->words-1)))*4) & 0xffff;
+		/* -trailer(2)+header(1) */
 		if (length && length <= (size << 2)-8 && length <=
-		  ATM_MAX_AAL5_PDU) eff = (length+3) >> 2;
+		    ATM_MAX_AAL5_PDU) eff = (length+3) >> 2;
 		else {				 /* ^ trailer length (8) */
 			EVENT("bad PDU (descr=0x08%lx,length=%ld)\n", descr,
-                              length);
+			      length);
 			printk(KERN_ERR DEV_LABEL "(itf %d): bad AAL5 PDU "
-			    "(VCI=%d,length=%ld,size=%ld (descr 0x%lx))\n",
-			    vcc->dev->number, vcc->vci, length, size << 2, descr);
+			       "(VCI=%d,length=%ld,size=%ld (descr 0x%lx))\n",
+			       vcc->dev->number, vcc->vci, length, size << 2, descr);
 			length = eff = 0;
 			atomic_inc(&vcc->stats->rx_err);
 		}
@@ -620,12 +620,12 @@ static inline int rx_vcc(struct atm_vcc *vcc)
 	vci_dsc = ENI_DEV(vcc->dev)->vci+vcc->vci*16;
 	EVENT("rx_vcc(1)\n", 0, 0);
 	while (eni_vcc->descr != (tmp = (readl(vci_dsc+4) & MID_VCI_DESCR) >>
-	    MID_VCI_DESCR_SHIFT)) {
+				  MID_VCI_DESCR_SHIFT)) {
 		EVENT("rx_vcc(2: host dsc=0x%lx, nic dsc=0x%lx)\n",
-		    eni_vcc->descr, tmp);
+		      eni_vcc->descr, tmp);
 		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
-		    (((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
-		    MID_VCI_DESCR_SHIFT));
+			(((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
+			 MID_VCI_DESCR_SHIFT));
 		if (ENI_VCC(vcc)->rx(vcc)) return 1;
 	}
 	/* clear IN_SERVICE flag */
@@ -637,12 +637,12 @@ static inline int rx_vcc(struct atm_vcc *vcc)
 	 */
 	EVENT("rx_vcc(3)\n", 0, 0);
 	while (ENI_VCC(vcc)->descr != (tmp = (readl(vci_dsc+4) & MID_VCI_DESCR)
-	    >> MID_VCI_DESCR_SHIFT)) {
+				       >> MID_VCI_DESCR_SHIFT)) {
 		EVENT("rx_vcc(4: host dsc=0x%lx, nic dsc=0x%lx)\n",
-		    eni_vcc->descr, tmp);
+		      eni_vcc->descr, tmp);
 		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
-		    (((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
-		    MID_VCI_DESCR_SHIFT));
+			(((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
+			 MID_VCI_DESCR_SHIFT));
 		if (ENI_VCC(vcc)->rx(vcc)) return 1;
 	}
 	return 0;
@@ -688,7 +688,7 @@ static void get_service(struct atm_dev *dev)
 		vcc = eni_dev->rx_map[vci & 1023];
 		if (!vcc) {
 			printk(KERN_CRIT DEV_LABEL "(itf %d): VCI %ld not "
-			    "found\n", dev->number, vci);
+			       "found\n", dev->number, vci);
 			continue; /* nasty but we try to go on anyway */
 			/* @@@ nope, doesn't work */
 		}
@@ -712,7 +712,7 @@ static void get_service(struct atm_dev *dev)
 			else eni_dev->slow = vcc;
 			eni_dev->last_slow = vcc;
 		}
-putting++;
+		putting++;
 		ENI_VCC(vcc)->servicing++;
 	}
 }
@@ -734,21 +734,21 @@ static void dequeue_rx(struct atm_dev *dev)
 		if (!skb) {
 			if (first) {
 				DPRINTK(DEV_LABEL "(itf %d): RX but not "
-				    "rxing\n", dev->number);
+					"rxing\n", dev->number);
 				EVENT("nothing to dequeue\n", 0, 0);
 			}
 			break;
 		}
 		EVENT("dequeued (size=%ld,pos=0x%lx)\n", ENI_PRV_SIZE(skb),
-                      ENI_PRV_POS(skb));
-rx_dequeued++;
+		      ENI_PRV_POS(skb));
+		rx_dequeued++;
 		vcc = ATM_SKB(skb)->vcc;
 		eni_vcc = ENI_VCC(vcc);
 		first = 0;
 		vci_dsc = eni_dev->vci+vcc->vci*16;
 		if (!EEPMOK(eni_vcc->rx_pos, ENI_PRV_SIZE(skb),
-		    (readl(vci_dsc+4) & MID_VCI_READ) >> MID_VCI_READ_SHIFT,
-		    eni_vcc->words)) {
+			    (readl(vci_dsc+4) & MID_VCI_READ) >> MID_VCI_READ_SHIFT,
+			    eni_vcc->words)) {
 			EVENT("requeuing\n", 0, 0);
 			skb_queue_head(&eni_dev->rx_queue, skb);
 			break;
@@ -756,13 +756,13 @@ rx_dequeued++;
 		eni_vcc->rxing--;
 		eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1);
 		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
-                                 PCI_DMA_TODEVICE);
+				 PCI_DMA_TODEVICE);
 		if (!skb->len) dev_kfree_skb_irq(skb);
 		else {
 			EVENT("pushing (len=%ld)\n", skb->len, 0);
 			if (vcc->qos.aal == ATM_AAL0)
 				*(unsigned long *) skb->data =
-				    ntohl(*(unsigned long *) skb->data);
+					ntohl(*(unsigned long *) skb->data);
 			memset(skb->cb, 0, sizeof(struct eni_skb_prv));
 			vcc->push(vcc, skb);
 			pushed++;
@@ -823,12 +823,12 @@ static int open_rx_second(struct atm_vcc *vcc)
 	writel(0, here+8); /* write, state, count = 0 */
 	if (eni_dev->rx_map[vcc->vci])
 		printk(KERN_CRIT DEV_LABEL "(itf %d): BUG - VCI %d already "
-		    "in use\n", vcc->dev->number, vcc->vci);
+		       "in use\n", vcc->dev->number, vcc->vci);
 	eni_dev->rx_map[vcc->vci] = vcc; /* now it counts */
 	writel(((vcc->qos.aal != ATM_AAL5 ? MID_MODE_RAW : MID_MODE_AAL5) <<
-	    MID_VCI_MODE_SHIFT) | MID_VCI_PTI_MODE |
-	    (((eni_vcc->recv-eni_dev->ram) >> (MID_LOC_SKIP+2)) <<
-	    MID_VCI_LOCATION_SHIFT) | (order << MID_VCI_SIZE_SHIFT), here);
+		MID_VCI_MODE_SHIFT) | MID_VCI_PTI_MODE |
+	       (((eni_vcc->recv-eni_dev->ram) >> (MID_LOC_SKIP+2)) <<
+		MID_VCI_LOCATION_SHIFT) | (order << MID_VCI_SIZE_SHIFT), here);
 	return 0;
 }
 
@@ -847,7 +847,7 @@ static void close_rx(struct atm_vcc *vcc)
 		here = eni_dev->vci+vcc->vci*16;
 		/* block receiver */
 		writel((readl(here) & ~MID_VCI_MODE) | (MID_MODE_TRASH <<
-		    MID_VCI_MODE_SHIFT), here);
+							MID_VCI_MODE_SHIFT), here);
 		/* wait for receiver to become idle */
 		udelay(27);
 		/* discard pending cell */
@@ -867,9 +867,9 @@ static void close_rx(struct atm_vcc *vcc)
 				if (!eni_vcc->rxing) break;
 			}
 			EVENT("drain PDUs (rx %ld, serv %ld)\n", eni_vcc->rxing,
-			    eni_vcc->servicing);
+			      eni_vcc->servicing);
 			printk(KERN_INFO "%d+%d RX left\n", eni_vcc->servicing,
-			    eni_vcc->rxing);
+			       eni_vcc->rxing);
 			schedule();
 			set_current_state(TASK_UNINTERRUPTIBLE);
 		}
@@ -883,9 +883,9 @@ static void close_rx(struct atm_vcc *vcc)
 			tasklet_enable(&eni_dev->task);
 			if (at_end) break;
 			EVENT("drain discard (host 0x%lx, nic 0x%lx)\n",
-			    eni_vcc->rx_pos, tmp);
+			      eni_vcc->rx_pos, tmp);
 			printk(KERN_INFO "draining RX: host 0x%lx, nic 0x%x\n",
-			    eni_vcc->rx_pos, tmp);
+			       eni_vcc->rx_pos, tmp);
 			schedule();
 			set_current_state(TASK_UNINTERRUPTIBLE);
 		}
@@ -905,7 +905,7 @@ static int start_rx(struct atm_dev *dev)
 	eni_dev->rx_map = (struct atm_vcc **) get_zeroed_page(GFP_KERNEL);
 	if (!eni_dev->rx_map) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
-		    dev->number);
+		       dev->number);
 		free_page((unsigned long) eni_dev->free_list);
 		return -ENOMEM;
 	}
@@ -927,7 +927,7 @@ enum enq_res { enq_ok, enq_next, enq_jam };
 
 
 static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
-                           u32 size)
+			   u32 size)
 {
 	u32 init, words;
 
@@ -943,9 +943,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 		init = 4-(paddr & 3);
 		if (init > size || size < 7) init = size;
 		DPRINTK("put_dma: %lx DMA: %d/%d bytes\n",
-		    (unsigned long) paddr, init, size);
+			(unsigned long) paddr, init, size);
 		dma[(*j)++] = MID_DT_BYTE | (init << MID_DMA_COUNT_SHIFT) |
-		    (chan << MID_DMA_CHAN_SHIFT);
+			(chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += init;
 		size -= init;
@@ -956,9 +956,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 		init = 8-((paddr & 31) >> 2);
 		if (init > words) init = words;
 		DPRINTK("put_dma: %lx DMA: %d/%d words\n",
-		    (unsigned long) paddr, init, words);
+			(unsigned long) paddr, init, words);
 		dma[(*j)++] = MID_DT_WORD | (init << MID_DMA_COUNT_SHIFT) |
-		    (chan << MID_DMA_CHAN_SHIFT);
+			(chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += init << 2;
 		words -= init;
@@ -966,9 +966,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_16W /* may work with some PCI chipsets ... */
 	if (words & ~15) {
 		DPRINTK("put_dma: %lx DMA: %d*16/%d words\n",
-		    (unsigned long) paddr, words >> 4, words);
+			(unsigned long) paddr, words >> 4, words);
 		dma[(*j)++] = MID_DT_16W | ((words >> 4) << MID_DMA_COUNT_SHIFT)
-		    | (chan << MID_DMA_CHAN_SHIFT);
+			| (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += (words & ~15) << 2;
 		words &= 15;
@@ -977,9 +977,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_8W /* recommended */
 	if (words & ~7) {
 		DPRINTK("put_dma: %lx DMA: %d*8/%d words\n",
-		    (unsigned long) paddr, words >> 3, words);
+			(unsigned long) paddr, words >> 3, words);
 		dma[(*j)++] = MID_DT_8W | ((words >> 3) << MID_DMA_COUNT_SHIFT)
-		    | (chan << MID_DMA_CHAN_SHIFT);
+			| (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += (words & ~7) << 2;
 		words &= 7;
@@ -988,9 +988,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_4W /* probably useless if TX_8W or TX_16W */
 	if (words & ~3) {
 		DPRINTK("put_dma: %lx DMA: %d*4/%d words\n",
-		    (unsigned long) paddr, words >> 2, words);
+			(unsigned long) paddr, words >> 2, words);
 		dma[(*j)++] = MID_DT_4W | ((words >> 2) << MID_DMA_COUNT_SHIFT)
-		    | (chan << MID_DMA_CHAN_SHIFT);
+			| (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += (words & ~3) << 2;
 		words &= 3;
@@ -999,9 +999,9 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #ifdef CONFIG_ATM_ENI_BURST_TX_2W /* probably useless if TX_4W, TX_8W, ... */
 	if (words & ~1) {
 		DPRINTK("put_dma: %lx DMA: %d*2/%d words\n",
-		    (unsigned long) paddr, words >> 1, words);
+			(unsigned long) paddr, words >> 1, words);
 		dma[(*j)++] = MID_DT_2W | ((words >> 1) << MID_DMA_COUNT_SHIFT)
-		    | (chan << MID_DMA_CHAN_SHIFT);
+			| (chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += (words & ~1) << 2;
 		words &= 1;
@@ -1009,17 +1009,17 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #endif
 	if (words) {
 		DPRINTK("put_dma: %lx DMA: %d words\n", (unsigned long) paddr,
-                        words);
+			words);
 		dma[(*j)++] = MID_DT_WORD | (words << MID_DMA_COUNT_SHIFT) |
-		    (chan << MID_DMA_CHAN_SHIFT);
+			(chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 		paddr += words << 2;
 	}
 	if (size) {
 		DPRINTK("put_dma: %lx DMA: %d bytes\n", (unsigned long) paddr,
-                        size);
+			size);
 		dma[(*j)++] = MID_DT_BYTE | (size << MID_DMA_COUNT_SHIFT) |
-		    (chan << MID_DMA_CHAN_SHIFT);
+			(chan << MID_DMA_CHAN_SHIFT);
 		dma[(*j)++] = paddr;
 	}
 }
@@ -1059,7 +1059,7 @@ static enum enq_res do_tx(struct sk_buff *skb)
 #if 0 /* should work now */
 	if ((unsigned long) skb->data & 3)
 		printk(KERN_ERR DEV_LABEL "(itf %d): VCI %d has mis-aligned "
-		    "TX data\n", vcc->dev->number, vcc->vci);
+		       "TX data\n", vcc->dev->number, vcc->vci);
 #endif
 	/*
 	 * Potential future IP speedup: make hard_header big enough to put
@@ -1071,13 +1071,13 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	/* check space in buffer */
 	if (!aal5)
 		size = (ATM_CELL_PAYLOAD >> 2)+TX_DESCR_SIZE;
-			/* cell without HEC plus segmentation header (includes
-			   four-byte cell header) */
+	/* cell without HEC plus segmentation header (includes
+	   four-byte cell header) */
 	else {
 		size = skb->len+4*AAL5_TRAILER+ATM_CELL_PAYLOAD-1;
-			/* add AAL5 trailer */
+		/* add AAL5 trailer */
 		size = ((size-(size % ATM_CELL_PAYLOAD)) >> 2)+TX_DESCR_SIZE;
-						/* add segmentation header */
+		/* add segmentation header */
 	}
 	/*
 	 * Can I move tx_pos by size bytes without getting closer than TX_GAP
@@ -1085,9 +1085,9 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	 * the manual calls "too close".
 	 */
 	if (!NEPMOK(tx->tx_pos, size+TX_GAP,
-	    eni_in(MID_TX_RDPTR(tx->index)), tx->words)) {
+		    eni_in(MID_TX_RDPTR(tx->index)), tx->words)) {
 		DPRINTK(DEV_LABEL "(itf %d): TX full (size %d)\n",
-		    vcc->dev->number, size);
+			vcc->dev->number, size);
 		return enq_next;
 	}
 	/* check DMA */
@@ -1095,44 +1095,44 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	dma_rd = eni_in(MID_DMA_RD_TX);
 	dma_size = 3; /* JK for descriptor and final fill, plus final size
 			 mis-alignment fix */
-DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
+	DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
 	if (!skb_shinfo(skb)->nr_frags) dma_size += 5;
 	else dma_size += 5*(skb_shinfo(skb)->nr_frags+1);
 	if (dma_size > TX_DMA_BUF) {
 		printk(KERN_CRIT DEV_LABEL "(itf %d): needs %d DMA entries "
-		    "(got only %d)\n", vcc->dev->number, dma_size, TX_DMA_BUF);
+		       "(got only %d)\n", vcc->dev->number, dma_size, TX_DMA_BUF);
 	}
 	DPRINTK("dma_wr is %d, tx_pos is %ld\n", dma_wr, tx->tx_pos);
 	if (dma_wr != dma_rd && ((dma_rd+NR_DMA_TX-dma_wr) & (NR_DMA_TX-1)) <
-	     dma_size) {
+	    dma_size) {
 		printk(KERN_WARNING DEV_LABEL "(itf %d): TX DMA full\n",
-                       vcc->dev->number);
+		       vcc->dev->number);
 		return enq_jam;
 	}
 	paddr = pci_map_single(eni_dev->pci_dev, skb->data, skb->len,
-                               PCI_DMA_TODEVICE);
+			       PCI_DMA_TODEVICE);
 	ENI_PRV_PADDR(skb) = paddr;
 	/* prepare DMA queue entries */
 	j = 0;
 	eni_dev->dma[j++] = (((tx->tx_pos+TX_DESCR_SIZE) & (tx->words-1)) <<
-	     MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
-	     MID_DT_JK;
+			     MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
+		MID_DT_JK;
 	j++;
 	if (!skb_shinfo(skb)->nr_frags)
 		if (aal5) put_dma(tx->index, eni_dev->dma, &j, paddr, skb->len);
 		else put_dma(tx->index, eni_dev->dma, &j, paddr+4, skb->len-4);
 	else {
-                DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
+		DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
 		for (i = -1; i < skb_shinfo(skb)->nr_frags; i++)
 			if (i == -1)
 				put_dma(tx->index, eni_dev->dma, &j, (unsigned long)
-                                        skb->data,
-                                        skb_headlen(skb));
+					skb->data,
+					skb_headlen(skb));
 			else
 				put_dma(tx->index, eni_dev->dma, &j, (unsigned long)
-                                        skb_frag_page(&skb_shinfo(skb)->frags[i]) +
+					skb_frag_page(&skb_shinfo(skb)->frags[i]) +
 					skb_shinfo(skb)->frags[i].page_offset,
-                                        skb_frag_size(&skb_shinfo(skb)->frags[i]));
+					skb_frag_size(&skb_shinfo(skb)->frags[i]));
 	}
 	if (skb->len & 3) {
 		put_dma(tx->index, eni_dev->dma, &j, eni_dev->zero.dma,
@@ -1140,24 +1140,24 @@ DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
 	}
 	/* JK for AAL5 trailer - AAL0 doesn't need it, but who cares ... */
 	eni_dev->dma[j++] = (((tx->tx_pos+size) & (tx->words-1)) <<
-	     MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
-	     MID_DMA_END | MID_DT_JK;
+			     MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
+		MID_DMA_END | MID_DT_JK;
 	j++;
 	DPRINTK("DMA at end: %d\n", j);
 	/* store frame */
 	writel((MID_SEG_TX_ID << MID_SEG_ID_SHIFT) |
-	    (aal5 ? MID_SEG_AAL5 : 0) | (tx->prescaler << MID_SEG_PR_SHIFT) |
-	    (tx->resolution << MID_SEG_RATE_SHIFT) |
-	    (size/(ATM_CELL_PAYLOAD/4)), tx->send+tx->tx_pos*4);
+	       (aal5 ? MID_SEG_AAL5 : 0) | (tx->prescaler << MID_SEG_PR_SHIFT) |
+	       (tx->resolution << MID_SEG_RATE_SHIFT) |
+	       (size/(ATM_CELL_PAYLOAD/4)), tx->send+tx->tx_pos*4);
 /*printk("dsc = 0x%08lx\n",(unsigned long) readl(tx->send+tx->tx_pos*4));*/
 	writel((vcc->vci << MID_SEG_VCI_SHIFT) |
-            (aal5 ? 0 : (skb->data[3] & 0xf)) |
-	    (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ? MID_SEG_CLP : 0),
-	    tx->send+((tx->tx_pos+1) & (tx->words-1))*4);
+	       (aal5 ? 0 : (skb->data[3] & 0xf)) |
+	       (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ? MID_SEG_CLP : 0),
+	       tx->send+((tx->tx_pos+1) & (tx->words-1))*4);
 	DPRINTK("size: %d, len:%d\n", size, skb->len);
 	if (aal5)
 		writel(skb->len, tx->send+
-                    ((tx->tx_pos+size-AAL5_TRAILER) & (tx->words-1))*4);
+		       ((tx->tx_pos+size-AAL5_TRAILER) & (tx->words-1))*4);
 	j = j >> 1;
 	for (i = 0; i < j; i++) {
 		writel(eni_dev->dma[i*2], eni_dev->tx_dma+dma_wr*8);
@@ -1171,7 +1171,7 @@ DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
 	DPRINTK("dma_wr set to %d, tx_pos is now %ld\n", dma_wr, tx->tx_pos);
 	eni_out(dma_wr, MID_DMA_WR_TX);
 	skb_queue_tail(&eni_dev->tx_queue, skb);
-queued++;
+	queued++;
 	return enq_ok;
 }
 
@@ -1192,7 +1192,7 @@ static void poll_tx(struct atm_dev *dev)
 				if (res == enq_ok) continue;
 				DPRINTK("re-queuing TX PDU\n");
 				skb_queue_head(&tx->backlog, skb);
-requeued++;
+				requeued++;
 				if (res == enq_jam) return;
 				break;
 			}
@@ -1216,7 +1216,7 @@ static void dequeue_tx(struct atm_dev *dev)
 		tx = ENI_VCC(vcc)->tx;
 		NULLCHECK(ENI_VCC(vcc)->tx);
 		DPRINTK("dequeue_tx: next 0x%lx curr 0x%x\n", ENI_PRV_POS(skb),
-		    (unsigned) eni_in(MID_TX_DESCRSTART(tx->index)));
+			(unsigned) eni_in(MID_TX_DESCRSTART(tx->index)));
 		if (ENI_VCC(vcc)->txing < tx->words && ENI_PRV_POS(skb) ==
 		    eni_in(MID_TX_DESCRSTART(tx->index))) {
 			skb_queue_head(&eni_dev->tx_queue, skb);
@@ -1224,12 +1224,12 @@ static void dequeue_tx(struct atm_dev *dev)
 		}
 		ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb);
 		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
-                                 PCI_DMA_TODEVICE);
+				 PCI_DMA_TODEVICE);
 		if (vcc->pop) vcc->pop(vcc, skb);
 		else dev_kfree_skb_irq(skb);
 		atomic_inc(&vcc->stats->tx);
 		wake_up(&eni_dev->tx_wait);
-dma_complete++;
+		dma_complete++;
 	}
 }
 
@@ -1245,10 +1245,10 @@ static struct eni_tx *alloc_tx(struct eni_dev *eni_dev, int ubr)
 
 
 static int comp_tx(struct eni_dev *eni_dev, int *pcr, int reserved, int *pre,
-                   int *res, int unlimited)
+		   int *res, int unlimited)
 {
 	static const int pre_div[] = { 4, 16, 128, 2048 };
-	    /* 2^(((x+2)^2-(x+2))/2+1) */
+	/* 2^(((x+2)^2-(x+2))/2+1) */
 
 	if (unlimited) *pre = *res = 0;
 	else {
@@ -1282,7 +1282,7 @@ static int comp_tx(struct eni_dev *eni_dev, int *pcr, int reserved, int *pre,
 
 
 static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
-                             int set_rsv, int set_shp)
+			     int set_rsv, int set_shp)
 {
 	struct eni_dev *eni_dev = ENI_DEV(vcc->dev);
 	struct eni_vcc *eni_vcc = ENI_VCC(vcc);
@@ -1296,7 +1296,7 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 	rate = atm_pcr_goal(txtp);
 	ubr = txtp->traffic_class == ATM_UBR;
 	unlimited = ubr && (!rate || rate <= -ATM_OC3_PCR ||
-	    rate >= ATM_OC3_PCR);
+			    rate >= ATM_OC3_PCR);
 	if (!unlimited) {
 		size = txtp->max_sdu*eni_dev->tx_mult/100;
 		if (size > MID_MAX_BUF_SIZE && txtp->max_sdu <=
@@ -1329,10 +1329,10 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 		skb_queue_head_init(&tx->backlog);
 		for (order = 0; size > (1 << (order+10)); order++);
 		eni_out((order << MID_SIZE_SHIFT) |
-                        ((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)),
-                        MID_TX_PLACE(tx->index));
+			((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)),
+			MID_TX_PLACE(tx->index));
 		tx->tx_pos = eni_in(MID_TX_DESCRSTART(tx->index)) &
-		    MID_DESCR_START;
+			MID_DESCR_START;
 	}
 	error = comp_tx(eni_dev, &rate, tx->reserved, &pre, &res, unlimited);
 	if (!error  && txtp->min_pcr > rate) error = -EINVAL;
@@ -1417,7 +1417,7 @@ static void close_tx(struct atm_vcc *vcc)
 		 * a bit ...
 		 */
 		while (eni_in(MID_TX_RDPTR(eni_vcc->tx->index)) !=
-		    eni_in(MID_TX_DESCRSTART(eni_vcc->tx->index)))
+		       eni_in(MID_TX_DESCRSTART(eni_vcc->tx->index)))
 			schedule();
 		eni_free_mem(eni_dev, eni_vcc->tx->send, eni_vcc->tx->words << 2);
 		eni_vcc->tx->send = NULL;
@@ -1455,12 +1455,12 @@ static int start_tx(struct atm_dev *dev)
 
 static void foo(void)
 {
-printk(KERN_INFO
-  "tx_complete=%d,dma_complete=%d,queued=%d,requeued=%d,sub=%d,\n"
-  "backlogged=%d,rx_enqueued=%d,rx_dequeued=%d,putting=%d,pushed=%d\n",
-  tx_complete, dma_complete, queued, requeued, submitted, backlogged,
-  rx_enqueued, rx_dequeued, putting, pushed);
-if (eni_boards) printk(KERN_INFO "loss: %ld\n", ENI_DEV(eni_boards)->lost);
+	printk(KERN_INFO
+	       "tx_complete=%d,dma_complete=%d,queued=%d,requeued=%d,sub=%d,\n"
+	       "backlogged=%d,rx_enqueued=%d,rx_dequeued=%d,putting=%d,pushed=%d\n",
+	       tx_complete, dma_complete, queued, requeued, submitted, backlogged,
+	       rx_enqueued, rx_dequeued, putting, pushed);
+	if (eni_boards) printk(KERN_INFO "loss: %ld\n", ENI_DEV(eni_boards)->lost);
 }
 
 #endif
@@ -1471,13 +1471,13 @@ static void bug_int(struct atm_dev *dev, unsigned long reason)
 	DPRINTK(">bug_int\n");
 	if (reason & MID_DMA_ERR_ACK)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - DMA "
-		    "error\n", dev->number);
+		       "error\n", dev->number);
 	if (reason & MID_TX_IDENT_MISM)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - ident "
-		    "mismatch\n", dev->number);
+		       "mismatch\n", dev->number);
 	if (reason & MID_TX_DMA_OVFL)
 		printk(KERN_CRIT DEV_LABEL "(itf %d): driver error - DMA "
-		    "overflow\n", dev->number);
+		       "overflow\n", dev->number);
 	EVENT("---dump ends here---\n", 0, 0);
 	printk(KERN_NOTICE "---recent events---\n");
 	event_dump();
@@ -1546,13 +1546,13 @@ static void eni_tasklet(unsigned long data)
 		poll_rx(dev);
 		EVENT("poll_rx done\n", 0, 0);
 	}
- 	if (events & MID_TX_DMA_COMPLETE) {
+	if (events & MID_TX_DMA_COMPLETE) {
 		EVENT("INT: TX DMA COMPLETE\n", 0, 0);
 		dequeue_tx(dev);
 	}
 	if (events & MID_TX_COMPLETE) {
 		EVENT("INT: TX COMPLETE\n", 0, 0);
-tx_complete++;
+		tx_complete++;
 		wake_up(&eni_dev->tx_wait);
 		/* poll_rx ? */
 	}
@@ -1568,27 +1568,27 @@ tx_complete++;
 
 
 static char * const media_name[] = {
-    "MMF", "SMF", "MMF", "03?", /*  0- 3 */
-    "UTP", "05?", "06?", "07?", /*  4- 7 */
-    "TAXI", "09?", "10?", "11?", /*  8-11 */
-    "12?", "13?", "14?", "15?", /* 12-15 */
-    "MMF", "SMF", "18?", "19?", /* 16-19 */
-    "UTP", "21?", "22?", "23?", /* 20-23 */
-    "24?", "25?", "26?", "27?", /* 24-27 */
-    "28?", "29?", "30?", "31?"  /* 28-31 */
+	"MMF", "SMF", "MMF", "03?", /*	0- 3 */
+	"UTP", "05?", "06?", "07?", /*	4- 7 */
+	"TAXI", "09?", "10?", "11?", /*	 8-11 */
+	"12?", "13?", "14?", "15?", /* 12-15 */
+	"MMF", "SMF", "18?", "19?", /* 16-19 */
+	"UTP", "21?", "22?", "23?", /* 20-23 */
+	"24?", "25?", "26?", "27?", /* 24-27 */
+	"28?", "29?", "30?", "31?"	/* 28-31 */
 };
 
 
-#define SET_SEPROM \
-  ({ if (!error && !pci_error) { \
-    pci_error = pci_write_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, tonga); \
-    udelay(10); /* 10 usecs */ \
-  } })
-#define GET_SEPROM \
-  ({ if (!error && !pci_error) { \
-    pci_error = pci_read_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, &tonga); \
-    udelay(10); /* 10 usecs */ \
-  } })
+#define SET_SEPROM							\
+	({ if (!error && !pci_error) {					\
+			pci_error = pci_write_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, tonga); \
+			udelay(10); /* 10 usecs */			\
+		} })
+#define GET_SEPROM							\
+	({ if (!error && !pci_error) {					\
+			pci_error = pci_read_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL, &tonga); \
+			udelay(10); /* 10 usecs */			\
+		} })
 
 
 static int get_esi_asic(struct atm_dev *dev)
@@ -1616,7 +1616,7 @@ static int get_esi_asic(struct atm_dev *dev)
 		address = ((i+SEPROM_ESI_BASE) << 1)+1;
 		for (j = 7; j >= 0; j--) {
 			tonga = (address >> j) & 1 ? tonga | SEPROM_DATA :
-			    tonga & ~SEPROM_DATA;
+				tonga & ~SEPROM_DATA;
 			SET_SEPROM;
 			tonga |= SEPROM_CLK;
 			SET_SEPROM;
@@ -1672,7 +1672,7 @@ static int get_esi_asic(struct atm_dev *dev)
 	}
 	if (pci_error) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): error reading ESI "
-		    "(0x%02x)\n", dev->number, pci_error);
+		       "(0x%02x)\n", dev->number, pci_error);
 		error = -EIO;
 	}
 	return error;
@@ -1712,18 +1712,18 @@ static int eni_do_init(struct atm_dev *dev)
 	real_base = pci_resource_start(pci_dev, 0);
 	eni_dev->irq = pci_dev->irq;
 	if ((error = pci_write_config_word(pci_dev, PCI_COMMAND,
-	    PCI_COMMAND_MEMORY |
-	    (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
+					   PCI_COMMAND_MEMORY |
+					   (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't enable memory "
-		    "(0x%02x)\n", dev->number, error);
+		       "(0x%02x)\n", dev->number, error);
 		return -EIO;
 	}
 	printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,",
-	    dev->number, pci_dev->revision, real_base, eni_dev->irq);
+	       dev->number, pci_dev->revision, real_base, eni_dev->irq);
 	if (!(base = ioremap_nocache(real_base, MAP_MAX_SIZE))) {
 		printk("\n");
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
-		    "mapping\n", dev->number);
+		       "mapping\n", dev->number);
 		return error;
 	}
 	eni_dev->ioaddr = base;
@@ -1764,7 +1764,7 @@ static int eni_do_init(struct atm_dev *dev)
 	if (!(eni_in(MID_RES_ID_MCON) & 0x200) != !eni_dev->asic) {
 		printk(")\n");
 		printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n",
-		    dev->number, (unsigned) eni_in(MID_RES_ID_MCON));
+		       dev->number, (unsigned) eni_in(MID_RES_ID_MCON));
 		error = -EINVAL;
 		goto unmap;
 	}
@@ -1775,8 +1775,8 @@ static int eni_do_init(struct atm_dev *dev)
 		printk("%s%02X", i ? "-" : "", dev->esi[i]);
 	printk(")\n");
 	printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n", dev->number,
-	    eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
-	    media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
+	       eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
+	       media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
 
 	error = suni_init(dev);
 	if (error)
@@ -1809,22 +1809,22 @@ static int eni_start(struct atm_dev *dev)
 	eni_dev = ENI_DEV(dev);
 	if (request_irq(eni_dev->irq, &eni_int, IRQF_SHARED, DEV_LABEL, dev)) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
-		    dev->number, eni_dev->irq);
+		       dev->number, eni_dev->irq);
 		error = -EAGAIN;
 		goto out;
 	}
 	pci_set_master(eni_dev->pci_dev);
 	if ((error = pci_write_config_word(eni_dev->pci_dev, PCI_COMMAND,
-	    PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
-	    (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
+					   PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
+					   (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't enable memory+"
-		    "master (0x%02x)\n", dev->number, error);
+		       "master (0x%02x)\n", dev->number, error);
 		goto free_irq;
 	}
 	if ((error = pci_write_config_byte(eni_dev->pci_dev, PCI_TONGA_CTRL,
-                                           END_SWAP_DMA))) {
+					   END_SWAP_DMA))) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap "
-		    "(0x%02x)\n", dev->number, error);
+		       "(0x%02x)\n", dev->number, error);
 		goto free_irq;
 	}
 	/* determine addresses of internal tables */
@@ -1834,8 +1834,8 @@ static int eni_start(struct atm_dev *dev)
 	eni_dev->service = eni_dev->tx_dma+NR_DMA_TX*8;
 	buf = eni_dev->service+NR_SERVICE*4;
 	DPRINTK("vci 0x%lx,rx 0x%lx, tx 0x%lx,srv 0x%lx,buf 0x%lx\n",
-	     eni_dev->vci, eni_dev->rx_dma, eni_dev->tx_dma,
-	     eni_dev->service, buf);
+		eni_dev->vci, eni_dev->rx_dma, eni_dev->tx_dma,
+		eni_dev->service, buf);
 	spin_lock_init(&eni_dev->lock);
 	tasklet_init(&eni_dev->task, eni_tasklet, (unsigned long) dev);
 	eni_dev->events = 0;
@@ -1843,10 +1843,10 @@ static int eni_start(struct atm_dev *dev)
 	buffer_mem = eni_dev->mem - (buf - eni_dev->ram);
 	eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2;
 	eni_dev->free_list = kmalloc(
-                sizeof(struct eni_free)*(eni_dev->free_list_size+1), GFP_KERNEL);
+		sizeof(struct eni_free)*(eni_dev->free_list_size+1), GFP_KERNEL);
 	if (!eni_dev->free_list) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
-		    dev->number);
+		       dev->number);
 		error = -ENOMEM;
 		goto free_irq;
 	}
@@ -1855,7 +1855,7 @@ static int eni_start(struct atm_dev *dev)
 	memset_io(eni_dev->vci, 0, 16*NR_VCI); /* clear VCI table */
 	/*
 	 * byte_addr  free (k)
-	 * 0x00000000     512  VCI table
+	 * 0x00000000	  512  VCI table
 	 * 0x00004000	  496  RX DMA
 	 * 0x00005000	  492  TX DMA
 	 * 0x00006000	  488  service list
@@ -1870,9 +1870,9 @@ static int eni_start(struct atm_dev *dev)
 	error = dev->phy->start(dev);
 	if (error) goto free_list;
 	eni_out(eni_in(MID_MC_S) | (1 << MID_INT_SEL_SHIFT) |
-	    MID_TX_LOCK_MODE | MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE,
-	    MID_MC_S);
-	    /* Tonga uses SBus INTReq1 */
+		MID_TX_LOCK_MODE | MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE,
+		MID_MC_S);
+	/* Tonga uses SBus INTReq1 */
 	(void) eni_in(MID_ISA); /* clear Midway interrupts */
 	return 0;
 
@@ -1919,7 +1919,7 @@ static int eni_open(struct atm_vcc *vcc)
 	if (vcc->qos.aal != ATM_AAL0 && vcc->qos.aal != ATM_AAL5)
 		return -EINVAL;
 	DPRINTK(DEV_LABEL "(itf %d): open %d.%d\n", vcc->dev->number, vcc->vpi,
-                vcc->vci);
+		vcc->vci);
 	if (!test_bit(ATM_VF_PARTIAL, &vcc->flags)) {
 		eni_vcc = kmalloc(sizeof(struct eni_vcc), GFP_KERNEL);
 		if (!eni_vcc) return -ENOMEM;
@@ -1980,8 +1980,8 @@ static int eni_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flgs)
 		if (ATM_SKB(skb)->vcc != vcc) continue;
 		dsc = tx->send+ENI_PRV_POS(skb)*4;
 		writel((readl(dsc) & ~(MID_SEG_RATE | MID_SEG_PR)) |
-		    (tx->prescaler << MID_SEG_PR_SHIFT) |
-		    (tx->resolution << MID_SEG_RATE_SHIFT), dsc);
+		       (tx->prescaler << MID_SEG_PR_SHIFT) |
+		       (tx->resolution << MID_SEG_RATE_SHIFT), dsc);
 	}
 	tasklet_enable(&eni_dev->task);
 	return 0;
@@ -1995,7 +1995,7 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 	if (cmd == ENI_MEMDUMP) {
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
 		printk(KERN_WARNING "Please use /proc/atm/" DEV_LABEL ":%d "
-		    "instead of obsolete ioctl ENI_MEMDUMP\n", dev->number);
+		       "instead of obsolete ioctl ENI_MEMDUMP\n", dev->number);
 		dump(dev);
 		return 0;
 	}
@@ -2004,7 +2004,7 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
 		if (copy_from_user(&mult, arg,
-		    sizeof(struct eni_multipliers)))
+				   sizeof(struct eni_multipliers)))
 			return -EFAULT;
 		if ((mult.tx && mult.tx <= 100) || (mult.rx &&mult.rx <= 100) ||
 		    mult.tx > 65536 || mult.rx > 65536)
@@ -2020,7 +2020,7 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 			return -EFAULT;
 		if ((ci.vpi_bits == 0 || ci.vpi_bits == ATM_CI_MAX) &&
 		    (ci.vci_bits == NR_VCI_LD || ci.vpi_bits == ATM_CI_MAX))
-		    return 0;
+			return 0;
 		return -EINVAL;
 	}
 	if (!dev->phy->ioctl) return -ENOIOCTLCMD;
@@ -2029,14 +2029,14 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 
 
 static int eni_getsockopt(struct atm_vcc *vcc, int level, int optname,
-                          void __user *optval, int optlen)
+			  void __user *optval, int optlen)
 {
 	return -EINVAL;
 }
 
 
 static int eni_setsockopt(struct atm_vcc *vcc, int level, int optname,
-                          void __user *optval, unsigned int optlen)
+			  void __user *optval, unsigned int optlen)
 {
 	return -EINVAL;
 }
@@ -2065,20 +2065,20 @@ static int eni_send(struct atm_vcc *vcc, struct sk_buff *skb)
 		}
 		*(u32 *) skb->data = htonl(*(u32 *) skb->data);
 	}
-submitted++;
+	submitted++;
 	ATM_SKB(skb)->vcc = vcc;
 	tasklet_disable(&ENI_DEV(vcc->dev)->task);
 	res = do_tx(skb);
 	tasklet_enable(&ENI_DEV(vcc->dev)->task);
 	if (res == enq_ok) return 0;
 	skb_queue_tail(&ENI_VCC(vcc)->tx->backlog, skb);
-backlogged++;
+	backlogged++;
 	tasklet_schedule(&ENI_DEV(vcc->dev)->task);
 	return 0;
 }
 
 static void eni_phy_put(struct atm_dev *dev, unsigned char value,
-                        unsigned long addr)
+			unsigned long addr)
 {
 	writel(value, ENI_DEV(dev)->phy+addr*4);
 }
@@ -2103,69 +2103,69 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 	left = *pos;
 	if (!left)
 		return sprintf(page, DEV_LABEL "(itf %d) signal %s, %dkB, "
-		    "%d cps remaining\n", dev->number, signal[(int) dev->signal],
-		    eni_dev->mem >> 10, eni_dev->tx_bw);
+			       "%d cps remaining\n", dev->number, signal[(int) dev->signal],
+			       eni_dev->mem >> 10, eni_dev->tx_bw);
 	if (!--left)
 		return sprintf(page, "%4sBursts: TX"
-#if !defined(CONFIG_ATM_ENI_BURST_TX_16W) && \
-    !defined(CONFIG_ATM_ENI_BURST_TX_8W) && \
-    !defined(CONFIG_ATM_ENI_BURST_TX_4W) && \
-    !defined(CONFIG_ATM_ENI_BURST_TX_2W)
-		    " none"
+#if !defined(CONFIG_ATM_ENI_BURST_TX_16W) &&	\
+	!defined(CONFIG_ATM_ENI_BURST_TX_8W) && \
+	!defined(CONFIG_ATM_ENI_BURST_TX_4W) && \
+	!defined(CONFIG_ATM_ENI_BURST_TX_2W)
+			       " none"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_TX_16W
-		    " 16W"
+			       " 16W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_TX_8W
-		    " 8W"
+			       " 8W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_TX_4W
-		    " 4W"
+			       " 4W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_TX_2W
-		    " 2W"
+			       " 2W"
 #endif
-		    ", RX"
-#if !defined(CONFIG_ATM_ENI_BURST_RX_16W) && \
-    !defined(CONFIG_ATM_ENI_BURST_RX_8W) && \
-    !defined(CONFIG_ATM_ENI_BURST_RX_4W) && \
-    !defined(CONFIG_ATM_ENI_BURST_RX_2W)
-		    " none"
+			       ", RX"
+#if !defined(CONFIG_ATM_ENI_BURST_RX_16W) &&	\
+	!defined(CONFIG_ATM_ENI_BURST_RX_8W) && \
+	!defined(CONFIG_ATM_ENI_BURST_RX_4W) && \
+	!defined(CONFIG_ATM_ENI_BURST_RX_2W)
+			       " none"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_RX_16W
-		    " 16W"
+			       " 16W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_RX_8W
-		    " 8W"
+			       " 8W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_RX_4W
-		    " 4W"
+			       " 4W"
 #endif
 #ifdef CONFIG_ATM_ENI_BURST_RX_2W
-		    " 2W"
+			       " 2W"
 #endif
 #ifndef CONFIG_ATM_ENI_TUNE_BURST
-		    " (default)"
+			       " (default)"
 #endif
-		    "\n", "");
+			       "\n", "");
 	if (!--left)
 		return sprintf(page, "%4sBuffer multipliers: tx %d%%, rx %d%%\n",
-		    "", eni_dev->tx_mult, eni_dev->rx_mult);
+			       "", eni_dev->tx_mult, eni_dev->rx_mult);
 	for (i = 0; i < NR_CHAN; i++) {
 		struct eni_tx *tx = eni_dev->tx+i;
 
 		if (!tx->send) continue;
 		if (!--left) {
-			return sprintf(page, "tx[%d]:    0x%ld-0x%ld "
-			    "(%6ld bytes), rsv %d cps, shp %d cps%s\n", i,
-			    (unsigned long) (tx->send - eni_dev->ram),
-			    tx->send-eni_dev->ram+tx->words*4-1, tx->words*4,
-			    tx->reserved, tx->shaping,
-			    tx == eni_dev->ubr ? " (UBR)" : "");
+			return sprintf(page, "tx[%d]:	 0x%ld-0x%ld "
+				       "(%6ld bytes), rsv %d cps, shp %d cps%s\n", i,
+				       (unsigned long) (tx->send - eni_dev->ram),
+				       tx->send-eni_dev->ram+tx->words*4-1, tx->words*4,
+				       tx->reserved, tx->shaping,
+				       tx == eni_dev->ubr ? " (UBR)" : "");
 		}
 		if (--left) continue;
 		return sprintf(page, "%10sbacklog %u packets\n", "",
-		    skb_queue_len(&tx->backlog));
+			       skb_queue_len(&tx->backlog));
 	}
 	read_lock(&vcc_sklist_lock);
 	for(i = 0; i < VCC_HTABLE_SIZE; ++i) {
@@ -2183,15 +2183,15 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 			length = sprintf(page, "vcc %4d: ", vcc->vci);
 			if (eni_vcc->rx) {
 				length += sprintf(page+length, "0x%ld-0x%ld "
-				    "(%6ld bytes)",
-				    (unsigned long) (eni_vcc->recv - eni_dev->ram),
-				    eni_vcc->recv-eni_dev->ram+eni_vcc->words*4-1,
-				    eni_vcc->words*4);
+						  "(%6ld bytes)",
+						  (unsigned long) (eni_vcc->recv - eni_dev->ram),
+						  eni_vcc->recv-eni_dev->ram+eni_vcc->words*4-1,
+						  eni_vcc->words*4);
 				if (eni_vcc->tx) length += sprintf(page+length, ", ");
 			}
 			if (eni_vcc->tx)
 				length += sprintf(page+length, "tx[%d], txing %d bytes",
-				    eni_vcc->tx->index, eni_vcc->txing);
+						  eni_vcc->tx->index, eni_vcc->txing);
 			page[length] = '\n';
 			read_unlock(&vcc_sklist_lock);
 			return length+1;
@@ -2204,9 +2204,9 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 
 		if (--left) continue;
 		offset = (unsigned long) eni_dev->ram+eni_dev->base_diff;
-		return sprintf(page, "free      %p-%p (%6d bytes)\n",
-		    fe->start-offset, fe->start-offset+(1 << fe->order)-1,
-		    1 << fe->order);
+		return sprintf(page, "free	%p-%p (%6d bytes)\n",
+			       fe->start-offset, fe->start-offset+(1 << fe->order)-1,
+			       1 << fe->order);
 	}
 	return 0;
 }
@@ -2320,7 +2320,7 @@ static int __init eni_init(void)
 
 	if (sizeof(skb->cb) < sizeof(struct eni_skb_prv)) {
 		printk(KERN_ERR "eni_detect: skb->cb is too small (%Zd < %Zd)\n",
-		    sizeof(skb->cb), sizeof(struct eni_skb_prv));
+		       sizeof(skb->cb), sizeof(struct eni_skb_prv));
 		return -EIO;
 	}
 	return pci_register_driver(&eni_driver);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 4/5] drivers: atm: checkpatch.pl changed headers from asm/* to linux/* in eni.c
From: Patrik Karlin @ 2013-01-20 23:12 UTC (permalink / raw)
  To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Patrik Karlin
In-Reply-To: <1358723575-8345-1-git-send-email-patrik.karlin@gmail.com>

This patch changes the included headers from asm/* to linux/* for
header changes sugested by checkpatch.pl

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
---
 drivers/atm/eni.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index f4a136a..2877832 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -19,10 +19,10 @@
 #include <linux/atm_eni.h>
 #include <linux/bitops.h>
 #include <linux/slab.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
-#include <asm/string.h>
+#include <linux/uaccess.h>
+#include <linux/string.h>
 #include <asm/byteorder.h>
 
 #include "tonga.h"
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 5/5] drivers: atm: checkpatch.pl fixed coding style issues in eni.c
From: Patrik Karlin @ 2013-01-20 23:12 UTC (permalink / raw)
  To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Patrik Karlin
In-Reply-To: <1358723575-8345-1-git-send-email-patrik.karlin@gmail.com>

This patch fixes statement placement around if/else/for statments
as suggested by checkpatch.pl

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
---
 drivers/atm/eni.c |  318 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 205 insertions(+), 113 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 2877832..a8a18d4 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -214,7 +214,8 @@ static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start,
 			       start, size);
 			break;
 		}
-		for (order = 0; !(((unsigned long)start | size) & (1 << order)); order++);
+		for (order = 0; !(((unsigned long)start | size) & (1 << order)); order++)
+			;
 		if (MID_MIN_BUF_SIZE > (1 << order)) {
 			printk(KERN_CRIT "eni_put_free: order %d too small\n",
 			       order);
@@ -239,9 +240,12 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 
 	list = eni_dev->free_list;
 	len = eni_dev->free_len;
-	if (*size < MID_MIN_BUF_SIZE) *size = MID_MIN_BUF_SIZE;
-	if (*size > MID_MAX_BUF_SIZE) return NULL;
-	for (order = 0; (1 << order) < *size; order++);
+	if (*size < MID_MIN_BUF_SIZE)
+		*size = MID_MIN_BUF_SIZE;
+	if (*size > MID_MAX_BUF_SIZE)
+		return NULL;
+	for (order = 0; (1 << order) < *size; order++)
+		;
 	DPRINTK("trying: %ld->%d\n", *size, order);
 	best_order = 65; /* we don't have more than 2^64 of anything ... */
 	index = 0; /* silence GCC */
@@ -250,12 +254,12 @@ static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
 			best_order = order;
 			index = i;
 			break;
-		}
-		else if (best_order > list[i].order && list[i].order > order) {
+		} else if (best_order > list[i].order && list[i].order > order) {
 			best_order = list[i].order;
 			index = i;
 		}
-	if (best_order == 65) return NULL;
+	if (best_order == 65)
+		return NULL;
 	start = list[index].start-eni_dev->base_diff;
 	list[index] = list[--len];
 	eni_dev->free_len = len;
@@ -277,7 +281,8 @@ static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
 	start += eni_dev->base_diff;
 	list = eni_dev->free_list;
 	len = eni_dev->free_len;
-	for (order = -1; size; order++) size >>= 1;
+	for (order = -1; size; order++)
+		size >>= 1;
 	DPRINTK("eni_free_mem: %p+0x%lx (order %d)\n", start, size, order);
 	for (i = 0; i < len; i++)
 		if (((unsigned long) list[i].start) == ((unsigned long)start^(1 << order)) &&
@@ -373,7 +378,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 		j++;
 	}
 	here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
-	if (!eff) size += skip;
+	if (!eff)
+		size += skip;
 	else {
 		unsigned long words;
 
@@ -387,7 +393,8 @@ static int do_rx_dma(struct atm_vcc *vcc, struct sk_buff *skb,
 			unsigned long init;
 
 			init = 4-((paddr & 15) >> 2);
-			if (init > words) init = words;
+			if (init > words)
+				init = words;
 			dma[j++] = MID_DT_WORD | (init << MID_DMA_COUNT_SHIFT) |
 				(vcc->vci << MID_DMA_VCI_SHIFT);
 			dma[j++] = paddr;
@@ -481,7 +488,8 @@ trouble:
 	if (paddr)
 		pci_unmap_single(eni_dev->pci_dev, paddr, skb->len,
 				 PCI_DMA_FROMDEVICE);
-	if (skb) dev_kfree_skb_irq(skb);
+	if (skb)
+		dev_kfree_skb_irq(skb);
 	return -1;
 }
 
@@ -492,10 +500,13 @@ static void discard(struct atm_vcc *vcc, unsigned long size)
 
 	eni_vcc = ENI_VCC(vcc);
 	EVENT("discard (size=%ld)\n", size, 0);
-	while (do_rx_dma(vcc, NULL, 1, size, 0)) EVENT("BUSY LOOP", 0, 0);
+	while (do_rx_dma(vcc, NULL, 1, size, 0))
+		EVENT("BUSY LOOP", 0, 0);
 	/* could do a full fallback, but that might be more expensive */
-	if (eni_vcc->rxing) ENI_PRV_POS(eni_vcc->last) += size+1;
-	else eni_vcc->rx_pos = (eni_vcc->rx_pos+size+1) & (eni_vcc->words-1);
+	if (eni_vcc->rxing)
+		ENI_PRV_POS(eni_vcc->last) += size+1;
+	else
+		eni_vcc->rx_pos = (eni_vcc->rx_pos+size+1) & (eni_vcc->words-1);
 }
 
 
@@ -523,8 +534,7 @@ static int rx_aal0(struct atm_vcc *vcc)
 			vcc->dev->number);
 		length = 0;
 		atomic_inc(&vcc->stats->rx_err);
-	}
-	else {
+	} else {
 		length = ATM_CELL_SIZE-1; /* no HEC */
 	}
 	skb = length ? atm_alloc_charge(vcc, length, GFP_ATOMIC) : NULL;
@@ -535,7 +545,8 @@ static int rx_aal0(struct atm_vcc *vcc)
 	skb_put(skb, length);
 	skb->tstamp = eni_vcc->timestamp;
 	DPRINTK("got len %ld\n", length);
-	if (do_rx_dma(vcc, skb, 1, length >> 2, length >> 2)) return 1;
+	if (do_rx_dma(vcc, skb, 1, length >> 2, length >> 2))
+		return 1;
 	eni_vcc->rxing++;
 	return 0;
 }
@@ -562,8 +573,7 @@ static int rx_aal5(struct atm_vcc *vcc)
 			DPRINTK(DEV_LABEL "(itf %d): trashing empty cell\n",
 				vcc->dev->number);
 			size = 0;
-		}
-		else {
+		} else {
 			static unsigned long silence = 0;
 
 			if (time_after(jiffies, silence) || silence == 0) {
@@ -578,15 +588,15 @@ static int rx_aal5(struct atm_vcc *vcc)
 		}
 		eff = length = 0;
 		atomic_inc(&vcc->stats->rx_err);
-	}
-	else {
+	} else {
 		size = (descr & MID_RED_COUNT)*(ATM_CELL_PAYLOAD >> 2);
 		DPRINTK("size=%ld\n", size);
 		length = readl(eni_vcc->recv+(((eni_vcc->descr+size-1) &
 					       (eni_vcc->words-1)))*4) & 0xffff;
 		/* -trailer(2)+header(1) */
 		if (length && length <= (size << 2)-8 && length <=
-		    ATM_MAX_AAL5_PDU) eff = (length+3) >> 2;
+		    ATM_MAX_AAL5_PDU) 
+			eff = (length+3) >> 2;
 		else {				 /* ^ trailer length (8) */
 			EVENT("bad PDU (descr=0x08%lx,length=%ld)\n", descr,
 			      length);
@@ -604,7 +614,8 @@ static int rx_aal5(struct atm_vcc *vcc)
 	}
 	skb_put(skb, length);
 	DPRINTK("got len %ld\n", length);
-	if (do_rx_dma(vcc, skb, 1, size, eff)) return 1;
+	if (do_rx_dma(vcc, skb, 1, size, eff))
+		return 1;
 	eni_vcc->rxing++;
 	return 0;
 }
@@ -626,7 +637,8 @@ static inline int rx_vcc(struct atm_vcc *vcc)
 		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
 			(((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
 			 MID_VCI_DESCR_SHIFT));
-		if (ENI_VCC(vcc)->rx(vcc)) return 1;
+		if (ENI_VCC(vcc)->rx(vcc))
+			return 1;
 	}
 	/* clear IN_SERVICE flag */
 	writel(readl(vci_dsc) & ~MID_VCI_IN_SERVICE, vci_dsc);
@@ -643,7 +655,8 @@ static inline int rx_vcc(struct atm_vcc *vcc)
 		DPRINTK("CB_DESCR %ld REG_DESCR %d\n", ENI_VCC(vcc)->descr,
 			(((unsigned) readl(vci_dsc+4) & MID_VCI_DESCR) >>
 			 MID_VCI_DESCR_SHIFT));
-		if (ENI_VCC(vcc)->rx(vcc)) return 1;
+		if (ENI_VCC(vcc)->rx(vcc))
+			return 1;
 	}
 	return 0;
 }
@@ -657,7 +670,8 @@ static void poll_rx(struct atm_dev *dev)
 	eni_dev = ENI_DEV(dev);
 	while ((curr = eni_dev->fast)) {
 		EVENT("poll_rx.fast\n", 0, 0);
-		if (rx_vcc(curr)) return;
+		if (rx_vcc(curr))
+			return;
 		eni_dev->fast = ENI_VCC(curr)->next;
 		ENI_VCC(curr)->next = ENI_VCC_NOS;
 		barrier();
@@ -665,7 +679,8 @@ static void poll_rx(struct atm_dev *dev)
 	}
 	while ((curr = eni_dev->slow)) {
 		EVENT("poll_rx.slow\n", 0, 0);
-		if (rx_vcc(curr)) return;
+		if (rx_vcc(curr))
+			return;
 		eni_dev->slow = ENI_VCC(curr)->next;
 		ENI_VCC(curr)->next = ENI_VCC_NOS;
 		barrier();
@@ -703,13 +718,14 @@ static void get_service(struct atm_dev *dev)
 		if (vcc->qos.rxtp.traffic_class == ATM_CBR) {
 			if (eni_dev->fast)
 				ENI_VCC(eni_dev->last_fast)->next = vcc;
-			else eni_dev->fast = vcc;
+			else
+				eni_dev->fast = vcc;
 			eni_dev->last_fast = vcc;
-		}
-		else {
+		} else {
 			if (eni_dev->slow)
 				ENI_VCC(eni_dev->last_slow)->next = vcc;
-			else eni_dev->slow = vcc;
+			else
+				eni_dev->slow = vcc;
 			eni_dev->last_slow = vcc;
 		}
 		putting++;
@@ -757,7 +773,8 @@ static void dequeue_rx(struct atm_dev *dev)
 		eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1);
 		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
 				 PCI_DMA_TODEVICE);
-		if (!skb->len) dev_kfree_skb_irq(skb);
+		if (!skb->len)
+			dev_kfree_skb_irq(skb);
 		else {
 			EVENT("pushing (len=%ld)\n", skb->len, 0);
 			if (vcc->qos.aal == ATM_AAL0)
@@ -783,7 +800,8 @@ static int open_rx_first(struct atm_vcc *vcc)
 	eni_dev = ENI_DEV(vcc->dev);
 	eni_vcc = ENI_VCC(vcc);
 	eni_vcc->rx = NULL;
-	if (vcc->qos.rxtp.traffic_class == ATM_NONE) return 0;
+	if (vcc->qos.rxtp.traffic_class == ATM_NONE)
+		return 0;
 	size = vcc->qos.rxtp.max_sdu*eni_dev->rx_mult/100;
 	if (size > MID_MAX_BUF_SIZE && vcc->qos.rxtp.max_sdu <=
 	    MID_MAX_BUF_SIZE)
@@ -791,7 +809,8 @@ static int open_rx_first(struct atm_vcc *vcc)
 	eni_vcc->recv = eni_alloc_mem(eni_dev, &size);
 	DPRINTK("rx at 0x%lx\n", eni_vcc->recv);
 	eni_vcc->words = size >> 2;
-	if (!eni_vcc->recv) return -ENOBUFS;
+	if (!eni_vcc->recv)
+		return -ENOBUFS;
 	eni_vcc->rx = vcc->qos.aal == ATM_AAL5 ? rx_aal5 : rx_aal0;
 	eni_vcc->descr = 0;
 	eni_vcc->rx_pos = 0;
@@ -813,12 +832,14 @@ static int open_rx_second(struct atm_vcc *vcc)
 	DPRINTK("open_rx_second\n");
 	eni_dev = ENI_DEV(vcc->dev);
 	eni_vcc = ENI_VCC(vcc);
-	if (!eni_vcc->rx) return 0;
+	if (!eni_vcc->rx)
+		return 0;
 	/* set up VCI descriptor */
 	here = eni_dev->vci+vcc->vci*16;
 	DPRINTK("loc 0x%x\n", (unsigned) (eni_vcc->recv-eni_dev->ram)/4);
 	size = eni_vcc->words >> 8;
-	for (order = -1; size; order++) size >>= 1;
+	for (order = -1; size; order++)
+		size >>= 1;
 	writel(0, here+4); /* descr, read = 0 */
 	writel(0, here+8); /* write, state, count = 0 */
 	if (eni_dev->rx_map[vcc->vci])
@@ -841,7 +862,8 @@ static void close_rx(struct atm_vcc *vcc)
 	struct eni_vcc *eni_vcc;
 
 	eni_vcc = ENI_VCC(vcc);
-	if (!eni_vcc->rx) return;
+	if (!eni_vcc->rx)
+		return;
 	eni_dev = ENI_DEV(vcc->dev);
 	if (vcc->vpi != ATM_VPI_UNSPEC && vcc->vci != ATM_VCI_UNSPEC) {
 		here = eni_dev->vci+vcc->vci*16;
@@ -864,7 +886,8 @@ static void close_rx(struct atm_vcc *vcc)
 			/* transition service->rx: rxing++, servicing-- */
 			if (!eni_vcc->servicing) {
 				barrier();
-				if (!eni_vcc->rxing) break;
+				if (!eni_vcc->rxing)
+					break;
 			}
 			EVENT("drain PDUs (rx %ld, serv %ld)\n", eni_vcc->rxing,
 			      eni_vcc->servicing);
@@ -881,7 +904,8 @@ static void close_rx(struct atm_vcc *vcc)
 			tmp = readl(eni_dev->vci+vcc->vci*16+4) & MID_VCI_READ;
 			at_end = eni_vcc->rx_pos == tmp >> MID_VCI_READ_SHIFT;
 			tasklet_enable(&eni_dev->task);
-			if (at_end) break;
+			if (at_end)
+				break;
 			EVENT("drain discard (host 0x%lx, nic 0x%lx)\n",
 			      eni_vcc->rx_pos, tmp);
 			printk(KERN_INFO "draining RX: host 0x%lx, nic 0x%x\n",
@@ -941,7 +965,8 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 #endif
 	if (paddr & 3) {
 		init = 4-(paddr & 3);
-		if (init > size || size < 7) init = size;
+		if (init > size || size < 7)
+			init = size;
 		DPRINTK("put_dma: %lx DMA: %d/%d bytes\n",
 			(unsigned long) paddr, init, size);
 		dma[(*j)++] = MID_DT_BYTE | (init << MID_DMA_COUNT_SHIFT) |
@@ -954,7 +979,8 @@ static inline void put_dma(int chan, u32 *dma, int *j, dma_addr_t paddr,
 	size &= 3;
 	if (words && (paddr & 31)) {
 		init = 8-((paddr & 31) >> 2);
-		if (init > words) init = words;
+		if (init > words)
+			init = words;
 		DPRINTK("put_dma: %lx DMA: %d/%d words\n",
 			(unsigned long) paddr, init, words);
 		dma[(*j)++] = MID_DT_WORD | (init << MID_DMA_COUNT_SHIFT) |
@@ -1096,8 +1122,10 @@ static enum enq_res do_tx(struct sk_buff *skb)
 	dma_size = 3; /* JK for descriptor and final fill, plus final size
 			 mis-alignment fix */
 	DPRINTK("iovcnt = %d\n", skb_shinfo(skb)->nr_frags);
-	if (!skb_shinfo(skb)->nr_frags) dma_size += 5;
-	else dma_size += 5*(skb_shinfo(skb)->nr_frags+1);
+	if (!skb_shinfo(skb)->nr_frags)
+		dma_size += 5;
+	else
+		dma_size += 5*(skb_shinfo(skb)->nr_frags+1);
 	if (dma_size > TX_DMA_BUF) {
 		printk(KERN_CRIT DEV_LABEL "(itf %d): needs %d DMA entries "
 		       "(got only %d)\n", vcc->dev->number, dma_size, TX_DMA_BUF);
@@ -1119,8 +1147,10 @@ static enum enq_res do_tx(struct sk_buff *skb)
 		MID_DT_JK;
 	j++;
 	if (!skb_shinfo(skb)->nr_frags)
-		if (aal5) put_dma(tx->index, eni_dev->dma, &j, paddr, skb->len);
-		else put_dma(tx->index, eni_dev->dma, &j, paddr+4, skb->len-4);
+		if (aal5)
+			put_dma(tx->index, eni_dev->dma, &j, paddr, skb->len);
+		else
+			put_dma(tx->index, eni_dev->dma, &j, paddr+4, skb->len-4);
 	else {
 		DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
 		for (i = -1; i < skb_shinfo(skb)->nr_frags; i++)
@@ -1189,11 +1219,13 @@ static void poll_tx(struct atm_dev *dev)
 		if (tx->send)
 			while ((skb = skb_dequeue(&tx->backlog))) {
 				res = do_tx(skb);
-				if (res == enq_ok) continue;
+				if (res == enq_ok)
+					continue;
 				DPRINTK("re-queuing TX PDU\n");
 				skb_queue_head(&tx->backlog, skb);
 				requeued++;
-				if (res == enq_jam) return;
+				if (res == enq_jam)
+					return;
 				break;
 			}
 	}
@@ -1225,8 +1257,10 @@ static void dequeue_tx(struct atm_dev *dev)
 		ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb);
 		pci_unmap_single(eni_dev->pci_dev, ENI_PRV_PADDR(skb), skb->len,
 				 PCI_DMA_TODEVICE);
-		if (vcc->pop) vcc->pop(vcc, skb);
-		else dev_kfree_skb_irq(skb);
+		if (vcc->pop)
+			vcc->pop(vcc, skb);
+		else
+			dev_kfree_skb_irq(skb);
 		atomic_inc(&vcc->stats->tx);
 		wake_up(&eni_dev->tx_wait);
 		dma_complete++;
@@ -1239,7 +1273,8 @@ static struct eni_tx *alloc_tx(struct eni_dev *eni_dev, int ubr)
 	int i;
 
 	for (i = !ubr; i < NR_CHAN; i++)
-		if (!eni_dev->tx[i].send) return eni_dev->tx+i;
+		if (!eni_dev->tx[i].send)
+			return eni_dev->tx+i;
 	return NULL;
 }
 
@@ -1250,30 +1285,36 @@ static int comp_tx(struct eni_dev *eni_dev, int *pcr, int reserved, int *pre,
 	static const int pre_div[] = { 4, 16, 128, 2048 };
 	/* 2^(((x+2)^2-(x+2))/2+1) */
 
-	if (unlimited) *pre = *res = 0;
+	if (unlimited)
+		*pre = *res = 0;
 	else {
 		if (*pcr > 0) {
 			int div;
 
 			for (*pre = 0; *pre < 3; (*pre)++)
-				if (TS_CLOCK/pre_div[*pre]/64 <= *pcr) break;
+				if (TS_CLOCK/pre_div[*pre]/64 <= *pcr)
+					break;
 			div = pre_div[*pre]**pcr;
 			DPRINTK("min div %d\n", div);
 			*res = TS_CLOCK/div-1;
-		}
-		else {
+		} else {
 			int div;
 
-			if (!*pcr) *pcr = eni_dev->tx_bw+reserved;
+			if (!*pcr)
+				*pcr = eni_dev->tx_bw+reserved;
 			for (*pre = 3; *pre >= 0; (*pre)--)
-				if (TS_CLOCK/pre_div[*pre]/64 > -*pcr) break;
-			if (*pre < 3) (*pre)++; /* else fail later */
+				if (TS_CLOCK/pre_div[*pre]/64 > -*pcr)
+					break;
+			if (*pre < 3)
+				(*pre)++; /* else fail later */
 			div = pre_div[*pre]*-*pcr;
 			DPRINTK("max div %d\n", div);
 			*res = DIV_ROUND_UP(TS_CLOCK, div)-1;
 		}
-		if (*res < 0) *res = 0;
-		if (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE;
+		if (*res < 0)
+			*res = 0;
+		if (*res > MID_SEG_MAX_RATE)
+			*res = MID_SEG_MAX_RATE;
 	}
 	*pcr = TS_CLOCK/pre_div[*pre]/(*res+1);
 	DPRINTK("out pcr: %d (%d:%d)\n", *pcr, *pre, *res);
@@ -1302,8 +1343,7 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 		if (size > MID_MAX_BUF_SIZE && txtp->max_sdu <=
 		    MID_MAX_BUF_SIZE)
 			size = MID_MAX_BUF_SIZE;
-	}
-	else {
+	} else {
 		if (eni_dev->ubr) {
 			eni_vcc->tx = eni_dev->ubr;
 			txtp->pcr = ATM_OC3_PCR;
@@ -1313,10 +1353,12 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 	}
 	new_tx = !eni_vcc->tx;
 	mem = NULL; /* for gcc */
-	if (!new_tx) tx = eni_vcc->tx;
+	if (!new_tx)
+		tx = eni_vcc->tx;
 	else {
 		mem = eni_alloc_mem(eni_dev, &size);
-		if (!mem) return -ENOBUFS;
+		if (!mem)
+			return -ENOBUFS;
 		tx = alloc_tx(eni_dev, unlimited);
 		if (!tx) {
 			eni_free_mem(eni_dev, mem, size);
@@ -1327,7 +1369,8 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 		tx->send = mem;
 		tx->words = size >> 2;
 		skb_queue_head_init(&tx->backlog);
-		for (order = 0; size > (1 << (order+10)); order++);
+		for (order = 0; size > (1 << (order+10)); order++)
+			;
 		eni_out((order << MID_SIZE_SHIFT) |
 			((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)),
 			MID_TX_PLACE(tx->index));
@@ -1335,9 +1378,11 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 			MID_DESCR_START;
 	}
 	error = comp_tx(eni_dev, &rate, tx->reserved, &pre, &res, unlimited);
-	if (!error  && txtp->min_pcr > rate) error = -EINVAL;
+	if (!error  && txtp->min_pcr > rate)
+		error = -EINVAL;
 	if (!error && txtp->max_pcr && txtp->max_pcr != ATM_MAX_PCR &&
-	    txtp->max_pcr < rate) error = -EINVAL;
+	    txtp->max_pcr < rate)
+		error = -EINVAL;
 	if (!error && !ubr && rate > eni_dev->tx_bw+tx->reserved)
 		error = -EINVAL;
 	if (!error && set_rsv && !set_shp && rate < tx->shaping)
@@ -1358,12 +1403,14 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 		eni_dev->tx_bw -= rate;
 	}
 	if (set_shp || (unlimited && new_tx)) {
-		if (unlimited && new_tx) eni_dev->ubr = tx;
+		if (unlimited && new_tx)
+			eni_dev->ubr = tx;
 		tx->prescaler = pre;
 		tx->resolution = res;
 		tx->shaping = rate;
 	}
-	if (set_shp) eni_vcc->tx = tx;
+	if (set_shp)
+		eni_vcc->tx = tx;
 	DPRINTK("rsv %d shp %d\n", tx->reserved, tx->shaping);
 	return 0;
 }
@@ -1372,7 +1419,8 @@ static int reserve_or_set_tx(struct atm_vcc *vcc, struct atm_trafprm *txtp,
 static int open_tx_first(struct atm_vcc *vcc)
 {
 	ENI_VCC(vcc)->tx = NULL;
-	if (vcc->qos.txtp.traffic_class == ATM_NONE) return 0;
+	if (vcc->qos.txtp.traffic_class == ATM_NONE)
+		return 0;
 	ENI_VCC(vcc)->txing = 0;
 	return reserve_or_set_tx(vcc, &vcc->qos.txtp, 1, 1);
 }
@@ -1391,7 +1439,8 @@ static void close_tx(struct atm_vcc *vcc)
 	struct eni_vcc *eni_vcc;
 
 	eni_vcc = ENI_VCC(vcc);
-	if (!eni_vcc->tx) return;
+	if (!eni_vcc->tx)
+		return;
 	eni_dev = ENI_DEV(vcc->dev);
 	/* wait for TX queue to drain */
 	DPRINTK("eni_close: waiting for TX ...\n");
@@ -1403,7 +1452,8 @@ static void close_tx(struct atm_vcc *vcc)
 		tasklet_disable(&eni_dev->task);
 		txing = skb_peek(&eni_vcc->tx->backlog) || eni_vcc->txing;
 		tasklet_enable(&eni_dev->task);
-		if (!txing) break;
+		if (!txing)
+			break;
 		DPRINTK("%d TX left\n", eni_vcc->txing);
 		schedule();
 		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -1460,7 +1510,8 @@ static void foo(void)
 	       "backlogged=%d,rx_enqueued=%d,rx_dequeued=%d,putting=%d,pushed=%d\n",
 	       tx_complete, dma_complete, queued, requeued, submitted, backlogged,
 	       rx_enqueued, rx_dequeued, putting, pushed);
-	if (eni_boards) printk(KERN_INFO "loss: %ld\n", ENI_DEV(eni_boards)->lost);
+	if (eni_boards)
+		printk(KERN_INFO "loss: %ld\n", ENI_DEV(eni_boards)->lost);
 }
 
 #endif
@@ -1634,7 +1685,8 @@ static int get_esi_asic(struct atm_dev *dev)
 		SET_SEPROM;
 		tonga |= SEPROM_DATA;
 		SET_SEPROM;
-		if (failed) error = -EIO;
+		if (failed)
+			error = -EIO;
 		else {
 			dev->esi[i] = 0;
 			for (j = 7; j >= 0; j--) {
@@ -1644,7 +1696,8 @@ static int get_esi_asic(struct atm_dev *dev)
 				tonga |= SEPROM_CLK;
 				SET_SEPROM;
 				GET_SEPROM;
-				if (tonga & SEPROM_DATA) dev->esi[i] |= 1;
+				if (tonga & SEPROM_DATA)
+					dev->esi[i] |= 1;
 				tonga &= ~SEPROM_CLK;
 				SET_SEPROM;
 				tonga |= SEPROM_DATA;
@@ -1656,7 +1709,8 @@ static int get_esi_asic(struct atm_dev *dev)
 			tonga |= SEPROM_CLK;
 			SET_SEPROM;
 			GET_SEPROM;
-			if (!(tonga & SEPROM_DATA)) error = -EIO;
+			if (!(tonga & SEPROM_DATA))
+				error = -EIO;
 			tonga &= ~SEPROM_CLK;
 			SET_SEPROM;
 			tonga |= SEPROM_DATA;
@@ -1689,7 +1743,8 @@ static int get_esi_fpga(struct atm_dev *dev, void __iomem *base)
 	int i;
 
 	mac_base = base+EPROM_SIZE-sizeof(struct midway_eprom);
-	for (i = 0; i < ESI_LEN; i++) dev->esi[i] = readb(mac_base+(i^3));
+	for (i = 0; i < ESI_LEN; i++)
+		dev->esi[i] = readb(mac_base+(i^3));
 	return 0;
 }
 
@@ -1747,15 +1802,19 @@ static int eni_do_init(struct atm_dev *dev)
 	last = MAP_MAX_SIZE-RAM_BASE;
 	for (i = last-RAM_INCREMENT; i >= 0; i -= RAM_INCREMENT) {
 		writel(0x55555555, eni_dev->ram+i);
-		if (readl(eni_dev->ram+i) != 0x55555555) last = i;
+		if (readl(eni_dev->ram+i) != 0x55555555)
+			last = i;
 		else {
 			writel(0xAAAAAAAA, eni_dev->ram+i);
-			if (readl(eni_dev->ram+i) != 0xAAAAAAAA) last = i;
-			else writel(i, eni_dev->ram+i);
+			if (readl(eni_dev->ram+i) != 0xAAAAAAAA)
+				last = i;
+			else
+				writel(i, eni_dev->ram+i);
 		}
 	}
 	for (i = 0; i < last; i += RAM_INCREMENT)
-		if (readl(eni_dev->ram+i) != i) break;
+		if (readl(eni_dev->ram+i) != i)
+			break;
 	eni_dev->mem = i;
 	memset_io(eni_dev->ram, 0, eni_dev->mem);
 	/* TODO: should shrink allocation now */
@@ -1864,11 +1923,14 @@ static int eni_start(struct atm_dev *dev)
 	 */
 	eni_out(0xffffffff, MID_IE);
 	error = start_tx(dev);
-	if (error) goto free_list;
+	if (error)
+		goto free_list;
 	error = start_rx(dev);
-	if (error) goto free_list;
+	if (error)
+		goto free_list;
 	error = dev->phy->start(dev);
-	if (error) goto free_list;
+	if (error)
+		goto free_list;
 	eni_out(eni_in(MID_MC_S) | (1 << MID_INT_SEL_SHIFT) |
 		MID_TX_LOCK_MODE | MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE,
 		MID_MC_S);
@@ -1890,7 +1952,8 @@ out:
 static void eni_close(struct atm_vcc *vcc)
 {
 	DPRINTK(">eni_close\n");
-	if (!ENI_VCC(vcc)) return;
+	if (!ENI_VCC(vcc))
+		return;
 	clear_bit(ATM_VF_READY, &vcc->flags);
 	close_rx(vcc);
 	close_tx(vcc);
@@ -1922,7 +1985,8 @@ static int eni_open(struct atm_vcc *vcc)
 		vcc->vci);
 	if (!test_bit(ATM_VF_PARTIAL, &vcc->flags)) {
 		eni_vcc = kmalloc(sizeof(struct eni_vcc), GFP_KERNEL);
-		if (!eni_vcc) return -ENOMEM;
+		if (!eni_vcc)
+			return -ENOMEM;
 		vcc->dev_data = eni_vcc;
 		eni_vcc->tx = NULL; /* for eni_close after open_rx */
 		if ((error = open_rx_first(vcc))) {
@@ -1934,7 +1998,8 @@ static int eni_open(struct atm_vcc *vcc)
 			return error;
 		}
 	}
-	if (vci == ATM_VPI_UNSPEC || vpi == ATM_VCI_UNSPEC) return 0;
+	if (vci == ATM_VPI_UNSPEC || vpi == ATM_VCI_UNSPEC)
+		return 0;
 	if ((error = open_rx_second(vcc))) {
 		eni_close(vcc);
 		return error;
@@ -1956,19 +2021,29 @@ static int eni_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flgs)
 	struct sk_buff *skb;
 	int error, rate, rsv, shp;
 
-	if (qos->txtp.traffic_class == ATM_NONE) return 0;
-	if (tx == eni_dev->ubr) return -EBADFD;
+	if (qos->txtp.traffic_class == ATM_NONE)
+		return 0;
+	if (tx == eni_dev->ubr)
+		return -EBADFD;
 	rate = atm_pcr_goal(&qos->txtp);
-	if (rate < 0) rate = -rate;
+	if (rate < 0)
+		rate = -rate;
 	rsv = shp = 0;
-	if ((flgs & ATM_MF_DEC_RSV) && rate && rate < tx->reserved) rsv = 1;
-	if ((flgs & ATM_MF_INC_RSV) && (!rate || rate > tx->reserved)) rsv = 1;
-	if ((flgs & ATM_MF_DEC_SHP) && rate && rate < tx->shaping) shp = 1;
-	if ((flgs & ATM_MF_INC_SHP) && (!rate || rate > tx->shaping)) shp = 1;
-	if (!rsv && !shp) return 0;
+	if ((flgs & ATM_MF_DEC_RSV) && rate && rate < tx->reserved)
+		rsv = 1;
+	if ((flgs & ATM_MF_INC_RSV) && (!rate || rate > tx->reserved))
+		rsv = 1;
+	if ((flgs & ATM_MF_DEC_SHP) && rate && rate < tx->shaping)
+		shp = 1;
+	if ((flgs & ATM_MF_INC_SHP) && (!rate || rate > tx->shaping))
+		shp = 1;
+	if (!rsv && !shp)
+		return 0;
 	error = reserve_or_set_tx(vcc, &qos->txtp, rsv, shp);
-	if (error) return error;
-	if (shp && !(flgs & ATM_MF_IMMED)) return 0;
+	if (error)
+		return error;
+	if (shp && !(flgs & ATM_MF_IMMED))
+		return 0;
 	/*
 	 * Walk through the send buffer and patch the rate information in all
 	 * segmentation buffer descriptors of this VCC.
@@ -1977,7 +2052,8 @@ static int eni_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flgs)
 	skb_queue_walk(&eni_dev->tx_queue, skb) {
 		void __iomem *dsc;
 
-		if (ATM_SKB(skb)->vcc != vcc) continue;
+		if (ATM_SKB(skb)->vcc != vcc)
+			continue;
 		dsc = tx->send+ENI_PRV_POS(skb)*4;
 		writel((readl(dsc) & ~(MID_SEG_RATE | MID_SEG_PR)) |
 		       (tx->prescaler << MID_SEG_PR_SHIFT) |
@@ -1993,7 +2069,8 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 	struct eni_dev *eni_dev = ENI_DEV(dev);
 
 	if (cmd == ENI_MEMDUMP) {
-		if (!capable(CAP_NET_ADMIN)) return -EPERM;
+		if (!capable(CAP_NET_ADMIN))
+			return -EPERM;
 		printk(KERN_WARNING "Please use /proc/atm/" DEV_LABEL ":%d "
 		       "instead of obsolete ioctl ENI_MEMDUMP\n", dev->number);
 		dump(dev);
@@ -2002,15 +2079,18 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 	if (cmd == ENI_SETMULT) {
 		struct eni_multipliers mult;
 
-		if (!capable(CAP_NET_ADMIN)) return -EPERM;
+		if (!capable(CAP_NET_ADMIN))
+			return -EPERM;
 		if (copy_from_user(&mult, arg,
 				   sizeof(struct eni_multipliers)))
 			return -EFAULT;
 		if ((mult.tx && mult.tx <= 100) || (mult.rx &&mult.rx <= 100) ||
 		    mult.tx > 65536 || mult.rx > 65536)
 			return -EINVAL;
-		if (mult.tx) eni_dev->tx_mult = mult.tx;
-		if (mult.rx) eni_dev->rx_mult = mult.rx;
+		if (mult.tx)
+			eni_dev->tx_mult = mult.tx;
+		if (mult.rx)
+			eni_dev->rx_mult = mult.rx;
 		return 0;
 	}
 	if (cmd == ATM_SETCIRANGE) {
@@ -2023,7 +2103,8 @@ static int eni_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 			return 0;
 		return -EINVAL;
 	}
-	if (!dev->phy->ioctl) return -ENOIOCTLCMD;
+	if (!dev->phy->ioctl)
+		return -ENOIOCTLCMD;
 	return dev->phy->ioctl(dev, cmd, arg);
 }
 
@@ -2048,19 +2129,24 @@ static int eni_send(struct atm_vcc *vcc, struct sk_buff *skb)
 
 	DPRINTK(">eni_send\n");
 	if (!ENI_VCC(vcc)->tx) {
-		if (vcc->pop) vcc->pop(vcc, skb);
-		else dev_kfree_skb(skb);
+		if (vcc->pop)
+			vcc->pop(vcc, skb);
+		else
+			dev_kfree_skb(skb);
 		return -EINVAL;
 	}
 	if (!skb) {
 		printk(KERN_CRIT "!skb in eni_send ?\n");
-		if (vcc->pop) vcc->pop(vcc, skb);
+		if (vcc->pop)
+			vcc->pop(vcc, skb);
 		return -EINVAL;
 	}
 	if (vcc->qos.aal == ATM_AAL0) {
 		if (skb->len != ATM_CELL_SIZE-1) {
-			if (vcc->pop) vcc->pop(vcc, skb);
-			else dev_kfree_skb(skb);
+			if (vcc->pop)
+				vcc->pop(vcc, skb);
+			else
+				dev_kfree_skb(skb);
 			return -EINVAL;
 		}
 		*(u32 *) skb->data = htonl(*(u32 *) skb->data);
@@ -2070,7 +2156,8 @@ static int eni_send(struct atm_vcc *vcc, struct sk_buff *skb)
 	tasklet_disable(&ENI_DEV(vcc->dev)->task);
 	res = do_tx(skb);
 	tasklet_enable(&ENI_DEV(vcc->dev)->task);
-	if (res == enq_ok) return 0;
+	if (res == enq_ok)
+		return 0;
 	skb_queue_tail(&ENI_VCC(vcc)->tx->backlog, skb);
 	backlogged++;
 	tasklet_schedule(&ENI_DEV(vcc->dev)->task);
@@ -2154,7 +2241,8 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 	for (i = 0; i < NR_CHAN; i++) {
 		struct eni_tx *tx = eni_dev->tx+i;
 
-		if (!tx->send) continue;
+		if (!tx->send)
+			continue;
 		if (!--left) {
 			return sprintf(page, "tx[%d]:	 0x%ld-0x%ld "
 				       "(%6ld bytes), rsv %d cps, shp %d cps%s\n", i,
@@ -2163,7 +2251,8 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 				       tx->reserved, tx->shaping,
 				       tx == eni_dev->ubr ? " (UBR)" : "");
 		}
-		if (--left) continue;
+		if (--left)
+			continue;
 		return sprintf(page, "%10sbacklog %u packets\n", "",
 			       skb_queue_len(&tx->backlog));
 	}
@@ -2179,7 +2268,8 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 			if (vcc->dev != dev)
 				continue;
 			eni_vcc = ENI_VCC(vcc);
-			if (--left) continue;
+			if (--left)
+				continue;
 			length = sprintf(page, "vcc %4d: ", vcc->vci);
 			if (eni_vcc->rx) {
 				length += sprintf(page+length, "0x%ld-0x%ld "
@@ -2187,7 +2277,8 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 						  (unsigned long) (eni_vcc->recv - eni_dev->ram),
 						  eni_vcc->recv-eni_dev->ram+eni_vcc->words*4-1,
 						  eni_vcc->words*4);
-				if (eni_vcc->tx) length += sprintf(page+length, ", ");
+				if (eni_vcc->tx)
+					length += sprintf(page+length, ", ");
 			}
 			if (eni_vcc->tx)
 				length += sprintf(page+length, "tx[%d], txing %d bytes",
@@ -2202,7 +2293,8 @@ static int eni_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 		struct eni_free *fe = eni_dev->free_list+i;
 		unsigned long offset;
 
-		if (--left) continue;
+		if (--left)
+			continue;
 		offset = (unsigned long) eni_dev->ram+eni_dev->base_diff;
 		return sprintf(page, "free	%p-%p (%6d bytes)\n",
 			       fe->start-offset, fe->start-offset+(1 << fe->order)-1,
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH 1/5] soreuseport: infrastructure
From: Tom Herbert @ 2013-01-20 23:33 UTC (permalink / raw)
  To: PJ Waskiewicz; +Cc: Eric Dumazet, Stephen Hemminger, netdev, davem, netdev
In-Reply-To: <20130116224734.GA28741@ppwaskie-mobl2.jf.intel.com>

> It would be pretty neat if the CPU layout could make it to this level, so
> that you could choose queues based on the shared cache layout.  e.g. if
> cores 0 and 2 shared the same L2 cache, then you can be intelligent about
> landing flows on those queues bound to those cores.  Essentially the info
> that feeds the cpuid utility being used to make even smarter decisions of
> flow tuning.
>
Indeed.  I think Ben's cpu_rmap code already pretty much does this...

> Cheers,
> -PJ

^ permalink raw reply

* Re: [PATCH 01/21] NTB: correct missing readq/writeq errors
From: Greg KH @ 2013-01-20 23:40 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-2-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:15AM -0700, Jon Mason wrote:
> Atomic readq and writeq do not exist by default on some 32bit
> architectures, thus causing compile errors due to non-existent symbols.
> In those cases, use the definitions of those symbols from
> include/asm-generic/io-64-nonatomic-hi-lo.h
> 
> Signed-off-by: Jon Mason <jon.mason@intel.com>
> ---
>  drivers/ntb/ntb_hw.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index 4c71b17..0b46fef 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -45,6 +45,7 @@
>   * Contact Information:
>   * Jon Mason <jon.mason@intel.com>
>   */
> +#include <asm-generic/io-64-nonatomic-hi-lo.h>

Really?  This seems really odd.  Usually we just don't build the code
for any platform that doesn't have readq/writeq.  Otherwise, shouldn't
those arches just include this file themselves to keep everything
working?  Individual drivers shouldn't have to do this.

So, I'm not going to take this one just yet, sorry.

greg k-h

^ permalink raw reply

* Re: [PATCH 07/21] NTB: zero PCI driver data
From: Greg KH @ 2013-01-20 23:41 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-8-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:21AM -0700, Jon Mason wrote:
> Zero pci_device_id driver_data variable.  Unused, but 'EXTRA_CFLAGS=-W'
> complained of uninitialized variables.
> 
> Signed-off-by: Jon Mason <jon.mason@intel.com>
> ---
>  drivers/ntb/ntb_hw.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index 0b46fef..867ccaa 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -83,14 +83,14 @@ enum {
>  #define MW_TO_BAR(mw)	(mw * 2 + 2)
>  
>  static DEFINE_PCI_DEVICE_TABLE(ntb_pci_tbl) = {
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_BWD)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_JSF)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_CLASSIC_JSF)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_RP_JSF)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_RP_SNB)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_SNB)},
> -	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_CLASSIC_SNB)},
> -	{0}
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_BWD),		0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_JSF),		0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_CLASSIC_JSF),	0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_RP_JSF),		0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_RP_SNB),		0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_SNB),		0},
> +	{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_CLASSIC_SNB),	0},
> +	{0, 0, 0, 0, 0, 0, 0}

Ick, why not just use PCI_DEVICE() instead?  Is it that hard to type out
the INTEL define?  That would, overall, look nicer than the 0, 0, 0...
line at the end, which is horrible (and not needed, { } is the same
thing.)

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 08/21] NTB: declare unused variables
From: Greg KH @ 2013-01-20 23:42 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-9-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:22AM -0700, Jon Mason wrote:
> Tag pci_device_id in ntb_pci_probe as unused function parameters.  This
> corrects issues found by 'EXTRA_CFLAGS=-W'.

Why would you build the kernel with that option?  This isn't needed, so
I'm not going to apply it.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 14/21] NTB: Fix Sparse Warnings
From: Greg KH @ 2013-01-20 23:45 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-15-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:28AM -0700, Jon Mason wrote:
> Address the sparse warnings and resulting fallout
> 
> Signed-off-by: Jon Mason <jon.mason@intel.com>
> ---
>  drivers/ntb/ntb_hw.c        |    7 ++++---
>  drivers/ntb/ntb_hw.h        |    4 ++--
>  drivers/ntb/ntb_transport.c |   32 ++++++++++++++++----------------
>  3 files changed, 22 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index 18cb5dc..b792ccd 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -104,8 +104,9 @@ MODULE_DEVICE_TABLE(pci, ntb_pci_tbl);
>   *
>   * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
>   */
> -int ntb_register_event_callback(struct ntb_device *ndev,
> -				void (*func)(void *handle, unsigned int event))
> +int
> +ntb_register_event_callback(struct ntb_device *ndev,
> +			    void (*func)(void *handle, enum ntb_hw_event event))

What is sparse complaining about here that moving the function name to
the start of the line fixes?  That shouldn't be necessary at all.  Ah,
the enum?  If so, why change the first line at all?

>  {
>  	if (ndev->event_cb)
>  		return -EINVAL;
> @@ -344,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
>   *
>   * RETURNS: pointer to virtual address, or NULL on error.
>   */
> -void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
> +void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)

That makes sense to fix.

>  {
>  	if (mw > NTB_NUM_MW)
>  		return NULL;
> diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
> index 5e00951..3a3038c 100644
> --- a/drivers/ntb/ntb_hw.h
> +++ b/drivers/ntb/ntb_hw.h
> @@ -165,14 +165,14 @@ int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
>  void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx);
>  int ntb_register_event_callback(struct ntb_device *ndev,
>  				void (*event_cb_func) (void *handle,
> -						       unsigned int event));
> +						      enum ntb_hw_event event));
>  void ntb_unregister_event_callback(struct ntb_device *ndev);
>  int ntb_get_max_spads(struct ntb_device *ndev);
>  int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
>  int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
>  int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
>  int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
> -void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
> +void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
>  resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw);
>  void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx);
>  void *ntb_find_transport(struct pci_dev *pdev);
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index b3afb24..e0bdfd7 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -58,7 +58,7 @@
>  #include <linux/ntb.h>
>  #include "ntb_hw.h"
>  
> -#define NTB_TRANSPORT_VERSION	1
> +#define NTB_TRANSPORT_VERSION	2

How is this a sparse fix?

>  static unsigned int transport_mtu = 0x401E;
>  module_param(transport_mtu, uint, 0644);
> @@ -91,14 +91,14 @@ struct ntb_transport_qp {
>  	bool qp_link;
>  	u8 qp_num;	/* Only 64 QP's are allowed.  0-63 */
>  
> -	struct ntb_rx_info *rx_info;
> +	struct ntb_rx_info __iomem *rx_info;
>  	struct ntb_rx_info *remote_rx_info;
>  
>  	void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
>  			    void *data, int len);
>  	struct list_head tx_free_q;
>  	spinlock_t ntb_tx_free_q_lock;
> -	void *tx_mw;
> +	void __iomem *tx_mw;
>  	unsigned int tx_index;
>  	unsigned int tx_max_entry;
>  	unsigned int tx_max_frame;
> @@ -166,7 +166,7 @@ enum {
>  };
>  
>  struct ntb_payload_header {
> -	u64 ver;
> +	unsigned int ver;

why does sparse care about this?

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 15/21] NTB: Update Version
From: Greg KH @ 2013-01-20 23:47 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-16-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:29AM -0700, Jon Mason wrote:
> Update NTB version to 0.25
> 
> Signed-off-by: Jon Mason <jon.mason@intel.com>
> ---
>  drivers/ntb/ntb_hw.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index b792ccd..df86882 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -56,7 +56,7 @@
>  #include "ntb_regs.h"
>  
>  #define NTB_NAME	"Intel(R) PCI-E Non-Transparent Bridge Driver"
> -#define NTB_VER		"0.24"
> +#define NTB_VER		"0.25"

I'm not objecting to this, but in the end, does it really matter?  Why
not just stick with whatever kernel version you are using?  Keeping this
up to date is going to be hard over the long haul, right?

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 19/21] ntb_netdev: declare unused variables and fix missing initializer
From: Greg KH @ 2013-01-20 23:47 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-20-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:33AM -0700, Jon Mason wrote:
> Tag qp in ntb_netdev_tx_handler and net_device in ntb_get_settings as
> unused function parameters.  Also, correct missing initializer errors
> for 'struct device_driver' in ntb_netdev_client.  This corrects issues
> found by 'EXTRA_CFLAGS=-W'.

Again, why would you want to ever build the kernel with that option?
This shouldn't be needed.

greg k-h

^ permalink raw reply

* Re: [PATCH 0/21] NTB and ntb_netdev patches
From: Greg KH @ 2013-01-20 23:48 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, netdev, Dave Jiang, Nicholas Bellinger
In-Reply-To: <1358586155-23322-1-git-send-email-jon.mason@intel.com>

On Sat, Jan 19, 2013 at 02:02:14AM -0700, Jon Mason wrote:
> Please apply these patches to Greg KH's char-misc-next tree.

I've applied most of them, other than the ones I've commented on.

thanks,

greg k-h

^ permalink raw reply

* [PATCH 3/5 v2] soreuseport: UDP/IPv4 implementation
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

[-- Attachment #1: Type: TEXT/PLAIN, Size: 6197 bytes --]

Allow multiple UDP sockets to bind to the same port.

Motivation soreuseport would be something like a DNS server.  An
alternative would be to recv on the same socket from multiple threads.
As in the case of TCP, the load across these threads tends to be
disproportionate and we also see a lot of contection on the socketlock.
Note that SO_REUSEADDR already allows multiple UDP sockets to bind to
the same port, however there is no provision to prevent hijacking and
nothing to distribute packets across all the sockets sharing the same
bound port.  This patch does not change the semantics of SO_REUSEADDR,
but provides usable functionality of it for unicast.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/udp.c |   61 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 79c8dbe..b360b30 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -139,6 +139,7 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
 {
 	struct sock *sk2;
 	struct hlist_nulls_node *node;
+	kuid_t uid = sock_i_uid(sk);
 
 	sk_nulls_for_each(sk2, node, &hslot->head)
 		if (net_eq(sock_net(sk2), net) &&
@@ -147,6 +148,8 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
 		    (!sk2->sk_reuse || !sk->sk_reuse) &&
 		    (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if ||
 		     sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
+		    (!sk2->sk_reuseport || !sk->sk_reuseport ||
+		      !uid_eq(uid, sock_i_uid(sk2))) &&
 		    (*saddr_comp)(sk, sk2)) {
 			if (bitmap)
 				__set_bit(udp_sk(sk2)->udp_port_hash >> log,
@@ -169,6 +172,7 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
 {
 	struct sock *sk2;
 	struct hlist_nulls_node *node;
+	kuid_t uid = sock_i_uid(sk);
 	int res = 0;
 
 	spin_lock(&hslot2->lock);
@@ -179,6 +183,8 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
 		    (!sk2->sk_reuse || !sk->sk_reuse) &&
 		    (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if ||
 		     sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
+		    (!sk2->sk_reuseport || !sk->sk_reuseport ||
+		      !uid_eq(uid, sock_i_uid(sk2))) &&
 		    (*saddr_comp)(sk, sk2)) {
 			res = 1;
 			break;
@@ -337,26 +343,26 @@ static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr,
 			!ipv6_only_sock(sk)) {
 		struct inet_sock *inet = inet_sk(sk);
 
-		score = (sk->sk_family == PF_INET ? 1 : 0);
+		score = (sk->sk_family == PF_INET ? 2 : 1);
 		if (inet->inet_rcv_saddr) {
 			if (inet->inet_rcv_saddr != daddr)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (inet->inet_daddr) {
 			if (inet->inet_daddr != saddr)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (inet->inet_dport) {
 			if (inet->inet_dport != sport)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (sk->sk_bound_dev_if) {
 			if (sk->sk_bound_dev_if != dif)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 	}
 	return score;
@@ -365,7 +371,6 @@ static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr,
 /*
  * In this second variant, we check (daddr, dport) matches (inet_rcv_sadd, inet_num)
  */
-#define SCORE2_MAX (1 + 2 + 2 + 2)
 static inline int compute_score2(struct sock *sk, struct net *net,
 				 __be32 saddr, __be16 sport,
 				 __be32 daddr, unsigned int hnum, int dif)
@@ -380,21 +385,21 @@ static inline int compute_score2(struct sock *sk, struct net *net,
 		if (inet->inet_num != hnum)
 			return -1;
 
-		score = (sk->sk_family == PF_INET ? 1 : 0);
+		score = (sk->sk_family == PF_INET ? 2 : 1);
 		if (inet->inet_daddr) {
 			if (inet->inet_daddr != saddr)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (inet->inet_dport) {
 			if (inet->inet_dport != sport)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (sk->sk_bound_dev_if) {
 			if (sk->sk_bound_dev_if != dif)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 	}
 	return score;
@@ -409,19 +414,29 @@ static struct sock *udp4_lib_lookup2(struct net *net,
 {
 	struct sock *sk, *result;
 	struct hlist_nulls_node *node;
-	int score, badness;
+	int score, badness, matches = 0, reuseport = 0;
+	u32 hash = 0;
 
 begin:
 	result = NULL;
-	badness = -1;
+	badness = 0;
 	udp_portaddr_for_each_entry_rcu(sk, node, &hslot2->head) {
 		score = compute_score2(sk, net, saddr, sport,
 				      daddr, hnum, dif);
 		if (score > badness) {
 			result = sk;
 			badness = score;
-			if (score == SCORE2_MAX)
-				goto exact_match;
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				hash = inet_ehashfn(net, daddr, hnum,
+						    saddr, htons(sport));
+				matches = 1;
+			}
+		} else if (score == badness && reuseport) {
+			matches++;
+			if (((u64)hash * matches) >> 32 == 0)
+				result = sk;
+			hash = next_pseudo_random32(hash);
 		}
 	}
 	/*
@@ -431,9 +446,7 @@ begin:
 	 */
 	if (get_nulls_value(node) != slot2)
 		goto begin;
-
 	if (result) {
-exact_match:
 		if (unlikely(!atomic_inc_not_zero_hint(&result->sk_refcnt, 2)))
 			result = NULL;
 		else if (unlikely(compute_score2(result, net, saddr, sport,
@@ -457,7 +470,8 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
 	unsigned short hnum = ntohs(dport);
 	unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask);
 	struct udp_hslot *hslot2, *hslot = &udptable->hash[slot];
-	int score, badness;
+	int score, badness, matches = 0, reuseport = 0;
+	u32 hash = 0;
 
 	rcu_read_lock();
 	if (hslot->count > 10) {
@@ -486,13 +500,24 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
 	}
 begin:
 	result = NULL;
-	badness = -1;
+	badness = 0;
 	sk_nulls_for_each_rcu(sk, node, &hslot->head) {
 		score = compute_score(sk, net, saddr, hnum, sport,
 				      daddr, dport, dif);
 		if (score > badness) {
 			result = sk;
 			badness = score;
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				hash = inet_ehashfn(net, daddr, hnum,
+						    saddr, htons(sport));
+				matches = 1;
+			}
+		} else if (score == badness && reuseport) {
+			matches++;
+			if (((u64)hash * matches) >> 32 == 0)
+				result = sk;
+			hash = next_pseudo_random32(hash);
 		}
 	}
 	/*
-- 
1.7.7.3

^ permalink raw reply related

* [PATCH 5/5 v2] soreuseport: UDP/IPv6 implementation
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2642 bytes --]

Motivation for soreuseport would be something like a DNS server.  An
alternative would be to recv on the same socket from multiple threads.
As in the case of TCP, the load across these threads tends to be
disproportionate and we also see a lot of contection on the socket lock.
Note that SO_REUSEADDR already allows multiple UDP sockets to bind to
the same port, however there is no provision to prevent hijacking and
nothing to distribute packets across all the sockets sharing the same
bound port.  This patch does not change the semantics of SO_REUSEADDR,
but provides usable functionality of it for unicast.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv6/udp.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 1afb635..cb5bf49 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -45,6 +45,7 @@
 #include <net/tcp_states.h>
 #include <net/ip6_checksum.h>
 #include <net/xfrm.h>
+#include <net/inet6_hashtables.h>
 
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
@@ -203,7 +204,8 @@ static struct sock *udp6_lib_lookup2(struct net *net,
 {
 	struct sock *sk, *result;
 	struct hlist_nulls_node *node;
-	int score, badness;
+	int score, badness, matches = 0, reuseport = 0;
+	u32 hash = 0;
 
 begin:
 	result = NULL;
@@ -214,8 +216,18 @@ begin:
 		if (score > badness) {
 			result = sk;
 			badness = score;
-			if (score == SCORE2_MAX)
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				hash = inet6_ehashfn(net, daddr, hnum,
+						     saddr, sport);
+				matches = 1;
+			} else if (score == SCORE2_MAX)
 				goto exact_match;
+		} else if (score == badness && reuseport) {
+			matches++;
+			if (((u64)hash * matches) >> 32 == 0)
+				result = sk;
+			hash = next_pseudo_random32(hash);
 		}
 	}
 	/*
@@ -249,7 +261,8 @@ struct sock *__udp6_lib_lookup(struct net *net,
 	unsigned short hnum = ntohs(dport);
 	unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask);
 	struct udp_hslot *hslot2, *hslot = &udptable->hash[slot];
-	int score, badness;
+	int score, badness, matches = 0, reuseport = 0;
+	u32 hash = 0;
 
 	rcu_read_lock();
 	if (hslot->count > 10) {
@@ -284,6 +297,17 @@ begin:
 		if (score > badness) {
 			result = sk;
 			badness = score;
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				hash = inet6_ehashfn(net, daddr, hnum,
+						     saddr, sport);
+				matches = 1;
+			}
+		} else if (score == badness && reuseport) {
+			matches++;
+			if (((u64)hash * matches) >> 32 == 0)
+				result = sk;
+			hash = next_pseudo_random32(hash);
 		}
 	}
 	/*
-- 
1.7.7.3

^ permalink raw reply related

* [PATCH 2/5 v2] soreuseport: TCP/IPv4 implementation
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

Allow multiple listener sockets to bind to the same port.

Motivation for soresuseport would be something like a web server
binding to port 80 running with multiple threads, where each thread
might have it's own listener socket.  This could be done as an
alternative to other models: 1) have one listener thread which
dispatches completed connections to workers. 2) accept on a single
listener socket from multiple threads.  In case #1 the listener thread
can easily become the bottleneck with high connection turn-over rate.
In case #2, the proportion of connections accepted per thread tends
to be uneven under high connection load (assuming simple event loop:
while (1) { accept(); process() }, wakeup does not promote fairness
among the sockets.  We have seen the  disproportion to be as high
as 3:1 ratio between thread accepting most connections and the one
accepting the fewest.  With so_reusport the distribution is
uniform.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 include/net/inet_hashtables.h          |   13 ++++++--
 include/net/netfilter/nf_tproxy_core.h |    1 +
 net/ipv4/inet_connection_sock.c        |   48 ++++++++++++++++++++++++-------
 net/ipv4/inet_hashtables.c             |   28 ++++++++++++++----
 net/ipv4/tcp_ipv4.c                    |    4 ++-
 5 files changed, 73 insertions(+), 21 deletions(-)

diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 67a8fa0..7b2ae9d 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -81,7 +81,9 @@ struct inet_bind_bucket {
 	struct net		*ib_net;
 #endif
 	unsigned short		port;
-	signed short		fastreuse;
+	signed char		fastreuse;
+	signed char		fastreuseport;
+	kuid_t			fastuid;
 	int			num_owners;
 	struct hlist_node	node;
 	struct hlist_head	owners;
@@ -257,15 +259,19 @@ extern void inet_unhash(struct sock *sk);
 
 extern struct sock *__inet_lookup_listener(struct net *net,
 					   struct inet_hashinfo *hashinfo,
+					   const __be32 saddr,
+					   const __be16 sport,
 					   const __be32 daddr,
 					   const unsigned short hnum,
 					   const int dif);
 
 static inline struct sock *inet_lookup_listener(struct net *net,
 		struct inet_hashinfo *hashinfo,
+		__be32 saddr, __be16 sport,
 		__be32 daddr, __be16 dport, int dif)
 {
-	return __inet_lookup_listener(net, hashinfo, daddr, ntohs(dport), dif);
+	return __inet_lookup_listener(net, hashinfo, saddr, sport,
+				      daddr, ntohs(dport), dif);
 }
 
 /* Socket demux engine toys. */
@@ -358,7 +364,8 @@ static inline struct sock *__inet_lookup(struct net *net,
 	struct sock *sk = __inet_lookup_established(net, hashinfo,
 				saddr, sport, daddr, hnum, dif);
 
-	return sk ? : __inet_lookup_listener(net, hashinfo, daddr, hnum, dif);
+	return sk ? : __inet_lookup_listener(net, hashinfo, saddr, sport,
+					     daddr, hnum, dif);
 }
 
 static inline struct sock *inet_lookup(struct net *net,
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index 75ca929..1937964 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -82,6 +82,7 @@ nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
 			break;
 		case NFT_LOOKUP_LISTENER:
 			sk = inet_lookup_listener(net, &tcp_hashinfo,
+						    saddr, sport,
 						    daddr, dport,
 						    in->ifindex);
 
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index d0670f0..8bb623d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -59,6 +59,8 @@ int inet_csk_bind_conflict(const struct sock *sk,
 	struct sock *sk2;
 	struct hlist_node *node;
 	int reuse = sk->sk_reuse;
+	int reuseport = sk->sk_reuseport;
+	kuid_t uid = sock_i_uid((struct sock *)sk);
 
 	/*
 	 * Unlike other sk lookup places we do not check
@@ -73,8 +75,11 @@ int inet_csk_bind_conflict(const struct sock *sk,
 		    (!sk->sk_bound_dev_if ||
 		     !sk2->sk_bound_dev_if ||
 		     sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
-			if (!reuse || !sk2->sk_reuse ||
-			    sk2->sk_state == TCP_LISTEN) {
+			if ((!reuse || !sk2->sk_reuse ||
+			    sk2->sk_state == TCP_LISTEN) &&
+			    (!reuseport || !sk2->sk_reuseport ||
+			    (sk2->sk_state != TCP_TIME_WAIT &&
+			     !uid_eq(uid, sock_i_uid(sk2))))) {
 				const __be32 sk2_rcv_saddr = sk_rcv_saddr(sk2);
 				if (!sk2_rcv_saddr || !sk_rcv_saddr(sk) ||
 				    sk2_rcv_saddr == sk_rcv_saddr(sk))
@@ -106,6 +111,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
 	int ret, attempts = 5;
 	struct net *net = sock_net(sk);
 	int smallest_size = -1, smallest_rover;
+	kuid_t uid = sock_i_uid(sk);
 
 	local_bh_disable();
 	if (!snum) {
@@ -125,9 +131,12 @@ again:
 			spin_lock(&head->lock);
 			inet_bind_bucket_for_each(tb, node, &head->chain)
 				if (net_eq(ib_net(tb), net) && tb->port == rover) {
-					if (tb->fastreuse > 0 &&
-					    sk->sk_reuse &&
-					    sk->sk_state != TCP_LISTEN &&
+					if (((tb->fastreuse > 0 &&
+					      sk->sk_reuse &&
+					      sk->sk_state != TCP_LISTEN) ||
+					     (tb->fastreuseport > 0 &&
+					      sk->sk_reuseport &&
+					      uid_eq(tb->fastuid, uid))) &&
 					    (tb->num_owners < smallest_size || smallest_size == -1)) {
 						smallest_size = tb->num_owners;
 						smallest_rover = rover;
@@ -185,14 +194,17 @@ tb_found:
 		if (sk->sk_reuse == SK_FORCE_REUSE)
 			goto success;
 
-		if (tb->fastreuse > 0 &&
-		    sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
+		if (((tb->fastreuse > 0 &&
+		      sk->sk_reuse && sk->sk_state != TCP_LISTEN) ||
+		     (tb->fastreuseport > 0 &&
+		      sk->sk_reuseport && uid_eq(tb->fastuid, uid))) &&
 		    smallest_size == -1) {
 			goto success;
 		} else {
 			ret = 1;
 			if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, true)) {
-				if (sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
+				if (((sk->sk_reuse && sk->sk_state != TCP_LISTEN) ||
+				     (sk->sk_reuseport && uid_eq(tb->fastuid, uid))) &&
 				    smallest_size != -1 && --attempts >= 0) {
 					spin_unlock(&head->lock);
 					goto again;
@@ -212,9 +224,23 @@ tb_not_found:
 			tb->fastreuse = 1;
 		else
 			tb->fastreuse = 0;
-	} else if (tb->fastreuse &&
-		   (!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
-		tb->fastreuse = 0;
+		if (sk->sk_reuseport) {
+			tb->fastreuseport = 1;
+			tb->fastuid = uid;
+		} else {
+			tb->fastreuseport = 0;
+			tb->fastuid = 0;
+		}
+	} else {
+		if (tb->fastreuse &&
+		    (!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
+			tb->fastreuse = 0;
+		if (tb->fastreuseport &&
+		    (!sk->sk_reuseport || !uid_eq(tb->fastuid, uid))) {
+			tb->fastreuseport = 0;
+			tb->fastuid = 0;
+		}
+	}
 success:
 	if (!inet_csk(sk)->icsk_bind_hash)
 		inet_bind_hash(sk, tb, snum);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index fa3ae81..0ce0595 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -39,6 +39,7 @@ struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep,
 		write_pnet(&tb->ib_net, hold_net(net));
 		tb->port      = snum;
 		tb->fastreuse = 0;
+		tb->fastreuseport = 0;
 		tb->num_owners = 0;
 		INIT_HLIST_HEAD(&tb->owners);
 		hlist_add_head(&tb->node, &head->chain);
@@ -151,16 +152,16 @@ static inline int compute_score(struct sock *sk, struct net *net,
 	if (net_eq(sock_net(sk), net) && inet->inet_num == hnum &&
 			!ipv6_only_sock(sk)) {
 		__be32 rcv_saddr = inet->inet_rcv_saddr;
-		score = sk->sk_family == PF_INET ? 1 : 0;
+		score = sk->sk_family == PF_INET ? 2 : 1;
 		if (rcv_saddr) {
 			if (rcv_saddr != daddr)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 		if (sk->sk_bound_dev_if) {
 			if (sk->sk_bound_dev_if != dif)
 				return -1;
-			score += 2;
+			score += 4;
 		}
 	}
 	return score;
@@ -176,6 +177,7 @@ static inline int compute_score(struct sock *sk, struct net *net,
 
 struct sock *__inet_lookup_listener(struct net *net,
 				    struct inet_hashinfo *hashinfo,
+				    const __be32 saddr, __be16 sport,
 				    const __be32 daddr, const unsigned short hnum,
 				    const int dif)
 {
@@ -183,17 +185,29 @@ struct sock *__inet_lookup_listener(struct net *net,
 	struct hlist_nulls_node *node;
 	unsigned int hash = inet_lhashfn(net, hnum);
 	struct inet_listen_hashbucket *ilb = &hashinfo->listening_hash[hash];
-	int score, hiscore;
+	int score, hiscore, matches = 0, reuseport = 0;
+	u32 phash = 0;
 
 	rcu_read_lock();
 begin:
 	result = NULL;
-	hiscore = -1;
+	hiscore = 0;
 	sk_nulls_for_each_rcu(sk, node, &ilb->head) {
 		score = compute_score(sk, net, hnum, daddr, dif);
 		if (score > hiscore) {
 			result = sk;
 			hiscore = score;
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				phash = inet_ehashfn(net, daddr, hnum,
+						     saddr, sport);
+				matches = 1;
+			}
+		} else if (score == hiscore && reuseport) {
+			matches++;
+			if (((u64)phash * matches) >> 32 == 0)
+				result = sk;
+			phash = next_pseudo_random32(phash);
 		}
 	}
 	/*
@@ -501,7 +515,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
 			inet_bind_bucket_for_each(tb, node, &head->chain) {
 				if (net_eq(ib_net(tb), net) &&
 				    tb->port == port) {
-					if (tb->fastreuse >= 0)
+					if (tb->fastreuse >= 0 ||
+					    tb->fastreuseport >= 0)
 						goto next_port;
 					WARN_ON(hlist_empty(&tb->owners));
 					if (!check_established(death_row, sk,
@@ -518,6 +533,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
 				break;
 			}
 			tb->fastreuse = -1;
+			tb->fastreuseport = -1;
 			goto ok;
 
 		next_port:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c6ce9ca..bbbdcc5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -657,7 +657,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
 		 * no RST generated if md5 hash doesn't match.
 		 */
 		sk1 = __inet_lookup_listener(dev_net(skb_dst(skb)->dev),
-					     &tcp_hashinfo, ip_hdr(skb)->daddr,
+					     &tcp_hashinfo, ip_hdr(skb)->saddr,
+					     th->source, ip_hdr(skb)->daddr,
 					     ntohs(th->source), inet_iif(skb));
 		/* don't send rst if it can't find key */
 		if (!sk1)
@@ -2074,6 +2075,7 @@ do_time_wait:
 	case TCP_TW_SYN: {
 		struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev),
 							&tcp_hashinfo,
+							iph->saddr, th->source,
 							iph->daddr, th->dest,
 							inet_iif(skb));
 		if (sk2) {
-- 
1.7.7.3

^ permalink raw reply related

* [PATCH 4/5 v2] soreuseport: TCP/IPv6 implementation
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

Motivation for soreuseport would be something like a web server
binding to port 80 running with multiple threads, where each thread
might have it's own listener socket.  This could be done as an
alternative to other models: 1) have one listener thread which
dispatches completed connections to workers. 2) accept on a single
listener socket from multiple threads.  In case #1 the listener thread
can easily become the bottleneck with high connection turn-over rate.
In case #2, the proportion of connections accepted per thread tends
to be uneven under high connection load (assuming simple event loop:
while (1) { accept(); process() }, wakeup does not promote fairness
among the sockets.  We have seen the  disproportion to be as high
as 3:1 ratio between thread accepting most connections and the one
accepting the fewest.  With so_reusport the distribution is
uniform.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 include/net/inet6_hashtables.h         |    5 ++++-
 include/net/netfilter/nf_tproxy_core.h |    1 +
 net/ipv6/inet6_connection_sock.c       |   19 ++++++++++++++-----
 net/ipv6/inet6_hashtables.c            |   19 ++++++++++++++++---
 net/ipv6/tcp_ipv6.c                    |    4 +++-
 5 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 9e34c87..7ca75cb 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -71,6 +71,8 @@ extern struct sock *__inet6_lookup_established(struct net *net,
 
 extern struct sock *inet6_lookup_listener(struct net *net,
 					  struct inet_hashinfo *hashinfo,
+					  const struct in6_addr *saddr,
+					  const __be16 sport,
 					  const struct in6_addr *daddr,
 					  const unsigned short hnum,
 					  const int dif);
@@ -88,7 +90,8 @@ static inline struct sock *__inet6_lookup(struct net *net,
 	if (sk)
 		return sk;
 
-	return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
+	return inet6_lookup_listener(net, hashinfo, saddr, sport,
+				     daddr, hnum, dif);
 }
 
 static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index 1937964..36d9379 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -152,6 +152,7 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
 			break;
 		case NFT_LOOKUP_LISTENER:
 			sk = inet6_lookup_listener(net, &tcp_hashinfo,
+						   saddr, sport,
 						   daddr, ntohs(dport),
 						   in->ifindex);
 
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 3064785..e4297a3 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -32,6 +32,9 @@ int inet6_csk_bind_conflict(const struct sock *sk,
 {
 	const struct sock *sk2;
 	const struct hlist_node *node;
+	int reuse = sk->sk_reuse;
+	int reuseport = sk->sk_reuseport;
+	int uid = sock_i_uid((struct sock *)sk);
 
 	/* We must walk the whole port owner list in this case. -DaveM */
 	/*
@@ -42,11 +45,17 @@ int inet6_csk_bind_conflict(const struct sock *sk,
 		if (sk != sk2 &&
 		    (!sk->sk_bound_dev_if ||
 		     !sk2->sk_bound_dev_if ||
-		     sk->sk_bound_dev_if == sk2->sk_bound_dev_if) &&
-		    (!sk->sk_reuse || !sk2->sk_reuse ||
-		     sk2->sk_state == TCP_LISTEN) &&
-		     ipv6_rcv_saddr_equal(sk, sk2))
-			break;
+		     sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
+			if ((!reuse || !sk2->sk_reuse ||
+			     sk2->sk_state == TCP_LISTEN) &&
+			    (!reuseport || !sk2->sk_reuseport ||
+			     (sk2->sk_state != TCP_TIME_WAIT &&
+			      !uid_eq(uid,
+				      sock_i_uid((struct sock *)sk2))))) {
+				if (ipv6_rcv_saddr_equal(sk, sk2))
+					break;
+			}
+		}
 	}
 
 	return node != NULL;
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index dea17fd..32b4a16 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -158,25 +158,38 @@ static inline int compute_score(struct sock *sk, struct net *net,
 }
 
 struct sock *inet6_lookup_listener(struct net *net,
-		struct inet_hashinfo *hashinfo, const struct in6_addr *daddr,
+		struct inet_hashinfo *hashinfo, const struct in6_addr *saddr,
+		const __be16 sport, const struct in6_addr *daddr,
 		const unsigned short hnum, const int dif)
 {
 	struct sock *sk;
 	const struct hlist_nulls_node *node;
 	struct sock *result;
-	int score, hiscore;
+	int score, hiscore, matches = 0, reuseport = 0;
+	u32 phash = 0;
 	unsigned int hash = inet_lhashfn(net, hnum);
 	struct inet_listen_hashbucket *ilb = &hashinfo->listening_hash[hash];
 
 	rcu_read_lock();
 begin:
 	result = NULL;
-	hiscore = -1;
+	hiscore = 0;
 	sk_nulls_for_each(sk, node, &ilb->head) {
 		score = compute_score(sk, net, hnum, daddr, dif);
 		if (score > hiscore) {
 			hiscore = score;
 			result = sk;
+			reuseport = sk->sk_reuseport;
+			if (reuseport) {
+				phash = inet6_ehashfn(net, daddr, hnum,
+						      saddr, sport);
+				matches = 1;
+			}
+		} else if (score == hiscore && reuseport) {
+			matches++;
+			if (((u64)phash * matches) >> 32 == 0)
+				result = sk;
+			phash = next_pseudo_random32(phash);
 		}
 	}
 	/*
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3701c3c..06087e5 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -834,7 +834,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 		 * no RST generated if md5 hash doesn't match.
 		 */
 		sk1 = inet6_lookup_listener(dev_net(skb_dst(skb)->dev),
-					   &tcp_hashinfo, &ipv6h->daddr,
+					   &tcp_hashinfo, &ipv6h->saddr,
+					   th->source, &ipv6h->daddr,
 					   ntohs(th->source), inet6_iif(skb));
 		if (!sk1)
 			return;
@@ -1598,6 +1599,7 @@ do_time_wait:
 		struct sock *sk2;
 
 		sk2 = inet6_lookup_listener(dev_net(skb->dev), &tcp_hashinfo,
+					    &ipv6_hdr(skb)->saddr, th->source,
 					    &ipv6_hdr(skb)->daddr,
 					    ntohs(th->dest), inet6_iif(skb));
 		if (sk2 != NULL) {
-- 
1.7.7.3

^ permalink raw reply related

* [PATCH 1/5 v2] soreuseport: infrastructure
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

Definitions and macros for implementing soreusport.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 include/linux/random.h            |    6 ++++++
 include/net/sock.h                |    5 ++++-
 include/uapi/asm-generic/socket.h |    3 +--
 net/core/sock.c                   |    7 +++++++
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/include/linux/random.h b/include/linux/random.h
index d984608..347ce55 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -74,4 +74,10 @@ static inline int arch_get_random_int(unsigned int *v)
 }
 #endif
 
+/* Pseudo random number generator from numerical recipes. */
+static inline u32 next_pseudo_random32(u32 seed)
+{
+	return seed * 1664525 + 1013904223;
+}
+
 #endif /* _LINUX_RANDOM_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index 5a34e2f..581dc6b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -140,6 +140,7 @@ typedef __u64 __bitwise __addrpair;
  *	@skc_family: network address family
  *	@skc_state: Connection state
  *	@skc_reuse: %SO_REUSEADDR setting
+ *	@skc_reuseport: %SO_REUSEPORT setting
  *	@skc_bound_dev_if: bound device index if != 0
  *	@skc_bind_node: bind hash linkage for various protocol lookup tables
  *	@skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
@@ -179,7 +180,8 @@ struct sock_common {
 
 	unsigned short		skc_family;
 	volatile unsigned char	skc_state;
-	unsigned char		skc_reuse;
+	unsigned char		skc_reuse:4;
+	unsigned char		skc_reuseport:4;
 	int			skc_bound_dev_if;
 	union {
 		struct hlist_node	skc_bind_node;
@@ -297,6 +299,7 @@ struct sock {
 #define sk_family		__sk_common.skc_family
 #define sk_state		__sk_common.skc_state
 #define sk_reuse		__sk_common.skc_reuse
+#define sk_reuseport		__sk_common.skc_reuseport
 #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
 #define sk_bind_node		__sk_common.skc_bind_node
 #define sk_prot			__sk_common.skc_prot
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 3f6a992..4ef3acb 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -22,8 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
-
+#define SO_REUSEPORT	15
 #ifndef SO_PASSCRED /* powerpc only differs in these */
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
diff --git a/net/core/sock.c b/net/core/sock.c
index 8258fb7..235fb89 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -665,6 +665,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
 	case SO_REUSEADDR:
 		sk->sk_reuse = (valbool ? SK_CAN_REUSE : SK_NO_REUSE);
 		break;
+	case SO_REUSEPORT:
+		sk->sk_reuseport = valbool;
+		break;
 	case SO_TYPE:
 	case SO_PROTOCOL:
 	case SO_DOMAIN:
@@ -972,6 +975,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		v.val = sk->sk_reuse;
 		break;
 
+	case SO_REUSEPORT:
+		v.val = sk->sk_reuseport;
+		break;
+
 	case SO_KEEPALIVE:
 		v.val = sock_flag(sk, SOCK_KEEPOPEN);
 		break;
-- 
1.7.7.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