summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_stats.c
AgeCommit message (Collapse)Author
2019-10-07ethdev: make stats and xstats reset callbacks return intIgor Romanov
Change return value of the callbacks from void to int. Make implementations across all drivers return negative errno values in case of error conditions. Both callbacks are updated together because a large number of drivers assign the same function to both callbacks. Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-06-06net/mlx5: fix RxQ errors statDavid Marchand
Transmit errors must not be reported in q_errors[] which is for reception. Fixes: 87011737b715 ("mlx5: add software counters") Fixes: 9f9a48eb2978 ("net/mlx5: fix Tx stats error counter definition") Cc: stable@dpdk.org Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-04-12net/mlx5: remove redundant queue indexYongseok Koh
Queue index is redundantly stored for both Rx and Tx structures. E.g. txq_ctrl->idx and txq->stats.idx. Both are consolidated to single storage - rxq->idx and txq->idx. Also, rxq and txq are moved to the beginning of its control structure (rxq_ctrl and txq_ctrl) for cacheline alignment. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-03-29net/mlx5: switch to the names in the shared IB contextViacheslav Ovsiienko
The IB device names are moved from device private data to the shared context, code involving the names is updated. The IB port index treatment is added where it is relevant. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-03-01net/mlx: prefix private structureThomas Monjalon
The private structure stored in rte_eth_dev->data->dev_private was named "struct priv". In order to ease code browsing, the structure is renamed "struct mlx[45]_priv". Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-12-13net/mlx5: report imissed statisticsTom Barbette
The imissed counters (number of packets dropped because the queues were full) were actually reported through xstats as "rx_out_of_buffer" but was not reported through stats. Following a recent discussion on the ML, as there is no way to tell the user if a counter is implemented or not, this should be considered a bug. For example, user looking at imissed will think the packets are lost before reaching the device. Signed-off-by: Tom Barbette <barbette@kth.se> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-16net/mlx5: fix initialization of struct membersAli Alnubani
This patch fixes compilation errors with meson and the clang compiler caused by some of the struct members not being initialized. ``` ../drivers/net/mlx5/mlx5_mr.c:345:37: error: missing field 'end' initializer [-Werror,-Wmissing-field-initializers] struct mlx5_mr_cache entry = { 0, }; ^ ../drivers/net/mlx5/mlx5_mr.c:389:36: error: missing field 'end' initializer [-Werror,-Wmissing-field-initializers] struct mlx5_mr_cache ret = { 0, }; ^ ../drivers/net/mlx5/mlx5_mr.c:691:35: error: missing field 'end' initializer [-Werror,-Wmissing-field-initializers] struct mlx5_mr_cache ret = { 0, }; ^ ``` The compilation errors reproduce with clang version 3.4.2 (tags/RELEASE_34/dot2-final) on RHEL. Fixes: e1114ff6a5ab ("net/mlx5: support e-switch flow count action") Fixes: db48f9db5d9f ("net/mlx5: support new flow counter API") Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") Fixes: 65c9d24170c9 ("net/mlx5: enable loopback by configured mode") Fixes: 87011737b715 ("mlx5: add software counters") Cc: stable@dpdk.org Signed-off-by: Ali Alnubani <alialnu@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-11net/mlx5: always use representor ifindex for ioctlShahaf Shuler
In the current code, on some cases the representor ethdev is using the PF interface to query some link status information or pause parameters. It was done because in previous kernel versions there was no support from the kernel for the representor info. Using the PF i/f for such ioctl is error prone and not always working because: * On some cases there is no PF at all, only representors (e.g Bluefield with host representors) * Query the up/down status from representor and link status from PF is in-consist * PF link is down doesn't necessarily means representor is down. * setting different pause configuration for the PF and the representors will result on undefined behaviour Making the code cleaner and more robust by using only the representor i/f for the ioctl. whatever the kernel will provide on this query will be used. No need to do W.A. for kernel missing functionality. Note: 1. Setting pause parameters will obviously won't work on representors 2. Old kernel will not report all the possible representor info Fixes: 2b7302638898 ("net/mlx5: probe all port representors") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-11net/mlx5: add representor specific statisticsShahaf Shuler
Representor ports has a different set of extended statistics (as those are logical ports which cannot count all that the PF can). Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-11net/mlx5: support missing counter in extended statisticsShahaf Shuler
The current code would fail if one of the counters DPDK counters was not found on the device counters. As representors and PF port has different counters the both cannot work together. Addressing this issue by making the counter init more flexible to contain all the counter found and skipping the error. Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-11net/mlx5: fix representor port xstatsXueming Li
This patch fixes the issue that representor port shows xstats of PF. Fixes: 2b7302638898 ("net/mlx5: probe all port representors") Cc: stable@dpdk.org Signed-off-by: Xueming Li <xuemingl@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-07-11net/mlx5: probe all port representorsAdrien Mazarguil
Probe existing port representors in addition to their master device and associate them automatically. To avoid collision between Ethernet devices, they are named as follows: - "{DBDF}" for master/switch devices. - "{DBDF}_representor_{rep}" with "rep" starting from 0 for port representors. (Patch based on prior work from Yuanhan Liu) Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Reviewed-by: Xueming Li <xuemingl@mellanox.com>
2018-05-23net/mlx5: fix count in xstatsDavid Marchand
With the commit af4f09f28294 ("net/mlx5: prefix all functions with mlx5"), mlx5_xstats_get() is not compliant any longer with the api. It always returns the caller max entries count while it should return how many entries it wrote/wanted to write. Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5") Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2018-04-11align SPDX Mellanox copyrightsShahaf Shuler
Aligning Mellanox SPDX copyrights to a single format. In addition replace to SPDX licence files which were missed. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: use dynamic loggingNélio Laranjeiro
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: use port id in PMD logNélio Laranjeiro
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: standardize on negative errno valuesNélio Laranjeiro
Set rte_errno systematically as well. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: prefix all functions with mlx5Nélio Laranjeiro
This change removes the need to distinguish unlocked priv_*() functions which are therefore renamed using a mlx5_*() prefix for consistency. At the same time, all functions from mlx5 uses a pointer to the ETH device instead of the one to the PMD private data. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: remove control path locksNélio Laranjeiro
In priv struct only the memory region needs to be protected against concurrent access between the control plane and the data plane. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx5: mark parameters with unused attributeNélio Laranjeiro
Replaces all (void)foo; by __rte_unused macro except when variables are under #if statements. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-03-30net/mlx: control netdevices through ioctl onlyAdrien Mazarguil
Several control operations implemented by these PMDs affect netdevices through sysfs, itself subject to file system permission checks enforced by the kernel, which limits their use for most purposes to applications running with root privileges. Since performing the same operations through ioctl() requires fewer capabilities (only CAP_NET_ADMIN) and given the remaining operations are already implemented this way, this patch standardizes on ioctl() and gets rid of redundant code. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
2018-02-01net/mlx5: use SPDX tags in 6WIND copyrighted filesOlivier Matz
Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-22ethdev: separate driver APIsFerruh Yigit
Create a rte_ethdev_driver.h file and move PMD specific APIs here. Drivers updated to include this new header file. There is no update in header content and since ethdev.h included by ethdev_driver.h, nothing changed from driver point of view, only logically grouping of APIs. From applications point of view they can't access to driver specific APIs anymore and they shouldn't. More PMD specific data structures still remain in ethdev.h because of inline functions in header use them. Those will be handled separately. Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-16net/mlx5: add physical port countersShahaf Shuler
Extend the PMD extended statistics with more counters on the physical port. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2018-01-16net/mlx5: remove get priv internal functionNélio Laranjeiro
mlx5_get_priv() is barely use across the driver. To avoid mixing access, this function is definitely removed. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-01-16net/mlx5: cleanup allocation of ethtool statsThierry Herbelot
Simplify the computation for the needed size: - exact size for the structure header, - exact size for a number of 64-bit counters. Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics") Cc: stable@dpdk.org Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-12ethdev: add return value to stats get dev opMatan Azrad
The stats_get dev op API doesn't include return value, so PMD cannot return an error in case of failure at stats getting process time. Since PCI devices can be removed and there is a time between the physical removal to the RMV interrupt, the user may get invalid stats without any indication. This patch changes the stats_get API return value to be int instead of void. All the net PMDs stats_get dev ops are adjusted by this patch. Signed-off-by: Matan Azrad <matan@mellanox.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-10-12net/mlx5: prefix Tx structures and functionsNélio Laranjeiro
Prefix struct txq_ctrl and associated function with mlx5. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2017-10-12net/mlx5: prefix Rx structures and functionsNélio Laranjeiro
Prefix struct rxq_ctrl and associated functions with mlx5. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2017-10-06net/mlx5: fix Tx stats error counter definitionShahaf Shuler
The current Tx error counter counts, according to its description, the total number of packets not sent when TX ring full. It is reported to application as part of oerrors field. The drop due to full ring is not the statistic that should be set on oerrors field. Such number can be counted by the application using the return value of the Tx burst function. The number that should be set there is the number of packets the device could not transmit in any way, even when it has resources. Therefore, replace this counter to count the total number of failed transmitted packets. Fixes: 87011737b715 ("mlx5: add software counters") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-06net/mlx5: fix locking in xstats functionsMatan Azrad
The corrupted code didn't unlock the spinlock in xstats get and reset functions error flow. Hence, if these errors happened, the device spinlock was left locked and many mlx5 device functionalities were blocked. The fix unlocks the spinlock in the missed places. Fixes: e62bc9e70608 ("net/mlx5: fix extended statistics") Cc: stable@dpdk.org Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-06net/mlx5: remove pedantic pragmaNélio Laranjeiro
Those are useless since DPDK headers have been cleaned up. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2017-04-04net/mlx5: fix extended statistics counters identificationShahaf Shuler
Checking whether the counter is IB counter was performed with the wrong index. Fixes: 859081d3fbbf ("net/mlx5: add out of buffer counter to extended statistic") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-04-04net/mlx5: fix extended statisticsShahaf Shuler
The number of extended statistics counters is queried through ETHTOOL. ETHTOOL provides a different number when the link is up or down. Since extended statistics query occurs at device start, segmentation fault might happen when changing the link state before and after the device start. this commit address this issue, and query the number of statistics before every call to ETHTOOL. Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-04-04net/mlx5: remove unused interface name queryShahaf Shuler
Interface name is queried, however never used. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-04-04net/mlx5: add out of buffer counter to extended statisticShahaf Shuler
This commit adds RX out of buffer counter to xstats report. The counter counts the number of dropped occurred due to lack of buffers on device RX queues. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-01-17net/mlx5: support extended statisticsShahaf Shuler
Implement extended statistics callbacks. Suggested-by: Hanoch Haim <hhaim@cisco.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Elad Persiko <eladpe@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-30net/mlx: fix debug build with gcc 6.1Bruce Richardson
With recent gcc versions, e.g. gcc 6.1, compilation of mlx drivers with debug enabled produces lots of errors complaining that "pedantic" is not a warning level that can be ignored. error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas] #pragma GCC diagnostic ignored "-pedantic" ^~~~~~~~~~~ These errors can be removed by changing the "-pedantic" to "-Wpedantic". Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters") Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-25mlx5: allow operation in secondary processesOr Ami
Secondary processes are expected to use queues and other resources allocated by the primary, however Verbs resources can only be shared between processes when inherited through fork(). This limitation can be worked around for TX by configuring separate queues from secondary processes. Signed-off-by: Or Ami <ora@mellanox.com>
2015-11-24mlx5: fix possible crash when clearing device statisticsAdrien Mazarguil
A typo causes TX stats indices to be retrieved from RX queues. Fixes: 87011737b715 ("mlx5: add software counters") Reported-by: Nicolas Harnois <nicolas.harnois@6wind.com> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-10-30mlx5: add software countersAdrien Mazarguil
Hardware counters are not supported yet. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>