Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1102102pxb; Thu, 15 Apr 2021 14:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZaHWCHvzL98YiqnuTKbpzS4hZ3a/G8NmKw1VTM3q6ILep/SHxHlEEza6on1LTdDLXalad X-Received: by 2002:a05:6402:1cc1:: with SMTP id ds1mr6387958edb.135.1618521041347; Thu, 15 Apr 2021 14:10:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618521041; cv=pass; d=google.com; s=arc-20160816; b=F2p6AHsSA5d/wefEi9dQVq3n6ISTVUdEj9ydHQYv/5R+mXh+3kE4ahotpyMh01uf5R VrsXLheHBEgKYCZy/oKdFY5hK0lBtYZxTXdqi5lYgJ68yQVS/sCWSgn4enuoTdO4V4XR oyRjQOWcQEM51ni6GDJch0KBQcelP1mFKnScLjI/E39kIfx2YHOAjU/a9Rnt1PlqzadH 7nz1Rcf/E1LtapZQ6a86eZ/+RlyTdsSegT9s7wtbuBAqthYRdpO/LxVMVnzZtQAtOX32 33vsEoQta053O6fuWqLk8g4OzCMTbi2paMBrbZfdkRuPO529McvAjS+stKk8252NJD7x pw/g== 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=6iJ63PfKQ4yBAnv39u6tsElhfkXTyxf2P7sTGCvG/kw=; b=IpkoYTus3Xww62xxPfJNi0loHYxzq32gXreL8Tyt8HZGbIuFSWuwcWMcnsd7drt2pN TlDnYYS+fDxiBDzap6dx78FLtjdM5s58tsXqE6AO0VArw5OAGXCGANiMDQjb7a94EEwU bJnkB/3OCPUFdoMBgToVkkmAecgbbLtgsUx3PrwDsj5DnnWi35NnIGscz6pNeJJLgtxm Ncrp6qtRWDca+qJ6HYVAfAzY3FWAuhOvazRs31OR86QfVA1xjtI5Kr+++accC8HqB/6K GnxvoDFddFgLQtjA9+bSia5A/6zokiFkdavIl9QUqQfw7k2YLnO/8cRb5Ky0q7HEUfwb k1iA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=BUkHFCSa; 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 dk6si3334876edb.572.2021.04.15.14.10.17; Thu, 15 Apr 2021 14:10:41 -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=BUkHFCSa; 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 S235595AbhDOVJZ (ORCPT + 99 others); Thu, 15 Apr 2021 17:09:25 -0400 Received: from mail-bn8nam11on2111.outbound.protection.outlook.com ([40.107.236.111]:21985 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234869AbhDOVJY (ORCPT ); Thu, 15 Apr 2021 17:09:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GAhrfYrHGrLMY5792isFu/u0trUQShii7gHbLArDGLtIK14KohJHn/nW4h9xe6gdfWy+hgp2v6t3rkjC/4yrV9VT4eDpm3bds4Nc+WXP8QSzxPOrVrIR8qt2tyxnd3bHV/2BH7KuXWZPj23uLOXsMg5mhnO+xe59DNGByKlVbo8rsH/LUJlGEUhC5F7sC7zhhDgYkrUyxjlmQPTf8upDkgUjUkpwwd5a22Q6jS7O5zkPNQjOsb0bDv0a02Z/1FGeb75t0VChvkT9D/rDS/oKUMrICr3kb8NxfpvDuRizE/fwaFNAUDqLsskpGqZxmBsMdmBVBAAotA7F7C512vqgVg== 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=6iJ63PfKQ4yBAnv39u6tsElhfkXTyxf2P7sTGCvG/kw=; b=TsDk+y1RQmNELhcIfemNOFU3TvdKFk7YasP9i8eOkSmZweZkfYRkTbvrNsxCTX9/D3HzOom77gb5Gcb/qHFnLG4KPTgMFCduMaqF8SOu+QEVEjK+K/TPFMOp1/Uo9ntat2LfXT/hl9GpBzdmmqGRUyS1FcC6F9mbdyFChO1N7tAugOC6tI52Qm54LMFND44xGCbkXdlqUFTjRS5KqjqVSqy9Ha6tu0uwjxFjYJGggIcCLiQcroG5oMPfyTh3GXBr8s8cyRUtxkj1IkqwVOEGaJYiNMMZ/xYpEdI0SekoepT9tAlBDwYMXHPvGTxxU4TeuvDJvf8A1n/2bcBSZvecAQ== 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=6iJ63PfKQ4yBAnv39u6tsElhfkXTyxf2P7sTGCvG/kw=; b=BUkHFCSaZzLMPkuNxO/t5SEUCzDT7QVEt+G6+avOMdisnytgvIXLPzm1NNFr7iZh9pcS2l5oPiCOd7zuio2ZcrjpV81KFp0kwP2sRrnuwMcwVEIUNCUxHaNH253Hjz9wRozEE2uxUq2EpowLpXQeSwAOozRaHJUChI7vL/rLiCE= Received: from MN2PR21MB1295.namprd21.prod.outlook.com (2603:10b6:208:3e::25) by MN2PR21MB1421.namprd21.prod.outlook.com (2603:10b6:208:1f7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.6; Thu, 15 Apr 2021 21:08:59 +0000 Received: from MN2PR21MB1295.namprd21.prod.outlook.com ([fe80::84fb:f29:d4a9:6c10]) by MN2PR21MB1295.namprd21.prod.outlook.com ([fe80::84fb:f29:d4a9:6c10%2]) with mapi id 15.20.4065.006; Thu, 15 Apr 2021 21:08:58 +0000 From: Haiyang Zhang To: Stephen Hemminger , Dexuan Cui CC: "davem@davemloft.net" , "kuba@kernel.org" , KY Srinivasan , Stephen Hemminger , "wei.liu@kernel.org" , Wei Liu , "netdev@vger.kernel.org" , "leon@kernel.org" , "andrew@lunn.ch" , "bernd@petrovitsch.priv.at" , "rdunlap@infradead.org" , Shachar Raindel , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" Subject: RE: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Topic: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Thread-Index: AQHXMbqnL34ZzVD9CUy17E5OCguws6q2E0cAgAAAQAA= Date: Thu, 15 Apr 2021 21:08:58 +0000 Message-ID: References: <20210415054519.12944-1-decui@microsoft.com> <20210415140740.7fac720e@hermes.local> In-Reply-To: <20210415140740.7fac720e@hermes.local> 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=abeb63a1-902b-4af2-ad16-0769efafbbbf;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-15T21:08:33Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [75.100.88.238] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e9856eaa-4ea2-4015-08b3-08d90052affd x-ms-traffictypediagnostic: MN2PR21MB1421: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AlIUVltR+DB5I7rz6JdSGak2VZDTacfk6NtXwWOY1OkdtbCWmOv/0xkd+zskbHzobgFnaOVXs94IIUJJ8qjq1YWhWmPcV0DIdlCR0m3OHqnmgIXvoK8usIV6zeqqDX3bmgZ9ZyfUZ5n8TS+HguaCbzj2LFEngcoHt9+Crdoi0Xuyydz8q4Moipm3T+Zal19YdkJ7T+gOO4em8mfIs0CuUdclFFuGRkEKzg4tQYXk7HTdssRRvmlvu2VaDGYFuYtX1czx2YZFpcVMK1gYTT5AYD1TPSBLRMsJ3y6ztYVHs9WstuOVU69SxStuk4J+zSk2E/Td04phRfvzCDCSpp1G6M4LLu5OVqx3Pi2PS0NFWgTUOHSDGWLiyshvzOxR6/5U3zR9TVVQCrYzcMz1i+WiHNrMy2HU+VtMqmP/ObCIIGgUU1G7kwVcP6/DnYgPF9NzdQQfpalOXagQ6whI9pFqZA/JIowjeI1XSZb2ekofR48jpFowQa5kc1tS9kiLg6Kr0N5EsNNBxj9tzj5yGhDM64qesyiCDWu5H7JHQlQqQb3xlvO96AUKkRc1V6CcEqA8uHvdLbgHnxsJcLZf3EGE3PlNDtgEFi9b326hvKoZ5jk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR21MB1295.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(136003)(376002)(346002)(396003)(47530400004)(8990500004)(66446008)(8936002)(66946007)(7696005)(86362001)(10290500003)(6636002)(66476007)(52536014)(7416002)(316002)(64756008)(54906003)(4326008)(76116006)(53546011)(66556008)(82960400001)(478600001)(186003)(71200400001)(83380400001)(38100700002)(8676002)(122000001)(82950400001)(5660300002)(9686003)(2906002)(55016002)(6506007)(26005)(110136005)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?LP/ygnvT2lXNMbhIAdpef1dr6R4AiVz3kGrzjMHRaoQmETlHbZzMghtIpU33?= =?us-ascii?Q?973dBtJCYsEpSBhZHkdqhUuU78Q2aj3BPRDheWaPuIWg2bI+8ye+Mpb1XZyT?= =?us-ascii?Q?OyHS4CnLF/lv9JwNoBn3j7l0pn9Kh2qhUVG7wGo1PLR9eUOr0oOrsb4HQZnD?= =?us-ascii?Q?nAi81igd5Cn8eSV81FiNX2wE/A3HPQHNyw/2yf2PBQZaqtziCbc2WXsjzuoM?= =?us-ascii?Q?a4ssG5Go180BcfhSjbuiDo1BnkWhZ1+ZaBB8h0xSXWOgXd0twTWF7fWZRUnZ?= =?us-ascii?Q?+gVINCdeImRBJ5XxYgHSMO2x/Y6/+6zv6LhzNj8m/3bhX5OeG/vDF+ZwLcH7?= =?us-ascii?Q?vruMuSnPDu4fhZQCmV1Ccf2t9nDPyQ5AgbXuHnEfg3suwjoHg+gzbB+BkBiv?=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XdGjIb4sESNbfSoOePUB4lKVwnyblbW5itG3xYE9NsS?= =?us-ascii?Q?lEmIw3ep4a7JpfiVfjkjHzkg?= 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: MN2PR21MB1295.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9856eaa-4ea2-4015-08b3-08d90052affd X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2021 21:08:58.7830 (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: 9CEwrW1kwdSpm8kIIckooQKjFBapPApvdJH22MObMbjqA03bfYoC2vAV7RQHfv0b7wzJ/8B0jdhJOUxtYXxsEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR21MB1421 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, April 15, 2021 5:08 PM > To: Dexuan Cui > Cc: davem@davemloft.net; kuba@kernel.org; KY Srinivasan > ; Haiyang Zhang ; Stephen > Hemminger ; wei.liu@kernel.org; Wei Liu > ; netdev@vger.kernel.org; leon@kernel.org; > andrew@lunn.ch; bernd@petrovitsch.priv.at; rdunlap@infradead.org; > Shachar Raindel ; linux-kernel@vger.kernel.org; > linux-hyperv@vger.kernel.org > Subject: Re: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Az= ure > Network Adapter (MANA) >=20 > On Wed, 14 Apr 2021 22:45:19 -0700 > Dexuan Cui wrote: >=20 > > +static int mana_query_vport_cfg(struct mana_port_context *apc, u32 > vport_index, > > + u32 *max_sq, u32 *max_rq, u32 > *num_indir_entry) { > > + struct mana_query_vport_cfg_resp resp =3D {}; > > + struct mana_query_vport_cfg_req req =3D {}; > > + int err; > > + > > + mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_VPORT_CONFIG, > > + sizeof(req), sizeof(resp)); > > + > > + req.vport_index =3D vport_index; > > + > > + err =3D mana_send_request(apc->ac, &req, sizeof(req), &resp, > > + sizeof(resp)); > > + if (err) > > + return err; > > + > > + err =3D mana_verify_resp_hdr(&resp.hdr, > MANA_QUERY_VPORT_CONFIG, > > + sizeof(resp)); > > + if (err) > > + return err; > > + > > + if (resp.hdr.status) > > + return -EPROTO; > > + > > + *max_sq =3D resp.max_num_sq; > > + *max_rq =3D resp.max_num_rq; > > + *num_indir_entry =3D resp.num_indirection_ent; > > + > > + apc->port_handle =3D resp.vport; > > + memcpy(apc->mac_addr, resp.mac_addr, ETH_ALEN); >=20 > You could use ether_addr_copy here. >=20 >=20 > > +int mana_do_attach(struct net_device *ndev, enum mana_attach_caller > > +caller) { > > + struct mana_port_context *apc =3D netdev_priv(ndev); > > + struct gdma_dev *gd =3D apc->ac->gdma_dev; > > + u32 max_txq, max_rxq, max_queues; > > + int port_idx =3D apc->port_idx; > > + u32 num_indirect_entries; > > + int err; > > + > > + if (caller =3D=3D MANA_OPEN) > > + goto start_open; > > + > > + err =3D mana_init_port_context(apc); > > + if (err) > > + return err; > > + > > + err =3D mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq, > > + &num_indirect_entries); > > + if (err) { > > + netdev_err(ndev, "Failed to query info for vPort 0\n"); > > + goto reset_apc; > > + } > > + > > + max_queues =3D min_t(u32, max_txq, max_rxq); > > + if (apc->max_queues > max_queues) > > + apc->max_queues =3D max_queues; > > + > > + if (apc->num_queues > apc->max_queues) > > + apc->num_queues =3D apc->max_queues; > > + > > + memcpy(ndev->dev_addr, apc->mac_addr, ETH_ALEN); >=20 > And here use ether_addr_copy(). Thanks, I will update these. - Haiyang