@@ -831,6 +831,10 @@ struct hfi1_pportdata {
831
831
typedef int (* rhf_rcv_function_ptr )(struct hfi1_packet * packet );
832
832
833
833
typedef void (* opcode_handler )(struct hfi1_packet * packet );
834
+ typedef void (* hfi1_make_req )(struct rvt_qp * qp ,
835
+ struct hfi1_pkt_state * ps ,
836
+ struct rvt_swqe * wqe );
837
+
834
838
835
839
/* return values for the RHF receive functions */
836
840
#define RHF_RCV_CONTINUE 0 /* keep going */
@@ -1373,6 +1377,13 @@ void hfi1_set_vnic_msix_info(struct hfi1_ctxtdata *rcd);
1373
1377
void hfi1_reset_vnic_msix_info (struct hfi1_ctxtdata * rcd );
1374
1378
1375
1379
extern const struct pci_device_id hfi1_pci_tbl [];
1380
+ void hfi1_make_ud_req_9B (struct rvt_qp * qp ,
1381
+ struct hfi1_pkt_state * ps ,
1382
+ struct rvt_swqe * wqe );
1383
+
1384
+ void hfi1_make_ud_req_16B (struct rvt_qp * qp ,
1385
+ struct hfi1_pkt_state * ps ,
1386
+ struct rvt_swqe * wqe );
1376
1387
1377
1388
/* receive packet handler dispositions */
1378
1389
#define RCV_PKT_OK 0x0 /* keep going */
@@ -1507,6 +1518,18 @@ void process_becn(struct hfi1_pportdata *ppd, u8 sl, u16 rlid, u32 lqpn,
1507
1518
void return_cnp (struct hfi1_ibport * ibp , struct rvt_qp * qp , u32 remote_qpn ,
1508
1519
u32 pkey , u32 slid , u32 dlid , u8 sc5 ,
1509
1520
const struct ib_grh * old_grh );
1521
+ void return_cnp_16B (struct hfi1_ibport * ibp , struct rvt_qp * qp ,
1522
+ u32 remote_qpn , u32 pkey , u32 slid , u32 dlid ,
1523
+ u8 sc5 , const struct ib_grh * old_grh );
1524
+ typedef void (* hfi1_handle_cnp )(struct hfi1_ibport * ibp , struct rvt_qp * qp ,
1525
+ u32 remote_qpn , u32 pkey , u32 slid , u32 dlid ,
1526
+ u8 sc5 , const struct ib_grh * old_grh );
1527
+
1528
+ /* We support only two types - 9B and 16B for now */
1529
+ static const hfi1_handle_cnp hfi1_handle_cnp_tbl [2 ] = {
1530
+ [HFI1_PKT_TYPE_9B ] = & return_cnp ,
1531
+ [HFI1_PKT_TYPE_16B ] = & return_cnp_16B
1532
+ };
1510
1533
#define PKEY_CHECK_INVALID -1
1511
1534
int egress_pkey_check (struct hfi1_pportdata * ppd , __be16 * lrh , __be32 * bth ,
1512
1535
u8 sc5 , int8_t s_pkey_index );
@@ -1747,12 +1770,22 @@ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt,
1747
1770
bool do_cnp )
1748
1771
{
1749
1772
struct ib_other_headers * ohdr = pkt -> ohdr ;
1750
- u32 bth1 ;
1751
1773
1752
- bth1 = be32_to_cpu (ohdr -> bth [1 ]);
1753
- if (unlikely (bth1 & (IB_BECN_SMASK | IB_FECN_SMASK ))) {
1774
+ u32 bth1 ;
1775
+ bool becn = false;
1776
+ bool fecn = false;
1777
+
1778
+ if (pkt -> etype == RHF_RCV_TYPE_BYPASS ) {
1779
+ fecn = hfi1_16B_get_fecn (pkt -> hdr );
1780
+ becn = hfi1_16B_get_becn (pkt -> hdr );
1781
+ } else {
1782
+ bth1 = be32_to_cpu (ohdr -> bth [1 ]);
1783
+ fecn = bth1 & IB_FECN_SMASK ;
1784
+ becn = bth1 & IB_BECN_SMASK ;
1785
+ }
1786
+ if (unlikely (fecn || becn )) {
1754
1787
hfi1_process_ecn_slowpath (qp , pkt , do_cnp );
1755
- return !!( bth1 & IB_FECN_SMASK ) ;
1788
+ return fecn ;
1756
1789
}
1757
1790
return false;
1758
1791
}
@@ -2315,4 +2348,80 @@ static inline bool hfi1_get_hdr_type(u32 lid, struct rdma_ah_attr *attr)
2315
2348
2316
2349
return hfi1_get_packet_type (lid );
2317
2350
}
2351
+
2352
+ static inline void hfi1_make_ext_grh (struct hfi1_packet * packet ,
2353
+ struct ib_grh * grh , u32 slid ,
2354
+ u32 dlid )
2355
+ {
2356
+ struct hfi1_ibport * ibp = & packet -> rcd -> ppd -> ibport_data ;
2357
+ struct hfi1_pportdata * ppd = ppd_from_ibp (ibp );
2358
+
2359
+ if (!ibp )
2360
+ return ;
2361
+
2362
+ grh -> hop_limit = 1 ;
2363
+ grh -> sgid .global .subnet_prefix = ibp -> rvp .gid_prefix ;
2364
+ if (slid == opa_get_lid (be32_to_cpu (OPA_LID_PERMISSIVE ), 16B ))
2365
+ grh -> sgid .global .interface_id =
2366
+ OPA_MAKE_ID (be32_to_cpu (OPA_LID_PERMISSIVE ));
2367
+ else
2368
+ grh -> sgid .global .interface_id = OPA_MAKE_ID (slid );
2369
+
2370
+ /*
2371
+ * Upper layers (like mad) may compare the dgid in the
2372
+ * wc that is obtained here with the sgid_index in
2373
+ * the wr. Since sgid_index in wr is always 0 for
2374
+ * extended lids, set the dgid here to the default
2375
+ * IB gid.
2376
+ */
2377
+ grh -> dgid .global .subnet_prefix = ibp -> rvp .gid_prefix ;
2378
+ grh -> dgid .global .interface_id =
2379
+ cpu_to_be64 (ppd -> guids [HFI1_PORT_GUID_INDEX ]);
2380
+ }
2381
+
2382
+ static inline int hfi1_get_16b_padding (u32 hdr_size , u32 payload )
2383
+ {
2384
+ return - (hdr_size + payload + (SIZE_OF_CRC << 2 ) +
2385
+ SIZE_OF_LT ) & 0x7 ;
2386
+ }
2387
+
2388
+ static inline void hfi1_make_ib_hdr (struct ib_header * hdr ,
2389
+ u16 lrh0 , u16 len ,
2390
+ u16 dlid , u16 slid )
2391
+ {
2392
+ hdr -> lrh [0 ] = cpu_to_be16 (lrh0 );
2393
+ hdr -> lrh [1 ] = cpu_to_be16 (dlid );
2394
+ hdr -> lrh [2 ] = cpu_to_be16 (len );
2395
+ hdr -> lrh [3 ] = cpu_to_be16 (slid );
2396
+ }
2397
+
2398
+ static inline void hfi1_make_16b_hdr (struct hfi1_16b_header * hdr ,
2399
+ u32 slid , u32 dlid ,
2400
+ u16 len , u16 pkey ,
2401
+ u8 becn , u8 fecn , u8 l4 ,
2402
+ u8 sc )
2403
+ {
2404
+ u32 lrh0 = 0 ;
2405
+ u32 lrh1 = 0x40000000 ;
2406
+ u32 lrh2 = 0 ;
2407
+ u32 lrh3 = 0 ;
2408
+
2409
+ lrh0 = (lrh0 & ~OPA_16B_BECN_MASK ) | (becn << OPA_16B_BECN_SHIFT );
2410
+ lrh0 = (lrh0 & ~OPA_16B_LEN_MASK ) | (len << OPA_16B_LEN_SHIFT );
2411
+ lrh0 = (lrh0 & ~OPA_16B_LID_MASK ) | (slid & OPA_16B_LID_MASK );
2412
+ lrh1 = (lrh1 & ~OPA_16B_FECN_MASK ) | (fecn << OPA_16B_FECN_SHIFT );
2413
+ lrh1 = (lrh1 & ~OPA_16B_SC_MASK ) | (sc << OPA_16B_SC_SHIFT );
2414
+ lrh1 = (lrh1 & ~OPA_16B_LID_MASK ) | (dlid & OPA_16B_LID_MASK );
2415
+ lrh2 = (lrh2 & ~OPA_16B_SLID_MASK ) |
2416
+ ((slid >> OPA_16B_SLID_SHIFT ) << OPA_16B_SLID_HIGH_SHIFT );
2417
+ lrh2 = (lrh2 & ~OPA_16B_DLID_MASK ) |
2418
+ ((dlid >> OPA_16B_DLID_SHIFT ) << OPA_16B_DLID_HIGH_SHIFT );
2419
+ lrh2 = (lrh2 & ~OPA_16B_PKEY_MASK ) | (pkey << OPA_16B_PKEY_SHIFT );
2420
+ lrh2 = (lrh2 & ~OPA_16B_L4_MASK ) | l4 ;
2421
+
2422
+ hdr -> lrh [0 ] = lrh0 ;
2423
+ hdr -> lrh [1 ] = lrh1 ;
2424
+ hdr -> lrh [2 ] = lrh2 ;
2425
+ hdr -> lrh [3 ] = lrh3 ;
2426
+ }
2318
2427
#endif /* _HFI1_KERNEL_H */
0 commit comments