From patchwork Mon Feb 6 23:07:55 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: 53546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2514390wrn; Mon, 6 Feb 2023 15:10:24 -0800 (PST) X-Google-Smtp-Source: AK7set/2TvpkAC+sY2wy77ARc1DrTHuj4p2t1zsu1fWQOpAlhOU92MBttfib2z4xCrhUcE5YErCW X-Received: by 2002:a05:6a20:1444:b0:bc:ec65:a73f with SMTP id a4-20020a056a20144400b000bcec65a73fmr1103156pzi.58.1675725024029; Mon, 06 Feb 2023 15:10:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675725024; cv=none; d=google.com; s=arc-20160816; b=AUkp7OKVPlhyrwPIpg0U5H+gWvAEk9tr1LKgVLnF5l6pUWvHzrAnfiL2DUntip8DOc hdYVSh1LOvfkzB0PmbafTS/KFTkDlV9mTitjbQ4QNVXjDSD8COqA+ctu6/jDi8d2Q6Lx sSM7hzdi6+mJUaImsSXr1frfzADkeYRZYjG9mwB7T61CbAhhAzaMFCH//LEMEji0s4aM 1WYKkDdzwvWiZCY/gZcyyDj9zFv+J1HwJ0UgKLVCQFqboKxiKulqgnmYYYcU5Xv+oMvx Mc9/Ni6wlw7A+tSofbMyNkImWjJIDIaUJ7mT8upg/d/2De1yzG8aBdJyiF353lbGIPOi ckzw== 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=j/lEJg/ReXobH4hd+iLRobue9kWLN1CWVWeI2l8aOjc=; b=tuNvVHwc3+Dm80SEhxuy+f0EmMpFr/j+KqRE+d6N+2YRkyGWKG33KaceUReJJ/zWkr pqwIRZOgJ7EwLQpVBnwQEjfcy4WCTzysUznr6CeWVe8PFjJodtBIogR/AnLyzLywQDXu m6R5VZmtEtABc50tn8Z793MsWzGJwAVTqSRSUa+uQwNlaZB8Xw72il/pSVIkxD88QtZC v4XDE0zAuZgU+nFspe2JEha/cqz2EQTqMshOx0oUzhhrSj0F+Et/P93ugdLtNDU7I3Nh d11uWLhAxP61M+2qsGtb2N5PDbVdtN+SCzML0t5+wVFlOiFv25tCLeLRthQKBKCzdzIF D9gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=qwwhdXQd; 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 e13-20020a62aa0d000000b005906af305c5si13058051pff.39.2023.02.06.15.10.09; Mon, 06 Feb 2023 15:10:24 -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=qwwhdXQd; 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 S230321AbjBFXJA (ORCPT + 99 others); Mon, 6 Feb 2023 18:09:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjBFXIs (ORCPT ); Mon, 6 Feb 2023 18:08:48 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AC832E4C for ; Mon, 6 Feb 2023 15:08: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 316KECEt024746; Mon, 6 Feb 2023 23:08:21 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=j/lEJg/ReXobH4hd+iLRobue9kWLN1CWVWeI2l8aOjc=; b=qwwhdXQdZXD7FMgnNscW+P863qCVCOh6tvRjiV04MQPunqc9lj5Jhx9v0NO1nRcuMobU hWqi3wN+fEBca8diO/AofPibovmbC7EZQGsI6JPJudatoILZHMXSmYkIrjCjEI9i4DQl 94t1c9+qeLB0G87hiKd+GHDRVue5X/ByGnMvpD4Eh/fhIIwGtbo3I5p2jz6ndQPO+7fU 8IiNKiFCpRYHGP7VMJjaEv1477sfeAaySkYhmJociEKFHsVNN8MMM/tIPA/xYZmhvP2x D/YBD4jBDWwn+6ay2mgDNN+6X1vwYcOcC/3/Ze+2LFH0Z4wB0AcJ+T4hTnBwv6vt8ijF /g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3nhf8a458p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Feb 2023 23:08:21 +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 316LbeUJ040865; Mon, 6 Feb 2023 23:08:20 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 3nhdtb99m7-2; Mon, 06 Feb 2023 23:08:20 +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 v3 1/6] vdpa: fix improper error message when adding vdpa dev Date: Mon, 6 Feb 2023 15:07:55 -0800 Message-Id: <1675724880-7216-2-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675724880-7216-1-git-send-email-si-wei.liu@oracle.com> References: <1675724880-7216-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-02-06_07,2023-02-06_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302060202 X-Proofpoint-ORIG-GUID: jc3UYtVBS5crri5Ryl2hBVF1nOIRFXDi X-Proofpoint-GUID: jc3UYtVBS5crri5Ryl2hBVF1nOIRFXDi 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?1757125042696741947?= X-GMAIL-MSGID: =?utf-8?q?1757125042696741947?= 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: 0x1000. kernel answers: Operation not supported Fixes: d8ca2fa5be1b ("vdpa: Enable user to set mac and mtu of vdpa device") Signed-off-by: Si-Wei Liu Reviewed-by: Parav Pandit Reviewed-by: Eli Cohen --- drivers/vdpa/vdpa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index 8ef7aa1..3a82ca78 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -622,9 +622,11 @@ 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) { - NL_SET_ERR_MSG_MOD(info->extack, - "All provided attributes are not supported"); + NL_SET_ERR_MSG_FMT_MOD(info->extack, + "Some provided attributes are not supported: 0x%llx", + config.mask & ~mdev->config_attr_mask); err = -EOPNOTSUPP; goto err; }