include/linux/can/dev.h
Source file repositories/reference/linux-study-clean/include/linux/can/dev.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/can/dev.h- Extension
.h- Size
- 5895 bytes
- Lines
- 202
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/can.hlinux/can/bittiming.hlinux/can/error.hlinux/can/length.hlinux/can/netlink.hlinux/can/skb.hlinux/ethtool.hlinux/netdevice.h
Detected Declarations
struct can_privenum can_modeenum can_termination_gpiofunction can_fd_tdc_is_enabledfunction can_xl_tdc_is_enabledfunction can_get_static_ctrlmodefunction can_is_canxl_dev_mtufunction can_dev_in_xl_only_modefunction can_dev_dropped_skbfunction of_can_transceiver
Annotated Snippet
struct can_priv {
struct net_device *dev;
struct can_device_stats can_stats;
const struct can_bittiming_const *bittiming_const;
struct can_bittiming bittiming;
struct data_bittiming_params fd, xl;
unsigned int bitrate_const_cnt;
const u32 *bitrate_const;
u32 bitrate_max;
struct can_clock clock;
unsigned int termination_const_cnt;
const u16 *termination_const;
u16 termination;
struct gpio_desc *termination_gpio;
u16 termination_gpio_ohms[CAN_TERMINATION_GPIO_MAX];
unsigned int echo_skb_max;
struct sk_buff **echo_skb;
enum can_state state;
/* CAN controller features - see include/uapi/linux/can/netlink.h */
u32 ctrlmode; /* current options setting */
u32 ctrlmode_supported; /* options that can be modified by netlink */
int restart_ms;
struct delayed_work restart_work;
int (*do_set_bittiming)(struct net_device *dev);
int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
int (*do_set_termination)(struct net_device *dev, u16 term);
int (*do_get_state)(const struct net_device *dev,
enum can_state *state);
int (*do_get_berr_counter)(const struct net_device *dev,
struct can_berr_counter *bec);
};
static inline bool can_fd_tdc_is_enabled(const struct can_priv *priv)
{
return !!(priv->ctrlmode & CAN_CTRLMODE_FD_TDC_MASK);
}
static inline bool can_xl_tdc_is_enabled(const struct can_priv *priv)
{
return !!(priv->ctrlmode & CAN_CTRLMODE_XL_TDC_MASK);
}
static inline u32 can_get_static_ctrlmode(struct can_priv *priv)
{
return priv->ctrlmode & ~priv->ctrlmode_supported;
}
static inline bool can_is_canxl_dev_mtu(unsigned int mtu)
{
return (mtu >= CANXL_MIN_MTU && mtu <= CANXL_MAX_MTU);
}
void can_setup(struct net_device *dev);
struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
unsigned int txqs, unsigned int rxqs);
#define alloc_candev(sizeof_priv, echo_skb_max) \
alloc_candev_mqs(sizeof_priv, echo_skb_max, 1, 1)
#define alloc_candev_mq(sizeof_priv, echo_skb_max, count) \
alloc_candev_mqs(sizeof_priv, echo_skb_max, count, count)
void free_candev(struct net_device *dev);
/* a candev safe wrapper around netdev_priv */
struct can_priv *safe_candev_priv(struct net_device *dev);
int open_candev(struct net_device *dev);
void close_candev(struct net_device *dev);
void can_set_default_mtu(struct net_device *dev);
void can_set_cap_info(struct net_device *dev);
int __must_check can_set_static_ctrlmode(struct net_device *dev,
u32 static_mode);
int can_hwtstamp_get(struct net_device *netdev,
struct kernel_hwtstamp_config *cfg);
int can_hwtstamp_set(struct net_device *netdev,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack);
int can_ethtool_op_get_ts_info_hwts(struct net_device *dev,
struct kernel_ethtool_ts_info *info);
int register_candev(struct net_device *dev);
void unregister_candev(struct net_device *dev);
int can_restart_now(struct net_device *dev);
Annotation
- Immediate include surface: `linux/can.h`, `linux/can/bittiming.h`, `linux/can/error.h`, `linux/can/length.h`, `linux/can/netlink.h`, `linux/can/skb.h`, `linux/ethtool.h`, `linux/netdevice.h`.
- Detected declarations: `struct can_priv`, `enum can_mode`, `enum can_termination_gpio`, `function can_fd_tdc_is_enabled`, `function can_xl_tdc_is_enabled`, `function can_get_static_ctrlmode`, `function can_is_canxl_dev_mtu`, `function can_dev_in_xl_only_mode`, `function can_dev_dropped_skb`, `function of_can_transceiver`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.