[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Adjusting patch to support napi weighting fot vif on kernel 3.4.1 using sysfs


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Ronald Pina <pinaronald@xxxxxxxxx>
  • Date: Thu, 12 Mar 2015 12:19:21 +0100
  • Delivery-date: Thu, 12 Mar 2015 11:19:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.