aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSteve Glendinning <steve.glendinning@smsc.com>2008-12-16 05:00:00 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 05:00:00 -0500
commite18ce3465477502108187c6c08b6423fb784a313 (patch)
tree7bc788dff1b580e959d51b764e9dd2f78c00a43d /drivers/net
parentf9867328f9e1c3fceb8593f84b980aa1d648ce9c (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')
-rw-r--r--drivers/net/smsc911x.h3
-rw-r--r--drivers/net/smsc9420.h3
-rw-r--r--drivers/net/tg3.c50
-rw-r--r--drivers/net/tg3.h2
-rw-r--r--drivers/net/usb/smsc95xx.c2
5 files changed, 25 insertions, 35 deletions
diff --git a/drivers/net/smsc911x.h b/drivers/net/smsc911x.h
index f818cf0415f7..2b76654bb958 100644
--- a/drivers/net/smsc911x.h
+++ b/drivers/net/smsc911x.h
@@ -61,9 +61,6 @@
61#define SMSC_ASSERT_MAC_LOCK(pdata) do {} while (0) 61#define SMSC_ASSERT_MAC_LOCK(pdata) do {} while (0)
62#endif /* CONFIG_DEBUG_SPINLOCK */ 62#endif /* CONFIG_DEBUG_SPINLOCK */
63 63
64#define FLOW_CTRL_TX (1)
65#define FLOW_CTRL_RX (2)
66
67/* SMSC911x registers and bitfields */ 64/* SMSC911x registers and bitfields */
68#define RX_DATA_FIFO 0x00 65#define RX_DATA_FIFO 0x00
69 66
diff --git a/drivers/net/smsc9420.h b/drivers/net/smsc9420.h
index 80c426dc4325..69c351f93f86 100644
--- a/drivers/net/smsc9420.h
+++ b/drivers/net/smsc9420.h
@@ -45,9 +45,6 @@
45 45
46#define SMSC9420_EEPROM_SIZE ((u32)11) 46#define SMSC9420_EEPROM_SIZE ((u32)11)
47 47
48#define FLOW_CTRL_TX (1)
49#define FLOW_CTRL_RX (2)
50
51#define PKT_BUF_SZ (VLAN_ETH_FRAME_LEN + NET_IP_ALIGN + 4) 48#define PKT_BUF_SZ (VLAN_ETH_FRAME_LEN + NET_IP_ALIGN + 4)
52 49
53/***********************************************/ 50/***********************************************/
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
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 61556764a505..0880cfacdcba 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2338,8 +2338,6 @@ struct tg3_link_config {
2338 u8 duplex; 2338 u8 duplex;
2339 u8 autoneg; 2339 u8 autoneg;
2340 u8 flowctrl; 2340 u8 flowctrl;
2341#define TG3_FLOW_CTRL_TX 0x01
2342#define TG3_FLOW_CTRL_RX 0x02
2343 2341
2344 /* Describes what we actually have. */ 2342 /* Describes what we actually have. */
2345 u8 active_flowctrl; 2343 u8 active_flowctrl;
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 4638a7bb471e..ee2eac3047b3 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -45,8 +45,6 @@
45#define SMSC95XX_INTERNAL_PHY_ID (1) 45#define SMSC95XX_INTERNAL_PHY_ID (1)
46#define SMSC95XX_TX_OVERHEAD (8) 46#define SMSC95XX_TX_OVERHEAD (8)
47#define SMSC95XX_TX_OVERHEAD_CSUM (12) 47#define SMSC95XX_TX_OVERHEAD_CSUM (12)
48#define FLOW_CTRL_TX (1)
49#define FLOW_CTRL_RX (2)
50 48
51struct smsc95xx_priv { 49struct smsc95xx_priv {
52 u32 mac_cr; 50 u32 mac_cr;