diff options
author | Bogdan Pricope <bogdan.pricope@linaro.org> | 2017-10-31 11:30:45 +0200 |
---|---|---|
committer | Yi He <yi.he@linaro.org> | 2017-11-03 09:47:04 +0800 |
commit | c0f99c441feadd1566b7e92789b11c30c6ee3f64 (patch) | |
tree | b102acc4653ea63ddd6b0a8bb886613d3d84ebf2 | |
parent | 3fc5b2aa0d85c5fb6800f06fcbf836ea1ac43337 (diff) |
linux-gen: pktio: remove duplicate odp_packet_io_internal.h2.0-native-drivers
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.pricope@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Honnappa Nagarahalli <honnappa.Nagarahalli@arm.com>
Reviewed-by: Krishna Garapati <balakrishna.garapati@linaro.org>
Signed-off-by: Yi He <yi.he@linaro.org>
-rw-r--r-- | platform/linux-dpdk/Makefile.am | 2 | ||||
-rw-r--r-- | platform/linux-dpdk/include/odp_packet_io_internal.h | 157 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_packet_io_internal.h | 1 | ||||
-rw-r--r-- | platform/linux-generic/odp_packet_io.c | 1 |
4 files changed, 2 insertions, 159 deletions
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); |