can_rcv_list_find(9)
π can_rcv_list_find(9) β the Kernel API Manual, bestie edition
okay so picture this: you're in the can subsystem, section 9 of the Kernel API Manual, and you need to know which filter list is the β¨optimalβ¨ one. That's this function. Her name is can_rcv_list_find and she's literally the main character of filter list picking. π
β¨ NAME β¨
can_rcv_list_find β determine the optimal filterlist inside the device filter struct π¦
πΈ SYNOPSIS πΈ
struct hlist_head * can_rcv_list_find (canid_t *can_id , canid_t *mask ,
struct can_dev_rcv_lists *dev_rcv_lists );
like, that's the whole vibe. a struct hlist_head * coming right back at you. π«
π ARGUMENTS π
can_idβ pointer to the CAN identifier of a givencan_filter, bestie. it's a pointer, so be nice to it.maskβ pointer to the CAN mask of a givencan_filter. also a pointer. also deserves respect. π«Άdev_rcv_listsβ pointer to the device filter struct. yes, another pointer. it's giving pointer party and honestly we love that for us.
π₯ DESCRIPTION π₯
So what does she do? She returns the optimal filterlist β the whole point is to reduce the filter handling in the receive path. Less work on the hot path, more slay. π
This function gets called by service functions that need to register or unregister a can_filter in the filter lists. iykyk.
A filter matches, in general, when:
<received_can_id> & mask == can_id & mask
so every bit set in the mask β and yes, that includes CAN_EFF_FLAG and CAN_RTR_FLAG β describes bits that are relevant for the filter. like, those bits are the ones that actually matter. periodt. β
Now the fun part, because she's flexible like that:
- The filter can be inverted β that's the
CAN_INV_FILTERbit set incan_id. π - Or it can filter for error messages β that's the
CAN_ERR_FLAGbit set inmask.
And for error msg frames there's a special filterlist and a special rx path filter handling. not like other filters. πβ¨
π RETURN π
Pointer to the optimal filterlist for the given can_id/mask pair. π―
Also lowkey doing extra credit on the way out:
- Consistency checked mask.
- Reduced
can_idto have a preprocessed filter compare value.
so you get the pointer and the glow-up. no cap. π
πΈ SEE ALSO πΈ
- Kernel file
./net/can/af_can.c can_send(9)effhash(9)can_rx_register(9)can_rx_unregister(9)can_proto_register(9)can_proto_unregister(9)
go read them, they're all iconic in their own way. ππ
and that's the whole page, bestie!! π§ this lil gem lives in ./net/can and the version/date stamp on it is October 2026, with the header can_rcv_list_find(9) riding up top the whole time. bye bestie, go register some filters responsibly πππ¦
π¦ 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