FreeBSD/sys/dev/qlxgb/qla_hw.c
/*
 * Name: qla_fw_cmd
 * Function: Issues firmware control commands on the Tx Ring.
 */
qla_fw_cmd
Function: Issues firmware control commands on the Tx Ring.
qla_fw_cmd Function : Issues firmware control commands on the Tx Ring .
static int
qla_fw_cmd(qla_host_t *ha, void *fw_cmd, uint32_t size)
{
	device_t dev;
        q80_tx_cmd_t *tx_cmd;
        qla_hw_t *hw = &ha->hw;
	int count = 100;
	dev = ha->pci_dev;
	QLA_TX_LOCK(ha);
        if (hw->txr_free <= QLA_TX_MIN_FREE) {
		while (count--) {
			qla_hw_tx_done_locked(ha);
			if (hw->txr_free > QLA_TX_MIN_FREE)
				break;
			QLA_TX_UNLOCK(ha);
			qla_mdelay(__func__, 10);
			QLA_TX_LOCK(ha);
		}
        	if (hw->txr_free <= QLA_TX_MIN_FREE) {
			QLA_TX_UNLOCK(ha);
			device_printf(dev, "%s: xmit queue full\n", __func__);
                	return (-1);
		}
        }
        tx_cmd = &hw->tx_ring_base[hw->txr_next];
        bzero((void *)tx_cmd, sizeof(q80_tx_cmd_t));
	bcopy(fw_cmd, tx_cmd, size);
	hw->txr_next = (hw->txr_next + 1) & (NUM_TX_DESCRIPTORS - 1);
	hw->txr_free--;
	QL_UPDATE_TX_PRODUCER_INDEX(ha, hw->txr_next);
	QLA_TX_UNLOCK(ha);
	return (0);
}
static int qla_fw_cmd ( qla_host_t * ha , void * fw_cmd , uint32_t size ) { device_t dev ; q80_tx_cmd_t * tx_cmd ; qla_hw_t * hw = & ha -> hw ; int count = 100 ; dev = ha -> pci_dev ; QLA_TX_LOCK ( ha ) ; if ( hw -> txr_free <= QLA_TX_MIN_FREE ) { while ( count -- ) { qla_hw_tx_done_locked ( ha ) ; if ( hw -> txr_free > QLA_TX_MIN_FREE ) break ; QLA_TX_UNLOCK ( ha ) ; qla_mdelay ( __func__ , 10 ) ; QLA_TX_LOCK ( ha ) ; } if ( hw -> txr_free <= QLA_TX_MIN_FREE ) { QLA_TX_UNLOCK ( ha ) ; device_printf ( dev , " \n " , __func__ ) ; return ( -1 ) ; } } tx_cmd = & hw -> tx_ring_base [ hw -> txr_next ] ; bzero ( ( void * ) tx_cmd , sizeof ( q80_tx_cmd_t ) ) ; bcopy ( fw_cmd , tx_cmd , size ) ; hw -> txr_next = ( hw -> txr_next + 1 ) & ( NUM_TX_DESCRIPTORS - 1 ) ; hw -> txr_free -- ; QL_UPDATE_TX_PRODUCER_INDEX ( ha , hw -> txr_next ) ; QLA_TX_UNLOCK ( ha ) ; return ( 0 ) ; }
Name: qla_fw_cmd
 Function: Issues firmware control commands on the Tx Ring.
Name : qla_fw_cmd Function : Issues firmware control commands on the Tx Ring .