Message ID | 1456915359-6775-3-git-send-email-marex@denx.de |
---|---|
State | Awaiting Upstream, archived |
Delegated to: | David Miller |
Headers | show |
Hi Marek, sorry for picking this patch up again. After looking around in the original source I have one more comment: On 03/02/2016 11:42 AM, Marek Vasut wrote: > - if (priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)) { > - if (can_is_canfd_skb(skb)) { > - txdlc |= IFI_CANFD_TXFIFO_DLC_EDL; > - if (cf->flags & CANFD_BRS) > - txdlc |= IFI_CANFD_TXFIFO_DLC_BRS; > - } > + txdlc |= can_len2dlc(cf->len); At the top of the function you defined u32 txst, txid; u32 txdlc = 0; and here you use 'txdlc |= ...'. That's weird style IMO. Please change it to u32 txst, txid, txdlc; and txdlc = can_len2dlc(cf->len); Thanks, Oliver
On 03/02/2016 07:46 PM, Oliver Hartkopp wrote: > Hi Marek, Hi! > sorry for picking this patch up again. nothing to be sorry about, thanks for the input :) > After looking around in the original source I have one more comment: > > On 03/02/2016 11:42 AM, Marek Vasut wrote: > >> - if (priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)) { >> - if (can_is_canfd_skb(skb)) { >> - txdlc |= IFI_CANFD_TXFIFO_DLC_EDL; >> - if (cf->flags & CANFD_BRS) >> - txdlc |= IFI_CANFD_TXFIFO_DLC_BRS; >> - } >> + txdlc |= can_len2dlc(cf->len); > > At the top of the function you defined > > u32 txst, txid; > u32 txdlc = 0; > > and here you use 'txdlc |= ...'. > > That's weird style IMO. > > Please change it to > > u32 txst, txid, txdlc; > > and > > txdlc = can_len2dlc(cf->len); I'll send a V3 shortly. btw. I forgot to add V2 to the 3/4 and 4/4 patches, sigh.
diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c index 72f5205..4bbc7d9 100644 --- a/drivers/net/can/ifi_canfd/ifi_canfd.c +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c @@ -772,12 +772,11 @@ static netdev_tx_t ifi_canfd_start_xmit(struct sk_buff *skb, txid = cf->can_id & CAN_SFF_MASK; } - if (priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)) { - if (can_is_canfd_skb(skb)) { - txdlc |= IFI_CANFD_TXFIFO_DLC_EDL; - if (cf->flags & CANFD_BRS) - txdlc |= IFI_CANFD_TXFIFO_DLC_BRS; - } + txdlc |= can_len2dlc(cf->len); + if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) && can_is_canfd_skb(skb)) { + txdlc |= IFI_CANFD_TXFIFO_DLC_EDL; + if (cf->flags & CANFD_BRS) + txdlc |= IFI_CANFD_TXFIFO_DLC_BRS; } if (cf->can_id & CAN_RTR_FLAG)
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 <marex@denx.de> Cc: Marc Kleine-Budde <mkl@pengutronix.de> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Oliver Hartkopp <socketcan@hartkopp.net> Cc: Wolfgang Grandegger <wg@grandegger.com> --- V2: - Use can_len2dlc() unconditionally to sanitize DLC in the TX path - The CAN_CTRLMODE_CANFD_NON_ISO can only ever be set if the CANFD_CTRLMODE_CANFD is set. Use only the later for checking if the core transmits in CANFD mode. --- drivers/net/can/ifi_canfd/ifi_canfd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)