| 131 | } |
| 132 | |
| 133 | int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) |
| 134 | { |
| 135 | struct vnic_stats *stats; |
| 136 | struct enic_soft_stats *soft_stats = &enic->soft_stats; |
| 137 | int64_t rx_truncated; |
| 138 | uint64_t rx_packet_errors; |
| 139 | int ret = vnic_dev_stats_dump(enic->vdev, &stats); |
| 140 | |
| 141 | if (ret) { |
| 142 | dev_err(enic, "Error in getting stats\n"); |
| 143 | return ret; |
| 144 | } |
| 145 | |
| 146 | /* The number of truncated packets can only be calculated by |
| 147 | * subtracting a hardware counter from error packets received by |
| 148 | * the driver. Note: this causes transient inaccuracies in the |
| 149 | * ipackets count. Also, the length of truncated packets are |
| 150 | * counted in ibytes even though truncated packets are dropped |
| 151 | * which can make ibytes be slightly higher than it should be. |
| 152 | */ |
| 153 | rx_packet_errors = rte_atomic64_read(&soft_stats->rx_packet_errors); |
| 154 | rx_truncated = rx_packet_errors - stats->rx.rx_errors; |
| 155 | |
| 156 | r_stats->ipackets = stats->rx.rx_frames_ok - rx_truncated; |
| 157 | r_stats->opackets = stats->tx.tx_frames_ok; |
| 158 | |
| 159 | r_stats->ibytes = stats->rx.rx_bytes_ok; |
| 160 | r_stats->obytes = stats->tx.tx_bytes_ok; |
| 161 | |
| 162 | r_stats->ierrors = stats->rx.rx_errors + stats->rx.rx_drop; |
| 163 | r_stats->oerrors = stats->tx.tx_errors |
| 164 | + rte_atomic64_read(&soft_stats->tx_oversized); |
| 165 | |
| 166 | r_stats->imissed = stats->rx.rx_no_bufs + rx_truncated; |
| 167 | |
| 168 | r_stats->rx_nombuf = rte_atomic64_read(&soft_stats->rx_nombuf); |
| 169 | return 0; |
| 170 | } |
| 171 | |
| 172 | int enic_del_mac_address(struct enic *enic, int mac_index) |
| 173 | { |
no test coverage detected