Skip to content

Commit e730139

Browse files
jpawladledford
authored andcommitted
IB/hfi1: Disable header suppression for short packets
For the received packets with payload less or equal 8DWS RxDmaDataFifoRdUncErr is not reported. There is set RHF.EccErr if the header is not suppressed. When such packet is detected on the send side the header suppression mechanism is disabled by clearing SH bit in the packet header. Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com> Signed-off-by: Jakub Pawlak <jakub.pawlak@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 1b9e774 commit e730139

File tree

2 files changed

+44
-18
lines changed

2 files changed

+44
-18
lines changed

drivers/infiniband/hw/hfi1/user_sdma.c

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12
115115
#define KDETH_HCRC_LOWER_MASK 0xff
116116

117117
#define AHG_KDETH_INTR_SHIFT 12
118+
#define AHG_KDETH_SH_SHIFT 13
118119

119120
#define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4)
120121
#define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff)
@@ -144,8 +145,9 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12
144145
#define KDETH_OM_LARGE 64
145146
#define KDETH_OM_MAX_SIZE (1 << ((KDETH_OM_LARGE / KDETH_OM_SMALL) + 1))
146147

147-
/* Last packet in the request */
148-
#define TXREQ_FLAGS_REQ_LAST_PKT BIT(0)
148+
/* Tx request flag bits */
149+
#define TXREQ_FLAGS_REQ_ACK BIT(0) /* Set the ACK bit in the header */
150+
#define TXREQ_FLAGS_REQ_DISABLE_SH BIT(1) /* Disable header suppression */
149151

150152
/* SDMA request flag bits */
151153
#define SDMA_REQ_FOR_THREAD 1
@@ -943,8 +945,13 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
943945
tx->busycount = 0;
944946
INIT_LIST_HEAD(&tx->list);
945947

948+
/*
949+
* For the last packet set the ACK request
950+
* and disable header suppression.
951+
*/
946952
if (req->seqnum == req->info.npkts - 1)
947-
tx->flags |= TXREQ_FLAGS_REQ_LAST_PKT;
953+
tx->flags |= (TXREQ_FLAGS_REQ_ACK |
954+
TXREQ_FLAGS_REQ_DISABLE_SH);
948955

949956
/*
950957
* Calculate the payload size - this is min of the fragment
@@ -963,11 +970,22 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
963970
}
964971

965972
datalen = compute_data_length(req, tx);
973+
974+
/*
975+
* Disable header suppression for the payload <= 8DWS.
976+
* If there is an uncorrectable error in the receive
977+
* data FIFO when the received payload size is less than
978+
* or equal to 8DWS then the RxDmaDataFifoRdUncErr is
979+
* not reported.There is set RHF.EccErr if the header
980+
* is not suppressed.
981+
*/
966982
if (!datalen) {
967983
SDMA_DBG(req,
968984
"Request has data but pkt len is 0");
969985
ret = -EFAULT;
970986
goto free_tx;
987+
} else if (datalen <= 32) {
988+
tx->flags |= TXREQ_FLAGS_REQ_DISABLE_SH;
971989
}
972990
}
973991

@@ -990,6 +1008,10 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
9901008
LRH2PBC(lrhlen);
9911009
tx->hdr.pbc[0] = cpu_to_le16(pbclen);
9921010
}
1011+
ret = check_header_template(req, &tx->hdr,
1012+
lrhlen, datalen);
1013+
if (ret)
1014+
goto free_tx;
9931015
ret = sdma_txinit_ahg(&tx->txreq,
9941016
SDMA_TXREQ_F_AHG_COPY,
9951017
sizeof(tx->hdr) + datalen,
@@ -1351,7 +1373,7 @@ static int set_txreq_header(struct user_sdma_request *req,
13511373
req->seqnum));
13521374

13531375
/* Set ACK request on last packet */
1354-
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT))
1376+
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_ACK))
13551377
hdr->bth[2] |= cpu_to_be32(1UL << 31);
13561378

13571379
/* Set the new offset */
@@ -1384,8 +1406,8 @@ static int set_txreq_header(struct user_sdma_request *req,
13841406
/* Set KDETH.TID based on value for this TID */
13851407
KDETH_SET(hdr->kdeth.ver_tid_offset, TID,
13861408
EXP_TID_GET(tidval, IDX));
1387-
/* Clear KDETH.SH only on the last packet */
1388-
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT))
1409+
/* Clear KDETH.SH when DISABLE_SH flag is set */
1410+
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_DISABLE_SH))
13891411
KDETH_SET(hdr->kdeth.ver_tid_offset, SH, 0);
13901412
/*
13911413
* Set the KDETH.OFFSET and KDETH.OM based on size of
@@ -1429,7 +1451,7 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,
14291451
/* BTH.PSN and BTH.A */
14301452
val32 = (be32_to_cpu(hdr->bth[2]) + req->seqnum) &
14311453
(HFI1_CAP_IS_KSET(EXTENDED_PSN) ? 0x7fffffff : 0xffffff);
1432-
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT))
1454+
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_ACK))
14331455
val32 |= 1UL << 31;
14341456
AHG_HEADER_SET(req->ahg, diff, 6, 0, 16, cpu_to_be16(val32 >> 16));
14351457
AHG_HEADER_SET(req->ahg, diff, 6, 16, 16, cpu_to_be16(val32 & 0xffff));
@@ -1468,19 +1490,23 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,
14681490
AHG_HEADER_SET(req->ahg, diff, 7, 0, 16,
14691491
((!!(req->omfactor - KDETH_OM_SMALL)) << 15 |
14701492
((req->tidoffset / req->omfactor) & 0x7fff)));
1471-
/* KDETH.TIDCtrl, KDETH.TID */
1493+
/* KDETH.TIDCtrl, KDETH.TID, KDETH.Intr, KDETH.SH */
14721494
val = cpu_to_le16(((EXP_TID_GET(tidval, CTRL) & 0x3) << 10) |
1473-
(EXP_TID_GET(tidval, IDX) & 0x3ff));
1474-
/* Clear KDETH.SH on last packet */
1475-
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT)) {
1476-
val |= cpu_to_le16(KDETH_GET(hdr->kdeth.ver_tid_offset,
1477-
INTR) <<
1478-
AHG_KDETH_INTR_SHIFT);
1479-
val &= cpu_to_le16(~(1U << 13));
1480-
AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val);
1495+
(EXP_TID_GET(tidval, IDX) & 0x3ff));
1496+
1497+
if (unlikely(tx->flags & TXREQ_FLAGS_REQ_DISABLE_SH)) {
1498+
val |= cpu_to_le16((KDETH_GET(hdr->kdeth.ver_tid_offset,
1499+
INTR) <<
1500+
AHG_KDETH_INTR_SHIFT));
14811501
} else {
1482-
AHG_HEADER_SET(req->ahg, diff, 7, 16, 12, val);
1502+
val |= KDETH_GET(hdr->kdeth.ver_tid_offset, SH) ?
1503+
cpu_to_le16(0x1 << AHG_KDETH_SH_SHIFT) :
1504+
cpu_to_le16((KDETH_GET(hdr->kdeth.ver_tid_offset,
1505+
INTR) <<
1506+
AHG_KDETH_INTR_SHIFT));
14831507
}
1508+
1509+
AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val);
14841510
}
14851511

14861512
trace_hfi1_sdma_user_header_ahg(pq->dd, pq->ctxt, pq->subctxt,

include/uapi/rdma/hfi/hfi1_user.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
* may not be implemented; the user code must deal with this if it
7676
* cares, or it must abort after initialization reports the difference.
7777
*/
78-
#define HFI1_USER_SWMINOR 2
78+
#define HFI1_USER_SWMINOR 3
7979

8080
/*
8181
* We will encode the major/minor inside a single 32bit version number.

0 commit comments

Comments
 (0)