[PACKET_IO]marsio mode add pkt_free function
This commit is contained in:
@@ -3,5 +3,7 @@
|
||||
#include "marsio.h"
|
||||
|
||||
struct packet {
|
||||
/* queue id which the packet belongs to */
|
||||
int qid;
|
||||
};
|
||||
|
||||
|
||||
@@ -322,6 +322,12 @@ int pio_marsio_device_send(struct packet_io_device *pdev, uint32_t txq_id, struc
|
||||
return g_marsio_dll_func.marsio_send_burst(sendpath_handle, txq_id, (marsio_buff_t **)pkts, nr_pkts);
|
||||
}
|
||||
|
||||
void pio_marsio_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
struct mr_instance *mr_inst = pdev->ppio_inst->entity.marsio_inst->mr_inst_handle;
|
||||
g_marsio_dll_func.marsio_buff_free(mr_inst, (marsio_buff_t **)pkts, nr_pkts, MARSIO_SOCKET_ID_ANY, qid);
|
||||
}
|
||||
|
||||
static int marsio_instance_init(struct packet_io_instance *pinst, int wrk_thread_num)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
@@ -116,6 +116,8 @@ int pio_marsio_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, st
|
||||
|
||||
int pio_marsio_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
void pio_marsio_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
|
||||
int pio_marsio_instance_create(struct packet_io_instance *pinst, int wrk_thread_num);
|
||||
|
||||
void pio_marsio_instance_destroy(struct packet_io_instance *pinst);
|
||||
@@ -22,6 +22,7 @@ struct pio_device_operations pio_device_ops_array[PACKET_IO_RUN_MODE_MAX] =
|
||||
.close = pio_pcap_file_device_close,
|
||||
.recv = pio_pcap_file_device_receive,
|
||||
.send = pio_pcap_file_device_send,
|
||||
.pkt_free = pio_pcap_file_device_pkt_free,
|
||||
},
|
||||
|
||||
{
|
||||
@@ -29,6 +30,7 @@ struct pio_device_operations pio_device_ops_array[PACKET_IO_RUN_MODE_MAX] =
|
||||
.close = pio_pcap_live_device_close,
|
||||
.recv = pio_pcap_live_device_receive,
|
||||
.send = pio_pcap_live_device_send,
|
||||
.pkt_free = pio_pcap_live_device_pkt_free,
|
||||
},
|
||||
|
||||
{
|
||||
@@ -36,6 +38,7 @@ struct pio_device_operations pio_device_ops_array[PACKET_IO_RUN_MODE_MAX] =
|
||||
.close = pio_marsio_device_close,
|
||||
.recv = pio_marsio_device_receive,
|
||||
.send = pio_marsio_device_send,
|
||||
.pkt_free = pio_marsio_device_pkt_free,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -140,12 +143,17 @@ void packet_io_device_close(struct packet_io_device *pdev)
|
||||
FREE(pdev);
|
||||
}
|
||||
|
||||
int packet_io_device_rx(struct packet_io_device *pdev, uint32_t rxq_id, struct packet *p[], int nr_p)
|
||||
int packet_io_device_rx(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
return pdev->dev_ops->recv(pdev, rxq_id, p, nr_p);
|
||||
return pdev->dev_ops->recv(pdev, rxq_id, pkts, nr_pkts);
|
||||
}
|
||||
|
||||
int packet_io_device_tx(struct packet_io_device *pdev, uint32_t txq_id, struct packet *p[], int nr_p)
|
||||
int packet_io_device_tx(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
return pdev->dev_ops->send(pdev, txq_id, p, nr_p);
|
||||
return pdev->dev_ops->send(pdev, txq_id, pkts, nr_pkts);
|
||||
}
|
||||
|
||||
void packet_io_pkts_free(struct packet_io_instance *pinst, uint32_t qid, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -60,9 +60,11 @@ struct pio_device_operations {
|
||||
|
||||
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);
|
||||
int (*recv)(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
int (*send)(struct packet_io_device *pdev, uint32_t txq_id, struct packet *p[], int pkt_cnt);
|
||||
int (*send)(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
void (*pkt_free)(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
};
|
||||
|
||||
struct packet_io_device {
|
||||
@@ -120,7 +122,7 @@ void packet_io_device_close(struct packet_io_device *dev);
|
||||
* @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_rx(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
/*
|
||||
* @brief packet_io device send function
|
||||
@@ -130,4 +132,9 @@ int packet_io_device_rx(struct packet_io_device *pdev, uint32_t rxq_id, struct p
|
||||
* @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);
|
||||
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);
|
||||
@@ -12,32 +12,42 @@
|
||||
|
||||
#include "pio_pcap_file.h"
|
||||
|
||||
int pio_pcap_file_device_open(struct packet_io_device *pdev, const char *path, uint32_t nr_rxq, uint32_t nr_txq) {
|
||||
int pio_pcap_file_device_open(struct packet_io_device *pdev, const char *path, uint32_t nr_rxq, uint32_t nr_txq)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pio_pcap_file_device_close(const struct packet_io_device *pdev) {
|
||||
int pio_pcap_file_device_close(const struct packet_io_device *pdev)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pio_pcap_file_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts) {
|
||||
int pio_pcap_file_device_receive(struct packet_io_device *pdev, uint32_t rxq_id, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pio_pcap_file_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts) {
|
||||
int pio_pcap_file_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pio_pcap_file_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
|
||||
int pio_pcap_file_instance_create(struct packet_io_instance *pinst, int wrk_thread_num) {
|
||||
}
|
||||
|
||||
int pio_pcap_file_instance_create(struct packet_io_instance *pinst, int wrk_thread_num)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pio_pcap_file_instance_destroy(struct packet_io_instance *pinst) {
|
||||
void pio_pcap_file_instance_destroy(struct packet_io_instance *pinst)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -45,6 +45,8 @@ int pio_pcap_file_device_receive(struct packet_io_device *pdev, uint32_t rxq_id,
|
||||
|
||||
int pio_pcap_file_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
void pio_pcap_file_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
|
||||
int pio_pcap_file_instance_create(struct packet_io_instance *pinst, int wrk_thread_num);
|
||||
|
||||
void pio_pcap_file_instance_destroy(struct packet_io_instance *pinst);
|
||||
@@ -30,6 +30,11 @@ int pio_pcap_live_device_send(struct packet_io_device *pdev, uint32_t txq_id, st
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pio_pcap_live_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int pio_pcap_live_instance_create(struct packet_io_instance *pinst, int wrk_thread_num) {
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -43,6 +43,8 @@ int pio_pcap_live_device_receive(struct packet_io_device *pdev, uint32_t rxq_id,
|
||||
|
||||
int pio_pcap_live_device_send(struct packet_io_device *pdev, uint32_t txq_id, struct packet **pkts, int nr_pkts);
|
||||
|
||||
void pio_pcap_live_device_pkt_free(struct packet_io_device *pdev, uint32_t qid, struct packet **pkts, int nr_pkts);
|
||||
|
||||
int pio_pcap_live_instance_create(struct packet_io_instance *pinst, int wrk_thread_num);
|
||||
|
||||
void pio_pcap_live_instance_destroy(struct packet_io_instance *pinst);
|
||||
Reference in New Issue
Block a user