app/testpmd: extend event printing
authorMatan Azrad <matan@mellanox.com>
Thu, 4 Jan 2018 16:01:12 +0000 (17:01 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
There are new Ethernet device events - NEW and DESTROY, and new option
to register all ports by one call.

Adjust application to aforementioned changes.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/parameters.c
app/test-pmd/testpmd.c
doc/guides/testpmd_app_ug/run_app.rst

index 5b4da6c..878c112 100644 (file)
@@ -516,6 +516,10 @@ parse_event_printing_config(const char *optarg, int enable)
                mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
        else if (!strcmp(optarg, "intr_rmv"))
                mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
+       else if (!strcmp(optarg, "dev_probed"))
+               mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
+       else if (!strcmp(optarg, "dev_released"))
+               mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
        else if (!strcmp(optarg, "all"))
                mask = ~UINT32_C(0);
        else {
index 007d6a2..c066cf9 100644 (file)
@@ -1554,20 +1554,6 @@ start_port(portid_t pid)
                        }
                }
 
-               for (event_type = RTE_ETH_EVENT_UNKNOWN;
-                    event_type < RTE_ETH_EVENT_MAX;
-                    event_type++) {
-                       diag = rte_eth_dev_callback_register(pi,
-                                                       event_type,
-                                                       eth_event_callback,
-                                                       NULL);
-                       if (diag) {
-                               printf("Failed to setup even callback for event %d\n",
-                                       event_type);
-                               return -1;
-                       }
-               }
-
                /* start port */
                if (rte_eth_dev_start(pi) < 0) {
                        printf("Fail to start port %d\n", pi);
@@ -1594,6 +1580,20 @@ start_port(portid_t pid)
                need_check_link_status = 1;
        }
 
+       for (event_type = RTE_ETH_EVENT_UNKNOWN;
+            event_type < RTE_ETH_EVENT_MAX;
+            event_type++) {
+               diag = rte_eth_dev_callback_register(RTE_ETH_ALL,
+                                               event_type,
+                                               eth_event_callback,
+                                               NULL);
+               if (diag) {
+                       printf("Failed to setup even callback for event %d\n",
+                               event_type);
+                       return -1;
+               }
+       }
+
        if (need_check_link_status == 1 && !no_link_check)
                check_all_ports_link_status(RTE_PORT_ALL);
        else if (need_check_link_status == 0)
@@ -1916,6 +1916,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
                [RTE_ETH_EVENT_VF_MBOX] = "VF Mbox",
                [RTE_ETH_EVENT_MACSEC] = "MACsec",
                [RTE_ETH_EVENT_INTR_RMV] = "device removal",
+               [RTE_ETH_EVENT_NEW] = "device probed",
+               [RTE_ETH_EVENT_DESTROY] = "device released",
                [RTE_ETH_EVENT_MAX] = NULL,
        };
 
index be9a2cd..46da1df 100644 (file)
@@ -480,12 +480,12 @@ The commandline options are:
 
     Set the logical core N to perform bitrate calculation.
 
-*   ``--print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>``
+*   ``--print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|all>``
 
     Enable printing the occurrence of the designated event. Using all will
     enable all of them.
 
-*   ``--mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>``
+*   ``--mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|all>``
 
     Disable printing the occurrence of the designated event. Using all will
     disable all of them.