hartkopp [Thu, 15 Jan 2009 11:14:12 +0000 (11:14 +0000)]
Reverted the removal of dev->get_stats = can_get_stats for kernels < 2.6.23
For these old kernels the access to the stats from outside the driver
only works via this function call.
hartkopp [Thu, 15 Jan 2009 08:30:18 +0000 (08:30 +0000)]
Update acces to netstats for 2.6.29
---
The successor of dev->get_stats(dev) in 2.6.29 is dev_get_stats(dev)
which provides a const(!) pointer for read only access to the stats.
As the usual current method to access the stats is to reference
dev->stats directly as stats is part of the struce netdevice
since 2.6.23 this patch implements this method of access now.
For kernels < 2.6.23 the netstats are part of the private data
and only this is handled by a separate wrapper now.
The idea was also to get a proper source code after strip-src.
hartkopp [Wed, 14 Jan 2009 08:02:23 +0000 (08:02 +0000)]
Due to the loopback functionality in can_send() we can not invoke it
from hardirq context which was done inside the bcm_tx_timeout_handler()
hrtimer callback:
hartkopp [Wed, 7 Jan 2009 08:38:59 +0000 (08:38 +0000)]
Added some sample code to use CAN interfaces with PF_PACKET sockets.
Just a proof-of-concept that has several drawbacks:
- you need to be root to access the CAN bus
- no local loopback (therefore virtual CAN interfaces do not really work)
- no CAN filters and other socket options from the can-raw socket
hartkopp [Tue, 6 Jan 2009 09:23:41 +0000 (09:23 +0000)]
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 [Sun, 28 Dec 2008 08:11:18 +0000 (08:11 +0000)]
Updated BCM to support hrtimers only run in hard_irq context in 2.6.29+
- added tasklets for messages to the userspace (needs soft_irq context)
- removed avoidable copy of data in bcm_rx_handler()
- fixed rearm of throttle timer in bcm_rx_thr_handler()
- some removal of duplicate code
hartkopp [Sun, 21 Dec 2008 16:55:48 +0000 (16:55 +0000)]
Created a copy of bcm.c for kernels below 2.6.22 (without hrtimers) to
split up the code as a precondition for changes caused by hrtimers in
2.6.29 that only support hrtimers in hard_irq context.
hartkopp [Thu, 18 Dec 2008 09:13:05 +0000 (09:13 +0000)]
can: merge error paths
This commit follows the change in net-next-2.6 git tree created by
Ilpo Järvinen.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=ebad5c0984e06f4036d2eb2741b9afce736b8a06
hartkopp [Mon, 8 Dec 2008 18:51:29 +0000 (18:51 +0000)]
Fix NULL pointer dereference as reported by Chris Dore:
https://lists.berlios.de/pipermail/socketcan-core/2008-December/002120.html
Added missing initialisation of resource struct as reported by David Mueller:
https://lists.berlios.de/pipermail/socketcan-core/2008-December/002127.html
Signed-off-by: David Mueller <d.mueller@elsoft.ch> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@879 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 4 Dec 2008 18:21:43 +0000 (18:21 +0000)]
Since rev872 the single CAN identifier filter lists handle only non-RTR
CAN frames. So we need to omit the check of these filter lists when
receiving RTR CAN frames.
hartkopp [Mon, 1 Dec 2008 07:24:18 +0000 (07:24 +0000)]
Fix sloppy CAN_(EFF|RTR)_FLAG handling in can_filter.can_mask .
Due to a wrong safety check in af_can.c it was not possible to filter
for SFF frames with a specific CAN identifier without getting the
same selected CAN identifier from a received EFF frame also.
This fix has a minimum impact on the CAN filter API as the 'sloppy'
handling is still a correct (and possibly wanted?) use-case.
Please update the can-utils (especially candump) whose filter definition
on the commandline made assumptions to correct the user input that are
probably unwanted now.
Thanks to Kurt van Dijck for pointing at this issue!
Signed-Off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@872 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 28 Nov 2008 21:50:24 +0000 (21:50 +0000)]
Fixed parse_canframe() with reordering the checks for the can_id
delimiter. Before this fix the function may have found delimiters in the
string behind the terminating zero.
hartkopp [Thu, 30 Oct 2008 21:18:34 +0000 (21:18 +0000)]
[PATCH] SJA1000: ixxat_pci: fix the detection of the second SJA1000 chip
According to the SJA1000 data sheet, section 6.3.2, only the bits 0,5
and 7 of the control/mode register are defined after a reset. This
patch uses a proper mask before checking the value.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@863 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 29 Oct 2008 19:05:06 +0000 (19:05 +0000)]
This patch allows pcmcia subsystem >= 2.6.28
The function pcmcia_loop_config is used. To support kernels < 2.6.28
the pcmcia_loop_config function is emulated (it does basically the same
as what I used to do, but seperates the code much cleaner) for these kernels.
This is definitely a change, but does not break on recent builds.
Additionally, in order to test the pcmcia access, the code needed to be
tested for 8bit softing pcmcia cards too. Historically, these cards did not
support shared irq's. But my current system, AMD64, does not provide exclusive
interrupts anymore. Therefore, the old 8bit cards are moved to have shared
irq's. The code did succeed in my elementary tests.
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@862 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Tue, 28 Oct 2008 19:20:02 +0000 (19:20 +0000)]
Added a file list and base patches to create a Kernel 2.6.25+ with the latest CAN divers.
The base patches just remove the vcan driver files which are taken from SVN also.
hartkopp [Mon, 27 Oct 2008 09:24:55 +0000 (09:24 +0000)]
Updated slcan.c following:
[TTY]: Use tty_mode_ioctl() in network drivers.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d0127539ea9b5fcfe1a1d7d4d57f12384da5190c
hartkopp [Fri, 24 Oct 2008 19:11:19 +0000 (19:11 +0000)]
Instead of using own error or success codes, the PCMCIA code should rely on
the generic return values. Therefore, replace all occurrences of CS_SUCCESS
with 0.
hartkopp [Fri, 24 Oct 2008 19:00:32 +0000 (19:00 +0000)]
Instead of using own error or success codes, the PCMCIA code should rely on
the generic return values. Therefore, replace all occurrences of CS_SUCCESS
with 0.
hartkopp [Fri, 24 Oct 2008 18:28:35 +0000 (18:28 +0000)]
This patch adds hardware probe to mc251x driver.
In case no mcp251x chip is installed the mcp251x_can_probe function
exits without registering the device.
Signed-off-by: Christian Pellegrin <chripell@gmail.com> Acked-by: Claudio Lanconelli <lanconelli.claudio@eptar.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@852 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 24 Oct 2008 13:42:42 +0000 (13:42 +0000)]
This patch ensures that can_calc_bittiming() returns an error (-EDOM) if
the bit-rate error is greater than 5%. In that case, it's very unlikely
that the determined bit-timing works properly anyhow.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@851 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 23 Oct 2008 10:17:31 +0000 (10:17 +0000)]
Move sja1000 cdr and ocr defines into platform header as discussed on
SocketCAN ML:
https://lists.berlios.de/pipermail/socketcan-core/2008-October/002032.html
Signed-off-by: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@847 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 22 Oct 2008 13:39:50 +0000 (13:39 +0000)]
From 0dcf8e2f6a5f453dca20b71aa146a28b470f4b07 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Sun, 19 Oct 2008 02:55:08 +0200
Subject: [PATCH] [CAN] add generic platform bus based sja1000 driver
This patch adds a generic platform bus based sja1000 driver.
Changes to original post:
- correct placing of config option in Kconfig file
- moved platform header file to separate directory
include/linux/can/platform
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@843 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sun, 19 Oct 2008 16:12:47 +0000 (16:12 +0000)]
The callbacks in the struct can_priv used u32 for state and mode.
There are already enums for these values. Use these enums to keep
sparse quiet if a driver already uses these values.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Acked-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@841 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sat, 18 Oct 2008 18:08:01 +0000 (18:08 +0000)]
The macro definition DRV_NAME is used for regions (/proc/ioports,
/proc/iomem), device names (/proc/bus/pci/devices), etc. The
names are now derived from the corresponding file name and do not
use the prefix "can-" any more.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@840 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sat, 18 Oct 2008 13:22:00 +0000 (13:22 +0000)]
This patch fixes suspend/resume for platforms that "lose" bit
timing settings after a suspend/resume cycle and improves robustness
in case of misbehaving hardware (doesn't lock the machine anymore)
Signed-off-by: Christian Pellegrin <chripell@gmail.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@839 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 16 Oct 2008 14:13:50 +0000 (14:13 +0000)]
If priv->do_get_state returns an error, nothing is printed
and "0" thus no error is delivered into userspace. This patch
changes the behaviour so that the error is propagated into the
userspace correctly.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@838 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Tue, 14 Oct 2008 19:08:33 +0000 (19:08 +0000)]
Applied patch from Christian Pellegrin
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001960.html
after fixing some whitespace issues in a comment section and the removal
of an obsolete debug output.
wolf [Tue, 7 Oct 2008 07:36:50 +0000 (07:36 +0000)]
Fix problems with calculating bit-timing parameters
This patch fixes a bug resulting in a badly matching sample point.
Furthermore, it temporarily fixes the problems with prog_seg being
0 on AT91 and MPC2510 CAN controllers. A proper fix using min/max
values for prog_seg, phase_seg1 and phase_seg2 is on the to-do
list.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@832 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Mon, 6 Oct 2008 11:54:19 +0000 (11:54 +0000)]
Applied two cosmetic issues from Kurt van Dijck:
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001885.html
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001883.html
hartkopp [Mon, 6 Oct 2008 09:32:02 +0000 (09:32 +0000)]
Cleanup new bittime interface on Softing Cards as proposed by Kurt van Dijck:
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001868.html
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001870.html
hartkopp [Sun, 5 Oct 2008 17:00:52 +0000 (17:00 +0000)]
Support the new bittime interface.
Fixes in softing_reinit() in softing_fw.c:
- calculate bittiming at re-init the chips
- in debug trace: use card->bus[1]->can.bittiming.bitrate for bus1
hartkopp [Sat, 4 Oct 2008 18:55:01 +0000 (18:55 +0000)]
Added MCP251x SPI CAN driver posted by Chris Elston <celston@katalix.com>
and Christian Pellegrin <chripell@evolware.org> in
https://lists.berlios.de/pipermail/socketcan-core/2008-October/001861.html
after updating the driver to the new bitrate setting interface.
Changed comment line recognition:
Everything without a '(' at the beginning of an input line is treated as comment.
Changed buffer size to allow long comment lines & added overflow handling.
Added automatic extended frame format recognition.
Most SocketCAN userspace tools (like cansend) recognize the EFF by the
stringlength of the given CAN-ID: 3 -> SFF , 8 -> EFF.
This was missing in the candump filter definition and therefore the
values had to be specified with the CAN_EFF_FLAG set in the value, e.g. 92345678 for the extended CAN-ID 12345678 - this was not really nice.
Now the filtersets for extended frames can be specified as expected: 12345678:1FFFFFFF to filter for only 12345678 extended CAN-ID 000000AA:1FFFFFFF to filter for only AA extended CAN-ID.