MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fs_switch_dev

Function fs_switch_dev

dpdk/drivers/net/failsafe/failsafe_private.h:450–492  ·  view source on GitHub ↗

* Switch emitting device. * If banned is set, banned must not be considered for * the role of emitting device. */

Source from the content-addressed store, hash-verified

448 * the role of emitting device.
449 */
450static inline void
451fs_switch_dev(struct rte_eth_dev *dev,
452 struct sub_device *banned)
453{
454 struct sub_device *txd;
455 enum dev_state req_state;
456
457 req_state = PRIV(dev)->state;
458 txd = TX_SUBDEV(dev);
459 if (PREFERRED_SUBDEV(dev)->state >= req_state &&
460 PREFERRED_SUBDEV(dev) != banned) {
461 if (txd != PREFERRED_SUBDEV(dev) &&
462 (txd == NULL ||
463 (req_state == DEV_STARTED) ||
464 (txd && txd->state < DEV_STARTED))) {
465 DEBUG("Switching tx_dev to preferred sub_device");
466 PRIV(dev)->subs_tx = 0;
467 }
468 } else if ((txd && txd->state < req_state) ||
469 txd == NULL ||
470 txd == banned) {
471 struct sub_device *sdev = NULL;
472 uint8_t i;
473
474 /* Using acceptable device */
475 FOREACH_SUBDEV_STATE(sdev, i, dev, req_state) {
476 if (sdev == banned)
477 continue;
478 DEBUG("Switching tx_dev to sub_device %d",
479 i);
480 PRIV(dev)->subs_tx = i;
481 break;
482 }
483 if (i >= PRIV(dev)->subs_tail || sdev == NULL) {
484 DEBUG("No device ready, deactivating tx_dev");
485 PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
486 }
487 } else {
488 return;
489 }
490 failsafe_set_burst_fn(dev, 0);
491 rte_wmb();
492}
493
494/*
495 * Adjust error value and rte_errno to the fail-safe actual error value.

Callers 3

fs_dev_startFunction · 0.85
failsafe_eal_initFunction · 0.85

Calls 1

failsafe_set_burst_fnFunction · 0.85

Tested by

no test coverage detected