V_01-00-17

1. Added M3 SRAM Debug counters to ethtool statistics.
2. Added MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.
This commit is contained in:
TC956X 2021-10-19 17:03:41 +09:00 committed by jianzhou
parent f5792b1dd5
commit ec5b1e771c
6 changed files with 206 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# Toshiba Electronic Devices & Storage Corporation TC956X PCIe Ethernet Host Driver
Release Date: 14 Oct 2021
Release Date: 19 Oct 2021
Release Version: V_01-00-16 : Limited-tested version
Release Version: V_01-00-17 : Limited-tested version
TC956X PCIe EMAC driver is based on "Fedora 30, kernel-5.4.19".
@ -249,3 +249,8 @@ Default Configuraton:
1. Configuring pause frame control using kernel module parameter also forwarding only Link partner pause frames to Application and filtering PHY pause frames using FRP.
2. Returning error on disabling Receive Flow Control via ethtool for speed other than 10G in XFI mode.
## TC956X_Host_Driver_20211019_V_01-00-17:
1. Added M3 SRAM Debug counters to ethtool statistics.
2. Added MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.

View File

@ -48,6 +48,9 @@
* VERSION : 01-00-14
* 14 Oct 2021 : 1. Moving common Macros to common header file
* VERSION : 01-00-16
* 19 Oct 2021 : 1. Adding M3 SRAM Debug counters to ethtool statistics
* 2. Adding MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.
* VERSION : 01-00-17
*/
#ifndef __COMMON_H__
@ -1223,6 +1226,33 @@ struct tc956xmac_extra_stats {
u64 xpcs_intr_n;
u64 phy_intr_n;
u64 sw_msi_n;
/*MTL Debug counters */
u64 mtl_tx_underflow[MTL_MAX_TX_QUEUES];
u64 mtl_rx_miss_pkt_cnt[MTL_MAX_RX_QUEUES];
u64 mtl_rx_overflow_pkt_cnt[MTL_MAX_RX_QUEUES];
u64 rxch_watchdog_timer[TC956XMAC_CH_MAX];
/*m3 SRAM debug counters */
u64 m3_debug_cnt0;
u64 m3_debug_cnt1;
u64 m3_debug_cnt2;
u64 m3_debug_cnt3;
u64 m3_debug_cnt4;
u64 m3_debug_cnt5;
u64 m3_debug_cnt6;
u64 m3_debug_cnt7;
u64 m3_debug_cnt8;
u64 m3_debug_cnt9;
u64 m3_debug_cnt10;
u64 m3_watchdog_exp_cnt;
u64 m3_watchdog_monitor_cnt;
u64 m3_debug_cnt13;
u64 m3_debug_cnt14;
u64 m3_systick_cnt_upper_value;
u64 m3_systick_cnt_lower_value;
u64 m3_tx_timeout_port0;
u64 m3_tx_timeout_port1;
u64 m3_debug_cnt19;
};

View File

@ -39,6 +39,9 @@
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
* VERSION : 01-00-13
* 19 Oct 2021 : 1. Adding M3 SRAM Debug counters to ethtool statistics
* 2. Adding MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.
* VERSION : 01-00-17
*/
@ -427,6 +430,10 @@
#define XGMAC_TXQEN GENMASK(3, 2)
#define XGMAC_TXQEN_SHIFT 2
#define XGMAC_TSF BIT(1)
#define XGMAC_MTL_TXQ_UF_OFFSET(x) (MAC_OFFSET + (0x00001104 + (0x80 * (x))))
#define XGMAC_MTL_UFPKTCNT_MASK GENMASK(10, 0)
#define XGMAC_MTL_TXQ_UFPKT_CNT(x) ((XGMAC_MTL_TXQ_UF_OFFSET(x)) & XGMAC_MTL_UFPKTCNT_MASK)
#define XGMAC_MTL_TXQ_Debug(x) (MAC_OFFSET + (0x00001108 + (0x80 * (x))))
#define XGMAC_MTL_DEBUG_TXQSTS BIT(4)
#define XGMAC_MTL_DEBUG_TWCSTS BIT(3)
@ -454,6 +461,11 @@
#define XGMAC_RSF BIT(5)
#define XGMAC_RTC GENMASK(1, 0)
#define XGMAC_RTC_SHIFT 0
#define XGMAC_MTL_RXQ_MISS_PKT_OF_CNT_OFFSET(x) (MAC_OFFSET + 0x00001144 + (0x80 * (x)))
#define XGMAC_OVFPKTCNT_MASK GENMASK(10, 0)
#define XGMAC_MISPKTCNT_MASK GENMASK(26, 16)
#define XGMAC_MISPKTCNT_SHIFT 16
#define XGMAC_MTL_RXQ_Debug(x) (0x00001148 + (0x80 * (x)))
#define XGMAC_MTL_DEBUG_RXQSTS_MASK GENMASK(5, 4)
#define XGMAC_MTL_DEBUG_RXQSTS_SHIFT 4

View File

@ -69,6 +69,8 @@
: 2. Configuring pause frame control using kernel module parameter also forwarding
* only Link partner pause frames to Application and filtering PHY pause frames using FRP
* VERSION : 01-00-16
* 19 Oct 2021 : 1. Version update
* VERSION : 01-00-17
*/
#include <linux/clk-provider.h>
@ -101,7 +103,7 @@ static unsigned int tc956x_port1_interface = ENABLE_SGMII_INTERFACE;
unsigned int tc956x_port0_filter_phy_pause_frames = DISABLE;
unsigned int tc956x_port1_filter_phy_pause_frames = DISABLE;
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 1, 6};
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 1, 7};
/*
* This struct is used to associate PCI Function of MAC controller on a board,

View File

@ -68,6 +68,10 @@
* VERSION : 01-00-15
* 14 Oct 2021 : 1. Version update
* VERSION : 01-00-16
* 19 Oct 2021 : 1. Adding M3 SRAM Debug counters to ethtool statistics
* : 2. Adding MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.
* : 3. Version update
* VERSION : 01-00-17
*/
#ifndef __TC956XMAC_H__
@ -116,7 +120,7 @@
#ifdef TC956X
#define TC956X_RESOURCE_NAME "tc956x_pci-eth"
#define DRV_MODULE_VERSION "V_01-00-16"
#define DRV_MODULE_VERSION "V_01-00-17"
#define TC956X_FW_MAX_SIZE (64*1024)
#define ATR_AXI4_SLV_BASE 0x0800
@ -172,6 +176,30 @@
#endif
#define TC956X_M3_SRAM_FW_VER_OFFSET 0x4F900 /* DMEM addrs 0x2000F900 */
/* M3 Debug Counters in SRAM*/
#define TC956X_M3_SRAM_DEBUG_CNTS_OFFSET 0x4F800 /* DMEM addrs 0x2000F800 */
#define DB_CNT_LEN 4 /* Size of each debug counter in bytes */
#define DB_CNT0 0 /* reserved0 */
#define DB_CNT1 1 /* reserved1 */
#define DB_CNT2 2 /* reserved2 */
#define DB_CNT3 3 /* reserved3 */
#define DB_CNT4 4 /* reserved4 */
#define DB_CNT5 5 /* reserved5 */
#define DB_CNT6 6 /* reserved6 */
#define DB_CNT7 7 /* reserved7 */
#define DB_CNT8 8 /* reserved8 */
#define DB_CNT9 9 /* reserved9 */
#define DB_CNT10 10 /* reserved10 */
#define DB_CNT11 11 /* m3 watchdog expiry count*/
#define DB_CNT12 12 /* m3 watchdog monitor value */
#define DB_CNT13 13 /* reserved13 */
#define DB_CNT14 14 /* reserved14 */
#define DB_CNT15 15 /* m3 systick counter lower 32bits */
#define DB_CNT16 16 /* m3 systick counter upper 32bits */
#define DB_CNT17 17 /* m3 transmission timeout indication for port0 */
#define DB_CNT18 18 /* m3 transmission timeout indication for port1 */
#define DB_CNT19 19 /* reserved19 */
#define NRSTCTRL0_RST_ASRT 0x1
#define NRSTCTRL0_RST_DE_ASRT 0x3

View File

@ -38,6 +38,9 @@
* VERSION : 01-00-02
* 14 Oct 2021 : 1. Returning error on disabling Receive Flow Control via ethtool for speed other than 10G in XFI mode.
* VERSION : 01-00-16
* 19 Oct 2021 : 1. Adding M3 SRAM Debug counters to ethtool statistics
* 2. Adding MTL RX Overflow/packet miss count, TX underflow counts,Rx Watchdog value to ethtool statistics.
* VERSION : 01-00-17
*/
#include <linux/etherdevice.h>
@ -605,6 +608,59 @@ static const struct tc956xmac_stats tc956xmac_gstrings_stats[] = {
TC956XMAC_STAT(xpcs_intr_n),
TC956XMAC_STAT(phy_intr_n),
TC956XMAC_STAT(sw_msi_n),
TC956XMAC_STAT(mtl_tx_underflow[0]),
TC956XMAC_STAT(mtl_tx_underflow[1]),
TC956XMAC_STAT(mtl_tx_underflow[3]),
TC956XMAC_STAT(mtl_tx_underflow[4]),
TC956XMAC_STAT(mtl_tx_underflow[5]),
TC956XMAC_STAT(mtl_tx_underflow[6]),
TC956XMAC_STAT(mtl_tx_underflow[7]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[0]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[1]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[3]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[4]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[5]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[6]),
TC956XMAC_STAT(mtl_rx_miss_pkt_cnt[7]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[0]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[1]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[3]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[4]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[5]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[6]),
TC956XMAC_STAT(mtl_rx_overflow_pkt_cnt[7]),
TC956XMAC_STAT(rxch_watchdog_timer[0]),
TC956XMAC_STAT(rxch_watchdog_timer[1]),
TC956XMAC_STAT(rxch_watchdog_timer[2]),
TC956XMAC_STAT(rxch_watchdog_timer[3]),
TC956XMAC_STAT(rxch_watchdog_timer[4]),
TC956XMAC_STAT(rxch_watchdog_timer[5]),
TC956XMAC_STAT(rxch_watchdog_timer[6]),
TC956XMAC_STAT(rxch_watchdog_timer[7]),
TC956XMAC_STAT(m3_debug_cnt0),
TC956XMAC_STAT(m3_debug_cnt1),
TC956XMAC_STAT(m3_debug_cnt2),
TC956XMAC_STAT(m3_debug_cnt3),
TC956XMAC_STAT(m3_debug_cnt4),
TC956XMAC_STAT(m3_debug_cnt5),
TC956XMAC_STAT(m3_debug_cnt6),
TC956XMAC_STAT(m3_debug_cnt7),
TC956XMAC_STAT(m3_debug_cnt8),
TC956XMAC_STAT(m3_debug_cnt9),
TC956XMAC_STAT(m3_debug_cnt10),
TC956XMAC_STAT(m3_watchdog_exp_cnt),
TC956XMAC_STAT(m3_watchdog_monitor_cnt),
TC956XMAC_STAT(m3_debug_cnt13),
TC956XMAC_STAT(m3_debug_cnt14),
TC956XMAC_STAT(m3_systick_cnt_upper_value),
TC956XMAC_STAT(m3_systick_cnt_lower_value),
TC956XMAC_STAT(m3_tx_timeout_port0),
TC956XMAC_STAT(m3_tx_timeout_port1),
TC956XMAC_STAT(m3_debug_cnt19),
};
#define TC956XMAC_STATS_LEN ARRAY_SIZE(tc956xmac_gstrings_stats)
@ -988,6 +1044,74 @@ tc956xmac_set_pauseparam(struct net_device *netdev,
priv->pause, tx_cnt);
return 0;
}
static void tc956xmac_m3fw_stats_read(struct tc956xmac_priv *priv)
{
u32 rx_queues_count = priv->plat->rx_queues_to_use;
u32 tx_queues_count = priv->plat->tx_queues_to_use;
u32 chno, reg_val=0;
for (chno = 0; chno < tx_queues_count; chno++) {
/* Tx Underflow count may not match with actual value, as it is 11bit value
accumulation happening only when reading ethool statistics, not after overflow of counter*/
priv->xstats.mtl_tx_underflow[chno] +=
readl(priv->ioaddr + XGMAC_MTL_TXQ_UFPKT_CNT(chno));
}
for (chno = 0; chno < rx_queues_count; chno++) {
/* Rx overflow/missed pkt count may not match with actual values, as these are 11bit values
accumulation happening only when reading ethool statistics, not after overflow of counters*/
reg_val = readl(priv->ioaddr + XGMAC_MTL_RXQ_MISS_PKT_OF_CNT_OFFSET(chno));
priv->xstats.mtl_rx_miss_pkt_cnt[chno] += ((reg_val & XGMAC_MISPKTCNT_MASK) >>
XGMAC_MISPKTCNT_SHIFT);
priv->xstats.mtl_rx_overflow_pkt_cnt[chno] += (reg_val & XGMAC_OVFPKTCNT_MASK);
priv->xstats.rxch_watchdog_timer[chno] =
readl(priv->ioaddr + XGMAC_DMA_CH_Rx_WATCHDOG(chno));
}
/* Reading M3 Debug Counters*/
priv->xstats.m3_debug_cnt0 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT0 )));
priv->xstats.m3_debug_cnt1 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT1 )));
priv->xstats.m3_debug_cnt2 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT2 )));
priv->xstats.m3_debug_cnt3 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT3 )));
priv->xstats.m3_debug_cnt4 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT4 )));
priv->xstats.m3_debug_cnt5 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT5 )));
priv->xstats.m3_debug_cnt6 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT6 )));
priv->xstats.m3_debug_cnt7 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT7 )));
priv->xstats.m3_debug_cnt8 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT8 )));
priv->xstats.m3_debug_cnt9 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT9 )));
priv->xstats.m3_debug_cnt10 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT10 )));
priv->xstats.m3_watchdog_exp_cnt = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT11 )));
priv->xstats.m3_watchdog_monitor_cnt = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT12 )));
priv->xstats.m3_debug_cnt13 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT13 )));
priv->xstats.m3_debug_cnt14 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT14 )));
priv->xstats.m3_systick_cnt_upper_value = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT16 )));
priv->xstats.m3_systick_cnt_lower_value = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT15 )));
priv->xstats.m3_tx_timeout_port0 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT17 )));
priv->xstats.m3_tx_timeout_port1 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT18 )));
priv->xstats.m3_debug_cnt19 = readl(priv->tc956x_SRAM_pci_base_addr +
(TC956X_M3_SRAM_DEBUG_CNTS_OFFSET + (DB_CNT_LEN * DB_CNT19 )));
}
static void tc956xmac_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *dummy, u64 *data)
@ -1040,6 +1164,7 @@ static void tc956xmac_get_ethtool_stats(struct net_device *dev,
tc956xmac_dma_desc_stats(priv, priv->ioaddr);
}
}
tc956xmac_m3fw_stats_read(priv);
for (i = 0; i < TC956XMAC_STATS_LEN; i++) {
char *p = (char *)priv + tc956xmac_gstrings_stats[i].stat_offset;