Skip to content

Commit f1deaee

Browse files
Marek Vasutmarckleinebudde
authored andcommitted
can: ifi: Fix TX DLC configuration
The TX DLC, the transmission length information, was not written into the transmit configuration register. When using the CAN core with different CAN controller, the receiving CAN controller will receive only the ID part of the CAN frame, but no data at all. This patch adds the TX DLC into the register to fix this issue. Signed-off-by: Marek Vasut <[email protected]> Cc: Marc Kleine-Budde <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Oliver Hartkopp <[email protected]> Cc: Wolfgang Grandegger <[email protected]> Reviewed-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 99312c3 commit f1deaee

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/net/can/ifi_canfd/ifi_canfd.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,7 @@ static netdev_tx_t ifi_canfd_start_xmit(struct sk_buff *skb,
749749
{
750750
struct ifi_canfd_priv *priv = netdev_priv(ndev);
751751
struct canfd_frame *cf = (struct canfd_frame *)skb->data;
752-
u32 txst, txid;
753-
u32 txdlc = 0;
752+
u32 txst, txid, txdlc;
754753
int i;
755754

756755
if (can_dropped_invalid_skb(ndev, skb))
@@ -773,12 +772,11 @@ static netdev_tx_t ifi_canfd_start_xmit(struct sk_buff *skb,
773772
txid = cf->can_id & CAN_SFF_MASK;
774773
}
775774

776-
if (priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)) {
777-
if (can_is_canfd_skb(skb)) {
778-
txdlc |= IFI_CANFD_TXFIFO_DLC_EDL;
779-
if (cf->flags & CANFD_BRS)
780-
txdlc |= IFI_CANFD_TXFIFO_DLC_BRS;
781-
}
775+
txdlc = can_len2dlc(cf->len);
776+
if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) && can_is_canfd_skb(skb)) {
777+
txdlc |= IFI_CANFD_TXFIFO_DLC_EDL;
778+
if (cf->flags & CANFD_BRS)
779+
txdlc |= IFI_CANFD_TXFIFO_DLC_BRS;
782780
}
783781

784782
if (cf->can_id & CAN_RTR_FLAG)

0 commit comments

Comments
 (0)