* [PATCH net-next] virtio-net: make napi_tx param easier to grasp
@ 2017-08-19 6:37 Koichiro Den
2017-08-20 20:30 ` Willem de Bruijn
2017-08-20 20:30 ` Willem de Bruijn
0 siblings, 2 replies; 5+ messages in thread
From: Koichiro Den @ 2017-08-19 6:37 UTC (permalink / raw)
To: mst; +Cc: netdev, virtualization
The module param napi_tx needs not to be writable for now since we do
not have any means of activating/deactivating it online, which seems to
be a low priority. Also make it clear that napi_tx is disabled when it
has been dynamically disabled behind the scenes.
Signed-off-by: Koichiro Den <den@klaipeden.com>
---
drivers/net/virtio_net.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4302f313d9a7..ea4e7ddcd377 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -37,7 +37,7 @@ module_param(napi_weight, int, 0444);
static bool csum = true, gso = true, napi_tx;
module_param(csum, bool, 0444);
module_param(gso, bool, 0444);
-module_param(napi_tx, bool, 0644);
+module_param(napi_tx, bool, 0444);
/* FIXME: MTU in config. */
#define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
@@ -1026,20 +1026,13 @@ static void virtnet_napi_enable(struct virtqueue *vq, struct napi_struct *napi)
local_bh_enable();
}
-static void virtnet_napi_tx_enable(struct virtnet_info *vi,
- struct virtqueue *vq,
- struct napi_struct *napi)
+static void virtnet_napi_tx_enable(struct virtqueue *vq, struct napi_struct *napi)
{
- if (!napi->weight)
- return;
-
- /* Tx napi touches cachelines on the cpu handling tx interrupts. Only
- * enable the feature if this is likely affine with the transmit path.
- */
- if (!vi->affinity_hint_set) {
+ if (!napi_tx)
napi->weight = 0;
+
+ if (!napi->weight)
return;
- }
return virtnet_napi_enable(vq, napi);
}
@@ -1179,13 +1172,19 @@ static int virtnet_open(struct net_device *dev)
struct virtnet_info *vi = netdev_priv(dev);
int i;
+ /* Tx napi touches cachelines on the cpu handling tx interrupts. Only
+ * enable the feature if this is likely affine with the transmit path.
+ */
+ if (!vi->affinity_hint_set)
+ napi_tx = false;
+
for (i = 0; i < vi->max_queue_pairs; i++) {
if (i < vi->curr_queue_pairs)
/* Make sure we have some buffers: if oom use wq. */
if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
schedule_delayed_work(&vi->refill, 0);
virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi);
- virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi);
+ virtnet_napi_tx_enable(vi->sq[i].vq, &vi->sq[i].napi);
}
return 0;
@@ -1890,6 +1889,12 @@ static int virtnet_restore_up(struct virtio_device *vdev)
virtio_device_ready(vdev);
+ /* Tx napi touches cachelines on the cpu handling tx interrupts. Only
+ * enable the feature if this is likely affine with the transmit path.
+ */
+ if (!vi->affinity_hint_set)
+ napi_tx = false;
+
if (netif_running(vi->dev)) {
for (i = 0; i < vi->curr_queue_pairs; i++)
if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
@@ -1897,8 +1902,7 @@ static int virtnet_restore_up(struct virtio_device *vdev)
for (i = 0; i < vi->max_queue_pairs; i++) {
virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi);
- virtnet_napi_tx_enable(vi, vi->sq[i].vq,
- &vi->sq[i].napi);
+ virtnet_napi_tx_enable(vi->sq[i].vq, &vi->sq[i].napi);
}
}
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] virtio-net: make napi_tx param easier to grasp
2017-08-19 6:37 [PATCH net-next] virtio-net: make napi_tx param easier to grasp Koichiro Den
2017-08-20 20:30 ` Willem de Bruijn
@ 2017-08-20 20:30 ` Willem de Bruijn
2017-08-21 11:49 ` Koichiro Den
2017-08-21 11:49 ` Koichiro Den
1 sibling, 2 replies; 5+ messages in thread
From: Willem de Bruijn @ 2017-08-20 20:30 UTC (permalink / raw)
To: Koichiro Den; +Cc: Michael S. Tsirkin, virtualization, Network Development
On Sat, Aug 19, 2017 at 2:37 AM, Koichiro Den <den@klaipeden.com> wrote:
> The module param napi_tx needs not to be writable for now since we do
> not have any means of activating/deactivating it online,
A virtio_net device inherits its napi tx mode from the global napi_tx flag
on device up. It is possible to change the parameter and bring a device
down/up to change the device mode.
> @@ -1179,13 +1172,19 @@ static int virtnet_open(struct net_device *dev)
> struct virtnet_info *vi = netdev_priv(dev);
> int i;
>
> + /* Tx napi touches cachelines on the cpu handling tx interrupts. Only
> + * enable the feature if this is likely affine with the transmit path.
> + */
> + if (!vi->affinity_hint_set)
> + napi_tx = false;
> +
This disables napi globally if a specific device lacks affinity.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] virtio-net: make napi_tx param easier to grasp
2017-08-19 6:37 [PATCH net-next] virtio-net: make napi_tx param easier to grasp Koichiro Den
@ 2017-08-20 20:30 ` Willem de Bruijn
2017-08-20 20:30 ` Willem de Bruijn
1 sibling, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2017-08-20 20:30 UTC (permalink / raw)
To: Koichiro Den; +Cc: Network Development, virtualization, Michael S. Tsirkin
On Sat, Aug 19, 2017 at 2:37 AM, Koichiro Den <den@klaipeden.com> wrote:
> The module param napi_tx needs not to be writable for now since we do
> not have any means of activating/deactivating it online,
A virtio_net device inherits its napi tx mode from the global napi_tx flag
on device up. It is possible to change the parameter and bring a device
down/up to change the device mode.
> @@ -1179,13 +1172,19 @@ static int virtnet_open(struct net_device *dev)
> struct virtnet_info *vi = netdev_priv(dev);
> int i;
>
> + /* Tx napi touches cachelines on the cpu handling tx interrupts. Only
> + * enable the feature if this is likely affine with the transmit path.
> + */
> + if (!vi->affinity_hint_set)
> + napi_tx = false;
> +
This disables napi globally if a specific device lacks affinity.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] virtio-net: make napi_tx param easier to grasp
2017-08-20 20:30 ` Willem de Bruijn
2017-08-21 11:49 ` Koichiro Den
@ 2017-08-21 11:49 ` Koichiro Den
1 sibling, 0 replies; 5+ messages in thread
From: Koichiro Den @ 2017-08-21 11:49 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: Michael S. Tsirkin, virtualization, Network Development
On Sun, 2017-08-20 at 16:30 -0400, Willem de Bruijn wrote:
> On Sat, Aug 19, 2017 at 2:37 AM, Koichiro Den <den@klaipeden.com> wrote:
> > The module param napi_tx needs not to be writable for now since we do
> > not have any means of activating/deactivating it online,
>
> A virtio_net device inherits its napi tx mode from the global napi_tx flag
> on device up. It is possible to change the parameter and bring a device
> down/up to change the device mode.
>
> > @@ -1179,13 +1172,19 @@ static int virtnet_open(struct net_device *dev)
> > struct virtnet_info *vi = netdev_priv(dev);
> > int i;
> >
> > + /* Tx napi touches cachelines on the cpu handling tx interrupts.
> > Only
> > + * enable the feature if this is likely affine with the transmit
> > path.
> > + */
> > + if (!vi->affinity_hint_set)
> > + napi_tx = false;
> > +
>
> This disables napi globally if a specific device lacks affinity.
Now I see this is not appropriate since it just represents whether or not TX
napi is available, not that whether or not it is being turned on or off on a
particular device. Thank you.
To be honest I hoped to make it possible to see which mode it is currently
running on with ease, but I guess it's not nice to accomplish it with net sysfs
nor ethtool or whatever because it seems not much generic matter.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] virtio-net: make napi_tx param easier to grasp
2017-08-20 20:30 ` Willem de Bruijn
@ 2017-08-21 11:49 ` Koichiro Den
2017-08-21 11:49 ` Koichiro Den
1 sibling, 0 replies; 5+ messages in thread
From: Koichiro Den @ 2017-08-21 11:49 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: Network Development, virtualization, Michael S. Tsirkin
On Sun, 2017-08-20 at 16:30 -0400, Willem de Bruijn wrote:
> On Sat, Aug 19, 2017 at 2:37 AM, Koichiro Den <den@klaipeden.com> wrote:
> > The module param napi_tx needs not to be writable for now since we do
> > not have any means of activating/deactivating it online,
>
> A virtio_net device inherits its napi tx mode from the global napi_tx flag
> on device up. It is possible to change the parameter and bring a device
> down/up to change the device mode.
>
> > @@ -1179,13 +1172,19 @@ static int virtnet_open(struct net_device *dev)
> > struct virtnet_info *vi = netdev_priv(dev);
> > int i;
> >
> > + /* Tx napi touches cachelines on the cpu handling tx interrupts.
> > Only
> > + * enable the feature if this is likely affine with the transmit
> > path.
> > + */
> > + if (!vi->affinity_hint_set)
> > + napi_tx = false;
> > +
>
> This disables napi globally if a specific device lacks affinity.
Now I see this is not appropriate since it just represents whether or not TX
napi is available, not that whether or not it is being turned on or off on a
particular device. Thank you.
To be honest I hoped to make it possible to see which mode it is currently
running on with ease, but I guess it's not nice to accomplish it with net sysfs
nor ethtool or whatever because it seems not much generic matter.
Thanks.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-21 11:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-19 6:37 [PATCH net-next] virtio-net: make napi_tx param easier to grasp Koichiro Den
2017-08-20 20:30 ` Willem de Bruijn
2017-08-20 20:30 ` Willem de Bruijn
2017-08-21 11:49 ` Koichiro Den
2017-08-21 11:49 ` Koichiro Den
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.