diff options
author | Doron Tsur <doront@mellanox.com> | 2016-01-17 04:25:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-17 12:08:04 -0500 |
commit | 0b6e26ce89391327d955a756a7823272238eb867 (patch) | |
tree | d1f06474ae9397bd652e8ff75014620c3713aaa4 | |
parent | cdb00777ffadb15b06627dd6c3f716a02f6b36e8 (diff) |
net/mlx5_core: Fix trimming down IRQ number
With several ConnectX-4 cards installed on a server, one may receive
irqn > 255 from the kernel API, which we mistakenly trim to 8bit.
This causes EQ creation failure with the following stack trace:
[<ffffffff812a11f4>] dump_stack+0x48/0x64
[<ffffffff810ace21>] __setup_irq+0x3a1/0x4f0
[<ffffffff810ad7e0>] request_threaded_irq+0x120/0x180
[<ffffffffa0923660>] ? mlx5_eq_int+0x450/0x450 [mlx5_core]
[<ffffffffa0922f64>] mlx5_create_map_eq+0x1e4/0x2b0 [mlx5_core]
[<ffffffffa091de01>] alloc_comp_eqs+0xb1/0x180 [mlx5_core]
[<ffffffffa091ea99>] mlx5_dev_init+0x5e9/0x6e0 [mlx5_core]
[<ffffffffa091ec29>] init_one+0x99/0x1c0 [mlx5_core]
[<ffffffff812e2afc>] local_pci_probe+0x4c/0xa0
Fixing it by changing of the irqn type from u8 to unsigned int to
support values > 255
Fixes: 61d0e73e0a5a ('net/mlx5_core: Use the the real irqn in eq->irqn')
Reported-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Doron Tsur <doront@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/mlx5/cq.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 | ||||
-rw-r--r-- | include/linux/mlx5/cq.h | 2 | ||||
-rw-r--r-- | include/linux/mlx5/driver.h | 5 |
5 files changed, 10 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index 3dfd287256d6..92ddae101ecc 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c | |||
@@ -756,7 +756,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, | |||
756 | int uninitialized_var(index); | 756 | int uninitialized_var(index); |
757 | int uninitialized_var(inlen); | 757 | int uninitialized_var(inlen); |
758 | int cqe_size; | 758 | int cqe_size; |
759 | int irqn; | 759 | unsigned int irqn; |
760 | int eqn; | 760 | int eqn; |
761 | int err; | 761 | int err; |
762 | 762 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 5c74a734f158..c56d91a2812b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -752,7 +752,7 @@ static int mlx5e_create_cq(struct mlx5e_channel *c, | |||
752 | struct mlx5_core_dev *mdev = priv->mdev; | 752 | struct mlx5_core_dev *mdev = priv->mdev; |
753 | struct mlx5_core_cq *mcq = &cq->mcq; | 753 | struct mlx5_core_cq *mcq = &cq->mcq; |
754 | int eqn_not_used; | 754 | int eqn_not_used; |
755 | int irqn; | 755 | unsigned int irqn; |
756 | int err; | 756 | int err; |
757 | u32 i; | 757 | u32 i; |
758 | 758 | ||
@@ -806,7 +806,7 @@ static int mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param) | |||
806 | void *in; | 806 | void *in; |
807 | void *cqc; | 807 | void *cqc; |
808 | int inlen; | 808 | int inlen; |
809 | int irqn_not_used; | 809 | unsigned int irqn_not_used; |
810 | int eqn; | 810 | int eqn; |
811 | int err; | 811 | int err; |
812 | 812 | ||
@@ -1517,7 +1517,7 @@ static int mlx5e_create_drop_cq(struct mlx5e_priv *priv, | |||
1517 | struct mlx5_core_dev *mdev = priv->mdev; | 1517 | struct mlx5_core_dev *mdev = priv->mdev; |
1518 | struct mlx5_core_cq *mcq = &cq->mcq; | 1518 | struct mlx5_core_cq *mcq = &cq->mcq; |
1519 | int eqn_not_used; | 1519 | int eqn_not_used; |
1520 | int irqn; | 1520 | unsigned int irqn; |
1521 | int err; | 1521 | int err; |
1522 | 1522 | ||
1523 | err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq, | 1523 | err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 67676cf0d507..b37749a3730e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -585,7 +585,8 @@ static void mlx5_irq_clear_affinity_hints(struct mlx5_core_dev *mdev) | |||
585 | mlx5_irq_clear_affinity_hint(mdev, i); | 585 | mlx5_irq_clear_affinity_hint(mdev, i); |
586 | } | 586 | } |
587 | 587 | ||
588 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn) | 588 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, |
589 | unsigned int *irqn) | ||
589 | { | 590 | { |
590 | struct mlx5_eq_table *table = &dev->priv.eq_table; | 591 | struct mlx5_eq_table *table = &dev->priv.eq_table; |
591 | struct mlx5_eq *eq, *n; | 592 | struct mlx5_eq *eq, *n; |
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h index abc4767695e4..b2c9fada8eac 100644 --- a/include/linux/mlx5/cq.h +++ b/include/linux/mlx5/cq.h | |||
@@ -45,7 +45,7 @@ struct mlx5_core_cq { | |||
45 | atomic_t refcount; | 45 | atomic_t refcount; |
46 | struct completion free; | 46 | struct completion free; |
47 | unsigned vector; | 47 | unsigned vector; |
48 | int irqn; | 48 | unsigned int irqn; |
49 | void (*comp) (struct mlx5_core_cq *); | 49 | void (*comp) (struct mlx5_core_cq *); |
50 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); | 50 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); |
51 | struct mlx5_uar *uar; | 51 | struct mlx5_uar *uar; |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 2fd7019f69db..5162f3533042 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -303,7 +303,7 @@ struct mlx5_eq { | |||
303 | u32 cons_index; | 303 | u32 cons_index; |
304 | struct mlx5_buf buf; | 304 | struct mlx5_buf buf; |
305 | int size; | 305 | int size; |
306 | u8 irqn; | 306 | unsigned int irqn; |
307 | u8 eqn; | 307 | u8 eqn; |
308 | int nent; | 308 | int nent; |
309 | u64 mask; | 309 | u64 mask; |
@@ -783,7 +783,8 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, | |||
783 | int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 783 | int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); |
784 | int mlx5_start_eqs(struct mlx5_core_dev *dev); | 784 | int mlx5_start_eqs(struct mlx5_core_dev *dev); |
785 | int mlx5_stop_eqs(struct mlx5_core_dev *dev); | 785 | int mlx5_stop_eqs(struct mlx5_core_dev *dev); |
786 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn); | 786 | int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, |
787 | unsigned int *irqn); | ||
787 | int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); | 788 | int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); |
788 | int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); | 789 | int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); |
789 | 790 | ||