From patchwork Mon Jan 30 20:30:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Si-Wei Liu X-Patchwork-Id: 50500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2409996wrn; Mon, 30 Jan 2023 13:42:42 -0800 (PST) X-Google-Smtp-Source: AK7set9DQe9xX3QyOY33OfqAaEUEeY86InX+k42wfTeEy3IGX3oFtc/KQUE/7K7z3H9Tkcx5ZjmO X-Received: by 2002:a05:6402:360c:b0:4a0:c3f7:69c3 with SMTP id el12-20020a056402360c00b004a0c3f769c3mr20341184edb.29.1675114962077; Mon, 30 Jan 2023 13:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675114962; cv=none; d=google.com; s=arc-20160816; b=ksC7D2gMqSD/aOV2YwlEO+wCKmmUfb/OyHMZl7gIkOFGNP+CjAZwuVEwI/JYQTNh/f FkVc40TX2KNLtB61cQ+hePrBNz19kbHfSSefZ6QJ8sSJ2+MkKfv0FH61iQPgOJQJvZnl DDKAY/V0VJnl4FIMEeyOpynjhZ0XiRUrbkV2aBkOsEAoGsGQVf3G9cjdH6CipkOmzL2F z46L4mgFRBY8VSp7za3nGIGaNOQFTMKyYYC2okzvM9E9ExnuB1bEmCOV1QoTfVwnCewO e4mWBaaCfmIq/vaSOlxKind9oA4/UxeA55LKrEJKortndJPuvsUZfDlw5YUtvnMPbDN9 STqw== 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=r0Xf7HwYTIa5HdBeaweSNt2PODdB5AMoLanWqL4vsmE=; b=lhju0h1EUcbyeuEdq4L/s7NYTb+ohRxWDG90UlxolsRZT5jZyFR/WDGmKFxEXV+25K ZoHlNmwx920VwRHIjKt52H3r0m2m3RYM/2E3lnDff1pntITnEkmwkj1vYBru46ZrDufU 7WQxhQlQbf/J+pdlMKW4DcExdMHwrngKOqZEXMp+WkTM/tks4hYcQAO2q3ubGvBaXYDL fjkkz6+VPyOnwOxUP2M5qdrMm6iy96JtbodWwblzHYvyo5jPbha0/9kYnYt3TxT6dO0d o0NewKxf7nMHUVLYPDI2F422hfe9g6VSainwAt8SJXSzSlIn0ztNvBIpPsZVgCI3s1tP udsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Fc5Uuejz; 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 j6-20020a170906534600b008775fc70980si15433819ejo.776.2023.01.30.13.42.18; Mon, 30 Jan 2023 13:42:42 -0800 (PST) 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=Fc5Uuejz; 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 S231287AbjA3Vhc (ORCPT + 99 others); Mon, 30 Jan 2023 16:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjA3Vh1 (ORCPT ); Mon, 30 Jan 2023 16:37:27 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82A54684 for ; Mon, 30 Jan 2023 13:37:25 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30UL4C0q002941; Mon, 30 Jan 2023 21:37:20 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=r0Xf7HwYTIa5HdBeaweSNt2PODdB5AMoLanWqL4vsmE=; b=Fc5UuejzyKX1eulxJRQ7C9Wis7E4mq8OmR8nQDUIh42m7yiEt9nOqtpW4qAVELT1TuF8 gpJ9ybT/1+4L+33e+aI3S2l+pISkzP0PCaW0DANsHTV4ZxcnJ2y2u3k8NPcRQdaofSdp Qpku9cZvN3lCH0pBK2OA+IFyROasPpGCGbHEN7Y2aT03jpCZILqJctgPVX8jg5yXAkom vEFdu/XDALyxrTPhmRsP+u/NScWSUHUynzTYY5zvr2fGIz8RbrBH0Hw/JvxVY9yhJnSP 1hNAQroFMNlezqQbwQdEZW+/2g0xfDUvVF4hwStVXG3jCvSUBtKMTKlzCrxGWorAADvd Nw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ncvr8m3mt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Jan 2023 21:37:20 +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 30UK8hpx031798; Mon, 30 Jan 2023 21:37:20 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 3nct54qa7f-2; Mon, 30 Jan 2023 21:37:19 +0000 From: Si-Wei Liu To: mst@redhat.com, jasowang@redhat.com, parav@nvidia.com, elic@nvidia.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] vdpa: fix improper error message when adding vdpa dev Date: Mon, 30 Jan 2023 12:30:38 -0800 Message-Id: <1675110643-28143-2-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675110643-28143-1-git-send-email-si-wei.liu@oracle.com> References: <1675110643-28143-1-git-send-email-si-wei.liu@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-30_17,2023-01-30_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301300200 X-Proofpoint-GUID: tIB-dZhbioWU-kwptlMYpbIIVMNWrE4D X-Proofpoint-ORIG-GUID: tIB-dZhbioWU-kwptlMYpbIIVMNWrE4D 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756485346788013239?= X-GMAIL-MSGID: =?utf-8?q?1756485346788013239?= 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 Acked-by: Jason Wang --- 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 8ef7aa1..5e57935 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -622,13 +622,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);