Message ID | 1666392237-4042-5-git-send-email-si-wei.liu@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp956368wrr; Fri, 21 Oct 2022 16:52:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Jru2FUU9HMUGo0R6IqX4A3jDA1aLTE8MDEa5Qt82qiaxkwwGOg8Tf5ahHY7Lt5X4AWsYv X-Received: by 2002:a17:907:7d8b:b0:78e:2534:4fd3 with SMTP id oz11-20020a1709077d8b00b0078e25344fd3mr18212360ejc.141.1666396339150; Fri, 21 Oct 2022 16:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666396339; cv=none; d=google.com; s=arc-20160816; b=e80iP84FEBeoGJ34DEHhKM87Q8DAA0QDttypUsDOcCYXxUVL383l2BwOImPgd3SYA1 DOLB8bkQM5mtaUsJUJlbQpz/Jwu7D4S1NimDPudzcMFAxxtDCOCPf+c4j8bTEH8ISOLU HxtAsVwAfoIT8WJ7AmuWBxn1P8ASN5DZFvBFsXhnEjzyz8CjnWQ7ysNWNzTT3YUn+GaL bxQs3G4Ob89rQkpZir8EUdQgG9yXvZBlWm1UVI3tGf9HIFzp1w9UyKvij3rF1YzYzsV8 OK/vEj9V45VIJMbsoVZGNkhBRsOluAbuW0Qm/dYmdcGP4nka+QoOiXIcNkwhBbDZZAa3 /j6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=FRx2Fg0cajst6kpPs94hDo0ddOOvTCD3LCs/N6K2pbQ=; b=o0O/StOE1YJEmt044CCrntfdn6ZaPUepksA/dyqDoDjqWFvbwZWSbUSGYoEQZJ4vw2 01oXHhurrsG9gxhs/hPxxzKMsKDxMoU/la2+USnF82p0MPIBiUuoU4YsWA0siYJ3dZVq TRr7PSlE7ilVW3TjCVc85QpZzdPh2UpVVGneBDbuy3LdUB2MDzPFGxIukvoWxWJEdkD+ HTUjGZuiT6FW6jBwA1xPaIrPdOnnQXbB+b0xgyIO9LAkw3xlvo0LmTMZea3Z8YGxAWqB PJooOh9WzNYrNuyyq0eKQ55uXWyCOQ1TKlEa/t1CYkYiSbkF+zIojTjJ6Cj4xlIp9JnF LAMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=zF7iufL3; 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b0078c47b4478esi19886098ejc.106.2022.10.21.16.51.55; Fri, 21 Oct 2022 16:52:19 -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=@oracle.com header.s=corp-2022-7-12 header.b=zF7iufL3; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbiJUXuL (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Fri, 21 Oct 2022 19:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbiJUXtr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Oct 2022 19:49:47 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF5732051 for <linux-kernel@vger.kernel.org>; Fri, 21 Oct 2022 16:49:45 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29LLDxSH010167; Fri, 21 Oct 2022 23:49:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2022-7-12; bh=FRx2Fg0cajst6kpPs94hDo0ddOOvTCD3LCs/N6K2pbQ=; b=zF7iufL38/zGRCwoYPbt/hbLIZw7k3PD028Na914f3vBi+UzjQ7LbC1y/Oj/mxLwLXQa ZPME/xePngSQtu0WyW+6dSkCcpiPOyGhHY39l/5TRiiW+k5XYBEwgiUaYKiUsWWHB6uC 44xHe4x+FUqH8wgr98T+QlpAWeMq1DsE3dn12waMgwsG1cFkc+L5Wayu40vmOQW8WNnm uD754CBwvUmI51XLhOiuF7fb3rEVyLjzsrImu70FqvxgFJ+rZwX1lPIeyuzoHy9dwg4W 6JBgxrbVoSdhsKsLvtoFVAIZ8t9pyWRWpReohcgvwgPTnLchUWcy3b6DpizAriCR+pAI SQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k99ntpp4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Oct 2022 23:49:41 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29LMgIQV007144; Fri, 21 Oct 2022 23:49:39 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3k8hre9a3b-5; Fri, 21 Oct 2022 23:49:39 +0000 From: Si-Wei Liu <si-wei.liu@oracle.com> To: mst@redhat.com, jasowang@redhat.com, parav@nvidia.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/4] vdpa: fix improper error message when adding vdpa dev Date: Fri, 21 Oct 2022 15:43:57 -0700 Message-Id: <1666392237-4042-5-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666392237-4042-1-git-send-email-si-wei.liu@oracle.com> References: <1666392237-4042-1-git-send-email-si-wei.liu@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-21_04,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210210139 X-Proofpoint-ORIG-GUID: RGN-ubRw9X1BKW1wArzcdeu-jrC-i3g3 X-Proofpoint-GUID: RGN-ubRw9X1BKW1wArzcdeu-jrC-i3g3 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747343207733907628?= X-GMAIL-MSGID: =?utf-8?q?1747343207733907628?= |
Series |
vDPA: initial config export via "vdpa dev show"
|
|
Commit Message
Si-Wei Liu
Oct. 21, 2022, 10:43 p.m. UTC
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>
---
drivers/vdpa/vdpa.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
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 >
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);