use random uplink. broadcast still broken

This commit is contained in:
Sagar Karandikar 2018-10-17 18:05:55 +00:00
parent e9ace4cc5d
commit c9f555c993
2 changed files with 15 additions and 2 deletions

View File

@ -95,12 +95,16 @@ class AbstractSwitchToSwitchConfig:
def get_numclientsconfig(self):
""" Emit constants for num ports. """
totalports = len(self.fsimswitchnode.downlinks) + len(self.fsimswitchnode.uplinks)
numdownlinks = len(self.fsimswitchnode.downlinks)
numuplinks = len(self.fsimswitchnode.uplinks)
totalports = numdownlinks + numuplinks
retstr = """
#ifdef NUMCLIENTSCONFIG
#define NUMPORTS {}
#endif""".format(totalports)
#define NUMDOWNLINKS {}
#define NUMUPLINKS {}
#endif""".format(totalports, numdownlinks, numuplinks)
return retstr
def get_portsetup(self):

View File

@ -1,3 +1,5 @@
#include <stdlib.h>
/* ----------------------------------------------------
* buffer flit operations
*
@ -63,6 +65,13 @@ uint16_t get_port_from_flit(uint64_t flit, int current_port) {
if (sendport != 0xffff) {
sendport = mac2port[sendport];
}
if (sendport == NUMDOWNLINKS) {
// this has been mapped to "any uplink", so pick one
int randval = rand() % NUMUPLINKS;
sendport = randval + NUMDOWNLINKS;
printf("sending to random uplink.\n");
printf("port: %04x\n", sendport);
}
//printf("port: %04x\n", sendport);
return sendport;
}