* [dpdk-stable] [PATCH 1/3] net/atlantic: exclude MACSEC counters from xstats [not found] <1567705278-10558-1-git-send-email-Pavel.Belous@aquantia.com> @ 2019-09-05 17:41 ` Pavel Belous 2019-09-05 17:41 ` [dpdk-stable] [PATCH 2/3] net/atlantic: fix reported flow control mode Pavel Belous 1 sibling, 0 replies; 3+ messages in thread From: Pavel Belous @ 2019-09-05 17:41 UTC (permalink / raw) To: Ferruh Yigit; +Cc: dev, Igor Russkikh, Corey Melton, Pavel Belous, stable From: Pavel Belous <Pavel.Belous@aquantia.com> Currently, driver always return full set of xstats counters, including MACSEC counters. But this driver also supports AQC100 chips, which does not have MACSEC feature. This fix adds checking for MACSEC availability (based on FW capability bits) and returns xstats without MACSEC counters if MACSEC feature is not available. Fixes: 09d4dfa85359 ("net/atlantic: implement MACsec statistics") Cc: stable@dpdk.org Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> --- drivers/net/atlantic/atl_ethdev.c | 52 ++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 3c1b349..178f7db 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -993,20 +993,42 @@ atl_dev_stats_reset(struct rte_eth_dev *dev) } static int +atl_dev_xstats_get_count(struct rte_eth_dev *dev) +{ + struct atl_adapter *adapter = + (struct atl_adapter *)dev->data->dev_private; + + struct aq_hw_s *hw = &adapter->hw; + unsigned int i, count = 0; + + for (i = 0; i < RTE_DIM(atl_xstats_tbl); i++) { + if (atl_xstats_tbl[i].type == XSTATS_TYPE_MACSEC && + ((hw->caps_lo & BIT(CAPS_LO_MACSEC)) == 0)) + continue; + + count++; + } + + return count; +} + +static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused, struct rte_eth_xstat_name *xstats_names, unsigned int size) { unsigned int i; + unsigned int count = atl_dev_xstats_get_count(dev); - if (!xstats_names) - return RTE_DIM(atl_xstats_tbl); - - for (i = 0; i < size && i < RTE_DIM(atl_xstats_tbl); i++) - strlcpy(xstats_names[i].name, atl_xstats_tbl[i].name, - RTE_ETH_XSTATS_NAME_SIZE); + if (xstats_names) { + for (i = 0; i < size && i < count; i++) { + snprintf(xstats_names[i].name, + RTE_ETH_XSTATS_NAME_SIZE, "%s", + atl_xstats_tbl[i].name); + } + } - return i; + return count; } static int @@ -1020,9 +1042,10 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, struct macsec_msg_fw_response resp = { 0 }; int err = -1; unsigned int i; + unsigned int count = atl_dev_xstats_get_count(dev); if (!stats) - return 0; + return count; if (hw->aq_fw_ops->send_macsec_req != NULL) { req.ingress_sa_index = 0xff; @@ -1035,7 +1058,7 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, err = hw->aq_fw_ops->send_macsec_req(hw, &msg, &resp); } - for (i = 0; i < n && i < RTE_DIM(atl_xstats_tbl); i++) { + for (i = 0; i < n && i < count; i++) { stats[i].id = i; switch (atl_xstats_tbl[i].type) { @@ -1044,14 +1067,15 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, atl_xstats_tbl[i].offset); break; case XSTATS_TYPE_MACSEC: - if (err) - goto done; - stats[i].value = *(u64 *)((uint8_t *)&resp.stats + - atl_xstats_tbl[i].offset); + if (!err) { + stats[i].value = + *(u64 *)((uint8_t *)&resp.stats + + atl_xstats_tbl[i].offset); + } break; } } -done: + return i; } -- 2.7.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH 2/3] net/atlantic: fix reported flow control mode [not found] <1567705278-10558-1-git-send-email-Pavel.Belous@aquantia.com> 2019-09-05 17:41 ` [dpdk-stable] [PATCH 1/3] net/atlantic: exclude MACSEC counters from xstats Pavel Belous @ 2019-09-05 17:41 ` Pavel Belous 1 sibling, 0 replies; 3+ messages in thread From: Pavel Belous @ 2019-09-05 17:41 UTC (permalink / raw) To: Ferruh Yigit; +Cc: dev, Igor Russkikh, Corey Melton, Pavel Belous, stable From: Pavel Belous <Pavel.Belous@aquantia.com> Driver reports current flow control mode based on internal flow control settings. Currently this logic works incorrectly. Fixes: 921eb6b8ce31 ("net/atlantic: fix flow control by sync settings on Rx") Cc: stable@dpdk.org Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> --- drivers/net/atlantic/atl_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 178f7db..1b9d514 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1535,11 +1535,11 @@ atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) if (fc == AQ_NIC_FC_OFF) fc_conf->mode = RTE_FC_NONE; - else if (fc & (AQ_NIC_FC_RX | AQ_NIC_FC_TX)) + else if ((fc & AQ_NIC_FC_RX) && (fc & AQ_NIC_FC_TX)) fc_conf->mode = RTE_FC_FULL; else if (fc & AQ_NIC_FC_RX) fc_conf->mode = RTE_FC_RX_PAUSE; - else if (fc & AQ_NIC_FC_RX) + else if (fc & AQ_NIC_FC_TX) fc_conf->mode = RTE_FC_TX_PAUSE; return 0; -- 2.7.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1567704331-10061-1-git-send-email-Pavel.Belous@aquantia.com>]
* [dpdk-stable] [PATCH 1/3] net/atlantic: exclude MACSEC counters from xstats [not found] <1567704331-10061-1-git-send-email-Pavel.Belous@aquantia.com> @ 2019-09-05 17:25 ` Pavel Belous 0 siblings, 0 replies; 3+ messages in thread From: Pavel Belous @ 2019-09-05 17:25 UTC (permalink / raw) To: Pavel Belous; +Cc: Pavel Belous, stable, Igor Russkikh From: Pavel Belous <Pavel.Belous@aquantia.com> Currently, driver always return full set of xstats counters, including MACSEC counters. But this driver also supports AQC100 chips, which does not have MACSEC feature. This fix adds checking for MACSEC availability (based on FW capability bits) and returns xstats without MACSEC counters if MACSEC feature is not available. Fixes: 09d4dfa85359 ("net/atlantic: implement MACsec statistics") Cc: stable@dpdk.org Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> --- drivers/net/atlantic/atl_ethdev.c | 52 ++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 3c1b349..178f7db 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -993,20 +993,42 @@ atl_dev_stats_reset(struct rte_eth_dev *dev) } static int +atl_dev_xstats_get_count(struct rte_eth_dev *dev) +{ + struct atl_adapter *adapter = + (struct atl_adapter *)dev->data->dev_private; + + struct aq_hw_s *hw = &adapter->hw; + unsigned int i, count = 0; + + for (i = 0; i < RTE_DIM(atl_xstats_tbl); i++) { + if (atl_xstats_tbl[i].type == XSTATS_TYPE_MACSEC && + ((hw->caps_lo & BIT(CAPS_LO_MACSEC)) == 0)) + continue; + + count++; + } + + return count; +} + +static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused, struct rte_eth_xstat_name *xstats_names, unsigned int size) { unsigned int i; + unsigned int count = atl_dev_xstats_get_count(dev); - if (!xstats_names) - return RTE_DIM(atl_xstats_tbl); - - for (i = 0; i < size && i < RTE_DIM(atl_xstats_tbl); i++) - strlcpy(xstats_names[i].name, atl_xstats_tbl[i].name, - RTE_ETH_XSTATS_NAME_SIZE); + if (xstats_names) { + for (i = 0; i < size && i < count; i++) { + snprintf(xstats_names[i].name, + RTE_ETH_XSTATS_NAME_SIZE, "%s", + atl_xstats_tbl[i].name); + } + } - return i; + return count; } static int @@ -1020,9 +1042,10 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, struct macsec_msg_fw_response resp = { 0 }; int err = -1; unsigned int i; + unsigned int count = atl_dev_xstats_get_count(dev); if (!stats) - return 0; + return count; if (hw->aq_fw_ops->send_macsec_req != NULL) { req.ingress_sa_index = 0xff; @@ -1035,7 +1058,7 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, err = hw->aq_fw_ops->send_macsec_req(hw, &msg, &resp); } - for (i = 0; i < n && i < RTE_DIM(atl_xstats_tbl); i++) { + for (i = 0; i < n && i < count; i++) { stats[i].id = i; switch (atl_xstats_tbl[i].type) { @@ -1044,14 +1067,15 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, atl_xstats_tbl[i].offset); break; case XSTATS_TYPE_MACSEC: - if (err) - goto done; - stats[i].value = *(u64 *)((uint8_t *)&resp.stats + - atl_xstats_tbl[i].offset); + if (!err) { + stats[i].value = + *(u64 *)((uint8_t *)&resp.stats + + atl_xstats_tbl[i].offset); + } break; } } -done: + return i; } -- 2.7.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-05 17:41 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1567705278-10558-1-git-send-email-Pavel.Belous@aquantia.com> 2019-09-05 17:41 ` [dpdk-stable] [PATCH 1/3] net/atlantic: exclude MACSEC counters from xstats Pavel Belous 2019-09-05 17:41 ` [dpdk-stable] [PATCH 2/3] net/atlantic: fix reported flow control mode Pavel Belous [not found] <1567704331-10061-1-git-send-email-Pavel.Belous@aquantia.com> 2019-09-05 17:25 ` [dpdk-stable] [PATCH 1/3] net/atlantic: exclude MACSEC counters from xstats Pavel Belous
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).