Lines Matching refs:trap

81  * with the given trap, because it may be queued.
83 static void cleanup_traps(struct hfi1_ibport *ibp, struct trap_node *trap)
102 if (node != trap)
111 kfree(trap);
115 struct trap_node *trap)
125 queue_id = trap->data.generic_type & 0x0F;
128 pr_err_ratelimited("hfi1: Invalid trap 0x%0x dropped. Total dropped: %d\n",
129 trap->data.generic_type, trap_count);
130 kfree(trap);
135 * Since the retry (handle timeout) does not remove a trap request
142 if (node == trap) {
153 list_add_tail(&trap->list, &trap_list->list);
155 pr_warn_ratelimited("hfi1: Maximum trap limit reached for 0x%0x traps\n",
156 trap->data.generic_type);
157 kfree(trap);
163 * and get the first trap from the list.
170 * before the trap can be sent.
190 struct trap_node *trap;
200 trap = list_first_entry_or_null(&trap_list->list,
202 if (trap && trap->tid == smp->tid) {
203 if (trap->in_use) {
204 trap->repress = 1;
207 list_del(&trap->list);
208 kfree(trap);
271 static void send_trap(struct hfi1_ibport *ibp, struct trap_node *trap)
282 cleanup_traps(ibp, trap);
288 cleanup_traps(ibp, trap);
292 /* Add the trap to the list if necessary and see if we can send it */
293 trap = check_and_add_trap(ibp, trap);
294 if (!trap)
317 if (trap->tid == 0) {
322 trap->tid = cpu_to_be64(ibp->rvp.tid);
324 smp->tid = trap->tid;
329 memcpy(smp->route.lid.data, &trap->data, trap->len);
352 * If the trap was repressed while things were getting set up, don't
355 if (trap->repress) {
356 list_del(&trap->list);
358 kfree(trap);
363 trap->in_use = 0;
373 struct trap_node *trap = NULL;
377 /* Find the trap with the highest priority */
379 for (i = 0; !trap && i < RVT_MAX_TRAP_LISTS; i++) {
380 trap = list_first_entry_or_null(&ibp->rvp.trap_lists[i].list,
385 if (trap)
386 send_trap(ibp, trap);
391 struct trap_node *trap;
393 trap = kzalloc(sizeof(*trap), GFP_ATOMIC);
394 if (!trap)
397 INIT_LIST_HEAD(&trap->list);
398 trap->data.generic_type = type;
399 trap->data.prod_type_lsb = IB_NOTICE_PROD_CA;
400 trap->data.trap_num = trap_num;
401 trap->data.issuer_lid = cpu_to_be32(lid);
403 return trap;
407 * Send a bad P_Key trap (ch. 14.3.8).
412 struct trap_node *trap;
418 trap = create_trap_node(IB_NOTICE_TYPE_SECURITY, OPA_TRAP_BAD_P_KEY,
420 if (!trap)
423 /* Send violation trap */
424 trap->data.ntc_257_258.lid1 = cpu_to_be32(lid1);
425 trap->data.ntc_257_258.lid2 = cpu_to_be32(lid2);
426 trap->data.ntc_257_258.key = cpu_to_be32(key);
427 trap->data.ntc_257_258.sl = sl << 3;
428 trap->data.ntc_257_258.qp1 = cpu_to_be32(qp1);
429 trap->data.ntc_257_258.qp2 = cpu_to_be32(qp2);
431 trap->len = sizeof(trap->data);
432 send_trap(ibp, trap);
436 * Send a bad M_Key trap (ch. 14.3.9).
441 struct trap_node *trap;
444 trap = create_trap_node(IB_NOTICE_TYPE_SECURITY, OPA_TRAP_BAD_M_KEY,
446 if (!trap)
449 /* Send violation trap */
450 trap->data.ntc_256.lid = trap->data.issuer_lid;
451 trap->data.ntc_256.method = mad->method;
452 trap->data.ntc_256.attr_id = mad->attr_id;
453 trap->data.ntc_256.attr_mod = mad->attr_mod;
454 trap->data.ntc_256.mkey = mkey;
456 trap->data.ntc_256.dr_slid = dr_slid;
457 trap->data.ntc_256.dr_trunc_hop = IB_NOTICE_TRAP_DR_NOTICE;
458 if (hop_cnt > ARRAY_SIZE(trap->data.ntc_256.dr_rtn_path)) {
459 trap->data.ntc_256.dr_trunc_hop |=
461 hop_cnt = ARRAY_SIZE(trap->data.ntc_256.dr_rtn_path);
463 trap->data.ntc_256.dr_trunc_hop |= hop_cnt;
464 memcpy(trap->data.ntc_256.dr_rtn_path, return_path,
468 trap->len = sizeof(trap->data);
470 send_trap(ibp, trap);
474 * Send a Port Capability Mask Changed trap (ch. 14.3.11).
478 struct trap_node *trap;
484 trap = create_trap_node(IB_NOTICE_TYPE_INFO,
487 if (!trap)
490 trap->data.ntc_144.lid = trap->data.issuer_lid;
491 trap->data.ntc_144.new_cap_mask = cpu_to_be32(ibp->rvp.port_cap_flags);
492 trap->data.ntc_144.cap_mask3 = cpu_to_be16(ibp->rvp.port_cap3_flags);
494 trap->len = sizeof(trap->data);
495 send_trap(ibp, trap);
499 * Send a System Image GUID Changed trap (ch. 14.3.12).
503 struct trap_node *trap;
506 trap = create_trap_node(IB_NOTICE_TYPE_INFO, OPA_TRAP_CHANGE_SYSGUID,
508 if (!trap)
511 trap->data.ntc_145.new_sys_guid = ib_hfi1_sys_image_guid;
512 trap->data.ntc_145.lid = trap->data.issuer_lid;
514 trap->len = sizeof(trap->data);
515 send_trap(ibp, trap);
519 * Send a Node Description Changed trap (ch. 14.3.13).
523 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.change_flags =
536 trap->len = sizeof(trap->data);
537 send_trap(ibp, trap);
691 /* Generate a trap notice. */