fix ethdev port id validation
authorThomas Monjalon <thomas@monjalon.net>
Thu, 5 Apr 2018 15:33:21 +0000 (17:33 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 17 Apr 2018 22:37:05 +0000 (00:37 +0200)
commita9dbe180222680edf8c49e86791f972549ce5be3
tree24de43bfe7364653ede899a7e2a391a1c7bd65b9
parent8728ccf37615904cf23fb8763895b05c9a3c6b0c
fix ethdev port id validation

Some DPDK applications wrongly assume these requirements:
    - no hotplug, i.e. ports are never detached
    - all allocated ports are available to the application

Such application assume a valid port index is in the range [0..count[.

There are three consequences when using such wrong design:
    - new ports having an index higher than the port count won't be valid
    - old ports being detached (RTE_ETH_DEV_UNUSED) can be valid

Such mistake will be less common with growing hotplug awareness.
All applications and examples inside this repository - except testpmd -
must be fixed to use the function rte_eth_dev_is_valid_port.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
36 files changed:
app/pdump/main.c
app/test-pmd/cmdline.c
doc/guides/sample_app_ug/flow_classify.rst
doc/guides/sample_app_ug/kernel_nic_interface.rst
doc/guides/sample_app_ug/l2_forward_job_stats.rst
doc/guides/sample_app_ug/l2_forward_real_virtual.rst
doc/guides/sample_app_ug/link_status_intr.rst
doc/guides/sample_app_ug/rxtx_callbacks.rst
doc/guides/sample_app_ug/skeleton.rst
examples/bbdev_app/main.c
examples/bond/main.c
examples/distributor/main.c
examples/eventdev_pipeline/main.c
examples/flow_classify/flow_classify.c
examples/ip_pipeline/kni.c
examples/ipsec-secgw/ipsec-secgw.c
examples/kni/main.c
examples/l2fwd-cat/l2fwd-cat.c
examples/l3fwd-acl/main.c
examples/l3fwd-power/main.c
examples/l3fwd-vf/main.c
examples/l3fwd/main.c
examples/multi_process/symmetric_mp/main.c
examples/packet_ordering/main.c
examples/performance-thread/l3fwd-thread/main.c
examples/ptpclient/ptpclient.c
examples/rxtx_callbacks/main.c
examples/skeleton/basicfwd.c
examples/tep_termination/main.c
examples/tep_termination/vxlan_setup.c
examples/vhost/main.c
examples/vm_power_manager/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c
lib/librte_kni/rte_kni.c
test/test/test_event_eth_rx_adapter.c