
 	 Silicom Linux RDI Control Utility
		  
1. Compiling, installing and loading the software.
       
   Compiling and installing fm10k driver
   
   tar xzvf fm10k-0.XX.X.tar.gz
   cd fm10k-0.XX.X/src
   make 
   make install
   
   Load fm10k & uio drivers:
   
   
   modprobe uio
   modprobe fm10k    
   
           
   Compiling and installing the rdif software in the system directory:
       # cd rdif-xxx

       # ./clean
	# ./install
       
========================================================================        
NOTE: Use local=1 parameter for local build if needed:
        #./install local=1
       
========================================================================        
	
2. Software loading:
	# rdif start
==========================================================================
NOTE: The command above  performs rdifd daemon start in verbose mode;
in order to run in non-verbose mode, please edit rdif script as below:

# rdifd -v
rdifd

==========================================================================
	      
4. Using the software.


Please use set_port_mask command to permit egress ports list for specific
ingress port, according to desired configuration. 
Example (for 4 ports adapter):
rdifctl set_port_mask 5 1,2,3,4

==========================================================================
Please refer to RDIF Programmer Guide for more info.
==========================================================================


Usage: rdifctl <command> [parameters]
   Commands List:
set_cfg - set the device to predefined configuration
get_dev_num - get total number of rdi devices.
set_sw_remain <val> - enable/disable (1/0) remain switch configuration after rdif stop
get_sw_remain
get_cfg - get current configuration mode
get_port_link <port> - get link status
get_port_speed <port> - get port speed
set_port_parser <port> <val> - set parser level (2,3,4)
get_port_parser <port>  - get parser level
set_rframe_update <port> <val> - set bitmask indicating the fields
                                 that will be updated on a routed frame
                                 dmac - bit 0, smac - bit 1, vlan - bit 2
get_rframe_update <port>  - get routed frame fields that will be updated
set_ttl_update <port> <val> - enable/disable (1/0) decrement TTL field on routed frames
get_ttl_update <port>
temp_write <addr> <length (1)> <reg>
temp_read <addr> <length>
temp1_write <addr> <length (1)> <reg> - use only for 0x4c address
temp1_read <addr> <length> - use only for 0x4c address
dir     - add the rule of a port with direction matching packets to another port
lb     - add the rule of a port with send matching packets to load balance group (LBG)
drop    - drop matching packets
permit  - permit matching packets
mir     - copy matching frame to mirror_port (mirror must be created previously, see mir_create)
set_prio  - set switch priority for the packet
set_vlan vlan_act <vlan_act> - set vlan1 rule
add_vlan_promisc <port> - add the port to all 2...4095 VLANs
rem_vlan_promisc <port> - remove the port from all 2...4095 VLANs
stat port <port>  - get statistic for specific port (port is mandatory)
prio_stat port <port>  - get priority statistic for specific port (port is mandatory)
reset_stat port <port>  - reset statistic for specific port (port is mandatory)
rule_stat <rule_id>  <group>- get statistic (pkts counter) for specific rule (rule_id is mandatory)
query_list <group> - query rule_id list
clear - clear rule stack
clear_group <group> - clear rule stack for specific group
set_port_mask <ingress_port> <egress_port_list example: 1,5,7> - set egress port mask
get_port_mask <ingress_port>  - get egress port list
set_reg <addr> <val> - write to RRC register
get_reg <addr>  - read from RRC register
bp_write <dev_addr> <len> <data1,data2,data3...>
bp_read <dev_addr> <len>
sfp_write <port num> <offset> <page> <len> <data1,data2,data3...>
sfp_read <port num> <offset> <page> <len>
set_gpio_dir <gpio> <dir> <value> - set GPIO direction & value
             gpio: gpio num; dir: 0 - input; 1 - output; 2 - open drain
get_gpio_dir <gpio> - get GPIO direction
set_gpio <gpio> <value> - set GPIO value
get_gpio <gpio> - get GPIO value
prbs <prbs> <dir> <port> - prbs test prbs supp. 7,15,23,31,11,9
get_port_state <port>
loopback <txrx/rxtx/off (1/2/0)> <port>
remove <rule_id> <group> remove rule
query <rule_id> <group> query rule
lbg_query_list - query LBG list
lbg_create  <port list, example: 1,2> - create LBG
lbg_del <lbg>  - delete LBG
mcg_create - create multicast group, return mcast group number
mcg_get_port <mcast group number> - get mcast group's port
mcg_add_listener <mcast_num> <port> <vlan> - add listener
mcg_del <mcast group number>  - delete mcast group
mir_query_list - query mirror list
mir_query_port_list <mirrror_port> - query mirror ports list
mir_create <mirror_port example: 1> <mirror_ports_list example: 2,3> - create mirror
mir_add_port <mirror_port> <port> - add port to mirror
mir_del_port <mirror_port> <port> - delete port from mirror
mir_add_vlan <mirror_port> <vlan_id> - specifies the mirrored frame encapsulation vlan id.
                                       Valid range 1...4095; 0 for no vlan encapsulation
mir_del <mirror_port>  - delete mirror
l3_hash <hash params> - set l3 hash
l2_hash <hash params> - set l2 hash
get_l3_hash - get l3 hash
get_l2_hash - get l2 hash
info         - print Program Information.
help         - print this message.
[parameters] :
               for 'permit', 'dir', 'set_prio' and 'drop' commands:
               rule_id <rule_id>
               src_ip <src_ip>
               dst_ip <dst_ip>
               dst_port <dst_port>
               src_port <src_port>
               src_ip_mask <src_ip_mask>
               dst_ip_mask <dst_ip_mask>
               src_ip6 <src_ip6>
               dst_ip6 <dst_ip6>
               src_ip6_mask <src_ip6_mask>
               dst_ip6_mask <dst_ip6_mask>
               group number <group>
               ip_proto <ip_proto>
               src_port_mask <src_port_mask>
               dst_port_mask <dst_port_mask>
               vlan <vlan>
               vlan_tag <vlan_tag> 1, 2, 3 ,4 for none, standard, user A, user B
               vlan_mask <vlan_mask>
               prio <0...15>
               mpls_type <multi | uni; mandatory for MPLS>
               mpls_header <MPLS headers, one or two headers (up to 8 byte)>
               mpls_header_mask <MPLS headers mask>
               ether_type <ether_type>
               src_mac <Source MAC address>
               dst_mac <Destination MAC address>
               port <1...>
               group - ACL number <0...15>
               redir_port <1...> (mandatory for dir command)
               mir_port (mandatory for mir command)
               lbg_num Load Balance Group (LBG) number (for lb command)
for 'set_cfg':
               <5> for MON2 (default mode) - egress disabled
for l3_hash:
               src_ip_hash, mask of src ip
               dst_ip_hash, mask of dst ip
               src_port_hash, mask of src port
               dst_port_hash, mask of dst port
               dscp_hash, 0x0-0xff
               isl_usr_hash, 0x0-0xff
               proto_hash, protocol mask
               flow_hash, 0x0-0xffff
               sym_l3_hash, on|off
               sym_l4_hash, on|off
               random_next_hop, on|off
               random_other, on|off
               random_only, on|off
for l2_hash:
               profile_idx, 0...16 default 0
               src_mac_hash, in MAC format
               dst_mac_hash, in MAC format
               ether_type_hash, 0x0-0xfff
               vlan_id_hash,  0x0-0xfff
               vlan_pri_hash,  0x0-0xf
               vlan2_id_hash,  0x0-0xfff
               vlan2_pri_hash,  0x0-0xf
               sym_mac_hash, on|off

Entire numerical paramters are in decimal format (123) or hex format (0xabc),
MAC is in aa:bb:cc:dd:ee:ff format.
Example:
         rdifctl drop port 1 src_ip 196.0.0.126
         rdifctl mir mir_port 5 dst_ip 10.10.10.184
         rdifctl set_port_mask 5 1,2,3,4
         rdifctl temp1_write 0x4c 1 1
         rdifctl temp1_read 0x4c 1
         rdifctl  set_vlan vlan_act 9 port 1
         rdifctl mir_add_vlan 1 11
Two MPLS example:
         rdifctl drop port 1 mpls_type uni mpls_header 0x0000104000001140 mpls_header_mask 0xffffffffffffffff
Single MPLS lable example:
         rdifctl drop port 1 mpls_type uni mpls_header 0x1140 mpls_header_mask 0xffffffff

 
5. Software unloading.

    # rdif stop
 
   
