examples/ethtool: convert to new ethdev offloads API
[dpdk.git] / app / test-pmd / testpmd.c
index bc63cf4..c066cf9 100644 (file)
@@ -230,11 +230,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET;
  */
 int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET;
 
-/*
- * Configurable value of TX queue flags.
- */
-int32_t txq_flags = RTE_PMD_PARAM_UNSET;
-
 /*
  * Receive Side Scaling (RSS) configuration.
  */
@@ -316,7 +311,9 @@ struct rte_eth_rxmode rx_mode = {
        .ignore_offload_bitfield = 1,
 };
 
-struct rte_eth_txmode tx_mode;
+struct rte_eth_txmode tx_mode = {
+       .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE,
+};
 
 struct rte_fdir_conf fdir_conf = {
        .mode = RTE_FDIR_MODE_NONE,
@@ -580,7 +577,12 @@ init_config(void)
                port = &ports[pid];
                /* Apply default Tx configuration for all ports */
                port->dev_conf.txmode = tx_mode;
+               port->dev_conf.rxmode = rx_mode;
                rte_eth_dev_info_get(pid, &port->dev_info);
+               if (!(port->dev_info.tx_offload_capa &
+                     DEV_TX_OFFLOAD_MBUF_FAST_FREE))
+                       port->dev_conf.txmode.offloads &=
+                               ~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
                if (numa_support) {
                        if (port_numa[pid] != NUMA_NO_CONFIG)
@@ -1552,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);
@@ -1592,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)
@@ -1914,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,
        };
 
@@ -2056,9 +2060,6 @@ rxtx_port_config(struct rte_port *port)
 
        if (tx_free_thresh != RTE_PMD_PARAM_UNSET)
                port->tx_conf.tx_free_thresh = tx_free_thresh;
-
-       if (txq_flags != RTE_PMD_PARAM_UNSET)
-               port->tx_conf.txq_flags = txq_flags;
 }
 
 void
@@ -2069,7 +2070,6 @@ init_port_config(void)
 
        RTE_ETH_FOREACH_DEV(pid) {
                port = &ports[pid];
-               port->dev_conf.rxmode = rx_mode;
                port->dev_conf.fdir_conf = fdir_conf;
                if (nb_rxq > 1) {
                        port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;