diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-02-23 05:42:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-25 02:50:01 -0500 |
commit | 49f2186d36a88ae6f7dd8261aff2cf80409af28d (patch) | |
tree | 150c5ae20128158903b3299aa0b30f4a58d2077a /drivers/net/qlge/qlge_main.c | |
parent | 8587ea35ca6b4add4353b8a18b67d358aed0389e (diff) |
qlge: Optimize rx buffer refill process.
RX Buffers are refilled in chunks of 16 at a time before notifying the
hardware with a register write. This can cause several writes to take
place in a given napi poll call. This change causes the write to take place
only once at the end of the call.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge/qlge_main.c')
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 16c056a62fc..17198459918 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -863,7 +863,8 @@ static void ql_write_cq_idx(struct rx_ring *rx_ring) | |||
863 | /* Process (refill) a large buffer queue. */ | 863 | /* Process (refill) a large buffer queue. */ |
864 | static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | 864 | static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) |
865 | { | 865 | { |
866 | int clean_idx = rx_ring->lbq_clean_idx; | 866 | u32 clean_idx = rx_ring->lbq_clean_idx; |
867 | u32 start_idx = clean_idx; | ||
867 | struct bq_desc *lbq_desc; | 868 | struct bq_desc *lbq_desc; |
868 | u64 map; | 869 | u64 map; |
869 | int i; | 870 | int i; |
@@ -910,19 +911,23 @@ static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | |||
910 | rx_ring->lbq_prod_idx += 16; | 911 | rx_ring->lbq_prod_idx += 16; |
911 | if (rx_ring->lbq_prod_idx == rx_ring->lbq_len) | 912 | if (rx_ring->lbq_prod_idx == rx_ring->lbq_len) |
912 | rx_ring->lbq_prod_idx = 0; | 913 | rx_ring->lbq_prod_idx = 0; |
914 | rx_ring->lbq_free_cnt -= 16; | ||
915 | } | ||
916 | |||
917 | if (start_idx != clean_idx) { | ||
913 | QPRINTK(qdev, RX_STATUS, DEBUG, | 918 | QPRINTK(qdev, RX_STATUS, DEBUG, |
914 | "lbq: updating prod idx = %d.\n", | 919 | "lbq: updating prod idx = %d.\n", |
915 | rx_ring->lbq_prod_idx); | 920 | rx_ring->lbq_prod_idx); |
916 | ql_write_db_reg(rx_ring->lbq_prod_idx, | 921 | ql_write_db_reg(rx_ring->lbq_prod_idx, |
917 | rx_ring->lbq_prod_idx_db_reg); | 922 | rx_ring->lbq_prod_idx_db_reg); |
918 | rx_ring->lbq_free_cnt -= 16; | ||
919 | } | 923 | } |
920 | } | 924 | } |
921 | 925 | ||
922 | /* Process (refill) a small buffer queue. */ | 926 | /* Process (refill) a small buffer queue. */ |
923 | static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | 927 | static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) |
924 | { | 928 | { |
925 | int clean_idx = rx_ring->sbq_clean_idx; | 929 | u32 clean_idx = rx_ring->sbq_clean_idx; |
930 | u32 start_idx = clean_idx; | ||
926 | struct bq_desc *sbq_desc; | 931 | struct bq_desc *sbq_desc; |
927 | u64 map; | 932 | u64 map; |
928 | int i; | 933 | int i; |
@@ -972,13 +977,15 @@ static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring) | |||
972 | rx_ring->sbq_prod_idx += 16; | 977 | rx_ring->sbq_prod_idx += 16; |
973 | if (rx_ring->sbq_prod_idx == rx_ring->sbq_len) | 978 | if (rx_ring->sbq_prod_idx == rx_ring->sbq_len) |
974 | rx_ring->sbq_prod_idx = 0; | 979 | rx_ring->sbq_prod_idx = 0; |
980 | rx_ring->sbq_free_cnt -= 16; | ||
981 | } | ||
982 | |||
983 | if (start_idx != clean_idx) { | ||
975 | QPRINTK(qdev, RX_STATUS, DEBUG, | 984 | QPRINTK(qdev, RX_STATUS, DEBUG, |
976 | "sbq: updating prod idx = %d.\n", | 985 | "sbq: updating prod idx = %d.\n", |
977 | rx_ring->sbq_prod_idx); | 986 | rx_ring->sbq_prod_idx); |
978 | ql_write_db_reg(rx_ring->sbq_prod_idx, | 987 | ql_write_db_reg(rx_ring->sbq_prod_idx, |
979 | rx_ring->sbq_prod_idx_db_reg); | 988 | rx_ring->sbq_prod_idx_db_reg); |
980 | |||
981 | rx_ring->sbq_free_cnt -= 16; | ||
982 | } | 989 | } |
983 | } | 990 | } |
984 | 991 | ||