diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/eq.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/eq.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 1e9b55eb7217..9129ace02560 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -513,25 +513,22 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave, | |||
513 | { | 513 | { |
514 | struct mlx4_priv *priv = mlx4_priv(dev); | 514 | struct mlx4_priv *priv = mlx4_priv(dev); |
515 | struct mlx4_slave_event_eq_info *event_eq = | 515 | struct mlx4_slave_event_eq_info *event_eq = |
516 | &priv->mfunc.master.slave_state[slave].event_eq; | 516 | priv->mfunc.master.slave_state[slave].event_eq; |
517 | u32 in_modifier = vhcr->in_modifier; | 517 | u32 in_modifier = vhcr->in_modifier; |
518 | u32 eqn = in_modifier & 0x1FF; | 518 | u32 eqn = in_modifier & 0x1FF; |
519 | u64 in_param = vhcr->in_param; | 519 | u64 in_param = vhcr->in_param; |
520 | int err = 0; | 520 | int err = 0; |
521 | int i; | ||
521 | 522 | ||
522 | if (slave == dev->caps.function) | 523 | if (slave == dev->caps.function) |
523 | err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn, | 524 | err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn, |
524 | 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B, | 525 | 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B, |
525 | MLX4_CMD_NATIVE); | 526 | MLX4_CMD_NATIVE); |
526 | if (!err) { | 527 | if (!err) |
527 | if (in_modifier >> 31) { | 528 | for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i) |
528 | /* unmap */ | 529 | if (in_param & (1LL << i)) |
529 | event_eq->event_type &= ~in_param; | 530 | event_eq[i].eqn = in_modifier >> 31 ? -1 : eqn; |
530 | } else { | 531 | |
531 | event_eq->eqn = eqn; | ||
532 | event_eq->event_type = in_param; | ||
533 | } | ||
534 | } | ||
535 | return err; | 532 | return err; |
536 | } | 533 | } |
537 | 534 | ||
@@ -546,7 +543,7 @@ static int mlx4_MAP_EQ(struct mlx4_dev *dev, u64 event_mask, int unmap, | |||
546 | static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 543 | static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
547 | int eq_num) | 544 | int eq_num) |
548 | { | 545 | { |
549 | return mlx4_cmd(dev, mailbox->dma | dev->caps.function, eq_num, 0, | 546 | return mlx4_cmd(dev, mailbox->dma, eq_num, 0, |
550 | MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, | 547 | MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, |
551 | MLX4_CMD_WRAPPED); | 548 | MLX4_CMD_WRAPPED); |
552 | } | 549 | } |
@@ -554,7 +551,7 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | |||
554 | static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 551 | static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
555 | int eq_num) | 552 | int eq_num) |
556 | { | 553 | { |
557 | return mlx4_cmd_box(dev, dev->caps.function, mailbox->dma, eq_num, | 554 | return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num, |
558 | 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, | 555 | 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, |
559 | MLX4_CMD_WRAPPED); | 556 | MLX4_CMD_WRAPPED); |
560 | } | 557 | } |
@@ -818,8 +815,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) | |||
818 | int err; | 815 | int err; |
819 | int i; | 816 | int i; |
820 | 817 | ||
821 | priv->eq_table.uar_map = kcalloc(sizeof *priv->eq_table.uar_map, | 818 | priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev), |
822 | mlx4_num_eq_uar(dev), GFP_KERNEL); | 819 | sizeof *priv->eq_table.uar_map, |
820 | GFP_KERNEL); | ||
823 | if (!priv->eq_table.uar_map) { | 821 | if (!priv->eq_table.uar_map) { |
824 | err = -ENOMEM; | 822 | err = -ENOMEM; |
825 | goto err_out_free; | 823 | goto err_out_free; |
@@ -1038,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector) | |||
1038 | struct mlx4_priv *priv = mlx4_priv(dev); | 1036 | struct mlx4_priv *priv = mlx4_priv(dev); |
1039 | int vec = 0, err = 0, i; | 1037 | int vec = 0, err = 0, i; |
1040 | 1038 | ||
1041 | spin_lock(&priv->msix_ctl.pool_lock); | 1039 | mutex_lock(&priv->msix_ctl.pool_lock); |
1042 | for (i = 0; !vec && i < dev->caps.comp_pool; i++) { | 1040 | for (i = 0; !vec && i < dev->caps.comp_pool; i++) { |
1043 | if (~priv->msix_ctl.pool_bm & 1ULL << i) { | 1041 | if (~priv->msix_ctl.pool_bm & 1ULL << i) { |
1044 | priv->msix_ctl.pool_bm |= 1ULL << i; | 1042 | priv->msix_ctl.pool_bm |= 1ULL << i; |
@@ -1060,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector) | |||
1060 | eq_set_ci(&priv->eq_table.eq[vec], 1); | 1058 | eq_set_ci(&priv->eq_table.eq[vec], 1); |
1061 | } | 1059 | } |
1062 | } | 1060 | } |
1063 | spin_unlock(&priv->msix_ctl.pool_lock); | 1061 | mutex_unlock(&priv->msix_ctl.pool_lock); |
1064 | 1062 | ||
1065 | if (vec) { | 1063 | if (vec) { |
1066 | *vector = vec; | 1064 | *vector = vec; |
@@ -1081,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) | |||
1081 | if (likely(i >= 0)) { | 1079 | if (likely(i >= 0)) { |
1082 | /*sanity check , making sure were not trying to free irq's | 1080 | /*sanity check , making sure were not trying to free irq's |
1083 | Belonging to a legacy EQ*/ | 1081 | Belonging to a legacy EQ*/ |
1084 | spin_lock(&priv->msix_ctl.pool_lock); | 1082 | mutex_lock(&priv->msix_ctl.pool_lock); |
1085 | if (priv->msix_ctl.pool_bm & 1ULL << i) { | 1083 | if (priv->msix_ctl.pool_bm & 1ULL << i) { |
1086 | free_irq(priv->eq_table.eq[vec].irq, | 1084 | free_irq(priv->eq_table.eq[vec].irq, |
1087 | &priv->eq_table.eq[vec]); | 1085 | &priv->eq_table.eq[vec]); |
1088 | priv->msix_ctl.pool_bm &= ~(1ULL << i); | 1086 | priv->msix_ctl.pool_bm &= ~(1ULL << i); |
1089 | } | 1087 | } |
1090 | spin_unlock(&priv->msix_ctl.pool_lock); | 1088 | mutex_unlock(&priv->msix_ctl.pool_lock); |
1091 | } | 1089 | } |
1092 | 1090 | ||
1093 | } | 1091 | } |