[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230506105529.4023-1-carsten.schmidt-achim@t-online.de>
Date: Sat, 6 May 2023 12:55:22 +0200
From: Carsten Schmidt <carsten.schmidt-achim@...nline.de>
To:
Cc: socketcan@...tkopp.net,
Carsten Schmidt <carsten.schmidt-achim@...nline.de>,
Wolfgang Grandegger <wg@...ndegger.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jimmy Assarsson <extja@...ser.com>,
Anssi Hannula <anssi.hannula@...wise.fi>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
linux-can@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] can: kvaser_usb_leaf: Implement CAN 2.0 raw DLC functionality.
Signed-off-by: Carsten Schmidt <carsten.schmidt-achim@...nline.de>
---
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
index 1c2f99ce4c6c..713b633773b1 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
@@ -573,7 +573,7 @@ kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,
cmd->u.tx_can.data[1] = cf->can_id & 0x3f;
}
- cmd->u.tx_can.data[5] = cf->len;
+ cmd->u.tx_can.data[5] = can_get_cc_dlc(cf, priv->can.ctrlmode);
memcpy(&cmd->u.tx_can.data[6], cf->data, cf->len);
if (cf->can_id & CAN_RTR_FLAG)
@@ -1349,7 +1349,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
else
cf->can_id &= CAN_SFF_MASK;
- cf->len = can_cc_dlc2len(cmd->u.leaf.log_message.dlc);
+ can_frame_set_cc_len(cf, cmd->u.leaf.log_message.dlc & 0xF, priv->can.ctrlmode);
if (cmd->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME)
cf->can_id |= CAN_RTR_FLAG;
@@ -1367,7 +1367,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
cf->can_id |= CAN_EFF_FLAG;
}
- cf->len = can_cc_dlc2len(rx_data[5]);
+ can_frame_set_cc_len(cf, rx_data[5] & 0xF, priv->can.ctrlmode);
if (cmd->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME)
cf->can_id |= CAN_RTR_FLAG;
@@ -1702,6 +1702,7 @@ static int kvaser_usb_leaf_init_card(struct kvaser_usb *dev)
struct kvaser_usb_dev_card_data *card_data = &dev->card_data;
card_data->ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
+ card_data->ctrlmode_supported |= CAN_CTRLMODE_CC_LEN8_DLC;
return 0;
}
--
2.34.1
Powered by blists - more mailing lists