Commit 04dd60d2 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

smartbits-tester: configure multiple streams per port

parent 8e84ce99
...@@ -345,11 +345,12 @@ int smb_learning(int mask, char mac[][6], int fnum) ...@@ -345,11 +345,12 @@ int smb_learning(int mask, char mac[][6], int fnum)
char broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; char broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
//char broadcast[6] = {0x90, 0xe2, 0xba, 0x17, 0xa7, 0xaf}; //char broadcast[6] = {0x90, 0xe2, 0xba, 0x17, 0xa7, 0xaf};
printf("Learning on ports: 0x%X\n", mask); //printf("Learning on ports: 0x%X\n", mask);
wait_linkup(mask); wait_linkup(mask);
for (i=0; i<SMB_PORTS; ++i) { for (i=0; i<SMB_PORTS; ++i) {
if (mask & (1<<i)) { if (mask & (1<<i)) {
setup_stream(i, broadcast, mac[i], FRAME_SZ, fnum, 0.001, 0, -1); setup_stream(i, broadcast, mac[i], FRAME_SZ, fnum, 0.001, 0, -1, 0);
setup_stream(i, broadcast, mac[i], FRAME_SZ, fnum, 0.001, 0, -1, -1);
} }
} }
run_traffic(mask, 1); run_traffic(mask, 1);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define PORT_TO_PMASK(i) (1<<(i)) #define PORT_TO_PMASK(i) (1<<(i))
#define MAX_STREAMS 4
#define FRAME_SZ 60 #define FRAME_SZ 60
#define LINKUP_TIMEOUT 10 #define LINKUP_TIMEOUT 10
#define TRAFFIC_START 1 #define TRAFFIC_START 1
...@@ -46,7 +47,7 @@ void show_card_info(int p); ...@@ -46,7 +47,7 @@ void show_card_info(int p);
void show_cntrs(HTCountStructure *cs, int p1); void show_cntrs(HTCountStructure *cs, int p1);
void latency_meas(int p_tx, int p_rx); void latency_meas(int p_tx, int p_rx);
int basic_traffic(int fsize, int p_tx, int p_rx); int basic_traffic(int fsize, int p_tx, int p_rx);
int setup_stream(int port, char *dmac, char *smac, int fsize, int fnum, float ratio, int v_pri, int vid); int setup_stream(int port, char *dmac, char *smac, int fsize, int fnum, float ratio, int v_pri, int vid, int idx);
int temp_run_test(int p_tx, int p_rx); int temp_run_test(int p_tx, int p_rx);
int detect_stop(void); int detect_stop(void);
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "et1000.h" #include "et1000.h"
#include "smartbits.h" #include "smartbits.h"
/* functional tests */
#define TEST_2_1_1 0 #define TEST_2_1_1 0
#define TEST_2_1_2 1 #define TEST_2_1_2 1
#define TEST_2_2_1 2 #define TEST_2_2_1 2
...@@ -11,13 +12,18 @@ ...@@ -11,13 +12,18 @@
#define TEST_2_2_5 4 #define TEST_2_2_5 4
#define TEST_2_2_6 5 #define TEST_2_2_6 5
#define TEST_2_2_7 6 #define TEST_2_2_7 6
/* performance tests */
#define VAR1 0
#define VAR2 1
#define TEST_3_1_1 7
extern const char* TLIST[7]; extern const char* TLIST[7];
#define DPORT_NONE 0xFE //#define DPORT_NONE 0xFE
#define TX_PALL 0x4 #define TX_PALL 0x4
#define VID_NONE -1 #define VID_NONE -1
#define RX_PALL 0xFF #define RX_PALL 0xFF
#define RX_ALLUNI 0xFE
#define VLAN_TAG(vid,prio) ((0x8100 << 16) | (prio<<13) | (vid)) #define VLAN_TAG(vid,prio) ((0x8100 << 16) | (prio<<13) | (vid))
#define NOVLAN_TAG 0x0800 #define NOVLAN_TAG 0x0800
...@@ -30,13 +36,23 @@ extern const char* TLIST[7]; ...@@ -30,13 +36,23 @@ extern const char* TLIST[7];
#define T_2XX_FNUM 1000 #define T_2XX_FNUM 1000
#define T_2XX_UNRECOG_THR 10 #define T_2XX_UNRECOG_THR 10
#define FLOAD_MAXTAB 12
#define FSIZE_MAXTAB 6
struct smb_port_tx { struct smb_port_tx {
int d_port; //SMB destination port index [0..3]; 0xff for broadcast int d_ports[SMB_PORTS]; //SMB destination port index [0..3]; 0xff for broadcast
int d_ports_n;
int q_vid; //VLAN ID, if 802.1d, make it -1 int q_vid; //VLAN ID, if 802.1d, make it -1
int q_pri; //priority, if 802.1d, make it -1 int q_pri; //priority, if 802.1d, make it -1
int fsize; //size of transmitted frames int fsize; //size of transmitted frames
int fload; //traffic load [1..100]% int fsize_step;
int fsize_stop;
int fsize_tab[FSIZE_MAXTAB];
int fsize_n;
int fload[FLOAD_MAXTAB]; //traffic load [1..100]%
int fload_n;
int fnum; //amount of frames sent in a single burst int fnum; //amount of frames sent in a single burst
int ftime; //length of burst in seconds
}; };
struct smb_port_rx { struct smb_port_rx {
......
...@@ -57,6 +57,7 @@ int main() ...@@ -57,6 +57,7 @@ int main()
} }
for(test_no=0; test_no<6; ++test_no) { for(test_no=0; test_no<6; ++test_no) {
//for(test_no=TEST_2_2_1; test_no<TEST_2_2_1+1; ++test_no) {
//test_no = TEST_2_2_2; //test_no = TEST_2_2_2;
printf("\n\n------ TEST %s ------\n", TLIST[test_no]); printf("\n\n------ TEST %s ------\n", TLIST[test_no]);
fprintf(logfile, "\n\n------ TEST %s ------\n", TLIST[test_no]); fprintf(logfile, "\n\n------ TEST %s ------\n", TLIST[test_no]);
...@@ -84,6 +85,7 @@ int main() ...@@ -84,6 +85,7 @@ int main()
++t_fail; ++t_fail;
show_allcntrs(logfile, SMB_PALL, cntrs); show_allcntrs(logfile, SMB_PALL, cntrs);
} }
show_allcntrs(stdout, SMB_PALL, cntrs);
NSDelay(5); NSDelay(5);
} }
...@@ -318,95 +320,103 @@ int basic_traffic(int fsize, int p_tx, int p_rx) ...@@ -318,95 +320,103 @@ int basic_traffic(int fsize, int p_tx, int p_rx)
} }
int setup_stream(int port, char *dmac, char *smac, int fsize, int fnum, float ratio, int v_pri, int vid) int setup_stream(int port, char *dmac, char *smac, int fsize, int fnum, float ratio, int v_pri, int vid, int idx)
{ {
StreamIP str; static StreamIP str[MAX_STREAMS];
StreamIPVLAN strv; static int n_streams = 0;
static StreamIPVLAN strv[MAX_STREAMS];
NSPortTransmit tx_mode; NSPortTransmit tx_mode;
L3StreamExtension l3_ext; static L3StreamExtension l3_ext[MAX_STREAMS];
unsigned long eth_speed; unsigned long eth_speed;
char dip[4] = {192, 168, 1, 1}; char dip[4] = {192, 168, 1, 1};
char sip[4] = {192, 168, 1, 3}; char sip[4] = {192, 168, 1, 3};
/* procedure according to page 332 of SmartLibrary Overview */ /* procedure according to page 332 of SmartLibrary Overview */
//printf("stream: port %d, dmac %02x:%02x:%02x:%02x:%02x:%02x, smac %02x:%02x:%02x:%02x:%02x:%02x, size %d, fnum %d, ratio %f, pri %d, vid %d, idx %d\n",
// port, dmac[0]&0xff, dmac[1]&0xff, dmac[2]&0xff, dmac[3]&0xff, dmac[4]&0xff, dmac[5]&0xff,
// smac[0]&0xff, smac[1]&0xff, smac[2]&0xff, smac[3]&0xff, smac[4]&0xff, smac[5]&0xff, fsize, fnum, ratio, v_pri, vid, idx);
//6 //6
if (vid < 0 ) { if (vid < 0 && idx >=0 ) {
//////// no VLAN /////////// //////// no VLAN ///////////
bzero(&str, sizeof(StreamIP)); //IP Stream
str.ucActive = 1; bzero(&str[idx], sizeof(StreamIP));
str.ucProtocolType = STREAM_PROTOCOL_IP; str[idx].ucActive = 1;
str.uiFrameLength = fsize; str[idx].ucProtocolType = STREAM_PROTOCOL_IP;
str[idx].uiFrameLength = fsize;
str.ucTagField = 1;
memcpy(str.DestinationMAC, dmac, 6); str[idx].ucTagField = 1;
memcpy(str.SourceMAC, smac, 6); memcpy(str[idx].DestinationMAC, dmac, 6);
str.TimeToLive = 255; memcpy(str[idx].SourceMAC, smac, 6);
str.InitialSequenceNumber = 0; str[idx].TimeToLive = 255;
bzero(str.DestinationIP, 4); str[idx].InitialSequenceNumber = 0;
bzero(str.SourceIP, 4); bzero(str[idx].DestinationIP, 4);
memcpy(str.DestinationIP, dip, 4); bzero(str[idx].SourceIP, 4);
memcpy(str.SourceIP, sip, 4); memcpy(str[idx].DestinationIP, dip, 4);
str.Protocol = 4; memcpy(str[idx].SourceIP, sip, 4);
str[idx].Protocol = 4;
//str.uiActualSequenceNumber = 0xcafe; //str.uiActualSequenceNumber = 0xcafe;
CHECKERROR( HTSetStructure(L3_DEFINE_IP_STREAM, 0, 0, 0, &str, sizeof(StreamIP), HUB, SLOT, port) ); n_streams++;
} else { }
else if (vid >= 0 && idx >= 0) {
//////// VLANs /////////// //////// VLANs ///////////
bzero(&strv, sizeof(StreamIP)); bzero(&strv[idx], sizeof(StreamIP));
strv.ucActive = 1; strv[idx].ucActive = 1;
strv.ucProtocolType = STREAM_PROTOCOL_IP_VLAN; strv[idx].ucProtocolType = STREAM_PROTOCOL_IP_VLAN;
strv.uiFrameLength = fsize; strv[idx].uiFrameLength = fsize;
strv.ucTagField = 0; strv[idx].ucTagField = 0;
memcpy(strv.DestinationMAC, dmac, 6); memcpy(strv[idx].DestinationMAC, dmac, 6);
memcpy(strv.SourceMAC, smac, 6); memcpy(strv[idx].SourceMAC, smac, 6);
strv.TimeToLive = 255; strv[idx].TimeToLive = 255;
strv.InitialSequenceNumber = 0; strv[idx].InitialSequenceNumber = 0;
bzero(strv.DestinationIP, 4); bzero(strv[idx].DestinationIP, 4);
bzero(strv.SourceIP, 4); bzero(strv[idx].SourceIP, 4);
bzero(strv.Netmask, 4); bzero(strv[idx].Netmask, 4);
memcpy(strv.DestinationIP, dip, 4); memcpy(strv[idx].DestinationIP, dip, 4);
memcpy(strv.SourceIP, sip, 4); memcpy(strv[idx].SourceIP, sip, 4);
bzero(strv.Gateway, 4); bzero(strv[idx].Gateway, 4);
strv.Protocol = 4; strv[idx].Protocol = 4;
strv.VLAN_Pri = v_pri; strv[idx].VLAN_Pri = v_pri;
strv.VLAN_Cfi = VLAN_CFI_RIF_ABSENT; strv[idx].VLAN_Cfi = VLAN_CFI_RIF_ABSENT;
strv.VLAN_Vid = vid; strv[idx].VLAN_Vid = vid;
n_streams++;
CHECKERROR( HTSetStructure(L3_DEFINE_IP_STREAM_VLAN, 0, 0, 0, &strv, sizeof(StreamIPVLAN), HUB, SLOT, port) ); }
else if(vid<0 && idx == -1) {
CHECKERROR( HTSetStructure(L3_DEFINE_IP_STREAM, 0, 0, 0, str, n_streams*sizeof(StreamIP), HUB, SLOT, port) );
} }
else if(vid>=0 && idx == -1)
CHECKERROR( HTSetStructure(L3_DEFINE_IP_STREAM_VLAN, 0, 0, 0, strv, n_streams*sizeof(StreamIPVLAN), HUB, SLOT, port) );
//7 //7
//CHECKERROR( HTScheduleMode(SCHEDULE_MODE_FRAME_RATE, HUB, SLOT, p_tx) ); // Stream EXT
//CHECKERROR( HTTransmitMode(SINGLE_BURST_MODE, HUB, SLOT, p_tx) );
//CHECKERROR( HTBurstCount(1000, HUB, SLOT, p_tx) );
bzero(&tx_mode, sizeof(NSPortTransmit));
if (fnum > 0) {
tx_mode.ulBurstCount = fnum;
tx_mode.ucTransmitMode = SINGLE_BURST_MODE;
} else {
tx_mode.ulBurstCount = 0;
tx_mode.ucTransmitMode = CONTINUOUS_PACKET_MODE;
}
tx_mode.ucScheduleMode = SCHEDULE_MODE_FRAME_RATE;
tx_mode.ucRandomGapEnable = 0;
CHECKERROR( HTSetStructure(NS_PORT_TRANSMIT, 0, 0, 0, &tx_mode, sizeof(NSPortTransmit), HUB, SLOT, port) );
//printf("Calculated %lu frames/sec for %f ratio\n", ratio_to_fps(fsize, ratio), ratio); //printf("Calculated %lu frames/sec for %f ratio\n", ratio_to_fps(fsize, ratio), ratio);
bzero(&l3_ext, sizeof(L3StreamExtension)); if (idx >= 0) {
l3_ext.ulFrameRate = ratio_to_fps(fsize, ratio); bzero(&l3_ext[idx], sizeof(L3StreamExtension));
if (fnum > 0) { l3_ext[idx].ulFrameRate = ratio_to_fps(fsize, ratio);
l3_ext.ulBurstCount = 1000; l3_ext[idx].ulBurstCount = fnum;
l3_ext.ulTxMode = L3_SINGLE_BURST_MODE; l3_ext[idx].uiInitialSeqNumber = 0;
} else { l3_ext[idx].ucIPHeaderChecksumError = 0;
l3_ext.ulBurstCount = 0; if (fnum > 0)
l3_ext.ulTxMode = L3_CONTINUOUS_MODE; l3_ext[idx].ulTxMode = L3_SINGLE_BURST_MODE;
else
l3_ext[idx].ulTxMode = L3_CONTINUOUS_MODE;
}
else {
//printf("define L3 EXT for %d streams\n", n_streams);
CHECKERROR( HTSetStructure(L3_DEFINE_STREAM_EXTENSION, 0, 0, 0,
l3_ext, n_streams*sizeof(L3StreamExtension), HUB, SLOT, port) );
bzero(&tx_mode, sizeof(NSPortTransmit));
tx_mode.ulBurstCount = n_streams*fnum;
tx_mode.ucScheduleMode = SCHEDULE_MODE_FRAME_RATE;
tx_mode.ucRandomGapEnable = 0;
if (fnum > 0)
tx_mode.ucTransmitMode = SINGLE_BURST_MODE;
else
tx_mode.ucTransmitMode = CONTINUOUS_PACKET_MODE;
CHECKERROR( HTSetStructure(NS_PORT_TRANSMIT, 0, 0, 0, &tx_mode, sizeof(NSPortTransmit), HUB, SLOT, port) );
n_streams = 0;
} }
l3_ext.uiInitialSeqNumber = 0;
l3_ext.ucIPHeaderChecksumError = 0;
CHECKERROR( HTSetStructure(L3_DEFINE_STREAM_EXTENSION, 0, 0, 0, &l3_ext, sizeof(L3StreamExtension), HUB, SLOT, port) );
//8
//eth_speed = SPEED_1GHZ;
//CHECKERROR( HTSetStructure(ETH_SET_SPEED, 0, 0, 0, &eth_speed, sizeof(unsigned long), HUB, SLOT, p_tx) );
//CHECKERROR( HTSetStructure(ETH_SET_SPEED, 0, 0, 0, &eth_speed, sizeof(unsigned long), HUB, SLOT, p_rx) ); //do I need that?
return 0; return 0;
} }
...@@ -425,8 +435,8 @@ int temp_run_test(int p_tx, int p_rx) ...@@ -425,8 +435,8 @@ int temp_run_test(int p_tx, int p_rx)
//smb_learning(SMB_P0 | SMB_P1 | SMB_P2 | SMB_P3, mac, 3); //smb_learning(SMB_P0 | SMB_P1 | SMB_P2 | SMB_P3, mac, 3);
setup_stream(p_tx, mac[1], mac[0], FRAME_SZ, 1000, 0.1, 5, -1); setup_stream(p_tx, mac[1], mac[0], FRAME_SZ, 1000, 0.1, 5, -1, 0);
setup_stream(p_rx, mac[0], mac[1], FRAME_SZ, 1234, 0.1, 5, -1); setup_stream(p_rx, mac[0], mac[1], FRAME_SZ, 1234, 0.1, 5, -1, 0);
//wait_linkup(SMB_P0 | SMB_P1); //wait_linkup(SMB_P0 | SMB_P1);
smb_set_trigger(mac[0], p_rx, 6, 6, HTTRIGGER_1); smb_set_trigger(mac[0], p_rx, 6, 6, HTTRIGGER_1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment