#include "testpmd.h"
-static const char *flowtype_str[RTE_ETH_FLOW_TYPE_MAX] = {
- NULL,
- "raw",
- "udp4",
- "tcp4",
- "sctp4",
- "ip4",
- "ip4-frag",
- "udp6",
- "tcp6",
- "sctp6",
- "ip6",
- "ip6-frag",
-};
+static char *flowtype_to_str(uint16_t flow_type);
static void
print_ethaddr(const char *name, struct ether_addr *eth_addr)
rte_eth_dev_info_get(port_id, &dev_info);
if (dev_info.reta_size > 0)
printf("Redirection table size: %u\n", dev_info.reta_size);
+ if (!dev_info.flow_type_rss_offloads)
+ printf("No flow type is supported.\n");
+ else {
+ uint16_t i;
+ char *p;
+
+ printf("Supported flow types:\n");
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < RTE_ETH_FLOW_MAX;
+ i++) {
+ if (!(dev_info.flow_type_rss_offloads & (1ULL << i)))
+ continue;
+ p = flowtype_to_str(i);
+ printf(" %s\n", (p ? p : "unknown"));
+ }
+ }
}
int
void
port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
{
+ struct rss_type_info {
+ char str[32];
+ uint64_t rss_type;
+ };
+ static const struct rss_type_info rss_type_table[] = {
+ {"ipv4", ETH_RSS_IPV4},
+ {"ipv4-frag", ETH_RSS_FRAG_IPV4},
+ {"ipv4-tcp", ETH_RSS_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", ETH_RSS_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", ETH_RSS_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", ETH_RSS_NONFRAG_IPV4_OTHER},
+ {"ipv6", ETH_RSS_IPV6},
+ {"ipv6-frag", ETH_RSS_FRAG_IPV6},
+ {"ipv6-tcp", ETH_RSS_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", ETH_RSS_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", ETH_RSS_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", ETH_RSS_NONFRAG_IPV6_OTHER},
+ {"l2-payload", ETH_RSS_L2_PAYLOAD},
+ {"ipv6-ex", ETH_RSS_IPV6_EX},
+ {"ipv6-tcp-ex", ETH_RSS_IPV6_TCP_EX},
+ {"ipv6-udp-ex", ETH_RSS_IPV6_UDP_EX},
+ };
+
struct rte_eth_rss_conf rss_conf;
uint8_t rss_key[10 * 4];
uint64_t rss_hf;
return;
}
printf("RSS functions:\n ");
- if (rss_hf & ETH_RSS_IPV4)
- printf("ip4");
- if (rss_hf & ETH_RSS_IPV4_TCP)
- printf(" tcp4");
- if (rss_hf & ETH_RSS_IPV4_UDP)
- printf(" udp4");
- if (rss_hf & ETH_RSS_IPV6)
- printf(" ip6");
- if (rss_hf & ETH_RSS_IPV6_EX)
- printf(" ip6-ex");
- if (rss_hf & ETH_RSS_IPV6_TCP)
- printf(" tcp6");
- if (rss_hf & ETH_RSS_IPV6_TCP_EX)
- printf(" tcp6-ex");
- if (rss_hf & ETH_RSS_IPV6_UDP)
- printf(" udp6");
- if (rss_hf & ETH_RSS_IPV6_UDP_EX)
- printf(" udp6-ex");
+ for (i = 0; i < RTE_DIM(rss_type_table); i++) {
+ if (rss_hf & rss_type_table[i].rss_type)
+ printf("%s ", rss_type_table[i].str);
+ }
printf("\n");
if (!show_rss_key)
return;
printf("\n");
}
+static char *
+flowtype_to_str(uint16_t flow_type)
+{
+ struct flow_type_info {
+ char str[32];
+ uint16_t ftype;
+ };
+
+ uint8_t i;
+ static struct flow_type_info flowtype_str_table[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ };
+
+ for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+ if (flowtype_str_table[i].ftype == flow_type)
+ return flowtype_str_table[i].str;
+ }
+
+ return NULL;
+}
+
static inline void
print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
{
struct rte_eth_fdir_flex_mask *mask;
uint32_t i, j;
+ char *p;
for (i = 0; i < flex_conf->nb_flexmasks; i++) {
mask = &flex_conf->flex_mask[i];
- printf("\n %s:\t", flowtype_str[mask->flow_type]);
+ p = flowtype_to_str(mask->flow_type);
+ printf("\n %s:\t", p ? p : "unknown");
for (j = 0; j < num; j++)
printf(" %02x", mask->mask[j]);
}
static inline void
print_fdir_flow_type(uint32_t flow_types_mask)
{
- int i = 0;
+ int i;
+ char *p;
- for (i = RTE_ETH_FLOW_TYPE_UDPV4;
- i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;
- i++) {
- if (flow_types_mask & (1 << i))
- printf(" %s", flowtype_str[i]);
+ for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
+ if (!(flow_types_mask & (1 << i)))
+ continue;
+ p = flowtype_to_str(i);
+ if (p)
+ printf(" %s", p);
+ else
+ printf(" unknown");
}
printf("\n");
}
fdir_stats_border, port_id, fdir_stats_border);
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
- printf(" PERFECT\n");
+ printf(" PERFECT\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
- printf(" SIGNATURE\n");
+ printf(" SIGNATURE\n");
else
- printf(" DISABLE\n");
+ printf(" DISABLE\n");
printf(" SUPPORTED FLOW TYPE: ");
print_fdir_flow_type(fdir_info.flow_types_mask[0]);
printf(" FLEX PAYLOAD INFO:\n");
port = &ports[port_id];
flex_conf = &port->dev_conf.fdir_conf.flex_conf;
- for (i = 0; i < RTE_ETH_FLOW_TYPE_MAX; i++) {
+ for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
if (cfg->flow_type == flex_conf->flex_mask[i].flow_type) {
idx = i;
break;
}
}
- if (i >= RTE_ETH_FLOW_TYPE_MAX) {
+ if (i >= RTE_ETH_FLOW_MAX) {
if (flex_conf->nb_flexmasks < RTE_DIM(flex_conf->flex_mask)) {
idx = flex_conf->nb_flexmasks;
flex_conf->nb_flexmasks++;
port_id, diag);
return diag;
}
-
-void
-get_2tuple_filter(uint8_t port_id, uint16_t index)
-{
- struct rte_2tuple_filter filter;
- int ret = 0;
- uint16_t rx_queue;
-
- memset(&filter, 0, sizeof(filter));
- ret = rte_eth_dev_get_2tuple_filter(port_id, index,
- &filter, &rx_queue);
- if (ret < 0) {
- if (ret == (-ENOENT))
- printf("filter[%d] is not enabled\n", index);
- else
- printf("get 2tuple filter fails(%s)\n", strerror(-ret));
- return;
- } else {
- printf("filter[%d]:\n", index);
- printf(" Destination Port: 0x%04x mask: %d\n",
- rte_be_to_cpu_16(filter.dst_port),
- filter.dst_port_mask ? 0 : 1);
- printf(" protocol: 0x%02x mask:%d tcp_flags: 0x%02x\n",
- filter.protocol, filter.protocol_mask ? 0 : 1,
- filter.tcp_flags);
- printf(" priority: %d queue: %d\n",
- filter.priority, rx_queue);
- }
-}
-
-void
-get_5tuple_filter(uint8_t port_id, uint16_t index)
-{
- struct rte_5tuple_filter filter;
- int ret = 0;
- uint16_t rx_queue;
-
- memset(&filter, 0, sizeof(filter));
- ret = rte_eth_dev_get_5tuple_filter(port_id, index,
- &filter, &rx_queue);
- if (ret < 0) {
- if (ret == (-ENOENT))
- printf("filter[%d] is not enabled\n", index);
- else
- printf("get 5tuple filter fails(%s)\n", strerror(-ret));
- return;
- } else {
- printf("filter[%d]:\n", index);
- printf(" Destination IP: 0x%08x mask: %d\n",
- (unsigned)rte_be_to_cpu_32(filter.dst_ip),
- filter.dst_ip_mask ? 0 : 1);
- printf(" Source IP: 0x%08x mask: %d\n",
- (unsigned)rte_be_to_cpu_32(filter.src_ip),
- filter.src_ip_mask ? 0 : 1);
- printf(" Destination Port: 0x%04x mask: %d\n",
- rte_be_to_cpu_16(filter.dst_port),
- filter.dst_port_mask ? 0 : 1);
- printf(" Source Port: 0x%04x mask: %d\n",
- rte_be_to_cpu_16(filter.src_port),
- filter.src_port_mask ? 0 : 1);
- printf(" protocol: 0x%02x mask: %d\n",
- filter.protocol,
- filter.protocol_mask ? 0 : 1);
- printf(" priority: %d flags: 0x%02x queue: %d\n",
- filter.priority, filter.tcp_flags, rx_queue);
- }
-}