aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2016-07-22 17:10:11 +0100
committerZoltan Kiss <zoltan.kiss@linaro.org>2016-07-22 18:23:33 +0100
commitd2cd17907bc9ca29fd6c6a98610e17abaf1d34e8 (patch)
treef3d828093538783842bc4bf9892c4bfdc89f533a
parent5ded0b8443bf2e5b6f710b8ad5c2b1d8b3c0abb1 (diff)
downloadodp-dpdk-d2cd17907bc9ca29fd6c6a98610e17abaf1d34e8.tar.gz
Port 41ab23c8 "linux-gen: pktio: simplify state handling"
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
-rw-r--r--platform/linux-dpdk/include/odp_packet_io_internal.h12
-rw-r--r--platform/linux-dpdk/odp_packet_dpdk.c4
2 files changed, 7 insertions, 9 deletions
diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h
index 5905cdb..f46b258 100644
--- a/platform/linux-dpdk/include/odp_packet_io_internal.h
+++ b/platform/linux-dpdk/include/odp_packet_io_internal.h
@@ -67,7 +67,6 @@ struct pktio_entry {
/* These two locks together lock the whole pktio device */
odp_ticketlock_t rxl; /**< RX ticketlock */
odp_ticketlock_t txl; /**< TX ticketlock */
- int taken; /**< is entry taken(1) or free(0) */
int cls_enabled; /**< is classifier enabled */
odp_pktio_t handle; /**< pktio handle */
union {
@@ -75,10 +74,11 @@ struct pktio_entry {
pkt_dpdk_t pkt_dpdk; /**< using DPDK API for IO */
};
enum {
- STATE_OPENED = 0, /**< After open() */
- STATE_STARTED, /**< After start() */
- STATE_STOPPED /**< Same as OPENED, but only happens
- after STARTED */
+ PKTIO_STATE_FREE = 0, /**< Not allocated */
+ PKTIO_STATE_ALLOCATED, /**< Allocated, open in progress */
+ PKTIO_STATE_OPENED, /**< Open completed */
+ PKTIO_STATE_STARTED, /**< Start completed */
+ PKTIO_STATE_STOPPED /**< Stop completed */
} state;
odp_pktio_config_t config; /**< Device configuration */
classifier_t cls; /**< classifier linked with this pktio*/
@@ -114,8 +114,6 @@ typedef struct {
pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES];
} pktio_table_t;
-int is_free(pktio_entry_t *entry);
-
typedef struct pktio_if_ops {
const char *name;
void (*print)(pktio_entry_t *pktio_entry);
diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c
index c8cc3a3..122a33c 100644
--- a/platform/linux-dpdk/odp_packet_dpdk.c
+++ b/platform/linux-dpdk/odp_packet_dpdk.c
@@ -183,7 +183,7 @@ static int close_pkt_dpdk(pktio_entry_t *pktio_entry)
{
pkt_dpdk_t * const pkt_dpdk = &pktio_entry->s.pkt_dpdk;
- if (pktio_entry->s.state == STATE_STOPPED)
+ if (pktio_entry->s.state == PKTIO_STATE_STOPPED)
rte_eth_dev_close(pkt_dpdk->portid);
return 0;
}
@@ -337,7 +337,7 @@ static void _odp_pktio_send_completion(pktio_entry_t *pktio_entry)
continue;
if (odp_ticketlock_trylock(&entry->s.txl)) {
- if (!is_free(entry) &&
+ if (entry->s.state != PKTIO_STATE_FREE &&
entry->s.ops == &dpdk_pktio_ops) {
for (j = 0; j < pktio_entry->s.num_out_queue;
j++)