Begin to introduce arp support
This commit is contained in:
		
					parent
					
						
							
								e1e56184c9
							
						
					
				
			
			
				commit
				
					
						07f0867175
					
				
			
		
					 4 changed files with 100 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -5,6 +5,8 @@
 | 
			
		|||
#include <core.p4>
 | 
			
		||||
#include <v1model.p4>
 | 
			
		||||
 | 
			
		||||
/**************************************** types    ****************************************/
 | 
			
		||||
 | 
			
		||||
typedef bit<48>  mac_addr_t;
 | 
			
		||||
typedef bit<32>  ipv4_addr_t;
 | 
			
		||||
typedef bit<128> ipv6_addr_t;
 | 
			
		||||
| 
						 | 
				
			
			@ -13,11 +15,14 @@ typedef bit<16>  mcast_t;
 | 
			
		|||
typedef bit<16>  task_t;
 | 
			
		||||
typedef bit<16>  table_t; /* to map debug messages - 16 bit to match shortenumfield */
 | 
			
		||||
 | 
			
		||||
/**************************************** constants ****************************************/
 | 
			
		||||
 | 
			
		||||
const bit<16> TABLE_NAT64       = 1;
 | 
			
		||||
const bit<16> TABLE_ICMP6       = 2;
 | 
			
		||||
const bit<16> TABLE_V6_NETWORKS = 3;
 | 
			
		||||
const bit<16> TABLE_NAT46       = 4;
 | 
			
		||||
const bit<16> TABLE_V4_NETWORKS = 5;
 | 
			
		||||
const bit<16> TABLE_ARP         = 6;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const bit<16> TYPE_IPV4  = 0x0800;
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +46,8 @@ const bit<8>  ICMP6_NA           = 136;
 | 
			
		|||
const bit<8>  ICMP_ECHO_REPLY    = 0;
 | 
			
		||||
const bit<8>  ICMP_ECHO_REQUEST  = 8;
 | 
			
		||||
 | 
			
		||||
const bit<16>  ARP_REQUEST        = 1;
 | 
			
		||||
const bit<16>  ARP_REPLY          = 2;
 | 
			
		||||
 | 
			
		||||
/* RFC4861, Section 4.6 */
 | 
			
		||||
const bit<8>  ICMP6_NDP_OPT_SOURCE_LL    = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +65,8 @@ const task_t TASK_CHECKSUM_ICMP6    = 5; /* data plane */
 | 
			
		|||
const task_t TASK_CHECKSUM_ICMP6_NA = 6; /* data plane */
 | 
			
		||||
const task_t TASK_CHECKSUM_ICMP     = 7; /* data plane */
 | 
			
		||||
 | 
			
		||||
/**************************************** header ****************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* 48+48+16 = 112 */
 | 
			
		||||
header ethernet_t {
 | 
			
		||||
| 
						 | 
				
			
			@ -154,6 +163,17 @@ header icmp_t {
 | 
			
		|||
    bit<16> checksum;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
header arp_t {
 | 
			
		||||
    bit<16>     hw_type;
 | 
			
		||||
    bit<16>     protocol;
 | 
			
		||||
    bit<8>      hw_size;
 | 
			
		||||
    bit<8>      protocol_size;
 | 
			
		||||
    bit<16>     opcode;
 | 
			
		||||
    mac_addr_t  src_mac_addr;
 | 
			
		||||
    ipv4_addr_t src_ipv4_addr;
 | 
			
		||||
    mac_addr_t  dst_mac_addr;
 | 
			
		||||
    ipv4_addr_t dst_ipv4_addr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
header cpu_t {
 | 
			
		||||
    task_t task;
 | 
			
		||||
| 
						 | 
				
			
			@ -162,6 +182,8 @@ header cpu_t {
 | 
			
		|||
    table_t table_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**************************************** struct ****************************************/
 | 
			
		||||
 | 
			
		||||
struct headers {
 | 
			
		||||
    ethernet_t       ethernet;
 | 
			
		||||
    ipv4_t	         ipv4;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,6 +197,7 @@ struct headers {
 | 
			
		|||
    icmp6_option_link_layer_addr_t   icmp6_option_link_layer_addr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct metadata {
 | 
			
		||||
    port_t ingress_port;
 | 
			
		||||
    task_t task;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue