diff options
-rwxr-xr-x | linux_dpdk/ws_main.py | 2 | ||||
-rw-r--r-- | src/dpdk/drivers/net/mlx5/mlx5_fdir.c | 37 | ||||
-rw-r--r-- | src/dpdk/drivers/net/mlx5/mlx5_rxq.c | 4 | ||||
-rw-r--r-- | src/dpdk/drivers/net/mlx5/mlx5_rxtx.h | 4 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 15 | ||||
-rw-r--r-- | src/stateful_rx_core.cpp | 4 |
6 files changed, 52 insertions, 14 deletions
diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py index 63377495..8d9a236c 100755 --- a/linux_dpdk/ws_main.py +++ b/linux_dpdk/ws_main.py @@ -710,6 +710,8 @@ class build_option: def get_c_flags (self): flags = self.get_common_flags() + if self.isRelease () : + flags += ['-DNDEBUG']; # for C no special flags yet return (flags) diff --git a/src/dpdk/drivers/net/mlx5/mlx5_fdir.c b/src/dpdk/drivers/net/mlx5/mlx5_fdir.c index 73eb00ec..e4f0bf06 100644 --- a/src/dpdk/drivers/net/mlx5/mlx5_fdir.c +++ b/src/dpdk/drivers/net/mlx5/mlx5_fdir.c @@ -42,7 +42,7 @@ #ifdef PEDANTIC #pragma GCC diagnostic ignored "-pedantic" #endif -#include <infiniband/verbs.h> +#include <infiniband/verbs_exp.h> #ifdef PEDANTIC #pragma GCC diagnostic error "-pedantic" #endif @@ -67,6 +67,10 @@ struct fdir_flow_desc { uint16_t src_port; uint32_t src_ip[4]; uint32_t dst_ip[4]; + uint8_t tos; + uint8_t ip_id; + uint16_t proto; + uint8_t mac[6]; uint16_t vlan_tag; enum hash_rxq_type type; @@ -141,9 +145,13 @@ fdir_filter_to_flow_desc(const struct rte_eth_fdir_filter *fdir_filter, case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: desc->src_port = fdir_filter->input.flow.udp4_flow.src_port; desc->dst_port = fdir_filter->input.flow.udp4_flow.dst_port; + case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: desc->src_ip[0] = fdir_filter->input.flow.ip4_flow.src_ip; desc->dst_ip[0] = fdir_filter->input.flow.ip4_flow.dst_ip; + desc->tos = fdir_filter->input.flow.ip4_flow.ttl; /* TTL is map to TOS*/ + desc->ip_id = fdir_filter->input.flow.ip4_flow.ip_id; + desc->proto = fdir_filter->input.flow.ip4_flow.proto; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: @@ -157,6 +165,10 @@ fdir_filter_to_flow_desc(const struct rte_eth_fdir_filter *fdir_filter, rte_memcpy(desc->dst_ip, fdir_filter->input.flow.ipv6_flow.dst_ip, sizeof(desc->dst_ip)); + desc->tos = fdir_filter->input.flow.ipv6_flow.tc; + desc->ip_id = (uint8_t)fdir_filter->input.flow.ipv6_flow.flow_label; + desc->proto = fdir_filter->input.flow.ipv6_flow.proto; + break; default: break; @@ -251,8 +263,8 @@ priv_fdir_flow_add(struct priv *priv, struct ibv_exp_flow_attr *attr = &data->attr; uintptr_t spec_offset = (uintptr_t)&data->spec; struct ibv_exp_flow_spec_eth *spec_eth; - struct ibv_exp_flow_spec_ipv4 *spec_ipv4; - struct ibv_exp_flow_spec_ipv6 *spec_ipv6; + struct ibv_exp_flow_spec_ipv4_ext *spec_ipv4; + struct ibv_exp_flow_spec_ipv6_ext *spec_ipv6; struct ibv_exp_flow_spec_tcp_udp *spec_tcp_udp; struct mlx5_fdir_filter *iter_fdir_filter; unsigned int i; @@ -305,10 +317,10 @@ priv_fdir_flow_add(struct priv *priv, spec_offset += spec_eth->size; /* Set IP spec */ - spec_ipv4 = (struct ibv_exp_flow_spec_ipv4 *)spec_offset; + spec_ipv4 = (struct ibv_exp_flow_spec_ipv4_ext *)spec_offset; /* The second specification must be IP. */ - assert(spec_ipv4->type == IBV_EXP_FLOW_SPEC_IPV4); + assert(spec_ipv4->type == IBV_EXP_FLOW_SPEC_IPV4_EXT); assert(spec_ipv4->size == sizeof(*spec_ipv4)); spec_ipv4->val.src_ip = @@ -318,6 +330,19 @@ priv_fdir_flow_add(struct priv *priv, spec_ipv4->mask.src_ip = mask->ipv4_mask.src_ip; spec_ipv4->mask.dst_ip = mask->ipv4_mask.dst_ip; + /* PROTO */ + spec_ipv4->val.proto = desc->proto & mask->ipv4_mask.proto; + spec_ipv4->mask.proto = mask->ipv4_mask.proto; + + /* TOS */ + if (desc->ip_id ==1 ){ + spec_ipv4->mask.tos = 0x1; + }else{ + spec_ipv4->mask.tos = 0x0; + } + spec_ipv4->val.tos = + desc->tos & spec_ipv4->mask.tos;// & mask->ipv4_mask.tos; + /* Update priority */ attr->priority = 1; @@ -332,7 +357,7 @@ priv_fdir_flow_add(struct priv *priv, spec_offset += spec_eth->size; /* Set IP spec */ - spec_ipv6 = (struct ibv_exp_flow_spec_ipv6 *)spec_offset; + spec_ipv6 = (struct ibv_exp_flow_spec_ipv6_ext *)spec_offset; /* The second specification must be IP. */ assert(spec_ipv6->type == IBV_EXP_FLOW_SPEC_IPV6); diff --git a/src/dpdk/drivers/net/mlx5/mlx5_rxq.c b/src/dpdk/drivers/net/mlx5/mlx5_rxq.c index 29c137cd..6be01d39 100644 --- a/src/dpdk/drivers/net/mlx5/mlx5_rxq.c +++ b/src/dpdk/drivers/net/mlx5/mlx5_rxq.c @@ -102,7 +102,7 @@ const struct hash_rxq_init hash_rxq_init[] = { ETH_RSS_FRAG_IPV4), .flow_priority = 1, .flow_spec.ipv4 = { - .type = IBV_EXP_FLOW_SPEC_IPV4, + .type = IBV_EXP_FLOW_SPEC_IPV4_EXT, .size = sizeof(hash_rxq_init[0].flow_spec.ipv4), }, .underlayer = &hash_rxq_init[HASH_RXQ_ETH], @@ -140,7 +140,7 @@ const struct hash_rxq_init hash_rxq_init[] = { ETH_RSS_FRAG_IPV6), .flow_priority = 1, .flow_spec.ipv6 = { - .type = IBV_EXP_FLOW_SPEC_IPV6, + .type = IBV_EXP_FLOW_SPEC_IPV6_EXT, .size = sizeof(hash_rxq_init[0].flow_spec.ipv6), }, .underlayer = &hash_rxq_init[HASH_RXQ_ETH], diff --git a/src/dpdk/drivers/net/mlx5/mlx5_rxtx.h b/src/dpdk/drivers/net/mlx5/mlx5_rxtx.h index f6e2cbac..d87dd19b 100644 --- a/src/dpdk/drivers/net/mlx5/mlx5_rxtx.h +++ b/src/dpdk/drivers/net/mlx5/mlx5_rxtx.h @@ -173,8 +173,8 @@ struct hash_rxq_init { uint16_t size; } hdr; struct ibv_exp_flow_spec_tcp_udp tcp_udp; - struct ibv_exp_flow_spec_ipv4 ipv4; - struct ibv_exp_flow_spec_ipv6 ipv6; + struct ibv_exp_flow_spec_ipv4_ext ipv4; + struct ibv_exp_flow_spec_ipv6_ext ipv6; struct ibv_exp_flow_spec_eth eth; } flow_spec; /* Flow specification template. */ const struct hash_rxq_init *underlayer; /* Pointer to underlayer. */ diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 511f7fc3..de7221b5 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -6389,9 +6389,14 @@ void CTRexExtendedDriverBaseMlnx5G::update_configuration(port_cfg_t * cfg){ cfg->m_tx_conf.tx_thresh.hthresh = TX_HTHRESH; cfg->m_tx_conf.tx_thresh.wthresh = TX_WTHRESH; cfg->update_global_config_fdir_40g(); + /* update mask */ + cfg->m_port_conf.fdir_conf.mask.ipv4_mask.proto=0xff; + cfg->m_port_conf.fdir_conf.mask.ipv4_mask.tos=0x01; } -void CTRexExtendedDriverBaseMlnx5G::add_del_rules(enum rte_filter_op op, uint8_t port_id, uint16_t type, uint8_t ttl, uint16_t ip_id, +void CTRexExtendedDriverBaseMlnx5G::add_del_rules(enum rte_filter_op op, uint8_t port_id, uint16_t type, + uint8_t ttl, + uint16_t ip_id, uint16_t l4_proto, int queue, uint16_t stat_idx) { /* Mellanox card does not have TTL support, so we will replace it in low level with TOS */ @@ -6495,9 +6500,15 @@ int CTRexExtendedDriverBaseMlnx5G::add_del_rx_flow_stat_rule(uint8_t port_id, en int CTRexExtendedDriverBaseMlnx5G::configure_rx_filter_rules_statfull(CPhyEthIF * _if) { - //uint32_t port_id = _if->get_port_id(); + uint32_t port_id = _if->get_port_id(); /* TTL==TOS */ + /*PID=1 ==> MASK TOS=0x1/0x1*/ + //add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_UDP, 0x1, 1, 17, MAIN_DPDK_RX_Q, 0); + //add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_TCP, 0x1, 1, 6, MAIN_DPDK_RX_Q, 0); + add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_OTHER, 0x1, 1, 132, MAIN_DPDK_RX_Q, 0); /*SCTP*/ + add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_OTHER, 0x1, 1, 1, MAIN_DPDK_RX_Q, 0); /*ICMP*/ + return (0); /* Configure rules for latency measurement packets */ //add_del_rules(RTE_ETH_FILTER_ADD, port_id, RTE_ETH_FLOW_NONFRAG_IPV4_UDP, TTL_RESERVE_DUPLICATE, 0, 0, MAIN_DPDK_RX_Q, 0); diff --git a/src/stateful_rx_core.cpp b/src/stateful_rx_core.cpp index ebc51fcb..cbf62a17 100644 --- a/src/stateful_rx_core.cpp +++ b/src/stateful_rx_core.cpp @@ -33,7 +33,7 @@ const uint8_t sctp_pkt[]={ 0x00,0x0e,0x2e,0x24,0x37,0x5f, 0x08,0x00, - 0x45,0x02,0x00,0x30, + 0x45,0x03,0x00,0x30, 0x00,0x00,0x40,0x00, 0xff,0x84,0xbd,0x04, 0x9b,0xe6,0x18,0x9b, //sIP @@ -57,7 +57,7 @@ const uint8_t icmp_pkt[]={ 0x00,0x0e,0x2e,0x24,0x37,0x5f, 0x08,0x00, - 0x45,0x02,0x00,0x30, + 0x45,0x03,0x00,0x30, 0x00,0x00,0x40,0x00, 0xff,0x01,0xbd,0x04, 0x9b,0xe6,0x18,0x9b, //SIP |