Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-dpaa2-mac-export-standard-statistics'

Ioana Ciornei says:

====================
net: dpaa2-mac: export standard statistics

This patch set adds support for standard ethtool statistics - rmon,
eth-ctrl, eth-mac and pause - to dpaa2-mac and its users dpaa2-eth and
dpaa2-switch.

The first patch extends the firmware APIs related to MAC counters and
adds dpmac_get_statistics() which can be used to retrieve multiple counter
values through a single firmware call.

This new API is put in use in the second patch by gathering all
previously exported ethtool statistics through a single MC firmware
call. In this patch we are also adding the setup and cleanup
infrastructure which will be also used for the standard ethtool
counters.

The third patch adds the actual suppord for rmon, eth-ctrl, eth-mac and
pause statistics in dpaa2-mac and its users.
====================

Link: https://patch.msgid.link/20260323115039.3932600-1-ioana.ciornei@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+638 -43
+60 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2 2 /* Copyright 2014-2016 Freescale Semiconductor Inc. 3 - * Copyright 2016-2022 NXP 3 + * Copyright 2016-2022, 2024-2026 NXP 4 4 */ 5 5 6 6 #include <linux/net_tstamp.h> ··· 938 938 channels->other_count; 939 939 } 940 940 941 + static void 942 + dpaa2_eth_get_rmon_stats(struct net_device *net_dev, 943 + struct ethtool_rmon_stats *rmon_stats, 944 + const struct ethtool_rmon_hist_range **ranges) 945 + { 946 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 947 + 948 + mutex_lock(&priv->mac_lock); 949 + 950 + if (dpaa2_eth_has_mac(priv)) 951 + dpaa2_mac_get_rmon_stats(priv->mac, rmon_stats, ranges); 952 + 953 + mutex_unlock(&priv->mac_lock); 954 + } 955 + 956 + static void dpaa2_eth_get_pause_stats(struct net_device *net_dev, 957 + struct ethtool_pause_stats *pause_stats) 958 + { 959 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 960 + 961 + mutex_lock(&priv->mac_lock); 962 + 963 + if (dpaa2_eth_has_mac(priv)) 964 + dpaa2_mac_get_pause_stats(priv->mac, pause_stats); 965 + 966 + mutex_unlock(&priv->mac_lock); 967 + } 968 + 969 + static void dpaa2_eth_get_ctrl_stats(struct net_device *net_dev, 970 + struct ethtool_eth_ctrl_stats *ctrl_stats) 971 + { 972 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 973 + 974 + mutex_lock(&priv->mac_lock); 975 + 976 + if (dpaa2_eth_has_mac(priv)) 977 + dpaa2_mac_get_ctrl_stats(priv->mac, ctrl_stats); 978 + 979 + mutex_unlock(&priv->mac_lock); 980 + } 981 + 982 + static void 983 + dpaa2_eth_get_eth_mac_stats(struct net_device *net_dev, 984 + struct ethtool_eth_mac_stats *eth_mac_stats) 985 + { 986 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 987 + 988 + mutex_lock(&priv->mac_lock); 989 + 990 + if (dpaa2_eth_has_mac(priv)) 991 + dpaa2_mac_get_eth_mac_stats(priv->mac, eth_mac_stats); 992 + 993 + mutex_unlock(&priv->mac_lock); 994 + } 995 + 941 996 const struct ethtool_ops dpaa2_ethtool_ops = { 942 997 .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | 943 998 ETHTOOL_COALESCE_USE_ADAPTIVE_RX, ··· 1017 962 .get_coalesce = dpaa2_eth_get_coalesce, 1018 963 .set_coalesce = dpaa2_eth_set_coalesce, 1019 964 .get_channels = dpaa2_eth_get_channels, 965 + .get_rmon_stats = dpaa2_eth_get_rmon_stats, 966 + .get_pause_stats = dpaa2_eth_get_pause_stats, 967 + .get_eth_ctrl_stats = dpaa2_eth_get_ctrl_stats, 968 + .get_eth_mac_stats = dpaa2_eth_get_eth_mac_stats, 1020 969 };
+373 -36
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2 - /* Copyright 2019 NXP */ 2 + /* Copyright 2019, 2024-2026 NXP */ 3 3 4 4 #include <linux/acpi.h> 5 5 #include <linux/pcs-lynx.h> ··· 15 15 #define DPMAC_PROTOCOL_CHANGE_VER_MAJOR 4 16 16 #define DPMAC_PROTOCOL_CHANGE_VER_MINOR 8 17 17 18 + #define DPMAC_STATS_BUNDLE_VER_MAJOR 4 19 + #define DPMAC_STATS_BUNDLE_VER_MINOR 10 20 + 21 + #define DPMAC_STANDARD_STATS_VER_MAJOR 4 22 + #define DPMAC_STANDARD_STATS_VER_MINOR 11 23 + 18 24 #define DPAA2_MAC_FEATURE_PROTOCOL_CHANGE BIT(0) 25 + #define DPAA2_MAC_FEATURE_STATS_BUNDLE BIT(1) 26 + #define DPAA2_MAC_FEATURE_STANDARD_STATS BIT(2) 27 + 28 + struct dpmac_counter { 29 + enum dpmac_counter_id id; 30 + size_t offset; 31 + const char *name; 32 + }; 33 + 34 + #define DPMAC_COUNTER(counter_id, struct_name, struct_offset) \ 35 + { \ 36 + .id = counter_id, \ 37 + .offset = offsetof(struct_name, struct_offset), \ 38 + } 39 + 40 + #define DPMAC_UNSTRUCTURED_COUNTER(counter_id, counter_name) \ 41 + { \ 42 + .id = counter_id, \ 43 + .name = counter_name, \ 44 + } 45 + 46 + #define DPMAC_RMON_COUNTER(counter_id, struct_offset) \ 47 + DPMAC_COUNTER(counter_id, struct ethtool_rmon_stats, struct_offset) 48 + 49 + #define DPMAC_PAUSE_COUNTER(counter_id, struct_offset) \ 50 + DPMAC_COUNTER(counter_id, struct ethtool_pause_stats, struct_offset) 51 + 52 + #define DPMAC_CTRL_COUNTER(counter_id, struct_offset) \ 53 + DPMAC_COUNTER(counter_id, struct ethtool_eth_ctrl_stats, struct_offset) 54 + 55 + #define DPMAC_MAC_COUNTER(counter_id, struct_offset) \ 56 + DPMAC_COUNTER(counter_id, struct ethtool_eth_mac_stats, struct_offset) 57 + 58 + static const struct dpmac_counter dpaa2_mac_ethtool_stats[] = { 59 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ALL_FRAME, "[mac] rx all frames"), 60 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_GOOD_FRAME, "[mac] rx frames ok"), 61 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ERR_FRAME, "[mac] rx frame errors"), 62 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_DISCARD, "[mac] rx frame discards"), 63 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_UCAST_FRAME, "[mac] rx u-cast"), 64 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_BCAST_FRAME, "[mac] rx b-cast"), 65 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_MCAST_FRAME, "[mac] rx m-cast"), 66 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_64, "[mac] rx 64 bytes"), 67 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_127, "[mac] rx 65-127 bytes"), 68 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_255, "[mac] rx 128-255 bytes"), 69 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_511, "[mac] rx 256-511 bytes"), 70 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1023, "[mac] rx 512-1023 bytes"), 71 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1518, "[mac] rx 1024-1518 bytes"), 72 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1519_MAX, "[mac] rx 1519-max bytes"), 73 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAG, "[mac] rx frags"), 74 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_JABBER, "[mac] rx jabber"), 75 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ALIGN_ERR, "[mac] rx align errors"), 76 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_OVERSIZED, "[mac] rx oversized"), 77 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_VALID_PAUSE_FRAME, "[mac] rx pause"), 78 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_BYTE, "[mac] rx bytes"), 79 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_GOOD_FRAME, "[mac] tx frames ok"), 80 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_UCAST_FRAME, "[mac] tx u-cast"), 81 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_MCAST_FRAME, "[mac] tx m-cast"), 82 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_BCAST_FRAME, "[mac] tx b-cast"), 83 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_ERR_FRAME, "[mac] tx frame errors"), 84 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_UNDERSIZED, "[mac] tx undersized"), 85 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_VALID_PAUSE_FRAME, "[mac] tx b-pause"), 86 + DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_BYTE, "[mac] tx bytes"), 87 + }; 88 + 89 + #define DPAA2_MAC_NUM_ETHTOOL_STATS ARRAY_SIZE(dpaa2_mac_ethtool_stats) 90 + 91 + static const struct dpmac_counter dpaa2_mac_rmon_stats[] = { 92 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_64, hist[0]), 93 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_127, hist[1]), 94 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_255, hist[2]), 95 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_511, hist[3]), 96 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1023, hist[4]), 97 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1518, hist[5]), 98 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1519_MAX, hist[6]), 99 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_64, hist_tx[0]), 100 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_127, hist_tx[1]), 101 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_255, hist_tx[2]), 102 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_511, hist_tx[3]), 103 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1023, hist_tx[4]), 104 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1518, hist_tx[5]), 105 + DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1519_MAX, hist_tx[6]), 106 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_UNDERSIZED, undersize_pkts), 107 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_OVERSIZED, oversize_pkts), 108 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAG, fragments), 109 + DPMAC_RMON_COUNTER(DPMAC_CNT_ING_JABBER, jabbers), 110 + }; 111 + 112 + #define DPAA2_MAC_NUM_RMON_STATS ARRAY_SIZE(dpaa2_mac_rmon_stats) 113 + 114 + static const struct dpmac_counter dpaa2_mac_pause_stats[] = { 115 + DPMAC_PAUSE_COUNTER(DPMAC_CNT_ING_VALID_PAUSE_FRAME, rx_pause_frames), 116 + DPMAC_PAUSE_COUNTER(DPMAC_CNT_EGR_VALID_PAUSE_FRAME, tx_pause_frames), 117 + }; 118 + 119 + #define DPAA2_MAC_NUM_PAUSE_STATS ARRAY_SIZE(dpaa2_mac_pause_stats) 120 + 121 + static const struct dpmac_counter dpaa2_mac_eth_ctrl_stats[] = { 122 + DPMAC_CTRL_COUNTER(DPMAC_CNT_ING_CONTROL_FRAME, MACControlFramesReceived), 123 + DPMAC_CTRL_COUNTER(DPMAC_CNT_EGR_CONTROL_FRAME, MACControlFramesTransmitted), 124 + }; 125 + 126 + #define DPAA2_MAC_NUM_ETH_CTRL_STATS ARRAY_SIZE(dpaa2_mac_eth_ctrl_stats) 127 + 128 + static const struct dpmac_counter dpaa2_mac_eth_mac_stats[] = { 129 + DPMAC_MAC_COUNTER(DPMAC_CNT_EGR_GOOD_FRAME, FramesTransmittedOK), 130 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_GOOD_FRAME, FramesReceivedOK), 131 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_FCS_ERR, FrameCheckSequenceErrors), 132 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_ALIGN_ERR, AlignmentErrors), 133 + DPMAC_MAC_COUNTER(DPMAC_CNT_EGR_ALL_BYTE, OctetsTransmittedOK), 134 + DPMAC_MAC_COUNTER(DPMAC_CNT_EGR_ERR_FRAME, FramesLostDueToIntMACXmitError), 135 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_ALL_BYTE, OctetsReceivedOK), 136 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_FRAME_DISCARD_NOT_TRUNC, FramesLostDueToIntMACRcvError), 137 + DPMAC_MAC_COUNTER(DPMAC_CNT_EGR_MCAST_FRAME, MulticastFramesXmittedOK), 138 + DPMAC_MAC_COUNTER(DPMAC_CNT_EGR_BCAST_FRAME, BroadcastFramesXmittedOK), 139 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_MCAST_FRAME, MulticastFramesReceivedOK), 140 + DPMAC_MAC_COUNTER(DPMAC_CNT_ING_BCAST_FRAME, BroadcastFramesReceivedOK), 141 + }; 142 + 143 + #define DPAA2_MAC_NUM_ETH_MAC_STATS ARRAY_SIZE(dpaa2_mac_eth_mac_stats) 144 + 145 + static void dpaa2_mac_setup_stats(struct dpaa2_mac *mac, 146 + struct dpaa2_mac_stats *stats, 147 + size_t num_stats, 148 + const struct dpmac_counter *counters) 149 + { 150 + struct device *dev = mac->net_dev->dev.parent; 151 + size_t size_idx, size_values; 152 + __le32 *cnt_idx; 153 + 154 + size_idx = num_stats * sizeof(u32); 155 + stats->idx_dma_mem = dma_alloc_noncoherent(dev, size_idx, 156 + &stats->idx_iova, 157 + DMA_TO_DEVICE, 158 + GFP_KERNEL); 159 + if (!stats->idx_dma_mem) 160 + goto out; 161 + 162 + size_values = num_stats * sizeof(u64); 163 + stats->values_dma_mem = dma_alloc_noncoherent(dev, size_values, 164 + &stats->values_iova, 165 + DMA_FROM_DEVICE, 166 + GFP_KERNEL); 167 + if (!stats->values_dma_mem) 168 + goto err_alloc_values; 169 + 170 + cnt_idx = stats->idx_dma_mem; 171 + for (size_t i = 0; i < num_stats; i++) 172 + *cnt_idx++ = cpu_to_le32((u32)(counters[i].id)); 173 + 174 + dma_sync_single_for_device(dev, stats->idx_iova, size_idx, 175 + DMA_TO_DEVICE); 176 + 177 + return; 178 + 179 + err_alloc_values: 180 + dma_free_noncoherent(dev, num_stats * sizeof(u32), stats->idx_dma_mem, 181 + stats->idx_iova, DMA_TO_DEVICE); 182 + out: 183 + stats->idx_dma_mem = NULL; 184 + stats->values_dma_mem = NULL; 185 + } 186 + 187 + static void dpaa2_mac_clear_stats(struct dpaa2_mac *mac, 188 + struct dpaa2_mac_stats *stats, 189 + size_t num_stats) 190 + { 191 + struct device *dev = mac->net_dev->dev.parent; 192 + 193 + if (stats->idx_dma_mem) { 194 + dma_free_noncoherent(dev, num_stats * sizeof(u32), 195 + stats->idx_dma_mem, 196 + stats->idx_iova, DMA_TO_DEVICE); 197 + stats->idx_dma_mem = NULL; 198 + } 199 + 200 + if (stats->values_dma_mem) { 201 + dma_free_noncoherent(dev, num_stats * sizeof(u64), 202 + stats->values_dma_mem, 203 + stats->values_iova, DMA_FROM_DEVICE); 204 + stats->values_dma_mem = NULL; 205 + } 206 + } 19 207 20 208 static int dpaa2_mac_cmp_ver(struct dpaa2_mac *mac, 21 209 u16 ver_major, u16 ver_minor) ··· 220 32 if (dpaa2_mac_cmp_ver(mac, DPMAC_PROTOCOL_CHANGE_VER_MAJOR, 221 33 DPMAC_PROTOCOL_CHANGE_VER_MINOR) >= 0) 222 34 mac->features |= DPAA2_MAC_FEATURE_PROTOCOL_CHANGE; 35 + 36 + if (dpaa2_mac_cmp_ver(mac, DPMAC_STATS_BUNDLE_VER_MAJOR, 37 + DPMAC_STATS_BUNDLE_VER_MINOR) >= 0) 38 + mac->features |= DPAA2_MAC_FEATURE_STATS_BUNDLE; 39 + 40 + if (dpaa2_mac_cmp_ver(mac, DPMAC_STANDARD_STATS_VER_MAJOR, 41 + DPMAC_STANDARD_STATS_VER_MINOR) >= 0) 42 + mac->features |= DPAA2_MAC_FEATURE_STANDARD_STATS; 223 43 } 224 44 225 45 static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode) ··· 700 504 mac->fw_node = fw_node; 701 505 net_dev->dev.of_node = to_of_node(mac->fw_node); 702 506 507 + if (mac->features & DPAA2_MAC_FEATURE_STATS_BUNDLE) 508 + dpaa2_mac_setup_stats(mac, &mac->ethtool_stats, 509 + DPAA2_MAC_NUM_ETHTOOL_STATS, 510 + dpaa2_mac_ethtool_stats); 511 + 512 + if (mac->features & DPAA2_MAC_FEATURE_STANDARD_STATS) { 513 + dpaa2_mac_setup_stats(mac, &mac->rmon_stats, 514 + DPAA2_MAC_NUM_RMON_STATS, 515 + dpaa2_mac_rmon_stats); 516 + 517 + dpaa2_mac_setup_stats(mac, &mac->pause_stats, 518 + DPAA2_MAC_NUM_PAUSE_STATS, 519 + dpaa2_mac_pause_stats); 520 + 521 + dpaa2_mac_setup_stats(mac, &mac->eth_ctrl_stats, 522 + DPAA2_MAC_NUM_ETH_CTRL_STATS, 523 + dpaa2_mac_eth_ctrl_stats); 524 + 525 + dpaa2_mac_setup_stats(mac, &mac->eth_mac_stats, 526 + DPAA2_MAC_NUM_ETH_MAC_STATS, 527 + dpaa2_mac_eth_mac_stats); 528 + } 529 + 703 530 return 0; 704 531 705 532 err_close_dpmac: ··· 734 515 { 735 516 struct fsl_mc_device *dpmac_dev = mac->mc_dev; 736 517 518 + if (mac->features & DPAA2_MAC_FEATURE_STATS_BUNDLE) 519 + dpaa2_mac_clear_stats(mac, &mac->ethtool_stats, 520 + DPAA2_MAC_NUM_ETHTOOL_STATS); 521 + 522 + if (mac->features & DPAA2_MAC_FEATURE_STANDARD_STATS) { 523 + dpaa2_mac_clear_stats(mac, &mac->rmon_stats, 524 + DPAA2_MAC_NUM_RMON_STATS); 525 + dpaa2_mac_clear_stats(mac, &mac->pause_stats, 526 + DPAA2_MAC_NUM_PAUSE_STATS); 527 + dpaa2_mac_clear_stats(mac, &mac->eth_ctrl_stats, 528 + DPAA2_MAC_NUM_ETH_CTRL_STATS); 529 + dpaa2_mac_clear_stats(mac, &mac->eth_mac_stats, 530 + DPAA2_MAC_NUM_ETH_MAC_STATS); 531 + } 532 + 737 533 dpmac_close(mac->mc_io, 0, dpmac_dev->mc_handle); 738 534 if (mac->fw_node) 739 535 fwnode_handle_put(mac->fw_node); 740 536 } 741 537 742 - static char dpaa2_mac_ethtool_stats[][ETH_GSTRING_LEN] = { 743 - [DPMAC_CNT_ING_ALL_FRAME] = "[mac] rx all frames", 744 - [DPMAC_CNT_ING_GOOD_FRAME] = "[mac] rx frames ok", 745 - [DPMAC_CNT_ING_ERR_FRAME] = "[mac] rx frame errors", 746 - [DPMAC_CNT_ING_FRAME_DISCARD] = "[mac] rx frame discards", 747 - [DPMAC_CNT_ING_UCAST_FRAME] = "[mac] rx u-cast", 748 - [DPMAC_CNT_ING_BCAST_FRAME] = "[mac] rx b-cast", 749 - [DPMAC_CNT_ING_MCAST_FRAME] = "[mac] rx m-cast", 750 - [DPMAC_CNT_ING_FRAME_64] = "[mac] rx 64 bytes", 751 - [DPMAC_CNT_ING_FRAME_127] = "[mac] rx 65-127 bytes", 752 - [DPMAC_CNT_ING_FRAME_255] = "[mac] rx 128-255 bytes", 753 - [DPMAC_CNT_ING_FRAME_511] = "[mac] rx 256-511 bytes", 754 - [DPMAC_CNT_ING_FRAME_1023] = "[mac] rx 512-1023 bytes", 755 - [DPMAC_CNT_ING_FRAME_1518] = "[mac] rx 1024-1518 bytes", 756 - [DPMAC_CNT_ING_FRAME_1519_MAX] = "[mac] rx 1519-max bytes", 757 - [DPMAC_CNT_ING_FRAG] = "[mac] rx frags", 758 - [DPMAC_CNT_ING_JABBER] = "[mac] rx jabber", 759 - [DPMAC_CNT_ING_ALIGN_ERR] = "[mac] rx align errors", 760 - [DPMAC_CNT_ING_OVERSIZED] = "[mac] rx oversized", 761 - [DPMAC_CNT_ING_VALID_PAUSE_FRAME] = "[mac] rx pause", 762 - [DPMAC_CNT_ING_BYTE] = "[mac] rx bytes", 763 - [DPMAC_CNT_EGR_GOOD_FRAME] = "[mac] tx frames ok", 764 - [DPMAC_CNT_EGR_UCAST_FRAME] = "[mac] tx u-cast", 765 - [DPMAC_CNT_EGR_MCAST_FRAME] = "[mac] tx m-cast", 766 - [DPMAC_CNT_EGR_BCAST_FRAME] = "[mac] tx b-cast", 767 - [DPMAC_CNT_EGR_ERR_FRAME] = "[mac] tx frame errors", 768 - [DPMAC_CNT_EGR_UNDERSIZED] = "[mac] tx undersized", 769 - [DPMAC_CNT_EGR_VALID_PAUSE_FRAME] = "[mac] tx b-pause", 770 - [DPMAC_CNT_EGR_BYTE] = "[mac] tx bytes", 538 + static void dpaa2_mac_transfer_stats(const struct dpmac_counter *counters, 539 + size_t num_counters, void *s, 540 + __le64 *cnt_values) 541 + { 542 + for (size_t i = 0; i < num_counters; i++) { 543 + u64 *p = s + counters[i].offset; 544 + 545 + *p = le64_to_cpu(cnt_values[i]); 546 + } 547 + } 548 + 549 + static const struct ethtool_rmon_hist_range dpaa2_mac_rmon_ranges[] = { 550 + { 64, 64 }, 551 + { 65, 127 }, 552 + { 128, 255 }, 553 + { 256, 511 }, 554 + { 512, 1023 }, 555 + { 1024, 1518 }, 556 + { 1519, DPAA2_ETH_MFL }, 557 + {}, 771 558 }; 772 559 773 - #define DPAA2_MAC_NUM_STATS ARRAY_SIZE(dpaa2_mac_ethtool_stats) 560 + static void dpaa2_mac_get_standard_stats(struct dpaa2_mac *mac, 561 + struct dpaa2_mac_stats *stats, 562 + size_t num_cnt, 563 + const struct dpmac_counter *counters, 564 + void *s) 565 + { 566 + struct device *dev = mac->net_dev->dev.parent; 567 + struct fsl_mc_device *dpmac_dev = mac->mc_dev; 568 + size_t values_size = num_cnt * sizeof(u64); 569 + int err; 570 + 571 + if (!(mac->features & DPAA2_MAC_FEATURE_STANDARD_STATS)) 572 + return; 573 + 574 + if (!stats->idx_dma_mem || !stats->values_dma_mem) 575 + return; 576 + 577 + dma_sync_single_for_device(dev, stats->values_iova, values_size, 578 + DMA_FROM_DEVICE); 579 + 580 + err = dpmac_get_statistics(mac->mc_io, 0, dpmac_dev->mc_handle, 581 + stats->idx_iova, stats->values_iova, 582 + num_cnt); 583 + if (err) { 584 + netdev_err(mac->net_dev, "%s: dpmac_get_statistics() = %d\n", 585 + __func__, err); 586 + return; 587 + } 588 + 589 + dma_sync_single_for_cpu(dev, stats->values_iova, values_size, 590 + DMA_FROM_DEVICE); 591 + 592 + dpaa2_mac_transfer_stats(counters, num_cnt, s, stats->values_dma_mem); 593 + } 594 + 595 + void dpaa2_mac_get_rmon_stats(struct dpaa2_mac *mac, 596 + struct ethtool_rmon_stats *s, 597 + const struct ethtool_rmon_hist_range **ranges) 598 + { 599 + if (s->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE) 600 + return; 601 + 602 + dpaa2_mac_get_standard_stats(mac, &mac->rmon_stats, 603 + DPAA2_MAC_NUM_RMON_STATS, 604 + dpaa2_mac_rmon_stats, s); 605 + 606 + *ranges = dpaa2_mac_rmon_ranges; 607 + } 608 + 609 + void dpaa2_mac_get_pause_stats(struct dpaa2_mac *mac, 610 + struct ethtool_pause_stats *s) 611 + { 612 + if (s->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE) 613 + return; 614 + 615 + dpaa2_mac_get_standard_stats(mac, &mac->pause_stats, 616 + DPAA2_MAC_NUM_PAUSE_STATS, 617 + dpaa2_mac_pause_stats, s); 618 + } 619 + 620 + void dpaa2_mac_get_ctrl_stats(struct dpaa2_mac *mac, 621 + struct ethtool_eth_ctrl_stats *s) 622 + { 623 + if (s->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE) 624 + return; 625 + 626 + dpaa2_mac_get_standard_stats(mac, &mac->eth_ctrl_stats, 627 + DPAA2_MAC_NUM_ETH_CTRL_STATS, 628 + dpaa2_mac_eth_ctrl_stats, s); 629 + } 630 + 631 + void dpaa2_mac_get_eth_mac_stats(struct dpaa2_mac *mac, 632 + struct ethtool_eth_mac_stats *s) 633 + { 634 + if (s->src != ETHTOOL_MAC_STATS_SRC_AGGREGATE) 635 + return; 636 + 637 + dpaa2_mac_get_standard_stats(mac, &mac->eth_mac_stats, 638 + DPAA2_MAC_NUM_ETH_MAC_STATS, 639 + dpaa2_mac_eth_mac_stats, s); 640 + } 774 641 775 642 int dpaa2_mac_get_sset_count(void) 776 643 { 777 - return DPAA2_MAC_NUM_STATS; 644 + return DPAA2_MAC_NUM_ETHTOOL_STATS; 778 645 } 779 646 780 647 void dpaa2_mac_get_strings(u8 **data) 781 648 { 782 649 int i; 783 650 784 - for (i = 0; i < DPAA2_MAC_NUM_STATS; i++) 785 - ethtool_puts(data, dpaa2_mac_ethtool_stats[i]); 651 + for (i = 0; i < DPAA2_MAC_NUM_ETHTOOL_STATS; i++) 652 + ethtool_puts(data, dpaa2_mac_ethtool_stats[i].name); 786 653 } 787 654 788 655 void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data) 789 656 { 657 + size_t values_size = DPAA2_MAC_NUM_ETHTOOL_STATS * sizeof(u64); 658 + struct device *dev = mac->net_dev->dev.parent; 790 659 struct fsl_mc_device *dpmac_dev = mac->mc_dev; 660 + __le64 *cnt_values; 791 661 int i, err; 792 662 u64 value; 793 663 794 - for (i = 0; i < DPAA2_MAC_NUM_STATS; i++) { 664 + if (!(mac->features & DPAA2_MAC_FEATURE_STATS_BUNDLE)) 665 + goto fallback; 666 + 667 + if (!mac->ethtool_stats.idx_dma_mem || 668 + !mac->ethtool_stats.values_dma_mem) 669 + goto fallback; 670 + 671 + dma_sync_single_for_device(dev, mac->ethtool_stats.values_iova, 672 + values_size, DMA_FROM_DEVICE); 673 + 674 + err = dpmac_get_statistics(mac->mc_io, 0, dpmac_dev->mc_handle, 675 + mac->ethtool_stats.idx_iova, 676 + mac->ethtool_stats.values_iova, 677 + DPAA2_MAC_NUM_ETHTOOL_STATS); 678 + if (err) 679 + goto fallback; 680 + 681 + dma_sync_single_for_cpu(dev, mac->ethtool_stats.values_iova, 682 + values_size, DMA_FROM_DEVICE); 683 + 684 + cnt_values = mac->ethtool_stats.values_dma_mem; 685 + for (i = 0; i < DPAA2_MAC_NUM_ETHTOOL_STATS; i++) 686 + *(data + i) = le64_to_cpu(*cnt_values++); 687 + 688 + return; 689 + 690 + fallback: 691 + 692 + /* Fallback and retrieve each counter one by one */ 693 + for (i = 0; i < DPAA2_MAC_NUM_ETHTOOL_STATS; i++) { 795 694 err = dpmac_get_counter(mac->mc_io, 0, dpmac_dev->mc_handle, 796 - i, &value); 695 + dpaa2_mac_ethtool_stats[i].id, &value); 797 696 if (err) { 798 697 netdev_err_once(mac->net_dev, 799 698 "dpmac_get_counter error %d\n", err);
+26 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 - /* Copyright 2019 NXP */ 2 + /* Copyright 2019, 2024-2026 NXP */ 3 3 #ifndef DPAA2_MAC_H 4 4 #define DPAA2_MAC_H 5 5 ··· 10 10 11 11 #include "dpmac.h" 12 12 #include "dpmac-cmd.h" 13 + 14 + struct dpaa2_mac_stats { 15 + __le32 *idx_dma_mem; 16 + __le64 *values_dma_mem; 17 + dma_addr_t idx_iova, values_iova; 18 + }; 13 19 14 20 struct dpaa2_mac { 15 21 struct fsl_mc_device *mc_dev; ··· 34 28 struct fwnode_handle *fw_node; 35 29 36 30 struct phy *serdes_phy; 31 + 32 + struct dpaa2_mac_stats ethtool_stats; 33 + struct dpaa2_mac_stats rmon_stats; 34 + struct dpaa2_mac_stats pause_stats; 35 + struct dpaa2_mac_stats eth_ctrl_stats; 36 + struct dpaa2_mac_stats eth_mac_stats; 37 37 }; 38 38 39 39 static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac) ··· 64 52 void dpaa2_mac_get_strings(u8 **data); 65 53 66 54 void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data); 55 + 56 + void dpaa2_mac_get_rmon_stats(struct dpaa2_mac *mac, 57 + struct ethtool_rmon_stats *s, 58 + const struct ethtool_rmon_hist_range **ranges); 59 + 60 + void dpaa2_mac_get_pause_stats(struct dpaa2_mac *mac, 61 + struct ethtool_pause_stats *s); 62 + 63 + void dpaa2_mac_get_ctrl_stats(struct dpaa2_mac *mac, 64 + struct ethtool_eth_ctrl_stats *s); 65 + 66 + void dpaa2_mac_get_eth_mac_stats(struct dpaa2_mac *mac, 67 + struct ethtool_eth_mac_stats *s); 67 68 68 69 void dpaa2_mac_start(struct dpaa2_mac *mac); 69 70
+47 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
··· 3 3 * DPAA2 Ethernet Switch ethtool support 4 4 * 5 5 * Copyright 2014-2016 Freescale Semiconductor Inc. 6 - * Copyright 2017-2018 NXP 6 + * Copyright 2017-2018, 2024-2026 NXP 7 7 * 8 8 */ 9 9 ··· 210 210 mutex_unlock(&port_priv->mac_lock); 211 211 } 212 212 213 + static void 214 + dpaa2_switch_get_rmon_stats(struct net_device *netdev, 215 + struct ethtool_rmon_stats *rmon_stats, 216 + const struct ethtool_rmon_hist_range **ranges) 217 + { 218 + struct ethsw_port_priv *port_priv = netdev_priv(netdev); 219 + 220 + mutex_lock(&port_priv->mac_lock); 221 + 222 + if (dpaa2_switch_port_has_mac(port_priv)) 223 + dpaa2_mac_get_rmon_stats(port_priv->mac, rmon_stats, ranges); 224 + 225 + mutex_unlock(&port_priv->mac_lock); 226 + } 227 + 228 + static void 229 + dpaa2_switch_get_ctrl_stats(struct net_device *net_dev, 230 + struct ethtool_eth_ctrl_stats *ctrl_stats) 231 + { 232 + struct ethsw_port_priv *port_priv = netdev_priv(net_dev); 233 + 234 + mutex_lock(&port_priv->mac_lock); 235 + 236 + if (dpaa2_switch_port_has_mac(port_priv)) 237 + dpaa2_mac_get_ctrl_stats(port_priv->mac, ctrl_stats); 238 + 239 + mutex_unlock(&port_priv->mac_lock); 240 + } 241 + 242 + static void 243 + dpaa2_switch_get_eth_mac_stats(struct net_device *net_dev, 244 + struct ethtool_eth_mac_stats *eth_mac_stats) 245 + { 246 + struct ethsw_port_priv *port_priv = netdev_priv(net_dev); 247 + 248 + mutex_lock(&port_priv->mac_lock); 249 + 250 + if (dpaa2_switch_port_has_mac(port_priv)) 251 + dpaa2_mac_get_eth_mac_stats(port_priv->mac, eth_mac_stats); 252 + 253 + mutex_unlock(&port_priv->mac_lock); 254 + } 255 + 213 256 const struct ethtool_ops dpaa2_switch_port_ethtool_ops = { 214 257 .get_drvinfo = dpaa2_switch_get_drvinfo, 215 258 .get_link = ethtool_op_get_link, ··· 261 218 .get_strings = dpaa2_switch_ethtool_get_strings, 262 219 .get_ethtool_stats = dpaa2_switch_ethtool_get_stats, 263 220 .get_sset_count = dpaa2_switch_ethtool_get_sset_count, 221 + .get_rmon_stats = dpaa2_switch_get_rmon_stats, 222 + .get_eth_ctrl_stats = dpaa2_switch_get_ctrl_stats, 223 + .get_eth_mac_stats = dpaa2_switch_get_eth_mac_stats, 264 224 };
+10 -1
drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 2 /* Copyright 2013-2016 Freescale Semiconductor Inc. 3 - * Copyright 2019 NXP 3 + * Copyright 2019, 2024-2026 NXP 4 4 */ 5 5 #ifndef _FSL_DPMAC_CMD_H 6 6 #define _FSL_DPMAC_CMD_H ··· 27 27 #define DPMAC_CMDID_GET_COUNTER DPMAC_CMD(0x0c4) 28 28 29 29 #define DPMAC_CMDID_SET_PROTOCOL DPMAC_CMD(0x0c7) 30 + 31 + #define DPMAC_CMDID_GET_STATISTICS DPMAC_CMD(0x0c8) 30 32 31 33 /* Macros for accessing command fields smaller than 1byte */ 32 34 #define DPMAC_MASK(field) \ ··· 84 82 struct dpmac_cmd_set_protocol { 85 83 u8 eth_if; 86 84 }; 85 + 86 + struct dpmac_cmd_get_statistics { 87 + __le64 iova_cnt; 88 + __le64 iova_values; 89 + __le32 num_cnt; 90 + }; 91 + 87 92 #endif /* _FSL_DPMAC_CMD_H */
+30 -1
drivers/net/ethernet/freescale/dpaa2/dpmac.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2 2 /* Copyright 2013-2016 Freescale Semiconductor Inc. 3 - * Copyright 2019 NXP 3 + * Copyright 2019, 2024-2026 NXP 4 4 */ 5 5 #include <linux/fsl/mc.h> 6 6 #include "dpmac.h" ··· 232 232 cmd_flags, token); 233 233 cmd_params = (struct dpmac_cmd_set_protocol *)cmd.params; 234 234 cmd_params->eth_if = protocol; 235 + 236 + return mc_send_command(mc_io, &cmd); 237 + } 238 + 239 + /** 240 + * dpmac_get_statistics() - Get MAC statistics 241 + * @mc_io: Pointer to opaque I/O object 242 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 243 + * @token: Token of DPMAC object 244 + * @iova_cnt: IOVA containing the requested MAC counters formatted as an 245 + * array of __le32 representing the dpmac_counter_id. 246 + * @iova_values: IOVA containing the values for all the requested counters 247 + * formatted as an array of __le64. 248 + * @num_cnt: Number of counters requested 249 + * 250 + * Return: '0' on Success; Error code otherwise. 251 + */ 252 + int dpmac_get_statistics(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 253 + u64 iova_cnt, u64 iova_values, u32 num_cnt) 254 + { 255 + struct dpmac_cmd_get_statistics *cmd_params; 256 + struct fsl_mc_command cmd = { 0 }; 257 + 258 + cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_STATISTICS, 259 + cmd_flags, token); 260 + cmd_params = (struct dpmac_cmd_get_statistics *)cmd.params; 261 + cmd_params->iova_cnt = cpu_to_le64(iova_cnt); 262 + cmd_params->iova_values = cpu_to_le64(iova_values); 263 + cmd_params->num_cnt = cpu_to_le32(num_cnt); 235 264 236 265 return mc_send_command(mc_io, &cmd); 237 266 }
+92 -2
drivers/net/ethernet/freescale/dpaa2/dpmac.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 2 /* Copyright 2013-2016 Freescale Semiconductor Inc. 3 - * Copyright 2019 NXP 3 + * Copyright 2019, 2024-2026 NXP 4 4 */ 5 5 #ifndef __FSL_DPMAC_H 6 6 #define __FSL_DPMAC_H ··· 170 170 * pause frames. 171 171 * @DPMAC_CNT_EGR_GOOD_FRAME: counts frames transmitted without error, including 172 172 * pause frames. 173 + * @DPMAC_CNT_EGR_FRAME_64: counts transmitted 64-bytes frames, good or bad. 174 + * @DPMAC_CNT_EGR_FRAME_127: counts transmitted 65 to 127-bytes frames, good or 175 + * bad. 176 + * @DPMAC_CNT_EGR_FRAME_255: counts transmitted 128 to 255-bytes frames, good 177 + * or bad. 178 + * @DPMAC_CNT_EGR_FRAME_511: counts transmitted 256 to 511-bytes frames, good 179 + * or bad. 180 + * @DPMAC_CNT_EGR_FRAME_1023: counts transmitted 512 to 1023-bytes frames, good 181 + * or bad. 182 + * @DPMAC_CNT_EGR_FRAME_1518: counts transmitted 1024 to 1518-bytes frames, 183 + * good or bad. 184 + * @DPMAC_CNT_EGR_FRAME_1519_MAX: counts transmitted 1519-bytes frames and 185 + * larger (up to max frame length specified), 186 + * good or bad. 187 + * @DPMAC_CNT_ING_ALL_BYTE: counts bytes received in both good and bad packets 188 + * @DPMAC_CNT_ING_FCS_ERR: counts frames received with a CRC-32 error but the 189 + * frame is otherwise of correct length 190 + * @DPMAC_CNT_ING_VLAN_FRAME: counts the received VLAN tagged frames which are 191 + * valid. 192 + * @DPMAC_CNT_ING_UNDERSIZED: counts received frames which were less than 64 193 + * bytes long and with a good CRC. 194 + * @DPMAC_CNT_ING_CONTROL_FRAME: counts received control frames (type 0x8808) 195 + * but not pause frames. 196 + * @DPMAC_CNT_ING_FRAME_DISCARD_NOT_TRUNC: counts the fully dropped frames (not 197 + * truncated) due to internal errors of 198 + * the MAC client. Occurs when a 199 + * receive FIFO overflows. 200 + * @DPMAC_CNT_EGR_ALL_BYTE: counts transmitted bytes in both good and bad 201 + * packets. 202 + * @DPMAC_CNT_EGR_FCS_ERR: counts trasmitted frames with a CRC-32 error except 203 + * for underflows. 204 + * @DPMAC_CNT_EGR_VLAN_FRAME: counts the transmitted VLAN tagged frames which 205 + * are valid. 206 + * @DPMAC_CNT_EGR_ALL_FRAME: counts all trasmitted frames, good or bad. 207 + * @DPMAC_CNT_EGR_CONTROL_FRAME: counts transmitted control frames (type 208 + * 0x8808) but not pause frames. 209 + * @DPMAC_CNT_ING_PFC0: number of PFC frames received for class 0. 210 + * @DPMAC_CNT_ING_PFC1: number of PFC frames received for class 1. 211 + * @DPMAC_CNT_ING_PFC2: number of PFC frames received for class 2. 212 + * @DPMAC_CNT_ING_PFC3: number of PFC frames received for class 3. 213 + * @DPMAC_CNT_ING_PFC4: number of PFC frames received for class 4. 214 + * @DPMAC_CNT_ING_PFC5: number of PFC frames received for class 5. 215 + * @DPMAC_CNT_ING_PFC6: number of PFC frames received for class 6. 216 + * @DPMAC_CNT_ING_PFC7: number of PFC frames received for class 7. 217 + * @DPMAC_CNT_EGR_PFC0: number of PFC frames transmitted for class 0. 218 + * @DPMAC_CNT_EGR_PFC1: number of PFC frames transmitted for class 1. 219 + * @DPMAC_CNT_EGR_PFC2: number of PFC frames transmitted for class 2. 220 + * @DPMAC_CNT_EGR_PFC3: number of PFC frames transmitted for class 3. 221 + * @DPMAC_CNT_EGR_PFC4: number of PFC frames transmitted for class 4. 222 + * @DPMAC_CNT_EGR_PFC5: number of PFC frames transmitted for class 5. 223 + * @DPMAC_CNT_EGR_PFC6: number of PFC frames transmitted for class 6. 224 + * @DPMAC_CNT_EGR_PFC7: number of PFC frames transmitted for class 7. 173 225 */ 174 226 enum dpmac_counter_id { 175 227 DPMAC_CNT_ING_FRAME_64, ··· 251 199 DPMAC_CNT_EGR_UCAST_FRAME, 252 200 DPMAC_CNT_EGR_ERR_FRAME, 253 201 DPMAC_CNT_ING_GOOD_FRAME, 254 - DPMAC_CNT_EGR_GOOD_FRAME 202 + DPMAC_CNT_EGR_GOOD_FRAME, 203 + DPMAC_CNT_EGR_FRAME_64, 204 + DPMAC_CNT_EGR_FRAME_127, 205 + DPMAC_CNT_EGR_FRAME_255, 206 + DPMAC_CNT_EGR_FRAME_511, 207 + DPMAC_CNT_EGR_FRAME_1023, 208 + DPMAC_CNT_EGR_FRAME_1518, 209 + DPMAC_CNT_EGR_FRAME_1519_MAX, 210 + DPMAC_CNT_ING_ALL_BYTE, 211 + DPMAC_CNT_ING_FCS_ERR, 212 + DPMAC_CNT_ING_VLAN_FRAME, 213 + DPMAC_CNT_ING_UNDERSIZED, 214 + DPMAC_CNT_ING_CONTROL_FRAME, 215 + DPMAC_CNT_ING_FRAME_DISCARD_NOT_TRUNC, 216 + DPMAC_CNT_EGR_ALL_BYTE, 217 + DPMAC_CNT_EGR_FCS_ERR, 218 + DPMAC_CNT_EGR_VLAN_FRAME, 219 + DPMAC_CNT_EGR_ALL_FRAME, 220 + DPMAC_CNT_EGR_CONTROL_FRAME, 221 + DPMAC_CNT_ING_PFC0, 222 + DPMAC_CNT_ING_PFC1, 223 + DPMAC_CNT_ING_PFC2, 224 + DPMAC_CNT_ING_PFC3, 225 + DPMAC_CNT_ING_PFC4, 226 + DPMAC_CNT_ING_PFC5, 227 + DPMAC_CNT_ING_PFC6, 228 + DPMAC_CNT_ING_PFC7, 229 + DPMAC_CNT_EGR_PFC0, 230 + DPMAC_CNT_EGR_PFC1, 231 + DPMAC_CNT_EGR_PFC2, 232 + DPMAC_CNT_EGR_PFC3, 233 + DPMAC_CNT_EGR_PFC4, 234 + DPMAC_CNT_EGR_PFC5, 235 + DPMAC_CNT_EGR_PFC6, 236 + DPMAC_CNT_EGR_PFC7, 255 237 }; 256 238 257 239 int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, ··· 296 210 297 211 int dpmac_set_protocol(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 298 212 enum dpmac_eth_if protocol); 213 + 214 + int dpmac_get_statistics(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 215 + u64 iova_cnt, u64 iova_values, u32 num_cnt); 216 + 299 217 #endif /* __FSL_DPMAC_H */