Representor fixes for BlueField device
cover Representor fixes for BlueField device
Setting BlueField device with representors introduced some corner cases that were overlooked during the development of representors for x86.
This series enables the PMD to run on both x86 and BlueField with representors enabled.
Shahaf Shuler (3):
net/mlx5: support missing counter in extended statistics net/mlx5: add representor specific statistics net/mlx5: always use representor ifindex for ioctl
drivers/net/mlx5/mlx5.h | 16 ++++++-- drivers/net/mlx5/mlx5_ethdev.c | 41 ++++++++------------ drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_stats.c | 88 ++++++++++++++++++++++-------------------- 4 files changed, 76 insertions(+), 71 deletions(-)
Signature · 1 line
2.12.0
PATCH 1/3 net/mlx5: support missing counter in extended statistics
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.
--- drivers/net/mlx5/mlx5.h | 11 ++++++++ drivers/net/mlx5/mlx5_stats.c | 65 ++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 38 deletions(-)
drivers/net/mlx5/mlx5.h +11 -0
@@ -72,12 +72,23 @@ struct mlx5_shared_data {extern struct mlx5_shared_data *mlx5_shared_data; +struct mlx5_counter_ctrl { +/* Name of the counter. */ +char dpdk_name[RTE_ETH_XSTATS_NAME_SIZE ]; +/* Name of the counter on the device table. */ +char ctr_name[RTE_ETH_XSTATS_NAME_SIZE ]; +uint32_t ib:1 ;/**< Nonzero for IB counters. */ +}; +struct mlx5_xstats_ctrl {/* Number of device stats. */ uint16_t stats_n; +/* Number of device stats identified by PMD. */ +uint16_t mlx5_stats_n;/* Index in the device counters table. */ uint16_t dev_table_idx[MLX5_MAX_XSTATS ];uint64_t base[MLX5_MAX_XSTATS ]; +struct mlx5_counter_ctrl info[MLX5_MAX_XSTATS ]; };/* Flow list . */
drivers/net/mlx5/mlx5_stats.c +27 -38
134 lines not on this page · raw message
Signature · 1 line
2.12.0
PATCH 2/3 net/mlx5: add representor specific statistics
In reply to Shahaf ShulerRepresentor ports has a different set of extended statistics (as those are logical ports which cannot count all that the PF can).
--- drivers/net/mlx5/mlx5_stats.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/mlx5/mlx5_stats.c +17 -0
@@ -107,6 +107,23 @@ static const struct mlx5_counter_ctrl mlx5_counters_init[] = { .dpdk_name = "rx_bytes_phy", .ctr_name = "rx_bytes_phy", }, +/* Representor only */ + { + .dpdk_name = "rx_packets", + .ctr_name = "vport_rx_packets", + }, + { + .dpdk_name = "rx_bytes", + .ctr_name = "vport_rx_bytes", + }, + { + .dpdk_name = "tx_packets", + .ctr_name = "vport_tx_packets", + }, + { + .dpdk_name = "tx_bytes", + .ctr_name = "vport_tx_bytes", + }, }; static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
Signature · 1 line
2.12.0
PATCH 3/3 net/mlx5: always use representor ifindex for ioctl
In reply to Shahaf ShulerIn 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
--- drivers/net/mlx5/mlx5.h | 5 +---- drivers/net/mlx5/mlx5_ethdev.c | 41 ++++++++++++++++------------------------- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_stats.c | 6 +++--- 4 files changed, 21 insertions(+), 33 deletions(-)
drivers/net/mlx5/mlx5.h +1 -4
@@ -248,12 +248,9 @@ int mlx5_getenv_int(const char *);/* mlx5_ethdev.c */ -int mlx5_get_master_ifname (const struct rte_eth_dev *dev, -char (*ifname)[IF_NAMESIZE ]);int mlx5_get_ifname (const struct rte_eth_dev *dev,char (*ifname)[IF_NAMESIZE ]);unsigned int mlx5_ifindex (const struct rte_eth_dev *dev); -int mlx5_ifreq (const struct rte_eth_dev *dev,int req,struct ifreq *ifr, -int master); +int mlx5_ifreq (const struct rte_eth_dev *dev,int req,struct ifreq *ifr);int mlx5_get_mtu (struct rte_eth_dev *dev,uint16_t *mtu);int mlx5_set_flags (struct rte_eth_dev *dev,unsigned int keep,unsigned int flags);
drivers/net/mlx5/mlx5_ethdev.c +16 -25
141 lines not on this page · raw message
drivers/net/mlx5/mlx5_mac.c +1 -1
@@ -49,7 +49,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN])struct ifreq request;int ret; - ret =mlx5_ifreq (dev,SIOCGIFHWADDR , &request,0 ); + ret =mlx5_ifreq (dev,SIOCGIFHWADDR , &request);if (ret)return ret;memcpy (mac, request.ifr_hwaddr.sa_data,ETHER_ADDR_LEN );
drivers/net/mlx5/mlx5_stats.c +3 -3
@@ -155,7 +155,7 @@ mlx5_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats) et_stats->cmd =ETHTOOL_GSTATS ; et_stats->n_stats = xstats_ctrl->stats_n; ifr.ifr_data = (caddr_t )et_stats; - ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr,0 ); + ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr);if (ret) { DRV_LOG(WARNING, "port %u unable to read statistic values from device",
@@ -203,7 +203,7 @@ mlx5_ethtool_get_stats_n(struct rte_eth_dev *dev) { drvinfo.cmd =ETHTOOL_GDRVINFO ; ifr.ifr_data = (caddr_t)&drvinfo; - ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr,0 ); + ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr);if (ret) {DRV_LOG (WARNING ,"port %u unable to query number of statistics" , dev->data->port_id);
@@ -252,7 +252,7 @@ mlx5_xstats_init(struct rte_eth_dev *dev) strings->string_set =ETH_SS_STATS ; strings->len = dev_stats_n; ifr.ifr_data = (caddr_t )strings; - ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr,0 ); + ret =mlx5_ifreq (dev,SIOCETHTOOL , &ifr);if (ret) {DRV_LOG (WARNING ,"port %u unable to get statistic names" , dev->data->port_id);
Signature · 1 line
2.12.0
Shahaf Shuler
AppliedMonday, October 8, 2018 11:25 AM, Shahaf Shuler:
Quoted 13 lines
Subject: [dpdk-dev] [PATCH 0/3] Representor fixes for BlueField device
Setting BlueField device with representors introduced some corner cases that were overlooked during the development of representors for x86.
This series enables the PMD to run on both x86 and BlueField with representors enabled.
Shahaf Shuler (3):
net/mlx5: support missing counter in extended statistics net/mlx5: add representor specific statistics net/mlx5: always use representor ifindex for ioctl
Quoted 6 lines
drivers/net/mlx5/mlx5.h | 16 ++++++-- drivers/net/mlx5/mlx5_ethdev.c | 41 ++++++++------------ drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_stats.c | 88 ++++++++++++++++++++++-------------- ------ 4 files changed, 76 insertions(+), 71 deletions(-)
Applied to next-net-mlx, thanks.
Quoted 3 lines
--
2.12.0