Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1105580pxb; Thu, 15 Apr 2021 14:17:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtce2C+owG3IPBe2QEIwbMIHus3UNqhYNkHUd+ApM+TO8X8CfGruflujgmDHjuBChh2SB0 X-Received: by 2002:a50:fe81:: with SMTP id d1mr6777383edt.308.1618521419914; Thu, 15 Apr 2021 14:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618521419; cv=none; d=google.com; s=arc-20160816; b=Eloyw3XLJ+GS/B3xWR9pEClTjUQQpPok8NQCcV0bWfamdhsCGypr5VgwsDtZoX9hia va6dOttJWrz9Ko9O3p5QzWl4j5zsAq7d0NnOwrocp432eqk4EA+HEkYzB4QmiOK0KeVL IfJyn7SsMC2cZ66Wsp1+hUpH7dGu1+2H9giJbtsXt/YOuW3MI4DNE7rgdFhEjGifgYrA RLzWofqR4s3JSzEWVL5HGCnianw2ndaJSkiPy6xrtMtcLKxbUU9BFDlrLbtsD2BbLt84 GU6DfGMWJgZSgUo/bTtXcWpQNQ4IEUcMBV19LjrXBi9Y8aTW/Mltqe+P0D/mit4LBm1Q M6dw== 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=E+zzLPV6n+5kowpZE/IEJBo10o+qQ1Ks/Ky4ezSQr08=; b=GbXKzzHP3fHt/kcQEH2VRMOfSgasJISrdEmG0d92s/V2hNp9F+sfAlYEJj7sx6yfOC 4k3UcEW03kM3FpmSLxUOlaNfOyiNVbVZrITEwFH4+EryWyEWjptMYReR8Ay1jQ5UzGgh iAgjai8oYG6ItTf3XiThhudLJSbcJBL8hkjsRzSCO+DS6jOUB5FFkqBAZZMObCT5Rus+ QUNEHJT47yNX2s0JWYlcTGbEiVR1+Xy+gfOcZh8GG1kCVS7AI1ba+tVVEDhlpTPeI1IN mxu/ffrNQeQz6MqzihRooTe+gKUFfe9sVZ6wr6daJSji2eqxXRWG6+1fdqqJz9F5TKRi s2RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=lBPOF7HU; 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 j18si3342444edw.209.2021.04.15.14.16.34; Thu, 15 Apr 2021 14:16:59 -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=lBPOF7HU; 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 S235455AbhDOVP6 (ORCPT + 99 others); Thu, 15 Apr 2021 17:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbhDOVP5 (ORCPT ); Thu, 15 Apr 2021 17:15:57 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D3AC06175F for ; Thu, 15 Apr 2021 14:15:34 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id s14so7940161pjl.5 for ; Thu, 15 Apr 2021 14:15:34 -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=E+zzLPV6n+5kowpZE/IEJBo10o+qQ1Ks/Ky4ezSQr08=; b=lBPOF7HUcnVEuaiUK1v7fYM3nLPcU8cI7Q8MC89mb0K9L4eoZWdBRTf+6kKSHke9XH hLNJaim9Jw5PoXWWPIDMAOsbHLJzFzOjIcVvDVUJuIgyFqNNGZ3VDn6OFVodLDjbgRpH 4ZWFKMk7KvkYI6Uz/tLNGUcIXWz++rZtxdRc3P5HM56ZB4YKxtWiPCm9DGf37NNxZnb9 8FCkGVBTZgmhNaUdyYZVEA2ruNxoVhze7YeiZG3sWKc0BzQcHgMfGDsb49zEE4eYkuTB BFGUz0rQIs81g53nIanFPkUgxMpLWh69r6/Fxapc70XQZ0XKh44DJVwGJme087pv9uw6 H1QA== 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=E+zzLPV6n+5kowpZE/IEJBo10o+qQ1Ks/Ky4ezSQr08=; b=c1ZYiI2jJ+oAp5xQAt26+mB70Z0QLr+PtGOIJ2XbK5fsRKbjMHNgCz7zoIjq36kEj6 BQze5pMMCSNn+xYyZ9bMdQEvBTwaAF+BYrjvzsexCBQ8XlVdWplXYHxuaLxGF/DLunRF FtzEDKxGRXVCHmuy4xpDBZtFw/iTmTV8Y9urixhXxRJuo8ny9oiz2z0sIStof4+ilLXt Xk/nUGETCoKtfL3lsM6Pv6ZbzdHgZAMjEgSPMVH0tmzC0JWtFNp1cVv49nV9c3r3Q3IJ AwrKYWpwuKVyrjGeJ+VEcoWSySgwavDuHeYoksAkbWR5tkxGkYNNeJ6hj8lOxoSXx9+P HWUw== X-Gm-Message-State: AOAM530IbKN8OlCrApIyQAbJOy9BesL3PzU0Twy6NMlNowWb34+Lj7pp hk2YiztwZDbb4t/WYEumy/Y+O93BhUOVMSnm X-Received: by 2002:a17:90a:488a:: with SMTP id b10mr5944052pjh.2.1618521333789; Thu, 15 Apr 2021 14:15:33 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id x1sm2905627pfj.209.2021.04.15.14.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 14:15:33 -0700 (PDT) Date: Thu, 15 Apr 2021 14:15:25 -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: <20210415141525.69c12844@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_probe_port(struct mana_context *ac, int port_idx, > + struct net_device **ndev_storage) > +{ > + struct gdma_context *gc = ac->gdma_dev->gdma_context; > + struct mana_port_context *apc; > + struct net_device *ndev; > + int err; > + > + ndev = alloc_etherdev_mq(sizeof(struct mana_port_context), > + gc->max_num_queues); > + if (!ndev) > + return -ENOMEM; > + > + *ndev_storage = ndev; > + > + apc = netdev_priv(ndev); > + apc->ac = ac; > + apc->ndev = ndev; > + apc->max_queues = gc->max_num_queues; > + apc->num_queues = min_t(uint, gc->max_num_queues, MANA_MAX_NUM_QUEUES); > + apc->port_handle = INVALID_MANA_HANDLE; > + apc->port_idx = port_idx; > + > + ndev->netdev_ops = &mana_devops; > + ndev->ethtool_ops = &mana_ethtool_ops; > + ndev->mtu = ETH_DATA_LEN; > + ndev->max_mtu = ndev->mtu; > + ndev->min_mtu = ndev->mtu; > + ndev->needed_headroom = MANA_HEADROOM; > + SET_NETDEV_DEV(ndev, gc->dev); > + > + netif_carrier_off(ndev); > + > + get_random_bytes(apc->hashkey, MANA_HASH_KEY_SIZE); Current practice for network drivers is to use netdev_rss_key_fill() for this.