can_rcv_list_find(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 given can_filter, bestie. it's a pointer, so be nice to it.
  • mask β€” pointer to the CAN mask of a given can_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_FILTER bit set in can_id. πŸ™ˆ
  • Or it can filter for error messages β€” that's the CAN_ERR_FLAG bit set in mask.

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_id to have a preprocessed filter compare value.

so you get the pointer and the glow-up. no cap. 🌈


🌸 SEE ALSO 🌸

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