* [PATCH net-next-2.6 v8 02/12] net-caif: add CAIF socket and configuration headers
From: sjur.brandeland @ 2010-03-30 23:56 UTC (permalink / raw)
To: davem, netdev, marcel; +Cc: daniel.martensson, sjurbr, Sjur Braendeland
In-Reply-To: <1269993390-23830-2-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Braendeland <sjur.brandeland@stericsson.com>
Add CAIF types for Socket Address, Socket Options,
and configuration parameters for the GPRS IP network interface.
Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
---
include/linux/caif/caif_socket.h | 164 ++++++++++++++++++++++++++++++++++++++
include/linux/caif/if_caif.h | 34 ++++++++
2 files changed, 198 insertions(+), 0 deletions(-)
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
new file mode 100644
index 0000000..8e5c844
--- /dev/null
+++ b/include/linux/caif/caif_socket.h
@@ -0,0 +1,164 @@
+/* linux/caif_socket.h
+ * CAIF Definitions for CAIF socket and network layer
+ * Copyright (C) ST-Ericsson AB 2010
+ * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef _LINUX_CAIF_SOCKET_H
+#define _LINUX_CAIF_SOCKET_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+#include <linux/socket.h>
+#else
+#include <sys/socket.h>
+#endif
+
+
+/**
+ * enum caif_link_selector - Physical Link Selection.
+ * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
+ * traffic.
+ * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
+ * traffic.
+ *
+ * CAIF Link Layers can register their link properties.
+ * This enum is used for choosing between CAIF Link Layers when
+ * setting up CAIF Channels when multiple CAIF Link Layers exists.
+ */
+enum caif_link_selector {
+ CAIF_LINK_HIGH_BANDW,
+ CAIF_LINK_LOW_LATENCY
+};
+
+/**
+ * enum caif_channel_priority - CAIF channel priorities.
+ *
+ * @CAIF_PRIO_MIN: Min priority for a channel.
+ * @CAIF_PRIO_LOW: Low-priority channel.
+ * @CAIF_PRIO_NORMAL: Normal/default priority level.
+ * @CAIF_PRIO_HIGH: High priority level
+ * @CAIF_PRIO_MAX: Max priority for channel
+ *
+ * Priority can be set on CAIF Channels in order to
+ * prioritize between traffic on different CAIF Channels.
+ * These priority levels are recommended, but the priority value
+ * is not restricted to the values defined in this enum, any value
+ * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
+ */
+enum caif_channel_priority {
+ CAIF_PRIO_MIN = 0x01,
+ CAIF_PRIO_LOW = 0x04,
+ CAIF_PRIO_NORMAL = 0x0f,
+ CAIF_PRIO_HIGH = 0x14,
+ CAIF_PRIO_MAX = 0x1F
+};
+
+/**
+ * enum caif_protocol_type - CAIF Channel type.
+ * @CAIFPROTO_AT: Classic AT channel.
+ * @CAIFPROTO_DATAGRAM: Datagram channel.
+ * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
+ * @CAIFPROTO_UTIL: Utility (Psock) channel.
+ * @CAIFPROTO_RFM: Remote File Manager
+ *
+ * This enum defines the CAIF Channel type to be used. This defines
+ * the service to connect to on the modem.
+ */
+enum caif_protocol_type {
+ CAIFPROTO_AT,
+ CAIFPROTO_DATAGRAM,
+ CAIFPROTO_DATAGRAM_LOOP,
+ CAIFPROTO_UTIL,
+ CAIFPROTO_RFM,
+ _CAIFPROTO_MAX
+};
+#define CAIFPROTO_MAX _CAIFPROTO_MAX
+
+/**
+ * enum caif_at_type - AT Service Endpoint
+ * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
+ */
+enum caif_at_type {
+ CAIF_ATTYPE_PLAIN = 2
+};
+
+/**
+ * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
+ * @u: Union of address data 'switched' by family.
+ * :
+ * @u.at: Applies when family = CAIFPROTO_AT.
+ *
+ * @u.at.type: Type of AT link to set up (enum caif_at_type).
+ *
+ * @u.util: Applies when family = CAIFPROTO_UTIL
+ *
+ * @u.util.service: Utility service name.
+ *
+ * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
+ *
+ * @u.dgm.connection_id: Datagram connection id.
+ *
+ * @u.dgm.nsapi: NSAPI of the PDP-Context.
+ *
+ * @u.rfm: Applies when family = CAIFPROTO_RFM
+ *
+ * @u.rfm.connection_id: Connection ID for RFM.
+ *
+ * @u.rfm.volume: Volume to mount.
+ *
+ * Description:
+ * This structure holds the connect parameters used for setting up a
+ * CAIF Channel. It defines the service to connect to on the modem.
+ */
+struct sockaddr_caif {
+ sa_family_t family;
+ union {
+ struct {
+ __u8 type; /* type: enum caif_at_type */
+ } at; /* CAIFPROTO_AT */
+ struct {
+ char service[16];
+ } util; /* CAIFPROTO_UTIL */
+ union {
+ __u32 connection_id;
+ __u8 nsapi;
+ } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
+ struct {
+ __u32 connection_id;
+ char volume[16];
+ } rfm; /* CAIFPROTO_RFM */
+ } u;
+};
+
+/**
+ * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
+ *
+ * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
+ * available. Either a high bandwidth
+ * link can be selected (CAIF_LINK_HIGH_BANDW) or
+ * or a low latency link (CAIF_LINK_LOW_LATENCY).
+ * This option is of type __u32.
+ * Alternatively SO_BINDTODEVICE can be used.
+ *
+ * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
+ * utility channel. (maximum 256 bytes). This
+ * option must be set before connecting.
+ *
+ * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
+ * channel. (maximum 256 bytes). This option
+ * is valid after a successful connect.
+ *
+ *
+ * This enum defines the CAIF Socket options to be used on a socket
+ *
+ */
+enum caif_socket_opts {
+ CAIFSO_LINK_SELECT = 127,
+ CAIFSO_REQ_PARAM = 128,
+ CAIFSO_RSP_PARAM = 129,
+};
+
+#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h
new file mode 100644
index 0000000..5e7eed4
--- /dev/null
+++ b/include/linux/caif/if_caif.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) ST-Ericsson AB 2010
+ * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef IF_CAIF_H_
+#define IF_CAIF_H_
+#include <linux/sockios.h>
+#include <linux/types.h>
+#include <linux/socket.h>
+
+/**
+ * enum ifla_caif - CAIF NetlinkRT parameters.
+ * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context.
+ * The type of attribute is NLA_U32.
+ * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context.
+ * The type of attribute is NLA_U32.
+ * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback
+ * The type of attribute is NLA_U8.
+ *
+ * When using RT Netlink to create, destroy or configure a CAIF IP interface,
+ * enum ifla_caif is used to specify the configuration attributes.
+ */
+enum ifla_caif {
+ __IFLA_CAIF_UNSPEC,
+ IFLA_CAIF_IPV4_CONNID,
+ IFLA_CAIF_IPV6_CONNID,
+ IFLA_CAIF_LOOPBACK,
+ __IFLA_CAIF_MAX
+};
+#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
+
+#endif /*IF_CAIF_H_*/
--
1.6.3.3
^ permalink raw reply related
* [PATCH net-next-2.6 v8 01/12] net-caif: add CAIF protocol definitions
From: sjur.brandeland @ 2010-03-30 23:56 UTC (permalink / raw)
To: davem, netdev, marcel; +Cc: daniel.martensson, sjurbr, Sjur Braendeland
In-Reply-To: <1269993390-23830-1-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Braendeland <sjur.brandeland@stericsson.com>
Add CAIF definitions to existing header files.
Files: if_arp.h, if_ether.h, socket.h.
Types: ARPHRD_CAIF, ETH_P_CAIF, AF_CAIF, PF_CAIF, SOL_CAIF, N_CAIF
Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
---
include/linux/if_arp.h | 1 +
include/linux/if_ether.h | 1 +
include/linux/socket.h | 5 ++++-
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index e80b7f8..6d722f4 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -90,6 +90,7 @@
#define ARPHRD_PHONET 820 /* PhoNet media type */
#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
+#define ARPHRD_CAIF 822 /* CAIF media type */
#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 299b412..bed7a46 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -109,6 +109,7 @@
#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
+#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
/*
* This is an Ethernet frame header.
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 7b3aae2..960659b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -189,7 +189,8 @@ struct ucred {
#define AF_ISDN 34 /* mISDN sockets */
#define AF_PHONET 35 /* Phonet sockets */
#define AF_IEEE802154 36 /* IEEE802154 sockets */
-#define AF_MAX 37 /* For now.. */
+#define AF_CAIF 37 /* CAIF sockets */
+#define AF_MAX 38 /* For now.. */
/* Protocol families, same as address families. */
#define PF_UNSPEC AF_UNSPEC
@@ -229,6 +230,7 @@ struct ucred {
#define PF_ISDN AF_ISDN
#define PF_PHONET AF_PHONET
#define PF_IEEE802154 AF_IEEE802154
+#define PF_CAIF AF_CAIF
#define PF_MAX AF_MAX
/* Maximum queue length specifiable by listen. */
@@ -300,6 +302,7 @@ struct ucred {
#define SOL_PNPIPE 275
#define SOL_RDS 276
#define SOL_IUCV 277
+#define SOL_CAIF 278
/* IPX options */
#define IPX_TYPE 1
--
1.6.3.3
^ permalink raw reply related
* [PATCH net-next-2.6 v8 00/12] net-caif: introducing CAIF protocol stack
From: sjur.brandeland @ 2010-03-30 23:56 UTC (permalink / raw)
To: davem, netdev, marcel; +Cc: daniel.martensson, sjurbr, Sjur Braendeland
From: Sjur Braendeland <sjur.brandeland@stericsson.com>
This patch-set introduces the CAIF protocol Stack.
The "Communication CPU to Application CPU Interface" (CAIF) is a packet based
connection-oriented MUX protocol developed by ST-Ericsson for use with its
modems.
Changes since v8:
- Fixed compile errors and warnings for 64-bit x86.
- Compiled and fixed sparse errors and warnings.
OVERVIEW:
* CAIF provides a socket interface which can be used to open virtual AT
channels, create and configure GPRS Data connections.
* A CAIF Network device is also provided for GPRS access.
This interface can be managed with RTNL.
* A kernel interface is provided allowing Kernel modules to use CAIF.
* A serial link layer layer implemented as a line discipline is currently
implemented. Other link interfaces may be contributed at a later stage.
RTNL
!
! +------+ +------+ +------+
! +------+! +------+! +------+!
! ! Sock !! !Kernel!! ! Net !!
! ! API !+ ! API !+ ! Dev !+ <- CAIF "Client" APIs
! +------+ +------! +------+
! ! ! !
! +----------!----------+
! +------+ <- CAIF Core Protocol Implementation
+-------> ! CAIF !
! Core !
+------+
+--------!--------+
! !
+------+ +-----+
! ldisc! ! ... ! <- Link Layer (Net Devices)
+------+ +-----+
!
+------+
! tty !
+------+
Please see Documentation/networking/CAIF for more documentation.
Based on net-next-2.6
Sjur Braendeland (12):
net-caif: add CAIF protocol definitions
net-caif: add CAIF socket and configuration headers
net-caif: add CAIF core protocol stack header files
net-caif: add CAIF Link layer device header files
net-caif: add CAIF core protocol stack
net-caif: add CAIF generic caif support functions
net-caif: add CAIF device registration functionality
net-caif: add CAIF socket implementation
net-caif: add CAIF netdevice
net-caif: add CAIF Kconfig and Makefiles
net-caif: add CAIF documentation
net-caif-driver: add CAIF serial driver (ldisc)
Documentation/networking/caif/Linux-CAIF.txt | 212 ++++
Documentation/networking/caif/README | 109 ++
drivers/net/Kconfig | 2 +
drivers/net/Makefile | 1 +
drivers/net/caif/Kconfig | 17 +
drivers/net/caif/Makefile | 12 +
drivers/net/caif/caif_serial.c | 441 ++++++++
include/linux/caif/caif_socket.h | 164 +++
include/linux/caif/if_caif.h | 34 +
include/linux/if_arp.h | 1 +
include/linux/if_ether.h | 1 +
include/linux/socket.h | 5 +-
include/linux/tty.h | 4 +-
include/net/caif/caif_dev.h | 90 ++
include/net/caif/caif_device.h | 55 +
include/net/caif/caif_layer.h | 283 ++++++
include/net/caif/cfcnfg.h | 133 +++
include/net/caif/cfctrl.h | 138 +++
include/net/caif/cffrml.h | 16 +
include/net/caif/cfmuxl.h | 22 +
include/net/caif/cfpkt.h | 274 +++++
include/net/caif/cfserl.h | 12 +
include/net/caif/cfsrvl.h | 34 +
net/Kconfig | 2 +
net/Makefile | 1 +
net/caif/Kconfig | 48 +
net/caif/Makefile | 26 +
net/caif/caif_config_util.c | 87 ++
net/caif/caif_dev.c | 413 ++++++++
net/caif/caif_socket.c | 1391 ++++++++++++++++++++++++++
net/caif/cfcnfg.c | 529 ++++++++++
net/caif/cfctrl.c | 664 ++++++++++++
net/caif/cfdbgl.c | 40 +
net/caif/cfdgml.c | 108 ++
net/caif/cffrml.c | 151 +++
net/caif/cfmuxl.c | 246 +++++
net/caif/cfpkt_skbuff.c | 571 +++++++++++
net/caif/cfrfml.c | 108 ++
net/caif/cfserl.c | 192 ++++
net/caif/cfsrvl.c | 185 ++++
net/caif/cfutill.c | 115 +++
net/caif/cfveil.c | 107 ++
net/caif/cfvidl.c | 65 ++
net/caif/chnl_net.c | 451 +++++++++
44 files changed, 7557 insertions(+), 3 deletions(-)
^ permalink raw reply
* [PATCH 7/6] sysfs: Remove double free sysfs_get_sb
From: Eric W. Biederman @ 2010-03-30 23:50 UTC (permalink / raw)
To: Eric Dumazet
Cc: Greg Kroah-Hartman, Kay Sievers, linux-kernel, Tejun Heo,
Cornelia Huck, linux-fsdevel, Benjamin LaHaise, Serge Hallyn,
netdev
In-Reply-To: <1269977012.2048.0.camel@edumazet-laptop>
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
fs/sysfs/mount.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 13bd0ba..bbba090 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -121,7 +121,6 @@ static int sysfs_get_sb(struct file_system_type *fs_type,
if (IS_ERR(sb) || sb->s_fs_info != info)
kfree(info);
if (IS_ERR(sb)) {
- kfree(info);
error = PTR_ERR(sb);
goto out;
}
--
1.6.5.2.143.g8cc62
^ permalink raw reply related
* Re: [PATCH net-next-2.6 v7 00/12] net-caif: introducing CAIF protocol stack
From: David Miller @ 2010-03-30 23:45 UTC (permalink / raw)
To: sjur.brandeland; +Cc: netdev, marcel, daniel.martensson, sjurbr
In-Reply-To: <1269990989-12383-1-git-send-email-sjur.brandeland@stericsson.com>
From: sjur.brandeland@stericsson.com
Date: Wed, 31 Mar 2010 01:16:29 +0200
> Do you want a new patch-set now
Sure.
^ permalink raw reply
* [PATCH net-next-2.6 v7 00/12] net-caif: introducing CAIF protocol stack
From: sjur.brandeland @ 2010-03-30 23:16 UTC (permalink / raw)
To: davem, netdev, marcel; +Cc: daniel.martensson, sjurbr, Sjur Braendeland
In-Reply-To: <1269934228-23292-1-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Braendeland <sjur.brandeland@stericsson.com>
Hi David.
>You're directly accessing SKB data members instead of using
>the portable interfaces defined in linux/skbuff.h, therefore
>the build fails on 64-bit.
Sorry for the inconvenience I have caused you David.
>How many revisions of this patch set and not once has it been even
>build tested on 64-bit?
We have been doing all our testing on ARM and x86 so far,
64bit slipped our attention.
I have compiled for x86, x86-64 bit, run sparce and checkpatch -strict,
compiled with -W, and already compiled for ARM.
Do you want a new patch-set now, or would you rather wait for completion of
all checks in 'SubmitPaches'? I'm missing at least steps: 2, 3, 4, 10, 21.
BR/Sjur
^ permalink raw reply
* Re: [PATCH 0/6] tagged sysfs support
From: Eric W. Biederman @ 2010-03-30 23:04 UTC (permalink / raw)
To: Kay Sievers
Cc: Greg Kroah-Hartman, Greg KH, linux-kernel, Tejun Heo,
Cornelia Huck, linux-fsdevel, Eric Dumazet, Benjamin LaHaise,
Serge Hallyn, netdev
In-Reply-To: <ac3eb2511003301153i43a60720hb015071e2c992199@mail.gmail.com>
Kay Sievers <kay.sievers@vrfy.org> writes:
> On Tue, Mar 30, 2010 at 20:30, Eric W. Biederman <ebiederm@xmission.com> wrote:
>>
>> The main short coming of using multiple network namespaces today
>> is that only network devices for the primary network namespaces
>> can be put in the kobject layer and sysfs.
>>
>> This is essentially the earlier version of this patchset that was
>> reviewed before, just now on top of a version of sysfs that doesn't
>> need cleanup patches to support it.
>
> Just to check if we are not in conflict with planned changes, and how
> to possibly handle them:
>
> There is the plan and ongoing work to unify classes and buses, export
> them at /sys/subsystem in the same layout of the current /sys/bus/.
> The decision to export buses and classes as two different things
> (which they aren't) is the last major piece in the sysfs layout which
> needs to be fixed.
Interesting. We will symlinks ie:
/sys/class -> /sys/subsystem
/sys/bus -> /sys/subsystem
to keep from breaking userspace.
> It would mean that /sys/subsystem/net/devices/* would look like
> /sys/class/net/* today. But at the /sys/subsystem/net/ directory could
> be global network-subsystem-wide control files which would need to be
> namespaced too. (The network subsystem does not use subsytem-global
> files today, but a bunch of other classes do.)
>
> This could be modeled into the current way of doing sysfs namespaces?
> A /sys/bus/<subsystem>/ directory hierarchy would need to be
> namespaced, not just a single plain directory with symlinks. Would
> that work?
I'm not entirely clear on what you are doing but it all sounds like it
will fit within what I am doing. Right now I have /sys/class/net,
/sys/devices/virtual/net and a bunch of other net directories becoming
tagged and only showing up in the appropriately mounted sysfs. We
track them all in the class kset and as long as we extend that capability
when the subsystem change happens in sysfs all should be well.
Today we have /sys/class/net/bonding_master. For now I have that as
an untagged but the implementation is aware of which network namespace
your current process is in. Thinking about that a little more it
would be better to make that file tagged so that userspace can see
different versions for the different network namespaces. Joy.
I expect other control files will be the same.
In general it doesn't make sense to add control files for networking.
as they easily conflict with legal network device names and thus create
the possibility of breaking someones userspace.
Eric
^ permalink raw reply
* Re: [PATCH 2/2] ethtool: RXHASH flag support
From: Jeff Garzik @ 2010-03-30 22:58 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20100330143133.709f542b@nehalam>
On 03/30/2010 05:31 PM, Stephen Hemminger wrote:
> On Tue, 30 Mar 2010 17:08:48 -0400
> Jeff Garzik<jeff@garzik.org> wrote:
>
>> On 03/30/2010 05:05 PM, Stephen Hemminger wrote:
>>> On Tue, 30 Mar 2010 13:37:13 -0400
>>> Jeff Garzik<jeff@garzik.org> wrote:
>>>
>>>> On 03/30/2010 01:32 PM, Stephen Hemminger wrote:
>>>>> On Tue, 30 Mar 2010 13:29:01 -0400
>>>>> Jeff Garzik<jeff@garzik.org> wrote:
>>>>>
>>>>>> By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY
>>>>>> and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed,
>>>>>> breaking the ethtool build.
>>>>>
>>>>> In the patch I moved it to ethtool.c to have local entries.
>>>>>
>>>>> I believe that all cloned headers should only come from the result
>>>>> of kernel "make install_headers". Not locally different vrsions.
>>>>
>>>> There is nothing locally different about ethtool-copy.h.
>>>>
>>>> Jeff
>>>
>>> diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h
>>> --- ethtool-copy.h 2010-03-30 14:03:45.000000000 -0700
>>> +++ /home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h 2010-03-30 14:04:30.893866057 -0700
>>
>> The canonical copy of ethtool-copy.h comes from the kernel tree's
>> include/linux/ethtool.h.
>>
>
> The difference comes because scripts/headers_install.pl decides to change inline to __inline__.
> I think Kbuild is the proper place to do any exported headers cleanup, so I would
> rather the automated process work.
Either way, it's a manual process to sync up -- except that grabbing
from $somewhere/usr/include/linux/ethtool.h involves more steps and is
potentially more error-prone.
And regardless of any of this, none of the sync-up stuff should have
been in the same patch as your RXHASH additions.
Now that ethtool.git has the latest from net-next, it's a moot point anyway.
Jeff
^ permalink raw reply
* Re: UDP path MTU discovery
From: Edgar E. Iglesias @ 2010-03-30 22:04 UTC (permalink / raw)
To: Andi Kleen
Cc: Templin, Fred L, Eric Dumazet, Rick Jones, Glen Turner,
netdev@vger.kernel.org
In-Reply-To: <20100330141237.GP20695@one.firstfloor.org>
On Tue, Mar 30, 2010 at 04:12:37PM +0200, Andi Kleen wrote:
> > Where does the application controllable per socket MTU come into the
> > picture?
>
> To set the minimum path MTU so that there is a guarantee that IPv6 routers
> (which are unable to fragment themselves) will never drop it.
Not sure I agree with that kind of solution but thats probably
because of missunderstandings on my side :)
Thanks for explaning.
^ permalink raw reply
* [PATCH 1/2] net: gianfar - initialize per-queue statistics
From: Kim Phillips @ 2010-03-30 21:54 UTC (permalink / raw)
To: David S. Miller, Anton Vorontsov, Sandeep Gopalpet, Kumar Gala,
Andy
Cc: Kim Phillips
Interfaces come up claiming having already received 3.0 GiB.
Use kzalloc to properly initialize per-queue data.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
drivers/net/gianfar.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 669de02..d557ab6 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -676,7 +676,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
priv->rx_queue[i] = NULL;
for (i = 0; i < priv->num_tx_queues; i++) {
- priv->tx_queue[i] = (struct gfar_priv_tx_q *)kmalloc(
+ priv->tx_queue[i] = (struct gfar_priv_tx_q *)kzalloc(
sizeof (struct gfar_priv_tx_q), GFP_KERNEL);
if (!priv->tx_queue[i]) {
err = -ENOMEM;
@@ -689,7 +689,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
}
for (i = 0; i < priv->num_rx_queues; i++) {
- priv->rx_queue[i] = (struct gfar_priv_rx_q *)kmalloc(
+ priv->rx_queue[i] = (struct gfar_priv_rx_q *)kzalloc(
sizeof (struct gfar_priv_rx_q), GFP_KERNEL);
if (!priv->rx_queue[i]) {
err = -ENOMEM;
--
1.7.0.2
^ permalink raw reply related
* [PATCH 2/2] net: gianfar - align BD ring size console messages
From: Kim Phillips @ 2010-03-30 21:54 UTC (permalink / raw)
To: David S. Miller, Anton Vorontsov, Sandeep Gopalpet, Kumar Gala,
Andy
Cc: Kim Phillips
In-Reply-To: <1269986062-1697-1-git-send-email-kim.phillips@freescale.com>
fix this:
eth2: :RX BD ring size for Q[0]: 256
eth2:TX BD ring size for Q[0]: 256
to look like:
eth2: RX BD ring size for Q[0]: 256
eth2: TX BD ring size for Q[0]: 256
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
drivers/net/gianfar.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d557ab6..5131d12 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1120,10 +1120,10 @@ static int gfar_probe(struct of_device *ofdev,
/* provided which set of benchmarks. */
printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name);
for (i = 0; i < priv->num_rx_queues; i++)
- printk(KERN_INFO "%s: :RX BD ring size for Q[%d]: %d\n",
+ printk(KERN_INFO "%s: RX BD ring size for Q[%d]: %d\n",
dev->name, i, priv->rx_queue[i]->rx_ring_size);
for(i = 0; i < priv->num_tx_queues; i++)
- printk(KERN_INFO "%s:TX BD ring size for Q[%d]: %d\n",
+ printk(KERN_INFO "%s: TX BD ring size for Q[%d]: %d\n",
dev->name, i, priv->tx_queue[i]->tx_ring_size);
return 0;
--
1.7.0.2
^ permalink raw reply related
* Re: Re [RFC PATCH 1/2] iproute2: Add libnl support.
From: Stephen Hemminger @ 2010-03-30 21:40 UTC (permalink / raw)
To: James Chapman; +Cc: netdev
In-Reply-To: <4BB1ACDA.8030808@katalix.com>
On Tue, 30 Mar 2010 08:48:42 +0100
James Chapman <jchapman@katalix.com> wrote:
> Stephen Hemminger wrote:
> >> This patch links the ip utility with libnl, which must be separately
> >> installed. This lets new functionality use libnl to implement its
> >> netlink interfaces.
> >>
> >> Package developers will need to add libnl to the iproute2 package
> >> dependencies.
> >> ---
> >> Makefile | 2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > No. I don't want to make iproute2 dependent on libnl.
> > It doesn't make sense to have dependency without major need for new
> > functionality. There are already netlink library routines in iproute2
>
> True, but libnetlink doesn't provide utility routines for building genl
> interfaces like it does, say, for rtnl. To use libnetlink for this code,
> we'd have to c&p some code from genl/ctrl.c to handle the interface
> family registration, for example. It's all there in libnl already.
>
> But I understand your reservation about introducing a new library
> dependency. Since the rest of our netlink code uses libnl, I'm leaning
> towards having a separate utility for these commands so we can keep it
> libnl.
>
Please use extend genl/ctrl.c to handle your lt2pv3 messages.
^ permalink raw reply
* Re: [PATCH 2/2] ethtool: RXHASH flag support
From: Stephen Hemminger @ 2010-03-30 21:31 UTC (permalink / raw)
To: Jeff Garzik; +Cc: David Miller, netdev
In-Reply-To: <4BB26860.2040000@garzik.org>
On Tue, 30 Mar 2010 17:08:48 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> On 03/30/2010 05:05 PM, Stephen Hemminger wrote:
> > On Tue, 30 Mar 2010 13:37:13 -0400
> > Jeff Garzik<jeff@garzik.org> wrote:
> >
> >> On 03/30/2010 01:32 PM, Stephen Hemminger wrote:
> >>> On Tue, 30 Mar 2010 13:29:01 -0400
> >>> Jeff Garzik<jeff@garzik.org> wrote:
> >>>
> >>>> By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY
> >>>> and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed,
> >>>> breaking the ethtool build.
> >>>
> >>> In the patch I moved it to ethtool.c to have local entries.
> >>>
> >>> I believe that all cloned headers should only come from the result
> >>> of kernel "make install_headers". Not locally different vrsions.
> >>
> >> There is nothing locally different about ethtool-copy.h.
> >>
> >> Jeff
> >
> > diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h
> > --- ethtool-copy.h 2010-03-30 14:03:45.000000000 -0700
> > +++ /home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h 2010-03-30 14:04:30.893866057 -0700
>
> The canonical copy of ethtool-copy.h comes from the kernel tree's
> include/linux/ethtool.h.
>
The difference comes because scripts/headers_install.pl decides to change inline to __inline__.
I think Kbuild is the proper place to do any exported headers cleanup, so I would
rather the automated process work.
--
^ permalink raw reply
* Re: [Bugme-new] [Bug 15571] New: TCP madness - some packets are shunned.
From: Jasen Betts @ 2010-03-30 21:08 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Arnd Hannemann, netdev, bugzilla-daemon, bugme-daemon,
Andrew Morton
In-Reply-To: <20100327212644.4bfda1ac@nehalam>
On Sat, Mar 27, 2010 at 09:26:44PM -0700, Stephen Hemminger wrote:
>
> The window is also settable on a per route basis as well.
>
> http://lwn.net/Articles/92727/
Have used this on our squid proxy server, all is good now.
thanks.
ip route add 121.199.32.220 via upstream.ip.router.addr window 65535
^ permalink raw reply
* Re: [PATCH 5/6] cxgb4: Add main driver file and driver Makefile
From: Stephen Hemminger @ 2010-03-30 21:19 UTC (permalink / raw)
To: Dimitris Michailidis; +Cc: netdev
In-Reply-To: <1269975142-30896-6-git-send-email-dm@chelsio.com>
On Tue, 30 Mar 2010 10:52:21 -0800
Dimitris Michailidis <dm@chelsio.com> wrote:
> +static struct cxgb4_proc_entry proc_files[] = {
> +#ifdef CONFIG_PROC_FS
> + { "l2t", 0444, ADAP_NEED_L2T, 0, &t4_l2t_proc_fops },
> +#endif
> + { "lb_stats", 0444, 0, 0, &lb_stats_proc_fops },
> + { "path_mtus", 0644, 0, 0, &mtutab_proc_fops },
> + { "qstats", 0444, 0, 0, &sge_stats_proc_fops },
> + { "rss", 0444, 0, 0, &rss_proc_fops },
> + { "tcp_stats", 0444, 0, 0, &tcp_stats_proc_fops },
> + { "tids", 0444, ADAP_NEED_OFLD, 0, &tid_info_proc_fops },
> + { "tp_err_stats", 0444, 0, 0, &tp_err_stats_proc_fops },
> + { "trace0", 0644, 0, 0, &mps_trc_proc_fops },
> + { "trace1", 0644, 0, 1, &mps_trc_proc_fops },
> + { "trace2", 0644, 0, 2, &mps_trc_proc_fops },
> + { "trace3", 0644, 0, 3, &mps_trc_proc_fops },
> + { "uld", 0444, 0, 0, &uld_proc_fops },
> +};
> +
Do you really need this large number of /proc files.
It creates another stable API to worry about. If it is just for
debugging move it to debugfs, or better yet just drop it.
--
^ permalink raw reply
* Re: [PATCH 1/6] cxgb4: Add register, message, and FW definitions
From: Stephen Hemminger @ 2010-03-30 21:09 UTC (permalink / raw)
To: Dimitris Michailidis; +Cc: netdev
In-Reply-To: <1269975142-30896-2-git-send-email-dm@chelsio.com>
On Tue, 30 Mar 2010 10:52:17 -0800
Dimitris Michailidis <dm@chelsio.com> wrote:
> +union opcode_tid {
> + __be32 opcode_tid;
> + __u8 opcode;
> +};
> +
The intent of the __types like __u8 etc are that these types
should only be used by structures that are part in some way of
a kernel to userspace API. Any structures which are only used
in the kernel should just use the regular type (ie u8).
I say intent because many places do not follow this practice.
--
^ permalink raw reply
* Re: [PATCH 2/2] ethtool: RXHASH flag support
From: Jeff Garzik @ 2010-03-30 21:08 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20100330140519.7b45cbb6@nehalam>
On 03/30/2010 05:05 PM, Stephen Hemminger wrote:
> On Tue, 30 Mar 2010 13:37:13 -0400
> Jeff Garzik<jeff@garzik.org> wrote:
>
>> On 03/30/2010 01:32 PM, Stephen Hemminger wrote:
>>> On Tue, 30 Mar 2010 13:29:01 -0400
>>> Jeff Garzik<jeff@garzik.org> wrote:
>>>
>>>> By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY
>>>> and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed,
>>>> breaking the ethtool build.
>>>
>>> In the patch I moved it to ethtool.c to have local entries.
>>>
>>> I believe that all cloned headers should only come from the result
>>> of kernel "make install_headers". Not locally different vrsions.
>>
>> There is nothing locally different about ethtool-copy.h.
>>
>> Jeff
>
> diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h
> --- ethtool-copy.h 2010-03-30 14:03:45.000000000 -0700
> +++ /home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h 2010-03-30 14:04:30.893866057 -0700
The canonical copy of ethtool-copy.h comes from the kernel tree's
include/linux/ethtool.h.
Jeff
^ permalink raw reply
* Re: [PATCH 2/2] ethtool: RXHASH flag support
From: Stephen Hemminger @ 2010-03-30 21:05 UTC (permalink / raw)
To: Jeff Garzik; +Cc: David Miller, netdev
In-Reply-To: <4BB236C9.7080300@garzik.org>
On Tue, 30 Mar 2010 13:37:13 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> On 03/30/2010 01:32 PM, Stephen Hemminger wrote:
> > On Tue, 30 Mar 2010 13:29:01 -0400
> > Jeff Garzik<jeff@garzik.org> wrote:
> >
> >> By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY
> >> and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed,
> >> breaking the ethtool build.
> >
> > In the patch I moved it to ethtool.c to have local entries.
> >
> > I believe that all cloned headers should only come from the result
> > of kernel "make install_headers". Not locally different vrsions.
>
> There is nothing locally different about ethtool-copy.h.
>
> Jeff
diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h
--- ethtool-copy.h 2010-03-30 14:03:45.000000000 -0700
+++ /home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h 2010-03-30 14:04:30.893866057 -0700
@@ -36,7 +36,7 @@
__u32 reserved[2];
};
-static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
__u32 speed)
{
@@ -44,7 +44,7 @@
ep->speed_hi = (__u16)(speed >> 16);
}
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
{
return (ep->speed_hi << 16) | ep->speed;
}
@@ -424,6 +424,7 @@
char data[ETHTOOL_FLASH_MAX_FILENAME];
};
+
/* CMDs currently supported */
#define ETHTOOL_GSET 0x00000001 /* Get settings. */
#define ETHTOOL_SSET 0x00000002 /* Set settings. */
^ permalink raw reply
* Re: [PATCH] net: Fix oops from tcp_collapse() when using splice()
From: David Miller @ 2010-03-30 20:56 UTC (permalink / raw)
To: steve
Cc: netdev, kuznet, pekkas, jmorris, yoshfuji, kaber, linux-kernel,
monstr, karl
In-Reply-To: <20100330.134741.203608594.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 30 Mar 2010 13:47:41 -0700 (PDT)
> From: "Steven J. Magnani" <steve@digidescorp.com>
> Date: Tue, 30 Mar 2010 15:45:13 -0500
>
>> tcp_read_sock() can have a eat skbs without immediately advancing copied_seq.
>> This can cause a panic in tcp_collapse() if it is called as a result
>> of the recv_actor dropping the socket lock.
>>
>> A userspace program that splices data from a socket to either another
>> socket or to a file can trigger this bug.
>>
>> Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
>
> Thanks for fixing this I'll look at your patch more closely
> right now.
Patch applied, thanks Steven!
^ permalink raw reply
* Re: [PATCH] net: Fix oops from tcp_collapse() when using splice()
From: David Miller @ 2010-03-30 20:47 UTC (permalink / raw)
To: steve
Cc: netdev, kuznet, pekkas, jmorris, yoshfuji, kaber, linux-kernel,
monstr, karl
In-Reply-To: <1269981913-18073-1-git-send-email-steve@digidescorp.com>
From: "Steven J. Magnani" <steve@digidescorp.com>
Date: Tue, 30 Mar 2010 15:45:13 -0500
> tcp_read_sock() can have a eat skbs without immediately advancing copied_seq.
> This can cause a panic in tcp_collapse() if it is called as a result
> of the recv_actor dropping the socket lock.
>
> A userspace program that splices data from a socket to either another
> socket or to a file can trigger this bug.
>
> Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Thanks for fixing this I'll look at your patch more closely
right now.
^ permalink raw reply
* [PATCH] net: Fix oops from tcp_collapse() when using splice()
From: Steven J. Magnani @ 2010-03-30 20:45 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Alexey Kuznetsov, Pekka Savola (ipv6),
James Morris, Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel,
monstr, Karl Hiramoto, Steven J. Magnani
tcp_read_sock() can have a eat skbs without immediately advancing copied_seq.
This can cause a panic in tcp_collapse() if it is called as a result
of the recv_actor dropping the socket lock.
A userspace program that splices data from a socket to either another
socket or to a file can trigger this bug.
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
---
diff -uprN a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c 2010-03-30 15:25:55.000000000 -0500
+++ b/net/ipv4/tcp.c 2010-03-30 15:27:49.000000000 -0500
@@ -1335,6 +1335,7 @@ int tcp_read_sock(struct sock *sk, read_
sk_eat_skb(sk, skb, 0);
if (!desc->count)
break;
+ tp->copied_seq = seq;
}
tp->copied_seq = seq;
^ permalink raw reply
* Re: [PATCH] net/pcmcia 3com: replacements of printk() with dev_info() and friends (fwd)
From: Joe Perches @ 2010-03-30 20:15 UTC (permalink / raw)
To: Alexander Kurz; +Cc: netdev
In-Reply-To: <alpine.DEB.1.10.1003302019200.11637@blala.de>
On Tue, 2010-03-30 at 21:01 +0400, Alexander Kurz wrote:
> It is my first patch, so I highly welcome comments and hints,
If you wanted to clean this up, you might
end up with something like what is below.
If you really wanted to clean this up, you'd
reorder the functions so you wouldn't need the
/* index of functions */
block so that all the static functions are
instantiated in order of use.
Basically:
Columnarize enums, typedefs, structs, etc
Convert printks to appropriate types
Coalesce long formats
Indent multiline arguments to function open paren
Trim trailing whitespace
Convert leading spaces to tab
Vertical whitespace between function variables and code
Appropriate checkpatch cleanups
I use a script for most of this,
http://lkml.org/lkml/2010/3/24/447
some coccinelle conversions I haven't posted,
checkpatch and a little I hope tasteful typing.
cheers, Joe
---
drivers/net/pcmcia/3c574_cs.c | 462 +++++++++++++++++++++++------------------
1 files changed, 255 insertions(+), 207 deletions(-)
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 3d1d3a7..9c96742 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -12,7 +12,7 @@
following copyright:
Copyright 1993 United States Government as represented by the
Director, National Security Agency.
-
+
*/
@@ -86,6 +86,8 @@ earlier 3Com products.
#include <linux/ethtool.h>
#include <linux/bitops.h>
#include <linux/mii.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
@@ -95,8 +97,6 @@ earlier 3Com products.
#include <pcmcia/ds.h>
#include <pcmcia/mem_op.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
#include <asm/system.h>
/*====================================================================*/
@@ -122,7 +122,7 @@ INT_MODULE_PARM(auto_polarity, 1);
/*====================================================================*/
/* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT ((800*HZ)/1000)
+#define TX_TIMEOUT ((800 * HZ) / 1000)
/* To minimize the size of the driver source and make the driver more
readable not all constants are symbolically defined.
@@ -137,85 +137,125 @@ INT_MODULE_PARM(auto_polarity, 1);
/* The top five bits written to EL3_CMD are a command, the lower
11 bits are the parameter, if applicable. */
enum el3_cmds {
- TotalReset = 0<<11, SelectWindow = 1<<11, StartCoax = 2<<11,
- RxDisable = 3<<11, RxEnable = 4<<11, RxReset = 5<<11, RxDiscard = 8<<11,
- TxEnable = 9<<11, TxDisable = 10<<11, TxReset = 11<<11,
- FakeIntr = 12<<11, AckIntr = 13<<11, SetIntrEnb = 14<<11,
- SetStatusEnb = 15<<11, SetRxFilter = 16<<11, SetRxThreshold = 17<<11,
- SetTxThreshold = 18<<11, SetTxStart = 19<<11, StatsEnable = 21<<11,
- StatsDisable = 22<<11, StopCoax = 23<<11,
+ TotalReset = 0 << 11,
+ SelectWindow = 1 << 11,
+ StartCoax = 2 << 11,
+ RxDisable = 3 << 11,
+ RxEnable = 4 << 11,
+ RxReset = 5 << 11,
+ RxDiscard = 8 << 11,
+ TxEnable = 9 << 11,
+ TxDisable = 10 << 11,
+ TxReset = 11 << 11,
+ FakeIntr = 12 << 11,
+ AckIntr = 13 << 11,
+ SetIntrEnb = 14 << 11,
+ SetStatusEnb = 15 << 11,
+ SetRxFilter = 16 << 11,
+ SetRxThreshold = 17 << 11,
+ SetTxThreshold = 18 << 11,
+ SetTxStart = 19 << 11,
+ StatsEnable = 21 << 11,
+ StatsDisable = 22 << 11,
+ StopCoax = 23 << 11,
};
enum elxl_status {
- IntLatch = 0x0001, AdapterFailure = 0x0002, TxComplete = 0x0004,
- TxAvailable = 0x0008, RxComplete = 0x0010, RxEarly = 0x0020,
- IntReq = 0x0040, StatsFull = 0x0080, CmdBusy = 0x1000 };
+ IntLatch = 0x0001,
+ AdapterFailure = 0x0002,
+ TxComplete = 0x0004,
+ TxAvailable = 0x0008,
+ RxComplete = 0x0010,
+ RxEarly = 0x0020,
+ IntReq = 0x0040,
+ StatsFull = 0x0080,
+ CmdBusy = 0x1000
+};
/* The SetRxFilter command accepts the following classes: */
enum RxFilter {
- RxStation = 1, RxMulticast = 2, RxBroadcast = 4, RxProm = 8
+ RxStation = 1,
+ RxMulticast = 2,
+ RxBroadcast = 4,
+ RxProm = 8
};
enum Window0 {
- Wn0EepromCmd = 10, Wn0EepromData = 12, /* EEPROM command/address, data. */
- IntrStatus=0x0E, /* Valid in all windows. */
+ Wn0EepromCmd = 10,
+ Wn0EepromData = 12, /* EEPROM command/address, data. */
+ IntrStatus = 0x0E, /* Valid in all windows. */
};
/* These assumes the larger EEPROM. */
enum Win0_EEPROM_cmds {
- EEPROM_Read = 0x200, EEPROM_WRITE = 0x100, EEPROM_ERASE = 0x300,
- EEPROM_EWENB = 0x30, /* Enable erasing/writing for 10 msec. */
- EEPROM_EWDIS = 0x00, /* Disable EWENB before 10 msec timeout. */
+ EEPROM_Read = 0x200,
+ EEPROM_WRITE = 0x100,
+ EEPROM_ERASE = 0x300,
+ EEPROM_EWENB = 0x30, /* Enable erasing/writing for 10 msec. */
+ EEPROM_EWDIS = 0x00, /* Disable EWENB before 10 msec timeout. */
};
/* Register window 1 offsets, the window used in normal operation.
On the "Odie" this window is always mapped at offsets 0x10-0x1f.
Except for TxFree, which is overlapped by RunnerWrCtrl. */
enum Window1 {
- TX_FIFO = 0x10, RX_FIFO = 0x10, RxErrors = 0x14,
- RxStatus = 0x18, Timer=0x1A, TxStatus = 0x1B,
- TxFree = 0x0C, /* Remaining free bytes in Tx buffer. */
- RunnerRdCtrl = 0x16, RunnerWrCtrl = 0x1c,
+ TX_FIFO = 0x10,
+ RX_FIFO = 0x10,
+ RxErrors = 0x14,
+ RxStatus = 0x18,
+ Timer = 0x1A,
+ TxStatus = 0x1B,
+ TxFree = 0x0C, /* Remaining free bytes in Tx buffer. */
+ RunnerRdCtrl = 0x16,
+ RunnerWrCtrl = 0x1c,
};
enum Window3 { /* Window 3: MAC/config bits. */
- Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
+ Wn3_Config = 0,
+ Wn3_MAC_Ctrl = 6,
+ Wn3_Options = 8,
};
enum wn3_config {
- Ram_size = 7,
- Ram_width = 8,
- Ram_speed = 0x30,
- Rom_size = 0xc0,
- Ram_split_shift = 16,
- Ram_split = 3 << Ram_split_shift,
- Xcvr_shift = 20,
- Xcvr = 7 << Xcvr_shift,
- Autoselect = 0x1000000,
+ Ram_size = 7,
+ Ram_width = 8,
+ Ram_speed = 0x30,
+ Rom_size = 0xc0,
+ Ram_split_shift = 16,
+ Ram_split = 3 << Ram_split_shift,
+ Xcvr_shift = 20,
+ Xcvr = 7 << Xcvr_shift,
+ Autoselect = 0x1000000,
};
enum Window4 { /* Window 4: Xcvr/media bits. */
- Wn4_FIFODiag = 4, Wn4_NetDiag = 6, Wn4_PhysicalMgmt=8, Wn4_Media = 10,
+ Wn4_FIFODiag = 4,
+ Wn4_NetDiag = 6,
+ Wn4_PhysicalMgmt = 8,
+ Wn4_Media = 10,
};
#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
struct el3_private {
struct pcmcia_device *p_dev;
- dev_node_t node;
- u16 advertising, partner; /* NWay media advertisement */
- unsigned char phys; /* MII device address */
- unsigned int autoselect:1, default_media:3; /* Read from the EEPROM/Wn3_Config. */
- /* for transceiver monitoring */
+ dev_node_t node;
+ u16 advertising;
+ u16 partner; /* NWay media advertisement */
+ unsigned char phys; /* MII device address */
+ unsigned int autoselect:1;
+ unsigned int default_media:3; /* Read from the
+ * EEPROM/Wn3_Config.
+ * for transceiver monitoring */
struct timer_list media;
- unsigned short media_status;
- unsigned short fast_poll;
- unsigned long last_irq;
- spinlock_t window_lock; /* Guards the Window selection */
+ unsigned short media_status;
+ unsigned short fast_poll;
+ unsigned long last_irq;
+ spinlock_t window_lock; /* Guards Window selection */
};
/* Set iff a MII transceiver on any interface requires mdio preamble.
This only set with the original DP83840 on older 3c905 boards, so the extra
code size of a per-interface flag is not worthwhile. */
-static char mii_preamble_required = 0;
+static char mii_preamble_required;
/* Index of functions. */
@@ -245,23 +285,21 @@ static const struct ethtool_ops netdev_ethtool_ops;
static void set_rx_mode(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
-static void tc574_detach(struct pcmcia_device *p_dev);
-
/*
tc574_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
*/
static const struct net_device_ops el3_netdev_ops = {
- .ndo_open = el3_open,
- .ndo_stop = el3_close,
+ .ndo_open = el3_open,
+ .ndo_stop = el3_close,
.ndo_start_xmit = el3_start_xmit,
- .ndo_tx_timeout = el3_tx_timeout,
+ .ndo_tx_timeout = el3_tx_timeout,
.ndo_get_stats = el3_get_stats,
.ndo_do_ioctl = el3_ioctl,
.ndo_set_multicast_list = set_multicast_list,
.ndo_change_mtu = eth_change_mtu,
- .ndo_set_mac_address = eth_mac_addr,
+ .ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
@@ -294,7 +332,7 @@ static int tc574_probe(struct pcmcia_device *link)
dev->watchdog_timeo = TX_TIMEOUT;
return tc574_config(link);
-} /* tc574_attach */
+}
/*
@@ -317,7 +355,7 @@ static void tc574_detach(struct pcmcia_device *link)
tc574_release(link);
free_netdev(dev);
-} /* tc574_detach */
+}
/*
tc574_config() is scheduled to run after a CARD_INSERTION event
@@ -381,8 +419,8 @@ static int tc574_config(struct pcmcia_device *link)
for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
if (phys_addr[0] == htons(0x6060)) {
- printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
- "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
+ netdev_notice(dev, "IO port conflict at 0x%03lx-0x%03lx\n",
+ dev->base_addr, dev->base_addr+15);
goto failed;
}
}
@@ -393,10 +431,10 @@ static int tc574_config(struct pcmcia_device *link)
{
u_char mcr;
- outw(2<<11, ioaddr + RunnerRdCtrl);
+ outw(2 << 11, ioaddr + RunnerRdCtrl);
mcr = inb(ioaddr + 2);
- outw(0<<11, ioaddr + RunnerRdCtrl);
- printk(KERN_INFO " ASIC rev %d,", mcr>>3);
+ outw(0 << 11, ioaddr + RunnerRdCtrl);
+ netdev_info(dev, "ASIC rev %d\n", mcr >> 3);
EL3WINDOW(3);
config = inl(ioaddr + Wn3_Config);
lp->default_media = (config & Xcvr) >> Xcvr_shift;
@@ -407,7 +445,7 @@ static int tc574_config(struct pcmcia_device *link)
{
int phy;
-
+
/* Roadrunner only: Turn on the MII transceiver */
outw(0x8040, ioaddr + Wn3_Options);
mdelay(1);
@@ -416,7 +454,7 @@ static int tc574_config(struct pcmcia_device *link)
tc574_wait_for_completion(dev, RxReset);
mdelay(1);
outw(0x8040, ioaddr + Wn3_Options);
-
+
EL3WINDOW(4);
for (phy = 1; phy <= 32; phy++) {
int mii_status;
@@ -424,16 +462,15 @@ static int tc574_config(struct pcmcia_device *link)
mii_status = mdio_read(ioaddr, phy & 0x1f, 1);
if (mii_status != 0xffff) {
lp->phys = phy & 0x1f;
- dev_dbg(&link->dev, " MII transceiver at "
- "index %d, status %x.\n",
- phy, mii_status);
+ dev_dbg(&link->dev, "MII transceiver at index %d, status %x\n",
+ phy, mii_status);
if ((mii_status & 0x0040) == 0)
mii_preamble_required = 1;
break;
}
}
if (phy > 32) {
- printk(KERN_NOTICE " No MII transceivers found!\n");
+ netdev_notice(dev, "No MII transceivers found!\n");
goto failed;
}
i = mdio_read(ioaddr, lp->phys, 16) | 0x40;
@@ -450,21 +487,19 @@ static int tc574_config(struct pcmcia_device *link)
SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) {
- printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
+ netdev_notice(dev, "register_netdev() failed\n");
link->dev_node = NULL;
goto failed;
}
strcpy(lp->node.dev_name, dev->name);
- printk(KERN_INFO "%s: %s at io %#3lx, irq %d, "
- "hw_addr %pM.\n",
- dev->name, cardname, dev->base_addr, dev->irq,
- dev->dev_addr);
- printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n",
- 8 << config & Ram_size,
- ram_split[(config & Ram_split) >> Ram_split_shift],
- config & Autoselect ? "autoselect " : "");
+ netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
+ cardname, dev->base_addr, dev->irq, dev->dev_addr);
+ netdev_info(dev, "%dK FIFO split %s Rx:Tx, %sMII interface\n",
+ 8 << config & Ram_size,
+ ram_split[(config & Ram_split) >> Ram_split_shift],
+ config & Autoselect ? "autoselect " : "");
return 0;
@@ -510,15 +545,15 @@ static int tc574_resume(struct pcmcia_device *link)
static void dump_status(struct net_device *dev)
{
unsigned int ioaddr = dev->base_addr;
+
EL3WINDOW(1);
- printk(KERN_INFO " irq status %04x, rx status %04x, tx status "
- "%02x, tx free %04x\n", inw(ioaddr+EL3_STATUS),
- inw(ioaddr+RxStatus), inb(ioaddr+TxStatus),
- inw(ioaddr+TxFree));
+ netdev_info(dev, "irq status %04x, rx status %04x, tx status %02x, tx free %04x\n",
+ inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus),
+ inb(ioaddr+TxStatus), inw(ioaddr+TxFree));
EL3WINDOW(4);
- printk(KERN_INFO " diagnostics: fifo %04x net %04x ethernet %04x"
- " media %04x\n", inw(ioaddr+0x04), inw(ioaddr+0x06),
- inw(ioaddr+0x08), inw(ioaddr+0x0a));
+ netdev_info(dev, "diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
+ inw(ioaddr+0x04), inw(ioaddr+0x06),
+ inw(ioaddr+0x08), inw(ioaddr+0x0a));
EL3WINDOW(1);
}
@@ -528,11 +563,13 @@ static void dump_status(struct net_device *dev)
static void tc574_wait_for_completion(struct net_device *dev, int cmd)
{
int i = 1500;
+
outw(cmd, dev->base_addr + EL3_CMD);
while (--i > 0)
- if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
+ if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000))
+ break;
if (i == 0)
- printk(KERN_NOTICE "%s: command 0x%04x did not complete!\n", dev->name, cmd);
+ netdev_notice(dev, "command 0x%04x did not complete!\n", cmd);
}
/* Read a word from the EEPROM using the regular EEPROM access register.
@@ -541,6 +578,7 @@ static void tc574_wait_for_completion(struct net_device *dev, int cmd)
static unsigned short read_eeprom(unsigned int ioaddr, int index)
{
int timer;
+
outw(EEPROM_Read + index, ioaddr + Wn0EepromCmd);
/* Pause for at least 162 usec for the read to take place. */
for (timer = 1620; timer >= 0; timer--) {
@@ -589,17 +627,19 @@ static int mdio_read(unsigned int ioaddr, int phy_id, int location)
/* Shift the read command bits out. */
for (i = 14; i >= 0; i--) {
- int dataval = (read_cmd&(1<<i)) ? MDIO_DATA_WRITE1 : MDIO_DATA_WRITE0;
+ int dataval = (read_cmd & (1 << i))
+ ? MDIO_DATA_WRITE1 : MDIO_DATA_WRITE0;
outw(dataval, mdio_addr);
outw(dataval | MDIO_SHIFT_CLK, mdio_addr);
}
/* Read the two transition, 16 data, and wire-idle bits. */
for (i = 19; i > 0; i--) {
outw(MDIO_ENB_IN, mdio_addr);
- retval = (retval << 1) | ((inw(mdio_addr) & MDIO_DATA_READ) ? 1 : 0);
+ retval = (retval << 1) |
+ ((inw(mdio_addr) & MDIO_DATA_READ) ? 1 : 0);
outw(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr);
}
- return (retval>>1) & 0xffff;
+ return (retval >> 1) & 0xffff;
}
static void mdio_write(unsigned int ioaddr, int phy_id, int location, int value)
@@ -613,7 +653,8 @@ static void mdio_write(unsigned int ioaddr, int phy_id, int location, int value)
/* Shift the command bits out. */
for (i = 31; i >= 0; i--) {
- int dataval = (write_cmd&(1<<i)) ? MDIO_DATA_WRITE1 : MDIO_DATA_WRITE0;
+ int dataval = (write_cmd&(1 << i))
+ ? MDIO_DATA_WRITE1 : MDIO_DATA_WRITE0;
outw(dataval, mdio_addr);
outw(dataval | MDIO_SHIFT_CLK, mdio_addr);
}
@@ -645,7 +686,7 @@ static void tc574_reset(struct net_device *dev)
EL3WINDOW(2);
for (i = 0; i < 6; i++)
outb(dev->dev_addr[i], ioaddr + i);
- for (; i < 12; i+=2)
+ for (; i < 12; i += 2)
outw(0, ioaddr + i);
/* Reset config options */
@@ -659,7 +700,7 @@ static void tc574_reset(struct net_device *dev)
outw(0xc040, ioaddr + Wn3_Options);
EL3WINDOW(1);
spin_unlock_irqrestore(&lp->window_lock, flags);
-
+
tc574_wait_for_completion(dev, TxReset);
tc574_wait_for_completion(dev, RxReset);
mdelay(1);
@@ -680,10 +721,10 @@ static void tc574_reset(struct net_device *dev)
/* .. enable any extra statistics bits.. */
outw(0x0040, ioaddr + Wn4_NetDiag);
-
+
EL3WINDOW(1);
spin_unlock_irqrestore(&lp->window_lock, flags);
-
+
/* .. re-sync MII and re-fill what NWay is advertising. */
mdio_sync(ioaddr, 32);
mdio_write(ioaddr, lp->phys, 4, lp->advertising);
@@ -704,9 +745,10 @@ static void tc574_reset(struct net_device *dev)
outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
/* Ack all pending events, and set active indicator mask. */
outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
- ioaddr + EL3_CMD);
- outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull
- | AdapterFailure | RxEarly, ioaddr + EL3_CMD);
+ ioaddr + EL3_CMD);
+ outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull |
+ AdapterFailure | RxEarly,
+ ioaddr + EL3_CMD);
}
static int el3_open(struct net_device *dev)
@@ -716,27 +758,27 @@ static int el3_open(struct net_device *dev)
if (!pcmcia_dev_present(link))
return -ENODEV;
-
+
link->open++;
netif_start_queue(dev);
-
+
tc574_reset(dev);
lp->media.function = &media_check;
lp->media.data = (unsigned long) dev;
lp->media.expires = jiffies + HZ;
add_timer(&lp->media);
-
- dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
- dev->name, inw(dev->base_addr + EL3_STATUS));
-
+
+ dev_dbg(&link->dev, "%s: opened, status %0x\n",
+ dev->name, inw(dev->base_addr + EL3_STATUS));
+
return 0;
}
static void el3_tx_timeout(struct net_device *dev)
{
unsigned int ioaddr = dev->base_addr;
-
- printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name);
+
+ netdev_notice(dev, "Transmit timed out!\n");
dump_status(dev);
dev->stats.tx_errors++;
dev->trans_start = jiffies;
@@ -750,7 +792,7 @@ static void pop_tx_status(struct net_device *dev)
{
unsigned int ioaddr = dev->base_addr;
int i;
-
+
/* Clear the Tx status stack. */
for (i = 32; i > 0; i--) {
u_char tx_status = inb(ioaddr + TxStatus);
@@ -760,8 +802,8 @@ static void pop_tx_status(struct net_device *dev)
if (tx_status & 0x30)
tc574_wait_for_completion(dev, TxReset);
if (tx_status & 0x38) {
- pr_debug("%s: transmit error: status 0x%02x\n",
- dev->name, tx_status);
+ netdev_dbg(dev, "transmit error: status 0x%02x\n",
+ tx_status);
outw(TxEnable, ioaddr + EL3_CMD);
dev->stats.tx_aborted_errors++;
}
@@ -769,30 +811,28 @@ static void pop_tx_status(struct net_device *dev)
}
}
-static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
- struct net_device *dev)
+static netdev_tx_t el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
unsigned int ioaddr = dev->base_addr;
struct el3_private *lp = netdev_priv(dev);
unsigned long flags;
- pr_debug("%s: el3_start_xmit(length = %ld) called, "
- "status %4.4x.\n", dev->name, (long)skb->len,
- inw(ioaddr + EL3_STATUS));
+ netdev_dbg(dev, "el3_start_xmit(length = %ld) called, status %04x\n",
+ (long)skb->len, inw(ioaddr + EL3_STATUS));
spin_lock_irqsave(&lp->window_lock, flags);
outw(skb->len, ioaddr + TX_FIFO);
outw(0, ioaddr + TX_FIFO);
- outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3)>>2);
+ outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3) >> 2);
dev->trans_start = jiffies;
/* TxFree appears only in Window 1, not offset 0x1c. */
if (inw(ioaddr + TxFree) <= 1536) {
netif_stop_queue(dev);
- /* Interrupt us when the FIFO has room for max-sized packet.
+ /* Interrupt us when the FIFO has room for max-sized packet.
The threshold is in units of dwords. */
- outw(SetTxThreshold + (1536>>2), ioaddr + EL3_CMD);
+ outw(SetTxThreshold + (1536 >> 2), ioaddr + EL3_CMD);
}
pop_tx_status(dev);
@@ -815,16 +855,15 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
return IRQ_NONE;
ioaddr = dev->base_addr;
- pr_debug("%s: interrupt, status %4.4x.\n",
- dev->name, inw(ioaddr + EL3_STATUS));
+ netdev_dbg(dev, "interrupt, status %04x\n", inw(ioaddr + EL3_STATUS));
spin_lock(&lp->window_lock);
-
+
while ((status = inw(ioaddr + EL3_STATUS)) &
(IntLatch | RxComplete | RxEarly | StatsFull)) {
if (!netif_device_present(dev) ||
- ((status & 0xe000) != 0x2000)) {
- pr_debug("%s: Interrupt from dead card\n", dev->name);
+ ((status & 0xe000) != 0x2000)) {
+ netdev_dbg(dev, "Interrupt from dead card\n");
break;
}
@@ -834,7 +873,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
work_budget = el3_rx(dev, work_budget);
if (status & TxAvailable) {
- pr_debug(" TX room bit was handled.\n");
+ netdev_dbg(dev, "TX room bit was handled\n");
/* There's room in the FIFO for a full-sized packet. */
outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
netif_wake_queue(dev);
@@ -856,8 +895,8 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
EL3WINDOW(4);
fifo_diag = inw(ioaddr + Wn4_FIFODiag);
EL3WINDOW(1);
- printk(KERN_NOTICE "%s: adapter failure, FIFO diagnostic"
- " register %04x.\n", dev->name, fifo_diag);
+ netdev_notice(dev, "adapter failure, FIFO diagnostic register %04x\n",
+ fifo_diag);
if (fifo_diag & 0x0400) {
/* Tx overrun */
tc574_wait_for_completion(dev, TxReset);
@@ -874,8 +913,8 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
}
if (--work_budget < 0) {
- pr_debug("%s: Too much work in interrupt, "
- "status %4.4x.\n", dev->name, status);
+ netdev_dbg(dev, "Too much work in interrupt, status %04x\n",
+ status);
/* Clear all interrupts */
outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
break;
@@ -884,9 +923,9 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
}
- pr_debug("%s: exiting interrupt, status %4.4x.\n",
- dev->name, inw(ioaddr + EL3_STATUS));
-
+ netdev_dbg(dev, "exiting interrupt, status %04x\n",
+ inw(ioaddr + EL3_STATUS));
+
spin_unlock(&lp->window_lock);
return IRQ_RETVAL(handled);
}
@@ -906,12 +945,13 @@ static void media_check(unsigned long arg)
if (!netif_device_present(dev))
goto reschedule;
-
+
/* Check for pending interrupt with expired latency timer: with
this, we can limp along even if the interrupt is blocked */
- if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) {
+ if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
+ (inb(ioaddr + Timer) == 0xff)) {
if (!lp->fast_poll)
- printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name);
+ netdev_info(dev, "interrupt(s) dropped!\n");
local_irq_save(flags);
el3_interrupt(dev->irq, dev);
@@ -931,39 +971,38 @@ static void media_check(unsigned long arg)
media = mdio_read(ioaddr, lp->phys, 1);
partner = mdio_read(ioaddr, lp->phys, 5);
EL3WINDOW(1);
-
+
if (media != lp->media_status) {
if ((media ^ lp->media_status) & 0x0004)
- printk(KERN_INFO "%s: %s link beat\n", dev->name,
- (lp->media_status & 0x0004) ? "lost" : "found");
+ netdev_info(dev, "%s link beat\n",
+ (lp->media_status & 0x0004)
+ ? "lost" : "found");
if ((media ^ lp->media_status) & 0x0020) {
lp->partner = 0;
if (lp->media_status & 0x0020) {
- printk(KERN_INFO "%s: autonegotiation restarted\n",
- dev->name);
+ netdev_info(dev, "autonegotiation restarted\n");
} else if (partner) {
partner &= lp->advertising;
lp->partner = partner;
- printk(KERN_INFO "%s: autonegotiation complete: "
- "%sbaseT-%cD selected\n", dev->name,
- ((partner & 0x0180) ? "100" : "10"),
- ((partner & 0x0140) ? 'F' : 'H'));
+ netdev_info(dev, "autonegotiation complete: %sbaseT-%cD selected\n",
+
+ ((partner & 0x0180) ? "100" : "10"),
+ ((partner & 0x0140) ? 'F' : 'H'));
} else {
- printk(KERN_INFO "%s: link partner did not autonegotiate\n",
- dev->name);
+ netdev_info(dev, "link partner did not autonegotiate\n");
}
EL3WINDOW(3);
outb((partner & 0x0140 ? 0x20 : 0) |
- (dev->mtu > 1500 ? 0x40 : 0), ioaddr + Wn3_MAC_Ctrl);
+ (dev->mtu > 1500 ? 0x40 : 0),
+ ioaddr + Wn3_MAC_Ctrl);
EL3WINDOW(1);
}
if (media & 0x0010)
- printk(KERN_INFO "%s: remote fault detected\n",
- dev->name);
+ netdev_info(dev, "remote fault detected\n");
if (media & 0x0002)
- printk(KERN_INFO "%s: jabber detected\n", dev->name);
+ netdev_info(dev, "jabber detected\n");
lp->media_status = media;
}
spin_unlock_irqrestore(&lp->window_lock, flags);
@@ -995,33 +1034,33 @@ static void update_stats(struct net_device *dev)
unsigned int ioaddr = dev->base_addr;
u8 rx, tx, up;
- pr_debug("%s: updating the statistics.\n", dev->name);
+ netdev_dbg(dev, "updating the statistics\n");
if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */
return;
-
+
/* Unlike the 3c509 we need not turn off stats updates while reading. */
/* Switch to the stats window, and read everything. */
EL3WINDOW(6);
- dev->stats.tx_carrier_errors += inb(ioaddr + 0);
+ dev->stats.tx_carrier_errors += inb(ioaddr + 0);
dev->stats.tx_heartbeat_errors += inb(ioaddr + 1);
- /* Multiple collisions. */ inb(ioaddr + 2);
+ /* Multiple collisions. */ inb(ioaddr + 2);
dev->stats.collisions += inb(ioaddr + 3);
dev->stats.tx_window_errors += inb(ioaddr + 4);
dev->stats.rx_fifo_errors += inb(ioaddr + 5);
dev->stats.tx_packets += inb(ioaddr + 6);
- up = inb(ioaddr + 9);
+ up = inb(ioaddr + 9);
dev->stats.tx_packets += (up&0x30) << 4;
/* Rx packets */ inb(ioaddr + 7);
/* Tx deferrals */ inb(ioaddr + 8);
- rx = inw(ioaddr + 10);
+ rx = inw(ioaddr + 10);
tx = inw(ioaddr + 12);
EL3WINDOW(4);
/* BadSSD */ inb(ioaddr + 12);
up = inb(ioaddr + 13);
- dev->stats.tx_bytes += tx + ((up & 0xf0) << 12);
+ dev->stats.tx_bytes += tx + ((up & 0xf0) << 12);
EL3WINDOW(1);
}
@@ -1030,22 +1069,34 @@ static int el3_rx(struct net_device *dev, int worklimit)
{
unsigned int ioaddr = dev->base_addr;
short rx_status;
-
- pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
- dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
+
+ netdev_dbg(dev, "in rx_packet(), status %04x, rx_status %04x\n",
+ inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
- worklimit > 0) {
+ worklimit > 0) {
worklimit--;
if (rx_status & 0x4000) { /* Error, update stats. */
short error = rx_status & 0x3800;
dev->stats.rx_errors++;
switch (error) {
- case 0x0000: dev->stats.rx_over_errors++; break;
- case 0x0800: dev->stats.rx_length_errors++; break;
- case 0x1000: dev->stats.rx_frame_errors++; break;
- case 0x1800: dev->stats.rx_length_errors++; break;
- case 0x2000: dev->stats.rx_frame_errors++; break;
- case 0x2800: dev->stats.rx_crc_errors++; break;
+ case 0x0000:
+ dev->stats.rx_over_errors++;
+ break;
+ case 0x0800:
+ dev->stats.rx_length_errors++;
+ break;
+ case 0x1000:
+ dev->stats.rx_frame_errors++;
+ break;
+ case 0x1800:
+ dev->stats.rx_length_errors++;
+ break;
+ case 0x2000:
+ dev->stats.rx_frame_errors++;
+ break;
+ case 0x2800:
+ dev->stats.rx_crc_errors++;
+ break;
}
} else {
short pkt_len = rx_status & 0x7ff;
@@ -1053,19 +1104,19 @@ static int el3_rx(struct net_device *dev, int worklimit)
skb = dev_alloc_skb(pkt_len+5);
- pr_debug(" Receiving packet size %d status %4.4x.\n",
- pkt_len, rx_status);
+ netdev_dbg(dev, "Receiving packet size %d status %04x\n",
+ pkt_len, rx_status);
if (skb != NULL) {
skb_reserve(skb, 2);
- insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len),
- ((pkt_len+3)>>2));
+ insl(ioaddr + RX_FIFO, skb_put(skb, pkt_len),
+ ((pkt_len+3) >> 2));
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
} else {
- pr_debug("%s: couldn't allocate a sk_buff of"
- " size %d.\n", dev->name, pkt_len);
+ netdev_dbg(dev, "couldn't allocate a sk_buff of size %d\n",
+ pkt_len);
dev->stats.rx_dropped++;
}
}
@@ -1093,41 +1144,39 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
struct mii_ioctl_data *data = if_mii(rq);
int phy = lp->phys & 0x1f;
- pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
- dev->name, rq->ifr_ifrn.ifrn_name, cmd,
- data->phy_id, data->reg_num, data->val_in, data->val_out);
+ netdev_dbg(dev, "In ioct(%-.6s, %#04x) %04x %04x %04x %04x\n",
+ rq->ifr_ifrn.ifrn_name, cmd,
+ data->phy_id, data->reg_num, data->val_in, data->val_out);
- switch(cmd) {
+ switch (cmd) {
case SIOCGMIIPHY: /* Get the address of the PHY in use. */
data->phy_id = phy;
- case SIOCGMIIREG: /* Read the specified MII register. */
- {
- int saved_window;
- unsigned long flags;
-
- spin_lock_irqsave(&lp->window_lock, flags);
- saved_window = inw(ioaddr + EL3_CMD) >> 13;
- EL3WINDOW(4);
- data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f,
- data->reg_num & 0x1f);
- EL3WINDOW(saved_window);
- spin_unlock_irqrestore(&lp->window_lock, flags);
- return 0;
- }
- case SIOCSMIIREG: /* Write the specified MII register */
- {
- int saved_window;
- unsigned long flags;
-
- spin_lock_irqsave(&lp->window_lock, flags);
- saved_window = inw(ioaddr + EL3_CMD) >> 13;
- EL3WINDOW(4);
- mdio_write(ioaddr, data->phy_id & 0x1f,
- data->reg_num & 0x1f, data->val_in);
- EL3WINDOW(saved_window);
- spin_unlock_irqrestore(&lp->window_lock, flags);
- return 0;
- }
+ case SIOCGMIIREG: { /* Read the specified MII register. */
+ int saved_window;
+ unsigned long flags;
+
+ spin_lock_irqsave(&lp->window_lock, flags);
+ saved_window = inw(ioaddr + EL3_CMD) >> 13;
+ EL3WINDOW(4);
+ data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f,
+ data->reg_num & 0x1f);
+ EL3WINDOW(saved_window);
+ spin_unlock_irqrestore(&lp->window_lock, flags);
+ return 0;
+ }
+ case SIOCSMIIREG: { /* Write the specified MII register */
+ int saved_window;
+ unsigned long flags;
+
+ spin_lock_irqsave(&lp->window_lock, flags);
+ saved_window = inw(ioaddr + EL3_CMD) >> 13;
+ EL3WINDOW(4);
+ mdio_write(ioaddr, data->phy_id & 0x1f,
+ data->reg_num & 0x1f, data->val_in);
+ EL3WINDOW(saved_window);
+ spin_unlock_irqrestore(&lp->window_lock, flags);
+ return 0;
+ }
default:
return -EOPNOTSUPP;
}
@@ -1144,14 +1193,13 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static void set_rx_mode(struct net_device *dev)
{
unsigned int ioaddr = dev->base_addr;
+ enum el3_cmds filters = SetRxFilter | RxStation | RxBroadcast;
if (dev->flags & IFF_PROMISC)
- outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm,
- ioaddr + EL3_CMD);
+ filters |= RxMulticast | RxProm;
else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI))
- outw(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD);
- else
- outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD);
+ filters |= RxMulticast;
+ outw(filters, ioaddr + EL3_CMD);
}
static void set_multicast_list(struct net_device *dev)
@@ -1170,18 +1218,18 @@ static int el3_close(struct net_device *dev)
struct el3_private *lp = netdev_priv(dev);
struct pcmcia_device *link = lp->p_dev;
- dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
-
+ netdev_dbg(dev, "shutting down ethercard\n");
+
if (pcmcia_dev_present(link)) {
unsigned long flags;
/* Turn off statistics ASAP. We update lp->stats below. */
outw(StatsDisable, ioaddr + EL3_CMD);
-
+
/* Disable the receiver and transmitter. */
outw(RxDisable, ioaddr + EL3_CMD);
outw(TxDisable, ioaddr + EL3_CMD);
-
+
/* Note: Switching to window 0 may disable the IRQ. */
EL3WINDOW(0);
spin_lock_irqsave(&lp->window_lock, flags);
^ permalink raw reply related
* Re: [PATCH 1/6] sysfs: Basic support for multiple super blocks
From: Eric Dumazet @ 2010-03-30 19:23 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Greg Kroah-Hartman, Kay Sievers, linux-kernel, Tejun Heo,
Cornelia Huck, linux-fsdevel, Benjamin LaHaise, Serge Hallyn,
netdev
In-Reply-To: <1269973889-25260-1-git-send-email-ebiederm@xmission.com>
Le mardi 30 mars 2010 à 11:31 -0700, Eric W. Biederman a écrit :
> From: Eric W. Biederman <ebiederm@xmission.com>
>
> Add all of the necessary bioler plate to support
> multiple superblocks in sysfs.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
> fs/sysfs/mount.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> fs/sysfs/sysfs.h | 3 ++
> 2 files changed, 59 insertions(+), 2 deletions(-)
>
> diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
> index 0cb1088..6a433ac 100644
> --- a/fs/sysfs/mount.c
> +++ b/fs/sysfs/mount.c
> @@ -71,16 +71,70 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
> return 0;
> }
>
> +static int sysfs_test_super(struct super_block *sb, void *data)
> +{
> + struct sysfs_super_info *sb_info = sysfs_info(sb);
> + struct sysfs_super_info *info = data;
> + int found = 1;
> + return found;
> +}
> +
> +static int sysfs_set_super(struct super_block *sb, void *data)
> +{
> + int error;
> + error = set_anon_super(sb, data);
> + if (!error)
> + sb->s_fs_info = data;
> + return error;
> +}
> +
> static int sysfs_get_sb(struct file_system_type *fs_type,
> int flags, const char *dev_name, void *data, struct vfsmount *mnt)
> {
> - return get_sb_single(fs_type, flags, data, sysfs_fill_super, mnt);
> + struct sysfs_super_info *info;
> + struct super_block *sb;
> + int error;
> +
> + error = -ENOMEM;
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info)
> + goto out;
> + sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info);
> + if (IS_ERR(sb) || sb->s_fs_info != info)
> + kfree(info);
> + if (IS_ERR(sb)) {
> + kfree(info);
double kfree(info) ?
> + error = PTR_ERR(sb);
> + goto out;
> + }
> +
^ permalink raw reply
* Re: [PATCH 0/6] tagged sysfs support
From: Kay Sievers @ 2010-03-30 18:53 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Greg Kroah-Hartman, Greg KH, linux-kernel, Tejun Heo,
Cornelia Huck, linux-fsdevel, Eric Dumazet, Benjamin LaHaise,
Serge Hallyn, netdev
In-Reply-To: <m1fx3hk6gw.fsf@fess.ebiederm.org>
On Tue, Mar 30, 2010 at 20:30, Eric W. Biederman <ebiederm@xmission.com> wrote:
>
> The main short coming of using multiple network namespaces today
> is that only network devices for the primary network namespaces
> can be put in the kobject layer and sysfs.
>
> This is essentially the earlier version of this patchset that was
> reviewed before, just now on top of a version of sysfs that doesn't
> need cleanup patches to support it.
Just to check if we are not in conflict with planned changes, and how
to possibly handle them:
There is the plan and ongoing work to unify classes and buses, export
them at /sys/subsystem in the same layout of the current /sys/bus/.
The decision to export buses and classes as two different things
(which they aren't) is the last major piece in the sysfs layout which
needs to be fixed.
It would mean that /sys/subsystem/net/devices/* would look like
/sys/class/net/* today. But at the /sys/subsystem/net/ directory could
be global network-subsystem-wide control files which would need to be
namespaced too. (The network subsystem does not use subsytem-global
files today, but a bunch of other classes do.)
This could be modeled into the current way of doing sysfs namespaces?
A /sys/bus/<subsystem>/ directory hierarchy would need to be
namespaced, not just a single plain directory with symlinks. Would
that work?
Thanks,
Kay
^ permalink raw reply
* [PATCH 6/6] net: Hook up cxgb4 to Kconfig and Makefile
From: Dimitris Michailidis @ 2010-03-30 18:52 UTC (permalink / raw)
To: netdev; +Cc: Dimitris Michailidis
In-Reply-To: <1269975142-30896-6-git-send-email-dm@chelsio.com>
Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
---
drivers/net/Kconfig | 25 +++++++++++++++++++++++++
drivers/net/Makefile | 1 +
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 4f1f974..944ffd1 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2582,6 +2582,31 @@ config CHELSIO_T3
To compile this driver as a module, choose M here: the module
will be called cxgb3.
+config CHELSIO_T4_DEPENDS
+ tristate
+ depends on PCI && INET
+ default y
+
+config CHELSIO_T4
+ tristate "Chelsio Communications T4 Ethernet support"
+ depends on CHELSIO_T4_DEPENDS
+ select FW_LOADER
+ select MDIO
+ help
+ This driver supports Chelsio T4-based gigabit and 10Gb Ethernet
+ adapters.
+
+ For general information about Chelsio and our products, visit
+ our website at <http://www.chelsio.com>.
+
+ For customer support, please visit our customer support page at
+ <http://www.chelsio.com/support.htm>.
+
+ Please send feedback to <linux-bugs@chelsio.com>.
+
+ To compile this driver as a module choose M here; the module
+ will be called cxgb4.
+
config EHEA
tristate "eHEA Ethernet support"
depends on IBMEBUS && INET && SPARSEMEM
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 4788862..a583b50 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_IXGB) += ixgb/
obj-$(CONFIG_IP1000) += ipg.o
obj-$(CONFIG_CHELSIO_T1) += chelsio/
obj-$(CONFIG_CHELSIO_T3) += cxgb3/
+obj-$(CONFIG_CHELSIO_T4) += cxgb4/
obj-$(CONFIG_EHEA) += ehea/
obj-$(CONFIG_CAN) += can/
obj-$(CONFIG_BONDING) += bonding/
--
1.5.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox