src/dpdk/drivers/net/failsafe/failsafe_private.h
static inline void
fs_switch_dev(struct rte_eth_dev *dev,
	      struct sub_device *banned)
{
	struct sub_device *txd;
	enum dev_state req_state;

	req_state = PRIV(dev)->state;
	txd = TX_SUBDEV(dev);
	if (PREFERRED_SUBDEV(dev)->state >= req_state &&
	    PREFERRED_SUBDEV(dev) != banned) {
		if (txd != PREFERRED_SUBDEV(dev) &&
		    (txd == NULL ||
		     (req_state == DEV_STARTED) ||
		     (txd && txd->state < DEV_STARTED))) {
			DEBUG("Switching tx_dev to preferred sub_device");
			PRIV(dev)->subs_tx = 0;
		}
	} else if ((txd && txd->state < req_state) ||
		   txd == NULL ||
		   txd == banned) {
		struct sub_device *sdev = NULL;
		uint8_t i;

		/* Using acceptable device */
		FOREACH_SUBDEV_STATE(sdev, i, dev, req_state) {
			if (sdev == banned)
				continue;
			DEBUG("Switching tx_dev to sub_device %d",
			      i);
			PRIV(dev)->subs_tx = i;
			break;
		}
		if (i >= PRIV(dev)->subs_tail || sdev == NULL) {
			DEBUG("No device ready, deactivating tx_dev");
			PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
		}
	} else {
		return;
	}
	failsafe_set_burst_fn(dev, 0);
	rte_wmb();
}
/*
 * Switch emitting device.
 * If banned is set, banned must not be considered for
 * the role of emitting device.
 */
Switch emitting device.
If banned is set, banned must not be considered for
the role of emitting device.
Switch emitting device . If banned is set banned must not be considered for the role of emitting device .
static inline void
fs_switch_dev(struct rte_eth_dev *dev,
	      struct sub_device *banned)
{
	struct sub_device *txd;
	enum dev_state req_state;
	req_state = PRIV(dev)->state;
	txd = TX_SUBDEV(dev);
	if (PREFERRED_SUBDEV(dev)->state >= req_state &&
	    PREFERRED_SUBDEV(dev) != banned) {
		if (txd != PREFERRED_SUBDEV(dev) &&
		    (txd == NULL ||
		     (req_state == DEV_STARTED) ||
		     (txd && txd->state < DEV_STARTED))) {
			DEBUG("Switching tx_dev to preferred sub_device");
			PRIV(dev)->subs_tx = 0;
		}
	} else if ((txd && txd->state < req_state) ||
		   txd == NULL ||
		   txd == banned) {
		struct sub_device *sdev = NULL;
		uint8_t i;
		FOREACH_SUBDEV_STATE(sdev, i, dev, req_state) {
			if (sdev == banned)
				continue;
			DEBUG("Switching tx_dev to sub_device %d",
			      i);
			PRIV(dev)->subs_tx = i;
			break;
		}
		if (i >= PRIV(dev)->subs_tail || sdev == NULL) {
			DEBUG("No device ready, deactivating tx_dev");
			PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
		}
	} else {
		return;
	}
	failsafe_set_burst_fn(dev, 0);
	rte_wmb();
}
static inline void fs_switch_dev ( struct rte_eth_dev * dev , struct sub_device * banned ) { struct sub_device * txd ; enum dev_state req_state ; req_state = PRIV ( dev ) -> state ; txd = TX_SUBDEV ( dev ) ; if ( PREFERRED_SUBDEV ( dev ) -> state >= req_state && PREFERRED_SUBDEV ( dev ) != banned ) { if ( txd != PREFERRED_SUBDEV ( dev ) && ( txd == NULL || ( req_state == DEV_STARTED ) || ( txd && txd -> state < DEV_STARTED ) ) ) { DEBUG ( " " ) ; PRIV ( dev ) -> subs_tx = 0 ; } } else if ( ( txd && txd -> state < req_state ) || txd == NULL || txd == banned ) { struct sub_device * sdev = NULL ; uint8_t i ; FOREACH_SUBDEV_STATE ( sdev , i , dev , req_state ) { if ( sdev == banned ) continue ; DEBUG ( " " , i ) ; PRIV ( dev ) -> subs_tx = i ; break ; } if ( i >= PRIV ( dev ) -> subs_tail || sdev == NULL ) { DEBUG ( " " ) ; PRIV ( dev ) -> subs_tx = PRIV ( dev ) -> subs_tail ; } } else { return ; } failsafe_set_burst_fn ( dev , 0 ) ; rte_wmb ( ) ; }
Switch emitting device.
Switch emitting device .
/* Using acceptable device */