Commit c8443b69 authored by Martin Habets's avatar Martin Habets Committed by Jakub Kicinski

sfc/siena: Rename functions in nic_common.h to avoid conflicts with sfc

For siena use efx_siena_ as the function prefix.
efx_nic_update_stats_atomic is only used in efx_common.c, so move
it there.
efx_nic_copy_stats is not used in Siena, so it is removed.
Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4d49e5cd
...@@ -830,7 +830,7 @@ static void efx_pci_remove_main(struct efx_nic *efx) ...@@ -830,7 +830,7 @@ static void efx_pci_remove_main(struct efx_nic *efx)
efx_siena_disable_interrupts(efx); efx_siena_disable_interrupts(efx);
efx_siena_clear_interrupt_affinity(efx); efx_siena_clear_interrupt_affinity(efx);
efx_nic_fini_interrupt(efx); efx_siena_fini_interrupt(efx);
efx_fini_port(efx); efx_fini_port(efx);
efx->type->fini(efx); efx->type->fini(efx);
efx_siena_fini_napi(efx); efx_siena_fini_napi(efx);
...@@ -939,7 +939,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) ...@@ -939,7 +939,7 @@ static int efx_pci_probe_main(struct efx_nic *efx)
goto fail4; goto fail4;
} }
rc = efx_nic_init_interrupt(efx); rc = efx_siena_init_interrupt(efx);
if (rc) if (rc)
goto fail5; goto fail5;
...@@ -952,7 +952,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) ...@@ -952,7 +952,7 @@ static int efx_pci_probe_main(struct efx_nic *efx)
fail6: fail6:
efx_siena_clear_interrupt_affinity(efx); efx_siena_clear_interrupt_affinity(efx);
efx_nic_fini_interrupt(efx); efx_siena_fini_interrupt(efx);
fail5: fail5:
efx_fini_port(efx); efx_fini_port(efx);
fail4: fail4:
......
...@@ -597,6 +597,14 @@ void efx_siena_stop_all(struct efx_nic *efx) ...@@ -597,6 +597,14 @@ void efx_siena_stop_all(struct efx_nic *efx)
efx_stop_datapath(efx); efx_stop_datapath(efx);
} }
static size_t efx_siena_update_stats_atomic(struct efx_nic *efx, u64 *full_stats,
struct rtnl_link_stats64 *core_stats)
{
if (efx->type->update_stats_atomic)
return efx->type->update_stats_atomic(efx, full_stats, core_stats);
return efx->type->update_stats(efx, full_stats, core_stats);
}
/* Context: process, dev_base_lock or RTNL held, non-blocking. */ /* Context: process, dev_base_lock or RTNL held, non-blocking. */
void efx_siena_net_stats(struct net_device *net_dev, void efx_siena_net_stats(struct net_device *net_dev,
struct rtnl_link_stats64 *stats) struct rtnl_link_stats64 *stats)
...@@ -604,7 +612,7 @@ void efx_siena_net_stats(struct net_device *net_dev, ...@@ -604,7 +612,7 @@ void efx_siena_net_stats(struct net_device *net_dev,
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
spin_lock_bh(&efx->stats_lock); spin_lock_bh(&efx->stats_lock);
efx_nic_update_stats_atomic(efx, NULL, stats); efx_siena_update_stats_atomic(efx, NULL, stats);
spin_unlock_bh(&efx->stats_lock); spin_unlock_bh(&efx->stats_lock);
} }
......
...@@ -55,7 +55,7 @@ static int efx_ethtool_phys_id(struct net_device *net_dev, ...@@ -55,7 +55,7 @@ static int efx_ethtool_phys_id(struct net_device *net_dev,
static int efx_ethtool_get_regs_len(struct net_device *net_dev) static int efx_ethtool_get_regs_len(struct net_device *net_dev)
{ {
return efx_nic_get_regs_len(netdev_priv(net_dev)); return efx_siena_get_regs_len(netdev_priv(net_dev));
} }
static void efx_ethtool_get_regs(struct net_device *net_dev, static void efx_ethtool_get_regs(struct net_device *net_dev,
...@@ -64,7 +64,7 @@ static void efx_ethtool_get_regs(struct net_device *net_dev, ...@@ -64,7 +64,7 @@ static void efx_ethtool_get_regs(struct net_device *net_dev,
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
regs->version = efx->type->revision; regs->version = efx->type->revision;
efx_nic_get_regs(efx, buf); efx_siena_get_regs(efx, buf);
} }
/* /*
......
...@@ -233,7 +233,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, ...@@ -233,7 +233,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx,
#endif #endif
len = ALIGN(len, EFX_BUF_SIZE); len = ALIGN(len, EFX_BUF_SIZE);
if (efx_nic_alloc_buffer(efx, &buffer->buf, len, GFP_KERNEL)) if (efx_siena_alloc_buffer(efx, &buffer->buf, len, GFP_KERNEL))
return -ENOMEM; return -ENOMEM;
buffer->entries = len / EFX_BUF_SIZE; buffer->entries = len / EFX_BUF_SIZE;
BUG_ON(buffer->buf.dma_addr & (EFX_BUF_SIZE - 1)); BUG_ON(buffer->buf.dma_addr & (EFX_BUF_SIZE - 1));
...@@ -269,7 +269,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) ...@@ -269,7 +269,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer)
(u64)buffer->buf.dma_addr, buffer->buf.len, (u64)buffer->buf.dma_addr, buffer->buf.len,
buffer->buf.addr, (u64)virt_to_phys(buffer->buf.addr)); buffer->buf.addr, (u64)virt_to_phys(buffer->buf.addr));
efx_nic_free_buffer(efx, &buffer->buf); efx_siena_free_buffer(efx, &buffer->buf);
buffer->entries = 0; buffer->entries = 0;
} }
......
...@@ -336,8 +336,7 @@ int efx_siena_mcdi_mon_probe(struct efx_nic *efx) ...@@ -336,8 +336,7 @@ int efx_siena_mcdi_mon_probe(struct efx_nic *efx)
if (n_sensors == 0) if (n_sensors == 0)
return 0; return 0;
rc = efx_nic_alloc_buffer( rc = efx_siena_alloc_buffer(efx, &hwmon->dma_buf,
efx, &hwmon->dma_buf,
n_sensors * MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_LEN, n_sensors * MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_LEN,
GFP_KERNEL); GFP_KERNEL);
if (rc) if (rc)
...@@ -526,7 +525,7 @@ void efx_siena_mcdi_mon_remove(struct efx_nic *efx) ...@@ -526,7 +525,7 @@ void efx_siena_mcdi_mon_remove(struct efx_nic *efx)
hwmon_device_unregister(hwmon->device); hwmon_device_unregister(hwmon->device);
kfree(hwmon->attrs); kfree(hwmon->attrs);
kfree(hwmon->group.attrs); kfree(hwmon->group.attrs);
efx_nic_free_buffer(efx, &hwmon->dma_buf); efx_siena_free_buffer(efx, &hwmon->dma_buf);
} }
#endif /* CONFIG_SFC_MCDI_MON */ #endif /* CONFIG_SFC_MCDI_MON */
...@@ -1225,8 +1225,9 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx) ...@@ -1225,8 +1225,9 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx)
return 0; return 0;
/* Allocate buffer for stats */ /* Allocate buffer for stats */
rc = efx_nic_alloc_buffer(efx, &efx->stats_buffer, rc = efx_siena_alloc_buffer(efx, &efx->stats_buffer,
efx->num_mac_stats * sizeof(u64), GFP_KERNEL); efx->num_mac_stats * sizeof(u64),
GFP_KERNEL);
if (rc) { if (rc) {
netif_warn(efx, probe, efx->net_dev, netif_warn(efx, probe, efx->net_dev,
"failed to allocate DMA buffer: %d\n", rc); "failed to allocate DMA buffer: %d\n", rc);
...@@ -1244,7 +1245,7 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx) ...@@ -1244,7 +1245,7 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx)
void efx_siena_mcdi_mac_fini_stats(struct efx_nic *efx) void efx_siena_mcdi_mac_fini_stats(struct efx_nic *efx)
{ {
efx_nic_free_buffer(efx, &efx->stats_buffer); efx_siena_free_buffer(efx, &efx->stats_buffer);
} }
static unsigned int efx_mcdi_event_link_speed[] = { static unsigned int efx_mcdi_event_link_speed[] = {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
**************************************************************************/ **************************************************************************/
int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, int efx_siena_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
unsigned int len, gfp_t gfp_flags) unsigned int len, gfp_t gfp_flags)
{ {
buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len,
...@@ -39,7 +39,7 @@ int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, ...@@ -39,7 +39,7 @@ int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
return 0; return 0;
} }
void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) void efx_siena_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer)
{ {
if (buffer->addr) { if (buffer->addr) {
dma_free_coherent(&efx->pci_dev->dev, buffer->len, dma_free_coherent(&efx->pci_dev->dev, buffer->len,
...@@ -51,19 +51,19 @@ void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) ...@@ -51,19 +51,19 @@ void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer)
/* Check whether an event is present in the eventq at the current /* Check whether an event is present in the eventq at the current
* read pointer. Only useful for self-test. * read pointer. Only useful for self-test.
*/ */
bool efx_nic_event_present(struct efx_channel *channel) bool efx_siena_event_present(struct efx_channel *channel)
{ {
return efx_event_present(efx_event(channel, channel->eventq_read_ptr)); return efx_event_present(efx_event(channel, channel->eventq_read_ptr));
} }
void efx_nic_event_test_start(struct efx_channel *channel) void efx_siena_event_test_start(struct efx_channel *channel)
{ {
channel->event_test_cpu = -1; channel->event_test_cpu = -1;
smp_wmb(); smp_wmb();
channel->efx->type->ev_test_generate(channel); channel->efx->type->ev_test_generate(channel);
} }
int efx_nic_irq_test_start(struct efx_nic *efx) int efx_siena_irq_test_start(struct efx_nic *efx)
{ {
efx->last_irq_cpu = -1; efx->last_irq_cpu = -1;
smp_wmb(); smp_wmb();
...@@ -73,7 +73,7 @@ int efx_nic_irq_test_start(struct efx_nic *efx) ...@@ -73,7 +73,7 @@ int efx_nic_irq_test_start(struct efx_nic *efx)
/* Hook interrupt handler(s) /* Hook interrupt handler(s)
* Try MSI and then legacy interrupts. * Try MSI and then legacy interrupts.
*/ */
int efx_nic_init_interrupt(struct efx_nic *efx) int efx_siena_init_interrupt(struct efx_nic *efx)
{ {
struct efx_channel *channel; struct efx_channel *channel;
unsigned int n_irqs; unsigned int n_irqs;
...@@ -146,7 +146,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx) ...@@ -146,7 +146,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx)
return rc; return rc;
} }
void efx_nic_fini_interrupt(struct efx_nic *efx) void efx_siena_fini_interrupt(struct efx_nic *efx)
{ {
struct efx_channel *channel; struct efx_channel *channel;
...@@ -364,7 +364,7 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = { ...@@ -364,7 +364,7 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = {
REGISTER_TABLE_BZ(RX_FILTER_TBL0), REGISTER_TABLE_BZ(RX_FILTER_TBL0),
}; };
size_t efx_nic_get_regs_len(struct efx_nic *efx) size_t efx_siena_get_regs_len(struct efx_nic *efx)
{ {
const struct efx_nic_reg *reg; const struct efx_nic_reg *reg;
const struct efx_nic_reg_table *table; const struct efx_nic_reg_table *table;
...@@ -387,7 +387,7 @@ size_t efx_nic_get_regs_len(struct efx_nic *efx) ...@@ -387,7 +387,7 @@ size_t efx_nic_get_regs_len(struct efx_nic *efx)
return len; return len;
} }
void efx_nic_get_regs(struct efx_nic *efx, void *buf) void efx_siena_get_regs(struct efx_nic *efx, void *buf)
{ {
const struct efx_nic_reg *reg; const struct efx_nic_reg *reg;
const struct efx_nic_reg_table *table; const struct efx_nic_reg_table *table;
...@@ -439,7 +439,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) ...@@ -439,7 +439,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
} }
/** /**
* efx_nic_describe_stats - Describe supported statistics for ethtool * efx_siena_describe_stats - Describe supported statistics for ethtool
* @desc: Array of &struct efx_hw_stat_desc describing the statistics * @desc: Array of &struct efx_hw_stat_desc describing the statistics
* @count: Length of the @desc array * @count: Length of the @desc array
* @mask: Bitmask of which elements of @desc are enabled * @mask: Bitmask of which elements of @desc are enabled
...@@ -449,7 +449,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) ...@@ -449,7 +449,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
* Returns the number of visible statistics, i.e. the number of set * 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. * 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, size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, u8 *names) const unsigned long *mask, u8 *names)
{ {
size_t visible = 0; size_t visible = 0;
...@@ -470,50 +470,7 @@ size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, ...@@ -470,50 +470,7 @@ size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
} }
/** /**
* efx_nic_copy_stats - Copy stats from the DMA buffer in to an * efx_siena_update_stats - Convert statistics DMA buffer to array of u64
* intermediate buffer. This is used to get a consistent
* set of stats while the DMA buffer can be written at any time
* by the NIC.
* @efx: The associated NIC.
* @dest: Destination buffer. Must be the same size as the DMA buffer.
*/
int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest)
{
__le64 *dma_stats = efx->stats_buffer.addr;
__le64 generation_start, generation_end;
int rc = 0, retry;
if (!dest)
return 0;
if (!dma_stats)
goto return_zeroes;
/* If we're unlucky enough to read statistics during the DMA, wait
* up to 10ms for it to finish (typically takes <500us)
*/
for (retry = 0; retry < 100; ++retry) {
generation_end = dma_stats[efx->num_mac_stats - 1];
if (generation_end == EFX_MC_STATS_GENERATION_INVALID)
goto return_zeroes;
rmb();
memcpy(dest, dma_stats, efx->num_mac_stats * sizeof(__le64));
rmb();
generation_start = dma_stats[MC_CMD_MAC_GENERATION_START];
if (generation_end == generation_start)
return 0; /* return good data */
udelay(100);
}
rc = -EIO;
return_zeroes:
memset(dest, 0, efx->num_mac_stats * sizeof(u64));
return rc;
}
/**
* efx_nic_update_stats - Convert statistics DMA buffer to array of u64
* @desc: Array of &struct efx_hw_stat_desc describing the DMA buffer * @desc: Array of &struct efx_hw_stat_desc describing the DMA buffer
* layout. DMA widths of 0, 16, 32 and 64 are supported; where * layout. DMA widths of 0, 16, 32 and 64 are supported; where
* the width is specified as 0 the corresponding element of * the width is specified as 0 the corresponding element of
...@@ -526,7 +483,7 @@ int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest) ...@@ -526,7 +483,7 @@ int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest)
* @accumulate: If set, the converted values will be added rather than * @accumulate: If set, the converted values will be added rather than
* directly stored to the corresponding elements of @stats * directly stored to the corresponding elements of @stats
*/ */
void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, const unsigned long *mask,
u64 *stats, const void *dma_buf, bool accumulate) u64 *stats, const void *dma_buf, bool accumulate)
{ {
...@@ -561,7 +518,7 @@ void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, ...@@ -561,7 +518,7 @@ void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
} }
} }
void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops) void efx_siena_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops)
{ {
/* if down, or this is the first update after coming up */ /* if down, or this is the first update after coming up */
if (!(efx->net_dev->flags & IFF_UP) || !efx->rx_nodesc_drops_prev_state) if (!(efx->net_dev->flags & IFF_UP) || !efx->rx_nodesc_drops_prev_state)
......
...@@ -182,9 +182,9 @@ static inline void efx_nic_eventq_read_ack(struct efx_channel *channel) ...@@ -182,9 +182,9 @@ static inline void efx_nic_eventq_read_ack(struct efx_channel *channel)
channel->efx->type->ev_read_ack(channel); channel->efx->type->ev_read_ack(channel);
} }
void efx_nic_event_test_start(struct efx_channel *channel); void efx_siena_event_test_start(struct efx_channel *channel);
bool efx_nic_event_present(struct efx_channel *channel); bool efx_siena_event_present(struct efx_channel *channel);
static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev) static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
{ {
...@@ -216,9 +216,9 @@ static inline void efx_update_diff_stat(u64 *stat, u64 diff) ...@@ -216,9 +216,9 @@ static inline void efx_update_diff_stat(u64 *stat, u64 diff)
} }
/* Interrupts */ /* Interrupts */
int efx_nic_init_interrupt(struct efx_nic *efx); int efx_siena_init_interrupt(struct efx_nic *efx);
int efx_nic_irq_test_start(struct efx_nic *efx); int efx_siena_irq_test_start(struct efx_nic *efx);
void efx_nic_fini_interrupt(struct efx_nic *efx); void efx_siena_fini_interrupt(struct efx_nic *efx);
static inline int efx_nic_event_test_irq_cpu(struct efx_channel *channel) static inline int efx_nic_event_test_irq_cpu(struct efx_channel *channel)
{ {
...@@ -230,29 +230,21 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) ...@@ -230,29 +230,21 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx)
} }
/* Global Resources */ /* Global Resources */
int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, int efx_siena_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
unsigned int len, gfp_t gfp_flags); unsigned int len, gfp_t gfp_flags);
void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer); void efx_siena_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer);
size_t efx_nic_get_regs_len(struct efx_nic *efx); size_t efx_siena_get_regs_len(struct efx_nic *efx);
void efx_nic_get_regs(struct efx_nic *efx, void *buf); void efx_siena_get_regs(struct efx_nic *efx, void *buf);
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1)) #define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, u8 *names); const unsigned long *mask, u8 *names);
int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest); void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
const unsigned long *mask, u64 *stats, const unsigned long *mask, u64 *stats,
const void *dma_buf, bool accumulate); const void *dma_buf, bool accumulate);
void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *stat); void efx_siena_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *stat);
static inline size_t efx_nic_update_stats_atomic(struct efx_nic *efx, u64 *full_stats,
struct rtnl_link_stats64 *core_stats)
{
if (efx->type->update_stats_atomic)
return efx->type->update_stats_atomic(efx, full_stats, core_stats);
return efx->type->update_stats(efx, full_stats, core_stats);
}
#define EFX_MAX_FLUSH_TIME 5000 #define EFX_MAX_FLUSH_TIME 5000
......
...@@ -398,7 +398,7 @@ size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings) ...@@ -398,7 +398,7 @@ size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings)
if (!efx->ptp_data) if (!efx->ptp_data)
return 0; return 0;
return efx_nic_describe_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, return efx_siena_describe_stats(efx_ptp_stat_desc, PTP_STAT_COUNT,
efx_ptp_stat_mask, strings); efx_ptp_stat_mask, strings);
} }
...@@ -430,7 +430,7 @@ size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats) ...@@ -430,7 +430,7 @@ size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats)
outbuf, sizeof(outbuf), NULL); outbuf, sizeof(outbuf), NULL);
if (rc) if (rc)
memset(outbuf, 0, sizeof(outbuf)); memset(outbuf, 0, sizeof(outbuf));
efx_nic_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, efx_siena_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT,
efx_ptp_stat_mask, efx_ptp_stat_mask,
stats, _MCDI_PTR(outbuf, 0), false); stats, _MCDI_PTR(outbuf, 0), false);
...@@ -1452,7 +1452,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) ...@@ -1452,7 +1452,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
ptp->channel = channel; ptp->channel = channel;
ptp->rx_ts_inline = efx_nic_rev(efx) >= EFX_REV_HUNT_A0; ptp->rx_ts_inline = efx_nic_rev(efx) >= EFX_REV_HUNT_A0;
rc = efx_nic_alloc_buffer(efx, &ptp->start, sizeof(int), GFP_KERNEL); rc = efx_siena_alloc_buffer(efx, &ptp->start, sizeof(int), GFP_KERNEL);
if (rc != 0) if (rc != 0)
goto fail1; goto fail1;
...@@ -1519,7 +1519,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) ...@@ -1519,7 +1519,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
destroy_workqueue(efx->ptp_data->workwq); destroy_workqueue(efx->ptp_data->workwq);
fail2: fail2:
efx_nic_free_buffer(efx, &ptp->start); efx_siena_free_buffer(efx, &ptp->start);
fail1: fail1:
kfree(efx->ptp_data); kfree(efx->ptp_data);
...@@ -1574,7 +1574,7 @@ static void efx_ptp_remove(struct efx_nic *efx) ...@@ -1574,7 +1574,7 @@ static void efx_ptp_remove(struct efx_nic *efx)
destroy_workqueue(efx->ptp_data->workwq); destroy_workqueue(efx->ptp_data->workwq);
efx_nic_free_buffer(efx, &efx->ptp_data->start); efx_siena_free_buffer(efx, &efx->ptp_data->start);
kfree(efx->ptp_data); kfree(efx->ptp_data);
efx->ptp_data = NULL; efx->ptp_data = NULL;
} }
......
...@@ -138,7 +138,7 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -138,7 +138,7 @@ static int efx_test_interrupts(struct efx_nic *efx,
netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n"); netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n");
tests->interrupt = -1; tests->interrupt = -1;
rc = efx_nic_irq_test_start(efx); rc = efx_siena_irq_test_start(efx);
if (rc == -ENOTSUPP) { if (rc == -ENOTSUPP) {
netif_dbg(efx, drv, efx->net_dev, netif_dbg(efx, drv, efx->net_dev,
"direct interrupt testing not supported\n"); "direct interrupt testing not supported\n");
...@@ -184,7 +184,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, ...@@ -184,7 +184,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx,
read_ptr[channel->channel] = channel->eventq_read_ptr; read_ptr[channel->channel] = channel->eventq_read_ptr;
set_bit(channel->channel, &dma_pend); set_bit(channel->channel, &dma_pend);
set_bit(channel->channel, &int_pend); set_bit(channel->channel, &int_pend);
efx_nic_event_test_start(channel); efx_siena_event_test_start(channel);
} }
timeout = jiffies + IRQ_TIMEOUT; timeout = jiffies + IRQ_TIMEOUT;
...@@ -204,7 +204,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, ...@@ -204,7 +204,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx,
clear_bit(channel->channel, &dma_pend); clear_bit(channel->channel, &dma_pend);
clear_bit(channel->channel, &int_pend); clear_bit(channel->channel, &int_pend);
} else { } else {
if (efx_nic_event_present(channel)) if (efx_siena_event_present(channel))
clear_bit(channel->channel, &dma_pend); clear_bit(channel->channel, &dma_pend);
if (efx_nic_event_test_irq_cpu(channel) >= 0) if (efx_nic_event_test_irq_cpu(channel) >= 0)
clear_bit(channel->channel, &int_pend); clear_bit(channel->channel, &int_pend);
...@@ -772,7 +772,7 @@ void efx_siena_selftest_async_start(struct efx_nic *efx) ...@@ -772,7 +772,7 @@ void efx_siena_selftest_async_start(struct efx_nic *efx)
struct efx_channel *channel; struct efx_channel *channel;
efx_for_each_channel(channel, efx) efx_for_each_channel(channel, efx)
efx_nic_event_test_start(channel); efx_siena_event_test_start(channel);
schedule_delayed_work(&efx->selftest_work, IRQ_TIMEOUT); schedule_delayed_work(&efx->selftest_work, IRQ_TIMEOUT);
} }
......
...@@ -301,7 +301,7 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -301,7 +301,7 @@ static int siena_probe_nic(struct efx_nic *efx)
siena_init_wol(efx); siena_init_wol(efx);
/* Allocate memory for INT_KER */ /* Allocate memory for INT_KER */
rc = efx_nic_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t), rc = efx_siena_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t),
GFP_KERNEL); GFP_KERNEL);
if (rc) if (rc)
goto fail4; goto fail4;
...@@ -336,7 +336,7 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -336,7 +336,7 @@ static int siena_probe_nic(struct efx_nic *efx)
return 0; return 0;
fail5: fail5:
efx_nic_free_buffer(efx, &efx->irq_status); efx_siena_free_buffer(efx, &efx->irq_status);
fail4: fail4:
fail3: fail3:
efx_siena_mcdi_detach(efx); efx_siena_mcdi_detach(efx);
...@@ -460,7 +460,7 @@ static void siena_remove_nic(struct efx_nic *efx) ...@@ -460,7 +460,7 @@ static void siena_remove_nic(struct efx_nic *efx)
{ {
efx_siena_mcdi_mon_remove(efx); efx_siena_mcdi_mon_remove(efx);
efx_nic_free_buffer(efx, &efx->irq_status); efx_siena_free_buffer(efx, &efx->irq_status);
efx_siena_mcdi_reset(efx, RESET_TYPE_ALL); efx_siena_mcdi_reset(efx, RESET_TYPE_ALL);
...@@ -547,7 +547,7 @@ static const unsigned long siena_stat_mask[] = { ...@@ -547,7 +547,7 @@ static const unsigned long siena_stat_mask[] = {
static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 *names) static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 *names)
{ {
return efx_nic_describe_stats(siena_stat_desc, SIENA_STAT_COUNT, return efx_siena_describe_stats(siena_stat_desc, SIENA_STAT_COUNT,
siena_stat_mask, names); siena_stat_mask, names);
} }
...@@ -564,7 +564,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) ...@@ -564,7 +564,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
if (generation_end == EFX_MC_STATS_GENERATION_INVALID) if (generation_end == EFX_MC_STATS_GENERATION_INVALID)
return 0; return 0;
rmb(); rmb();
efx_nic_update_stats(siena_stat_desc, SIENA_STAT_COUNT, siena_stat_mask, efx_siena_update_stats(siena_stat_desc, SIENA_STAT_COUNT, siena_stat_mask,
stats, efx->stats_buffer.addr, false); stats, efx->stats_buffer.addr, false);
rmb(); rmb();
generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; generation_start = dma_stats[MC_CMD_MAC_GENERATION_START];
...@@ -572,7 +572,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) ...@@ -572,7 +572,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
return -EAGAIN; return -EAGAIN;
/* Update derived statistics */ /* Update derived statistics */
efx_nic_fix_nodesc_drop_stat(efx, efx_siena_fix_nodesc_drop_stat(efx,
&stats[SIENA_STAT_rx_nodesc_drop_cnt]); &stats[SIENA_STAT_rx_nodesc_drop_cnt]);
efx_update_diff_stat(&stats[SIENA_STAT_tx_good_bytes], efx_update_diff_stat(&stats[SIENA_STAT_tx_good_bytes],
stats[SIENA_STAT_tx_bytes] - stats[SIENA_STAT_tx_bytes] -
......
...@@ -1012,9 +1012,9 @@ static void efx_siena_sriov_reset_vf_work(struct work_struct *work) ...@@ -1012,9 +1012,9 @@ static void efx_siena_sriov_reset_vf_work(struct work_struct *work)
struct efx_nic *efx = vf->efx; struct efx_nic *efx = vf->efx;
struct efx_buffer buf; struct efx_buffer buf;
if (!efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) { if (!efx_siena_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) {
efx_siena_sriov_reset_vf(vf, &buf); efx_siena_sriov_reset_vf(vf, &buf);
efx_nic_free_buffer(efx, &buf); efx_siena_free_buffer(efx, &buf);
} }
} }
...@@ -1229,7 +1229,7 @@ static void efx_siena_sriov_vfs_fini(struct efx_nic *efx) ...@@ -1229,7 +1229,7 @@ static void efx_siena_sriov_vfs_fini(struct efx_nic *efx)
for (pos = 0; pos < efx->vf_count; ++pos) { for (pos = 0; pos < efx->vf_count; ++pos) {
vf = nic_data->vf + pos; vf = nic_data->vf + pos;
efx_nic_free_buffer(efx, &vf->buf); efx_siena_free_buffer(efx, &vf->buf);
kfree(vf->peer_page_addrs); kfree(vf->peer_page_addrs);
vf->peer_page_addrs = NULL; vf->peer_page_addrs = NULL;
vf->peer_page_count = 0; vf->peer_page_count = 0;
...@@ -1269,7 +1269,7 @@ static int efx_siena_sriov_vfs_init(struct efx_nic *efx) ...@@ -1269,7 +1269,7 @@ static int efx_siena_sriov_vfs_init(struct efx_nic *efx)
pci_domain_nr(pci_dev->bus), pci_dev->bus->number, pci_domain_nr(pci_dev->bus), pci_dev->bus->number,
PCI_SLOT(devfn), PCI_FUNC(devfn)); PCI_SLOT(devfn), PCI_FUNC(devfn));
rc = efx_nic_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, rc = efx_siena_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (rc) if (rc)
goto fail; goto fail;
...@@ -1303,7 +1303,7 @@ int efx_siena_sriov_init(struct efx_nic *efx) ...@@ -1303,7 +1303,7 @@ int efx_siena_sriov_init(struct efx_nic *efx)
if (rc) if (rc)
goto fail_cmd; goto fail_cmd;
rc = efx_nic_alloc_buffer(efx, &nic_data->vfdi_status, rc = efx_siena_alloc_buffer(efx, &nic_data->vfdi_status,
sizeof(*vfdi_status), GFP_KERNEL); sizeof(*vfdi_status), GFP_KERNEL);
if (rc) if (rc)
goto fail_status; goto fail_status;
...@@ -1359,7 +1359,7 @@ int efx_siena_sriov_init(struct efx_nic *efx) ...@@ -1359,7 +1359,7 @@ int efx_siena_sriov_init(struct efx_nic *efx)
efx_siena_sriov_free_local(efx); efx_siena_sriov_free_local(efx);
kfree(nic_data->vf); kfree(nic_data->vf);
fail_alloc: fail_alloc:
efx_nic_free_buffer(efx, &nic_data->vfdi_status); efx_siena_free_buffer(efx, &nic_data->vfdi_status);
fail_status: fail_status:
efx_siena_sriov_cmd(efx, false, NULL, NULL); efx_siena_sriov_cmd(efx, false, NULL, NULL);
fail_cmd: fail_cmd:
...@@ -1396,7 +1396,7 @@ void efx_siena_sriov_fini(struct efx_nic *efx) ...@@ -1396,7 +1396,7 @@ void efx_siena_sriov_fini(struct efx_nic *efx)
efx_siena_sriov_vfs_fini(efx); efx_siena_sriov_vfs_fini(efx);
efx_siena_sriov_free_local(efx); efx_siena_sriov_free_local(efx);
kfree(nic_data->vf); kfree(nic_data->vf);
efx_nic_free_buffer(efx, &nic_data->vfdi_status); efx_siena_free_buffer(efx, &nic_data->vfdi_status);
efx_siena_sriov_cmd(efx, false, NULL, NULL); efx_siena_sriov_cmd(efx, false, NULL, NULL);
} }
...@@ -1564,7 +1564,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx) ...@@ -1564,7 +1564,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx)
efx_siena_sriov_usrev(efx, true); efx_siena_sriov_usrev(efx, true);
(void)efx_siena_sriov_cmd(efx, true, NULL, NULL); (void)efx_siena_sriov_cmd(efx, true, NULL, NULL);
if (efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) if (efx_siena_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO))
return; return;
for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) { for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) {
...@@ -1572,7 +1572,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx) ...@@ -1572,7 +1572,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx)
efx_siena_sriov_reset_vf(vf, &buf); efx_siena_sriov_reset_vf(vf, &buf);
} }
efx_nic_free_buffer(efx, &buf); efx_siena_free_buffer(efx, &buf);
} }
int efx_init_sriov(void) int efx_init_sriov(void)
......
...@@ -33,7 +33,7 @@ static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue, ...@@ -33,7 +33,7 @@ static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue,
((index << EFX_TX_CB_ORDER) + NET_IP_ALIGN) & (PAGE_SIZE - 1); ((index << EFX_TX_CB_ORDER) + NET_IP_ALIGN) & (PAGE_SIZE - 1);
if (unlikely(!page_buf->addr) && if (unlikely(!page_buf->addr) &&
efx_nic_alloc_buffer(tx_queue->efx, page_buf, PAGE_SIZE, efx_siena_alloc_buffer(tx_queue->efx, page_buf, PAGE_SIZE,
GFP_ATOMIC)) GFP_ATOMIC))
return NULL; return NULL;
buffer->dma_addr = page_buf->dma_addr + offset; buffer->dma_addr = page_buf->dma_addr + offset;
......
...@@ -107,7 +107,7 @@ void efx_siena_remove_tx_queue(struct efx_tx_queue *tx_queue) ...@@ -107,7 +107,7 @@ void efx_siena_remove_tx_queue(struct efx_tx_queue *tx_queue)
if (tx_queue->cb_page) { if (tx_queue->cb_page) {
for (i = 0; i < efx_tx_cb_page_count(tx_queue); i++) for (i = 0; i < efx_tx_cb_page_count(tx_queue); i++)
efx_nic_free_buffer(tx_queue->efx, efx_siena_free_buffer(tx_queue->efx,
&tx_queue->cb_page[i]); &tx_queue->cb_page[i]);
kfree(tx_queue->cb_page); kfree(tx_queue->cb_page);
tx_queue->cb_page = NULL; tx_queue->cb_page = NULL;
......
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