hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/can/j1939/address-claim.c
....@@ -165,6 +165,46 @@
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