On Wed, 14 Apr 2021 22:45:19 -0700 Dexuan Cui <decui@xxxxxxxxxxxxx> 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.