diff options
| author | songyanchao <[email protected]> | 2022-09-07 07:57:36 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2022-09-07 07:57:36 +0000 |
| commit | b80b554f6de62ebfa6b357593869fbd7bd6a6c43 (patch) | |
| tree | 37993b3d982a89495f5d25694984f0a2741a7dae /examples | |
| parent | f31c97a5918bf615b89cf5688975a6cee5fa9d8f (diff) | |
🎈 perf(TSG-11887): lb node 适配 eth-egress node
lb node 适配 eth-egress node
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/l2fwd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/l2fwd.c b/examples/l2fwd.c index 64b2ef0..c475737 100644 --- a/examples/l2fwd.c +++ b/examples/l2fwd.c @@ -8,13 +8,16 @@ static char appsym[64] = "mrfwd"; static char dev_1_symbol[64] = "meth0"; +static char dev_2_symbol[64] = "meth1"; uint64_t cpu_mask = 0x3c; unsigned int nr_thread; struct mr_instance * mr_instance = NULL; struct mr_vdev * dev_1_handler = NULL; +struct mr_vdev * dev_2_handler = NULL; struct mr_sendpath * to_dev_1_sendpath = NULL; +struct mr_sendpath * to_dev_2_sendpath = NULL; #define BURST_MAX 64 unsigned int nr_burst = 32; @@ -30,6 +33,8 @@ void * l2fwd_loop(void * arg) for (;;) { ret = marsio_recv_burst(dev_1_handler, sid, rx_buff, nr_burst); + marsio_send_burst(to_dev_2_sendpath, sid, rx_buff, ret); + ret = marsio_recv_burst(dev_2_handler, sid, rx_buff, nr_burst); marsio_send_burst(to_dev_1_sendpath, sid, rx_buff, ret); } @@ -61,6 +66,11 @@ int main(int argc, char * argv[]) snprintf(dev_1_symbol, sizeof(dev_1_symbol), "%s", optarg); break; } + case 'd': + { + snprintf(dev_2_symbol, sizeof(dev_2_symbol), "%s", optarg); + break; + } case 'a': { snprintf(appsym, sizeof(appsym), "%s", optarg); @@ -99,7 +109,9 @@ int main(int argc, char * argv[]) nr_thread = __builtin_popcountll(cpu_mask); dev_1_handler = marsio_open_device(mr_instance, dev_1_symbol, nr_thread, nr_thread); + dev_2_handler = marsio_open_device(mr_instance, dev_2_symbol, nr_thread, nr_thread); to_dev_1_sendpath = marsio_sendpath_create_by_vdev(dev_1_handler); + to_dev_2_sendpath = marsio_sendpath_create_by_vdev(dev_2_handler); fprintf(stdout, "Thread Count = %d\n", nr_thread); pthread_t __tmp_pid[nr_thread]; |
