fix broadcast handling for clos topols

This commit is contained in:
Sagar Karandikar 2018-10-17 18:31:02 +00:00
parent c9f555c993
commit 46a379632b
1 changed files with 5 additions and 1 deletions

View File

@ -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));