summaryrefslogtreecommitdiff
path: root/drivers/net/can/rx-offload.c
diff options
context:
space:
mode:
authorJoakim Zhang <qiangqing.zhang@nxp.com>2018-10-18 13:06:19 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:34:43 +0800
commit2fe3a436eab38178d074ad5e1d01c827207dc1a4 (patch)
tree593e38c3a50c78976d7cc611ee8def32c396774a /drivers/net/can/rx-offload.c
parentaa984877f4c464c0fe4fd75c20178c785dfbbc72 (diff)
MLK-19787 can: flexcan: fix CAN can't receive remote request frame
The flexcan driver allocates canfd-skb no matter whether use CAN FD mode or not, it's unreasonable due to it will affect the parse of the remote request frame. To fix the issue, allocating can-skb with "alloc_can_skb()" in normal mode and canfd-skb with "alloc_canfd_skb()" in fd mode. Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Diffstat (limited to 'drivers/net/can/rx-offload.c')
-rw-r--r--drivers/net/can/rx-offload.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c
index 3a7601930243..37535b03e028 100644
--- a/drivers/net/can/rx-offload.c
+++ b/drivers/net/can/rx-offload.c
@@ -125,8 +125,12 @@ static struct sk_buff *can_rx_offload_offload_one(struct can_rx_offload *offload
/* If queue is full or skb not available, read to discard mailbox */
if (likely(skb_queue_len(&offload->skb_queue) <=
- offload->skb_queue_len_max))
- skb = alloc_canfd_skb(offload->dev, &cf);
+ offload->skb_queue_len_max)) {
+ if (offload->is_canfd)
+ skb = alloc_canfd_skb(offload->dev, &cf);
+ else
+ skb = alloc_can_skb(offload->dev, (struct can_frame **)&cf);
+ }
if (!skb) {
struct canfd_frame cf_overflow;