wolf [Wed, 25 Nov 2009 11:18:22 +0000 (11:18 +0000)]
can-utils: canfdtest, a full duplex test to find out-of-order messages
This patch is a pepped up version of Valdislav's canecho_gen and
canecho_dut test programs, which have prooved to be useful for
detecting out-of-order message transmisson and reception. Here
is a list of the changes and improvements:
- Both programs have been merged into on test program named
canfdtest. Message generation can be selected via the command
line option '-g'.
- The test loop count can be specified.
- A low and high verbosity level has been added.
- send/recv is used instead of write/read.
- The return code of send/recv is checked properly.
- Use Linux coding style.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1088 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 21 Nov 2009 20:28:17 +0000 (20:28 +0000)]
net: Support specifying the network namespace upon device creation.
There is no good reason to not support userspace specifying the
network namespace during device creation, and it makes it easier
to create a network device and pass it to a child network namespace
with a well known name.
We have to be careful to ensure that the target network namespace
for the new device exists through the life of the call. To keep
that logic clear I have factored out the network namespace grabbing
logic into rtnl_link_get_net.
In addtion we need to continue to pass the source network namespace
to the rtnl_link_ops.newlink method so that we can find the base
device source network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1085 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 21 Nov 2009 20:20:17 +0000 (20:20 +0000)]
can: Fix driver Kconfig structure
In 2.6.32-rc the new EMS USB CAN driver was contributed and added the Kconfig
entry right behind an entry of the same *vendor*. This teared the SJA1000
based driver selection into pieces.
This fix cleans up the 2.6.32-rc Kconfig files for the CAN drivers and moves
the SJA1000 and USB Kconfig portions into the belonging directories.
As there are many new CAN drivers in the queue getting this cleanup into
2.6.32-rc would massively reduce the problems for the upcoming drivers.
wolf [Mon, 16 Nov 2009 22:09:58 +0000 (22:09 +0000)]
can: add the missing netlink get_xstats_size callback
This patch adds the missing "get_xstats_size" callback for the
netlink interface, which is required if "fill_xstats" is used,
as pointed out by Patrick McHardy.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1082 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 11 Nov 2009 06:38:03 +0000 (06:38 +0000)]
Add MODULE_FIRMWARE definitions.
These definitions should IMO live next to the card descriptions, which should
in turn live in the modules that actually drive the cards.
Therefore, this patch moves all PCMCIA card descriptions
& MODULE_FIRMWARE statements into softing_cs.
Before this patch, the card description was looked up twice.
The pc104 descriptions (which have not yet been tested) have no seperate
module to go into, and live still in softing_fw.c
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@skynet.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1080 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sun, 8 Nov 2009 17:29:22 +0000 (17:29 +0000)]
bcm_proc_getifname() is called with RTNL and dev_base_lock
not held. It calls __dev_get_by_index() without locks, and
this is illegal (might crash)
Close the race by holding dev_base_lock and copying dev->name
in the protected section.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=6755aebaaf9fc5416acfd4578ab7a1e122ecbc74
wolf [Sun, 8 Nov 2009 13:48:06 +0000 (13:48 +0000)]
can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo()
On older kernels, e.g. 2.6.27, a WARN_ON dump in rtmsg_ifinfo()
is thrown when the CAN device is registered due to insufficient
skb space, as reported by various users. This patch adds the
rtnl_link_ops "get_size" to fix the problem. I think it's
required for more recent kernels as well, even if no WARN_ON
dumps are triggered. Maybe we also need it for the CAN xstats.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1078 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 6 Nov 2009 16:54:18 +0000 (16:54 +0000)]
In 2.6.32+ the setsockopt function provides an unsigned optlen.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b7058842c940ad2c08dd829b21e5c92ebe3b8758
hartkopp [Fri, 6 Nov 2009 15:46:21 +0000 (15:46 +0000)]
Added channel information in sysfs.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1076 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 6 Nov 2009 15:32:27 +0000 (15:32 +0000)]
- Fix 64bit division for 32bit systems.
- Fix compile warning in dev_dbg() output
- Added include of <linux/sched.h> needed in 2.6.32
- Reordered timestamp functions to prevent a forward declaration.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1075 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Thu, 5 Nov 2009 16:33:04 +0000 (16:33 +0000)]
mscan: do not set err value on slprq timeout
If the RXACT flag is not cleared on the mscan, the slprq will eventually
fail. This could be the situation when some opposite is keeping resending
frames because of some communication errors. This way we will the initrq or
cswai will also not be set and the mscan controller will got stuck till
the bus is restarted. To avoid this we kick out setting the err value beyong a
slprq failure to let the controller proceed. This is hacky since calling e.g.
initrq while the mscan is really doing stuffs might disturb the bus
communication. For now we however don't have other possiblities to work around
the behaviour of mscan mentioned above.
Chanages to V1: turn dev_warn to dev_dbg. put part of the warning messages into
the comment
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1073 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Mon, 26 Oct 2009 10:54:44 +0000 (10:54 +0000)]
sja1000: fix improper library functions for skb allocation usage
The commit 1068 "can: provide library functions for skb allocation" did
forget to remove two line of the SJA1000 driver resulting in a
'skb_over_panic' when calling skb_put.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1071 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Thu, 15 Oct 2009 08:36:11 +0000 (08:36 +0000)]
Wrap the CAN include/linux header files to include/socketcan
To avoid conflicts with the *almost* similar kernel include files we
use a separate set of header files in include/socketcan (instead of
include/linux). But the include/linux header files are still needed
for the user space applications, e.g. the can-utils. To simplify
maintanance, wrappers to the corresponding files in include/socketcan
are used. Kernel-only header files are removed from include/linux.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1070 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 8 Oct 2009 10:41:01 +0000 (10:41 +0000)]
Rework of can_if start script:
- make use of 'ip' tool from iproute2 package
- support Debian depency start scripts
- support setting of bitrates and restart-ms
- remove created vcan devices at shutdown
wolf [Wed, 7 Oct 2009 17:37:57 +0000 (17:37 +0000)]
can: provide library functions for skb allocation
This patch makes the private functions alloc_can_skb() and
alloc_can_err_skb() of the at91_can driver public and adapts all
drivers to use these. While making the patch I realized, that
the skb's are *not* setup consistently. The skb's are now setup
as shown:
wolf [Tue, 22 Sep 2009 08:08:15 +0000 (08:08 +0000)]
can: make the number of echo skb's configurable
This patch allows the CAN controller driver to define the number
of echo skb's used for the local loopback (echo), as suggested by
Kurt, via:
struct net_device *alloc_candev(int sizeof_priv,
unsigned int echo_skb_max);
The drivers have been adapted accordingly. Please check if the
value of echo_skb_max is OK for your driver.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1061 030b6a49-0b11-0410-94ab-b0dab22257f2
An out-of-order TX message problem has been reported and demonstrated
by Vladislav. The TX message buffers were not handled properly if
just one message was pending. This patch remembers the id of the buffer
used previously and increase the buffer priority if the next one has a
lower id number. This allows up to approx. 3*256 messages to be sent
until the lowest buffer priority of 255 is reached.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1059 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Tue, 15 Sep 2009 18:42:01 +0000 (18:42 +0000)]
sja1000: fix network statistics update
The member "tx_bytes" of "struct net_device_stats" should be
incremented when the interrupt is done and an "arbitration
lost error" is a TX error and the statistics should be updated
accordingly.
wolf [Tue, 15 Sep 2009 18:25:47 +0000 (18:25 +0000)]
at91_can: add NAPI support fix error and bus off handling
This patch updates the at91_can driver it features:
- NAPI for rx and error packages
(tx and state changes stay in irq handler)
- implemented bus off and errror handling conforming to the
Linux CAN API
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1056 030b6a49-0b11-0410-94ab-b0dab22257f2
When using nanosleep() in an userspace application we get a ratelimit warning
NOHZ: local_softirq_pending 08
for 10 times.
The echo of CAN frames is done from process context and softirq context only.
Therefore the usage of netif_rx() was wrong (for years).
This patch replaces netif_rx() with netif_rx_ni() which has to be used from
process/softirq context. It also adds a missing comment that can_send() must
no be used from hardirq context.
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Also in mainline.
hartkopp [Mon, 31 Aug 2009 12:16:26 +0000 (12:16 +0000)]
Update minor changes from mainline, e.g.
can: switch carrier on if device was stopped while in bus-off state
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=1b0d92244ff2434a98272f6d2525da32fc230f19
And reorder of can_update_spt() in can_calc_bittiming().
To ensure a proper handling of CAN frames transported in skbuffs some checks
need to be performed at receive time.
As stated by Michael Olbrich and Luotao Fu BUG_ON() might be to restrictive.
This is right as we can just drop the non conform skbuff and the Kernel can
continue working.
This patch replaces the BUG_ON() with a WARN_ONCE() so that the system remains
healthy but we made the problem visible (once).
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: Urs Thuermann <urs@isnogud.escape.de> CC: Michael Olbrich <m.olbrich@pengutronix.de> CC: Luotao Fu <l.fu@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1039 030b6a49-0b11-0410-94ab-b0dab22257f2
Signed-off-by: Lothar Wassmann <LW@KARO-electronics.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1033 030b6a49-0b11-0410-94ab-b0dab22257f2
Signed-off-by: Lothar Wassmann <LW@KARO-electronics.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1032 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Tue, 2 Jun 2009 11:55:06 +0000 (11:55 +0000)]
dev: Use minimal set of SYSFS flies for intelligent CAN controllers
Active or intelligent CAN controllers do the setting of the bit-timing
internally rendering most of the standard bit-timing parameters for
the passive CAN controllers unnecessary. Usually just an index to a
fixed bit-time setting can be selected. For this purpose, just the
SYSFS file "can_bittiming/bitrate" will be created, if the CAN
bit-timing constants are not provided for the device.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@984 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Tue, 5 May 2009 09:00:33 +0000 (09:00 +0000)]
As the original code was already under GPL the additional license information was removed.
Also moved the dual license BSD/GPL to only GPL.
Added some information about N_SLCAN in precompiled Kernels provided by Lionel Saugrain.
For the Network Drop Monitor introduced in 2.6.30 by Neil Horman the
end-of-line points for skbs that are not dropped due to errors should
use consume_skb() instead of kfree_skb() to not be monitored as a 'drop'.
wolf [Mon, 6 Apr 2009 10:59:05 +0000 (10:59 +0000)]
AT91SAM9263 CAN driver taken from Marc's GIT repository
(http://pasiphae.extern.pengutronix.de/?p=mkl/linux-can;a=summary)
commit id 95742fd12484176ecaa7c54a1d08e744fac487e3
and adapted to work with the latest SVN version 963 of SocketCAN
according to SJA1000 driver. Changes:
- change register_netdev() to register_candev()
- fix bittiming constants to enable bitrates up to 1000000 bps
- some cosmetic changes and spelling errors fixes
wolf [Wed, 18 Feb 2009 18:38:12 +0000 (18:38 +0000)]
SJA1000: generic OF platform bus driver
This patch adds a generic driver for SJA1000 chips on the OpenFirmware
platform bus found on embedded PowerPC systems. You need a SJA1000 node
definition in your flattened device tree source (DTS) file similar to:
wolf [Tue, 17 Feb 2009 11:02:09 +0000 (11:02 +0000)]
Use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL for drivers
As suggested by Sam, the safer approach is to be more restrictive.
If we later decide we want to support non-gpl we can be less restrictive.
Therefore let's go for the GPL version of the exports for now.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@953 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sun, 15 Feb 2009 17:40:32 +0000 (17:40 +0000)]
Spagetti code cleanup:
Moved conversions into separate functions can2pty() and pty2can().
Updated and enhanced some comments.
Variable name cleanups inside the separate functions.
Fix handling on wrong pty commands (was a wrong 'continue' statement).
wolf [Sun, 15 Feb 2009 10:38:25 +0000 (10:38 +0000)]
Prelimary quilt patch stack for including the device drivers interface
This is a prelimary quilt patch stack to include the CAN network
device driver interface and some drivers into Linux kernel. It is
based on the netdev GIT tree currently at version 2.6.29-rcX:
wolf [Sat, 14 Feb 2009 14:35:38 +0000 (14:35 +0000)]
Enable device dev_dbg with CONFIG_CAN_DEBUG_DEVICES
The following patch allows to enable CAN device debug messages via
CONFIG_CAN_DEBUG_DEVICES and adds some useful dev_dbg() to dev.c,
sja1000.c and mscan.c.
The old MSCAN driver used dev_dbg() the heavy way, e.g. printing
messages for each message sent and received. I think that's only
useful for development.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@942 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 14 Feb 2009 14:32:35 +0000 (14:32 +0000)]
MSCAN/MPC52xx: copyright note fixes and beautification
I restricted the copyright to GPL v2 and added a copyright line for myself.
Furthermore, I changed the file header to a more usual format. I also
changed the MODULE_AUTHOR in mpc52xx_can.c to myself for my re-written
version using the OF platform.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@941 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 14 Feb 2009 14:31:34 +0000 (14:31 +0000)]
dev.c: cleanup and name changes and more doc
This patch briefly documents exported functions of the CAN device
driver interface. I also changed the module description to "CAN
network device driver interface" because it's more appropriate than
"CAN netdevice library", I think. Comments?
Finally, I fix the issue marked with "#ifdef FIXME".
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@940 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 14 Feb 2009 14:29:41 +0000 (14:29 +0000)]
drivers/net/can/Kconfig cleanup and beautification
This patch fixes some white space issues and uses consequently the tag
"---help---" for help text. Furthermore it changes the type of
CAN_CALC_BITTIMING to "bool".
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@938 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 6 Feb 2009 10:03:54 +0000 (10:03 +0000)]
Added CONFIG_CAN_CALC_BITTIMING to be defined by default when compiling
CAN drivers on the SVN trunk. This fixes an issue caused by commit r920:
"Make CAN bit-timing calculation configurable"