app/testpmd: update flow director commands
[dpdk.git] / app / test-pmd / config.c
index 71b34dd..47eac88 100644 (file)
@@ -628,8 +628,13 @@ ring_dma_zone_lookup(const char *ring_name, uint8_t port_id, uint16_t q_id)
 union igb_ring_dword {
        uint64_t dword;
        struct {
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+               uint32_t lo;
+               uint32_t hi;
+#else
                uint32_t hi;
                uint32_t lo;
+#endif
        } words;
 };
 
@@ -672,23 +677,29 @@ ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
                /* 32 bytes RX descriptor, i40e only */
                struct igb_ring_desc_32_bytes *ring =
                        (struct igb_ring_desc_32_bytes *)ring_mz->addr;
+               ring[desc_id].lo_dword.dword =
+                       rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+               ring_rxd_display_dword(ring[desc_id].lo_dword);
+               ring[desc_id].hi_dword.dword =
+                       rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
+               ring_rxd_display_dword(ring[desc_id].hi_dword);
+               ring[desc_id].resv1.dword =
+                       rte_le_to_cpu_64(ring[desc_id].resv1.dword);
+               ring_rxd_display_dword(ring[desc_id].resv1);
+               ring[desc_id].resv2.dword =
+                       rte_le_to_cpu_64(ring[desc_id].resv2.dword);
+               ring_rxd_display_dword(ring[desc_id].resv2);
 
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].lo_dword));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].hi_dword));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].resv1));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].resv2));
                return;
        }
 #endif
        /* 16 bytes RX descriptor */
-       ring_rxd_display_dword(rte_le_to_cpu_64(
-                       ring[desc_id].lo_dword));
-       ring_rxd_display_dword(rte_le_to_cpu_64(
-                       ring[desc_id].hi_dword));
+       ring[desc_id].lo_dword.dword =
+               rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+       ring_rxd_display_dword(ring[desc_id].lo_dword);
+       ring[desc_id].hi_dword.dword =
+               rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
+       ring_rxd_display_dword(ring[desc_id].hi_dword);
 }
 
 static void
@@ -698,8 +709,8 @@ ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
        struct igb_ring_desc_16_bytes txd;
 
        ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
-       txd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
-       txd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
+       txd.lo_dword.dword = rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+       txd.hi_dword.dword = rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
        printf("    0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
                        (unsigned)txd.lo_dword.words.lo,
                        (unsigned)txd.lo_dword.words.hi,
@@ -763,18 +774,23 @@ rxtx_config_display(void)
                printf("  packet len=%u - nb packet segments=%d\n",
                                (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs);
 
+       struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf;
+       struct rte_eth_txconf *tx_conf = &ports[0].tx_conf;
+
        printf("  nb forwarding cores=%d - nb forwarding ports=%d\n",
               nb_fwd_lcores, nb_fwd_ports);
        printf("  RX queues=%d - RX desc=%d - RX free threshold=%d\n",
-              nb_rxq, nb_rxd, rx_free_thresh);
+              nb_rxq, nb_rxd, rx_conf->rx_free_thresh);
        printf("  RX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n",
-              rx_thresh.pthresh, rx_thresh.hthresh, rx_thresh.wthresh);
+              rx_conf->rx_thresh.pthresh, rx_conf->rx_thresh.hthresh,
+              rx_conf->rx_thresh.wthresh);
        printf("  TX queues=%d - TX desc=%d - TX free threshold=%d\n",
-              nb_txq, nb_txd, tx_free_thresh);
+              nb_txq, nb_txd, tx_conf->tx_free_thresh);
        printf("  TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n",
-              tx_thresh.pthresh, tx_thresh.hthresh, tx_thresh.wthresh);
+              tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh,
+              tx_conf->tx_thresh.wthresh);
        printf("  TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n",
-              tx_rs_thresh, txq_flags);
+              tx_conf->tx_rs_thresh, tx_conf->txq_flags);
 }
 
 void
@@ -813,7 +829,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 {
        struct rte_eth_rss_conf rss_conf;
        uint8_t rss_key[10 * 4];
-       uint16_t rss_hf;
+       uint64_t rss_hf;
        uint8_t i;
        int diag;
 
@@ -1429,7 +1445,7 @@ set_fwd_ports_mask(uint64_t portmask)
                return;
        }
        nb_pt = 0;
-       for (i = 0; i < 64; i++) {
+       for (i = 0; i < (unsigned)RTE_MIN(64, RTE_MAX_ETHPORTS); i++) {
                if (! ((uint64_t)(1ULL << i) & portmask))
                        continue;
                portlist[nb_pt++] = i;
@@ -1756,60 +1772,6 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
        }
 }
 
-void
-fdir_add_signature_filter(portid_t port_id, uint8_t queue_id,
-                         struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_add_signature_filter(port_id, fdir_filter,
-                                                    queue_id);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_add_signature_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
-void
-fdir_update_signature_filter(portid_t port_id, uint8_t queue_id,
-                            struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_update_signature_filter(port_id, fdir_filter,
-                                                       queue_id);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_update_signature_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
-void
-fdir_remove_signature_filter(portid_t port_id,
-                            struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_remove_signature_filter(port_id, fdir_filter);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_add_signature_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-
-}
-
 static inline void
 print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)
 {
@@ -1938,76 +1900,6 @@ fdir_get_infos(portid_t port_id)
               fdir_stats_border, fdir_stats_border);
 }
 
-void
-fdir_add_perfect_filter(portid_t port_id, uint16_t soft_id, uint8_t queue_id,
-                       uint8_t drop, struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_add_perfect_filter(port_id, fdir_filter,
-                                                  soft_id, queue_id, drop);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_add_perfect_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
-void
-fdir_update_perfect_filter(portid_t port_id, uint16_t soft_id, uint8_t queue_id,
-                          uint8_t drop, struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_update_perfect_filter(port_id, fdir_filter,
-                                                     soft_id, queue_id, drop);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_update_perfect_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
-void
-fdir_remove_perfect_filter(portid_t port_id, uint16_t soft_id,
-                          struct rte_fdir_filter *fdir_filter)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_remove_perfect_filter(port_id, fdir_filter,
-                                                     soft_id);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_fdir_update_perfect_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
-void
-fdir_set_masks(portid_t port_id, struct rte_fdir_masks *fdir_masks)
-{
-       int diag;
-
-       if (port_id_is_invalid(port_id))
-               return;
-
-       diag = rte_eth_dev_fdir_set_masks(port_id, fdir_masks);
-       if (diag == 0)
-               return;
-
-       printf("rte_eth_dev_set_masks_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
-
 void
 fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *cfg)
 {
@@ -2154,33 +2046,6 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
        return diag;
 }
 
-void
-get_ethertype_filter(uint8_t port_id, uint16_t index)
-{
-       struct rte_ethertype_filter filter;
-       int ret = 0;
-       uint16_t rx_queue;
-
-       memset(&filter, 0, sizeof(filter));
-       ret = rte_eth_dev_get_ethertype_filter(port_id, index,
-                               &filter, &rx_queue);
-       if (ret < 0) {
-               if (ret == (-ENOENT))
-                       printf("filter[%d] is not enabled\n", index);
-               else
-                       printf("get ethertype filter fails(%s)\n", strerror(-ret));
-               return;
-       } else {
-               printf("filter[%d]:\n", index);
-               printf("    ethertype:  0x%04x\n",
-                       rte_le_to_cpu_32(filter.ethertype));
-               printf("    priority: %s, %d\n",
-                       filter.priority_en ? "enable" : "disable",
-                       filter.priority);
-               printf("    queue: %d\n", rx_queue);
-       }
-}
-
 void
 get_syn_filter(uint8_t port_id)
 {