numam-dpdk/drivers/dma/skeleton/skeleton_dmadev.h
Chengwen Feng 618a40a0c9 dma/skeleton: fix index returned when no memcpy completed
If no memcopy request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch fixes it.

Fixes: 05d5fc66a2 ("dma/skeleton: introduce skeleton driver")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
2022-06-15 16:15:07 +02:00

63 lines
1.8 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2021 HiSilicon Limited
*/
#ifndef SKELETON_DMADEV_H
#define SKELETON_DMADEV_H
#include <pthread.h>
#include <rte_ring.h>
#define SKELDMA_ARG_LCORE "lcore"
struct skeldma_desc {
void *src;
void *dst;
uint32_t len;
uint16_t ridx; /* ring idx */
};
struct skeldma_hw {
int lcore_id; /* cpucopy task affinity core */
int socket_id;
pthread_t thread; /* cpucopy task thread */
volatile int exit_flag; /* cpucopy task exit flag */
struct skeldma_desc *desc_mem;
/* Descriptor ring state machine:
*
* ----------- enqueue without submit -----------
* | empty |------------------------------->| pending |
* -----------\ -----------
* ^ \------------ |
* | | |submit doorbell
* | | |
* | |enqueue with submit |
* |get completed |------------------| |
* | | |
* | v v
* ----------- cpucopy thread working -----------
* |completed|<-------------------------------| running |
* ----------- -----------
*/
struct rte_ring *desc_empty;
struct rte_ring *desc_pending;
struct rte_ring *desc_running;
struct rte_ring *desc_completed;
/* Cache delimiter for dataplane API's operation data */
char cache1 __rte_cache_aligned;
uint16_t ridx; /* ring idx */
uint16_t last_ridx;
uint64_t submitted_count;
/* Cache delimiter for cpucopy thread's operation data */
char cache2 __rte_cache_aligned;
volatile uint32_t zero_req_count;
uint64_t completed_count;
};
#endif /* SKELETON_DMADEV_H */