summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-12-22 16:49:34 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-12-22 16:49:34 +0200
commitee1eb4de057d5e1752fc588ba4a2d873bae6d064 (patch)
treec5be502364675b8992cf5a1435ea458ab234dc77
parentd99346269fed5539d483113a4b37928619c6640a (diff)
Allow up to 10 hops TTL reduction in X710 and 82599 stateful
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
-rwxr-xr-xsrc/bp_sim.cpp7
-rw-r--r--src/debug.cpp65
-rw-r--r--src/main_dpdk.cpp73
3 files changed, 73 insertions, 72 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index a757cce0..5b3c1bb1 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -2356,11 +2356,10 @@ enum CCapFileFlowInfo::load_cap_file_err CCapFileFlowInfo::load_cap_file(std::st
/* inc pkt_id inside the flow */
lpflow->pkt_id++;
- /* check that we don't have reserve TTL for duplication */
+ /* check that we don't have reserved TTL */
uint8_t ttl = pkt_indication.getTTL();
- if ( (ttl == TTL_RESERVE_DUPLICATE) ||
- (ttl == (TTL_RESERVE_DUPLICATE-1)) ) {
- pkt_indication.setTTL(TTL_RESERVE_DUPLICATE-4);
+ if ( ttl > 127) {
+ pkt_indication.setTTL(127);
}
pkt_indication.clearTOSReserve();
diff --git a/src/debug.cpp b/src/debug.cpp
index e272424c..5a881dd9 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -293,50 +293,49 @@ struct pkt_params test_pkts[] = {
{"ARP", 1, IPPROTO_UDP, 255, 5, 0, ZERO},
{"VLAN ARP", 1, IPPROTO_UDP, 255, 5, DPF_VLAN, ZERO},
{"ipv4 TCP ttl 255", 4, IPPROTO_TCP, 255, 5, 0, STF},
- {"ipv4 TCP ttl 254", 4, IPPROTO_TCP, 254, 5, 0, STF},
- {"ipv4 TCP ttl 253", 4, IPPROTO_TCP, 253, 5, 0, ZERO},
+ {"ipv4 TCP ttl 246", 4, IPPROTO_TCP, 246, 5, 0, STF},
+ {"ipv4 TCP ttl 245", 4, IPPROTO_TCP, 245, 5, 0, ZERO},
{"ipv4 UDP ttl 255", 4, IPPROTO_UDP, 255, 5, 0, STF},
- {"ipv4 UDP ttl 254", 4, IPPROTO_UDP, 254, 5, 0, STF},
- {"ipv4 UDP ttl 253", 4, IPPROTO_UDP, 253, 5, 0, ZERO},
+ {"ipv4 UDP ttl 246", 4, IPPROTO_UDP, 246, 5, 0, STF},
+ {"ipv4 UDP ttl 245", 4, IPPROTO_UDP, 245, 5, 0, ZERO},
{"ipv4 ICMP ttl 255", 4, IPPROTO_ICMP, 255, 5, 0, STF},
- {"ipv4 ICMP ttl 254", 4, IPPROTO_ICMP, 254, 5, 0, STF},
- {"ipv4 ICMP ttl 253", 4, IPPROTO_ICMP, 253, 5, 0, ZERO},
- {"ipv4 TCP latency flow stat", 4, IPPROTO_TCP, 253, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
- {"ipv4 UDP latency flow stat", 4, IPPROTO_UDP, 253, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
+ {"ipv4 ICMP ttl 246", 4, IPPROTO_ICMP, 246, 5, 0, STF},
+ {"ipv4 ICMP ttl 245", 4, IPPROTO_ICMP, 245, 5, 0, ZERO},
+ {"ipv4 TCP latency flow stat", 4, IPPROTO_TCP, 240, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
+ {"ipv4 UDP latency flow stat", 4, IPPROTO_UDP, 240, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
{"vlan ipv4 TCP ttl 255", 4, IPPROTO_TCP, 255, 5, DPF_VLAN, STF},
- {"vlan ipv4 TCP ttl 254", 4, IPPROTO_TCP, 254, 5, DPF_VLAN, STF},
- {"vlan ipv4 TCP ttl 253", 4, IPPROTO_TCP, 253, 5, DPF_VLAN, ZERO},
+ {"vlan ipv4 TCP ttl 246", 4, IPPROTO_TCP, 246, 5, DPF_VLAN, STF},
+ {"vlan ipv4 TCP ttl 245", 4, IPPROTO_TCP, 245, 5, DPF_VLAN, ZERO},
{"vlan ipv4 UDP ttl 255", 4, IPPROTO_UDP, 255, 5, DPF_VLAN, STF},
- {"vlan ipv4 UDP ttl 254", 4, IPPROTO_UDP, 254, 5, DPF_VLAN, STF},
- {"vlan ipv4 UDP ttl 253", 4, IPPROTO_UDP, 253, 5, DPF_VLAN, ZERO},
+ {"vlan ipv4 UDP ttl 246", 4, IPPROTO_UDP, 246, 5, DPF_VLAN, STF},
+ {"vlan ipv4 UDP ttl 245", 4, IPPROTO_UDP, 245, 5, DPF_VLAN, ZERO},
{"vlan ipv4 ICMP ttl 255", 4, IPPROTO_ICMP, 255, 5, DPF_VLAN, STF},
- {"vlan ipv4 ICMP ttl 254", 4, IPPROTO_ICMP, 254, 5, DPF_VLAN, STF},
- {"vlan ipv4 ICMP ttl 253", 4, IPPROTO_ICMP, 253, 5, DPF_VLAN, ZERO},
- {"vlan ipv4 TCP latency flow stat", 4, IPPROTO_TCP, 253, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
- {"vlan ipv4 UDP latency flow stat", 4, IPPROTO_UDP, 253, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
+ {"vlan ipv4 ICMP ttl 246", 4, IPPROTO_ICMP, 246, 5, DPF_VLAN, STF},
+ {"vlan ipv4 ICMP ttl 245", 4, IPPROTO_ICMP, 245, 5, DPF_VLAN, ZERO},
+ {"vlan ipv4 TCP latency flow stat", 4, IPPROTO_TCP, 240, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
+ {"vlan ipv4 UDP latency flow stat", 4, IPPROTO_UDP, 240, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
{"ipv6 TCP ttl 255", 6, IPPROTO_TCP, 255, 5, DPF_RXCHECK, STF},
- {"ipv6 TCP ttl 254", 6, IPPROTO_TCP, 254, 5, DPF_RXCHECK, STF},
- {"ipv6 TCP ttl 253", 6, IPPROTO_TCP, 253, 5, DPF_RXCHECK, ZERO},
+ {"ipv6 TCP ttl 246", 6, IPPROTO_TCP, 246, 5, DPF_RXCHECK, STF},
+ {"ipv6 TCP ttl 245", 6, IPPROTO_TCP, 245, 5, DPF_RXCHECK, ZERO},
{"ipv6 UDP ttl 255", 6, IPPROTO_UDP, 255, 5, DPF_RXCHECK, STF},
- {"ipv6 UDP ttl 254", 6, IPPROTO_UDP, 254, 5, DPF_RXCHECK, STF},
- {"ipv6 UDP ttl 253", 6, IPPROTO_UDP, 253, 5, DPF_RXCHECK, ZERO},
+ {"ipv6 UDP ttl 246", 6, IPPROTO_UDP, 246, 5, DPF_RXCHECK, STF},
+ {"ipv6 UDP ttl 245", 6, IPPROTO_UDP, 245, 5, DPF_RXCHECK, ZERO},
{"ipv6 ICMP ttl 255", 6, IPPROTO_ICMP, 255, 5, DPF_RXCHECK, STF},
- {"ipv6 ICMP ttl 254", 6, IPPROTO_ICMP, 254, 5, DPF_RXCHECK, STF},
- {"ipv6 ICMP ttl 253", 6, IPPROTO_ICMP, 253, 5, DPF_RXCHECK, ZERO},
- {"ipv6 TCP latency flow stat", 6, IPPROTO_TCP, 253, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
- {"ipv6 UDP latency flow stat", 6, IPPROTO_UDP, 253, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
+ {"ipv6 ICMP ttl 246", 6, IPPROTO_ICMP, 246, 5, DPF_RXCHECK, STF},
+ {"ipv6 ICMP ttl 245", 6, IPPROTO_ICMP, 245, 5, DPF_RXCHECK, ZERO},
+ {"ipv6 TCP latency flow stat", 6, IPPROTO_TCP, 240, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
+ {"ipv6 UDP latency flow stat", 6, IPPROTO_UDP, 240, FLOW_STAT_PAYLOAD_IP_ID, 0, STL},
{"vlan ipv6 TCP ttl 255", 6, IPPROTO_TCP, 255, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 TCP ttl 254", 6, IPPROTO_TCP, 254, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 TCP ttl 253", 6, IPPROTO_TCP, 253, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
+ {"vlan ipv6 TCP ttl 246", 6, IPPROTO_TCP, 246, 5, DPF_VLAN | DPF_RXCHECK, STF},
+ {"vlan ipv6 TCP ttl 245", 6, IPPROTO_TCP, 245, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
{"vlan ipv6 UDP ttl 255", 6, IPPROTO_UDP, 255, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 UDP ttl 254", 6, IPPROTO_UDP, 254, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 UDP ttl 253", 6, IPPROTO_UDP, 253, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
+ {"vlan ipv6 UDP ttl 246", 6, IPPROTO_UDP, 246, 5, DPF_VLAN | DPF_RXCHECK, STF},
+ {"vlan ipv6 UDP ttl 245", 6, IPPROTO_UDP, 245, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
{"vlan ipv6 ICMP ttl 255", 6, IPPROTO_ICMP, 255, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 ICMP ttl 254", 6, IPPROTO_ICMP, 254, 5, DPF_VLAN | DPF_RXCHECK, STF},
- {"vlan ipv6 ICMP ttl 253", 6, IPPROTO_ICMP, 253, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
- {"vlan ipv6 TCP latency flow stat", 6, IPPROTO_TCP, 253, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
- {"vlan ipv6 UDP latency flow stat", 6, IPPROTO_UDP, 253, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
-
+ {"vlan ipv6 ICMP ttl 246", 6, IPPROTO_ICMP, 246, 5, DPF_VLAN | DPF_RXCHECK, STF},
+ {"vlan ipv6 ICMP ttl 245", 6, IPPROTO_ICMP, 245, 5, DPF_VLAN | DPF_RXCHECK, ZERO},
+ {"vlan ipv6 TCP latency flow stat", 6, IPPROTO_TCP, 240, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
+ {"vlan ipv6 UDP latency flow stat", 6, IPPROTO_UDP, 240, FLOW_STAT_PAYLOAD_IP_ID, DPF_VLAN, STL},
};
// unit test for verifying hw queues rule configuration. Can be run by:
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 250d0911..6e4b22e1 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -6193,11 +6193,10 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules_stateless(CPhyEthIF *
int CTRexExtendedDriverBase10G::configure_rx_filter_rules_statefull(CPhyEthIF * _if) {
uint8_t port_id=_if->get_rte_port_id();
- uint16_t hops = get_rx_check_hops();
- uint16_t v4_hops = (hops << 8)&0xff00;
+ uint16_t base_hop = get_rx_check_hops();
/* enable rule 0 SCTP -> queue 1 for latency */
- /* 1<<21 means that queue 1 is for SCTP */
+ /* 1 << 21 means send to queue */
_if->pci_reg_write(IXGBE_L34T_IMIR(0),(1<<21));
_if->pci_reg_write(IXGBE_FTQF(0),
IXGBE_FTQF_PROTOCOL_SCTP|
@@ -6205,23 +6204,19 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules_statefull(CPhyEthIF *
((0x0f)<<IXGBE_FTQF_5TUPLE_MASK_SHIFT)|IXGBE_FTQF_QUEUE_ENABLE);
// IPv4: bytes being compared are {TTL, Protocol}
- uint16_t ff_rules_v4[6]={
- (uint16_t)(0xFF11 - v4_hops),
- (uint16_t)(0xFE11 - v4_hops),
- (uint16_t)(0xFF06 - v4_hops),
- (uint16_t)(0xFE06 - v4_hops),
- (uint16_t)(0xFF01 - v4_hops),
- (uint16_t)(0xFE01 - v4_hops),
+ uint16_t ff_rules_v4[3] = {
+ 0xFF11,
+ 0xFF06,
+ 0xFF01,
};
// IPv6: bytes being compared are {NextHdr, HopLimit}
- uint16_t ff_rules_v6[6]={
- (uint16_t)(0x3CFF - hops),
- (uint16_t)(0x3CFE - hops),
+ uint16_t ff_rules_v6[1] = {
+ 0x3CFF
};
uint16_t *ff_rules;
uint16_t num_rules;
- int rule_id;
+ int rule_id = 1;
if ( CGlobalInfo::m_options.preview.get_ipv6_mode_enable() ){
ff_rules = &ff_rules_v6[0];
@@ -6231,29 +6226,37 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules_statefull(CPhyEthIF *
num_rules = sizeof(ff_rules_v4)/sizeof(ff_rules_v4[0]);
}
- for (rule_id=0; rule_id<num_rules; rule_id++ ) {
+ for (int rule_num = 0; rule_num < num_rules; rule_num++ ) {
struct rte_eth_fdir_filter fdir_filter;
- uint16_t ff_rule = ff_rules[rule_id];
+ uint16_t ff_rule = ff_rules[rule_num];
int res = 0;
+ uint16_t v4_hops;
- memset(&fdir_filter,0,sizeof(fdir_filter));
- /* TOS/PROTO */
- if ( CGlobalInfo::m_options.preview.get_ipv6_mode_enable() ){
- fdir_filter.input.flow_type = RTE_ETH_FLOW_NONFRAG_IPV6_OTHER;
- }else{
- fdir_filter.input.flow_type = RTE_ETH_FLOW_NONFRAG_IPV4_OTHER;
- }
- fdir_filter.soft_id = rule_id;
-
- fdir_filter.input.flow_ext.flexbytes[0] = (ff_rule >> 8) & 0xff;
- fdir_filter.input.flow_ext.flexbytes[1] = ff_rule & 0xff;
- fdir_filter.action.rx_queue = 1;
- fdir_filter.action.behavior = RTE_ETH_FDIR_ACCEPT;
- fdir_filter.action.report_status = RTE_ETH_FDIR_NO_REPORT_STATUS;
- res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_ADD, &fdir_filter);
-
- if (res != 0) {
- rte_exit(EXIT_FAILURE, "Error: rte_eth_dev_filter_ctrl in configure_rx_filter_rules_statefull: %d\n",res);
+ // configure rule sending packets to RX queue for 10 TTL values
+ for (int hops = base_hop; hops < base_hop + 10; hops++) {
+ memset(&fdir_filter, 0, sizeof(fdir_filter));
+ /* TOS/PROTO */
+ if ( CGlobalInfo::m_options.preview.get_ipv6_mode_enable() ) {
+ fdir_filter.input.flow_type = RTE_ETH_FLOW_NONFRAG_IPV6_OTHER;
+ fdir_filter.input.flow_ext.flexbytes[0] = (ff_rule >> 8) & 0xff;
+ fdir_filter.input.flow_ext.flexbytes[1] = (ff_rule - hops) & 0xff;
+ } else {
+ v4_hops = hops << 8;
+ fdir_filter.input.flow_type = RTE_ETH_FLOW_NONFRAG_IPV4_OTHER;
+ fdir_filter.input.flow_ext.flexbytes[0] = ((ff_rule - v4_hops) >> 8) & 0xff;
+ fdir_filter.input.flow_ext.flexbytes[1] = ff_rule & 0xff;
+ }
+ fdir_filter.soft_id = rule_id++;
+ fdir_filter.action.rx_queue = 1;
+ fdir_filter.action.behavior = RTE_ETH_FDIR_ACCEPT;
+ fdir_filter.action.report_status = RTE_ETH_FDIR_NO_REPORT_STATUS;
+ res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_ADD, &fdir_filter);
+
+ if (res != 0) {
+ rte_exit(EXIT_FAILURE
+ , "Error: rte_eth_dev_filter_ctrl in configure_rx_filter_rules_statefull rule_id:%d: %d\n"
+ , rule_id, res);
+ }
}
}
return (0);
@@ -6492,7 +6495,7 @@ int CTRexExtendedDriverBase40G::configure_rx_filter_rules_statefull(CPhyEthIF *
int i;
rte_eth_fdir_stats_reset(port_id, NULL, 0, 1);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < 10; i++) {
uint8_t ttl = TTL_RESERVE_DUPLICATE - i - hops;
add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_UDP, ttl, 0, 0, MAIN_DPDK_RX_Q, 0);
add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_TCP, ttl, 0, 0, MAIN_DPDK_RX_Q, 0);