Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp938820pxf; Wed, 7 Apr 2021 15:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd0Cxs3lr48Y0a7YKyjElaEmUnGggLh9Bs09G8PbjxL7Ba0Y+e1Z02HTmMnwo6Lt7Ry28z X-Received: by 2002:a17:906:7194:: with SMTP id h20mr5582024ejk.432.1617834891402; Wed, 07 Apr 2021 15:34:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617834891; cv=pass; d=google.com; s=arc-20160816; b=nEs7WDcBlyy+GbL08/hMtuKsl79wItgscfEy9x0bOOI1iKJ/roVaTUBG3Jz0rS+5YW J3d0YRYf27quzmPrjopmHpRYOwdnmhr2XrZg9hDu9vfDQZ0XK0SDKF97c6uXiqqUgP39 wyFifyXflPlcFkoqNEpHA2UqgTgfSQQE/03t88lOxcdifbN/fjN6LvFpaaEjeeqQwOa7 MR8EIqmdWNIRqCmP/knTDv90gGaCfs8qPjIUhQc8iwd0NrcDd6XouaUjmQT+glFc6ZE7 Zuw0rj+fygoheeob3lNoVmuHA/PU9NYf6K/1ZHoSIexMnVa3HANVomGq8ACl0hO5o3qA FRjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=SpZfcvzvyr3yxfD/RWW5s07ZWo0dRaSy6vD+eqR0eqo=; b=cBltxZ+1IbhYasEvyW6VM6ttCTF/58Hi0UknE5EbknzcXI1DZ7lZBT3mb2m+99M0oR xtqRNv6Tcxc9XaudcJmnp+wcu6DNatm/yN82/ibQb9xWtym5E4PEz7+EHZoXg/7ineTr trNBdhJxb1MOFRj8Xcb6yK4hU0eTNHVsBx/LxNq3ogtnkSpyT2MxmNSs4I5LWYZr5KmY sCa1kVSeiFGe6iAZTfoFq1SLapmMt+ZFT7128cQCAEctabTrMrIXDZWUKasioifzwtbd hjU6uWkUxShBE7sQ92Hd31lX3fROM2uxxHsvDT1C3J4YqcqsgAev345InBFSrVQa11qm ssEA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=OmH57Jjl; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce25si11183931ejb.93.2021.04.07.15.34.28; Wed, 07 Apr 2021 15:34:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=OmH57Jjl; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349584AbhDGIk0 (ORCPT + 99 others); Wed, 7 Apr 2021 04:40:26 -0400 Received: from mail-dm3nam07on2110.outbound.protection.outlook.com ([40.107.95.110]:58465 "EHLO NAM02-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231909AbhDGIkY (ORCPT ); Wed, 7 Apr 2021 04:40:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDZc0r/qrLYJHjwC9VpcTBd7DstTaDs/8gc3LVE8+LryKNO5OyvgvcJzPmTLA4erPSQm2ubnBE/OTmCs5UVOK+HGAvzhu4mZI/6ulBd21Iwa+ZCMO9GkjHM8AKNSbbsGpa4aNxviMXvD42PE9vfbz0htVFMpr/SjesSlM/sBAblE30Ir1NhIf3MeLs9yIQo4s7EjYpFCgj9dry9mZUOQWu9j3QV+Yg69lE0DoIeGa1b/yEC9IyMo/9bb9MuDsVQbACA5zejJ75rnMF70+3UiTpTffljNk/mVu97lp2ujpHggZfFBs2HM/Nc6J3V/JLd4xSTIqCpw8lZmsc2b/hDdIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SpZfcvzvyr3yxfD/RWW5s07ZWo0dRaSy6vD+eqR0eqo=; b=aEKra700SoOXBiwlSDs/QIL9ugMDJ4SHhAxbK5ylLXkRaWjg5d/okKsy+HP1xkSNmZShZAQ5vOtzGCkx3hUla8f/VsTF+kegIEUyjbk3p+omthYIH7UvFzRV/uMbHp9J3JXvIfZ3EhcoqyrO5Nv+1/QSvoUxbdYEH+vKpLqb1xRU2FNc8sB2sjQB9vowpR4PYst8oq/K6fsuwoh+DHClFaxVY15QHKQC3FQS2zv+MpTo+e0gFWQ0YSMEbWVVNfUUCsTnMMKvO0CDmKMUJ9HqWbSsv/kA4WlHtnf6/zvRT1JueIJip+QF4n0aeVggXweuehFN2aNwujRKudnOFLgZTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SpZfcvzvyr3yxfD/RWW5s07ZWo0dRaSy6vD+eqR0eqo=; b=OmH57JjlTDfrPH9QpGgYgLqJcZM+VulS76oB5S3LOMl9FmAoPV+jFaYxo043f5g5KuNsmmLQdUU5ZmZzJKB4ywnwYXouqdpgsWfI5vJN+O2zo/8p7LydiZRg8NfFny2TAkq48O8hQZnuf5VOSWJq61pyVE7GGwS8T1qQL/9fWoI= Received: from MW2PR2101MB0892.namprd21.prod.outlook.com (2603:10b6:302:10::24) by MWHPR2101MB0812.namprd21.prod.outlook.com (2603:10b6:301:7c::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.4; Wed, 7 Apr 2021 08:40:13 +0000 Received: from MW2PR2101MB0892.namprd21.prod.outlook.com ([fe80::5548:cbd8:43cd:aa3d]) by MW2PR2101MB0892.namprd21.prod.outlook.com ([fe80::5548:cbd8:43cd:aa3d%6]) with mapi id 15.20.4042.006; Wed, 7 Apr 2021 08:40:13 +0000 From: Dexuan Cui To: Leon Romanovsky CC: "davem@davemloft.net" , "kuba@kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "wei.liu@kernel.org" , Wei Liu , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" Subject: RE: [PATCH net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Topic: [PATCH net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Index: AQHXK4VsK9CYzM87fki9gwnmLmNhk6qotOdw Date: Wed, 7 Apr 2021 08:40:13 +0000 Message-ID: References: <20210406232321.12104-1-decui@microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=f2d290f8-ac74-4517-b94f-57903914f981;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-04-07T08:14:03Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2601:600:8b00:6b90:b462:5488:6830:14b3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b7b787c5-66a1-44a8-66be-08d8f9a0c303 x-ms-traffictypediagnostic: MWHPR2101MB0812: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2l2AewoAuiVlpVO0LQsqra47q/ecztbYMyUTog4vCyRjE4JOuOaBWFohgvXNQMdRZnLexgmN0S3EDQT6npfbPo/Ufw1nlTbmgXI8+ez9fAQ2X+gkd5jbwoBoNpXSE6ngXxSGvkNvTAskdqQL+BOb5bGZxdG5XWu9Ew+OKRyZBhIL4of0myudkb3URE0ke8b2/mMSCWc+cFxYf5iGN6Dk4oyxbYQ4SOsY4uN5l+cvjdVeincd8R1xNDfR92wBBlUeRfrdUOlAIg+O/f66bXGrkZdJA1QJ9eb3lGXwCy9zoqLq6cVlg6XvO3BgYYnfh9xcLINEYZIO5EWDAlBmNptcno46YOLidipvXsg3ZOKsaVeba6Z8vQtCr/N2Vggx64R8LgACWKxLKirBtGJUIejfg+kUvPIwJUNDoVRqqff7P19ww/v7FM3ul5PPiKlmM3Zne1X4RRLxmgHX1F55cWRzBPFmkbm8wcLqDZSbW+Csu8wSYtzY1axxWVLuEk+blbRDNaEpudY+GBEFFlm3Ko1bGWJ7k/riPyvT31gvyALth4TWK0Ir8uTvhfx7JBcd2P6h9ugkdU2b4nDKs45EXY9ThIa9dlMR8Q4Dtu7eP59UMTzpJ+sZ3wGOAKcuKEDqTQuc8qv6t+MiSemtuJB04Zu1XPN8mVDA2jhl8wdCX+NC2NE= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR2101MB0892.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(376002)(366004)(136003)(39860400002)(47530400004)(4326008)(8990500004)(71200400001)(316002)(6916009)(9686003)(8936002)(2906002)(55016002)(76116006)(7696005)(52536014)(82950400001)(33656002)(186003)(66476007)(66556008)(66946007)(478600001)(54906003)(66446008)(8676002)(10290500003)(5660300002)(38100700001)(6506007)(86362001)(82960400001)(83380400001)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?1kQrK1xOxRKcftzbuiBgE3ZnYQOnexCfrVgR6sYKFm2r1lAOK+2CNITTzih9?= =?us-ascii?Q?9TX+LUUFf6W9GrL+k6d6FdGCSsi7BpniAbPc0JAHfOK2cq5AE5HojRLXsSNE?= =?us-ascii?Q?U7tFD7mJZbYzbLDOn3b4A7VIcU5yWoE0AKWsOrYNQqxoa+X8jRaZKsxnvjnO?= =?us-ascii?Q?/hoQWSim/YBGyk6vnNFrV9Y2yVU4xgi+AkalbfWm6o0rdfkjuT/198G4R0TL?= =?us-ascii?Q?1ylliNJm5//1iNF0UnN6aHtl5luVnV/VyYvgvzJ99l2076p+AMROx54SroNM?= =?us-ascii?Q?wAip19+kQJL2p5Gy/CmWM3LokCZXWM1+eZi7AWjibEqlTHoyUKLvFOqMvaxo?= =?us-ascii?Q?fQ1pF3TmBTsV7OLFtD1wJ5nB1aXNQrfURRH+x7/58lCbMMHul7SkG3wDWHBb?= =?us-ascii?Q?OmT74Q1U4RiglMzK8tWTxmFiFK0bf/kXgOgnPXt2Tg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ii?Q?VQlb2YZNlOKLo94JF81TtKat/Y+3P4tOWoxTy7Vwl/8elaoviwidF/OYPC/g?= =?us-ascii?Q?tnC1B+xqU8sS1r+TQIDCXfvzc/VR?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW2PR2101MB0892.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7b787c5-66a1-44a8-66be-08d8f9a0c303 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2021 08:40:13.2000 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gk0piiEU4GiLtruJBdlk76jTVIdEb24sbdzV+E+Xlc3d3jjvEZMf/Lv/exw2TcUzJSc6/ABR4Bl6tVpxPgGfgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2101MB0812 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Leon Romanovsky > Sent: Wednesday, April 7, 2021 1:10 AM >=20 > <...> >=20 > > +int gdma_verify_vf_version(struct pci_dev *pdev) > > +{ > > + struct gdma_context *gc =3D pci_get_drvdata(pdev); > > + struct gdma_verify_ver_req req =3D { 0 }; > > + struct gdma_verify_ver_resp resp =3D { 0 }; > > + int err; > > + > > + gdma_init_req_hdr(&req.hdr, GDMA_VERIFY_VF_DRIVER_VERSION, > > + sizeof(req), sizeof(resp)); > > + > > + req.protocol_ver_min =3D GDMA_PROTOCOL_FIRST; > > + req.protocol_ver_max =3D GDMA_PROTOCOL_LAST; > > + > > + err =3D gdma_send_request(gc, sizeof(req), &req, sizeof(resp), &resp)= ; > > + if (err || resp.hdr.status) { > > + pr_err("VfVerifyVersionOutput: %d, status=3D0x%x\n", err, > > + resp.hdr.status); > > + return -EPROTO; > > + } > > + > > + return 0; > > +} >=20 > <...> > > + err =3D gdma_verify_vf_version(pdev); > > + if (err) > > + goto remove_irq; >=20 > Will this VF driver be used in the guest VM? What will prevent from users= to > change it? > I think that such version negotiation scheme is not allowed. Yes, the VF driver is expected to run in a Linux VM that runs on Azure. Currently gdma_verify_vf_version() just tells the PF driver that the VF dri= ver is only able to support GDMA_PROTOCOL_V1, and want to use GDMA_PROTOCOL_V1's message formats to talk to the PF driver later. enum { GDMA_PROTOCOL_UNDEFINED =3D 0, GDMA_PROTOCOL_V1 =3D 1, GDMA_PROTOCOL_FIRST =3D GDMA_PROTOCOL_V1, GDMA_PROTOCOL_LAST =3D GDMA_PROTOCOL_V1, GDMA_PROTOCOL_VALUE_MAX }; The PF driver is supposed to always support GDMA_PROTOCOL_V1, so I expect here gdma_verify_vf_version() should succeed. If a user changes the Linux V= F driver and try to use a protocol version not supported by the PF driver, th= en gdma_verify_vf_version() will fail; later, if the VF driver tries to talk t= o the PF driver using an unsupported message format, the PF driver will return a fai= lure. Thanks, -- Dexuan