@@ -343,19 +343,22 @@ CommandResponse PMDPort::Init(const bess::pb::PMDPortArg &arg) {
343343}
344344
345345CommandResponse PMDPort::UpdateConf (const Conf &conf) {
346- rte_eth_dev_stop (dpdk_port_id_);
346+ CommandResponse resp = CommandSuccess ();
347+ rte_eth_dev_stop (dpdk_port_id_); // need to restart before return
347348
348349 if (conf_.mtu != conf.mtu && conf.mtu != 0 ) {
349350 if (conf.mtu > SNBUF_DATA || conf.mtu < RTE_ETHER_MIN_MTU) {
350- return CommandFailure (EINVAL, " mtu should be >= %d and <= %d" ,
351+ resp = CommandFailure (EINVAL, " mtu should be >= %d and <= %d" ,
351352 RTE_ETHER_MIN_MTU, SNBUF_DATA);
353+ goto restart;
352354 }
353355
354356 int ret = rte_eth_dev_set_mtu (dpdk_port_id_, conf.mtu );
355357 if (ret == 0 ) {
356358 conf_.mtu = conf.mtu ;
357359 } else {
358- return CommandFailure (-ret, " rte_eth_dev_set_mtu() failed" );
360+ resp = CommandFailure (-ret, " rte_eth_dev_set_mtu() failed" );
361+ goto restart;
359362 }
360363 }
361364
@@ -367,10 +370,12 @@ CommandResponse PMDPort::UpdateConf(const Conf &conf) {
367370 if (ret == 0 ) {
368371 conf_.mac_addr = conf.mac_addr ;
369372 } else {
370- return CommandFailure (-ret, " rte_eth_dev_default_mac_addr_set() failed" );
373+ resp = CommandFailure (-ret, " rte_eth_dev_default_mac_addr_set() failed" );
374+ goto restart;
371375 }
372376 }
373377
378+ restart:
374379 if (conf.admin_up ) {
375380 int ret = rte_eth_dev_start (dpdk_port_id_);
376381 if (ret == 0 ) {
@@ -380,7 +385,7 @@ CommandResponse PMDPort::UpdateConf(const Conf &conf) {
380385 }
381386 }
382387
383- return CommandSuccess () ;
388+ return resp ;
384389}
385390
386391void PMDPort::DeInit () {
0 commit comments