diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-09-05 18:58:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:05 -0400 |
commit | bb9366af7b4addb27156585baccadc4b6d30f223 (patch) | |
tree | 2d22b563a7d4b531aa550e068aaae658a2d2fc08 | |
parent | 1c17ae8af93bed203d9760702882e9f747a51912 (diff) |
cxgb3 - CQ context operations time out too soon.
Currently, the driver only tries up to 5 times (5us) to get the results
of a CQ context operation. Testing has shown the chip can take as much
as 50us to return the response on SG_CONTEXT_CMD operations. So we up
the retry count to 100 to cover high loads.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index bff1d028a96b..058329321440 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1870,6 +1870,8 @@ void t3_port_intr_clear(struct adapter *adapter, int idx) | |||
1870 | phy->ops->intr_clear(phy); | 1870 | phy->ops->intr_clear(phy); |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | #define SG_CONTEXT_CMD_ATTEMPTS 100 | ||
1874 | |||
1873 | /** | 1875 | /** |
1874 | * t3_sge_write_context - write an SGE context | 1876 | * t3_sge_write_context - write an SGE context |
1875 | * @adapter: the adapter | 1877 | * @adapter: the adapter |
@@ -1889,7 +1891,7 @@ static int t3_sge_write_context(struct adapter *adapter, unsigned int id, | |||
1889 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 1891 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
1890 | V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id)); | 1892 | V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id)); |
1891 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 1893 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
1892 | 0, 5, 1); | 1894 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
1893 | } | 1895 | } |
1894 | 1896 | ||
1895 | /** | 1897 | /** |
@@ -2075,7 +2077,7 @@ int t3_sge_enable_ecntxt(struct adapter *adapter, unsigned int id, int enable) | |||
2075 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2077 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2076 | V_CONTEXT_CMD_OPCODE(1) | F_EGRESS | V_CONTEXT(id)); | 2078 | V_CONTEXT_CMD_OPCODE(1) | F_EGRESS | V_CONTEXT(id)); |
2077 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2079 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2078 | 0, 5, 1); | 2080 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
2079 | } | 2081 | } |
2080 | 2082 | ||
2081 | /** | 2083 | /** |
@@ -2099,7 +2101,7 @@ int t3_sge_disable_fl(struct adapter *adapter, unsigned int id) | |||
2099 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2101 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2100 | V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id)); | 2102 | V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id)); |
2101 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2103 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2102 | 0, 5, 1); | 2104 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
2103 | } | 2105 | } |
2104 | 2106 | ||
2105 | /** | 2107 | /** |
@@ -2123,7 +2125,7 @@ int t3_sge_disable_rspcntxt(struct adapter *adapter, unsigned int id) | |||
2123 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2125 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2124 | V_CONTEXT_CMD_OPCODE(1) | F_RESPONSEQ | V_CONTEXT(id)); | 2126 | V_CONTEXT_CMD_OPCODE(1) | F_RESPONSEQ | V_CONTEXT(id)); |
2125 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2127 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2126 | 0, 5, 1); | 2128 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
2127 | } | 2129 | } |
2128 | 2130 | ||
2129 | /** | 2131 | /** |
@@ -2147,7 +2149,7 @@ int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id) | |||
2147 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2149 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2148 | V_CONTEXT_CMD_OPCODE(1) | F_CQ | V_CONTEXT(id)); | 2150 | V_CONTEXT_CMD_OPCODE(1) | F_CQ | V_CONTEXT(id)); |
2149 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2151 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2150 | 0, 5, 1); | 2152 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
2151 | } | 2153 | } |
2152 | 2154 | ||
2153 | /** | 2155 | /** |
@@ -2172,7 +2174,7 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, | |||
2172 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(op) | | 2174 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(op) | |
2173 | V_CONTEXT(id) | F_CQ); | 2175 | V_CONTEXT(id) | F_CQ); |
2174 | if (t3_wait_op_done_val(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2176 | if (t3_wait_op_done_val(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2175 | 0, 5, 1, &val)) | 2177 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1, &val)) |
2176 | return -EIO; | 2178 | return -EIO; |
2177 | 2179 | ||
2178 | if (op >= 2 && op < 7) { | 2180 | if (op >= 2 && op < 7) { |
@@ -2182,7 +2184,8 @@ int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, | |||
2182 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2184 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2183 | V_CONTEXT_CMD_OPCODE(0) | F_CQ | V_CONTEXT(id)); | 2185 | V_CONTEXT_CMD_OPCODE(0) | F_CQ | V_CONTEXT(id)); |
2184 | if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, | 2186 | if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, |
2185 | F_CONTEXT_CMD_BUSY, 0, 5, 1)) | 2187 | F_CONTEXT_CMD_BUSY, 0, |
2188 | SG_CONTEXT_CMD_ATTEMPTS, 1)) | ||
2186 | return -EIO; | 2189 | return -EIO; |
2187 | return G_CQ_INDEX(t3_read_reg(adapter, A_SG_CONTEXT_DATA0)); | 2190 | return G_CQ_INDEX(t3_read_reg(adapter, A_SG_CONTEXT_DATA0)); |
2188 | } | 2191 | } |
@@ -2208,7 +2211,7 @@ static int t3_sge_read_context(unsigned int type, struct adapter *adapter, | |||
2208 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2211 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2209 | V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id)); | 2212 | V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id)); |
2210 | if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0, | 2213 | if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0, |
2211 | 5, 1)) | 2214 | SG_CONTEXT_CMD_ATTEMPTS, 1)) |
2212 | return -EIO; | 2215 | return -EIO; |
2213 | data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0); | 2216 | data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0); |
2214 | data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1); | 2217 | data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1); |