Specify that queue config can be called always. Those must be
called when input/output is not disabled or done through TM.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 include/odp/api/spec/packet_io.h       | 28 ++++++++++++++++++++++++----
 platform/linux-generic/odp_packet_io.c | 15 +++++++--------
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 684f634..70ae063 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -226,10 +226,30 @@ typedef struct odp_pktio_capability_t {
  * errno set. Use odp_pktio_lookup() to obtain a handle to an already open
  * device. Packet IO parameters provide interface level configuration options.
  *
- * This call does not activate packet receive and transmit on the interface.
- * The interface is activated with a call to odp_pktio_start(). If not
- * specified otherwise, any interface level configuration must not be changed
- * when the interface is active (between start and stop calls).
+ * Packet input queue configuration must be setup with
+ * odp_pktin_queue_config() before odp_pktio_start() is called. When packet
+ * input mode is ODP_PKTIN_MODE_DISABLED, odp_pktin_queue_config() call is
+ * optional and will ignore all parameters.
+ *
+ * Packet output queue configuration must be setup with
+ * odp_pktout_queue_config() before odp_pktio_start() is called. When packet
+ * output mode is ODP_PKTOUT_MODE_DISABLED or ODP_PKTOUT_MODE_TM,
+ * odp_pktout_queue_config() call is optional and will ignore all parameters.
+ *
+ * Packet receive and transmit on the interface is enabled with a call to
+ * odp_pktio_start(). If not specified otherwise, any interface level
+ * configuration must not be changed when the interface is active (between 
start
+ * and stop calls).
+ *
+ * In summary, a typical pktio interface setup sequence is ...
+ *   * odp_pktio_open()
+ *   * odp_pktin_queue_config()
+ *   * odp_pktout_queue_config()
+ *   * odp_pktio_start()
+ *
+ * ... and tear down sequence is:
+ *   * odp_pktio_stop()
+ *   * odp_pktio_close()
  *
  * @param name   Packet IO device name
  * @param pool   Default pool from which to allocate storage for packets
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 5d71ece..7e1d1af 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1088,10 +1088,9 @@ int odp_pktin_queue_config(odp_pktio_t pktio,
 
        mode = entry->s.param.in_mode;
 
-       if (mode == ODP_PKTIN_MODE_DISABLED) {
-               ODP_DBG("pktio %s: packet input is disabled\n", entry->s.name);
-               return -1;
-       }
+       /* Ignore the call when packet input is disabled. */
+       if (mode == ODP_PKTIN_MODE_DISABLED)
+               return 0;
 
        num_queues = param->num_queues;
 
@@ -1194,10 +1193,10 @@ int odp_pktout_queue_config(odp_pktio_t pktio,
 
        mode = entry->s.param.out_mode;
 
-       if (mode == ODP_PKTOUT_MODE_DISABLED) {
-               ODP_DBG("pktio %s: packet output is disabled\n", entry->s.name);
-               return -1;
-       }
+       /* Ignore the call when packet output is disabled, or routed through
+        * traffic manager. */
+       if (mode == ODP_PKTOUT_MODE_DISABLED || mode == ODP_PKTOUT_MODE_TM)
+               return 0;
 
        if (mode != ODP_PKTOUT_MODE_DIRECT) {
                ODP_DBG("pktio %s: bad packet output mode\n", entry->s.name);
-- 
2.7.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to