Michael S. Tsirkin
2021-Oct-22 10:41 UTC
[PATCH linux-next v4 0/8] vdpa: enable user to set mac, mtu
On Thu, Oct 21, 2021 at 07:35:01PM +0300, Parav Pandit wrote:> Currently user cannot view the vdpa device config space. Also user > cannot set the mac address and mtu of the vdpa device. > This patchset enables users to set the mac address and mtu of the vdpa > device once the device is created. > If a vendor driver supports such configuration user can set it otherwise > user gets unsupported error. > > vdpa mac address and mtu are device configuration layout fields. > To keep interface generic enough for multiple types of vdpa devices, mac > address and mtu setting is implemented as configuration layout fields.So I got lots of "sha1 is lacking or useless" warnings with this. I did my best to merge but please check out the result in linux-next.> An example of query & set of config layout fields for vdpa_sim_net > driver: > > Configuration layout fields are set when a vdpa device is created. > > $ vdpa mgmtdev show > vdpasim_net: > supported_classes net > pci/0000:08:00.2: > supported_classes net > > Add the device with MAC and MTU: > $ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:66 mtu 1500 > > In above command only mac address or only mtu can also be set. > > View the config after setting: > $ vdpa dev config show > bar: mac 00:11:22:33:44:66 link up link_announce false mtu 1500 > > Patch summary: > Patch-1 introduced and use helpers for get/set config area > Patch-2 implement query device config layout > Patch-3 use kernel coding style for structure comment > Patch-4 enanble user to set mac and mtu in config space > Patch-5 vdpa_sim_net implements get and set of config layout > Patch-6 mlx vdpa driver fix to avoid clearing VIRTIO_NET_F_MAC during > reset callback > Patch-7 mlx5 vdpa driver supports user provided mac config > Patch-8 mlx5 vdpa driver uses user provided mac during rx flow steering > > changelog: > v3->v4: > - enable setting mac and mtu of the vdpa device using creation time > - introduced a patch to fix mlx5 driver to avoid clearing > VIRTIO_NET_F_MAC > - introduced a patch to use kernel coding style for structure comment > - removed config attributes not used by sim and mlx5 net drivers > v2->v3: > - dropped patches which are merged > - simplified code to handle non transitional devices > > v1->v2: > - new patches to fix kdoc comment to add new kdoc section > - new patch to have synchronized access to features and config space > - read whole net config layout instead of individual fields > - added error extack for unmanaged vdpa device > - fixed several endianness issues > - introduced vdpa device ops for get config which is synchronized > with other get/set features ops and config ops > - fixed mtu range checking for max > - using NLA_POLICY_ETH_ADDR > - set config moved to device ops instead of mgmtdev ops > - merged build and set to single routine > - ensuring that user has NET_ADMIN capability for configuring network > attributes > - using updated interface and callbacks for get/set config > - following new api for config get/set for mgmt tool in mlx5 vdpa > driver > - fixes for accessing right SF dma device and bar address > - fix for mtu calculation > - fix for bit access in features > - fix for index restore with suspend/resume operation > > > Eli Cohen (2): > vdpa/mlx5: Support configuration of MAC > vdpa/mlx5: Forward only packets with allowed MAC address > > Parav Pandit (6): > vdpa: Introduce and use vdpa device get, set config helpers > vdpa: Introduce query of device config layout > vdpa: Use kernel coding style for structure comments > vdpa: Enable user to set mac and mtu of vdpa device > vdpa_sim_net: Enable user to set mac address and mtu > vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit > > drivers/vdpa/ifcvf/ifcvf_main.c | 3 +- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 92 +++++++--- > drivers/vdpa/vdpa.c | 243 ++++++++++++++++++++++++++- > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 3 +- > drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 38 +++-- > drivers/vdpa/vdpa_user/vduse_dev.c | 3 +- > drivers/vhost/vdpa.c | 3 +- > include/linux/vdpa.h | 47 ++++-- > include/uapi/linux/vdpa.h | 6 + > 9 files changed, 375 insertions(+), 63 deletions(-) > > -- > 2.25.4
Parav Pandit
2021-Oct-22 15:07 UTC
[PATCH linux-next v4 0/8] vdpa: enable user to set mac, mtu
Hi Michael,> From: Michael S. Tsirkin <mst at redhat.com> > Sent: Friday, October 22, 2021 4:11 PM > > On Thu, Oct 21, 2021 at 07:35:01PM +0300, Parav Pandit wrote: > > Currently user cannot view the vdpa device config space. Also user > > cannot set the mac address and mtu of the vdpa device. > > This patchset enables users to set the mac address and mtu of the vdpa > > device once the device is created. > > If a vendor driver supports such configuration user can set it > > otherwise user gets unsupported error. > > > > vdpa mac address and mtu are device configuration layout fields. > > To keep interface generic enough for multiple types of vdpa devices, > > mac address and mtu setting is implemented as configuration layout fields. > > > So I got lots of "sha1 is lacking or useless" warnings with this. > I did my best to merge but please check out the result in linux-next. >I was able to test vdpasim_net on one system with rebase code with these patches. On 2nd system I started verifying mlx5 vdpa. System has mlx5 vdpa and virtio blk devices. After rebase, I hit the below crash at system boot time on virtio blk device. I have some internal issues in accessing crashed system, unable to proceed to verify it. However, the crash doesn't seems to occur due to this patches, as its happening on virtio blk dev (non vdpa based blk dev). [ 1.238098] virtio_blk virtio0: [vda] 73400320 512-byte logical blocks (37.6 GB/35.0 GiB) [ 1.240177] BUG: unable to handle page fault for address: 00000000fffedbeb [ 1.240973] #PF: supervisor write access in kernel mode [ 1.241590] #PF: error_code(0x0002) - not-present page [ 1.242202] PGD 0 P4D 0 [ 1.242559] Oops: 0002 [#1] SMP NOPTI [ 1.243023] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc6-vdpa-mac+ #7 [ 1.243559] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 1.243559] RIP: 0010:virtqueue_add_sgs+0x9e2/0xe50 [ 1.243559] Code: 0e 41 89 4d 40 49 8b 4d 78 48 89 1c 11 48 8b 5c 24 08 49 8b 4d 78 48 89 5c 11 08 49 8b 95 b0 00 00 00 48 85 d2 74 06 8b 1c 24 <89> 1c 82 41 8b 45 50 0f b7 5c 24 10 49 8b 55 60 83 e8 01 66 41 23 [ 1.243559] RSP: 0000:ffff88810092b5a8 EFLAGS: 00010006 [ 1.243559] RAX: 0000000000000000 RBX: 0000000000001001 RCX: ffff888104f91000 [ 1.243559] RDX: 00000000fffedbeb RSI: 0000000000000000 RDI: 0000000000000004 [ 1.243559] RBP: 0000000000000003 R08: 0000000000000004 R09: ffffffff8289920c [ 1.243559] R10: 0000000000000003 R11: 0000000000000001 R12: 0000000000000030 [ 1.243559] R13: ffff88810547ef00 R14: 0000000000000001 R15: 0000000000000000 [ 1.243559] FS: 0000000000000000(0000) GS:ffff88846fa00000(0000) knlGS:0000000000000000 [ 1.243559] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.243559] CR2: 00000000fffedbeb CR3: 0000000002612001 CR4: 0000000000370eb0 [ 1.243559] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1.243559] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1.243559] Call Trace: [ 1.243559] virtio_queue_rq+0x1e4/0x5f0 [ 1.243559] __blk_mq_try_issue_directly+0x138/0x1e0 [ 1.243559] blk_mq_try_issue_directly+0x47/0xa0 [ 1.243559] blk_mq_submit_bio+0x5af/0x890 [ 1.243559] __submit_bio+0x2af/0x2e0 [ 1.243559] ? create_page_buffers+0x55/0x70 [ 1.243559] submit_bio_noacct+0x26c/0x2d0 [ 1.243559] submit_bh_wbc.isra.0+0x122/0x150 [ 1.243559] block_read_full_page+0x2f7/0x3f0 [ 1.243559] ? blkdev_direct_IO+0x4b0/0x4b0 [ 1.243559] ? lru_cache_add+0xcf/0x150 [ 1.243559] do_read_cache_page+0x4f2/0x6a0 [ 1.243559] ? lockdep_hardirqs_on_prepare+0xe4/0x190 [ 1.243559] read_part_sector+0x39/0xd0 [ 1.243559] read_lba+0xca/0x140 [ 1.243559] efi_partition+0xe6/0x770 [ 1.243559] ? snprintf+0x49/0x60 [ 1.243559] ? is_gpt_valid.part.0+0x420/0x420 [ 1.243559] bdev_disk_changed+0x21c/0x4a0 [ 1.243559] blkdev_get_whole+0x76/0x90 [ 1.243559] blkdev_get_by_dev+0xd4/0x2c0 [ 1.243559] device_add_disk+0x351/0x390 [ 1.243559] virtblk_probe+0x804/0xa40 [ 1.243559] ? ncpus_cmp_func+0x10/0x10 [ 1.243559] virtio_dev_probe+0x155/0x250 [ 1.243559] really_probe+0xdb/0x3b0 [ 1.243559] __driver_probe_device+0x8c/0x180 [ 1.243559] driver_probe_device+0x1e/0xa0 [ 1.243559] __driver_attach+0xaa/0x160 [ 1.243559] ? __device_attach_driver+0x110/0x110 [ 1.243559] ? __device_attach_driver+0x110/0x110 [ 1.243559] bus_for_each_dev+0x7a/0xc0 [ 1.243559] bus_add_driver+0x198/0x200 [ 1.243559] driver_register+0x6c/0xc0 [ 1.243559] ? loop_init+0x149/0x149 [ 1.243559] init+0x52/0x7d [ 1.243559] do_one_initcall+0x63/0x300 [ 1.243559] ? rcu_read_lock_sched_held+0x5d/0x90 [ 1.243559] kernel_init_freeable+0x26a/0x2b2 [ 1.243559] ? rest_init+0x2e0/0x2e0 [ 1.243559] kernel_init+0x17/0x130 [ 1.243559] ? rest_init+0x2e0/0x2e0 [ 1.243559] ret_from_fork+0x1f/0x30 [ 1.243559] Modules linked in: [ 1.243559] CR2: 00000000fffedbeb