/* Timeout to receive the abort signal over loop back. In case CAN *busisopen,thetimeoutshouldbetriggered.
*/ #define J1939_XTP_ABORT_TIMEOUT_MS 500 #define J1939_SIMPLE_ECHO_TIMEOUT_MS (10 * 1000)
/* indicates that this ecu successfully claimed @sa as its address */ struct hrtimer ac_timer; struct kref kref; struct j1939_priv *priv;
/* count users, to help transport protocol decide for interaction */ int nusers;
};
struct j1939_priv { struct list_head ecus; /* local list entry in priv *Theseallowirq(&softirq)contextlookupsonj1939devices *Thisapproach(separatelists)isdoneastheother2alternatives *arenoteasierorevenwrong *1)usingthepurekobjectmethodsinvolvesmutexes,whicharenot *allowedinirqcontext. *2)duplicatingdatastructureswouldrequirealotofsynchronization *code *usage:
*/
/* segments need a lock to protect the above list */
rwlock_t lock;
struct net_device *ndev;
/* list of 256 ecu ptrs, that cache the claimed addresses. *alsoprotectedbytheabovelock
*/ struct j1939_addr_ent { struct j1939_ecu *ecu; /* count users, to help transport protocol */ int nusers;
} ents[256];
struct kref kref;
/* List of active sessions to prevent start of conflicting *one. * *Donotstarttwosessionsofsametype,addressesand *direction.
*/ struct list_head active_session_list;
/* lock for j1939_socks list */
rwlock_t j1939_socks_lock; struct list_head j1939_socks;
struct kref rx_kref;
u32 rx_tskey;
};
void j1939_ecu_put(struct j1939_ecu *ecu);
/* keep the cache of what is local */ int j1939_local_ecu_get(struct j1939_priv *priv, name_t name, u8 sa); void j1939_local_ecu_put(struct j1939_priv *priv, name_t name, u8 sa);
/* notify/alert all j1939 sockets bound to ifindex */ void j1939_sk_netdev_event_netdown(struct j1939_priv *priv); void j1939_sk_netdev_event_unregister(struct j1939_priv *priv); int j1939_cancel_active_session(struct j1939_priv *priv, struct sock *sk); void j1939_tp_init(struct j1939_priv *priv);
/* decrement pending skb for a j1939 socket */ void j1939_sock_pending_del(struct sock *sk);
enum j1939_session_state {
J1939_SESSION_NEW,
J1939_SESSION_ACTIVE, /* waiting for abort signal on the bus */
J1939_SESSION_WAITING_ABORT,
J1939_SESSION_ACTIVE_MAX,
J1939_SESSION_DONE,
};
/* all tx related stuff (last_txcmd, pkt.tx) *isprotected(modifiedonly)withthetxtimerhrtimer *'total'&'block'areneverchanged, *last_cmd,last&blockareprotectedby->lock *thismeansthatthetxmayrunafterctsisreceivedthatshould *havestoppedtx,butthistimediscrepancyisneveravoidedanyhow
*/
u8 last_cmd, last_txcmd; bool transmission; bool extd; /* Total message size, number of bytes */ unsignedint total_message_size; /* Total number of bytes queue from socket to the session */ unsignedint total_queued_size; unsignedint tx_retry;
int err;
u32 tskey; enum j1939_session_state state;
/* Packets counters for a (extended) transfer session. The packet is *maximalof7bytes.
*/ struct { /* total - total number of packets for this session */ unsignedint total; /* last - last packet of a transfer block after which *respondershouldsendETP.CM_CTSandoriginator *ETP.CM_DPO
*/ unsignedint last; /* tx - number of packets send by originator node. *thiscountercanbesetbackifrespondernode *didn'treceivedallpacketssendbyoriginator.
*/ unsignedint tx; unsignedint tx_acked; /* rx - number of packets received */ unsignedint rx; /* block - amount of packets expected in one block */ unsignedint block; /* dpo - ETP.CM_DPO, Data Packet Offset */ unsignedint dpo;
} pkt; struct hrtimer txtimer, rxtimer;
};
struct j1939_sock { struct sock sk; /* must be first to skip with memset */ struct j1939_priv *priv; struct list_head list;
int ifindex; struct j1939_addr addr;
spinlock_t filters_lock; struct j1939_filter *filters; int nfilters;
pgn_t pgn_rx_filter;
/* j1939 may emit equal PGN (!= equal CAN-id's) out of order *whentransportprotocolcomesin. *Toallowemittinginorder,keepa'pending'nr.ofpackets
*/
atomic_t skb_pending;
wait_queue_head_t waitq;
/* lock for the sk_session_queue list */
spinlock_t sk_session_queue_lock; struct list_head sk_session_queue;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.