Commit 30088a25 authored by David S. Miller's avatar David S. Miller
parents c45a3dfb db339569
...@@ -16,6 +16,13 @@ config SFC_MTD ...@@ -16,6 +16,13 @@ config SFC_MTD
depends on SFC && MTD && !(SFC=y && MTD=m) depends on SFC && MTD && !(SFC=y && MTD=m)
default y default y
---help--- ---help---
This exposes the on-board flash memory as MTD devices (e.g. This exposes the on-board flash and/or EEPROM as MTD devices
/dev/mtd1). This makes it possible to upload new firmware (e.g. /dev/mtd1). This is required to update the firmware or
to the NIC. the boot configuration under Linux.
config SFC_MCDI_MON
bool "Solarflare SFC9000-family hwmon support"
depends on SFC && HWMON && !(SFC=y && HWMON=m)
default y
----help---
This exposes the on-board firmware-managed sensors as a
hardware monitor device.
...@@ -2,7 +2,7 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \ ...@@ -2,7 +2,7 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \
falcon_xmac.o mcdi_mac.o \ falcon_xmac.o mcdi_mac.o \
selftest.o ethtool.o qt202x_phy.o mdio_10g.o \ selftest.o ethtool.o qt202x_phy.o mdio_10g.o \
tenxpress.o txc43128_phy.o falcon_boards.o \ tenxpress.o txc43128_phy.o falcon_boards.o \
mcdi.o mcdi_phy.o mcdi.o mcdi_phy.o mcdi_mon.o
sfc-$(CONFIG_SFC_MTD) += mtd.o sfc-$(CONFIG_SFC_MTD) += mtd.o
obj-$(CONFIG_SFC) += sfc.o obj-$(CONFIG_SFC) += sfc.o
This diff is collapsed.
...@@ -40,9 +40,9 @@ extern void efx_rx_strategy(struct efx_channel *channel); ...@@ -40,9 +40,9 @@ extern void efx_rx_strategy(struct efx_channel *channel);
extern void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue); extern void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue);
extern void efx_rx_slow_fill(unsigned long context); extern void efx_rx_slow_fill(unsigned long context);
extern void __efx_rx_packet(struct efx_channel *channel, extern void __efx_rx_packet(struct efx_channel *channel,
struct efx_rx_buffer *rx_buf, bool checksummed); struct efx_rx_buffer *rx_buf);
extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
unsigned int len, bool checksummed, bool discard); unsigned int len, u16 flags);
extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
#define EFX_MAX_DMAQ_SIZE 4096UL #define EFX_MAX_DMAQ_SIZE 4096UL
...@@ -145,6 +145,12 @@ static inline void efx_schedule_channel(struct efx_channel *channel) ...@@ -145,6 +145,12 @@ static inline void efx_schedule_channel(struct efx_channel *channel)
napi_schedule(&channel->napi_str); napi_schedule(&channel->napi_str);
} }
static inline void efx_schedule_channel_irq(struct efx_channel *channel)
{
channel->last_irq_cpu = raw_smp_processor_id();
efx_schedule_channel(channel);
}
extern void efx_link_status_changed(struct efx_nic *efx); extern void efx_link_status_changed(struct efx_nic *efx);
extern void efx_link_set_advertising(struct efx_nic *efx, u32); extern void efx_link_set_advertising(struct efx_nic *efx, u32);
extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8); extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8);
......
...@@ -52,11 +52,6 @@ static u64 efx_get_uint_stat(void *field) ...@@ -52,11 +52,6 @@ static u64 efx_get_uint_stat(void *field)
return *(unsigned int *)field; return *(unsigned int *)field;
} }
static u64 efx_get_ulong_stat(void *field)
{
return *(unsigned long *)field;
}
static u64 efx_get_u64_stat(void *field) static u64 efx_get_u64_stat(void *field)
{ {
return *(u64 *) field; return *(u64 *) field;
...@@ -67,10 +62,6 @@ static u64 efx_get_atomic_stat(void *field) ...@@ -67,10 +62,6 @@ static u64 efx_get_atomic_stat(void *field)
return atomic_read((atomic_t *) field); return atomic_read((atomic_t *) field);
} }
#define EFX_ETHTOOL_ULONG_MAC_STAT(field) \
EFX_ETHTOOL_STAT(field, mac_stats, field, \
unsigned long, efx_get_ulong_stat)
#define EFX_ETHTOOL_U64_MAC_STAT(field) \ #define EFX_ETHTOOL_U64_MAC_STAT(field) \
EFX_ETHTOOL_STAT(field, mac_stats, field, \ EFX_ETHTOOL_STAT(field, mac_stats, field, \
u64, efx_get_u64_stat) u64, efx_get_u64_stat)
...@@ -91,36 +82,36 @@ static u64 efx_get_atomic_stat(void *field) ...@@ -91,36 +82,36 @@ static u64 efx_get_atomic_stat(void *field)
EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \ EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \
unsigned int, efx_get_uint_stat) unsigned int, efx_get_uint_stat)
static struct efx_ethtool_stat efx_ethtool_stats[] = { static const struct efx_ethtool_stat efx_ethtool_stats[] = {
EFX_ETHTOOL_U64_MAC_STAT(tx_bytes), EFX_ETHTOOL_U64_MAC_STAT(tx_bytes),
EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes), EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes),
EFX_ETHTOOL_U64_MAC_STAT(tx_bad_bytes), EFX_ETHTOOL_U64_MAC_STAT(tx_bad_bytes),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_packets), EFX_ETHTOOL_U64_MAC_STAT(tx_packets),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_bad), EFX_ETHTOOL_U64_MAC_STAT(tx_bad),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_pause), EFX_ETHTOOL_U64_MAC_STAT(tx_pause),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_control), EFX_ETHTOOL_U64_MAC_STAT(tx_control),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_unicast), EFX_ETHTOOL_U64_MAC_STAT(tx_unicast),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_multicast), EFX_ETHTOOL_U64_MAC_STAT(tx_multicast),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_broadcast), EFX_ETHTOOL_U64_MAC_STAT(tx_broadcast),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_lt64), EFX_ETHTOOL_U64_MAC_STAT(tx_lt64),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_64), EFX_ETHTOOL_U64_MAC_STAT(tx_64),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_65_to_127), EFX_ETHTOOL_U64_MAC_STAT(tx_65_to_127),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_128_to_255), EFX_ETHTOOL_U64_MAC_STAT(tx_128_to_255),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_256_to_511), EFX_ETHTOOL_U64_MAC_STAT(tx_256_to_511),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_512_to_1023), EFX_ETHTOOL_U64_MAC_STAT(tx_512_to_1023),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_1024_to_15xx), EFX_ETHTOOL_U64_MAC_STAT(tx_1024_to_15xx),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_15xx_to_jumbo), EFX_ETHTOOL_U64_MAC_STAT(tx_15xx_to_jumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_gtjumbo), EFX_ETHTOOL_U64_MAC_STAT(tx_gtjumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_collision), EFX_ETHTOOL_U64_MAC_STAT(tx_collision),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_single_collision), EFX_ETHTOOL_U64_MAC_STAT(tx_single_collision),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_multiple_collision), EFX_ETHTOOL_U64_MAC_STAT(tx_multiple_collision),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_excessive_collision), EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_collision),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_deferred), EFX_ETHTOOL_U64_MAC_STAT(tx_deferred),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_late_collision), EFX_ETHTOOL_U64_MAC_STAT(tx_late_collision),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_excessive_deferred), EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_deferred),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp), EFX_ETHTOOL_U64_MAC_STAT(tx_non_tcpudp),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error), EFX_ETHTOOL_U64_MAC_STAT(tx_mac_src_error),
EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error), EFX_ETHTOOL_U64_MAC_STAT(tx_ip_src_error),
EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts), EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts),
EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers), EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers),
EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets), EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets),
...@@ -128,34 +119,34 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = { ...@@ -128,34 +119,34 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = {
EFX_ETHTOOL_U64_MAC_STAT(rx_bytes), EFX_ETHTOOL_U64_MAC_STAT(rx_bytes),
EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes), EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes), EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_packets), EFX_ETHTOOL_U64_MAC_STAT(rx_packets),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_good), EFX_ETHTOOL_U64_MAC_STAT(rx_good),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_bad), EFX_ETHTOOL_U64_MAC_STAT(rx_bad),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_pause), EFX_ETHTOOL_U64_MAC_STAT(rx_pause),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_control), EFX_ETHTOOL_U64_MAC_STAT(rx_control),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_unicast), EFX_ETHTOOL_U64_MAC_STAT(rx_unicast),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_multicast), EFX_ETHTOOL_U64_MAC_STAT(rx_multicast),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_broadcast), EFX_ETHTOOL_U64_MAC_STAT(rx_broadcast),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_lt64), EFX_ETHTOOL_U64_MAC_STAT(rx_lt64),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_64), EFX_ETHTOOL_U64_MAC_STAT(rx_64),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_65_to_127), EFX_ETHTOOL_U64_MAC_STAT(rx_65_to_127),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_128_to_255), EFX_ETHTOOL_U64_MAC_STAT(rx_128_to_255),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_256_to_511), EFX_ETHTOOL_U64_MAC_STAT(rx_256_to_511),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_512_to_1023), EFX_ETHTOOL_U64_MAC_STAT(rx_512_to_1023),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_1024_to_15xx), EFX_ETHTOOL_U64_MAC_STAT(rx_1024_to_15xx),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_15xx_to_jumbo), EFX_ETHTOOL_U64_MAC_STAT(rx_15xx_to_jumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_gtjumbo), EFX_ETHTOOL_U64_MAC_STAT(rx_gtjumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_bad_lt64), EFX_ETHTOOL_U64_MAC_STAT(rx_bad_lt64),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_bad_64_to_15xx), EFX_ETHTOOL_U64_MAC_STAT(rx_bad_64_to_15xx),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_bad_15xx_to_jumbo), EFX_ETHTOOL_U64_MAC_STAT(rx_bad_15xx_to_jumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_bad_gtjumbo), EFX_ETHTOOL_U64_MAC_STAT(rx_bad_gtjumbo),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_overflow), EFX_ETHTOOL_U64_MAC_STAT(rx_overflow),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_missed), EFX_ETHTOOL_U64_MAC_STAT(rx_missed),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_false_carrier), EFX_ETHTOOL_U64_MAC_STAT(rx_false_carrier),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_symbol_error), EFX_ETHTOOL_U64_MAC_STAT(rx_symbol_error),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_align_error), EFX_ETHTOOL_U64_MAC_STAT(rx_align_error),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_length_error), EFX_ETHTOOL_U64_MAC_STAT(rx_length_error),
EFX_ETHTOOL_ULONG_MAC_STAT(rx_internal_error), EFX_ETHTOOL_U64_MAC_STAT(rx_internal_error),
EFX_ETHTOOL_UINT_NIC_STAT(rx_nodesc_drop_cnt), EFX_ETHTOOL_UINT_NIC_STAT(rx_nodesc_drop_cnt),
EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset), EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc),
...@@ -404,10 +395,6 @@ static int efx_ethtool_fill_self_tests(struct efx_nic *efx, ...@@ -404,10 +395,6 @@ static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
&tests->eventq_int[channel->channel], &tests->eventq_int[channel->channel],
EFX_CHANNEL_NAME(channel), EFX_CHANNEL_NAME(channel),
"eventq.int", NULL); "eventq.int", NULL);
efx_fill_test(n++, strings, data,
&tests->eventq_poll[channel->channel],
EFX_CHANNEL_NAME(channel),
"eventq.poll", NULL);
} }
efx_fill_test(n++, strings, data, &tests->registers, efx_fill_test(n++, strings, data, &tests->registers,
...@@ -486,16 +473,17 @@ static void efx_ethtool_get_stats(struct net_device *net_dev, ...@@ -486,16 +473,17 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct efx_mac_stats *mac_stats = &efx->mac_stats; struct efx_mac_stats *mac_stats = &efx->mac_stats;
struct efx_ethtool_stat *stat; const struct efx_ethtool_stat *stat;
struct efx_channel *channel; struct efx_channel *channel;
struct efx_tx_queue *tx_queue; struct efx_tx_queue *tx_queue;
struct rtnl_link_stats64 temp;
int i; int i;
EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS); EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS);
spin_lock_bh(&efx->stats_lock);
/* Update MAC and NIC statistics */ /* Update MAC and NIC statistics */
dev_get_stats(net_dev, &temp); efx->type->update_stats(efx);
/* Fill detailed statistics buffer */ /* Fill detailed statistics buffer */
for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) { for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) {
...@@ -525,6 +513,8 @@ static void efx_ethtool_get_stats(struct net_device *net_dev, ...@@ -525,6 +513,8 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
break; break;
} }
} }
spin_unlock_bh(&efx->stats_lock);
} }
static void efx_ethtool_self_test(struct net_device *net_dev, static void efx_ethtool_self_test(struct net_device *net_dev,
...@@ -747,7 +737,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, ...@@ -747,7 +737,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
/* Recover by resetting the EM block */ /* Recover by resetting the EM block */
falcon_stop_nic_stats(efx); falcon_stop_nic_stats(efx);
falcon_drain_tx_fifo(efx); falcon_drain_tx_fifo(efx);
efx->mac_op->reconfigure(efx); falcon_reconfigure_xmac(efx);
falcon_start_nic_stats(efx); falcon_start_nic_stats(efx);
} else { } else {
/* Schedule a reset to recover */ /* Schedule a reset to recover */
...@@ -772,7 +762,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, ...@@ -772,7 +762,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
/* Reconfigure the MAC. The PHY *may* generate a link state change event /* Reconfigure the MAC. The PHY *may* generate a link state change event
* if the user just changed the advertised capabilities, but there's no * if the user just changed the advertised capabilities, but there's no
* harm doing this twice */ * harm doing this twice */
efx->mac_op->reconfigure(efx); efx->type->reconfigure_mac(efx);
out: out:
mutex_unlock(&efx->mac_lock); mutex_unlock(&efx->mac_lock);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "net_driver.h" #include "net_driver.h"
#include "bitfield.h" #include "bitfield.h"
#include "efx.h" #include "efx.h"
#include "mac.h"
#include "spi.h" #include "spi.h"
#include "nic.h" #include "nic.h"
#include "regs.h" #include "regs.h"
...@@ -89,7 +88,7 @@ static int falcon_getscl(void *data) ...@@ -89,7 +88,7 @@ static int falcon_getscl(void *data)
return EFX_OWORD_FIELD(reg, FRF_AB_GPIO0_IN); return EFX_OWORD_FIELD(reg, FRF_AB_GPIO0_IN);
} }
static struct i2c_algo_bit_data falcon_i2c_bit_operations = { static const struct i2c_algo_bit_data falcon_i2c_bit_operations = {
.setsda = falcon_setsda, .setsda = falcon_setsda,
.setscl = falcon_setscl, .setscl = falcon_setscl,
.getsda = falcon_getsda, .getsda = falcon_getsda,
...@@ -104,8 +103,6 @@ static void falcon_push_irq_moderation(struct efx_channel *channel) ...@@ -104,8 +103,6 @@ static void falcon_push_irq_moderation(struct efx_channel *channel)
efx_dword_t timer_cmd; efx_dword_t timer_cmd;
struct efx_nic *efx = channel->efx; struct efx_nic *efx = channel->efx;
BUILD_BUG_ON(EFX_IRQ_MOD_MAX > (1 << FRF_AB_TC_TIMER_VAL_WIDTH));
/* Set timer register */ /* Set timer register */
if (channel->irq_moderation) { if (channel->irq_moderation) {
EFX_POPULATE_DWORD_2(timer_cmd, EFX_POPULATE_DWORD_2(timer_cmd,
...@@ -177,27 +174,24 @@ irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) ...@@ -177,27 +174,24 @@ irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id)
"IRQ %d on CPU %d status " EFX_OWORD_FMT "\n", "IRQ %d on CPU %d status " EFX_OWORD_FMT "\n",
irq, raw_smp_processor_id(), EFX_OWORD_VAL(*int_ker)); irq, raw_smp_processor_id(), EFX_OWORD_VAL(*int_ker));
/* Determine interrupting queues, clear interrupt status
* register and acknowledge the device interrupt.
*/
BUILD_BUG_ON(FSF_AZ_NET_IVEC_INT_Q_WIDTH > EFX_MAX_CHANNELS);
queues = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_INT_Q);
/* Check to see if we have a serious error condition */ /* Check to see if we have a serious error condition */
if (queues & (1U << efx->fatal_irq_level)) {
syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT); syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT);
if (unlikely(syserr)) if (unlikely(syserr))
return efx_nic_fatal_interrupt(efx); return efx_nic_fatal_interrupt(efx);
}
/* Determine interrupting queues, clear interrupt status
* register and acknowledge the device interrupt.
*/
BUILD_BUG_ON(FSF_AZ_NET_IVEC_INT_Q_WIDTH > EFX_MAX_CHANNELS);
queues = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_INT_Q);
EFX_ZERO_OWORD(*int_ker); EFX_ZERO_OWORD(*int_ker);
wmb(); /* Ensure the vector is cleared before interrupt ack */ wmb(); /* Ensure the vector is cleared before interrupt ack */
falcon_irq_ack_a1(efx); falcon_irq_ack_a1(efx);
if (queues & 1) if (queues & 1)
efx_schedule_channel(efx_get_channel(efx, 0)); efx_schedule_channel_irq(efx_get_channel(efx, 0));
if (queues & 2) if (queues & 2)
efx_schedule_channel(efx_get_channel(efx, 1)); efx_schedule_channel_irq(efx_get_channel(efx, 1));
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/************************************************************************** /**************************************************************************
...@@ -613,7 +607,7 @@ static void falcon_stats_complete(struct efx_nic *efx) ...@@ -613,7 +607,7 @@ static void falcon_stats_complete(struct efx_nic *efx)
nic_data->stats_pending = false; nic_data->stats_pending = false;
if (*nic_data->stats_dma_done == FALCON_STATS_DONE) { if (*nic_data->stats_dma_done == FALCON_STATS_DONE) {
rmb(); /* read the done flag before the stats */ rmb(); /* read the done flag before the stats */
efx->mac_op->update_stats(efx); falcon_update_stats_xmac(efx);
} else { } else {
netif_err(efx, hw, efx->net_dev, netif_err(efx, hw, efx->net_dev,
"timed out waiting for statistics\n"); "timed out waiting for statistics\n");
...@@ -670,7 +664,7 @@ static int falcon_reconfigure_port(struct efx_nic *efx) ...@@ -670,7 +664,7 @@ static int falcon_reconfigure_port(struct efx_nic *efx)
falcon_reset_macs(efx); falcon_reset_macs(efx);
efx->phy_op->reconfigure(efx); efx->phy_op->reconfigure(efx);
rc = efx->mac_op->reconfigure(efx); rc = falcon_reconfigure_xmac(efx);
BUG_ON(rc); BUG_ON(rc);
falcon_start_nic_stats(efx); falcon_start_nic_stats(efx);
...@@ -1218,7 +1212,7 @@ static void falcon_monitor(struct efx_nic *efx) ...@@ -1218,7 +1212,7 @@ static void falcon_monitor(struct efx_nic *efx)
falcon_deconfigure_mac_wrapper(efx); falcon_deconfigure_mac_wrapper(efx);
falcon_reset_macs(efx); falcon_reset_macs(efx);
rc = efx->mac_op->reconfigure(efx); rc = falcon_reconfigure_xmac(efx);
BUG_ON(rc); BUG_ON(rc);
falcon_start_nic_stats(efx); falcon_start_nic_stats(efx);
...@@ -1472,6 +1466,8 @@ static int falcon_probe_nic(struct efx_nic *efx) ...@@ -1472,6 +1466,8 @@ static int falcon_probe_nic(struct efx_nic *efx)
goto fail5; goto fail5;
} }
efx->timer_quantum_ns = 4968; /* 621 cycles */
/* Initialise I2C adapter */ /* Initialise I2C adapter */
board = falcon_board(efx); board = falcon_board(efx);
board->i2c_adap.owner = THIS_MODULE; board->i2c_adap.owner = THIS_MODULE;
...@@ -1676,7 +1672,7 @@ static void falcon_update_nic_stats(struct efx_nic *efx) ...@@ -1676,7 +1672,7 @@ static void falcon_update_nic_stats(struct efx_nic *efx)
*nic_data->stats_dma_done == FALCON_STATS_DONE) { *nic_data->stats_dma_done == FALCON_STATS_DONE) {
nic_data->stats_pending = false; nic_data->stats_pending = false;
rmb(); /* read the done flag before the stats */ rmb(); /* read the done flag before the stats */
efx->mac_op->update_stats(efx); falcon_update_stats_xmac(efx);
} }
} }
...@@ -1767,13 +1763,13 @@ const struct efx_nic_type falcon_a1_nic_type = { ...@@ -1767,13 +1763,13 @@ const struct efx_nic_type falcon_a1_nic_type = {
.stop_stats = falcon_stop_nic_stats, .stop_stats = falcon_stop_nic_stats,
.set_id_led = falcon_set_id_led, .set_id_led = falcon_set_id_led,
.push_irq_moderation = falcon_push_irq_moderation, .push_irq_moderation = falcon_push_irq_moderation,
.push_multicast_hash = falcon_push_multicast_hash,
.reconfigure_port = falcon_reconfigure_port, .reconfigure_port = falcon_reconfigure_port,
.reconfigure_mac = falcon_reconfigure_xmac,
.check_mac_fault = falcon_xmac_check_fault,
.get_wol = falcon_get_wol, .get_wol = falcon_get_wol,
.set_wol = falcon_set_wol, .set_wol = falcon_set_wol,
.resume_wol = efx_port_dummy_op_void, .resume_wol = efx_port_dummy_op_void,
.test_nvram = falcon_test_nvram, .test_nvram = falcon_test_nvram,
.default_mac_ops = &falcon_xmac_operations,
.revision = EFX_REV_FALCON_A1, .revision = EFX_REV_FALCON_A1,
.mem_map_size = 0x20000, .mem_map_size = 0x20000,
...@@ -1786,6 +1782,7 @@ const struct efx_nic_type falcon_a1_nic_type = { ...@@ -1786,6 +1782,7 @@ const struct efx_nic_type falcon_a1_nic_type = {
.rx_buffer_padding = 0x24, .rx_buffer_padding = 0x24,
.max_interrupt_mode = EFX_INT_MODE_MSI, .max_interrupt_mode = EFX_INT_MODE_MSI,
.phys_addr_channels = 4, .phys_addr_channels = 4,
.timer_period_max = 1 << FRF_AB_TC_TIMER_VAL_WIDTH,
.tx_dc_base = 0x130000, .tx_dc_base = 0x130000,
.rx_dc_base = 0x100000, .rx_dc_base = 0x100000,
.offload_features = NETIF_F_IP_CSUM, .offload_features = NETIF_F_IP_CSUM,
...@@ -1809,14 +1806,14 @@ const struct efx_nic_type falcon_b0_nic_type = { ...@@ -1809,14 +1806,14 @@ const struct efx_nic_type falcon_b0_nic_type = {
.stop_stats = falcon_stop_nic_stats, .stop_stats = falcon_stop_nic_stats,
.set_id_led = falcon_set_id_led, .set_id_led = falcon_set_id_led,
.push_irq_moderation = falcon_push_irq_moderation, .push_irq_moderation = falcon_push_irq_moderation,
.push_multicast_hash = falcon_push_multicast_hash,
.reconfigure_port = falcon_reconfigure_port, .reconfigure_port = falcon_reconfigure_port,
.reconfigure_mac = falcon_reconfigure_xmac,
.check_mac_fault = falcon_xmac_check_fault,
.get_wol = falcon_get_wol, .get_wol = falcon_get_wol,
.set_wol = falcon_set_wol, .set_wol = falcon_set_wol,
.resume_wol = efx_port_dummy_op_void, .resume_wol = efx_port_dummy_op_void,
.test_registers = falcon_b0_test_registers, .test_registers = falcon_b0_test_registers,
.test_nvram = falcon_test_nvram, .test_nvram = falcon_test_nvram,
.default_mac_ops = &falcon_xmac_operations,
.revision = EFX_REV_FALCON_B0, .revision = EFX_REV_FALCON_B0,
/* Map everything up to and including the RSS indirection /* Map everything up to and including the RSS indirection
...@@ -1837,6 +1834,7 @@ const struct efx_nic_type falcon_b0_nic_type = { ...@@ -1837,6 +1834,7 @@ const struct efx_nic_type falcon_b0_nic_type = {
.phys_addr_channels = 32, /* Hardware limit is 64, but the legacy .phys_addr_channels = 32, /* Hardware limit is 64, but the legacy
* interrupt handler only supports 32 * interrupt handler only supports 32
* channels */ * channels */
.timer_period_max = 1 << FRF_AB_TC_TIMER_VAL_WIDTH,
.tx_dc_base = 0x130000, .tx_dc_base = 0x130000,
.rx_dc_base = 0x100000, .rx_dc_base = 0x100000,
.offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE, .offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE,
......
...@@ -87,7 +87,7 @@ static const u8 falcon_lm87_common_regs[] = { ...@@ -87,7 +87,7 @@ static const u8 falcon_lm87_common_regs[] = {
0 0
}; };
static int efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info, static int efx_init_lm87(struct efx_nic *efx, const struct i2c_board_info *info,
const u8 *reg_values) const u8 *reg_values)
{ {
struct falcon_board *board = falcon_board(efx); struct falcon_board *board = falcon_board(efx);
...@@ -179,7 +179,7 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask) ...@@ -179,7 +179,7 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask)
#else /* !CONFIG_SENSORS_LM87 */ #else /* !CONFIG_SENSORS_LM87 */
static inline int static inline int
efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info, efx_init_lm87(struct efx_nic *efx, const struct i2c_board_info *info,
const u8 *reg_values) const u8 *reg_values)
{ {
return 0; return 0;
...@@ -442,7 +442,7 @@ static int sfe4001_check_hw(struct efx_nic *efx) ...@@ -442,7 +442,7 @@ static int sfe4001_check_hw(struct efx_nic *efx)
return (status < 0) ? -EIO : -ERANGE; return (status < 0) ? -EIO : -ERANGE;
} }
static struct i2c_board_info sfe4001_hwmon_info = { static const struct i2c_board_info sfe4001_hwmon_info = {
I2C_BOARD_INFO("max6647", 0x4e), I2C_BOARD_INFO("max6647", 0x4e),
}; };
...@@ -522,7 +522,7 @@ static const u8 sfe4002_lm87_regs[] = { ...@@ -522,7 +522,7 @@ static const u8 sfe4002_lm87_regs[] = {
0 0
}; };
static struct i2c_board_info sfe4002_hwmon_info = { static const struct i2c_board_info sfe4002_hwmon_info = {
I2C_BOARD_INFO("lm87", 0x2e), I2C_BOARD_INFO("lm87", 0x2e),
.platform_data = &sfe4002_lm87_channel, .platform_data = &sfe4002_lm87_channel,
}; };
...@@ -591,7 +591,7 @@ static const u8 sfn4112f_lm87_regs[] = { ...@@ -591,7 +591,7 @@ static const u8 sfn4112f_lm87_regs[] = {
0 0
}; };
static struct i2c_board_info sfn4112f_hwmon_info = { static const struct i2c_board_info sfn4112f_hwmon_info = {
I2C_BOARD_INFO("lm87", 0x2e), I2C_BOARD_INFO("lm87", 0x2e),
.platform_data = &sfn4112f_lm87_channel, .platform_data = &sfn4112f_lm87_channel,
}; };
...@@ -653,7 +653,7 @@ static const u8 sfe4003_lm87_regs[] = { ...@@ -653,7 +653,7 @@ static const u8 sfe4003_lm87_regs[] = {
0 0
}; };
static struct i2c_board_info sfe4003_hwmon_info = { static const struct i2c_board_info sfe4003_hwmon_info = {
I2C_BOARD_INFO("lm87", 0x2e), I2C_BOARD_INFO("lm87", 0x2e),
.platform_data = &sfe4003_lm87_channel, .platform_data = &sfe4003_lm87_channel,
}; };
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "nic.h" #include "nic.h"
#include "regs.h" #include "regs.h"
#include "io.h" #include "io.h"
#include "mac.h"
#include "mdio_10g.h" #include "mdio_10g.h"
#include "workarounds.h" #include "workarounds.h"
...@@ -270,12 +269,12 @@ static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries) ...@@ -270,12 +269,12 @@ static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries)
return mac_up; return mac_up;
} }
static bool falcon_xmac_check_fault(struct efx_nic *efx) bool falcon_xmac_check_fault(struct efx_nic *efx)
{ {
return !falcon_xmac_link_ok_retry(efx, 5); return !falcon_xmac_link_ok_retry(efx, 5);
} }
static int falcon_reconfigure_xmac(struct efx_nic *efx) int falcon_reconfigure_xmac(struct efx_nic *efx)
{ {
struct falcon_nic_data *nic_data = efx->nic_data; struct falcon_nic_data *nic_data = efx->nic_data;
...@@ -290,7 +289,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx) ...@@ -290,7 +289,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
return 0; return 0;
} }
static void falcon_update_stats_xmac(struct efx_nic *efx) void falcon_update_stats_xmac(struct efx_nic *efx)
{ {
struct efx_mac_stats *mac_stats = &efx->mac_stats; struct efx_mac_stats *mac_stats = &efx->mac_stats;
...@@ -361,9 +360,3 @@ void falcon_poll_xmac(struct efx_nic *efx) ...@@ -361,9 +360,3 @@ void falcon_poll_xmac(struct efx_nic *efx)
nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1); nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
falcon_ack_status_intr(efx); falcon_ack_status_intr(efx);
} }
const struct efx_mac_operations falcon_xmac_operations = {
.reconfigure = falcon_reconfigure_xmac,
.update_stats = falcon_update_stats_xmac,
.check_fault = falcon_xmac_check_fault,
};
/****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2009 Solarflare Communications Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation, incorporated herein by reference.
*/
#ifndef EFX_MAC_H
#define EFX_MAC_H
#include "net_driver.h"
extern const struct efx_mac_operations falcon_xmac_operations;
extern const struct efx_mac_operations efx_mcdi_mac_operations;
extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 dma_len, int enable, int clear);
#endif
...@@ -22,22 +22,22 @@ ...@@ -22,22 +22,22 @@
************************************************************************** **************************************************************************
*/ */
/* Software-defined structure to the shared-memory */
#define CMD_NOTIFY_PORT0 0
#define CMD_NOTIFY_PORT1 4
#define CMD_PDU_PORT0 0x008
#define CMD_PDU_PORT1 0x108
#define REBOOT_FLAG_PORT0 0x3f8
#define REBOOT_FLAG_PORT1 0x3fc
#define MCDI_RPC_TIMEOUT 10 /*seconds */ #define MCDI_RPC_TIMEOUT 10 /*seconds */
#define MCDI_PDU(efx) \ #define MCDI_PDU(efx) \
(efx_port_num(efx) ? CMD_PDU_PORT1 : CMD_PDU_PORT0) (efx_port_num(efx) ? MC_SMEM_P1_PDU_OFST : MC_SMEM_P0_PDU_OFST)
#define MCDI_DOORBELL(efx) \ #define MCDI_DOORBELL(efx) \
(efx_port_num(efx) ? CMD_NOTIFY_PORT1 : CMD_NOTIFY_PORT0) (efx_port_num(efx) ? MC_SMEM_P1_DOORBELL_OFST : MC_SMEM_P0_DOORBELL_OFST)
#define MCDI_REBOOT_FLAG(efx) \ #define MCDI_STATUS(efx) \
(efx_port_num(efx) ? REBOOT_FLAG_PORT1 : REBOOT_FLAG_PORT0) (efx_port_num(efx) ? MC_SMEM_P1_STATUS_OFST : MC_SMEM_P0_STATUS_OFST)
/* A reboot/assertion causes the MCDI status word to be set after the
* command word is set or a REBOOT event is sent. If we notice a reboot
* via these mechanisms then wait 10ms for the status word to be set. */
#define MCDI_STATUS_DELAY_US 100
#define MCDI_STATUS_DELAY_COUNT 100
#define MCDI_STATUS_SLEEP_MS \
(MCDI_STATUS_DELAY_US * MCDI_STATUS_DELAY_COUNT / 1000)
#define SEQ_MASK \ #define SEQ_MASK \
EFX_MASK32(EFX_WIDTH(MCDI_HEADER_SEQ)) EFX_MASK32(EFX_WIDTH(MCDI_HEADER_SEQ))
...@@ -77,7 +77,7 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd, ...@@ -77,7 +77,7 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
u32 xflags, seqno; u32 xflags, seqno;
BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT);
BUG_ON(inlen & 3 || inlen >= 0x100); BUG_ON(inlen & 3 || inlen >= MC_SMEM_PDU_LEN);
seqno = mcdi->seqno & SEQ_MASK; seqno = mcdi->seqno & SEQ_MASK;
xflags = 0; xflags = 0;
...@@ -111,7 +111,7 @@ static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) ...@@ -111,7 +111,7 @@ static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen)
int i; int i;
BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT);
BUG_ON(outlen & 3 || outlen >= 0x100); BUG_ON(outlen & 3 || outlen >= MC_SMEM_PDU_LEN);
for (i = 0; i < outlen; i += 4) for (i = 0; i < outlen; i += 4)
*((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i); *((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i);
...@@ -210,7 +210,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) ...@@ -210,7 +210,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
/* Test and clear MC-rebooted flag for this port/function */ /* Test and clear MC-rebooted flag for this port/function */
int efx_mcdi_poll_reboot(struct efx_nic *efx) int efx_mcdi_poll_reboot(struct efx_nic *efx)
{ {
unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_REBOOT_FLAG(efx); unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx);
efx_dword_t reg; efx_dword_t reg;
uint32_t value; uint32_t value;
...@@ -384,6 +384,11 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, ...@@ -384,6 +384,11 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
netif_dbg(efx, hw, efx->net_dev, netif_dbg(efx, hw, efx->net_dev,
"MC command 0x%x inlen %d failed rc=%d\n", "MC command 0x%x inlen %d failed rc=%d\n",
cmd, (int)inlen, -rc); cmd, (int)inlen, -rc);
if (rc == -EIO || rc == -EINTR) {
msleep(MCDI_STATUS_SLEEP_MS);
efx_mcdi_poll_reboot(efx);
}
} }
efx_mcdi_release(mcdi); efx_mcdi_release(mcdi);
...@@ -465,10 +470,20 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc) ...@@ -465,10 +470,20 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc)
mcdi->resplen = 0; mcdi->resplen = 0;
++mcdi->credits; ++mcdi->credits;
} }
} else } else {
int count;
/* Nobody was waiting for an MCDI request, so trigger a reset */ /* Nobody was waiting for an MCDI request, so trigger a reset */
efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE);
/* Consume the status word since efx_mcdi_rpc_finish() won't */
for (count = 0; count < MCDI_STATUS_DELAY_COUNT; ++count) {
if (efx_mcdi_poll_reboot(efx))
break;
udelay(MCDI_STATUS_DELAY_US);
}
}
spin_unlock(&mcdi->iface_lock); spin_unlock(&mcdi->iface_lock);
} }
...@@ -502,49 +517,6 @@ static void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) ...@@ -502,49 +517,6 @@ static void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev)
efx_link_status_changed(efx); efx_link_status_changed(efx);
} }
static const char *sensor_names[] = {
[MC_CMD_SENSOR_CONTROLLER_TEMP] = "Controller temp. sensor",
[MC_CMD_SENSOR_PHY_COMMON_TEMP] = "PHY shared temp. sensor",
[MC_CMD_SENSOR_CONTROLLER_COOLING] = "Controller cooling",
[MC_CMD_SENSOR_PHY0_TEMP] = "PHY 0 temp. sensor",
[MC_CMD_SENSOR_PHY0_COOLING] = "PHY 0 cooling",
[MC_CMD_SENSOR_PHY1_TEMP] = "PHY 1 temp. sensor",
[MC_CMD_SENSOR_PHY1_COOLING] = "PHY 1 cooling",
[MC_CMD_SENSOR_IN_1V0] = "1.0V supply sensor",
[MC_CMD_SENSOR_IN_1V2] = "1.2V supply sensor",
[MC_CMD_SENSOR_IN_1V8] = "1.8V supply sensor",
[MC_CMD_SENSOR_IN_2V5] = "2.5V supply sensor",
[MC_CMD_SENSOR_IN_3V3] = "3.3V supply sensor",
[MC_CMD_SENSOR_IN_12V0] = "12V supply sensor"
};
static const char *sensor_status_names[] = {
[MC_CMD_SENSOR_STATE_OK] = "OK",
[MC_CMD_SENSOR_STATE_WARNING] = "Warning",
[MC_CMD_SENSOR_STATE_FATAL] = "Fatal",
[MC_CMD_SENSOR_STATE_BROKEN] = "Device failure",
};
static void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
{
unsigned int monitor, state, value;
const char *name, *state_txt;
monitor = EFX_QWORD_FIELD(*ev, MCDI_EVENT_SENSOREVT_MONITOR);
state = EFX_QWORD_FIELD(*ev, MCDI_EVENT_SENSOREVT_STATE);
value = EFX_QWORD_FIELD(*ev, MCDI_EVENT_SENSOREVT_VALUE);
/* Deal gracefully with the board having more drivers than we
* know about, but do not expect new sensor states. */
name = (monitor >= ARRAY_SIZE(sensor_names))
? "No sensor name available" :
sensor_names[monitor];
EFX_BUG_ON_PARANOID(state >= ARRAY_SIZE(sensor_status_names));
state_txt = sensor_status_names[state];
netif_err(efx, hw, efx->net_dev,
"Sensor %d (%s) reports condition '%s' for raw value %d\n",
monitor, name, state_txt, value);
}
/* Called from falcon_process_eventq for MCDI events */ /* Called from falcon_process_eventq for MCDI events */
void efx_mcdi_process_event(struct efx_channel *channel, void efx_mcdi_process_event(struct efx_channel *channel,
efx_qword_t *event) efx_qword_t *event)
...@@ -604,7 +576,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -604,7 +576,7 @@ void efx_mcdi_process_event(struct efx_channel *channel,
void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
{ {
u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)]; u8 outbuf[ALIGN(MC_CMD_GET_VERSION_OUT_LEN, 4)];
size_t outlength; size_t outlength;
const __le16 *ver_words; const __le16 *ver_words;
int rc; int rc;
...@@ -616,7 +588,7 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) ...@@ -616,7 +588,7 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
if (rc) if (rc)
goto fail; goto fail;
if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) { if (outlength < MC_CMD_GET_VERSION_OUT_LEN) {
rc = -EIO; rc = -EIO;
goto fail; goto fail;
} }
...@@ -663,9 +635,9 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, ...@@ -663,9 +635,9 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
} }
int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
u16 *fw_subtype_list) u16 *fw_subtype_list, u32 *capabilities)
{ {
uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN]; uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
size_t outlen; size_t outlen;
int port_num = efx_port_num(efx); int port_num = efx_port_num(efx);
int offset; int offset;
...@@ -678,7 +650,7 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -678,7 +650,7 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
if (rc) if (rc)
goto fail; goto fail;
if (outlen < MC_CMD_GET_BOARD_CFG_OUT_LEN) { if (outlen < MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = -EIO; rc = -EIO;
goto fail; goto fail;
} }
...@@ -691,7 +663,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -691,7 +663,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
if (fw_subtype_list) if (fw_subtype_list)
memcpy(fw_subtype_list, memcpy(fw_subtype_list,
outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,
MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN); MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *
sizeof(fw_subtype_list[0]));
if (capabilities) {
if (port_num)
*capabilities = MCDI_DWORD(outbuf,
GET_BOARD_CFG_OUT_CAPABILITIES_PORT1);
else
*capabilities = MCDI_DWORD(outbuf,
GET_BOARD_CFG_OUT_CAPABILITIES_PORT0);
}
return 0; return 0;
...@@ -779,7 +760,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, ...@@ -779,7 +760,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type,
*size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_SIZE); *size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_SIZE);
*erase_size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_ERASESIZE); *erase_size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_ERASESIZE);
*protected_out = !!(MCDI_DWORD(outbuf, NVRAM_INFO_OUT_FLAGS) & *protected_out = !!(MCDI_DWORD(outbuf, NVRAM_INFO_OUT_FLAGS) &
(1 << MC_CMD_NVRAM_PROTECTED_LBN)); (1 << MC_CMD_NVRAM_INFO_OUT_PROTECTED_LBN));
return 0; return 0;
fail: fail:
...@@ -1060,7 +1041,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) ...@@ -1060,7 +1041,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
int efx_mcdi_reset_port(struct efx_nic *efx) int efx_mcdi_reset_port(struct efx_nic *efx)
{ {
int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL); int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL);
if (rc) if (rc)
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc); __func__, rc);
......
...@@ -56,6 +56,15 @@ struct efx_mcdi_iface { ...@@ -56,6 +56,15 @@ struct efx_mcdi_iface {
size_t resplen; size_t resplen;
}; };
struct efx_mcdi_mon {
struct efx_buffer dma_buf;
struct mutex update_lock;
unsigned long last_update;
struct device *device;
struct efx_mcdi_mon_attribute *attrs;
unsigned int n_attrs;
};
extern void efx_mcdi_init(struct efx_nic *efx); extern void efx_mcdi_init(struct efx_nic *efx);
extern int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const u8 *inbuf, extern int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const u8 *inbuf,
...@@ -68,6 +77,7 @@ extern void efx_mcdi_mode_event(struct efx_nic *efx); ...@@ -68,6 +77,7 @@ extern void efx_mcdi_mode_event(struct efx_nic *efx);
extern void efx_mcdi_process_event(struct efx_channel *channel, extern void efx_mcdi_process_event(struct efx_channel *channel,
efx_qword_t *event); efx_qword_t *event);
extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
#define MCDI_PTR2(_buf, _ofst) \ #define MCDI_PTR2(_buf, _ofst) \
(((u8 *)_buf) + _ofst) (((u8 *)_buf) + _ofst)
...@@ -83,6 +93,10 @@ extern void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -83,6 +93,10 @@ extern void efx_mcdi_process_event(struct efx_channel *channel,
#define MCDI_PTR(_buf, _ofst) \ #define MCDI_PTR(_buf, _ofst) \
MCDI_PTR2(_buf, MC_CMD_ ## _ofst ## _OFST) MCDI_PTR2(_buf, MC_CMD_ ## _ofst ## _OFST)
#define MCDI_ARRAY_PTR(_buf, _field, _type, _index) \
MCDI_PTR2(_buf, \
MC_CMD_ ## _field ## _OFST + \
(_index) * MC_CMD_ ## _type ## _TYPEDEF_LEN)
#define MCDI_SET_DWORD(_buf, _ofst, _value) \ #define MCDI_SET_DWORD(_buf, _ofst, _value) \
MCDI_SET_DWORD2(_buf, MC_CMD_ ## _ofst ## _OFST, _value) MCDI_SET_DWORD2(_buf, MC_CMD_ ## _ofst ## _OFST, _value)
#define MCDI_DWORD(_buf, _ofst) \ #define MCDI_DWORD(_buf, _ofst) \
...@@ -92,12 +106,18 @@ extern void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -92,12 +106,18 @@ extern void efx_mcdi_process_event(struct efx_channel *channel,
#define MCDI_EVENT_FIELD(_ev, _field) \ #define MCDI_EVENT_FIELD(_ev, _field) \
EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
#define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \
EFX_DWORD_FIELD( \
*((efx_dword_t *) \
(MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \
(MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _OFST & ~3))), \
MC_CMD_ ## _type ## _TYPEDEF_ ## _field2)
extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
bool *was_attached_out); bool *was_attached_out);
extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
u16 *fw_subtype_list); u16 *fw_subtype_list, u32 *capabilities);
extern int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, extern int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart,
u32 dest_evq); u32 dest_evq);
extern int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); extern int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out);
...@@ -126,5 +146,17 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, ...@@ -126,5 +146,17 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,
extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id);
extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx); extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx);
extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 dma_len, int enable, int clear);
extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx);
extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx);
#ifdef CONFIG_SFC_MCDI_MON
extern int efx_mcdi_mon_probe(struct efx_nic *efx);
extern void efx_mcdi_mon_remove(struct efx_nic *efx);
#else
static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; }
static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {}
#endif
#endif /* EFX_MCDI_H */ #endif /* EFX_MCDI_H */
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "net_driver.h" #include "net_driver.h"
#include "efx.h" #include "efx.h"
#include "mac.h"
#include "mcdi.h" #include "mcdi.h"
#include "mcdi_pcol.h" #include "mcdi_pcol.h"
...@@ -52,7 +51,7 @@ static int efx_mcdi_set_mac(struct efx_nic *efx) ...@@ -52,7 +51,7 @@ static int efx_mcdi_set_mac(struct efx_nic *efx)
NULL, 0, NULL); NULL, 0, NULL);
} }
static int efx_mcdi_get_mac_faults(struct efx_nic *efx, u32 *faults) bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
{ {
u8 outbuf[MC_CMD_GET_LINK_OUT_LEN]; u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
size_t outlength; size_t outlength;
...@@ -62,16 +61,13 @@ static int efx_mcdi_get_mac_faults(struct efx_nic *efx, u32 *faults) ...@@ -62,16 +61,13 @@ static int efx_mcdi_get_mac_faults(struct efx_nic *efx, u32 *faults)
rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
outbuf, sizeof(outbuf), &outlength); outbuf, sizeof(outbuf), &outlength);
if (rc) if (rc) {
goto fail;
*faults = MCDI_DWORD(outbuf, GET_LINK_OUT_MAC_FAULT);
return 0;
fail:
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc); __func__, rc);
return rc; return true;
}
return MCDI_DWORD(outbuf, GET_LINK_OUT_MAC_FAULT) != 0;
} }
int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
...@@ -84,7 +80,7 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -84,7 +80,7 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 addr_hi; u32 addr_hi;
u32 addr_lo; u32 addr_lo;
BUILD_BUG_ON(MC_CMD_MAC_STATS_OUT_LEN != 0); BUILD_BUG_ON(MC_CMD_MAC_STATS_OUT_DMA_LEN != 0);
addr_lo = ((u64)dma_addr) >> 0; addr_lo = ((u64)dma_addr) >> 0;
addr_hi = ((u64)dma_addr) >> 32; addr_hi = ((u64)dma_addr) >> 32;
...@@ -93,13 +89,13 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -93,13 +89,13 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_ADDR_HI, addr_hi); MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_ADDR_HI, addr_hi);
cmd_ptr = (efx_dword_t *)MCDI_PTR(inbuf, MAC_STATS_IN_CMD); cmd_ptr = (efx_dword_t *)MCDI_PTR(inbuf, MAC_STATS_IN_CMD);
EFX_POPULATE_DWORD_7(*cmd_ptr, EFX_POPULATE_DWORD_7(*cmd_ptr,
MC_CMD_MAC_STATS_CMD_DMA, !!enable, MC_CMD_MAC_STATS_IN_DMA, !!enable,
MC_CMD_MAC_STATS_CMD_CLEAR, clear, MC_CMD_MAC_STATS_IN_CLEAR, clear,
MC_CMD_MAC_STATS_CMD_PERIODIC_CHANGE, 1, MC_CMD_MAC_STATS_IN_PERIODIC_CHANGE, 1,
MC_CMD_MAC_STATS_CMD_PERIODIC_ENABLE, !!enable, MC_CMD_MAC_STATS_IN_PERIODIC_ENABLE, !!enable,
MC_CMD_MAC_STATS_CMD_PERIODIC_CLEAR, 0, MC_CMD_MAC_STATS_IN_PERIODIC_CLEAR, 0,
MC_CMD_MAC_STATS_CMD_PERIODIC_NOEVENT, 1, MC_CMD_MAC_STATS_IN_PERIODIC_NOEVENT, 1,
MC_CMD_MAC_STATS_CMD_PERIOD_MS, period); MC_CMD_MAC_STATS_IN_PERIOD_MS, period);
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len); MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len);
rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf),
...@@ -115,31 +111,18 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -115,31 +111,18 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
return rc; return rc;
} }
static int efx_mcdi_mac_reconfigure(struct efx_nic *efx) int efx_mcdi_mac_reconfigure(struct efx_nic *efx)
{ {
int rc; int rc;
WARN_ON(!mutex_is_locked(&efx->mac_lock));
rc = efx_mcdi_set_mac(efx); rc = efx_mcdi_set_mac(efx);
if (rc != 0) if (rc != 0)
return rc; return rc;
/* Restore the multicast hash registers. */ return efx_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH,
efx->type->push_multicast_hash(efx); efx->multicast_hash.byte,
sizeof(efx->multicast_hash),
return 0; NULL, 0, NULL);
}
static bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
{
u32 faults;
int rc = efx_mcdi_get_mac_faults(efx, &faults);
return (rc != 0) || (faults != 0);
} }
const struct efx_mac_operations efx_mcdi_mac_operations = {
.reconfigure = efx_mcdi_mac_reconfigure,
.update_stats = efx_port_dummy_op_void,
.check_fault = efx_mcdi_mac_check_fault,
};
This diff is collapsed.
This diff is collapsed.
...@@ -116,7 +116,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) ...@@ -116,7 +116,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes)
goto fail; goto fail;
} }
*loopback_modes = MCDI_QWORD(outbuf, GET_LOOPBACK_MODES_SUGGESTED); *loopback_modes = MCDI_QWORD(outbuf, GET_LOOPBACK_MODES_OUT_SUGGESTED);
return 0; return 0;
...@@ -264,22 +264,22 @@ static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx) ...@@ -264,22 +264,22 @@ static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx)
/* TODO: Advertise the capabilities supported by this PHY */ /* TODO: Advertise the capabilities supported by this PHY */
supported = 0; supported = 0;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_TXDIS_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_TXDIS_LBN))
supported |= PHY_MODE_TX_DISABLED; supported |= PHY_MODE_TX_DISABLED;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_LOWPOWER_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_LOWPOWER_LBN))
supported |= PHY_MODE_LOW_POWER; supported |= PHY_MODE_LOW_POWER;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_POWEROFF_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_POWEROFF_LBN))
supported |= PHY_MODE_OFF; supported |= PHY_MODE_OFF;
mode = efx->phy_mode & supported; mode = efx->phy_mode & supported;
flags = 0; flags = 0;
if (mode & PHY_MODE_TX_DISABLED) if (mode & PHY_MODE_TX_DISABLED)
flags |= (1 << MC_CMD_SET_LINK_TXDIS_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_TXDIS_LBN);
if (mode & PHY_MODE_LOW_POWER) if (mode & PHY_MODE_LOW_POWER)
flags |= (1 << MC_CMD_SET_LINK_LOWPOWER_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_LOWPOWER_LBN);
if (mode & PHY_MODE_OFF) if (mode & PHY_MODE_OFF)
flags |= (1 << MC_CMD_SET_LINK_POWEROFF_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_POWEROFF_LBN);
return flags; return flags;
} }
...@@ -436,8 +436,8 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx, ...@@ -436,8 +436,8 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx,
break; break;
} }
link_state->up = !!(flags & (1 << MC_CMD_GET_LINK_LINK_UP_LBN)); link_state->up = !!(flags & (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
link_state->fd = !!(flags & (1 << MC_CMD_GET_LINK_FULL_DUPLEX_LBN)); link_state->fd = !!(flags & (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
link_state->speed = speed; link_state->speed = speed;
} }
...@@ -592,7 +592,7 @@ static int efx_mcdi_phy_test_alive(struct efx_nic *efx) ...@@ -592,7 +592,7 @@ static int efx_mcdi_phy_test_alive(struct efx_nic *efx)
if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN) if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN)
return -EIO; return -EIO;
if (MCDI_DWORD(outbuf, GET_PHY_STATE_STATE) != MC_CMD_PHY_STATE_OK) if (MCDI_DWORD(outbuf, GET_PHY_STATE_OUT_STATE) != MC_CMD_PHY_STATE_OK)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -680,7 +680,7 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, ...@@ -680,7 +680,7 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
u32 mode; u32 mode;
int rc; int rc;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_LBN)) {
rc = efx_mcdi_bist(efx, MC_CMD_PHY_BIST, results); rc = efx_mcdi_bist(efx, MC_CMD_PHY_BIST, results);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -691,15 +691,15 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, ...@@ -691,15 +691,15 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
/* If we support both LONG and SHORT, then run each in response to /* If we support both LONG and SHORT, then run each in response to
* break or not. Otherwise, run the one we support */ * break or not. Otherwise, run the one we support */
mode = 0; mode = 0;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_SHORT_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_SHORT_LBN)) {
if ((flags & ETH_TEST_FL_OFFLINE) && if ((flags & ETH_TEST_FL_OFFLINE) &&
(phy_cfg->flags & (phy_cfg->flags &
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN))) (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN)))
mode = MC_CMD_PHY_BIST_CABLE_LONG; mode = MC_CMD_PHY_BIST_CABLE_LONG;
else else
mode = MC_CMD_PHY_BIST_CABLE_SHORT; mode = MC_CMD_PHY_BIST_CABLE_SHORT;
} else if (phy_cfg->flags & } else if (phy_cfg->flags &
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN)) (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN))
mode = MC_CMD_PHY_BIST_CABLE_LONG; mode = MC_CMD_PHY_BIST_CABLE_LONG;
if (mode != 0) { if (mode != 0) {
...@@ -717,14 +717,14 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx, ...@@ -717,14 +717,14 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx,
{ {
struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_LBN)) {
if (index == 0) if (index == 0)
return "bist"; return "bist";
--index; --index;
} }
if (phy_cfg->flags & ((1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_SHORT_LBN) | if (phy_cfg->flags & ((1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_SHORT_LBN) |
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN))) { (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN))) {
if (index == 0) if (index == 0)
return "cable"; return "cable";
--index; --index;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/module.h> #include <linux/module.h>
#undef DEBUG /* <linux/mtd/mtd.h> has its own use for DEBUG */
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -382,7 +383,7 @@ static int falcon_mtd_sync(struct mtd_info *mtd) ...@@ -382,7 +383,7 @@ static int falcon_mtd_sync(struct mtd_info *mtd)
return rc; return rc;
} }
static struct efx_mtd_ops falcon_mtd_ops = { static const struct efx_mtd_ops falcon_mtd_ops = {
.read = falcon_mtd_read, .read = falcon_mtd_read,
.erase = falcon_mtd_erase, .erase = falcon_mtd_erase,
.write = falcon_mtd_write, .write = falcon_mtd_write,
...@@ -560,7 +561,7 @@ static int siena_mtd_sync(struct mtd_info *mtd) ...@@ -560,7 +561,7 @@ static int siena_mtd_sync(struct mtd_info *mtd)
return rc; return rc;
} }
static struct efx_mtd_ops siena_mtd_ops = { static const struct efx_mtd_ops siena_mtd_ops = {
.read = siena_mtd_read, .read = siena_mtd_read,
.erase = siena_mtd_erase, .erase = siena_mtd_erase,
.write = siena_mtd_write, .write = siena_mtd_write,
...@@ -572,7 +573,7 @@ struct siena_nvram_type_info { ...@@ -572,7 +573,7 @@ struct siena_nvram_type_info {
const char *name; const char *name;
}; };
static struct siena_nvram_type_info siena_nvram_types[] = { static const struct siena_nvram_type_info siena_nvram_types[] = {
[MC_CMD_NVRAM_TYPE_DISABLED_CALLISTO] = { 0, "sfc_dummy_phy" }, [MC_CMD_NVRAM_TYPE_DISABLED_CALLISTO] = { 0, "sfc_dummy_phy" },
[MC_CMD_NVRAM_TYPE_MC_FW] = { 0, "sfc_mcfw" }, [MC_CMD_NVRAM_TYPE_MC_FW] = { 0, "sfc_mcfw" },
[MC_CMD_NVRAM_TYPE_MC_FW_BACKUP] = { 0, "sfc_mcfw_backup" }, [MC_CMD_NVRAM_TYPE_MC_FW_BACKUP] = { 0, "sfc_mcfw_backup" },
...@@ -593,7 +594,7 @@ static int siena_mtd_probe_partition(struct efx_nic *efx, ...@@ -593,7 +594,7 @@ static int siena_mtd_probe_partition(struct efx_nic *efx,
unsigned int type) unsigned int type)
{ {
struct efx_mtd_partition *part = &efx_mtd->part[part_id]; struct efx_mtd_partition *part = &efx_mtd->part[part_id];
struct siena_nvram_type_info *info; const struct siena_nvram_type_info *info;
size_t size, erase_size; size_t size, erase_size;
bool protected; bool protected;
int rc; int rc;
...@@ -627,11 +628,10 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, ...@@ -627,11 +628,10 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx,
struct efx_mtd *efx_mtd) struct efx_mtd *efx_mtd)
{ {
struct efx_mtd_partition *part; struct efx_mtd_partition *part;
uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN / uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM];
sizeof(uint16_t)];
int rc; int rc;
rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list); rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL);
if (rc) if (rc)
return rc; return rc;
......
This diff is collapsed.
...@@ -726,10 +726,8 @@ efx_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -726,10 +726,8 @@ efx_handle_tx_event(struct efx_channel *channel, efx_qword_t *event)
tx_queue = efx_channel_get_tx_queue( tx_queue = efx_channel_get_tx_queue(
channel, tx_ev_q_label % EFX_TXQ_TYPES); channel, tx_ev_q_label % EFX_TXQ_TYPES);
if (efx_dev_registered(efx))
netif_tx_lock(efx->net_dev); netif_tx_lock(efx->net_dev);
efx_notify_tx_desc(tx_queue); efx_notify_tx_desc(tx_queue);
if (efx_dev_registered(efx))
netif_tx_unlock(efx->net_dev); netif_tx_unlock(efx->net_dev);
} else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_PKT_ERR) && } else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_PKT_ERR) &&
EFX_WORKAROUND_10727(efx)) { EFX_WORKAROUND_10727(efx)) {
...@@ -745,10 +743,8 @@ efx_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -745,10 +743,8 @@ efx_handle_tx_event(struct efx_channel *channel, efx_qword_t *event)
} }
/* Detect errors included in the rx_evt_pkt_ok bit. */ /* Detect errors included in the rx_evt_pkt_ok bit. */
static void efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue, static u16 efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
const efx_qword_t *event, const efx_qword_t *event)
bool *rx_ev_pkt_ok,
bool *discard)
{ {
struct efx_channel *channel = efx_rx_queue_channel(rx_queue); struct efx_channel *channel = efx_rx_queue_channel(rx_queue);
struct efx_nic *efx = rx_queue->efx; struct efx_nic *efx = rx_queue->efx;
...@@ -793,15 +789,11 @@ static void efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue, ...@@ -793,15 +789,11 @@ static void efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
++channel->n_rx_tcp_udp_chksum_err; ++channel->n_rx_tcp_udp_chksum_err;
} }
/* The frame must be discarded if any of these are true. */
*discard = (rx_ev_eth_crc_err | rx_ev_frm_trunc | rx_ev_drib_nib |
rx_ev_tobe_disc | rx_ev_pause_frm);
/* TOBE_DISC is expected on unicast mismatches; don't print out an /* TOBE_DISC is expected on unicast mismatches; don't print out an
* error message. FRM_TRUNC indicates RXDP dropped the packet due * error message. FRM_TRUNC indicates RXDP dropped the packet due
* to a FIFO overflow. * to a FIFO overflow.
*/ */
#ifdef EFX_ENABLE_DEBUG #ifdef DEBUG
if (rx_ev_other_err && net_ratelimit()) { if (rx_ev_other_err && net_ratelimit()) {
netif_dbg(efx, rx_err, efx->net_dev, netif_dbg(efx, rx_err, efx->net_dev,
" RX queue %d unexpected RX event " " RX queue %d unexpected RX event "
...@@ -819,6 +811,11 @@ static void efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue, ...@@ -819,6 +811,11 @@ static void efx_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
rx_ev_pause_frm ? " [PAUSE]" : ""); rx_ev_pause_frm ? " [PAUSE]" : "");
} }
#endif #endif
/* The frame must be discarded if any of these are true. */
return (rx_ev_eth_crc_err | rx_ev_frm_trunc | rx_ev_drib_nib |
rx_ev_tobe_disc | rx_ev_pause_frm) ?
EFX_RX_PKT_DISCARD : 0;
} }
/* Handle receive events that are not in-order. */ /* Handle receive events that are not in-order. */
...@@ -851,7 +848,8 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) ...@@ -851,7 +848,8 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
unsigned int rx_ev_desc_ptr, rx_ev_byte_cnt; unsigned int rx_ev_desc_ptr, rx_ev_byte_cnt;
unsigned int rx_ev_hdr_type, rx_ev_mcast_pkt; unsigned int rx_ev_hdr_type, rx_ev_mcast_pkt;
unsigned expected_ptr; unsigned expected_ptr;
bool rx_ev_pkt_ok, discard = false, checksummed; bool rx_ev_pkt_ok;
u16 flags;
struct efx_rx_queue *rx_queue; struct efx_rx_queue *rx_queue;
/* Basic packet information */ /* Basic packet information */
...@@ -874,12 +872,11 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) ...@@ -874,12 +872,11 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
/* If packet is marked as OK and packet type is TCP/IP or /* If packet is marked as OK and packet type is TCP/IP or
* UDP/IP, then we can rely on the hardware checksum. * UDP/IP, then we can rely on the hardware checksum.
*/ */
checksummed = flags = (rx_ev_hdr_type == FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP ||
rx_ev_hdr_type == FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP || rx_ev_hdr_type == FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP) ?
rx_ev_hdr_type == FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP; EFX_RX_PKT_CSUMMED : 0;
} else { } else {
efx_handle_rx_not_ok(rx_queue, event, &rx_ev_pkt_ok, &discard); flags = efx_handle_rx_not_ok(rx_queue, event);
checksummed = false;
} }
/* Detect multicast packets that didn't match the filter */ /* Detect multicast packets that didn't match the filter */
...@@ -890,15 +887,14 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) ...@@ -890,15 +887,14 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
if (unlikely(!rx_ev_mcast_hash_match)) { if (unlikely(!rx_ev_mcast_hash_match)) {
++channel->n_rx_mcast_mismatch; ++channel->n_rx_mcast_mismatch;
discard = true; flags |= EFX_RX_PKT_DISCARD;
} }
} }
channel->irq_mod_score += 2; channel->irq_mod_score += 2;
/* Handle received packet */ /* Handle received packet */
efx_rx_packet(rx_queue, rx_ev_desc_ptr, rx_ev_byte_cnt, efx_rx_packet(rx_queue, rx_ev_desc_ptr, rx_ev_byte_cnt, flags);
checksummed, discard);
} }
static void static void
...@@ -1311,7 +1307,7 @@ static inline void efx_nic_interrupts(struct efx_nic *efx, ...@@ -1311,7 +1307,7 @@ static inline void efx_nic_interrupts(struct efx_nic *efx,
efx_oword_t int_en_reg_ker; efx_oword_t int_en_reg_ker;
EFX_POPULATE_OWORD_3(int_en_reg_ker, EFX_POPULATE_OWORD_3(int_en_reg_ker,
FRF_AZ_KER_INT_LEVE_SEL, efx->fatal_irq_level, FRF_AZ_KER_INT_LEVE_SEL, efx->irq_level,
FRF_AZ_KER_INT_KER, force, FRF_AZ_KER_INT_KER, force,
FRF_AZ_DRV_INT_EN_KER, enabled); FRF_AZ_DRV_INT_EN_KER, enabled);
efx_writeo(efx, &int_en_reg_ker, FR_AZ_INT_EN_KER); efx_writeo(efx, &int_en_reg_ker, FR_AZ_INT_EN_KER);
...@@ -1427,11 +1423,12 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id) ...@@ -1427,11 +1423,12 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id)
efx_readd(efx, &reg, FR_BZ_INT_ISR0); efx_readd(efx, &reg, FR_BZ_INT_ISR0);
queues = EFX_EXTRACT_DWORD(reg, 0, 31); queues = EFX_EXTRACT_DWORD(reg, 0, 31);
/* Check to see if we have a serious error condition */ /* Handle non-event-queue sources */
if (queues & (1U << efx->fatal_irq_level)) { if (queues & (1U << efx->irq_level)) {
syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT); syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT);
if (unlikely(syserr)) if (unlikely(syserr))
return efx_nic_fatal_interrupt(efx); return efx_nic_fatal_interrupt(efx);
efx->last_irq_cpu = raw_smp_processor_id();
} }
if (queues != 0) { if (queues != 0) {
...@@ -1441,7 +1438,7 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id) ...@@ -1441,7 +1438,7 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id)
/* Schedule processing of any interrupting queues */ /* Schedule processing of any interrupting queues */
efx_for_each_channel(channel, efx) { efx_for_each_channel(channel, efx) {
if (queues & 1) if (queues & 1)
efx_schedule_channel(channel); efx_schedule_channel_irq(channel);
queues >>= 1; queues >>= 1;
} }
result = IRQ_HANDLED; result = IRQ_HANDLED;
...@@ -1458,18 +1455,16 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id) ...@@ -1458,18 +1455,16 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id)
efx_for_each_channel(channel, efx) { efx_for_each_channel(channel, efx) {
event = efx_event(channel, channel->eventq_read_ptr); event = efx_event(channel, channel->eventq_read_ptr);
if (efx_event_present(event)) if (efx_event_present(event))
efx_schedule_channel(channel); efx_schedule_channel_irq(channel);
else else
efx_nic_eventq_read_ack(channel); efx_nic_eventq_read_ack(channel);
} }
} }
if (result == IRQ_HANDLED) { if (result == IRQ_HANDLED)
efx->last_irq_cpu = raw_smp_processor_id();
netif_vdbg(efx, intr, efx->net_dev, netif_vdbg(efx, intr, efx->net_dev,
"IRQ %d on CPU %d status " EFX_DWORD_FMT "\n", "IRQ %d on CPU %d status " EFX_DWORD_FMT "\n",
irq, raw_smp_processor_id(), EFX_DWORD_VAL(reg)); irq, raw_smp_processor_id(), EFX_DWORD_VAL(reg));
}
return result; return result;
} }
...@@ -1488,20 +1483,20 @@ static irqreturn_t efx_msi_interrupt(int irq, void *dev_id) ...@@ -1488,20 +1483,20 @@ static irqreturn_t efx_msi_interrupt(int irq, void *dev_id)
efx_oword_t *int_ker = efx->irq_status.addr; efx_oword_t *int_ker = efx->irq_status.addr;
int syserr; int syserr;
efx->last_irq_cpu = raw_smp_processor_id();
netif_vdbg(efx, intr, efx->net_dev, netif_vdbg(efx, intr, efx->net_dev,
"IRQ %d on CPU %d status " EFX_OWORD_FMT "\n", "IRQ %d on CPU %d status " EFX_OWORD_FMT "\n",
irq, raw_smp_processor_id(), EFX_OWORD_VAL(*int_ker)); irq, raw_smp_processor_id(), EFX_OWORD_VAL(*int_ker));
/* Check to see if we have a serious error condition */ /* Handle non-event-queue sources */
if (channel->channel == efx->fatal_irq_level) { if (channel->channel == efx->irq_level) {
syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT); syserr = EFX_OWORD_FIELD(*int_ker, FSF_AZ_NET_IVEC_FATAL_INT);
if (unlikely(syserr)) if (unlikely(syserr))
return efx_nic_fatal_interrupt(efx); return efx_nic_fatal_interrupt(efx);
efx->last_irq_cpu = raw_smp_processor_id();
} }
/* Schedule processing of the channel */ /* Schedule processing of the channel */
efx_schedule_channel(channel); efx_schedule_channel_irq(channel);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1640,10 +1635,10 @@ void efx_nic_init_common(struct efx_nic *efx) ...@@ -1640,10 +1635,10 @@ void efx_nic_init_common(struct efx_nic *efx)
if (EFX_WORKAROUND_17213(efx) && !EFX_INT_MODE_USE_MSI(efx)) if (EFX_WORKAROUND_17213(efx) && !EFX_INT_MODE_USE_MSI(efx))
/* Use an interrupt level unused by event queues */ /* Use an interrupt level unused by event queues */
efx->fatal_irq_level = 0x1f; efx->irq_level = 0x1f;
else else
/* Use a valid MSI-X vector */ /* Use a valid MSI-X vector */
efx->fatal_irq_level = 0; efx->irq_level = 0;
/* Enable all the genuinely fatal interrupts. (They are still /* Enable all the genuinely fatal interrupts. (They are still
* masked by the overall interrupt mask, controlled by * masked by the overall interrupt mask, controlled by
......
...@@ -144,12 +144,26 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx) ...@@ -144,12 +144,26 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx)
* struct siena_nic_data - Siena NIC state * struct siena_nic_data - Siena NIC state
* @mcdi: Management-Controller-to-Driver Interface * @mcdi: Management-Controller-to-Driver Interface
* @wol_filter_id: Wake-on-LAN packet filter id * @wol_filter_id: Wake-on-LAN packet filter id
* @hwmon: Hardware monitor state
*/ */
struct siena_nic_data { struct siena_nic_data {
struct efx_mcdi_iface mcdi; struct efx_mcdi_iface mcdi;
int wol_filter_id; int wol_filter_id;
#ifdef CONFIG_SFC_MCDI_MON
struct efx_mcdi_mon hwmon;
#endif
}; };
#ifdef CONFIG_SFC_MCDI_MON
static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx)
{
struct siena_nic_data *nic_data;
EFX_BUG_ON_PARANOID(efx_nic_rev(efx) < EFX_REV_SIENA_A0);
nic_data = efx->nic_data;
return &nic_data->hwmon;
}
#endif
extern const struct efx_nic_type falcon_a1_nic_type; extern const struct efx_nic_type falcon_a1_nic_type;
extern const struct efx_nic_type falcon_b0_nic_type; extern const struct efx_nic_type falcon_b0_nic_type;
extern const struct efx_nic_type siena_a0_nic_type; extern const struct efx_nic_type siena_a0_nic_type;
...@@ -189,6 +203,9 @@ extern bool efx_nic_event_present(struct efx_channel *channel); ...@@ -189,6 +203,9 @@ extern bool efx_nic_event_present(struct efx_channel *channel);
/* MAC/PHY */ /* MAC/PHY */
extern void falcon_drain_tx_fifo(struct efx_nic *efx); extern void falcon_drain_tx_fifo(struct efx_nic *efx);
extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx); extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx);
extern bool falcon_xmac_check_fault(struct efx_nic *efx);
extern int falcon_reconfigure_xmac(struct efx_nic *efx);
extern void falcon_update_stats_xmac(struct efx_nic *efx);
/* Interrupts and test events */ /* Interrupts and test events */
extern int efx_nic_init_interrupt(struct efx_nic *efx); extern int efx_nic_init_interrupt(struct efx_nic *efx);
...@@ -202,9 +219,6 @@ extern irqreturn_t efx_nic_fatal_interrupt(struct efx_nic *efx); ...@@ -202,9 +219,6 @@ extern irqreturn_t efx_nic_fatal_interrupt(struct efx_nic *efx);
extern irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id); extern irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id);
extern void falcon_irq_ack_a1(struct efx_nic *efx); extern void falcon_irq_ack_a1(struct efx_nic *efx);
#define EFX_IRQ_MOD_RESOLUTION 5
#define EFX_IRQ_MOD_MAX 0x1000
/* Global Resources */ /* Global Resources */
extern int efx_nic_flush_queues(struct efx_nic *efx); extern int efx_nic_flush_queues(struct efx_nic *efx);
extern void falcon_start_nic_stats(struct efx_nic *efx); extern void falcon_start_nic_stats(struct efx_nic *efx);
......
This diff is collapsed.
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/io.h>
#include "net_driver.h" #include "net_driver.h"
#include "efx.h" #include "efx.h"
#include "nic.h" #include "nic.h"
...@@ -50,7 +49,7 @@ static const char payload_msg[] = ...@@ -50,7 +49,7 @@ static const char payload_msg[] =
/* Interrupt mode names */ /* Interrupt mode names */
static const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX; static const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX;
static const char *efx_interrupt_mode_names[] = { static const char *const efx_interrupt_mode_names[] = {
[EFX_INT_MODE_MSIX] = "MSI-X", [EFX_INT_MODE_MSIX] = "MSI-X",
[EFX_INT_MODE_MSI] = "MSI", [EFX_INT_MODE_MSI] = "MSI",
[EFX_INT_MODE_LEGACY] = "legacy", [EFX_INT_MODE_LEGACY] = "legacy",
...@@ -131,6 +130,8 @@ static int efx_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) ...@@ -131,6 +130,8 @@ static int efx_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
static int efx_test_interrupts(struct efx_nic *efx, static int efx_test_interrupts(struct efx_nic *efx,
struct efx_self_tests *tests) struct efx_self_tests *tests)
{ {
int cpu;
netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n"); netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n");
tests->interrupt = -1; tests->interrupt = -1;
...@@ -143,7 +144,8 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -143,7 +144,8 @@ static int efx_test_interrupts(struct efx_nic *efx,
/* Wait for arrival of test interrupt. */ /* Wait for arrival of test interrupt. */
netif_dbg(efx, drv, efx->net_dev, "waiting for test interrupt\n"); netif_dbg(efx, drv, efx->net_dev, "waiting for test interrupt\n");
schedule_timeout_uninterruptible(HZ / 10); schedule_timeout_uninterruptible(HZ / 10);
if (efx->last_irq_cpu >= 0) cpu = ACCESS_ONCE(efx->last_irq_cpu);
if (cpu >= 0)
goto success; goto success;
netif_err(efx, drv, efx->net_dev, "timed out waiting for interrupt\n"); netif_err(efx, drv, efx->net_dev, "timed out waiting for interrupt\n");
...@@ -151,8 +153,7 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -151,8 +153,7 @@ static int efx_test_interrupts(struct efx_nic *efx,
success: success:
netif_dbg(efx, drv, efx->net_dev, "%s test interrupt seen on CPU%d\n", netif_dbg(efx, drv, efx->net_dev, "%s test interrupt seen on CPU%d\n",
INT_MODE(efx), INT_MODE(efx), cpu);
efx->last_irq_cpu);
tests->interrupt = 1; tests->interrupt = 1;
return 0; return 0;
} }
...@@ -162,56 +163,57 @@ static int efx_test_eventq_irq(struct efx_channel *channel, ...@@ -162,56 +163,57 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
struct efx_self_tests *tests) struct efx_self_tests *tests)
{ {
struct efx_nic *efx = channel->efx; struct efx_nic *efx = channel->efx;
unsigned int read_ptr, count; unsigned int read_ptr;
bool napi_ran, dma_seen, int_seen;
tests->eventq_dma[channel->channel] = -1;
tests->eventq_int[channel->channel] = -1;
tests->eventq_poll[channel->channel] = -1;
read_ptr = channel->eventq_read_ptr; read_ptr = channel->eventq_read_ptr;
channel->efx->last_irq_cpu = -1; channel->last_irq_cpu = -1;
smp_wmb(); smp_wmb();
efx_nic_generate_test_event(channel); efx_nic_generate_test_event(channel);
/* Wait for arrival of interrupt */ /* Wait for arrival of interrupt. NAPI processing may or may
count = 0; * not complete in time, but we can cope in any case.
do { */
schedule_timeout_uninterruptible(HZ / 100); msleep(10);
napi_disable(&channel->napi_str);
if (channel->eventq_read_ptr != read_ptr) {
napi_ran = true;
dma_seen = true;
int_seen = true;
} else {
napi_ran = false;
dma_seen = efx_nic_event_present(channel);
int_seen = ACCESS_ONCE(channel->last_irq_cpu) >= 0;
}
napi_enable(&channel->napi_str);
efx_nic_eventq_read_ack(channel);
if (ACCESS_ONCE(channel->eventq_read_ptr) != read_ptr) tests->eventq_dma[channel->channel] = dma_seen ? 1 : -1;
goto eventq_ok; tests->eventq_int[channel->channel] = int_seen ? 1 : -1;
} while (++count < 2);
if (dma_seen && int_seen) {
netif_dbg(efx, drv, efx->net_dev,
"channel %d event queue passed (with%s NAPI)\n",
channel->channel, napi_ran ? "" : "out");
return 0;
} else {
/* Report failure and whether either interrupt or DMA worked */
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
"channel %d timed out waiting for event queue\n", "channel %d timed out waiting for event queue\n",
channel->channel); channel->channel);
if (int_seen)
/* See if interrupt arrived */
if (channel->efx->last_irq_cpu >= 0) {
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
"channel %d saw interrupt on CPU%d " "channel %d saw interrupt "
"during event queue test\n", channel->channel, "during event queue test\n",
raw_smp_processor_id()); channel->channel);
tests->eventq_int[channel->channel] = 1; if (dma_seen)
}
/* Check to see if event was received even if interrupt wasn't */
if (efx_nic_event_present(channel)) {
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
"channel %d event was generated, but " "channel %d event was generated, but "
"failed to trigger an interrupt\n", channel->channel); "failed to trigger an interrupt\n",
tests->eventq_dma[channel->channel] = 1;
}
return -ETIMEDOUT;
eventq_ok:
netif_dbg(efx, drv, efx->net_dev, "channel %d event queue passed\n",
channel->channel); channel->channel);
tests->eventq_dma[channel->channel] = 1; return -ETIMEDOUT;
tests->eventq_int[channel->channel] = 1; }
tests->eventq_poll[channel->channel] = 1;
return 0;
} }
static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests, static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests,
...@@ -316,7 +318,7 @@ void efx_loopback_rx_packet(struct efx_nic *efx, ...@@ -316,7 +318,7 @@ void efx_loopback_rx_packet(struct efx_nic *efx,
return; return;
err: err:
#ifdef EFX_ENABLE_DEBUG #ifdef DEBUG
if (atomic_read(&state->rx_bad) == 0) { if (atomic_read(&state->rx_bad) == 0) {
netif_err(efx, drv, efx->net_dev, "received packet:\n"); netif_err(efx, drv, efx->net_dev, "received packet:\n");
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1, print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1,
...@@ -395,10 +397,8 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue) ...@@ -395,10 +397,8 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue)
* interrupt handler. */ * interrupt handler. */
smp_wmb(); smp_wmb();
if (efx_dev_registered(efx))
netif_tx_lock_bh(efx->net_dev); netif_tx_lock_bh(efx->net_dev);
rc = efx_enqueue_skb(tx_queue, skb); rc = efx_enqueue_skb(tx_queue, skb);
if (efx_dev_registered(efx))
netif_tx_unlock_bh(efx->net_dev); netif_tx_unlock_bh(efx->net_dev);
if (rc != NETDEV_TX_OK) { if (rc != NETDEV_TX_OK) {
...@@ -440,19 +440,17 @@ static int efx_end_loopback(struct efx_tx_queue *tx_queue, ...@@ -440,19 +440,17 @@ static int efx_end_loopback(struct efx_tx_queue *tx_queue,
int tx_done = 0, rx_good, rx_bad; int tx_done = 0, rx_good, rx_bad;
int i, rc = 0; int i, rc = 0;
if (efx_dev_registered(efx))
netif_tx_lock_bh(efx->net_dev); netif_tx_lock_bh(efx->net_dev);
/* Count the number of tx completions, and decrement the refcnt. Any /* Count the number of tx completions, and decrement the refcnt. Any
* skbs not already completed will be free'd when the queue is flushed */ * skbs not already completed will be free'd when the queue is flushed */
for (i=0; i < state->packet_count; i++) { for (i = 0; i < state->packet_count; i++) {
skb = state->skbs[i]; skb = state->skbs[i];
if (skb && !skb_shared(skb)) if (skb && !skb_shared(skb))
++tx_done; ++tx_done;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
if (efx_dev_registered(efx))
netif_tx_unlock_bh(efx->net_dev); netif_tx_unlock_bh(efx->net_dev);
/* Check TX completion and received packet counts */ /* Check TX completion and received packet counts */
...@@ -570,7 +568,7 @@ static int efx_wait_for_link(struct efx_nic *efx) ...@@ -570,7 +568,7 @@ static int efx_wait_for_link(struct efx_nic *efx)
mutex_lock(&efx->mac_lock); mutex_lock(&efx->mac_lock);
link_up = link_state->up; link_up = link_state->up;
if (link_up) if (link_up)
link_up = !efx->mac_op->check_fault(efx); link_up = !efx->type->check_mac_fault(efx);
mutex_unlock(&efx->mac_lock); mutex_unlock(&efx->mac_lock);
if (link_up) { if (link_up) {
......
...@@ -37,7 +37,6 @@ struct efx_self_tests { ...@@ -37,7 +37,6 @@ struct efx_self_tests {
int interrupt; int interrupt;
int eventq_dma[EFX_MAX_CHANNELS]; int eventq_dma[EFX_MAX_CHANNELS];
int eventq_int[EFX_MAX_CHANNELS]; int eventq_int[EFX_MAX_CHANNELS];
int eventq_poll[EFX_MAX_CHANNELS];
/* offline tests */ /* offline tests */
int registers; int registers;
int phy_ext[EFX_MAX_PHY_TESTS]; int phy_ext[EFX_MAX_PHY_TESTS];
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "bitfield.h" #include "bitfield.h"
#include "efx.h" #include "efx.h"
#include "nic.h" #include "nic.h"
#include "mac.h"
#include "spi.h" #include "spi.h"
#include "regs.h" #include "regs.h"
#include "io.h" #include "io.h"
...@@ -36,8 +35,6 @@ static void siena_push_irq_moderation(struct efx_channel *channel) ...@@ -36,8 +35,6 @@ static void siena_push_irq_moderation(struct efx_channel *channel)
{ {
efx_dword_t timer_cmd; efx_dword_t timer_cmd;
BUILD_BUG_ON(EFX_IRQ_MOD_MAX > (1 << FRF_CZ_TC_TIMER_VAL_WIDTH));
if (channel->irq_moderation) if (channel->irq_moderation)
EFX_POPULATE_DWORD_2(timer_cmd, EFX_POPULATE_DWORD_2(timer_cmd,
FRF_CZ_TC_TIMER_MODE, FRF_CZ_TC_TIMER_MODE,
...@@ -53,15 +50,6 @@ static void siena_push_irq_moderation(struct efx_channel *channel) ...@@ -53,15 +50,6 @@ static void siena_push_irq_moderation(struct efx_channel *channel)
channel->channel); channel->channel);
} }
static void siena_push_multicast_hash(struct efx_nic *efx)
{
WARN_ON(!mutex_is_locked(&efx->mac_lock));
efx_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH,
efx->multicast_hash.byte, sizeof(efx->multicast_hash),
NULL, 0, NULL);
}
static int siena_mdio_write(struct net_device *net_dev, static int siena_mdio_write(struct net_device *net_dev,
int prtad, int devad, u16 addr, u16 value) int prtad, int devad, u16 addr, u16 value)
{ {
...@@ -226,7 +214,15 @@ static int siena_reset_hw(struct efx_nic *efx, enum reset_type method) ...@@ -226,7 +214,15 @@ static int siena_reset_hw(struct efx_nic *efx, enum reset_type method)
static int siena_probe_nvconfig(struct efx_nic *efx) static int siena_probe_nvconfig(struct efx_nic *efx)
{ {
return efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL); u32 caps = 0;
int rc;
rc = efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, &caps);
efx->timer_quantum_ns =
(caps & (1 << MC_CMD_CAPABILITIES_TURBO_ACTIVE_LBN)) ?
3072 : 6144; /* 768 cycles */
return rc;
} }
static int siena_probe_nic(struct efx_nic *efx) static int siena_probe_nic(struct efx_nic *efx)
...@@ -304,6 +300,10 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -304,6 +300,10 @@ static int siena_probe_nic(struct efx_nic *efx)
goto fail5; goto fail5;
} }
rc = efx_mcdi_mon_probe(efx);
if (rc)
goto fail5;
return 0; return 0;
fail5: fail5:
...@@ -391,6 +391,8 @@ static int siena_init_nic(struct efx_nic *efx) ...@@ -391,6 +391,8 @@ static int siena_init_nic(struct efx_nic *efx)
static void siena_remove_nic(struct efx_nic *efx) static void siena_remove_nic(struct efx_nic *efx)
{ {
efx_mcdi_mon_remove(efx);
efx_nic_free_buffer(efx, &efx->irq_status); efx_nic_free_buffer(efx, &efx->irq_status);
siena_reset_hw(efx, RESET_TYPE_ALL); siena_reset_hw(efx, RESET_TYPE_ALL);
...@@ -630,14 +632,14 @@ const struct efx_nic_type siena_a0_nic_type = { ...@@ -630,14 +632,14 @@ const struct efx_nic_type siena_a0_nic_type = {
.stop_stats = siena_stop_nic_stats, .stop_stats = siena_stop_nic_stats,
.set_id_led = efx_mcdi_set_id_led, .set_id_led = efx_mcdi_set_id_led,
.push_irq_moderation = siena_push_irq_moderation, .push_irq_moderation = siena_push_irq_moderation,
.push_multicast_hash = siena_push_multicast_hash, .reconfigure_mac = efx_mcdi_mac_reconfigure,
.check_mac_fault = efx_mcdi_mac_check_fault,
.reconfigure_port = efx_mcdi_phy_reconfigure, .reconfigure_port = efx_mcdi_phy_reconfigure,
.get_wol = siena_get_wol, .get_wol = siena_get_wol,
.set_wol = siena_set_wol, .set_wol = siena_set_wol,
.resume_wol = siena_init_wol, .resume_wol = siena_init_wol,
.test_registers = siena_test_registers, .test_registers = siena_test_registers,
.test_nvram = efx_mcdi_nvram_test_all, .test_nvram = efx_mcdi_nvram_test_all,
.default_mac_ops = &efx_mcdi_mac_operations,
.revision = EFX_REV_SIENA_A0, .revision = EFX_REV_SIENA_A0,
.mem_map_size = (FR_CZ_MC_TREG_SMEM + .mem_map_size = (FR_CZ_MC_TREG_SMEM +
...@@ -654,6 +656,7 @@ const struct efx_nic_type siena_a0_nic_type = { ...@@ -654,6 +656,7 @@ const struct efx_nic_type siena_a0_nic_type = {
.phys_addr_channels = 32, /* Hardware limit is 64, but the legacy .phys_addr_channels = 32, /* Hardware limit is 64, but the legacy
* interrupt handler only supports 32 * interrupt handler only supports 32
* channels */ * channels */
.timer_period_max = 1 << FRF_CZ_TC_TIMER_VAL_WIDTH,
.tx_dc_base = 0x88000, .tx_dc_base = 0x88000,
.rx_dc_base = 0x68000, .rx_dc_base = 0x68000,
.offload_features = (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | .offload_features = (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
......
...@@ -68,7 +68,7 @@ static inline bool efx_spi_present(const struct efx_spi_device *spi) ...@@ -68,7 +68,7 @@ static inline bool efx_spi_present(const struct efx_spi_device *spi)
int falcon_spi_cmd(struct efx_nic *efx, int falcon_spi_cmd(struct efx_nic *efx,
const struct efx_spi_device *spi, unsigned int command, const struct efx_spi_device *spi, unsigned int command,
int address, const void* in, void *out, size_t len); int address, const void *in, void *out, size_t len);
int falcon_spi_wait_write(struct efx_nic *efx, int falcon_spi_wait_write(struct efx_nic *efx,
const struct efx_spi_device *spi); const struct efx_spi_device *spi);
int falcon_spi_read(struct efx_nic *efx, int falcon_spi_read(struct efx_nic *efx,
......
...@@ -446,11 +446,9 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) ...@@ -446,11 +446,9 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
likely(efx->port_enabled) && likely(efx->port_enabled) &&
likely(netif_device_present(efx->net_dev))) { likely(netif_device_present(efx->net_dev))) {
fill_level = tx_queue->insert_count - tx_queue->read_count; fill_level = tx_queue->insert_count - tx_queue->read_count;
if (fill_level < EFX_TXQ_THRESHOLD(efx)) { if (fill_level < EFX_TXQ_THRESHOLD(efx))
EFX_BUG_ON_PARANOID(!efx_dev_registered(efx));
netif_tx_wake_queue(tx_queue->core_txq); netif_tx_wake_queue(tx_queue->core_txq);
} }
}
/* Check whether the hardware queue is now empty */ /* Check whether the hardware queue is now empty */
if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) { if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
......
...@@ -512,7 +512,7 @@ static bool txc43128_phy_poll(struct efx_nic *efx) ...@@ -512,7 +512,7 @@ static bool txc43128_phy_poll(struct efx_nic *efx)
return efx->link_state.up != was_up; return efx->link_state.up != was_up;
} }
static const char *txc43128_test_names[] = { static const char *const txc43128_test_names[] = {
"bist" "bist"
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment