summaryrefslogtreecommitdiff
path: root/examples/ethtool
diff options
context:
space:
mode:
authorMauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>2016-05-18 21:15:11 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-05-24 15:30:08 +0200
commit1414dabc1b59b471b8604e7368bef581747cdcc6 (patch)
tree98b1ba6e9d52d2ef35dbfe3bd925bc832939632b /examples/ethtool
parente89880957f47d8529cf61c0c0374b053b8704ed6 (diff)
downloaddpdk-1414dabc1b59b471b8604e7368bef581747cdcc6.zip
dpdk-1414dabc1b59b471b8604e7368bef581747cdcc6.tar.gz
dpdk-1414dabc1b59b471b8604e7368bef581747cdcc6.tar.xz
ethdev: use dedicated macro to check port id
The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some places to check if a port id is valid or not. This commit makes use of it in some new parts of the code. Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'examples/ethtool')
-rw-r--r--examples/ethtool/lib/rte_ethtool.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 42e05f1..54391f2 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);