Commit d0372504 authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-fixes-for-4.0-20150309' of...

Merge tag 'linux-can-fixes-for-4.0-20150309' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2015-03-09

this is a pull request for net/master for the 4.0 release cycle, it consists of
6 patches:

A patch by Oliver Hartkopp fixes a long outstanding bug in the infrastructure,
which leads to skb_under_panics when CAN interfaces are used by AF_PACKET
sockets e.g. by dhclient. Stephane Grosjean contributes a patch for the
peak_usb driver which adds a missing initialization. Two patches by Ahmed S.
Darwish fix problems in the kvaser_usb driver. Followed by two patches by
myself, updating the MAINTAINERS file
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c247f053 f7214cf2
...@@ -2369,8 +2369,9 @@ F: arch/x86/include/asm/tce.h ...@@ -2369,8 +2369,9 @@ F: arch/x86/include/asm/tce.h
CAN NETWORK LAYER CAN NETWORK LAYER
M: Oliver Hartkopp <socketcan@hartkopp.net> M: Oliver Hartkopp <socketcan@hartkopp.net>
M: Marc Kleine-Budde <mkl@pengutronix.de>
L: linux-can@vger.kernel.org L: linux-can@vger.kernel.org
W: http://gitorious.org/linux-can W: https://github.com/linux-can
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
S: Maintained S: Maintained
...@@ -2386,7 +2387,7 @@ CAN NETWORK DRIVERS ...@@ -2386,7 +2387,7 @@ CAN NETWORK DRIVERS
M: Wolfgang Grandegger <wg@grandegger.com> M: Wolfgang Grandegger <wg@grandegger.com>
M: Marc Kleine-Budde <mkl@pengutronix.de> M: Marc Kleine-Budde <mkl@pengutronix.de>
L: linux-can@vger.kernel.org L: linux-can@vger.kernel.org
W: http://gitorious.org/linux-can W: https://github.com/linux-can
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
S: Maintained S: Maintained
......
...@@ -579,6 +579,10 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) ...@@ -579,6 +579,10 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
skb->pkt_type = PACKET_BROADCAST; skb->pkt_type = PACKET_BROADCAST;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
can_skb_reserve(skb); can_skb_reserve(skb);
can_skb_prv(skb)->ifindex = dev->ifindex; can_skb_prv(skb)->ifindex = dev->ifindex;
...@@ -603,6 +607,10 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, ...@@ -603,6 +607,10 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
skb->pkt_type = PACKET_BROADCAST; skb->pkt_type = PACKET_BROADCAST;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
can_skb_reserve(skb); can_skb_reserve(skb);
can_skb_prv(skb)->ifindex = dev->ifindex; can_skb_prv(skb)->ifindex = dev->ifindex;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* Copyright (C) 2015 Valeo S.A. * Copyright (C) 2015 Valeo S.A.
*/ */
#include <linux/kernel.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -584,8 +585,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, ...@@ -584,8 +585,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id,
while (pos <= actual_len - MSG_HEADER_LEN) { while (pos <= actual_len - MSG_HEADER_LEN) {
tmp = buf + pos; tmp = buf + pos;
if (!tmp->len) /* Handle messages crossing the USB endpoint max packet
break; * size boundary. Check kvaser_usb_read_bulk_callback()
* for further details.
*/
if (tmp->len == 0) {
pos = round_up(pos,
dev->bulk_in->wMaxPacketSize);
continue;
}
if (pos + tmp->len > actual_len) { if (pos + tmp->len > actual_len) {
dev_err(dev->udev->dev.parent, dev_err(dev->udev->dev.parent,
...@@ -787,7 +795,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, ...@@ -787,7 +795,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
netdev_err(netdev, "Error transmitting URB\n"); netdev_err(netdev, "Error transmitting URB\n");
usb_unanchor_urb(urb); usb_unanchor_urb(urb);
usb_free_urb(urb); usb_free_urb(urb);
kfree(buf);
return err; return err;
} }
...@@ -1317,8 +1324,19 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) ...@@ -1317,8 +1324,19 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
while (pos <= urb->actual_length - MSG_HEADER_LEN) { while (pos <= urb->actual_length - MSG_HEADER_LEN) {
msg = urb->transfer_buffer + pos; msg = urb->transfer_buffer + pos;
if (!msg->len) /* The Kvaser firmware can only read and write messages that
break; * does not cross the USB's endpoint wMaxPacketSize boundary.
* If a follow-up command crosses such boundary, firmware puts
* a placeholder zero-length command in its place then aligns
* the real command to the next max packet size.
*
* Handle such cases or we're going to miss a significant
* number of events in case of a heavy rx load on the bus.
*/
if (msg->len == 0) {
pos = round_up(pos, dev->bulk_in->wMaxPacketSize);
continue;
}
if (pos + msg->len > urb->actual_length) { if (pos + msg->len > urb->actual_length) {
dev_err(dev->udev->dev.parent, "Format error\n"); dev_err(dev->udev->dev.parent, "Format error\n");
...@@ -1326,7 +1344,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) ...@@ -1326,7 +1344,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
} }
kvaser_usb_handle_message(dev, msg); kvaser_usb_handle_message(dev, msg);
pos += msg->len; pos += msg->len;
} }
...@@ -1615,8 +1632,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, ...@@ -1615,8 +1632,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
struct urb *urb; struct urb *urb;
void *buf; void *buf;
struct kvaser_msg *msg; struct kvaser_msg *msg;
int i, err; int i, err, ret = NETDEV_TX_OK;
int ret = NETDEV_TX_OK;
u8 *msg_tx_can_flags = NULL; /* GCC */ u8 *msg_tx_can_flags = NULL; /* GCC */
if (can_dropped_invalid_skb(netdev, skb)) if (can_dropped_invalid_skb(netdev, skb))
...@@ -1634,7 +1650,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, ...@@ -1634,7 +1650,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
if (!buf) { if (!buf) {
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto nobufmem; goto freeurb;
} }
msg = buf; msg = buf;
...@@ -1681,8 +1697,10 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, ...@@ -1681,8 +1697,10 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
/* This should never happen; it implies a flow control bug */ /* This should never happen; it implies a flow control bug */
if (!context) { if (!context) {
netdev_warn(netdev, "cannot find free context\n"); netdev_warn(netdev, "cannot find free context\n");
kfree(buf);
ret = NETDEV_TX_BUSY; ret = NETDEV_TX_BUSY;
goto releasebuf; goto freeurb;
} }
context->priv = priv; context->priv = priv;
...@@ -1719,16 +1737,12 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, ...@@ -1719,16 +1737,12 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
else else
netdev_warn(netdev, "Failed tx_urb %d\n", err); netdev_warn(netdev, "Failed tx_urb %d\n", err);
goto releasebuf; goto freeurb;
} }
usb_free_urb(urb); ret = NETDEV_TX_OK;
return NETDEV_TX_OK;
releasebuf: freeurb:
kfree(buf);
nobufmem:
usb_free_urb(urb); usb_free_urb(urb);
return ret; return ret;
} }
......
...@@ -879,6 +879,10 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) ...@@ -879,6 +879,10 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
pdev->usb_if = ppdev->usb_if; pdev->usb_if = ppdev->usb_if;
pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr; pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr;
/* do a copy of the ctrlmode[_supported] too */
dev->can.ctrlmode = ppdev->dev.can.ctrlmode;
dev->can.ctrlmode_supported = ppdev->dev.can.ctrlmode_supported;
} }
pdev->usb_if->dev[dev->ctrl_idx] = dev; pdev->usb_if->dev[dev->ctrl_idx] = dev;
......
...@@ -259,6 +259,9 @@ int can_send(struct sk_buff *skb, int loop) ...@@ -259,6 +259,9 @@ int can_send(struct sk_buff *skb, int loop)
goto inval_skb; goto inval_skb;
} }
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb_reset_mac_header(skb);
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_reset_transport_header(skb); skb_reset_transport_header(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment