Lines Matching refs:sparx5
201 static void sparx5_get_queue_sys_stats(struct sparx5 *sparx5, int portno) in sparx5_get_queue_sys_stats() argument
208 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_queue_sys_stats()
209 mutex_lock(&sparx5->queue_stats_lock); in sparx5_get_queue_sys_stats()
210 spx5_wr(XQS_STAT_CFG_STAT_VIEW_SET(portno), sparx5, XQS_STAT_CFG); in sparx5_get_queue_sys_stats()
214 sparx5_update_counter(stats, spx5_rd(sparx5, XQS_CNT(addr))); in sparx5_get_queue_sys_stats()
218 sparx5_update_counter(stats, spx5_rd(sparx5, XQS_CNT(addr))); in sparx5_get_queue_sys_stats()
222 sparx5_update_counter(stats, spx5_rd(sparx5, XQS_CNT(addr))); in sparx5_get_queue_sys_stats()
224 spx5_rd(sparx5, XQS_CNT(32))); in sparx5_get_queue_sys_stats()
226 spx5_rd(sparx5, XQS_CNT(272))); in sparx5_get_queue_sys_stats()
227 mutex_unlock(&sparx5->queue_stats_lock); in sparx5_get_queue_sys_stats()
230 static void sparx5_get_ana_ac_stats_stats(struct sparx5 *sparx5, int portno) in sparx5_get_ana_ac_stats_stats() argument
232 u64 *portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_ana_ac_stats_stats()
235 spx5_rd(sparx5, ANA_AC_PORT_STAT_LSB_CNT(portno, in sparx5_get_ana_ac_stats_stats()
505 static void sparx5_get_device_stats(struct sparx5 *sparx5, int portno) in sparx5_get_device_stats() argument
507 u64 *portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_device_stats()
512 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_device_stats()
788 static void sparx5_get_asm_stats(struct sparx5 *sparx5, int portno) in sparx5_get_asm_stats() argument
790 u64 *portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_asm_stats()
791 void __iomem *inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_asm_stats()
815 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_eth_phy_stats() local
820 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_eth_phy_stats()
825 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_eth_phy_stats()
828 inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_eth_phy_stats()
840 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_eth_mac_stats() local
845 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_eth_mac_stats()
850 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_eth_mac_stats()
853 inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_eth_mac_stats()
908 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_eth_mac_ctrl_stats() local
913 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_eth_mac_ctrl_stats()
918 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_eth_mac_ctrl_stats()
921 inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_eth_mac_ctrl_stats()
940 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_eth_rmon_stats() local
945 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_eth_rmon_stats()
950 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_eth_rmon_stats()
953 inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_eth_rmon_stats()
998 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_sset_count() local
1002 return sparx5->num_ethtool_stats; in sparx5_get_sset_count()
1008 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_sset_strings() local
1014 for (idx = 0; idx < sparx5->num_ethtool_stats; idx++) in sparx5_get_sset_strings()
1015 ethtool_puts(&data, sparx5->stats_layout[idx]); in sparx5_get_sset_strings()
1022 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_sset_data() local
1028 portstats = &sparx5->stats[portno * sparx5->num_stats]; in sparx5_get_sset_data()
1033 inst = spx5_inst_get(sparx5, dev, tinst); in sparx5_get_sset_data()
1036 inst = spx5_inst_get(sparx5, TARGET_ASM, 0); in sparx5_get_sset_data()
1039 sparx5_get_ana_ac_stats_stats(sparx5, portno); in sparx5_get_sset_data()
1040 sparx5_get_queue_sys_stats(sparx5, portno); in sparx5_get_sset_data()
1044 sparx5->num_ethtool_stats; idx++) in sparx5_get_sset_data()
1052 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_stats64() local
1056 if (!sparx5->stats) in sparx5_get_stats64()
1059 portstats = &sparx5->stats[port->portno * sparx5->num_stats]; in sparx5_get_stats64()
1111 static void sparx5_update_port_stats(struct sparx5 *sparx5, int portno) in sparx5_update_port_stats() argument
1113 if (sparx5_is_baser(sparx5->ports[portno]->conf.portmode)) in sparx5_update_port_stats()
1114 sparx5_get_device_stats(sparx5, portno); in sparx5_update_port_stats()
1116 sparx5_get_asm_stats(sparx5, portno); in sparx5_update_port_stats()
1117 sparx5_get_ana_ac_stats_stats(sparx5, portno); in sparx5_update_port_stats()
1118 sparx5_get_queue_sys_stats(sparx5, portno); in sparx5_update_port_stats()
1121 static void sparx5_update_stats(struct sparx5 *sparx5) in sparx5_update_stats() argument
1126 if (sparx5->ports[idx]) in sparx5_update_stats()
1127 sparx5_update_port_stats(sparx5, idx); in sparx5_update_stats()
1133 struct sparx5 *sparx5 = container_of(dwork, in sparx5_check_stats_work() local
1134 struct sparx5, in sparx5_check_stats_work()
1137 sparx5_update_stats(sparx5); in sparx5_check_stats_work()
1139 queue_delayed_work(sparx5->stats_queue, &sparx5->stats_work, in sparx5_check_stats_work()
1159 static void sparx5_config_stats(struct sparx5 *sparx5) in sparx5_config_stats() argument
1164 sparx5, in sparx5_config_stats()
1168 static void sparx5_config_port_stats(struct sparx5 *sparx5, int portno) in sparx5_config_port_stats() argument
1172 XQS_STAT_CFG_STAT_CLEAR_SHOT_SET(3), sparx5, in sparx5_config_port_stats()
1182 sparx5, ANA_AC_PORT_STAT_CFG(portno, SPX5_PORT_POLICER_DROPS)); in sparx5_config_port_stats()
1189 struct sparx5 *sparx5 = port->sparx5; in sparx5_get_ts_info() local
1192 if (!sparx5->ptp) in sparx5_get_ts_info()
1195 phc = &sparx5->phc[SPARX5_PHC_PORT]; in sparx5_get_ts_info()
1229 int sparx_stats_init(struct sparx5 *sparx5) in sparx_stats_init() argument
1234 sparx5->stats_layout = sparx5_stats_layout; in sparx_stats_init()
1235 sparx5->num_stats = spx5_stats_count; in sparx_stats_init()
1236 sparx5->num_ethtool_stats = ARRAY_SIZE(sparx5_stats_layout); in sparx_stats_init()
1237 sparx5->stats = devm_kcalloc(sparx5->dev, in sparx_stats_init()
1238 SPX5_PORTS_ALL * sparx5->num_stats, in sparx_stats_init()
1240 if (!sparx5->stats) in sparx_stats_init()
1243 mutex_init(&sparx5->queue_stats_lock); in sparx_stats_init()
1244 sparx5_config_stats(sparx5); in sparx_stats_init()
1246 if (sparx5->ports[portno]) in sparx_stats_init()
1247 sparx5_config_port_stats(sparx5, portno); in sparx_stats_init()
1250 dev_name(sparx5->dev)); in sparx_stats_init()
1251 sparx5->stats_queue = create_singlethread_workqueue(queue_name); in sparx_stats_init()
1252 if (!sparx5->stats_queue) in sparx_stats_init()
1255 INIT_DELAYED_WORK(&sparx5->stats_work, sparx5_check_stats_work); in sparx_stats_init()
1256 queue_delayed_work(sparx5->stats_queue, &sparx5->stats_work, in sparx_stats_init()