Skip to content

Commit 93eb2b7

Browse files
committed
Merge tag 'mlx5-updates-2021-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2021-10-15 1) From Rongwei Liu: Use system_image_guid and native_port_num when bonding. Don't relay on PCIe ids anymore. With some specific NIC, the physical devices may have PCIe IDs like 0001:01:00.0/1 and 0002:02:00.0/1. All of these devices should have the same system_image_guid and device index can be queried from native_port_num. For matching sibling devices/port of the same HCA, compare the HCA GUID reported on each device rather than just assuming PCIe ids have similar attributes. 2) From Amir Tzin: Use HCA defined Timouts Replace hard coded timeouts with values stored by firmware in default timeouts register (DTOR). Timeouts are read during driver load. If DTOR is not supported by firmware then fallback to hard coded defaults instead. 3) From Shay Drory: Disable roce at HCA level Disable RoCE in Firmware when devlink roce parameter is set to off. 4) A small set of trivial cleanups ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 803a434 + 8a54318 commit 93eb2b7

32 files changed

+529
-133
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
1717
fs_counters.o fs_ft_pool.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
1818
lib/devcom.o lib/pci_vsc.o lib/dm.o lib/fs_ttc.o diag/fs_tracepoint.o \
1919
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \
20-
fw_reset.o qos.o
20+
fw_reset.o qos.o lib/tout.o
2121

2222
#
2323
# Netdev basic

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#include "mlx5_core.h"
4747
#include "lib/eq.h"
48+
#include "lib/tout.h"
4849

4950
enum {
5051
CMD_IF_REV = 5,
@@ -225,9 +226,13 @@ static void set_signature(struct mlx5_cmd_work_ent *ent, int csum)
225226

226227
static void poll_timeout(struct mlx5_cmd_work_ent *ent)
227228
{
228-
unsigned long poll_end = jiffies + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000);
229+
struct mlx5_core_dev *dev = container_of(ent->cmd, struct mlx5_core_dev, cmd);
230+
u64 cmd_to_ms = mlx5_tout_ms(dev, CMD);
231+
unsigned long poll_end;
229232
u8 own;
230233

234+
poll_end = jiffies + msecs_to_jiffies(cmd_to_ms + 1000);
235+
231236
do {
232237
own = READ_ONCE(ent->lay->status_own);
233238
if (!(own & CMD_OWNER_HW)) {
@@ -925,15 +930,18 @@ static void cmd_work_handler(struct work_struct *work)
925930
{
926931
struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work);
927932
struct mlx5_cmd *cmd = ent->cmd;
928-
struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd);
929-
unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC);
933+
bool poll_cmd = ent->polling;
930934
struct mlx5_cmd_layout *lay;
935+
struct mlx5_core_dev *dev;
936+
unsigned long cb_timeout;
931937
struct semaphore *sem;
932938
unsigned long flags;
933-
bool poll_cmd = ent->polling;
934939
int alloc_ret;
935940
int cmd_mode;
936941

942+
dev = container_of(cmd, struct mlx5_core_dev, cmd);
943+
cb_timeout = msecs_to_jiffies(mlx5_tout_ms(dev, CMD));
944+
937945
complete(&ent->handling);
938946
sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
939947
down(sem);
@@ -1073,7 +1081,7 @@ static void wait_func_handle_exec_timeout(struct mlx5_core_dev *dev,
10731081

10741082
static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent)
10751083
{
1076-
unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC);
1084+
unsigned long timeout = msecs_to_jiffies(mlx5_tout_ms(dev, CMD));
10771085
struct mlx5_cmd *cmd = &dev->cmd;
10781086
int err;
10791087

drivers/net/ethernet/mellanox/mlx5/core/dev.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/mlx5/driver.h>
3434
#include <linux/mlx5/eswitch.h>
3535
#include <linux/mlx5/mlx5_ifc_vdpa.h>
36+
#include <linux/mlx5/vport.h>
3637
#include "mlx5_core.h"
3738

3839
/* intf dev list mutex */
@@ -537,6 +538,16 @@ int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev)
537538
return add_drivers(dev);
538539
}
539540

541+
static bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev)
542+
{
543+
u64 fsystem_guid, psystem_guid;
544+
545+
fsystem_guid = mlx5_query_nic_system_image_guid(dev);
546+
psystem_guid = mlx5_query_nic_system_image_guid(peer_dev);
547+
548+
return (fsystem_guid && psystem_guid && fsystem_guid == psystem_guid);
549+
}
550+
540551
static u32 mlx5_gen_pci_id(const struct mlx5_core_dev *dev)
541552
{
542553
return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
@@ -556,7 +567,8 @@ static int next_phys_dev(struct device *dev, const void *data)
556567
if (mdev == curr)
557568
return 0;
558569

559-
if (mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
570+
if (!mlx5_same_hw_devs(mdev, (struct mlx5_core_dev *)curr) &&
571+
mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
560572
return 0;
561573

562574
return 1;

drivers/net/ethernet/mellanox/mlx5/core/devlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id,
454454
struct mlx5_core_dev *dev = devlink_priv(devlink);
455455
bool new_state = val.vbool;
456456

457-
if (new_state && !MLX5_CAP_GEN(dev, roce)) {
457+
if (new_state && !MLX5_CAP_GEN(dev, roce) &&
458+
!MLX5_CAP_GEN(dev, roce_rw_supported)) {
458459
NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE");
459460
return -EOPNOTSUPP;
460461
}

drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int mlx5e_devlink_port_register(struct mlx5e_priv *priv)
2424

2525
if (mlx5_core_is_pf(priv->mdev)) {
2626
attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
27-
attrs.phys.port_number = PCI_FUNC(priv->mdev->pdev->devfn);
27+
attrs.phys.port_number = mlx5_get_dev_index(priv->mdev);
2828
if (MLX5_ESWITCH_MANAGER(priv->mdev)) {
2929
mlx5e_devlink_get_port_parent_id(priv->mdev, &ppid);
3030
memcpy(attrs.switch_id.id, ppid.id, ppid.id_len);

drivers/net/ethernet/mellanox/mlx5/core/en/fs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ struct mlx5e_ethtool_steering {
125125

126126
void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
127127
void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
128-
int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
129-
int mlx5e_ethtool_get_rxnfc(struct net_device *dev,
128+
int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd);
129+
int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
130130
struct ethtool_rxnfc *info, u32 *rule_locs);
131131
#else
132132
static inline void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv) { }
133133
static inline void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv) { }
134-
static inline int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
134+
static inline int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd)
135135
{ return -EOPNOTSUPP; }
136-
static inline int mlx5e_ethtool_get_rxnfc(struct net_device *dev,
136+
static inline int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
137137
struct ethtool_rxnfc *info, u32 *rule_locs)
138138
{ return -EOPNOTSUPP; }
139139
#endif /* CONFIG_MLX5_EN_RXNFC */

drivers/net/ethernet/mellanox/mlx5/core/en/health.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq);
3232
void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq);
3333

3434
#define MLX5E_REPORTER_PER_Q_MAX_LEN 256
35-
#define MLX5E_REPORTER_FLUSH_TIMEOUT_MSEC 2000
3635

3736
struct mlx5e_err_ctx {
3837
int (*recover)(void *ctx);

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "txrx.h"
77
#include "devlink.h"
88
#include "ptp.h"
9+
#include "lib/tout.h"
910

1011
static int mlx5e_query_rq_state(struct mlx5_core_dev *dev, u32 rqn, u8 *state)
1112
{
@@ -32,8 +33,10 @@ static int mlx5e_query_rq_state(struct mlx5_core_dev *dev, u32 rqn, u8 *state)
3233

3334
static int mlx5e_wait_for_icosq_flush(struct mlx5e_icosq *icosq)
3435
{
35-
unsigned long exp_time = jiffies +
36-
msecs_to_jiffies(MLX5E_REPORTER_FLUSH_TIMEOUT_MSEC);
36+
struct mlx5_core_dev *dev = icosq->channel->mdev;
37+
unsigned long exp_time;
38+
39+
exp_time = jiffies + msecs_to_jiffies(mlx5_tout_ms(dev, FLUSH_ON_ERROR));
3740

3841
while (time_before(jiffies, exp_time)) {
3942
if (icosq->cc == icosq->pc)

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
#include "health.h"
55
#include "en/ptp.h"
66
#include "en/devlink.h"
7+
#include "lib/tout.h"
78

89
static int mlx5e_wait_for_sq_flush(struct mlx5e_txqsq *sq)
910
{
10-
unsigned long exp_time = jiffies +
11-
msecs_to_jiffies(MLX5E_REPORTER_FLUSH_TIMEOUT_MSEC);
11+
struct mlx5_core_dev *dev = sq->mdev;
12+
unsigned long exp_time;
13+
14+
exp_time = jiffies + msecs_to_jiffies(mlx5_tout_ms(dev, FLUSH_ON_ERROR));
1215

1316
while (time_before(jiffies, exp_time)) {
1417
if (sq->cc == sq->pc)

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
21412141
err_ct_tuples_ht:
21422142
rhashtable_destroy(&ct_priv->zone_ht);
21432143
err_ct_zone_ht:
2144+
mlx5_chains_destroy_global_table(chains, ct_priv->ct_nat);
21442145
err_ct_nat_tbl:
21452146
mlx5_chains_destroy_global_table(chains, ct_priv->ct);
21462147
err_ct_tbl:

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,12 +2137,14 @@ int mlx5e_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
21372137
return 0;
21382138
}
21392139

2140-
return mlx5e_ethtool_get_rxnfc(dev, info, rule_locs);
2140+
return mlx5e_ethtool_get_rxnfc(priv, info, rule_locs);
21412141
}
21422142

21432143
int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
21442144
{
2145-
return mlx5e_ethtool_set_rxnfc(dev, cmd);
2145+
struct mlx5e_priv *priv = netdev_priv(dev);
2146+
2147+
return mlx5e_ethtool_set_rxnfc(priv, cmd);
21462148
}
21472149

21482150
static int query_port_status_opcode(struct mlx5_core_dev *mdev, u32 *status_opcode)

drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,8 @@ static int mlx5e_get_rss_hash_opt(struct mlx5e_priv *priv,
937937
return 0;
938938
}
939939

940-
int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
940+
int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd)
941941
{
942-
struct mlx5e_priv *priv = netdev_priv(dev);
943942
int err = 0;
944943

945944
switch (cmd->cmd) {
@@ -960,10 +959,9 @@ int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
960959
return err;
961960
}
962961

963-
int mlx5e_ethtool_get_rxnfc(struct net_device *dev,
962+
int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
964963
struct ethtool_rxnfc *info, u32 *rule_locs)
965964
{
966-
struct mlx5e_priv *priv = netdev_priv(dev);
967965
int err = 0;
968966

969967
switch (info->cmd) {

0 commit comments

Comments
 (0)