net/ark: support multi-port pkt generation
PATCH 1/1 net/ark: support multi-port pkt generation
Added support for packet generation in multi-port Arkville implementations. The packet generator is a singleton within the device but is capable of generating packets for any port within one device.
--- drivers/net/ark/ark_ethdev.c | 4 +++- drivers/net/ark/ark_global.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ark/ark_ethdev.c +3 -1
@@ -441,6 +441,7 @@ ark_config_device(struct rte_eth_dev *dev)* known state */ ark->start_pg =0 ; + ark->pg_running =0 ; ark->pg =ark_pktgen_init (ark->pktgen.v,0 ,1 );if (ark->pg ==NULL )return -1 ;
@@ -562,7 +563,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev)if (ark->start_pg)ark_pktchkr_run (ark->pc); -if (ark->start_pg && (dev->data->port_id ==0 )) { +if (ark->start_pg && !ark->pg_running) {pthread_t thread;/* Delay packet generatpr start allow the hardware to be ready
@@ -574,6 +575,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev) "starter thread\n");return -1 ; } + ark->pg_running =1 ; }if (ark->user_ext.dev_start)
drivers/net/ark/ark_global.h +1 -0
@@ -107,6 +107,7 @@ struct ark_adapter {/* Pointers to packet generator and checker */ int start_pg; +uint16_t pg_running;ark_pkt_gen_t pg;ark_pkt_chkr_t pc;ark_pkt_dir_t pd;
Signature · 1 line
2.25.1
Quoted 34 lines · John Miller
Added support for packet generation in multi-port Arkville implementations. The packet generator is a singleton within the device but is capable of generating packets for any port within one device.
Signed-off-by John Miller <[email protected]>--- drivers/net/ark/ark_ethdev.c | 4 +++- drivers/net/ark/ark_global.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)drivers/net/ark/ark_ethdev.c +2
-1@@ -441,6 +441,7 @@ ark_config_device(struct rte_eth_dev *dev)* known state */ ark->start_pg =0 ; + ark->pg_running =0 ; ark->pg =ark_pktgen_init (ark->pktgen.v,0 ,1 );if (ark->pg ==NULL )return -1 ;@@ -562,7 +563,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev)if (ark->start_pg)ark_pktchkr_run (ark->pc); -if (ark->start_pg && (dev->data->port_id ==0 )) { +if (ark->start_pg && !ark->pg_running) {pthread_t thread;/* Delay packet generatpr start allow the hardware to be ready
drivers/net/ark/ark_ethdev.c eth_ark_dev_start(struct rte_eth_dev *dev) · line 578
Quoted 4 lines
drivers/net/ark/ark_ethdev.c +1
-0@@ -574,6 +575,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev) "starter thread\n");return -1 ; } + ark->pg_running =1 ;
Should there be a place 'ark->pg_running' set back to '0', like 'eth_ark_dev_stop()'?
Or is this delay thread is only required once in first init per port?
Btw, if there will change, you may consider thread name, "ark-delay-pg", get port_id to differentiate multiple threads, like "ark-delay-pg_0", "ark-delay-pg_1" ...
Quoted 15 lines
drivers/net/ark/ark_ethdev.c +0
-0}if (ark->user_ext.dev_start)drivers/net/ark/ark_global.h +1
-0@@ -107,6 +107,7 @@ struct ark_adapter {/* Pointers to packet generator and checker */ int start_pg; +uint16_t pg_running;ark_pkt_gen_t pg;ark_pkt_chkr_t pc;ark_pkt_dir_t pd;