app/testpmd: flush flow director table
[dpdk.git] / app / test-pmd / parameters.c
index 7a60048..9573a43 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -75,6 +75,9 @@
 #include <cmdline_parse.h>
 #include <cmdline_parse_etheraddr.h>
 #endif
+#ifdef RTE_LIBRTE_PMD_BOND
+#include <rte_eth_bond.h>
+#endif
 
 #include "testpmd.h"
 
@@ -300,7 +303,7 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
                if(size >= sizeof(s))
                        return -1;
 
-               rte_snprintf(s, sizeof(s), "%.*s", size, p);
+               snprintf(s, sizeof(s), "%.*s", size, p);
                if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
                        return -1;
                for (i = 0; i < _NUM_FLD; i++){
@@ -316,14 +319,14 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
                        return -1;
                }
 
-               if (is_rx ? (nb_rx_queue_stats_mappings >= MAX_RX_QUEUE_STATS_MAPPINGS) :
-                   (nb_tx_queue_stats_mappings >= MAX_TX_QUEUE_STATS_MAPPINGS)) {
-                       printf("exceeded max number of %s queue statistics mappings: %hu\n",
-                              is_rx ? "RX" : "TX",
-                              is_rx ? nb_rx_queue_stats_mappings : nb_tx_queue_stats_mappings);
-                       return -1;
-               }
                if (!is_rx) {
+                       if ((nb_tx_queue_stats_mappings >=
+                                               MAX_TX_QUEUE_STATS_MAPPINGS)) {
+                               printf("exceeded max number of TX queue "
+                                               "statistics mappings: %hu\n",
+                                               nb_tx_queue_stats_mappings);
+                               return -1;
+                       }
                        tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id =
                                (uint8_t)int_fld[FLD_PORT];
                        tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id =
@@ -333,6 +336,13 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
                        ++nb_tx_queue_stats_mappings;
                }
                else {
+                       if ((nb_rx_queue_stats_mappings >=
+                                               MAX_RX_QUEUE_STATS_MAPPINGS)) {
+                               printf("exceeded max number of RX queue "
+                                               "statistics mappings: %hu\n",
+                                               nb_rx_queue_stats_mappings);
+                               return -1;
+                       }
                        rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id =
                                (uint8_t)int_fld[FLD_PORT];
                        rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id =
@@ -364,7 +374,7 @@ parse_portnuma_config(const char *q_arg)
                _NUM_FLD
        };
        unsigned long int_fld[_NUM_FLD];
-       char *str_fld[_NUM_FLD];        
+       char *str_fld[_NUM_FLD];
 
        /* reset from value set at definition */
        while ((p = strchr(p0,'(')) != NULL) {
@@ -376,7 +386,7 @@ parse_portnuma_config(const char *q_arg)
                if(size >= sizeof(s))
                        return -1;
 
-               rte_snprintf(s, sizeof(s), "%.*s", size, p);
+               snprintf(s, sizeof(s), "%.*s", size, p);
                if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
                        return -1;
                for (i = 0; i < _NUM_FLD; i++) {
@@ -417,7 +427,7 @@ parse_ringnuma_config(const char *q_arg)
                _NUM_FLD
        };
        unsigned long int_fld[_NUM_FLD];
-       char *str_fld[_NUM_FLD];        
+       char *str_fld[_NUM_FLD];
        #define RX_RING_ONLY 0x1
        #define TX_RING_ONLY 0x2
        #define RXTX_RING    0x3
@@ -432,7 +442,7 @@ parse_ringnuma_config(const char *q_arg)
                if(size >= sizeof(s))
                        return -1;
 
-               rte_snprintf(s, sizeof(s), "%.*s", size, p);
+               snprintf(s, sizeof(s), "%.*s", size, p);
                if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
                        return -1;
                for (i = 0; i < _NUM_FLD; i++) {
@@ -475,8 +485,8 @@ parse_ringnuma_config(const char *q_arg)
                                ring_flag,port_id);
                        break;
                }
-       }       
-       
+       }
+
        return 0;
 }
 
@@ -551,7 +561,7 @@ launch_args_parse(int argc, char** argv)
                { "mp-anon",                    0, 0, 0 },
                { "port-numa-config",           1, 0, 0 },
                { "ring-numa-config",           1, 0, 0 },
-               { "socket-num",                 1, 0, 0 },      
+               { "socket-num",                 1, 0, 0 },
                { "mbuf-size",                  1, 0, 0 },
                { "total-num-mbufs",            1, 0, 0 },
                { "max-pkt-len",                1, 0, 0 },
@@ -832,10 +842,9 @@ launch_args_parse(int argc, char** argv)
                        if (!strcmp(lgopts[opt_idx].name, "forward-mode"))
                                set_pkt_forwarding_mode(optarg);
                        if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
-                               rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6;
+                               rss_hf = ETH_RSS_IP;
                        if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
-                               rss_hf = ETH_RSS_IPV4 |
-                                               ETH_RSS_IPV6 | ETH_RSS_IPV4_UDP;
+                               rss_hf = ETH_RSS_UDP;
                        if (!strcmp(lgopts[opt_idx].name, "rxq")) {
                                n = atoi(optarg);
                                if (n >= 1 && n <= (int) MAX_QUEUE_ID)