app/testpmd: fix flow director mask
[dpdk.git] / app / test-pmd / config.c
index c5865f9..7854b72 100644 (file)
@@ -84,7 +84,6 @@
 #include <rte_lcore.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
-#include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_interrupts.h>
@@ -954,7 +953,7 @@ rxtx_config_display(void)
               rx_mode.hw_strip_crc ? "enabled" : "disabled",
               nb_pkt_per_burst);
 
-       if (cur_fwd_eng == &tx_only_engine)
+       if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine)
                printf("  packet len=%u - nb packet segments=%d\n",
                                (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs);
 
@@ -1012,14 +1011,26 @@ void
 port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
 {
        struct rte_eth_rss_conf rss_conf;
-       uint8_t rss_key[10 * 4] = "";
+       uint8_t rss_key[RSS_HASH_KEY_LENGTH];
        uint64_t rss_hf;
        uint8_t i;
        int diag;
+       struct rte_eth_dev_info dev_info;
+       uint8_t hash_key_size;
 
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&dev_info, 0, sizeof(dev_info));
+       rte_eth_dev_info_get(port_id, &dev_info);
+       if (dev_info.hash_key_size > 0 &&
+                       dev_info.hash_key_size <= sizeof(rss_key))
+               hash_key_size = dev_info.hash_key_size;
+       else {
+               printf("dev_info did not provide a valid hash key size\n");
+               return;
+       }
+
        rss_conf.rss_hf = 0;
        for (i = 0; i < RTE_DIM(rss_type_table); i++) {
                if (!strcmp(rss_info, rss_type_table[i].str))
@@ -1028,7 +1039,7 @@ port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
 
        /* Get RSS hash key if asked to display it */
        rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
-       rss_conf.rss_key_len = sizeof(rss_key);
+       rss_conf.rss_key_len = hash_key_size;
        diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
        if (diag != 0) {
                switch (diag) {
@@ -1058,7 +1069,7 @@ port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
        if (!show_rss_key)
                return;
        printf("RSS key:\n");
-       for (i = 0; i < sizeof(rss_key); i++)
+       for (i = 0; i < hash_key_size; i++)
                printf("%02X", rss_key[i]);
        printf("\n");
 }
@@ -1201,14 +1212,9 @@ simple_fwd_config_setup(void)
 }
 
 /**
- * For the RSS forwarding test, each core is assigned on every port a transmit
- * queue whose index is the index of the core itself. This approach limits the
- * maximumm number of processing cores of the RSS test to the maximum number of
- * TX queues supported by the devices.
- *
- * Each core is assigned a single stream, each stream being composed of
- * a RX queue to poll on a RX port for input messages, associated with
- * a TX queue of a TX port where to send forwarded packets.
+ * For the RSS forwarding test all streams distributed over lcores. Each stream
+ * being composed of a RX queue to poll on a RX port for input messages,
+ * associated with a TX queue of a TX port where to send forwarded packets.
  * All packets received on the RX queue of index "RxQj" of the RX port "RxPi"
  * are sent on the TX queue "TxQl" of the TX port "TxPk" according to the two
  * following rules:
@@ -1222,7 +1228,7 @@ rss_fwd_config_setup(void)
        portid_t   txp;
        queueid_t  rxq;
        queueid_t  nb_q;
-       lcoreid_t  lc_id;
+       streamid_t  sm_id;
 
        nb_q = nb_rxq;
        if (nb_q > nb_txq)
@@ -1241,10 +1247,10 @@ rss_fwd_config_setup(void)
 
        setup_fwd_config_of_each_lcore(&cur_fwd_config);
        rxp = 0; rxq = 0;
-       for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_streams; lc_id++) {
+       for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
                struct fwd_stream *fs;
 
-               fs = fwd_streams[lc_id];
+               fs = fwd_streams[sm_id];
 
                if ((rxp & 0x1) == 0)
                        txp = (portid_t) (rxp + 1);
@@ -2051,16 +2057,15 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
-       printf("\n    vlan_tci: 0x%04x", mask->vlan_tci_mask);
+       printf("\n    vlan_tci: 0x%04x", mask->vlan_tci_mask);
 
-       if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
-               printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask);
-       else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
-               printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+       if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+               printf(", mac_addr: 0x%02x, tunnel_type: 0x%01x,"
+                       " tunnel_id: 0x%08x",
                        mask->mac_addr_byte_mask, mask->tunnel_type_mask,
                        mask->tunnel_id_mask);
-       else {
-               printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+       else if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+               printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
                        " src_port: 0x%04x, dst_port: 0x%04x",
                        mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
                        mask->src_port_mask, mask->dst_port_mask);