summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-11-11 13:42:02 +0200
committerHanoh Haim <hhaim@cisco.com>2016-11-11 13:42:02 +0200
commit6d80194380143cc12ef46c4d430f21e7a1ba2a18 (patch)
tree6107442169d386f8803e546713b0cf1b52611295
parent8d0a50a3512593aa2036b297a83ad486349845a1 (diff)
mlx5 stateless latency support
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
-rwxr-xr-xsrc/common/Network/Packet/IPHeader.h9
-rw-r--r--src/flow_stat_parser.cpp3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/common/Network/Packet/IPHeader.h b/src/common/Network/Packet/IPHeader.h
index da9ba52c..0bf97fbb 100755
--- a/src/common/Network/Packet/IPHeader.h
+++ b/src/common/Network/Packet/IPHeader.h
@@ -91,6 +91,15 @@ public:
*/
inline void setHeaderLength (uint8_t);
+ inline uint16_t getFirstWord(){
+ return PKT_NTOHS(*((uint16_t *)&myVer_HeaderLength));
+ }
+
+ inline void setFirstWord (uint16_t word){
+ *((uint16_t *)&myVer_HeaderLength) = PKT_NTOHS(word);
+ }
+
+
inline uint8_t getTOS ();
inline void setTOS (uint8_t);
diff --git a/src/flow_stat_parser.cpp b/src/flow_stat_parser.cpp
index 7335a6a2..c0813c3e 100644
--- a/src/flow_stat_parser.cpp
+++ b/src/flow_stat_parser.cpp
@@ -27,6 +27,7 @@
#include "common/Network/Packet/TcpHeader.h"
#include "pkt_gen.h"
#include "flow_stat_parser.h"
+#include "bp_sim.h"
void CFlowStatParser::reset() {
m_start = 0;
@@ -120,8 +121,10 @@ int CFlowStatParser::get_ip_id(uint32_t &ip_id) {
int CFlowStatParser::set_ip_id(uint32_t new_id) {
if (m_ipv4) {
// Updating checksum, not recalculating, so if someone put bad checksum on purpose, it will stay bad
+ m_ipv4->updateCheckSum(PKT_NTOHS(m_ipv4->getFirstWord()), PKT_NTOHS(m_ipv4->getFirstWord() |TOS_TTL_RESERVE_DUPLICATE));
m_ipv4->updateCheckSum(PKT_NTOHS(m_ipv4->getId()), PKT_NTOHS(new_id));
m_ipv4->setId(new_id);
+ m_ipv4->setTOS(m_ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE);
return 0;
}