app/testpmd: separate forward config setup from display
[dpdk.git] / app / test-pmd / config.c
index 1c552e4..24eac3c 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -1381,7 +1381,7 @@ fwd_config_setup(void)
                simple_fwd_config_setup();
 }
 
-static void
+void
 pkt_fwd_config_display(struct fwd_config *cfg)
 {
        struct fwd_stream *fs;
@@ -1420,14 +1420,6 @@ pkt_fwd_config_display(struct fwd_config *cfg)
        printf("\n");
 }
 
-
-void
-fwd_config_display(void)
-{
-       fwd_config_setup();
-       pkt_fwd_config_display(&cur_fwd_config);
-}
-
 int
 set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
 {
@@ -1565,6 +1557,22 @@ set_fwd_ports_number(uint16_t nb_pt)
               (unsigned int) nb_fwd_ports);
 }
 
+int
+port_is_forwarding(portid_t port_id)
+{
+       unsigned int i;
+
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return -1;
+
+       for (i = 0; i < nb_fwd_ports; i++) {
+               if (fwd_ports_ids[i] == port_id)
+                       return 1;
+       }
+
+       return 0;
+}
+
 void
 set_nb_pkt_per_burst(uint16_t nb)
 {