eal: deprecate rte_snprintf
[dpdk.git] / app / test-pmd / parameters.c
index d37e1b0..4bca0b0 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
@@ -197,6 +197,8 @@ usage(char* progname)
        printf("  --no-flush-rx: Don't flush RX streams before forwarding."
               " Used mainly with PCAP drivers.\n");
        printf("  --txpkts=X[,Y]*: set TX segment sizes.\n");
+       printf("  --disable-link-check: disable check on link status when "
+              "starting/stopping ports.\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -298,7 +300,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++){
@@ -314,14 +316,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 =
@@ -331,6 +333,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 =
@@ -362,7 +371,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) {
@@ -374,7 +383,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++) {
@@ -415,7 +424,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
@@ -430,7 +439,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++) {
@@ -473,8 +482,8 @@ parse_ringnuma_config(const char *q_arg)
                                ring_flag,port_id);
                        break;
                }
-       }       
-       
+       }
+
        return 0;
 }
 
@@ -549,7 +558,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 },
@@ -587,6 +596,7 @@ launch_args_parse(int argc, char** argv)
                { "rx-queue-stats-mapping",     1, 0, 0 },
                { "no-flush-rx",        0, 0, 0 },
                { "txpkts",                     1, 0, 0 },
+               { "disable-link-check",         0, 0, 0 },
                { 0, 0, 0, 0 },
        };
 
@@ -829,10 +839,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)
@@ -1044,6 +1053,8 @@ launch_args_parse(int argc, char** argv)
                        }
                        if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
                                no_flush_rx = 1;
+                       if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
+                               no_link_check = 1;
 
                        break;
                case 'h':