aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index d4c4076cf087..8c381c696a3d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -172,6 +172,23 @@ static void link_report(struct net_device *dev)
172 } 172 }
173} 173}
174 174
175static void enable_tx_fifo_drain(struct adapter *adapter,
176 struct port_info *pi)
177{
178 t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + pi->mac.offset, 0,
179 F_ENDROPPKT);
180 t3_write_reg(adapter, A_XGM_RX_CTRL + pi->mac.offset, 0);
181 t3_write_reg(adapter, A_XGM_TX_CTRL + pi->mac.offset, F_TXEN);
182 t3_write_reg(adapter, A_XGM_RX_CTRL + pi->mac.offset, F_RXEN);
183}
184
185static void disable_tx_fifo_drain(struct adapter *adapter,
186 struct port_info *pi)
187{
188 t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + pi->mac.offset,
189 F_ENDROPPKT, 0);
190}
191
175void t3_os_link_fault(struct adapter *adap, int port_id, int state) 192void t3_os_link_fault(struct adapter *adap, int port_id, int state)
176{ 193{
177 struct net_device *dev = adap->port[port_id]; 194 struct net_device *dev = adap->port[port_id];
@@ -185,6 +202,8 @@ void t3_os_link_fault(struct adapter *adap, int port_id, int state)
185 202
186 netif_carrier_on(dev); 203 netif_carrier_on(dev);
187 204
205 disable_tx_fifo_drain(adap, pi);
206
188 /* Clear local faults */ 207 /* Clear local faults */
189 t3_xgm_intr_disable(adap, pi->port_id); 208 t3_xgm_intr_disable(adap, pi->port_id);
190 t3_read_reg(adap, A_XGM_INT_STATUS + 209 t3_read_reg(adap, A_XGM_INT_STATUS +
@@ -200,9 +219,12 @@ void t3_os_link_fault(struct adapter *adap, int port_id, int state)
200 t3_xgm_intr_enable(adap, pi->port_id); 219 t3_xgm_intr_enable(adap, pi->port_id);
201 220
202 t3_mac_enable(mac, MAC_DIRECTION_TX); 221 t3_mac_enable(mac, MAC_DIRECTION_TX);
203 } else 222 } else {
204 netif_carrier_off(dev); 223 netif_carrier_off(dev);
205 224
225 /* Flush TX FIFO */
226 enable_tx_fifo_drain(adap, pi);
227 }
206 link_report(dev); 228 link_report(dev);
207} 229}
208 230
@@ -232,6 +254,8 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
232 254
233 if (link_stat != netif_carrier_ok(dev)) { 255 if (link_stat != netif_carrier_ok(dev)) {
234 if (link_stat) { 256 if (link_stat) {
257 disable_tx_fifo_drain(adapter, pi);
258
235 t3_mac_enable(mac, MAC_DIRECTION_RX); 259 t3_mac_enable(mac, MAC_DIRECTION_RX);
236 260
237 /* Clear local faults */ 261 /* Clear local faults */
@@ -263,6 +287,9 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
263 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); 287 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset);
264 t3_mac_disable(mac, MAC_DIRECTION_RX); 288 t3_mac_disable(mac, MAC_DIRECTION_RX);
265 t3_link_start(&pi->phy, mac, &pi->link_config); 289 t3_link_start(&pi->phy, mac, &pi->link_config);
290
291 /* Flush TX FIFO */
292 enable_tx_fifo_drain(adapter, pi);
266 } 293 }
267 294
268 link_report(dev); 295 link_report(dev);