Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Testing
Commits
04dd60d2
Commit
04dd60d2
authored
May 03, 2014
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smartbits-tester: configure multiple streams per port
parent
8e84ce99
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
136 deletions
+283
-136
smartbits.c
sw/smartbits-tester/smartbits.c
+3
-2
smartbits.h
sw/smartbits-tester/smartbits.h
+2
-1
tests_body.c
sw/smartbits-tester/tests_body.c
+174
-55
tests_body.h
sw/smartbits-tester/tests_body.h
+19
-3
wrs_smb.c
sw/smartbits-tester/wrs_smb.c
+85
-75
No files found.
sw/smartbits-tester/smartbits.c
View file @
04dd60d2
...
...
@@ -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] = {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
);
for
(
i
=
0
;
i
<
SMB_PORTS
;
++
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
);
...
...
sw/smartbits-tester/smartbits.h
View file @
04dd60d2
...
...
@@ -24,6 +24,7 @@
#define PORT_TO_PMASK(i) (1<<(i))
#define MAX_STREAMS 4
#define FRAME_SZ 60
#define LINKUP_TIMEOUT 10
#define TRAFFIC_START 1
...
...
@@ -46,7 +47,7 @@ void show_card_info(int p);
void
show_cntrs
(
HTCountStructure
*
cs
,
int
p1
);
void
latency_meas
(
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
detect_stop
(
void
);
...
...
sw/smartbits-tester/tests_body.c
View file @
04dd60d2
This diff is collapsed.
Click to expand it.
sw/smartbits-tester/tests_body.h
View file @
04dd60d2
...
...
@@ -4,6 +4,7 @@
#include "et1000.h"
#include "smartbits.h"
/* functional tests */
#define TEST_2_1_1 0
#define TEST_2_1_2 1
#define TEST_2_2_1 2
...
...
@@ -11,13 +12,18 @@
#define TEST_2_2_5 4
#define TEST_2_2_6 5
#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
];
#define DPORT_NONE 0xFE
//
#define DPORT_NONE 0xFE
#define TX_PALL 0x4
#define VID_NONE -1
#define RX_PALL 0xFF
#define RX_ALLUNI 0xFE
#define VLAN_TAG(vid,prio) ((0x8100 << 16) | (prio<<13) | (vid))
#define NOVLAN_TAG 0x0800
...
...
@@ -30,13 +36,23 @@ extern const char* TLIST[7];
#define T_2XX_FNUM 1000
#define T_2XX_UNRECOG_THR 10
#define FLOAD_MAXTAB 12
#define FSIZE_MAXTAB 6
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_pri
;
//priority, if 802.1d, make it -1
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
ftime
;
//length of burst in seconds
};
struct
smb_port_rx
{
...
...
sw/smartbits-tester/wrs_smb.c
View file @
04dd60d2
...
...
@@ -57,6 +57,7 @@ int main()
}
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;
printf
(
"
\n\n
------ TEST %s ------
\n
"
,
TLIST
[
test_no
]);
fprintf
(
logfile
,
"
\n\n
------ TEST %s ------
\n
"
,
TLIST
[
test_no
]);
...
...
@@ -84,6 +85,7 @@ int main()
++
t_fail
;
show_allcntrs
(
logfile
,
SMB_PALL
,
cntrs
);
}
show_allcntrs
(
stdout
,
SMB_PALL
,
cntrs
);
NSDelay
(
5
);
}
...
...
@@ -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
;
StreamIPVLAN
strv
;
static
StreamIP
str
[
MAX_STREAMS
];
static
int
n_streams
=
0
;
static
StreamIPVLAN
strv
[
MAX_STREAMS
];
NSPortTransmit
tx_mode
;
L3StreamExtension
l3_ext
;
static
L3StreamExtension
l3_ext
[
MAX_STREAMS
]
;
unsigned
long
eth_speed
;
char
dip
[
4
]
=
{
192
,
168
,
1
,
1
};
char
sip
[
4
]
=
{
192
,
168
,
1
,
3
};
/* 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
if
(
vid
<
0
)
{
if
(
vid
<
0
&&
idx
>=
0
)
{
//////// no VLAN ///////////
bzero
(
&
str
,
sizeof
(
StreamIP
));
str
.
ucActive
=
1
;
str
.
ucProtocolType
=
STREAM_PROTOCOL_IP
;
str
.
uiFrameLength
=
fsize
;
str
.
ucTagField
=
1
;
memcpy
(
str
.
DestinationMAC
,
dmac
,
6
);
memcpy
(
str
.
SourceMAC
,
smac
,
6
);
str
.
TimeToLive
=
255
;
str
.
InitialSequenceNumber
=
0
;
bzero
(
str
.
DestinationIP
,
4
);
bzero
(
str
.
SourceIP
,
4
);
memcpy
(
str
.
DestinationIP
,
dip
,
4
);
memcpy
(
str
.
SourceIP
,
sip
,
4
);
str
.
Protocol
=
4
;
//IP Stream
bzero
(
&
str
[
idx
],
sizeof
(
StreamIP
));
str
[
idx
].
ucActive
=
1
;
str
[
idx
].
ucProtocolType
=
STREAM_PROTOCOL_IP
;
str
[
idx
].
uiFrameLength
=
fsize
;
str
[
idx
].
ucTagField
=
1
;
memcpy
(
str
[
idx
].
DestinationMAC
,
dmac
,
6
);
memcpy
(
str
[
idx
].
SourceMAC
,
smac
,
6
);
str
[
idx
].
TimeToLive
=
255
;
str
[
idx
].
InitialSequenceNumber
=
0
;
bzero
(
str
[
idx
].
DestinationIP
,
4
);
bzero
(
str
[
idx
].
SourceIP
,
4
);
memcpy
(
str
[
idx
].
DestinationIP
,
dip
,
4
);
memcpy
(
str
[
idx
].
SourceIP
,
sip
,
4
);
str
[
idx
].
Protocol
=
4
;
//str.uiActualSequenceNumber = 0xcafe;
CHECKERROR
(
HTSetStructure
(
L3_DEFINE_IP_STREAM
,
0
,
0
,
0
,
&
str
,
sizeof
(
StreamIP
),
HUB
,
SLOT
,
port
)
);
}
else
{
n_streams
++
;
}
else
if
(
vid
>=
0
&&
idx
>=
0
)
{
//////// VLANs ///////////
bzero
(
&
strv
,
sizeof
(
StreamIP
));
strv
.
ucActive
=
1
;
strv
.
ucProtocolType
=
STREAM_PROTOCOL_IP_VLAN
;
strv
.
uiFrameLength
=
fsize
;
strv
.
ucTagField
=
0
;
memcpy
(
strv
.
DestinationMAC
,
dmac
,
6
);
memcpy
(
strv
.
SourceMAC
,
smac
,
6
);
strv
.
TimeToLive
=
255
;
strv
.
InitialSequenceNumber
=
0
;
bzero
(
strv
.
DestinationIP
,
4
);
bzero
(
strv
.
SourceIP
,
4
);
bzero
(
strv
.
Netmask
,
4
);
memcpy
(
strv
.
DestinationIP
,
dip
,
4
);
memcpy
(
strv
.
SourceIP
,
sip
,
4
);
bzero
(
strv
.
Gateway
,
4
);
strv
.
Protocol
=
4
;
strv
.
VLAN_Pri
=
v_pri
;
strv
.
VLAN_Cfi
=
VLAN_CFI_RIF_ABSENT
;
strv
.
VLAN_Vid
=
vid
;
CHECKERROR
(
HTSetStructure
(
L3_DEFINE_IP_STREAM_VLAN
,
0
,
0
,
0
,
&
strv
,
sizeof
(
StreamIPVLAN
),
HUB
,
SLOT
,
port
)
);
bzero
(
&
strv
[
idx
],
sizeof
(
StreamIP
));
strv
[
idx
].
ucActive
=
1
;
strv
[
idx
].
ucProtocolType
=
STREAM_PROTOCOL_IP_VLAN
;
strv
[
idx
].
uiFrameLength
=
fsize
;
strv
[
idx
].
ucTagField
=
0
;
memcpy
(
strv
[
idx
].
DestinationMAC
,
dmac
,
6
);
memcpy
(
strv
[
idx
].
SourceMAC
,
smac
,
6
);
strv
[
idx
].
TimeToLive
=
255
;
strv
[
idx
].
InitialSequenceNumber
=
0
;
bzero
(
strv
[
idx
].
DestinationIP
,
4
);
bzero
(
strv
[
idx
].
SourceIP
,
4
);
bzero
(
strv
[
idx
].
Netmask
,
4
);
memcpy
(
strv
[
idx
].
DestinationIP
,
dip
,
4
);
memcpy
(
strv
[
idx
].
SourceIP
,
sip
,
4
);
bzero
(
strv
[
idx
].
Gateway
,
4
);
strv
[
idx
].
Protocol
=
4
;
strv
[
idx
].
VLAN_Pri
=
v_pri
;
strv
[
idx
].
VLAN_Cfi
=
VLAN_CFI_RIF_ABSENT
;
strv
[
idx
].
VLAN_Vid
=
vid
;
n_streams
++
;
}
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
//CHECKERROR( HTScheduleMode(SCHEDULE_MODE_FRAME_RATE, HUB, SLOT, p_tx) );
//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
)
);
// Stream EXT
//printf("Calculated %lu frames/sec for %f ratio\n", ratio_to_fps(fsize, ratio), ratio);
bzero
(
&
l3_ext
,
sizeof
(
L3StreamExtension
));
l3_ext
.
ulFrameRate
=
ratio_to_fps
(
fsize
,
ratio
);
if
(
fnum
>
0
)
{
l3_ext
.
ulBurstCount
=
1000
;
l3_ext
.
ulTxMode
=
L3_SINGLE_BURST_MODE
;
}
else
{
l3_ext
.
ulBurstCount
=
0
;
l3_ext
.
ulTxMode
=
L3_CONTINUOUS_MODE
;
if
(
idx
>=
0
)
{
bzero
(
&
l3_ext
[
idx
],
sizeof
(
L3StreamExtension
));
l3_ext
[
idx
].
ulFrameRate
=
ratio_to_fps
(
fsize
,
ratio
);
l3_ext
[
idx
].
ulBurstCount
=
fnum
;
l3_ext
[
idx
].
uiInitialSeqNumber
=
0
;
l3_ext
[
idx
].
ucIPHeaderChecksumError
=
0
;
if
(
fnum
>
0
)
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, ð_speed, sizeof(unsigned long), HUB, SLOT, p_tx) );
//CHECKERROR( HTSetStructure(ETH_SET_SPEED, 0, 0, 0, ð_speed, sizeof(unsigned long), HUB, SLOT, p_rx) ); //do I need that?
return
0
;
}
...
...
@@ -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);
setup_stream
(
p_tx
,
mac
[
1
],
mac
[
0
],
FRAME_SZ
,
1000
,
0
.
1
,
5
,
-
1
);
setup_stream
(
p_rx
,
mac
[
0
],
mac
[
1
],
FRAME_SZ
,
1234
,
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
,
0
);
//wait_linkup(SMB_P0 | SMB_P1);
smb_set_trigger
(
mac
[
0
],
p_rx
,
6
,
6
,
HTTRIGGER_1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment