sfc: Prepare for RX scatter on EF10
[deliverable/linux.git] / drivers / net / ethernet / sfc / falcon.c
index e556a5d7731a54a8a850c095eacc8efc291d4332..a7b30ddbd4e0c47af54989194106ecdea3d0d001 100644 (file)
@@ -19,7 +19,6 @@
 #include "net_driver.h"
 #include "bitfield.h"
 #include "efx.h"
-#include "spi.h"
 #include "nic.h"
 #include "farch_regs.h"
 #include "io.h"
@@ -32,7 +31,7 @@
 
 /**************************************************************************
  *
- * MAC stats DMA format
+ * NIC stats
  *
  **************************************************************************
  */
 #define XgDmaDone_offset 0xD4
 #define XgDmaDone_WIDTH 32
 
-#define FALCON_STATS_NOT_DONE 0x00000000
-#define FALCON_STATS_DONE 0xffffffff
-
-#define FALCON_STAT_OFFSET(falcon_stat) EFX_VAL(falcon_stat, offset)
-#define FALCON_STAT_WIDTH(falcon_stat) EFX_VAL(falcon_stat, WIDTH)
-
-/* Retrieve statistic from statistics block */
-#define FALCON_STAT(efx, falcon_stat, efx_stat) do {           \
-       if (FALCON_STAT_WIDTH(falcon_stat) == 16)               \
-               (efx)->mac_stats.efx_stat += le16_to_cpu(       \
-                       *((__force __le16 *)                            \
-                         (efx->stats_buffer.addr +             \
-                          FALCON_STAT_OFFSET(falcon_stat))));  \
-       else if (FALCON_STAT_WIDTH(falcon_stat) == 32)          \
-               (efx)->mac_stats.efx_stat += le32_to_cpu(       \
-                       *((__force __le32 *)                            \
-                         (efx->stats_buffer.addr +             \
-                          FALCON_STAT_OFFSET(falcon_stat))));  \
-       else                                                    \
-               (efx)->mac_stats.efx_stat += le64_to_cpu(       \
-                       *((__force __le64 *)                            \
-                         (efx->stats_buffer.addr +             \
-                          FALCON_STAT_OFFSET(falcon_stat))));  \
-       } while (0)
+#define FALCON_XMAC_STATS_DMA_FLAG(efx)                                \
+       (*(u32 *)((efx)->stats_buffer.addr + XgDmaDone_offset))
+
+#define FALCON_DMA_STAT(ext_name, hw_name)                             \
+       [FALCON_STAT_ ## ext_name] =                                    \
+       { #ext_name,                                                    \
+         /* 48-bit stats are zero-padded to 64 on DMA */               \
+         hw_name ## _ ## WIDTH == 48 ? 64 : hw_name ## _ ## WIDTH,     \
+         hw_name ## _ ## offset }
+#define FALCON_OTHER_STAT(ext_name)                                    \
+       [FALCON_STAT_ ## ext_name] = { #ext_name, 0, 0 }
+
+static const struct efx_hw_stat_desc falcon_stat_desc[FALCON_STAT_COUNT] = {
+       FALCON_DMA_STAT(tx_bytes, XgTxOctets),
+       FALCON_DMA_STAT(tx_packets, XgTxPkts),
+       FALCON_DMA_STAT(tx_pause, XgTxPausePkts),
+       FALCON_DMA_STAT(tx_control, XgTxControlPkts),
+       FALCON_DMA_STAT(tx_unicast, XgTxUnicastPkts),
+       FALCON_DMA_STAT(tx_multicast, XgTxMulticastPkts),
+       FALCON_DMA_STAT(tx_broadcast, XgTxBroadcastPkts),
+       FALCON_DMA_STAT(tx_lt64, XgTxUndersizePkts),
+       FALCON_DMA_STAT(tx_64, XgTxPkts64Octets),
+       FALCON_DMA_STAT(tx_65_to_127, XgTxPkts65to127Octets),
+       FALCON_DMA_STAT(tx_128_to_255, XgTxPkts128to255Octets),
+       FALCON_DMA_STAT(tx_256_to_511, XgTxPkts256to511Octets),
+       FALCON_DMA_STAT(tx_512_to_1023, XgTxPkts512to1023Octets),
+       FALCON_DMA_STAT(tx_1024_to_15xx, XgTxPkts1024to15xxOctets),
+       FALCON_DMA_STAT(tx_15xx_to_jumbo, XgTxPkts1519toMaxOctets),
+       FALCON_DMA_STAT(tx_gtjumbo, XgTxOversizePkts),
+       FALCON_DMA_STAT(tx_non_tcpudp, XgTxNonTcpUdpPkt),
+       FALCON_DMA_STAT(tx_mac_src_error, XgTxMacSrcErrPkt),
+       FALCON_DMA_STAT(tx_ip_src_error, XgTxIpSrcErrPkt),
+       FALCON_DMA_STAT(rx_bytes, XgRxOctets),
+       FALCON_DMA_STAT(rx_good_bytes, XgRxOctetsOK),
+       FALCON_OTHER_STAT(rx_bad_bytes),
+       FALCON_DMA_STAT(rx_packets, XgRxPkts),
+       FALCON_DMA_STAT(rx_good, XgRxPktsOK),
+       FALCON_DMA_STAT(rx_bad, XgRxFCSerrorPkts),
+       FALCON_DMA_STAT(rx_pause, XgRxPausePkts),
+       FALCON_DMA_STAT(rx_control, XgRxControlPkts),
+       FALCON_DMA_STAT(rx_unicast, XgRxUnicastPkts),
+       FALCON_DMA_STAT(rx_multicast, XgRxMulticastPkts),
+       FALCON_DMA_STAT(rx_broadcast, XgRxBroadcastPkts),
+       FALCON_DMA_STAT(rx_lt64, XgRxUndersizePkts),
+       FALCON_DMA_STAT(rx_64, XgRxPkts64Octets),
+       FALCON_DMA_STAT(rx_65_to_127, XgRxPkts65to127Octets),
+       FALCON_DMA_STAT(rx_128_to_255, XgRxPkts128to255Octets),
+       FALCON_DMA_STAT(rx_256_to_511, XgRxPkts256to511Octets),
+       FALCON_DMA_STAT(rx_512_to_1023, XgRxPkts512to1023Octets),
+       FALCON_DMA_STAT(rx_1024_to_15xx, XgRxPkts1024to15xxOctets),
+       FALCON_DMA_STAT(rx_15xx_to_jumbo, XgRxPkts15xxtoMaxOctets),
+       FALCON_DMA_STAT(rx_gtjumbo, XgRxOversizePkts),
+       FALCON_DMA_STAT(rx_bad_lt64, XgRxUndersizeFCSerrorPkts),
+       FALCON_DMA_STAT(rx_bad_gtjumbo, XgRxJabberPkts),
+       FALCON_DMA_STAT(rx_overflow, XgRxDropEvents),
+       FALCON_DMA_STAT(rx_symbol_error, XgRxSymbolError),
+       FALCON_DMA_STAT(rx_align_error, XgRxAlignError),
+       FALCON_DMA_STAT(rx_length_error, XgRxLengthError),
+       FALCON_DMA_STAT(rx_internal_error, XgRxInternalMACError),
+       FALCON_OTHER_STAT(rx_nodesc_drop_cnt),
+};
+static const unsigned long falcon_stat_mask[] = {
+       [0 ... BITS_TO_LONGS(FALCON_STAT_COUNT) - 1] = ~0UL,
+};
 
 /**************************************************************************
  *
- * Non-volatile configuration
+ * 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 */
+
+/**************************************************************************
+ *
+ * Non-volatile memory layout
  *
  **************************************************************************
  */
 
+/* SFC4000 flash is partitioned into:
+ *     0-0x400       chip and board config (see struct falcon_nvconfig)
+ *     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
+
 /* Board configuration v2 (v1 is obsolete; later versions are compatible) */
 struct falcon_nvconfig_board_v2 {
        __le16 nports;
@@ -434,9 +511,10 @@ static int falcon_spi_wait(struct efx_nic *efx)
        }
 }
 
-int falcon_spi_cmd(struct efx_nic *efx, const struct efx_spi_device *spi,
-                  unsigned int command, int address,
-                  const void *in, void *out, size_t len)
+static 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)
 {
        bool addressed = (address >= 0);
        bool reading = (out != NULL);
@@ -490,48 +568,16 @@ int falcon_spi_cmd(struct efx_nic *efx, const struct efx_spi_device *spi,
        return 0;
 }
 
-static size_t
-falcon_spi_write_limit(const struct efx_spi_device *spi, size_t start)
-{
-       return min(FALCON_SPI_MAX_LEN,
-                  (spi->block_size - (start & (spi->block_size - 1))));
-}
-
 static inline u8
-efx_spi_munge_command(const struct efx_spi_device *spi,
-                     const u8 command, const unsigned int address)
+falcon_spi_munge_command(const struct falcon_spi_device *spi,
+                        const u8 command, const unsigned int address)
 {
        return command | (((address >> 8) & spi->munge_address) << 3);
 }
 
-/* Wait up to 10 ms for buffered write completion */
-int
-falcon_spi_wait_write(struct efx_nic *efx, const struct efx_spi_device *spi)
-{
-       unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 100);
-       u8 status;
-       int rc;
-
-       for (;;) {
-               rc = falcon_spi_cmd(efx, spi, SPI_RDSR, -1, NULL,
-                                   &status, sizeof(status));
-               if (rc)
-                       return rc;
-               if (!(status & SPI_STATUS_NRDY))
-                       return 0;
-               if (time_after_eq(jiffies, timeout)) {
-                       netif_err(efx, hw, efx->net_dev,
-                                 "SPI write timeout on device %d"
-                                 " last status=0x%02x\n",
-                                 spi->device_id, status);
-                       return -ETIMEDOUT;
-               }
-               schedule_timeout_uninterruptible(1);
-       }
-}
-
-int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
-                   loff_t start, size_t len, size_t *retlen, u8 *buffer)
+static 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)
 {
        size_t block_len, pos = 0;
        unsigned int command;
@@ -540,7 +586,7 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
        while (pos < len) {
                block_len = min(len - pos, FALCON_SPI_MAX_LEN);
 
-               command = efx_spi_munge_command(spi, SPI_READ, start + pos);
+               command = falcon_spi_munge_command(spi, SPI_READ, start + pos);
                rc = falcon_spi_cmd(efx, spi, command, start + pos, NULL,
                                    buffer + pos, block_len);
                if (rc)
@@ -560,8 +606,52 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
        return rc;
 }
 
-int
-falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
+#ifdef CONFIG_SFC_MTD
+
+struct falcon_mtd_partition {
+       struct efx_mtd_partition common;
+       const struct falcon_spi_device *spi;
+       size_t offset;
+};
+
+#define to_falcon_mtd_partition(mtd)                           \
+       container_of(mtd, struct falcon_mtd_partition, common.mtd)
+
+static size_t
+falcon_spi_write_limit(const struct falcon_spi_device *spi, size_t start)
+{
+       return min(FALCON_SPI_MAX_LEN,
+                  (spi->block_size - (start & (spi->block_size - 1))));
+}
+
+/* Wait up to 10 ms for buffered write completion */
+static int
+falcon_spi_wait_write(struct efx_nic *efx, const struct falcon_spi_device *spi)
+{
+       unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 100);
+       u8 status;
+       int rc;
+
+       for (;;) {
+               rc = falcon_spi_cmd(efx, spi, SPI_RDSR, -1, NULL,
+                                   &status, sizeof(status));
+               if (rc)
+                       return rc;
+               if (!(status & SPI_STATUS_NRDY))
+                       return 0;
+               if (time_after_eq(jiffies, timeout)) {
+                       netif_err(efx, hw, efx->net_dev,
+                                 "SPI write timeout on device %d"
+                                 " last status=0x%02x\n",
+                                 spi->device_id, status);
+                       return -ETIMEDOUT;
+               }
+               schedule_timeout_uninterruptible(1);
+       }
+}
+
+static 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)
 {
        u8 verify_buffer[FALCON_SPI_MAX_LEN];
@@ -576,7 +666,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
 
                block_len = min(len - pos,
                                falcon_spi_write_limit(spi, start + pos));
-               command = efx_spi_munge_command(spi, SPI_WRITE, start + pos);
+               command = falcon_spi_munge_command(spi, SPI_WRITE, start + pos);
                rc = falcon_spi_cmd(efx, spi, command, start + pos,
                                    buffer + pos, NULL, block_len);
                if (rc)
@@ -586,7 +676,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
                if (rc)
                        break;
 
-               command = efx_spi_munge_command(spi, SPI_READ, start + pos);
+               command = falcon_spi_munge_command(spi, SPI_READ, start + pos);
                rc = falcon_spi_cmd(efx, spi, command, start + pos,
                                    NULL, verify_buffer, block_len);
                if (memcmp(verify_buffer, buffer + pos, block_len)) {
@@ -609,6 +699,238 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
        return rc;
 }
 
+static int
+falcon_spi_slow_wait(struct falcon_mtd_partition *part, bool uninterruptible)
+{
+       const struct falcon_spi_device *spi = part->spi;
+       struct efx_nic *efx = part->common.mtd.priv;
+       u8 status;
+       int rc, i;
+
+       /* Wait up to 4s for flash/EEPROM to finish a slow operation. */
+       for (i = 0; i < 40; i++) {
+               __set_current_state(uninterruptible ?
+                                   TASK_UNINTERRUPTIBLE : TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ / 10);
+               rc = falcon_spi_cmd(efx, spi, SPI_RDSR, -1, NULL,
+                                   &status, sizeof(status));
+               if (rc)
+                       return rc;
+               if (!(status & SPI_STATUS_NRDY))
+                       return 0;
+               if (signal_pending(current))
+                       return -EINTR;
+       }
+       pr_err("%s: timed out waiting for %s\n",
+              part->common.name, part->common.dev_type_name);
+       return -ETIMEDOUT;
+}
+
+static int
+falcon_spi_unlock(struct efx_nic *efx, const struct falcon_spi_device *spi)
+{
+       const u8 unlock_mask = (SPI_STATUS_BP2 | SPI_STATUS_BP1 |
+                               SPI_STATUS_BP0);
+       u8 status;
+       int rc;
+
+       rc = falcon_spi_cmd(efx, spi, SPI_RDSR, -1, NULL,
+                           &status, sizeof(status));
+       if (rc)
+               return rc;
+
+       if (!(status & unlock_mask))
+               return 0; /* already unlocked */
+
+       rc = falcon_spi_cmd(efx, spi, SPI_WREN, -1, NULL, NULL, 0);
+       if (rc)
+               return rc;
+       rc = falcon_spi_cmd(efx, spi, SPI_SST_EWSR, -1, NULL, NULL, 0);
+       if (rc)
+               return rc;
+
+       status &= ~unlock_mask;
+       rc = falcon_spi_cmd(efx, spi, SPI_WRSR, -1, &status,
+                           NULL, sizeof(status));
+       if (rc)
+               return rc;
+       rc = falcon_spi_wait_write(efx, spi);
+       if (rc)
+               return rc;
+
+       return 0;
+}
+
+#define FALCON_SPI_VERIFY_BUF_LEN 16
+
+static int
+falcon_spi_erase(struct falcon_mtd_partition *part, loff_t start, size_t len)
+{
+       const struct falcon_spi_device *spi = part->spi;
+       struct efx_nic *efx = part->common.mtd.priv;
+       unsigned pos, block_len;
+       u8 empty[FALCON_SPI_VERIFY_BUF_LEN];
+       u8 buffer[FALCON_SPI_VERIFY_BUF_LEN];
+       int rc;
+
+       if (len != spi->erase_size)
+               return -EINVAL;
+
+       if (spi->erase_command == 0)
+               return -EOPNOTSUPP;
+
+       rc = falcon_spi_unlock(efx, spi);
+       if (rc)
+               return rc;
+       rc = falcon_spi_cmd(efx, spi, SPI_WREN, -1, NULL, NULL, 0);
+       if (rc)
+               return rc;
+       rc = falcon_spi_cmd(efx, spi, spi->erase_command, start, NULL,
+                           NULL, 0);
+       if (rc)
+               return rc;
+       rc = falcon_spi_slow_wait(part, false);
+
+       /* Verify the entire region has been wiped */
+       memset(empty, 0xff, sizeof(empty));
+       for (pos = 0; pos < len; pos += block_len) {
+               block_len = min(len - pos, sizeof(buffer));
+               rc = falcon_spi_read(efx, spi, start + pos, block_len,
+                                    NULL, buffer);
+               if (rc)
+                       return rc;
+               if (memcmp(empty, buffer, block_len))
+                       return -EIO;
+
+               /* Avoid locking up the system */
+               cond_resched();
+               if (signal_pending(current))
+                       return -EINTR;
+       }
+
+       return rc;
+}
+
+static void falcon_mtd_rename(struct efx_mtd_partition *part)
+{
+       struct efx_nic *efx = part->mtd.priv;
+
+       snprintf(part->name, sizeof(part->name), "%s %s",
+                efx->name, part->type_name);
+}
+
+static int falcon_mtd_read(struct mtd_info *mtd, loff_t start,
+                          size_t len, size_t *retlen, u8 *buffer)
+{
+       struct falcon_mtd_partition *part = to_falcon_mtd_partition(mtd);
+       struct efx_nic *efx = mtd->priv;
+       struct falcon_nic_data *nic_data = efx->nic_data;
+       int rc;
+
+       rc = mutex_lock_interruptible(&nic_data->spi_lock);
+       if (rc)
+               return rc;
+       rc = falcon_spi_read(efx, part->spi, part->offset + start,
+                            len, retlen, buffer);
+       mutex_unlock(&nic_data->spi_lock);
+       return rc;
+}
+
+static int falcon_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len)
+{
+       struct falcon_mtd_partition *part = to_falcon_mtd_partition(mtd);
+       struct efx_nic *efx = mtd->priv;
+       struct falcon_nic_data *nic_data = efx->nic_data;
+       int rc;
+
+       rc = mutex_lock_interruptible(&nic_data->spi_lock);
+       if (rc)
+               return rc;
+       rc = falcon_spi_erase(part, part->offset + start, len);
+       mutex_unlock(&nic_data->spi_lock);
+       return rc;
+}
+
+static int falcon_mtd_write(struct mtd_info *mtd, loff_t start,
+                           size_t len, size_t *retlen, const u8 *buffer)
+{
+       struct falcon_mtd_partition *part = to_falcon_mtd_partition(mtd);
+       struct efx_nic *efx = mtd->priv;
+       struct falcon_nic_data *nic_data = efx->nic_data;
+       int rc;
+
+       rc = mutex_lock_interruptible(&nic_data->spi_lock);
+       if (rc)
+               return rc;
+       rc = falcon_spi_write(efx, part->spi, part->offset + start,
+                             len, retlen, buffer);
+       mutex_unlock(&nic_data->spi_lock);
+       return rc;
+}
+
+static int falcon_mtd_sync(struct mtd_info *mtd)
+{
+       struct falcon_mtd_partition *part = to_falcon_mtd_partition(mtd);
+       struct efx_nic *efx = mtd->priv;
+       struct falcon_nic_data *nic_data = efx->nic_data;
+       int rc;
+
+       mutex_lock(&nic_data->spi_lock);
+       rc = falcon_spi_slow_wait(part, true);
+       mutex_unlock(&nic_data->spi_lock);
+       return rc;
+}
+
+static int falcon_mtd_probe(struct efx_nic *efx)
+{
+       struct falcon_nic_data *nic_data = efx->nic_data;
+       struct falcon_mtd_partition *parts;
+       struct falcon_spi_device *spi;
+       size_t n_parts;
+       int rc = -ENODEV;
+
+       ASSERT_RTNL();
+
+       /* Allocate space for maximum number of partitions */
+       parts = kcalloc(2, sizeof(*parts), GFP_KERNEL);
+       n_parts = 0;
+
+       spi = &nic_data->spi_flash;
+       if (falcon_spi_present(spi) && spi->size > FALCON_FLASH_BOOTCODE_START) {
+               parts[n_parts].spi = spi;
+               parts[n_parts].offset = FALCON_FLASH_BOOTCODE_START;
+               parts[n_parts].common.dev_type_name = "flash";
+               parts[n_parts].common.type_name = "sfc_flash_bootrom";
+               parts[n_parts].common.mtd.type = MTD_NORFLASH;
+               parts[n_parts].common.mtd.flags = MTD_CAP_NORFLASH;
+               parts[n_parts].common.mtd.size = spi->size - FALCON_FLASH_BOOTCODE_START;
+               parts[n_parts].common.mtd.erasesize = spi->erase_size;
+               n_parts++;
+       }
+
+       spi = &nic_data->spi_eeprom;
+       if (falcon_spi_present(spi) && spi->size > FALCON_EEPROM_BOOTCONFIG_START) {
+               parts[n_parts].spi = spi;
+               parts[n_parts].offset = FALCON_EEPROM_BOOTCONFIG_START;
+               parts[n_parts].common.dev_type_name = "EEPROM";
+               parts[n_parts].common.type_name = "sfc_bootconfig";
+               parts[n_parts].common.mtd.type = MTD_RAM;
+               parts[n_parts].common.mtd.flags = MTD_CAP_RAM;
+               parts[n_parts].common.mtd.size =
+                       min(spi->size, FALCON_EEPROM_BOOTCONFIG_END) -
+                       FALCON_EEPROM_BOOTCONFIG_START;
+               parts[n_parts].common.mtd.erasesize = spi->erase_size;
+               n_parts++;
+       }
+
+       rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts));
+       if (rc)
+               kfree(parts);
+       return rc;
+}
+
+#endif /* CONFIG_SFC_MTD */
+
 /**************************************************************************
  *
  * XMAC operations
@@ -686,7 +1008,7 @@ static void falcon_ack_status_intr(struct efx_nic *efx)
                return;
 
        /* We expect xgmii faults if the wireside link is down */
-       if (!EFX_WORKAROUND_5147(efx) || !efx->link_state.up)
+       if (!efx->link_state.up)
                return;
 
        /* We can only use this interrupt to signal the negative edge of
@@ -764,7 +1086,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
                             FRF_AB_XM_RXEN, 1,
                             FRF_AB_XM_AUTO_DEPAD, 0,
                             FRF_AB_XM_ACPT_ALL_MCAST, 1,
-                            FRF_AB_XM_ACPT_ALL_UCAST, efx->promiscuous,
+                            FRF_AB_XM_ACPT_ALL_UCAST, !efx->unicast_filter,
                             FRF_AB_XM_PASS_CRC_ERR, 1);
        efx_writeo(efx, &reg, FR_AB_XM_RX_CFG);
 
@@ -795,29 +1117,22 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
        bool xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS);
        bool xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI);
        bool xgmii_loopback = (efx->loopback_mode == LOOPBACK_XGMII);
+       bool old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
 
        /* XGXS block is flaky and will need to be reset if moving
         * into our out of XGMII, XGXS or XAUI loopbacks. */
-       if (EFX_WORKAROUND_5147(efx)) {
-               bool old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
-               bool reset_xgxs;
-
-               efx_reado(efx, &reg, FR_AB_XX_CORE_STAT);
-               old_xgxs_loopback = EFX_OWORD_FIELD(reg, FRF_AB_XX_XGXS_LB_EN);
-               old_xgmii_loopback =
-                       EFX_OWORD_FIELD(reg, FRF_AB_XX_XGMII_LB_EN);
-
-               efx_reado(efx, &reg, FR_AB_XX_SD_CTL);
-               old_xaui_loopback = EFX_OWORD_FIELD(reg, FRF_AB_XX_LPBKA);
+       efx_reado(efx, &reg, FR_AB_XX_CORE_STAT);
+       old_xgxs_loopback = EFX_OWORD_FIELD(reg, FRF_AB_XX_XGXS_LB_EN);
+       old_xgmii_loopback = EFX_OWORD_FIELD(reg, FRF_AB_XX_XGMII_LB_EN);
 
-               /* The PHY driver may have turned XAUI off */
-               reset_xgxs = ((xgxs_loopback != old_xgxs_loopback) ||
-                             (xaui_loopback != old_xaui_loopback) ||
-                             (xgmii_loopback != old_xgmii_loopback));
+       efx_reado(efx, &reg, FR_AB_XX_SD_CTL);
+       old_xaui_loopback = EFX_OWORD_FIELD(reg, FRF_AB_XX_LPBKA);
 
-               if (reset_xgxs)
-                       falcon_reset_xaui(efx);
-       }
+       /* The PHY driver may have turned XAUI off */
+       if ((xgxs_loopback != old_xgxs_loopback) ||
+           (xaui_loopback != old_xaui_loopback) ||
+           (xgmii_loopback != old_xgmii_loopback))
+               falcon_reset_xaui(efx);
 
        efx_reado(efx, &reg, FR_AB_XX_CORE_STAT);
        EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_FORCE_SIG,
@@ -871,6 +1186,8 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
 {
        struct falcon_nic_data *nic_data = efx->nic_data;
 
+       efx_farch_filter_sync_rx_mode(efx);
+
        falcon_reconfigure_xgxs_core(efx);
        falcon_reconfigure_xmac_core(efx);
 
@@ -882,72 +1199,12 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
        return 0;
 }
 
-static void falcon_update_stats_xmac(struct efx_nic *efx)
-{
-       struct efx_mac_stats *mac_stats = &efx->mac_stats;
-
-       /* Update MAC stats from DMAed values */
-       FALCON_STAT(efx, XgRxOctets, rx_bytes);
-       FALCON_STAT(efx, XgRxOctetsOK, rx_good_bytes);
-       FALCON_STAT(efx, XgRxPkts, rx_packets);
-       FALCON_STAT(efx, XgRxPktsOK, rx_good);
-       FALCON_STAT(efx, XgRxBroadcastPkts, rx_broadcast);
-       FALCON_STAT(efx, XgRxMulticastPkts, rx_multicast);
-       FALCON_STAT(efx, XgRxUnicastPkts, rx_unicast);
-       FALCON_STAT(efx, XgRxUndersizePkts, rx_lt64);
-       FALCON_STAT(efx, XgRxOversizePkts, rx_gtjumbo);
-       FALCON_STAT(efx, XgRxJabberPkts, rx_bad_gtjumbo);
-       FALCON_STAT(efx, XgRxUndersizeFCSerrorPkts, rx_bad_lt64);
-       FALCON_STAT(efx, XgRxDropEvents, rx_overflow);
-       FALCON_STAT(efx, XgRxFCSerrorPkts, rx_bad);
-       FALCON_STAT(efx, XgRxAlignError, rx_align_error);
-       FALCON_STAT(efx, XgRxSymbolError, rx_symbol_error);
-       FALCON_STAT(efx, XgRxInternalMACError, rx_internal_error);
-       FALCON_STAT(efx, XgRxControlPkts, rx_control);
-       FALCON_STAT(efx, XgRxPausePkts, rx_pause);
-       FALCON_STAT(efx, XgRxPkts64Octets, rx_64);
-       FALCON_STAT(efx, XgRxPkts65to127Octets, rx_65_to_127);
-       FALCON_STAT(efx, XgRxPkts128to255Octets, rx_128_to_255);
-       FALCON_STAT(efx, XgRxPkts256to511Octets, rx_256_to_511);
-       FALCON_STAT(efx, XgRxPkts512to1023Octets, rx_512_to_1023);
-       FALCON_STAT(efx, XgRxPkts1024to15xxOctets, rx_1024_to_15xx);
-       FALCON_STAT(efx, XgRxPkts15xxtoMaxOctets, rx_15xx_to_jumbo);
-       FALCON_STAT(efx, XgRxLengthError, rx_length_error);
-       FALCON_STAT(efx, XgTxPkts, tx_packets);
-       FALCON_STAT(efx, XgTxOctets, tx_bytes);
-       FALCON_STAT(efx, XgTxMulticastPkts, tx_multicast);
-       FALCON_STAT(efx, XgTxBroadcastPkts, tx_broadcast);
-       FALCON_STAT(efx, XgTxUnicastPkts, tx_unicast);
-       FALCON_STAT(efx, XgTxControlPkts, tx_control);
-       FALCON_STAT(efx, XgTxPausePkts, tx_pause);
-       FALCON_STAT(efx, XgTxPkts64Octets, tx_64);
-       FALCON_STAT(efx, XgTxPkts65to127Octets, tx_65_to_127);
-       FALCON_STAT(efx, XgTxPkts128to255Octets, tx_128_to_255);
-       FALCON_STAT(efx, XgTxPkts256to511Octets, tx_256_to_511);
-       FALCON_STAT(efx, XgTxPkts512to1023Octets, tx_512_to_1023);
-       FALCON_STAT(efx, XgTxPkts1024to15xxOctets, tx_1024_to_15xx);
-       FALCON_STAT(efx, XgTxPkts1519toMaxOctets, tx_15xx_to_jumbo);
-       FALCON_STAT(efx, XgTxUndersizePkts, tx_lt64);
-       FALCON_STAT(efx, XgTxOversizePkts, tx_gtjumbo);
-       FALCON_STAT(efx, XgTxNonTcpUdpPkt, tx_non_tcpudp);
-       FALCON_STAT(efx, XgTxMacSrcErrPkt, tx_mac_src_error);
-       FALCON_STAT(efx, XgTxIpSrcErrPkt, tx_ip_src_error);
-
-       /* Update derived statistics */
-       efx_update_diff_stat(&mac_stats->tx_good_bytes,
-                            mac_stats->tx_bytes - mac_stats->tx_bad_bytes -
-                            mac_stats->tx_control * 64);
-       efx_update_diff_stat(&mac_stats->rx_bad_bytes,
-                            mac_stats->rx_bytes - mac_stats->rx_good_bytes -
-                            mac_stats->rx_control * 64);
-}
-
 static void falcon_poll_xmac(struct efx_nic *efx)
 {
        struct falcon_nic_data *nic_data = efx->nic_data;
 
-       if (!EFX_WORKAROUND_5147(efx) || !efx->link_state.up ||
-           !nic_data->xmac_poll_required)
+       /* We expect xgmii faults if the wireside link is down */
+       if (!efx->link_state.up || !nic_data->xmac_poll_required)
                return;
 
        nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
@@ -1088,7 +1345,7 @@ static void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
        EFX_POPULATE_OWORD_5(reg,
                             FRF_AB_MAC_XOFF_VAL, 0xffff /* max pause time */,
                             FRF_AB_MAC_BCAD_ACPT, 1,
-                            FRF_AB_MAC_UC_PROM, efx->promiscuous,
+                            FRF_AB_MAC_UC_PROM, !efx->unicast_filter,
                             FRF_AB_MAC_LINK_STATUS, 1, /* always set */
                             FRF_AB_MAC_SPEED, link_speed);
        /* On B0, MAC backpressure can be disabled and packets get
@@ -1121,10 +1378,7 @@ static void falcon_stats_request(struct efx_nic *efx)
        WARN_ON(nic_data->stats_pending);
        WARN_ON(nic_data->stats_disable_count);
 
-       if (nic_data->stats_dma_done == NULL)
-               return; /* no mac selected */
-
-       *nic_data->stats_dma_done = FALCON_STATS_NOT_DONE;
+       FALCON_XMAC_STATS_DMA_FLAG(efx) = 0;
        nic_data->stats_pending = true;
        wmb(); /* ensure done flag is clear */
 
@@ -1146,9 +1400,11 @@ static void falcon_stats_complete(struct efx_nic *efx)
                return;
 
        nic_data->stats_pending = false;
-       if (*nic_data->stats_dma_done == FALCON_STATS_DONE) {
+       if (FALCON_XMAC_STATS_DMA_FLAG(efx)) {
                rmb(); /* read the done flag before the stats */
-               falcon_update_stats_xmac(efx);
+               efx_nic_update_stats(falcon_stat_desc, FALCON_STAT_COUNT,
+                                    falcon_stat_mask, nic_data->stats,
+                                    efx->stats_buffer.addr, true);
        } else {
                netif_err(efx, hw, efx->net_dev,
                          "timed out waiting for statistics\n");
@@ -1429,7 +1685,6 @@ static int falcon_probe_port(struct efx_nic *efx)
                  (u64)efx->stats_buffer.dma_addr,
                  efx->stats_buffer.addr,
                  (u64)virt_to_phys(efx->stats_buffer.addr));
-       nic_data->stats_dma_done = efx->stats_buffer.addr + XgDmaDone_offset;
 
        return 0;
 }
@@ -1486,15 +1741,15 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
 {
        struct falcon_nic_data *nic_data = efx->nic_data;
        struct falcon_nvconfig *nvconfig;
-       struct efx_spi_device *spi;
+       struct falcon_spi_device *spi;
        void *region;
        int rc, magic_num, struct_ver;
        __le16 *word, *limit;
        u32 csum;
 
-       if (efx_spi_present(&nic_data->spi_flash))
+       if (falcon_spi_present(&nic_data->spi_flash))
                spi = &nic_data->spi_flash;
-       else if (efx_spi_present(&nic_data->spi_eeprom))
+       else if (falcon_spi_present(&nic_data->spi_eeprom))
                spi = &nic_data->spi_eeprom;
        else
                return -EINVAL;
@@ -1509,7 +1764,7 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
        mutex_unlock(&nic_data->spi_lock);
        if (rc) {
                netif_err(efx, hw, efx->net_dev, "Failed to read %s\n",
-                         efx_spi_present(&nic_data->spi_flash) ?
+                         falcon_spi_present(&nic_data->spi_flash) ?
                          "flash" : "EEPROM");
                rc = -EIO;
                goto out;
@@ -1638,8 +1893,7 @@ static enum reset_type falcon_map_reset_reason(enum reset_type reason)
 {
        switch (reason) {
        case RESET_TYPE_RX_RECOVERY:
-       case RESET_TYPE_RX_DESC_FETCH:
-       case RESET_TYPE_TX_DESC_FETCH:
+       case RESET_TYPE_DMA_ERROR:
        case RESET_TYPE_TX_SKIP:
                /* These can occasionally occur due to hardware bugs.
                 * We try to reset without disrupting the link.
@@ -1854,7 +2108,7 @@ static int falcon_reset_sram(struct efx_nic *efx)
 }
 
 static void falcon_spi_device_init(struct efx_nic *efx,
-                                 struct efx_spi_device *spi_device,
+                                 struct falcon_spi_device *spi_device,
                                  unsigned int device_id, u32 device_type)
 {
        if (device_type != 0) {
@@ -1920,10 +2174,11 @@ out:
        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->tx_dc_base = 0x26000;
+       return 0;
 }
 
 /* Probe all SPI devices on the NIC */
@@ -1970,6 +2225,20 @@ static void falcon_probe_spi_devices(struct efx_nic *efx)
                                       large_eeprom_type);
 }
 
+static unsigned int falcon_a1_mem_map_size(struct efx_nic *efx)
+{
+       return 0x20000;
+}
+
+static unsigned int falcon_b0_mem_map_size(struct efx_nic *efx)
+{
+       /* Map everything up to and including the RSS indirection table.
+        * The PCI core takes care of mapping the MSI-X tables.
+        */
+       return FR_BZ_RX_INDIRECTION_TBL +
+               FR_BZ_RX_INDIRECTION_TBL_STEP * FR_BZ_RX_INDIRECTION_TBL_ROWS;
+}
+
 static int falcon_probe_nic(struct efx_nic *efx)
 {
        struct falcon_nic_data *nic_data;
@@ -2060,6 +2329,8 @@ static int falcon_probe_nic(struct efx_nic *efx)
                goto fail5;
        }
 
+       efx->max_channels = (efx_nic_rev(efx) <= EFX_REV_FALCON_A1 ? 4 :
+                            EFX_MAX_CHANNELS);
        efx->timer_quantum_ns = 4968; /* 621 cycles */
 
        /* Initialise I2C adapter */
@@ -2249,24 +2520,65 @@ static void falcon_remove_nic(struct efx_nic *efx)
        efx->nic_data = NULL;
 }
 
-static void falcon_update_nic_stats(struct efx_nic *efx)
+static size_t falcon_describe_nic_stats(struct efx_nic *efx, u8 *names)
+{
+       return efx_nic_describe_stats(falcon_stat_desc, FALCON_STAT_COUNT,
+                                     falcon_stat_mask, names);
+}
+
+static size_t falcon_update_nic_stats(struct efx_nic *efx, u64 *full_stats,
+                                     struct rtnl_link_stats64 *core_stats)
 {
        struct falcon_nic_data *nic_data = efx->nic_data;
+       u64 *stats = nic_data->stats;
        efx_oword_t cnt;
 
-       if (nic_data->stats_disable_count)
-               return;
+       if (!nic_data->stats_disable_count) {
+               efx_reado(efx, &cnt, FR_AZ_RX_NODESC_DROP);
+               stats[FALCON_STAT_rx_nodesc_drop_cnt] +=
+                       EFX_OWORD_FIELD(cnt, FRF_AB_RX_NODESC_DROP_CNT);
+
+               if (nic_data->stats_pending &&
+                   FALCON_XMAC_STATS_DMA_FLAG(efx)) {
+                       nic_data->stats_pending = false;
+                       rmb(); /* read the done flag before the stats */
+                       efx_nic_update_stats(
+                               falcon_stat_desc, FALCON_STAT_COUNT,
+                               falcon_stat_mask,
+                               stats, efx->stats_buffer.addr, true);
+               }
 
-       efx_reado(efx, &cnt, FR_AZ_RX_NODESC_DROP);
-       efx->n_rx_nodesc_drop_cnt +=
-               EFX_OWORD_FIELD(cnt, FRF_AB_RX_NODESC_DROP_CNT);
+               /* Update derived statistic */
+               efx_update_diff_stat(&stats[FALCON_STAT_rx_bad_bytes],
+                                    stats[FALCON_STAT_rx_bytes] -
+                                    stats[FALCON_STAT_rx_good_bytes] -
+                                    stats[FALCON_STAT_rx_control] * 64);
+       }
 
-       if (nic_data->stats_pending &&
-           *nic_data->stats_dma_done == FALCON_STATS_DONE) {
-               nic_data->stats_pending = false;
-               rmb(); /* read the done flag before the stats */
-               falcon_update_stats_xmac(efx);
+       if (full_stats)
+               memcpy(full_stats, stats, sizeof(u64) * FALCON_STAT_COUNT);
+
+       if (core_stats) {
+               core_stats->rx_packets = stats[FALCON_STAT_rx_packets];
+               core_stats->tx_packets = stats[FALCON_STAT_tx_packets];
+               core_stats->rx_bytes = stats[FALCON_STAT_rx_bytes];
+               core_stats->tx_bytes = stats[FALCON_STAT_tx_bytes];
+               core_stats->rx_dropped = stats[FALCON_STAT_rx_nodesc_drop_cnt];
+               core_stats->multicast = stats[FALCON_STAT_rx_multicast];
+               core_stats->rx_length_errors =
+                       stats[FALCON_STAT_rx_gtjumbo] +
+                       stats[FALCON_STAT_rx_length_error];
+               core_stats->rx_crc_errors = stats[FALCON_STAT_rx_bad];
+               core_stats->rx_frame_errors = stats[FALCON_STAT_rx_align_error];
+               core_stats->rx_fifo_errors = stats[FALCON_STAT_rx_overflow];
+
+               core_stats->rx_errors = (core_stats->rx_length_errors +
+                                        core_stats->rx_crc_errors +
+                                        core_stats->rx_frame_errors +
+                                        stats[FALCON_STAT_rx_symbol_error]);
        }
+
+       return FALCON_STAT_COUNT;
 }
 
 void falcon_start_nic_stats(struct efx_nic *efx)
@@ -2295,7 +2607,7 @@ void falcon_stop_nic_stats(struct efx_nic *efx)
        /* Wait enough time for the most recent transfer to
         * complete. */
        for (i = 0; i < 4 && nic_data->stats_pending; i++) {
-               if (*nic_data->stats_dma_done == FALCON_STATS_DONE)
+               if (FALCON_XMAC_STATS_DMA_FLAG(efx))
                        break;
                msleep(1);
        }
@@ -2339,6 +2651,7 @@ static int falcon_set_wol(struct efx_nic *efx, u32 type)
  */
 
 const struct efx_nic_type falcon_a1_nic_type = {
+       .mem_map_size = falcon_a1_mem_map_size,
        .probe = falcon_probe_nic,
        .remove = falcon_remove_nic,
        .init = falcon_init_nic,
@@ -2354,6 +2667,7 @@ const struct efx_nic_type falcon_a1_nic_type = {
        .fini_dmaq = efx_farch_fini_dmaq,
        .prepare_flush = falcon_prepare_flush,
        .finish_flush = efx_port_dummy_op_void,
+       .describe_stats = falcon_describe_nic_stats,
        .update_stats = falcon_update_nic_stats,
        .start_stats = falcon_start_nic_stats,
        .stop_stats = falcon_stop_nic_stats,
@@ -2390,8 +2704,31 @@ const struct efx_nic_type falcon_a1_nic_type = {
        .ev_read_ack = efx_farch_ev_read_ack,
        .ev_test_generate = efx_farch_ev_test_generate,
 
+       /* We don't expose the filter table on Falcon A1 as it is not
+        * mapped into function 0, but these implementations still
+        * work with a degenerate case of all tables set to size 0.
+        */
+       .filter_table_probe = efx_farch_filter_table_probe,
+       .filter_table_restore = efx_farch_filter_table_restore,
+       .filter_table_remove = efx_farch_filter_table_remove,
+       .filter_insert = efx_farch_filter_insert,
+       .filter_remove_safe = efx_farch_filter_remove_safe,
+       .filter_get_safe = efx_farch_filter_get_safe,
+       .filter_clear_rx = efx_farch_filter_clear_rx,
+       .filter_count_rx_used = efx_farch_filter_count_rx_used,
+       .filter_get_rx_id_limit = efx_farch_filter_get_rx_id_limit,
+       .filter_get_rx_ids = efx_farch_filter_get_rx_ids,
+
+#ifdef CONFIG_SFC_MTD
+       .mtd_probe = falcon_mtd_probe,
+       .mtd_rename = falcon_mtd_rename,
+       .mtd_read = falcon_mtd_read,
+       .mtd_erase = falcon_mtd_erase,
+       .mtd_write = falcon_mtd_write,
+       .mtd_sync = falcon_mtd_sync,
+#endif
+
        .revision = EFX_REV_FALCON_A1,
-       .mem_map_size = 0x20000,
        .txd_ptr_tbl_base = FR_AA_TX_DESC_PTR_TBL_KER,
        .rxd_ptr_tbl_base = FR_AA_RX_DESC_PTR_TBL_KER,
        .buf_tbl_base = FR_AA_BUF_FULL_TBL_KER,
@@ -2401,13 +2738,13 @@ const struct efx_nic_type falcon_a1_nic_type = {
        .rx_buffer_padding = 0x24,
        .can_rx_scatter = false,
        .max_interrupt_mode = EFX_INT_MODE_MSI,
-       .phys_addr_channels = 4,
        .timer_period_max =  1 << FRF_AB_TC_TIMER_VAL_WIDTH,
        .offload_features = NETIF_F_IP_CSUM,
        .mcdi_max_ver = -1,
 };
 
 const struct efx_nic_type falcon_b0_nic_type = {
+       .mem_map_size = falcon_b0_mem_map_size,
        .probe = falcon_probe_nic,
        .remove = falcon_remove_nic,
        .init = falcon_init_nic,
@@ -2423,6 +2760,7 @@ const struct efx_nic_type falcon_b0_nic_type = {
        .fini_dmaq = efx_farch_fini_dmaq,
        .prepare_flush = falcon_prepare_flush,
        .finish_flush = efx_port_dummy_op_void,
+       .describe_stats = falcon_describe_nic_stats,
        .update_stats = falcon_update_nic_stats,
        .start_stats = falcon_start_nic_stats,
        .stop_stats = falcon_stop_nic_stats,
@@ -2459,29 +2797,45 @@ const struct efx_nic_type falcon_b0_nic_type = {
        .ev_process = efx_farch_ev_process,
        .ev_read_ack = efx_farch_ev_read_ack,
        .ev_test_generate = efx_farch_ev_test_generate,
+       .filter_table_probe = efx_farch_filter_table_probe,
+       .filter_table_restore = efx_farch_filter_table_restore,
+       .filter_table_remove = efx_farch_filter_table_remove,
+       .filter_update_rx_scatter = efx_farch_filter_update_rx_scatter,
+       .filter_insert = efx_farch_filter_insert,
+       .filter_remove_safe = efx_farch_filter_remove_safe,
+       .filter_get_safe = efx_farch_filter_get_safe,
+       .filter_clear_rx = efx_farch_filter_clear_rx,
+       .filter_count_rx_used = efx_farch_filter_count_rx_used,
+       .filter_get_rx_id_limit = efx_farch_filter_get_rx_id_limit,
+       .filter_get_rx_ids = efx_farch_filter_get_rx_ids,
+#ifdef CONFIG_RFS_ACCEL
+       .filter_rfs_insert = efx_farch_filter_rfs_insert,
+       .filter_rfs_expire_one = efx_farch_filter_rfs_expire_one,
+#endif
+#ifdef CONFIG_SFC_MTD
+       .mtd_probe = falcon_mtd_probe,
+       .mtd_rename = falcon_mtd_rename,
+       .mtd_read = falcon_mtd_read,
+       .mtd_erase = falcon_mtd_erase,
+       .mtd_write = falcon_mtd_write,
+       .mtd_sync = falcon_mtd_sync,
+#endif
 
        .revision = EFX_REV_FALCON_B0,
-       /* Map everything up to and including the RSS indirection
-        * table.  Don't map MSI-X table, MSI-X PBA since Linux
-        * requires that they not be mapped.  */
-       .mem_map_size = (FR_BZ_RX_INDIRECTION_TBL +
-                        FR_BZ_RX_INDIRECTION_TBL_STEP *
-                        FR_BZ_RX_INDIRECTION_TBL_ROWS),
        .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
        .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL,
        .buf_tbl_base = FR_BZ_BUF_FULL_TBL,
        .evq_ptr_tbl_base = FR_BZ_EVQ_PTR_TBL,
        .evq_rptr_tbl_base = FR_BZ_EVQ_RPTR,
        .max_dma_mask = DMA_BIT_MASK(FSF_AZ_TX_KER_BUF_ADDR_WIDTH),
-       .rx_buffer_hash_size = 0x10,
+       .rx_prefix_size = FS_BZ_RX_PREFIX_SIZE,
+       .rx_hash_offset = FS_BZ_RX_PREFIX_HASH_OFST,
        .rx_buffer_padding = 0,
        .can_rx_scatter = true,
        .max_interrupt_mode = EFX_INT_MODE_MSIX,
-       .phys_addr_channels = 32, /* Hardware limit is 64, but the legacy
-                                  * interrupt handler only supports 32
-                                  * channels */
        .timer_period_max =  1 << FRF_AB_TC_TIMER_VAL_WIDTH,
        .offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE,
        .mcdi_max_ver = -1,
+       .max_rx_ip_filters = FR_BZ_RX_FILTER_TBL0_ROWS,
 };
 
This page took 0.037873 seconds and 5 git commands to generate.