Lines Matching full:packet
255 struct hfi1_packet *packet) in rcv_hdrerr() argument
257 struct ib_header *rhdr = packet->hdr; in rcv_hdrerr()
258 u32 rte = rhf_rcv_type_err(packet->rhf); in rcv_hdrerr()
265 if ((packet->rhf & RHF_DC_ERR) && in rcv_hdrerr()
269 if (packet->rhf & RHF_ICRC_ERR) in rcv_hdrerr()
272 if (packet->etype == RHF_RCV_TYPE_BYPASS) { in rcv_hdrerr()
279 packet->ohdr = &rhdr->u.oth; in rcv_hdrerr()
281 packet->ohdr = &rhdr->u.l.oth; in rcv_hdrerr()
282 packet->grh = &rhdr->u.l.grh; in rcv_hdrerr()
288 if (packet->rhf & RHF_TID_ERR) { in rcv_hdrerr()
290 u32 tlen = rhf_pkt_len(packet->rhf); /* in bytes */ in rcv_hdrerr()
294 /* Sanity check packet */ in rcv_hdrerr()
299 if (packet->grh) { in rcv_hdrerr()
301 struct ib_grh *grh = packet->grh; in rcv_hdrerr()
311 qp_num = ib_bth_get_qpn(packet->ohdr); in rcv_hdrerr()
325 * packet. in rcv_hdrerr()
337 hfi1_rc_hdrerr(rcd, packet, qp); in rcv_hdrerr()
347 } /* Valid packet with TIDErr */ in rcv_hdrerr()
356 if (rhf_use_egr_bfr(packet->rhf)) in rcv_hdrerr()
357 ebuf = packet->ebuf; in rcv_hdrerr()
362 opcode = ib_bth_get_opcode(packet->ohdr); in rcv_hdrerr()
373 sc5 = hfi1_9B_get_sc5(rhdr, packet->rhf); in rcv_hdrerr()
376 lqpn = ib_bth_get_qpn(packet->ohdr); in rcv_hdrerr()
404 packet->rhf &= ~RHF_RCV_TYPE_ERR_SMASK; in rcv_hdrerr()
416 struct hfi1_packet *packet) in init_packet() argument
418 packet->rsize = get_hdrqentsize(rcd); /* words */ in init_packet()
419 packet->maxcnt = get_hdrq_cnt(rcd) * packet->rsize; /* words */ in init_packet()
420 packet->rcd = rcd; in init_packet()
421 packet->updegr = 0; in init_packet()
422 packet->etail = -1; in init_packet()
423 packet->rhf_addr = get_rhf_addr(rcd); in init_packet()
424 packet->rhf = rhf_to_cpu(packet->rhf_addr); in init_packet()
425 packet->rhqoff = hfi1_rcd_head(rcd); in init_packet()
426 packet->numpkt = 0; in init_packet()
437 * @qp: The packet's destination QP
438 * @pkt: The packet itself.
441 * Process the packet's FECN or BECN bits. By now, the packet
446 * normal packet processing to send an ACK with BECN set (or a CNP).
549 struct hfi1_packet *packet) in init_ps_mdata() argument
551 struct hfi1_ctxtdata *rcd = packet->rcd; in init_ps_mdata()
554 mdata->rsize = packet->rsize; in init_ps_mdata()
555 mdata->maxcnt = packet->maxcnt; in init_ps_mdata()
556 mdata->ps_head = packet->rhqoff; in init_ps_mdata()
612 #define prescan_rxq(rcd, packet) \ argument
615 __prescan_rxq(packet); \
617 static void __prescan_rxq(struct hfi1_packet *packet) in __prescan_rxq() argument
619 struct hfi1_ctxtdata *rcd = packet->rcd; in __prescan_rxq()
622 init_ps_mdata(&mdata, packet); in __prescan_rxq()
627 packet->rcd->rhf_offset; in __prescan_rxq()
644 packet->hdr = hfi1_get_msgheader(packet->rcd, rhf_addr); in __prescan_rxq()
645 hdr = packet->hdr; in __prescan_rxq()
649 packet->ohdr = &hdr->u.oth; in __prescan_rxq()
650 packet->grh = NULL; in __prescan_rxq()
652 packet->ohdr = &hdr->u.l.oth; in __prescan_rxq()
653 packet->grh = &hdr->u.l.grh; in __prescan_rxq()
658 if (!hfi1_may_ecn(packet)) in __prescan_rxq()
661 bth1 = be32_to_cpu(packet->ohdr->bth[1]); in __prescan_rxq()
671 hfi1_process_ecn_slowpath(qp, packet, true); in __prescan_rxq()
676 packet->ohdr->bth[1] = cpu_to_be32(bth1); in __prescan_rxq()
682 static void process_rcv_qp_work(struct hfi1_packet *packet) in process_rcv_qp_work() argument
685 struct hfi1_ctxtdata *rcd = packet->rcd; in process_rcv_qp_work()
695 packet->qp = qp; in process_rcv_qp_work()
696 hfi1_send_rc_ack(packet, 0); in process_rcv_qp_work()
712 static noinline int max_packet_exceeded(struct hfi1_packet *packet, int thread) in max_packet_exceeded() argument
715 if ((packet->numpkt & (MAX_PKT_RECV_THREAD - 1)) == 0) in max_packet_exceeded()
717 process_rcv_qp_work(packet); in max_packet_exceeded()
721 this_cpu_inc(*packet->rcd->dd->rcv_limit); in max_packet_exceeded()
726 static inline int check_max_packet(struct hfi1_packet *packet, int thread) in check_max_packet() argument
730 if (unlikely((packet->numpkt & (MAX_PKT_RECV - 1)) == 0)) in check_max_packet()
731 ret = max_packet_exceeded(packet, thread); in check_max_packet()
735 static noinline int skip_rcv_packet(struct hfi1_packet *packet, int thread) in skip_rcv_packet() argument
739 packet->rcd->dd->ctx0_seq_drop++; in skip_rcv_packet()
740 /* Set up for the next packet */ in skip_rcv_packet()
741 packet->rhqoff += packet->rsize; in skip_rcv_packet()
742 if (packet->rhqoff >= packet->maxcnt) in skip_rcv_packet()
743 packet->rhqoff = 0; in skip_rcv_packet()
745 packet->numpkt++; in skip_rcv_packet()
746 ret = check_max_packet(packet, thread); in skip_rcv_packet()
748 packet->rhf_addr = (__le32 *)packet->rcd->rcvhdrq + packet->rhqoff + in skip_rcv_packet()
749 packet->rcd->rhf_offset; in skip_rcv_packet()
750 packet->rhf = rhf_to_cpu(packet->rhf_addr); in skip_rcv_packet()
755 static void process_rcv_packet_napi(struct hfi1_packet *packet) in process_rcv_packet_napi() argument
757 packet->etype = rhf_rcv_type(packet->rhf); in process_rcv_packet_napi()
760 packet->tlen = rhf_pkt_len(packet->rhf); /* in bytes */ in process_rcv_packet_napi()
762 packet->etail = rhf_egr_index(packet->rhf); in process_rcv_packet_napi()
763 packet->ebuf = get_egrbuf(packet->rcd, packet->rhf, in process_rcv_packet_napi()
764 &packet->updegr); in process_rcv_packet_napi()
770 prefetch_range(packet->ebuf, in process_rcv_packet_napi()
771 packet->tlen - ((packet->rcd->rcvhdrqentsize - in process_rcv_packet_napi()
772 (rhf_hdrq_offset(packet->rhf) in process_rcv_packet_napi()
775 packet->rcd->rhf_rcv_function_map[packet->etype](packet); in process_rcv_packet_napi()
776 packet->numpkt++; in process_rcv_packet_napi()
778 /* Set up for the next packet */ in process_rcv_packet_napi()
779 packet->rhqoff += packet->rsize; in process_rcv_packet_napi()
780 if (packet->rhqoff >= packet->maxcnt) in process_rcv_packet_napi()
781 packet->rhqoff = 0; in process_rcv_packet_napi()
783 packet->rhf_addr = (__le32 *)packet->rcd->rcvhdrq + packet->rhqoff + in process_rcv_packet_napi()
784 packet->rcd->rhf_offset; in process_rcv_packet_napi()
785 packet->rhf = rhf_to_cpu(packet->rhf_addr); in process_rcv_packet_napi()
788 static inline int process_rcv_packet(struct hfi1_packet *packet, int thread) in process_rcv_packet() argument
792 packet->etype = rhf_rcv_type(packet->rhf); in process_rcv_packet()
795 packet->tlen = rhf_pkt_len(packet->rhf); /* in bytes */ in process_rcv_packet()
797 packet->ebuf = NULL; in process_rcv_packet()
798 if (rhf_use_egr_bfr(packet->rhf)) { in process_rcv_packet()
799 packet->etail = rhf_egr_index(packet->rhf); in process_rcv_packet()
800 packet->ebuf = get_egrbuf(packet->rcd, packet->rhf, in process_rcv_packet()
801 &packet->updegr); in process_rcv_packet()
807 prefetch_range(packet->ebuf, in process_rcv_packet()
808 packet->tlen - ((get_hdrqentsize(packet->rcd) - in process_rcv_packet()
809 (rhf_hdrq_offset(packet->rhf) in process_rcv_packet()
814 * Call a type specific handler for the packet. We in process_rcv_packet()
821 packet->rcd->rhf_rcv_function_map[packet->etype](packet); in process_rcv_packet()
822 packet->numpkt++; in process_rcv_packet()
824 /* Set up for the next packet */ in process_rcv_packet()
825 packet->rhqoff += packet->rsize; in process_rcv_packet()
826 if (packet->rhqoff >= packet->maxcnt) in process_rcv_packet()
827 packet->rhqoff = 0; in process_rcv_packet()
829 ret = check_max_packet(packet, thread); in process_rcv_packet()
831 packet->rhf_addr = (__le32 *)packet->rcd->rcvhdrq + packet->rhqoff + in process_rcv_packet()
832 packet->rcd->rhf_offset; in process_rcv_packet()
833 packet->rhf = rhf_to_cpu(packet->rhf_addr); in process_rcv_packet()
838 static inline void process_rcv_update(int last, struct hfi1_packet *packet) in process_rcv_update() argument
846 if (!last && !(packet->numpkt & 0xf)) { in process_rcv_update()
847 update_usrhead(packet->rcd, packet->rhqoff, packet->updegr, in process_rcv_update()
848 packet->etail, 0, 0); in process_rcv_update()
849 packet->updegr = 0; in process_rcv_update()
851 packet->grh = NULL; in process_rcv_update()
854 static inline void finish_packet(struct hfi1_packet *packet) in finish_packet() argument
857 * Nothing we need to free for the packet. in finish_packet()
862 update_usrhead(packet->rcd, hfi1_rcd_head(packet->rcd), packet->updegr, in finish_packet()
863 packet->etail, rcv_intr_dynamic, packet->numpkt); in finish_packet()
867 * handle_receive_interrupt_napi_fp - receive a packet
877 struct hfi1_packet packet; in handle_receive_interrupt_napi_fp() local
879 init_packet(rcd, &packet); in handle_receive_interrupt_napi_fp()
880 if (last_rcv_seq(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt_napi_fp()
883 while (packet.numpkt < budget) { in handle_receive_interrupt_napi_fp()
884 process_rcv_packet_napi(&packet); in handle_receive_interrupt_napi_fp()
885 if (hfi1_seq_incr(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt_napi_fp()
888 process_rcv_update(0, &packet); in handle_receive_interrupt_napi_fp()
890 hfi1_set_rcd_head(rcd, packet.rhqoff); in handle_receive_interrupt_napi_fp()
892 finish_packet(&packet); in handle_receive_interrupt_napi_fp()
893 return packet.numpkt; in handle_receive_interrupt_napi_fp()
902 struct hfi1_packet packet; in handle_receive_interrupt_nodma_rtail() local
904 init_packet(rcd, &packet); in handle_receive_interrupt_nodma_rtail()
905 if (last_rcv_seq(rcd, rhf_rcv_seq(packet.rhf))) { in handle_receive_interrupt_nodma_rtail()
910 prescan_rxq(rcd, &packet); in handle_receive_interrupt_nodma_rtail()
913 last = process_rcv_packet(&packet, thread); in handle_receive_interrupt_nodma_rtail()
914 if (hfi1_seq_incr(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt_nodma_rtail()
916 process_rcv_update(last, &packet); in handle_receive_interrupt_nodma_rtail()
918 process_rcv_qp_work(&packet); in handle_receive_interrupt_nodma_rtail()
919 hfi1_set_rcd_head(rcd, packet.rhqoff); in handle_receive_interrupt_nodma_rtail()
921 finish_packet(&packet); in handle_receive_interrupt_nodma_rtail()
929 struct hfi1_packet packet; in handle_receive_interrupt_dma_rtail() local
931 init_packet(rcd, &packet); in handle_receive_interrupt_dma_rtail()
933 if (packet.rhqoff == hdrqtail) { in handle_receive_interrupt_dma_rtail()
939 prescan_rxq(rcd, &packet); in handle_receive_interrupt_dma_rtail()
942 last = process_rcv_packet(&packet, thread); in handle_receive_interrupt_dma_rtail()
943 if (packet.rhqoff == hdrqtail) in handle_receive_interrupt_dma_rtail()
945 process_rcv_update(last, &packet); in handle_receive_interrupt_dma_rtail()
947 process_rcv_qp_work(&packet); in handle_receive_interrupt_dma_rtail()
948 hfi1_set_rcd_head(rcd, packet.rhqoff); in handle_receive_interrupt_dma_rtail()
950 finish_packet(&packet); in handle_receive_interrupt_dma_rtail()
995 static bool __set_armed_to_active(struct hfi1_packet *packet) in __set_armed_to_active() argument
997 u8 etype = rhf_rcv_type(packet->rhf); in __set_armed_to_active()
1001 struct ib_header *hdr = hfi1_get_msgheader(packet->rcd, in __set_armed_to_active()
1002 packet->rhf_addr); in __set_armed_to_active()
1003 sc = hfi1_9B_get_sc5(hdr, packet->rhf); in __set_armed_to_active()
1006 packet->rcd, in __set_armed_to_active()
1007 packet->rhf_addr); in __set_armed_to_active()
1011 int hwstate = driver_lstate(packet->rcd->ppd); in __set_armed_to_active()
1013 &packet->rcd->ppd->linkstate_active_work; in __set_armed_to_active()
1016 dd_dev_info(packet->rcd->dd, in __set_armed_to_active()
1022 queue_work(packet->rcd->ppd->link_wq, lsaw); in __set_armed_to_active()
1030 * @packet: the packet structure
1032 * Return true if packet processing needs to bail.
1034 static bool set_armed_to_active(struct hfi1_packet *packet) in set_armed_to_active() argument
1036 if (likely(packet->rcd->ppd->host_link_state != HLS_UP_ARMED)) in set_armed_to_active()
1038 return __set_armed_to_active(packet); in set_armed_to_active()
1042 * handle_receive_interrupt - receive a packet
1053 struct hfi1_packet packet; in handle_receive_interrupt() local
1061 init_packet(rcd, &packet); in handle_receive_interrupt()
1064 if (last_rcv_seq(rcd, rhf_rcv_seq(packet.rhf))) { in handle_receive_interrupt()
1071 if (packet.rhqoff == hdrqtail) { in handle_receive_interrupt()
1082 if (last_rcv_seq(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt()
1086 prescan_rxq(rcd, &packet); in handle_receive_interrupt()
1090 /* On to the next packet */ in handle_receive_interrupt()
1091 packet.rhqoff += packet.rsize; in handle_receive_interrupt()
1092 packet.rhf_addr = (__le32 *)rcd->rcvhdrq + in handle_receive_interrupt()
1093 packet.rhqoff + in handle_receive_interrupt()
1095 packet.rhf = rhf_to_cpu(packet.rhf_addr); in handle_receive_interrupt()
1098 last = skip_rcv_packet(&packet, thread); in handle_receive_interrupt()
1101 if (set_armed_to_active(&packet)) in handle_receive_interrupt()
1103 last = process_rcv_packet(&packet, thread); in handle_receive_interrupt()
1107 if (hfi1_seq_incr(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt()
1110 if (packet.rhqoff == hdrqtail) in handle_receive_interrupt()
1120 rhf_rcv_seq(packet.rhf)); in handle_receive_interrupt()
1130 process_rcv_update(last, &packet); in handle_receive_interrupt()
1133 process_rcv_qp_work(&packet); in handle_receive_interrupt()
1134 hfi1_set_rcd_head(rcd, packet.rhqoff); in handle_receive_interrupt()
1141 finish_packet(&packet); in handle_receive_interrupt()
1146 * handle_receive_interrupt_napi_sp - receive a packet
1159 struct hfi1_packet packet; in handle_receive_interrupt_napi_sp() local
1161 init_packet(rcd, &packet); in handle_receive_interrupt_napi_sp()
1162 if (last_rcv_seq(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt_napi_sp()
1165 while (last != RCV_PKT_DONE && packet.numpkt < budget) { in handle_receive_interrupt_napi_sp()
1167 /* On to the next packet */ in handle_receive_interrupt_napi_sp()
1168 packet.rhqoff += packet.rsize; in handle_receive_interrupt_napi_sp()
1169 packet.rhf_addr = (__le32 *)rcd->rcvhdrq + in handle_receive_interrupt_napi_sp()
1170 packet.rhqoff + in handle_receive_interrupt_napi_sp()
1172 packet.rhf = rhf_to_cpu(packet.rhf_addr); in handle_receive_interrupt_napi_sp()
1175 if (set_armed_to_active(&packet)) in handle_receive_interrupt_napi_sp()
1177 process_rcv_packet_napi(&packet); in handle_receive_interrupt_napi_sp()
1180 if (hfi1_seq_incr(rcd, rhf_rcv_seq(packet.rhf))) in handle_receive_interrupt_napi_sp()
1188 process_rcv_update(last, &packet); in handle_receive_interrupt_napi_sp()
1191 hfi1_set_rcd_head(rcd, packet.rhqoff); in handle_receive_interrupt_napi_sp()
1198 finish_packet(&packet); in handle_receive_interrupt_napi_sp()
1199 return packet.numpkt; in handle_receive_interrupt_napi_sp()
1204 * changed from ARMED to ACTIVE (due to the arrival of a non-SC15 packet),
1227 /* Received non-SC15 packet implies neighbor_normal */ in receive_interrupt_work()
1244 * Convert a given MTU size to the on-wire MAD packet enumeration.
1306 * MTU is specified per-VL. To ensure that no packet gets in set_mtu()
1307 * stuck (due, e.g., to the MTU for the packet's VL being in set_mtu()
1483 static inline void hfi1_setup_ib_header(struct hfi1_packet *packet) in hfi1_setup_ib_header() argument
1485 packet->hdr = (struct hfi1_ib_message_header *) in hfi1_setup_ib_header()
1486 hfi1_get_msgheader(packet->rcd, in hfi1_setup_ib_header()
1487 packet->rhf_addr); in hfi1_setup_ib_header()
1488 packet->hlen = (u8 *)packet->rhf_addr - (u8 *)packet->hdr; in hfi1_setup_ib_header()
1491 static int hfi1_bypass_ingress_pkt_check(struct hfi1_packet *packet) in hfi1_bypass_ingress_pkt_check() argument
1493 struct hfi1_pportdata *ppd = packet->rcd->ppd; in hfi1_bypass_ingress_pkt_check()
1496 if ((!packet->slid) || (!packet->dlid)) in hfi1_bypass_ingress_pkt_check()
1499 /* Compare port lid with incoming packet dlid */ in hfi1_bypass_ingress_pkt_check()
1500 if ((!(hfi1_is_16B_mcast(packet->dlid))) && in hfi1_bypass_ingress_pkt_check()
1501 (packet->dlid != in hfi1_bypass_ingress_pkt_check()
1503 if ((packet->dlid & ~((1 << ppd->lmc) - 1)) != ppd->lid) in hfi1_bypass_ingress_pkt_check()
1508 if ((hfi1_is_16B_mcast(packet->dlid)) && (packet->sc == 0xF)) in hfi1_bypass_ingress_pkt_check()
1512 if ((packet->dlid == opa_get_lid(be32_to_cpu(OPA_LID_PERMISSIVE), in hfi1_bypass_ingress_pkt_check()
1514 (packet->sc != 0xF)) in hfi1_bypass_ingress_pkt_check()
1520 static int hfi1_setup_9B_packet(struct hfi1_packet *packet) in hfi1_setup_9B_packet() argument
1522 struct hfi1_ibport *ibp = rcd_to_iport(packet->rcd); in hfi1_setup_9B_packet()
1526 hfi1_setup_ib_header(packet); in hfi1_setup_9B_packet()
1527 hdr = packet->hdr; in hfi1_setup_9B_packet()
1531 packet->ohdr = &hdr->u.oth; in hfi1_setup_9B_packet()
1532 packet->grh = NULL; in hfi1_setup_9B_packet()
1536 packet->ohdr = &hdr->u.l.oth; in hfi1_setup_9B_packet()
1537 packet->grh = &hdr->u.l.grh; in hfi1_setup_9B_packet()
1538 if (packet->grh->next_hdr != IB_GRH_NEXT_HDR) in hfi1_setup_9B_packet()
1540 vtf = be32_to_cpu(packet->grh->version_tclass_flow); in hfi1_setup_9B_packet()
1547 /* Query commonly used fields from packet header */ in hfi1_setup_9B_packet()
1548 packet->payload = packet->ebuf; in hfi1_setup_9B_packet()
1549 packet->opcode = ib_bth_get_opcode(packet->ohdr); in hfi1_setup_9B_packet()
1550 packet->slid = ib_get_slid(hdr); in hfi1_setup_9B_packet()
1551 packet->dlid = ib_get_dlid(hdr); in hfi1_setup_9B_packet()
1552 if (unlikely((packet->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) && in hfi1_setup_9B_packet()
1553 (packet->dlid != be16_to_cpu(IB_LID_PERMISSIVE)))) in hfi1_setup_9B_packet()
1554 packet->dlid += opa_get_mcast_base(OPA_MCAST_NR) - in hfi1_setup_9B_packet()
1556 packet->sl = ib_get_sl(hdr); in hfi1_setup_9B_packet()
1557 packet->sc = hfi1_9B_get_sc5(hdr, packet->rhf); in hfi1_setup_9B_packet()
1558 packet->pad = ib_bth_get_pad(packet->ohdr); in hfi1_setup_9B_packet()
1559 packet->extra_byte = 0; in hfi1_setup_9B_packet()
1560 packet->pkey = ib_bth_get_pkey(packet->ohdr); in hfi1_setup_9B_packet()
1561 packet->migrated = ib_bth_is_migration(packet->ohdr); in hfi1_setup_9B_packet()
1569 static int hfi1_setup_bypass_packet(struct hfi1_packet *packet) in hfi1_setup_bypass_packet() argument
1573 * compared to an IB packet. in hfi1_setup_bypass_packet()
1581 struct hfi1_ctxtdata *rcd = packet->rcd; in hfi1_setup_bypass_packet()
1586 packet->hdr = (struct hfi1_16b_header *) in hfi1_setup_bypass_packet()
1587 hfi1_get_16B_header(packet->rcd, in hfi1_setup_bypass_packet()
1588 packet->rhf_addr); in hfi1_setup_bypass_packet()
1589 l4 = hfi1_16B_get_l4(packet->hdr); in hfi1_setup_bypass_packet()
1591 packet->ohdr = packet->ebuf; in hfi1_setup_bypass_packet()
1592 packet->grh = NULL; in hfi1_setup_bypass_packet()
1593 packet->opcode = ib_bth_get_opcode(packet->ohdr); in hfi1_setup_bypass_packet()
1594 packet->pad = hfi1_16B_bth_get_pad(packet->ohdr); in hfi1_setup_bypass_packet()
1596 packet->hlen = hdr_len_by_opcode[packet->opcode] + in hfi1_setup_bypass_packet()
1598 packet->migrated = opa_bth_is_migration(packet->ohdr); in hfi1_setup_bypass_packet()
1603 packet->ohdr = packet->ebuf + grh_len; in hfi1_setup_bypass_packet()
1604 packet->grh = packet->ebuf; in hfi1_setup_bypass_packet()
1605 packet->opcode = ib_bth_get_opcode(packet->ohdr); in hfi1_setup_bypass_packet()
1606 packet->pad = hfi1_16B_bth_get_pad(packet->ohdr); in hfi1_setup_bypass_packet()
1608 packet->hlen = hdr_len_by_opcode[packet->opcode] + in hfi1_setup_bypass_packet()
1610 packet->migrated = opa_bth_is_migration(packet->ohdr); in hfi1_setup_bypass_packet()
1612 if (packet->grh->next_hdr != IB_GRH_NEXT_HDR) in hfi1_setup_bypass_packet()
1614 vtf = be32_to_cpu(packet->grh->version_tclass_flow); in hfi1_setup_bypass_packet()
1618 packet->mgmt = packet->ebuf; in hfi1_setup_bypass_packet()
1619 packet->ohdr = NULL; in hfi1_setup_bypass_packet()
1620 packet->grh = NULL; in hfi1_setup_bypass_packet()
1621 packet->opcode = IB_OPCODE_UD_SEND_ONLY; in hfi1_setup_bypass_packet()
1622 packet->pad = OPA_16B_L4_FM_PAD; in hfi1_setup_bypass_packet()
1623 packet->hlen = OPA_16B_L4_FM_HLEN; in hfi1_setup_bypass_packet()
1624 packet->migrated = false; in hfi1_setup_bypass_packet()
1629 /* Query commonly used fields from packet header */ in hfi1_setup_bypass_packet()
1630 packet->payload = packet->ebuf + packet->hlen - LRH_16B_BYTES; in hfi1_setup_bypass_packet()
1631 packet->slid = hfi1_16B_get_slid(packet->hdr); in hfi1_setup_bypass_packet()
1632 packet->dlid = hfi1_16B_get_dlid(packet->hdr); in hfi1_setup_bypass_packet()
1633 if (unlikely(hfi1_is_16B_mcast(packet->dlid))) in hfi1_setup_bypass_packet()
1634 packet->dlid += opa_get_mcast_base(OPA_MCAST_NR) - in hfi1_setup_bypass_packet()
1637 packet->sc = hfi1_16B_get_sc(packet->hdr); in hfi1_setup_bypass_packet()
1638 packet->sl = ibp->sc_to_sl[packet->sc]; in hfi1_setup_bypass_packet()
1639 packet->extra_byte = SIZE_OF_LT; in hfi1_setup_bypass_packet()
1640 packet->pkey = hfi1_16B_get_pkey(packet->hdr); in hfi1_setup_bypass_packet()
1642 if (hfi1_bypass_ingress_pkt_check(packet)) in hfi1_setup_bypass_packet()
1647 hfi1_cdbg(PKT, "%s: packet dropped\n", __func__); in hfi1_setup_bypass_packet()
1652 static void show_eflags_errs(struct hfi1_packet *packet) in show_eflags_errs() argument
1654 struct hfi1_ctxtdata *rcd = packet->rcd; in show_eflags_errs()
1655 u32 rte = rhf_rcv_type_err(packet->rhf); in show_eflags_errs()
1659 rcd->ctxt, packet->rhf, in show_eflags_errs()
1660 packet->rhf & RHF_K_HDR_LEN_ERR ? "k_hdr_len " : "", in show_eflags_errs()
1661 packet->rhf & RHF_DC_UNC_ERR ? "dc_unc " : "", in show_eflags_errs()
1662 packet->rhf & RHF_DC_ERR ? "dc " : "", in show_eflags_errs()
1663 packet->rhf & RHF_TID_ERR ? "tid " : "", in show_eflags_errs()
1664 packet->rhf & RHF_LEN_ERR ? "len " : "", in show_eflags_errs()
1665 packet->rhf & RHF_ECC_ERR ? "ecc " : "", in show_eflags_errs()
1666 packet->rhf & RHF_ICRC_ERR ? "icrc " : "", in show_eflags_errs()
1670 void handle_eflags(struct hfi1_packet *packet) in handle_eflags() argument
1672 struct hfi1_ctxtdata *rcd = packet->rcd; in handle_eflags()
1674 rcv_hdrerr(rcd, rcd->ppd, packet); in handle_eflags()
1675 if (rhf_err_flags(packet->rhf)) in handle_eflags()
1676 show_eflags_errs(packet); in handle_eflags()
1679 static void hfi1_ipoib_ib_rcv(struct hfi1_packet *packet) in hfi1_ipoib_ib_rcv() argument
1683 struct hfi1_ctxtdata *rcd = packet->rcd; in hfi1_ipoib_ib_rcv()
1693 trace_hfi1_rcvhdr(packet); in hfi1_ipoib_ib_rcv()
1695 hfi1_setup_ib_header(packet); in hfi1_ipoib_ib_rcv()
1697 packet->ohdr = &((struct ib_header *)packet->hdr)->u.oth; in hfi1_ipoib_ib_rcv()
1698 packet->grh = NULL; in hfi1_ipoib_ib_rcv()
1700 if (unlikely(rhf_err_flags(packet->rhf))) { in hfi1_ipoib_ib_rcv()
1701 handle_eflags(packet); in hfi1_ipoib_ib_rcv()
1705 qpnum = ib_bth_get_qpn(packet->ohdr); in hfi1_ipoib_ib_rcv()
1710 trace_input_ibhdr(rcd->dd, packet, !!(rhf_dc_info(packet->rhf))); in hfi1_ipoib_ib_rcv()
1714 do_work = hfi1_may_ecn(packet); in hfi1_ipoib_ib_rcv()
1716 do_cnp = (packet->opcode != IB_OPCODE_CNP); in hfi1_ipoib_ib_rcv()
1718 packet, do_cnp); in hfi1_ipoib_ib_rcv()
1724 * tlen is whole packet len so we need to in hfi1_ipoib_ib_rcv()
1727 tlen = packet->tlen; in hfi1_ipoib_ib_rcv()
1728 extra_bytes = ib_bth_get_pad(packet->ohdr) + (SIZE_OF_CRC << 2) + in hfi1_ipoib_ib_rcv()
1729 packet->hlen; in hfi1_ipoib_ib_rcv()
1735 skb = hfi1_ipoib_prepare_skb(rxq, tlen, packet->ebuf); in hfi1_ipoib_ib_rcv()
1751 ibp = rcd_to_iport(packet->rcd); in hfi1_ipoib_ib_rcv()
1757 * specific handlers for each packet type.
1759 static void process_receive_ib(struct hfi1_packet *packet) in process_receive_ib() argument
1761 if (hfi1_setup_9B_packet(packet)) in process_receive_ib()
1764 if (unlikely(hfi1_dbg_should_fault_rx(packet))) in process_receive_ib()
1767 trace_hfi1_rcvhdr(packet); in process_receive_ib()
1769 if (unlikely(rhf_err_flags(packet->rhf))) { in process_receive_ib()
1770 handle_eflags(packet); in process_receive_ib()
1774 hfi1_ib_rcv(packet); in process_receive_ib()
1777 static void process_receive_bypass(struct hfi1_packet *packet) in process_receive_bypass() argument
1779 struct hfi1_devdata *dd = packet->rcd->dd; in process_receive_bypass()
1781 if (hfi1_setup_bypass_packet(packet)) in process_receive_bypass()
1784 trace_hfi1_rcvhdr(packet); in process_receive_bypass()
1786 if (unlikely(rhf_err_flags(packet->rhf))) { in process_receive_bypass()
1787 handle_eflags(packet); in process_receive_bypass()
1791 if (hfi1_16B_get_l2(packet->hdr) == 0x2) { in process_receive_bypass()
1792 hfi1_16B_rcv(packet); in process_receive_bypass()
1799 u64 *flits = packet->ebuf; in process_receive_bypass()
1801 if (flits && !(packet->rhf & RHF_LEN_ERR)) { in process_receive_bypass()
1804 packet->tlen > sizeof(flits[0]) ? in process_receive_bypass()
1813 static void process_receive_error(struct hfi1_packet *packet) in process_receive_error() argument
1815 /* KHdrHCRCErr -- KDETH packet with a bad HCRC */ in process_receive_error()
1817 hfi1_dbg_fault_suppress_err(&packet->rcd->dd->verbs_dev) && in process_receive_error()
1818 (rhf_rcv_type_err(packet->rhf) == RHF_RCV_TYPE_ERROR || in process_receive_error()
1819 packet->rhf & RHF_DC_ERR))) in process_receive_error()
1822 hfi1_setup_ib_header(packet); in process_receive_error()
1823 handle_eflags(packet); in process_receive_error()
1825 if (unlikely(rhf_err_flags(packet->rhf))) in process_receive_error()
1826 dd_dev_err(packet->rcd->dd, in process_receive_error()
1827 "Unhandled error packet received. Dropping.\n"); in process_receive_error()
1830 static void kdeth_process_expected(struct hfi1_packet *packet) in kdeth_process_expected() argument
1832 hfi1_setup_9B_packet(packet); in kdeth_process_expected()
1833 if (unlikely(hfi1_dbg_should_fault_rx(packet))) in kdeth_process_expected()
1836 if (unlikely(rhf_err_flags(packet->rhf))) { in kdeth_process_expected()
1837 struct hfi1_ctxtdata *rcd = packet->rcd; in kdeth_process_expected()
1839 if (hfi1_handle_kdeth_eflags(rcd, rcd->ppd, packet)) in kdeth_process_expected()
1843 hfi1_kdeth_expected_rcv(packet); in kdeth_process_expected()
1846 static void kdeth_process_eager(struct hfi1_packet *packet) in kdeth_process_eager() argument
1848 hfi1_setup_9B_packet(packet); in kdeth_process_eager()
1849 if (unlikely(hfi1_dbg_should_fault_rx(packet))) in kdeth_process_eager()
1852 trace_hfi1_rcvhdr(packet); in kdeth_process_eager()
1853 if (unlikely(rhf_err_flags(packet->rhf))) { in kdeth_process_eager()
1854 struct hfi1_ctxtdata *rcd = packet->rcd; in kdeth_process_eager()
1856 show_eflags_errs(packet); in kdeth_process_eager()
1857 if (hfi1_handle_kdeth_eflags(rcd, rcd->ppd, packet)) in kdeth_process_eager()
1861 hfi1_kdeth_eager_rcv(packet); in kdeth_process_eager()
1864 static void process_receive_invalid(struct hfi1_packet *packet) in process_receive_invalid() argument
1866 dd_dev_err(packet->rcd->dd, "Invalid packet type %d. Dropping\n", in process_receive_invalid()
1867 rhf_rcv_type(packet->rhf)); in process_receive_invalid()
1874 struct hfi1_packet packet; in seqfile_dump_rcd() local
1889 init_packet(rcd, &packet); in seqfile_dump_rcd()
1890 init_ps_mdata(&mdata, &packet); in seqfile_dump_rcd()
1911 packet.hdr = hfi1_get_msgheader(rcd, rhf_addr); in seqfile_dump_rcd()
1912 hdr = packet.hdr; in seqfile_dump_rcd()
1917 packet.ohdr = &hdr->u.oth; in seqfile_dump_rcd()
1919 packet.ohdr = &hdr->u.l.oth; in seqfile_dump_rcd()
1923 opcode = (be32_to_cpu(packet.ohdr->bth[0]) >> 24); in seqfile_dump_rcd()
1924 qpn = be32_to_cpu(packet.ohdr->bth[1]) & RVT_QPN_MASK; in seqfile_dump_rcd()
1925 psn = mask_psn(be32_to_cpu(packet.ohdr->bth[2])); in seqfile_dump_rcd()