Skip to content

Commit 7854ac4

Browse files
author
Saeed Mahameed
committed
Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
mlx5 core infrastructure updates and fixes. From Eran: - Add MPEGC (Management PCIe General Configuration) registers and btis - Fix tristate and description for MLX5 module rom Feras: - Add hardware structures for the firmware tracer From Jainbo: - Core support for double vlan push/pop steering action From Max: - Add XRQ commands definitions From Noa: - Add missing SET_DRIVER_VERSION command translation From Roi: - Use ERR_CAST() instead of coding it From Tariq: - Better return types for CQE API Signed-off-by: Saeed Mahameed <[email protected]>
2 parents c9eaaa1 + 048f314 commit 7854ac4

File tree

17 files changed

+258
-89
lines changed

17 files changed

+258
-89
lines changed

drivers/infiniband/hw/mlx5/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
config MLX5_INFINIBAND
2-
tristate "Mellanox Connect-IB HCA support"
2+
tristate "Mellanox 5th generation network adapters (ConnectX series) support"
33
depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
44
depends on INFINIBAND_USER_ACCESS || INFINIBAND_USER_ACCESS=n
55
---help---

drivers/infiniband/hw/mlx5/cmd.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@
3232

3333
#include "cmd.h"
3434

35+
int mlx5_cmd_dump_fill_mkey(struct mlx5_core_dev *dev, u32 *mkey)
36+
{
37+
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0};
38+
u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0};
39+
int err;
40+
41+
MLX5_SET(query_special_contexts_in, in, opcode,
42+
MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS);
43+
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
44+
if (!err)
45+
*mkey = MLX5_GET(query_special_contexts_out, out,
46+
dump_fill_mkey);
47+
return err;
48+
}
49+
3550
int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey)
3651
{
3752
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {};

drivers/infiniband/hw/mlx5/cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/kernel.h>
3838
#include <linux/mlx5/driver.h>
3939

40+
int mlx5_cmd_dump_fill_mkey(struct mlx5_core_dev *dev, u32 *mkey);
4041
int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey);
4142
int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point,
4243
void *out, int out_size);

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
config MLX5_CORE
6-
tristate "Mellanox Technologies ConnectX-4 and Connect-IB core driver"
6+
tristate "Mellanox 5th generation network adapters (ConnectX series) core driver"
77
depends on MAY_USE_DEVLINK
88
depends on PCI
99
imply PTP_1588_CLOCK
@@ -27,7 +27,7 @@ config MLX5_FPGA
2727
sandbox-specific client drivers.
2828

2929
config MLX5_CORE_EN
30-
bool "Mellanox Technologies ConnectX-4 Ethernet support"
30+
bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support"
3131
depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE
3232
depends on IPV6=y || IPV6=n || MLX5_CORE=m
3333
select PAGE_POOL
@@ -69,7 +69,7 @@ config MLX5_CORE_EN_DCB
6969
If unsure, set to Y
7070

7171
config MLX5_CORE_IPOIB
72-
bool "Mellanox Technologies ConnectX-4 IPoIB offloads support"
72+
bool "Mellanox 5th generation network adapters (connectX series) IPoIB offloads support"
7373
depends on MLX5_CORE_EN
7474
default n
7575
---help---

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

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
278278
case MLX5_CMD_OP_DESTROY_PSV:
279279
case MLX5_CMD_OP_DESTROY_SRQ:
280280
case MLX5_CMD_OP_DESTROY_XRC_SRQ:
281+
case MLX5_CMD_OP_DESTROY_XRQ:
281282
case MLX5_CMD_OP_DESTROY_DCT:
282283
case MLX5_CMD_OP_DEALLOC_Q_COUNTER:
283284
case MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT:
@@ -310,6 +311,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
310311
case MLX5_CMD_OP_DEALLOC_ENCAP_HEADER:
311312
case MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT:
312313
case MLX5_CMD_OP_FPGA_DESTROY_QP:
314+
case MLX5_CMD_OP_DESTROY_GENERAL_OBJECT:
313315
return MLX5_CMD_STAT_OK;
314316

315317
case MLX5_CMD_OP_QUERY_HCA_CAP:
@@ -346,6 +348,9 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
346348
case MLX5_CMD_OP_CREATE_XRC_SRQ:
347349
case MLX5_CMD_OP_QUERY_XRC_SRQ:
348350
case MLX5_CMD_OP_ARM_XRC_SRQ:
351+
case MLX5_CMD_OP_CREATE_XRQ:
352+
case MLX5_CMD_OP_QUERY_XRQ:
353+
case MLX5_CMD_OP_ARM_XRQ:
349354
case MLX5_CMD_OP_CREATE_DCT:
350355
case MLX5_CMD_OP_DRAIN_DCT:
351356
case MLX5_CMD_OP_QUERY_DCT:
@@ -427,6 +432,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
427432
case MLX5_CMD_OP_FPGA_MODIFY_QP:
428433
case MLX5_CMD_OP_FPGA_QUERY_QP:
429434
case MLX5_CMD_OP_FPGA_QUERY_QP_COUNTERS:
435+
case MLX5_CMD_OP_CREATE_GENERAL_OBJECT:
430436
*status = MLX5_DRIVER_STATUS_ABORTED;
431437
*synd = MLX5_DRIVER_SYND;
432438
return -EIO;
@@ -452,6 +458,7 @@ const char *mlx5_command_str(int command)
452458
MLX5_COMMAND_STR_CASE(SET_HCA_CAP);
453459
MLX5_COMMAND_STR_CASE(QUERY_ISSI);
454460
MLX5_COMMAND_STR_CASE(SET_ISSI);
461+
MLX5_COMMAND_STR_CASE(SET_DRIVER_VERSION);
455462
MLX5_COMMAND_STR_CASE(CREATE_MKEY);
456463
MLX5_COMMAND_STR_CASE(QUERY_MKEY);
457464
MLX5_COMMAND_STR_CASE(DESTROY_MKEY);
@@ -599,6 +606,12 @@ const char *mlx5_command_str(int command)
599606
MLX5_COMMAND_STR_CASE(FPGA_QUERY_QP);
600607
MLX5_COMMAND_STR_CASE(FPGA_QUERY_QP_COUNTERS);
601608
MLX5_COMMAND_STR_CASE(FPGA_DESTROY_QP);
609+
MLX5_COMMAND_STR_CASE(CREATE_XRQ);
610+
MLX5_COMMAND_STR_CASE(DESTROY_XRQ);
611+
MLX5_COMMAND_STR_CASE(QUERY_XRQ);
612+
MLX5_COMMAND_STR_CASE(ARM_XRQ);
613+
MLX5_COMMAND_STR_CASE(CREATE_GENERAL_OBJECT);
614+
MLX5_COMMAND_STR_CASE(DESTROY_GENERAL_OBJECT);
602615
default: return "unknown command opcode";
603616
}
604617
}
@@ -677,7 +690,7 @@ struct mlx5_ifc_mbox_out_bits {
677690

678691
struct mlx5_ifc_mbox_in_bits {
679692
u8 opcode[0x10];
680-
u8 reserved_at_10[0x10];
693+
u8 uid[0x10];
681694

682695
u8 reserved_at_20[0x10];
683696
u8 op_mod[0x10];
@@ -697,15 +710,23 @@ static int mlx5_cmd_check(struct mlx5_core_dev *dev, void *in, void *out)
697710
u8 status;
698711
u16 opcode;
699712
u16 op_mod;
713+
u16 uid;
700714

701715
mlx5_cmd_mbox_status(out, &status, &syndrome);
702716
if (!status)
703717
return 0;
704718

705719
opcode = MLX5_GET(mbox_in, in, opcode);
706720
op_mod = MLX5_GET(mbox_in, in, op_mod);
721+
uid = MLX5_GET(mbox_in, in, uid);
707722

708-
mlx5_core_err(dev,
723+
if (!uid && opcode != MLX5_CMD_OP_DESTROY_MKEY)
724+
mlx5_core_err_rl(dev,
725+
"%s(0x%x) op_mod(0x%x) failed, status %s(0x%x), syndrome (0x%x)\n",
726+
mlx5_command_str(opcode), opcode, op_mod,
727+
cmd_status_str(status), status, syndrome);
728+
else
729+
mlx5_core_dbg(dev,
709730
"%s(0x%x) op_mod(0x%x) failed, status %s(0x%x), syndrome (0x%x)\n",
710731
mlx5_command_str(opcode),
711732
opcode, op_mod,
@@ -1022,7 +1043,10 @@ static ssize_t dbg_write(struct file *filp, const char __user *buf,
10221043
if (!dbg->in_msg || !dbg->out_msg)
10231044
return -ENOMEM;
10241045

1025-
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
1046+
if (count < sizeof(lbuf) - 1)
1047+
return -EINVAL;
1048+
1049+
if (copy_from_user(lbuf, buf, sizeof(lbuf) - 1))
10261050
return -EFAULT;
10271051

10281052
lbuf[sizeof(lbuf) - 1] = 0;
@@ -1226,21 +1250,12 @@ static ssize_t data_read(struct file *filp, char __user *buf, size_t count,
12261250
{
12271251
struct mlx5_core_dev *dev = filp->private_data;
12281252
struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
1229-
int copy;
1230-
1231-
if (*pos)
1232-
return 0;
12331253

12341254
if (!dbg->out_msg)
12351255
return -ENOMEM;
12361256

1237-
copy = min_t(int, count, dbg->outlen);
1238-
if (copy_to_user(buf, dbg->out_msg, copy))
1239-
return -EFAULT;
1240-
1241-
*pos += copy;
1242-
1243-
return copy;
1257+
return simple_read_from_buffer(buf, count, pos, dbg->out_msg,
1258+
dbg->outlen);
12441259
}
12451260

12461261
static const struct file_operations dfops = {
@@ -1258,19 +1273,11 @@ static ssize_t outlen_read(struct file *filp, char __user *buf, size_t count,
12581273
char outlen[8];
12591274
int err;
12601275

1261-
if (*pos)
1262-
return 0;
1263-
12641276
err = snprintf(outlen, sizeof(outlen), "%d", dbg->outlen);
12651277
if (err < 0)
12661278
return err;
12671279

1268-
if (copy_to_user(buf, &outlen, err))
1269-
return -EFAULT;
1270-
1271-
*pos += err;
1272-
1273-
return err;
1280+
return simple_read_from_buffer(buf, count, pos, outlen, err);
12741281
}
12751282

12761283
static ssize_t outlen_write(struct file *filp, const char __user *buf,

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,13 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
150150
int ret;
151151
char tbuf[22];
152152

153-
if (*pos)
154-
return 0;
155-
156153
stats = filp->private_data;
157154
spin_lock_irq(&stats->lock);
158155
if (stats->n)
159156
field = div64_u64(stats->sum, stats->n);
160157
spin_unlock_irq(&stats->lock);
161158
ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field);
162-
if (ret > 0) {
163-
if (copy_to_user(buf, tbuf, ret))
164-
return -EFAULT;
165-
}
166-
167-
*pos += ret;
168-
return ret;
159+
return simple_read_from_buffer(buf, count, pos, tbuf, ret);
169160
}
170161

171162
static ssize_t average_write(struct file *filp, const char __user *buf,
@@ -442,9 +433,6 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count,
442433
u64 field;
443434
int ret;
444435

445-
if (*pos)
446-
return 0;
447-
448436
desc = filp->private_data;
449437
d = (void *)(desc - desc->i) - sizeof(*d);
450438
switch (d->type) {
@@ -470,13 +458,7 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count,
470458
else
471459
ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field);
472460

473-
if (ret > 0) {
474-
if (copy_to_user(buf, tbuf, ret))
475-
return -EFAULT;
476-
}
477-
478-
*pos += ret;
479-
return ret;
461+
return simple_read_from_buffer(buf, count, pos, tbuf, ret);
480462
}
481463

482464
static const struct file_operations fops = {

drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ TRACE_EVENT(mlx5_fs_del_fg,
138138
{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
139139
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH, "VLAN_PUSH"},\
140140
{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP, "VLAN_POP"},\
141+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2, "VLAN_PUSH_2"},\
142+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2, "VLAN_POP_2"},\
141143
{MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
142144

143145
TRACE_EVENT(mlx5_fs_set_fte,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
7070
flow_act.action &= ~(MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH |
7171
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP);
7272
else if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) {
73-
flow_act.vlan.ethtype = ntohs(attr->vlan_proto);
74-
flow_act.vlan.vid = attr->vlan_vid;
75-
flow_act.vlan.prio = attr->vlan_prio;
73+
flow_act.vlan[0].ethtype = ntohs(attr->vlan_proto);
74+
flow_act.vlan[0].vid = attr->vlan_vid;
75+
flow_act.vlan[0].prio = attr->vlan_prio;
7676
}
7777

7878
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
349349

350350
vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan);
351351

352-
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan.ethtype);
353-
MLX5_SET(vlan, vlan, vid, fte->action.vlan.vid);
354-
MLX5_SET(vlan, vlan, prio, fte->action.vlan.prio);
352+
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[0].ethtype);
353+
MLX5_SET(vlan, vlan, vid, fte->action.vlan[0].vid);
354+
MLX5_SET(vlan, vlan, prio, fte->action.vlan[0].prio);
355+
356+
vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan_2);
357+
358+
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[1].ethtype);
359+
MLX5_SET(vlan, vlan, vid, fte->action.vlan[1].vid);
360+
MLX5_SET(vlan, vlan, prio, fte->action.vlan[1].prio);
355361

356362
in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context,
357363
match_value);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,9 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
14651465
MLX5_FLOW_CONTEXT_ACTION_DECAP |
14661466
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
14671467
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP |
1468-
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH))
1468+
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH |
1469+
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 |
1470+
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2))
14691471
return true;
14701472

14711473
return false;
@@ -1824,7 +1826,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
18241826

18251827
g = alloc_auto_flow_group(ft, spec);
18261828
if (IS_ERR(g)) {
1827-
rule = (void *)g;
1829+
rule = ERR_CAST(g);
18281830
up_write_ref_node(&ft->node);
18291831
return rule;
18301832
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#include "lib/clock.h"
6565

6666
MODULE_AUTHOR("Eli Cohen <[email protected]>");
67-
MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver");
67+
MODULE_DESCRIPTION("Mellanox 5th generation network adapters (ConnectX series) core driver");
6868
MODULE_LICENSE("Dual BSD/GPL");
6969
MODULE_VERSION(DRIVER_VERSION);
7070

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ do { \
6666
__func__, __LINE__, current->pid, \
6767
##__VA_ARGS__)
6868

69+
#define mlx5_core_err_rl(__dev, format, ...) \
70+
dev_err_ratelimited(&(__dev)->pdev->dev, \
71+
"%s:%d:(pid %d): " format, \
72+
__func__, __LINE__, current->pid, \
73+
##__VA_ARGS__)
74+
6975
#define mlx5_core_warn(__dev, format, ...) \
7076
dev_warn(&(__dev)->pdev->dev, "%s:%d:(pid %d): " format, \
7177
__func__, __LINE__, current->pid, \

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,6 @@ int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey,
146146
}
147147
EXPORT_SYMBOL(mlx5_core_query_mkey);
148148

149-
int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey,
150-
u32 *mkey)
151-
{
152-
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0};
153-
u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0};
154-
int err;
155-
156-
MLX5_SET(query_special_contexts_in, in, opcode,
157-
MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS);
158-
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
159-
if (!err)
160-
*mkey = MLX5_GET(query_special_contexts_out, out,
161-
dump_fill_mkey);
162-
return err;
163-
}
164-
EXPORT_SYMBOL(mlx5_core_dump_fill_mkey);
165-
166149
static inline u32 mlx5_get_psv(u32 *out, int psv_index)
167150
{
168151
switch (psv_index) {

0 commit comments

Comments
 (0)