Hi Dave,
This patchset contains several bug fixes from the team to the
mlx4 Eth and Core drivers.
Series generated against net commit:
ecc515d7238f 'sctp: fix the panic caused by route update'
Thanks,
Tariq.
Erez Shitrit (1):
net/mlx4_en: Process all completions in RX rings after port goes up
Eugenia Emantayev (3):
net/mlx4_en: Resolve dividing by zero in 32-bit system
net/mlx4_en: Fix panic during reboot
net/mlx4: Fix firmware command timeout during interrupt test
Jack Morgenstein (3):
net/mlx4_core: Fix the resource-type enum in res tracker to conform to
FW spec
net/mlx4_core: Do not access comm channel if it has not yet been
initialized
net/mlx4_en: Fix potential deadlock in port statistics flow
Maor Gottlieb (1):
net/mlx4_core: Avoid setting ports to auto when only one port type is
supported
Moshe Lazer (1):
net/mlx4_core: Change the default value of enable_qos
Tariq Toukan (1):
net/mlx4_en: Save slave ethtool stats command
drivers/net/ethernet/mellanox/mlx4/cmd.c | 9 ++++
drivers/net/ethernet/mellanox/mlx4/en_clock.c | 5 +-
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 13 ++++-
drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 +-
drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 26 +++++++++-
drivers/net/ethernet/mellanox/mlx4/eq.c | 62 +++++++++++-------------
drivers/net/ethernet/mellanox/mlx4/fw.c | 4 +-
drivers/net/ethernet/mellanox/mlx4/main.c | 10 +++-
drivers/net/ethernet/mellanox/mlx4/mlx4.h | 5 +-
drivers/net/ethernet/mellanox/mlx4/port.c | 13 +----
include/linux/mlx4/device.h | 3 +-
11 files changed, 95 insertions(+), 59 deletions(-)
--
1.8.3.1
From: Maor Gottlieb <redacted>
When only one port type is supported, it should be read only.
We reject changing requests, even to the auto sense mode.
Fixes: 27bf91d6a0d5 ("mlx4_core: Add link type autosensing")
Signed-off-by: Maor Gottlieb <redacted>
Signed-off-by: Moshe Shemesh <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -1102,6 +1102,14 @@ static int __set_port_type(struct mlx4_port_info *info,inti;interr=0;+if((port_type&mdev->caps.supported_type[info->port])!=port_type){+mlx4_err(mdev,+"Requested port type for port %d is not supported on this HCA\n",+info->port);+err=-EINVAL;+gotoerr_sup;+}+mlx4_stop_sense(mdev);mutex_lock(&priv->port_mutex);info->tmp_type=port_type;
@@ -1147,7 +1155,7 @@ static int __set_port_type(struct mlx4_port_info *info,out:mlx4_start_sense(mdev);mutex_unlock(&priv->port_mutex);-+err_sup:returnerr;}
From: Jack Morgenstein <redacted>
The resource type enum in the resource tracker was incorrect.
RES_EQ was put in the position of RES_NPORT_ID (a FC resource).
Since the remaining resources maintain their current values,
and RES_EQ is not passed from slaves to the hypervisor in any
FW command, this change affects only the hypervisor.
Therefore, there is no backwards-compatibility issue.
Fixes: 623ed84b1f95 ("mlx4_core: initial header-file changes for SRIOV support")
Signed-off-by: Jack Morgenstein <redacted>
Signed-off-by: Moshe Shemesh <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/mlx4.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Moshe Lazer <redacted>
Change the default status of quality of service back to disabled,
as it hurts performance in some cases.
Fixes: 38438f7c7e8c ("net/mlx4: Set enhanced QoS support by default when ...")
Signed-off-by: Moshe Lazer <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/fw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Eugenia Emantayev <redacted>
Currently interrupt test that is part of ethtool selftest runs the
check over all interrupt vectors of the device.
In mlx4_en package part of interrupt vectors are uninitialized since
mlx4_ib doesn't exist. This causes NOP FW command to time out.
Change logic to test current port interrupt vectors only.
Signed-off-by: Eugenia Emantayev <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 26 +++++++++-
drivers/net/ethernet/mellanox/mlx4/eq.c | 62 +++++++++++-------------
include/linux/mlx4/device.h | 3 +-
3 files changed, 55 insertions(+), 36 deletions(-)
@@ -118,6 +118,29 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)return!loopback_ok;}+staticintmlx4_en_test_interrupts(structmlx4_en_priv*priv)+{+structmlx4_en_dev*mdev=priv->mdev;+interr=0;+inti=0;++err=mlx4_test_async(mdev->dev);+/* When not in MSI_X or slave, test only async */+if(!(mdev->dev->flags&MLX4_FLAG_MSI_X)||mlx4_is_slave(mdev->dev))+returnerr;++/* A loop over all completion vectors of current port,+*foreachvectorcheckwhetheritworksbymappingcommand+*completionstothatvectorandperformingaNOPcommand+*/+for(i=0;i<priv->rx_ring_num;i++){+err=mlx4_test_interrupt(mdev->dev,priv->rx_cq[i]->vector);+if(err)+break;+}++returnerr;+}staticintmlx4_en_test_link(structmlx4_en_priv*priv){
@@ -151,7 +174,6 @@ static int mlx4_en_test_speed(struct mlx4_en_priv *priv)voidmlx4_en_ex_selftest(structnet_device*dev,u32*flags,u64*buf){structmlx4_en_priv*priv=netdev_priv(dev);-structmlx4_en_dev*mdev=priv->mdev;inti,carrier_ok;memset(buf,0,sizeof(u64)*MLX4_EN_NUM_SELF_TEST);
@@ -1361,53 +1361,49 @@ void mlx4_cleanup_eq_table(struct mlx4_dev *dev)kfree(priv->eq_table.uar_map);}-/* A test that verifies that we can accept interrupts on all-*theirqvectorsofthedevice.+/* A test that verifies that we can accept interrupts+*onthevectorallocatedforasynchronousevents+*/+intmlx4_test_async(structmlx4_dev*dev)+{+returnmlx4_NOP(dev);+}+EXPORT_SYMBOL(mlx4_test_async);++/* A test that verifies that we can accept interrupts+*onthegivenirqvectorofthetestedport.*InterruptsarecheckedusingtheNOPcommand.*/-intmlx4_test_interrupts(structmlx4_dev*dev)+intmlx4_test_interrupt(structmlx4_dev*dev,intvector){structmlx4_priv*priv=mlx4_priv(dev);-inti;interr;-err=mlx4_NOP(dev);-/* When not in MSI_X, there is only one irq to check */-if(!(dev->flags&MLX4_FLAG_MSI_X)||mlx4_is_slave(dev))-returnerr;--/* A loop over all completion vectors, for each vector we will check-*whetheritworksbymappingcommandcompletionstothatvector-*andperformingaNOPcommand-*/-for(i=0;!err&&(i<dev->caps.num_comp_vectors);++i){-/* Make sure request_irq was called */-if(!priv->eq_table.eq[i].have_irq)-continue;--/* Temporary use polling for command completions */-mlx4_cmd_use_polling(dev);--/* Map the new eq to handle all asynchronous events */-err=mlx4_MAP_EQ(dev,get_async_ev_mask(dev),0,-priv->eq_table.eq[i].eqn);-if(err){-mlx4_warn(dev,"Failed mapping eq for interrupt test\n");-mlx4_cmd_use_events(dev);-break;-}+/* Temporary use polling for command completions */+mlx4_cmd_use_polling(dev);-/* Go back to using events */-mlx4_cmd_use_events(dev);-err=mlx4_NOP(dev);+/* Map the new eq to handle all asynchronous events */+err=mlx4_MAP_EQ(dev,get_async_ev_mask(dev),0,+priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(vector)].eqn);+if(err){+mlx4_warn(dev,"Failed mapping eq for interrupt test\n");+gotoout;}+/* Go back to using events */+mlx4_cmd_use_events(dev);+err=mlx4_NOP(dev);+/* Return to default */+mlx4_cmd_use_polling(dev);+out:mlx4_MAP_EQ(dev,get_async_ev_mask(dev),0,priv->eq_table.eq[MLX4_EQ_ASYNC].eqn);+mlx4_cmd_use_events(dev);+returnerr;}-EXPORT_SYMBOL(mlx4_test_interrupts);+EXPORT_SYMBOL(mlx4_test_interrupt);boolmlx4_is_eq_vector_valid(structmlx4_dev*dev,u8port,intvector){
From: Eugenia Emantayev <redacted>
Fix a kernel panic that occurs as a result of an asynchronous event
handled in roce_gid_mgmt:
mlx4_en_get_drvinfo is called and accesses freed resources.
This happens in a shutdown flow only, since pci device is destroyed
while netdevice is still alive.
Fixes: c27a02cd94d6 ("mlx4_en: Add driver for Mellanox ConnectX 10GbE NIC")
Signed-off-by: Eugenia Emantayev <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 1 +
1 file changed, 1 insertion(+)
From: Eugenia Emantayev <redacted>
When doing roundup_pow_of_two for large enough number with
bit 31, an overflow will occur and a value equal to 1 will
be returned. In this case 1 will be subtracted from the return
value and division by zero will be reached.
Fixes: 31c128b66e5b ("net/mlx4_en: Choose time-stamping shift value according to HW frequency")
Signed-off-by: Eugenia Emantayev <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_clock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -245,8 +245,11 @@ static u32 freq_to_shift(u16 freq){u32freq_khz=freq*1000;u64max_val_cycles=freq_khz*1000*MLX4_EN_WRAP_AROUND_SEC;+u64tmp_rounded=+roundup_pow_of_two(max_val_cycles)>max_val_cycles?+roundup_pow_of_two(max_val_cycles)-1:UINT_MAX;u64max_val_cycles_rounded=is_power_of_2(max_val_cycles+1)?-max_val_cycles:roundup_pow_of_two(max_val_cycles)-1;+max_val_cycles:tmp_rounded;/* calculate max possible multiplier in order to fit in 64bit */u64max_mul=div_u64(0xffffffffffffffffULL,max_val_cycles_rounded);
From: Erez Shitrit <redacted>
Currently there is a race between incoming traffic and
initialization flow. HW is able to receive the packets
after INIT_PORT is done and unicast steering is configured.
Before we set priv->port_up NAPI is not scheduled and
receive queues become full. Therefore we never get
new interrupts about the completions.
This issue could happen if running heavy traffic during
bringing port up.
The resolution is to schedule NAPI once port_up is set.
If receive queues were full this will process all cqes
and release them.
Fixes: c27a02cd94d6 ("mlx4_en: Add driver for Mellanox ConnectX 10GbE NIC")
Signed-off-by: Erez Shitrit <redacted>
Signed-off-by: Eugenia Emantayev <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 7 +++++++
1 file changed, 7 insertions(+)
@@ -1733,6 +1733,13 @@ int mlx4_en_start_port(struct net_device *dev)udp_tunnel_get_rx_info(dev);priv->port_up=true;++/* Process all completions if exist to prevent+*thequeuesfreezingiftheyarefull+*/+for(i=0;i<priv->rx_ring_num;i++)+napi_schedule(&priv->rx_cq[i]->napi);+netif_tx_start_all_queues(dev);netif_device_attach(dev);
From: Jack Morgenstein <redacted>
In the Hypervisor, there are several FW commands which are invoked
before the comm channel is initialized (in mlx4_multi_func_init).
These include MOD_STAT_CONFIG, QUERY_DEV_CAP, INIT_HCA, and others.
If any of these commands fails, say with a timeout, the Hypervisor
driver enters the internal error reset flow. In this flow, the driver
attempts to notify all slaves via the comm channel that an internal error
has occurred.
Since the comm channel has not yet been initialized (i.e., mapped via
ioremap), this will cause dereferencing a NULL pointer.
To fix this, do not access the comm channel in the internal error flow
if it has not yet been initialized.
Fixes: 55ad359225b2 ("net/mlx4_core: Enable device recovery flow with SRIOV")
Fixes: ab9c17a009ee ("mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet")
Signed-off-by: Jack Morgenstein <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/cmd.c | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -2469,6 +2469,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)kfree(priv->mfunc.master.slave_state);err_comm:iounmap(priv->mfunc.comm);+priv->mfunc.comm=NULL;err_vhcr:dma_free_coherent(&dev->persist->pdev->dev,PAGE_SIZE,priv->mfunc.vhcr,
@@ -2537,6 +2538,13 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev)intslave;u32slave_read;+/* If the comm channel has not yet been initialized,+*skipreportingtheinternalerroreventtoall+*thecommunicationchannels.+*/+if(!priv->mfunc.comm)+return;+/* Report an internal error event to all*communicationchannels.*/
From: Jack Morgenstein <redacted>
mlx4_en_DUMP_ETH_STATS took the *counter mutex* and then
called the FW command, with WRAPPED attribute. As a result, the fw command
is wrapped on the Hypervisor when it calls mlx4_en_DUMP_ETH_STATS.
The FW command wrapper flow on the hypervisor takes the *slave_cmd_mutex*
during processing.
At the same time, a VF could be in the process of coming up, and could
call mlx4_QUERY_FUNC_CAP. On the hypervisor, the command flow takes the
*slave_cmd_mutex*, then executes mlx4_QUERY_FUNC_CAP_wrapper.
mlx4_QUERY_FUNC_CAP wrapper calls mlx4_get_default_counter_index(),
which takes the *counter mutex*. DEADLOCK.
The fix is that the DUMP_ETH_STATS fw command should be called with
the NATIVE attribute, so that on the hypervisor, this command does not
enter the wrapper flow.
Since the Hypervisor no longer goes through the wrapper code, we also
simply return 0 in mlx4_DUMP_ETH_STATS_wrapper (i.e.the function succeeds,
but the returned data will be all zeroes).
No need to test if it is the Hypervisor going through the wrapper.
Fixes: f9baff509f8a ("mlx4_core: Add "native" argument to mlx4_cmd ...")
Signed-off-by: Jack Morgenstein <redacted>
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 ++--
drivers/net/ethernet/mellanox/mlx4/mlx4.h | 2 --
drivers/net/ethernet/mellanox/mlx4/port.c | 13 +------------
3 files changed, 3 insertions(+), 16 deletions(-)
@@ -1330,8 +1330,6 @@ int mlx4_SET_VLAN_FLTR_wrapper(struct mlx4_dev *dev, int slave,structmlx4_cmd_info*cmd);intmlx4_common_set_vlan_fltr(structmlx4_dev*dev,intfunction,intport,void*buf);-intmlx4_common_dump_eth_stats(structmlx4_dev*dev,intslave,u32in_mod,-structmlx4_cmd_mailbox*outbox);intmlx4_DUMP_ETH_STATS_wrapper(structmlx4_dev*dev,intslave,structmlx4_vhcr*vhcr,structmlx4_cmd_mailbox*inbox,
@@ -1728,24 +1728,13 @@ int mlx4_SET_VLAN_FLTR_wrapper(struct mlx4_dev *dev, int slave,returnerr;}-intmlx4_common_dump_eth_stats(structmlx4_dev*dev,intslave,-u32in_mod,structmlx4_cmd_mailbox*outbox)-{-returnmlx4_cmd_box(dev,0,outbox->dma,in_mod,0,-MLX4_CMD_DUMP_ETH_STATS,MLX4_CMD_TIME_CLASS_B,-MLX4_CMD_NATIVE);-}-intmlx4_DUMP_ETH_STATS_wrapper(structmlx4_dev*dev,intslave,structmlx4_vhcr*vhcr,structmlx4_cmd_mailbox*inbox,structmlx4_cmd_mailbox*outbox,structmlx4_cmd_info*cmd){-if(slave!=dev->caps.function)-return0;-returnmlx4_common_dump_eth_stats(dev,slave,-vhcr->in_modifier,outbox);+return0;}intmlx4_get_slave_from_roce_gid(structmlx4_dev*dev,intport,u8*gid,
Following the previous patch, as an optimization, the slave will
not even bother sending the DUMP_ETH_STATS command over the
comm channel.
Signed-off-by: Tariq Toukan <redacted>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
This patchset contains several bug fixes from the team to the
mlx4 Eth and Core drivers.
Series generated against net commit:
ecc515d7238f 'sctp: fix the panic caused by route update'