interface: fix regression on adding hotplug devices to interfaces
[project/netifd.git] / device.h
index 804efb38a048fa919daa0b61247c43e7ba955eb4..1c01b58889ed7b957bb9bc36af33f467d2d533ef 100644 (file)
--- a/device.h
+++ b/device.h
@@ -60,6 +60,7 @@ enum {
        DEV_ATTR_DROP_UNSOLICITED_NA,
        DEV_ATTR_ARP_ACCEPT,
        DEV_ATTR_AUTH,
        DEV_ATTR_DROP_UNSOLICITED_NA,
        DEV_ATTR_ARP_ACCEPT,
        DEV_ATTR_AUTH,
+       DEV_ATTR_AUTH_VLAN,
        DEV_ATTR_SPEED,
        DEV_ATTR_DUPLEX,
        DEV_ATTR_VLAN,
        DEV_ATTR_SPEED,
        DEV_ATTR_DUPLEX,
        DEV_ATTR_VLAN,
@@ -68,6 +69,9 @@ enum {
        DEV_ATTR_RXPAUSE,
        DEV_ATTR_TXPAUSE,
        DEV_ATTR_AUTONEG,
        DEV_ATTR_RXPAUSE,
        DEV_ATTR_TXPAUSE,
        DEV_ATTR_AUTONEG,
+       DEV_ATTR_GRO,
+       DEV_ATTR_MASTER,
+       DEV_ATTR_EEE,
        __DEV_ATTR_MAX,
 };
 
        __DEV_ATTR_MAX,
 };
 
@@ -137,6 +141,9 @@ enum {
        DEV_OPT_RXPAUSE                 = (1ULL << 34),
        DEV_OPT_TXPAUSE                 = (1ULL << 35),
        DEV_OPT_AUTONEG                 = (1ULL << 36),
        DEV_OPT_RXPAUSE                 = (1ULL << 34),
        DEV_OPT_TXPAUSE                 = (1ULL << 35),
        DEV_OPT_AUTONEG                 = (1ULL << 36),
+       DEV_OPT_GRO                     = (1ULL << 37),
+       DEV_OPT_MASTER                  = (1ULL << 38),
+       DEV_OPT_EEE                     = (1ULL << 39),
 };
 
 /* events broadcasted to all users of a device */
 };
 
 /* events broadcasted to all users of a device */
@@ -219,6 +226,9 @@ struct device_settings {
        bool rxpause;
        bool txpause;
        bool autoneg;
        bool rxpause;
        bool txpause;
        bool autoneg;
+       bool gro;
+       int master_ifindex;
+       bool eee;
 };
 
 struct device_vlan_range {
 };
 
 struct device_vlan_range {
@@ -238,6 +248,7 @@ struct device {
 
        struct vlist_tree vlans;
        struct kvlist vlan_aliases;
 
        struct vlist_tree vlans;
        struct kvlist vlan_aliases;
+       struct blob_attr *config_auth_vlans;
        struct blob_attr *auth_vlans;
 
        char ifname[IFNAMSIZ];
        struct blob_attr *auth_vlans;
 
        char ifname[IFNAMSIZ];
@@ -354,9 +365,26 @@ static inline struct device *device_get(const char *name, int create)
 
 void device_add_user(struct device_user *dep, struct device *dev);
 void device_remove_user(struct device_user *dep);
 
 void device_add_user(struct device_user *dep, struct device *dev);
 void device_remove_user(struct device_user *dep);
-void device_broadcast_event(struct device *dev, enum device_event ev);
+const char *device_event_name(enum device_event ev);
+void __device_broadcast_event(struct device *dev, enum device_event ev);
+#define device_broadcast_event(dev, ev) do {                                   \
+       struct device *__ev_dev = (dev);                                        \
+       D(DEVICE, "%s: event (%s)",                                             \
+         (__ev_dev && __ev_dev->ifname[0] ? __ev_dev->ifname : "(none)"),      \
+         device_event_name(ev));                                               \
+       __device_broadcast_event(__ev_dev, ev);                                 \
+} while (0)
+
+void _device_set_present(struct device *dev, bool state);
+#define device_set_present(dev, state) do {                                    \
+       struct device *__ev_dev = (dev);                                        \
+       bool __ev_state = state;                                                \
+       D(DEVICE, "%s: set present=%d",                                         \
+         (__ev_dev && __ev_dev->ifname[0] ? __ev_dev->ifname : "(none)"),      \
+         __ev_state);                                                          \
+       _device_set_present(__ev_dev, __ev_state);                              \
+} while (0)
 
 
-void device_set_present(struct device *dev, bool state);
 void device_set_link(struct device *dev, bool state);
 void device_set_ifindex(struct device *dev, int ifindex);
 int device_set_ifname(struct device *dev, const char *name);
 void device_set_link(struct device *dev, bool state);
 void device_set_ifindex(struct device *dev, int ifindex);
 int device_set_ifname(struct device *dev, const char *name);