[PACKET_IO] finish marsio mode
This commit is contained in:
@@ -19,8 +19,13 @@
|
||||
#include "./pcap_file_mode/pio_pcap_file.h"
|
||||
#include "./marsio_mode/pio_marsio.h"
|
||||
|
||||
/*
|
||||
note:
|
||||
1. packet_io_XXX function is supported by packet_io.h
|
||||
2. pio_XXX function is supported by pio_pcap_live.h/pio_pcap_file.h/pio_marsio.h
|
||||
*/
|
||||
struct pio_instance_operations {
|
||||
int (*create)(struct packet_io_instance *instance, int worker_thread_num);
|
||||
int (*create)(struct packet_io_instance *instance, int wrk_thread_num);
|
||||
|
||||
void (*destroy)(void);
|
||||
};
|
||||
@@ -33,7 +38,7 @@ struct packet_io_instance {
|
||||
enum packet_io_run_mode mode;
|
||||
|
||||
/* device handle set in this instance */
|
||||
struct packet_io_device *device_handle[DEV_MAX_CNT];
|
||||
struct packet_io_device *devices[DEV_MAX_CNT];
|
||||
|
||||
/* device's exactly count */
|
||||
uint32_t dev_cnt;
|
||||
@@ -52,7 +57,7 @@ struct packet_io_instance {
|
||||
struct pio_device_operations {
|
||||
int (*open)(struct packet_io_device *pinst, const char *dev_name, uint32_t nr_rxq, uint32_t nr_txq);
|
||||
|
||||
int (*close)(const void *init_data);
|
||||
int (*close)(const struct packet_io_device *pdev);
|
||||
|
||||
int (*recv)(struct packet_io_device *pdev, uint32_t rxq_id, struct packet *p[], int pkt_cnt);
|
||||
|
||||
@@ -79,8 +84,15 @@ struct packet_io_device {
|
||||
struct packet_io_instance *ppio_inst;
|
||||
};
|
||||
|
||||
/*
|
||||
@brief create packet_io instance which will manage packet_io device
|
||||
|
||||
@param instance_name: packet_io instance name
|
||||
@param mode: packet_io run mode
|
||||
@param wrk_thread_num: expected number of packet receiving threads, which will be created by packet_io
|
||||
*/
|
||||
struct packet_io_instance *
|
||||
packet_io_instance_create(const char *instance_name, const enum packet_io_run_mode mode, const int worker_thread_num);
|
||||
packet_io_instance_create(const char *instance_name, const enum packet_io_run_mode mode, const int wrk_thread_num);
|
||||
|
||||
void packet_io_instance_destroy(struct packet_io_instance *pinst);
|
||||
|
||||
@@ -89,5 +101,6 @@ packet_io_open_device(struct packet_io_instance *instance, const char *dev_name,
|
||||
|
||||
void packet_io_close_device(struct packet_io_device *dev);
|
||||
|
||||
int packet_io_rx(struct packet_io_device *dev, uint32_t rx_queue_id, struct packet *p[], int nr_p);
|
||||
int packet_io_tx(struct packet_io_device *dev, uint32_t rx_queue_id, struct packet *p[], int nr_p);
|
||||
int packet_io_device_rx(struct packet_io_device *dev, uint32_t rx_queue_id, struct packet *p[], int nr_p);
|
||||
|
||||
int packet_io_device_tx(struct packet_io_device *dev, uint32_t rx_queue_id, struct packet *p[], int nr_p);
|
||||
Reference in New Issue
Block a user