| 1036 | } |
| 1037 | |
| 1038 | static int |
| 1039 | __fs_xstats_get(struct rte_eth_dev *dev, |
| 1040 | struct rte_eth_xstat *xstats, |
| 1041 | unsigned int n) |
| 1042 | { |
| 1043 | unsigned int count = 0; |
| 1044 | struct sub_device *sdev; |
| 1045 | uint8_t i; |
| 1046 | int j, ret; |
| 1047 | |
| 1048 | ret = __fs_xstats_count(dev); |
| 1049 | /* |
| 1050 | * if error |
| 1051 | * or caller did not give enough space |
| 1052 | * or just querying |
| 1053 | */ |
| 1054 | if (ret < 0 || ret > (int)n || xstats == NULL) |
| 1055 | return ret; |
| 1056 | |
| 1057 | FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { |
| 1058 | ret = rte_eth_xstats_get(PORT_ID(sdev), xstats, n); |
| 1059 | if (ret < 0) |
| 1060 | return ret; |
| 1061 | |
| 1062 | if (ret > (int)n) |
| 1063 | return n + count; |
| 1064 | |
| 1065 | /* add offset to id's from sub-device */ |
| 1066 | for (j = 0; j < ret; j++) |
| 1067 | xstats[j].id += count; |
| 1068 | |
| 1069 | xstats += ret; |
| 1070 | n -= ret; |
| 1071 | count += ret; |
| 1072 | } |
| 1073 | |
| 1074 | return count; |
| 1075 | } |
| 1076 | |
| 1077 | static int |
| 1078 | fs_xstats_get(struct rte_eth_dev *dev, |
no test coverage detected