X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=device.h;h=b2ea0fa67afe56b243ec13c288ab239b07fb5984;hb=HEAD;hp=14d7486b7317799e2a431e01c826b9c0fdb0728a;hpb=f429bd94f99e55548bf4fa8156c165017ce3c41c;p=project%2Fnetifd.git diff --git a/device.h b/device.h index 14d7486..1c01b58 100644 --- 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_AUTH_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_GRO, + DEV_ATTR_MASTER, + DEV_ATTR_EEE, __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_GRO = (1ULL << 37), + DEV_OPT_MASTER = (1ULL << 38), + DEV_OPT_EEE = (1ULL << 39), }; /* events broadcasted to all users of a device */ @@ -219,6 +226,9 @@ struct device_settings { bool rxpause; bool txpause; bool autoneg; + bool gro; + int master_ifindex; + bool eee; }; struct device_vlan_range { @@ -238,6 +248,8 @@ struct device { struct vlist_tree vlans; struct kvlist vlan_aliases; + struct blob_attr *config_auth_vlans; + struct blob_attr *auth_vlans; char ifname[IFNAMSIZ]; int ifindex; @@ -353,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_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); @@ -371,7 +400,7 @@ struct device *get_vlan_device_chain(const char *ifname, int create); void alias_notify_device(const char *name, struct device *dev); struct device *device_alias_get(const char *name); -void device_set_auth_status(struct device *dev, bool value); +void device_set_auth_status(struct device *dev, bool value, struct blob_attr *vlans); static inline void device_set_deferred(struct device *dev, bool value)