-
Notifications
You must be signed in to change notification settings - Fork 140
VlanTagHandler
- Status :
- Version :
- Authors :
- NetFPGA base source :
This design adds/modifies/removes VLAN tags to outgoing packets. Operations(add/mod/remove) and VLAN tag values can be configured per port via registers. The forwarding ports for each input port are also programmable.
- Install the NetFPGA Base Package
Download from Here
The regression tests verify the functionality of this project. In order to run the tests, you need to have the machine connected for the regression tests as stated in the Run Regression Tests section of the Guide.
After connecting the cables, type the following command to run the regression tests.
nf_regress_test.pl --project vlan_tag_handler
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_loopback_simple
- Output
SUCCESS!
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_vlan_through
- Output
SUCCESS!
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_wo_vlan_through
- Output
SUCCESS!
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_vlan_add
- Output
SUCCESS!
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_vlan_mod
- Output
SUCCESS!
- Name :
- Description :
- Location
projects/vlan_tag_handler/regress/test_vlan_strip
- Output
SUCCESS!
Edit register-configuration file:
cd projects/vlan_tag_handler/sw/ vi register_setup.sh
You will find 12 variables on the top part of the file. They are 8 registers for setup forwarding output-ports and 4 registers for VLAN tag description. See comments for each section and modify accordingly.
Connect the cables as you described in the register setup file above.
Download the project bitfile:
su nf_download vlan_tag_handler.bit
Run the script you have modified:
su cd projects/vlan_tag_handler/sw/ ./register_setup.sh
Now you are ready to use this design.
reference_nic
This module is attached as the first module of user_data_path. It parses an incoming packet to see if it has VLAN ethernet type (0x8100). If it finds it, strip this field and throw it away, and strip next 16bits of VLAN tag field and insert it as a module header right after the IOQ module header. It also recalculates the packet size and replaces values in IOQ module header. So now the VLAN information resides in a module header and the packet itself doesn't have VLAN tags.
This module has 8 registers for specifying output ports per input port. It looks into IOQ header of each packet and see the source(input) port number. Then it rewrites DSTPORT section of the IOQ header according to register value corresponding to each incoming port number.
This module is replaced from sram_rr_output_queue so that users can use SRAM for any additional functions.
This module is attached per port right after output_port_queue, meaning there are four of them in the design. Each of them has 1 register for specifying VLAN tagging action.
The module consists of two parts. In the first part, it checks the register, and if the register value is:
VLAN tag value (meaning add or modify):
- It looks for a module header which has VLAN information. if it is found, replce VLAN tag to the value written in the register. If not, insert a module header with this VLAN information.
- It doesn't do anything.
- It looks for a module header which has VLAN information. if it is found, it invalidates this info. If not, it doesn't do anything.