V_01-00-31

1. Support for link partner pause frame counting.
2. Module parameter support to enable/disable link partner pause frame counting.
This commit is contained in:
TC956X 2021-12-10 18:57:05 +05:30 committed by jianzhou
parent a5e807500a
commit 8d5c1f128e
6 changed files with 70 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Toshiba Electronic Devices & Storage Corporation TC956X PCIe Ethernet Host Driver
Release Date: 08 Dec 2021
Release Date: 10 Dec 2021
Release Version: V_01-00-30 : Limited-tested version
Release Version: V_01-00-31 : Limited-tested version
TC956X PCIe EMAC driver is based on "Fedora 30, kernel-5.4.19".
@ -242,6 +242,17 @@ TC956X PCIe EMAC driver is based on "Fedora 30, kernel-5.4.19".
Note:
1. Please configure flow control thresholds (RFD & RFA) as per Queue size (Default values are for Default Queue size which is 18KB).
15. Please use the below command to insert the kernel module for counting Link partner pause frames and output to ethtool:
#insmod tc956x_pcie_eth.ko mac0_en_lp_pause_frame_cnt=x mac1_en_lp_pause_frame_cnt=x
argument info:
mac0_en_lp_pause_frame_cnt: For PORT0
mac1_en_lp_pause_frame_cnt: For PORT1
x = [0: DISABLE (default), 1: ENABLE]
If invalid values are passed as kernel module parameter, the default value will be selected.
Note: It is required to enable kernel module parameter "mac0_filter_phy_pause/mac1_filter_phy_pause" along with this module parameter to count link partner pause frames.
# Release Versions:
## TC956X_Host_Driver_20210326_V_01-00:
@ -396,3 +407,8 @@ TC956X PCIe EMAC driver is based on "Fedora 30, kernel-5.4.19".
1. Added module parameters for Rx Queue Size, Flow Control thresholds and Tx Queue Size configuration.
2. Renamed all module parameters for easy readability.
## TC956X_Host_Driver_20211210_V_01-00-31:
1. Support for link partner pause frame counting.
2. Module parameter support to enable/disable link partner pause frame counting.

View File

@ -67,6 +67,8 @@
* VERSION : 01-00-24
* 08 Dec 2021 : 1. Added Macro for Maximum Tx, Rx Queue Size and byte size.
* VERSION : 01-00-30
* 10 Dec 2021 : 1. Added link partner pause frame count debug counters to ethtool statistics.
* VERSION : 01-00-31
*/
#ifndef __COMMON_H__
@ -1303,6 +1305,7 @@ struct tc956xmac_extra_stats {
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];
u64 link_partner_pause_frame_cnt;
/*m3 SRAM debug counters */
u64 m3_debug_cnt0;

View File

@ -110,6 +110,9 @@
3. Printing User Configured/Default Module Parameters for future purpose.
4. Version update.
* VERSION : 01-00-30
* 10 Dec 2021 : 1. Added Module parameter to count Link partner pause frames and output to ethtool.
2. Version update.
* VERSION : 01-00-31
*/
#include <linux/clk-provider.h>
@ -165,7 +168,10 @@ static unsigned int mac1_rxq1_rfa = 24;
static unsigned int mac1_txq0_size = TX_QUEUE0_SIZE;
static unsigned int mac1_txq1_size = TX_QUEUE1_SIZE;
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 3, 0};
unsigned int mac0_en_lp_pause_frame_cnt = DISABLE;
unsigned int mac1_en_lp_pause_frame_cnt = DISABLE;
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 3, 1};
static int tc956xmac_pm_usage_counter; /* Device Usage Counter */
struct mutex tc956x_pm_suspend_lock; /* This mutex is shared between all available EMAC ports. */
@ -2215,6 +2221,7 @@ static int tc956xmac_pci_probe(struct pci_dev *pdev,
NMSGPR_INFO(&pdev->dev, "mac0_rxq1_rfa = %d \n", mac0_rxq1_rfa);
NMSGPR_INFO(&pdev->dev, "mac0_txq0_size = %d \n", mac0_txq0_size);
NMSGPR_INFO(&pdev->dev, "mac0_txq1_size = %d \n", mac0_txq1_size);
NMSGPR_INFO(&pdev->dev, "mac0_en_lp_pause_frame_cnt = %d \n", mac0_en_lp_pause_frame_cnt);
} else if (plat->port_num == RM_PF1_ID) {
NMSGPR_INFO(&pdev->dev, "mac1_interface = %d \n", mac1_interface);
NMSGPR_INFO(&pdev->dev, "mac1_eee_enable = %d \n", mac1_eee_enable);
@ -2228,6 +2235,7 @@ static int tc956xmac_pci_probe(struct pci_dev *pdev,
NMSGPR_INFO(&pdev->dev, "mac1_rxq1_rfa = %d \n", mac1_rxq1_rfa);
NMSGPR_INFO(&pdev->dev, "mac1_txq0_size = %d \n", mac1_txq0_size);
NMSGPR_INFO(&pdev->dev, "mac1_txq1_size = %d \n", mac1_txq1_size);
NMSGPR_INFO(&pdev->dev, "mac1_en_lp_pause_frame_cnt = %d \n", mac1_en_lp_pause_frame_cnt);
}
if (res.port_num == RM_PF0_ID) {
@ -3376,6 +3384,16 @@ MODULE_PARM_DESC(mac1_txq1_size,
"Tx Queue-1 size of Port 1 - default is 18432 (bytes),\
[Range Supported : 3072..44032 (bytes)]");
module_param(mac0_en_lp_pause_frame_cnt, uint, 0444);
MODULE_PARM_DESC(mac0_en_lp_pause_frame_cnt,
"Enable counter to count Link Partner pause frames in PORT0 - default is 0,\
[0: DISABLE, 1: ENABLE]");
module_param(mac1_en_lp_pause_frame_cnt, uint, 0444);
MODULE_PARM_DESC(mac1_en_lp_pause_frame_cnt,
"Enable counter to count Link Partner pause frames in PORT1 - default is 0,\
[0: DISABLE, 1: ENABLE]");
MODULE_DESCRIPTION("TC956X PCI Express Ethernet Network Driver");
MODULE_AUTHOR("Toshiba Electronic Devices & Storage Corporation");
MODULE_LICENSE("GPL v2");

View File

@ -104,6 +104,8 @@
* VERSION : 01-00-29
* 08 Dec 2021 : 1. Version update
* VERSION : 01-00-30
* 10 Dec 2021 : 1. Version update
* VERSION : 01-00-31
*/
#ifndef __TC956XMAC_H__
@ -156,7 +158,7 @@
#ifdef TC956X
#define TC956X_RESOURCE_NAME "tc956x_pci-eth"
#define DRV_MODULE_VERSION "V_01-00-30"
#define DRV_MODULE_VERSION "V_01-00-31"
#define TC956X_FW_MAX_SIZE (64*1024)
#define ATR_AXI4_SLV_BASE 0x0800

View File

@ -45,7 +45,9 @@
* VERSION : 01-00-19
* 24 Nov 2021 : 1. EEE update for runtime configuration through ethtool.
2. ethtool driver name display corrected
* VERSION : 01-00-24
* VERSION : 01-00-24
* 10 Dec 2021 : 1. Added link partner pause frame count debug counters to ethtool statistics.
* VERSION : 01-00-31
*/
#include <linux/etherdevice.h>
@ -645,6 +647,7 @@ static const struct tc956xmac_stats tc956xmac_gstrings_stats[] = {
TC956XMAC_STAT(rxch_watchdog_timer[5]),
TC956XMAC_STAT(rxch_watchdog_timer[6]),
TC956XMAC_STAT(rxch_watchdog_timer[7]),
TC956XMAC_STAT(link_partner_pause_frame_cnt),
TC956XMAC_STAT(m3_debug_cnt0),
TC956XMAC_STAT(m3_debug_cnt1),

View File

@ -83,6 +83,8 @@
* VERSION : 01-00-29
* 08 Dec 2021 : 1. Added Module parameter for Rx & Tx Queue Size configuration.
* VERSION : 01-00-30
* 10 Dec 2021 : 1. Added Module parameter to count Link partner pause frames and output to ethtool.
* VERSION : 01-00-31
*/
#include <linux/clk.h>
@ -237,6 +239,14 @@ static uint16_t mdio_bus_id;
#define CONFIG_PARAM_NUM ARRAY_SIZE(config_param_list)
int tc956xmac_rx_parser_configuration(struct tc956xmac_priv *);
/* Source Address in Pause frame from PHY */
static u8 phy_sa_addr[2][6] = {
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}, /*For Port-0*/
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}, /*For Port-1*/
};
extern unsigned int mac0_en_lp_pause_frame_cnt;
extern unsigned int mac1_en_lp_pause_frame_cnt;
/**
* tc956x_GPIO_OutputConfigPin - to configure GPIO as output and write the value
* @priv: driver private structure
@ -5405,6 +5415,7 @@ static int tc956xmac_rx(struct tc956xmac_priv *priv, int limit, u32 queue)
int status = 0, coe = priv->hw->rx_csum;
unsigned int next_entry = rx_q->cur_rx;
struct sk_buff *skb = NULL;
unsigned int proto;
if (netif_msg_rx_status(priv)) {
void *rx_head;
@ -5547,6 +5558,18 @@ static int tc956xmac_rx(struct tc956xmac_priv *priv, int limit, u32 queue)
continue;
/* Got entire packet into SKB. Finish it. */
/* Pause frame counter to count link partner pause frames */
if ((mac0_en_lp_pause_frame_cnt == ENABLE && priv->port_num == RM_PF0_ID) ||
(mac1_en_lp_pause_frame_cnt == ENABLE && priv->port_num == RM_PF1_ID)) {
proto = htons(((skb->data[13]<<8) | skb->data[12]));
if (proto == ETH_P_PAUSE) {
if(!(skb->data[6] == phy_sa_addr[priv->port_num][0] && skb->data[7] == phy_sa_addr[priv->port_num][1]
&& skb->data[8] == phy_sa_addr[priv->port_num][2] && skb->data[9] == phy_sa_addr[priv->port_num][3]
&& skb->data[10] == phy_sa_addr[priv->port_num][4] && skb->data[11] == phy_sa_addr[priv->port_num][5])) {
priv->xstats.link_partner_pause_frame_cnt++;
}
}
}
tc956xmac_get_rx_hwtstamp(priv, p, np, skb);
#ifndef TC956X