Commit 1385c5b4 authored by Maciej Lipinski's avatar Maciej Lipinski

[RTUex] adding snake test stuff/config

parent 31ac1a89
......@@ -43,8 +43,10 @@
int rtux_init(void)
{
uint8_t mac_single_A[] = {0x11,0x50,0xca,0xfe,0xba,0xbe};
uint8_t mac_single_B[] = {0x11,0x11,0x11,0x11,0x11,0x11};
// uint8_t mac_single_A[] = {0x11,0x50,0xca,0xfe,0xba,0xbe};
// uint8_t mac_single_B[] = {0x11,0x11,0x11,0x11,0x11,0x11};
uint8_t mac_single_A[] = {0x00,0x10,0x94,0x00,0x00,0x01};
uint8_t mac_single_B[] = {0x00,0x10,0x94,0x00,0x00,0x02};
uint8_t mac_range_lower[] = {0x00,0x50,0xca,0xfe,0xba,0xbe};
uint8_t mac_range_upper[] = {0x08,0x50,0xca,0xfe,0xba,0xbe};
......
......@@ -202,7 +202,8 @@ int rtu_fd_create_entry(uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_mask,
uint32_t mask_src, mask_dst; // used to check port masks update
struct rtu_addr eaddr;
TRACE_DBG(TRACE_INFO, "ML: create entry, vid=%d, vlan.drop=%d, vlan.fid=%d, vlan.mask=0x%x",
vid, vlan_tab[vid].drop, vlan_tab[vid].fid, vlan_tab[vid].port_mask);
pthread_mutex_lock(&fd_mutex);
// if VLAN is registered (otherwise just ignore request)
if (! vlan_tab[vid].drop) {
......@@ -404,7 +405,8 @@ static void clean_fd(void)
*/
static void clean_vd(void)
{
int i;
int i,j;
int pvid = 3;
rtu_clean_vlan();
for(i = 1; i < NUM_VLANS; i++) {
......@@ -420,6 +422,7 @@ static void clean_vd(void)
vlan_tab[0].prio = 0;
rtu_write_vlan_entry(0, &vlan_tab[0]);
}
/**
......@@ -595,6 +598,25 @@ void vlan_entry_vd(int vid, uint32_t port_mask, uint8_t fid, uint8_t prio,
vlan_tab[vid].has_prio = has_prio;
vlan_tab[vid].prio_override = prio_override;
vlan_tab[vid].prio = prio;
TRACE(TRACE_INFO, "vlan_entry_vd: vid %d, drop=%d, fid=%d, port_mask 0x%x",
vid,
vlan_tab[vid].drop,
vlan_tab[vid].fid,
vlan_tab[vid].port_mask
);
rtu_write_vlan_entry(vid, &vlan_tab[vid]);
}
void vlan_entry_rd(int vid)
{
// First entry reserved for untagged packets.
TRACE(TRACE_INFO, "vlan_entry_vd: vid %d, drop=%d, fid=%d, port_mask 0x%x",
vid,
vlan_tab[vid].drop,
vlan_tab[vid].fid,
vlan_tab[vid].port_mask
);
}
\ No newline at end of file
......@@ -61,6 +61,8 @@ struct filtering_entry *rtu_fd_lookup_htab_entry(int index);
void vlan_entry_vd(int vid, uint32_t port_mask, uint8_t fid, uint8_t prio,
int has_prio,int prio_override, int drop);
void vlan_entry_rd(int vid);
#endif /*__WHITERABBIT_RTU_FD_H*/
......@@ -71,15 +71,25 @@ int tru_init(int tru_enabled )
// 3 /*port_a_id*/,
// 4 /*port_b_id*/);
//clear tru tab subentries for FID=0
for(i=0;i<TRU_TAB_SUBENTRY_NUM;i++)
//clear tru tab subentries for FID=0
for(i=0;i<TRU_TAB_SUBENTRY_NUM;i++)
tru_write_tab_entry(0,0,i,0,0,0,0,0,0);
/// port 1 active
/// port 2 backup
// make TRU transparent
tru_write_tab_entry(1 /* valid */,
0 /* entry_addr */,
0 /* subentry_addr*/,
0x00000000 /*pattern_mask*/,
0x00000000 /* pattern_match*/,
0x000 /* pattern_mode */,
0x0003FFFF /*ports_mask */,
0x0003FFFF /* ports_egress */,
0x0003FFFF /* ports_ingress */);
/// port 1 active
/// port 2 backup
//tru_set_port_roles(1 /*active port*/,2/*backup port*/); //TODO: make it config
tru_set_port_roles(1 /*active port*/,2/*backup port*/);
// tru_set_port_roles(2 /*active port*/,1/*backup port*/);
if(tru_enabled)
tru_enable();
......@@ -883,6 +893,55 @@ void tru_set_life(char *optarg)
case 18:
ep_pause_config_ena((uint32_t)sub_opt,0,0,1,0);
break;
case 19:
ep_snake_config((uint32_t)sub_opt);
break;
case 20:
tru_write_tab_entry(1 /* valid */,
0 /* entry_addr */,
0 /* subentry_addr*/,
0x00000000 /*pattern_mask*/,
0x00000000 /* pattern_match*/,
0x000 /* pattern_mode */,
0x0003FFFF /*ports_mask */,
0x0003FFFF /* ports_egress */,
0x0003FFFF /* ports_ingress */);
// override possibly-existing old entries for VLAN 0
tru_write_tab_entry(0 /* valid */,
0 /* entry_addr */,
1 /* subentry_addr*/,
0x00000000 /*pattern_mask*/,
0x00000000 /* pattern_match*/,
0x000 /* pattern_mode */,
0x0003FFFF /*ports_mask */,
0x0003FFFF /* ports_egress */,
0x0003FFFF /* ports_ingress */);
tru_write_tab_entry(0 /* valid */,
0 /* entry_addr */,
2 /* subentry_addr*/,
0x00000000 /*pattern_mask*/,
0x00000000 /* pattern_match*/,
0x000 /* pattern_mode */,
0x0003FFFF /*ports_mask */,
0x0003FFFF /* ports_egress */,
0x0003FFFF /* ports_ingress */);
tru_write_tab_entry(0 /* valid */,
0 /* entry_addr */,
3 /* subentry_addr*/,
0x00000000 /*pattern_mask*/,
0x00000000 /* pattern_match*/,
0x000 /* pattern_mode */,
0x0003FFFF /*ports_mask */,
0x0003FFFF /* ports_egress */,
0x0003FFFF /* ports_ingress */);
break;
case 21:
ep_set_vlan((uint32_t)sub_opt /*port*/, 0/*access port*/, 1 /*fix_prio*/, 7 /*prio_val*/, 1/*pvid*/);
break;
case 22:
ep_vcr1_wr((uint32_t)sub_opt /*port*/, 1/*is_vlan*/, 0 /*address*/, 0xFFFF /*data */ );
TRACE(TRACE_INFO, "Untag frames on port %d, untagging mask: 0x%x", (uint32_t)sub_opt, 0xFFFF);
break;
case 100:
tru_show_status(18) ;
......@@ -935,6 +994,18 @@ void tru_set_life(char *optarg)
TRACE(TRACE_INFO, "-u 16 n Endpoint PAUSE config: disable all PAUSEs on port n");
TRACE(TRACE_INFO, "-u 17 n Endpoint PAUSE config: enable Tx PAUSE 802.3 on port n");
TRACE(TRACE_INFO, "-u 18 n Endpoint PAUSE config: enable Tx PAUSE 802.1Q on port n");
TRACE(TRACE_INFO, "-u 19 n Snake testing port configuration, config number: n");
TRACE(TRACE_INFO, "-u 19 0 Simple snake test:");
TRACE(TRACE_INFO, " snake-ports: 0-7 (access port, untagging on egress");
TRACE(TRACE_INFO, "-u 19 1 Snake test + other traffic on 2 ports:");
TRACE(TRACE_INFO, " snake-ports: 2-7 (access port, untagging on egress");
TRACE(TRACE_INFO, " free-ports : 0-1 no vlan (unqualified)");
TRACE(TRACE_INFO, "-u 19 2 Snake test + HP traffic on 2 ports:");
TRACE(TRACE_INFO, " snake-ports: 2-7 (access port, untagging on egress");
TRACE(TRACE_INFO, " HP-ports : 0-1 HP traffic (access with tagging for special VLAN + HP priority)");
TRACE(TRACE_INFO, "-u 20 Configure TRU to be transparent");
TRACE(TRACE_INFO, "-u 21 n Set port n as Access port with pvid=1");
TRACE(TRACE_INFO, "-u 22 n Set port n to untagg VIDs 0 - 15");
TRACE(TRACE_INFO, "-u 100 show status");
};
exit(1);
......
......@@ -63,6 +63,45 @@ static struct {
int hw_index;
} port_state[MAX_PORT + 1];
static int rtu_set_startup_config()
{
int i;
int pvid = 1;
vlan_entry_vd( 10, //vid,
0xffffffff, //port_mask,
10, //fid,
0, //prio,
0, //has_prio,
0, //prio_override,
0 //drop
);
vlan_entry_vd( 11, //vid,
0xffffffff, //port_mask,
11, //fid,
0, //prio,
0, //has_prio,
0, //prio_override,
0 //drop
);
for(i=0;i < 18;i++)
{
if(i%2==0 && i!=0) pvid++;
vlan_entry_vd( pvid, //vid,
(0x3 << 2*(pvid-1)), //port_mask,
pvid, //fid,
0, //prio,
0, //has_prio,
0, //prio_override,
0 //drop
);
}
// ep_snake_config(0);
return 0;
}
/**
* \brief Creates the static entries in the filtering database
......@@ -402,6 +441,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time, int unrec_be
int static_entries, int tru_enabled)
{
int i, err;
int startup_config = 1; //TODO: make configurabel
// init RTU HW
TRACE(TRACE_INFO, "init rtu hardware.");
......@@ -416,7 +456,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time, int unrec_be
if(err)
return err;
err = ep_init(1,8);
err = ep_init(1,MAX_PORT);
if(err)
return err;
......@@ -452,6 +492,11 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time, int unrec_be
err = rtu_create_static_entries();
if(err)
return err;
if(startup_config)
err = rtu_set_startup_config();
if(err)
return err;
// turn on RTU
TRACE(TRACE_INFO, "enable rtu.");
......
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