# How does FreeBSD make use of SATA's NCQ?



## coopci (Mar 4, 2009)

It seems that the ata requests are always software-sorted in ata_queue_request(/sys/dev/ata/Ata-queue.c) unless (ch->state & ATA_STALL_QUEUE). And this process has nothing to do with specific HBA driver. So I can't image how FreeBSD makes use of SATA's NCQ.


----------



## trev (Mar 4, 2009)

This came up on one of the mailing lists mid-last year and the answer then was FreeBSD makes no use of NCQ as soren@ needed to add it code to the FreeBSD driver to make use of it and soren@ was otherwise busy with life.

I've seen no updates since though.


----------



## coopci (Mar 4, 2009)

trev said:
			
		

> This came up on one of the mailing lists mid-last year and the answer then was FreeBSD makes no use of NCQ as soren@ needed to add it code to the FreeBSD driver to make use of it and soren@ was otherwise busy with life.
> 
> I've seen no updates since though.



Thanks..... Does that mean I must modify ata-layer in addition to write a driver with NCQ to enable this feature?


----------



## Maledictus (Mar 12, 2009)

Seems so.


----------



## trasz@ (Feb 5, 2010)

Note that in FreeBSD 8.0 there is new driver called ahci(4), which uses CAM (previously used only by SCSI drives) instead of the old ata(4) infrastructure.  One of the advantages over ata(4) is the efficient use of NCQ.  This is still being improved in FreeBSD-CURRENT, but what's in 8.0 works very well already.


----------

