Hello
I am trying to adjust the of Stephen Hemminger patch (
http://marc.info/?l=linux-netdev&m=111773621018096&w=2 ),  suporting
napi weight changes for virtual paravirtualized network interfaces
like xen vif (since they use napi now) on kernel 3.4.1.

The changes are listed below.

napi-sysfs/net/core/net-sysfs.c

+static int change_weight(struct napi_struct *napi, unsigned long new_weight)
+{
+         napi->weight = new_weight;
+         return 0;
+ }

+ static ssize_t weight_store(struct device *dev, struct
device_attribute *attr, const char *buf, size_t len)
+ {
+         return netdev_store(dev, attr, buf, len, change_weight);
+ }
+NETDEVICE_SHOW_RW ( weight, fmt_dec);


static struct attribute *net_class_attrs[] = {
&dev_attr_netdev_group.attr,
         &dev_attr_type.attr,
         &dev_attr_dev_id.attr,
         &dev_attr_dev_port.attr,
         &dev_attr_iflink.attr,
         &dev_attr_ifindex.attr,
         &dev_attr_name_assign_type.attr,
         &dev_attr_addr_assign_type.attr,
+      &dev_attr_addr_weight.attr,
         &dev_attr_link_mode.attr,
         &dev_attr_address.attr,
         &dev_attr_broadcast.attr,
         &dev_attr_speed.attr,
         &dev_attr_duplex.attr,
         &dev_attr_dormant.attr,
         &dev_attr_operstate.attr,
         &dev_attr_carrier_changes.attr,
         &dev_attr_ifalias.attr,
         &dev_attr_carrier.attr,
         &dev_attr_mtu.attr,
         &dev_attr_flags.attr,
         &dev_attr_tx_queue_len.attr,
         &dev_attr_gro_flush_timeout.attr,
         &dev_attr_phys_port_id.attr,
         &dev_attr_phys_switch_id.attr,
         NULL,
 };

But the weight prameter is on the napi_structure, not on the struct
net_device.   I tried to compile it but it shows:
--------------------------------------------------------------------------
net/core/net-sysfs.c: In function ‘format_weight’:
net/core/net-sysfs.c:268: error: ‘const struct net_device’ has no
member named ‘weight’
net/core/net-sysfs.c: In function ‘store_weight’:
net/core/net-sysfs.c:280: warning: passing argument 5 of
‘netdev_store’ from incompatible pointer type
net/core/net-sysfs.c:80: note: expected ‘int (*)(struct net_device *,
long unsigned int)’ but argument is of type ‘int (*)(struct
napi_struct *, long unsigned int)’
make[2]: *** [net/core/net-sysfs.o] Error 1
make[1]: *** [net/core] Error 2
make: *** [net] Error 2

----------------------------------------------------------------------------

How can i reference struct  napi_stuct inide the function
change_weight, and how can i pass the new weight to netdev_store
function ?

The main idea is that a sysadmin can change the weight of vif using
sysfs , for example to use a weight of 32 for low priority vif.
Another reason that i am asking how to make those changes, is to to
make study that how the values of weights affect the network
performace of virtual machines.

Thanks in advance

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to