FreeBSD/sys/dev/iser/icl_iser.c
/**
 * iser_initialize_headers() - Initialize task headers
 * @pdu:       iser pdu
 * @iser_conn:    iser connection
 *
 * Notes:
 * This routine may race with iser teardown flow for scsi
 * error handling TMFs. So for TMF we should acquire the
 * state mutex to avoid dereferencing the IB device which
 * may have already been terminated (racing teardown sequence).
 */
Initialize task headers
@pdu:       iser pdu
@iser_conn:    iser connection

This routine may race with iser teardown flow for scsi
error handling TMFs. So for TMF we should acquire the
state mutex to avoid dereferencing the IB device which
may have already been terminated (racing teardown sequence).
Initialize task headers @pdu : iser pdu @iser_conn : iser connection This routine may race with iser teardown flow for scsi error handling TMFs . So for TMF we should acquire the state mutex to avoid dereferencing the IB device which may have already been terminated ( racing teardown sequence ) .
int
iser_initialize_headers(struct icl_iser_pdu *pdu, struct iser_conn *iser_conn)
{
	struct iser_tx_desc *tx_desc = &pdu->desc;
	struct iser_device *device = iser_conn->ib_conn.device;
	u64 dma_addr;
	int ret = 0;
	dma_addr = ib_dma_map_single(device->ib_device, (void *)tx_desc,
				ISER_HEADERS_LEN, DMA_TO_DEVICE);
	if (ib_dma_mapping_error(device->ib_device, dma_addr)) {
		ret = -ENOMEM;
		goto out;
	}
	tx_desc->mapped = true;
	tx_desc->dma_addr = dma_addr;
	tx_desc->tx_sg[0].addr   = tx_desc->dma_addr;
	tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
	tx_desc->tx_sg[0].lkey   = device->mr->lkey;
out:
	return (ret);
}
int iser_initialize_headers ( struct icl_iser_pdu * pdu , struct iser_conn * iser_conn ) { struct iser_tx_desc * tx_desc = & pdu -> desc ; struct iser_device * device = iser_conn -> ib_conn . device ; u64 dma_addr ; int ret = 0 ; dma_addr = ib_dma_map_single ( device -> ib_device , ( void * ) tx_desc , ISER_HEADERS_LEN , DMA_TO_DEVICE ) ; if ( ib_dma_mapping_error ( device -> ib_device , dma_addr ) ) { ret = - ENOMEM ; goto out ; } tx_desc -> mapped = true ; tx_desc -> dma_addr = dma_addr ; tx_desc -> tx_sg [ 0 ] . addr = tx_desc -> dma_addr ; tx_desc -> tx_sg [ 0 ] . length = ISER_HEADERS_LEN ; tx_desc -> tx_sg [ 0 ] . lkey = device -> mr -> lkey ; out : return ( ret ) ; }
iser_initialize_headers() - Initialize task headers
 @pdu:       iser pdu
 @iser_conn:    iser connection
iser_initialize_headers () - Initialize task headers @pdu : iser pdu @iser_conn : iser connection