diff options
author | Steve Glendinning <steve.glendinning@smsc.com> | 2008-12-16 05:00:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-16 05:00:00 -0500 |
commit | e18ce3465477502108187c6c08b6423fb784a313 (patch) | |
tree | 7bc788dff1b580e959d51b764e9dd2f78c00a43d /drivers/net/tg3.c | |
parent | f9867328f9e1c3fceb8593f84b980aa1d648ce9c (diff) |
net: Move flow control definitions to mii.h
flags used within drivers for indicating tx and rx flow control are
defined in 4 drivers (and probably more), move these constants to mii.h.
The 3 SMSC drivers use the same constants (FLOW_CTRL_TX), but TG3 uses
TG3_FLOW_CTRL_TX, so this patch also renames the constants within TG3.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 6e40d52107a4..f353f69caeb8 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -1187,9 +1187,9 @@ static void tg3_link_report(struct tg3 *tp) | |||
1187 | printk(KERN_INFO PFX | 1187 | printk(KERN_INFO PFX |
1188 | "%s: Flow control is %s for TX and %s for RX.\n", | 1188 | "%s: Flow control is %s for TX and %s for RX.\n", |
1189 | tp->dev->name, | 1189 | tp->dev->name, |
1190 | (tp->link_config.active_flowctrl & TG3_FLOW_CTRL_TX) ? | 1190 | (tp->link_config.active_flowctrl & FLOW_CTRL_TX) ? |
1191 | "on" : "off", | 1191 | "on" : "off", |
1192 | (tp->link_config.active_flowctrl & TG3_FLOW_CTRL_RX) ? | 1192 | (tp->link_config.active_flowctrl & FLOW_CTRL_RX) ? |
1193 | "on" : "off"); | 1193 | "on" : "off"); |
1194 | tg3_ump_link_report(tp); | 1194 | tg3_ump_link_report(tp); |
1195 | } | 1195 | } |
@@ -1199,11 +1199,11 @@ static u16 tg3_advert_flowctrl_1000T(u8 flow_ctrl) | |||
1199 | { | 1199 | { |
1200 | u16 miireg; | 1200 | u16 miireg; |
1201 | 1201 | ||
1202 | if ((flow_ctrl & TG3_FLOW_CTRL_TX) && (flow_ctrl & TG3_FLOW_CTRL_RX)) | 1202 | if ((flow_ctrl & FLOW_CTRL_TX) && (flow_ctrl & FLOW_CTRL_RX)) |
1203 | miireg = ADVERTISE_PAUSE_CAP; | 1203 | miireg = ADVERTISE_PAUSE_CAP; |
1204 | else if (flow_ctrl & TG3_FLOW_CTRL_TX) | 1204 | else if (flow_ctrl & FLOW_CTRL_TX) |
1205 | miireg = ADVERTISE_PAUSE_ASYM; | 1205 | miireg = ADVERTISE_PAUSE_ASYM; |
1206 | else if (flow_ctrl & TG3_FLOW_CTRL_RX) | 1206 | else if (flow_ctrl & FLOW_CTRL_RX) |
1207 | miireg = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | 1207 | miireg = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
1208 | else | 1208 | else |
1209 | miireg = 0; | 1209 | miireg = 0; |
@@ -1215,11 +1215,11 @@ static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) | |||
1215 | { | 1215 | { |
1216 | u16 miireg; | 1216 | u16 miireg; |
1217 | 1217 | ||
1218 | if ((flow_ctrl & TG3_FLOW_CTRL_TX) && (flow_ctrl & TG3_FLOW_CTRL_RX)) | 1218 | if ((flow_ctrl & FLOW_CTRL_TX) && (flow_ctrl & FLOW_CTRL_RX)) |
1219 | miireg = ADVERTISE_1000XPAUSE; | 1219 | miireg = ADVERTISE_1000XPAUSE; |
1220 | else if (flow_ctrl & TG3_FLOW_CTRL_TX) | 1220 | else if (flow_ctrl & FLOW_CTRL_TX) |
1221 | miireg = ADVERTISE_1000XPSE_ASYM; | 1221 | miireg = ADVERTISE_1000XPSE_ASYM; |
1222 | else if (flow_ctrl & TG3_FLOW_CTRL_RX) | 1222 | else if (flow_ctrl & FLOW_CTRL_RX) |
1223 | miireg = ADVERTISE_1000XPAUSE | ADVERTISE_1000XPSE_ASYM; | 1223 | miireg = ADVERTISE_1000XPAUSE | ADVERTISE_1000XPSE_ASYM; |
1224 | else | 1224 | else |
1225 | miireg = 0; | 1225 | miireg = 0; |
@@ -1256,16 +1256,16 @@ static u8 tg3_resolve_flowctrl_1000X(u16 lcladv, u16 rmtadv) | |||
1256 | if (lcladv & ADVERTISE_1000XPAUSE) { | 1256 | if (lcladv & ADVERTISE_1000XPAUSE) { |
1257 | if (lcladv & ADVERTISE_1000XPSE_ASYM) { | 1257 | if (lcladv & ADVERTISE_1000XPSE_ASYM) { |
1258 | if (rmtadv & LPA_1000XPAUSE) | 1258 | if (rmtadv & LPA_1000XPAUSE) |
1259 | cap = TG3_FLOW_CTRL_TX | TG3_FLOW_CTRL_RX; | 1259 | cap = FLOW_CTRL_TX | FLOW_CTRL_RX; |
1260 | else if (rmtadv & LPA_1000XPAUSE_ASYM) | 1260 | else if (rmtadv & LPA_1000XPAUSE_ASYM) |
1261 | cap = TG3_FLOW_CTRL_RX; | 1261 | cap = FLOW_CTRL_RX; |
1262 | } else { | 1262 | } else { |
1263 | if (rmtadv & LPA_1000XPAUSE) | 1263 | if (rmtadv & LPA_1000XPAUSE) |
1264 | cap = TG3_FLOW_CTRL_TX | TG3_FLOW_CTRL_RX; | 1264 | cap = FLOW_CTRL_TX | FLOW_CTRL_RX; |
1265 | } | 1265 | } |
1266 | } else if (lcladv & ADVERTISE_1000XPSE_ASYM) { | 1266 | } else if (lcladv & ADVERTISE_1000XPSE_ASYM) { |
1267 | if ((rmtadv & LPA_1000XPAUSE) && (rmtadv & LPA_1000XPAUSE_ASYM)) | 1267 | if ((rmtadv & LPA_1000XPAUSE) && (rmtadv & LPA_1000XPAUSE_ASYM)) |
1268 | cap = TG3_FLOW_CTRL_TX; | 1268 | cap = FLOW_CTRL_TX; |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | return cap; | 1271 | return cap; |
@@ -1294,7 +1294,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv) | |||
1294 | 1294 | ||
1295 | tp->link_config.active_flowctrl = flowctrl; | 1295 | tp->link_config.active_flowctrl = flowctrl; |
1296 | 1296 | ||
1297 | if (flowctrl & TG3_FLOW_CTRL_RX) | 1297 | if (flowctrl & FLOW_CTRL_RX) |
1298 | tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; | 1298 | tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; |
1299 | else | 1299 | else |
1300 | tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE; | 1300 | tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE; |
@@ -1302,7 +1302,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv) | |||
1302 | if (old_rx_mode != tp->rx_mode) | 1302 | if (old_rx_mode != tp->rx_mode) |
1303 | tw32_f(MAC_RX_MODE, tp->rx_mode); | 1303 | tw32_f(MAC_RX_MODE, tp->rx_mode); |
1304 | 1304 | ||
1305 | if (flowctrl & TG3_FLOW_CTRL_TX) | 1305 | if (flowctrl & FLOW_CTRL_TX) |
1306 | tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE; | 1306 | tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE; |
1307 | else | 1307 | else |
1308 | tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE; | 1308 | tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE; |
@@ -9419,12 +9419,12 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
9419 | 9419 | ||
9420 | epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; | 9420 | epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; |
9421 | 9421 | ||
9422 | if (tp->link_config.active_flowctrl & TG3_FLOW_CTRL_RX) | 9422 | if (tp->link_config.active_flowctrl & FLOW_CTRL_RX) |
9423 | epause->rx_pause = 1; | 9423 | epause->rx_pause = 1; |
9424 | else | 9424 | else |
9425 | epause->rx_pause = 0; | 9425 | epause->rx_pause = 0; |
9426 | 9426 | ||
9427 | if (tp->link_config.active_flowctrl & TG3_FLOW_CTRL_TX) | 9427 | if (tp->link_config.active_flowctrl & FLOW_CTRL_TX) |
9428 | epause->tx_pause = 1; | 9428 | epause->tx_pause = 1; |
9429 | else | 9429 | else |
9430 | epause->tx_pause = 0; | 9430 | epause->tx_pause = 0; |
@@ -9475,14 +9475,14 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
9475 | } | 9475 | } |
9476 | } else { | 9476 | } else { |
9477 | if (epause->rx_pause) | 9477 | if (epause->rx_pause) |
9478 | tp->link_config.flowctrl |= TG3_FLOW_CTRL_RX; | 9478 | tp->link_config.flowctrl |= FLOW_CTRL_RX; |
9479 | else | 9479 | else |
9480 | tp->link_config.flowctrl &= ~TG3_FLOW_CTRL_RX; | 9480 | tp->link_config.flowctrl &= ~FLOW_CTRL_RX; |
9481 | 9481 | ||
9482 | if (epause->tx_pause) | 9482 | if (epause->tx_pause) |
9483 | tp->link_config.flowctrl |= TG3_FLOW_CTRL_TX; | 9483 | tp->link_config.flowctrl |= FLOW_CTRL_TX; |
9484 | else | 9484 | else |
9485 | tp->link_config.flowctrl &= ~TG3_FLOW_CTRL_TX; | 9485 | tp->link_config.flowctrl &= ~FLOW_CTRL_TX; |
9486 | 9486 | ||
9487 | if (netif_running(dev)) | 9487 | if (netif_running(dev)) |
9488 | tg3_setup_flow_control(tp, 0, 0); | 9488 | tg3_setup_flow_control(tp, 0, 0); |
@@ -9502,13 +9502,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
9502 | else | 9502 | else |
9503 | tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG; | 9503 | tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG; |
9504 | if (epause->rx_pause) | 9504 | if (epause->rx_pause) |
9505 | tp->link_config.flowctrl |= TG3_FLOW_CTRL_RX; | 9505 | tp->link_config.flowctrl |= FLOW_CTRL_RX; |
9506 | else | 9506 | else |
9507 | tp->link_config.flowctrl &= ~TG3_FLOW_CTRL_RX; | 9507 | tp->link_config.flowctrl &= ~FLOW_CTRL_RX; |
9508 | if (epause->tx_pause) | 9508 | if (epause->tx_pause) |
9509 | tp->link_config.flowctrl |= TG3_FLOW_CTRL_TX; | 9509 | tp->link_config.flowctrl |= FLOW_CTRL_TX; |
9510 | else | 9510 | else |
9511 | tp->link_config.flowctrl &= ~TG3_FLOW_CTRL_TX; | 9511 | tp->link_config.flowctrl &= ~FLOW_CTRL_TX; |
9512 | 9512 | ||
9513 | if (netif_running(dev)) { | 9513 | if (netif_running(dev)) { |
9514 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); | 9514 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); |
@@ -13849,7 +13849,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
13849 | 13849 | ||
13850 | /* flow control autonegotiation is default behavior */ | 13850 | /* flow control autonegotiation is default behavior */ |
13851 | tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; | 13851 | tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; |
13852 | tp->link_config.flowctrl = TG3_FLOW_CTRL_TX | TG3_FLOW_CTRL_RX; | 13852 | tp->link_config.flowctrl = FLOW_CTRL_TX | FLOW_CTRL_RX; |
13853 | 13853 | ||
13854 | tg3_init_coal(tp); | 13854 | tg3_init_coal(tp); |
13855 | 13855 | ||