drivers/net/can/usb/etas_es58x/es58x_core.h

Source file repositories/reference/linux-study-clean/drivers/net/can/usb/etas_es58x/es58x_core.h

File Facts

System
Linux kernel
Corpus path
drivers/net/can/usb/etas_es58x/es58x_core.h
Extension
.h
Size
25543 bytes
Lines
751
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct es58x_priv {
	struct can_priv can;
	struct devlink_port devlink_port;
	struct es58x_device *es58x_dev;
	struct urb *tx_urb;

	u32 tx_tail;
	u32 tx_head;

	u8 tx_can_msg_cnt;
	bool tx_can_msg_is_fd;

	u8 err_passive_before_rtx_success;

	u8 channel_idx;
};

/**
 * struct es58x_parameters - Constant parameters of a given hardware
 *	variant.
 * @bittiming_const: Nominal bittimming constant parameters.
 * @data_bittiming_const: Data bittiming constant parameters.
 * @tdc_const: Transmission Delay Compensation constant parameters.
 * @bitrate_max: Maximum bitrate supported by the device.
 * @clock: CAN clock parameters.
 * @ctrlmode_supported: List of supported modes. Please refer to
 *	can/netlink.h file for additional details.
 * @tx_start_of_frame: Magic number at the beginning of each TX URB
 *	command.
 * @rx_start_of_frame: Magic number at the beginning of each RX URB
 *	command.
 * @tx_urb_cmd_max_len: Maximum length of a TX URB command.
 * @rx_urb_cmd_max_len: Maximum length of a RX URB command.
 * @fifo_mask: Bit mask to quickly convert the tx_tail and tx_head
 *	field of the struct es58x_priv into echo_skb
 *	indexes. Properties: @fifo_mask = echo_skb_max - 1 where
 *	echo_skb_max must be a power of two. Also, echo_skb_max must
 *	not exceed the maximum size of the device internal TX FIFO
 *	length. This parameter is used to control the network queue
 *	wake/stop logic.
 * @dql_min_limit: Dynamic Queue Limits (DQL) absolute minimum limit
 *	of bytes allowed to be queued on this network device transmit
 *	queue. Used by the Byte Queue Limits (BQL) to determine how
 *	frequently the xmit_more flag will be set to true in
 *	es58x_start_xmit(). Set this value higher to optimize for
 *	throughput but be aware that it might have a negative impact
 *	on the latency! This value can also be set dynamically. Please
 *	refer to Documentation/ABI/testing/sysfs-class-net-queues for
 *	more details.
 * @tx_bulk_max: Maximum number of TX messages that can be sent in one
 *	single URB packet.
 * @urb_cmd_header_len: Length of the URB command header.
 * @rx_urb_max: Number of RX URB to be allocated during device probe.
 * @tx_urb_max: Number of TX URB to be allocated during device probe.
 */
struct es58x_parameters {
	const struct can_bittiming_const *bittiming_const;
	const struct can_bittiming_const *data_bittiming_const;
	const struct can_tdc_const *tdc_const;
	u32 bitrate_max;
	struct can_clock clock;
	u32 ctrlmode_supported;
	u16 tx_start_of_frame;
	u16 rx_start_of_frame;
	u16 tx_urb_cmd_max_len;
	u16 rx_urb_cmd_max_len;
	u16 fifo_mask;
	u16 dql_min_limit;
	u8 tx_bulk_max;
	u8 urb_cmd_header_len;
	u8 rx_urb_max;
	u8 tx_urb_max;
};

/**
 * struct es58x_operators - Function pointers used to encode/decode
 *	the TX/RX messages.
 * @get_msg_len: Get field msg_len of the urb_cmd. The offset of
 *	msg_len inside urb_cmd depends of the device model.
 * @handle_urb_cmd: Decode the URB command received from the device
 *	and dispatch it to the relevant sub function.
 * @fill_urb_header: Fill the header of urb_cmd.
 * @tx_can_msg: Encode a TX CAN message and add it to the bulk buffer
 *	cmd_buf of es58x_dev.
 * @enable_channel: Start the CAN channel.
 * @disable_channel: Stop the CAN channel.
 * @reset_device: Full reset of the device. N.B: this feature is only
 *	present on the ES581.4. For ES58X FD devices, this field is
 *	set to NULL.
 * @get_timestamp: Request a timestamp from the ES58X device.

Annotation

Implementation Notes