@@ -162,7 +162,7 @@ static struct lcore_conf lcore_conf;
162
162
163
163
static struct rte_mempool * pktmbuf_pool [NB_SOCKETS ];
164
164
165
- static struct rte_ring * * arp_ring [RTE_MAX_LCORE ];
165
+ static struct rte_ring * * arp_ring [RTE_MAX_ETHPORTS ];
166
166
167
167
static uint16_t rss_reta_size [RTE_MAX_ETHPORTS ];
168
168
@@ -420,43 +420,40 @@ create_ring(const char *name, unsigned count, int socket_id, unsigned flags)
420
420
static int
421
421
init_arp_ring (void )
422
422
{
423
- int i , j , ret ;
423
+ int j ;
424
424
char name_buf [RTE_RING_NAMESIZE ];
425
- int nb_procs = ff_global_cfg .dpdk .nb_procs ;
426
- int proc_id = ff_global_cfg .dpdk .proc_id ;
427
-
428
- /* Allocate arp ring ptr according to eth dev count. */
429
- int nb_dev_ports = rte_eth_dev_count ();
430
- for (i = 0 ; i < nb_procs ; ++ i ) {
431
- snprintf (name_buf , RTE_RING_NAMESIZE , "ring_ptr_%d_%d" ,
432
- proc_id , i );
433
-
434
- arp_ring [i ] = rte_zmalloc (name_buf ,
435
- sizeof (struct rte_ring * ) * nb_dev_ports ,
436
- RTE_CACHE_LINE_SIZE );
437
- if (arp_ring [i ] == NULL ) {
438
- rte_exit (EXIT_FAILURE , "rte_zmalloc(%s (struct rte_ring*)) "
439
- "failed\n" , name_buf );
440
- }
441
- }
425
+ int queueid ;
442
426
443
427
unsigned socketid = lcore_conf .socket_id ;
444
428
445
429
/* Create ring according to ports actually being used. */
446
430
int nb_ports = ff_global_cfg .dpdk .nb_ports ;
447
431
for (j = 0 ; j < nb_ports ; j ++ ) {
448
- uint16_t port_id = ff_global_cfg .dpdk .portid_list [j ];
432
+ uint16_t portid = ff_global_cfg .dpdk .portid_list [j ];
433
+ struct ff_port_cfg * pconf = & ff_global_cfg .dpdk .port_cfgs [portid ];
434
+ int nb_queues = pconf -> nb_lcores ;
435
+ if (arp_ring [portid ] == NULL ) {
436
+ snprintf (name_buf , RTE_RING_NAMESIZE , "ring_ptr_p%d" , portid );
437
+
438
+ arp_ring [portid ] = rte_zmalloc (name_buf ,
439
+ sizeof (struct rte_ring * ) * nb_queues ,
440
+ RTE_CACHE_LINE_SIZE );
441
+ if (arp_ring [portid ] == NULL ) {
442
+ rte_exit (EXIT_FAILURE , "rte_zmalloc(%s (struct rte_ring*)) "
443
+ "failed\n" , name_buf );
444
+ }
445
+ }
449
446
450
- for (i = 0 ; i < nb_procs ; ++ i ) {
451
- snprintf (name_buf , RTE_RING_NAMESIZE , "arp_ring_%d_ %d" , i , port_id );
452
- arp_ring [i ][ port_id ] = create_ring (name_buf , ARP_RING_SIZE ,
447
+ for (queueid = 0 ; queueid < nb_queues ; ++ queueid ) {
448
+ snprintf (name_buf , RTE_RING_NAMESIZE , "arp_ring_p%d_q %d" , portid , queueid );
449
+ arp_ring [portid ][ queueid ] = create_ring (name_buf , ARP_RING_SIZE ,
453
450
socketid , RING_F_SC_DEQ );
454
451
455
- if (arp_ring [i ][ port_id ] == NULL )
452
+ if (arp_ring [portid ][ queueid ] == NULL )
456
453
rte_panic ("create ring:%s failed!\n" , name_buf );
457
454
458
455
printf ("create ring:%s success, %u ring entries are now free!\n" ,
459
- name_buf , rte_ring_free_count (arp_ring [i ][ port_id ]));
456
+ name_buf , rte_ring_free_count (arp_ring [portid ][ queueid ]));
460
457
}
461
458
}
462
459
@@ -931,7 +928,7 @@ process_packets(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **bufs,
931
928
mbuf_pool = pktmbuf_pool [socket_id ];
932
929
mbuf_clone = rte_pktmbuf_clone (rtem , mbuf_pool );
933
930
if (mbuf_clone ) {
934
- int ret = rte_ring_enqueue (arp_ring [i ][ port_id ], mbuf_clone );
931
+ int ret = rte_ring_enqueue (arp_ring [port_id ][ i ], mbuf_clone );
935
932
if (ret < 0 )
936
933
rte_pktmbuf_free (mbuf_clone );
937
934
}
@@ -962,7 +959,7 @@ process_arp_ring(uint8_t port_id, uint16_t queue_id,
962
959
{
963
960
/* read packet from ring buf and to process */
964
961
uint16_t nb_rb ;
965
- nb_rb = rte_ring_dequeue_burst (arp_ring [queue_id ][ port_id ],
962
+ nb_rb = rte_ring_dequeue_burst (arp_ring [port_id ][ queue_id ],
966
963
(void * * )pkts_burst , MAX_PKT_BURST );
967
964
968
965
if (nb_rb > 0 ) {
0 commit comments