Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SendQ header length bug #9

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ OUTPUTDIR ?= output
LOGFILE ?= run.log
RUNTOPHASE ?= place # synth place route all
PARTNAME = xcvu13p-fhgb2104-2-i
TARGETFILE ?= ../src/SendQ.bsv
TOPMODULE ?= mkSQ
# TARGETFILE ?= ../src/QueuePair.bsv
# TOPMODULE ?= mkQP
TARGETFILE ?= ../src/TransportLayer.bsv
TOPMODULE ?= mkTransportLayer
# TARGETFILE ?= ../src/TransportLayer.bsv
# TOPMODULE ?= mkTransportLayer

export TOP = $(TOPMODULE)
export RTL = $(VLOGDIR)
Expand Down
10 changes: 9 additions & 1 deletion src/ExtractAndPrependPipeOut.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,15 @@ module mkDataStream2Header#(
let headerLastFragByteEn = genByteEn(rdmaHeader.headerMetaData.lastFragValidByteNum);
headerOutQ.enq(rdmaHeader);
busyReg <= False;
// $display("time=%0t: rdmaHeader=", $time, fshow(rdmaHeader));

// let { transType, rdmaOpCode } =
// extractTranTypeAndRdmaOpCode(rdmaHeader.headerData);
// $display(
// "time=%0t: mkDataStream2Header", $time,
// ", rdmaOpCode=", fshow(rdmaOpCode),
// ", transType=", fshow(transType),
// ", rdmaHeader=", fshow(rdmaHeader)
// );

immAssert(
headerLastFragByteEn == curDataStreamFrag.byteEn,
Expand Down
2 changes: 1 addition & 1 deletion src/Headers.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function Integer calcHeaderLenByTransTypeAndRdmaOpCode(
endcase;
endfunction
/*
// TODO: enable this after refactor
// TODO: enable this after refactor RQ
function Integer calcHeaderLenByTransTypeAndRdmaOpCode(
TransType transType, RdmaOpCode rdmaOpCode
);
Expand Down
3 changes: 2 additions & 1 deletion src/InputPktHandle.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ module mkExtractHeaderFromRdmaPktPipeOut#(
headerMetaDataInQ.enq(headerMetaData);
// $display(
// "time=%0t: extractHeader", $time,
// ", headerLen=%0d, transType=", headerLen, fshow(transType),
// ", headerLen=%0d", headerLen,
// ", rdmaOpCode=", fshow(rdmaOpCode),
// ", transType=", fshow(transType),
// ", rdmaPktDataStream=", fshow(rdmaPktDataStream),
// ", headerHasPayload=", fshow(headerHasPayload),
// ", headerMetaData=", fshow(headerMetaData)
Expand Down
63 changes: 45 additions & 18 deletions src/SendQ.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function Maybe#(PktHeaderInfo) genFirstOrOnlyPktHeader(
IBV_QPT_RC ,
IBV_QPT_XRC_SEND,
IBV_QPT_XRC_RECV: tagged Valid genPktHeaderInfo(
zeroExtendLSB({ pack(bth), pack(reth) }),
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(reth)) }),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
Expand Down Expand Up @@ -416,45 +416,48 @@ function Maybe#(PktHeaderInfo) genMiddleOrLastPktHeader(
case (wqe.opcode)
IBV_WR_RDMA_WRITE:begin
return case (wqe.qpType)
IBV_QPT_RC: tagged Valid genPktHeaderInfo(
zeroExtendLSB(pack(bth)),
fromInteger(valueOf(BTH_BYTE_WIDTH)),
IBV_QPT_RC,
IBV_QPT_UC: tagged Valid genPktHeaderInfo(
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(reth)) }),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
IBV_QPT_XRC_SEND: tagged Valid genPktHeaderInfo(
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)) }),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH)),
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)), pack(unwrapMaybe(reth)) }),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
default: tagged Invalid;
endcase;
end
IBV_WR_RDMA_WRITE_WITH_IMM: begin
return case (wqe.qpType)
IBV_QPT_RC: tagged Valid genPktHeaderInfo(
IBV_QPT_RC,
IBV_QPT_UC: tagged Valid genPktHeaderInfo(
isLastReqPkt ?
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(immDt))}) :
zeroExtendLSB(pack(bth)),
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(reth)), pack(unwrapMaybe(immDt))}) :
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(reth)) }),
isLastReqPkt ?
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(IMM_DT_BYTE_WIDTH)) :
fromInteger(valueOf(BTH_BYTE_WIDTH)),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH) + valueOf(IMM_DT_BYTE_WIDTH)) :
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
IBV_QPT_XRC_SEND: tagged Valid genPktHeaderInfo(
isLastReqPkt ?
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)), pack(unwrapMaybe(immDt)) }) :
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)) }),
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)), pack(unwrapMaybe(reth)), pack(unwrapMaybe(immDt)) }) :
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(xrceth)), pack(unwrapMaybe(reth)) }),
isLastReqPkt ?
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH) + valueOf(IMM_DT_BYTE_WIDTH)) :
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH)),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH) + valueOf(IMM_DT_BYTE_WIDTH)) :
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(XRCETH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
default: tagged Invalid;
endcase;
end
IBV_WR_SEND: begin
return case (wqe.qpType)
IBV_QPT_RC: tagged Valid genPktHeaderInfo(
IBV_QPT_RC,
IBV_QPT_UC: tagged Valid genPktHeaderInfo(
zeroExtendLSB(pack(bth)),
fromInteger(valueOf(BTH_BYTE_WIDTH)),
hasPayload
Expand All @@ -469,7 +472,8 @@ function Maybe#(PktHeaderInfo) genMiddleOrLastPktHeader(
end
IBV_WR_SEND_WITH_IMM: begin
return case (wqe.qpType)
IBV_QPT_RC: tagged Valid genPktHeaderInfo(
IBV_QPT_RC,
IBV_QPT_UC: tagged Valid genPktHeaderInfo(
isLastReqPkt ?
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(immDt)) }) :
zeroExtendLSB(pack(bth)),
Expand Down Expand Up @@ -518,7 +522,7 @@ function Maybe#(PktHeaderInfo) genMiddleOrLastPktHeader(
IBV_QPT_RC ,
IBV_QPT_XRC_SEND,
IBV_QPT_XRC_RECV: tagged Valid genPktHeaderInfo(
zeroExtendLSB({ pack(bth), pack(reth) }),
zeroExtendLSB({ pack(bth), pack(unwrapMaybe(reth)) }),
fromInteger(valueOf(BTH_BYTE_WIDTH) + valueOf(RETH_BYTE_WIDTH)),
hasPayload
);
Expand Down Expand Up @@ -1049,3 +1053,26 @@ module mkSendQ#(
pktHeaderQ.notEmpty
);
endmodule

interface SQ;
interface DmaReadClt dmaReadClt;
interface SendQ sendQ;
endinterface

(* synthesize *)
module mkSQ#(Bool clearAll)(SQ);
FIFOF#(DmaReadReq) dmaReadReqQ <- mkFIFOF;
FIFOF#(DmaReadResp) dmaReadRespQ <- mkFIFOF;

let dmaReadSrv = toGPServer(dmaReadReqQ, dmaReadRespQ);
let dmaReadCntrl <- mkDmaReadCntrl(clearAll, dmaReadSrv);

// TODO: add shouldAddPadding to PayloadGenReqSG
let shouldAddPadding = True;
let payloadGenerator <- mkPayloadGenerator(clearAll, shouldAddPadding, dmaReadCntrl);

let sq <- mkSendQ(clearAll, payloadGenerator);

interface dmaReadClt = toGPClient(dmaReadReqQ, dmaReadRespQ);
interface sendQ = sq;
endmodule
Loading