Skip to content

Commit 4ae5e1e

Browse files
dfiloni-egluemarckleinebudde
authored andcommitted
can: j1939: do not wait 250 ms if the same addr was already claimed
The ISO 11783-5 standard, in "4.5.2 - Address claim requirements", states: d) No CF shall begin, or resume, transmission on the network until 250 ms after it has successfully claimed an address except when responding to a request for address-claimed. But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim prioritization" show that the CF begins the transmission after 250 ms from the first AC (address-claimed) message even if it sends another AC message during that time window to resolve the address contention with another CF. As stated in "4.4.2.3 - Address-claimed message": In order to successfully claim an address, the CF sending an address claimed message shall not receive a contending claim from another CF for at least 250 ms. As stated in "4.4.3.2 - NAME management (NM) message": 1) A commanding CF can d) request that a CF with a specified NAME transmit the address- claimed message with its current NAME. 2) A target CF shall d) send an address-claimed message in response to a request for a matching NAME Taking the above arguments into account, the 250 ms wait is requested only during network initialization. Do not restart the timer on AC message if both the NAME and the address match and so if the address has already been claimed (timer has expired) or the AC message has been sent to resolve the contention with another CF (timer is still running). Signed-off-by: Devid Antonio Filoni <[email protected]> Acked-by: Oleksij Rempel <[email protected]> Link: https://lore.kernel.org/all/[email protected] Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol") Cc: [email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 811d581 commit 4ae5e1e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

net/can/j1939/address-claim.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,46 @@ static void j1939_ac_process(struct j1939_priv *priv, struct sk_buff *skb)
165165
* leaving this function.
166166
*/
167167
ecu = j1939_ecu_get_by_name_locked(priv, name);
168+
169+
if (ecu && ecu->addr == skcb->addr.sa) {
170+
/* The ISO 11783-5 standard, in "4.5.2 - Address claim
171+
* requirements", states:
172+
* d) No CF shall begin, or resume, transmission on the
173+
* network until 250 ms after it has successfully claimed
174+
* an address except when responding to a request for
175+
* address-claimed.
176+
*
177+
* But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim
178+
* prioritization" show that the CF begins the transmission
179+
* after 250 ms from the first AC (address-claimed) message
180+
* even if it sends another AC message during that time window
181+
* to resolve the address contention with another CF.
182+
*
183+
* As stated in "4.4.2.3 - Address-claimed message":
184+
* In order to successfully claim an address, the CF sending
185+
* an address claimed message shall not receive a contending
186+
* claim from another CF for at least 250 ms.
187+
*
188+
* As stated in "4.4.3.2 - NAME management (NM) message":
189+
* 1) A commanding CF can
190+
* d) request that a CF with a specified NAME transmit
191+
* the address-claimed message with its current NAME.
192+
* 2) A target CF shall
193+
* d) send an address-claimed message in response to a
194+
* request for a matching NAME
195+
*
196+
* Taking the above arguments into account, the 250 ms wait is
197+
* requested only during network initialization.
198+
*
199+
* Do not restart the timer on AC message if both the NAME and
200+
* the address match and so if the address has already been
201+
* claimed (timer has expired) or the AC message has been sent
202+
* to resolve the contention with another CF (timer is still
203+
* running).
204+
*/
205+
goto out_ecu_put;
206+
}
207+
168208
if (!ecu && j1939_address_is_unicast(skcb->addr.sa))
169209
ecu = j1939_ecu_create_locked(priv, name);
170210

0 commit comments

Comments
 (0)