Skip to content

Commit

Permalink
net: lan743x: Add set RFE read fifo threshold for PCI1x1x chips
Browse files Browse the repository at this point in the history
[ Upstream commit e4a5898 ]

PCI11x1x Rev B0 devices might drop packets when receiving back to back frames
at 2.5G link speed. Change the B0 Rev device's Receive filtering Engine FIFO
threshold parameter from its hardware default of 4 to 3 dwords to prevent the
problem. Rev C0 and later hardware already defaults to 3 dwords.

Fixes: bb4f6bf ("net: lan743x: Add PCI11010 / PCI11414 device IDs")
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240326065805.686128-1-Raju.Lakkaraju@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
lakkarajun authored and gregkh committed Apr 10, 2024
1 parent 889c0c2 commit 0b95aad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/net/ethernet/microchip/lan743x_main.c
Expand Up @@ -25,6 +25,8 @@
#define PCS_POWER_STATE_DOWN 0x6
#define PCS_POWER_STATE_UP 0x4

#define RFE_RD_FIFO_TH_3_DWORDS 0x3

static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
{
u32 chip_rev;
Expand Down Expand Up @@ -3272,6 +3274,21 @@ static void lan743x_full_cleanup(struct lan743x_adapter *adapter)
lan743x_pci_cleanup(adapter);
}

static void pci11x1x_set_rfe_rd_fifo_threshold(struct lan743x_adapter *adapter)
{
u16 rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;

if (rev == ID_REV_CHIP_REV_PCI11X1X_B0_) {
u32 misc_ctl;

misc_ctl = lan743x_csr_read(adapter, MISC_CTL_0);
misc_ctl &= ~MISC_CTL_0_RFE_READ_FIFO_MASK_;
misc_ctl |= FIELD_PREP(MISC_CTL_0_RFE_READ_FIFO_MASK_,
RFE_RD_FIFO_TH_3_DWORDS);
lan743x_csr_write(adapter, MISC_CTL_0, misc_ctl);
}
}

static int lan743x_hardware_init(struct lan743x_adapter *adapter,
struct pci_dev *pdev)
{
Expand All @@ -3287,6 +3304,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
pci11x1x_strap_get_status(adapter);
spin_lock_init(&adapter->eth_syslock_spinlock);
mutex_init(&adapter->sgmii_rw_lock);
pci11x1x_set_rfe_rd_fifo_threshold(adapter);
} else {
adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/microchip/lan743x_main.h
Expand Up @@ -26,6 +26,7 @@
#define ID_REV_CHIP_REV_MASK_ (0x0000FFFF)
#define ID_REV_CHIP_REV_A0_ (0x00000000)
#define ID_REV_CHIP_REV_B0_ (0x00000010)
#define ID_REV_CHIP_REV_PCI11X1X_B0_ (0x000000B0)

#define FPGA_REV (0x04)
#define FPGA_REV_GET_MINOR_(fpga_rev) (((fpga_rev) >> 8) & 0x000000FF)
Expand Down Expand Up @@ -311,6 +312,9 @@
#define SGMII_CTL_LINK_STATUS_SOURCE_ BIT(8)
#define SGMII_CTL_SGMII_POWER_DN_ BIT(1)

#define MISC_CTL_0 (0x920)
#define MISC_CTL_0_RFE_READ_FIFO_MASK_ GENMASK(6, 4)

/* Vendor Specific SGMII MMD details */
#define SR_VSMMD_PCS_ID1 0x0004
#define SR_VSMMD_PCS_ID2 0x0005
Expand Down

0 comments on commit 0b95aad

Please sign in to comment.