linux/net/can/j1939/transport.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2010-2011 EIA Electronics,
//                         Kurt Van Dijck <[email protected]>
// Copyright (c) 2018 Protonic,
//                         Robin van der Gracht <[email protected]>
// Copyright (c) 2017-2019 Pengutronix,
//                         Marc Kleine-Budde <[email protected]>
// Copyright (c) 2017-2019 Pengutronix,
//                         Oleksij Rempel <[email protected]>

#include <linux/can/skb.h>

#include "j1939-priv.h"

#define J1939_XTP_TX_RETRY_LIMIT

#define J1939_ETP_PGN_CTL
#define J1939_ETP_PGN_DAT
#define J1939_TP_PGN_CTL
#define J1939_TP_PGN_DAT

#define J1939_TP_CMD_RTS
#define J1939_TP_CMD_CTS
#define J1939_TP_CMD_EOMA
#define J1939_TP_CMD_BAM
#define J1939_TP_CMD_ABORT

#define J1939_ETP_CMD_RTS
#define J1939_ETP_CMD_CTS
#define J1939_ETP_CMD_DPO
#define J1939_ETP_CMD_EOMA
#define J1939_ETP_CMD_ABORT

enum j1939_xtp_abort {};

static unsigned int j1939_tp_block =;
static unsigned int j1939_tp_packet_delay;
static unsigned int j1939_tp_padding =;

/* helpers */
static const char *j1939_xtp_abort_to_str(enum j1939_xtp_abort abort)
{}

static int j1939_xtp_abort_to_errno(struct j1939_priv *priv,
				    enum j1939_xtp_abort abort)
{}

static inline void j1939_session_list_lock(struct j1939_priv *priv)
{}

static inline void j1939_session_list_unlock(struct j1939_priv *priv)
{}

void j1939_session_get(struct j1939_session *session)
{}

/* session completion functions */
static void __j1939_session_drop(struct j1939_session *session)
{}

static void j1939_session_destroy(struct j1939_session *session)
{}

static void __j1939_session_release(struct kref *kref)
{}

void j1939_session_put(struct j1939_session *session)
{}

static void j1939_session_txtimer_cancel(struct j1939_session *session)
{}

static void j1939_session_rxtimer_cancel(struct j1939_session *session)
{}

void j1939_session_timers_cancel(struct j1939_session *session)
{}

static inline bool j1939_cb_is_broadcast(const struct j1939_sk_buff_cb *skcb)
{}

static void j1939_session_skb_drop_old(struct j1939_session *session)
{}

void j1939_session_skb_queue(struct j1939_session *session,
			     struct sk_buff *skb)
{}

static struct
sk_buff *j1939_session_skb_get_by_offset(struct j1939_session *session,
					 unsigned int offset_start)
{}

static struct sk_buff *j1939_session_skb_get(struct j1939_session *session)
{}

/* see if we are receiver
 * returns 0 for broadcasts, although we will receive them
 */
static inline int j1939_tp_im_receiver(const struct j1939_sk_buff_cb *skcb)
{}

/* see if we are sender */
static inline int j1939_tp_im_transmitter(const struct j1939_sk_buff_cb *skcb)
{}

/* see if we are involved as either receiver or transmitter */
static int j1939_tp_im_involved(const struct j1939_sk_buff_cb *skcb, bool swap)
{}

static int j1939_tp_im_involved_anydir(struct j1939_sk_buff_cb *skcb)
{}

/* extract pgn from flow-ctl message */
static inline pgn_t j1939_xtp_ctl_to_pgn(const u8 *dat)
{}

static inline unsigned int j1939_tp_ctl_to_size(const u8 *dat)
{}

static inline unsigned int j1939_etp_ctl_to_packet(const u8 *dat)
{}

static inline unsigned int j1939_etp_ctl_to_size(const u8 *dat)
{}

/* find existing session:
 * reverse: swap cb's src & dst
 * there is no problem with matching broadcasts, since
 * broadcasts (no dst, no da) would never call this
 * with reverse == true
 */
static bool j1939_session_match(struct j1939_addr *se_addr,
				struct j1939_addr *sk_addr, bool reverse)
{}

static struct
j1939_session *j1939_session_get_by_addr_locked(struct j1939_priv *priv,
						struct list_head *root,
						struct j1939_addr *addr,
						bool reverse, bool transmitter)
{}

static struct
j1939_session *j1939_session_get_simple(struct j1939_priv *priv,
					struct sk_buff *skb)
{}

static struct
j1939_session *j1939_session_get_by_addr(struct j1939_priv *priv,
					 struct j1939_addr *addr,
					 bool reverse, bool transmitter)
{}

static void j1939_skbcb_swap(struct j1939_sk_buff_cb *skcb)
{}

static struct
sk_buff *j1939_tp_tx_dat_new(struct j1939_priv *priv,
			     const struct j1939_sk_buff_cb *re_skcb,
			     bool ctl,
			     bool swap_src_dst)
{}

/* TP transmit packet functions */
static int j1939_tp_tx_dat(struct j1939_session *session,
			   const u8 *dat, int len)
{}

static int j1939_xtp_do_tx_ctl(struct j1939_priv *priv,
			       const struct j1939_sk_buff_cb *re_skcb,
			       bool swap_src_dst, pgn_t pgn, const u8 *dat)
{}

static inline int j1939_tp_tx_ctl(struct j1939_session *session,
				  bool swap_src_dst, const u8 *dat)
{}

static int j1939_xtp_tx_abort(struct j1939_priv *priv,
			      const struct j1939_sk_buff_cb *re_skcb,
			      bool swap_src_dst,
			      enum j1939_xtp_abort err,
			      pgn_t pgn)
{}

void j1939_tp_schedule_txtimer(struct j1939_session *session, int msec)
{}

static inline void j1939_tp_set_rxtimeout(struct j1939_session *session,
					  int msec)
{}

static int j1939_session_tx_rts(struct j1939_session *session)
{}

static int j1939_session_tx_dpo(struct j1939_session *session)
{}

static int j1939_session_tx_dat(struct j1939_session *session)
{}

static int j1939_xtp_txnext_transmiter(struct j1939_session *session)
{}

static int j1939_session_tx_cts(struct j1939_session *session)
{}

static int j1939_session_tx_eoma(struct j1939_session *session)
{}

static int j1939_xtp_txnext_receiver(struct j1939_session *session)
{}

static int j1939_simple_txnext(struct j1939_session *session)
{}

static bool j1939_session_deactivate_locked(struct j1939_session *session)
{}

static bool j1939_session_deactivate(struct j1939_session *session)
{}

static void
j1939_session_deactivate_activate_next(struct j1939_session *session)
{}

static void __j1939_session_cancel(struct j1939_session *session,
				   enum j1939_xtp_abort err)
{}

static void j1939_session_cancel(struct j1939_session *session,
				 enum j1939_xtp_abort err)
{}

static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
{}

static void j1939_session_completed(struct j1939_session *session)
{}

static enum hrtimer_restart j1939_tp_rxtimer(struct hrtimer *hrtimer)
{}

static bool j1939_xtp_rx_cmd_bad_pgn(struct j1939_session *session,
				     const struct sk_buff *skb)
{}

static void j1939_xtp_rx_abort_one(struct j1939_priv *priv, struct sk_buff *skb,
				   bool reverse, bool transmitter)
{}

/* abort packets may come in 2 directions */
static void
j1939_xtp_rx_abort(struct j1939_priv *priv, struct sk_buff *skb,
		   bool transmitter)
{}

static void
j1939_xtp_rx_eoma_one(struct j1939_session *session, struct sk_buff *skb)
{}

static void
j1939_xtp_rx_eoma(struct j1939_priv *priv, struct sk_buff *skb,
		  bool transmitter)
{}

static void
j1939_xtp_rx_cts_one(struct j1939_session *session, struct sk_buff *skb)
{}

static void
j1939_xtp_rx_cts(struct j1939_priv *priv, struct sk_buff *skb, bool transmitter)
{}

static struct j1939_session *j1939_session_new(struct j1939_priv *priv,
					       struct sk_buff *skb, size_t size)
{}

static struct
j1939_session *j1939_session_fresh_new(struct j1939_priv *priv,
				       int size,
				       const struct j1939_sk_buff_cb *rel_skcb)
{}

int j1939_session_activate(struct j1939_session *session)
{}

static struct
j1939_session *j1939_xtp_rx_rts_session_new(struct j1939_priv *priv,
					    struct sk_buff *skb)
{}

static int j1939_xtp_rx_rts_session_active(struct j1939_session *session,
					   struct sk_buff *skb)
{}

static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
			     bool transmitter)
{}

static void j1939_xtp_rx_dpo_one(struct j1939_session *session,
				 struct sk_buff *skb)
{}

static void j1939_xtp_rx_dpo(struct j1939_priv *priv, struct sk_buff *skb,
			     bool transmitter)
{}

static void j1939_xtp_rx_dat_one(struct j1939_session *session,
				 struct sk_buff *skb)
{}

static void j1939_xtp_rx_dat(struct j1939_priv *priv, struct sk_buff *skb)
{}

/* j1939 main intf */
struct j1939_session *j1939_tp_send(struct j1939_priv *priv,
				    struct sk_buff *skb, size_t size)
{}

static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
{}

int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb)
{}

void j1939_simple_recv(struct j1939_priv *priv, struct sk_buff *skb)
{}

int j1939_cancel_active_session(struct j1939_priv *priv, struct sock *sk)
{}

void j1939_tp_init(struct j1939_priv *priv)
{}