search for: virtnet_napi_tx_enable

Displaying 20 results from an estimated 35 matches for "virtnet_napi_tx_enable".

2023 May 12
4
[PATCH net v6] virtio_net: Fix error unwinding of XDP initialization
...;rq[qp_index].napi.napi_id); + if (err < 0) + return err; + + err = xdp_rxq_info_reg_mem_model(&vi->rq[qp_index].xdp_rxq, + MEM_TYPE_PAGE_SHARED, NULL); + if (err < 0) + goto err_xdp_reg_mem_model; + + virtnet_napi_enable(vi->rq[qp_index].vq, &vi->rq[qp_index].napi); + virtnet_napi_tx_enable(vi, vi->sq[qp_index].vq, &vi->sq[qp_index].napi); + + return 0; + +err_xdp_reg_mem_model: + xdp_rxq_info_unreg(&vi->rq[qp_index].xdp_rxq); + return err; +} + static int virtnet_open(struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); @@ -1881,22 +1913,20 @@ st...
2020 Jun 05
2
[PATCH] virtio_net: Unregister and re-register xdp_rxq across freeze/restore
...if (err < 0) return err; - err = xdp_rxq_info_reg_mem_model(&vi->rq[i].xdp_rxq, - MEM_TYPE_PAGE_SHARED, NULL); - if (err < 0) { - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); - return err; - } - virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); } @@ -2306,6 +2314,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev) if (netif_running(vi->dev)) { for (i = 0; i < vi->max_queue_pairs; i++) { + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); napi_disable(&vi-&...
2020 Jun 05
2
[PATCH] virtio_net: Unregister and re-register xdp_rxq across freeze/restore
...if (err < 0) return err; - err = xdp_rxq_info_reg_mem_model(&vi->rq[i].xdp_rxq, - MEM_TYPE_PAGE_SHARED, NULL); - if (err < 0) { - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); - return err; - } - virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); } @@ -2306,6 +2314,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev) if (netif_running(vi->dev)) { for (i = 0; i < vi->max_queue_pairs; i++) { + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); napi_disable(&vi-&...
2017 Apr 18
2
[PATCH net-next v2 2/5] virtio-net: transmit napi
...ting for more output buffers. */ + netif_wake_subqueue(vi->dev, vq2txq(vq)); } static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx) @@ -972,6 +979,21 @@ 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) +{ + if (!napi->weight) + return; + + if (!vi->affinity_hint_set) { + napi->weight = 0; + return; + } + + return virtnet_napi_enable(vq, napi); +} + static void refill_work(struct work_struct *work...
2017 Apr 25
3
[PATCH net-next] virtio-net: on tx, only call napi_disable if tx napi is on
...gt; --- drivers/net/virtio_net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 003143835766..82f1c3a73345 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -997,6 +997,12 @@ static void virtnet_napi_tx_enable(struct virtnet_info *vi, return virtnet_napi_enable(vq, napi); } +static void virtnet_napi_tx_disable(struct napi_struct *napi) +{ + if (napi->weight) + napi_disable(napi); +} + static void refill_work(struct work_struct *work) { struct virtnet_info *vi = @@ -1445,7 +1451,7 @@ static i...
2017 Apr 25
3
[PATCH net-next] virtio-net: on tx, only call napi_disable if tx napi is on
...gt; --- drivers/net/virtio_net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 003143835766..82f1c3a73345 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -997,6 +997,12 @@ static void virtnet_napi_tx_enable(struct virtnet_info *vi, return virtnet_napi_enable(vq, napi); } +static void virtnet_napi_tx_disable(struct napi_struct *napi) +{ + if (napi->weight) + napi_disable(napi); +} + static void refill_work(struct work_struct *work) { struct virtnet_info *vi = @@ -1445,7 +1451,7 @@ static i...
2023 May 10
2
[PATCH net v3] virtio_net: Fix error unwinding of XDP initialization
...gt;>>>>> + if (err < 0) >>>>>> + goto err_xdp_reg_mem_model; >>>>>> >>>>>> virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); >>>>>> virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); >>>>>> } >>>>>> >>>>>> return 0; >>>>>> + >>>>>> +err_xdp_reg_mem_model: >>>>>> + xdp_rxq_info_unreg(&vi->rq[i].xdp_...
2017 Apr 24
0
[PATCH net-next v3 2/5] virtio-net: transmit napi
...ting for more output buffers. */ + netif_wake_subqueue(vi->dev, vq2txq(vq)); } static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx) @@ -972,6 +979,24 @@ 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) +{ + 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->affin...
2023 May 09
1
[PATCH net v3] virtio_net: Fix error unwinding of XDP initialization
...- } > >>>> + if (err < 0) > >>>> + goto err_xdp_reg_mem_model; > >>>> > >>>> virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > >>>> virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); > >>>> } > >>>> > >>>> return 0; > >>>> + > >>>> +err_xdp_reg_mem_model: > >>>> + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); > >>&...
2023 Apr 28
1
[PATCH net v1 1/2] virtio_net: Fix error unwinding of XDP initialization
...xq_info_reg_mem_model(&vi->rq[i].xdp_rxq, MEM_TYPE_PAGE_SHARED, NULL); - if (err < 0) { - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); - return err; - } + if (err < 0) + goto err_xdp_reg_mem_model; virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); } return 0; + + /* error unwinding of xdp init */ +err_xdp_reg_mem_model: + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); +err_xdp_info_reg: + for (i = i - 1; i >= 0; i--) + virtnet_disable_qp(vi, i); + + return err; } static int virtnet_...
2017 Apr 20
0
[PATCH net-next v2 2/5] virtio-net: transmit napi
..._subqueue(vi->dev, vq2txq(vq)); > } > > static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx) > @@ -972,6 +979,21 @@ 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) > +{ > + if (!napi->weight) > + return; > + > + if (!vi->affinity_hint_set) { > + napi->weight = 0; > + return; > + } > + > + return virtnet_napi_enable(vq, n...
2017 Apr 18
8
[PATCH net-next v2 0/5] virtio-net tx napi
From: Willem de Bruijn <willemb at google.com> Add napi for virtio-net transmit completion processing. Changes: v1 -> v2: - disable by default - disable unless affinity_hint_set because cache misses add up to a third higher cycle cost, e.g., in TCP_RR tests. This is not limited to the patch that enables tx completion cleaning in rx napi. - use trylock to
2017 Apr 18
8
[PATCH net-next v2 0/5] virtio-net tx napi
From: Willem de Bruijn <willemb at google.com> Add napi for virtio-net transmit completion processing. Changes: v1 -> v2: - disable by default - disable unless affinity_hint_set because cache misses add up to a third higher cycle cost, e.g., in TCP_RR tests. This is not limited to the patch that enables tx completion cleaning in rx napi. - use trylock to
2020 Jun 07
0
[PATCH] virtio_net: Unregister and re-register xdp_rxq across freeze/restore
...err = xdp_rxq_info_reg_mem_model(&vi->rq[i].xdp_rxq, > - MEM_TYPE_PAGE_SHARED, NULL); > - if (err < 0) { > - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); > - return err; > - } > - > virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); > } > @@ -2306,6 +2314,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev) > > if (netif_running(vi->dev)) { > for (i = 0; i < vi->max_queue_pairs; i++) { > + xdp_rxq_info_unreg(&vi->rq[i].xdp_rx...
2018 Sep 13
5
[PATCH net-next V2] virtio_net: ethtool tx napi configuration
...ht) { + for (i = 0; i < vi->max_queue_pairs; i++) { + struct netdev_queue *txq = + netdev_get_tx_queue(vi->dev, i); + + virtnet_napi_tx_disable(&vi->sq[i].napi); + __netif_tx_lock_bh(txq); + vi->sq[i].napi.weight = napi_weight; + __netif_tx_unlock_bh(txq); + virtnet_napi_tx_enable(vi, vi->sq[i].vq, + &vi->sq[i].napi); + } + } + + return 0; +} + +static int virtnet_get_coalesce(struct net_device *dev, + struct ethtool_coalesce *ec) +{ + struct ethtool_coalesce ec_default = { + .cmd = ETHTOOL_GCOALESCE, + .rx_max_coalesced_frames = 1, + .tx_max_coal...
2018 Sep 13
5
[PATCH net-next V2] virtio_net: ethtool tx napi configuration
...ht) { + for (i = 0; i < vi->max_queue_pairs; i++) { + struct netdev_queue *txq = + netdev_get_tx_queue(vi->dev, i); + + virtnet_napi_tx_disable(&vi->sq[i].napi); + __netif_tx_lock_bh(txq); + vi->sq[i].napi.weight = napi_weight; + __netif_tx_unlock_bh(txq); + virtnet_napi_tx_enable(vi, vi->sq[i].vq, + &vi->sq[i].napi); + } + } + + return 0; +} + +static int virtnet_get_coalesce(struct net_device *dev, + struct ethtool_coalesce *ec) +{ + struct ethtool_coalesce ec_default = { + .cmd = ETHTOOL_GCOALESCE, + .rx_max_coalesced_frames = 1, + .tx_max_coal...
2023 May 02
1
[PATCH net v2] virtio_net: Fix error unwinding of XDP initialization
...xq_info_reg_mem_model(&vi->rq[i].xdp_rxq, MEM_TYPE_PAGE_SHARED, NULL); - if (err < 0) { - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); - return err; - } + if (err < 0) + goto err_xdp_reg_mem_model; virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); } return 0; + + /* error unwinding of xdp init */ +err_xdp_reg_mem_model: + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); +err_xdp_info_reg: + for (i = i - 1; i >= 0; i--) + virtnet_disable_qp(vi, i); + + return err; } static int virtnet_...
2017 Dec 31
1
[bpf-next V3 PATCH 11/14] virtio_net: setup xdp_rxq_info
...s: if oom use wq. */ if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL)) schedule_delayed_work(&vi->refill, 0); + + err = xdp_rxq_info_reg(&vi->rq[i].xdp_rxq, dev, i); + if (err < 0) + return err; + virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); } @@ -1560,6 +1571,7 @@ static int virtnet_close(struct net_device *dev) cancel_delayed_work_sync(&vi->refill); for (i = 0; i < vi->max_queue_pairs; i++) { + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); napi_disable(&vi-&g...
2023 May 02
1
[PATCH net v2] virtio_net: Fix error unwinding of XDP initialization
...gt; MEM_TYPE_PAGE_SHARED, NULL); > - if (err < 0) { > - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); > - return err; > - } > + if (err < 0) > + goto err_xdp_reg_mem_model; > > virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); > } > > return 0; > + > + /* error unwinding of xdp init */ btw we don't really need this comment - it's how all error handling is done anyways. if you need to roll v3, you can drop it. > +err_xdp_reg_mem_model: > +...
2023 May 06
1
[PATCH net v3] virtio_net: Fix error unwinding of XDP initialization
...> MEM_TYPE_PAGE_SHARED, NULL); > - if (err < 0) { > - xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); > - return err; > - } > + if (err < 0) > + goto err_xdp_reg_mem_model; > > virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > virtnet_napi_tx_enable(vi, vi->sq[i].vq, &vi->sq[i].napi); > } > > return 0; > + > +err_xdp_reg_mem_model: > + xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq); > +err_xdp_info_reg: > + for (i = i - 1; i >= 0; i--) > + virtnet_disable_qp(vi, i); I would to know should we handle...