DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v2 0/3] ethdev: fix ports enumeration
Date: Thu,  5 Apr 2018 17:33:19 +0200	[thread overview]
Message-ID: <20180405153322.5488-1-thomas@monjalon.net> (raw)
In-Reply-To: <20180309222255.27663-1-thomas@monjalon.net>

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.

-- 
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

  reply	other threads:[~2018-04-05 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 22:22 [dpdk-dev] [RFC PATCH] " Thomas Monjalon
2018-04-05 15:33 ` Thomas Monjalon [this message]
2018-04-05 15:33   ` [dpdk-dev] [PATCH v2 1/3] fix ethdev " Thomas Monjalon
2018-04-05 15:33   ` [dpdk-dev] [PATCH v2 2/3] fix ethdev port id validation Thomas Monjalon
2018-04-05 15:33   ` [dpdk-dev] [PATCH v2 3/3] ethdev: deprecate port count function Thomas Monjalon
2018-04-17 22:22   ` [dpdk-dev] [PATCH v2 0/3] ethdev: fix ports enumeration Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180405153322.5488-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).