2 * Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved.
3 * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved.
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 #include <linux/init.h>
35 #include <linux/interrupt.h>
36 #include <linux/slab.h>
38 #include <linux/dma-mapping.h>
40 #include <linux/mlx4/cmd.h>
46 MLX4_IRQNAME_SIZE = 32
50 MLX4_NUM_ASYNC_EQE = 0x100,
51 MLX4_NUM_SPARE_EQE = 0x80,
52 MLX4_EQ_ENTRY_SIZE = 0x20
55 #define MLX4_EQ_STATUS_OK ( 0 << 28)
56 #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28)
57 #define MLX4_EQ_OWNER_SW ( 0 << 24)
58 #define MLX4_EQ_OWNER_HW ( 1 << 24)
59 #define MLX4_EQ_FLAG_EC ( 1 << 18)
60 #define MLX4_EQ_FLAG_OI ( 1 << 17)
61 #define MLX4_EQ_STATE_ARMED ( 9 << 8)
62 #define MLX4_EQ_STATE_FIRED (10 << 8)
63 #define MLX4_EQ_STATE_ALWAYS_ARMED (11 << 8)
65 #define MLX4_ASYNC_EVENT_MASK ((1ull << MLX4_EVENT_TYPE_PATH_MIG) | \
66 (1ull << MLX4_EVENT_TYPE_COMM_EST) | \
67 (1ull << MLX4_EVENT_TYPE_SQ_DRAINED) | \
68 (1ull << MLX4_EVENT_TYPE_CQ_ERROR) | \
69 (1ull << MLX4_EVENT_TYPE_WQ_CATAS_ERROR) | \
70 (1ull << MLX4_EVENT_TYPE_EEC_CATAS_ERROR) | \
71 (1ull << MLX4_EVENT_TYPE_PATH_MIG_FAILED) | \
72 (1ull << MLX4_EVENT_TYPE_WQ_INVAL_REQ_ERROR) | \
73 (1ull << MLX4_EVENT_TYPE_WQ_ACCESS_ERROR) | \
74 (1ull << MLX4_EVENT_TYPE_PORT_CHANGE) | \
75 (1ull << MLX4_EVENT_TYPE_ECC_DETECT) | \
76 (1ull << MLX4_EVENT_TYPE_SRQ_CATAS_ERROR) | \
77 (1ull << MLX4_EVENT_TYPE_SRQ_QP_LAST_WQE) | \
78 (1ull << MLX4_EVENT_TYPE_SRQ_LIMIT) | \
79 (1ull << MLX4_EVENT_TYPE_CMD) | \
80 (1ull << MLX4_EVENT_TYPE_OP_REQUIRED) | \
81 (1ull << MLX4_EVENT_TYPE_COMM_CHANNEL) | \
82 (1ull << MLX4_EVENT_TYPE_FLR_EVENT) | \
83 (1ull << MLX4_EVENT_TYPE_FATAL_WARNING))
85 static u64 get_async_ev_mask(struct mlx4_dev *dev)
87 u64 async_ev_mask = MLX4_ASYNC_EVENT_MASK;
88 if (dev->caps.flags & MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV)
89 async_ev_mask |= (1ull << MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT);
94 static void eq_set_ci(struct mlx4_eq *eq, int req_not)
96 __raw_writel((__force u32) cpu_to_be32((eq->cons_index & 0xffffff) |
99 /* We still want ordering, just not swabbing, so add a barrier */
103 static struct mlx4_eqe *get_eqe(struct mlx4_eq *eq, u32 entry, u8 eqe_factor)
105 /* (entry & (eq->nent - 1)) gives us a cyclic array */
106 unsigned long offset = (entry & (eq->nent - 1)) * (MLX4_EQ_ENTRY_SIZE << eqe_factor);
107 /* CX3 is capable of extending the EQE from 32 to 64 bytes.
108 * When this feature is enabled, the first (in the lower addresses)
109 * 32 bytes in the 64 byte EQE are reserved and the next 32 bytes
110 * contain the legacy EQE information.
112 return eq->page_list[offset / PAGE_SIZE].buf + (offset + (eqe_factor ? MLX4_EQ_ENTRY_SIZE : 0)) % PAGE_SIZE;
115 static struct mlx4_eqe *next_eqe_sw(struct mlx4_eq *eq, u8 eqe_factor)
117 struct mlx4_eqe *eqe = get_eqe(eq, eq->cons_index, eqe_factor);
118 return !!(eqe->owner & 0x80) ^ !!(eq->cons_index & eq->nent) ? NULL : eqe;
121 static struct mlx4_eqe *next_slave_event_eqe(struct mlx4_slave_event_eq *slave_eq)
123 struct mlx4_eqe *eqe =
124 &slave_eq->event_eqe[slave_eq->cons & (SLAVE_EVENT_EQ_SIZE - 1)];
125 return (!!(eqe->owner & 0x80) ^
126 !!(slave_eq->cons & SLAVE_EVENT_EQ_SIZE)) ?
130 void mlx4_gen_slave_eqe(struct work_struct *work)
132 struct mlx4_mfunc_master_ctx *master =
133 container_of(work, struct mlx4_mfunc_master_ctx,
135 struct mlx4_mfunc *mfunc =
136 container_of(master, struct mlx4_mfunc, master);
137 struct mlx4_priv *priv = container_of(mfunc, struct mlx4_priv, mfunc);
138 struct mlx4_dev *dev = &priv->dev;
139 struct mlx4_slave_event_eq *slave_eq = &mfunc->master.slave_eq;
140 struct mlx4_eqe *eqe;
144 for (eqe = next_slave_event_eqe(slave_eq); eqe;
145 eqe = next_slave_event_eqe(slave_eq)) {
146 slave = eqe->slave_id;
148 /* All active slaves need to receive the event */
149 if (slave == ALL_SLAVES) {
150 for (i = 0; i < dev->num_slaves; i++) {
151 if (i != dev->caps.function &&
152 master->slave_state[i].active)
153 if (mlx4_GEN_EQE(dev, i, eqe))
154 mlx4_warn(dev, "Failed to "
156 "for slave %d\n", i);
159 if (mlx4_GEN_EQE(dev, slave, eqe))
160 mlx4_warn(dev, "Failed to generate event "
161 "for slave %d\n", slave);
168 static void slave_event(struct mlx4_dev *dev, u8 slave, struct mlx4_eqe *eqe)
170 struct mlx4_priv *priv = mlx4_priv(dev);
171 struct mlx4_slave_event_eq *slave_eq = &priv->mfunc.master.slave_eq;
172 struct mlx4_eqe *s_eqe;
175 spin_lock_irqsave(&slave_eq->event_lock, flags);
176 s_eqe = &slave_eq->event_eqe[slave_eq->prod & (SLAVE_EVENT_EQ_SIZE - 1)];
177 if ((!!(s_eqe->owner & 0x80)) ^
178 (!!(slave_eq->prod & SLAVE_EVENT_EQ_SIZE))) {
179 mlx4_warn(dev, "Master failed to generate an EQE for slave: %d. "
180 "No free EQE on slave events queue\n", slave);
181 spin_unlock_irqrestore(&slave_eq->event_lock, flags);
185 memcpy(s_eqe, eqe, dev->caps.eqe_size - 1);
186 s_eqe->slave_id = slave;
187 /* ensure all information is written before setting the ownersip bit */
189 s_eqe->owner = !!(slave_eq->prod & SLAVE_EVENT_EQ_SIZE) ? 0x0 : 0x80;
192 queue_work(priv->mfunc.master.comm_wq,
193 &priv->mfunc.master.slave_event_work);
194 spin_unlock_irqrestore(&slave_eq->event_lock, flags);
197 static void mlx4_slave_event(struct mlx4_dev *dev, int slave,
198 struct mlx4_eqe *eqe)
200 struct mlx4_priv *priv = mlx4_priv(dev);
201 struct mlx4_slave_state *s_slave =
202 &priv->mfunc.master.slave_state[slave];
204 if (!s_slave->active) {
205 /*mlx4_warn(dev, "Trying to pass event to inactive slave\n");*/
209 slave_event(dev, slave, eqe);
212 int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port)
216 struct mlx4_priv *priv = mlx4_priv(dev);
217 struct mlx4_slave_state *s_slave = &priv->mfunc.master.slave_state[slave];
219 if (!s_slave->active)
222 memset(&eqe, 0, sizeof eqe);
224 eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
225 eqe.subtype = MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE;
226 eqe.event.port_mgmt_change.port = port;
228 return mlx4_GEN_EQE(dev, slave, &eqe);
230 EXPORT_SYMBOL(mlx4_gen_pkey_eqe);
232 int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port)
236 /*don't send if we don't have the that slave */
237 if (dev->num_vfs < slave)
239 memset(&eqe, 0, sizeof eqe);
241 eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
242 eqe.subtype = MLX4_DEV_PMC_SUBTYPE_GUID_INFO;
243 eqe.event.port_mgmt_change.port = port;
245 return mlx4_GEN_EQE(dev, slave, &eqe);
247 EXPORT_SYMBOL(mlx4_gen_guid_change_eqe);
249 int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port,
250 u8 port_subtype_change)
254 /*don't send if we don't have the that slave */
255 if (dev->num_vfs < slave)
257 memset(&eqe, 0, sizeof eqe);
259 eqe.type = MLX4_EVENT_TYPE_PORT_CHANGE;
260 eqe.subtype = port_subtype_change;
261 eqe.event.port_change.port = cpu_to_be32(port << 28);
263 mlx4_dbg(dev, "%s: sending: %d to slave: %d on port: %d\n", __func__,
264 port_subtype_change, slave, port);
265 return mlx4_GEN_EQE(dev, slave, &eqe);
267 EXPORT_SYMBOL(mlx4_gen_port_state_change_eqe);
269 enum slave_port_state mlx4_get_slave_port_state(struct mlx4_dev *dev, int slave, u8 port)
271 struct mlx4_priv *priv = mlx4_priv(dev);
272 struct mlx4_slave_state *s_state = priv->mfunc.master.slave_state;
273 if (slave >= dev->num_slaves || port > MLX4_MAX_PORTS) {
274 pr_err("%s: Error: asking for slave:%d, port:%d\n",
275 __func__, slave, port);
276 return SLAVE_PORT_DOWN;
278 return s_state[slave].port_state[port];
280 EXPORT_SYMBOL(mlx4_get_slave_port_state);
282 static int mlx4_set_slave_port_state(struct mlx4_dev *dev, int slave, u8 port,
283 enum slave_port_state state)
285 struct mlx4_priv *priv = mlx4_priv(dev);
286 struct mlx4_slave_state *s_state = priv->mfunc.master.slave_state;
288 if (slave >= dev->num_slaves || port > MLX4_MAX_PORTS || port == 0) {
289 pr_err("%s: Error: asking for slave:%d, port:%d\n",
290 __func__, slave, port);
293 s_state[slave].port_state[port] = state;
298 static void set_all_slave_state(struct mlx4_dev *dev, u8 port, int event)
301 enum slave_port_gen_event gen_event;
303 for (i = 0; i < dev->num_slaves; i++)
304 set_and_calc_slave_port_state(dev, i, port, event, &gen_event);
306 /**************************************************************************
307 The function get as input the new event to that port,
308 and according to the prev state change the slave's port state.
310 MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN,
311 MLX4_PORT_STATE_DEV_EVENT_PORT_UP
312 MLX4_PORT_STATE_IB_EVENT_GID_VALID
313 MLX4_PORT_STATE_IB_EVENT_GID_INVALID
314 ***************************************************************************/
315 int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave,
317 enum slave_port_gen_event *gen_event)
319 struct mlx4_priv *priv = mlx4_priv(dev);
320 struct mlx4_slave_state *ctx = NULL;
323 enum slave_port_state cur_state =
324 mlx4_get_slave_port_state(dev, slave, port);
326 *gen_event = SLAVE_PORT_GEN_EVENT_NONE;
328 if (slave >= dev->num_slaves || port > MLX4_MAX_PORTS || port == 0) {
329 pr_err("%s: Error: asking for slave:%d, port:%d\n",
330 __func__, slave, port);
334 ctx = &priv->mfunc.master.slave_state[slave];
335 spin_lock_irqsave(&ctx->lock, flags);
338 case SLAVE_PORT_DOWN:
339 if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event)
340 mlx4_set_slave_port_state(dev, slave, port,
343 case SLAVE_PENDING_UP:
344 if (MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN == event)
345 mlx4_set_slave_port_state(dev, slave, port,
347 else if (MLX4_PORT_STATE_IB_PORT_STATE_EVENT_GID_VALID == event) {
348 mlx4_set_slave_port_state(dev, slave, port,
350 *gen_event = SLAVE_PORT_GEN_EVENT_UP;
354 if (MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN == event) {
355 mlx4_set_slave_port_state(dev, slave, port,
357 *gen_event = SLAVE_PORT_GEN_EVENT_DOWN;
358 } else if (MLX4_PORT_STATE_IB_EVENT_GID_INVALID ==
360 mlx4_set_slave_port_state(dev, slave, port,
362 *gen_event = SLAVE_PORT_GEN_EVENT_DOWN;
366 pr_err("%s: BUG!!! UNKNOWN state: "
367 "slave:%d, port:%d\n", __func__, slave, port);
370 ret = mlx4_get_slave_port_state(dev, slave, port);
373 spin_unlock_irqrestore(&ctx->lock, flags);
377 EXPORT_SYMBOL(set_and_calc_slave_port_state);
379 int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr)
383 memset(&eqe, 0, sizeof eqe);
385 eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
386 eqe.subtype = MLX4_DEV_PMC_SUBTYPE_PORT_INFO;
387 eqe.event.port_mgmt_change.port = port;
388 eqe.event.port_mgmt_change.params.port_info.changed_attr =
389 cpu_to_be32((u32) attr);
391 slave_event(dev, ALL_SLAVES, &eqe);
394 EXPORT_SYMBOL(mlx4_gen_slaves_port_mgt_ev);
396 void mlx4_master_handle_slave_flr(struct work_struct *work)
398 struct mlx4_mfunc_master_ctx *master =
399 container_of(work, struct mlx4_mfunc_master_ctx,
400 slave_flr_event_work);
401 struct mlx4_mfunc *mfunc =
402 container_of(master, struct mlx4_mfunc, master);
403 struct mlx4_priv *priv =
404 container_of(mfunc, struct mlx4_priv, mfunc);
405 struct mlx4_dev *dev = &priv->dev;
406 struct mlx4_slave_state *slave_state = priv->mfunc.master.slave_state;
411 mlx4_dbg(dev, "mlx4_handle_slave_flr\n");
413 for (i = 0 ; i < dev->num_slaves; i++) {
415 if (MLX4_COMM_CMD_FLR == slave_state[i].last_cmd) {
416 mlx4_dbg(dev, "mlx4_handle_slave_flr: "
417 "clean slave: %d\n", i);
419 mlx4_delete_all_resources_for_slave(dev, i);
420 /*return the slave to running mode*/
421 spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
422 slave_state[i].last_cmd = MLX4_COMM_CMD_RESET;
423 slave_state[i].is_slave_going_down = 0;
424 spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
426 err = mlx4_cmd(dev, 0, i, 0, MLX4_CMD_INFORM_FLR_DONE,
427 MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
429 mlx4_warn(dev, "Failed to notify FW on "
430 "FLR done (slave:%d)\n", i);
435 static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
437 struct mlx4_priv *priv = mlx4_priv(dev);
438 struct mlx4_eqe *eqe;
446 u8 update_slave_state;
448 enum slave_port_gen_event gen_event;
451 while ((eqe = next_eqe_sw(eq, dev->caps.eqe_factor))) {
453 * Make sure we read EQ entry contents after we've
454 * checked the ownership bit.
459 case MLX4_EVENT_TYPE_COMP:
460 cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff;
461 mlx4_cq_completion(dev, cqn);
464 case MLX4_EVENT_TYPE_PATH_MIG:
465 case MLX4_EVENT_TYPE_COMM_EST:
466 case MLX4_EVENT_TYPE_SQ_DRAINED:
467 case MLX4_EVENT_TYPE_SRQ_QP_LAST_WQE:
468 case MLX4_EVENT_TYPE_WQ_CATAS_ERROR:
469 case MLX4_EVENT_TYPE_PATH_MIG_FAILED:
470 case MLX4_EVENT_TYPE_WQ_INVAL_REQ_ERROR:
471 case MLX4_EVENT_TYPE_WQ_ACCESS_ERROR:
472 mlx4_dbg(dev, "event %d arrived\n", eqe->type);
473 if (mlx4_is_master(dev)) {
474 /* forward only to slave owning the QP */
475 ret = mlx4_get_slave_from_resource_id(dev,
477 be32_to_cpu(eqe->event.qp.qpn)
479 if (ret && ret != -ENOENT) {
480 mlx4_dbg(dev, "QP event %02x(%02x) on "
481 "EQ %d at index %u: could "
482 "not get slave id (%d)\n",
483 eqe->type, eqe->subtype,
484 eq->eqn, eq->cons_index, ret);
488 if (!ret && slave != dev->caps.function) {
489 mlx4_slave_event(dev, slave, eqe);
494 mlx4_qp_event(dev, be32_to_cpu(eqe->event.qp.qpn) &
495 0xffffff, eqe->type);
498 case MLX4_EVENT_TYPE_SRQ_LIMIT:
499 mlx4_warn(dev, "%s: MLX4_EVENT_TYPE_SRQ_LIMIT\n",
501 case MLX4_EVENT_TYPE_SRQ_CATAS_ERROR:
502 if (mlx4_is_master(dev)) {
503 /* forward only to slave owning the SRQ */
504 ret = mlx4_get_slave_from_resource_id(dev,
506 be32_to_cpu(eqe->event.srq.srqn)
509 if (ret && ret != -ENOENT) {
510 mlx4_warn(dev, "SRQ event %02x(%02x) "
511 "on EQ %d at index %u: could"
512 " not get slave id (%d)\n",
513 eqe->type, eqe->subtype,
514 eq->eqn, eq->cons_index, ret);
517 mlx4_warn(dev, "%s: slave:%d, srq_no:0x%x,"
518 " event: %02x(%02x)\n", __func__,
520 be32_to_cpu(eqe->event.srq.srqn),
521 eqe->type, eqe->subtype);
523 if (!ret && slave != dev->caps.function) {
524 mlx4_warn(dev, "%s: sending event "
525 "%02x(%02x) to slave:%d\n",
527 eqe->subtype, slave);
528 mlx4_slave_event(dev, slave, eqe);
532 mlx4_srq_event(dev, be32_to_cpu(eqe->event.srq.srqn) &
533 0xffffff, eqe->type);
536 case MLX4_EVENT_TYPE_CMD:
538 be16_to_cpu(eqe->event.cmd.token),
539 eqe->event.cmd.status,
540 be64_to_cpu(eqe->event.cmd.out_param));
543 case MLX4_EVENT_TYPE_PORT_CHANGE:
544 port = be32_to_cpu(eqe->event.port_change.port) >> 28;
545 if (eqe->subtype == MLX4_PORT_CHANGE_SUBTYPE_DOWN) {
546 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_PORT_DOWN,
548 mlx4_priv(dev)->sense.do_sense_port[port] = 1;
549 if (!mlx4_is_master(dev))
551 for (i = 0; i < dev->num_slaves; i++) {
552 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH) {
553 if (i == mlx4_master_func_num(dev))
555 mlx4_dbg(dev, "%s: Sending MLX4_PORT_CHANGE_SUBTYPE_DOWN"
556 " to slave: %d, port:%d\n",
558 mlx4_slave_event(dev, i, eqe);
559 } else { /* IB port */
560 set_and_calc_slave_port_state(dev, i, port,
561 MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN,
563 /*we can be in pending state, then do not send port_down event*/
564 if (SLAVE_PORT_GEN_EVENT_DOWN == gen_event) {
565 if (i == mlx4_master_func_num(dev))
567 mlx4_slave_event(dev, i, eqe);
572 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_PORT_UP, port);
574 mlx4_priv(dev)->sense.do_sense_port[port] = 0;
576 if (!mlx4_is_master(dev))
578 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
579 for (i = 0; i < dev->num_slaves; i++) {
580 if (i == mlx4_master_func_num(dev))
582 mlx4_slave_event(dev, i, eqe);
585 /* port-up event will be sent to a slave when the
586 * slave's alias-guid is set. This is done in alias_GUID.c
588 set_all_slave_state(dev, port, MLX4_DEV_EVENT_PORT_UP);
592 case MLX4_EVENT_TYPE_CQ_ERROR:
593 mlx4_warn(dev, "CQ %s on CQN %06x\n",
594 eqe->event.cq_err.syndrome == 1 ?
595 "overrun" : "access violation",
596 be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff);
597 if (mlx4_is_master(dev)) {
598 ret = mlx4_get_slave_from_resource_id(dev,
600 be32_to_cpu(eqe->event.cq_err.cqn)
602 if (ret && ret != -ENOENT) {
603 mlx4_dbg(dev, "CQ event %02x(%02x) on "
604 "EQ %d at index %u: could "
605 "not get slave id (%d)\n",
606 eqe->type, eqe->subtype,
607 eq->eqn, eq->cons_index, ret);
611 if (!ret && slave != dev->caps.function) {
612 mlx4_slave_event(dev, slave, eqe);
617 be32_to_cpu(eqe->event.cq_err.cqn)
622 case MLX4_EVENT_TYPE_EQ_OVERFLOW:
623 mlx4_warn(dev, "EQ overrun on EQN %d\n", eq->eqn);
626 case MLX4_EVENT_TYPE_OP_REQUIRED:
627 atomic_inc(&priv->opreq_count);
628 /* FW commands can't be executed from interrupt context
629 working in deferred task */
630 queue_work(mlx4_wq, &priv->opreq_task);
633 case MLX4_EVENT_TYPE_COMM_CHANNEL:
634 if (!mlx4_is_master(dev)) {
635 mlx4_warn(dev, "Received comm channel event "
636 "for non master device\n");
639 memcpy(&priv->mfunc.master.comm_arm_bit_vector,
640 eqe->event.comm_channel_arm.bit_vec,
641 sizeof eqe->event.comm_channel_arm.bit_vec);
642 queue_work(priv->mfunc.master.comm_wq,
643 &priv->mfunc.master.comm_work);
646 case MLX4_EVENT_TYPE_FLR_EVENT:
647 flr_slave = be32_to_cpu(eqe->event.flr_event.slave_id);
648 if (!mlx4_is_master(dev)) {
649 mlx4_warn(dev, "Non-master function received"
654 mlx4_dbg(dev, "FLR event for slave: %d\n", flr_slave);
656 if (flr_slave >= dev->num_slaves) {
658 "Got FLR for unknown function: %d\n",
660 update_slave_state = 0;
662 update_slave_state = 1;
664 spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
665 if (update_slave_state) {
666 priv->mfunc.master.slave_state[flr_slave].active = false;
667 priv->mfunc.master.slave_state[flr_slave].last_cmd = MLX4_COMM_CMD_FLR;
668 priv->mfunc.master.slave_state[flr_slave].is_slave_going_down = 1;
670 spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
671 queue_work(priv->mfunc.master.comm_wq,
672 &priv->mfunc.master.slave_flr_event_work);
675 case MLX4_EVENT_TYPE_FATAL_WARNING:
676 if (eqe->subtype == MLX4_FATAL_WARNING_SUBTYPE_WARMING) {
677 if (mlx4_is_master(dev))
678 for (i = 0; i < dev->num_slaves; i++) {
679 mlx4_dbg(dev, "%s: Sending "
680 "MLX4_FATAL_WARNING_SUBTYPE_WARMING"
681 " to slave: %d\n", __func__, i);
682 if (i == dev->caps.function)
684 mlx4_slave_event(dev, i, eqe);
686 mlx4_err(dev, "Temperature Threshold was reached! "
687 "Threshold: %d celsius degrees; "
688 "Current Temperature: %d\n",
689 be16_to_cpu(eqe->event.warming.warning_threshold),
690 be16_to_cpu(eqe->event.warming.current_temperature));
692 mlx4_warn(dev, "Unhandled event FATAL WARNING (%02x), "
693 "subtype %02x on EQ %d at index %u. owner=%x, "
694 "nent=0x%x, slave=%x, ownership=%s\n",
695 eqe->type, eqe->subtype, eq->eqn,
696 eq->cons_index, eqe->owner, eq->nent,
698 !!(eqe->owner & 0x80) ^
699 !!(eq->cons_index & eq->nent) ? "HW" : "SW");
703 case MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT:
704 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_PORT_MGMT_CHANGE,
705 (unsigned long) eqe);
708 case MLX4_EVENT_TYPE_EEC_CATAS_ERROR:
709 case MLX4_EVENT_TYPE_ECC_DETECT:
711 mlx4_warn(dev, "Unhandled event %02x(%02x) on EQ %d at "
712 "index %u. owner=%x, nent=0x%x, slave=%x, "
714 eqe->type, eqe->subtype, eq->eqn,
715 eq->cons_index, eqe->owner, eq->nent,
717 !!(eqe->owner & 0x80) ^
718 !!(eq->cons_index & eq->nent) ? "HW" : "SW");
727 * The HCA will think the queue has overflowed if we
728 * don't tell it we've been processing events. We
729 * create our EQs with MLX4_NUM_SPARE_EQE extra
730 * entries, so we must update our consumer index at
733 if (unlikely(set_ci >= MLX4_NUM_SPARE_EQE)) {
744 static irqreturn_t mlx4_interrupt(int irq, void *dev_ptr)
746 struct mlx4_dev *dev = dev_ptr;
747 struct mlx4_priv *priv = mlx4_priv(dev);
752 writel(priv->eq_table.clr_mask, priv->eq_table.clr_int);
754 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i)
755 work |= mlx4_eq_int(dev, &priv->eq_table.eq[i]);
757 return IRQ_RETVAL(work);
760 static irqreturn_t mlx4_msi_x_interrupt(int irq, void *eq_ptr)
762 struct mlx4_eq *eq = eq_ptr;
763 struct mlx4_dev *dev = eq->dev;
765 mlx4_eq_int(dev, eq);
767 /* MSI-X vectors always belong to us */
771 int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave,
772 struct mlx4_vhcr *vhcr,
773 struct mlx4_cmd_mailbox *inbox,
774 struct mlx4_cmd_mailbox *outbox,
775 struct mlx4_cmd_info *cmd)
777 struct mlx4_priv *priv = mlx4_priv(dev);
778 struct mlx4_slave_event_eq_info *event_eq =
779 priv->mfunc.master.slave_state[slave].event_eq;
780 u32 in_modifier = vhcr->in_modifier;
781 u32 eqn = in_modifier & 0x1FF;
782 u64 in_param = vhcr->in_param;
786 if (slave == dev->caps.function)
787 err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn,
788 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B,
791 for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i)
792 if (in_param & (1LL << i))
793 event_eq[i].eqn = in_modifier >> 31 ? -1 : eqn;
798 static int mlx4_MAP_EQ(struct mlx4_dev *dev, u64 event_mask, int unmap,
801 return mlx4_cmd(dev, event_mask, (unmap << 31) | eq_num,
802 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B,
806 static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
809 return mlx4_cmd(dev, mailbox->dma, eq_num, 0,
810 MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A,
814 static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
817 return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num,
818 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A,
822 static int mlx4_num_eq_uar(struct mlx4_dev *dev)
825 * Each UAR holds 4 EQ doorbells. To figure out how many UARs
826 * we need to map, take the difference of highest index and
827 * the lowest index we'll use and add 1.
829 return (dev->caps.num_comp_vectors + 1 + dev->caps.reserved_eqs +
830 dev->caps.comp_pool)/4 - dev->caps.reserved_eqs/4 + 1;
833 static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq)
835 struct mlx4_priv *priv = mlx4_priv(dev);
838 index = eq->eqn / 4 - dev->caps.reserved_eqs / 4;
840 if (!priv->eq_table.uar_map[index]) {
841 priv->eq_table.uar_map[index] =
842 ioremap(pci_resource_start(dev->pdev, 2) +
843 ((eq->eqn / 4) << PAGE_SHIFT),
845 if (!priv->eq_table.uar_map[index]) {
846 mlx4_err(dev, "Couldn't map EQ doorbell for EQN 0x%06x\n",
852 return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4);
855 static void mlx4_unmap_uar(struct mlx4_dev *dev)
857 struct mlx4_priv *priv = mlx4_priv(dev);
860 for (i = 0; i < mlx4_num_eq_uar(dev); ++i)
861 if (priv->eq_table.uar_map[i]) {
862 iounmap(priv->eq_table.uar_map[i]);
863 priv->eq_table.uar_map[i] = NULL;
867 static int mlx4_create_eq(struct mlx4_dev *dev, int nent,
868 u8 intr, struct mlx4_eq *eq)
870 struct mlx4_priv *priv = mlx4_priv(dev);
871 struct mlx4_cmd_mailbox *mailbox;
872 struct mlx4_eq_context *eq_context;
874 u64 *dma_list = NULL;
881 eq->nent = roundup_pow_of_two(max(nent, 2));
882 /* CX3 is capable of extending the CQE\EQE from 32 to 64 bytes */
883 npages = PAGE_ALIGN(eq->nent * (MLX4_EQ_ENTRY_SIZE << dev->caps.eqe_factor)) / PAGE_SIZE;
885 eq->page_list = kmalloc(npages * sizeof *eq->page_list,
890 for (i = 0; i < npages; ++i)
891 eq->page_list[i].buf = NULL;
893 dma_list = kmalloc(npages * sizeof *dma_list, GFP_KERNEL);
897 mailbox = mlx4_alloc_cmd_mailbox(dev);
900 eq_context = mailbox->buf;
902 for (i = 0; i < npages; ++i) {
903 eq->page_list[i].buf = dma_alloc_coherent(&dev->pdev->dev,
904 PAGE_SIZE, &t, GFP_KERNEL);
905 if (!eq->page_list[i].buf)
906 goto err_out_free_pages;
909 eq->page_list[i].map = t;
911 memset(eq->page_list[i].buf, 0, PAGE_SIZE);
914 eq->eqn = mlx4_bitmap_alloc(&priv->eq_table.bitmap);
916 goto err_out_free_pages;
918 eq->doorbell = mlx4_get_eq_uar(dev, eq);
921 goto err_out_free_eq;
924 err = mlx4_mtt_init(dev, npages, PAGE_SHIFT, &eq->mtt);
926 goto err_out_free_eq;
928 err = mlx4_write_mtt(dev, &eq->mtt, 0, npages, dma_list);
930 goto err_out_free_mtt;
932 memset(eq_context, 0, sizeof *eq_context);
933 eq_context->flags = cpu_to_be32(MLX4_EQ_STATUS_OK |
934 MLX4_EQ_STATE_ARMED);
935 eq_context->log_eq_size = ilog2(eq->nent);
936 eq_context->intr = intr;
937 eq_context->log_page_size = PAGE_SHIFT - MLX4_ICM_PAGE_SHIFT;
939 mtt_addr = mlx4_mtt_addr(dev, &eq->mtt);
940 eq_context->mtt_base_addr_h = mtt_addr >> 32;
941 eq_context->mtt_base_addr_l = cpu_to_be32(mtt_addr & 0xffffffff);
943 err = mlx4_SW2HW_EQ(dev, mailbox, eq->eqn);
945 mlx4_warn(dev, "SW2HW_EQ failed (%d)\n", err);
946 goto err_out_free_mtt;
950 mlx4_free_cmd_mailbox(dev, mailbox);
957 mlx4_mtt_cleanup(dev, &eq->mtt);
960 mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn);
963 for (i = 0; i < npages; ++i)
964 if (eq->page_list[i].buf)
965 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
966 eq->page_list[i].buf,
967 eq->page_list[i].map);
969 mlx4_free_cmd_mailbox(dev, mailbox);
972 kfree(eq->page_list);
979 static void mlx4_free_eq(struct mlx4_dev *dev,
982 struct mlx4_priv *priv = mlx4_priv(dev);
983 struct mlx4_cmd_mailbox *mailbox;
986 /* CX3 is capable of extending the CQE\EQE from 32 to 64 bytes */
987 int npages = PAGE_ALIGN((MLX4_EQ_ENTRY_SIZE << dev->caps.eqe_factor) * eq->nent) / PAGE_SIZE;
989 mailbox = mlx4_alloc_cmd_mailbox(dev);
993 err = mlx4_HW2SW_EQ(dev, mailbox, eq->eqn);
995 mlx4_warn(dev, "HW2SW_EQ failed (%d)\n", err);
998 mlx4_dbg(dev, "Dumping EQ context %02x:\n", eq->eqn);
999 for (i = 0; i < sizeof (struct mlx4_eq_context) / 4; ++i) {
1001 pr_cont("[%02x] ", i * 4);
1002 pr_cont(" %08x", be32_to_cpup(mailbox->buf + i * 4));
1003 if ((i + 1) % 4 == 0)
1008 mlx4_mtt_cleanup(dev, &eq->mtt);
1009 for (i = 0; i < npages; ++i)
1010 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
1011 eq->page_list[i].buf,
1012 eq->page_list[i].map);
1014 kfree(eq->page_list);
1015 mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn);
1016 mlx4_free_cmd_mailbox(dev, mailbox);
1019 static void mlx4_free_irqs(struct mlx4_dev *dev)
1021 struct mlx4_eq_table *eq_table = &mlx4_priv(dev)->eq_table;
1022 struct mlx4_priv *priv = mlx4_priv(dev);
1025 if (eq_table->have_irq)
1026 free_irq(dev->pdev->irq, dev);
1028 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i)
1029 if (eq_table->eq[i].have_irq) {
1030 free_irq(eq_table->eq[i].irq, eq_table->eq + i);
1031 eq_table->eq[i].have_irq = 0;
1034 for (i = 0; i < dev->caps.comp_pool; i++) {
1036 * Freeing the assigned irq's
1037 * all bits should be 0, but we need to validate
1039 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1040 /* NO need protecting*/
1041 vec = dev->caps.num_comp_vectors + 1 + i;
1042 free_irq(priv->eq_table.eq[vec].irq,
1043 &priv->eq_table.eq[vec]);
1048 kfree(eq_table->irq_names);
1051 static int mlx4_map_clr_int(struct mlx4_dev *dev)
1053 struct mlx4_priv *priv = mlx4_priv(dev);
1055 priv->clr_base = ioremap(pci_resource_start(dev->pdev, priv->fw.clr_int_bar) +
1056 priv->fw.clr_int_base, MLX4_CLR_INT_SIZE);
1057 if (!priv->clr_base) {
1058 mlx4_err(dev, "Couldn't map interrupt clear register, aborting.\n");
1065 static void mlx4_unmap_clr_int(struct mlx4_dev *dev)
1067 struct mlx4_priv *priv = mlx4_priv(dev);
1069 iounmap(priv->clr_base);
1072 int mlx4_alloc_eq_table(struct mlx4_dev *dev)
1074 struct mlx4_priv *priv = mlx4_priv(dev);
1076 priv->eq_table.eq = kcalloc(dev->caps.num_eqs - dev->caps.reserved_eqs,
1077 sizeof *priv->eq_table.eq, GFP_KERNEL);
1078 if (!priv->eq_table.eq)
1084 void mlx4_free_eq_table(struct mlx4_dev *dev)
1086 kfree(mlx4_priv(dev)->eq_table.eq);
1089 int mlx4_init_eq_table(struct mlx4_dev *dev)
1091 struct mlx4_priv *priv = mlx4_priv(dev);
1095 priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev),
1096 sizeof *priv->eq_table.uar_map,
1098 if (!priv->eq_table.uar_map) {
1103 err = mlx4_bitmap_init(&priv->eq_table.bitmap, dev->caps.num_eqs,
1104 dev->caps.num_eqs - 1, dev->caps.reserved_eqs, 0);
1108 for (i = 0; i < mlx4_num_eq_uar(dev); ++i)
1109 priv->eq_table.uar_map[i] = NULL;
1111 if (!mlx4_is_slave(dev)) {
1112 err = mlx4_map_clr_int(dev);
1114 goto err_out_bitmap;
1116 priv->eq_table.clr_mask =
1117 swab32(1 << (priv->eq_table.inta_pin & 31));
1118 priv->eq_table.clr_int = priv->clr_base +
1119 (priv->eq_table.inta_pin < 32 ? 4 : 0);
1122 priv->eq_table.irq_names =
1123 kmalloc(MLX4_IRQNAME_SIZE * (dev->caps.num_comp_vectors + 1 +
1124 dev->caps.comp_pool),
1126 if (!priv->eq_table.irq_names) {
1128 goto err_out_clr_int;
1131 for (i = 0; i < dev->caps.num_comp_vectors; ++i) {
1132 err = mlx4_create_eq(dev, dev->caps.num_cqs -
1133 dev->caps.reserved_cqs +
1135 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
1136 &priv->eq_table.eq[i]);
1143 err = mlx4_create_eq(dev, MLX4_NUM_ASYNC_EQE + MLX4_NUM_SPARE_EQE,
1144 (dev->flags & MLX4_FLAG_MSI_X) ? dev->caps.num_comp_vectors : 0,
1145 &priv->eq_table.eq[dev->caps.num_comp_vectors]);
1149 /*if additional completion vectors poolsize is 0 this loop will not run*/
1150 for (i = dev->caps.num_comp_vectors + 1;
1151 i < dev->caps.num_comp_vectors + dev->caps.comp_pool + 1; ++i) {
1153 err = mlx4_create_eq(dev, dev->caps.num_cqs -
1154 dev->caps.reserved_cqs +
1156 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
1157 &priv->eq_table.eq[i]);
1165 if (dev->flags & MLX4_FLAG_MSI_X) {
1166 const char *eq_name;
1168 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i) {
1169 if (i < dev->caps.num_comp_vectors) {
1170 snprintf(priv->eq_table.irq_names +
1171 i * MLX4_IRQNAME_SIZE,
1173 "mlx4-comp-%d@pci:%s", i,
1174 pci_name(dev->pdev));
1176 snprintf(priv->eq_table.irq_names +
1177 i * MLX4_IRQNAME_SIZE,
1179 "mlx4-async@pci:%s",
1180 pci_name(dev->pdev));
1183 eq_name = priv->eq_table.irq_names +
1184 i * MLX4_IRQNAME_SIZE;
1185 err = request_irq(priv->eq_table.eq[i].irq,
1186 mlx4_msi_x_interrupt, 0, eq_name,
1187 priv->eq_table.eq + i);
1191 priv->eq_table.eq[i].have_irq = 1;
1194 snprintf(priv->eq_table.irq_names,
1197 pci_name(dev->pdev));
1198 err = request_irq(dev->pdev->irq, mlx4_interrupt,
1199 IRQF_SHARED, priv->eq_table.irq_names, dev);
1203 priv->eq_table.have_irq = 1;
1206 err = mlx4_MAP_EQ(dev, get_async_ev_mask(dev), 0,
1207 priv->eq_table.eq[dev->caps.num_comp_vectors].eqn);
1209 mlx4_warn(dev, "MAP_EQ for async EQ %d failed (%d)\n",
1210 priv->eq_table.eq[dev->caps.num_comp_vectors].eqn, err);
1212 for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i)
1213 eq_set_ci(&priv->eq_table.eq[i], 1);
1218 mlx4_free_eq(dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]);
1221 i = dev->caps.num_comp_vectors - 1;
1225 mlx4_free_eq(dev, &priv->eq_table.eq[i]);
1228 mlx4_free_irqs(dev);
1231 if (!mlx4_is_slave(dev))
1232 mlx4_unmap_clr_int(dev);
1235 mlx4_unmap_uar(dev);
1236 mlx4_bitmap_cleanup(&priv->eq_table.bitmap);
1239 kfree(priv->eq_table.uar_map);
1244 void mlx4_cleanup_eq_table(struct mlx4_dev *dev)
1246 struct mlx4_priv *priv = mlx4_priv(dev);
1249 mlx4_MAP_EQ(dev, get_async_ev_mask(dev), 1,
1250 priv->eq_table.eq[dev->caps.num_comp_vectors].eqn);
1252 mlx4_free_irqs(dev);
1254 for (i = 0; i < dev->caps.num_comp_vectors + dev->caps.comp_pool + 1; ++i)
1255 mlx4_free_eq(dev, &priv->eq_table.eq[i]);
1257 if (!mlx4_is_slave(dev))
1258 mlx4_unmap_clr_int(dev);
1260 mlx4_unmap_uar(dev);
1261 mlx4_bitmap_cleanup(&priv->eq_table.bitmap);
1263 kfree(priv->eq_table.uar_map);
1266 /* A test that verifies that we can accept interrupts on all
1267 * the irq vectors of the device.
1268 * Interrupts are checked using the NOP command.
1270 int mlx4_test_interrupts(struct mlx4_dev *dev)
1272 struct mlx4_priv *priv = mlx4_priv(dev);
1276 err = mlx4_NOP(dev);
1277 /* When not in MSI_X, there is only one irq to check */
1278 if (!(dev->flags & MLX4_FLAG_MSI_X) || mlx4_is_slave(dev))
1281 /* A loop over all completion vectors, for each vector we will check
1282 * whether it works by mapping command completions to that vector
1283 * and performing a NOP command
1285 for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) {
1286 /* Temporary use polling for command completions */
1287 mlx4_cmd_use_polling(dev);
1289 /* Map the new eq to handle all asyncronous events */
1290 err = mlx4_MAP_EQ(dev, get_async_ev_mask(dev), 0,
1291 priv->eq_table.eq[i].eqn);
1293 mlx4_warn(dev, "Failed mapping eq for interrupt test\n");
1294 mlx4_cmd_use_events(dev);
1298 /* Go back to using events */
1299 mlx4_cmd_use_events(dev);
1300 err = mlx4_NOP(dev);
1303 /* Return to default */
1304 mlx4_MAP_EQ(dev, get_async_ev_mask(dev), 0,
1305 priv->eq_table.eq[dev->caps.num_comp_vectors].eqn);
1308 EXPORT_SYMBOL(mlx4_test_interrupts);
1310 int mlx4_assign_eq(struct mlx4_dev *dev, char *name, int *vector)
1313 struct mlx4_priv *priv = mlx4_priv(dev);
1314 int vec = 0, err = 0, i;
1316 mutex_lock(&priv->msix_ctl.pool_lock);
1317 for (i = 0; !vec && i < dev->caps.comp_pool; i++) {
1318 if (~priv->msix_ctl.pool_bm & 1ULL << i) {
1319 priv->msix_ctl.pool_bm |= 1ULL << i;
1320 vec = dev->caps.num_comp_vectors + 1 + i;
1321 snprintf(priv->eq_table.irq_names +
1322 vec * MLX4_IRQNAME_SIZE,
1323 MLX4_IRQNAME_SIZE, "%s", name);
1324 err = request_irq(priv->eq_table.eq[vec].irq,
1325 mlx4_msi_x_interrupt, 0,
1326 &priv->eq_table.irq_names[vec<<5],
1327 priv->eq_table.eq + vec);
1329 /*zero out bit by fliping it*/
1330 priv->msix_ctl.pool_bm ^= 1 << i;
1333 /*we dont want to break here*/
1335 eq_set_ci(&priv->eq_table.eq[vec], 1);
1338 mutex_unlock(&priv->msix_ctl.pool_lock);
1344 err = (i == dev->caps.comp_pool) ? -ENOSPC : err;
1348 EXPORT_SYMBOL(mlx4_assign_eq);
1350 void mlx4_release_eq(struct mlx4_dev *dev, int vec)
1352 struct mlx4_priv *priv = mlx4_priv(dev);
1354 int i = vec - dev->caps.num_comp_vectors - 1;
1356 if (likely(i >= 0)) {
1357 /*sanity check , making sure were not trying to free irq's
1358 Belonging to a legacy EQ*/
1359 mutex_lock(&priv->msix_ctl.pool_lock);
1360 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1361 free_irq(priv->eq_table.eq[vec].irq,
1362 &priv->eq_table.eq[vec]);
1363 priv->msix_ctl.pool_bm &= ~(1ULL << i);
1365 mutex_unlock(&priv->msix_ctl.pool_lock);
1369 EXPORT_SYMBOL(mlx4_release_eq);