Skip to content

Commit

Permalink
cleanup packet header validation in EDM fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanNijjar committed Feb 19, 2025
1 parent b26e037 commit 94f717f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ enum NocSendType : uint8_t {
NOC_UNICAST_INLINE_WRITE = 1,
NOC_MULTICAST_WRITE = 2,
NOC_UNICAST_ATOMIC_INC = 3,
NOC_MULTICAST_ATOMIC_INC = 4
NOC_MULTICAST_ATOMIC_INC = 4,
NOC_SEND_TYPE_LAST = NOC_MULTICAST_ATOMIC_INC
};
// How to send the payload across the cluster
// 1 bit
enum ChipSendType : uint8_t {
CHIP_UNICAST = 0,
CHIP_MULTICAST = 1,
CHIP_SEND_TYPE_LAST = CHIP_MULTICAST
};

struct RoutingFields {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

namespace tt::fabric {

FORCE_INLINE void validate(const PacketHeader& packet_header) { ASSERT(packet_header.chip_send_type < 2); }
FORCE_INLINE void validate(const PacketHeader& packet_header) {
ASSERT(packet_header.chip_send_type <= CHIP_SEND_TYPE_LAST);
}
FORCE_INLINE bool is_valid(PacketHeader const& packet_header) {
return (packet_header.chip_send_type < 2) && (packet_header.noc_send_type < 2);
return (packet_header.chip_send_type <= CHIP_SEND_TYPE_LAST) && (packet_header.noc_send_type <= NOC_SEND_TYPE_LAST);
}

} // namespace tt::fabric

0 comments on commit 94f717f

Please sign in to comment.