45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "stellar/mq.h"
|
|
#include "stellar/packet_manager.h"
|
|
|
|
#define PACKET_QUEUE_MAX (PACKET_STAGE_MAX + 1)
|
|
|
|
struct packet_manager_stat
|
|
{
|
|
struct
|
|
{
|
|
uint64_t pkts_ingress;
|
|
uint64_t pkts_egress;
|
|
} total;
|
|
struct
|
|
{
|
|
uint64_t pkts_in; // include the packets that are scheduled
|
|
uint64_t pkts_out; // include the packets that are claimed
|
|
uint64_t pkts_claim;
|
|
uint64_t pkts_schedule;
|
|
} queue[PACKET_QUEUE_MAX]; // the last queue is for sending packets
|
|
};
|
|
|
|
struct packet_manager *packet_manager_new(struct mq_schema *mq_schema, uint16_t thread_num);
|
|
void packet_manager_free(struct packet_manager *pkt_mgr);
|
|
|
|
int packet_manager_init(struct packet_manager *pkt_mgr, uint16_t thread_id, struct mq_runtime *mq_rt);
|
|
void packet_manager_clean(struct packet_manager *pkt_mgr, uint16_t thread_id);
|
|
void packet_manager_ingress(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt);
|
|
struct packet *packet_manager_egress(struct packet_manager *pkt_mgr, uint16_t thread_id);
|
|
void packet_manager_dispatch(struct packet_manager *pkt_mgr, uint16_t thread_id);
|
|
struct packet_manager_stat *packet_manager_get_stat(struct packet_manager *pkt_mgr, uint16_t thread_id);
|
|
void packet_manager_print_stat(struct packet_manager *pkt_mgr, uint16_t thread_id);
|
|
|
|
const char *packet_stage_to_str(enum packet_stage stage);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|