diff options
| author | Stephen Hemminger <shemminger@osdl.org> | 2005-06-08 17:55:42 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2005-06-08 17:55:42 -0400 |
| commit | 699a411451a32cc111410f44f172b265f6d679c8 (patch) | |
| tree | 7a959a5f8a7da6c1f9d7a41c9c0425754625314c | |
| parent | 8181b8c1f3a69fe5abcc51cb732eb512ccd1566a (diff) | |
[NET]: Allow controlling NAPI device weight with sysfs
Simple interface to allow changing network device scheduling weight
with sysfs. Please consider this for 2.6.12, since risk/impact is small.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/core/net-sysfs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 910eb4c05a47..e2137f3e489d 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
| @@ -185,6 +185,22 @@ static ssize_t store_tx_queue_len(struct class_device *dev, const char *buf, siz | |||
| 185 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, | 185 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, |
| 186 | store_tx_queue_len); | 186 | store_tx_queue_len); |
| 187 | 187 | ||
| 188 | NETDEVICE_SHOW(weight, fmt_dec); | ||
| 189 | |||
| 190 | static int change_weight(struct net_device *net, unsigned long new_weight) | ||
| 191 | { | ||
| 192 | net->weight = new_weight; | ||
| 193 | return 0; | ||
| 194 | } | ||
| 195 | |||
| 196 | static ssize_t store_weight(struct class_device *dev, const char *buf, size_t len) | ||
| 197 | { | ||
| 198 | return netdev_store(dev, buf, len, change_weight); | ||
| 199 | } | ||
| 200 | |||
| 201 | static CLASS_DEVICE_ATTR(weight, S_IRUGO | S_IWUSR, show_weight, | ||
| 202 | store_weight); | ||
| 203 | |||
| 188 | 204 | ||
| 189 | static struct class_device_attribute *net_class_attributes[] = { | 205 | static struct class_device_attribute *net_class_attributes[] = { |
| 190 | &class_device_attr_ifindex, | 206 | &class_device_attr_ifindex, |
| @@ -194,6 +210,7 @@ static struct class_device_attribute *net_class_attributes[] = { | |||
| 194 | &class_device_attr_features, | 210 | &class_device_attr_features, |
| 195 | &class_device_attr_mtu, | 211 | &class_device_attr_mtu, |
| 196 | &class_device_attr_flags, | 212 | &class_device_attr_flags, |
| 213 | &class_device_attr_weight, | ||
| 197 | &class_device_attr_type, | 214 | &class_device_attr_type, |
| 198 | &class_device_attr_address, | 215 | &class_device_attr_address, |
| 199 | &class_device_attr_broadcast, | 216 | &class_device_attr_broadcast, |
