Commit ae5dbf1a 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. A little more refactoring.
2. Remove the unnecessary use of atomic_t that you pointed out.
3. Add support for starting or queueing firmware requests from atomic
context.
4. Add hwmon support for additional sensors found on some new boards.
5. Add support for the EF10 controller architecture, the SFC9100 family
and specifically the SFC9120 controller.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 34aedd3f f7a6d2c4
config SFC config SFC
tristate "Solarflare SFC4000/SFC9000-family support" tristate "Solarflare SFC4000/SFC9000/SFC9100-family support"
depends on PCI depends on PCI
select MDIO select MDIO
select CRC32 select CRC32
...@@ -8,12 +8,13 @@ config SFC ...@@ -8,12 +8,13 @@ config SFC
select PTP_1588_CLOCK select PTP_1588_CLOCK
---help--- ---help---
This driver supports 10-gigabit Ethernet cards based on This driver supports 10-gigabit Ethernet cards based on
the Solarflare SFC4000 and SFC9000-family controllers. the Solarflare SFC4000, SFC9000-family and SFC9100-family
controllers.
To compile this driver as a module, choose M here. The module To compile this driver as a module, choose M here. The module
will be called sfc. will be called sfc.
config SFC_MTD config SFC_MTD
bool "Solarflare SFC4000/SFC9000-family MTD support" bool "Solarflare SFC4000/SFC9000/SFC9100-family MTD support"
depends on SFC && MTD && !(SFC=y && MTD=m) depends on SFC && MTD && !(SFC=y && MTD=m)
default y default y
---help--- ---help---
...@@ -21,7 +22,7 @@ config SFC_MTD ...@@ -21,7 +22,7 @@ config SFC_MTD
(e.g. /dev/mtd1). This is required to update the firmware or (e.g. /dev/mtd1). This is required to update the firmware or
the boot configuration under Linux. the boot configuration under Linux.
config SFC_MCDI_MON config SFC_MCDI_MON
bool "Solarflare SFC9000-family hwmon support" bool "Solarflare SFC9000/SFC9100-family hwmon support"
depends on SFC && HWMON && !(SFC=y && HWMON=m) depends on SFC && HWMON && !(SFC=y && HWMON=m)
default y default y
---help--- ---help---
......
sfc-y += efx.o nic.o farch.o falcon.o siena.o tx.o rx.o \ sfc-y += efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
selftest.o ethtool.o qt202x_phy.o mdio_10g.o \ rx.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_port.o mcdi_mon.o ptp.o mcdi.o mcdi_port.o mcdi_mon.o ptp.o
sfc-$(CONFIG_SFC_MTD) += mtd.o sfc-$(CONFIG_SFC_MTD) += mtd.o
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2009 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
/* Lowest bit numbers and widths */ /* Lowest bit numbers and widths */
#define EFX_DUMMY_FIELD_LBN 0 #define EFX_DUMMY_FIELD_LBN 0
#define EFX_DUMMY_FIELD_WIDTH 0 #define EFX_DUMMY_FIELD_WIDTH 0
#define EFX_WORD_0_LBN 0
#define EFX_WORD_0_WIDTH 16
#define EFX_WORD_1_LBN 16
#define EFX_WORD_1_WIDTH 16
#define EFX_DWORD_0_LBN 0 #define EFX_DWORD_0_LBN 0
#define EFX_DWORD_0_WIDTH 32 #define EFX_DWORD_0_WIDTH 32
#define EFX_DWORD_1_LBN 32 #define EFX_DWORD_1_LBN 32
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -79,13 +79,20 @@ extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); ...@@ -79,13 +79,20 @@ extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
* On success, return the filter ID. * On success, return the filter ID.
* On failure, return a negative error code. * On failure, return a negative error code.
* *
* If an existing filter has equal match values to the new filter * If existing filters have equal match values to the new filter spec,
* spec, then the new filter might replace it, depending on the * then the new filter might replace them or the function might fail,
* relative priorities. If the existing filter has lower priority, or * as follows.
* if @replace_equal is set and it has equal priority, then it is *
* replaced. Otherwise the function fails, returning -%EPERM if * 1. If the existing filters have lower priority, or @replace_equal
* the existing filter has higher priority or -%EEXIST if it has * is set and they have equal priority, replace them.
* equal priority. *
* 2. If the existing filters have higher priority, return -%EPERM.
*
* 3. If !efx_filter_is_mc_recipient(@spec), or the NIC does not
* support delivery to multiple recipients, return -%EEXIST.
*
* This implies that filters for multiple multicast recipients must
* all be inserted with the same priority and @replace_equal = %false.
*/ */
static inline s32 efx_filter_insert_filter(struct efx_nic *efx, static inline s32 efx_filter_insert_filter(struct efx_nic *efx,
struct efx_filter_spec *spec, struct efx_filter_spec *spec,
...@@ -169,6 +176,7 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel) ...@@ -169,6 +176,7 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel)
static inline void efx_filter_rfs_expire(struct efx_channel *channel) {} static inline void efx_filter_rfs_expire(struct efx_channel *channel) {}
#define efx_filter_rfs_enabled() 0 #define efx_filter_rfs_enabled() 0
#endif #endif
extern bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec);
/* Channels */ /* Channels */
extern int efx_channel_dummy_op_int(struct efx_channel *channel); extern int efx_channel_dummy_op_int(struct efx_channel *channel);
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2007-2009 Solarflare Communications Inc. * Copyright 2007-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -77,6 +77,8 @@ static const struct efx_sw_stat_desc efx_sw_stat_desc[] = { ...@@ -77,6 +77,8 @@ static const struct efx_sw_stat_desc efx_sw_stat_desc[] = {
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_nodesc_trunc), EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_nodesc_trunc),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_events),
EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_packets),
}; };
#define EFX_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(efx_sw_stat_desc) #define EFX_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(efx_sw_stat_desc)
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -2174,10 +2174,11 @@ static int falcon_probe_nvconfig(struct efx_nic *efx) ...@@ -2174,10 +2174,11 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
return rc; return rc;
} }
static void falcon_dimension_resources(struct efx_nic *efx) static int falcon_dimension_resources(struct efx_nic *efx)
{ {
efx->rx_dc_base = 0x20000; efx->rx_dc_base = 0x20000;
efx->tx_dc_base = 0x26000; efx->tx_dc_base = 0x26000;
return 0;
} }
/* Probe all SPI devices on the NIC */ /* Probe all SPI devices on the NIC */
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2007-2010 Solarflare Communications Inc. * Copyright 2007-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2011 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -325,6 +325,8 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue) ...@@ -325,6 +325,8 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)
txd = efx_tx_desc(tx_queue, write_ptr); txd = efx_tx_desc(tx_queue, write_ptr);
++tx_queue->write_count; ++tx_queue->write_count;
EFX_BUG_ON_PARANOID(buffer->flags & EFX_TX_BUF_OPTION);
/* Create TX descriptor ring entry */ /* Create TX descriptor ring entry */
BUILD_BUG_ON(EFX_TX_BUF_CONT != 1); BUILD_BUG_ON(EFX_TX_BUF_CONT != 1);
EFX_POPULATE_QWORD_4(*txd, EFX_POPULATE_QWORD_4(*txd,
...@@ -594,7 +596,7 @@ static bool efx_farch_flush_wake(struct efx_nic *efx) ...@@ -594,7 +596,7 @@ static bool efx_farch_flush_wake(struct efx_nic *efx)
/* Ensure that all updates are visible to efx_farch_flush_queues() */ /* Ensure that all updates are visible to efx_farch_flush_queues() */
smp_mb(); smp_mb();
return (atomic_read(&efx->drain_pending) == 0 || return (atomic_read(&efx->active_queues) == 0 ||
(atomic_read(&efx->rxq_flush_outstanding) < EFX_RX_FLUSH_COUNT (atomic_read(&efx->rxq_flush_outstanding) < EFX_RX_FLUSH_COUNT
&& atomic_read(&efx->rxq_flush_pending) > 0)); && atomic_read(&efx->rxq_flush_pending) > 0));
} }
...@@ -626,7 +628,7 @@ static bool efx_check_tx_flush_complete(struct efx_nic *efx) ...@@ -626,7 +628,7 @@ static bool efx_check_tx_flush_complete(struct efx_nic *efx)
netif_dbg(efx, hw, efx->net_dev, netif_dbg(efx, hw, efx->net_dev,
"flush complete on TXQ %d, so drain " "flush complete on TXQ %d, so drain "
"the queue\n", tx_queue->queue); "the queue\n", tx_queue->queue);
/* Don't need to increment drain_pending as it /* Don't need to increment active_queues as it
* has already been incremented for the queues * has already been incremented for the queues
* which did not drain * which did not drain
*/ */
...@@ -653,17 +655,15 @@ static int efx_farch_do_flush(struct efx_nic *efx) ...@@ -653,17 +655,15 @@ static int efx_farch_do_flush(struct efx_nic *efx)
efx_for_each_channel(channel, efx) { efx_for_each_channel(channel, efx) {
efx_for_each_channel_tx_queue(tx_queue, channel) { efx_for_each_channel_tx_queue(tx_queue, channel) {
atomic_inc(&efx->drain_pending);
efx_farch_flush_tx_queue(tx_queue); efx_farch_flush_tx_queue(tx_queue);
} }
efx_for_each_channel_rx_queue(rx_queue, channel) { efx_for_each_channel_rx_queue(rx_queue, channel) {
atomic_inc(&efx->drain_pending);
rx_queue->flush_pending = true; rx_queue->flush_pending = true;
atomic_inc(&efx->rxq_flush_pending); atomic_inc(&efx->rxq_flush_pending);
} }
} }
while (timeout && atomic_read(&efx->drain_pending) > 0) { while (timeout && atomic_read(&efx->active_queues) > 0) {
/* If SRIOV is enabled, then offload receive queue flushing to /* If SRIOV is enabled, then offload receive queue flushing to
* the firmware (though we will still have to poll for * the firmware (though we will still have to poll for
* completion). If that fails, fall back to the old scheme. * completion). If that fails, fall back to the old scheme.
...@@ -699,15 +699,15 @@ static int efx_farch_do_flush(struct efx_nic *efx) ...@@ -699,15 +699,15 @@ static int efx_farch_do_flush(struct efx_nic *efx)
timeout); timeout);
} }
if (atomic_read(&efx->drain_pending) && if (atomic_read(&efx->active_queues) &&
!efx_check_tx_flush_complete(efx)) { !efx_check_tx_flush_complete(efx)) {
netif_err(efx, hw, efx->net_dev, "failed to flush %d queues " netif_err(efx, hw, efx->net_dev, "failed to flush %d queues "
"(rx %d+%d)\n", atomic_read(&efx->drain_pending), "(rx %d+%d)\n", atomic_read(&efx->active_queues),
atomic_read(&efx->rxq_flush_outstanding), atomic_read(&efx->rxq_flush_outstanding),
atomic_read(&efx->rxq_flush_pending)); atomic_read(&efx->rxq_flush_pending));
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
atomic_set(&efx->drain_pending, 0); atomic_set(&efx->active_queues, 0);
atomic_set(&efx->rxq_flush_pending, 0); atomic_set(&efx->rxq_flush_pending, 0);
atomic_set(&efx->rxq_flush_outstanding, 0); atomic_set(&efx->rxq_flush_outstanding, 0);
} }
...@@ -1123,8 +1123,8 @@ efx_farch_handle_drain_event(struct efx_channel *channel) ...@@ -1123,8 +1123,8 @@ efx_farch_handle_drain_event(struct efx_channel *channel)
{ {
struct efx_nic *efx = channel->efx; struct efx_nic *efx = channel->efx;
WARN_ON(atomic_read(&efx->drain_pending) == 0); WARN_ON(atomic_read(&efx->active_queues) == 0);
atomic_dec(&efx->drain_pending); atomic_dec(&efx->active_queues);
if (efx_farch_flush_wake(efx)) if (efx_farch_flush_wake(efx))
wake_up(&efx->flush_wq); wake_up(&efx->flush_wq);
} }
...@@ -1325,7 +1325,7 @@ int efx_farch_ev_probe(struct efx_channel *channel) ...@@ -1325,7 +1325,7 @@ int efx_farch_ev_probe(struct efx_channel *channel)
entries * sizeof(efx_qword_t)); entries * sizeof(efx_qword_t));
} }
void efx_farch_ev_init(struct efx_channel *channel) int efx_farch_ev_init(struct efx_channel *channel)
{ {
efx_oword_t reg; efx_oword_t reg;
struct efx_nic *efx = channel->efx; struct efx_nic *efx = channel->efx;
...@@ -1357,7 +1357,7 @@ void efx_farch_ev_init(struct efx_channel *channel) ...@@ -1357,7 +1357,7 @@ void efx_farch_ev_init(struct efx_channel *channel)
efx_writeo_table(efx, &reg, efx->type->evq_ptr_tbl_base, efx_writeo_table(efx, &reg, efx->type->evq_ptr_tbl_base,
channel->channel); channel->channel);
efx->type->push_irq_moderation(channel); return 0;
} }
void efx_farch_ev_fini(struct efx_channel *channel) void efx_farch_ev_fini(struct efx_channel *channel)
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2010 Solarflare Communications Inc. * Copyright 2005-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
************************************************************************** **************************************************************************
* *
* Notes on locking strategy: * Notes on locking strategy for the Falcon architecture:
* *
* Many CSRs are very wide and cannot be read or written atomically. * Many CSRs are very wide and cannot be read or written atomically.
* Writes from the host are buffered by the Bus Interface Unit (BIU) * Writes from the host are buffered by the Bus Interface Unit (BIU)
...@@ -54,6 +54,12 @@ ...@@ -54,6 +54,12 @@
* register while the collector already holds values for some other * register while the collector already holds values for some other
* register, the write is discarded and the collector maintains its * register, the write is discarded and the collector maintains its
* current state. * current state.
*
* The EF10 architecture exposes very few registers to the host and
* most of them are only 32 bits wide. The only exceptions are the MC
* doorbell register pair, which has its own latching, and
* TX_DESC_UPD, which works in a similar way to the Falcon
* architecture.
*/ */
#if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64
...@@ -237,8 +243,8 @@ static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value, ...@@ -237,8 +243,8 @@ static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value,
BUILD_BUG_ON_ZERO((reg) != 0x830 && (reg) != 0xa10), \ BUILD_BUG_ON_ZERO((reg) != 0x830 && (reg) != 0xa10), \
page) page)
/* Write a page-mapped 32-bit CSR (EVQ_RPTR or the high bits of /* Write a page-mapped 32-bit CSR (EVQ_RPTR, EVQ_TMR (EF10), or the
* RX_DESC_UPD or TX_DESC_UPD) * high bits of RX_DESC_UPD or TX_DESC_UPD)
*/ */
static inline void static inline void
_efx_writed_page(struct efx_nic *efx, const efx_dword_t *value, _efx_writed_page(struct efx_nic *efx, const efx_dword_t *value,
...@@ -249,8 +255,12 @@ _efx_writed_page(struct efx_nic *efx, const efx_dword_t *value, ...@@ -249,8 +255,12 @@ _efx_writed_page(struct efx_nic *efx, const efx_dword_t *value,
#define efx_writed_page(efx, value, reg, page) \ #define efx_writed_page(efx, value, reg, page) \
_efx_writed_page(efx, value, \ _efx_writed_page(efx, value, \
reg + \ reg + \
BUILD_BUG_ON_ZERO((reg) != 0x400 && (reg) != 0x83c \ BUILD_BUG_ON_ZERO((reg) != 0x400 && \
&& (reg) != 0xa1c), \ (reg) != 0x420 && \
(reg) != 0x830 && \
(reg) != 0x83c && \
(reg) != 0xa18 && \
(reg) != 0xa1c), \
page) page)
/* Write TIMER_COMMAND. This is a page-mapped 32-bit CSR, but a bug /* Write TIMER_COMMAND. This is a page-mapped 32-bit CSR, but a bug
......
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2008-2010 Solarflare Communications Inc. * Copyright 2008-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -14,15 +14,17 @@ ...@@ -14,15 +14,17 @@
* enum efx_mcdi_state - MCDI request handling state * enum efx_mcdi_state - MCDI request handling state
* @MCDI_STATE_QUIESCENT: No pending MCDI requests. If the caller holds the * @MCDI_STATE_QUIESCENT: No pending MCDI requests. If the caller holds the
* mcdi @iface_lock then they are able to move to %MCDI_STATE_RUNNING * mcdi @iface_lock then they are able to move to %MCDI_STATE_RUNNING
* @MCDI_STATE_RUNNING: There is an MCDI request pending. Only the thread that * @MCDI_STATE_RUNNING_SYNC: There is a synchronous MCDI request pending.
* moved into this state is allowed to move out of it. * Only the thread that moved into this state is allowed to move out of it.
* @MCDI_STATE_RUNNING_ASYNC: There is an asynchronous MCDI request pending.
* @MCDI_STATE_COMPLETED: An MCDI request has completed, but the owning thread * @MCDI_STATE_COMPLETED: An MCDI request has completed, but the owning thread
* has not yet consumed the result. For all other threads, equivalent to * has not yet consumed the result. For all other threads, equivalent to
* %MCDI_STATE_RUNNING. * %MCDI_STATE_RUNNING.
*/ */
enum efx_mcdi_state { enum efx_mcdi_state {
MCDI_STATE_QUIESCENT, MCDI_STATE_QUIESCENT,
MCDI_STATE_RUNNING, MCDI_STATE_RUNNING_SYNC,
MCDI_STATE_RUNNING_ASYNC,
MCDI_STATE_COMPLETED, MCDI_STATE_COMPLETED,
}; };
...@@ -33,20 +35,26 @@ enum efx_mcdi_mode { ...@@ -33,20 +35,26 @@ enum efx_mcdi_mode {
/** /**
* struct efx_mcdi_iface - MCDI protocol context * struct efx_mcdi_iface - MCDI protocol context
* @efx: The associated NIC.
* @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 * @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 @seqno, @credits and response metadata
* @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
* trigger a fatal error * trigger a fatal error
* @resprc: Response error/success code (Linux numbering) * @resprc: Response error/success code (Linux numbering)
* @resp_hdr_len: Response header length * @resp_hdr_len: Response header length
* @resp_data_len: Response data (SDU or error) length * @resp_data_len: Response data (SDU or error) length
* @async_lock: Serialises access to @async_list while event processing is
* enabled
* @async_list: Queue of asynchronous requests
* @async_timer: Timer for asynchronous request timeout
*/ */
struct efx_mcdi_iface { struct efx_mcdi_iface {
atomic_t state; struct efx_nic *efx;
enum efx_mcdi_state state;
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;
...@@ -56,6 +64,9 @@ struct efx_mcdi_iface { ...@@ -56,6 +64,9 @@ struct efx_mcdi_iface {
int resprc; int resprc;
size_t resp_hdr_len; size_t resp_hdr_len;
size_t resp_data_len; size_t resp_data_len;
spinlock_t async_lock;
struct list_head async_list;
struct timer_list async_timer;
}; };
struct efx_mcdi_mon { struct efx_mcdi_mon {
...@@ -70,7 +81,7 @@ struct efx_mcdi_mon { ...@@ -70,7 +81,7 @@ struct efx_mcdi_mon {
struct efx_mcdi_mtd_partition { struct efx_mcdi_mtd_partition {
struct efx_mtd_partition common; struct efx_mtd_partition common;
bool updating; bool updating;
u8 nvram_type; u16 nvram_type;
u16 fw_subtype; u16 fw_subtype;
}; };
...@@ -111,10 +122,20 @@ extern int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, ...@@ -111,10 +122,20 @@ extern int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
efx_dword_t *outbuf, size_t outlen, efx_dword_t *outbuf, size_t outlen,
size_t *outlen_actual); size_t *outlen_actual);
typedef void efx_mcdi_async_completer(struct efx_nic *efx,
unsigned long cookie, int rc,
efx_dword_t *outbuf,
size_t outlen_actual);
extern int efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
const efx_dword_t *inbuf, size_t inlen,
size_t outlen,
efx_mcdi_async_completer *complete,
unsigned long cookie);
extern int efx_mcdi_poll_reboot(struct efx_nic *efx); extern int efx_mcdi_poll_reboot(struct efx_nic *efx);
extern void efx_mcdi_mode_poll(struct efx_nic *efx); extern void efx_mcdi_mode_poll(struct efx_nic *efx);
extern void efx_mcdi_mode_event(struct efx_nic *efx); extern void efx_mcdi_mode_event(struct efx_nic *efx);
extern void efx_mcdi_flush_async(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);
...@@ -136,6 +157,9 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); ...@@ -136,6 +157,9 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
#define _MCDI_DWORD(_buf, _field) \ #define _MCDI_DWORD(_buf, _field) \
((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2)) ((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2))
#define MCDI_WORD(_buf, _field) \
((u16)BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 2) + \
le16_to_cpu(*(__force const __le16 *)MCDI_PTR(_buf, _field)))
#define MCDI_SET_DWORD(_buf, _field, _value) \ #define MCDI_SET_DWORD(_buf, _field, _value) \
EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0, _value) EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0, _value)
#define MCDI_DWORD(_buf, _field) \ #define MCDI_DWORD(_buf, _field) \
...@@ -252,8 +276,6 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); ...@@ -252,8 +276,6 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
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,
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, u32 *capabilities); 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,
...@@ -274,6 +296,8 @@ extern int efx_mcdi_flush_rxqs(struct efx_nic *efx); ...@@ -274,6 +296,8 @@ extern int efx_mcdi_flush_rxqs(struct efx_nic *efx);
extern int efx_mcdi_port_probe(struct efx_nic *efx); extern int efx_mcdi_port_probe(struct efx_nic *efx);
extern void efx_mcdi_port_remove(struct efx_nic *efx); extern void efx_mcdi_port_remove(struct efx_nic *efx);
extern int efx_mcdi_port_reconfigure(struct efx_nic *efx); extern int efx_mcdi_port_reconfigure(struct efx_nic *efx);
extern int efx_mcdi_port_get_number(struct efx_nic *efx);
extern u32 efx_mcdi_phy_get_caps(struct efx_nic *efx);
extern void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); extern void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev);
extern int efx_mcdi_set_mac(struct efx_nic *efx); extern int efx_mcdi_set_mac(struct efx_nic *efx);
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1)) #define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
...@@ -282,6 +306,7 @@ extern void efx_mcdi_mac_stop_stats(struct efx_nic *efx); ...@@ -282,6 +306,7 @@ extern void efx_mcdi_mac_stop_stats(struct efx_nic *efx);
extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx); extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx);
extern enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason); extern enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason);
extern int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method); extern int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method);
extern int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled);
#ifdef CONFIG_SFC_MCDI_MON #ifdef CONFIG_SFC_MCDI_MON
extern int efx_mcdi_mon_probe(struct efx_nic *efx); extern int efx_mcdi_mon_probe(struct efx_nic *efx);
......
This diff is collapsed.
...@@ -3799,6 +3799,10 @@ ...@@ -3799,6 +3799,10 @@
#define NVRAM_PARTITION_TYPE_DUMP 0x800 #define NVRAM_PARTITION_TYPE_DUMP 0x800
/* enum: Application license key storage partition */ /* enum: Application license key storage partition */
#define NVRAM_PARTITION_TYPE_LICENSE 0x900 #define NVRAM_PARTITION_TYPE_LICENSE 0x900
/* enum: Start of range used for PHY partitions (low 8 bits are the PHY ID) */
#define NVRAM_PARTITION_TYPE_PHY_MIN 0xa00
/* enum: End of range used for PHY partitions (low 8 bits are the PHY ID) */
#define NVRAM_PARTITION_TYPE_PHY_MAX 0xaff
/* enum: Start of reserved value range (firmware may use for any purpose) */ /* enum: Start of reserved value range (firmware may use for any purpose) */
#define NVRAM_PARTITION_TYPE_RESERVED_VALUES_MIN 0xff00 #define NVRAM_PARTITION_TYPE_RESERVED_VALUES_MIN 0xff00
/* enum: End of reserved value range (firmware may use for any purpose) */ /* enum: End of reserved value range (firmware may use for any purpose) */
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2009-2010 Solarflare Communications Inc. * Copyright 2009-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
...@@ -830,6 +830,13 @@ static const struct efx_phy_operations efx_mcdi_phy_ops = { ...@@ -830,6 +830,13 @@ static const struct efx_phy_operations efx_mcdi_phy_ops = {
.get_module_info = efx_mcdi_phy_get_module_info, .get_module_info = efx_mcdi_phy_get_module_info,
}; };
u32 efx_mcdi_phy_get_caps(struct efx_nic *efx)
{
struct efx_mcdi_phy_data *phy_data = efx->phy_data;
return phy_data->supported_cap;
}
static unsigned int efx_mcdi_event_link_speed[] = { static unsigned int efx_mcdi_event_link_speed[] = {
[MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100,
[MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000,
...@@ -1004,3 +1011,17 @@ void efx_mcdi_port_remove(struct efx_nic *efx) ...@@ -1004,3 +1011,17 @@ void efx_mcdi_port_remove(struct efx_nic *efx)
efx->phy_op->remove(efx); efx->phy_op->remove(efx);
efx_nic_free_buffer(efx, &efx->stats_buffer); efx_nic_free_buffer(efx, &efx->stats_buffer);
} }
/* Get physical port number (EF10 only; on Siena it is same as PF number) */
int efx_mcdi_port_get_number(struct efx_nic *efx)
{
MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN);
int rc;
rc = efx_mcdi_rpc(efx, MC_CMD_GET_PORT_ASSIGNMENT, NULL, 0,
outbuf, sizeof(outbuf), NULL);
if (rc)
return rc;
return MCDI_DWORD(outbuf, GET_PORT_ASSIGNMENT_OUT_PORT);
}
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2006-2011 Solarflare Communications Inc. * Copyright 2006-2011 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2006-2011 Solarflare Communications Inc. * Copyright 2006-2011 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2011 Solarflare Communications Inc. * Copyright 2006-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2007-2010 Solarflare Communications Inc. * Copyright 2007-2010 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2011 Solarflare Communications Inc. * Copyright 2011-2013 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2005-2006 Fen Systems Ltd. * Copyright 2005-2006 Fen Systems Ltd.
* Copyright 2006-2010 Solarflare Communications Inc. * Copyright 2006-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
This diff is collapsed.
/**************************************************************************** /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards * Driver for Solarflare network controllers and boards
* Copyright 2010-2011 Solarflare Communications Inc. * Copyright 2010-2012 Solarflare Communications Inc.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 as published
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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