Skip to content

Commit 4097359

Browse files
committed
[pda] Fix a bug that resulted to incorrect initialization of PdaDmaBuffer
1 parent 05b23ca commit 4097359

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Crorc/CrorcDmaChannel.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ CrorcDmaChannel::CrorcDmaChannel(const Parameters& parameters)
6767
{
6868
// Create and register the buffer
6969
// Note: if resizing the file fails, we might've accidentally put the file in a hugetlbfs mount with 1 GB page size
70-
Utilities::resetSmartPtr(mSuperpageInfoFile, getPaths().spInfo(), kSuperpageInfoSize, true);
70+
SerialId serialId = { getSerialNumber(), getEndpointNumber() };
71+
Utilities::resetSmartPtr(mSuperpageInfoFile, getPaths().spInfo(), kSuperpageInfoSize, false);
7172
Utilities::resetSmartPtr(mPdaDmaBufferFifo, getRocPciDevice().getPciDevice(), mSuperpageInfoFile->getAddress(),
72-
kSuperpageInfoSize, getPdaDmaBufferIndexFifo(getChannelNumber()), false); // note the 'false' at the end specifies non-hugepage memory
73+
kSuperpageInfoSize, getPdaDmaBufferIndexFifo(getChannelNumber()), serialId, false); // note the 'false' at the end specifies non-hugepage memory
7374

7475
const auto& entry = mPdaDmaBufferFifo->getScatterGatherList().at(0);
7576
if (entry.size < kSuperpageInfoSize) {

src/DmaBufferProvider/FilePdaDmaBufferProvider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ namespace roc
3434
class FilePdaDmaBufferProvider : public DmaBufferProviderInterface
3535
{
3636
public:
37-
FilePdaDmaBufferProvider(PciDevice* pciDevice, std::string path, size_t size, int dmaBufferId,
37+
FilePdaDmaBufferProvider(PciDevice* pciDevice, std::string path, size_t size, int dmaBufferId, SerialId serialId,
3838
bool requireHugepage)
39-
: mMappedFile(path, size), mAddress(mMappedFile.getAddress()), mSize(mMappedFile.getSize()), mPdaBuffer(pciDevice, mAddress, mSize, dmaBufferId, requireHugepage)
39+
: mMappedFile(path, size), mAddress(mMappedFile.getAddress()), mSize(mMappedFile.getSize()), mPdaBuffer(pciDevice, mAddress, mSize, dmaBufferId, serialId, requireHugepage)
4040
{
4141
}
4242

src/DmaChannelPdaBase.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ DmaChannelPdaBase::DmaChannelPdaBase(const Parameters& parameters,
6262
[&](buffer_parameters::File parameters) {
6363
log("Initializing with DMA buffer from memory-mapped file", LogDebugDevel);
6464
return std::make_unique<FilePdaDmaBufferProvider>(mRocPciDevice->getPciDevice(), parameters.path,
65-
parameters.size, bufferId, true);
65+
parameters.size, bufferId, mRocPciDevice->getSerialId(), true);
6666
},
6767
[&](buffer_parameters::Null) {
6868
log("Initializing with null DMA buffer", LogDebugDevel);

0 commit comments

Comments
 (0)