Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp326483rwi; Wed, 19 Oct 2022 22:17:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM423linFNOxRwRSwncmpOi5Fb7j84xDvIAy8Y2sN3p8d2LH4N9ObQEexB+nJSVd5q6PSkFh X-Received: by 2002:a05:6402:1d4a:b0:45c:98a9:7ba3 with SMTP id dz10-20020a0564021d4a00b0045c98a97ba3mr10667297edb.418.1666243074591; Wed, 19 Oct 2022 22:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666243074; cv=none; d=google.com; s=arc-20160816; b=FiLc5ZurU5rOjaTyTKttFUAj9bUzCJW+1K8rFzl76yQAWivmhBURjiSoZjenD7S8cj zFoxGA4ezsizbLWcGPp9Psu7SXuQgn8Wjrx7+ASGeB3V8sZkAZOKL7tBSGQ3twl+DH2T ZU3+IWk4A+6tSpEXz7KSE528nXB9DEG1DP8GGLw/tdXKQM1oyXR5Q2rHAy498+/N1muY p5zqap8Ig6bwjPCXxGsOmTQ7+6Wy9MrGRfP5WpI7nVd475bJtevRf/dz1JKNxF/8sdPs P35MLtNajSlQHsIbsE/FnUtwC8W7ECxuIylbxfPPym25Eh/VvTbliXA0xTjjRssA81nS s9qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Kyv8nGXj9Ah4DccAJThYdzgEzvLEuADjYtSpDgDrIrY=; b=lTT30VhMuMiIpHWSTdz8GI8H3Eh7zKog1p71vAZFeM8H5W0aoTdlAXCe62D2gmvAG4 eZWKMQnv42IIO7By3qfqyIIPZS8oUJ6UUG8AB2X5rztNzFAKB5pXexkF7yQp13ipyuGb My+/uN83wMr7ZUtoi96RGRNkS5iYOqgA0uEwFgxRWTJY0CqxWoXSeyBkia+Mrk14qNvm sEL2jHeWrmlcjHaRFB3DbqSCOiqHbfIbSCpGPhthpq+cn3zmK9wHCInq6dEuBGTeXjRG ItVrAZFC7qcF3YJjSO9HRHFlMpd3BXiFQQCnFhM81J985jKNvXOscwrscF/gptTRXN0E PSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ilkpoW9O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka14-20020a170907990e00b0078358970513si13560362ejc.367.2022.10.19.22.17.12; Wed, 19 Oct 2022 22:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ilkpoW9O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbiJTEip (ORCPT + 99 others); Thu, 20 Oct 2022 00:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbiJTEil (ORCPT ); Thu, 20 Oct 2022 00:38:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7BC5161FFD for ; Wed, 19 Oct 2022 21:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666240718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Kyv8nGXj9Ah4DccAJThYdzgEzvLEuADjYtSpDgDrIrY=; b=ilkpoW9OgrBvWHcesYY8J8Oi3kgJKhLM3r9aQcu/78Y9Z8Fr3d97pA23XDyjcT2PuQPHVS 6yd1a4+nmg2kTT5sMvXJeySBteQ02J/7QPnnLrsBPPWAsNzh5gQ4Ef/LM+KOYkK98fLHdc 0kYXVb9k/U1oSU19U3tRQ3WAkPLzEqQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-592-UG4APNjgNX2bVfojPeyamw-1; Thu, 20 Oct 2022 00:38:36 -0400 X-MC-Unique: UG4APNjgNX2bVfojPeyamw-1 Received: by mail-ed1-f72.google.com with SMTP id s8-20020a056402520800b0045cab560d5eso15477631edd.1 for ; Wed, 19 Oct 2022 21:38:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Kyv8nGXj9Ah4DccAJThYdzgEzvLEuADjYtSpDgDrIrY=; b=6gjVknf69cGEB5yVETBktraJEm6dWY50v/q0wPTYFr8zw6HZTC3Q8Gl7KMG4Ez+Xmw SF4UARC8uPkxGk8ONrCx5yV1l81sTrqRnKojSp7ojQxHitq0USqbVAzPtFHDBQd3dfCD rsECYUAq+RqZAqONQhfAXKG3BCUHYTdlZ24nH6U3PHQVWN0fceXw5cFEYCC1vqwg/Ai9 itudkrEfAZ7FrUMCR0r3SGmsoVkH+MHbwJ5XVs08bupIxmIfMFS2HOfXyvmGa1vvcAx0 3/jDT4N4/nm36j6XZf2mts6qwoJRqUScz63qF5/fgR3hkgDGt8YPQgiujfJ01w3lKMUH mNsQ== X-Gm-Message-State: ACrzQf3iTuPJujxupaosiarNJ8Y7fwJM/r6RD41/NPqtO45BJlX3ey5n D2CXnIsOcugbbttZlsL6aMv0MAPGWdbe178pXl3dg4GINxqpQkWSQx1/7wYeC8tjX9rAh0HO038 Bu/BfVHyinNeDPoTFN/btW0BHnSTEyHTqpNC3KraD X-Received: by 2002:a17:906:8a62:b0:78d:a05c:c37f with SMTP id hy2-20020a1709068a6200b0078da05cc37fmr9268197ejc.159.1666240715759; Wed, 19 Oct 2022 21:38:35 -0700 (PDT) X-Received: by 2002:a17:906:8a62:b0:78d:a05c:c37f with SMTP id hy2-20020a1709068a6200b0078da05cc37fmr9268186ejc.159.1666240715492; Wed, 19 Oct 2022 21:38:35 -0700 (PDT) MIME-Version: 1.0 References: <1666137032-28192-1-git-send-email-si-wei.liu@oracle.com> <1666137032-28192-2-git-send-email-si-wei.liu@oracle.com> In-Reply-To: <1666137032-28192-2-git-send-email-si-wei.liu@oracle.com> From: Jason Wang Date: Thu, 20 Oct 2022 12:38:22 +0800 Message-ID: Subject: Re: [PATCH v2 1/4] vdpa: save vdpa_dev_set_config in struct vdpa_device To: Si-Wei Liu Cc: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 19, 2022 at 8:56 AM Si-Wei Liu wrote: > > In order to allow live migration orchestration software to export the > initial set of vdpa attributes with which the device was created, it > will be useful if the vdpa tool can report the config on demand with > simple query. This will ease the orchestration software implementation > so that it doesn't have to keep track of vdpa config change, or have > to persist vdpa attributes across failure and recovery, in fear of > being killed due to accidental software error. > > This commit attempts to make struct vdpa_device contain the struct > vdpa_dev_set_config, where all config attributes upon vdpa creation > are carried over. Which will be used in subsequent commits. > > Signed-off-by: Si-Wei Liu > --- > include/linux/vdpa.h | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 6d0f5e4..f1838f5 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -58,6 +58,16 @@ struct vdpa_vq_state { > }; > }; > > +struct vdpa_dev_set_config { > + u64 device_features; > + struct { > + u8 mac[ETH_ALEN]; > + u16 mtu; > + u16 max_vq_pairs; > + } net; Not for this patch but I think there should be a union container for this structure to make it usable for other types of devices. > + u64 mask; > +}; > + > struct vdpa_mgmt_dev; > > /** > @@ -77,6 +87,8 @@ struct vdpa_vq_state { > * @nvqs: maximum number of supported virtqueues > * @mdev: management device pointer; caller must setup when registering device as part > * of dev_add() mgmtdev ops callback before invoking _vdpa_register_device(). > + * @vdev_cfg: initial device config on vdpa creation; useful when instantiate with > + * the exact same config is needed. Not a native speaker, but I guess it should be better named as "init_cfg"? Thanks > */ > struct vdpa_device { > struct device dev; > @@ -91,6 +103,7 @@ struct vdpa_device { > struct vdpa_mgmt_dev *mdev; > unsigned int ngroups; > unsigned int nas; > + struct vdpa_dev_set_config vdev_cfg; > }; > > /** > @@ -103,16 +116,6 @@ struct vdpa_iova_range { > u64 last; > }; > > -struct vdpa_dev_set_config { > - u64 device_features; > - struct { > - u8 mac[ETH_ALEN]; > - u16 mtu; > - u16 max_vq_pairs; > - } net; > - u64 mask; > -}; > - > /** > * Corresponding file area for device memory mapping > * @file: vma->vm_file for the mapping > -- > 1.8.3.1 >