Commit 2a46fa13 authored by Dan Williams's avatar Dan Williams

iop_adma: cleanup iop_chan_xor_slot_count

- use a table for iop13xx, trade text for data
- shrink the iop3xx to a cache line
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 5eb907aa
...@@ -198,17 +198,13 @@ iop_chan_memset_slot_count(size_t len, int *slots_per_op) ...@@ -198,17 +198,13 @@ iop_chan_memset_slot_count(size_t len, int *slots_per_op)
static inline int static inline int
iop_chan_xor_slot_count(size_t len, int src_cnt, int *slots_per_op) iop_chan_xor_slot_count(size_t len, int src_cnt, int *slots_per_op)
{ {
int num_slots; static const char slot_count_table[] = { 1, 2, 2, 2,
/* slots_to_find = 1 for basic descriptor + 1 per 4 sources above 1 2, 3, 3, 3,
* (1 source => 8 bytes) (1 slot => 32 bytes) 3, 4, 4, 4,
*/ 4, 5, 5, 5,
num_slots = 1 + (((src_cnt - 1) << 3) >> 5); };
if (((src_cnt - 1) << 3) & 0x1f) *slots_per_op = slot_count_table[src_cnt - 1];
num_slots++; return *slots_per_op;
*slots_per_op = num_slots;
return num_slots;
} }
#define ADMA_MAX_BYTE_COUNT (16 * 1024 * 1024) #define ADMA_MAX_BYTE_COUNT (16 * 1024 * 1024)
......
...@@ -260,7 +260,7 @@ static inline int iop_chan_memset_slot_count(size_t len, int *slots_per_op) ...@@ -260,7 +260,7 @@ static inline int iop_chan_memset_slot_count(size_t len, int *slots_per_op)
static inline int iop3xx_aau_xor_slot_count(size_t len, int src_cnt, static inline int iop3xx_aau_xor_slot_count(size_t len, int src_cnt,
int *slots_per_op) int *slots_per_op)
{ {
static const int slot_count_table[] = { 0, static const char slot_count_table[] = {
1, 1, 1, 1, /* 01 - 04 */ 1, 1, 1, 1, /* 01 - 04 */
2, 2, 2, 2, /* 05 - 08 */ 2, 2, 2, 2, /* 05 - 08 */
4, 4, 4, 4, /* 09 - 12 */ 4, 4, 4, 4, /* 09 - 12 */
...@@ -270,7 +270,7 @@ static inline int iop3xx_aau_xor_slot_count(size_t len, int src_cnt, ...@@ -270,7 +270,7 @@ static inline int iop3xx_aau_xor_slot_count(size_t len, int src_cnt,
8, 8, 8, 8, /* 25 - 28 */ 8, 8, 8, 8, /* 25 - 28 */
8, 8, 8, 8, /* 29 - 32 */ 8, 8, 8, 8, /* 29 - 32 */
}; };
*slots_per_op = slot_count_table[src_cnt]; *slots_per_op = slot_count_table[src_cnt - 1];
return *slots_per_op; return *slots_per_op;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment