/* 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)(conststruct net_device *dev, enum can_state *state); int (*do_get_berr_counter)(conststruct net_device *dev, struct can_berr_counter *bec);
};
/* helper to define static CAN controller features at device creation time */ staticinlineint __must_check can_set_static_ctrlmode(struct net_device *dev,
u32 static_mode)
{ struct can_priv *priv = netdev_priv(dev);
/* alloc_candev() succeeded => netdev_priv() is valid at this point */ if (priv->ctrlmode_supported & static_mode) {
netdev_warn(dev, "Controller features can not be supported and static at the same time\n"); return -EINVAL;
}
priv->ctrlmode = static_mode;
/* override MTU which was set by default in can_setup()? */ if (static_mode & CAN_CTRLMODE_FD)
dev->mtu = CANFD_MTU;
/* drop skb if it does not contain a valid CAN frame for sending */ staticinlinebool can_dev_dropped_skb(struct net_device *dev, struct sk_buff *skb)
{ struct can_priv *priv = netdev_priv(dev);
if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) {
netdev_info_once(dev, "interface in listen only mode, dropping skb\n");
kfree_skb(skb);
dev->stats.tx_dropped++; returntrue;
}
/* 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); int can_change_mtu(struct net_device *dev, int new_mtu); int can_eth_ioctl_hwts(struct net_device *netdev, struct ifreq *ifr, int cmd); 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); void can_bus_off(struct net_device *dev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.