mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
igc: add support to get frame preemption statistics via ethtool
Implemented "ethtool --include-statistics --show-mm" callback for IGC.
Tested preemption scenario to check preemption statistics:
1) Trigger verification handshake on both boards:
$ sudo ethtool --set-mm enp1s0 pmac-enabled on
$ sudo ethtool --set-mm enp1s0 tx-enabled on
$ sudo ethtool --set-mm enp1s0 verify-enabled on
2) Set preemptible or express queue in taprio for tx board:
$ sudo tc qdisc replace dev enp1s0 parent root handle 100 taprio \
num_tc 4 map 3 2 1 0 3 3 3 3 3 3 3 3 3 3 3 3 \
queues 1@0 1@1 1@2 1@3 base-time 0 sched-entry S F 100000 \
fp E E P P
3) Send large size packets on preemptible queue
4) Send small size packets on express queue to preempt packets in
preemptible queue
5) Show preemption statistics on the receiving board:
$ ethtool --include-statistics --show-mm enp1s0
MAC Merge layer state for enp1s0:
pMAC enabled: on
TX enabled: on
TX active: on
TX minimum fragment size: 64
RX minimum fragment size: 60
Verify enabled: on
Verify time: 128
Max verify time: 128
Verification status: SUCCEEDED
Statistics:
MACMergeFrameAssErrorCount: 0
MACMergeFrameSmdErrorCount: 0
MACMergeFrameAssOkCount: 511
MACMergeFragCountRx: 764
MACMergeFragCountTx: 0
MACMergeHoldCount: 0
Co-developed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Co-developed-by: Chwee-Lin Choong <chwee.lin.choong@intel.com>
Signed-off-by: Chwee-Lin Choong <chwee.lin.choong@intel.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>
Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
10e2ffe10e
commit
f05ce73cc3
|
|
@ -1819,6 +1819,46 @@ static int igc_ethtool_set_mm(struct net_device *netdev,
|
|||
return igc_tsn_offload_apply(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* igc_ethtool_get_frame_ass_error - Get the frame assembly error count.
|
||||
* @reg_value: Register value for IGC_PRMEXCPRCNT
|
||||
* Return: The count of frame assembly errors.
|
||||
*/
|
||||
static u64 igc_ethtool_get_frame_ass_error(u32 reg_value)
|
||||
{
|
||||
/* Out of order statistics */
|
||||
u32 ooo_frame_cnt, ooo_frag_cnt;
|
||||
u32 miss_frame_frag_cnt;
|
||||
|
||||
ooo_frame_cnt = FIELD_GET(IGC_PRMEXCPRCNT_OOO_FRAME_CNT, reg_value);
|
||||
ooo_frag_cnt = FIELD_GET(IGC_PRMEXCPRCNT_OOO_FRAG_CNT, reg_value);
|
||||
miss_frame_frag_cnt = FIELD_GET(IGC_PRMEXCPRCNT_MISS_FRAME_FRAG_CNT,
|
||||
reg_value);
|
||||
|
||||
return ooo_frame_cnt + ooo_frag_cnt + miss_frame_frag_cnt;
|
||||
}
|
||||
|
||||
static u64 igc_ethtool_get_frame_smd_error(u32 reg_value)
|
||||
{
|
||||
return FIELD_GET(IGC_PRMEXCPRCNT_OOO_SMDC, reg_value);
|
||||
}
|
||||
|
||||
static void igc_ethtool_get_mm_stats(struct net_device *dev,
|
||||
struct ethtool_mm_stats *stats)
|
||||
{
|
||||
struct igc_adapter *adapter = netdev_priv(dev);
|
||||
struct igc_hw *hw = &adapter->hw;
|
||||
u32 reg_value;
|
||||
|
||||
reg_value = rd32(IGC_PRMEXCPRCNT);
|
||||
|
||||
stats->MACMergeFrameAssErrorCount = igc_ethtool_get_frame_ass_error(reg_value);
|
||||
stats->MACMergeFrameSmdErrorCount = igc_ethtool_get_frame_smd_error(reg_value);
|
||||
stats->MACMergeFrameAssOkCount = rd32(IGC_PRMPTDRCNT);
|
||||
stats->MACMergeFragCountRx = rd32(IGC_PRMEVNTRCNT);
|
||||
stats->MACMergeFragCountTx = rd32(IGC_PRMEVNTTCNT);
|
||||
}
|
||||
|
||||
static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
{
|
||||
|
|
@ -2115,6 +2155,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
|
|||
.set_link_ksettings = igc_ethtool_set_link_ksettings,
|
||||
.self_test = igc_ethtool_diag_test,
|
||||
.get_mm = igc_ethtool_get_mm,
|
||||
.get_mm_stats = igc_ethtool_get_mm_stats,
|
||||
.set_mm = igc_ethtool_set_mm,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,6 +222,22 @@
|
|||
|
||||
#define IGC_FTQF(_n) (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */
|
||||
|
||||
/* Time sync registers - preemption statistics */
|
||||
#define IGC_PRMPTDRCNT 0x04284 /* Good RX Preempted Packets */
|
||||
#define IGC_PRMEVNTTCNT 0x04298 /* TX Preemption event counter */
|
||||
#define IGC_PRMEVNTRCNT 0x0429C /* RX Preemption event counter */
|
||||
|
||||
/* Preemption Exception Counter */
|
||||
#define IGC_PRMEXCPRCNT 0x42A0
|
||||
/* Received out of order packets with SMD-C */
|
||||
#define IGC_PRMEXCPRCNT_OOO_SMDC 0x000000FF
|
||||
/* Received out of order packets with SMD-C and wrong Frame CNT */
|
||||
#define IGC_PRMEXCPRCNT_OOO_FRAME_CNT 0x0000FF00
|
||||
/* Received out of order packets with SMD-C and wrong Frag CNT */
|
||||
#define IGC_PRMEXCPRCNT_OOO_FRAG_CNT 0x00FF0000
|
||||
/* Received packets with SMD-S and wrong Frag CNT and Frame CNT */
|
||||
#define IGC_PRMEXCPRCNT_MISS_FRAME_FRAG_CNT 0xFF000000
|
||||
|
||||
/* Transmit Scheduling Registers */
|
||||
#define IGC_TQAVCTRL 0x3570
|
||||
#define IGC_TXQCTL(_n) (0x3344 + 0x4 * (_n))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user