aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-09-01 07:46:50 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-03 09:53:45 -0400
commitdc8cfa55da8c21e0b3290c29677a9d05c0a3e595 (patch)
treea4c8bedad12a15d1e7c9fcfc99f873280ca644b4 /drivers
parentcc12dac2e512c2b6185ed91899e09e9910630315 (diff)
sfc: Use explicit bool for boolean variables, parameters and return values
Replace (cond ? 1 : 0) with cond or !!cond as appropriate, and (cond ? 0 : 1) with !cond. Remove some redundant boolean temporaries. Rename one field that looks like a flag but isn't. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sfc/boards.c12
-rw-r--r--drivers/net/sfc/efx.c47
-rw-r--r--drivers/net/sfc/efx.h6
-rw-r--r--drivers/net/sfc/enum.h9
-rw-r--r--drivers/net/sfc/ethtool.c8
-rw-r--r--drivers/net/sfc/falcon.c50
-rw-r--r--drivers/net/sfc/falcon.h2
-rw-r--r--drivers/net/sfc/falcon_xmac.c63
-rw-r--r--drivers/net/sfc/mdio_10g.c12
-rw-r--r--drivers/net/sfc/mdio_10g.h11
-rw-r--r--drivers/net/sfc/net_driver.h36
-rw-r--r--drivers/net/sfc/phy.h2
-rw-r--r--drivers/net/sfc/rx.c14
-rw-r--r--drivers/net/sfc/rx.h2
-rw-r--r--drivers/net/sfc/selftest.c15
-rw-r--r--drivers/net/sfc/tenxpress.c28
-rw-r--r--drivers/net/sfc/tx.c32
-rw-r--r--drivers/net/sfc/xfp_phy.c4
18 files changed, 175 insertions, 178 deletions
diff --git a/drivers/net/sfc/boards.c b/drivers/net/sfc/boards.c
index d3d3dd0a1170..99e602373269 100644
--- a/drivers/net/sfc/boards.c
+++ b/drivers/net/sfc/boards.c
@@ -31,23 +31,23 @@ static void blink_led_timer(unsigned long context)
31 mod_timer(&bl->timer, jiffies + BLINK_INTERVAL); 31 mod_timer(&bl->timer, jiffies + BLINK_INTERVAL);
32} 32}
33 33
34static void board_blink(struct efx_nic *efx, int blink) 34static void board_blink(struct efx_nic *efx, bool blink)
35{ 35{
36 struct efx_blinker *blinker = &efx->board_info.blinker; 36 struct efx_blinker *blinker = &efx->board_info.blinker;
37 37
38 /* The rtnl mutex serialises all ethtool ioctls, so 38 /* The rtnl mutex serialises all ethtool ioctls, so
39 * nothing special needs doing here. */ 39 * nothing special needs doing here. */
40 if (blink) { 40 if (blink) {
41 blinker->resubmit = 1; 41 blinker->resubmit = true;
42 blinker->state = 0; 42 blinker->state = false;
43 setup_timer(&blinker->timer, blink_led_timer, 43 setup_timer(&blinker->timer, blink_led_timer,
44 (unsigned long)efx); 44 (unsigned long)efx);
45 mod_timer(&blinker->timer, jiffies + BLINK_INTERVAL); 45 mod_timer(&blinker->timer, jiffies + BLINK_INTERVAL);
46 } else { 46 } else {
47 blinker->resubmit = 0; 47 blinker->resubmit = false;
48 if (blinker->timer.function) 48 if (blinker->timer.function)
49 del_timer_sync(&blinker->timer); 49 del_timer_sync(&blinker->timer);
50 efx->board_info.set_fault_led(efx, 0); 50 efx->board_info.set_fault_led(efx, false);
51 } 51 }
52} 52}
53 53
@@ -78,7 +78,7 @@ static int sfe4002_init_leds(struct efx_nic *efx)
78 return 0; 78 return 0;
79} 79}
80 80
81static void sfe4002_fault_led(struct efx_nic *efx, int state) 81static void sfe4002_fault_led(struct efx_nic *efx, bool state)
82{ 82{
83 xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON : 83 xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON :
84 QUAKE_LED_OFF); 84 QUAKE_LED_OFF);
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index d3b76bd58094..7eb11d32debf 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -51,7 +51,7 @@ static struct workqueue_struct *refill_workqueue;
51 * This sets the default for new devices. It can be controlled later 51 * This sets the default for new devices. It can be controlled later
52 * using ethtool. 52 * using ethtool.
53 */ 53 */
54static int lro = 1; 54static int lro = true;
55module_param(lro, int, 0644); 55module_param(lro, int, 0644);
56MODULE_PARM_DESC(lro, "Large receive offload acceleration"); 56MODULE_PARM_DESC(lro, "Large receive offload acceleration");
57 57
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(lro, "Large receive offload acceleration");
64 * This is forced to 0 for MSI interrupt mode as the interrupt vector 64 * This is forced to 0 for MSI interrupt mode as the interrupt vector
65 * is not written 65 * is not written
66 */ 66 */
67static unsigned int separate_tx_and_rx_channels = 1; 67static unsigned int separate_tx_and_rx_channels = true;
68 68
69/* This is the weight assigned to each of the (per-channel) virtual 69/* This is the weight assigned to each of the (per-channel) virtual
70 * NAPI devices. 70 * NAPI devices.
@@ -80,7 +80,7 @@ unsigned int efx_monitor_interval = 1 * HZ;
80/* This controls whether or not the hardware monitor will trigger a 80/* This controls whether or not the hardware monitor will trigger a
81 * reset when it detects an error condition. 81 * reset when it detects an error condition.
82 */ 82 */
83static unsigned int monitor_reset = 1; 83static unsigned int monitor_reset = true;
84 84
85/* This controls whether or not the driver will initialise devices 85/* This controls whether or not the driver will initialise devices
86 * with invalid MAC addresses stored in the EEPROM or flash. If true, 86 * with invalid MAC addresses stored in the EEPROM or flash. If true,
@@ -202,7 +202,7 @@ static inline void efx_channel_processed(struct efx_channel *channel)
202 /* The interrupt handler for this channel may set work_pending 202 /* The interrupt handler for this channel may set work_pending
203 * as soon as we acknowledge the events we've seen. Make sure 203 * as soon as we acknowledge the events we've seen. Make sure
204 * it's cleared before then. */ 204 * it's cleared before then. */
205 channel->work_pending = 0; 205 channel->work_pending = false;
206 smp_wmb(); 206 smp_wmb();
207 207
208 falcon_eventq_read_ack(channel); 208 falcon_eventq_read_ack(channel);
@@ -431,8 +431,8 @@ static void efx_start_channel(struct efx_channel *channel)
431 /* The interrupt handler for this channel may set work_pending 431 /* The interrupt handler for this channel may set work_pending
432 * as soon as we enable it. Make sure it's cleared before 432 * as soon as we enable it. Make sure it's cleared before
433 * then. Similarly, make sure it sees the enabled flag set. */ 433 * then. Similarly, make sure it sees the enabled flag set. */
434 channel->work_pending = 0; 434 channel->work_pending = false;
435 channel->enabled = 1; 435 channel->enabled = true;
436 smp_wmb(); 436 smp_wmb();
437 437
438 napi_enable(&channel->napi_str); 438 napi_enable(&channel->napi_str);
@@ -455,7 +455,7 @@ static void efx_stop_channel(struct efx_channel *channel)
455 455
456 EFX_LOG(channel->efx, "stop chan %d\n", channel->channel); 456 EFX_LOG(channel->efx, "stop chan %d\n", channel->channel);
457 457
458 channel->enabled = 0; 458 channel->enabled = false;
459 napi_disable(&channel->napi_str); 459 napi_disable(&channel->napi_str);
460 460
461 /* Ensure that any worker threads have exited or will be no-ops */ 461 /* Ensure that any worker threads have exited or will be no-ops */
@@ -525,8 +525,6 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay)
525 */ 525 */
526static void efx_link_status_changed(struct efx_nic *efx) 526static void efx_link_status_changed(struct efx_nic *efx)
527{ 527{
528 int carrier_ok;
529
530 /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure 528 /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure
531 * that no events are triggered between unregister_netdev() and the 529 * that no events are triggered between unregister_netdev() and the
532 * driver unloading. A more general condition is that NETDEV_CHANGE 530 * driver unloading. A more general condition is that NETDEV_CHANGE
@@ -534,8 +532,7 @@ static void efx_link_status_changed(struct efx_nic *efx)
534 if (!netif_running(efx->net_dev)) 532 if (!netif_running(efx->net_dev))
535 return; 533 return;
536 534
537 carrier_ok = netif_carrier_ok(efx->net_dev) ? 1 : 0; 535 if (efx->link_up != netif_carrier_ok(efx->net_dev)) {
538 if (efx->link_up != carrier_ok) {
539 efx->n_link_state_changes++; 536 efx->n_link_state_changes++;
540 537
541 if (efx->link_up) 538 if (efx->link_up)
@@ -660,7 +657,7 @@ static int efx_init_port(struct efx_nic *efx)
660 if (rc) 657 if (rc)
661 return rc; 658 return rc;
662 659
663 efx->port_initialized = 1; 660 efx->port_initialized = true;
664 661
665 /* Reconfigure port to program MAC registers */ 662 /* Reconfigure port to program MAC registers */
666 falcon_reconfigure_xmac(efx); 663 falcon_reconfigure_xmac(efx);
@@ -677,7 +674,7 @@ static void efx_start_port(struct efx_nic *efx)
677 BUG_ON(efx->port_enabled); 674 BUG_ON(efx->port_enabled);
678 675
679 mutex_lock(&efx->mac_lock); 676 mutex_lock(&efx->mac_lock);
680 efx->port_enabled = 1; 677 efx->port_enabled = true;
681 __efx_reconfigure_port(efx); 678 __efx_reconfigure_port(efx);
682 mutex_unlock(&efx->mac_lock); 679 mutex_unlock(&efx->mac_lock);
683} 680}
@@ -691,7 +688,7 @@ static void efx_stop_port(struct efx_nic *efx)
691 EFX_LOG(efx, "stop port\n"); 688 EFX_LOG(efx, "stop port\n");
692 689
693 mutex_lock(&efx->mac_lock); 690 mutex_lock(&efx->mac_lock);
694 efx->port_enabled = 0; 691 efx->port_enabled = false;
695 mutex_unlock(&efx->mac_lock); 692 mutex_unlock(&efx->mac_lock);
696 693
697 /* Serialise against efx_set_multicast_list() */ 694 /* Serialise against efx_set_multicast_list() */
@@ -709,9 +706,9 @@ static void efx_fini_port(struct efx_nic *efx)
709 return; 706 return;
710 707
711 falcon_fini_xmac(efx); 708 falcon_fini_xmac(efx);
712 efx->port_initialized = 0; 709 efx->port_initialized = false;
713 710
714 efx->link_up = 0; 711 efx->link_up = false;
715 efx_link_status_changed(efx); 712 efx_link_status_changed(efx);
716} 713}
717 714
@@ -866,7 +863,7 @@ static void efx_probe_interrupts(struct efx_nic *efx)
866 863
867 if (rc == 0) { 864 if (rc == 0) {
868 for (i = 0; i < efx->rss_queues; i++) { 865 for (i = 0; i < efx->rss_queues; i++) {
869 efx->channel[i].has_interrupt = 1; 866 efx->channel[i].has_interrupt = true;
870 efx->channel[i].irq = xentries[i].vector; 867 efx->channel[i].irq = xentries[i].vector;
871 } 868 }
872 } else { 869 } else {
@@ -882,7 +879,7 @@ static void efx_probe_interrupts(struct efx_nic *efx)
882 rc = pci_enable_msi(efx->pci_dev); 879 rc = pci_enable_msi(efx->pci_dev);
883 if (rc == 0) { 880 if (rc == 0) {
884 efx->channel[0].irq = efx->pci_dev->irq; 881 efx->channel[0].irq = efx->pci_dev->irq;
885 efx->channel[0].has_interrupt = 1; 882 efx->channel[0].has_interrupt = true;
886 } else { 883 } else {
887 EFX_ERR(efx, "could not enable MSI\n"); 884 EFX_ERR(efx, "could not enable MSI\n");
888 efx->interrupt_mode = EFX_INT_MODE_LEGACY; 885 efx->interrupt_mode = EFX_INT_MODE_LEGACY;
@@ -894,7 +891,7 @@ static void efx_probe_interrupts(struct efx_nic *efx)
894 efx->rss_queues = 1; 891 efx->rss_queues = 1;
895 /* Every channel is interruptible */ 892 /* Every channel is interruptible */
896 for (i = 0; i < EFX_MAX_CHANNELS; i++) 893 for (i = 0; i < EFX_MAX_CHANNELS; i++)
897 efx->channel[i].has_interrupt = 1; 894 efx->channel[i].has_interrupt = true;
898 efx->legacy_irq = efx->pci_dev->irq; 895 efx->legacy_irq = efx->pci_dev->irq;
899 } 896 }
900} 897}
@@ -935,7 +932,7 @@ static void efx_select_used(struct efx_nic *efx)
935 rx_queue = &efx->rx_queue[i]; 932 rx_queue = &efx->rx_queue[i];
936 933
937 if (i < efx->rss_queues) { 934 if (i < efx->rss_queues) {
938 rx_queue->used = 1; 935 rx_queue->used = true;
939 /* If we allow multiple RX queues per channel 936 /* If we allow multiple RX queues per channel
940 * we need to decide that here 937 * we need to decide that here
941 */ 938 */
@@ -1462,13 +1459,13 @@ static void efx_set_multicast_list(struct net_device *net_dev)
1462 struct efx_nic *efx = netdev_priv(net_dev); 1459 struct efx_nic *efx = netdev_priv(net_dev);
1463 struct dev_mc_list *mc_list = net_dev->mc_list; 1460 struct dev_mc_list *mc_list = net_dev->mc_list;
1464 union efx_multicast_hash *mc_hash = &efx->multicast_hash; 1461 union efx_multicast_hash *mc_hash = &efx->multicast_hash;
1465 int promiscuous; 1462 bool promiscuous;
1466 u32 crc; 1463 u32 crc;
1467 int bit; 1464 int bit;
1468 int i; 1465 int i;
1469 1466
1470 /* Set per-MAC promiscuity flag and reconfigure MAC if necessary */ 1467 /* Set per-MAC promiscuity flag and reconfigure MAC if necessary */
1471 promiscuous = (net_dev->flags & IFF_PROMISC) ? 1 : 0; 1468 promiscuous = !!(net_dev->flags & IFF_PROMISC);
1472 if (efx->promiscuous != promiscuous) { 1469 if (efx->promiscuous != promiscuous) {
1473 efx->promiscuous = promiscuous; 1470 efx->promiscuous = promiscuous;
1474 /* Close the window between efx_stop_port() and efx_flush_all() 1471 /* Close the window between efx_stop_port() and efx_flush_all()
@@ -1801,7 +1798,7 @@ int efx_port_dummy_op_int(struct efx_nic *efx)
1801 return 0; 1798 return 0;
1802} 1799}
1803void efx_port_dummy_op_void(struct efx_nic *efx) {} 1800void efx_port_dummy_op_void(struct efx_nic *efx) {}
1804void efx_port_dummy_op_blink(struct efx_nic *efx, int blink) {} 1801void efx_port_dummy_op_blink(struct efx_nic *efx, bool blink) {}
1805 1802
1806static struct efx_phy_operations efx_dummy_phy_operations = { 1803static struct efx_phy_operations efx_dummy_phy_operations = {
1807 .init = efx_port_dummy_op_int, 1804 .init = efx_port_dummy_op_int,
@@ -1855,7 +1852,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1855 efx->board_info = efx_dummy_board_info; 1852 efx->board_info = efx_dummy_board_info;
1856 1853
1857 efx->net_dev = net_dev; 1854 efx->net_dev = net_dev;
1858 efx->rx_checksum_enabled = 1; 1855 efx->rx_checksum_enabled = true;
1859 spin_lock_init(&efx->netif_stop_lock); 1856 spin_lock_init(&efx->netif_stop_lock);
1860 spin_lock_init(&efx->stats_lock); 1857 spin_lock_init(&efx->stats_lock);
1861 mutex_init(&efx->mac_lock); 1858 mutex_init(&efx->mac_lock);
@@ -1869,7 +1866,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1869 channel->efx = efx; 1866 channel->efx = efx;
1870 channel->channel = i; 1867 channel->channel = i;
1871 channel->evqnum = i; 1868 channel->evqnum = i;
1872 channel->work_pending = 0; 1869 channel->work_pending = false;
1873 } 1870 }
1874 for (i = 0; i < EFX_TX_QUEUE_COUNT; i++) { 1871 for (i = 0; i < EFX_TX_QUEUE_COUNT; i++) {
1875 tx_queue = &efx->tx_queue[i]; 1872 tx_queue = &efx->tx_queue[i];
diff --git a/drivers/net/sfc/efx.h b/drivers/net/sfc/efx.h
index 3b2f69f4a9ab..29a1c5830587 100644
--- a/drivers/net/sfc/efx.h
+++ b/drivers/net/sfc/efx.h
@@ -28,7 +28,7 @@ extern void efx_wake_queue(struct efx_nic *efx);
28/* RX */ 28/* RX */
29extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); 29extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
30extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, 30extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
31 unsigned int len, int checksummed, int discard); 31 unsigned int len, bool checksummed, bool discard);
32extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay); 32extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay);
33 33
34/* Channels */ 34/* Channels */
@@ -50,7 +50,7 @@ extern void efx_hex_dump(const u8 *, unsigned int, const char *);
50/* Dummy PHY ops for PHY drivers */ 50/* Dummy PHY ops for PHY drivers */
51extern int efx_port_dummy_op_int(struct efx_nic *efx); 51extern int efx_port_dummy_op_int(struct efx_nic *efx);
52extern void efx_port_dummy_op_void(struct efx_nic *efx); 52extern void efx_port_dummy_op_void(struct efx_nic *efx);
53extern void efx_port_dummy_op_blink(struct efx_nic *efx, int blink); 53extern void efx_port_dummy_op_blink(struct efx_nic *efx, bool blink);
54 54
55 55
56extern unsigned int efx_monitor_interval; 56extern unsigned int efx_monitor_interval;
@@ -59,7 +59,7 @@ static inline void efx_schedule_channel(struct efx_channel *channel)
59{ 59{
60 EFX_TRACE(channel->efx, "channel %d scheduling NAPI poll on CPU%d\n", 60 EFX_TRACE(channel->efx, "channel %d scheduling NAPI poll on CPU%d\n",
61 channel->channel, raw_smp_processor_id()); 61 channel->channel, raw_smp_processor_id());
62 channel->work_pending = 1; 62 channel->work_pending = true;
63 63
64 netif_rx_schedule(channel->napi_dev, &channel->napi_str); 64 netif_rx_schedule(channel->napi_dev, &channel->napi_str);
65} 65}
diff --git a/drivers/net/sfc/enum.h b/drivers/net/sfc/enum.h
index c53290d08e2b..cec15dbb88e4 100644
--- a/drivers/net/sfc/enum.h
+++ b/drivers/net/sfc/enum.h
@@ -52,12 +52,11 @@ extern const char *efx_loopback_mode_names[];
52#define LOOPBACK_MASK(_efx) \ 52#define LOOPBACK_MASK(_efx) \
53 (1 << (_efx)->loopback_mode) 53 (1 << (_efx)->loopback_mode)
54 54
55#define LOOPBACK_INTERNAL(_efx) \ 55#define LOOPBACK_INTERNAL(_efx) \
56 ((LOOPBACKS_10G_INTERNAL & LOOPBACK_MASK(_efx)) ? 1 : 0) 56 (!!(LOOPBACKS_10G_INTERNAL & LOOPBACK_MASK(_efx)))
57 57
58#define LOOPBACK_OUT_OF(_from, _to, _mask) \ 58#define LOOPBACK_OUT_OF(_from, _to, _mask) \
59 (((LOOPBACK_MASK(_from) & (_mask)) && \ 59 ((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask)))
60 ((LOOPBACK_MASK(_to) & (_mask)) == 0)) ? 1 : 0)
61 60
62/*****************************************************************************/ 61/*****************************************************************************/
63 62
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index ccd82f12456c..6142c3a394bf 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -447,7 +447,7 @@ static int efx_ethtool_set_rx_csum(struct net_device *net_dev, u32 enable)
447 /* No way to stop the hardware doing the checks; we just 447 /* No way to stop the hardware doing the checks; we just
448 * ignore the result. 448 * ignore the result.
449 */ 449 */
450 efx->rx_checksum_enabled = (enable ? 1 : 0); 450 efx->rx_checksum_enabled = !!enable;
451 451
452 return 0; 452 return 0;
453} 453}
@@ -641,9 +641,9 @@ static void efx_ethtool_get_pauseparam(struct net_device *net_dev,
641{ 641{
642 struct efx_nic *efx = netdev_priv(net_dev); 642 struct efx_nic *efx = netdev_priv(net_dev);
643 643
644 pause->rx_pause = (efx->flow_control & EFX_FC_RX) ? 1 : 0; 644 pause->rx_pause = !!(efx->flow_control & EFX_FC_RX);
645 pause->tx_pause = (efx->flow_control & EFX_FC_TX) ? 1 : 0; 645 pause->tx_pause = !!(efx->flow_control & EFX_FC_TX);
646 pause->autoneg = (efx->flow_control & EFX_FC_AUTO) ? 1 : 0; 646 pause->autoneg = !!(efx->flow_control & EFX_FC_AUTO);
647} 647}
648 648
649 649
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 8ee63da25e6c..fb069712222f 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -539,7 +539,7 @@ static int falcon_flush_tx_queue(struct efx_tx_queue *tx_queue)
539 539
540 if (EFX_WORKAROUND_11557(efx)) { 540 if (EFX_WORKAROUND_11557(efx)) {
541 efx_oword_t reg; 541 efx_oword_t reg;
542 int enabled; 542 bool enabled;
543 543
544 falcon_read_table(efx, &reg, efx->type->txd_ptr_tbl_base, 544 falcon_read_table(efx, &reg, efx->type->txd_ptr_tbl_base,
545 tx_queue->queue); 545 tx_queue->queue);
@@ -644,8 +644,8 @@ int falcon_init_rx(struct efx_rx_queue *rx_queue)
644 efx_oword_t rx_desc_ptr; 644 efx_oword_t rx_desc_ptr;
645 struct efx_nic *efx = rx_queue->efx; 645 struct efx_nic *efx = rx_queue->efx;
646 int rc; 646 int rc;
647 int is_b0 = falcon_rev(efx) >= FALCON_REV_B0; 647 bool is_b0 = falcon_rev(efx) >= FALCON_REV_B0;
648 int iscsi_digest_en = is_b0; 648 bool iscsi_digest_en = is_b0;
649 649
650 EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", 650 EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n",
651 rx_queue->queue, rx_queue->rxd.index, 651 rx_queue->queue, rx_queue->rxd.index,
@@ -695,7 +695,8 @@ static int falcon_flush_rx_queue(struct efx_rx_queue *rx_queue)
695 read_ptr = channel->eventq_read_ptr; 695 read_ptr = channel->eventq_read_ptr;
696 for (i = 0; i < FALCON_EVQ_SIZE; ++i) { 696 for (i = 0; i < FALCON_EVQ_SIZE; ++i) {
697 efx_qword_t *event = falcon_event(channel, read_ptr); 697 efx_qword_t *event = falcon_event(channel, read_ptr);
698 int ev_code, ev_sub_code, ev_queue, ev_failed; 698 int ev_code, ev_sub_code, ev_queue;
699 bool ev_failed;
699 if (!falcon_event_present(event)) 700 if (!falcon_event_present(event))
700 break; 701 break;
701 702
@@ -722,7 +723,7 @@ static int falcon_flush_rx_queue(struct efx_rx_queue *rx_queue)
722 723
723 if (EFX_WORKAROUND_11557(efx)) { 724 if (EFX_WORKAROUND_11557(efx)) {
724 efx_oword_t reg; 725 efx_oword_t reg;
725 int enabled; 726 bool enabled;
726 727
727 falcon_read_table(efx, &reg, efx->type->rxd_ptr_tbl_base, 728 falcon_read_table(efx, &reg, efx->type->rxd_ptr_tbl_base,
728 rx_queue->queue); 729 rx_queue->queue);
@@ -851,15 +852,16 @@ static inline void falcon_handle_tx_event(struct efx_channel *channel,
851/* Detect errors included in the rx_evt_pkt_ok bit. */ 852/* Detect errors included in the rx_evt_pkt_ok bit. */
852static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue, 853static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
853 const efx_qword_t *event, 854 const efx_qword_t *event,
854 unsigned *rx_ev_pkt_ok, 855 bool *rx_ev_pkt_ok,
855 int *discard) 856 bool *discard)
856{ 857{
857 struct efx_nic *efx = rx_queue->efx; 858 struct efx_nic *efx = rx_queue->efx;
858 unsigned rx_ev_buf_owner_id_err, rx_ev_ip_hdr_chksum_err; 859 bool rx_ev_buf_owner_id_err, rx_ev_ip_hdr_chksum_err;
859 unsigned rx_ev_tcp_udp_chksum_err, rx_ev_eth_crc_err; 860 bool rx_ev_tcp_udp_chksum_err, rx_ev_eth_crc_err;
860 unsigned rx_ev_frm_trunc, rx_ev_drib_nib, rx_ev_tobe_disc; 861 bool rx_ev_frm_trunc, rx_ev_drib_nib, rx_ev_tobe_disc;
861 unsigned rx_ev_pkt_type, rx_ev_other_err, rx_ev_pause_frm; 862 bool rx_ev_other_err, rx_ev_pause_frm;
862 unsigned rx_ev_ip_frag_err, rx_ev_hdr_type, rx_ev_mcast_pkt; 863 bool rx_ev_ip_frag_err, rx_ev_hdr_type, rx_ev_mcast_pkt;
864 unsigned rx_ev_pkt_type;
863 865
864 rx_ev_hdr_type = EFX_QWORD_FIELD(*event, RX_EV_HDR_TYPE); 866 rx_ev_hdr_type = EFX_QWORD_FIELD(*event, RX_EV_HDR_TYPE);
865 rx_ev_mcast_pkt = EFX_QWORD_FIELD(*event, RX_EV_MCAST_PKT); 867 rx_ev_mcast_pkt = EFX_QWORD_FIELD(*event, RX_EV_MCAST_PKT);
@@ -954,9 +956,9 @@ static inline int falcon_handle_rx_event(struct efx_channel *channel,
954 const efx_qword_t *event) 956 const efx_qword_t *event)
955{ 957{
956 unsigned int rx_ev_q_label, rx_ev_desc_ptr, rx_ev_byte_cnt; 958 unsigned int rx_ev_q_label, rx_ev_desc_ptr, rx_ev_byte_cnt;
957 unsigned int rx_ev_pkt_ok, rx_ev_hdr_type, rx_ev_mcast_pkt; 959 unsigned int rx_ev_hdr_type, rx_ev_mcast_pkt;
958 unsigned expected_ptr; 960 unsigned expected_ptr;
959 int discard = 0, checksummed; 961 bool rx_ev_pkt_ok, discard = false, checksummed;
960 struct efx_rx_queue *rx_queue; 962 struct efx_rx_queue *rx_queue;
961 struct efx_nic *efx = channel->efx; 963 struct efx_nic *efx = channel->efx;
962 964
@@ -985,7 +987,7 @@ static inline int falcon_handle_rx_event(struct efx_channel *channel,
985 } else { 987 } else {
986 falcon_handle_rx_not_ok(rx_queue, event, &rx_ev_pkt_ok, 988 falcon_handle_rx_not_ok(rx_queue, event, &rx_ev_pkt_ok,
987 &discard); 989 &discard);
988 checksummed = 0; 990 checksummed = false;
989 } 991 }
990 992
991 /* Detect multicast packets that didn't match the filter */ 993 /* Detect multicast packets that didn't match the filter */
@@ -995,7 +997,7 @@ static inline int falcon_handle_rx_event(struct efx_channel *channel,
995 EFX_QWORD_FIELD(*event, RX_EV_MCAST_HASH_MATCH); 997 EFX_QWORD_FIELD(*event, RX_EV_MCAST_HASH_MATCH);
996 998
997 if (unlikely(!rx_ev_mcast_hash_match)) 999 if (unlikely(!rx_ev_mcast_hash_match))
998 discard = 1; 1000 discard = true;
999 } 1001 }
1000 1002
1001 /* Handle received packet */ 1003 /* Handle received packet */
@@ -1010,23 +1012,23 @@ static void falcon_handle_global_event(struct efx_channel *channel,
1010 efx_qword_t *event) 1012 efx_qword_t *event)
1011{ 1013{
1012 struct efx_nic *efx = channel->efx; 1014 struct efx_nic *efx = channel->efx;
1013 int is_phy_event = 0, handled = 0; 1015 bool is_phy_event = false, handled = false;
1014 1016
1015 /* Check for interrupt on either port. Some boards have a 1017 /* Check for interrupt on either port. Some boards have a
1016 * single PHY wired to the interrupt line for port 1. */ 1018 * single PHY wired to the interrupt line for port 1. */
1017 if (EFX_QWORD_FIELD(*event, G_PHY0_INTR) || 1019 if (EFX_QWORD_FIELD(*event, G_PHY0_INTR) ||
1018 EFX_QWORD_FIELD(*event, G_PHY1_INTR) || 1020 EFX_QWORD_FIELD(*event, G_PHY1_INTR) ||
1019 EFX_QWORD_FIELD(*event, XG_PHY_INTR)) 1021 EFX_QWORD_FIELD(*event, XG_PHY_INTR))
1020 is_phy_event = 1; 1022 is_phy_event = true;
1021 1023
1022 if ((falcon_rev(efx) >= FALCON_REV_B0) && 1024 if ((falcon_rev(efx) >= FALCON_REV_B0) &&
1023 EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) 1025 EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0))
1024 is_phy_event = 1; 1026 is_phy_event = true;
1025 1027
1026 if (is_phy_event) { 1028 if (is_phy_event) {
1027 efx->phy_op->clear_interrupt(efx); 1029 efx->phy_op->clear_interrupt(efx);
1028 queue_work(efx->workqueue, &efx->reconfigure_work); 1030 queue_work(efx->workqueue, &efx->reconfigure_work);
1029 handled = 1; 1031 handled = true;
1030 } 1032 }
1031 1033
1032 if (EFX_QWORD_FIELD_VER(efx, *event, RX_RECOVERY)) { 1034 if (EFX_QWORD_FIELD_VER(efx, *event, RX_RECOVERY)) {
@@ -1036,7 +1038,7 @@ static void falcon_handle_global_event(struct efx_channel *channel,
1036 atomic_inc(&efx->rx_reset); 1038 atomic_inc(&efx->rx_reset);
1037 efx_schedule_reset(efx, EFX_WORKAROUND_6555(efx) ? 1039 efx_schedule_reset(efx, EFX_WORKAROUND_6555(efx) ?
1038 RESET_TYPE_RX_RECOVERY : RESET_TYPE_DISABLE); 1040 RESET_TYPE_RX_RECOVERY : RESET_TYPE_DISABLE);
1039 handled = 1; 1041 handled = true;
1040 } 1042 }
1041 1043
1042 if (!handled) 1044 if (!handled)
@@ -1756,7 +1758,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
1756{ 1758{
1757 efx_oword_t reg; 1759 efx_oword_t reg;
1758 int link_speed; 1760 int link_speed;
1759 unsigned int tx_fc; 1761 bool tx_fc;
1760 1762
1761 if (efx->link_options & GM_LPA_10000) 1763 if (efx->link_options & GM_LPA_10000)
1762 link_speed = 0x3; 1764 link_speed = 0x3;
@@ -1791,7 +1793,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
1791 /* Transmission of pause frames when RX crosses the threshold is 1793 /* Transmission of pause frames when RX crosses the threshold is
1792 * covered by RX_XOFF_MAC_EN and XM_TX_CFG_REG:XM_FCNTL. 1794 * covered by RX_XOFF_MAC_EN and XM_TX_CFG_REG:XM_FCNTL.
1793 * Action on receipt of pause frames is controller by XM_DIS_FCNTL */ 1795 * Action on receipt of pause frames is controller by XM_DIS_FCNTL */
1794 tx_fc = (efx->flow_control & EFX_FC_TX) ? 1 : 0; 1796 tx_fc = !!(efx->flow_control & EFX_FC_TX);
1795 falcon_read(efx, &reg, RX_CFG_REG_KER); 1797 falcon_read(efx, &reg, RX_CFG_REG_KER);
1796 EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); 1798 EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc);
1797 1799
@@ -2064,7 +2066,7 @@ int falcon_probe_port(struct efx_nic *efx)
2064 return rc; 2066 return rc;
2065 2067
2066 /* Set up GMII structure for PHY */ 2068 /* Set up GMII structure for PHY */
2067 efx->mii.supports_gmii = 1; 2069 efx->mii.supports_gmii = true;
2068 falcon_init_mdio(&efx->mii); 2070 falcon_init_mdio(&efx->mii);
2069 2071
2070 /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ 2072 /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */
diff --git a/drivers/net/sfc/falcon.h b/drivers/net/sfc/falcon.h
index 492f9bc28840..a72f50e3e6eb 100644
--- a/drivers/net/sfc/falcon.h
+++ b/drivers/net/sfc/falcon.h
@@ -65,7 +65,7 @@ extern int falcon_probe_port(struct efx_nic *efx);
65extern void falcon_remove_port(struct efx_nic *efx); 65extern void falcon_remove_port(struct efx_nic *efx);
66 66
67/* MAC/PHY */ 67/* MAC/PHY */
68extern int falcon_xaui_link_ok(struct efx_nic *efx); 68extern bool falcon_xaui_link_ok(struct efx_nic *efx);
69extern int falcon_dma_stats(struct efx_nic *efx, 69extern int falcon_dma_stats(struct efx_nic *efx,
70 unsigned int done_offset); 70 unsigned int done_offset);
71extern void falcon_drain_tx_fifo(struct efx_nic *efx); 71extern void falcon_drain_tx_fifo(struct efx_nic *efx);
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index ab114b4c3426..be5a86f0e5cf 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -70,7 +70,7 @@ static int falcon_reset_xmac(struct efx_nic *efx)
70 } 70 }
71 71
72 /* This often fails when DSP is disabled, ignore it */ 72 /* This often fails when DSP is disabled, ignore it */
73 if (sfe4001_phy_flash_cfg != 0) 73 if (sfe4001_phy_flash_cfg)
74 return 0; 74 return 0;
75 75
76 EFX_ERR(efx, "timed out waiting for XMAC core reset\n"); 76 EFX_ERR(efx, "timed out waiting for XMAC core reset\n");
@@ -217,12 +217,12 @@ int falcon_reset_xaui(struct efx_nic *efx)
217 return rc; 217 return rc;
218} 218}
219 219
220static int falcon_xgmii_status(struct efx_nic *efx) 220static bool falcon_xgmii_status(struct efx_nic *efx)
221{ 221{
222 efx_dword_t reg; 222 efx_dword_t reg;
223 223
224 if (falcon_rev(efx) < FALCON_REV_B0) 224 if (falcon_rev(efx) < FALCON_REV_B0)
225 return 1; 225 return true;
226 226
227 /* The ISR latches, so clear it and re-read */ 227 /* The ISR latches, so clear it and re-read */
228 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 228 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0);
@@ -231,13 +231,13 @@ static int falcon_xgmii_status(struct efx_nic *efx)
231 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) || 231 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) ||
232 EFX_DWORD_FIELD(reg, XM_RMTFLT)) { 232 EFX_DWORD_FIELD(reg, XM_RMTFLT)) {
233 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg)); 233 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg));
234 return 0; 234 return false;
235 } 235 }
236 236
237 return 1; 237 return true;
238} 238}
239 239
240static void falcon_mask_status_intr(struct efx_nic *efx, int enable) 240static void falcon_mask_status_intr(struct efx_nic *efx, bool enable)
241{ 241{
242 efx_dword_t reg; 242 efx_dword_t reg;
243 243
@@ -274,7 +274,7 @@ int falcon_init_xmac(struct efx_nic *efx)
274 if (rc) 274 if (rc)
275 goto fail2; 275 goto fail2;
276 276
277 falcon_mask_status_intr(efx, 1); 277 falcon_mask_status_intr(efx, true);
278 return 0; 278 return 0;
279 279
280 fail2: 280 fail2:
@@ -283,13 +283,14 @@ int falcon_init_xmac(struct efx_nic *efx)
283 return rc; 283 return rc;
284} 284}
285 285
286int falcon_xaui_link_ok(struct efx_nic *efx) 286bool falcon_xaui_link_ok(struct efx_nic *efx)
287{ 287{
288 efx_dword_t reg; 288 efx_dword_t reg;
289 int align_done, sync_status, link_ok = 0; 289 bool align_done, link_ok = false;
290 int sync_status;
290 291
291 if (LOOPBACK_INTERNAL(efx)) 292 if (LOOPBACK_INTERNAL(efx))
292 return 1; 293 return true;
293 294
294 /* Read link status */ 295 /* Read link status */
295 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 296 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC);
@@ -297,7 +298,7 @@ int falcon_xaui_link_ok(struct efx_nic *efx)
297 align_done = EFX_DWORD_FIELD(reg, XX_ALIGN_DONE); 298 align_done = EFX_DWORD_FIELD(reg, XX_ALIGN_DONE);
298 sync_status = EFX_DWORD_FIELD(reg, XX_SYNC_STAT); 299 sync_status = EFX_DWORD_FIELD(reg, XX_SYNC_STAT);
299 if (align_done && (sync_status == XX_SYNC_STAT_DECODE_SYNCED)) 300 if (align_done && (sync_status == XX_SYNC_STAT_DECODE_SYNCED))
300 link_ok = 1; 301 link_ok = true;
301 302
302 /* Clear link status ready for next read */ 303 /* Clear link status ready for next read */
303 EFX_SET_DWORD_FIELD(reg, XX_COMMA_DET, XX_COMMA_DET_RESET); 304 EFX_SET_DWORD_FIELD(reg, XX_COMMA_DET, XX_COMMA_DET_RESET);
@@ -309,8 +310,7 @@ int falcon_xaui_link_ok(struct efx_nic *efx)
309 * (error conditions from the wire side propoagate back through 310 * (error conditions from the wire side propoagate back through
310 * the phy to the xaui side). */ 311 * the phy to the xaui side). */
311 if (efx->link_up && link_ok) { 312 if (efx->link_up && link_ok) {
312 int has_phyxs = efx->phy_op->mmds & (1 << MDIO_MMD_PHYXS); 313 if (efx->phy_op->mmds & (1 << MDIO_MMD_PHYXS))
313 if (has_phyxs)
314 link_ok = mdio_clause45_phyxgxs_lane_sync(efx); 314 link_ok = mdio_clause45_phyxgxs_lane_sync(efx);
315 } 315 }
316 316
@@ -326,7 +326,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
326{ 326{
327 unsigned int max_frame_len; 327 unsigned int max_frame_len;
328 efx_dword_t reg; 328 efx_dword_t reg;
329 int rx_fc = (efx->flow_control & EFX_FC_RX) ? 1 : 0; 329 bool rx_fc = !!(efx->flow_control & EFX_FC_RX);
330 330
331 /* Configure MAC - cut-thru mode is hard wired on */ 331 /* Configure MAC - cut-thru mode is hard wired on */
332 EFX_POPULATE_DWORD_3(reg, 332 EFX_POPULATE_DWORD_3(reg,
@@ -365,7 +365,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
365 365
366 EFX_POPULATE_DWORD_2(reg, 366 EFX_POPULATE_DWORD_2(reg,
367 XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */ 367 XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */
368 XM_DIS_FCNTL, rx_fc ? 0 : 1); 368 XM_DIS_FCNTL, !rx_fc);
369 falcon_xmac_writel(efx, &reg, XM_FC_REG_MAC); 369 falcon_xmac_writel(efx, &reg, XM_FC_REG_MAC);
370 370
371 /* Set MAC address */ 371 /* Set MAC address */
@@ -384,16 +384,15 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
384static void falcon_reconfigure_xgxs_core(struct efx_nic *efx) 384static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
385{ 385{
386 efx_dword_t reg; 386 efx_dword_t reg;
387 int xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS) ? 1 : 0; 387 bool xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS);
388 int xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI) ? 1 : 0; 388 bool xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI);
389 int xgmii_loopback = 389 bool xgmii_loopback = (efx->loopback_mode == LOOPBACK_XGMII);
390 (efx->loopback_mode == LOOPBACK_XGMII) ? 1 : 0;
391 390
392 /* XGXS block is flaky and will need to be reset if moving 391 /* XGXS block is flaky and will need to be reset if moving
393 * into our out of XGMII, XGXS or XAUI loopbacks. */ 392 * into our out of XGMII, XGXS or XAUI loopbacks. */
394 if (EFX_WORKAROUND_5147(efx)) { 393 if (EFX_WORKAROUND_5147(efx)) {
395 int old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback; 394 bool old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
396 int reset_xgxs; 395 bool reset_xgxs;
397 396
398 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 397 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC);
399 old_xgxs_loopback = EFX_DWORD_FIELD(reg, XX_XGXS_LB_EN); 398 old_xgxs_loopback = EFX_DWORD_FIELD(reg, XX_XGXS_LB_EN);
@@ -438,7 +437,7 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
438 437
439/* Try and bring the Falcon side of the Falcon-Phy XAUI link fails 438/* Try and bring the Falcon side of the Falcon-Phy XAUI link fails
440 * to come back up. Bash it until it comes back up */ 439 * to come back up. Bash it until it comes back up */
441static int falcon_check_xaui_link_up(struct efx_nic *efx) 440static bool falcon_check_xaui_link_up(struct efx_nic *efx)
442{ 441{
443 int max_tries, tries; 442 int max_tries, tries;
444 tries = EFX_WORKAROUND_5147(efx) ? 5 : 1; 443 tries = EFX_WORKAROUND_5147(efx) ? 5 : 1;
@@ -446,11 +445,11 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)
446 445
447 if ((efx->loopback_mode == LOOPBACK_NETWORK) || 446 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
448 (efx->phy_type == PHY_TYPE_NONE)) 447 (efx->phy_type == PHY_TYPE_NONE))
449 return 0; 448 return false;
450 449
451 while (tries) { 450 while (tries) {
452 if (falcon_xaui_link_ok(efx)) 451 if (falcon_xaui_link_ok(efx))
453 return 1; 452 return true;
454 453
455 EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n", 454 EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n",
456 __func__, tries); 455 __func__, tries);
@@ -461,14 +460,14 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)
461 460
462 EFX_LOG(efx, "Failed to bring XAUI link back up in %d tries!\n", 461 EFX_LOG(efx, "Failed to bring XAUI link back up in %d tries!\n",
463 max_tries); 462 max_tries);
464 return 0; 463 return false;
465} 464}
466 465
467void falcon_reconfigure_xmac(struct efx_nic *efx) 466void falcon_reconfigure_xmac(struct efx_nic *efx)
468{ 467{
469 int xaui_link_ok; 468 bool xaui_link_ok;
470 469
471 falcon_mask_status_intr(efx, 0); 470 falcon_mask_status_intr(efx, false);
472 471
473 falcon_deconfigure_mac_wrapper(efx); 472 falcon_deconfigure_mac_wrapper(efx);
474 473
@@ -484,7 +483,7 @@ void falcon_reconfigure_xmac(struct efx_nic *efx)
484 xaui_link_ok = falcon_check_xaui_link_up(efx); 483 xaui_link_ok = falcon_check_xaui_link_up(efx);
485 484
486 if (xaui_link_ok && efx->link_up) 485 if (xaui_link_ok && efx->link_up)
487 falcon_mask_status_intr(efx, 1); 486 falcon_mask_status_intr(efx, true);
488} 487}
489 488
490void falcon_fini_xmac(struct efx_nic *efx) 489void falcon_fini_xmac(struct efx_nic *efx)
@@ -563,14 +562,14 @@ void falcon_update_stats_xmac(struct efx_nic *efx)
563 562
564int falcon_check_xmac(struct efx_nic *efx) 563int falcon_check_xmac(struct efx_nic *efx)
565{ 564{
566 unsigned xaui_link_ok; 565 bool xaui_link_ok;
567 int rc; 566 int rc;
568 567
569 if ((efx->loopback_mode == LOOPBACK_NETWORK) || 568 if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
570 (efx->phy_type == PHY_TYPE_NONE)) 569 (efx->phy_type == PHY_TYPE_NONE))
571 return 0; 570 return 0;
572 571
573 falcon_mask_status_intr(efx, 0); 572 falcon_mask_status_intr(efx, false);
574 xaui_link_ok = falcon_xaui_link_ok(efx); 573 xaui_link_ok = falcon_xaui_link_ok(efx);
575 574
576 if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok) 575 if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok)
@@ -581,7 +580,7 @@ int falcon_check_xmac(struct efx_nic *efx)
581 580
582 /* Unmask interrupt if everything was (and still is) ok */ 581 /* Unmask interrupt if everything was (and still is) ok */
583 if (xaui_link_ok && efx->link_up) 582 if (xaui_link_ok && efx->link_up)
584 falcon_mask_status_intr(efx, 1); 583 falcon_mask_status_intr(efx, true);
585 584
586 return rc; 585 return rc;
587} 586}
@@ -622,7 +621,7 @@ int falcon_xmac_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
622 621
623int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control) 622int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control)
624{ 623{
625 int reset; 624 bool reset;
626 625
627 if (flow_control & EFX_FC_AUTO) { 626 if (flow_control & EFX_FC_AUTO) {
628 EFX_LOG(efx, "10G does not support flow control " 627 EFX_LOG(efx, "10G does not support flow control "
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index c4f540e93b79..406494684bb8 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -159,20 +159,19 @@ int mdio_clause45_check_mmds(struct efx_nic *efx,
159 return 0; 159 return 0;
160} 160}
161 161
162int mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask) 162bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
163{ 163{
164 int phy_id = efx->mii.phy_id; 164 int phy_id = efx->mii.phy_id;
165 int status; 165 int status;
166 int ok = 1; 166 bool ok = true;
167 int mmd = 0; 167 int mmd = 0;
168 int good;
169 168
170 /* If the port is in loopback, then we should only consider a subset 169 /* If the port is in loopback, then we should only consider a subset
171 * of mmd's */ 170 * of mmd's */
172 if (LOOPBACK_INTERNAL(efx)) 171 if (LOOPBACK_INTERNAL(efx))
173 return 1; 172 return true;
174 else if (efx->loopback_mode == LOOPBACK_NETWORK) 173 else if (efx->loopback_mode == LOOPBACK_NETWORK)
175 return 0; 174 return false;
176 else if (efx->loopback_mode == LOOPBACK_PHYXS) 175 else if (efx->loopback_mode == LOOPBACK_PHYXS)
177 mmd_mask &= ~(MDIO_MMDREG_DEVS0_PHYXS | 176 mmd_mask &= ~(MDIO_MMDREG_DEVS0_PHYXS |
178 MDIO_MMDREG_DEVS0_PCS | 177 MDIO_MMDREG_DEVS0_PCS |
@@ -192,8 +191,7 @@ int mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
192 status = mdio_clause45_read(efx, phy_id, 191 status = mdio_clause45_read(efx, phy_id,
193 mmd, MDIO_MMDREG_STAT1); 192 mmd, MDIO_MMDREG_STAT1);
194 193
195 good = status & (1 << MDIO_MMDREG_STAT1_LINK_LBN); 194 ok = ok && (status & (1 << MDIO_MMDREG_STAT1_LINK_LBN));
196 ok = ok && good;
197 } 195 }
198 mmd_mask = (mmd_mask >> 1); 196 mmd_mask = (mmd_mask >> 1);
199 mmd++; 197 mmd++;
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h
index 3bb6b55010d4..19c42eaf7fb4 100644
--- a/drivers/net/sfc/mdio_10g.h
+++ b/drivers/net/sfc/mdio_10g.h
@@ -199,16 +199,17 @@ static inline u32 mdio_clause45_read_id(struct efx_nic *efx, int mmd)
199 return (id_hi << 16) | (id_low); 199 return (id_hi << 16) | (id_low);
200} 200}
201 201
202static inline int mdio_clause45_phyxgxs_lane_sync(struct efx_nic *efx) 202static inline bool mdio_clause45_phyxgxs_lane_sync(struct efx_nic *efx)
203{ 203{
204 int i, sync, lane_status; 204 int i, lane_status;
205 bool sync;
205 206
206 for (i = 0; i < 2; ++i) 207 for (i = 0; i < 2; ++i)
207 lane_status = mdio_clause45_read(efx, efx->mii.phy_id, 208 lane_status = mdio_clause45_read(efx, efx->mii.phy_id,
208 MDIO_MMD_PHYXS, 209 MDIO_MMD_PHYXS,
209 MDIO_PHYXS_LANE_STATE); 210 MDIO_PHYXS_LANE_STATE);
210 211
211 sync = (lane_status & (1 << MDIO_PHYXS_LANE_ALIGNED_LBN)) != 0; 212 sync = !!(lane_status & (1 << MDIO_PHYXS_LANE_ALIGNED_LBN));
212 if (!sync) 213 if (!sync)
213 EFX_LOG(efx, "XGXS lane status: %x\n", lane_status); 214 EFX_LOG(efx, "XGXS lane status: %x\n", lane_status);
214 return sync; 215 return sync;
@@ -230,8 +231,8 @@ int mdio_clause45_check_mmds(struct efx_nic *efx,
230 unsigned int mmd_mask, unsigned int fatal_mask); 231 unsigned int mmd_mask, unsigned int fatal_mask);
231 232
232/* Check the link status of specified mmds in bit mask */ 233/* Check the link status of specified mmds in bit mask */
233extern int mdio_clause45_links_ok(struct efx_nic *efx, 234extern bool mdio_clause45_links_ok(struct efx_nic *efx,
234 unsigned int mmd_mask); 235 unsigned int mmd_mask);
235 236
236/* Generic transmit disable support though PMAPMD */ 237/* Generic transmit disable support though PMAPMD */
237extern void mdio_clause45_transmit_disable(struct efx_nic *efx); 238extern void mdio_clause45_transmit_disable(struct efx_nic *efx);
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 6369f9253c7b..1b92186bec5a 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -137,8 +137,8 @@ struct efx_tx_buffer {
137 struct efx_tso_header *tsoh; 137 struct efx_tso_header *tsoh;
138 dma_addr_t dma_addr; 138 dma_addr_t dma_addr;
139 unsigned short len; 139 unsigned short len;
140 unsigned char continuation; 140 bool continuation;
141 unsigned char unmap_single; 141 bool unmap_single;
142 unsigned short unmap_len; 142 unsigned short unmap_len;
143}; 143};
144 144
@@ -162,7 +162,7 @@ struct efx_tx_buffer {
162 * @txd: The hardware descriptor ring 162 * @txd: The hardware descriptor ring
163 * @read_count: Current read pointer. 163 * @read_count: Current read pointer.
164 * This is the number of buffers that have been removed from both rings. 164 * This is the number of buffers that have been removed from both rings.
165 * @stopped: Stopped flag. 165 * @stopped: Stopped count.
166 * Set if this TX queue is currently stopping its port. 166 * Set if this TX queue is currently stopping its port.
167 * @insert_count: Current insert pointer 167 * @insert_count: Current insert pointer
168 * This is the number of buffers that have been added to the 168 * This is the number of buffers that have been added to the
@@ -265,7 +265,7 @@ struct efx_rx_buffer {
265struct efx_rx_queue { 265struct efx_rx_queue {
266 struct efx_nic *efx; 266 struct efx_nic *efx;
267 int queue; 267 int queue;
268 int used; 268 bool used;
269 struct efx_channel *channel; 269 struct efx_channel *channel;
270 struct efx_rx_buffer *buffer; 270 struct efx_rx_buffer *buffer;
271 struct efx_special_buffer rxd; 271 struct efx_special_buffer rxd;
@@ -359,13 +359,13 @@ struct efx_channel {
359 int evqnum; 359 int evqnum;
360 int channel; 360 int channel;
361 int used_flags; 361 int used_flags;
362 int enabled; 362 bool enabled;
363 int irq; 363 int irq;
364 unsigned int has_interrupt; 364 bool has_interrupt;
365 unsigned int irq_moderation; 365 unsigned int irq_moderation;
366 struct net_device *napi_dev; 366 struct net_device *napi_dev;
367 struct napi_struct napi_str; 367 struct napi_struct napi_str;
368 int work_pending; 368 bool work_pending;
369 struct efx_special_buffer eventq; 369 struct efx_special_buffer eventq;
370 unsigned int eventq_read_ptr; 370 unsigned int eventq_read_ptr;
371 unsigned int last_eventq_read_ptr; 371 unsigned int last_eventq_read_ptr;
@@ -388,7 +388,7 @@ struct efx_channel {
388 * access with prefetches. 388 * access with prefetches.
389 */ 389 */
390 struct efx_rx_buffer *rx_pkt; 390 struct efx_rx_buffer *rx_pkt;
391 int rx_pkt_csummed; 391 bool rx_pkt_csummed;
392 392
393}; 393};
394 394
@@ -401,8 +401,8 @@ struct efx_channel {
401 */ 401 */
402struct efx_blinker { 402struct efx_blinker {
403 int led_num; 403 int led_num;
404 int state; 404 bool state;
405 int resubmit; 405 bool resubmit;
406 struct timer_list timer; 406 struct timer_list timer;
407}; 407};
408 408
@@ -430,8 +430,8 @@ struct efx_board {
430 * have a separate init callback that happens later than 430 * have a separate init callback that happens later than
431 * board init. */ 431 * board init. */
432 int (*init_leds)(struct efx_nic *efx); 432 int (*init_leds)(struct efx_nic *efx);
433 void (*set_fault_led) (struct efx_nic *efx, int state); 433 void (*set_fault_led) (struct efx_nic *efx, bool state);
434 void (*blink) (struct efx_nic *efx, int start); 434 void (*blink) (struct efx_nic *efx, bool start);
435 void (*fini) (struct efx_nic *nic); 435 void (*fini) (struct efx_nic *nic);
436 struct efx_blinker blinker; 436 struct efx_blinker blinker;
437 struct i2c_client *hwmon_client, *ioexp_client; 437 struct i2c_client *hwmon_client, *ioexp_client;
@@ -714,11 +714,11 @@ struct efx_nic {
714 struct falcon_nic_data *nic_data; 714 struct falcon_nic_data *nic_data;
715 715
716 struct mutex mac_lock; 716 struct mutex mac_lock;
717 int port_enabled; 717 bool port_enabled;
718 718
719 int port_initialized; 719 bool port_initialized;
720 struct net_device *net_dev; 720 struct net_device *net_dev;
721 int rx_checksum_enabled; 721 bool rx_checksum_enabled;
722 722
723 atomic_t netif_stop_count; 723 atomic_t netif_stop_count;
724 spinlock_t netif_stop_lock; 724 spinlock_t netif_stop_lock;
@@ -734,13 +734,13 @@ struct efx_nic {
734 struct efx_phy_operations *phy_op; 734 struct efx_phy_operations *phy_op;
735 void *phy_data; 735 void *phy_data;
736 struct mii_if_info mii; 736 struct mii_if_info mii;
737 unsigned tx_disabled; 737 bool tx_disabled;
738 738
739 int link_up; 739 bool link_up;
740 unsigned int link_options; 740 unsigned int link_options;
741 unsigned int n_link_state_changes; 741 unsigned int n_link_state_changes;
742 742
743 int promiscuous; 743 bool promiscuous;
744 union efx_multicast_hash multicast_hash; 744 union efx_multicast_hash multicast_hash;
745 enum efx_fc_type flow_control; 745 enum efx_fc_type flow_control;
746 struct work_struct reconfigure_work; 746 struct work_struct reconfigure_work;
diff --git a/drivers/net/sfc/phy.h b/drivers/net/sfc/phy.h
index 9d02c84e6b2d..25bd18ec7046 100644
--- a/drivers/net/sfc/phy.h
+++ b/drivers/net/sfc/phy.h
@@ -23,7 +23,7 @@ enum tenxpress_state {
23 23
24extern void tenxpress_set_state(struct efx_nic *efx, 24extern void tenxpress_set_state(struct efx_nic *efx,
25 enum tenxpress_state state); 25 enum tenxpress_state state);
26extern void tenxpress_phy_blink(struct efx_nic *efx, int blink); 26extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink);
27extern void tenxpress_crc_err(struct efx_nic *efx); 27extern void tenxpress_crc_err(struct efx_nic *efx);
28 28
29/**************************************************************************** 29/****************************************************************************
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index 0d27dd39bc09..17aa81e66a89 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -508,8 +508,8 @@ void efx_rx_work(struct work_struct *data)
508 508
509static inline void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue, 509static inline void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
510 struct efx_rx_buffer *rx_buf, 510 struct efx_rx_buffer *rx_buf,
511 int len, int *discard, 511 int len, bool *discard,
512 int *leak_packet) 512 bool *leak_packet)
513{ 513{
514 struct efx_nic *efx = rx_queue->efx; 514 struct efx_nic *efx = rx_queue->efx;
515 unsigned max_len = rx_buf->len - efx->type->rx_buffer_padding; 515 unsigned max_len = rx_buf->len - efx->type->rx_buffer_padding;
@@ -520,7 +520,7 @@ static inline void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
520 /* The packet must be discarded, but this is only a fatal error 520 /* The packet must be discarded, but this is only a fatal error
521 * if the caller indicated it was 521 * if the caller indicated it was
522 */ 522 */
523 *discard = 1; 523 *discard = true;
524 524
525 if ((len > rx_buf->len) && EFX_WORKAROUND_8071(efx)) { 525 if ((len > rx_buf->len) && EFX_WORKAROUND_8071(efx)) {
526 EFX_ERR_RL(efx, " RX queue %d seriously overlength " 526 EFX_ERR_RL(efx, " RX queue %d seriously overlength "
@@ -621,11 +621,11 @@ static inline struct sk_buff *efx_rx_mk_skb(struct efx_rx_buffer *rx_buf,
621} 621}
622 622
623void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, 623void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
624 unsigned int len, int checksummed, int discard) 624 unsigned int len, bool checksummed, bool discard)
625{ 625{
626 struct efx_nic *efx = rx_queue->efx; 626 struct efx_nic *efx = rx_queue->efx;
627 struct efx_rx_buffer *rx_buf; 627 struct efx_rx_buffer *rx_buf;
628 int leak_packet = 0; 628 bool leak_packet = false;
629 629
630 rx_buf = efx_rx_buffer(rx_queue, index); 630 rx_buf = efx_rx_buffer(rx_queue, index);
631 EFX_BUG_ON_PARANOID(!rx_buf->data); 631 EFX_BUG_ON_PARANOID(!rx_buf->data);
@@ -683,11 +683,11 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
683 683
684/* Handle a received packet. Second half: Touches packet payload. */ 684/* Handle a received packet. Second half: Touches packet payload. */
685void __efx_rx_packet(struct efx_channel *channel, 685void __efx_rx_packet(struct efx_channel *channel,
686 struct efx_rx_buffer *rx_buf, int checksummed) 686 struct efx_rx_buffer *rx_buf, bool checksummed)
687{ 687{
688 struct efx_nic *efx = channel->efx; 688 struct efx_nic *efx = channel->efx;
689 struct sk_buff *skb; 689 struct sk_buff *skb;
690 int lro = efx->net_dev->features & NETIF_F_LRO; 690 bool lro = !!(efx->net_dev->features & NETIF_F_LRO);
691 691
692 /* If we're in loopback test, then pass the packet directly to the 692 /* If we're in loopback test, then pass the packet directly to the
693 * loopback layer, and free the rx_buf here 693 * loopback layer, and free the rx_buf here
diff --git a/drivers/net/sfc/rx.h b/drivers/net/sfc/rx.h
index f35e377bfc5f..187b1109973c 100644
--- a/drivers/net/sfc/rx.h
+++ b/drivers/net/sfc/rx.h
@@ -24,6 +24,6 @@ void efx_rx_strategy(struct efx_channel *channel);
24void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue); 24void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue);
25void efx_rx_work(struct work_struct *data); 25void efx_rx_work(struct work_struct *data);
26void __efx_rx_packet(struct efx_channel *channel, 26void __efx_rx_packet(struct efx_channel *channel,
27 struct efx_rx_buffer *rx_buf, int checksummed); 27 struct efx_rx_buffer *rx_buf, bool checksummed);
28 28
29#endif /* EFX_RX_H */ 29#endif /* EFX_RX_H */
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 53fa4edf486c..ff7b84c3fcfb 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -60,12 +60,12 @@ static const char *payload_msg =
60 * @payload: Payload used in tests 60 * @payload: Payload used in tests
61 */ 61 */
62struct efx_selftest_state { 62struct efx_selftest_state {
63 int flush; 63 bool flush;
64 int packet_count; 64 int packet_count;
65 struct sk_buff **skbs; 65 struct sk_buff **skbs;
66 66
67 /* Checksums are being offloaded */ 67 /* Checksums are being offloaded */
68 int offload_csum; 68 bool offload_csum;
69 69
70 atomic_t rx_good; 70 atomic_t rx_good;
71 atomic_t rx_bad; 71 atomic_t rx_bad;
@@ -537,7 +537,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
537 state->packet_count, GFP_KERNEL); 537 state->packet_count, GFP_KERNEL);
538 if (!state->skbs) 538 if (!state->skbs)
539 return -ENOMEM; 539 return -ENOMEM;
540 state->flush = 0; 540 state->flush = false;
541 541
542 EFX_LOG(efx, "TX queue %d testing %s loopback with %d " 542 EFX_LOG(efx, "TX queue %d testing %s loopback with %d "
543 "packets\n", tx_queue->queue, LOOPBACK_MODE(efx), 543 "packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
@@ -580,7 +580,8 @@ static int efx_test_loopbacks(struct efx_nic *efx,
580 struct ethtool_cmd ecmd, ecmd_loopback; 580 struct ethtool_cmd ecmd, ecmd_loopback;
581 struct efx_tx_queue *tx_queue; 581 struct efx_tx_queue *tx_queue;
582 enum efx_loopback_mode old_mode, mode; 582 enum efx_loopback_mode old_mode, mode;
583 int count, rc, link_up; 583 bool link_up;
584 int count, rc;
584 585
585 rc = efx_ethtool_get_settings(efx->net_dev, &ecmd); 586 rc = efx_ethtool_get_settings(efx->net_dev, &ecmd);
586 if (rc) { 587 if (rc) {
@@ -611,7 +612,7 @@ static int efx_test_loopbacks(struct efx_nic *efx,
611 continue; 612 continue;
612 613
613 /* Move the port into the specified loopback mode. */ 614 /* Move the port into the specified loopback mode. */
614 state->flush = 1; 615 state->flush = true;
615 efx->loopback_mode = mode; 616 efx->loopback_mode = mode;
616 efx_reconfigure_port(efx); 617 efx_reconfigure_port(efx);
617 618
@@ -664,7 +665,7 @@ static int efx_test_loopbacks(struct efx_nic *efx,
664 665
665 out: 666 out:
666 /* Take out of loopback and restore PHY settings */ 667 /* Take out of loopback and restore PHY settings */
667 state->flush = 1; 668 state->flush = true;
668 efx->loopback_mode = old_mode; 669 efx->loopback_mode = old_mode;
669 efx_ethtool_set_settings(efx->net_dev, &ecmd); 670 efx_ethtool_set_settings(efx->net_dev, &ecmd);
670 671
@@ -716,7 +717,7 @@ int efx_offline_test(struct efx_nic *efx,
716 * all received packets will be dropped. Mark the state as 717 * all received packets will be dropped. Mark the state as
717 * "flushing" so all inflight packets are dropped */ 718 * "flushing" so all inflight packets are dropped */
718 BUG_ON(efx->loopback_selftest); 719 BUG_ON(efx->loopback_selftest);
719 state->flush = 1; 720 state->flush = true;
720 efx->loopback_selftest = state; 721 efx->loopback_selftest = state;
721 722
722 rc = efx_test_loopbacks(efx, tests, loopback_modes); 723 rc = efx_test_loopbacks(efx, tests, loopback_modes);
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index c0146061c326..b92b24bba9e8 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -122,7 +122,7 @@ struct tenxpress_phy_data {
122 enum tenxpress_state state; 122 enum tenxpress_state state;
123 enum efx_loopback_mode loopback_mode; 123 enum efx_loopback_mode loopback_mode;
124 atomic_t bad_crc_count; 124 atomic_t bad_crc_count;
125 int tx_disabled; 125 bool tx_disabled;
126 int bad_lp_tries; 126 int bad_lp_tries;
127}; 127};
128 128
@@ -274,7 +274,7 @@ static int tenxpress_special_reset(struct efx_nic *efx)
274 return 0; 274 return 0;
275} 275}
276 276
277static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp) 277static void tenxpress_set_bad_lp(struct efx_nic *efx, bool bad_lp)
278{ 278{
279 struct tenxpress_phy_data *pd = efx->phy_data; 279 struct tenxpress_phy_data *pd = efx->phy_data;
280 int reg; 280 int reg;
@@ -311,15 +311,15 @@ static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp)
311 * into a non-10GBT port and if so warn the user that they won't get 311 * into a non-10GBT port and if so warn the user that they won't get
312 * link any time soon as we are 10GBT only, unless caller specified 312 * link any time soon as we are 10GBT only, unless caller specified
313 * not to do this check (it isn't useful in loopback) */ 313 * not to do this check (it isn't useful in loopback) */
314static int tenxpress_link_ok(struct efx_nic *efx, int check_lp) 314static bool tenxpress_link_ok(struct efx_nic *efx, bool check_lp)
315{ 315{
316 int ok = mdio_clause45_links_ok(efx, TENXPRESS_REQUIRED_DEVS); 316 bool ok = mdio_clause45_links_ok(efx, TENXPRESS_REQUIRED_DEVS);
317 317
318 if (ok) { 318 if (ok) {
319 tenxpress_set_bad_lp(efx, 0); 319 tenxpress_set_bad_lp(efx, false);
320 } else if (check_lp) { 320 } else if (check_lp) {
321 /* Are we plugged into the wrong sort of link? */ 321 /* Are we plugged into the wrong sort of link? */
322 int bad_lp = 0; 322 bool bad_lp = false;
323 int phy_id = efx->mii.phy_id; 323 int phy_id = efx->mii.phy_id;
324 int an_stat = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 324 int an_stat = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
325 MDIO_AN_STATUS); 325 MDIO_AN_STATUS);
@@ -332,7 +332,7 @@ static int tenxpress_link_ok(struct efx_nic *efx, int check_lp)
332 * bit has the advantage of not clearing when autoneg 332 * bit has the advantage of not clearing when autoneg
333 * restarts. */ 333 * restarts. */
334 if (!(xphy_stat & (1 << PMA_PMD_XSTAT_FLP_LBN))) { 334 if (!(xphy_stat & (1 << PMA_PMD_XSTAT_FLP_LBN))) {
335 tenxpress_set_bad_lp(efx, 0); 335 tenxpress_set_bad_lp(efx, false);
336 return ok; 336 return ok;
337 } 337 }
338 338
@@ -367,8 +367,8 @@ static void tenxpress_phyxs_loopback(struct efx_nic *efx)
367static void tenxpress_phy_reconfigure(struct efx_nic *efx) 367static void tenxpress_phy_reconfigure(struct efx_nic *efx)
368{ 368{
369 struct tenxpress_phy_data *phy_data = efx->phy_data; 369 struct tenxpress_phy_data *phy_data = efx->phy_data;
370 int loop_change = LOOPBACK_OUT_OF(phy_data, efx, 370 bool loop_change = LOOPBACK_OUT_OF(phy_data, efx,
371 TENXPRESS_LOOPBACKS); 371 TENXPRESS_LOOPBACKS);
372 372
373 if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL)) 373 if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL))
374 return; 374 return;
@@ -388,7 +388,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
388 388
389 phy_data->tx_disabled = efx->tx_disabled; 389 phy_data->tx_disabled = efx->tx_disabled;
390 phy_data->loopback_mode = efx->loopback_mode; 390 phy_data->loopback_mode = efx->loopback_mode;
391 efx->link_up = tenxpress_link_ok(efx, 0); 391 efx->link_up = tenxpress_link_ok(efx, false);
392 efx->link_options = GM_LPA_10000FULL; 392 efx->link_options = GM_LPA_10000FULL;
393} 393}
394 394
@@ -402,10 +402,10 @@ static void tenxpress_phy_clear_interrupt(struct efx_nic *efx)
402static int tenxpress_phy_check_hw(struct efx_nic *efx) 402static int tenxpress_phy_check_hw(struct efx_nic *efx)
403{ 403{
404 struct tenxpress_phy_data *phy_data = efx->phy_data; 404 struct tenxpress_phy_data *phy_data = efx->phy_data;
405 int phy_up = tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL); 405 bool phy_up = tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL);
406 int link_ok; 406 bool link_ok;
407 407
408 link_ok = phy_up && tenxpress_link_ok(efx, 1); 408 link_ok = phy_up && tenxpress_link_ok(efx, true);
409 409
410 if (link_ok != efx->link_up) 410 if (link_ok != efx->link_up)
411 falcon_xmac_sim_phy_event(efx); 411 falcon_xmac_sim_phy_event(efx);
@@ -444,7 +444,7 @@ static void tenxpress_phy_fini(struct efx_nic *efx)
444 444
445/* Set the RX and TX LEDs and Link LED flashing. The other LEDs 445/* Set the RX and TX LEDs and Link LED flashing. The other LEDs
446 * (which probably aren't wired anyway) are left in AUTO mode */ 446 * (which probably aren't wired anyway) are left in AUTO mode */
447void tenxpress_phy_blink(struct efx_nic *efx, int blink) 447void tenxpress_phy_blink(struct efx_nic *efx, bool blink)
448{ 448{
449 int reg; 449 int reg;
450 450
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index 5f01371baaf9..51429b6a4dee 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -73,7 +73,7 @@ static inline void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
73 pci_unmap_page(pci_dev, unmap_addr, buffer->unmap_len, 73 pci_unmap_page(pci_dev, unmap_addr, buffer->unmap_len,
74 PCI_DMA_TODEVICE); 74 PCI_DMA_TODEVICE);
75 buffer->unmap_len = 0; 75 buffer->unmap_len = 0;
76 buffer->unmap_single = 0; 76 buffer->unmap_single = false;
77 } 77 }
78 78
79 if (buffer->skb) { 79 if (buffer->skb) {
@@ -150,7 +150,7 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
150 unsigned int len, unmap_len = 0, fill_level, insert_ptr, misalign; 150 unsigned int len, unmap_len = 0, fill_level, insert_ptr, misalign;
151 dma_addr_t dma_addr, unmap_addr = 0; 151 dma_addr_t dma_addr, unmap_addr = 0;
152 unsigned int dma_len; 152 unsigned int dma_len;
153 unsigned unmap_single; 153 bool unmap_single;
154 int q_space, i = 0; 154 int q_space, i = 0;
155 int rc = NETDEV_TX_OK; 155 int rc = NETDEV_TX_OK;
156 156
@@ -169,7 +169,7 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
169 * since this is more efficient on machines with sparse 169 * since this is more efficient on machines with sparse
170 * memory. 170 * memory.
171 */ 171 */
172 unmap_single = 1; 172 unmap_single = true;
173 dma_addr = pci_map_single(pci_dev, skb->data, len, PCI_DMA_TODEVICE); 173 dma_addr = pci_map_single(pci_dev, skb->data, len, PCI_DMA_TODEVICE);
174 174
175 /* Process all fragments */ 175 /* Process all fragments */
@@ -215,7 +215,7 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
215 EFX_BUG_ON_PARANOID(buffer->tsoh); 215 EFX_BUG_ON_PARANOID(buffer->tsoh);
216 EFX_BUG_ON_PARANOID(buffer->skb); 216 EFX_BUG_ON_PARANOID(buffer->skb);
217 EFX_BUG_ON_PARANOID(buffer->len); 217 EFX_BUG_ON_PARANOID(buffer->len);
218 EFX_BUG_ON_PARANOID(buffer->continuation != 1); 218 EFX_BUG_ON_PARANOID(!buffer->continuation);
219 EFX_BUG_ON_PARANOID(buffer->unmap_len); 219 EFX_BUG_ON_PARANOID(buffer->unmap_len);
220 220
221 dma_len = (((~dma_addr) & efx->type->tx_dma_mask) + 1); 221 dma_len = (((~dma_addr) & efx->type->tx_dma_mask) + 1);
@@ -248,14 +248,14 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
248 page_offset = fragment->page_offset; 248 page_offset = fragment->page_offset;
249 i++; 249 i++;
250 /* Map for DMA */ 250 /* Map for DMA */
251 unmap_single = 0; 251 unmap_single = false;
252 dma_addr = pci_map_page(pci_dev, page, page_offset, len, 252 dma_addr = pci_map_page(pci_dev, page, page_offset, len,
253 PCI_DMA_TODEVICE); 253 PCI_DMA_TODEVICE);
254 } 254 }
255 255
256 /* Transfer ownership of the skb to the final buffer */ 256 /* Transfer ownership of the skb to the final buffer */
257 buffer->skb = skb; 257 buffer->skb = skb;
258 buffer->continuation = 0; 258 buffer->continuation = false;
259 259
260 /* Pass off to hardware */ 260 /* Pass off to hardware */
261 falcon_push_buffers(tx_queue); 261 falcon_push_buffers(tx_queue);
@@ -326,7 +326,7 @@ static inline void efx_dequeue_buffers(struct efx_tx_queue *tx_queue,
326 } 326 }
327 327
328 efx_dequeue_buffer(tx_queue, buffer); 328 efx_dequeue_buffer(tx_queue, buffer);
329 buffer->continuation = 1; 329 buffer->continuation = true;
330 buffer->len = 0; 330 buffer->len = 0;
331 331
332 ++tx_queue->read_count; 332 ++tx_queue->read_count;
@@ -428,7 +428,7 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue)
428 if (!tx_queue->buffer) 428 if (!tx_queue->buffer)
429 return -ENOMEM; 429 return -ENOMEM;
430 for (i = 0; i <= efx->type->txd_ring_mask; ++i) 430 for (i = 0; i <= efx->type->txd_ring_mask; ++i)
431 tx_queue->buffer[i].continuation = 1; 431 tx_queue->buffer[i].continuation = true;
432 432
433 /* Allocate hardware ring */ 433 /* Allocate hardware ring */
434 rc = falcon_probe_tx(tx_queue); 434 rc = falcon_probe_tx(tx_queue);
@@ -469,7 +469,7 @@ void efx_release_tx_buffers(struct efx_tx_queue *tx_queue)
469 buffer = &tx_queue->buffer[tx_queue->read_count & 469 buffer = &tx_queue->buffer[tx_queue->read_count &
470 tx_queue->efx->type->txd_ring_mask]; 470 tx_queue->efx->type->txd_ring_mask];
471 efx_dequeue_buffer(tx_queue, buffer); 471 efx_dequeue_buffer(tx_queue, buffer);
472 buffer->continuation = 1; 472 buffer->continuation = true;
473 buffer->len = 0; 473 buffer->len = 0;
474 474
475 ++tx_queue->read_count; 475 ++tx_queue->read_count;
@@ -567,7 +567,7 @@ struct tso_state {
567 /* DMA address and length of the whole fragment */ 567 /* DMA address and length of the whole fragment */
568 unsigned int unmap_len; 568 unsigned int unmap_len;
569 dma_addr_t unmap_addr; 569 dma_addr_t unmap_addr;
570 unsigned int unmap_single; 570 bool unmap_single;
571 } ifc; 571 } ifc;
572 572
573 struct { 573 struct {
@@ -746,7 +746,7 @@ static int efx_tx_queue_insert(struct efx_tx_queue *tx_queue,
746 EFX_BUG_ON_PARANOID(buffer->len); 746 EFX_BUG_ON_PARANOID(buffer->len);
747 EFX_BUG_ON_PARANOID(buffer->unmap_len); 747 EFX_BUG_ON_PARANOID(buffer->unmap_len);
748 EFX_BUG_ON_PARANOID(buffer->skb); 748 EFX_BUG_ON_PARANOID(buffer->skb);
749 EFX_BUG_ON_PARANOID(buffer->continuation != 1); 749 EFX_BUG_ON_PARANOID(!buffer->continuation);
750 EFX_BUG_ON_PARANOID(buffer->tsoh); 750 EFX_BUG_ON_PARANOID(buffer->tsoh);
751 751
752 buffer->dma_addr = dma_addr; 752 buffer->dma_addr = dma_addr;
@@ -792,7 +792,7 @@ static inline void efx_tso_put_header(struct efx_tx_queue *tx_queue,
792 EFX_BUG_ON_PARANOID(buffer->len); 792 EFX_BUG_ON_PARANOID(buffer->len);
793 EFX_BUG_ON_PARANOID(buffer->unmap_len); 793 EFX_BUG_ON_PARANOID(buffer->unmap_len);
794 EFX_BUG_ON_PARANOID(buffer->skb); 794 EFX_BUG_ON_PARANOID(buffer->skb);
795 EFX_BUG_ON_PARANOID(buffer->continuation != 1); 795 EFX_BUG_ON_PARANOID(!buffer->continuation);
796 EFX_BUG_ON_PARANOID(buffer->tsoh); 796 EFX_BUG_ON_PARANOID(buffer->tsoh);
797 buffer->len = len; 797 buffer->len = len;
798 buffer->dma_addr = tsoh->dma_addr; 798 buffer->dma_addr = tsoh->dma_addr;
@@ -816,7 +816,7 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
816 efx_tsoh_free(tx_queue, buffer); 816 efx_tsoh_free(tx_queue, buffer);
817 EFX_BUG_ON_PARANOID(buffer->skb); 817 EFX_BUG_ON_PARANOID(buffer->skb);
818 buffer->len = 0; 818 buffer->len = 0;
819 buffer->continuation = 1; 819 buffer->continuation = true;
820 if (buffer->unmap_len) { 820 if (buffer->unmap_len) {
821 unmap_addr = (buffer->dma_addr + buffer->len - 821 unmap_addr = (buffer->dma_addr + buffer->len -
822 buffer->unmap_len); 822 buffer->unmap_len);
@@ -855,7 +855,7 @@ static inline void tso_start(struct tso_state *st, const struct sk_buff *skb)
855 st->packet_space = st->p.full_packet_size; 855 st->packet_space = st->p.full_packet_size;
856 st->remaining_len = skb->len - st->p.header_length; 856 st->remaining_len = skb->len - st->p.header_length;
857 st->ifc.unmap_len = 0; 857 st->ifc.unmap_len = 0;
858 st->ifc.unmap_single = 0; 858 st->ifc.unmap_single = false;
859} 859}
860 860
861static inline int tso_get_fragment(struct tso_state *st, struct efx_nic *efx, 861static inline int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
@@ -865,7 +865,7 @@ static inline int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
865 frag->page_offset, frag->size, 865 frag->page_offset, frag->size,
866 PCI_DMA_TODEVICE); 866 PCI_DMA_TODEVICE);
867 if (likely(!pci_dma_mapping_error(efx->pci_dev, st->ifc.unmap_addr))) { 867 if (likely(!pci_dma_mapping_error(efx->pci_dev, st->ifc.unmap_addr))) {
868 st->ifc.unmap_single = 0; 868 st->ifc.unmap_single = false;
869 st->ifc.unmap_len = frag->size; 869 st->ifc.unmap_len = frag->size;
870 st->ifc.len = frag->size; 870 st->ifc.len = frag->size;
871 st->ifc.dma_addr = st->ifc.unmap_addr; 871 st->ifc.dma_addr = st->ifc.unmap_addr;
@@ -884,7 +884,7 @@ tso_get_head_fragment(struct tso_state *st, struct efx_nic *efx,
884 st->ifc.unmap_addr = pci_map_single(efx->pci_dev, skb->data + hl, 884 st->ifc.unmap_addr = pci_map_single(efx->pci_dev, skb->data + hl,
885 len, PCI_DMA_TODEVICE); 885 len, PCI_DMA_TODEVICE);
886 if (likely(!pci_dma_mapping_error(efx->pci_dev, st->ifc.unmap_addr))) { 886 if (likely(!pci_dma_mapping_error(efx->pci_dev, st->ifc.unmap_addr))) {
887 st->ifc.unmap_single = 1; 887 st->ifc.unmap_single = true;
888 st->ifc.unmap_len = len; 888 st->ifc.unmap_len = len;
889 st->ifc.len = len; 889 st->ifc.len = len;
890 st->ifc.dma_addr = st->ifc.unmap_addr; 890 st->ifc.dma_addr = st->ifc.unmap_addr;
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c
index f3684ad28887..fd4045b4d9d0 100644
--- a/drivers/net/sfc/xfp_phy.c
+++ b/drivers/net/sfc/xfp_phy.c
@@ -40,7 +40,7 @@ void xfp_set_led(struct efx_nic *p, int led, int mode)
40} 40}
41 41
42struct xfp_phy_data { 42struct xfp_phy_data {
43 int tx_disabled; 43 bool tx_disabled;
44}; 44};
45 45
46#define XFP_MAX_RESET_TIME 500 46#define XFP_MAX_RESET_TIME 500
@@ -151,7 +151,7 @@ static void xfp_phy_reconfigure(struct efx_nic *efx)
151static void xfp_phy_fini(struct efx_nic *efx) 151static void xfp_phy_fini(struct efx_nic *efx)
152{ 152{
153 /* Clobber the LED if it was blinking */ 153 /* Clobber the LED if it was blinking */
154 efx->board_info.blink(efx, 0); 154 efx->board_info.blink(efx, false);
155 155
156 /* Free the context block */ 156 /* Free the context block */
157 kfree(efx->phy_data); 157 kfree(efx->phy_data);