All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>,
	kbuild test robot <lkp@intel.com>,
	Maxime Jayat <maxime.jayat@mobile-devices.fr>,
	Robin van der Gracht <robin@protonic.nl>,
	linux-kernel@vger.kernel.org,
	Oleksij Rempel <linux@rempel-privat.de>,
	Paolo Abeni <pabeni@redhat.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	kernel@pengutronix.de, David Jander <david@protonic.nl>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-can@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH RESEND] can: j1939: do not wait 250ms if the same addr was already claimed
Date: Sat, 19 Nov 2022 11:12:11 +0100	[thread overview]
Message-ID: <20221119101211.GA7626@pengutronix.de> (raw)
In-Reply-To: <a01fe547c052e861d47089d6767aba639250adda.camel@egluetechnologies.com>

On Fri, Nov 18, 2022 at 04:12:40PM +0100, Devid Antonio Filoni wrote:
> Hi Oleksij,
> 
> honestly I would apply proposed patch because it is the easier solution
> and makes the driver compliant with the standard for the following
> reasons:
> - on the first claim, the kernel will wait 250 ms as stated by the
> standard
> + on successive claims with the same name, the kernel will not wait
> 250ms, this implies:
>   - it will not wait after sending the address-claimed message when the
> claimed address has been spoofed, but the standard does not explicitly
> states what to do in this case (see previous emails in this thread), so
> it would be up to the application developer to decide how to manage the
> conflict
>   - it will not wait after sending the address-claimed message when a
> request for address-claimed message has been received as stated by the
> standard

Standard says:
1. No CF _shall_ begin, or resume, transmission on the network until 250 ms
   after it has successfully claimed an address (Figure 4).
2. This does not apply when responding to a request for address claimed.

With current patch state: 1. is implemented and working as expected, 2.
is not implemented.
With this patch: 1. is partially broken and 2. is partially faking
needed behavior.

It will not wait if remote ECU which rebooted for some reasons. With this patch
we are breaking one case of the standard in favor to fake compatibility to the
other case. We should avoid waiting only based on presence of RfAC not based
on the old_addr == new_addr.

Without words 2. part should be implemented without breaking 1.

> Otherwise you will have to keep track of above cases and decide if the
> wait is needed or not, but this is hard do accomplish because is the
> application in charge of sending the address-claimed message, so you
> would have to decide how much to keep track of the request for address-
> claimed message thus adding more complexity to the code of the driver.

Current kernel already tracks all claims on the bus and knows all registered
NAMEs. I do not see increased complicity in this case.

IMHO, only missing part i a user space interface. Some thing like "ip n"
will do.

> Another solution is to let the driver send the address-claimed message
> waiting or without waiting 250 ms for successive messages depending on
> the case.

You can send "address-claimed message" in any time you wont. Kernel will
just not resolve the NAME to address until 1. part of the spec will
apply. Do not forget, the NAME cache is used for local _and_ remote
names. You can trick out local system, not remote.

Even if you implement "smart" logic in user space and will know better
then kernel, that this application is responding to RfAC. You will newer
know if address-claimed message of remote system is a response to RfAC.

From this perspective, I do not know, how allowing the user space break
the rules will help to solve the problem?

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2022-11-19 10:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 17:03 [PATCH RESEND] can: j1939: do not wait 250ms if the same addr was already claimed Devid Antonio Filoni
2022-05-09 19:04 ` Kurt Van Dijck
2022-05-10  4:26   ` Oleksij Rempel
2022-05-10 11:00     ` Devid Antonio Filoni
2022-05-11  8:47       ` Oleksij Rempel
2022-05-11  9:06         ` David Jander
2022-05-11 12:55           ` Devid Antonio Filoni
2022-05-11 14:22             ` David Jander
2022-05-13  9:46               ` Devid Antonio Filoni
2022-11-17 14:08                 ` Devid Antonio Filoni
2022-11-17 15:22                   ` David Jander
2022-11-18  6:06                     ` Oleksij Rempel
2022-11-18 10:25                       ` Devid Antonio Filoni
2022-11-18 12:30                         ` Oleksij Rempel
2022-11-18 12:41                           ` Devid Antonio Filoni
2022-11-18 13:44                             ` Oleksij Rempel
2022-11-18 15:12                               ` Devid Antonio Filoni
2022-11-19 10:12                                 ` Oleksij Rempel [this message]
2022-11-20  0:11                                   ` Devid Antonio Filoni
2022-11-20  8:45                                     ` Oleksij Rempel
2022-11-20 19:18                                       ` Devid Antonio Filoni
2022-11-21  5:19                                         ` Oleksij Rempel
2022-11-23 20:39                                           ` Devid Antonio Filoni
2022-11-24  5:16                                             ` Oleksij Rempel
2022-11-25 17:04                                               ` [PATCH v2] can: j1939: do not wait 250 ms " Devid Antonio Filoni
2022-11-26 10:28                                                 ` Oleksij Rempel
2023-02-07 13:50                                                   ` Devid Antonio Filoni
2023-02-07 14:05                                                     ` Marc Kleine-Budde

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=20221119101211.GA7626@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=david@protonic.nl \
    --cc=dev.kurt@vandijck-laurijssen.be \
    --cc=devid.filoni@egluetechnologies.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=lkp@intel.com \
    --cc=maxime.jayat@mobile-devices.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robin@protonic.nl \
    --cc=socketcan@hartkopp.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.