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"
wolf [Sun, 1 Feb 2009 15:26:56 +0000 (15:26 +0000)]
SJA1000: remove unnecessary debugging code
For kernel inclusion, we need to cleanup and remove unnecessary
debugging code from the SJA1000 driver. Therefore I removed the
private DBG debugging interface and converted a few DBG calls to
dev_info() or dev_err(), where appropriate. Maybe they can be
removed as well, please check?
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@921 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sun, 1 Feb 2009 15:24:41 +0000 (15:24 +0000)]
Make CAN bit-timing calculation configurable
This patch adds the Kconfig option CAN_CALC_BITTIMING to make the
calculation of bit-timing parameters configurable. Disabling it will
save some space and will allow user space tools to determine proper
bit-timing parameters exclusively.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@920 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 29 Jan 2009 17:04:44 +0000 (17:04 +0000)]
Fix 64bit issue in strtoul() usage reported by Kurt Van Dijck:
The idea is that the (unsigned long *) cast is wrong on 64bit,
therefore, a real unsigned long intermediate variable should be
applied. Before this patch, the can_dlc field was always cleared to 0
again.
Added in the patch is a line that I otherwise needed an ascii table to
understand what was going on. I took the freedom to make it more
programmer-readable wihthout performance penalty :-)
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@919 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 21 Jan 2009 12:45:27 +0000 (12:45 +0000)]
Updated to latest CAN core changes:
From commit r890:
- removed avoidable copy of data in bcm_rx_handler()
- some removal of duplicate code
From commit r894:
Omit unneeded skb_clone() calls.
The AF_CAN core delivered always cloned sk_buffs to the AF_CAN
protocols, although this was _only_ needed by the can-raw protocol.
With this (additionally documented) change, the AF_CAN core calls the
callback functions of the registered AF_CAN protocols with the original
(uncloned) sk_buff pointer and let's the can-raw protocol do the
skb_clone() itself which omits all unneeded skb_clone() calls for other
AF_CAN protocols.
hartkopp [Wed, 21 Jan 2009 10:14:42 +0000 (10:14 +0000)]
Updated to latest CAN core changes:
From commit r890:
- removed avoidable copy of data in bcm_rx_handler()
- some removal of duplicate code
From commit r894:
Omit unneeded skb_clone() calls.
The AF_CAN core delivered always cloned sk_buffs to the AF_CAN
protocols, although this was _only_ needed by the can-raw protocol.
With this (additionally documented) change, the AF_CAN core calls the
callback functions of the registered AF_CAN protocols with the original
(uncloned) sk_buff pointer and let's the can-raw protocol do the
skb_clone() itself which omits all unneeded skb_clone() calls for other
AF_CAN protocols.
hartkopp [Wed, 21 Jan 2009 07:36:32 +0000 (07:36 +0000)]
Revert commit r910: "Added sanity check for received slcan ASCII data."
as this is done with ASCII comparision three lines above.
It obviously was too late yesterday ;-)
hartkopp [Tue, 20 Jan 2009 23:06:01 +0000 (23:06 +0000)]
Added a proof of concept tool 'slcanpty' which
creates a pty for applications using the slcan ASCII protocol and
converts the data to a CAN network interface (and vice versa).
This can be used for existing applications to run on SocketCAN.
wolf [Tue, 20 Jan 2009 18:51:50 +0000 (18:51 +0000)]
MSCAN-MPC52XX: re-write as proper OF driver (/arch/ppc is gone)
Starting with 2.6.28, the /arch/ppc tree is no longer available making
the legacy support obsolete. I took the occasion to re-write the driver
using the proper Open Firmware device driver interface.
Furthermore, MSCAN clock source selection has been enhanced. By default,
the external oscillator clock is now selected where appropriate (for
MPC5200B chips) because it's the better choice according to the MPC5200
user's manual as it has less jitter. The IP bus clock can be selected
via flat device tree property "clock-ipb":
wolf [Tue, 20 Jan 2009 18:50:21 +0000 (18:50 +0000)]
MSCAN: don't use interrrupt sharing
The MSCAN devices use dedicated interrupt sources and therefore
interrupt sharing is not needed. This patch corrects the relevant
flags of request_irq().
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@907 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Tue, 20 Jan 2009 18:48:41 +0000 (18:48 +0000)]
dev: add register_candev() and unregister_candev()
Not all CAN devices are using the CAN device interface, like vcan or
slcan. Providing "struct can_priv" and SYSFS files for them seems
overkill. Because it's awkward to identify a device using the CAN
device interface in the netdev notifier callback, the functions
register_candev() and unregister_candev() have been introduced. All
devices using the CAN device interface should call them instead of
register_netdev() and unregister_netdev().
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
This line, and those below, will be ignored--
M kernel/2.6/include/linux/can/dev.h
M kernel/2.6/drivers/net/can/dev.c
M kernel/2.6/drivers/net/can/mcp251x.c
M kernel/2.6/drivers/net/can/mscan/mscan.c
M kernel/2.6/drivers/net/can/softing/softing_main.c
M kernel/2.6/drivers/net/can/sja1000/sja1000.c