Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / include / linux / can / dev.h
index 735f9f8..5f52709 100644 (file)
@@ -32,6 +32,7 @@ enum can_mode {
  * CAN common private data
  */
 struct can_priv {
+       struct net_device *dev;
        struct can_device_stats can_stats;
 
        struct can_bittiming bittiming, data_bittiming;
@@ -40,11 +41,14 @@ struct can_priv {
        struct can_clock clock;
 
        enum can_state state;
-       u32 ctrlmode;
-       u32 ctrlmode_supported;
+
+       /* 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 */
+       u32 ctrlmode_static;    /* static enabled options for driver/hardware */
 
        int restart_ms;
-       struct timer_list restart_timer;
+       struct delayed_work restart_work;
 
        int (*do_set_bittiming)(struct net_device *dev);
        int (*do_set_data_bittiming)(struct net_device *dev);
@@ -108,6 +112,21 @@ static inline bool can_is_canfd_skb(const struct sk_buff *skb)
        return skb->len == CANFD_MTU;
 }
 
+/* helper to define static CAN controller features at device creation time */
+static inline void 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 */
+       priv->ctrlmode = static_mode;
+       priv->ctrlmode_static = static_mode;
+
+       /* override MTU which was set by default in can_setup()? */
+       if (static_mode & CAN_CTRLMODE_FD)
+               dev->mtu = CANFD_MTU;
+}
+
 /* get data length from can_dlc with sanitized can_dlc */
 u8 can_dlc2len(u8 can_dlc);