[PACKET_IO]format code style
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* custom zone: user can set custom field
|
||||
* pkt_payload: received packet data
|
||||
**/
|
||||
*/
|
||||
struct pio_packet {
|
||||
/* pkt header pointer */
|
||||
void *pkt_hdr;
|
||||
|
||||
@@ -390,11 +390,6 @@ static int marsio_instance_init(struct packet_io_instance *pinst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief create packet_io marsio instance
|
||||
*
|
||||
* @param: pinst(in/out)
|
||||
*/
|
||||
int pio_marsio_instance_create(struct packet_io_instance *pinst)
|
||||
{
|
||||
if (nullptr == pinst) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* @brief dll is short for dynamic link lib
|
||||
* the following entries is supported by marsio system
|
||||
**/
|
||||
*/
|
||||
struct marsio_dll_function_entries {
|
||||
|
||||
struct mr_instance *(*marsio_create)(void);
|
||||
@@ -88,7 +88,7 @@ struct pio_marsio_instance_context {
|
||||
* if marsio device receive packets, use mr_dev_handle
|
||||
* @mr_sendpath_handle: marsio sendpath handle
|
||||
* if marsio device send packets, both mr_dev_handle and sendpath are required
|
||||
**/
|
||||
*/
|
||||
struct pio_marsio_device_context {
|
||||
struct mr_vdev *mr_dev_handle;
|
||||
struct mr_sendpath * mr_sendpath_handle;
|
||||
@@ -118,12 +118,12 @@ void pio_marsio_instance_destroy(struct packet_io_instance *pinst);
|
||||
* pdev->dev_name: the name of marsio device, such as eth1, eth2, ...
|
||||
* pdev->rxq_num: number of the packet receiving queues for the device
|
||||
* pdev->txq_num: number of the packet sending queues for the device
|
||||
**/
|
||||
*/
|
||||
int pio_marsio_device_open(struct packet_io_device *pdev);
|
||||
|
||||
/*
|
||||
/**
|
||||
* @brief close pcap_live device
|
||||
**/
|
||||
*/
|
||||
int pio_marsio_device_close(struct packet_io_device *pdev);
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ int pio_marsio_device_close(struct packet_io_device *pdev);
|
||||
* @param nr_pkts: number of packets expected to receive
|
||||
*
|
||||
* @retval number of packets actually received
|
||||
*/
|
||||
*/
|
||||
int pio_marsio_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
/**
|
||||
@@ -147,7 +147,7 @@ int pio_marsio_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, st
|
||||
* @param nr_pkts: number of packets expected to send
|
||||
*
|
||||
* @retval if ret<0, means the sending fails; if ret==0 means the sending succeeds
|
||||
*/
|
||||
*/
|
||||
int pio_marsio_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ int pio_marsio_device_send(struct packet_io_device *pdev, uint32_t txq_id, struc
|
||||
* @param qid:
|
||||
* @param pkts:
|
||||
* @param nr_pkts:
|
||||
*/
|
||||
*/
|
||||
void pio_marsio_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
|
||||
void *pio_marsio_device_buff_ctrlzone(struct packet *p);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* 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 *pinst);
|
||||
@@ -104,7 +104,7 @@ struct packet_io_device {
|
||||
*
|
||||
* @param instance_name: packet_io instance name
|
||||
* @param mode: packet_io run mode
|
||||
**/
|
||||
*/
|
||||
struct packet_io_instance *
|
||||
packet_io_instance_create(const char *instance_name, const enum packet_io_run_mode mode);
|
||||
|
||||
@@ -118,7 +118,7 @@ void packet_io_instance_destroy(struct packet_io_instance *pinst);
|
||||
* @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_device_open(struct packet_io_instance *pinst, const char *dev_name, uint32_t nr_rxq, uint32_t nr_txq);
|
||||
|
||||
@@ -132,7 +132,7 @@ void packet_io_device_close(struct packet_io_device *dev);
|
||||
* @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 **pkts, int nr_pkts);
|
||||
|
||||
/**
|
||||
@@ -142,12 +142,12 @@ int packet_io_device_rx(struct packet_io_device *pdev, uint32_t rxq_id, struct p
|
||||
* @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 **pkts, int nr_pkts);
|
||||
|
||||
/*
|
||||
* @brief packet_io free packet buff
|
||||
**/
|
||||
*/
|
||||
void packet_io_pkts_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
#include "../../../sdk/include/logger.h"
|
||||
#include "../../common/time_helper.h"
|
||||
|
||||
/*
|
||||
/**
|
||||
* @brief validate path is a valid plain file or directory
|
||||
*
|
||||
* @retval failed (-1) successful (0),
|
||||
* if success, dir == nullptr <---> means path is plain file
|
||||
* dir != nullptr <---> means path is directory
|
||||
**/
|
||||
*/
|
||||
static int validate_directory_or_file(const char *path, DIR **dir)
|
||||
{
|
||||
DIR *temp_dir = nullptr;
|
||||
@@ -58,11 +58,11 @@ static int validate_directory_or_file(const char *path, DIR **dir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @brief get the timestamp of the first packet and rewind
|
||||
*
|
||||
* @retval true(success), false(error)
|
||||
*/
|
||||
*/
|
||||
static bool peek_first_packet_timestamp(struct pcap_plain_file_info *pfile_info)
|
||||
{
|
||||
int ret = pcap_next_ex(pfile_info->pcap_handle, &pfile_info->first_pkt_hdr,
|
||||
|
||||
@@ -79,7 +79,7 @@ struct pcap_file_directory_info {
|
||||
|
||||
/**
|
||||
* @brief pio_pcap_file_device_context - pcap file device context
|
||||
**/
|
||||
*/
|
||||
struct pio_pcap_file_device_context {
|
||||
union {
|
||||
struct pcap_file_directory_info *dir;
|
||||
@@ -119,12 +119,12 @@ void pio_pcap_file_instance_destroy(struct packet_io_instance *pinst);
|
||||
* pdev->dev_name: the name of pcap file
|
||||
* pdev->rxq_num: number of the packet receiving queues for the device
|
||||
* pdev->txq_num: number of the packet sending queues for the device
|
||||
**/
|
||||
*/
|
||||
int pio_pcap_file_device_open(struct packet_io_device *pdev);
|
||||
|
||||
/**
|
||||
* @brief close pcap_live device
|
||||
**/
|
||||
*/
|
||||
int pio_pcap_file_device_close(struct packet_io_device *pdev);
|
||||
|
||||
int pio_pcap_file_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
@@ -25,7 +25,7 @@ struct pio_pcap_live_instance_context {
|
||||
|
||||
/**
|
||||
* @brief pio_pcap_file_device_context - pcap file device context
|
||||
**/
|
||||
*/
|
||||
struct pio_pcap_live_device_context {
|
||||
pcap_t *pcap_handle;
|
||||
|
||||
@@ -79,12 +79,12 @@ void pio_pcap_live_instance_destroy(struct packet_io_instance *pinst);
|
||||
* pdev->dev_name: the name of pcap device, such as eth1, eth2, ...
|
||||
* pdev->rxq_num: number of the packet receiving queues for the device
|
||||
* pdev->txq_num: number of the packet sending queues for the device
|
||||
**/
|
||||
*/
|
||||
int pio_pcap_live_device_open(struct packet_io_device *pdev);
|
||||
|
||||
/**
|
||||
* @brief close pcap_live device
|
||||
**/
|
||||
*/
|
||||
int pio_pcap_live_device_close(struct packet_io_device *pdev);
|
||||
|
||||
int pio_pcap_live_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
Reference in New Issue
Block a user