ethdev: fix compiler warning on PMD_DEBUG_TRACE formats
[dpdk.git] / lib / librte_ether / rte_ethdev.c
index d10982f..25bbd9c 100644 (file)
@@ -447,7 +447,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                    (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB_RSS) ||
                    (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
                        /* SRIOV only works in VMDq enable mode */
-                       PMD_DEBUG_TRACE("ethdev port_id=%hhu SRIOV active, "
+                       PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
+                                       " SRIOV active, "
                                        "wrong VMDQ mq_mode rx %u tx %u\n",
                                        port_id,
                                        dev_conf->rxmode.mq_mode,
@@ -460,7 +461,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                case ETH_MQ_RX_VMDQ_DCB:
                case ETH_MQ_RX_VMDQ_DCB_RSS:
                        /* DCB/RSS VMDQ in SRIOV mode, not implement yet */
-                       PMD_DEBUG_TRACE("ethdev port_id=%hhu SRIOV active, "
+                       PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
+                                       " SRIOV active, "
                                        "unsupported VMDQ mq_mode rx %u\n",
                                        port_id, dev_conf->rxmode.mq_mode);
                        return (-EINVAL);
@@ -475,7 +477,8 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                switch (dev_conf->txmode.mq_mode) {
                case ETH_MQ_TX_VMDQ_DCB:
                        /* DCB VMDQ in SRIOV mode, not implement yet */
-                       PMD_DEBUG_TRACE("ethdev port_id=%hhu SRIOV active, "
+                       PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
+                                       " SRIOV active, "
                                        "unsupported VMDQ mq_mode tx %u\n",
                                        port_id, dev_conf->txmode.mq_mode);
                        return (-EINVAL);
@@ -758,12 +761,20 @@ rte_eth_dev_start(uint8_t port_id)
        PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
        if (port_id >= nb_ports) {
-               PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+               PMD_DEBUG_TRACE("Invalid port_id=%" PRIu8 "\n", port_id);
                return (-EINVAL);
        }
        dev = &rte_eth_devices[port_id];
 
        FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+
+       if (dev->data->dev_started != 0) {
+               PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+                       " already started\n",
+                       port_id);
+               return (0);
+       }
+
        diag = (*dev->dev_ops->dev_start)(dev);
        if (diag == 0)
                dev->data->dev_started = 1;
@@ -785,12 +796,20 @@ rte_eth_dev_stop(uint8_t port_id)
        PROC_PRIMARY_OR_RET();
 
        if (port_id >= nb_ports) {
-               PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+               PMD_DEBUG_TRACE("Invalid port_id=%" PRIu8 "\n", port_id);
                return;
        }
        dev = &rte_eth_devices[port_id];
 
        FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+
+       if (dev->data->dev_started == 0) {
+               PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+                       " already stopped\n",
+                       port_id);
+               return;
+       }
+
        dev->data->dev_started = 0;
        (*dev->dev_ops->dev_stop)(dev);
 }