From: Dexuan Cui <decui@microsoft.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
KY Srinivasan <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
Wei Liu <liuwe@microsoft.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"leon@kernel.org" <leon@kernel.org>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"bernd@petrovitsch.priv.at" <bernd@petrovitsch.priv.at>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
Shachar Raindel <shacharr@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@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 20:43:52 +0000 [thread overview]
Message-ID: <MW2PR2101MB08921AE42035E49BABB19C19BF709@MW2PR2101MB0892.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20210412112109.145faac8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
> From: Jakub Kicinski <kuba@kernel.org>
> 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
prev parent reply other threads:[~2021-04-12 20:43 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
2021-04-12 20:43 ` Dexuan Cui [this message]
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=MW2PR2101MB08921AE42035E49BABB19C19BF709@MW2PR2101MB0892.namprd21.prod.outlook.com \
--to=decui@microsoft.com \
--cc=andrew@lunn.ch \
--cc=bernd@petrovitsch.priv.at \
--cc=davem@davemloft.net \
--cc=haiyangz@microsoft.com \
--cc=kuba@kernel.org \
--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).