net: ena: use constant value for net_device allocation
authorShay Agroskin <shayagr@amazon.com>
Tue, 8 Dec 2020 18:02:00 +0000 (20:02 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 9 Dec 2020 23:26:40 +0000 (15:26 -0800)
commitce74496a1575dc5364ad2aed99d3604269c7b645
tree93850872cde416d8164b00315cc62fa845e47c24
parentda9482332d581bb8ea69eca34d7f75a3c6247475
net: ena: use constant value for net_device allocation

The patch changes the maximum number of RX/TX queues it advertises to
the kernel (via alloc_etherdev_mq()) from a value received from the
device to a constant value which is the minimum between 128 and the
number of CPUs in the system.

By allocating the net_device struct with a constant number of queues,
the driver is able to allocate it at a much earlier stage, before
calling any ena_com functions. This would allow to make all log prints
in ena_com to use netdev_* log functions instead or current pr_* ones.

Note:
netdev_* prints in ena_com functions that are called before
net_device registration in ena_probe() might print messages that are
a bit ugly (with strings like "(unnamed net_device) (uninitialized)").
However we decided to use netdev_* prints in these functions anyway,
for the sake of getting better messages later, when ena_com functions
are called after ena_probe() form other parts of the driver.
See discussion about this decision in [1].

[1] http://www.mail-archive.com/netdev@vger.kernel.org/msg353590.html

Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amazon/ena/ena_netdev.c