Lines Matching refs:eq
97 static void eq_set_ci(struct mlx4_eq *eq, int req_not) in eq_set_ci() argument
99 __raw_writel((__force u32) cpu_to_be32((eq->cons_index & 0xffffff) | in eq_set_ci()
101 eq->doorbell); in eq_set_ci()
106 static struct mlx4_eqe *get_eqe(struct mlx4_eq *eq, u32 entry, u8 eqe_factor, in get_eqe() argument
110 unsigned long offset = (entry & (eq->nent - 1)) * eqe_size; in get_eqe()
118 …return eq->page_list[offset / PAGE_SIZE].buf + (offset + (eqe_factor ? MLX4_EQ_ENTRY_SIZE : 0)) % … in get_eqe()
121 static struct mlx4_eqe *next_eqe_sw(struct mlx4_eq *eq, u8 eqe_factor, u8 size) in next_eqe_sw() argument
123 struct mlx4_eqe *eqe = get_eqe(eq, eq->cons_index, eqe_factor, size); in next_eqe_sw()
124 return !!(eqe->owner & 0x80) ^ !!(eq->cons_index & eq->nent) ? NULL : eqe; in next_eqe_sw()
241 struct mlx4_eq *eq = &priv->eq_table.eq[vec]; in mlx4_set_eq_affinity_hint() local
243 if (!cpumask_available(eq->affinity_mask) || in mlx4_set_eq_affinity_hint()
244 cpumask_empty(eq->affinity_mask)) in mlx4_set_eq_affinity_hint()
247 hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask); in mlx4_set_eq_affinity_hint()
494 static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq) in mlx4_eq_int() argument
512 while ((eqe = next_eqe_sw(eq, dev->caps.eqe_factor, eqe_size))) { in mlx4_eq_int()
543 eq->eqn, eq->cons_index, ret); in mlx4_eq_int()
560 eq->eqn); in mlx4_eq_int()
573 eq->eqn, eq->cons_index, ret); in mlx4_eq_int()
697 eq->eqn, eq->cons_index, ret); in mlx4_eq_int()
713 mlx4_warn(dev, "EQ overrun on EQN %d\n", eq->eqn); in mlx4_eq_int()
781 eqe->type, eqe->subtype, eq->eqn, in mlx4_eq_int()
782 eq->cons_index, eqe->owner, eq->nent, in mlx4_eq_int()
785 !!(eq->cons_index & eq->nent) ? "HW" : "SW"); in mlx4_eq_int()
806 eqe->type, eqe->subtype, eq->eqn, in mlx4_eq_int()
807 eq->cons_index, eqe->owner, eq->nent, in mlx4_eq_int()
809 !!(eq->cons_index & eq->nent) ? "HW" : "SW"); in mlx4_eq_int()
818 eqe->type, eqe->subtype, eq->eqn, in mlx4_eq_int()
819 eq->cons_index, eqe->owner, eq->nent, in mlx4_eq_int()
822 !!(eq->cons_index & eq->nent) ? "HW" : "SW"); in mlx4_eq_int()
826 ++eq->cons_index; in mlx4_eq_int()
838 eq_set_ci(eq, 0); in mlx4_eq_int()
843 eq_set_ci(eq, 1); in mlx4_eq_int()
858 work |= mlx4_eq_int(dev, &priv->eq_table.eq[i]); in mlx4_interrupt()
865 struct mlx4_eq *eq = eq_ptr; in mlx4_msi_x_interrupt() local
866 struct mlx4_dev *dev = eq->dev; in mlx4_msi_x_interrupt()
868 mlx4_eq_int(dev, eq); in mlx4_msi_x_interrupt()
934 static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq) in mlx4_get_eq_uar() argument
939 index = eq->eqn / 4 - dev->caps.reserved_eqs / 4; in mlx4_get_eq_uar()
945 ((eq->eqn / 4) << (dev->uar_page_shift)), in mlx4_get_eq_uar()
949 eq->eqn); in mlx4_get_eq_uar()
954 return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); in mlx4_get_eq_uar()
970 u8 intr, struct mlx4_eq *eq) in mlx4_create_eq() argument
982 eq->dev = dev; in mlx4_create_eq()
983 eq->nent = roundup_pow_of_two(max(nent, 2)); in mlx4_create_eq()
987 npages = PAGE_ALIGN(eq->nent * dev->caps.eqe_size) / PAGE_SIZE; in mlx4_create_eq()
989 eq->page_list = kmalloc_array(npages, sizeof(*eq->page_list), in mlx4_create_eq()
991 if (!eq->page_list) in mlx4_create_eq()
995 eq->page_list[i].buf = NULL; in mlx4_create_eq()
1007 eq->page_list[i].buf = dma_alloc_coherent(&dev->persist-> in mlx4_create_eq()
1011 if (!eq->page_list[i].buf) in mlx4_create_eq()
1015 eq->page_list[i].map = t; in mlx4_create_eq()
1018 eq->eqn = mlx4_bitmap_alloc(&priv->eq_table.bitmap); in mlx4_create_eq()
1019 if (eq->eqn == -1) in mlx4_create_eq()
1022 eq->doorbell = mlx4_get_eq_uar(dev, eq); in mlx4_create_eq()
1023 if (!eq->doorbell) { in mlx4_create_eq()
1028 err = mlx4_mtt_init(dev, npages, PAGE_SHIFT, &eq->mtt); in mlx4_create_eq()
1032 err = mlx4_write_mtt(dev, &eq->mtt, 0, npages, dma_list); in mlx4_create_eq()
1038 eq_context->log_eq_size = ilog2(eq->nent); in mlx4_create_eq()
1042 mtt_addr = mlx4_mtt_addr(dev, &eq->mtt); in mlx4_create_eq()
1046 err = mlx4_SW2HW_EQ(dev, mailbox, eq->eqn); in mlx4_create_eq()
1055 eq->cons_index = 0; in mlx4_create_eq()
1057 INIT_LIST_HEAD(&eq->tasklet_ctx.list); in mlx4_create_eq()
1058 INIT_LIST_HEAD(&eq->tasklet_ctx.process_list); in mlx4_create_eq()
1059 spin_lock_init(&eq->tasklet_ctx.lock); in mlx4_create_eq()
1060 tasklet_setup(&eq->tasklet_ctx.task, mlx4_cq_tasklet_cb); in mlx4_create_eq()
1065 mlx4_mtt_cleanup(dev, &eq->mtt); in mlx4_create_eq()
1068 mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn, MLX4_USE_RR); in mlx4_create_eq()
1072 if (eq->page_list[i].buf) in mlx4_create_eq()
1074 eq->page_list[i].buf, in mlx4_create_eq()
1075 eq->page_list[i].map); in mlx4_create_eq()
1080 kfree(eq->page_list); in mlx4_create_eq()
1088 struct mlx4_eq *eq) in mlx4_free_eq() argument
1096 int npages = PAGE_ALIGN(dev->caps.eqe_size * eq->nent) / PAGE_SIZE; in mlx4_free_eq()
1098 err = mlx4_HW2SW_EQ(dev, eq->eqn); in mlx4_free_eq()
1102 synchronize_irq(eq->irq); in mlx4_free_eq()
1103 tasklet_disable(&eq->tasklet_ctx.task); in mlx4_free_eq()
1105 mlx4_mtt_cleanup(dev, &eq->mtt); in mlx4_free_eq()
1108 eq->page_list[i].buf, in mlx4_free_eq()
1109 eq->page_list[i].map); in mlx4_free_eq()
1111 kfree(eq->page_list); in mlx4_free_eq()
1112 mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn, MLX4_USE_RR); in mlx4_free_eq()
1124 if (eq_table->eq[i].have_irq) { in mlx4_free_irqs()
1125 free_cpumask_var(eq_table->eq[i].affinity_mask); in mlx4_free_irqs()
1127 irq_set_affinity_hint(eq_table->eq[i].irq, NULL); in mlx4_free_irqs()
1129 free_irq(eq_table->eq[i].irq, eq_table->eq + i); in mlx4_free_irqs()
1130 eq_table->eq[i].have_irq = 0; in mlx4_free_irqs()
1162 priv->eq_table.eq = kcalloc(dev->caps.num_eqs - dev->caps.reserved_eqs, in mlx4_alloc_eq_table()
1163 sizeof(*priv->eq_table.eq), GFP_KERNEL); in mlx4_alloc_eq_table()
1164 if (!priv->eq_table.eq) in mlx4_alloc_eq_table()
1172 kfree(mlx4_priv(dev)->eq_table.eq); in mlx4_free_eq_table()
1225 0, &priv->eq_table.eq[MLX4_EQ_ASYNC]); in mlx4_init_eq_table()
1227 struct mlx4_eq *eq = &priv->eq_table.eq[i]; in mlx4_init_eq_table() local
1229 int port = find_first_bit(eq->actv_ports.ports, in mlx4_init_eq_table()
1247 info->rmap, eq->irq); in mlx4_init_eq_table()
1256 eq); in mlx4_init_eq_table()
1273 err = request_irq(priv->eq_table.eq[MLX4_EQ_ASYNC].irq, in mlx4_init_eq_table()
1275 priv->eq_table.eq + MLX4_EQ_ASYNC); in mlx4_init_eq_table()
1279 priv->eq_table.eq[MLX4_EQ_ASYNC].have_irq = 1; in mlx4_init_eq_table()
1294 priv->eq_table.eq[MLX4_EQ_ASYNC].eqn); in mlx4_init_eq_table()
1297 priv->eq_table.eq[MLX4_EQ_ASYNC].eqn, err); in mlx4_init_eq_table()
1300 eq_set_ci(&priv->eq_table.eq[MLX4_EQ_ASYNC], 1); in mlx4_init_eq_table()
1306 mlx4_free_eq(dev, &priv->eq_table.eq[--i]); in mlx4_init_eq_table()
1337 priv->eq_table.eq[MLX4_EQ_ASYNC].eqn); in mlx4_cleanup_eq_table()
1350 mlx4_free_eq(dev, &priv->eq_table.eq[i]); in mlx4_cleanup_eq_table()
1384 priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(vector)].eqn); in mlx4_test_interrupt()
1398 priv->eq_table.eq[MLX4_EQ_ASYNC].eqn); in mlx4_test_interrupt()
1414 return test_bit(port - 1, priv->eq_table.eq[vector].actv_ports.ports); in mlx4_is_eq_vector_valid()
1426 priv->eq_table.eq[i].actv_ports.ports); in mlx4_get_eqs_per_port()
1440 return !!(bitmap_weight(priv->eq_table.eq[vector].actv_ports.ports, in mlx4_is_eq_shared()
1465 priv->eq_table.eq[requested_vector].actv_ports.ports)) { in mlx4_assign_eq()
1468 struct mlx4_eq *eq; in mlx4_assign_eq() local
1474 eq = &priv->eq_table.eq[requested_vector]; in mlx4_assign_eq()
1476 test_bit(port - 1, eq->actv_ports.ports)) { in mlx4_assign_eq()
1486 struct mlx4_eq *eq = &priv->eq_table.eq[i]; in mlx4_assign_eq() local
1488 if (min_ref_count_val > eq->ref_count && in mlx4_assign_eq()
1489 test_bit(port - 1, eq->actv_ports.ports)) { in mlx4_assign_eq()
1490 min_ref_count_val = eq->ref_count; in mlx4_assign_eq()
1511 err = request_irq(priv->eq_table.eq[*prequested_vector].irq, in mlx4_assign_eq()
1514 priv->eq_table.eq + *prequested_vector); in mlx4_assign_eq()
1523 eq_set_ci(&priv->eq_table.eq[*prequested_vector], 1); in mlx4_assign_eq()
1524 priv->eq_table.eq[*prequested_vector].have_irq = 1; in mlx4_assign_eq()
1529 priv->eq_table.eq[*prequested_vector].ref_count++; in mlx4_assign_eq()
1547 return priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(cq_vec)].irq; in mlx4_eq_get_irq()
1557 priv->eq_table.eq[eq_vec].ref_count--; in mlx4_release_eq()