Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) // Copyright (c) 2010-2011 EIA Electronics,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) //                         Kurt Van Dijck <kurt.van.dijck@eia.be>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) // Copyright (c) 2010-2011 EIA Electronics,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) //                         Pieter Beyens <pieter.beyens@eia.be>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) // Copyright (c) 2017-2019 Pengutronix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) //                         Marc Kleine-Budde <kernel@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) // Copyright (c) 2017-2019 Pengutronix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) //                         Oleksij Rempel <kernel@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /* J1939 Address Claiming.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Address Claiming in the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * - keeps track of the AC states of ECU's,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * - resolves NAME<=>SA taking into account the AC states of ECU's.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * All Address Claim msgs (including host-originated msg) are processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * at the receive path (a sent msg is always received again via CAN echo).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * As such, the processing of AC msgs is done in the order on which msgs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * are sent on the bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * This module doesn't send msgs itself (e.g. replies on Address Claims),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * this is the responsibility of a user space application or daemon.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include "j1939-priv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) static inline name_t j1939_skb_to_name(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	return le64_to_cpup((__le64 *)skb->data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static inline bool j1939_ac_msg_is_request(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	int req_pgn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	if (skb->len < 3 || skcb->addr.pgn != J1939_PGN_REQUEST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	req_pgn = skb->data[0] | (skb->data[1] << 8) | (skb->data[2] << 16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	return req_pgn == J1939_PGN_ADDRESS_CLAIMED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static int j1939_ac_verify_outgoing(struct j1939_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 				    struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	if (skb->len != 8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		netdev_notice(priv->ndev, "tx address claim with dlc %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 			      skb->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	if (skcb->addr.src_name != j1939_skb_to_name(skb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		netdev_notice(priv->ndev, "tx address claim with different name\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	if (skcb->addr.sa == J1939_NO_ADDR) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		netdev_notice(priv->ndev, "tx address claim with broadcast sa\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* ac must always be a broadcast */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	if (skcb->addr.dst_name || skcb->addr.da != J1939_NO_ADDR) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		netdev_notice(priv->ndev, "tx address claim with dest, not broadcast\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) int j1939_ac_fixup(struct j1939_priv *priv, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	u8 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	/* network mgmt: address claiming msgs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	if (skcb->addr.pgn == J1939_PGN_ADDRESS_CLAIMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		struct j1939_ecu *ecu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		ret = j1939_ac_verify_outgoing(priv, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		/* return both when failure & when successful */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		ecu = j1939_ecu_get_by_name(priv, skcb->addr.src_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		if (!ecu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		if (ecu->addr != skcb->addr.sa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 			/* hold further traffic for ecu, remove from parent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			j1939_ecu_unmap(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		j1939_ecu_put(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	} else if (skcb->addr.src_name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		/* assign source address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		addr = j1939_name_to_addr(priv, skcb->addr.src_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		if (!j1939_address_is_unicast(addr) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		    !j1939_ac_msg_is_request(skb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			netdev_notice(priv->ndev, "tx drop: invalid sa for name 0x%016llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 				      skcb->addr.src_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			return -EADDRNOTAVAIL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		skcb->addr.sa = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/* assign destination address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	if (skcb->addr.dst_name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		addr = j1939_name_to_addr(priv, skcb->addr.dst_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		if (!j1939_address_is_unicast(addr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			netdev_notice(priv->ndev, "tx drop: invalid da for name 0x%016llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				      skcb->addr.dst_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			return -EADDRNOTAVAIL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		skcb->addr.da = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) static void j1939_ac_process(struct j1939_priv *priv, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	struct j1939_ecu *ecu, *prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	name_t name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	if (skb->len != 8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		netdev_notice(priv->ndev, "rx address claim with wrong dlc %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			      skb->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	name = j1939_skb_to_name(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	skcb->addr.src_name = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (!name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		netdev_notice(priv->ndev, "rx address claim without name\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	if (!j1939_address_is_valid(skcb->addr.sa)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		netdev_notice(priv->ndev, "rx address claim with broadcast sa\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	write_lock_bh(&priv->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	/* Few words on the ECU ref counting:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	 * First we get an ECU handle, either with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	 * j1939_ecu_get_by_name_locked() (increments the ref counter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	 * or j1939_ecu_create_locked() (initializes an ECU object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	 * with a ref counter of 1).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	 * j1939_ecu_unmap_locked() will decrement the ref counter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	 * but only if the ECU was mapped before. So "ecu" still
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 * belongs to us.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 * j1939_ecu_timer_start() will increment the ref counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 * before it starts the timer, so we can put the ecu when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 * leaving this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	ecu = j1939_ecu_get_by_name_locked(priv, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	if (!ecu && j1939_address_is_unicast(skcb->addr.sa))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		ecu = j1939_ecu_create_locked(priv, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	if (IS_ERR_OR_NULL(ecu))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		goto out_unlock_bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	/* cancel pending (previous) address claim */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	j1939_ecu_timer_cancel(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	if (j1939_address_is_idle(skcb->addr.sa)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		j1939_ecu_unmap_locked(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		goto out_ecu_put;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	/* save new addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	if (ecu->addr != skcb->addr.sa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		j1939_ecu_unmap_locked(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	ecu->addr = skcb->addr.sa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	prev = j1939_ecu_get_by_addr_locked(priv, skcb->addr.sa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (prev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		if (ecu->name > prev->name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			j1939_ecu_unmap_locked(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			j1939_ecu_put(prev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			goto out_ecu_put;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			/* kick prev if less or equal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			j1939_ecu_unmap_locked(prev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 			j1939_ecu_put(prev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	j1939_ecu_timer_start(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  out_ecu_put:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	j1939_ecu_put(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  out_unlock_bh:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	write_unlock_bh(&priv->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) void j1939_ac_recv(struct j1939_priv *priv, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	struct j1939_ecu *ecu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	/* network mgmt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	if (skcb->addr.pgn == J1939_PGN_ADDRESS_CLAIMED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		j1939_ac_process(priv, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	} else if (j1939_address_is_unicast(skcb->addr.sa)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		/* assign source name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		ecu = j1939_ecu_get_by_addr(priv, skcb->addr.sa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		if (ecu) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			skcb->addr.src_name = ecu->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			j1939_ecu_put(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	/* assign destination name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	ecu = j1939_ecu_get_by_addr(priv, skcb->addr.da);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	if (ecu) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		skcb->addr.dst_name = ecu->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		j1939_ecu_put(ecu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }