create P4 basis + smaller updates
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
7f904bdcef
commit
b6bd281c3a
8 changed files with 151 additions and 3 deletions
28
p4src/checksums.p4
Normal file
28
p4src/checksums.p4
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* -*- P4_16 -*- */
|
||||
#ifndef CHECKSUMS_P4
|
||||
#define CHECKSUMS_P4
|
||||
|
||||
#include <core.p4>
|
||||
#include <v1model.p4>
|
||||
|
||||
#include "headers.p4"
|
||||
|
||||
/*************************************************************************
|
||||
************* C H E C K S U M V E R I F I C A T I O N *************
|
||||
*************************************************************************/
|
||||
|
||||
control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
|
||||
apply {}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
************** C H E C K S U M C O M P U T A T I O N **************
|
||||
*************************************************************************/
|
||||
|
||||
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
||||
apply {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -14,6 +14,7 @@ typedef bit<9> port_t;
|
|||
const bit<16> TYPE_IPV4 = 0x0800;
|
||||
const bit<16> TYPE_IPV6 = 0x86DD;
|
||||
const bit<8> TYPE_TCP = 6;
|
||||
const bit<8> TCP_SEQ_LEN = 4;
|
||||
|
||||
|
||||
header ethernet_t {
|
||||
|
|
|
|||
12
p4src/settings.p4
Normal file
12
p4src/settings.p4
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/* -*- P4_16 -*- */
|
||||
/* table sizes, register widths, and such */
|
||||
#ifndef SETTINGS_P4
|
||||
#define SETTINGS_P4
|
||||
|
||||
#include <core.p4>
|
||||
#include <v1model.p4>
|
||||
|
||||
#define THE_ANSWER_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING 42
|
||||
|
||||
|
||||
#endif
|
||||
49
p4src/static-mapping.p4
Normal file
49
p4src/static-mapping.p4
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- P4_16 -*- */
|
||||
#include <core.p4>
|
||||
#include <v1model.p4>
|
||||
|
||||
#include "headers.p4"
|
||||
#include "parsers.p4"
|
||||
#include "checksums.p4"
|
||||
#include "settings.p4"
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
************** I N G R E S S P R O C E S S I N G *******************
|
||||
*************************************************************************/
|
||||
|
||||
control MyIngress(inout headers hdr,
|
||||
inout metadata meta,
|
||||
inout standard_metadata_t standard_metadata) {
|
||||
|
||||
apply {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
**************** E G R E S S P R O C E S S I N G *******************
|
||||
*************************************************************************/
|
||||
|
||||
control MyEgress(inout headers hdr,
|
||||
inout metadata meta,
|
||||
inout standard_metadata_t standard_metadata) {
|
||||
apply {
|
||||
/* set tcp header valid after modifying it -- keep this in mind*/
|
||||
// hdr.tcp.setValid();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*********************** S W I T C H *******************************
|
||||
*************************************************************************/
|
||||
|
||||
V1Switch(
|
||||
MyParser(),
|
||||
MyVerifyChecksum(),
|
||||
MyIngress(),
|
||||
MyEgress(),
|
||||
MyComputeChecksum(),
|
||||
MyDeparser()
|
||||
) main;
|
||||
Loading…
Add table
Add a link
Reference in a new issue