[PACKET_IO]bugfix for marsio mode

This commit is contained in:
liuwentan
2022-07-29 13:31:09 +08:00
parent 90b60f637e
commit ee2513fde4
11 changed files with 209 additions and 154 deletions

View File

@@ -20,14 +20,15 @@
#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 wrk_thread_num);
* 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
**/
void (*destroy)(void);
struct pio_instance_operations {
int (*create)(struct packet_io_instance *pinst, int wrk_thread_num);
void (*destroy)(struct packet_io_instance *pinst);
};
struct packet_io_instance {
@@ -85,22 +86,48 @@ struct packet_io_device {
};
/*
@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
*/
* @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 wrk_thread_num);
/* destroy packet_io instance */
void packet_io_instance_destroy(struct packet_io_instance *pinst);
/*
* @brief open packet_io device for send/receive packets
*
* @param pinst: packet_io instance pointer
* @param dev_name: packet_io device name
* @param nr_rxq: number of receive queue for the device
* @param nr_txq: number of send queue for the device
**/
struct packet_io_device *
packet_io_open_device(struct packet_io_instance *instance, const char *dev_name, uint32_t nr_rxq, uint32_t nr_txq);
packet_io_device_open(struct packet_io_instance *pinst, const char *dev_name, uint32_t nr_rxq, uint32_t nr_txq);
void packet_io_close_device(struct packet_io_device *dev);
/* close packet_io device */
void packet_io_device_close(struct packet_io_device *dev);
int packet_io_device_rx(struct packet_io_device *dev, uint32_t rx_queue_id, struct packet *p[], int nr_p);
/*
* @brief packet_io device receive function
*
* @param pdev: packet_io device pointer
* @param rxq_id: which queue will receive from
* @param p: received packet's pointer array
* @param nr_p: number of received packets
**/
int packet_io_device_rx(struct packet_io_device *pdev, uint32_t rxq_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);
/*
* @brief packet_io device send function
*
* @param pdev: packet_io device pointer
* @param rxq_id: which queue will send to
* @param p: prepare to send packet's pointer array
* @param nr_p: number of packets which prepare to send
**/
int packet_io_device_tx(struct packet_io_device *pdev, uint32_t txq_id, struct packet *p[], int nr_p);