linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Dexuan Cui <decui@microsoft.com>
Cc: davem@davemloft.net, 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 v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)
Date: Mon, 12 Apr 2021 11:21:09 -0700	[thread overview]
Message-ID: <20210412112109.145faac8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210412023455.45594-1-decui@microsoft.com>

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()

> +	err = mana_cfg_vport_steering(apc, rx, true, update_hash, update_tab);
> +	return err;

return mana_...

please fix everywhere.

> +	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.

> +	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?

> +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.

> +	err = mana_detach(ndev);
> +	if (err) {
> +		netdev_err(ndev, "mana_detach failed: %d\n", err);
> +		return err;
> +	}

  parent reply	other threads:[~2021-04-12 18:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210412023455.45594-1-decui@microsoft.com>
2021-04-12  7:45 ` [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Leon Romanovsky
2021-04-12  8:35   ` Dexuan Cui
2021-04-12  8:52     ` Leon Romanovsky
2021-04-12 12:10       ` Andrew Lunn
2021-04-12 12:15 ` Andrew Lunn
2021-04-12 14:29   ` Haiyang Zhang
2021-04-12 12:32 ` Andrew Lunn
2021-04-12 14:39   ` Haiyang Zhang
2021-04-12 20:30     ` Dexuan Cui
2021-04-12 18:21 ` Jakub Kicinski [this message]
2021-04-12 20:43   ` Dexuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412112109.145faac8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bernd@petrovitsch.priv.at \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwe@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=shacharr@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).