Commit 4c9d546f authored by David S. Miller's avatar David S. Miller

Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next

Ben Hutchings says:

====================
1. Further cleanup and refactoring in preparation for EF10.
2. Remove ethtool stats that are always zero on Falcon boards.
3. Add an ethtool stat for merged TX completions.
4. Prepare to support merged RX completions.
5. Prepare to support more hwmon sensors.
6. Add support for new events that are generated by EF10 firmware.
7. Update MC reboot detection for EF10.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cc328dea d4fbdcfe
...@@ -80,8 +80,7 @@ const char *const efx_reset_type_names[] = { ...@@ -80,8 +80,7 @@ const char *const efx_reset_type_names[] = {
[RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG", [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG",
[RESET_TYPE_INT_ERROR] = "INT_ERROR", [RESET_TYPE_INT_ERROR] = "INT_ERROR",
[RESET_TYPE_RX_RECOVERY] = "RX_RECOVERY", [RESET_TYPE_RX_RECOVERY] = "RX_RECOVERY",
[RESET_TYPE_RX_DESC_FETCH] = "RX_DESC_FETCH", [RESET_TYPE_DMA_ERROR] = "DMA_ERROR",
[RESET_TYPE_TX_DESC_FETCH] = "TX_DESC_FETCH",
[RESET_TYPE_TX_SKIP] = "TX_SKIP", [RESET_TYPE_TX_SKIP] = "TX_SKIP",
[RESET_TYPE_MC_FAILURE] = "MC_FAILURE", [RESET_TYPE_MC_FAILURE] = "MC_FAILURE",
}; };
...@@ -574,7 +573,7 @@ static void efx_start_datapath(struct efx_nic *efx) ...@@ -574,7 +573,7 @@ static void efx_start_datapath(struct efx_nic *efx)
* support the current MTU, including padding for header * support the current MTU, including padding for header
* alignment and overruns. * alignment and overruns.
*/ */
efx->rx_dma_len = (efx->type->rx_buffer_hash_size + efx->rx_dma_len = (efx->rx_prefix_size +
EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
efx->type->rx_buffer_padding); efx->type->rx_buffer_padding);
rx_buf_len = (sizeof(struct efx_rx_page_state) + rx_buf_len = (sizeof(struct efx_rx_page_state) +
...@@ -1920,34 +1919,9 @@ static struct rtnl_link_stats64 *efx_net_stats(struct net_device *net_dev, ...@@ -1920,34 +1919,9 @@ static struct rtnl_link_stats64 *efx_net_stats(struct net_device *net_dev,
struct rtnl_link_stats64 *stats) struct rtnl_link_stats64 *stats)
{ {
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;
spin_lock_bh(&efx->stats_lock); spin_lock_bh(&efx->stats_lock);
efx->type->update_stats(efx, NULL, stats);
efx->type->update_stats(efx);
stats->rx_packets = mac_stats->rx_packets;
stats->tx_packets = mac_stats->tx_packets;
stats->rx_bytes = mac_stats->rx_bytes;
stats->tx_bytes = mac_stats->tx_bytes;
stats->rx_dropped = efx->n_rx_nodesc_drop_cnt;
stats->multicast = mac_stats->rx_multicast;
stats->collisions = mac_stats->tx_collision;
stats->rx_length_errors = (mac_stats->rx_gtjumbo +
mac_stats->rx_length_error);
stats->rx_crc_errors = mac_stats->rx_bad;
stats->rx_frame_errors = mac_stats->rx_align_error;
stats->rx_fifo_errors = mac_stats->rx_overflow;
stats->rx_missed_errors = mac_stats->rx_missed;
stats->tx_window_errors = mac_stats->tx_late_collision;
stats->rx_errors = (stats->rx_length_errors +
stats->rx_crc_errors +
stats->rx_frame_errors +
mac_stats->rx_symbol_error);
stats->tx_errors = (stats->tx_window_errors +
mac_stats->tx_bad);
spin_unlock_bh(&efx->stats_lock); spin_unlock_bh(&efx->stats_lock);
return stats; return stats;
...@@ -2228,8 +2202,6 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) ...@@ -2228,8 +2202,6 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
"could not restore PHY settings\n"); "could not restore PHY settings\n");
} }
efx->type->reconfigure_mac(efx);
efx_enable_interrupts(efx); efx_enable_interrupts(efx);
efx_restore_filters(efx); efx_restore_filters(efx);
efx_sriov_reset(efx); efx_sriov_reset(efx);
...@@ -2484,6 +2456,9 @@ static int efx_init_struct(struct efx_nic *efx, ...@@ -2484,6 +2456,9 @@ static int efx_init_struct(struct efx_nic *efx,
strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name)); strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
efx->net_dev = net_dev; efx->net_dev = net_dev;
efx->rx_prefix_size = efx->type->rx_prefix_size;
efx->rx_packet_hash_offset =
efx->type->rx_hash_offset - efx->type->rx_prefix_size;
spin_lock_init(&efx->stats_lock); spin_lock_init(&efx->stats_lock);
mutex_init(&efx->mac_lock); mutex_init(&efx->mac_lock);
efx->phy_op = &efx_dummy_phy_operations; efx->phy_op = &efx_dummy_phy_operations;
......
...@@ -204,7 +204,12 @@ extern void efx_port_dummy_op_void(struct efx_nic *efx); ...@@ -204,7 +204,12 @@ extern void efx_port_dummy_op_void(struct efx_nic *efx);
/* MTD */ /* MTD */
#ifdef CONFIG_SFC_MTD #ifdef CONFIG_SFC_MTD
extern int efx_mtd_probe(struct efx_nic *efx); extern int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts,
size_t n_parts, size_t sizeof_part);
static inline int efx_mtd_probe(struct efx_nic *efx)
{
return efx->type->mtd_probe(efx);
}
extern void efx_mtd_rename(struct efx_nic *efx); extern void efx_mtd_rename(struct efx_nic *efx);
extern void efx_mtd_remove(struct efx_nic *efx); extern void efx_mtd_remove(struct efx_nic *efx);
#else #else
......
...@@ -147,8 +147,7 @@ enum efx_loopback_mode { ...@@ -147,8 +147,7 @@ enum efx_loopback_mode {
* @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
* @RESET_TYPE_INT_ERROR: reset due to internal error * @RESET_TYPE_INT_ERROR: reset due to internal error
* @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors * @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors
* @RESET_TYPE_RX_DESC_FETCH: pcie error during rx descriptor fetch * @RESET_TYPE_DMA_ERROR: DMA error
* @RESET_TYPE_TX_DESC_FETCH: pcie error during tx descriptor fetch
* @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
* @RESET_TYPE_MC_FAILURE: MC reboot/assertion * @RESET_TYPE_MC_FAILURE: MC reboot/assertion
*/ */
...@@ -163,8 +162,7 @@ enum reset_type { ...@@ -163,8 +162,7 @@ enum reset_type {
RESET_TYPE_TX_WATCHDOG, RESET_TYPE_TX_WATCHDOG,
RESET_TYPE_INT_ERROR, RESET_TYPE_INT_ERROR,
RESET_TYPE_RX_RECOVERY, RESET_TYPE_RX_RECOVERY,
RESET_TYPE_RX_DESC_FETCH, RESET_TYPE_DMA_ERROR,
RESET_TYPE_TX_DESC_FETCH,
RESET_TYPE_TX_SKIP, RESET_TYPE_TX_SKIP,
RESET_TYPE_MC_FAILURE, RESET_TYPE_MC_FAILURE,
RESET_TYPE_MAX, RESET_TYPE_MAX,
......
...@@ -19,14 +19,9 @@ ...@@ -19,14 +19,9 @@
#include "filter.h" #include "filter.h"
#include "nic.h" #include "nic.h"
struct ethtool_string { struct efx_sw_stat_desc {
char name[ETH_GSTRING_LEN];
};
struct efx_ethtool_stat {
const char *name; const char *name;
enum { enum {
EFX_ETHTOOL_STAT_SOURCE_mac_stats,
EFX_ETHTOOL_STAT_SOURCE_nic, EFX_ETHTOOL_STAT_SOURCE_nic,
EFX_ETHTOOL_STAT_SOURCE_channel, EFX_ETHTOOL_STAT_SOURCE_channel,
EFX_ETHTOOL_STAT_SOURCE_tx_queue EFX_ETHTOOL_STAT_SOURCE_tx_queue
...@@ -35,7 +30,7 @@ struct efx_ethtool_stat { ...@@ -35,7 +30,7 @@ struct efx_ethtool_stat {
u64(*get_stat) (void *field); /* Reader function */ u64(*get_stat) (void *field); /* Reader function */
}; };
/* Initialiser for a struct #efx_ethtool_stat with type-checking */ /* Initialiser for a struct efx_sw_stat_desc with type-checking */
#define EFX_ETHTOOL_STAT(stat_name, source_name, field, field_type, \ #define EFX_ETHTOOL_STAT(stat_name, source_name, field, field_type, \
get_stat_function) { \ get_stat_function) { \
.name = #stat_name, \ .name = #stat_name, \
...@@ -52,24 +47,11 @@ static u64 efx_get_uint_stat(void *field) ...@@ -52,24 +47,11 @@ static u64 efx_get_uint_stat(void *field)
return *(unsigned int *)field; return *(unsigned int *)field;
} }
static u64 efx_get_u64_stat(void *field)
{
return *(u64 *) field;
}
static u64 efx_get_atomic_stat(void *field) static u64 efx_get_atomic_stat(void *field)
{ {
return atomic_read((atomic_t *) field); return atomic_read((atomic_t *) field);
} }
#define EFX_ETHTOOL_U64_MAC_STAT(field) \
EFX_ETHTOOL_STAT(field, mac_stats, field, \
u64, efx_get_u64_stat)
#define EFX_ETHTOOL_UINT_NIC_STAT(name) \
EFX_ETHTOOL_STAT(name, nic, n_##name, \
unsigned int, efx_get_uint_stat)
#define EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(field) \ #define EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(field) \
EFX_ETHTOOL_STAT(field, nic, field, \ EFX_ETHTOOL_STAT(field, nic, field, \
atomic_t, efx_get_atomic_stat) atomic_t, efx_get_atomic_stat)
...@@ -82,72 +64,12 @@ static u64 efx_get_atomic_stat(void *field) ...@@ -82,72 +64,12 @@ 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 const struct efx_ethtool_stat efx_ethtool_stats[] = { static const struct efx_sw_stat_desc efx_sw_stat_desc[] = {
EFX_ETHTOOL_U64_MAC_STAT(tx_bytes), EFX_ETHTOOL_UINT_TXQ_STAT(merge_events),
EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes),
EFX_ETHTOOL_U64_MAC_STAT(tx_bad_bytes),
EFX_ETHTOOL_U64_MAC_STAT(tx_packets),
EFX_ETHTOOL_U64_MAC_STAT(tx_bad),
EFX_ETHTOOL_U64_MAC_STAT(tx_pause),
EFX_ETHTOOL_U64_MAC_STAT(tx_control),
EFX_ETHTOOL_U64_MAC_STAT(tx_unicast),
EFX_ETHTOOL_U64_MAC_STAT(tx_multicast),
EFX_ETHTOOL_U64_MAC_STAT(tx_broadcast),
EFX_ETHTOOL_U64_MAC_STAT(tx_lt64),
EFX_ETHTOOL_U64_MAC_STAT(tx_64),
EFX_ETHTOOL_U64_MAC_STAT(tx_65_to_127),
EFX_ETHTOOL_U64_MAC_STAT(tx_128_to_255),
EFX_ETHTOOL_U64_MAC_STAT(tx_256_to_511),
EFX_ETHTOOL_U64_MAC_STAT(tx_512_to_1023),
EFX_ETHTOOL_U64_MAC_STAT(tx_1024_to_15xx),
EFX_ETHTOOL_U64_MAC_STAT(tx_15xx_to_jumbo),
EFX_ETHTOOL_U64_MAC_STAT(tx_gtjumbo),
EFX_ETHTOOL_U64_MAC_STAT(tx_collision),
EFX_ETHTOOL_U64_MAC_STAT(tx_single_collision),
EFX_ETHTOOL_U64_MAC_STAT(tx_multiple_collision),
EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_collision),
EFX_ETHTOOL_U64_MAC_STAT(tx_deferred),
EFX_ETHTOOL_U64_MAC_STAT(tx_late_collision),
EFX_ETHTOOL_U64_MAC_STAT(tx_excessive_deferred),
EFX_ETHTOOL_U64_MAC_STAT(tx_non_tcpudp),
EFX_ETHTOOL_U64_MAC_STAT(tx_mac_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),
EFX_ETHTOOL_UINT_TXQ_STAT(pushes), EFX_ETHTOOL_UINT_TXQ_STAT(pushes),
EFX_ETHTOOL_U64_MAC_STAT(rx_bytes),
EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes),
EFX_ETHTOOL_U64_MAC_STAT(rx_packets),
EFX_ETHTOOL_U64_MAC_STAT(rx_good),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad),
EFX_ETHTOOL_U64_MAC_STAT(rx_pause),
EFX_ETHTOOL_U64_MAC_STAT(rx_control),
EFX_ETHTOOL_U64_MAC_STAT(rx_unicast),
EFX_ETHTOOL_U64_MAC_STAT(rx_multicast),
EFX_ETHTOOL_U64_MAC_STAT(rx_broadcast),
EFX_ETHTOOL_U64_MAC_STAT(rx_lt64),
EFX_ETHTOOL_U64_MAC_STAT(rx_64),
EFX_ETHTOOL_U64_MAC_STAT(rx_65_to_127),
EFX_ETHTOOL_U64_MAC_STAT(rx_128_to_255),
EFX_ETHTOOL_U64_MAC_STAT(rx_256_to_511),
EFX_ETHTOOL_U64_MAC_STAT(rx_512_to_1023),
EFX_ETHTOOL_U64_MAC_STAT(rx_1024_to_15xx),
EFX_ETHTOOL_U64_MAC_STAT(rx_15xx_to_jumbo),
EFX_ETHTOOL_U64_MAC_STAT(rx_gtjumbo),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_lt64),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_64_to_15xx),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_15xx_to_jumbo),
EFX_ETHTOOL_U64_MAC_STAT(rx_bad_gtjumbo),
EFX_ETHTOOL_U64_MAC_STAT(rx_overflow),
EFX_ETHTOOL_U64_MAC_STAT(rx_missed),
EFX_ETHTOOL_U64_MAC_STAT(rx_false_carrier),
EFX_ETHTOOL_U64_MAC_STAT(rx_symbol_error),
EFX_ETHTOOL_U64_MAC_STAT(rx_align_error),
EFX_ETHTOOL_U64_MAC_STAT(rx_length_error),
EFX_ETHTOOL_U64_MAC_STAT(rx_internal_error),
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),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err),
...@@ -157,8 +79,7 @@ static const struct efx_ethtool_stat efx_ethtool_stats[] = { ...@@ -157,8 +79,7 @@ static const struct efx_ethtool_stat efx_ethtool_stats[] = {
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_nodesc_trunc), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_nodesc_trunc),
}; };
/* Number of ethtool statistics */ #define EFX_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(efx_sw_stat_desc)
#define EFX_ETHTOOL_NUM_STATS ARRAY_SIZE(efx_ethtool_stats)
#define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB #define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB
...@@ -205,8 +126,6 @@ static int efx_ethtool_get_settings(struct net_device *net_dev, ...@@ -205,8 +126,6 @@ static int efx_ethtool_get_settings(struct net_device *net_dev,
efx->phy_op->get_settings(efx, ecmd); efx->phy_op->get_settings(efx, ecmd);
mutex_unlock(&efx->mac_lock); mutex_unlock(&efx->mac_lock);
/* GMAC does not support 1000Mbps HD */
ecmd->supported &= ~SUPPORTED_1000baseT_Half;
/* Both MACs support pause frames (bidirectional and respond-only) */ /* Both MACs support pause frames (bidirectional and respond-only) */
ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
...@@ -291,12 +210,11 @@ static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) ...@@ -291,12 +210,11 @@ static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable)
* *
* Fill in an individual self-test entry. * Fill in an individual self-test entry.
*/ */
static void efx_fill_test(unsigned int test_index, static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data,
struct ethtool_string *strings, u64 *data,
int *test, const char *unit_format, int unit_id, int *test, const char *unit_format, int unit_id,
const char *test_format, const char *test_id) const char *test_format, const char *test_id)
{ {
struct ethtool_string unit_str, test_str; char unit_str[ETH_GSTRING_LEN], test_str[ETH_GSTRING_LEN];
/* Fill data value, if applicable */ /* Fill data value, if applicable */
if (data) if (data)
...@@ -305,15 +223,14 @@ static void efx_fill_test(unsigned int test_index, ...@@ -305,15 +223,14 @@ static void efx_fill_test(unsigned int test_index,
/* Fill string, if applicable */ /* Fill string, if applicable */
if (strings) { if (strings) {
if (strchr(unit_format, '%')) if (strchr(unit_format, '%'))
snprintf(unit_str.name, sizeof(unit_str.name), snprintf(unit_str, sizeof(unit_str),
unit_format, unit_id); unit_format, unit_id);
else else
strcpy(unit_str.name, unit_format); strcpy(unit_str, unit_format);
snprintf(test_str.name, sizeof(test_str.name), snprintf(test_str, sizeof(test_str), test_format, test_id);
test_format, test_id); snprintf(strings + test_index * ETH_GSTRING_LEN,
snprintf(strings[test_index].name, ETH_GSTRING_LEN,
sizeof(strings[test_index].name), "%-6s %-24s", unit_str, test_str);
"%-6s %-24s", unit_str.name, test_str.name);
} }
} }
...@@ -336,7 +253,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx, ...@@ -336,7 +253,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx,
struct efx_loopback_self_tests *lb_tests, struct efx_loopback_self_tests *lb_tests,
enum efx_loopback_mode mode, enum efx_loopback_mode mode,
unsigned int test_index, unsigned int test_index,
struct ethtool_string *strings, u64 *data) u8 *strings, u64 *data)
{ {
struct efx_channel *channel = struct efx_channel *channel =
efx_get_channel(efx, efx->tx_channel_offset); efx_get_channel(efx, efx->tx_channel_offset);
...@@ -373,8 +290,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx, ...@@ -373,8 +290,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx,
*/ */
static int efx_ethtool_fill_self_tests(struct efx_nic *efx, static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
struct efx_self_tests *tests, struct efx_self_tests *tests,
struct ethtool_string *strings, u8 *strings, u64 *data)
u64 *data)
{ {
struct efx_channel *channel; struct efx_channel *channel;
unsigned int n = 0, i; unsigned int n = 0, i;
...@@ -433,12 +349,14 @@ static int efx_ethtool_fill_self_tests(struct efx_nic *efx, ...@@ -433,12 +349,14 @@ static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
static int efx_ethtool_get_sset_count(struct net_device *net_dev, static int efx_ethtool_get_sset_count(struct net_device *net_dev,
int string_set) int string_set)
{ {
struct efx_nic *efx = netdev_priv(net_dev);
switch (string_set) { switch (string_set) {
case ETH_SS_STATS: case ETH_SS_STATS:
return EFX_ETHTOOL_NUM_STATS; return efx->type->describe_stats(efx, NULL) +
EFX_ETHTOOL_SW_STAT_COUNT;
case ETH_SS_TEST: case ETH_SS_TEST:
return efx_ethtool_fill_self_tests(netdev_priv(net_dev), return efx_ethtool_fill_self_tests(efx, NULL, NULL, NULL);
NULL, NULL, NULL);
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -448,20 +366,18 @@ static void efx_ethtool_get_strings(struct net_device *net_dev, ...@@ -448,20 +366,18 @@ static void efx_ethtool_get_strings(struct net_device *net_dev,
u32 string_set, u8 *strings) u32 string_set, u8 *strings)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct ethtool_string *ethtool_strings =
(struct ethtool_string *)strings;
int i; int i;
switch (string_set) { switch (string_set) {
case ETH_SS_STATS: case ETH_SS_STATS:
for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) strings += (efx->type->describe_stats(efx, strings) *
strlcpy(ethtool_strings[i].name, ETH_GSTRING_LEN);
efx_ethtool_stats[i].name, for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
sizeof(ethtool_strings[i].name)); strlcpy(strings + i * ETH_GSTRING_LEN,
efx_sw_stat_desc[i].name, ETH_GSTRING_LEN);
break; break;
case ETH_SS_TEST: case ETH_SS_TEST:
efx_ethtool_fill_self_tests(efx, NULL, efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
ethtool_strings, NULL);
break; break;
default: default:
/* No other string sets */ /* No other string sets */
...@@ -474,27 +390,20 @@ static void efx_ethtool_get_stats(struct net_device *net_dev, ...@@ -474,27 +390,20 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
u64 *data) u64 *data)
{ {
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; const struct efx_sw_stat_desc *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;
int i; int i;
EFX_BUG_ON_PARANOID(stats->n_stats != EFX_ETHTOOL_NUM_STATS);
spin_lock_bh(&efx->stats_lock); spin_lock_bh(&efx->stats_lock);
/* Update MAC and NIC statistics */ /* Get NIC statistics */
efx->type->update_stats(efx); data += efx->type->update_stats(efx, data, NULL);
/* Fill detailed statistics buffer */ /* Get software statistics */
for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) { for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++) {
stat = &efx_ethtool_stats[i]; stat = &efx_sw_stat_desc[i];
switch (stat->source) { switch (stat->source) {
case EFX_ETHTOOL_STAT_SOURCE_mac_stats:
data[i] = stat->get_stat((void *)mac_stats +
stat->offset);
break;
case EFX_ETHTOOL_STAT_SOURCE_nic: case EFX_ETHTOOL_STAT_SOURCE_nic:
data[i] = stat->get_stat((void *)efx + stat->offset); data[i] = stat->get_stat((void *)efx + stat->offset);
break; break;
......
This diff is collapsed.
...@@ -832,7 +832,7 @@ efx_farch_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -832,7 +832,7 @@ efx_farch_handle_tx_event(struct efx_channel *channel, efx_qword_t *event)
efx_farch_notify_tx_desc(tx_queue); efx_farch_notify_tx_desc(tx_queue);
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_schedule_reset(efx, RESET_TYPE_TX_DESC_FETCH); efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
} else { } else {
netif_err(efx, tx_err, efx->net_dev, netif_err(efx, tx_err, efx->net_dev,
"channel %d unexpected TX event " "channel %d unexpected TX event "
...@@ -1217,7 +1217,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1217,7 +1217,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
"RX DMA Q %d reports descriptor fetch error." "RX DMA Q %d reports descriptor fetch error."
" RX Q %d is disabled.\n", ev_sub_data, " RX Q %d is disabled.\n", ev_sub_data,
ev_sub_data); ev_sub_data);
efx_schedule_reset(efx, RESET_TYPE_RX_DESC_FETCH); efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
} else } else
efx_sriov_desc_fetch_err(efx, ev_sub_data); efx_sriov_desc_fetch_err(efx, ev_sub_data);
break; break;
...@@ -1227,7 +1227,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1227,7 +1227,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
"TX DMA Q %d reports descriptor fetch error." "TX DMA Q %d reports descriptor fetch error."
" TX Q %d is disabled.\n", ev_sub_data, " TX Q %d is disabled.\n", ev_sub_data,
ev_sub_data); ev_sub_data);
efx_schedule_reset(efx, RESET_TYPE_TX_DESC_FETCH); efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
} else } else
efx_sriov_desc_fetch_err(efx, ev_sub_data); efx_sriov_desc_fetch_err(efx, ev_sub_data);
break; break;
......
...@@ -2925,4 +2925,8 @@ ...@@ -2925,4 +2925,8 @@
#define FSF_AZ_DRV_GEN_EV_MAGIC_LBN 0 #define FSF_AZ_DRV_GEN_EV_MAGIC_LBN 0
#define FSF_AZ_DRV_GEN_EV_MAGIC_WIDTH 32 #define FSF_AZ_DRV_GEN_EV_MAGIC_WIDTH 32
/* RX packet prefix */
#define FS_BZ_RX_PREFIX_HASH_OFST 12
#define FS_BZ_RX_PREFIX_SIZE 16
#endif /* EFX_FARCH_REGS_H */ #endif /* EFX_FARCH_REGS_H */
...@@ -204,12 +204,12 @@ static inline void efx_reado_table(struct efx_nic *efx, efx_oword_t *value, ...@@ -204,12 +204,12 @@ static inline void efx_reado_table(struct efx_nic *efx, efx_oword_t *value,
efx_reado(efx, value, reg + index * sizeof(efx_oword_t)); efx_reado(efx, value, reg + index * sizeof(efx_oword_t));
} }
/* Page-mapped register block size */ /* Page size used as step between per-VI registers */
#define EFX_PAGE_BLOCK_SIZE 0x2000 #define EFX_VI_PAGE_SIZE 0x2000
/* Calculate offset to page-mapped register block */ /* Calculate offset to page-mapped register */
#define EFX_PAGED_REG(page, reg) \ #define EFX_PAGED_REG(page, reg) \
((page) * EFX_PAGE_BLOCK_SIZE + (reg)) ((page) * EFX_VI_PAGE_SIZE + (reg))
/* Write the whole of RX_DESC_UPD or TX_DESC_UPD */ /* Write the whole of RX_DESC_UPD or TX_DESC_UPD */
static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value, static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value,
......
This diff is collapsed.
...@@ -36,6 +36,7 @@ enum efx_mcdi_mode { ...@@ -36,6 +36,7 @@ enum efx_mcdi_mode {
* @state: Request handling state. Waited for by @wq. * @state: Request handling state. Waited for by @wq.
* @mode: Poll for mcdi completion, or wait for an mcdi_event. * @mode: Poll for mcdi completion, or wait for an mcdi_event.
* @wq: Wait queue for threads waiting for @state != %MCDI_STATE_RUNNING * @wq: Wait queue for threads waiting for @state != %MCDI_STATE_RUNNING
* @new_epoch: Indicates start of day or start of MC reboot recovery
* @iface_lock: Serialises access to all the following fields * @iface_lock: Serialises access to all the following fields
* @seqno: The next sequence number to use for mcdi requests. * @seqno: The next sequence number to use for mcdi requests.
* @credits: Number of spurious MCDI completion events allowed before we * @credits: Number of spurious MCDI completion events allowed before we
...@@ -49,6 +50,7 @@ struct efx_mcdi_iface { ...@@ -49,6 +50,7 @@ struct efx_mcdi_iface {
enum efx_mcdi_mode mode; enum efx_mcdi_mode mode;
wait_queue_head_t wq; wait_queue_head_t wq;
spinlock_t iface_lock; spinlock_t iface_lock;
bool new_epoch;
unsigned int credits; unsigned int credits;
unsigned int seqno; unsigned int seqno;
int resprc; int resprc;
...@@ -65,6 +67,16 @@ struct efx_mcdi_mon { ...@@ -65,6 +67,16 @@ struct efx_mcdi_mon {
unsigned int n_attrs; unsigned int n_attrs;
}; };
struct efx_mcdi_mtd_partition {
struct efx_mtd_partition common;
bool updating;
u8 nvram_type;
u16 fw_subtype;
};
#define to_efx_mcdi_mtd_partition(mtd) \
container_of(mtd, struct efx_mcdi_mtd_partition, common.mtd)
/** /**
* struct efx_mcdi_data - extra state for NICs that implement MCDI * struct efx_mcdi_data - extra state for NICs that implement MCDI
* @iface: Interface/protocol state * @iface: Interface/protocol state
...@@ -250,18 +262,6 @@ extern int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); ...@@ -250,18 +262,6 @@ extern int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out);
extern int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, extern int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type,
size_t *size_out, size_t *erase_size_out, size_t *size_out, size_t *erase_size_out,
bool *protected_out); bool *protected_out);
extern int efx_mcdi_nvram_update_start(struct efx_nic *efx,
unsigned int type);
extern int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
loff_t offset, u8 *buffer, size_t length);
extern int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
loff_t offset, const u8 *buffer,
size_t length);
#define EFX_MCDI_NVRAM_LEN_MAX 128
extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type,
loff_t offset, size_t length);
extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx,
unsigned int type);
extern int efx_mcdi_nvram_test_all(struct efx_nic *efx); extern int efx_mcdi_nvram_test_all(struct efx_nic *efx);
extern int efx_mcdi_handle_assertion(struct efx_nic *efx); extern int efx_mcdi_handle_assertion(struct efx_nic *efx);
extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
...@@ -291,4 +291,14 @@ static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; } ...@@ -291,4 +291,14 @@ static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; }
static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {} static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {}
#endif #endif
#ifdef CONFIG_SFC_MTD
extern int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start,
size_t len, size_t *retlen, u8 *buffer);
extern int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len);
extern int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start,
size_t len, size_t *retlen, const u8 *buffer);
extern int efx_mcdi_mtd_sync(struct mtd_info *mtd);
extern void efx_mcdi_mtd_rename(struct efx_mtd_partition *part);
#endif
#endif /* EFX_MCDI_H */ #endif /* EFX_MCDI_H */
...@@ -28,7 +28,7 @@ static const struct { ...@@ -28,7 +28,7 @@ static const struct {
const char *label; const char *label;
enum efx_hwmon_type hwmon_type; enum efx_hwmon_type hwmon_type;
int port; int port;
} efx_mcdi_sensor_type[MC_CMD_SENSOR_ENTRY_MAXNUM] = { } efx_mcdi_sensor_type[] = {
#define SENSOR(name, label, hwmon_type, port) \ #define SENSOR(name, label, hwmon_type, port) \
[MC_CMD_SENSOR_##name] = { label, hwmon_type, port } [MC_CMD_SENSOR_##name] = { label, hwmon_type, port }
SENSOR(CONTROLLER_TEMP, "Controller temp.", EFX_HWMON_TEMP, -1), SENSOR(CONTROLLER_TEMP, "Controller temp.", EFX_HWMON_TEMP, -1),
...@@ -54,6 +54,7 @@ static const char *const sensor_status_names[] = { ...@@ -54,6 +54,7 @@ static const char *const sensor_status_names[] = {
[MC_CMD_SENSOR_STATE_WARNING] = "Warning", [MC_CMD_SENSOR_STATE_WARNING] = "Warning",
[MC_CMD_SENSOR_STATE_FATAL] = "Fatal", [MC_CMD_SENSOR_STATE_FATAL] = "Fatal",
[MC_CMD_SENSOR_STATE_BROKEN] = "Device failure", [MC_CMD_SENSOR_STATE_BROKEN] = "Device failure",
[MC_CMD_SENSOR_STATE_NO_READING] = "No reading",
}; };
void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev) void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
...@@ -85,6 +86,7 @@ struct efx_mcdi_mon_attribute { ...@@ -85,6 +86,7 @@ struct efx_mcdi_mon_attribute {
struct device_attribute dev_attr; struct device_attribute dev_attr;
unsigned int index; unsigned int index;
unsigned int type; unsigned int type;
enum efx_hwmon_type hwmon_type;
unsigned int limit_value; unsigned int limit_value;
char name[12]; char name[12];
}; };
...@@ -92,11 +94,12 @@ struct efx_mcdi_mon_attribute { ...@@ -92,11 +94,12 @@ struct efx_mcdi_mon_attribute {
static int efx_mcdi_mon_update(struct efx_nic *efx) static int efx_mcdi_mon_update(struct efx_nic *efx)
{ {
struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx);
MCDI_DECLARE_BUF(inbuf, MC_CMD_READ_SENSORS_IN_LEN); MCDI_DECLARE_BUF(inbuf, MC_CMD_READ_SENSORS_EXT_IN_LEN);
int rc; int rc;
MCDI_SET_QWORD(inbuf, READ_SENSORS_IN_DMA_ADDR, MCDI_SET_QWORD(inbuf, READ_SENSORS_EXT_IN_DMA_ADDR,
hwmon->dma_buf.dma_addr); hwmon->dma_buf.dma_addr);
MCDI_SET_DWORD(inbuf, READ_SENSORS_EXT_IN_LENGTH, hwmon->dma_buf.len);
rc = efx_mcdi_rpc(efx, MC_CMD_READ_SENSORS, rc = efx_mcdi_rpc(efx, MC_CMD_READ_SENSORS,
inbuf, sizeof(inbuf), NULL, 0, NULL); inbuf, sizeof(inbuf), NULL, 0, NULL);
...@@ -144,17 +147,21 @@ static ssize_t efx_mcdi_mon_show_value(struct device *dev, ...@@ -144,17 +147,21 @@ static ssize_t efx_mcdi_mon_show_value(struct device *dev,
struct efx_mcdi_mon_attribute *mon_attr = struct efx_mcdi_mon_attribute *mon_attr =
container_of(attr, struct efx_mcdi_mon_attribute, dev_attr); container_of(attr, struct efx_mcdi_mon_attribute, dev_attr);
efx_dword_t entry; efx_dword_t entry;
unsigned int value; unsigned int value, state;
int rc; int rc;
rc = efx_mcdi_mon_get_entry(dev, mon_attr->index, &entry); rc = efx_mcdi_mon_get_entry(dev, mon_attr->index, &entry);
if (rc) if (rc)
return rc; return rc;
state = EFX_DWORD_FIELD(entry, MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_STATE);
if (state == MC_CMD_SENSOR_STATE_NO_READING)
return -EBUSY;
value = EFX_DWORD_FIELD(entry, MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_VALUE); value = EFX_DWORD_FIELD(entry, MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_VALUE);
/* Convert temperature from degrees to milli-degrees Celsius */ /* Convert temperature from degrees to milli-degrees Celsius */
if (efx_mcdi_sensor_type[mon_attr->type].hwmon_type == EFX_HWMON_TEMP) if (mon_attr->hwmon_type == EFX_HWMON_TEMP)
value *= 1000; value *= 1000;
return sprintf(buf, "%u\n", value); return sprintf(buf, "%u\n", value);
...@@ -171,7 +178,7 @@ static ssize_t efx_mcdi_mon_show_limit(struct device *dev, ...@@ -171,7 +178,7 @@ static ssize_t efx_mcdi_mon_show_limit(struct device *dev,
value = mon_attr->limit_value; value = mon_attr->limit_value;
/* Convert temperature from degrees to milli-degrees Celsius */ /* Convert temperature from degrees to milli-degrees Celsius */
if (efx_mcdi_sensor_type[mon_attr->type].hwmon_type == EFX_HWMON_TEMP) if (mon_attr->hwmon_type == EFX_HWMON_TEMP)
value *= 1000; value *= 1000;
return sprintf(buf, "%u\n", value); return sprintf(buf, "%u\n", value);
...@@ -219,6 +226,10 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, ...@@ -219,6 +226,10 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name,
strlcpy(attr->name, name, sizeof(attr->name)); strlcpy(attr->name, name, sizeof(attr->name));
attr->index = index; attr->index = index;
attr->type = type; attr->type = type;
if (type < ARRAY_SIZE(efx_mcdi_sensor_type))
attr->hwmon_type = efx_mcdi_sensor_type[type].hwmon_type;
else
attr->hwmon_type = EFX_HWMON_UNKNOWN;
attr->limit_value = limit_value; attr->limit_value = limit_value;
sysfs_attr_init(&attr->dev_attr.attr); sysfs_attr_init(&attr->dev_attr.attr);
attr->dev_attr.attr.name = attr->name; attr->dev_attr.attr.name = attr->name;
...@@ -233,35 +244,42 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, ...@@ -233,35 +244,42 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name,
int efx_mcdi_mon_probe(struct efx_nic *efx) int efx_mcdi_mon_probe(struct efx_nic *efx)
{ {
struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx);
unsigned int n_attrs, n_temp = 0, n_cool = 0, n_in = 0; unsigned int n_temp = 0, n_cool = 0, n_in = 0;
MCDI_DECLARE_BUF(inbuf, MC_CMD_SENSOR_INFO_EXT_IN_LEN);
MCDI_DECLARE_BUF(outbuf, MC_CMD_SENSOR_INFO_OUT_LENMAX); MCDI_DECLARE_BUF(outbuf, MC_CMD_SENSOR_INFO_OUT_LENMAX);
unsigned int n_pages, n_sensors, n_attrs, page;
size_t outlen; size_t outlen;
char name[12]; char name[12];
u32 mask; u32 mask;
int rc, i, type; int rc, i, j, type;
BUILD_BUG_ON(MC_CMD_SENSOR_INFO_IN_LEN != 0); /* Find out how many sensors are present */
n_sensors = 0;
page = 0;
do {
MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, page);
rc = efx_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, NULL, 0, rc = efx_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, inbuf, sizeof(inbuf),
outbuf, sizeof(outbuf), &outlen); outbuf, sizeof(outbuf), &outlen);
if (rc) if (rc)
return rc; return rc;
if (outlen < MC_CMD_SENSOR_INFO_OUT_LENMIN) if (outlen < MC_CMD_SENSOR_INFO_OUT_LENMIN)
return -EIO; return -EIO;
/* Find out which sensors are present. Don't create a device
* if there are none.
*/
mask = MCDI_DWORD(outbuf, SENSOR_INFO_OUT_MASK); mask = MCDI_DWORD(outbuf, SENSOR_INFO_OUT_MASK);
if (mask == 0) n_sensors += hweight32(mask & ~(1 << MC_CMD_SENSOR_PAGE0_NEXT));
return 0; ++page;
} while (mask & (1 << MC_CMD_SENSOR_PAGE0_NEXT));
n_pages = page;
/* Check again for short response */ /* Don't create a device if there are none */
if (outlen < MC_CMD_SENSOR_INFO_OUT_LEN(hweight32(mask))) if (n_sensors == 0)
return -EIO; return 0;
rc = efx_nic_alloc_buffer(efx, &hwmon->dma_buf, rc = efx_nic_alloc_buffer(
4 * MC_CMD_SENSOR_ENTRY_MAXNUM, GFP_KERNEL); efx, &hwmon->dma_buf,
n_sensors * MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_LEN,
GFP_KERNEL);
if (rc) if (rc)
return rc; return rc;
...@@ -272,7 +290,7 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) ...@@ -272,7 +290,7 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
* attributes for this set of sensors: name of the driver plus * attributes for this set of sensors: name of the driver plus
* value, min, max, crit, alarm and label for each sensor. * value, min, max, crit, alarm and label for each sensor.
*/ */
n_attrs = 1 + 6 * hweight32(mask); n_attrs = 1 + 6 * n_sensors;
hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL);
if (!hwmon->attrs) { if (!hwmon->attrs) {
rc = -ENOMEM; rc = -ENOMEM;
...@@ -289,26 +307,63 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) ...@@ -289,26 +307,63 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
if (rc) if (rc)
goto fail; goto fail;
for (i = 0, type = -1; ; i++) { for (i = 0, j = -1, type = -1; ; i++) {
enum efx_hwmon_type hwmon_type;
const char *hwmon_prefix; const char *hwmon_prefix;
unsigned hwmon_index; unsigned hwmon_index;
u16 min1, max1, min2, max2; u16 min1, max1, min2, max2;
/* Find next sensor type or exit if there is none */ /* Find next sensor type or exit if there is none */
do {
type++; type++;
while (!(mask & (1 << type))) {
type++; if ((type % 32) == 0) {
if (type == 32) page = type / 32;
j = -1;
if (page == n_pages)
return 0; return 0;
MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE,
page);
rc = efx_mcdi_rpc(efx, MC_CMD_SENSOR_INFO,
inbuf, sizeof(inbuf),
outbuf, sizeof(outbuf),
&outlen);
if (rc)
goto fail;
if (outlen < MC_CMD_SENSOR_INFO_OUT_LENMIN) {
rc = -EIO;
goto fail;
} }
mask = (MCDI_DWORD(outbuf,
SENSOR_INFO_OUT_MASK) &
~(1 << MC_CMD_SENSOR_PAGE0_NEXT));
/* Check again for short response */
if (outlen <
MC_CMD_SENSOR_INFO_OUT_LEN(hweight32(mask))) {
rc = -EIO;
goto fail;
}
}
} while (!(mask & (1 << type % 32)));
j++;
if (type < ARRAY_SIZE(efx_mcdi_sensor_type)) {
hwmon_type = efx_mcdi_sensor_type[type].hwmon_type;
/* Skip sensors specific to a different port */ /* Skip sensors specific to a different port */
if (efx_mcdi_sensor_type[type].hwmon_type != EFX_HWMON_UNKNOWN && if (hwmon_type != EFX_HWMON_UNKNOWN &&
efx_mcdi_sensor_type[type].port >= 0 && efx_mcdi_sensor_type[type].port >= 0 &&
efx_mcdi_sensor_type[type].port != efx_port_num(efx)) efx_mcdi_sensor_type[type].port !=
efx_port_num(efx))
continue; continue;
} else {
hwmon_type = EFX_HWMON_UNKNOWN;
}
switch (efx_mcdi_sensor_type[type].hwmon_type) { switch (hwmon_type) {
case EFX_HWMON_TEMP: case EFX_HWMON_TEMP:
hwmon_prefix = "temp"; hwmon_prefix = "temp";
hwmon_index = ++n_temp; /* 1-based */ hwmon_index = ++n_temp; /* 1-based */
...@@ -328,13 +383,13 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) ...@@ -328,13 +383,13 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
} }
min1 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY, min1 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY,
SENSOR_INFO_ENTRY, i, MIN1); SENSOR_INFO_ENTRY, j, MIN1);
max1 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY, max1 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY,
SENSOR_INFO_ENTRY, i, MAX1); SENSOR_INFO_ENTRY, j, MAX1);
min2 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY, min2 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY,
SENSOR_INFO_ENTRY, i, MIN2); SENSOR_INFO_ENTRY, j, MIN2);
max2 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY, max2 = MCDI_ARRAY_FIELD(outbuf, SENSOR_ENTRY,
SENSOR_INFO_ENTRY, i, MAX2); SENSOR_INFO_ENTRY, j, MAX2);
if (min1 != max1) { if (min1 != max1) {
snprintf(name, sizeof(name), "%s%u_input", snprintf(name, sizeof(name), "%s%u_input",
...@@ -381,7 +436,8 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) ...@@ -381,7 +436,8 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
if (rc) if (rc)
goto fail; goto fail;
if (efx_mcdi_sensor_type[type].label) { if (type < ARRAY_SIZE(efx_mcdi_sensor_type) &&
efx_mcdi_sensor_type[type].label) {
snprintf(name, sizeof(name), "%s%u_label", snprintf(name, sizeof(name), "%s%u_label",
hwmon_prefix, hwmon_index); hwmon_prefix, hwmon_index);
rc = efx_mcdi_mon_add_attr( rc = efx_mcdi_mon_add_attr(
......
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/mtd/mtd.h>
#include "enum.h" #include "enum.h"
#include "bitfield.h" #include "bitfield.h"
...@@ -185,6 +186,7 @@ struct efx_tx_buffer { ...@@ -185,6 +186,7 @@ struct efx_tx_buffer {
* variable indicates that the queue is empty. This is to * variable indicates that the queue is empty. This is to
* avoid cache-line ping-pong between the xmit path and the * avoid cache-line ping-pong between the xmit path and the
* completion path. * completion path.
* @merge_events: Number of TX merged completion events
* @insert_count: Current insert pointer * @insert_count: Current insert pointer
* This is the number of buffers that have been added to the * This is the number of buffers that have been added to the
* software ring. * software ring.
...@@ -221,6 +223,7 @@ struct efx_tx_queue { ...@@ -221,6 +223,7 @@ struct efx_tx_queue {
/* Members used mainly on the completion path */ /* Members used mainly on the completion path */
unsigned int read_count ____cacheline_aligned_in_smp; unsigned int read_count ____cacheline_aligned_in_smp;
unsigned int old_write_count; unsigned int old_write_count;
unsigned int merge_events;
/* Members used only on the xmit path */ /* Members used only on the xmit path */
unsigned int insert_count ____cacheline_aligned_in_smp; unsigned int insert_count ____cacheline_aligned_in_smp;
...@@ -260,6 +263,7 @@ struct efx_rx_buffer { ...@@ -260,6 +263,7 @@ struct efx_rx_buffer {
#define EFX_RX_PKT_CSUMMED 0x0002 #define EFX_RX_PKT_CSUMMED 0x0002
#define EFX_RX_PKT_DISCARD 0x0004 #define EFX_RX_PKT_DISCARD 0x0004
#define EFX_RX_PKT_TCP 0x0040 #define EFX_RX_PKT_TCP 0x0040
#define EFX_RX_PKT_PREFIX_LEN 0x0080 /* length is in prefix only */
/** /**
* struct efx_rx_page_state - Page-based rx buffer state * struct efx_rx_page_state - Page-based rx buffer state
...@@ -594,75 +598,17 @@ static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode) ...@@ -594,75 +598,17 @@ static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode)
return !!(mode & ~PHY_MODE_TX_DISABLED); return !!(mode & ~PHY_MODE_TX_DISABLED);
} }
/* /**
* Efx extended statistics * struct efx_hw_stat_desc - Description of a hardware statistic
* * @name: Name of the statistic as visible through ethtool, or %NULL if
* Not all statistics are provided by all supported MACs. The purpose * it should not be exposed
* is this structure is to contain the raw statistics provided by each * @dma_width: Width in bits (0 for non-DMA statistics)
* MAC. * @offset: Offset within stats (ignored for non-DMA statistics)
*/ */
struct efx_mac_stats { struct efx_hw_stat_desc {
u64 tx_bytes; const char *name;
u64 tx_good_bytes; u16 dma_width;
u64 tx_bad_bytes; u16 offset;
u64 tx_packets;
u64 tx_bad;
u64 tx_pause;
u64 tx_control;
u64 tx_unicast;
u64 tx_multicast;
u64 tx_broadcast;
u64 tx_lt64;
u64 tx_64;
u64 tx_65_to_127;
u64 tx_128_to_255;
u64 tx_256_to_511;
u64 tx_512_to_1023;
u64 tx_1024_to_15xx;
u64 tx_15xx_to_jumbo;
u64 tx_gtjumbo;
u64 tx_collision;
u64 tx_single_collision;
u64 tx_multiple_collision;
u64 tx_excessive_collision;
u64 tx_deferred;
u64 tx_late_collision;
u64 tx_excessive_deferred;
u64 tx_non_tcpudp;
u64 tx_mac_src_error;
u64 tx_ip_src_error;
u64 rx_bytes;
u64 rx_good_bytes;
u64 rx_bad_bytes;
u64 rx_packets;
u64 rx_good;
u64 rx_bad;
u64 rx_pause;
u64 rx_control;
u64 rx_unicast;
u64 rx_multicast;
u64 rx_broadcast;
u64 rx_lt64;
u64 rx_64;
u64 rx_65_to_127;
u64 rx_128_to_255;
u64 rx_256_to_511;
u64 rx_512_to_1023;
u64 rx_1024_to_15xx;
u64 rx_15xx_to_jumbo;
u64 rx_gtjumbo;
u64 rx_bad_lt64;
u64 rx_bad_64_to_15xx;
u64 rx_bad_15xx_to_jumbo;
u64 rx_bad_gtjumbo;
u64 rx_overflow;
u64 rx_missed;
u64 rx_false_carrier;
u64 rx_symbol_error;
u64 rx_align_error;
u64 rx_length_error;
u64 rx_internal_error;
u64 rx_good_lt64;
}; };
/* Number of bits used in a multicast filter hash address */ /* Number of bits used in a multicast filter hash address */
...@@ -720,6 +666,11 @@ struct vfdi_status; ...@@ -720,6 +666,11 @@ struct vfdi_status;
* @rx_buffer_order: Order (log2) of number of pages for each RX buffer * @rx_buffer_order: Order (log2) of number of pages for each RX buffer
* @rx_buffer_truesize: Amortised allocation size of an RX buffer, * @rx_buffer_truesize: Amortised allocation size of an RX buffer,
* for use in sk_buff::truesize * for use in sk_buff::truesize
* @rx_prefix_size: Size of RX prefix before packet data
* @rx_packet_hash_offset: Offset of RX flow hash from start of packet data
* (valid only if @rx_prefix_size != 0; always negative)
* @rx_packet_len_offset: Offset of RX packet length from start of packet data
* (valid only for NICs that set %EFX_RX_PKT_PREFIX_LEN; always negative)
* @rx_hash_key: Toeplitz hash key for RSS * @rx_hash_key: Toeplitz hash key for RSS
* @rx_indir_table: Indirection table for RSS * @rx_indir_table: Indirection table for RSS
* @rx_scatter: Scatter mode enabled for receives * @rx_scatter: Scatter mode enabled for receives
...@@ -794,12 +745,8 @@ struct vfdi_status; ...@@ -794,12 +745,8 @@ struct vfdi_status;
* @last_irq_cpu: Last CPU to handle a possible test interrupt. This * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
* field is used by efx_test_interrupts() to verify that an * field is used by efx_test_interrupts() to verify that an
* interrupt has occurred. * interrupt has occurred.
* @n_rx_nodesc_drop_cnt: RX no descriptor drop count * @stats_lock: Statistics update lock. Must be held when calling
* @mac_stats: MAC statistics. These include all statistics the MACs * efx_nic_type::{update,start,stop}_stats.
* can provide. Generic code converts these into a standard
* &struct net_device_stats.
* @stats_lock: Statistics update lock. Serialises statistics fetches
* and access to @mac_stats.
* *
* This is stored in the private area of the &struct net_device. * This is stored in the private area of the &struct net_device.
*/ */
...@@ -854,6 +801,9 @@ struct efx_nic { ...@@ -854,6 +801,9 @@ struct efx_nic {
unsigned int rx_page_buf_step; unsigned int rx_page_buf_step;
unsigned int rx_bufs_per_page; unsigned int rx_bufs_per_page;
unsigned int rx_pages_per_batch; unsigned int rx_pages_per_batch;
unsigned int rx_prefix_size;
int rx_packet_hash_offset;
int rx_packet_len_offset;
u8 rx_hash_key[40]; u8 rx_hash_key[40];
u32 rx_indir_table[128]; u32 rx_indir_table[128];
bool rx_scatter; bool rx_scatter;
...@@ -868,7 +818,6 @@ struct efx_nic { ...@@ -868,7 +818,6 @@ struct efx_nic {
struct delayed_work selftest_work; struct delayed_work selftest_work;
#ifdef CONFIG_SFC_MTD #ifdef CONFIG_SFC_MTD
const struct efx_mtd_ops *mtd_ops;
struct list_head mtd_list; struct list_head mtd_list;
#endif #endif
...@@ -939,8 +888,6 @@ struct efx_nic { ...@@ -939,8 +888,6 @@ struct efx_nic {
struct delayed_work monitor_work ____cacheline_aligned_in_smp; struct delayed_work monitor_work ____cacheline_aligned_in_smp;
spinlock_t biu_lock; spinlock_t biu_lock;
int last_irq_cpu; int last_irq_cpu;
unsigned n_rx_nodesc_drop_cnt;
struct efx_mac_stats mac_stats;
spinlock_t stats_lock; spinlock_t stats_lock;
}; };
...@@ -954,6 +901,14 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) ...@@ -954,6 +901,14 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
return efx->port_num; return efx->port_num;
} }
struct efx_mtd_partition {
struct list_head node;
struct mtd_info mtd;
const char *dev_type_name;
const char *type_name;
char name[IFNAMSIZ + 20];
};
/** /**
* struct efx_nic_type - Efx device type definition * struct efx_nic_type - Efx device type definition
* @mem_map_size: Get memory BAR mapped size * @mem_map_size: Get memory BAR mapped size
...@@ -976,7 +931,9 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) ...@@ -976,7 +931,9 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
* (for Falcon architecture) * (for Falcon architecture)
* @finish_flush: Clean up after flushing the DMA queues (for Falcon * @finish_flush: Clean up after flushing the DMA queues (for Falcon
* architecture) * architecture)
* @update_stats: Update statistics not provided by event handling * @describe_stats: Describe statistics for ethtool
* @update_stats: Update statistics not provided by event handling.
* Either argument may be %NULL.
* @start_stats: Start the regular fetching of statistics * @start_stats: Start the regular fetching of statistics
* @stop_stats: Stop the regular fetching of statistics * @stop_stats: Stop the regular fetching of statistics
* @set_id_led: Set state of identifying LED or revert to automatic function * @set_id_led: Set state of identifying LED or revert to automatic function
...@@ -1047,6 +1004,15 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) ...@@ -1047,6 +1004,15 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
* @filter_rfs_expire_one: Consider expiring a filter inserted for RFS. * @filter_rfs_expire_one: Consider expiring a filter inserted for RFS.
* This must check whether the specified table entry is used by RFS * This must check whether the specified table entry is used by RFS
* and that rps_may_expire_flow() returns true for it. * and that rps_may_expire_flow() returns true for it.
* @mtd_probe: Probe and add MTD partitions associated with this net device,
* using efx_mtd_add()
* @mtd_rename: Set an MTD partition name using the net device name
* @mtd_read: Read from an MTD partition
* @mtd_erase: Erase part of an MTD partition
* @mtd_write: Write to an MTD partition
* @mtd_sync: Wait for write-back to complete on MTD partition. This
* also notifies the driver that a writer has finished using this
* partition.
* @revision: Hardware architecture revision * @revision: Hardware architecture revision
* @txd_ptr_tbl_base: TX descriptor ring base address * @txd_ptr_tbl_base: TX descriptor ring base address
* @rxd_ptr_tbl_base: RX descriptor ring base address * @rxd_ptr_tbl_base: RX descriptor ring base address
...@@ -1054,7 +1020,8 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) ...@@ -1054,7 +1020,8 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
* @evq_ptr_tbl_base: Event queue pointer table base address * @evq_ptr_tbl_base: Event queue pointer table base address
* @evq_rptr_tbl_base: Event queue read-pointer table base address * @evq_rptr_tbl_base: Event queue read-pointer table base address
* @max_dma_mask: Maximum possible DMA mask * @max_dma_mask: Maximum possible DMA mask
* @rx_buffer_hash_size: Size of hash at start of RX packet * @rx_prefix_size: Size of RX prefix before packet data
* @rx_hash_offset: Offset of RX flow hash within prefix
* @rx_buffer_padding: Size of padding at end of RX packet * @rx_buffer_padding: Size of padding at end of RX packet
* @can_rx_scatter: NIC is able to scatter packet to multiple buffers * @can_rx_scatter: NIC is able to scatter packet to multiple buffers
* @max_interrupt_mode: Highest capability interrupt mode supported * @max_interrupt_mode: Highest capability interrupt mode supported
...@@ -1081,7 +1048,9 @@ struct efx_nic_type { ...@@ -1081,7 +1048,9 @@ struct efx_nic_type {
int (*fini_dmaq)(struct efx_nic *efx); int (*fini_dmaq)(struct efx_nic *efx);
void (*prepare_flush)(struct efx_nic *efx); void (*prepare_flush)(struct efx_nic *efx);
void (*finish_flush)(struct efx_nic *efx); void (*finish_flush)(struct efx_nic *efx);
void (*update_stats)(struct efx_nic *efx); size_t (*describe_stats)(struct efx_nic *efx, u8 *names);
size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
struct rtnl_link_stats64 *core_stats);
void (*start_stats)(struct efx_nic *efx); void (*start_stats)(struct efx_nic *efx);
void (*stop_stats)(struct efx_nic *efx); void (*stop_stats)(struct efx_nic *efx);
void (*set_id_led)(struct efx_nic *efx, enum efx_led_mode mode); void (*set_id_led)(struct efx_nic *efx, enum efx_led_mode mode);
...@@ -1150,6 +1119,17 @@ struct efx_nic_type { ...@@ -1150,6 +1119,17 @@ struct efx_nic_type {
bool (*filter_rfs_expire_one)(struct efx_nic *efx, u32 flow_id, bool (*filter_rfs_expire_one)(struct efx_nic *efx, u32 flow_id,
unsigned int index); unsigned int index);
#endif #endif
#ifdef CONFIG_SFC_MTD
int (*mtd_probe)(struct efx_nic *efx);
void (*mtd_rename)(struct efx_mtd_partition *part);
int (*mtd_read)(struct mtd_info *mtd, loff_t start, size_t len,
size_t *retlen, u8 *buffer);
int (*mtd_erase)(struct mtd_info *mtd, loff_t start, size_t len);
int (*mtd_write)(struct mtd_info *mtd, loff_t start, size_t len,
size_t *retlen, const u8 *buffer);
int (*mtd_sync)(struct mtd_info *mtd);
#endif
void (*ptp_write_host_time)(struct efx_nic *efx, u32 host_time);
int revision; int revision;
unsigned int txd_ptr_tbl_base; unsigned int txd_ptr_tbl_base;
...@@ -1158,7 +1138,8 @@ struct efx_nic_type { ...@@ -1158,7 +1138,8 @@ struct efx_nic_type {
unsigned int evq_ptr_tbl_base; unsigned int evq_ptr_tbl_base;
unsigned int evq_rptr_tbl_base; unsigned int evq_rptr_tbl_base;
u64 max_dma_mask; u64 max_dma_mask;
unsigned int rx_buffer_hash_size; unsigned int rx_prefix_size;
unsigned int rx_hash_offset;
unsigned int rx_buffer_padding; unsigned int rx_buffer_padding;
bool can_rx_scatter; bool can_rx_scatter;
unsigned int max_interrupt_mode; unsigned int max_interrupt_mode;
......
...@@ -429,3 +429,86 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) ...@@ -429,3 +429,86 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
} }
} }
} }
/**
* efx_nic_describe_stats - Describe supported statistics for ethtool
* @desc: Array of &struct efx_hw_stat_desc describing the statistics
* @count: Length of the @desc array
* @mask: Bitmask of which elements of @desc are enabled
* @names: Buffer to copy names to, or %NULL. The names are copied
* starting at intervals of %ETH_GSTRING_LEN bytes.
*
* Returns the number of visible statistics, i.e. the number of set
* bits in the first @count bits of @mask for which a name is defined.
*/
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, u8 *names)
{
size_t visible = 0;
size_t index;
for_each_set_bit(index, mask, count) {
if (desc[index].name) {
if (names) {
strlcpy(names, desc[index].name,
ETH_GSTRING_LEN);
names += ETH_GSTRING_LEN;
}
++visible;
}
}
return visible;
}
/**
* efx_nic_update_stats - Convert statistics DMA buffer to array of u64
* @desc: Array of &struct efx_hw_stat_desc describing the DMA buffer
* layout. DMA widths of 0, 16, 32 and 64 are supported; where
* the width is specified as 0 the corresponding element of
* @stats is not updated.
* @count: Length of the @desc array
* @mask: Bitmask of which elements of @desc are enabled
* @stats: Buffer to update with the converted statistics. The length
* of this array must be at least the number of set bits in the
* first @count bits of @mask.
* @dma_buf: DMA buffer containing hardware statistics
* @accumulate: If set, the converted values will be added rather than
* directly stored to the corresponding elements of @stats
*/
void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask,
u64 *stats, const void *dma_buf, bool accumulate)
{
size_t index;
for_each_set_bit(index, mask, count) {
if (desc[index].dma_width) {
const void *addr = dma_buf + desc[index].offset;
u64 val;
switch (desc[index].dma_width) {
case 16:
val = le16_to_cpup((__le16 *)addr);
break;
case 32:
val = le32_to_cpup((__le32 *)addr);
break;
case 64:
val = le64_to_cpup((__le64 *)addr);
break;
default:
WARN_ON(1);
val = 0;
break;
}
if (accumulate)
*stats += val;
else
*stats = val;
}
++stats;
}
}
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "net_driver.h" #include "net_driver.h"
#include "efx.h" #include "efx.h"
#include "mcdi.h" #include "mcdi.h"
#include "spi.h"
/* /*
* Falcon hardware control * Falcon hardware control
...@@ -118,9 +117,6 @@ enum { ...@@ -118,9 +117,6 @@ enum {
(1 << LOOPBACK_XGXS) | \ (1 << LOOPBACK_XGXS) | \
(1 << LOOPBACK_XAUI)) (1 << LOOPBACK_XAUI))
#define FALCON_GMAC_LOOPBACKS \
(1 << LOOPBACK_GMAC)
/* Alignment of PCIe DMA boundaries (4KB) */ /* Alignment of PCIe DMA boundaries (4KB) */
#define EFX_PAGE_SIZE 4096 #define EFX_PAGE_SIZE 4096
/* Size and alignment of buffer table entries (same) */ /* Size and alignment of buffer table entries (same) */
...@@ -163,14 +159,97 @@ struct falcon_board { ...@@ -163,14 +159,97 @@ struct falcon_board {
struct i2c_client *hwmon_client, *ioexp_client; struct i2c_client *hwmon_client, *ioexp_client;
}; };
/**
* struct falcon_spi_device - a Falcon SPI (Serial Peripheral Interface) device
* @device_id: Controller's id for the device
* @size: Size (in bytes)
* @addr_len: Number of address bytes in read/write commands
* @munge_address: Flag whether addresses should be munged.
* Some devices with 9-bit addresses (e.g. AT25040A EEPROM)
* use bit 3 of the command byte as address bit A8, rather
* than having a two-byte address. If this flag is set, then
* commands should be munged in this way.
* @erase_command: Erase command (or 0 if sector erase not needed).
* @erase_size: Erase sector size (in bytes)
* Erase commands affect sectors with this size and alignment.
* This must be a power of two.
* @block_size: Write block size (in bytes).
* Write commands are limited to blocks with this size and alignment.
*/
struct falcon_spi_device {
int device_id;
unsigned int size;
unsigned int addr_len;
unsigned int munge_address:1;
u8 erase_command;
unsigned int erase_size;
unsigned int block_size;
};
static inline bool falcon_spi_present(const struct falcon_spi_device *spi)
{
return spi->size != 0;
}
enum {
FALCON_STAT_tx_bytes,
FALCON_STAT_tx_packets,
FALCON_STAT_tx_pause,
FALCON_STAT_tx_control,
FALCON_STAT_tx_unicast,
FALCON_STAT_tx_multicast,
FALCON_STAT_tx_broadcast,
FALCON_STAT_tx_lt64,
FALCON_STAT_tx_64,
FALCON_STAT_tx_65_to_127,
FALCON_STAT_tx_128_to_255,
FALCON_STAT_tx_256_to_511,
FALCON_STAT_tx_512_to_1023,
FALCON_STAT_tx_1024_to_15xx,
FALCON_STAT_tx_15xx_to_jumbo,
FALCON_STAT_tx_gtjumbo,
FALCON_STAT_tx_non_tcpudp,
FALCON_STAT_tx_mac_src_error,
FALCON_STAT_tx_ip_src_error,
FALCON_STAT_rx_bytes,
FALCON_STAT_rx_good_bytes,
FALCON_STAT_rx_bad_bytes,
FALCON_STAT_rx_packets,
FALCON_STAT_rx_good,
FALCON_STAT_rx_bad,
FALCON_STAT_rx_pause,
FALCON_STAT_rx_control,
FALCON_STAT_rx_unicast,
FALCON_STAT_rx_multicast,
FALCON_STAT_rx_broadcast,
FALCON_STAT_rx_lt64,
FALCON_STAT_rx_64,
FALCON_STAT_rx_65_to_127,
FALCON_STAT_rx_128_to_255,
FALCON_STAT_rx_256_to_511,
FALCON_STAT_rx_512_to_1023,
FALCON_STAT_rx_1024_to_15xx,
FALCON_STAT_rx_15xx_to_jumbo,
FALCON_STAT_rx_gtjumbo,
FALCON_STAT_rx_bad_lt64,
FALCON_STAT_rx_bad_gtjumbo,
FALCON_STAT_rx_overflow,
FALCON_STAT_rx_symbol_error,
FALCON_STAT_rx_align_error,
FALCON_STAT_rx_length_error,
FALCON_STAT_rx_internal_error,
FALCON_STAT_rx_nodesc_drop_cnt,
FALCON_STAT_COUNT
};
/** /**
* struct falcon_nic_data - Falcon NIC state * struct falcon_nic_data - Falcon NIC state
* @pci_dev2: Secondary function of Falcon A * @pci_dev2: Secondary function of Falcon A
* @board: Board state and functions * @board: Board state and functions
* @stats: Hardware statistics
* @stats_disable_count: Nest count for disabling statistics fetches * @stats_disable_count: Nest count for disabling statistics fetches
* @stats_pending: Is there a pending DMA of MAC statistics. * @stats_pending: Is there a pending DMA of MAC statistics.
* @stats_timer: A timer for regularly fetching MAC statistics. * @stats_timer: A timer for regularly fetching MAC statistics.
* @stats_dma_done: Pointer to the flag which indicates DMA completion.
* @spi_flash: SPI flash device * @spi_flash: SPI flash device
* @spi_eeprom: SPI EEPROM device * @spi_eeprom: SPI EEPROM device
* @spi_lock: SPI bus lock * @spi_lock: SPI bus lock
...@@ -180,10 +259,10 @@ struct falcon_board { ...@@ -180,10 +259,10 @@ struct falcon_board {
struct falcon_nic_data { struct falcon_nic_data {
struct pci_dev *pci_dev2; struct pci_dev *pci_dev2;
struct falcon_board board; struct falcon_board board;
u64 stats[FALCON_STAT_COUNT];
unsigned int stats_disable_count; unsigned int stats_disable_count;
bool stats_pending; bool stats_pending;
struct timer_list stats_timer; struct timer_list stats_timer;
u32 *stats_dma_done;
struct falcon_spi_device spi_flash; struct falcon_spi_device spi_flash;
struct falcon_spi_device spi_eeprom; struct falcon_spi_device spi_eeprom;
struct mutex spi_lock; struct mutex spi_lock;
...@@ -197,12 +276,75 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx) ...@@ -197,12 +276,75 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx)
return &data->board; return &data->board;
} }
enum {
SIENA_STAT_tx_bytes,
SIENA_STAT_tx_good_bytes,
SIENA_STAT_tx_bad_bytes,
SIENA_STAT_tx_packets,
SIENA_STAT_tx_bad,
SIENA_STAT_tx_pause,
SIENA_STAT_tx_control,
SIENA_STAT_tx_unicast,
SIENA_STAT_tx_multicast,
SIENA_STAT_tx_broadcast,
SIENA_STAT_tx_lt64,
SIENA_STAT_tx_64,
SIENA_STAT_tx_65_to_127,
SIENA_STAT_tx_128_to_255,
SIENA_STAT_tx_256_to_511,
SIENA_STAT_tx_512_to_1023,
SIENA_STAT_tx_1024_to_15xx,
SIENA_STAT_tx_15xx_to_jumbo,
SIENA_STAT_tx_gtjumbo,
SIENA_STAT_tx_collision,
SIENA_STAT_tx_single_collision,
SIENA_STAT_tx_multiple_collision,
SIENA_STAT_tx_excessive_collision,
SIENA_STAT_tx_deferred,
SIENA_STAT_tx_late_collision,
SIENA_STAT_tx_excessive_deferred,
SIENA_STAT_tx_non_tcpudp,
SIENA_STAT_tx_mac_src_error,
SIENA_STAT_tx_ip_src_error,
SIENA_STAT_rx_bytes,
SIENA_STAT_rx_good_bytes,
SIENA_STAT_rx_bad_bytes,
SIENA_STAT_rx_packets,
SIENA_STAT_rx_good,
SIENA_STAT_rx_bad,
SIENA_STAT_rx_pause,
SIENA_STAT_rx_control,
SIENA_STAT_rx_unicast,
SIENA_STAT_rx_multicast,
SIENA_STAT_rx_broadcast,
SIENA_STAT_rx_lt64,
SIENA_STAT_rx_64,
SIENA_STAT_rx_65_to_127,
SIENA_STAT_rx_128_to_255,
SIENA_STAT_rx_256_to_511,
SIENA_STAT_rx_512_to_1023,
SIENA_STAT_rx_1024_to_15xx,
SIENA_STAT_rx_15xx_to_jumbo,
SIENA_STAT_rx_gtjumbo,
SIENA_STAT_rx_bad_gtjumbo,
SIENA_STAT_rx_overflow,
SIENA_STAT_rx_false_carrier,
SIENA_STAT_rx_symbol_error,
SIENA_STAT_rx_align_error,
SIENA_STAT_rx_length_error,
SIENA_STAT_rx_internal_error,
SIENA_STAT_rx_nodesc_drop_cnt,
SIENA_STAT_COUNT
};
/** /**
* struct siena_nic_data - Siena NIC state * struct siena_nic_data - Siena NIC state
* @wol_filter_id: Wake-on-LAN packet filter id * @wol_filter_id: Wake-on-LAN packet filter id
* @stats: Hardware statistics
*/ */
struct siena_nic_data { struct siena_nic_data {
int wol_filter_id; int wol_filter_id;
u64 stats[SIENA_STAT_COUNT];
}; };
/* /*
...@@ -507,6 +649,14 @@ extern int efx_farch_test_registers(struct efx_nic *efx, ...@@ -507,6 +649,14 @@ extern int efx_farch_test_registers(struct efx_nic *efx,
extern size_t efx_nic_get_regs_len(struct efx_nic *efx); extern size_t efx_nic_get_regs_len(struct efx_nic *efx);
extern void efx_nic_get_regs(struct efx_nic *efx, void *buf); extern void efx_nic_get_regs(struct efx_nic *efx, void *buf);
extern size_t
efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, u8 *names);
extern void
efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask,
u64 *stats, const void *dma_buf, bool accumulate);
#define EFX_MAX_FLUSH_TIME 5000 #define EFX_MAX_FLUSH_TIME 5000
extern void efx_farch_generate_event(struct efx_nic *efx, unsigned int evq, extern void efx_farch_generate_event(struct efx_nic *efx, unsigned int evq,
......
...@@ -313,6 +313,7 @@ static int efx_ptp_enable(struct efx_nic *efx) ...@@ -313,6 +313,7 @@ static int efx_ptp_enable(struct efx_nic *efx)
MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ENABLE_LEN); MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ENABLE_LEN);
MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ENABLE); MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ENABLE);
MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0);
MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_QUEUE, MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_QUEUE,
efx->ptp_data->channel->channel); efx->ptp_data->channel->channel);
MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_MODE, efx->ptp_data->mode); MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_MODE, efx->ptp_data->mode);
...@@ -331,6 +332,7 @@ static int efx_ptp_disable(struct efx_nic *efx) ...@@ -331,6 +332,7 @@ static int efx_ptp_disable(struct efx_nic *efx)
MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_DISABLE_LEN); MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_DISABLE_LEN);
MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_DISABLE); MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_DISABLE);
MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0);
return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf),
NULL, 0, NULL); NULL, 0, NULL);
} }
...@@ -388,8 +390,7 @@ static void efx_ptp_send_times(struct efx_nic *efx, ...@@ -388,8 +390,7 @@ static void efx_ptp_send_times(struct efx_nic *efx,
host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS | host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS |
now.ts_real.tv_nsec); now.ts_real.tv_nsec);
/* Update host time in NIC memory */ /* Update host time in NIC memory */
_efx_writed(efx, cpu_to_le32(host_time), efx->type->ptp_write_host_time(efx, host_time);
FR_CZ_MC_TREG_SMEM + MC_SMEM_P0_PTP_TIME_OFST);
} }
*last_time = now; *last_time = now;
} }
...@@ -531,6 +532,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings) ...@@ -531,6 +532,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
int *start = ptp->start.addr; int *start = ptp->start.addr;
MCDI_SET_DWORD(synch_buf, PTP_IN_OP, MC_CMD_PTP_OP_SYNCHRONIZE); MCDI_SET_DWORD(synch_buf, PTP_IN_OP, MC_CMD_PTP_OP_SYNCHRONIZE);
MCDI_SET_DWORD(synch_buf, PTP_IN_PERIPH_ID, 0);
MCDI_SET_DWORD(synch_buf, PTP_IN_SYNCHRONIZE_NUMTIMESETS, MCDI_SET_DWORD(synch_buf, PTP_IN_SYNCHRONIZE_NUMTIMESETS,
num_readings); num_readings);
MCDI_SET_QWORD(synch_buf, PTP_IN_SYNCHRONIZE_START_ADDR, MCDI_SET_QWORD(synch_buf, PTP_IN_SYNCHRONIZE_START_ADDR,
...@@ -574,6 +576,7 @@ static int efx_ptp_xmit_skb(struct efx_nic *efx, struct sk_buff *skb) ...@@ -574,6 +576,7 @@ static int efx_ptp_xmit_skb(struct efx_nic *efx, struct sk_buff *skb)
size_t len; size_t len;
MCDI_SET_DWORD(ptp_data->txbuf, PTP_IN_OP, MC_CMD_PTP_OP_TRANSMIT); MCDI_SET_DWORD(ptp_data->txbuf, PTP_IN_OP, MC_CMD_PTP_OP_TRANSMIT);
MCDI_SET_DWORD(ptp_data->txbuf, PTP_IN_PERIPH_ID, 0);
MCDI_SET_DWORD(ptp_data->txbuf, PTP_IN_TRANSMIT_LENGTH, skb->len); MCDI_SET_DWORD(ptp_data->txbuf, PTP_IN_TRANSMIT_LENGTH, skb->len);
if (skb_shinfo(skb)->nr_frags != 0) { if (skb_shinfo(skb)->nr_frags != 0) {
rc = skb_linearize(skb); rc = skb_linearize(skb);
...@@ -1377,6 +1380,7 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) ...@@ -1377,6 +1380,7 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta)
(PPB_EXTRA_BITS + MAX_PPB_BITS)); (PPB_EXTRA_BITS + MAX_PPB_BITS));
MCDI_SET_DWORD(inadj, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); MCDI_SET_DWORD(inadj, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST);
MCDI_SET_DWORD(inadj, PTP_IN_PERIPH_ID, 0);
MCDI_SET_QWORD(inadj, PTP_IN_ADJUST_FREQ, adjustment_ns); MCDI_SET_QWORD(inadj, PTP_IN_ADJUST_FREQ, adjustment_ns);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_SECONDS, 0); MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_SECONDS, 0);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_NANOSECONDS, 0); MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_NANOSECONDS, 0);
...@@ -1399,6 +1403,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) ...@@ -1399,6 +1403,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ADJUST_LEN); MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ADJUST_LEN);
MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST);
MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0);
MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, 0); MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, 0);
MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec);
MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec);
...@@ -1417,6 +1422,7 @@ static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts) ...@@ -1417,6 +1422,7 @@ static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
int rc; int rc;
MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_READ_NIC_TIME); MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_READ_NIC_TIME);
MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0);
rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf),
outbuf, sizeof(outbuf), NULL); outbuf, sizeof(outbuf), NULL);
......
...@@ -61,13 +61,12 @@ static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf) ...@@ -61,13 +61,12 @@ static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf)
return page_address(buf->page) + buf->page_offset; return page_address(buf->page) + buf->page_offset;
} }
static inline u32 efx_rx_buf_hash(const u8 *eh) static inline u32 efx_rx_buf_hash(struct efx_nic *efx, const u8 *eh)
{ {
/* The ethernet header is always directly after any hash. */ #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) || NET_IP_ALIGN % 4 == 0 return __le32_to_cpup((const __le32 *)(eh + efx->rx_packet_hash_offset));
return __le32_to_cpup((const __le32 *)(eh - 4));
#else #else
const u8 *data = eh - 4; const u8 *data = eh + efx->rx_packet_hash_offset;
return (u32)data[0] | return (u32)data[0] |
(u32)data[1] << 8 | (u32)data[1] << 8 |
(u32)data[2] << 16 | (u32)data[2] << 16 |
...@@ -439,7 +438,7 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, ...@@ -439,7 +438,7 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
} }
if (efx->net_dev->features & NETIF_F_RXHASH) if (efx->net_dev->features & NETIF_F_RXHASH)
skb->rxhash = efx_rx_buf_hash(eh); skb->rxhash = efx_rx_buf_hash(efx, eh);
skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ? skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ?
CHECKSUM_UNNECESSARY : CHECKSUM_NONE); CHECKSUM_UNNECESSARY : CHECKSUM_NONE);
...@@ -527,6 +526,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, ...@@ -527,6 +526,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
/* Validate the number of fragments and completed length */ /* Validate the number of fragments and completed length */
if (n_frags == 1) { if (n_frags == 1) {
if (!(flags & EFX_RX_PKT_PREFIX_LEN))
efx_rx_packet__check_len(rx_queue, rx_buf, len); efx_rx_packet__check_len(rx_queue, rx_buf, len);
} else if (unlikely(n_frags > EFX_RX_MAX_FRAGS) || } else if (unlikely(n_frags > EFX_RX_MAX_FRAGS) ||
unlikely(len <= (n_frags - 1) * EFX_RX_USR_BUF_SIZE) || unlikely(len <= (n_frags - 1) * EFX_RX_USR_BUF_SIZE) ||
...@@ -555,7 +555,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, ...@@ -555,7 +555,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
return; return;
} }
if (n_frags == 1) if (n_frags == 1 && !(flags & EFX_RX_PKT_PREFIX_LEN))
rx_buf->len = len; rx_buf->len = len;
/* Release and/or sync the DMA mapping - assumes all RX buffers /* Release and/or sync the DMA mapping - assumes all RX buffers
...@@ -568,8 +568,8 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, ...@@ -568,8 +568,8 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
*/ */
prefetch(efx_rx_buf_va(rx_buf)); prefetch(efx_rx_buf_va(rx_buf));
rx_buf->page_offset += efx->type->rx_buffer_hash_size; rx_buf->page_offset += efx->rx_prefix_size;
rx_buf->len -= efx->type->rx_buffer_hash_size; rx_buf->len -= efx->rx_prefix_size;
if (n_frags > 1) { if (n_frags > 1) {
/* Release/sync DMA mapping for additional fragments. /* Release/sync DMA mapping for additional fragments.
...@@ -634,6 +634,13 @@ void __efx_rx_packet(struct efx_channel *channel) ...@@ -634,6 +634,13 @@ void __efx_rx_packet(struct efx_channel *channel)
efx_rx_buffer(&channel->rx_queue, channel->rx_pkt_index); efx_rx_buffer(&channel->rx_queue, channel->rx_pkt_index);
u8 *eh = efx_rx_buf_va(rx_buf); u8 *eh = efx_rx_buf_va(rx_buf);
/* Read length from the prefix if necessary. This already
* excludes the length of the prefix itself.
*/
if (rx_buf->flags & EFX_RX_PKT_PREFIX_LEN)
rx_buf->len = le16_to_cpup((__le16 *)
(eh + efx->rx_packet_len_offset));
/* If we're in loopback test, then pass the packet directly to the /* If we're in loopback test, then pass the packet directly to the
* loopback layer, and free the rx_buf here * loopback layer, and free the rx_buf here
*/ */
......
This diff is collapsed.
/****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards
* Copyright 2005 Fen Systems Ltd.
* Copyright 2006-2010 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_SPI_H
#define EFX_SPI_H
#include "net_driver.h"
/**************************************************************************
*
* Basic SPI command set and bit definitions
*
*************************************************************************/
#define SPI_WRSR 0x01 /* Write status register */
#define SPI_WRITE 0x02 /* Write data to memory array */
#define SPI_READ 0x03 /* Read data from memory array */
#define SPI_WRDI 0x04 /* Reset write enable latch */
#define SPI_RDSR 0x05 /* Read status register */
#define SPI_WREN 0x06 /* Set write enable latch */
#define SPI_SST_EWSR 0x50 /* SST: Enable write to status register */
#define SPI_STATUS_WPEN 0x80 /* Write-protect pin enabled */
#define SPI_STATUS_BP2 0x10 /* Block protection bit 2 */
#define SPI_STATUS_BP1 0x08 /* Block protection bit 1 */
#define SPI_STATUS_BP0 0x04 /* Block protection bit 0 */
#define SPI_STATUS_WEN 0x02 /* State of the write enable latch */
#define SPI_STATUS_NRDY 0x01 /* Device busy flag */
/**
* struct falcon_spi_device - a Falcon SPI (Serial Peripheral Interface) device
* @device_id: Controller's id for the device
* @size: Size (in bytes)
* @addr_len: Number of address bytes in read/write commands
* @munge_address: Flag whether addresses should be munged.
* Some devices with 9-bit addresses (e.g. AT25040A EEPROM)
* use bit 3 of the command byte as address bit A8, rather
* than having a two-byte address. If this flag is set, then
* commands should be munged in this way.
* @erase_command: Erase command (or 0 if sector erase not needed).
* @erase_size: Erase sector size (in bytes)
* Erase commands affect sectors with this size and alignment.
* This must be a power of two.
* @block_size: Write block size (in bytes).
* Write commands are limited to blocks with this size and alignment.
*/
struct falcon_spi_device {
int device_id;
unsigned int size;
unsigned int addr_len;
unsigned int munge_address:1;
u8 erase_command;
unsigned int erase_size;
unsigned int block_size;
};
static inline bool falcon_spi_present(const struct falcon_spi_device *spi)
{
return spi->size != 0;
}
int falcon_spi_cmd(struct efx_nic *efx,
const struct falcon_spi_device *spi, unsigned int command,
int address, const void *in, void *out, size_t len);
int falcon_spi_wait_write(struct efx_nic *efx,
const struct falcon_spi_device *spi);
int falcon_spi_read(struct efx_nic *efx,
const struct falcon_spi_device *spi, loff_t start,
size_t len, size_t *retlen, u8 *buffer);
int falcon_spi_write(struct efx_nic *efx,
const struct falcon_spi_device *spi, loff_t start,
size_t len, size_t *retlen, const u8 *buffer);
/*
* SFC4000 flash is partitioned into:
* 0-0x400 chip and board config (see falcon_hwdefs.h)
* 0x400-0x8000 unused (or may contain VPD if EEPROM not present)
* 0x8000-end boot code (mapped to PCI expansion ROM)
* SFC4000 small EEPROM (size < 0x400) is used for VPD only.
* SFC4000 large EEPROM (size >= 0x400) is partitioned into:
* 0-0x400 chip and board config
* configurable VPD
* 0x800-0x1800 boot config
* Aside from the chip and board config, all of these are optional and may
* be absent or truncated depending on the devices used.
*/
#define FALCON_NVCONFIG_END 0x400U
#define FALCON_FLASH_BOOTCODE_START 0x8000U
#define FALCON_EEPROM_BOOTCONFIG_START 0x800U
#define FALCON_EEPROM_BOOTCONFIG_END 0x1800U
#endif /* EFX_SPI_H */
...@@ -437,6 +437,9 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) ...@@ -437,6 +437,9 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl); efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
netdev_tx_completed_queue(tx_queue->core_txq, pkts_compl, bytes_compl); netdev_tx_completed_queue(tx_queue->core_txq, pkts_compl, bytes_compl);
if (pkts_compl > 1)
++tx_queue->merge_events;
/* See if we need to restart the netif queue. This memory /* See if we need to restart the netif queue. This memory
* barrier ensures that we write read_count (inside * barrier ensures that we write read_count (inside
* efx_dequeue_buffers()) before reading the queue status. * efx_dequeue_buffers()) before reading the queue status.
......
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