aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/can/dev.c
AgeCommit message (Collapse)AuthorFilesLines
2014-11-18can: dev: fix typo CIA -> CiA, CAN in AutomationRoman Fietze1-1/+1
This patch fixes a typo in CAN's dev.c: CIA -> CiA which stands for CAN in Automation. Signed-off-by: Roman Fietze <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-11-18can: dev: avoid calling kfree_skb() from interrupt contextThomas Körper1-1/+1
ikfree_skb() is Called in can_free_echo_skb(), which might be called from (TX Error) interrupt, which triggers the folloing warning: [ 1153.360705] ------------[ cut here ]------------ [ 1153.360715] WARNING: CPU: 0 PID: 31 at net/core/skbuff.c:563 skb_release_head_state+0xb9/0xd0() [ 1153.360772] Call Trace: [ 1153.360778] [<c167906f>] dump_stack+0x41/0x52 [ 1153.360782] [<c105bb7e>] warn_slowpath_common+0x7e/0xa0 [ 1153.360784] [<c158b909>] ? skb_release_head_state+0xb9/0xd0 [ 1153.360786] [<c158b909>] ? skb_release_head_state+0xb9/0xd0 [ 1153.360788] [<c105bc42>] warn_slowpath_null+0x22/0x30 [ 1153.360791] [<c158b909>] skb_release_head_state+0xb9/0xd0 [ 1153.360793] [<c158be90>] skb_release_all+0x10/0x30 [ 1153.360795] [<c158bf06>] kfree_skb+0x36/0x80 [ 1153.360799] [<f8486938>] ? can_free_echo_skb+0x28/0x40 [can_dev] [ 1153.360802] [<f8486938>] can_free_echo_skb+0x28/0x40 [can_dev] [ 1153.360805] [<f849a12c>] esd_pci402_interrupt+0x34c/0x57a [esd402] [ 1153.360809] [<c10a75b5>] handle_irq_event_percpu+0x35/0x180 [ 1153.360811] [<c10a7623>] ? handle_irq_event_percpu+0xa3/0x180 [ 1153.360813] [<c10a7731>] handle_irq_event+0x31/0x50 [ 1153.360816] [<c10a9c7f>] handle_fasteoi_irq+0x6f/0x120 [ 1153.360818] [<c10a9c10>] ? handle_edge_irq+0x110/0x110 [ 1153.360822] [<c1011b61>] handle_irq+0x71/0x90 [ 1153.360823] <IRQ> [<c168152c>] do_IRQ+0x3c/0xd0 [ 1153.360829] [<c1680b6c>] common_interrupt+0x2c/0x34 [ 1153.360834] [<c107d277>] ? finish_task_switch+0x47/0xf0 [ 1153.360836] [<c167c27b>] __schedule+0x35b/0x7e0 [ 1153.360839] [<c10a5334>] ? console_unlock+0x2c4/0x4d0 [ 1153.360842] [<c13df500>] ? n_tty_receive_buf_common+0x890/0x890 [ 1153.360845] [<c10707b6>] ? process_one_work+0x196/0x370 [ 1153.360847] [<c167c723>] schedule+0x23/0x60 [ 1153.360849] [<c1070de1>] worker_thread+0x161/0x460 [ 1153.360852] [<c1090fcf>] ? __wake_up_locked+0x1f/0x30 [ 1153.360854] [<c1070c80>] ? rescuer_thread+0x2f0/0x2f0 [ 1153.360856] [<c1074f01>] kthread+0xa1/0xc0 [ 1153.360859] [<c1680401>] ret_from_kernel_thread+0x21/0x30 [ 1153.360861] [<c1074e60>] ? kthread_create_on_node+0x110/0x110 [ 1153.360863] ---[ end trace 5ff83639cbb74b35 ]--- This patch replaces the kfree_skb() by dev_kfree_skb_any(). Signed-off-by: Thomas Körper <[email protected]> Cc: linux-stable <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-08-18can: dev: remove unused variable from can_calc_bittiming() functionLad, Prabhakar1-2/+1
this patch removes best_rate variable from can_calc_bittiming() function which was set but was never used. Signed-off-by: Lad, Prabhakar <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-07-15net: set name_assign_type in alloc_netdev()Tom Gundersen1-1/+1
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert all users to pass NET_NAME_UNKNOWN. Coccinelle patch: @@ expression sizeof_priv, name, setup, txqs, rxqs, count; @@ ( -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs) | -alloc_netdev_mq(sizeof_priv, name, setup, count) +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count) | -alloc_netdev(sizeof_priv, name, setup) +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup) ) v9: move comments here from the wrong commit Signed-off-by: Tom Gundersen <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-24can: fix return value from can_get_bittiming()Oliver Hartkopp1-1/+1
When trying to set a data bitrate on non CAN FD devices the 'ip' tool answers with: RTNETLINK answers: Unknown error 524 Rename '-ENOTSUPP' to '-EOPNOTSUPP' so that 'ip' answers correctly: RTNETLINK answers: Operation not supported Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: add bittiming check at interface open for CAN FDOliver Hartkopp1-0/+8
Additionally to have the second (data) bitrate available the data bitrate has to be greater or equal to the arbitration bitrate in CAN FD. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: allow to change the device mtu for CAN FD capable devicesOliver Hartkopp1-0/+39
The configuration for CAN FD depends on CAN_CTRLMODE_FD enabled in the driver specific ctrlmode_supported capabilities. The configuration can be done either with the 'fd { on | off }' option in the 'ip' tool from iproute2 or by setting the CAN netdevice MTU to CAN_MTU (16) or to CANFD_MTU (72). Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: introduce the data bitrate configuration for CAN FDOliver Hartkopp1-1/+44
As CAN FD offers a second bitrate for the data section of the CAN frame the infrastructure for storing and configuring this second bitrate is introduced. Improved the readability of the if-statement by inserting some newlines. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: provide a separate bittiming_const parameter to bittiming functionsOliver Hartkopp1-18/+13
As the bittiming calculation functions are to be used with different bittiming_const structures for CAN and CAN FD the direct reference to priv->bittiming_const inside these functions has to be removed. Also moved the check for existing bittiming const to one place. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: move sanity check for bitrate and tq into can_get_bittimingOliver Hartkopp1-14/+15
This patch moves a sanity check in order to have a second user for CAN FD. Also simplify the return value generation in can_get_bittiming() as only correct return values of can_[calc|fixup]_bittiming() lead to a return value of zero. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: only send bitrate data via netlink when availableOliver Hartkopp1-4/+6
When setting the bitrate both can_calc_bittiming() and can_fixup_bittiming() lead to the bitrate variable to be set, when a proper bit timing is available. Only then the bitrate configuration is stored for the device, so checking for priv->bittiming.bitrate is always sufficient. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: preserve skbuff protocol in can_put_echo_skbOliver Hartkopp1-2/+3
The skbuff protocol value was formerly fixed/sanitized to ETH_P_CAN in can_put_echo_skb(). With CAN FD this value has to be preserved. This patch changes the hard assignment of the protocol value to a check of valid protocol values for CAN and CAN FD. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-02-13Merge tag 'linux-can-next-for-3.15-20140212' of ↵David S. Miller1-0/+24
git://gitorious.org/linux-can/linux-can-next linux-can-next-for-3.15-20140212 Marc Kleine-Budde says: ==================== this is a pull request of eight patches for net-next/master. Florian Vaussard contributed a series that merged the sja1000 of_platform into the platform driver. The of_platform driver is finally removed. Stephane Grosjean supplied a patch to allocate CANFD skbs. In a patch by Uwe Kleine-König another missing copyright information was added to a userspace header. And a patch by Yoann DI RUZZA that adds listen only mode to the at91_can driver. ==================== Signed-off-by: David S. Miller <[email protected]>
2014-02-04can: add ability to allocate CANFD frame in skb dataStephane Grosjean1-0/+24
This patch adds the ability of allocating a CANFD frame data structure in the skb data area. Signed-off-by: Stephane Grosjean <[email protected]> Acked-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-01-30can: add destructor for self generated skbsOliver Hartkopp1-12/+3
Self generated skbuffs in net/can/bcm.c are setting a skb->sk reference but no explicit destructor which is enforced since Linux 3.11 with commit 376c7311bdb6 (net: add a temporary sanity check in skb_orphan()). This patch adds some helper functions to make sure that a destructor is properly defined when a sock reference is assigned to a CAN related skb. To create an unshared skb owned by the original sock a common helper function has been introduced to replace open coded functions to create CAN echo skbs. Signed-off-by: Oliver Hartkopp <[email protected]> Tested-by: Andre Naujoks <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2013-12-17can: Fix FSF address in file headersJeff Kirsher1-2/+1
Several files refer to an old address for the Free Software Foundation in the file header comment. Resolve by replacing the address with the URL <http://www.gnu.org/licenses/> so that we do not have to keep updating the header comments anytime the address changes. CC: Wolfgang Grandegger <[email protected]> CC: Marc Kleine-Budde <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-10-31can: dev: sort can_changelink() by IFLA_CAN_*Marc Kleine-Budde1-13/+13
This patch sorts the handling of data[IFLA_CAN_*] by IFLA_CAN_*. Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-10-31can: dev: sort can_fill_info() by IFLA_CAN_*Marc Kleine-Budde1-12/+9
This patch sorts the call to nla_put() by IFLA_CAN_*. Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-10-31can: dev: sort can_get_size() by IFLA_CAN_*Marc Kleine-Budde1-10/+10
This patch sorts the individual addends of the sum by IFLA_CAN_*. Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-10-07can: dev: fix nlmsg size calculation in can_get_size()Marc Kleine-Budde1-5/+5
This patch fixes the calculation of the nlmsg size, by adding the missing nla_total_size(). Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2013-01-28can: rework skb reserved data handlingOliver Hartkopp1-2/+2
Added accessor and skb_reserve helpers for struct can_skb_priv. Removed pointless skb_headroom() check. Signed-off-by: Oliver Hartkopp <[email protected]> CC: Marc Kleine-Budde <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2013-01-26can: add private data space for CAN sk_buffsOliver Hartkopp1-1/+7
The struct can_skb_priv is used to transport additional information along with the stored struct can(fd)_frame that can not be contained in existing struct sk_buff elements. can_skb_priv is located in the skb headroom, which does not touch the existing CAN sk_buff usage with skb->data and skb->len, so that even out-of-tree CAN drivers can be used without changes. Btw. out-of-tree CAN drivers without can_skb_priv in the sk_buff headroom would not support features based on can_skb_priv. The can_skb_priv->ifindex contains the first interface where the CAN frame appeared on the local host. Unfortunately skb->skb_iif can not be used as this value is overwritten in every netif_receive_skb() call. Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-01-26can: rename LED trigger name on netdev renamesKurt Van Dijck1-0/+5
The LED trigger name for CAN devices is based on the initial CAN device name, but does never change. The LED trigger name is not guaranteed to be unique in case of hotplugging CAN devices. This patch tries to address this problem by modifying the LED trigger name according to the CAN device name when the latter changes. v1 - Kurt Van Dijck v2 - Fabio Baltieri - remove rename blocking if trigger is bound - use led-subsystem function for the actual rename (still WiP) - call init/exit functions from dev.c v3 - Kurt Van Dijck - safe operation for non-candev based devices (vcan, slcan) based on earlier patch v4 - Kurt Van Dijck - trivial patch mistakes fixed Signed-off-by: Kurt Van Dijck <[email protected]> Signed-off-by: Fabio Baltieri <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2013-01-26can: export a safe netdev_priv wrapper for candevKurt Van Dijck1-0/+13
In net_device notifier calls, it was impossible to determine if a CAN device is based on candev in a safe way. This patch adds such test in order to access candev storage from within those notifiers. Signed-off-by: Kurt Van Dijck <[email protected]> Acked-by: Oliver Hartkopp <[email protected]> Signed-off-by: Fabio Baltieri <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2012-11-29can: Do not call dev_put if restart timer is running upon closeAlexander Stein1-2/+1
If the restart timer is running due to BUS-OFF and the device is disconnected an dev_put will decrease the usage counter to -1 thus blocking the interface removal, resulting in the following dmesg lines repeating every 10s: can: notifier: receive list not found for dev can0 can: notifier: receive list not found for dev can0 can: notifier: receive list not found for dev can0 unregister_netdevice: waiting for can0 to become free. Usage count = -1 Cc: linux-stable <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2012-07-02can: dev: fix sparse warning for can_restartMarc Kleine-Budde1-1/+1
Make can_restart static to fix the following sparse warning: drivers/net/can/dev.c:371:6: warning: symbol 'can_restart' was not declared. Should it be static? Signed-off-by: Marc Kleine-Budde <[email protected]>
2012-06-19candev: add/update helpers for CAN FDOliver Hartkopp1-1/+34
- update sanity checks - add DLC to length conversion helpers - can_dlc2len() - get data length from can_dlc with sanitized can_dlc - can_len2dlc() - map the sanitized data length to an appropriate DLC Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2012-04-02can: Stop using NLA_PUT*().David S. Miller1-15/+16
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <[email protected]>
2012-02-03can: replace the dev_dbg/info/err/... with the new netdev_xxx macrosWolfgang Grandegger1-12/+11
Cc: [email protected] Cc: Anant Gole <[email protected]> Cc: Chris Elston <[email protected]> Cc: Sebastian Haas <[email protected]> Cc: Matthias Fuchs <[email protected]> Signed-off-by: Wolfgang Grandegger <[email protected]> Acked-by: Sebastian Haas <[email protected]> Acked-by: Mike Frysinger <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2012-02-03can: dev: let can_get_echo_skb() return dlc of CAN frameMarc Kleine-Budde1-1/+9
can_get_echo_skb() is usually called in the TX complete handler. The stats->tx_packets and stats->tx_bytes should be updated there, too. This patch simplifies to figure out the size of the sent CAN frame. Signed-off-by: Marc Kleine-Budde <[email protected]>
2011-11-16net: remove NETIF_F_NO_CSUM feature bitMichał Mirosław1-1/+1
Only distinct use is checking if NETIF_F_NOCACHE_COPY should be enabled by default. The check heuristics is altered a bit here, so it hits other people than before. The default shouldn't be trusted for performance-critical cases anyway. For all other uses NETIF_F_NO_CSUM is equivalent to NETIF_F_HW_CSUM. Signed-off-by: Michał Mirosław <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2011-09-28candev: allow SJW user setting for bittiming calculationOliver Hartkopp1-1/+13
This patch adds support for SJW user settings to not set the synchronization jump width (SJW) to 1 in any case when using the in-kernel bittiming calculation. The ip-tool from iproute2 already supports to pass the user defined SJW value. The given SJW value is sanitized with the controller specific sjw_max and the calculated tseg2 value. As the SJW can have values up to 4 providing this value will lead to the maximum possible SJW automatically. A higher SJW allows higher controller oscillator tolerances. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2011-07-21can: make function can_get_bittiming staticThadeu Lima de Souza Cascardo1-1/+1
The function can_get_bittiming is not used anywhere else, so it should be static. Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo1-0/+1
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <[email protected]> Guess-its-ok-by: Christoph Lameter <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Lee Schermerhorn <[email protected]>
2010-02-26can: netlink support for bus-error reporting and countersWolfgang Grandegger1-0/+6
This patch makes the bus-error reporting configurable and allows to retrieve the CAN TX and RX bus error counters via netlink interface. I have added support for the SJA1000. The TX and RX bus error counters are also copied to the data fields 6..7 of error messages when state changes are reported. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2010-01-15can: Proper ctrlmode handling for CAN devicesChristian Pellegrin1-0/+2
This patch adds error checking of ctrlmode values for CAN devices. As an example all availabe bits are implemented in the mcp251x driver. Signed-off-by: Christian Pellegrin <[email protected]> Acked-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-11-17Merge branch 'master' of ↵David S. Miller1-0/+6
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/can/Kconfig
2009-11-13can: add the missing netlink get_xstats_size callbackWolfgang Grandegger1-0/+6
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-11-08Merge branch 'master' of ↵David S. Miller1-0/+17
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/can/usb/ems_usb.c
2009-11-08net: Support specifying the network namespace upon device creation.Eric W. Biederman1-1/+1
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 <[email protected]> Acked-by: Eric Dumazet <[email protected]>
2009-11-08can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo()Wolfgang Grandegger1-0/+17
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 this patch is required for more recent kernels as well, even if no WARN_ON dumps are triggered. Maybe we also need "get_xstats_size" for the CAN xstats. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-10-20can: provide library functions for skb allocationWolfgang Grandegger1-7/+35
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. It's now done as shown below: skb->protocol = htons(ETH_P_CAN); skb->pkt_type = PACKET_BROADCAST; skb->ip_summed = CHECKSUM_UNNECESSARY; *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); memset(*cf, 0, sizeof(struct can_frame)); The frame is zeroed out to avoid uninitialized data to be passed to user space. Some drivers or library code did not set "pkt_type" or "ip_summed". Also, "__constant_htons()" should not be used for runtime invocations, as pointed out by David Miller. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-10-13can: make the number of echo skb's configurableWolfgang Grandegger1-6/+26
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 Van Dijck, with the function: struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); The CAN drivers have been adapted accordingly. For the ems_usb driver, as suggested by Sebastian Haas, the number of echo skb's has been increased to 10, which improves the transmission performance a lot. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: Kurt Van Dijck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-09-04can: add can_free_echo_skb() for upcoming driversWolfgang Grandegger1-1/+17
This patch adds the function can_free_echo_skb to the CAN device interface to allow upcoming drivers to release echo skb's in case of error. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-09-02drivers: Kill now superfluous ->last_rx storesEric Dumazet1-1/+0
The generic packet receive code takes care of setting netdev->last_rx when necessary, for the sake of the bonding ARP monitor. Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-08-13can: fix oops caused by wrong rtnl newlink usageOliver Hartkopp1-0/+7
For 'real' hardware CAN devices the netlink interface is used to set CAN specific communication parameters. Real CAN hardware can not be created with the ip tool ... The invocation of 'ip link add type can' lead to an oops as the standard rtnl newlink function was called: http://bugzilla.kernel.org/show_bug.cgi?id=13954 This patch adds a private newlink function for the CAN device driver interface that unconditionally returns -EOPNOTSUPP. Signed-off-by: Oliver Hartkopp <[email protected]> Reported-by: Dmitry Eremin-Solenikov <[email protected]> CC: Patrick McHardy <[email protected]> CC: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-07-20can: switch carrier on if device was stopped while in bus-off stateWolfgang Grandegger1-0/+4
This patch fixes a problem when a device is stopped while in the bus-off state. Then the carrier remains off forever. Signed-off-by: Kurt Van Dijck <[email protected]> Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-07-20can: restart device even if dev_alloc_skb() failsWolfgang Grandegger1-2/+2
If dev_alloc_skb() failed in can_restart(), the device was left behind in the bus-off state. This patch restarts the device nevertheless. Signed-off-by: Kurt Van Dijck <[email protected]> Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-06-01can: some fixes and cleanups to the initial device driver interfaceWolfgang Grandegger1-1/+1
This patch fixes a few errors sneaked into the initial version of the device driver interface. Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2009-05-18can: CAN Network device driver and Netlink interfaceWolfgang Grandegger1-0/+657
The CAN network device driver interface provides a generic interface to setup, configure and monitor CAN network devices. It exports a set of common data structures and functions, which all real CAN network device drivers should use. Please have a look to the SJA1000 or MSCAN driver to understand how to use them. The name of the module is can-dev.ko. Furthermore, it adds a Netlink interface allowing to configure the CAN device using the program "ip" from the iproute2 utility suite. For further information please check "Documentation/networking/can.txt" Signed-off-by: Wolfgang Grandegger <[email protected]> Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: David S. Miller <[email protected]>