Re: [PATCH net-next 5/5] virtio-net: support tx netdim

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

 



On Thu, Oct 12, 2023 at 3:44 PM Heng Qi <hengqi@xxxxxxxxxxxxxxxxx> wrote:
>
> Similar to rx netdim, this patch supports adaptive tx
> coalescing moderation for the virtio-net.
>
> Signed-off-by: Heng Qi <hengqi@xxxxxxxxxxxxxxxxx>
> ---
>  drivers/net/virtio_net.c | 143 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 119 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 6ad2890a7909..1c680cb09d48 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -154,6 +154,15 @@ struct send_queue {
>
>         struct virtnet_sq_stats stats;
>
> +       /* The number of tx notifications */
> +       u16 calls;
> +
> +       /* Is dynamic interrupt moderation enabled? */
> +       bool dim_enabled;
> +
> +       /* Dynamic Interrupt Moderation */
> +       struct dim dim;
> +
>         struct virtnet_interrupt_coalesce intr_coal;
>
>         struct napi_struct napi;
> @@ -317,8 +326,9 @@ struct virtnet_info {
>         u8 duplex;
>         u32 speed;
>
> -       /* Is rx dynamic interrupt moderation enabled? */
> +       /* Is dynamic interrupt moderation enabled? */
>         bool rx_dim_enabled;
> +       bool tx_dim_enabled;
>
>         /* Interrupt coalescing settings */
>         struct virtnet_interrupt_coalesce intr_coal_tx;
> @@ -464,19 +474,40 @@ static bool virtqueue_napi_complete(struct napi_struct *napi,
>         return false;
>  }
>
> +static void virtnet_tx_dim_work(struct work_struct *work);
> +
> +static void virtnet_tx_dim_update(struct virtnet_info *vi, struct send_queue *sq)
> +{
> +       struct virtnet_sq_stats *stats = &sq->stats;
> +       struct dim_sample cur_sample = {};
> +
> +       u64_stats_update_begin(&sq->stats.syncp);
> +       dim_update_sample(sq->calls, stats->packets,
> +                         stats->bytes, &cur_sample);
> +       u64_stats_update_end(&sq->stats.syncp);
> +
> +       net_dim(&sq->dim, cur_sample);
> +}
> +
>  static void skb_xmit_done(struct virtqueue *vq)
>  {
>         struct virtnet_info *vi = vq->vdev->priv;
> -       struct napi_struct *napi = &vi->sq[vq2txq(vq)].napi;
> +       struct send_queue *sq = &vi->sq[vq2txq(vq)];
> +       struct napi_struct *napi = &sq->napi;
> +
> +       sq->calls++;

I wonder what's the impact of this counters for netdim. As we have a
mode of orphan skb in xmit.

We need to test to see.

Thanks

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux