The new mkpatch script removes the trailing blank lines after a
#if LINUX_VERSION_CODE ...
Added some blank lines to get a better linespacing in the (patched) code.
Unified the RCSID stuff which is usefull when making an external compilation.
The version.h include and the RCSID macro is automatically removed when
creating a (mainline) kernel patch by the script trunk/mkpatch .
Fixed compile error due to moved CAN_VERSION string.
Indeed the version of a netdev driver has nothing to do with the
version of the protocol family CAN core ...
Remove everything from version.h except definition of RCSID().
Rename macro VERSION to CAN_VERSION, now defined in core.h.
Add macro CAN_ABI_VERSION.
Don't include version.h in kernel patches and delete usage of RCSID()
from all files generated by mkpatch.
Added local kzalloc() function for Kernel Versions < 2.6.14 .
kzalloc() became part of the Mainline Kernel in 2.6.14 .
Tnx to the hint from Simon Kallweit.
Following the discussion with tglx the functions can_dev_(un)register get a
return value.
* Moved EXPORT_SYMBOL macro to end of the appropriate function (Codingstyle).
* Added Kerneldoc compatible comments for exported fundctions.
TODO: Check if can_proto_(un)register should also have a return value.
Cleaned up the code according to the hints from a code review with
Thomas Gleixner. Removed many goto's and variable assignments within
conditions for that reason. Usage of kzalloc, etc ...
TODO:
- Add kernel doc comments for structs & public (global) functions
- Find a solution for the RCS / version.h stuff (together with Urs)
- Sort the functions to reduce forward declarations for static functions.
- Check for pr_debug as a replacement for local DBG macros
- And some more details on my list ...
Moved the work from branches/ha/candrv to trunk.
Added support for @$%&! Intel i82527 controller.
Added hardware abstraction layer inspired by the OCAN i82527 driver.
Therefore reworked the SJA1000 driver. Comments / KConfig / etc.
thuermann [Mon, 19 Mar 2007 13:03:37 +0000 (13:03 +0000)]
Add a quick'n'dirty script to generate a kernel patch file.
Needs a list of files to be added on stdin and currently also a diff file
for the kernel version the patch is to be generated for.
hartkopp [Tue, 13 Mar 2007 21:31:59 +0000 (21:31 +0000)]
Due to several complains about the 'failing make' the compilation of the
slcan-driver is now removed as part of the 'all' target.
Not everyone knows 'make -k' and as long as the defines for N_SLCAN are not
commonly defined in the Kernel you have to build the slcan-driver as an extra
target: 'make slcan'
After downloading fresh source code a failing 'make' doesn't smell well :-/
hartkopp [Mon, 12 Mar 2007 20:33:38 +0000 (20:33 +0000)]
Applied patch from Eberhard Stoll to fix MSCAN TX timeout problems:
---
Now it uses only one tx buffer, all others are unused.
For me this seems to be the best way, especially after i read the new
RevB ERRATA sheet. Purging the pending can frame is done via CANTARQ
register.
---
Tnx to Eberhard for the contribution!
hartkopp [Thu, 8 Mar 2007 11:02:43 +0000 (11:02 +0000)]
Moved definition and prototypes for for CAN protocol modules using the PF_CAN
core module into linux/can/core.h to be public visible for external
compilation. Thanks to Urs for the hint and advisory.
hartkopp [Mon, 5 Mar 2007 13:55:34 +0000 (13:55 +0000)]
Defined ARPHARD_CAN as 280 (formerly 804) due to my RFC on the socketcan-core
mailinglist. Had a phonecall with Marc who sees no problem with ARPHRD_CAN 280
hartkopp [Mon, 5 Mar 2007 10:23:51 +0000 (10:23 +0000)]
Added slim Makefiles that are working inside the kernel tree.
For the first step only vcan and slcan drivers are on the roadmap for
integration into the kernel. IMHO the device drivers and the ioctl interface
as well as the CAN driver lib (candev.ko) from Andrey should be focussed
when we're stable integrated into the kernel tree.
hartkopp [Mon, 5 Mar 2007 10:14:18 +0000 (10:14 +0000)]
Moved the definitions of AF_CAN, PF_CAN, ARPHRD_CAN and ETH_P_CAN out of the
file can.h to make can.h fit for a kernel integration path.
Therefore i added the 'hack' to the Makefiles which now contain the missing
defines. Maybe there will be a better solution in the future (when CAN is
part of the kernel). But currently it helps to maintain sourcecode to be
copied right into the kernel source tree.
Additionally added address structures for isotp and bap in sockaddr_can.
Cleanups. Cosmetics.
hartkopp [Thu, 22 Feb 2007 12:47:37 +0000 (12:47 +0000)]
Added CAN interface driver for low-cost CAN-Interfaces with ASCII protocol
via serial (or quasi serial via USB) lines.
This driver is partly derived from linux/net/driver/slip.c and uses a new
tty line discipline (N_SLCAN) analogue to N_SLIP to encapsulate can_frames
sent to a slc* netdevice for the serial line and vice versa.
As only the sending and receiving of can_frames is implemented, this driver
should work with the (serial/USB) CAN hardware from:
> www.canusb.com / www.can232.com / www.mictronic.com / www.canhack.de <
The sending and receiving frames format is pretty common. The other settings
and the 'open' command 'O' of the specific adapters may be set with a
terminal programm (like minicom) before switching the CAN data stream to
the slc* netdevice using the slcan_attach userspace tool.
Feel free to send patches / extensions to slcan.c / slcan_attach.c :)
ps. There had been no performances measurements until now. As long as the
data fit's through the 'serial' line it works obviously well. The slcan-driver
nor the Linux network layer will definitely have no problems to process
the received data. Remember the 'low-cost' hardware approach. We'll see ...
hartkopp [Thu, 22 Feb 2007 08:46:53 +0000 (08:46 +0000)]
Added module parameter 'numdev' to modify the number of created virtual CAN
interfaces. The default remains 4 interfaces.
More sophisticated error handling at netdevice creation.
Added missing device flag IFF_NOARP.
It's now possible to filter for EFF/RTR frames AND to filter not for them
explicitely (when CAN_EFF_FLAG or CAN_RTR_FLAG is set in the can_mask and
cleared in the can_id). This is indeed more straight and is what i intended
to have ...
hartkopp [Wed, 14 Feb 2007 14:56:39 +0000 (14:56 +0000)]
Fixed memory leak in Kernel 2.4 VCAN source when unloading the module.
Even if no one ever want's to unload this fancy code ;-)
Setting DO_LOOPBACK default OFF (analogue to Kernel 2.6 tree). Cosmetics.
hartkopp [Mon, 12 Feb 2007 08:36:38 +0000 (08:36 +0000)]
Added Option -l ('l'oop) to make the canplayer replay a given file more than
one time. To replay a given file infinitely say '-l i'. Of course it is not
possible/reasonable to define '-l' when reading from stdin ...
hartkopp [Fri, 9 Feb 2007 09:53:16 +0000 (09:53 +0000)]
Removed possibility to terminate candump with an input from stdin.
Therefore it can be used in scripts now, e.g. for CAN-frame bridging:
candump can1 -mFFF -v123 -b can3 -s 2 &
Use CTRL-C to terminate candump.
thuermann [Thu, 8 Feb 2007 13:00:54 +0000 (13:00 +0000)]
Lock the receive lists when removing in can_exit().
Disable soft-IRQs (traditionally aka bottom halves) when working on receive
lists, since can_notifier() is called in interrupt context.
hartkopp [Thu, 1 Feb 2007 09:15:00 +0000 (09:15 +0000)]
Complete reworked and beautified the Broadcast Manager (bcm)
The BCM now supports the binding to ifindex 0 like the raw socket does.
The first implementation of the BCM was from September 2003 and therefore
many historic stuff (e.g. unusual error reporting) was removed.
The support of ifindex 0 leads to the possibility to read from several
interfaces via one BCM-socket using sendto() / recvfrom().
See new test-apps tst-bcm-?x-sendto.c
The update of RX/TX_SETUPs 'on the run' are only possible with a smaller or
eval size of parameters now, as it is very complex in locking to provide the
other case and there was really now use-case for it ...
hartkopp [Tue, 30 Jan 2007 08:57:08 +0000 (08:57 +0000)]
Removed dynamic memory allocation inside bcm.c for bcm_opt.
Added init function analogue to behaviour in raw.c.
Renamed all the user_data stuff to bcm_opt.
Comming soon: Ability to bind the BCM socket to any CAN device (ifindex=0)
hartkopp [Fri, 26 Jan 2007 07:36:33 +0000 (07:36 +0000)]
Updated vcan.c to support the new loopback functionality in af_can.c.
Added Makefile parameters to allow to set the RAW and BCM capabilities at
compiletime, e.g. make RAWCAP=-DCONFIG_CAN_RAW_USER
hartkopp [Wed, 10 Jan 2007 17:18:01 +0000 (17:18 +0000)]
Fixed typo in log2asc.c
Added asc2log.c to convert existing CANoe/CANalyser logfiles into socketcan
logfiles (with absolute and full qualified timestamps).
The date and the other settings (dec/hex absolute/relative) are taken from
the head of the ASC files.
OK, maybe it would be reasonable to write a short program for this application.
But for some tests all this can be done with existing commandline tools.
In addition the filtering possibilities of candump can be used here.
hartkopp [Sat, 6 Jan 2007 15:43:12 +0000 (15:43 +0000)]
Minor fix and cosmetics in color handling in candump.c .
Added new tool 'canplayer' to replay logfiles generated by candump -l .
Features of canplayer:
- Input from stdin or file.
- throttling of the replay to get nearly original timestamps / message gaps
- mapping and selection of CAN interfaces (assignment)
e.g. canplay -I logfile vcan2=can2 vcan0=can1 can2=can3
means: send frames received on can1 in the logfile to vcan0 and so on ...
- if no assignment is made the original interfaces are used for replay
- handling of multiple CAN interfaces simultaneously (if in logfile)
- option: throttle disable (do not look on timestamps => very FAST replay!)
- option: change the 'sleep time' in milli seconds
Remarks:
canplayer uses nanosleep() for throttling which means that the resolution of
the canplayer is about 1ms (Kernel HZ = 1000) or 10ms (Kernel HZ = 100).
After each nanosleep() all the CAN frames are send that had to be transmitted
until the timestamp at the current time. Giving e.g. the option '-g 500' for
500ms let's you see the behaviour. Using nanosleep() makes canplay a very
performant tool with minimum CPU load.
To transfer CAN frames over a TCP/IP network you may now say something like:
candump -> netcat -> netcat -> canplayer
hartkopp [Mon, 1 Jan 2007 18:29:52 +0000 (18:29 +0000)]
- added error frame support in lib.c
- added sprint_* functions for CAN-frame output in lib.c / lib.h
- added comments / cosmetics
candump.c:
- removed support for the output in ASC representation (moved to log2asc.c)
- added option '-l' for logfile creation e.g. 'candump-2007-01-01_164123.log'
- added funtionality to terminate candump by pressing [ENTER] (not only ^C)
- added error frame support
- added color support even when reading from 'any'
- three different color levels (e.g. -c -c -c)
- making use if lib.c
cangen.c:
- CAN frames generator for testing purposes (e.g. on vcanx)
(nice when you're on vacancy at the baltic sea and have no real CAN source :)
log2long.c:
- convert compact CAN frame representation into user readable representation
log2asc.c:
- convert compact CAN frame logfile to ASC logfile for 3rd party CAN tools
Next step: Create a tool to replay candump logfiles.
hartkopp [Wed, 13 Dec 2006 07:47:34 +0000 (07:47 +0000)]
Preventing procfs output to overflow PAGE_SIZE.
Cosmetics in 2.4 af_can.c (looked broken & is unusual in the Kernel even when
it's ok for the compiler).
thuermann [Tue, 12 Dec 2006 11:37:28 +0000 (11:37 +0000)]
in 2.4, make rx_alldev_list part of the rx_dev_list.
in 2.4, remove dynamically allocated dev_recv_lists on module unload.
add comment about possibly missing locking.
hartkopp [Thu, 7 Dec 2006 13:06:14 +0000 (13:06 +0000)]
Backported current functionality in Kernel 2.6 path to Kernel 2.4 path.
Changes:
- support for new sockopts CAN_RAW_LOOPBACK & CAN_RAW_RECV_OWN_MSGS
- allow raw socket filter with zero length
- check for alloc_skb failure
- DNAME macro in proc.c as preparation for rx_alldev_list changes
TODO:
- perform rx_alldev_list changes from revision 112/113
- remove device receive lists when unloading can.o from revision 115
hartkopp [Wed, 6 Dec 2006 10:42:02 +0000 (10:42 +0000)]
Made the device receive list for sockets that are bound to 'any' interfaces an
element of the rx_dev_list due to a discussion with Urs.
This has the effects:
1. The 'any' entries are shown in the procfs
2. remove of obsolete code
3. fix of debugging output (NULL pointer dereferencing)
4. preparation for removing the device receive lists in can_exit()
TODO: see point 4: The unloading of can.ko does not remove device receive
lists for devices that are currently registered.
hartkopp [Sat, 2 Dec 2006 11:49:02 +0000 (11:49 +0000)]
Renamed #include<linux/config.h> to autoconf.h as config.h
is no longer supported in Kernel 2.6.19.
In former Kernels config.h only included autoconf.h ...
hartkopp [Wed, 29 Nov 2006 14:36:49 +0000 (14:36 +0000)]
Introduced return values for socketcan internal functions can_rx_register()
and can_rx_unregister().
Background: When hot-unplugging CAN netdevices (like CAN USB devices) the
device structures are removed due to the notifier in af_can.c.
As this notification is passed to the user-app, the user-app closes the socket
which causes the socket to remove the already nonexistent RX-entries.
This 'usual' unplugging event lead to a kernel error logging ...
Now the retval of the (un)register-functions gives the information to be
handled (if sensefull).