From: Bogdan Pricope <bogdan.pric...@linaro.org>

Enable utilization of linux-generic version of odp_packet_io_internal.h
for linux-dpdk platform. Subsequently, linux-dpdk version of
odp_packet_io_internal.h is removed.
This is part of an attempt to reduce the delta between linux-dpdk and
linux-generic platforms to permit integration of linux-dpdk pktios
in linux-generic.

Signed-off-by: Bogdan Pricope <bogdan.pric...@linaro.org>
---
/** Email created from pull request 267 (bogdanPricope:2_0_pktio_internal_pr)
 ** https://github.com/Linaro/odp/pull/267
 ** Patch: https://github.com/Linaro/odp/pull/267.patch
 ** Base sha: ca1be967bd4f6aec7dc99b72de643718cb8a32b8
 ** Merge commit sha: 29fab9a6071107a8bb565ceee1837755d3ca1eee
 **/
 platform/linux-dpdk/Makefile.am                    |   2 +-
 .../linux-dpdk/include/odp_packet_io_internal.h    | 157 ---------------------
 .../linux-generic/include/odp_packet_io_internal.h |   1 -
 platform/linux-generic/odp_packet_io.c             |   1 +
 4 files changed, 2 insertions(+), 159 deletions(-)
 delete mode 100644 platform/linux-dpdk/include/odp_packet_io_internal.h

diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am
index e2a0249df..596c7b784 100644
--- a/platform/linux-dpdk/Makefile.am
+++ b/platform/linux-dpdk/Makefile.am
@@ -199,7 +199,7 @@ noinst_HEADERS = \
                  
${top_srcdir}/platform/linux-generic/include/odp_pktio_ops_socket.h \
                  
${top_srcdir}/platform/linux-generic/include/odp_pktio_ops_loopback.h \
                  
${top_srcdir}/platform/linux-generic/include/odp_name_table_internal.h \
-                 ${srcdir}/include/odp_packet_io_internal.h \
+                 
${top_srcdir}/platform/linux-generic/include/odp_packet_io_internal.h \
                  ${srcdir}/include/odp_errno_define.h \
                  
${top_srcdir}/platform/linux-generic/include/odp_packet_io_ring_internal.h \
                  
${top_srcdir}/platform/linux-generic/include/odp_pkt_queue_internal.h \
diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h 
b/platform/linux-dpdk/include/odp_packet_io_internal.h
deleted file mode 100644
index 089ad38c5..000000000
--- a/platform/linux-dpdk/include/odp_packet_io_internal.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-/**
- * @file
- *
- * ODP packet IO - implementation internal
- */
-
-#ifndef ODP_PACKET_IO_INTERNAL_H_
-#define ODP_PACKET_IO_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <odp/api/spinlock.h>
-#include <odp/api/ticketlock.h>
-#include <odp_classification_datamodel.h>
-#include <odp_align_internal.h>
-#include <odp_debug_internal.h>
-#include <odp_queue_if.h>
-
-#include <odp_config_internal.h>
-#include <odp/api/hints.h>
-
-#define PKTIO_MAX_QUEUES 64
-#include <linux/if_ether.h>
-
-/* Forward declaration */
-typedef union pktio_entry_u pktio_entry_t;
-#include <odp_pktio_ops_subsystem.h>
-
-#define PKTIO_NAME_LEN 256
-
-#define PKTIN_INVALID  ((odp_pktin_queue_t) {ODP_PKTIO_INVALID, 0})
-#define PKTOUT_INVALID ((odp_pktout_queue_t) {ODP_PKTIO_INVALID, 0})
-
-struct pktio_entry {
-       const pktio_ops_module_t *ops;  /**< Implementation specific methods */
-       uint8_t ops_data[ODP_PKTIO_ODPS_DATA_MAX_SIZE]; /**< IO operation
-                                                       specific data */
-       /* These two locks together lock the whole pktio device */
-       odp_ticketlock_t rxl;           /**< RX ticketlock */
-       odp_ticketlock_t txl;           /**< TX ticketlock */
-       int cls_enabled;                /**< is classifier enabled */
-       odp_pktio_t handle;             /**< pktio handle */
-       enum {
-               /* Not allocated */
-               PKTIO_STATE_FREE = 0,
-               /* Close pending on scheduler response. Next state after this
-                * is PKTIO_STATE_FREE. */
-               PKTIO_STATE_CLOSE_PENDING,
-               /* Open in progress.
-                  Marker for all active states following under. */
-               PKTIO_STATE_ACTIVE,
-               /* Open completed */
-               PKTIO_STATE_OPENED,
-               /* Start completed */
-               PKTIO_STATE_STARTED,
-               /* Stop pending on scheduler response */
-               PKTIO_STATE_STOP_PENDING,
-               /* Stop completed */
-               PKTIO_STATE_STOPPED
-       } state;
-       odp_pktio_config_t config;      /**< Device configuration */
-       classifier_t cls;               /**< classifier linked with this pktio*/
-       odp_pktio_stats_t stats;        /**< statistic counters for pktio */
-       char name[PKTIO_NAME_LEN];      /**< name of pktio provided to
-                                          pktio_open() */
-       odp_pool_t pool;
-       odp_pktio_param_t param;
-
-       /* Storage for queue handles
-        * Multi-queue support is pktio driver specific */
-       unsigned num_in_queue;
-       unsigned num_out_queue;
-
-       struct {
-               odp_queue_t        queue;
-               queue_t            queue_int;
-               odp_pktin_queue_t  pktin;
-       } in_queue[PKTIO_MAX_QUEUES];
-
-       struct {
-               odp_queue_t        queue;
-               odp_pktout_queue_t pktout;
-       } out_queue[PKTIO_MAX_QUEUES];
-};
-
-union pktio_entry_u {
-       struct pktio_entry s;
-       uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pktio_entry))];
-};
-
-typedef struct {
-       odp_spinlock_t lock;
-       pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES];
-} pktio_table_t;
-
-extern void *pktio_entry_ptr[];
-
-static inline int pktio_to_id(odp_pktio_t pktio)
-{
-       return _odp_typeval(pktio) - 1;
-}
-
-static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio)
-{
-       if (odp_unlikely(pktio == ODP_PKTIO_INVALID))
-               return NULL;
-
-       if (odp_unlikely(_odp_typeval(pktio) > ODP_CONFIG_PKTIO_ENTRIES)) {
-               ODP_DBG("pktio limit %d/%d exceed\n",
-                       _odp_typeval(pktio), ODP_CONFIG_PKTIO_ENTRIES);
-               return NULL;
-       }
-
-       return pktio_entry_ptr[pktio_to_id(pktio)];
-}
-
-static inline int pktio_cls_enabled(pktio_entry_t *entry)
-{
-       return entry->s.cls_enabled;
-}
-
-static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
-{
-       entry->s.cls_enabled = ena;
-}
-
-/*
- * Dummy single queue implementations of multi-queue API
- */
-int single_input_queues_config(pktio_entry_t *entry,
-                              const odp_pktin_queue_param_t *param);
-int single_output_queues_config(pktio_entry_t *entry,
-                               const odp_pktout_queue_param_t *param);
-int single_recv_queue(pktio_entry_t *entry, int index, odp_packet_t packets[],
-                     int num);
-int single_send_queue(pktio_entry_t *entry, int index,
-                     const odp_packet_t packets[], int num);
-
-int pktin_poll_one(int pktio_index,
-                  int rx_queue,
-                  odp_event_t evt_tbl[]);
-int pktin_poll(int pktio_index, int num_queue, int index[]);
-void pktio_stop_finalize(int pktio_index);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index a2e1fdd9c..7df11618e 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -25,7 +25,6 @@ extern "C" {
 #include <odp_classification_datamodel.h>
 #include <odp_align_internal.h>
 #include <odp_debug_internal.h>
-#include <odp_packet_io_ring_internal.h>
 #include <odp_queue_if.h>
 
 #include <odp_config_internal.h>
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index beeb9c6b3..d5f8d5de0 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -186,6 +186,7 @@ static odp_pktio_t setup_pktio_entry(const char *name, 
odp_pool_t pool,
        pktio_entry->s.pool = pool;
        memcpy(&pktio_entry->s.param, param, sizeof(odp_pktio_param_t));
        pktio_entry->s.handle = hdl;
+       pktio_entry->s.stats_type = STATS_UNSUPPORTED;
 
        odp_pktio_config_init(&pktio_entry->s.config);
 

Reply via email to