Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1410101rwi; Fri, 14 Oct 2022 18:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Iug9Stu6ItxeMUIfF5sfUISOZaWV27iN3Vsh8tQZatkWaxAa9AedZFYq8scI3+ZdRqRB/ X-Received: by 2002:a17:906:db07:b0:77b:82cf:54af with SMTP id xj7-20020a170906db0700b0077b82cf54afmr563642ejb.666.1665798335145; Fri, 14 Oct 2022 18:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665798335; cv=none; d=google.com; s=arc-20160816; b=CwGMa+SdAFXIeLfD/Uf7tVeE6gKtnc9MiLbI37CBBaItKtYCTrALo8bz7n8PVriWDP KKIdh4ouhXsmR8ZDra/gzdEQawqDGP1QwhU/VreNPgSqJf4lKswFOFJKTHgGsq7TDrvU iUHJOE0hZd6Cs0QNr1D3un4NTYN3GHJlIvn/T5pynZYKoQe4/qB4SxqdgiFcpngtWWOz B7inzL4KWYRfjDSJ+QWbBYdlwcP8Qpo4nJbiiYhBMpy6wriBEyQUf9FFy8MGSxRv1ALG U6x20iHJj2yOqoxbKcZWHvYw7QVKWfFmqKIwDhBXi9uiLl9qk6J7/dFDXIG3PFqCqhrW cLSw== 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=9ktHFLbxiHPNJk8/uwRXopWzYH45YEFFBA2qhx+h77s=; b=ScF45MpvpQ5LxZieMsR0C1pkkT8iFA9Se6BjlkzDy3hJt6jIMKCCy3H2B8db3TpSyR D6LX9dvIaWuYCQhkg0leXt5dtPUr1JLO1CDxSyXwjAb11ZKzZxp0Y0uTGOsK/Jl8l9oM WGgsDzYXTPzsYl4hHyVpjLwKIrxx0ZaE7yIWzQPvPwBvtWzBlHEret5zB7SnhVxmOzWI 57dfDVPzIx61RdYZj7/NM9RYCrOtcV+jCu5nH3CQkFHXuiMB8Tz0Br4zQRkHhQykOfOa hdtcc+EHw0bmNs9AaLhKeoF7QdkYyZRZprG0nfHkomr6XkM9rVcSMZOQhU4bHL2qBQ2q 2+ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=1m9moB44; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vl2-20020a170907b60200b0073083c63edcsi2770084ejc.306.2022.10.14.18.45.08; Fri, 14 Oct 2022 18:45:35 -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=1m9moB44; 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 S229651AbiJOBeK (ORCPT + 99 others); Fri, 14 Oct 2022 21:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbiJOBd5 (ORCPT ); Fri, 14 Oct 2022 21:33:57 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E79F6C946 for ; Fri, 14 Oct 2022 18:33:55 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29F0pCq1025287; Sat, 15 Oct 2022 01:33:51 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=9ktHFLbxiHPNJk8/uwRXopWzYH45YEFFBA2qhx+h77s=; b=1m9moB4422aQ164SIfPyuWnegpRz2XJHvejcaSNzAu+8os4lbQYlKIwZXLwQ5iMLBwMM g+qqzvZBlED0wAb4d1jmtfmRoJ1vlGTUzfYPNUmPVabsVvYUggjQNOjSA9K8mVlxqrNI KcyWgVbP/UeH2PcP3t/ulD2QNPZ3ft63mWmgS8my/wHV6qtiTSjjT0/yWKSKxkF3J+px 91iLgoKhFFXeUoscOvdCFOeKySCYFUdb7hjJhJAmjL3vQOSBbQVLU47MAKYuipOhYOtQ 1PM4NauP5Gg9wpBk5R9qhXKQWDdbsc+UmMVxb5nXv7W3HSlYqM4BA6Wf85ESlt9HceCi cQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k79sg17d0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 15 Oct 2022 01:33:51 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29F1X47A008564; Sat, 15 Oct 2022 01:33:50 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3k7ka180am-5; Sat, 15 Oct 2022 01:33:50 +0000 From: Si-Wei Liu To: mst@redhat.com, jasowang@redhat.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] vdpa: fix improper error message when adding vdpa dev Date: Fri, 14 Oct 2022 17:28:10 -0700 Message-Id: <1665793690-28120-5-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1665793690-28120-1-git-send-email-si-wei.liu@oracle.com> References: <1665793690-28120-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-14_13,2022-10-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210150007 X-Proofpoint-GUID: EdPlJR4y-Udb6aZ_Vf42AaiPUyLPzCvj X-Proofpoint-ORIG-GUID: EdPlJR4y-Udb6aZ_Vf42AaiPUyLPzCvj 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 91eca6d..ff15e0a 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