diff options
author | ajit.khaparde@broadcom.com | 2016-02-22 20:03:48 +0100 |
---|---|---|
committer | David S. Miller | 2016-02-24 21:25:19 +0100 |
commit | b0fd2eb28bd47e0c906e31dbaccaf17883e238ff (patch) | |
tree | e3726de0de2bb2527104965bb4928c3607bff823 /drivers/net/ethernet/emulex/benet/be.h | |
parent | Merge branch 'flow_dissector-fixes-and-improvements' (diff) | |
download | kernel-qcow2-linux-b0fd2eb28bd47e0c906e31dbaccaf17883e238ff.tar.gz kernel-qcow2-linux-b0fd2eb28bd47e0c906e31dbaccaf17883e238ff.tar.xz kernel-qcow2-linux-b0fd2eb28bd47e0c906e31dbaccaf17883e238ff.zip |
be2net: Declare some u16 fields as u32 to improve performance
When 16-bit integers are loaded on CPUs with high order native
register sizes, the CPU could use some extra ops before using them.
And currently some of the frequently used fields in the driver like
the producer and consumer indices of the queues are declared as u16.
This patch declares such fields as u32. With this change we see the
64-byte packets per second numbers improve by about 4%.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be.h')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index ab24f84060c6..756f25bd8ee3 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h @@ -124,27 +124,27 @@ struct be_dma_mem { }; struct be_queue_info { + u32 len; + u32 entry_size; /* Size of an element in the queue */ + u32 tail, head; + atomic_t used; /* Number of valid elements in the queue */ + u32 id; struct be_dma_mem dma_mem; - u16 len; - u16 entry_size; /* Size of an element in the queue */ - u16 id; - u16 tail, head; bool created; - atomic_t used; /* Number of valid elements in the queue */ }; -static inline u32 MODULO(u16 val, u16 limit) +static inline u32 MODULO(u32 val, u32 limit) { BUG_ON(limit & (limit - 1)); return val & (limit - 1); } -static inline void index_adv(u16 *index, u16 val, u16 limit) +static inline void index_adv(u32 *index, u32 val, u32 limit) { *index = MODULO((*index + val), limit); } -static inline void index_inc(u16 *index, u16 limit) +static inline void index_inc(u32 *index, u32 limit) { *index = MODULO((*index + 1), limit); } @@ -169,7 +169,7 @@ static inline void queue_head_inc(struct be_queue_info *q) index_inc(&q->head, q->len); } -static inline void index_dec(u16 *index, u16 limit) +static inline void index_dec(u32 *index, u32 limit) { *index = MODULO((*index - 1), limit); } |