[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAONBAadh1ZcH+D8XOkaLBWS0ssV4SVCNCq616Q8EK4kjY_G=xg@mail.gmail.com>
Date: Thu, 12 Mar 2015 10:42:29 +0100
From: Ronald Pina <pinaronald@...il.com>
To: netdev <netdev@...r.kernel.org>
Subject: Adjusting patch to support napi weighting on kernel 3.4.1
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 every network interfaces and including
virtual paravirtualized network interfaces like xen vif (since they
use napi now) on kernel 3.4.1.
The changes are listed below.
+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 ?
Thanks in advance
Ronald
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists