Lines Matching refs:trap
123 * with the given trap, because it may be queued.
125 static void cleanup_traps(struct hfi1_ibport *ibp, struct trap_node *trap)
144 if (node != trap)
153 kfree(trap);
157 struct trap_node *trap)
167 queue_id = trap->data.generic_type & 0x0F;
170 pr_err_ratelimited("hfi1: Invalid trap 0x%0x dropped. Total dropped: %d\n",
171 trap->data.generic_type, trap_count);
172 kfree(trap);
177 * Since the retry (handle timeout) does not remove a trap request
184 if (node == trap) {
195 list_add_tail(&trap->list, &trap_list->list);
197 pr_warn_ratelimited("hfi1: Maximum trap limit reached for 0x%0x traps\n",
198 trap->data.generic_type);
199 kfree(trap);
205 * and get the first trap from the list.
212 * before the trap can be sent.
232 struct trap_node *trap;
242 trap = list_first_entry_or_null(&trap_list->list,
244 if (trap && trap->tid == smp->tid) {
245 if (trap->in_use) {
246 trap->repress = 1;
249 list_del(&trap->list);
250 kfree(trap);
313 static void send_trap(struct hfi1_ibport *ibp, struct trap_node *trap)
324 cleanup_traps(ibp, trap);
330 cleanup_traps(ibp, trap);
334 /* Add the trap to the list if necessary and see if we can send it */
335 trap = check_and_add_trap(ibp, trap);
336 if (!trap)
359 if (trap->tid == 0) {
364 trap->tid = cpu_to_be64(ibp->rvp.tid);
366 smp->tid = trap->tid;
371 memcpy(smp->route.lid.data, &trap->data, trap->len);
394 * If the trap was repressed while things were getting set up, don't
397 if (trap->repress) {
398 list_del(&trap->list);
400 kfree(trap);
405 trap->in_use = 0;
415 struct trap_node *trap = NULL;
419 /* Find the trap with the highest priority */
421 for (i = 0; !trap && i < RVT_MAX_TRAP_LISTS; i++) {
422 trap = list_first_entry_or_null(&ibp->rvp.trap_lists[i].list,
427 if (trap)
428 send_trap(ibp, trap);
433 struct trap_node *trap;
435 trap = kzalloc(sizeof(*trap), GFP_ATOMIC);
436 if (!trap)
439 INIT_LIST_HEAD(&trap->list);
440 trap->data.generic_type = type;
441 trap->data.prod_type_lsb = IB_NOTICE_PROD_CA;
442 trap->data.trap_num = trap_num;
443 trap->data.issuer_lid = cpu_to_be32(lid);
445 return trap;
449 * Send a bad P_Key trap (ch. 14.3.8).
454 struct trap_node *trap;
460 trap = create_trap_node(IB_NOTICE_TYPE_SECURITY, OPA_TRAP_BAD_P_KEY,
462 if (!trap)
465 /* Send violation trap */
466 trap->data.ntc_257_258.lid1 = cpu_to_be32(lid1);
467 trap->data.ntc_257_258.lid2 = cpu_to_be32(lid2);
468 trap->data.ntc_257_258.key = cpu_to_be32(key);
469 trap->data.ntc_257_258.sl = sl << 3;
470 trap->data.ntc_257_258.qp1 = cpu_to_be32(qp1);
471 trap->data.ntc_257_258.qp2 = cpu_to_be32(qp2);
473 trap->len = sizeof(trap->data);
474 send_trap(ibp, trap);
478 * Send a bad M_Key trap (ch. 14.3.9).
483 struct trap_node *trap;
486 trap = create_trap_node(IB_NOTICE_TYPE_SECURITY, OPA_TRAP_BAD_M_KEY,
488 if (!trap)
491 /* Send violation trap */
492 trap->data.ntc_256.lid = trap->data.issuer_lid;
493 trap->data.ntc_256.method = mad->method;
494 trap->data.ntc_256.attr_id = mad->attr_id;
495 trap->data.ntc_256.attr_mod = mad->attr_mod;
496 trap->data.ntc_256.mkey = mkey;
498 trap->data.ntc_256.dr_slid = dr_slid;
499 trap->data.ntc_256.dr_trunc_hop = IB_NOTICE_TRAP_DR_NOTICE;
500 if (hop_cnt > ARRAY_SIZE(trap->data.ntc_256.dr_rtn_path)) {
501 trap->data.ntc_256.dr_trunc_hop |=
503 hop_cnt = ARRAY_SIZE(trap->data.ntc_256.dr_rtn_path);
505 trap->data.ntc_256.dr_trunc_hop |= hop_cnt;
506 memcpy(trap->data.ntc_256.dr_rtn_path, return_path,
510 trap->len = sizeof(trap->data);
512 send_trap(ibp, trap);
516 * Send a Port Capability Mask Changed trap (ch. 14.3.11).
520 struct trap_node *trap;
526 trap = create_trap_node(IB_NOTICE_TYPE_INFO,
529 if (!trap)
532 trap->data.ntc_144.lid = trap->data.issuer_lid;
533 trap->data.ntc_144.new_cap_mask = cpu_to_be32(ibp->rvp.port_cap_flags);
534 trap->data.ntc_144.cap_mask3 = cpu_to_be16(ibp->rvp.port_cap3_flags);
536 trap->len = sizeof(trap->data);
537 send_trap(ibp, trap);
541 * Send a System Image GUID Changed trap (ch. 14.3.12).
545 struct trap_node *trap;
548 trap = create_trap_node(IB_NOTICE_TYPE_INFO, OPA_TRAP_CHANGE_SYSGUID,
550 if (!trap)
553 trap->data.ntc_145.new_sys_guid = ib_hfi1_sys_image_guid;
554 trap->data.ntc_145.lid = trap->data.issuer_lid;
556 trap->len = sizeof(trap->data);
557 send_trap(ibp, trap);
561 * Send a Node Description Changed trap (ch. 14.3.13).
565 struct trap_node *trap;
568 trap = create_trap_node(IB_NOTICE_TYPE_INFO,
571 if (!trap)
574 trap->data.ntc_144.lid = trap->data.issuer_lid;
575 trap->data.ntc_144.change_flags =
578 trap->len = sizeof(trap->data);
579 send_trap(ibp, trap);
733 /* Generate a trap notice. */