net/hns3: fix checking enough Tx BDs
[dpdk.git] / app / test-pmd / testpmd.c
index 446da36..b374682 100644 (file)
@@ -979,7 +979,7 @@ check_socket_id(const unsigned int socket_id)
 queueid_t
 get_allowed_max_nb_rxq(portid_t *pid)
 {
-       queueid_t allowed_max_rxq = MAX_QUEUE_ID;
+       queueid_t allowed_max_rxq = RTE_MAX_QUEUES_PER_PORT;
        bool max_rxq_valid = false;
        portid_t pi;
        struct rte_eth_dev_info dev_info;
@@ -1029,7 +1029,7 @@ check_nb_rxq(queueid_t rxq)
 queueid_t
 get_allowed_max_nb_txq(portid_t *pid)
 {
-       queueid_t allowed_max_txq = MAX_QUEUE_ID;
+       queueid_t allowed_max_txq = RTE_MAX_QUEUES_PER_PORT;
        bool max_txq_valid = false;
        portid_t pi;
        struct rte_eth_dev_info dev_info;
@@ -1079,7 +1079,7 @@ check_nb_txq(queueid_t txq)
 queueid_t
 get_allowed_max_nb_hairpinq(portid_t *pid)
 {
-       queueid_t allowed_max_hairpinq = MAX_QUEUE_ID;
+       queueid_t allowed_max_hairpinq = RTE_MAX_QUEUES_PER_PORT;
        portid_t pi;
        struct rte_eth_hairpin_cap cap;
 
@@ -2557,6 +2557,9 @@ detach_port_device(portid_t port_id)
 
        printf("Removing a device...\n");
 
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return;
+
        dev = rte_eth_devices[port_id].device;
        if (dev == NULL) {
                printf("Device already removed\n");
@@ -2616,6 +2619,7 @@ detach_device(char *identifier)
                if (ports[port_id].port_status != RTE_PORT_CLOSED) {
                        if (ports[port_id].port_status != RTE_PORT_STOPPED) {
                                printf("Port %u not stopped\n", port_id);
+                               rte_eth_iterator_cleanup(&iterator);
                                return;
                        }