[PAKCET_IO] framework intermediate state <the second time>

This commit is contained in:
liuwentan
2022-07-28 20:30:48 +08:00
parent 7ae4ca2e2a
commit 536bf31be1
12 changed files with 168 additions and 82 deletions

View File

@@ -51,20 +51,21 @@ void packet_io_loop(struct packet_io_loop_arg *arg)
}
struct packet_io_device *packet_io_init(const char *instance_name, enum packet_io_run_mode mode, int worker_thread_num)
struct packet_io_device *
packet_io_init(const char *instance_name, const enum packet_io_run_mode mode, const int worker_thread_num)
{
struct packet_io_instance *ppio_instance = packet_io_instance_create(instance_name, mode, worker_thread_num);
if (nullptr == ppio_instance) {
struct packet_io_instance *ppio_inst = packet_io_instance_create(instance_name, mode, worker_thread_num);
if (nullptr == ppio_inst) {
log_error(ST_ERR_PIO_INSTANCE, "packet_io instance init failed.");
return nullptr;
}
struct packet_io_device *ppio_device = packet_io_open_device(ppio_instance, nullptr, worker_thread_num, worker_thread_num);
if (nullptr == ppio_device) {
struct packet_io_device *ppio_dev = packet_io_open_device(ppio_inst, "eth1", worker_thread_num, worker_thread_num);
if (nullptr == ppio_dev) {
log_error(ST_ERR_PIO_DEVICE, "packet_io device open failed.");
}
return ppio_device;
return ppio_dev;
}
int main(int argc, char ** argv)