mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next
Marc Kleine-Budde says: ==================== this is a pull request of four patches for net-next/master. There is one patch by Markus Pargmann, which speeds up the c_can driver, a patch by John Whitmore which updates the in tree documentation. A patch by Jeff Kirsher which replaces the FSF's address by a link and a patch by Alexander Shiyan which converts the mcp251x driver to make use of managed resources. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
de47c4ab25
@ -13,8 +13,7 @@ This file contains
|
||||
3 SocketCAN concept
|
||||
3.1 receive lists
|
||||
3.2 local loopback of sent frames
|
||||
3.3 network security issues (capabilities)
|
||||
3.4 network problem notifications
|
||||
3.3 network problem notifications
|
||||
|
||||
4 How to use SocketCAN
|
||||
4.1 RAW protocol sockets with can_filters (SOCK_RAW)
|
||||
@ -92,7 +91,7 @@ new driver's API.
|
||||
SocketCAN was designed to overcome all of these limitations. A new
|
||||
protocol family has been implemented which provides a socket interface
|
||||
to user space applications and which builds upon the Linux network
|
||||
layer, so to use all of the provided queueing functionality. A device
|
||||
layer, enabling use all of the provided queueing functionality. A device
|
||||
driver for CAN controller hardware registers itself with the Linux
|
||||
network layer as a network device, so that CAN frames from the
|
||||
controller can be passed up to the network layer and on to the CAN
|
||||
@ -217,21 +216,7 @@ solution for a couple of reasons:
|
||||
* = you really like to have this when you're running analyser tools
|
||||
like 'candump' or 'cansniffer' on the (same) node.
|
||||
|
||||
3.3 network security issues (capabilities)
|
||||
|
||||
The Controller Area Network is a local field bus transmitting only
|
||||
broadcast messages without any routing and security concepts.
|
||||
In the majority of cases the user application has to deal with
|
||||
raw CAN frames. Therefore it might be reasonable NOT to restrict
|
||||
the CAN access only to the user root, as known from other networks.
|
||||
Since the currently implemented CAN_RAW and CAN_BCM sockets can only
|
||||
send and receive frames to/from CAN interfaces it does not affect
|
||||
security of others networks to allow all users to access the CAN.
|
||||
To enable non-root users to access CAN_RAW and CAN_BCM protocol
|
||||
sockets the Kconfig options CAN_RAW_USER and/or CAN_BCM_USER may be
|
||||
selected at kernel compile time.
|
||||
|
||||
3.4 network problem notifications
|
||||
3.3 network problem notifications
|
||||
|
||||
The use of the CAN bus may lead to several problems on the physical
|
||||
and media access control layer. Detecting and logging of these lower
|
||||
@ -286,8 +271,8 @@ solution for a couple of reasons:
|
||||
};
|
||||
|
||||
The alignment of the (linear) payload data[] to a 64bit boundary
|
||||
allows the user to define own structs and unions to easily access the
|
||||
CAN payload. There is no given byteorder on the CAN bus by
|
||||
allows the user to define their own structs and unions to easily access
|
||||
the CAN payload. There is no given byteorder on the CAN bus by
|
||||
default. A read(2) system call on a CAN_RAW socket transfers a
|
||||
struct can_frame to the user space.
|
||||
|
||||
@ -479,7 +464,7 @@ solution for a couple of reasons:
|
||||
|
||||
setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
|
||||
|
||||
To set the filters to zero filters is quite obsolete as not read
|
||||
To set the filters to zero filters is quite obsolete as to not read
|
||||
data causes the raw socket to discard the received CAN frames. But
|
||||
having this 'send only' use-case we may remove the receive list in the
|
||||
Kernel to save a little (really a very little!) CPU usage.
|
||||
@ -1105,7 +1090,7 @@ solution for a couple of reasons:
|
||||
|
||||
$ ip link set canX up type can bitrate 125000
|
||||
|
||||
A device may enter the "bus-off" state if too much errors occurred on
|
||||
A device may enter the "bus-off" state if too many errors occurred on
|
||||
the CAN bus. Then no more messages are received or sent. An automatic
|
||||
bus-off recovery can be enabled by setting the "restart-ms" to a
|
||||
non-zero value, e.g.:
|
||||
@ -1157,14 +1142,9 @@ solution for a couple of reasons:
|
||||
7. SocketCAN resources
|
||||
-----------------------
|
||||
|
||||
You can find further resources for Socket CAN like user space tools,
|
||||
support for old kernel versions, more drivers, mailing lists, etc.
|
||||
at the BerliOS OSS project website for Socket CAN:
|
||||
|
||||
http://developer.berlios.de/projects/socketcan
|
||||
|
||||
If you have questions, bug fixes, etc., don't hesitate to post them to
|
||||
the Socketcan-Users mailing list. But please search the archives first.
|
||||
The Linux CAN / SocketCAN project ressources (project site / mailing list)
|
||||
are referenced in the MAINTAINERS file in the Linux source tree.
|
||||
Search for CAN NETWORK [LAYERS|DRIVERS].
|
||||
|
||||
8. Credits
|
||||
----------
|
||||
|
@ -2008,6 +2008,7 @@ L: linux-can@vger.kernel.org
|
||||
W: http://gitorious.org/linux-can
|
||||
T: git git://gitorious.org/linux-can/linux-can-next.git
|
||||
S: Maintained
|
||||
F: Documentation/networking/can.txt
|
||||
F: net/can/
|
||||
F: include/linux/can/core.h
|
||||
F: include/uapi/linux/can.h
|
||||
|
@ -808,17 +808,19 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
|
||||
u32 num_rx_pkts = 0;
|
||||
unsigned int msg_obj, msg_ctrl_save;
|
||||
struct c_can_priv *priv = netdev_priv(dev);
|
||||
u32 val = c_can_read_reg32(priv, C_CAN_INTPND1_REG);
|
||||
u16 val;
|
||||
|
||||
for (msg_obj = C_CAN_MSG_OBJ_RX_FIRST;
|
||||
msg_obj <= C_CAN_MSG_OBJ_RX_LAST && quota > 0;
|
||||
val = c_can_read_reg32(priv, C_CAN_INTPND1_REG),
|
||||
msg_obj++) {
|
||||
/*
|
||||
* as interrupt pending register's bit n-1 corresponds to
|
||||
* message object n, we need to handle the same properly.
|
||||
* It is faster to read only one 16bit register. This is only possible
|
||||
* for a maximum number of 16 objects.
|
||||
*/
|
||||
if (val & (1 << (msg_obj - 1))) {
|
||||
BUILD_BUG_ON_MSG(C_CAN_MSG_OBJ_RX_LAST > 16,
|
||||
"Implementation does not support more message objects than 16");
|
||||
|
||||
while (quota > 0 && (val = priv->read_reg(priv, C_CAN_INTPND1_REG))) {
|
||||
while ((msg_obj = ffs(val)) && quota > 0) {
|
||||
val &= ~BIT(msg_obj - 1);
|
||||
|
||||
c_can_object_get(dev, 0, msg_obj, IF_COMM_ALL &
|
||||
~IF_COMM_TXRQST);
|
||||
msg_ctrl_save = priv->read_reg(priv,
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -28,8 +28,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*
|
||||
@ -1067,15 +1066,17 @@ static int mcp251x_can_probe(struct spi_device *spi)
|
||||
|
||||
/* Allocate non-DMA buffers */
|
||||
if (!mcp251x_enable_dma) {
|
||||
priv->spi_tx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL);
|
||||
priv->spi_tx_buf = devm_kzalloc(&spi->dev, SPI_TRANSFER_BUF_LEN,
|
||||
GFP_KERNEL);
|
||||
if (!priv->spi_tx_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto error_tx_buf;
|
||||
goto error_probe;
|
||||
}
|
||||
priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL);
|
||||
priv->spi_rx_buf = devm_kzalloc(&spi->dev, SPI_TRANSFER_BUF_LEN,
|
||||
GFP_KERNEL);
|
||||
if (!priv->spi_rx_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto error_rx_buf;
|
||||
goto error_probe;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1108,12 +1109,6 @@ static int mcp251x_can_probe(struct spi_device *spi)
|
||||
return ret;
|
||||
|
||||
error_probe:
|
||||
if (!mcp251x_enable_dma)
|
||||
kfree(priv->spi_rx_buf);
|
||||
error_rx_buf:
|
||||
if (!mcp251x_enable_dma)
|
||||
kfree(priv->spi_tx_buf);
|
||||
error_tx_buf:
|
||||
if (mcp251x_enable_dma)
|
||||
dma_free_coherent(&spi->dev, PAGE_SIZE,
|
||||
priv->spi_tx_buf, priv->spi_tx_dma);
|
||||
@ -1136,9 +1131,6 @@ static int mcp251x_can_remove(struct spi_device *spi)
|
||||
if (mcp251x_enable_dma) {
|
||||
dma_free_coherent(&spi->dev, PAGE_SIZE,
|
||||
priv->spi_tx_buf, priv->spi_tx_dma);
|
||||
} else {
|
||||
kfree(priv->spi_tx_buf);
|
||||
kfree(priv->spi_rx_buf);
|
||||
}
|
||||
|
||||
mcp251x_power_enable(priv->power, 0);
|
||||
|
@ -16,8 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -16,8 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -14,8 +14,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __MSCAN_H__
|
||||
|
@ -12,8 +12,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -26,8 +26,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -16,8 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -11,8 +11,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This is a generic driver for SJA1000 chips on the OpenFirmware platform
|
||||
|
@ -12,8 +12,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307. You can also get it
|
||||
* at http://www.gnu.org/licenses/gpl.html
|
||||
* with this program; if not, see http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/firmware.h>
|
||||
|
@ -13,8 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
Loading…
Reference in New Issue
Block a user