Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1101250pxb; Thu, 15 Apr 2021 14:09:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwayRvqrw/vMIbBz30zydlfKubieNfZnCQEBBdfh1TM0g8E0q4rztJpMTK1HoromYjcPJb6 X-Received: by 2002:a17:906:37c9:: with SMTP id o9mr5321256ejc.285.1618520951171; Thu, 15 Apr 2021 14:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618520951; cv=none; d=google.com; s=arc-20160816; b=Vq77Rq5atI+FohhHQ3R4Ln7PpG51TirifDsI6M7t0Nr2ctfGOK18YDqyApiC2EAAb8 UfVEKtkC3ewGEfgrx5Gu9orARilS0rsfAomZ6shr5ZeTPG+KtLEwZsbuMAcKQYbt+l/J 2LbRWkRCJ1Q7vSKUlukx0t3uqKS8Q6jZR8ibU2J7K1i9bN+huBe4Ybx/0+DuO2kYUO1E xCHzfsd8N4tRF/lz20wkNRs+FF+mtyX1gpMCXVEix9FEk/UjSOHb2wtTH/vilpUe5d6u iFv+3/gyhZwiKMj88wM+1tboTMxa5AC687gTwFiGn3jKSsKlmgpaIXVAkFc1KDC4Ish1 T0Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=HftWZnccBzP01eluEQiPxFKbZi9Y6kknhs11IWeFnvM=; b=ONRi7Ey2do8JPPh2jflGQC8Jgqz64KSWqtMgmK9hC5ipkZkgKrIeMEEGF7H2lwZ2uY MudqvJJjie/s6F/z+nzXQ7p0iyNu8sLYxoCdgwHqG22gac+/CHNj8+hPttOUcMKRa9xd 1Clvz8c0xprU07Z6bbnYAjCktcGGKX59eIYdWZy+c7/cE/K4pcj7TOqy5yJipvT6vz1H GbcqJRx57RMFUIzTbZrbZb1St5hagjPcmGUUWw1J1kIExy2YfFz3MtjWe5E+RQ+CtkNM szmDYnqf/MYvHktuVOyBUq7odyiWHcQcYzgcyCQCuWuhLLSMt+FRz+SzvoEiI3v/r4Ff K2EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=NRvO3JOF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si3122869ejn.570.2021.04.15.14.08.46; Thu, 15 Apr 2021 14:09:11 -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=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=NRvO3JOF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235184AbhDOVIN (ORCPT + 99 others); Thu, 15 Apr 2021 17:08:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234869AbhDOVIN (ORCPT ); Thu, 15 Apr 2021 17:08:13 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C76BDC06175F for ; Thu, 15 Apr 2021 14:07:49 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id q14-20020a17090a430eb02901503aaee02bso2358806pjg.3 for ; Thu, 15 Apr 2021 14:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HftWZnccBzP01eluEQiPxFKbZi9Y6kknhs11IWeFnvM=; b=NRvO3JOF8esPh7/WWkaX8usLVRSwsRys7YWh93NwFRddFNjL48k1rv9EHsnby5dv04 kYHVjh/ZHUyXCgAzGLfn7VWfk2NBxw3Q8otRYaShP4NqstdYEUq/RNE9dqnxIEZbPF9H IfTxHNzYLHNYjAECWkPJWbtiy3yh4kow8p71RFx1TtXsLxi2vxXExkzbv16OOrihFzNr 37qV+2AICtA+AGb9EQbNJCEKW8cl2jypQLut7Xb2RYvFIiUkFmf6x26JXOUXtR1wUEKv ARouBx2K+KXbP//OX1crmWeSBLkJQlQgQT7HPXWRtaH7l4xyUoG2WD59i/ADlDwvtfOt ZXWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HftWZnccBzP01eluEQiPxFKbZi9Y6kknhs11IWeFnvM=; b=Q/cZTvDlXLXNzmHW+70TdMeihtOUTG4GAp02jvyC6ZOj0y97HwnJN+6G5/4WLS+Xkc cr6UdocdRp517wzfsOpBXupPjAdlyDnwO7Q9gVKf4jiatZbJkf67yy0+WLzgJRU08b/z PwqfzX4j3FOhWCzw4X3zkjOOaRfp5Pu9+O+G81tA2D7lMeBBvE6eQ5AXOuAzX05mtuCl PhLlGPFYU4S2f8oHGAGWQJpATbfozcUxnBJod7rGMYYnJ8GO/b7y4noz7+HIjJFZ/tql ZJ7hIz2L7Lmg5anHY3MGBQPeZVLKyzwb+GyBYixq3v6rcYu6U9lL/4BB6z0FsVhmrVpt iCmg== X-Gm-Message-State: AOAM531UsjEQ8sTw23P989K1xe9QJkp4MWT079fYeF+1bEIejo+s1nq0 ZYAWJvSY767hVVWT1lnecpIjFg== X-Received: by 2002:a17:90b:16cd:: with SMTP id iy13mr6219384pjb.46.1618520869084; Thu, 15 Apr 2021 14:07:49 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id q63sm3391636pjq.17.2021.04.15.14.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 14:07:48 -0700 (PDT) Date: Thu, 15 Apr 2021 14:07:40 -0700 From: Stephen Hemminger To: Dexuan Cui Cc: davem@davemloft.net, kuba@kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, liuwe@microsoft.com, netdev@vger.kernel.org, leon@kernel.org, andrew@lunn.ch, bernd@petrovitsch.priv.at, rdunlap@infradead.org, shacharr@microsoft.com, 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) Message-ID: <20210415140740.7fac720e@hermes.local> In-Reply-To: <20210415054519.12944-1-decui@microsoft.com> References: <20210415054519.12944-1-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Apr 2021 22:45:19 -0700 Dexuan Cui wrote: > +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 = {}; > + struct mana_query_vport_cfg_req req = {}; > + int err; > + > + mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_VPORT_CONFIG, > + sizeof(req), sizeof(resp)); > + > + req.vport_index = vport_index; > + > + err = mana_send_request(apc->ac, &req, sizeof(req), &resp, > + sizeof(resp)); > + if (err) > + return err; > + > + err = mana_verify_resp_hdr(&resp.hdr, MANA_QUERY_VPORT_CONFIG, > + sizeof(resp)); > + if (err) > + return err; > + > + if (resp.hdr.status) > + return -EPROTO; > + > + *max_sq = resp.max_num_sq; > + *max_rq = resp.max_num_rq; > + *num_indir_entry = resp.num_indirection_ent; > + > + apc->port_handle = resp.vport; > + memcpy(apc->mac_addr, resp.mac_addr, ETH_ALEN); You could use ether_addr_copy here. > +int mana_do_attach(struct net_device *ndev, enum mana_attach_caller caller) > +{ > + struct mana_port_context *apc = netdev_priv(ndev); > + struct gdma_dev *gd = apc->ac->gdma_dev; > + u32 max_txq, max_rxq, max_queues; > + int port_idx = apc->port_idx; > + u32 num_indirect_entries; > + int err; > + > + if (caller == MANA_OPEN) > + goto start_open; > + > + err = mana_init_port_context(apc); > + if (err) > + return err; > + > + err = 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 = min_t(u32, max_txq, max_rxq); > + if (apc->max_queues > max_queues) > + apc->max_queues = max_queues; > + > + if (apc->num_queues > apc->max_queues) > + apc->num_queues = apc->max_queues; > + > + memcpy(ndev->dev_addr, apc->mac_addr, ETH_ALEN); And here use ether_addr_copy().