STRUCT XCAN_PRIV(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

โœจ struct xcan_priv(9) โœจ

okay bestie, so this is a Kernel API Manual page for struct xcan_priv โ€” and like, the whole point of it is that this definition define CAN driver instance ๐Ÿ’… that's the vibe, that's the assignment. It's the little private clubhouse where one Xilinx CAN driver keeps all its stuff. Let's get into it ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

Here's the whole struct, character for character, no cap โ€” don't touch a single field:

struct xcan_priv {
    struct can_priv can;
    spinlock_t tx_lock;
    unsigned int tx_head;
    unsigned int tx_tail;
    unsigned int tx_max;
    struct napi_struct napi;
    u32 (*read_reg)(const struct xcan_priv *priv, enum xcan_reg reg);
    void (*write_reg)(const struct xcan_priv *priv, enum xcan_reg reg,
u32 val);
    struct device *dev;
    void __iomem *reg_base;
    unsigned long irq_flags;
    struct clk *bus_clk;
    struct clk *can_clk;
    struct xcan_devtype_data devtype;
    struct phy *transceiver;
    struct reset_control *rstc;
    bool ecc_enable;
    struct u64_stats_sync syncp;
    u64_stats_t ecc_rx_2_bit_errors;
    u64_stats_t ecc_rx_1_bit_errors;
    u64_stats_t ecc_txol_2_bit_errors;
    u64_stats_t ecc_txol_1_bit_errors;
    u64_stats_t ecc_txtl_2_bit_errors;
    u64_stats_t ecc_txtl_1_bit_errors;
 };

(yeah that u32 val); line is doing its own little thing, we love a quirky wrap ๐Ÿ™ˆ)


๐Ÿฆ‹ Members ๐Ÿฆ‹

okay so member by member, and I'm gonna give you the actual tea for each one:

  • can โ€” CAN private data structure. the whole CAN situation lives in here bestie โœจ
  • tx_lock โ€” Lock for synchronizing TX interrupt handling ๐Ÿ”’
  • tx_head โ€” Tx CAN packets ready to send on the queue ๐Ÿ“ค
  • tx_tail โ€” Tx CAN packets successfully sended on the queue ๐Ÿ“ฅ
  • tx_max โ€” Maximum number packets the driver can send ๐Ÿšฆ
  • napi โ€” NAPI structure, iconic as always ๐Ÿ‘‘
  • read_reg โ€” For reading data from CAN registers ๐Ÿ“–
  • write_reg โ€” For writing data to CAN registers โœ๏ธ
  • dev โ€” Network device data structure ๐Ÿ’ป
  • reg_base โ€” Ioremapped address to registers ๐Ÿ—บ๏ธ
  • irq_flags โ€” For request_irq โšก
  • bus_clk โ€” Pointer to struct clk ๐Ÿ•ฐ๏ธ
  • can_clk โ€” Pointer to struct clk ๐Ÿ•ฐ๏ธ (yes, another one, she's got two clocks, main character energy)
  • devtype โ€” Device type specific constants ๐Ÿงฌ
  • transceiver โ€” Optional pointer to associated CAN transceiver ๐Ÿ“ก
  • rstc โ€” Pointer to reset control ๐Ÿ”„
  • ecc_enable โ€” ECC enable flag ๐Ÿšฉ
  • syncp โ€” synchronization for ECC error stats ๐Ÿงฎ
  • ecc_rx_2_bit_errors โ€” RXFIFO 2bit ECC count ๐Ÿ’€
  • ecc_rx_1_bit_errors โ€” RXFIFO 1bit ECC count ๐Ÿ˜ญ
  • ecc_txol_2_bit_errors โ€” TXOLFIFO 2bit ECC count ๐Ÿ’€
  • ecc_txol_1_bit_errors โ€” TXOLFIFO 1bit ECC count ๐Ÿ˜ญ
  • ecc_txtl_2_bit_errors โ€” TXTLFIFO 2bit ECC count ๐Ÿ’€
  • ecc_txtl_1_bit_errors โ€” TXTLFIFO 1bit ECC count ๐Ÿ˜ญ
bestie note: those ECC counters are error counts, so if they're going up... vibe check failed, go look at your hardware ๐Ÿซถ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

Kernel file ./drivers/net/can/xilinx_can.c โ€” and like, literally the entire friend group:


anyway that's the whole page, go read the source, ily, bye ๐Ÿ’–โœจ

signed, sealed, delivered: this came out of ./drivers/net/can, dated October 2026, and it's still called struct xcan_priv(9). periodt ๐ŸŽ€๐Ÿฆ‹๐Ÿ’œ
๐Ÿ“ฆ where this page comes from