]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_kni/rte_kni.c
fix ethdev port id validation
[dpdk.git] / lib / librte_kni / rte_kni.c
index 28674115ffa155ebcdf4dbf18cbd9ae1272e32a0..8a8f6c1cc964c9f52ffc1f746fbe9fa4f585f00c 100644 (file)
@@ -510,7 +510,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 {
        int ret = 0;
 
-       if (port_id >= rte_eth_dev_count() || port_id >= RTE_MAX_ETHPORTS) {
+       if (!rte_eth_dev_is_valid_port(port_id)) {
                RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
                return -EINVAL;
        }
@@ -530,7 +530,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 static int
 kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 {
-       if (port_id >= rte_eth_dev_count() || port_id >= RTE_MAX_ETHPORTS) {
+       if (!rte_eth_dev_is_valid_port(port_id)) {
                RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
                return -EINVAL;
        }