src/dpdk/drivers/net/bnx2x/bnx2x.c
static int
bnx2x_issue_dmae_with_comp(struct bnx2x_softc *sc, struct dmae_command *dmae)
{
	uint32_t *wb_comp = BNX2X_SP(sc, wb_comp);
	int timeout = CHIP_REV_IS_SLOW(sc) ? 400000 : 4000;

	/* reset completion */
	*wb_comp = 0;

	/* post the command on the channel used for initializations */
	bnx2x_post_dmae(sc, dmae, INIT_DMAE_C(sc));

	/* wait for completion */
	DELAY(500);

	while ((*wb_comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) {
		if (!timeout ||
		    (sc->recovery_state != BNX2X_RECOVERY_DONE &&
		     sc->recovery_state != BNX2X_RECOVERY_NIC_LOADING)) {
			PMD_DRV_LOG(INFO, sc, "DMAE timeout!");
			return DMAE_TIMEOUT;
		}

		timeout--;
		DELAY(50);
	}

	if (*wb_comp & DMAE_PCI_ERR_FLAG) {
		PMD_DRV_LOG(INFO, sc, "DMAE PCI error!");
		return DMAE_PCI_ERROR;
	}

	return 0;
}
/* issue a DMAE command over the init channel and wait for completion */
issue a DMAE command over the init channel and wait for completion
issue a DMAE command over the init channel and wait for completion
static int
bnx2x_issue_dmae_with_comp(struct bnx2x_softc *sc, struct dmae_command *dmae)
{
	uint32_t *wb_comp = BNX2X_SP(sc, wb_comp);
	int timeout = CHIP_REV_IS_SLOW(sc) ? 400000 : 4000;
	*wb_comp = 0;
	bnx2x_post_dmae(sc, dmae, INIT_DMAE_C(sc));
	DELAY(500);
	while ((*wb_comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) {
		if (!timeout ||
		    (sc->recovery_state != BNX2X_RECOVERY_DONE &&
		     sc->recovery_state != BNX2X_RECOVERY_NIC_LOADING)) {
			PMD_DRV_LOG(INFO, sc, "DMAE timeout!");
			return DMAE_TIMEOUT;
		}
		timeout--;
		DELAY(50);
	}
	if (*wb_comp & DMAE_PCI_ERR_FLAG) {
		PMD_DRV_LOG(INFO, sc, "DMAE PCI error!");
		return DMAE_PCI_ERROR;
	}
	return 0;
}
static int bnx2x_issue_dmae_with_comp ( struct bnx2x_softc * sc , struct dmae_command * dmae ) { uint32_t * wb_comp = BNX2X_SP ( sc , wb_comp ) ; int timeout = CHIP_REV_IS_SLOW ( sc ) ? 400000 : 4000 ; * wb_comp = 0 ; bnx2x_post_dmae ( sc , dmae , INIT_DMAE_C ( sc ) ) ; DELAY ( 500 ) ; while ( ( * wb_comp & ~ DMAE_PCI_ERR_FLAG ) != DMAE_COMP_VAL ) { if ( ! timeout || ( sc -> recovery_state != BNX2X_RECOVERY_DONE && sc -> recovery_state != BNX2X_RECOVERY_NIC_LOADING ) ) { PMD_DRV_LOG ( INFO , sc , " " ) ; return DMAE_TIMEOUT ; } timeout -- ; DELAY ( 50 ) ; } if ( * wb_comp & DMAE_PCI_ERR_FLAG ) { PMD_DRV_LOG ( INFO , sc , " " ) ; return DMAE_PCI_ERROR ; } return 0 ; }
issue a DMAE command over the init channel and wait for completion
issue a DMAE command over the init channel and wait for completion
/* reset completion */ /* post the command on the channel used for initializations */ /* wait for completion */