Replaced config definition for maximum pktio entries with
maximum packet IO index call. Maximum index cannot be part
of pktio capability struct, which is per interface.
Application needs max index for memory allocation,
etc resource reservation per index. Max index may be larger
than maximum number of interfaces (which are named resource and
thus max number is known by the user).

Signed-off-by: Petri Savolainen <[email protected]>
---
 include/odp/api/spec/config.h                        |  7 -------
 include/odp/api/spec/packet_io.h                     | 10 ++++++++++
 platform/linux-generic/include/odp/api/config.h      |  9 ---------
 platform/linux-generic/include/odp_config_internal.h |  5 +++++
 platform/linux-generic/odp_packet_io.c               |  5 +++++
 5 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/include/odp/api/spec/config.h b/include/odp/api/spec/config.h
index 4be0b3f..2a1f621 100644
--- a/include/odp/api/spec/config.h
+++ b/include/odp/api/spec/config.h
@@ -58,13 +58,6 @@ int odp_config_sched_prios(void);
 int odp_config_sched_grps(void);
 
 /**
- * Maximum number of packet IO resources
- * @return The maximum number of packet I/O resources supported by this
- * platform
- */
-int odp_config_pktio_entries(void);
-
-/**
  * @}
  */
 
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 7c29176..3e535d6 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -475,6 +475,16 @@ odp_pktio_t odp_pktio_open(const char *name, odp_pool_t 
pool,
 int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa);
 
 /**
+ * Maximum packet IO interface index
+ *
+ * Return the maximum packet IO interface index. Interface indexes
+ * (e.g. returned by odp_pktio_index()) range from zero to this maximum value.
+ *
+ * @return Maximum packet IO interface index
+ */
+unsigned odp_pktio_max_index(void);
+
+/**
  * Configure packet IO interface options
  *
  * Select interface level configuration options before the interface is
diff --git a/platform/linux-generic/include/odp/api/config.h 
b/platform/linux-generic/include/odp/api/config.h
index 398e346..2fba933 100644
--- a/platform/linux-generic/include/odp/api/config.h
+++ b/platform/linux-generic/include/odp/api/config.h
@@ -58,15 +58,6 @@ static inline int odp_config_sched_grps(void)
        return ODP_CONFIG_SCHED_GRPS;
 }
 
-/**
- * Maximum number of packet IO resources
- */
-#define ODP_CONFIG_PKTIO_ENTRIES 64
-static inline int odp_config_pktio_entries(void)
-{
-       return ODP_CONFIG_PKTIO_ENTRIES;
-}
-
 #include <odp/api/spec/config.h>
 
 /**
diff --git a/platform/linux-generic/include/odp_config_internal.h 
b/platform/linux-generic/include/odp_config_internal.h
index b7fcdbf..fecfbec 100644
--- a/platform/linux-generic/include/odp_config_internal.h
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -125,6 +125,11 @@ extern "C" {
  */
 #define ODP_CONFIG_SHM_BLOCKS (ODP_CONFIG_POOLS + 48)
 
+/*
+ * Maximum number of packet IO resources
+ */
+#define ODP_CONFIG_PKTIO_ENTRIES 64
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 148adc9..59ce6e9 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1082,6 +1082,11 @@ int odp_pktio_capability(odp_pktio_t pktio, 
odp_pktio_capability_t *capa)
        return single_capability(capa);
 }
 
+unsigned odp_pktio_max_index(void)
+{
+       return ODP_CONFIG_PKTIO_ENTRIES - 1;
+}
+
 int odp_pktio_stats(odp_pktio_t pktio,
                    odp_pktio_stats_t *stats)
 {
-- 
2.8.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to