From: Jason Wang <jasowang@redhat.com> To: Si-Wei Liu <si-wei.liu@oracle.com> Cc: mst@redhat.com, parav@nvidia.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] vdpa: fix improper error message when adding vdpa dev Date: Mon, 24 Oct 2022 16:43:15 +0800 [thread overview] Message-ID: <CACGkMEvuExLpzOEDJN_dq+t3MBDNgpnkapyk13xtWBF4nKxutg@mail.gmail.com> (raw) In-Reply-To: <1666392237-4042-5-git-send-email-si-wei.liu@oracle.com> On Sat, Oct 22, 2022 at 7:49 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > In below example, before the fix, mtu attribute is supported > by the parent mgmtdev, but the error message showing "All > provided are not supported" is just misleading. > > $ vdpa mgmtdev show > vdpasim_net: > supported_classes net > max_supported_vqs 3 > dev_features MTU MAC CTRL_VQ CTRL_MAC_ADDR ANY_LAYOUT VERSION_1 ACCESS_PLATFORM > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 mtu 5000 max_vqp 2 > Error: vdpa: All provided attributes are not supported. > kernel answers: Operation not supported > > After fix, the relevant error message will be like: > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 mtu 5000 max_vqp 2 > Error: vdpa: Some provided attributes are not supported. > kernel answers: Operation not supported > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 max_vqp 2 > Error: vdpa: All provided attributes are not supported. > kernel answers: Operation not supported > > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Acked-by: Jason Wang <jasowang@redhat.com> > --- > drivers/vdpa/vdpa.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > index bfb8f54..2638565 100644 > --- a/drivers/vdpa/vdpa.c > +++ b/drivers/vdpa/vdpa.c > @@ -629,13 +629,20 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i > err = PTR_ERR(mdev); > goto err; > } > - if ((config.mask & mdev->config_attr_mask) != config.mask) { > + if (config.mask && (config.mask & mdev->config_attr_mask) == 0) { > NL_SET_ERR_MSG_MOD(info->extack, > "All provided attributes are not supported"); > err = -EOPNOTSUPP; > goto err; > } > > + if ((config.mask & mdev->config_attr_mask) != config.mask) { > + NL_SET_ERR_MSG_MOD(info->extack, > + "Some provided attributes are not supported"); > + err = -EOPNOTSUPP; > + goto err; > + } > + > err = mdev->ops->dev_add(mdev, name, &config); > err: > up_write(&vdpa_dev_lock); > -- > 1.8.3.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: Si-Wei Liu <si-wei.liu@oracle.com> Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, mst@redhat.com Subject: Re: [PATCH v3 4/4] vdpa: fix improper error message when adding vdpa dev Date: Mon, 24 Oct 2022 16:43:15 +0800 [thread overview] Message-ID: <CACGkMEvuExLpzOEDJN_dq+t3MBDNgpnkapyk13xtWBF4nKxutg@mail.gmail.com> (raw) In-Reply-To: <1666392237-4042-5-git-send-email-si-wei.liu@oracle.com> On Sat, Oct 22, 2022 at 7:49 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > In below example, before the fix, mtu attribute is supported > by the parent mgmtdev, but the error message showing "All > provided are not supported" is just misleading. > > $ vdpa mgmtdev show > vdpasim_net: > supported_classes net > max_supported_vqs 3 > dev_features MTU MAC CTRL_VQ CTRL_MAC_ADDR ANY_LAYOUT VERSION_1 ACCESS_PLATFORM > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 mtu 5000 max_vqp 2 > Error: vdpa: All provided attributes are not supported. > kernel answers: Operation not supported > > After fix, the relevant error message will be like: > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 mtu 5000 max_vqp 2 > Error: vdpa: Some provided attributes are not supported. > kernel answers: Operation not supported > > $ vdpa dev add mgmtdev vdpasim_net name vdpasim0 max_vqp 2 > Error: vdpa: All provided attributes are not supported. > kernel answers: Operation not supported > > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Acked-by: Jason Wang <jasowang@redhat.com> > --- > drivers/vdpa/vdpa.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > index bfb8f54..2638565 100644 > --- a/drivers/vdpa/vdpa.c > +++ b/drivers/vdpa/vdpa.c > @@ -629,13 +629,20 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i > err = PTR_ERR(mdev); > goto err; > } > - if ((config.mask & mdev->config_attr_mask) != config.mask) { > + if (config.mask && (config.mask & mdev->config_attr_mask) == 0) { > NL_SET_ERR_MSG_MOD(info->extack, > "All provided attributes are not supported"); > err = -EOPNOTSUPP; > goto err; > } > > + if ((config.mask & mdev->config_attr_mask) != config.mask) { > + NL_SET_ERR_MSG_MOD(info->extack, > + "Some provided attributes are not supported"); > + err = -EOPNOTSUPP; > + goto err; > + } > + > err = mdev->ops->dev_add(mdev, name, &config); > err: > up_write(&vdpa_dev_lock); > -- > 1.8.3.1 > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-10-24 8:43 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-21 22:43 [PATCH v3 0/4] vDPA: initial config export via "vdpa dev show" Si-Wei Liu 2022-10-21 22:43 ` Si-Wei Liu 2022-10-21 22:43 ` [PATCH v3 1/4] vdpa: save vdpa_dev_set_config in struct vdpa_device Si-Wei Liu 2022-10-21 22:43 ` Si-Wei Liu 2022-10-24 8:43 ` Jason Wang 2022-10-24 8:43 ` Jason Wang 2022-10-21 22:43 ` [PATCH v3 2/4] vdpa: pass initial config to _vdpa_register_device() Si-Wei Liu 2022-10-21 22:43 ` Si-Wei Liu 2022-10-21 22:43 ` [PATCH v3 3/4] vdpa: show dev config as-is in "vdpa dev show" output Si-Wei Liu 2022-10-21 22:43 ` Si-Wei Liu 2022-10-24 8:40 ` Jason Wang 2022-10-24 8:40 ` Jason Wang 2022-10-24 19:14 ` Si-Wei Liu 2022-10-24 19:14 ` Si-Wei Liu 2022-10-25 2:24 ` Jason Wang 2022-10-25 2:24 ` Jason Wang 2022-10-26 1:10 ` Si-Wei Liu 2022-10-26 4:44 ` Jason Wang 2022-10-26 4:44 ` Jason Wang 2022-10-27 6:31 ` Si-Wei Liu 2022-10-27 6:31 ` Si-Wei Liu 2022-10-27 8:47 ` Jason Wang 2022-10-27 8:47 ` Jason Wang 2022-10-28 23:23 ` Si-Wei Liu 2022-10-28 23:23 ` Si-Wei Liu 2022-10-30 13:36 ` Eli Cohen 2022-12-19 6:31 ` Michael S. Tsirkin 2022-12-19 6:31 ` Michael S. Tsirkin 2022-12-21 0:14 ` Si-Wei Liu 2022-12-21 0:14 ` Si-Wei Liu 2022-12-20 7:58 ` Jason Wang 2022-12-20 7:58 ` Jason Wang 2022-10-21 22:43 ` [PATCH v3 4/4] vdpa: fix improper error message when adding vdpa dev Si-Wei Liu 2022-10-21 22:43 ` Si-Wei Liu 2022-10-24 8:43 ` Jason Wang [this message] 2022-10-24 8:43 ` Jason Wang 2023-01-27 8:16 ` [PATCH v3 0/4] vDPA: initial config export via "vdpa dev show" Michael S. Tsirkin 2023-01-27 8:16 ` Michael S. Tsirkin 2023-01-30 21:05 ` Si-Wei Liu 2023-01-30 21:05 ` Si-Wei Liu 2023-01-30 21:59 ` Si-Wei Liu 2023-01-30 21:59 ` Si-Wei Liu
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=CACGkMEvuExLpzOEDJN_dq+t3MBDNgpnkapyk13xtWBF4nKxutg@mail.gmail.com \ --to=jasowang@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=parav@nvidia.com \ --cc=si-wei.liu@oracle.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.