[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210415141525.69c12844@hermes.local>
Date: Thu, 15 Apr 2021 14:15:25 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Dexuan Cui <decui@...rosoft.com>
Cc: davem@...emloft.net, kuba@...nel.org, kys@...rosoft.com,
haiyangz@...rosoft.com, sthemmin@...rosoft.com, wei.liu@...nel.org,
liuwe@...rosoft.com, netdev@...r.kernel.org, leon@...nel.org,
andrew@...n.ch, bernd@...rovitsch.priv.at, rdunlap@...radead.org,
shacharr@...rosoft.com, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org
Subject: Re: [PATCH v6 net-next] net: mana: Add a driver for Microsoft Azure
Network Adapter (MANA)
On Wed, 14 Apr 2021 22:45:19 -0700
Dexuan Cui <decui@...rosoft.com> 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.
Powered by blists - more mailing lists