* [PATCH 1/8] net/nfp: fix incorrect type declaration of some variables
[not found] <20240905062511.2710102-1-chaoyong.he@corigine.com>
@ 2024-09-05 6:25 ` Chaoyong He
2024-09-05 6:25 ` [PATCH 6/8] net/nfp: fix representor port link speed update problem Chaoyong He
2024-09-05 6:25 ` [PATCH 8/8] net/nfp: fix representor port link status " Chaoyong He
2 siblings, 0 replies; 3+ messages in thread
From: Chaoyong He @ 2024-09-05 6:25 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Qin Ke, james.hershaw, stable, Chaoyong He, Long Wu,
Peng Zhang
From: Qin Ke <qin.ke@corigine.com>
The type declaration of variable 'speed' and 'i' in
'nfp_net_link_speed_rte2nfp()' is not correct, fix it.
Fixes: 36a9abd4b679 ("net/nfp: write link speed to control BAR")
Cc: james.hershaw@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_net_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 5f92c2c31d..be0b6dc0cf 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -157,10 +157,10 @@ static const uint32_t nfp_net_link_speed_nfp2rte[] = {
[NFP_NET_CFG_STS_LINK_RATE_100G] = RTE_ETH_SPEED_NUM_100G,
};
-static uint16_t
-nfp_net_link_speed_rte2nfp(uint16_t speed)
+static size_t
+nfp_net_link_speed_rte2nfp(uint32_t speed)
{
- uint16_t i;
+ size_t i;
for (i = 0; i < RTE_DIM(nfp_net_link_speed_nfp2rte); i++) {
if (speed == nfp_net_link_speed_nfp2rte[i])
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 6/8] net/nfp: fix representor port link speed update problem
[not found] <20240905062511.2710102-1-chaoyong.he@corigine.com>
2024-09-05 6:25 ` [PATCH 1/8] net/nfp: fix incorrect type declaration of some variables Chaoyong He
@ 2024-09-05 6:25 ` Chaoyong He
2024-09-05 6:25 ` [PATCH 8/8] net/nfp: fix representor port link status " Chaoyong He
2 siblings, 0 replies; 3+ messages in thread
From: Chaoyong He @ 2024-09-05 6:25 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Qin Ke, zerun.fu, stable, Chaoyong He, Long Wu, Peng Zhang
From: Qin Ke <qin.ke@corigine.com>
For representor port link speed, the original logic finally calls
'nfp_net_speed_aneg_update()' to update it. But the reference of
'hw->idx' in this function is invalid for representor port devices,
the logic has problem.
Fix it by getting correct 'idx' for all type of deives including
representor port and make reference to it.
Fixes: 8412feed3f26 ("net/nfp: modify link update function")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
.../net/nfp/flower/nfp_flower_representor.c | 2 +-
drivers/net/nfp/nfp_net_common.c | 32 +++++++++++++++----
drivers/net/nfp/nfp_net_common.h | 2 +-
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index e7593313e2..054ea1a938 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -40,7 +40,7 @@ nfp_flower_repr_link_update(struct rte_eth_dev *dev,
pf_hw = repr->app_fw_flower->pf_hw;
nn_link_status = nn_cfg_readw(&pf_hw->super, NFP_NET_CFG_STS);
- ret = nfp_net_link_update_common(dev, pf_hw, link, nn_link_status);
+ ret = nfp_net_link_update_common(dev, link, nn_link_status);
return ret;
}
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 6761a16ef2..daed57e374 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -311,6 +311,24 @@ nfp_net_get_hw(const struct rte_eth_dev *dev)
return hw;
}
+uint8_t
+nfp_net_get_idx(const struct rte_eth_dev *dev)
+{
+ uint8_t idx;
+
+ if (rte_eth_dev_is_repr(dev)) {
+ struct nfp_flower_representor *repr;
+ repr = dev->data->dev_private;
+ idx = repr->idx;
+ } else {
+ struct nfp_net_hw *hw;
+ hw = dev->data->dev_private;
+ idx = hw->idx;
+ }
+
+ return idx;
+}
+
/*
* Configure an Ethernet device.
*
@@ -743,17 +761,18 @@ nfp_net_allmulticast_disable(struct rte_eth_dev *dev)
static void
nfp_net_pf_speed_update(struct rte_eth_dev *dev,
- struct nfp_net_hw *hw,
struct nfp_net_hw_priv *hw_priv,
struct rte_eth_link *link)
{
+ uint8_t idx;
enum nfp_eth_aneg aneg;
struct nfp_pf_dev *pf_dev;
struct nfp_eth_table *nfp_eth_table;
struct nfp_eth_table_port *eth_port;
pf_dev = hw_priv->pf_dev;
- aneg = pf_dev->nfp_eth_table->ports[hw->idx].aneg;
+ idx = nfp_net_get_idx(dev);
+ aneg = pf_dev->nfp_eth_table->ports[idx].aneg;
/* Compare whether the current status has changed. */
if (pf_dev->speed_updated || aneg == NFP_ANEG_AUTO) {
@@ -761,14 +780,14 @@ nfp_net_pf_speed_update(struct rte_eth_dev *dev,
if (nfp_eth_table == NULL) {
PMD_DRV_LOG(WARNING, "Failed to update port speed.");
} else {
- pf_dev->nfp_eth_table->ports[hw->idx] = nfp_eth_table->ports[hw->idx];
+ pf_dev->nfp_eth_table->ports[idx] = nfp_eth_table->ports[idx];
free(nfp_eth_table);
pf_dev->speed_updated = false;
}
}
nfp_eth_table = pf_dev->nfp_eth_table;
- eth_port = &nfp_eth_table->ports[hw->idx];
+ eth_port = &nfp_eth_table->ports[idx];
link->link_speed = nfp_net_link_speed_nfp2rte_check(eth_port->speed);
@@ -797,7 +816,6 @@ nfp_net_vf_speed_update(struct rte_eth_link *link,
int
nfp_net_link_update_common(struct rte_eth_dev *dev,
- struct nfp_net_hw *hw,
struct rte_eth_link *link,
uint32_t link_status)
{
@@ -807,7 +825,7 @@ nfp_net_link_update_common(struct rte_eth_dev *dev,
hw_priv = dev->process_private;
if (link->link_status == RTE_ETH_LINK_UP) {
if (hw_priv->is_pf)
- nfp_net_pf_speed_update(dev, hw, hw_priv, link);
+ nfp_net_pf_speed_update(dev, hw_priv, link);
else
nfp_net_vf_speed_update(link, link_status);
}
@@ -851,7 +869,7 @@ nfp_net_link_update(struct rte_eth_dev *dev,
link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
- ret = nfp_net_link_update_common(dev, hw, &link, nn_link_status);
+ ret = nfp_net_link_update_common(dev, &link, nn_link_status);
if (ret == -EIO)
return ret;
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index be5705636f..a32f3b330a 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -293,7 +293,6 @@ int nfp_net_promisc_disable(struct rte_eth_dev *dev);
int nfp_net_allmulticast_enable(struct rte_eth_dev *dev);
int nfp_net_allmulticast_disable(struct rte_eth_dev *dev);
int nfp_net_link_update_common(struct rte_eth_dev *dev,
- struct nfp_net_hw *hw,
struct rte_eth_link *link,
uint32_t link_status);
int nfp_net_link_update(struct rte_eth_dev *dev,
@@ -356,6 +355,7 @@ int nfp_net_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size
bool nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version);
bool nfp_net_is_valid_version_class(struct nfp_net_fw_ver version);
struct nfp_net_hw *nfp_net_get_hw(const struct rte_eth_dev *dev);
+uint8_t nfp_net_get_idx(const struct rte_eth_dev *dev);
int nfp_net_stop(struct rte_eth_dev *dev);
int nfp_net_flow_ctrl_get(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 8/8] net/nfp: fix representor port link status update problem
[not found] <20240905062511.2710102-1-chaoyong.he@corigine.com>
2024-09-05 6:25 ` [PATCH 1/8] net/nfp: fix incorrect type declaration of some variables Chaoyong He
2024-09-05 6:25 ` [PATCH 6/8] net/nfp: fix representor port link speed update problem Chaoyong He
@ 2024-09-05 6:25 ` Chaoyong He
2 siblings, 0 replies; 3+ messages in thread
From: Chaoyong He @ 2024-09-05 6:25 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Qin Ke, chaoyong.he, stable, Long Wu, Peng Zhang
From: Qin Ke <qin.ke@corigine.com>
The link status of representor port is reported by the flower
firmware through control message and it already parsed and
stored in the 'link' field of representor port structure.
The original logic read link status from the control BAR again,
and use it rather then the 'link' field of the representor port
structure in the following logic wrongly.
Fix this by delete the read control BAR statement and use the
right link status value.
Fixes: c4de52eca76c ("net/nfp: remove redundancy for representor port")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_representor.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 054ea1a938..5db7d50618 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -29,18 +29,13 @@ nfp_flower_repr_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete)
{
int ret;
- uint32_t nn_link_status;
- struct nfp_net_hw *pf_hw;
struct rte_eth_link *link;
struct nfp_flower_representor *repr;
repr = dev->data->dev_private;
link = &repr->link;
- pf_hw = repr->app_fw_flower->pf_hw;
- nn_link_status = nn_cfg_readw(&pf_hw->super, NFP_NET_CFG_STS);
-
- ret = nfp_net_link_update_common(dev, link, nn_link_status);
+ ret = nfp_net_link_update_common(dev, link, link->link_status);
return ret;
}
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-05 6:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240905062511.2710102-1-chaoyong.he@corigine.com>
2024-09-05 6:25 ` [PATCH 1/8] net/nfp: fix incorrect type declaration of some variables Chaoyong He
2024-09-05 6:25 ` [PATCH 6/8] net/nfp: fix representor port link speed update problem Chaoyong He
2024-09-05 6:25 ` [PATCH 8/8] net/nfp: fix representor port link status " Chaoyong He
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).