netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marek Vasut <marex@denx.de>, linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>,
	Mark Rutland <mark.rutland@arm.com>,
	Wolfgang Grandegger <wg@grandegger.com>
Subject: Re: [PATCH 2/4] net: can: ifi: Fix TX DLC configuration
Date: Tue, 1 Mar 2016 19:11:32 +0100	[thread overview]
Message-ID: <56D5DB54.6000600@hartkopp.net> (raw)
In-Reply-To: <1456775971-4946-3-git-send-email-marex@denx.de>



On 02/29/2016 08:59 PM, Marek Vasut wrote:
> 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>
> ---
>  drivers/net/can/ifi_canfd/ifi_canfd.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c
> index 72f5205..82a33bd 100644
> --- a/drivers/net/can/ifi_canfd/ifi_canfd.c
> +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c
> @@ -774,10 +774,15 @@ static netdev_tx_t ifi_canfd_start_xmit(struct sk_buff *skb,
>  
>  	if (priv->can.ctrlmode & (CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO)) {
>  		if (can_is_canfd_skb(skb)) {
> +			txdlc |= can_len2dlc(cf->len);
>  			txdlc |= IFI_CANFD_TXFIFO_DLC_EDL;
>  			if (cf->flags & CANFD_BRS)
>  				txdlc |= IFI_CANFD_TXFIFO_DLC_BRS;
> +		} else {
> +			txdlc |= cf->len;
>  		}
> +	} else {
> +		txdlc |= cf->len;
>  	}

Please use

	txdlc |= can_len2dlc(cf->len);

by default (it works for CAN and CAN FD).

So that it looks more like:

	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;
	}

Testing against CAN_CTRLMODE_FD_NON_ISO is wrong!
This configuration bit is just for the protocol on the wire and is no
distinction for CAN / CAN FD.

Best regards,
Oliver

>  
>  	if (cf->can_id & CAN_RTR_FLAG)
> 

  reply	other threads:[~2016-03-01 18:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 19:59 [PATCH 0/4] Synchronise IFI CANFD driver with real world Marek Vasut
2016-02-29 19:59 ` [PATCH 1/4] net: can: ifi: Fix clock generator configuration Marek Vasut
2016-02-29 19:59 ` [PATCH 2/4] net: can: ifi: Fix TX DLC configuration Marek Vasut
2016-03-01 18:11   ` Oliver Hartkopp [this message]
2016-03-01 21:27     ` Marek Vasut
2016-03-02  6:12       ` Oliver Hartkopp
2016-03-02 10:37         ` Marek Vasut
2016-02-29 19:59 ` [PATCH 3/4] net: can: ifi: Fix RX and TX ID mask Marek Vasut
2016-03-01 17:49   ` Oliver Hartkopp
2016-03-01 21:23     ` Marek Vasut
2016-03-02  6:10       ` Oliver Hartkopp
2016-03-02 10:28         ` Marek Vasut
2016-02-29 19:59 ` [PATCH 4/4] net: can: ifi: Add obscure bit swap for EFF frame IDs Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D5DB54.6000600@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).