RE: [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Jakub Kicinski <kuba@xxxxxxxxxx>
> Sent: Monday, April 12, 2021 11:21 AM
> ... 
> On Sun, 11 Apr 2021 19:34:55 -0700 Dexuan Cui wrote:
> > +	for (i = 0; i < ANA_INDIRECT_TABLE_SIZE; i++)
> > +		apc->indir_table[i] = i % apc->num_queues;
> 
> ethtool_rxfh_indir_default()

Will use ethtool_rxfh_indir_default().

> > +	err = mana_cfg_vport_steering(apc, rx, true, update_hash, update_tab);
> > +	return err;
> 
> return mana_...
> 
> please fix everywhere.

Will fix this one, and will review if there is any similar issue.

> > +	netif_set_real_num_tx_queues(ndev, apc->num_queues);
> > +
> > +	err = mana_add_rx_queues(apc, ndev);
> > +	if (err)
> > +		goto destroy_vport;
> > +
> > +	apc->rss_state = apc->num_queues > 1 ? TRI_STATE_TRUE :
> TRI_STATE_FALSE;
> > +
> > +	netif_set_real_num_rx_queues(ndev, apc->num_queues);
> 
> netif_set_real_num_.. can fail.

Will fix the error handling.

> > +	rtnl_lock();
> > +
> > +	netdev_lockdep_set_classes(ndev);
> > +
> > +	ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
> NETIF_F_IPV6_CSUM;
> > +	ndev->hw_features |= NETIF_F_RXCSUM;
> > +	ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
> > +	ndev->hw_features |= NETIF_F_RXHASH;
> > +	ndev->features = ndev->hw_features;
> > +	ndev->vlan_features = 0;
> > +
> > +	err = register_netdevice(ndev);
> > +	if (err) {
> > +		netdev_err(ndev, "Unable to register netdev.\n");
> > +		goto destroy_vport;
> > +	}
> > +
> > +	rtnl_unlock();
> > +
> > +	return 0;
> > +destroy_vport:
> > +	rtnl_unlock();
> 
> Why do you take rtnl_lock() explicitly around this code?

It looks like there is no good reason, and I guess we just copied
the code from netvsc_probe(), where the RTNL lock is indeed
explicitly needed.

Will change to directly use register_netdev(), which gets and
release the RTNL lock automatically.

> > +static int mana_set_channels(struct net_device *ndev,
> > +			     struct ethtool_channels *channels)
> > +{
> > +	struct ana_port_context *apc = netdev_priv(ndev);
> > +	unsigned int new_count;
> > +	unsigned int old_count;
> > +	int err, err2;
> > +
> > +	new_count = channels->combined_count;
> > +	old_count = apc->num_queues;
> > +
> > +	if (new_count < 1 || new_count > apc->max_queues ||
> > +	    channels->rx_count || channels->tx_count ||
> channels->other_count)
> 
> All these checks should be done by the core already.
> 
> > +		return -EINVAL;
> > +
> > +	if (new_count == old_count)
> > +		return 0;
> 
> And so is this one.

Will change the code to avoid unnecessary checking.

Thanks,
Dexuan




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux