Skip to content

Commit 37de563

Browse files
committed
dpdk-ring - prefetch dequeued packets before processing
1 parent 5adbd36 commit 37de563

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

input/dpdk-ring.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ InputPlugin::Result DpdkRingReader::get(PacketBlock& packets)
196196
if (pkts_read_ == 0) {
197197
return Result::TIMEOUT;
198198
}
199+
prefetchPackets();
199200
for (auto i = 0; i < pkts_read_; i++) {
200201
parse_packet(&opt,
201202
m_parser_stats,
@@ -256,4 +257,11 @@ void DpdkRingReader::getDynfieldInfo()
256257
}
257258
}
258259

260+
void DpdkRingReader::prefetchPackets() {
261+
for (auto i = 0; i < pkts_read_; i++) {
262+
__builtin_prefetch(mbufs_[i], 0, 2);
263+
__builtin_prefetch((uint8_t*)mbufs_[i] + 64, 0, 2);
264+
}
265+
}
266+
259267
} // namespace ipxp

input/dpdk-ring.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class DpdkRingReader : public InputPlugin {
152152

153153
telemetry::Content get_queue_telemetry();
154154
void getDynfieldInfo();
155+
void prefetchPackets();
155156

156157
std::vector<rte_mbuf *> mbufs_;
157158
std::uint16_t pkts_read_;

0 commit comments

Comments
 (0)