STRUCT ST_DATA_S(9)
π struct st_data_s(9) β the ST core internal structure, bestie π
Okay so this is from the Kernel API Manual (yes, the (9) section, the cool one) and it's basically the master blueprint of the ST core internals. Think of it as the group chat roster for everything the ST driver keeps track of: states, skbs, queues, locks, and the tty it's parasocially attached to. Let's get into it π«Ά
β¨ NAME β¨
struct st_data_s β the ST core internal structure. That's it, that's the vibe. It's the struct holding all the inside info, no cap.
πΈ SYNOPSIS πΈ
struct st_data_s {
unsigned long st_state;
struct sk_buff *tx_skb;
#define ST_TX_SENDING 1;
#define ST_TX_WAKEUP 2;
unsigned long tx_state;
struct st_proto_s *list[ST_MAX_CHANNELS];
bool is_registered[ST_MAX_CHANNELS];
unsigned long rx_state;
unsigned long rx_count;
struct sk_buff *rx_skb;
unsigned char rx_chnl;
struct sk_buff_head txq, tx_waitq;
spinlock_t lock;
unsigned char protos_registered;
unsigned long ll_state;
void *kim_data;
struct tty_struct *tty;
struct work_struct work_write_wakeup;
};
Copy it exactly, bestie β every field, every #define, semicolons and all. Not me being dramatic, but those #defines live literally inside the struct braces and that's iconic of them. π
π Members π
Buckle in, we're going field by field. Every single one gets its moment. β
st_stateβ the different states of ST, like initializing, or registration being in progress. It's mainly used so we can return relevant err codes when protocol drivers are registering. It also tracks the recv function: during fw download only HCI events can occur, where as during other times other eventsCH8,CH9can occur. So yeah, it's the main character of state tracking. πtx_skbβ if for some reason the tty's write returns lesser bytes written, then this keeps the rest of the data around to be written on the next instance. It needs to be protected, hence the lock inside wakeup func. Protect the skb at all costs π‘οΈtx_stateβ if the data is being written onto the TTY and the protocol driver wants to send more, we queue up data and mark that there is more data to send. Queue it, flag it, slay it. πlistβ the list of protocols registered. OnlyMAXcan exist, and one protocol can register only once. Exclusive club, no double-dipping, iykyk. πͺβ¨rx_stateβ states to be maintained inside st's tty receive. That's the whole description, and honestly? Respect the brevity. π¦rx_countβ count to be maintained inside st's tty receieve. (Their spelling, not mine β I'm keeping it exactly as written, fr fr. π)rx_skbβ the skb where all data for a protocol gets accumulated. Since the tty might not call receive when a complete event packet is received, the states, count and the skb all need to be maintained. It's giving "we hold onto things here." π€rx_chnlβ the channel ID for which the data is getting accumalated for. (Again β their spelling, keeping it π)txqβ the list of skbs which needs to be sent onto the TTY. Outbox energy. π€tx_waitqβ if the chip is not inAWAKEstate, the skbs needs to be queued up in here.PM(WAKEUP_IND)data needs to be sent, and then the skbs from the waitq can be moved onto the txq. Needs locking too. It's like the waiting room before the main stage β literally so much drama happens here. π΄β‘οΈπ₯lockβ the lock to protect skbs, queues, and ST states. Small field, huge responsibility. πprotos_registeredβ count of the protocols registered. Also, when it's0the chip enable gpio can be toggled, and when it changes to1the fw needs to be downloaded to initialize chip side ST. Zero to one, glow-up arc. πll_stateβ the various PM states the chip can be in. The states are notified to us when the chip sends relevant PM packets (SLEEP_IND,WAKE_IND). The chip is basically texting us its mood. π§kim_dataβ reference to the parent encapsulating structure. The parent! We stan a supportive ancestor. π«Άttyβ tty provided by the TTY core for line disciplines. That's the whole entry, and it's doing the most with the least. π
Quick aside bestie: a couple fields in the synopsis (is_registered,work_write_wakeup) don't get their own Members entry up there. That's just the page being the page β I'm not gonna invent lore, that's not my job. π
π₯ SEE ALSO π₯
Go read these next, in this exact order, no skipping:
- Kernel file
./include/linux/ti_wilink_st.h struct st_proto_s(9)st_int_write(9)st_write(9)struct chip_version(9)struct kim_data_s(9)struct bts_header(9)struct bts_action(9)struct hci_command(9)struct ti_st_plat_data(9)
That's the whole reading list. Cue the study montage π§β¨π
Alright, that's the page! Shoutout to the source path ./include/linux and the <rainbow>October 2026</rainbow> date stamp at the bottom β that's the version/source energy, we love a documented timeline. Byeee, go read your headers ππ¦π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms