netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: virtualization <virtualization@lists.linux-foundation.org>,
	netdev <netdev@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	bpf@vger.kernel.org, "Zhu, Lingshan" <lingshan.zhu@intel.com>
Subject: Re: [PATCH v5 20/22] virtio_net: set the default max ring num
Date: Mon, 21 Feb 2022 15:00:17 +0800	[thread overview]
Message-ID: <d8011051-dc45-85f6-3630-4ba0cf6179b2@redhat.com> (raw)
In-Reply-To: <2a7acc5a-2c4d-2176-efd6-2aa828833587@redhat.com>


在 2022/2/21 上午11:40, Jason Wang 写道:
>
> 在 2022/2/17 下午5:30, Xuan Zhuo 写道:
>> On Thu, 17 Feb 2022 15:21:26 +0800, Jason Wang <jasowang@redhat.com> 
>> wrote:
>>> On Wed, Feb 16, 2022 at 3:52 PM Xuan Zhuo 
>>> <xuanzhuo@linux.alibaba.com> wrote:
>>>> On Wed, 16 Feb 2022 12:14:31 +0800, Jason Wang 
>>>> <jasowang@redhat.com> wrote:
>>>>> On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo 
>>>>> <xuanzhuo@linux.alibaba.com> wrote:
>>>>>> Sets the default maximum ring num based on 
>>>>>> virtio_set_max_ring_num().
>>>>>>
>>>>>> The default maximum ring num is 1024.
>>>>> Having a default value is pretty useful, I see 32K is used by 
>>>>> default for IFCVF.
>>>>>
>>>>> Rethink this, how about having a different default value based on 
>>>>> the speed?
>>>>>
>>>>> Without SPEED_DUPLEX, we use 1024. Otherwise
>>>>>
>>>>> 10g 4096
>>>>> 40g 8192
>>>> We can define different default values of tx and rx by the way. 
>>>> This way I can
>>>> just use it in the new interface of find_vqs().
>>>>
>>>> without SPEED_DUPLEX:  tx 512 rx 1024
>>>>
>>> Any reason that TX is smaller than RX?
>>>
>> I've seen some NIC drivers with default tx smaller than rx.
>
>
> Interesting, do they use combined channels?


Adding Ling Shan.

I see 32K is used for IFCVF by default, this is another call for the 
this patch:

# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:        32768
RX Mini:    0
RX Jumbo:    0
TX:        32768
Current hardware settings:
RX:        32768
RX Mini:    0
RX Jumbo:    0
TX:        32768

Thanks


>
>
>>
>> One problem I have now is that inside virtnet_probe, init_vqs is 
>> before getting
>> speed/duplex. I'm not sure, can the logic to get speed/duplex be put 
>> before
>> init_vqs? Is there any risk?
>>
>> Can you help me?
>
>
> The feature has been negotiated during probe(), so I don't see any risk.
>
> Thanks
>
>
>>
>> Thanks.
>>
>>> Thanks
>>>
>>>> Thanks.
>>>>
>>>>
>>>>> etc.
>>>>>
>>>>> (The number are just copied from the 10g/40g default parameter from
>>>>> other vendors)
>>>>>
>>>>> Thanks
>>>>>
>>>>>> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
>>>>>> ---
>>>>>>   drivers/net/virtio_net.c | 4 ++++
>>>>>>   1 file changed, 4 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>>>>>> index a4ffd7cdf623..77e61fe0b2ce 100644
>>>>>> --- a/drivers/net/virtio_net.c
>>>>>> +++ b/drivers/net/virtio_net.c
>>>>>> @@ -35,6 +35,8 @@ module_param(napi_tx, bool, 0644);
>>>>>>   #define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
>>>>>>   #define GOOD_COPY_LEN  128
>>>>>>
>>>>>> +#define VIRTNET_DEFAULT_MAX_RING_NUM 1024
>>>>>> +
>>>>>>   #define VIRTNET_RX_PAD (NET_IP_ALIGN + NET_SKB_PAD)
>>>>>>
>>>>>>   /* Amount of XDP headroom to prepend to packets for use by 
>>>>>> xdp_adjust_head */
>>>>>> @@ -3045,6 +3047,8 @@ static int virtnet_find_vqs(struct 
>>>>>> virtnet_info *vi)
>>>>>>                          ctx[rxq2vq(i)] = true;
>>>>>>          }
>>>>>>
>>>>>> +       virtio_set_max_ring_num(vi->vdev, 
>>>>>> VIRTNET_DEFAULT_MAX_RING_NUM);
>>>>>> +
>>>>>>          ret = virtio_find_vqs_ctx(vi->vdev, total_vqs, vqs, 
>>>>>> callbacks,
>>>>>>                                    names, ctx, NULL);
>>>>>>          if (ret)
>>>>>> -- 
>>>>>> 2.31.0
>>>>>>


  reply	other threads:[~2022-02-21  7:00 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14  8:13 [PATCH v5 00/22] virtio pci support VIRTIO_F_RING_RESET Xuan Zhuo
2022-02-14  8:13 ` [PATCH v5 01/22] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data Xuan Zhuo
2022-02-14  8:13 ` [PATCH v5 02/22] virtio: queue_reset: add VIRTIO_F_RING_RESET Xuan Zhuo
2022-02-14  8:13 ` [PATCH v5 03/22] virtio_ring: queue_reset: add function vring_setup_virtqueue() Xuan Zhuo
2022-02-14  8:13 ` [PATCH v5 04/22] virtio_ring: queue_reset: split: add __vring_init_virtqueue() Xuan Zhuo
2022-02-14  8:13 ` [PATCH v5 05/22] virtio_ring: queue_reset: split: support enable reset queue Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 06/22] virtio_ring: queue_reset: packed: " Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-14  8:14 ` [PATCH v5 07/22] virtio_ring: queue_reset: extract the release function of the vq ring Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 08/22] virtio_ring: queue_reset: add vring_release_virtqueue() Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-14  8:14 ` [PATCH v5 09/22] virtio: queue_reset: struct virtio_config_ops add callbacks for queue_reset Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 10/22] virtio_pci: queue_reset: update struct virtio_pci_common_cfg and option functions Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 11/22] virtio_pci: queue_reset: release vq by vp_dev->vqs Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 12/22] virtio_pci: queue_reset: setup_vq() support vring_setup_virtqueue() Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 13/22] virtio_pci: queue_reset: reserve vq->priv for re-enable queue Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 14/22] virtio_pci: queue_reset: support VIRTIO_F_RING_RESET Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-16  8:03     ` Xuan Zhuo
2022-02-17  7:25       ` Jason Wang
2022-02-14  8:14 ` [PATCH v5 15/22] virtio: queue_reset: add helper Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 16/22] virtio_net: split free_unused_bufs() Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 17/22] virtio_net: support rx/tx queue reset Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-16  7:56     ` Xuan Zhuo
2022-02-16  8:35       ` Michael S. Tsirkin
2022-02-16  8:42         ` Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 18/22] virtio: add helper virtqueue_get_vring_max_size() Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 19/22] virtio: add helper virtio_set_max_ring_num() Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-16  7:54     ` Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 20/22] virtio_net: set the default max ring num Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-16  7:46     ` Xuan Zhuo
2022-02-17  7:21       ` Jason Wang
2022-02-17  9:30         ` Xuan Zhuo
2022-02-21  3:40           ` Jason Wang
2022-02-21  7:00             ` Jason Wang [this message]
2022-02-14  8:14 ` [PATCH v5 21/22] virtio_net: get max ring size by virtqueue_get_vring_max_size() Xuan Zhuo
2022-02-14  8:14 ` [PATCH v5 22/22] virtio_net: support set_ringparam Xuan Zhuo
2022-02-16  4:14   ` Jason Wang
2022-02-16  7:21     ` Xuan Zhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8011051-dc45-85f6-3630-4ba0cf6179b2@redhat.com \
    --to=jasowang@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lingshan.zhu@intel.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).