From 274daef03e626973a799c7d17e2f9dd9017f44fa Mon Sep 17 00:00:00 2001 From: Carmelo Cascone Date: Wed, 14 Feb 2018 20:32:49 -0800 Subject: [PATCH] Minor bugfix to spgw.p4 Change-Id: I2668883ba73558d445f05b7d2e3901252b5a640c --- pipelines/fabric/src/main/resources/include/header.p4 | 1 + pipelines/fabric/src/main/resources/include/spgw.p4 | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4 index 7b61cec235..6cff586e0f 100644 --- a/pipelines/fabric/src/main/resources/include/header.p4 +++ b/pipelines/fabric/src/main/resources/include/header.p4 @@ -133,6 +133,7 @@ header gtpu_t { struct spgw_meta_t { bool do_spgw; direction_t direction; + bit<16> ipv4_len; bit<32> teid; bit<32> s1u_enb_addr; bit<32> s1u_sgw_addr; diff --git a/pipelines/fabric/src/main/resources/include/spgw.p4 b/pipelines/fabric/src/main/resources/include/spgw.p4 index 5637adfd45..87839f6103 100644 --- a/pipelines/fabric/src/main/resources/include/spgw.p4 +++ b/pipelines/fabric/src/main/resources/include/spgw.p4 @@ -194,6 +194,9 @@ control spgw_ingress( } ue_cdr_table.apply(); } + + // Don't ask why... we'll need this later. + spgw_meta.ipv4_len = ipv4.total_len; } } @@ -212,7 +215,7 @@ control spgw_egress( gtpu_ipv4.version = IP_VERSION_4; gtpu_ipv4.ihl = IPV4_MIN_IHL; gtpu_ipv4.diffserv = 0; - gtpu_ipv4.total_len = ipv4.total_len + gtpu_ipv4.total_len = spgw_meta.ipv4_len + (IPV4_HDR_SIZE + UDP_HDR_SIZE + GTP_HDR_SIZE); gtpu_ipv4.identification = 0x1513; /* From NGIC */ gtpu_ipv4.flags = 0; @@ -226,7 +229,7 @@ control spgw_egress( gtpu_udp.setValid(); gtpu_udp.src_port = UDP_PORT_GTPU; gtpu_udp.dst_port = UDP_PORT_GTPU; - gtpu_udp.len = ipv4.total_len + gtpu_udp.len = spgw_meta.ipv4_len + (UDP_HDR_SIZE + GTP_HDR_SIZE); gtpu_udp.checksum = 0; // Updated later @@ -238,7 +241,7 @@ control spgw_egress( gtpu.seq_flag = 0; gtpu.npdu_flag = 0; gtpu.msgtype = GTP_GPDU; - gtpu.msglen = ipv4.total_len; + gtpu.msglen = spgw_meta.ipv4_len; gtpu.teid = spgw_meta.teid; }