@@ -4161,6 +4161,22 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, enum dcb_mode_enable dcb_mode,
4161
4161
eth_conf -> dcb_capability_en = RTE_ETH_DCB_PG_SUPPORT ;
4162
4162
}
4163
4163
4164
+ static void
4165
+ clear_eth_dcb_conf (portid_t pid , struct rte_eth_conf * eth_conf )
4166
+ {
4167
+ uint32_t i ;
4168
+
4169
+ eth_conf -> rxmode .mq_mode &= ~(RTE_ETH_MQ_RX_DCB | RTE_ETH_MQ_RX_VMDQ_DCB );
4170
+ eth_conf -> txmode .mq_mode = RTE_ETH_MQ_TX_NONE ;
4171
+ eth_conf -> dcb_capability_en = 0 ;
4172
+ if (dcb_config ) {
4173
+ /* Unset VLAN filter configuration if already config DCB. */
4174
+ eth_conf -> rxmode .offloads &= ~RTE_ETH_RX_OFFLOAD_VLAN_FILTER ;
4175
+ for (i = 0 ; i < RTE_DIM (vlan_tags ); i ++ )
4176
+ rx_vft_set (pid , vlan_tags [i ], 0 );
4177
+ }
4178
+ }
4179
+
4164
4180
int
4165
4181
init_port_dcb_config (portid_t pid ,
4166
4182
enum dcb_mode_enable dcb_mode ,
@@ -4184,16 +4200,19 @@ init_port_dcb_config(portid_t pid,
4184
4200
/* retain the original device configuration. */
4185
4201
memcpy (& port_conf , & rte_port -> dev_conf , sizeof (struct rte_eth_conf ));
4186
4202
4187
- /* set configuration of DCB in vt mode and DCB in non-vt mode */
4188
- get_eth_dcb_conf (& port_conf , dcb_mode , num_tcs , pfc_en , prio_tc , prio_tc_en );
4189
-
4190
- port_conf .rxmode .offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER ;
4191
- /* remove RSS HASH offload for DCB in vt mode */
4192
- if (port_conf .rxmode .mq_mode == RTE_ETH_MQ_RX_VMDQ_DCB ) {
4193
- port_conf .rxmode .offloads &= ~RTE_ETH_RX_OFFLOAD_RSS_HASH ;
4194
- for (i = 0 ; i < nb_rxq ; i ++ )
4195
- rte_port -> rxq [i ].conf .offloads &=
4196
- ~RTE_ETH_RX_OFFLOAD_RSS_HASH ;
4203
+ if (num_tcs > 1 ) {
4204
+ /* set configuration of DCB in vt mode and DCB in non-vt mode */
4205
+ get_eth_dcb_conf (& port_conf , dcb_mode , num_tcs , pfc_en , prio_tc , prio_tc_en );
4206
+ port_conf .rxmode .offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER ;
4207
+ /* remove RSS HASH offload for DCB in vt mode */
4208
+ if (port_conf .rxmode .mq_mode == RTE_ETH_MQ_RX_VMDQ_DCB ) {
4209
+ port_conf .rxmode .offloads &= ~RTE_ETH_RX_OFFLOAD_RSS_HASH ;
4210
+ for (i = 0 ; i < nb_rxq ; i ++ )
4211
+ rte_port -> rxq [i ].conf .offloads &=
4212
+ ~RTE_ETH_RX_OFFLOAD_RSS_HASH ;
4213
+ }
4214
+ } else {
4215
+ clear_eth_dcb_conf (pid , & port_conf );
4197
4216
}
4198
4217
4199
4218
/* re-configure the device . */
@@ -4208,15 +4227,16 @@ init_port_dcb_config(portid_t pid,
4208
4227
/* If dev_info.vmdq_pool_base is greater than 0,
4209
4228
* the queue id of vmdq pools is started after pf queues.
4210
4229
*/
4211
- if (dcb_mode == DCB_VT_ENABLED &&
4230
+ if (num_tcs > 1 &&
4231
+ dcb_mode == DCB_VT_ENABLED &&
4212
4232
rte_port -> dev_info .vmdq_pool_base > 0 ) {
4213
4233
fprintf (stderr ,
4214
4234
"VMDQ_DCB multi-queue mode is nonsensical for port %d.\n" ,
4215
4235
pid );
4216
4236
return -1 ;
4217
4237
}
4218
4238
4219
- if (keep_qnum == 0 ) {
4239
+ if (num_tcs > 1 && keep_qnum == 0 ) {
4220
4240
/* Assume the ports in testpmd have the same dcb capability
4221
4241
* and has the same number of rxq and txq in dcb mode
4222
4242
*/
@@ -4244,19 +4264,21 @@ init_port_dcb_config(portid_t pid,
4244
4264
memcpy (& rte_port -> dev_conf , & port_conf , sizeof (struct rte_eth_conf ));
4245
4265
4246
4266
rxtx_port_config (pid );
4247
- /* VLAN filter */
4248
- rte_port -> dev_conf .rxmode .offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER ;
4249
- for (i = 0 ; i < RTE_DIM (vlan_tags ); i ++ )
4250
- rx_vft_set (pid , vlan_tags [i ], 1 );
4267
+ if (num_tcs > 1 ) {
4268
+ /* VLAN filter */
4269
+ rte_port -> dev_conf .rxmode .offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER ;
4270
+ for (i = 0 ; i < RTE_DIM (vlan_tags ); i ++ )
4271
+ rx_vft_set (pid , vlan_tags [i ], 1 );
4272
+ }
4251
4273
4252
4274
retval = eth_macaddr_get_print_err (pid , & rte_port -> eth_addr );
4253
4275
if (retval != 0 )
4254
4276
return retval ;
4255
4277
4256
- rte_port -> dcb_flag = 1 ;
4278
+ rte_port -> dcb_flag = num_tcs > 1 ? 1 : 0 ;
4257
4279
4258
4280
/* Enter DCB configuration status */
4259
- dcb_config = 1 ;
4281
+ dcb_config = num_tcs > 1 ? 1 : 0 ;
4260
4282
4261
4283
return 0 ;
4262
4284
}
0 commit comments