@@ -123,30 +123,51 @@ int ans_check_port_config(const unsigned nb_ports, struct ans_user_config *user_
123123**********************************************************************/
124124int ans_check_lcore_params (struct ans_user_config * user_conf )
125125{
126- uint8_t queue , lcore ;
127- uint16_t i ;
126+ uint8_t queue , lcore , port ;
127+ uint16_t i , j ;
128128 int socketid ;
129129
130130 for (i = 0 ; i < user_conf -> lcore_param_nb ; ++ i )
131131 {
132- queue = user_conf -> lcore_param [i ].queue_id ;
133- if (queue >= MAX_RX_QUEUE_PER_PORT )
134- {
135- printf ("invalid queue number: %hhu\n" , queue );
136- return -1 ;
137- }
138- lcore = user_conf -> lcore_param [i ].lcore_id ;
139- if (!rte_lcore_is_enabled (lcore ))
140- {
141- printf ("error: lcore %hhu is not enabled in lcore mask\n" , lcore );
142- return -1 ;
143- }
144-
145- if ((socketid = rte_lcore_to_socket_id (lcore ) != 0 ) && (user_conf -> numa_on == 0 ))
146- {
147- printf ("warning: lcore %hhu is on socket %d with numa off \n" , lcore , socketid );
148- }
132+ queue = user_conf -> lcore_param [i ].queue_id ;
133+ if (queue >= MAX_RX_QUEUE_PER_PORT )
134+ {
135+ printf ("invalid queue number: %hhu\n" , queue );
136+ return -1 ;
137+ }
138+
139+ lcore = user_conf -> lcore_param [i ].lcore_id ;
140+ if (!rte_lcore_is_enabled (lcore ))
141+ {
142+ printf ("error: lcore %hhu is not enabled in lcore mask\n" , lcore );
143+ return -1 ;
144+ }
145+
146+ if ((socketid = rte_lcore_to_socket_id (lcore ) != 0 ) && (user_conf -> numa_on == 0 ))
147+ {
148+ printf ("warning: lcore %hhu is on socket %d with numa off \n" , lcore , socketid );
149+ }
150+ }
151+
152+ /* check if same port and queue mapping to different lcore */
153+ for (i = 0 ; i < user_conf -> lcore_param_nb ; ++ i )
154+ {
155+ port = user_conf -> lcore_param [i ].port_id ;
156+ queue = user_conf -> lcore_param [i ].queue_id ;
157+ lcore = user_conf -> lcore_param [i ].lcore_id ;
158+
159+ for (j = i + 1 ; j < user_conf -> lcore_param_nb ; ++ j )
160+ {
161+ if ( port == user_conf -> lcore_param [j ].port_id &&
162+ queue == user_conf -> lcore_param [j ].queue_id &&
163+ lcore != user_conf -> lcore_param [j ].lcore_id )
164+ {
165+ printf ("error: same port(%d) and queue(%d) mapping to different lcore \n" , port , queue );
166+ return -1 ;
167+ }
168+ }
149169 }
170+
150171 return 0 ;
151172}
152173
0 commit comments