Skip to content

ethdev: fix ports enumeration

Thomas Monjalon dpdk-dev 2 versions – Applied

Status from this message: Applied

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyApplied
  2. v1 RFC1 patch 0 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3fix ethdev ports enumerationapp/proc-info/main.c app/test-eventdev/test_perf_common.c app/test-eventdev/test_pipeline_common.c +106 more+319 -2440 replies
2/3fix ethdev port id validationapp/pdump/main.c app/test-pmd/cmdline.c doc/guides/sample_app_ug/flow_classify.rst +33 more+61 -1480 replies
3/3ethdev: deprecate port count functionapp/proc-info/main.c app/test-eventdev/test_perf_atq.c app/test-eventdev/test_perf_common.c +72 more+150 -780 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] ethdev: fix ports enumeration

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 iterates over ports by its own mean. The most common pattern is to request the port count and assume ports with index in the range [0..count[ can be used.

There are three consequences when using such wrong design:
- new ports having an index higher than the port count won't be seen
- old ports being detached (RTE_ETH_DEV_UNUSED) can be seen as ghosts
- failsafe sub-devices (RTE_ETH_DEV_DEFERRED) will be seen by the application

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 iterator RTE_ETH_FOREACH_DEV,
and to use the function rte_eth_dev_is_valid_port.

In order to fix this common mistake in all external applications, the function rte_eth_dev_count is deprecated, while introducing the new functions rte_eth_dev_count_avail and rte_eth_dev_count_total.

Signature · 163 lines
The RFC was sent one month ago with only couple of apps updated.
V2 does the same change with all apps updated.


Thomas Monjalon (3):
  fix ethdev ports enumeration
  fix ethdev port id validation
  ethdev: deprecate port count function

 app/pdump/main.c                                   |  3 +-
 app/proc-info/main.c                               |  4 +-
 app/test-eventdev/test_perf_atq.c                  |  2 +-
 app/test-eventdev/test_perf_common.c               | 12 ++---
 app/test-eventdev/test_perf_queue.c                |  2 +-
 app/test-eventdev/test_pipeline_atq.c              |  4 +-
 app/test-eventdev/test_pipeline_common.c           | 16 +++---
 app/test-eventdev/test_pipeline_queue.c            |  6 +--
 app/test-pmd/cmdline.c                             | 57 ++--------------------
 app/test-pmd/testpmd.c                             | 13 ++---
 doc/guides/rel_notes/release_18_05.rst             |  7 +++
 doc/guides/sample_app_ug/flow_classify.rst         | 14 ++----
 doc/guides/sample_app_ug/kernel_nic_interface.rst  | 10 ----
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  7 +--
 .../sample_app_ug/l2_forward_real_virtual.rst      |  7 +--
 doc/guides/sample_app_ug/link_status_intr.rst      |  6 +--
 doc/guides/sample_app_ug/quota_watermark.rst       |  2 +-
 doc/guides/sample_app_ug/rxtx_callbacks.rst        |  3 --
 doc/guides/sample_app_ug/skeleton.rst              | 11 ++---
 drivers/net/bonding/Makefile                       |  1 +
 drivers/net/bonding/meson.build                    |  2 +
 drivers/net/bonding/rte_eth_bond_args.c            |  4 +-
 drivers/net/mvpp2/mrvl_ethdev.c                    |  2 +-
 examples/bbdev_app/main.c                          | 10 ++--
 examples/bond/Makefile                             |  3 ++
 examples/bond/main.c                               |  8 +--
 examples/bond/meson.build                          |  1 +
 examples/distributor/Makefile                      |  3 ++
 examples/distributor/main.c                        | 29 ++++++-----
 examples/distributor/meson.build                   |  1 +
 examples/ethtool/ethtool-app/Makefile              |  1 +
 examples/ethtool/ethtool-app/ethapp.c              | 10 ++--
 examples/ethtool/ethtool-app/main.c                |  2 +-
 examples/eventdev_pipeline/main.c                  | 25 +++++-----
 .../eventdev_pipeline/pipeline_worker_generic.c    |  7 ++-
 examples/eventdev_pipeline/pipeline_worker_tx.c    |  6 +--
 examples/exception_path/Makefile                   |  3 ++
 examples/exception_path/main.c                     | 10 ++--
 examples/exception_path/meson.build                |  1 +
 examples/flow_classify/flow_classify.c             | 17 +++----
 examples/flow_filtering/Makefile                   |  3 ++
 examples/flow_filtering/main.c                     |  4 +-
 examples/flow_filtering/meson.build                |  1 +
 examples/ip_fragmentation/Makefile                 |  3 ++
 examples/ip_fragmentation/main.c                   | 14 +++---
 examples/ip_fragmentation/meson.build              |  1 +
 examples/ip_pipeline/init.c                        |  4 +-
 examples/ip_reassembly/Makefile                    |  3 ++
 examples/ip_reassembly/main.c                      | 12 ++---
 examples/ip_reassembly/meson.build                 |  1 +
 examples/ipsec-secgw/ipsec-secgw.c                 | 24 ++++-----
 examples/ipv4_multicast/Makefile                   |  3 ++
 examples/ipv4_multicast/main.c                     | 10 ++--
 examples/ipv4_multicast/meson.build                |  1 +
 examples/kni/Makefile                              |  3 ++
 examples/kni/main.c                                | 24 ++++-----
 examples/kni/meson.build                           |  1 +
 examples/l2fwd-cat/Makefile                        |  2 +
 examples/l2fwd-cat/l2fwd-cat.c                     | 11 ++---
 examples/l2fwd-cat/meson.build                     |  1 +
 examples/l2fwd-crypto/Makefile                     |  3 ++
 examples/l2fwd-crypto/main.c                       | 22 ++++-----
 examples/l2fwd-crypto/meson.build                  |  1 +
 examples/l2fwd-jobstats/Makefile                   |  4 +-
 examples/l2fwd-jobstats/main.c                     | 21 ++++----
 examples/l2fwd-jobstats/meson.build                |  1 +
 examples/l2fwd-keepalive/Makefile                  |  3 ++
 examples/l2fwd-keepalive/main.c                    | 21 ++++----
 examples/l2fwd-keepalive/meson.build               |  1 +
 examples/l2fwd/Makefile                            |  3 ++
 examples/l2fwd/main.c                              | 23 +++++----
 examples/l2fwd/meson.build                         |  1 +
 examples/l3fwd-acl/Makefile                        |  3 ++
 examples/l3fwd-acl/main.c                          | 18 +++----
 examples/l3fwd-acl/meson.build                     |  1 +
 examples/l3fwd-power/Makefile                      |  3 ++
 examples/l3fwd-power/main.c                        | 23 +++++----
 examples/l3fwd-power/meson.build                   |  1 +
 examples/l3fwd-vf/Makefile                         |  3 ++
 examples/l3fwd-vf/main.c                           | 15 +++---
 examples/l3fwd-vf/meson.build                      |  1 +
 examples/l3fwd/Makefile                            |  3 ++
 examples/l3fwd/main.c                              | 20 ++++----
 examples/l3fwd/meson.build                         |  1 +
 examples/link_status_interrupt/Makefile            |  3 ++
 examples/link_status_interrupt/main.c              |  2 +-
 examples/link_status_interrupt/meson.build         |  1 +
 .../client_server_mp/mp_client/Makefile            |  1 +
 .../client_server_mp/mp_client/client.c            |  2 +-
 .../client_server_mp/mp_server/Makefile            |  1 +
 .../client_server_mp/mp_server/init.c              |  2 +-
 examples/multi_process/l2fwd_fork/Makefile         |  1 +
 examples/multi_process/l2fwd_fork/main.c           | 24 +++++----
 examples/multi_process/symmetric_mp/Makefile       |  1 +
 examples/multi_process/symmetric_mp/main.c         |  8 +--
 examples/netmap_compat/bridge/Makefile             |  1 +
 examples/netmap_compat/bridge/bridge.c             |  2 +-
 examples/packet_ordering/Makefile                  |  3 ++
 examples/packet_ordering/main.c                    | 27 +++++-----
 examples/packet_ordering/meson.build               |  1 +
 examples/performance-thread/l3fwd-thread/Makefile  |  1 +
 examples/performance-thread/l3fwd-thread/main.c    | 18 +++----
 examples/ptpclient/Makefile                        |  3 ++
 examples/ptpclient/meson.build                     |  1 +
 examples/ptpclient/ptpclient.c                     |  6 +--
 examples/qos_sched/Makefile                        |  3 ++
 examples/qos_sched/init.c                          |  2 +-
 examples/qos_sched/meson.build                     |  1 +
 examples/quota_watermark/qw/Makefile               |  1 +
 examples/quota_watermark/qw/init.c                 |  2 +-
 examples/rxtx_callbacks/Makefile                   |  3 ++
 examples/rxtx_callbacks/main.c                     | 13 +++--
 examples/rxtx_callbacks/meson.build                |  1 +
 examples/server_node_efd/node/Makefile             |  1 +
 examples/server_node_efd/node/node.c               |  2 +-
 examples/server_node_efd/server/Makefile           |  1 +
 examples/server_node_efd/server/init.c             |  2 +-
 examples/skeleton/Makefile                         |  3 ++
 examples/skeleton/basicfwd.c                       | 11 ++---
 examples/skeleton/meson.build                      |  3 ++
 examples/tep_termination/Makefile                  |  3 ++
 examples/tep_termination/main.c                    | 11 ++---
 examples/tep_termination/meson.build               |  1 +
 examples/tep_termination/vxlan_setup.c             |  2 +-
 examples/vhost/Makefile                            |  3 ++
 examples/vhost/main.c                              | 14 +++---
 examples/vhost/meson.build                         |  1 +
 examples/vm_power_manager/Makefile                 |  1 +
 examples/vm_power_manager/channel_monitor.c        |  5 +-
 examples/vm_power_manager/main.c                   | 12 ++---
 examples/vmdq/Makefile                             |  3 ++
 examples/vmdq/main.c                               | 12 ++---
 examples/vmdq/meson.build                          |  1 +
 examples/vmdq_dcb/Makefile                         |  3 ++
 examples/vmdq_dcb/main.c                           | 12 ++---
 examples/vmdq_dcb/meson.build                      |  1 +
 lib/librte_ether/rte_ethdev.c                      | 25 ++++++++--
 lib/librte_ether/rte_ethdev.h                      | 23 +++++++++
 lib/librte_ether/rte_ethdev_version.map            |  4 +-
 lib/librte_eventdev/rte_event_eth_rx_adapter.c     | 13 ++---
 lib/librte_kni/rte_kni.c                           |  4 +-
 lib/librte_latencystats/Makefile                   |  1 +
 lib/librte_latencystats/meson.build                |  1 +
 lib/librte_latencystats/rte_latencystats.c         |  6 +--
 test/test/test_event_eth_rx_adapter.c              | 10 ++--
 test/test/test_kni.c                               |  2 +-
 test/test/test_link_bonding_mode4.c                |  2 +-
 test/test/test_link_bonding_rssconf.c              |  2 +-
 test/test/test_pmd_perf.c                          |  6 +--
 test/test/test_pmd_ring.c                          |  4 +-
 150 files changed, 530 insertions(+), 470 deletions(-)

-- 
2.16.2