summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-11-10 22:17:45 +0200
committerHanoh Haim <hhaim@cisco.com>2016-11-11 12:22:51 +0200
commit0dfd6a37ec369145f4d3d225064e0f75476fde68 (patch)
treefbee519288e3a4483c7ba9baa2d0fe0d42478a44 /src
parent50746d0dc7db5cb49bfd6ab9e5942ecdea694734 (diff)
mlx5 add TOS marker for mlx5 type of driver
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bp_sim.cpp9
-rwxr-xr-xsrc/bp_sim.h22
-rwxr-xr-xsrc/rx_check.cpp4
3 files changed, 32 insertions, 3 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index 3373c363..90560417 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -1675,7 +1675,8 @@ void CFlowPktInfo::do_generate_new_mbuf_rxcheck(rte_mbuf_t * m,
IPv6Header * ipv6=(IPv6Header *)(mp1 + 14);
uint8_t save_header= ipv6->getNextHdr();
ipv6->setNextHdr(RX_CHECK_V6_OPT_TYPE);
- ipv6->setHopLimit(TTL_RESERVE_DUPLICATE);
+ ipv6->setHopLimit(TTL_RESERVE_DUPLICATE);
+ ipv6->setTrafficClass(ipv6->getTrafficClass()|TOS_TTL_RESERVE_DUPLICATE);
ipv6->setPayloadLen( ipv6->getPayloadLen() +
sizeof(CRx_check_header));
rxhdr->m_option_type = save_header;
@@ -1685,6 +1686,8 @@ void CFlowPktInfo::do_generate_new_mbuf_rxcheck(rte_mbuf_t * m,
ipv4->setHeaderLength(current_opt_len+opt_len);
ipv4->setTotalLength(ipv4->getTotalLength()+opt_len);
ipv4->setTimeToLive(TTL_RESERVE_DUPLICATE);
+ ipv4->setTOS(ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE);
+
rxhdr->m_option_type = RX_CHECK_V4_OPT_TYPE;
rxhdr->m_option_len = RX_CHECK_V4_OPT_LEN;
}
@@ -2155,6 +2158,7 @@ void CCapFileFlowInfo::update_info(){
lp = GetPacket(1);
assert(lp);
lp->m_pkt_indication.setTTL(TTL_RESERVE_DUPLICATE);
+ lp->m_pkt_indication.setTOSReserve();
}
}
@@ -2241,6 +2245,9 @@ enum CCapFileFlowInfo::load_cap_file_err CCapFileFlowInfo::load_cap_file(std::st
pkt_indication.setTTL(TTL_RESERVE_DUPLICATE-4);
}
+ pkt_indication.clearTOSReserve();
+
+
// Validation for first packet in flow
if (is_fif) {
lpflow->flow_id = m_total_flows;
diff --git a/src/bp_sim.h b/src/bp_sim.h
index e3dab2ad..c292103b 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -2688,6 +2688,26 @@ public:
return (0);
}
}
+
+
+ void setTOSReserve(){
+ BP_ASSERT(l3.m_ipv4);
+ if (is_ipv6()) {
+ l3.m_ipv6->setTrafficClass(l3.m_ipv6->getTrafficClass() | TOS_TTL_RESERVE_DUPLICATE );
+ }else{
+ l3.m_ipv4->setTOS(l3.m_ipv4->getTOS()| TOS_TTL_RESERVE_DUPLICATE );
+ }
+ }
+
+ void clearTOSReserve(){
+ BP_ASSERT(l3.m_ipv4);
+ if (is_ipv6()) {
+ l3.m_ipv6->setTrafficClass(l3.m_ipv6->getTrafficClass()& (~TOS_TTL_RESERVE_DUPLICATE) );
+ }else{
+ l3.m_ipv4->setTOS(l3.m_ipv4->getTOS() & (~TOS_TTL_RESERVE_DUPLICATE) );
+ }
+ }
+
uint8_t getTTL(){
BP_ASSERT(l3.m_ipv4);
if (is_ipv6()) {
@@ -3060,7 +3080,7 @@ inline void CFlowPktInfo::update_pkt_info(char *p,
printf(" %.3f : DP : learn packet !\n",now_sec());
#endif
ipv4->setTimeToLive(TTL_RESERVE_DUPLICATE);
- ipv4->setTOS(0x3);
+ ipv4->setTOS(ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE);
/* first ipv4 option add the info in case of learn packet, usualy only the first packet */
diff --git a/src/rx_check.cpp b/src/rx_check.cpp
index bfaa4ddb..d7eecede 100755
--- a/src/rx_check.cpp
+++ b/src/rx_check.cpp
@@ -255,7 +255,9 @@ bool RxCheckManager::Create(){
void RxCheckManager::handle_packet(CRx_check_header * rxh){
- //rxh->dump(stdout);
+ // m_stats.Dump(stdout);
+ //rxh->dump(stdout);
+
m_stats.m_total_rx++;
if ( rxh->m_magic != RX_CHECK_MAGIC ){
m_stats.m_err_no_magic++;