xref: /openbmc/linux/net/can/j1939/j1939-priv.h (revision cd85d3aed5cf4410e42ea404db0abb648b296391)
19d71dd0cSThe j1939 authors /* SPDX-License-Identifier: GPL-2.0 */
29d71dd0cSThe j1939 authors // Copyright (c) 2010-2011 EIA Electronics,
39d71dd0cSThe j1939 authors //                         Kurt Van Dijck <kurt.van.dijck@eia.be>
49d71dd0cSThe j1939 authors // Copyright (c) 2017-2019 Pengutronix,
59d71dd0cSThe j1939 authors //                         Marc Kleine-Budde <kernel@pengutronix.de>
69d71dd0cSThe j1939 authors // Copyright (c) 2017-2019 Pengutronix,
79d71dd0cSThe j1939 authors //                         Oleksij Rempel <kernel@pengutronix.de>
89d71dd0cSThe j1939 authors 
99d71dd0cSThe j1939 authors #ifndef _J1939_PRIV_H_
109d71dd0cSThe j1939 authors #define _J1939_PRIV_H_
119d71dd0cSThe j1939 authors 
129d71dd0cSThe j1939 authors #include <linux/can/j1939.h>
139d71dd0cSThe j1939 authors #include <net/sock.h>
149d71dd0cSThe j1939 authors 
159d71dd0cSThe j1939 authors /* Timeout to receive the abort signal over loop back. In case CAN
169d71dd0cSThe j1939 authors  * bus is open, the timeout should be triggered.
179d71dd0cSThe j1939 authors  */
189d71dd0cSThe j1939 authors #define J1939_XTP_ABORT_TIMEOUT_MS 500
199d71dd0cSThe j1939 authors #define J1939_SIMPLE_ECHO_TIMEOUT_MS (10 * 1000)
209d71dd0cSThe j1939 authors 
219d71dd0cSThe j1939 authors struct j1939_session;
229d71dd0cSThe j1939 authors enum j1939_sk_errqueue_type {
23*cd85d3aeSOleksij Rempel 	J1939_ERRQUEUE_TX_ACK,
24*cd85d3aeSOleksij Rempel 	J1939_ERRQUEUE_TX_SCHED,
25*cd85d3aeSOleksij Rempel 	J1939_ERRQUEUE_TX_ABORT,
269d71dd0cSThe j1939 authors };
279d71dd0cSThe j1939 authors 
289d71dd0cSThe j1939 authors /* j1939 devices */
299d71dd0cSThe j1939 authors struct j1939_ecu {
309d71dd0cSThe j1939 authors 	struct list_head list;
319d71dd0cSThe j1939 authors 	name_t name;
329d71dd0cSThe j1939 authors 	u8 addr;
339d71dd0cSThe j1939 authors 
349d71dd0cSThe j1939 authors 	/* indicates that this ecu successfully claimed @sa as its address */
359d71dd0cSThe j1939 authors 	struct hrtimer ac_timer;
369d71dd0cSThe j1939 authors 	struct kref kref;
379d71dd0cSThe j1939 authors 	struct j1939_priv *priv;
389d71dd0cSThe j1939 authors 
399d71dd0cSThe j1939 authors 	/* count users, to help transport protocol decide for interaction */
409d71dd0cSThe j1939 authors 	int nusers;
419d71dd0cSThe j1939 authors };
429d71dd0cSThe j1939 authors 
439d71dd0cSThe j1939 authors struct j1939_priv {
449d71dd0cSThe j1939 authors 	struct list_head ecus;
459d71dd0cSThe j1939 authors 	/* local list entry in priv
469d71dd0cSThe j1939 authors 	 * These allow irq (& softirq) context lookups on j1939 devices
479d71dd0cSThe j1939 authors 	 * This approach (separate lists) is done as the other 2 alternatives
489d71dd0cSThe j1939 authors 	 * are not easier or even wrong
499d71dd0cSThe j1939 authors 	 * 1) using the pure kobject methods involves mutexes, which are not
509d71dd0cSThe j1939 authors 	 *    allowed in irq context.
519d71dd0cSThe j1939 authors 	 * 2) duplicating data structures would require a lot of synchronization
529d71dd0cSThe j1939 authors 	 *    code
539d71dd0cSThe j1939 authors 	 * usage:
549d71dd0cSThe j1939 authors 	 */
559d71dd0cSThe j1939 authors 
569d71dd0cSThe j1939 authors 	/* segments need a lock to protect the above list */
579d71dd0cSThe j1939 authors 	rwlock_t lock;
589d71dd0cSThe j1939 authors 
599d71dd0cSThe j1939 authors 	struct net_device *ndev;
609d71dd0cSThe j1939 authors 
619d71dd0cSThe j1939 authors 	/* list of 256 ecu ptrs, that cache the claimed addresses.
629d71dd0cSThe j1939 authors 	 * also protected by the above lock
639d71dd0cSThe j1939 authors 	 */
649d71dd0cSThe j1939 authors 	struct j1939_addr_ent {
659d71dd0cSThe j1939 authors 		struct j1939_ecu *ecu;
669d71dd0cSThe j1939 authors 		/* count users, to help transport protocol */
679d71dd0cSThe j1939 authors 		int nusers;
689d71dd0cSThe j1939 authors 	} ents[256];
699d71dd0cSThe j1939 authors 
709d71dd0cSThe j1939 authors 	struct kref kref;
719d71dd0cSThe j1939 authors 
729d71dd0cSThe j1939 authors 	/* List of active sessions to prevent start of conflicting
739d71dd0cSThe j1939 authors 	 * one.
749d71dd0cSThe j1939 authors 	 *
759d71dd0cSThe j1939 authors 	 * Do not start two sessions of same type, addresses and
769d71dd0cSThe j1939 authors 	 * direction.
779d71dd0cSThe j1939 authors 	 */
789d71dd0cSThe j1939 authors 	struct list_head active_session_list;
799d71dd0cSThe j1939 authors 
809d71dd0cSThe j1939 authors 	/* protects active_session_list */
819d71dd0cSThe j1939 authors 	spinlock_t active_session_list_lock;
829d71dd0cSThe j1939 authors 
839d71dd0cSThe j1939 authors 	unsigned int tp_max_packet_size;
849d71dd0cSThe j1939 authors 
859d71dd0cSThe j1939 authors 	/* lock for j1939_socks list */
869d71dd0cSThe j1939 authors 	spinlock_t j1939_socks_lock;
879d71dd0cSThe j1939 authors 	struct list_head j1939_socks;
889d71dd0cSThe j1939 authors 
899d71dd0cSThe j1939 authors 	struct kref rx_kref;
909d71dd0cSThe j1939 authors };
919d71dd0cSThe j1939 authors 
929d71dd0cSThe j1939 authors void j1939_ecu_put(struct j1939_ecu *ecu);
939d71dd0cSThe j1939 authors 
949d71dd0cSThe j1939 authors /* keep the cache of what is local */
959d71dd0cSThe j1939 authors int j1939_local_ecu_get(struct j1939_priv *priv, name_t name, u8 sa);
969d71dd0cSThe j1939 authors void j1939_local_ecu_put(struct j1939_priv *priv, name_t name, u8 sa);
979d71dd0cSThe j1939 authors 
989d71dd0cSThe j1939 authors static inline bool j1939_address_is_unicast(u8 addr)
999d71dd0cSThe j1939 authors {
1009d71dd0cSThe j1939 authors 	return addr <= J1939_MAX_UNICAST_ADDR;
1019d71dd0cSThe j1939 authors }
1029d71dd0cSThe j1939 authors 
1039d71dd0cSThe j1939 authors static inline bool j1939_address_is_idle(u8 addr)
1049d71dd0cSThe j1939 authors {
1059d71dd0cSThe j1939 authors 	return addr == J1939_IDLE_ADDR;
1069d71dd0cSThe j1939 authors }
1079d71dd0cSThe j1939 authors 
1089d71dd0cSThe j1939 authors static inline bool j1939_address_is_valid(u8 addr)
1099d71dd0cSThe j1939 authors {
1109d71dd0cSThe j1939 authors 	return addr != J1939_NO_ADDR;
1119d71dd0cSThe j1939 authors }
1129d71dd0cSThe j1939 authors 
1139d71dd0cSThe j1939 authors static inline bool j1939_pgn_is_pdu1(pgn_t pgn)
1149d71dd0cSThe j1939 authors {
1159d71dd0cSThe j1939 authors 	/* ignore dp & res bits for this */
1169d71dd0cSThe j1939 authors 	return (pgn & 0xff00) < 0xf000;
1179d71dd0cSThe j1939 authors }
1189d71dd0cSThe j1939 authors 
1199d71dd0cSThe j1939 authors /* utility to correctly unmap an ECU */
1209d71dd0cSThe j1939 authors void j1939_ecu_unmap_locked(struct j1939_ecu *ecu);
1219d71dd0cSThe j1939 authors void j1939_ecu_unmap(struct j1939_ecu *ecu);
1229d71dd0cSThe j1939 authors 
1239d71dd0cSThe j1939 authors u8 j1939_name_to_addr(struct j1939_priv *priv, name_t name);
1249d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_find_by_addr_locked(struct j1939_priv *priv,
1259d71dd0cSThe j1939 authors 						u8 addr);
1269d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_get_by_addr(struct j1939_priv *priv, u8 addr);
1279d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_get_by_addr_locked(struct j1939_priv *priv,
1289d71dd0cSThe j1939 authors 					       u8 addr);
1299d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_get_by_name(struct j1939_priv *priv, name_t name);
1309d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_get_by_name_locked(struct j1939_priv *priv,
1319d71dd0cSThe j1939 authors 					       name_t name);
1329d71dd0cSThe j1939 authors 
1339d71dd0cSThe j1939 authors enum j1939_transfer_type {
1349d71dd0cSThe j1939 authors 	J1939_TP,
1359d71dd0cSThe j1939 authors 	J1939_ETP,
1369d71dd0cSThe j1939 authors 	J1939_SIMPLE,
1379d71dd0cSThe j1939 authors };
1389d71dd0cSThe j1939 authors 
1399d71dd0cSThe j1939 authors struct j1939_addr {
1409d71dd0cSThe j1939 authors 	name_t src_name;
1419d71dd0cSThe j1939 authors 	name_t dst_name;
1429d71dd0cSThe j1939 authors 	pgn_t pgn;
1439d71dd0cSThe j1939 authors 
1449d71dd0cSThe j1939 authors 	u8 sa;
1459d71dd0cSThe j1939 authors 	u8 da;
1469d71dd0cSThe j1939 authors 
1479d71dd0cSThe j1939 authors 	u8 type;
1489d71dd0cSThe j1939 authors };
1499d71dd0cSThe j1939 authors 
1509d71dd0cSThe j1939 authors /* control buffer of the sk_buff */
1519d71dd0cSThe j1939 authors struct j1939_sk_buff_cb {
1529d71dd0cSThe j1939 authors 	/* Offset in bytes within one ETP session */
1539d71dd0cSThe j1939 authors 	u32 offset;
1549d71dd0cSThe j1939 authors 
1559d71dd0cSThe j1939 authors 	/* for tx, MSG_SYN will be used to sync on sockets */
1569d71dd0cSThe j1939 authors 	u32 msg_flags;
1579d71dd0cSThe j1939 authors 	u32 tskey;
1589d71dd0cSThe j1939 authors 
1599d71dd0cSThe j1939 authors 	struct j1939_addr addr;
1609d71dd0cSThe j1939 authors 
1619d71dd0cSThe j1939 authors 	/* Flags for quick lookups during skb processing.
1629d71dd0cSThe j1939 authors 	 * These are set in the receive path only.
1639d71dd0cSThe j1939 authors 	 */
1649d71dd0cSThe j1939 authors #define J1939_ECU_LOCAL_SRC BIT(0)
1659d71dd0cSThe j1939 authors #define J1939_ECU_LOCAL_DST BIT(1)
1669d71dd0cSThe j1939 authors 	u8 flags;
1679d71dd0cSThe j1939 authors 
1689d71dd0cSThe j1939 authors 	priority_t priority;
1699d71dd0cSThe j1939 authors };
1709d71dd0cSThe j1939 authors 
1719d71dd0cSThe j1939 authors static inline
1729d71dd0cSThe j1939 authors struct j1939_sk_buff_cb *j1939_skb_to_cb(const struct sk_buff *skb)
1739d71dd0cSThe j1939 authors {
1749d71dd0cSThe j1939 authors 	BUILD_BUG_ON(sizeof(struct j1939_sk_buff_cb) > sizeof(skb->cb));
1759d71dd0cSThe j1939 authors 
1769d71dd0cSThe j1939 authors 	return (struct j1939_sk_buff_cb *)skb->cb;
1779d71dd0cSThe j1939 authors }
1789d71dd0cSThe j1939 authors 
1799d71dd0cSThe j1939 authors int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb);
1809d71dd0cSThe j1939 authors void j1939_sk_recv(struct j1939_priv *priv, struct sk_buff *skb);
1819d71dd0cSThe j1939 authors bool j1939_sk_recv_match(struct j1939_priv *priv,
1829d71dd0cSThe j1939 authors 			 struct j1939_sk_buff_cb *skcb);
1839d71dd0cSThe j1939 authors void j1939_sk_send_loop_abort(struct sock *sk, int err);
1849d71dd0cSThe j1939 authors void j1939_sk_errqueue(struct j1939_session *session,
1859d71dd0cSThe j1939 authors 		       enum j1939_sk_errqueue_type type);
1869d71dd0cSThe j1939 authors void j1939_sk_queue_activate_next(struct j1939_session *session);
1879d71dd0cSThe j1939 authors 
1889d71dd0cSThe j1939 authors /* stack entries */
1899d71dd0cSThe j1939 authors struct j1939_session *j1939_tp_send(struct j1939_priv *priv,
1909d71dd0cSThe j1939 authors 				    struct sk_buff *skb, size_t size);
1919d71dd0cSThe j1939 authors int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb);
1929d71dd0cSThe j1939 authors int j1939_ac_fixup(struct j1939_priv *priv, struct sk_buff *skb);
1939d71dd0cSThe j1939 authors void j1939_ac_recv(struct j1939_priv *priv, struct sk_buff *skb);
1949d71dd0cSThe j1939 authors void j1939_simple_recv(struct j1939_priv *priv, struct sk_buff *skb);
1959d71dd0cSThe j1939 authors 
1969d71dd0cSThe j1939 authors /* network management */
1979d71dd0cSThe j1939 authors struct j1939_ecu *j1939_ecu_create_locked(struct j1939_priv *priv, name_t name);
1989d71dd0cSThe j1939 authors 
1999d71dd0cSThe j1939 authors void j1939_ecu_timer_start(struct j1939_ecu *ecu);
2009d71dd0cSThe j1939 authors void j1939_ecu_timer_cancel(struct j1939_ecu *ecu);
2019d71dd0cSThe j1939 authors void j1939_ecu_unmap_all(struct j1939_priv *priv);
2029d71dd0cSThe j1939 authors 
2039d71dd0cSThe j1939 authors struct j1939_priv *j1939_netdev_start(struct net_device *ndev);
2049d71dd0cSThe j1939 authors void j1939_netdev_stop(struct j1939_priv *priv);
2059d71dd0cSThe j1939 authors 
2069d71dd0cSThe j1939 authors void j1939_priv_put(struct j1939_priv *priv);
2079d71dd0cSThe j1939 authors void j1939_priv_get(struct j1939_priv *priv);
2089d71dd0cSThe j1939 authors 
2099d71dd0cSThe j1939 authors /* notify/alert all j1939 sockets bound to ifindex */
2109d71dd0cSThe j1939 authors void j1939_sk_netdev_event_netdown(struct j1939_priv *priv);
2119d71dd0cSThe j1939 authors int j1939_cancel_active_session(struct j1939_priv *priv, struct sock *sk);
2129d71dd0cSThe j1939 authors void j1939_tp_init(struct j1939_priv *priv);
2139d71dd0cSThe j1939 authors 
2149d71dd0cSThe j1939 authors /* decrement pending skb for a j1939 socket */
2159d71dd0cSThe j1939 authors void j1939_sock_pending_del(struct sock *sk);
2169d71dd0cSThe j1939 authors 
2179d71dd0cSThe j1939 authors enum j1939_session_state {
2189d71dd0cSThe j1939 authors 	J1939_SESSION_NEW,
2199d71dd0cSThe j1939 authors 	J1939_SESSION_ACTIVE,
2209d71dd0cSThe j1939 authors 	/* waiting for abort signal on the bus */
2219d71dd0cSThe j1939 authors 	J1939_SESSION_WAITING_ABORT,
2229d71dd0cSThe j1939 authors 	J1939_SESSION_ACTIVE_MAX,
2239d71dd0cSThe j1939 authors 	J1939_SESSION_DONE,
2249d71dd0cSThe j1939 authors };
2259d71dd0cSThe j1939 authors 
2269d71dd0cSThe j1939 authors struct j1939_session {
2279d71dd0cSThe j1939 authors 	struct j1939_priv *priv;
2289d71dd0cSThe j1939 authors 	struct list_head active_session_list_entry;
2299d71dd0cSThe j1939 authors 	struct list_head sk_session_queue_entry;
2309d71dd0cSThe j1939 authors 	struct kref kref;
2319d71dd0cSThe j1939 authors 	struct sock *sk;
2329d71dd0cSThe j1939 authors 
2339d71dd0cSThe j1939 authors 	/* ifindex, src, dst, pgn define the session block
2349d71dd0cSThe j1939 authors 	 * the are _never_ modified after insertion in the list
2359d71dd0cSThe j1939 authors 	 * this decreases locking problems a _lot_
2369d71dd0cSThe j1939 authors 	 */
2379d71dd0cSThe j1939 authors 	struct j1939_sk_buff_cb skcb;
2389d71dd0cSThe j1939 authors 	struct sk_buff_head skb_queue;
2399d71dd0cSThe j1939 authors 
2409d71dd0cSThe j1939 authors 	/* all tx related stuff (last_txcmd, pkt.tx)
2419d71dd0cSThe j1939 authors 	 * is protected (modified only) with the txtimer hrtimer
2429d71dd0cSThe j1939 authors 	 * 'total' & 'block' are never changed,
2439d71dd0cSThe j1939 authors 	 * last_cmd, last & block are protected by ->lock
2449d71dd0cSThe j1939 authors 	 * this means that the tx may run after cts is received that should
2459d71dd0cSThe j1939 authors 	 * have stopped tx, but this time discrepancy is never avoided anyhow
2469d71dd0cSThe j1939 authors 	 */
2479d71dd0cSThe j1939 authors 	u8 last_cmd, last_txcmd;
2489d71dd0cSThe j1939 authors 	bool transmission;
2499d71dd0cSThe j1939 authors 	bool extd;
2509d71dd0cSThe j1939 authors 	/* Total message size, number of bytes */
2519d71dd0cSThe j1939 authors 	unsigned int total_message_size;
2529d71dd0cSThe j1939 authors 	/* Total number of bytes queue from socket to the session */
2539d71dd0cSThe j1939 authors 	unsigned int total_queued_size;
2549d71dd0cSThe j1939 authors 	unsigned int tx_retry;
2559d71dd0cSThe j1939 authors 
2569d71dd0cSThe j1939 authors 	int err;
2579d71dd0cSThe j1939 authors 	u32 tskey;
2589d71dd0cSThe j1939 authors 	enum j1939_session_state state;
2599d71dd0cSThe j1939 authors 
2609d71dd0cSThe j1939 authors 	/* Packets counters for a (extended) transfer session. The packet is
2619d71dd0cSThe j1939 authors 	 * maximal of 7 bytes.
2629d71dd0cSThe j1939 authors 	 */
2639d71dd0cSThe j1939 authors 	struct {
2649d71dd0cSThe j1939 authors 		/* total - total number of packets for this session */
2659d71dd0cSThe j1939 authors 		unsigned int total;
2669d71dd0cSThe j1939 authors 		/* last - last packet of a transfer block after which
2679d71dd0cSThe j1939 authors 		 * responder should send ETP.CM_CTS and originator
2689d71dd0cSThe j1939 authors 		 * ETP.CM_DPO
2699d71dd0cSThe j1939 authors 		 */
2709d71dd0cSThe j1939 authors 		unsigned int last;
2719d71dd0cSThe j1939 authors 		/* tx - number of packets send by originator node.
2729d71dd0cSThe j1939 authors 		 * this counter can be set back if responder node
2739d71dd0cSThe j1939 authors 		 * didn't received all packets send by originator.
2749d71dd0cSThe j1939 authors 		 */
2759d71dd0cSThe j1939 authors 		unsigned int tx;
2769d71dd0cSThe j1939 authors 		unsigned int tx_acked;
2779d71dd0cSThe j1939 authors 		/* rx - number of packets received */
2789d71dd0cSThe j1939 authors 		unsigned int rx;
2799d71dd0cSThe j1939 authors 		/* block - amount of packets expected in one block */
2809d71dd0cSThe j1939 authors 		unsigned int block;
2819d71dd0cSThe j1939 authors 		/* dpo - ETP.CM_DPO, Data Packet Offset */
2829d71dd0cSThe j1939 authors 		unsigned int dpo;
2839d71dd0cSThe j1939 authors 	} pkt;
2849d71dd0cSThe j1939 authors 	struct hrtimer txtimer, rxtimer;
2859d71dd0cSThe j1939 authors };
2869d71dd0cSThe j1939 authors 
2879d71dd0cSThe j1939 authors struct j1939_sock {
2889d71dd0cSThe j1939 authors 	struct sock sk; /* must be first to skip with memset */
2899d71dd0cSThe j1939 authors 	struct j1939_priv *priv;
2909d71dd0cSThe j1939 authors 	struct list_head list;
2919d71dd0cSThe j1939 authors 
2929d71dd0cSThe j1939 authors #define J1939_SOCK_BOUND BIT(0)
2939d71dd0cSThe j1939 authors #define J1939_SOCK_CONNECTED BIT(1)
2949d71dd0cSThe j1939 authors #define J1939_SOCK_PROMISC BIT(2)
2959d71dd0cSThe j1939 authors #define J1939_SOCK_ERRQUEUE BIT(3)
2969d71dd0cSThe j1939 authors 	int state;
2979d71dd0cSThe j1939 authors 
2989d71dd0cSThe j1939 authors 	int ifindex;
2999d71dd0cSThe j1939 authors 	struct j1939_addr addr;
3009d71dd0cSThe j1939 authors 	struct j1939_filter *filters;
3019d71dd0cSThe j1939 authors 	int nfilters;
3029d71dd0cSThe j1939 authors 	pgn_t pgn_rx_filter;
3039d71dd0cSThe j1939 authors 
3049d71dd0cSThe j1939 authors 	/* j1939 may emit equal PGN (!= equal CAN-id's) out of order
3059d71dd0cSThe j1939 authors 	 * when transport protocol comes in.
3069d71dd0cSThe j1939 authors 	 * To allow emitting in order, keep a 'pending' nr. of packets
3079d71dd0cSThe j1939 authors 	 */
3089d71dd0cSThe j1939 authors 	atomic_t skb_pending;
3099d71dd0cSThe j1939 authors 	wait_queue_head_t waitq;
3109d71dd0cSThe j1939 authors 
3119d71dd0cSThe j1939 authors 	/* lock for the sk_session_queue list */
3129d71dd0cSThe j1939 authors 	spinlock_t sk_session_queue_lock;
3139d71dd0cSThe j1939 authors 	struct list_head sk_session_queue;
3149d71dd0cSThe j1939 authors };
3159d71dd0cSThe j1939 authors 
3169d71dd0cSThe j1939 authors static inline struct j1939_sock *j1939_sk(const struct sock *sk)
3179d71dd0cSThe j1939 authors {
3189d71dd0cSThe j1939 authors 	return container_of(sk, struct j1939_sock, sk);
3199d71dd0cSThe j1939 authors }
3209d71dd0cSThe j1939 authors 
3219d71dd0cSThe j1939 authors void j1939_session_get(struct j1939_session *session);
3229d71dd0cSThe j1939 authors void j1939_session_put(struct j1939_session *session);
3239d71dd0cSThe j1939 authors void j1939_session_skb_queue(struct j1939_session *session,
3249d71dd0cSThe j1939 authors 			     struct sk_buff *skb);
3259d71dd0cSThe j1939 authors int j1939_session_activate(struct j1939_session *session);
3269d71dd0cSThe j1939 authors void j1939_tp_schedule_txtimer(struct j1939_session *session, int msec);
3279d71dd0cSThe j1939 authors void j1939_session_timers_cancel(struct j1939_session *session);
3289d71dd0cSThe j1939 authors 
3299d71dd0cSThe j1939 authors #define J1939_MAX_TP_PACKET_SIZE (7 * 0xff)
3309d71dd0cSThe j1939 authors #define J1939_MAX_ETP_PACKET_SIZE (7 * 0x00ffffff)
3319d71dd0cSThe j1939 authors 
3329d71dd0cSThe j1939 authors #define J1939_REGULAR 0
3339d71dd0cSThe j1939 authors #define J1939_EXTENDED 1
3349d71dd0cSThe j1939 authors 
3359d71dd0cSThe j1939 authors /* CAN protocol */
3369d71dd0cSThe j1939 authors extern const struct can_proto j1939_can_proto;
3379d71dd0cSThe j1939 authors 
3389d71dd0cSThe j1939 authors #endif /* _J1939_PRIV_H_ */
339