-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5: fix counters map in bonding mode
[ upstream commit a687c3e658c2d889052089af8340bc0b9299c856 ] In the HW-LAG mode, there is only one mlx5 IB device with 2 ETH interfaces. In theory, the settings on both ports should be the same. But in the real life, some inconsistent settings may be done by the user and the PMD is not aware of this. In the previous implementation, the xstats map was generated from the information fetched on the 1st port of a bonding interface. If the 2nd port had a different settings, the number and the order of the counters may differ from that of the 1st one. The ioctl() call may corrupt the user buffers (copy_to_user) and cause a crash. The commit will change the map between the driver counters to the PMD user counters. 1. Switch the inner and outer loop to speed up the initialization time AMAP - since there will be >300 counters returned from the driver. 2. Generate an unique map for both ports in LAG mode. a. Scan the 1st port and find the supported counters' strings, then add to the map. b. In bonding, scan the 2nd port and find the strings. If one is already in the map, use the index. Or append to the next free slot. c. Append the device counters that needs to be fetched via sysfs or Devx command. This kind of counter(s) is unique per IB device. After querying the statistics from the driver, the value will be read from the proper offset in the "struct ethtool_stats" and then added into the output array based on the map information. In bonding mode, the statistics from both ports will be accumulated if the counters are valid on both ports. Compared to the system call or Devx command, the overhead introduced by the extra index comparison is light and should not cause a significant degradation. The application should ensure that the port settings should not be changed out of the DPDK application dynamically in most cases. Or else the change cannot be notified and the counters map might not be valid when the number doesn't change but the counters set had changed. A device restart will help to re-initialize the map from scrath. Fixes: 7ed15ac ("net/mlx5: improve xstats of bonding port") Signed-off-by: Bing Zhao <bingz@nvidia.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
- Loading branch information
1 parent
03c7f0a
commit 2481136
Showing
4 changed files
with
242 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.