diff options
| author | Jens Axboe <axboe@kernel.dk> | 2018-05-11 14:51:09 -0400 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2018-05-11 16:10:44 -0400 |
| commit | 28361c403683c2b00d4f5e76045f3ccd299bf99d (patch) | |
| tree | bcfd75dd3334fb180bdfd81669f4caa8189c1685 /include/linux/libata.h | |
| parent | ba80c3a572f4db2153a1a94c02f27a4566ca0995 (diff) | |
libata: add extra internal command
Bump the internal tag to 32, instead of stealing the last tag in
our regular command space. This works just fine, since we don't
actually need a separate hardware tag for this. Internal commands
cannot coexist with NCQ commands.
As a bonus, we get rid of the special casing of what tag to use
for the internal command.
This is in preparation for utilizing all 32 commands for normal IO.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 60ce1ba26fdd..1d026719461b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -125,9 +125,8 @@ enum { | |||
| 125 | LIBATA_MAX_PRD = ATA_MAX_PRD / 2, | 125 | LIBATA_MAX_PRD = ATA_MAX_PRD / 2, |
| 126 | LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ | 126 | LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, /* Worst case */ |
| 127 | ATA_DEF_QUEUE = 1, | 127 | ATA_DEF_QUEUE = 1, |
| 128 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | ||
| 129 | ATA_MAX_QUEUE = 32, | 128 | ATA_MAX_QUEUE = 32, |
| 130 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 129 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE, |
| 131 | ATA_SHORT_PAUSE = 16, | 130 | ATA_SHORT_PAUSE = 16, |
| 132 | 131 | ||
| 133 | ATAPI_MAX_DRAIN = 16 << 10, | 132 | ATAPI_MAX_DRAIN = 16 << 10, |
| @@ -850,7 +849,7 @@ struct ata_port { | |||
| 850 | unsigned int udma_mask; | 849 | unsigned int udma_mask; |
| 851 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ | 850 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ |
| 852 | 851 | ||
| 853 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; | 852 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE + 1]; |
| 854 | unsigned long sas_tag_allocated; /* for sas tag allocation only */ | 853 | unsigned long sas_tag_allocated; /* for sas tag allocation only */ |
| 855 | u64 qc_active; | 854 | u64 qc_active; |
| 856 | int nr_active_links; /* #links with active qcs */ | 855 | int nr_active_links; /* #links with active qcs */ |
| @@ -1486,14 +1485,14 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset, | |||
| 1486 | const char *name); | 1485 | const char *name); |
| 1487 | #endif | 1486 | #endif |
| 1488 | 1487 | ||
| 1489 | static inline unsigned int ata_tag_valid(unsigned int tag) | 1488 | static inline bool ata_tag_internal(unsigned int tag) |
| 1490 | { | 1489 | { |
| 1491 | return (tag < ATA_MAX_QUEUE) ? 1 : 0; | 1490 | return tag == ATA_TAG_INTERNAL; |
| 1492 | } | 1491 | } |
| 1493 | 1492 | ||
| 1494 | static inline bool ata_tag_internal(unsigned int tag) | 1493 | static inline bool ata_tag_valid(unsigned int tag) |
| 1495 | { | 1494 | { |
| 1496 | return tag == ATA_TAG_INTERNAL; | 1495 | return tag < ATA_MAX_QUEUE || ata_tag_internal(tag); |
| 1497 | } | 1496 | } |
| 1498 | 1497 | ||
| 1499 | /* | 1498 | /* |
| @@ -1656,7 +1655,7 @@ static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) | |||
| 1656 | static inline struct ata_queued_cmd *__ata_qc_from_tag(struct ata_port *ap, | 1655 | static inline struct ata_queued_cmd *__ata_qc_from_tag(struct ata_port *ap, |
| 1657 | unsigned int tag) | 1656 | unsigned int tag) |
| 1658 | { | 1657 | { |
| 1659 | if (likely(ata_tag_valid(tag))) | 1658 | if (ata_tag_valid(tag)) |
| 1660 | return &ap->qcmd[tag]; | 1659 | return &ap->qcmd[tag]; |
| 1661 | return NULL; | 1660 | return NULL; |
| 1662 | } | 1661 | } |
