src/dpdk/drivers/net/bnx2x/bnx2x.c
void bnx2x_periodic_callout(struct bnx2x_softc *sc)
{
	if ((sc->state != BNX2X_STATE_OPEN) ||
	    (atomic_load_acq_long(&sc->periodic_flags) == PERIODIC_STOP)) {
		PMD_DRV_LOG(DEBUG, sc, "periodic callout exit (state=0x%x)",
			    sc->state);
		return;
	}
	if (!CHIP_REV_IS_SLOW(sc)) {
/*
 * This barrier is needed to ensure the ordering between the writing
 * to the sc->port.pmf in the bnx2x_nic_load() or bnx2x_pmf_update() and
 * the reading here.
 */
		mb();
		if (sc->port.pmf) {
			bnx2x_acquire_phy_lock(sc);
			elink_period_func(&sc->link_params, &sc->link_vars);
			bnx2x_release_phy_lock(sc);
		}
	}
#ifdef BNX2X_PULSE
	if (IS_PF(sc) && !BNX2X_NOMCP(sc)) {
		int mb_idx = SC_FW_MB_IDX(sc);
		uint32_t drv_pulse;
		uint32_t mcp_pulse;

		++sc->fw_drv_pulse_wr_seq;
		sc->fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK;

		drv_pulse = sc->fw_drv_pulse_wr_seq;
		bnx2x_drv_pulse(sc);

		mcp_pulse = (SHMEM_RD(sc, func_mb[mb_idx].mcp_pulse_mb) &
			     MCP_PULSE_SEQ_MASK);

/*
 * The delta between driver pulse and mcp response should
 * be 1 (before mcp response) or 0 (after mcp response).
 */
		if ((drv_pulse != mcp_pulse) &&
		    (drv_pulse != ((mcp_pulse + 1) & MCP_PULSE_SEQ_MASK))) {
			/* someone lost a heartbeat... */
			PMD_DRV_LOG(ERR, sc,
				    "drv_pulse (0x%x) != mcp_pulse (0x%x)",
				    drv_pulse, mcp_pulse);
		}
	}
#endif
}
/* periodic timer callout routine, only runs when the interface is up */
periodic timer callout routine, only runs when the interface is up
periodic timer callout routine only runs when the interface is up
void bnx2x_periodic_callout(struct bnx2x_softc *sc)
{
	if ((sc->state != BNX2X_STATE_OPEN) ||
	    (atomic_load_acq_long(&sc->periodic_flags) == PERIODIC_STOP)) {
		PMD_DRV_LOG(DEBUG, sc, "periodic callout exit (state=0x%x)",
			    sc->state);
		return;
	}
	if (!CHIP_REV_IS_SLOW(sc)) {
		mb();
		if (sc->port.pmf) {
			bnx2x_acquire_phy_lock(sc);
			elink_period_func(&sc->link_params, &sc->link_vars);
			bnx2x_release_phy_lock(sc);
		}
	}
#ifdef BNX2X_PULSE
	if (IS_PF(sc) && !BNX2X_NOMCP(sc)) {
		int mb_idx = SC_FW_MB_IDX(sc);
		uint32_t drv_pulse;
		uint32_t mcp_pulse;
		++sc->fw_drv_pulse_wr_seq;
		sc->fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK;
		drv_pulse = sc->fw_drv_pulse_wr_seq;
		bnx2x_drv_pulse(sc);
		mcp_pulse = (SHMEM_RD(sc, func_mb[mb_idx].mcp_pulse_mb) &
			     MCP_PULSE_SEQ_MASK);
		if ((drv_pulse != mcp_pulse) &&
		    (drv_pulse != ((mcp_pulse + 1) & MCP_PULSE_SEQ_MASK))) {
			PMD_DRV_LOG(ERR, sc,
				    "drv_pulse (0x%x) != mcp_pulse (0x%x)",
				    drv_pulse, mcp_pulse);
		}
	}
#endif
}
void bnx2x_periodic_callout ( struct bnx2x_softc * sc ) { if ( ( sc -> state != BNX2X_STATE_OPEN ) || ( atomic_load_acq_long ( & sc -> periodic_flags ) == PERIODIC_STOP ) ) { PMD_DRV_LOG ( DEBUG , sc , " " , sc -> state ) ; return ; } if ( ! CHIP_REV_IS_SLOW ( sc ) ) { mb ( ) ; if ( sc -> port . pmf ) { bnx2x_acquire_phy_lock ( sc ) ; elink_period_func ( & sc -> link_params , & sc -> link_vars ) ; bnx2x_release_phy_lock ( sc ) ; } } #ifdef BNX2X_PULSE if ( IS_PF ( sc ) && ! BNX2X_NOMCP ( sc ) ) { int mb_idx = SC_FW_MB_IDX ( sc ) ; uint32_t drv_pulse ; uint32_t mcp_pulse ; ++ sc -> fw_drv_pulse_wr_seq ; sc -> fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK ; drv_pulse = sc -> fw_drv_pulse_wr_seq ; bnx2x_drv_pulse ( sc ) ; mcp_pulse = ( SHMEM_RD ( sc , func_mb [ mb_idx ] . mcp_pulse_mb ) & MCP_PULSE_SEQ_MASK ) ; if ( ( drv_pulse != mcp_pulse ) && ( drv_pulse != ( ( mcp_pulse + 1 ) & MCP_PULSE_SEQ_MASK ) ) ) { PMD_DRV_LOG ( ERR , sc , " " , drv_pulse , mcp_pulse ) ; } } #endif }
periodic timer callout routine, only runs when the interface is up
periodic timer callout routine only runs when the interface is up
/*
 * This barrier is needed to ensure the ordering between the writing
 * to the sc->port.pmf in the bnx2x_nic_load() or bnx2x_pmf_update() and
 * the reading here.
 */ /*
 * The delta between driver pulse and mcp response should
 * be 1 (before mcp response) or 0 (after mcp response).
 */ /* someone lost a heartbeat... */