All of lore.kernel.org
 help / color / mirror / Atom feed
* Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
@ 2015-03-13 11:11 Ronald Pina
  2015-03-13 11:30 ` Wei Liu
  2015-03-13 17:03 ` Zoltan Kiss
  0 siblings, 2 replies; 10+ messages in thread
From: Ronald Pina @ 2015-03-13 11:11 UTC (permalink / raw)
  To: xen-devel

Hello
I am working to allow controlling napi weight of virtual interfaces on
xen using sysfs.
If may i ask, is it achievable since NAPI interface structure in
current kernels is managed by the driver?

Please, any help or idea is very appreciated.
Best Regards

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 11:11 Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs Ronald Pina
@ 2015-03-13 11:30 ` Wei Liu
  2015-03-13 11:56   ` Ronald Pina
  2015-03-13 17:03 ` Zoltan Kiss
  1 sibling, 1 reply; 10+ messages in thread
From: Wei Liu @ 2015-03-13 11:30 UTC (permalink / raw)
  To: Ronald Pina; +Cc: wei.liu2, xen-devel

On Fri, Mar 13, 2015 at 12:11:51PM +0100, Ronald Pina wrote:
> Hello
> I am working to allow controlling napi weight of virtual interfaces on
> xen using sysfs.
> If may i ask, is it achievable since NAPI interface structure in
> current kernels is managed by the driver?
> 

I would say yes. Netback is just another kernel driver that uses NAPI as
far as kernel concerns.

Actually I am wondering what you need to do to enable that. Shouldn't
the sysfs knob just show up?

Wei.

> Please, any help or idea is very appreciated.
> Best Regards
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 11:30 ` Wei Liu
@ 2015-03-13 11:56   ` Ronald Pina
  2015-03-13 12:05     ` Wei Liu
  0 siblings, 1 reply; 10+ messages in thread
From: Ronald Pina @ 2015-03-13 11:56 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel

Actually not, it was removed since the weight parameter was moved from
the net_device structure to napi_struct.
An older implementation of sysfs on kernel 2.6.21 was done this way:


NETDEVICE_SHOW(weight, fmt_dec);

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

static ssize_t store_weight(struct device *dev, struct device_attribute *attr,
                const char *buf, size_t len)
{
    return netdev_store(dev, attr, buf, len, change_weight);
}

static struct device_attribute net_class_attributes[] = {

.......... ..........   ....

__ATTR(weight, S_IRUGO | S_IWUSR, show_weight, store_weight)

But, now i that the weight is not anymore on net_device struct, I'm
having problems referencing  napi_struct.
I want to use this kind of mechanism on kernel our updated kernels.
The idea of bringing support back to control napi weight with sysfs is
very attractive.

Do you have any idea what must be changed to achieve this supplementary control?



On Fri, Mar 13, 2015 at 12:30 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> On Fri, Mar 13, 2015 at 12:11:51PM +0100, Ronald Pina wrote:
>> Hello
>> I am working to allow controlling napi weight of virtual interfaces on
>> xen using sysfs.
>> If may i ask, is it achievable since NAPI interface structure in
>> current kernels is managed by the driver?
>>
>
> I would say yes. Netback is just another kernel driver that uses NAPI as
> far as kernel concerns.
>
> Actually I am wondering what you need to do to enable that. Shouldn't
> the sysfs knob just show up?
>
> Wei.
>
>> Please, any help or idea is very appreciated.
>> Best Regards
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 11:56   ` Ronald Pina
@ 2015-03-13 12:05     ` Wei Liu
  2015-03-13 12:49       ` Ronald Pina
  0 siblings, 1 reply; 10+ messages in thread
From: Wei Liu @ 2015-03-13 12:05 UTC (permalink / raw)
  To: Ronald Pina; +Cc: Wei Liu, xen-devel

Please don't top-post.

On Fri, Mar 13, 2015 at 12:56:53PM +0100, Ronald Pina wrote:
> Actually not, it was removed since the weight parameter was moved from
> the net_device structure to napi_struct.
> An older implementation of sysfs on kernel 2.6.21 was done this way:
> 
> 
> NETDEVICE_SHOW(weight, fmt_dec);
> 
> static int change_weight(struct net_device *net, unsigned long new_weight)
> {
>     net->weight = new_weight;
>     return 0;
> }
> 
> static ssize_t store_weight(struct device *dev, struct device_attribute *attr,
>                 const char *buf, size_t len)
> {
>     return netdev_store(dev, attr, buf, len, change_weight);
> }
> 
> static struct device_attribute net_class_attributes[] = {
> 
> .......... ..........   ....
> 
> __ATTR(weight, S_IRUGO | S_IWUSR, show_weight, store_weight)
> 
> But, now i that the weight is not anymore on net_device struct, I'm

This doesn't really matter. This kind of core driver change can be
easily adapted in individual driver.

> having problems referencing  napi_struct.

Where do you want to reference napi_struct?

> I want to use this kind of mechanism on kernel our updated kernels.

What kernel version are you using?

> The idea of bringing support back to control napi weight with sysfs is
> very attractive.
> 

What about other network drivers in the kernel you're using? What do
they do? I think you can just use one existing driver for reference.

> Do you have any idea what must be changed to achieve this supplementary control?
> 

If the issue you're seeing is a core driver issue, then you need to ask
core network driver what to do. If it's a netback specific problem, I
would say you just need to look at other drivers which expose
napi_weight via sysfs and hook up netback using the same method.

Wei.

> 
> 
> On Fri, Mar 13, 2015 at 12:30 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> > On Fri, Mar 13, 2015 at 12:11:51PM +0100, Ronald Pina wrote:
> >> Hello
> >> I am working to allow controlling napi weight of virtual interfaces on
> >> xen using sysfs.
> >> If may i ask, is it achievable since NAPI interface structure in
> >> current kernels is managed by the driver?
> >>
> >
> > I would say yes. Netback is just another kernel driver that uses NAPI as
> > far as kernel concerns.
> >
> > Actually I am wondering what you need to do to enable that. Shouldn't
> > the sysfs knob just show up?
> >
> > Wei.
> >
> >> Please, any help or idea is very appreciated.
> >> Best Regards
> >>
> >> _______________________________________________
> >> Xen-devel mailing list
> >> Xen-devel@lists.xen.org
> >> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 12:05     ` Wei Liu
@ 2015-03-13 12:49       ` Ronald Pina
  2015-03-13 13:53         ` Wei Liu
  0 siblings, 1 reply; 10+ messages in thread
From: Ronald Pina @ 2015-03-13 12:49 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel

My main idea was to adapt the the function of static int
change_weight(struct net_device *net, unsigned long new_weight) and
static ssize_t store_weight(struct device *dev, struct
device_attribute *attr, const char *buf, size_t len) which are present
on kernel 2.6.21 . In this kernel we can change the weight of every
interface because the weight parameter is inside the net_device
structure. But on later kernel the weight was inserted on napi_struct
and wasn't exposed for every interface. Thus now we can only change
the default weight and every device use the same weight (of course if
their drivers allow that).
This kind of organization is used in xen netback too, with weight 64.

If may ask , how can i change the weight for every individual
interface (vif) or how can i adopt the sysfs to change the weight for
every vif ?

My goal is to allow  different vif to have different weight, for
example vif1.0 to have a weight 32 ,and vif1.0 weight 64. I am using
kernel 3.18

Thanks

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 12:49       ` Ronald Pina
@ 2015-03-13 13:53         ` Wei Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Wei Liu @ 2015-03-13 13:53 UTC (permalink / raw)
  To: Ronald Pina; +Cc: Wei Liu, xen-devel

On Fri, Mar 13, 2015 at 01:49:34PM +0100, Ronald Pina wrote:
> My main idea was to adapt the the function of static int
> change_weight(struct net_device *net, unsigned long new_weight) and
> static ssize_t store_weight(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t len) which are present
> on kernel 2.6.21 . In this kernel we can change the weight of every
> interface because the weight parameter is inside the net_device
> structure. But on later kernel the weight was inserted on napi_struct
> and wasn't exposed for every interface. Thus now we can only change
> the default weight and every device use the same weight (of course if
> their drivers allow that).

This is the "core driver change" I referred to. They did that for a
reason and there is little thing I (as a netback maintainer) can do.

> This kind of organization is used in xen netback too, with weight 64.
> 
> If may ask , how can i change the weight for every individual
> interface (vif) or how can i adopt the sysfs to change the weight for
> every vif ?
> 

You either need to forward port all the core bits from 2.6.21 to 3.18
(which I don't recommend) or wire up things by hand, i.e. look for
examples one how to use sysfs interface and expose relevant bits by
hand.

In any case, if you want this feature appears in upstream kernel, you
need to talk to core network driver maintainers.

Wei.

> My goal is to allow  different vif to have different weight, for
> example vif1.0 to have a weight 32 ,and vif1.0 weight 64. I am using
> kernel 3.18
> 
> Thanks

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 11:11 Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs Ronald Pina
  2015-03-13 11:30 ` Wei Liu
@ 2015-03-13 17:03 ` Zoltan Kiss
  2015-03-13 19:05   ` Ronald Pina
  1 sibling, 1 reply; 10+ messages in thread
From: Zoltan Kiss @ 2015-03-13 17:03 UTC (permalink / raw)
  To: Ronald Pina, xen-devel

Hi,

I reckon you want to do this for the same reason you started this thread 
a month ago:

http://lists.xen.org/archives/html/xen-devel/2015-02/msg00228.html

Have you considered the suggestions given there? (using the existing 
traffic shaping facilities of the kernel). As Wei said, you would have 
better luck with them than introducing a core networking driver feature 
which might be redundant?

Regards,

Zoltan

On 13/03/15 11:11, Ronald Pina wrote:
> Hello
> I am working to allow controlling napi weight of virtual interfaces on
> xen using sysfs.
> If may i ask, is it achievable since NAPI interface structure in
> current kernels is managed by the driver?
>
> Please, any help or idea is very appreciated.
> Best Regards
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 17:03 ` Zoltan Kiss
@ 2015-03-13 19:05   ` Ronald Pina
  2015-03-16 11:49     ` Zoltan Kiss
  0 siblings, 1 reply; 10+ messages in thread
From: Ronald Pina @ 2015-03-13 19:05 UTC (permalink / raw)
  To: Zoltan Kiss; +Cc: xen-devel

Hi Zoltan

Yes , i successfully achieved good results using tc tools, it could do
the job and the performance was great. But my primary goal is to make
a study about the  of performance impact of  the weight parameter.

It must be noted that Xen use NAPI, and on dom0 every vif is treated
in the same way as every real network interface. On old kernels that
feature was present , here is a patch that can show how was that
implemented:

http://marc.info/?l=linux-netdev&m=111773621018096&w=2

As soon as on later kernel the weight was inserted on napi_struct, the
weight wasn't exposed any more for every interface.
Maybe that feature is not essential necessary, it can be valuable on
dom0 where there many vif . It is another supplementary control knob,
someone may found it useful to tweak the performance.

Regards,
Ronald

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-13 19:05   ` Ronald Pina
@ 2015-03-16 11:49     ` Zoltan Kiss
  2015-03-17 11:11       ` Ronald Pina
  0 siblings, 1 reply; 10+ messages in thread
From: Zoltan Kiss @ 2015-03-16 11:49 UTC (permalink / raw)
  To: Ronald Pina; +Cc: xen-devel

Hi,

In that case I recommend you to take a look at the debugfs patch already 
in there, based on that it should be pretty straightforward to do it 
what you want:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f51de243

It already prints out "queue->napi.weight"

Zoltan

On 13/03/15 19:05, Ronald Pina wrote:
> Hi Zoltan
>
> Yes , i successfully achieved good results using tc tools, it could do
> the job and the performance was great. But my primary goal is to make
> a study about the  of performance impact of  the weight parameter.
>
> It must be noted that Xen use NAPI, and on dom0 every vif is treated
> in the same way as every real network interface. On old kernels that
> feature was present , here is a patch that can show how was that
> implemented:
>
> http://marc.info/?l=linux-netdev&m=111773621018096&w=2
>
> As soon as on later kernel the weight was inserted on napi_struct, the
> weight wasn't exposed any more for every interface.
> Maybe that feature is not essential necessary, it can be valuable on
> dom0 where there many vif . It is another supplementary control knob,
> someone may found it useful to tweak the performance.
>
> Regards,
> Ronald
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs
  2015-03-16 11:49     ` Zoltan Kiss
@ 2015-03-17 11:11       ` Ronald Pina
  0 siblings, 0 replies; 10+ messages in thread
From: Ronald Pina @ 2015-03-17 11:11 UTC (permalink / raw)
  To: Zoltan Kiss; +Cc: xen-devel

Thanks Zoli, every time you have  given very well detailed answers.
I will consider that and will let you know .

Best Regards
Ronald

On Mon, Mar 16, 2015 at 12:49 PM, Zoltan Kiss <zoltan.kiss@linaro.org> wrote:
> Hi,
>
> In that case I recommend you to take a look at the debugfs patch already in
> there, based on that it should be pretty straightforward to do it what you
> want:
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f51de243
>
> It already prints out "queue->napi.weight"
>
> Zoltan

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-17 11:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 11:11 Allow controlling NAPI weight of virtual network interfaces (vif) with sysfs Ronald Pina
2015-03-13 11:30 ` Wei Liu
2015-03-13 11:56   ` Ronald Pina
2015-03-13 12:05     ` Wei Liu
2015-03-13 12:49       ` Ronald Pina
2015-03-13 13:53         ` Wei Liu
2015-03-13 17:03 ` Zoltan Kiss
2015-03-13 19:05   ` Ronald Pina
2015-03-16 11:49     ` Zoltan Kiss
2015-03-17 11:11       ` Ronald Pina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.