Commit 8823a213 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

Merge branch 'greg-smbits'

parents 4df5984d 758dd0a1
CC = gcc
NAME = wrs_smb
CFLAGS = -I ../../smartlib/include
LDFLAGS = -L ../../smartlib/lib
LIB = ../../smartlib/lib/libetsmb.so
OBJ = wrs_smb.o smartbits.o tests_body.o switch_config.o
all: $(OBJ)
$(CC) $(LDFLAGS) -o $(NAME) $^ $(LIB)
%.o : %.c
$(CC) -c $(CFLAGS) $^
clean:
rm -rf *.o wrs_smb
This diff is collapsed.
#ifndef __SMARTBITS_H__
#define __SMARTBITS_H__
#define HUB 0
#define SLOT 7
#define IPADR "10.11.34.101"
//#define IPADR "127.0.0.1"
#define FIBER 1
#define BANK 0
//FIBER 0 BANK 0 -> regular ETH switch
//FIBER 1 BANK 0 -> WR switch
//FIBER 0 BANK 1 -> PCBE13137
//FIBER 1 BANK 1 -> loopback
/****** SmartBits device ******/
#define SMB_PORTS 4
#define SMB_P0 0x01
#define SMB_P1 0x02
#define SMB_P2 0x04
#define SMB_P3 0x08
#define SMB_PALL (SMB_P0 | SMB_P1 | SMB_P2 | SMB_P3)
#define PORT_TO_PMASK(i) (1<<(i))
#define MAX_STREAMS 4
#define FRAME_SZ 60
#define LINKUP_TIMEOUT 10
#define TRAFFIC_START 1
#define TRAFFIC_STOP 0
// macro CHECKERROR:
// in case of error displays the function name and the status
#define CHECKERROR(givenfunction) \
{\
int _____ireturncode = (givenfunction); \
if( _____ireturncode < 0 ) \
fprintf(stderr, "\n%s = %d\n", #givenfunction, _____ireturncode); \
}
struct smb_test;
void linkToSmartBits();
void setTrigger(int h1, int s1, int p1);
void clearCounters(int h1, int s1, int p1);
int set_port_config(int p);
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 idx);
int temp_run_test(int p_tx, int p_rx);
int detect_stop(void);
long ratio_to_fps(int frame_size, float ratio);
long ratio_to_gap(int frame_size, float ratio);
int get_allcntrs(int mask, HTCountStructure *cntrs);
int show_allcntrs(FILE *f, int mask, HTCountStructure *cntrs);
int clear_allcntrs(int mask);
int show_floss(FILE *f, HTCountStructure *cntrs, unsigned long *total);
int reset_ports(int mask);
int run_traffic(int mask, int start);
int smb_learning(int mask, char [][6], int fnum);
int wait_linkup(int mask);
int smb_set_trigger(char *pat, int port, int offset, int range, int trigno);
int wait_test_done(int mask, int sec);
int exp_rx_frames(struct smb_test *wrst, HTCountStructure *cntrs, unsigned long *exp);
#endif
#include <stdio.h>
#include <stdlib.h>
#include "switch_config.h"
int wrs_config(char *ip, int testno)
{
char cmd[100];
int list[16] = {211, 212, 221, 222, 225, 226, 227, 311, 312, 313, 314, 315, 321, 322, 331, 332};
sprintf(cmd, "ssh -p %d root@%s %s %d >/dev/null 2>&1", WRS_PORT, ip, WRS_CONF_SCRIPT, list[testno]);
return system(cmd);
}
#ifndef __SWITCH_CONFIG_H__
#define __SWITCH_CONFIG_H__
#define WRS_PORT 2223
#define WRS_CONF_SCRIPT "/root/wrs_vlan_config.sh"
int wrs_config(char *ip, int testno);
#endif
This diff is collapsed.
#ifndef __TESTS_BODY_H__
#define __TESTS_BODY_H__
#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
#define TEST_2_2_2 3
#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
#define TEST_3_1_2 8
#define TEST_3_1_3 9
#define TEST_3_1_4 10
#define TEST_3_1_5 11
#define TEST_3_2_1 12
#define TEST_3_2_2 13
#define TEST_3_3_1 14
#define TEST_3_3_2 15
extern const char* TLIST[16];
//#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
#define TEST_PASSED 2
#define TEST_WARNING 1
#define TEST_FAILED 0
#define NEXT_STEP 1
#define NONEXT_STEP 0
#define TEST_FUNCTIONAL 0
#define TEST_PERFORMANCE 1
/* Tests parameters */
#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_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 fsize_start;
int fsize_step;
int fsize_stop;
int fsize_tab[FSIZE_MAXTAB];
int fsize_n;
int fload; /* currently used frame load */
int fload_tab[FLOAD_MAXTAB]; //traffic load tab to test[1..100]%
int fload_n;
int fnum; //amount of frames sent in a single burst
};
struct smb_port_rx {
int s_port; //Source SMB port for setting TRIG1
char trig2_len; //TRIG2 pattern length, if 0 TRIG2 not set
char trig2_pat[6]; //TRIG2 pattern - Ethtype + VLAN tag
};
struct smb_test {
struct smb_port_tx ptx[SMB_PORTS];
struct smb_port_rx prx[SMB_PORTS];
int learning;
int variants;
int ftime; //length of burst in seconds
int test_type;
int permute;
int force_prst; // force ports reset for each tested load/size
};
void init_wr_tests(int num, int variant);
int run_test( HTCountStructure *cntrs, char mac[][6] );
int anl_result( HTCountStructure *cntrs, int testno);
int run_and_analyze(int test_no, FILE *logfile);
int next_testcase(int reset);
#endif
This diff is collapsed.
#ifndef __WRS_SMB_H__
#define __WRS_SMB_H__
#define LOG_FILE "wrs-test"
FILE* open_logfile();
#endif
#!/bin/sh
# remove all possible VLANs
/wr/bin/rtu_stat vlan 1 1 0x0 1
/wr/bin/rtu_stat vlan 2 2 0x0 1
/wr/bin/rtu_stat vlan 3 3 0x0 1
/wr/bin/rtu_stat vlan 4 4 0x0 1
/wr/bin/rtu_stat vlan 5 5 0x0 1
/wr/bin/rtu_stat vlan 6 6 0x0 1
/wr/bin/rtu_stat vlan 7 7 0x0 1
/wr/bin/rtu_stat vlan 8 8 0x0 1
/wr/bin/rtu_stat vlan 9 9 0x0 1
/wr/bin/rtu_gd -g $1
if [ "$1" == "211" ] || [ "$1" == "212" ] || [ "$1" == "311" ] || [ "$1" == "312" ] || [ "$1" == "313" ] || [ "$1" == "331" ]; then
#remove VLAN 1
/wr/bin/rtu_stat vlan 1 1 0x0 1
fi
if [ "$1" == "221" ] || [ "$1" == "225" ] || [ "$1" == "226" ]; then
#configure VLAN 1
/wr/bin/rtu_stat vlan 1 1 0x3
fi
if [ "$1" == "222" ]; then
/wr/bin/rtu_stat vlan 1 1 0x1
fi
if [ "$1" == "227" ] || [ "$1" == "321" ] || [ "$1" == "322" ]; then
/wr/bin/rtu_stat vlan 1 1 0x20001
/wr/bin/rtu_stat vlan 2 2 0x00006
/wr/bin/rtu_stat vlan 3 3 0x00018
/wr/bin/rtu_stat vlan 4 4 0x00060
/wr/bin/rtu_stat vlan 5 5 0x00180
/wr/bin/rtu_stat vlan 6 6 0x00600
/wr/bin/rtu_stat vlan 7 7 0x01800
/wr/bin/rtu_stat vlan 8 8 0x06000
/wr/bin/rtu_stat vlan 9 9 0x18000
fi
if [ "$1" == "314" ] || [ "$1" == "315" ] || [ "$1" == "332" ]; then
/wr/bin/rtu_stat vlan 1 1 0x3
/wr/bin/rtu_stat vlan 2 2 0x30000
fi
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