virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Parav Pandit <parav@nvidia.com>
To: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Eli Cohen <elic@nvidia.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: RE: [PATCH linux-next v3 6/6] vdpa_sim_net: Add support for user supported devices
Date: Thu, 14 Jan 2021 07:58:08 +0000	[thread overview]
Message-ID: <BY5PR12MB43225D83EA46004E3AF50D3ADCA80@BY5PR12MB4322.namprd12.prod.outlook.com> (raw)
In-Reply-To: <66dc44ac-52da-eaba-3f5e-69254e42d75b@redhat.com>



> From: Jason Wang <jasowang@redhat.com>
> Sent: Thursday, January 14, 2021 9:48 AM
> 
> On 2021/1/7 上午11:48, Parav Pandit wrote:
> >
> >> From: Michael S. Tsirkin <mst@redhat.com>
> >> Sent: Tuesday, January 5, 2021 6:53 PM
> >>
> >> On Tue, Jan 05, 2021 at 12:30:15PM +0000, Parav Pandit wrote:
> >>>
> >>>> From: Michael S. Tsirkin <mst@redhat.com>
> >>>> Sent: Tuesday, January 5, 2021 5:45 PM
> >>>>
> >>>> On Tue, Jan 05, 2021 at 12:02:33PM +0000, Parav Pandit wrote:
> >>>>>
> >>>>>> From: Michael S. Tsirkin <mst@redhat.com>
> >>>>>> Sent: Tuesday, January 5, 2021 5:19 PM
> >>>>>>
> >>>>>> On Tue, Jan 05, 2021 at 12:32:03PM +0200, Parav Pandit wrote:
> >>>>>>> Enable user to create vdpasim net simulate devices.
> >>>>>>>
> >>>>>>>
> >>>>>>> $ vdpa dev add mgmtdev vdpasim_net name foo2
> >>>>>>>
> >>>>>>> Show the newly created vdpa device by its name:
> >>>>>>> $ vdpa dev show foo2
> >>>>>>> foo2: type network mgmtdev vdpasim_net vendor_id 0 max_vqs 2
> >>>>>>> max_vq_size 256
> >>>>>>>
> >>>>>>> $ vdpa dev show foo2 -jp
> >>>>>>> {
> >>>>>>>      "dev": {
> >>>>>>>          "foo2": {
> >>>>>>>              "type": "network",
> >>>>>>>              "mgmtdev": "vdpasim_net",
> >>>>>>>              "vendor_id": 0,
> >>>>>>>              "max_vqs": 2,
> >>>>>>>              "max_vq_size": 256
> >>>>>>>          }
> >>>>>>>      }
> >>>>>>> }
> >>>>>>
> >>>>>> I'd like an example of how do device specific (e.g. net
> >>>>>> specific) interfaces tie in to this.
> >>>>> Not sure I follow your question.
> >>>>> Do you mean how to set mac address or mtu of this vdpa device of
> >>>>> type
> >>>> net?
> >>>>> If so, dev add command will be extended shortly in subsequent
> >>>>> series to
> >>>> set this net specific attributes.
> >>>>> (I did mention in the next steps in cover letter).
> >>>>>
> >>>>>>> +static int __init vdpasim_net_init(void) {
> >>>>>>> +	int ret;
> >>>>>>> +
> >>>>>>> +	if (macaddr) {
> >>>>>>> +		mac_pton(macaddr, macaddr_buf);
> >>>>>>> +		if (!is_valid_ether_addr(macaddr_buf))
> >>>>>>> +			return -EADDRNOTAVAIL;
> >>>>>>> +	} else {
> >>>>>>> +		eth_random_addr(macaddr_buf);
> >>>>>>>   	}
> >>>>>> Hmm so all devices start out with the same MAC until changed?
> >>>>>> And how is the change effected?
> >>>>> Post this patchset and post we have iproute2 vdpa in the tree,
> >>>>> will add the
> >>>> mac address as the input attribute during "vdpa dev add" command.
> >>>>> So that each different vdpa device can have user specified
> >>>>> (different) mac
> >>>> address.
> >>>>
> >>>> For now maybe just avoid VIRTIO_NET_F_MAC then for new devices
> >> then?
> >>> That would require book keeping existing net vdpa_sim devices
> >>> created to
> >> avoid setting VIRTIO_NET_F_MAC.
> >>> Such book keeping code will be short lived anyway.
> >>> Not sure if its worth it.
> >>> Until now only one device was created. So not sure two vdpa devices
> >>> with
> >> same mac address will be a real issue.
> >>> When we add mac address attribute in add command, at that point also
> >> remove the module parameter macaddr.
> >>
> >> Will that be mandatory? I'm not to happy with a UAPI we intend to
> >> break straight away ...
> > No. Specifying mac address shouldn't be mandatory. UAPI wont' be
> broken.
> 
> 
> If it's not mandatory. Does it mean the vDPA parent need to use its own logic
> to generate a validate mac? I'm not sure this is what management (libvirt
> want).
> 
There are few use cases that I see with PFs, VFs and SFs supporting vdpa devices.

1. User wants to use the VF only for vdpa purpose. Here user got the VF which was pre-setup by the sysadmin.
In this case whatever MAC assigned to the VF can be used by its vdpa device.
Here, user doesn't need to pass the mac address during vdpa device creation time.
This is done as the same MAC has been setup in the ACL rules on the switch side.
Non VDPA users of a VF typically use the VF this way for Netdev and rdma functionality.
They might continue same way for vdpa application as well.
Here VF mac is either set using 
(a) devlink port function set hw_addr command or using 
(b) ip link set vf mac 
So vdpa tool didn't pass the mac. (optional).
Though VIRTIO_NET_F_MAC is still valid.

2. User may want to create one or more vdpa device out of the mgmt. device.
Here user wants to more/full control of all features, overriding what sysadmin has setup as MAC of the VF/SF.
In this case user will specify the MAC via mgmt tool.
(a) This is also used by those vdpa devices which doesn't have eswitch offloads.
(b) This will work with eswitch offloads as well who does source learning.
(c) User chose to use the vdpa device of a VF while VF Netdev and rdma device are used by hypervisor for something else as well.
VIRTIO_NET_F_MAC remains valid in all 2.{a,b,c}.

3. A  vendor mgmt. device always expects it user to provide mac for its vdpa devices.
So when it is not provided, it can fail with error message string in extack or clear the VIRTIO_NET_F_MAC and let it work using virtio spec's 5.1.5 point 5 to proceed.

As common denominator of all above cases, if QEMU or user pass the MAC during creation, it will almost always work.
Advance user and QEMU with switchdev mode support who has done 1.a/1.b, will omit it.
I do not know how deep integration of QEMU exist with the switchdev mode support.

With that mac, mtu as optional input fields provide the necessary flexibility for different stacks to take appropriate shape as they desire.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-01-14  7:58 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  6:39 [PATCH 0/7] Introduce vdpa management tool Parav Pandit
2020-11-12  6:39 ` [PATCH 1/7] vdpa: Add missing comment for virtqueue count Parav Pandit
2020-11-12  6:40 ` [PATCH 2/7] vdpa: Use simpler version of ida allocation Parav Pandit
2020-11-12  6:40 ` [PATCH 3/7] vdpa: Extend routine to accept vdpa device name Parav Pandit
2020-11-12  6:40 ` [PATCH 4/7] vdpa: Define vdpa parent device, ops and a netlink interface Parav Pandit
2020-11-12  6:40 ` [PATCH 5/7] vdpa: Enable a user to add and delete a vdpa device Parav Pandit
2020-11-12  6:40 ` [PATCH 6/7] vdpa: Enable user to query vdpa device info Parav Pandit
2020-11-12  6:40 ` [PATCH 7/7] vdpa/vdpa_sim: Enable user to create vdpasim net devices Parav Pandit
2020-11-16  9:41 ` [PATCH 0/7] Introduce vdpa management tool Stefan Hajnoczi
2020-11-17 19:41   ` Parav Pandit
     [not found] ` <20201116142312.661786bb@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-17 19:51   ` Parav Pandit
2020-12-16  9:13     ` Michael S. Tsirkin
     [not found]       ` <20201216080610.08541f44@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-12-16 16:54         ` Parav Pandit
2020-12-16 19:57           ` Michael S. Tsirkin
2020-12-17 12:13             ` Parav Pandit
2020-11-27  3:53 ` Jason Wang
     [not found]   ` <CACycT3sYScObb9nN3g7L3cesjE7sCZWxZ5_5R1usGU9ePZEeqA@mail.gmail.com>
2020-11-30  3:36     ` [External] " Jason Wang
     [not found]       ` <CACycT3votu2eyacKg+w12xZ_ujEOgTY0f8A7qcpbM-fwTpjqAw@mail.gmail.com>
2020-12-01  6:25         ` Jason Wang
     [not found]           ` <CACycT3uw6KJgTo+dBzSj07p2P_PziD+WBfX4yWVX-nDNUD2M3A@mail.gmail.com>
2020-12-01 11:32             ` Parav Pandit
     [not found]               ` <CACycT3tTCmEzY37E5196Q2mqME2v+KpAp7Snn8wK4XtRKHEqEw@mail.gmail.com>
2020-12-01 15:58                 ` Parav Pandit
     [not found]                   ` <CACycT3vNXvNVUP+oqzv-MMgtzneeeZUoMaDVtEws7VizH0V+mA@mail.gmail.com>
2020-12-02  4:53                     ` Parav Pandit
2020-12-02  5:51                       ` Jason Wang
2020-12-02  6:24                         ` Parav Pandit
2020-12-02  7:55                           ` Jason Wang
     [not found]                       ` <CACycT3uV8e61kVF6Q8zE5VVK_Okp03e=WNRcUffdkFeeFpfKDQ@mail.gmail.com>
2020-12-02 11:13                         ` Parav Pandit
2020-12-02  5:48             ` Jason Wang
2020-12-08 22:47   ` David Ahern
2021-01-19  4:21     ` Parav Pandit
2020-12-16  9:16 ` Michael S. Tsirkin
2021-01-04  3:31 ` [PATCH linux-next v2 " Parav Pandit
2021-01-04  3:31   ` [PATCH linux-next v2 1/7] vdpa_sim_net: Make mac address array static Parav Pandit
2021-01-04  7:00     ` Jason Wang
2021-01-04  3:31   ` [PATCH linux-next v2 2/7] vdpa_sim_net: Add module param to disable default vdpa net device Parav Pandit
2021-01-04  3:31   ` [PATCH linux-next v2 3/7] vdpa: Extend routine to accept vdpa device name Parav Pandit
2021-01-04  3:31   ` [PATCH linux-next v2 4/7] vdpa: Define vdpa mgmt device, ops and a netlink interface Parav Pandit
2021-01-04  7:03     ` Jason Wang
2021-01-04  7:24       ` Parav Pandit
2021-01-05  4:10         ` Jason Wang
2021-01-05  6:33           ` Parav Pandit
2021-01-05  8:36             ` Jason Wang
2021-01-04  3:31   ` [PATCH linux-next v2 5/7] vdpa: Enable a user to add and delete a vdpa device Parav Pandit
2021-01-04  3:31   ` [PATCH linux-next v2 6/7] vdpa: Enable user to query vdpa device info Parav Pandit
2021-01-04  3:31   ` [PATCH linux-next v2 7/7] vdpa_sim_net: Add support for user supported devices Parav Pandit
2021-01-04  7:05     ` Jason Wang
2021-01-04  7:21       ` Parav Pandit
2021-01-05  4:06         ` Jason Wang
2021-01-05  6:22           ` Parav Pandit
2021-01-05 10:31 ` [PATCH linux-next v3 0/6] Introduce vdpa management tool Parav Pandit
2021-01-05 10:31   ` [PATCH linux-next v3 1/6] vdpa_sim_net: Make mac address array static Parav Pandit
2021-01-07 13:45     ` Stefano Garzarella
2021-01-05 10:31   ` [PATCH linux-next v3 2/6] vdpa: Extend routine to accept vdpa device name Parav Pandit
2021-01-05 10:32   ` [PATCH linux-next v3 3/6] vdpa: Define vdpa mgmt device, ops and a netlink interface Parav Pandit
2021-01-05 10:32   ` [PATCH linux-next v3 4/6] vdpa: Enable a user to add and delete a vdpa device Parav Pandit
2021-01-05 10:32   ` [PATCH linux-next v3 5/6] vdpa: Enable user to query vdpa device info Parav Pandit
2021-01-05 10:32   ` [PATCH linux-next v3 6/6] vdpa_sim_net: Add support for user supported devices Parav Pandit
2021-01-05 11:48     ` Michael S. Tsirkin
2021-01-05 12:02       ` Parav Pandit
2021-01-05 12:14         ` Michael S. Tsirkin
2021-01-05 12:30           ` Parav Pandit
2021-01-05 13:23             ` Michael S. Tsirkin
2021-01-07  3:48               ` Parav Pandit
2021-01-12  4:14                 ` Parav Pandit
2021-01-14  4:17                 ` Jason Wang
2021-01-14  7:58                   ` Parav Pandit [this message]
2021-01-15  5:38                     ` Jason Wang
2021-01-15  6:27                       ` Parav Pandit
2021-01-19 11:09                         ` Jason Wang
2021-01-20  3:21                           ` Parav Pandit
2021-01-20  3:46                             ` Parav Pandit
2021-01-18 18:03                       ` Parav Pandit
2021-01-20  7:53                         ` Michael S. Tsirkin

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=BY5PR12MB43225D83EA46004E3AF50D3ADCA80@BY5PR12MB4322.namprd12.prod.outlook.com \
    --to=parav@nvidia.com \
    --cc=elic@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).