Skip to content

Commit e08a976

Browse files
author
Saeed Mahameed
committed
Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
Misc updates from mlx5-next branch: 1) Add the required HW definitions and structures for upcoming TLS support. 2) Add support for MCQI and MCQS hardware registers for fw version query. 3) Added hardware bits and structures definitions for sub-functions 4) Small code cleanup and improvement for PF pci driver. 5) Bluefield (ECPF) updates and refactoring for better E-Switch management on ECPF embedded CPU NIC: 5.1) Consolidate querying eswitch number of VFs 5.2) Register event handler at the correct E-Switch init stage 5.3) Setup PF's inline mode and vlan pop when the ECPF is the E-Swtich manager ( the host PF is basically a VF ). 5.4) Handle Vport UC address changes in switchdev mode. 6) Cleanup the rep and netdev reference when unloading IB rep. Signed-off-by: Saeed Mahameed <[email protected]> i# All conflicts fixed but you are still merging.
2 parents e2c7469 + f8efee0 commit e08a976

File tree

36 files changed

+786
-360
lines changed

36 files changed

+786
-360
lines changed

drivers/infiniband/hw/mlx5/cq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "mlx5_ib.h"
3838
#include "srq.h"
3939

40-
static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq)
40+
static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe)
4141
{
4242
struct ib_cq *ibcq = &to_mibcq(cq)->ibcq;
4343

@@ -891,6 +891,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
891891
int entries = attr->cqe;
892892
int vector = attr->comp_vector;
893893
struct mlx5_ib_dev *dev = to_mdev(ibdev);
894+
u32 out[MLX5_ST_SZ_DW(create_cq_out)];
894895
struct mlx5_ib_cq *cq;
895896
int uninitialized_var(index);
896897
int uninitialized_var(inlen);
@@ -958,7 +959,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
958959
if (cq->create_flags & IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN)
959960
MLX5_SET(cqc, cqc, oi, 1);
960961

961-
err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen);
962+
err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen, out, sizeof(out));
962963
if (err)
963964
goto err_cqb;
964965

drivers/infiniband/hw/mlx5/ib_rep.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
1414
int vport_index;
1515

1616
ibdev = mlx5_ib_get_uplink_ibdev(dev->priv.eswitch);
17-
vport_index = ibdev->free_port++;
17+
vport_index = rep->vport_index;
1818

1919
ibdev->port[vport_index].rep = rep;
20+
rep->rep_data[REP_IB].priv = ibdev;
2021
write_lock(&ibdev->port[vport_index].roce.netdev_lock);
2122
ibdev->port[vport_index].roce.netdev =
2223
mlx5_ib_get_rep_netdev(dev->priv.eswitch, rep->vport);
@@ -28,7 +29,7 @@ mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
2829
static int
2930
mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
3031
{
31-
int num_ports = MLX5_TOTAL_VPORTS(dev);
32+
int num_ports = mlx5_eswitch_get_total_vports(dev);
3233
const struct mlx5_ib_profile *profile;
3334
struct mlx5_ib_dev *ibdev;
3435
int vport_index;
@@ -50,7 +51,7 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
5051
}
5152

5253
ibdev->is_rep = true;
53-
vport_index = ibdev->free_port++;
54+
vport_index = rep->vport_index;
5455
ibdev->port[vport_index].rep = rep;
5556
ibdev->port[vport_index].roce.netdev =
5657
mlx5_ib_get_rep_netdev(dev->priv.eswitch, rep->vport);
@@ -68,15 +69,18 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
6869
static void
6970
mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
7071
{
71-
struct mlx5_ib_dev *dev;
72-
73-
if (!rep->rep_data[REP_IB].priv ||
74-
rep->vport != MLX5_VPORT_UPLINK)
75-
return;
72+
struct mlx5_ib_dev *dev = mlx5_ib_rep_to_dev(rep);
73+
struct mlx5_ib_port *port;
7674

77-
dev = mlx5_ib_rep_to_dev(rep);
78-
__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
75+
port = &dev->port[rep->vport_index];
76+
write_lock(&port->roce.netdev_lock);
77+
port->roce.netdev = NULL;
78+
write_unlock(&port->roce.netdev_lock);
7979
rep->rep_data[REP_IB].priv = NULL;
80+
port->rep = NULL;
81+
82+
if (rep->vport == MLX5_VPORT_UPLINK)
83+
__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
8084
}
8185

8286
static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)

drivers/infiniband/hw/mlx5/ib_rep.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
2828
#else /* CONFIG_MLX5_ESWITCH */
2929
static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
3030
{
31-
return SRIOV_NONE;
31+
return MLX5_ESWITCH_NONE;
3232
}
3333

3434
static inline

drivers/infiniband/hw/mlx5/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4492,7 +4492,7 @@ static void mlx5_ib_handle_internal_error(struct mlx5_ib_dev *ibdev)
44924492
* lock/unlock above locks Now need to arm all involved CQs.
44934493
*/
44944494
list_for_each_entry(mcq, &cq_armed_list, reset_notify) {
4495-
mcq->comp(mcq);
4495+
mcq->comp(mcq, NULL);
44964496
}
44974497
spin_unlock_irqrestore(&ibdev->reset_flow_resource_lock, flags);
44984498
}
@@ -6814,7 +6814,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
68146814
printk_once(KERN_INFO "%s", mlx5_version);
68156815

68166816
if (MLX5_ESWITCH_MANAGER(mdev) &&
6817-
mlx5_ib_eswitch_mode(mdev->priv.eswitch) == SRIOV_OFFLOADS) {
6817+
mlx5_ib_eswitch_mode(mdev->priv.eswitch) == MLX5_ESWITCH_OFFLOADS) {
68186818
if (!mlx5_core_mp_enabled(mdev))
68196819
mlx5_ib_register_vport_reps(mdev);
68206820
return mdev;

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ struct mlx5_ib_dev {
978978
u16 devx_whitelist_uid;
979979
struct mlx5_srq_table srq_table;
980980
struct mlx5_async_ctx async_ctx;
981-
int free_port;
982981
};
983982

984983
static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq)

drivers/infiniband/hw/mlx5/odp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,9 +1558,9 @@ mlx5_ib_create_pf_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)
15581558
eq->irq_nb.notifier_call = mlx5_ib_eq_pf_int;
15591559
param = (struct mlx5_eq_param) {
15601560
.irq_index = 0,
1561-
.mask = 1 << MLX5_EVENT_TYPE_PAGE_FAULT,
15621561
.nent = MLX5_IB_NUM_PF_EQE,
15631562
};
1563+
param.mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_FAULT;
15641564
eq->core = mlx5_eq_create_generic(dev->mdev, &param);
15651565
if (IS_ERR(eq->core)) {
15661566
err = PTR_ERR(eq->core);

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6297,7 +6297,7 @@ static void handle_drain_completion(struct ib_cq *cq,
62976297
/* Run the CQ handler - this makes sure that the drain WR will
62986298
* be processed if wasn't processed yet.
62996299
*/
6300-
mcq->mcq.comp(&mcq->mcq);
6300+
mcq->mcq.comp(&mcq->mcq, NULL);
63016301
}
63026302

63036303
wait_for_completion(&sdrain->done);

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void mlx5_cq_tasklet_cb(unsigned long data)
5858
list_for_each_entry_safe(mcq, temp, &ctx->process_list,
5959
tasklet_ctx.list) {
6060
list_del_init(&mcq->tasklet_ctx.list);
61-
mcq->tasklet_ctx.comp(mcq);
61+
mcq->tasklet_ctx.comp(mcq, NULL);
6262
mlx5_cq_put(mcq);
6363
if (time_after(jiffies, end))
6464
break;
@@ -68,7 +68,8 @@ void mlx5_cq_tasklet_cb(unsigned long data)
6868
tasklet_schedule(&ctx->task);
6969
}
7070

71-
static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq)
71+
static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,
72+
struct mlx5_eqe *eqe)
7273
{
7374
unsigned long flags;
7475
struct mlx5_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv;
@@ -87,11 +88,10 @@ static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq)
8788
}
8889

8990
int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
90-
u32 *in, int inlen)
91+
u32 *in, int inlen, u32 *out, int outlen)
9192
{
9293
int eqn = MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context), c_eqn);
9394
u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)];
94-
u32 out[MLX5_ST_SZ_DW(create_cq_out)];
9595
u32 din[MLX5_ST_SZ_DW(destroy_cq_in)];
9696
struct mlx5_eq_comp *eq;
9797
int err;
@@ -100,9 +100,9 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
100100
if (IS_ERR(eq))
101101
return PTR_ERR(eq);
102102

103-
memset(out, 0, sizeof(out));
103+
memset(out, 0, outlen);
104104
MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ);
105-
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
105+
err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
106106
if (err)
107107
return err;
108108

@@ -158,13 +158,8 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)
158158
u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {0};
159159
int err;
160160

161-
err = mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq);
162-
if (err)
163-
return err;
164-
165-
err = mlx5_eq_del_cq(&cq->eq->core, cq);
166-
if (err)
167-
return err;
161+
mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq);
162+
mlx5_eq_del_cq(&cq->eq->core, cq);
168163

169164
MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ);
170165
MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,20 @@ static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
311311
/* Must be called with intf_mutex held */
312312
struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
313313
{
314-
u32 pci_id = mlx5_gen_pci_id(dev);
315314
struct mlx5_core_dev *res = NULL;
316315
struct mlx5_core_dev *tmp_dev;
317316
struct mlx5_priv *priv;
317+
u32 pci_id;
318318

319+
if (!mlx5_core_is_pf(dev))
320+
return NULL;
321+
322+
pci_id = mlx5_gen_pci_id(dev);
319323
list_for_each_entry(priv, &mlx5_dev_list, dev_list) {
320324
tmp_dev = container_of(priv, struct mlx5_core_dev, priv);
325+
if (!mlx5_core_is_pf(tmp_dev))
326+
continue;
327+
321328
if ((dev != tmp_dev) && (mlx5_gen_pci_id(tmp_dev) == pci_id)) {
322329
res = tmp_dev;
323330
break;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
782782
struct mlx5e_tx_wqe *wqe, u16 pi, bool xmit_more);
783783

784784
void mlx5e_trigger_irq(struct mlx5e_icosq *sq);
785-
void mlx5e_completion_event(struct mlx5_core_cq *mcq);
785+
void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);
786786
void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
787787
int mlx5e_napi_poll(struct napi_struct *napi, int budget);
788788
bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);

0 commit comments

Comments
 (0)