Skip to content
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
4 changes: 4 additions & 0 deletions proto/frontend/src/packet_io_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ class PacketInMutate {
generic_extract(pkt, bit_offset, bitwidth, buffer.data());
bit_offset += (bitwidth % 8);
pkt += (bitwidth / 8);
if (bit_offset >= 8) {
pkt += (bit_offset / 8);
bit_offset = bit_offset % 8;
}
metadata->set_value(bytestring_pi_to_p4rt(buffer.data(), buffer.size()));
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions proto/tests/test_proto_fe_packet_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ struct ValueIterator {
class DeviceMgrPacketIOMetadataTest : public DeviceMgrPacketIOTest {
public:
static constexpr int num = 3;
static constexpr int bw1 = 2;
static constexpr int bw2 = 9;
static constexpr int bw3 = 5;
static constexpr int bw1 = 7;
static constexpr int bw2 = 7;
static constexpr int bw3 = 2;
using VType = std::array<int, num>;

protected:
Expand Down