sysfs support of network devices
Subsystems (2)
PATCH 1/1 sysfs support of network devices
This is the network core infrastructure changes for network device support of sysfs. The changes from the earlier patch are:
- sysfs support is not a config option.
- updated to latest 2.5.69 including latest net device changes
- only mtu, tx_queue_len and flags are writeable.
Please apply. Comments and extensions are always welcome.
include/linux/netdevice.h +19 -6
@@ -28,7 +28,7 @@#include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_packet.h> -#include <linux/kobject.h> +#include <linux/device.h> #include <asm/atomic.h> #include <asm/cache.h>
@@ -441,11 +441,22 @@ struct net_devicestruct divert_blk *divert;#endif /* CONFIG_NET_DIVERT */ -/* generic object representation */ -struct kobject kobj; +/* generic device structure used in constructing class */ +struct device *dev; + +/* class/net/name entry */ +struct class_device class_dev; + +/* statistics sub-directory */ +struct kobject stats_kobj; };#define SET_MODULE_OWNER (dev) do { } while (0) +/* Set the sysfs physical device reference for the network logical device +* if set prior to registration will cause a symlink during initialization. +*/ +#define SET_NETDEV_DEV (net, pdev) ((net)->dev = (pdev)) +struct packet_type {
@@ -561,12 +572,12 @@ static inline void netif_stop_queue(struset_bit (__LINK_STATE_XOFF, &dev->state); } -static inline int netif_queue_stopped (struct net_device *dev) +static inline int netif_queue_stopped (const struct net_device *dev) {return test_bit (__LINK_STATE_XOFF, &dev->state); } -static inline int netif_running (struct net_device *dev) +static inline int netif_running (const struct net_device *dev) {return test_bit (__LINK_STATE_START, &dev->state); }
@@ -606,7 +617,9 @@ extern int netif_rx(struct sk_buff *skb#define HAVE_NETIF_RECEIVE_SKB 1extern int netif_receive_skb (struct sk_buff *skb);extern int dev_ioctl (unsigned int cmd,void *); +extern unsigned dev_get_flags (const struct net_device *);extern int dev_change_flags (struct net_device *,unsigned ); +extern int dev_set_mtu (struct net_device *,int );extern void dev_queue_xmit_nit (struct sk_buff *skb,struct net_device *dev);extern void dev_init (void );
@@ -642,7 +655,7 @@ static inline void dev_put(struct net_deextern void linkwatch_fire_event (struct net_device *dev); -static inline int netif_carrier_ok (struct net_device *dev) +static inline int netif_carrier_ok (const struct net_device *dev) {return !test_bit (__LINK_STATE_NOCARRIER, &dev->state); }
net/core/dev.c +56 -49
178 lines not on this page · raw message
net/core/Makefile +2 -1
@@ -10,7 +10,8 @@ obj-y += sysctl_net_core.o endif endif -obj-$(CONFIG_NET) += flow.o dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o +obj-$(CONFIG_NET) += flow.o dev.o net-sysfs.o dev_mcast.o dst.o neighbour.o \ + rtnetlink.o utils.o link_watch.o filter.o obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NET_DIVERT) += dv.o
net/core/net-sysfs.c +344 -0
344 lines not on this page · raw message