From 46a379632be7f98893e4fbe3a44e3b393c0cdb78 Mon Sep 17 00:00:00 2001 From: Sagar Karandikar Date: Wed, 17 Oct 2018 18:31:02 +0000 Subject: [PATCH] fix broadcast handling for clos topols --- target-design/switch/switch.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target-design/switch/switch.cc b/target-design/switch/switch.cc index 296dd4d3..2c79c180 100644 --- a/target-design/switch/switch.cc +++ b/target-design/switch/switch.cc @@ -159,7 +159,11 @@ while (!pqueue.empty()) { printf("packet for port: %x\n", send_to_port); printf("packet timestamp: %ld\n", tsp->timestamp); if (send_to_port == BROADCAST_ADJUSTED) { - for (int i = 0; i < NUMPORTS; i++) { +#define ADDUPLINK (NUMUPLINKS > 0 ? 1 : 0) + // this will only send broadcasts to the first (zeroeth) uplink. + // on a switch receiving broadcast packet from an uplink, this should + // automatically prevent switch from sending the broadcast to any uplink + for (int i = 0; i < NUMDOWNLINKS + ADDUPLINK; i++) { if (i != tsp->sender ) { switchpacket * tsp2 = (switchpacket*)malloc(sizeof(switchpacket)); memcpy(tsp2, tsp, sizeof(switchpacket));