X-Git-Url: https://gerrit.fd.io/r/gitweb?p=deb_dpdk.git;a=blobdiff_plain;f=examples%2Fethtool%2Flib%2Frte_ethtool.c;h=54391f213cf70a87ac6b41fff066bce9c2748808;hp=42e05f1fb17e8ebfa82a448f879224cefa8270cc;hb=8b25d1ad5d2264bdfc2818c7bda74ee2697df6db;hpb=97f17497d162afdb82c8704bf097f0fee3724b2e diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 42e05f1f..54391f21 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -51,8 +51,7 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) if (drvinfo == NULL) return -EINVAL; - if (!rte_eth_dev_is_valid_port(port_id)) - return -ENODEV; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); @@ -120,8 +119,7 @@ rte_ethtool_get_link(uint8_t port_id) { struct rte_eth_link link; - if (!rte_eth_dev_is_valid_port(port_id)) - return -ENODEV; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); rte_eth_link_get(port_id, &link); return link.link_status; } @@ -267,8 +265,7 @@ rte_ethtool_net_open(uint8_t port_id) int rte_ethtool_net_stop(uint8_t port_id) { - if (!rte_eth_dev_is_valid_port(port_id)) - return -ENODEV; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); rte_eth_dev_stop(port_id); return 0; @@ -277,8 +274,7 @@ rte_ethtool_net_stop(uint8_t port_id) int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr) { - if (!rte_eth_dev_is_valid_port(port_id)) - return -ENODEV; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) return -EINVAL; rte_eth_macaddr_get(port_id, addr);