From: Harman Kalra <hkalra@marvell.com>
To: <dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>,
Maciej Czekaj <mczekaj@marvell.com>
Cc: Hanumanth Pothula <hpothula@marvell.com>
Subject: [PATCH v3 05/11] net/thunderx: implement polling of link state change
Date: Tue, 24 May 2022 14:12:29 +0530 [thread overview]
Message-ID: <20220524084235.17796-5-hkalra@marvell.com> (raw)
In-Reply-To: <20220524084235.17796-1-hkalra@marvell.com>
From: Hanumanth Pothula <hpothula@marvell.com>
Moving the logic of link polling to VF from PF. Now VF
is supposed to poll for the link status, rather PF alerting
VF about any link change.
Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
drivers/net/thunderx/base/nicvf_mbox.c | 9 ++++++++
drivers/net/thunderx/base/nicvf_mbox.h | 1 +
drivers/net/thunderx/nicvf_ethdev.c | 32 ++++++++++++++------------
drivers/net/thunderx/nicvf_ethdev.h | 10 ++++----
4 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c
index d7209c0083..281027ccce 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.c
+++ b/drivers/net/thunderx/base/nicvf_mbox.c
@@ -440,3 +440,12 @@ nicvf_mbox_cfg_done(struct nicvf *nic)
mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
nicvf_mbox_send_async_msg_to_pf(nic, &mbx);
}
+
+void
+nicvf_mbox_link_change(struct nicvf *nic)
+{
+ struct nic_mbx mbx = { .msg = { 0 } };
+
+ mbx.msg.msg = NIC_MBOX_MSG_BGX_LINK_CHANGE;
+ nicvf_mbox_send_async_msg_to_pf(nic, &mbx);
+}
diff --git a/drivers/net/thunderx/base/nicvf_mbox.h b/drivers/net/thunderx/base/nicvf_mbox.h
index d0b294362c..490bed206b 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.h
+++ b/drivers/net/thunderx/base/nicvf_mbox.h
@@ -222,5 +222,6 @@ int nicvf_mbox_reset_stat_counters(struct nicvf *nic, uint16_t rx_stat_mask,
int nicvf_mbox_set_link_up_down(struct nicvf *nic, bool enable);
void nicvf_mbox_shutdown(struct nicvf *nic);
void nicvf_mbox_cfg_done(struct nicvf *nic);
+void nicvf_mbox_link_change(struct nicvf *nic);
#endif /* __THUNDERX_NICVF_MBOX__ */
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index fc334cf734..addbd53735 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -71,6 +71,9 @@ nicvf_link_status_update(struct nicvf *nic,
link->link_autoneg = RTE_ETH_LINK_AUTONEG;
}
+/*Poll for link status change by sending NIC_MBOX_MSG_BGX_LINK_CHANGE msg
+ * periodically to PF.
+ */
static void
nicvf_interrupt(void *arg)
{
@@ -78,7 +81,10 @@ nicvf_interrupt(void *arg)
struct nicvf *nic = nicvf_pmd_priv(dev);
struct rte_eth_link link;
- if (nicvf_reg_poll_interrupts(nic) == NIC_MBOX_MSG_BGX_LINK_CHANGE) {
+ rte_eth_linkstatus_get(dev, &link);
+
+ nicvf_mbox_link_change(nic);
+ if (nic->link_up != link.link_status) {
if (dev->data->dev_conf.intr_conf.lsc) {
nicvf_link_status_update(nic, &link);
rte_eth_linkstatus_set(dev, &link);
@@ -89,7 +95,7 @@ nicvf_interrupt(void *arg)
}
}
- rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
+ rte_eal_alarm_set(NICVF_INTR_LINK_POLL_INTERVAL_MS * 1000,
nicvf_interrupt, dev);
}
@@ -1841,7 +1847,6 @@ nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic, bool cleanup)
static int
nicvf_dev_close(struct rte_eth_dev *dev)
{
- size_t i;
struct nicvf *nic = nicvf_pmd_priv(dev);
PMD_INIT_FUNC_TRACE();
@@ -1850,13 +1855,7 @@ nicvf_dev_close(struct rte_eth_dev *dev)
nicvf_dev_stop_cleanup(dev, true);
nicvf_periodic_alarm_stop(nicvf_interrupt, dev);
-
- for (i = 0; i < nic->sqs_count; i++) {
- if (!nic->snicvf[i])
- continue;
-
- nicvf_periodic_alarm_stop(nicvf_vf_interrupt, nic->snicvf[i]);
- }
+ nicvf_periodic_alarm_stop(nicvf_vf_interrupt, nic);
rte_intr_instance_free(nic->intr_handle);
@@ -2169,6 +2168,14 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
nicvf_disable_all_interrupts(nic);
+ /* To read mbox messages */
+ ret = nicvf_periodic_alarm_start(nicvf_vf_interrupt, nic);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to start period alarm");
+ goto fail;
+ }
+
+ /* To poll link status change*/
ret = nicvf_periodic_alarm_start(nicvf_interrupt, eth_dev);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to start period alarm");
@@ -2203,11 +2210,6 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->dev_private = NULL;
nicvf_periodic_alarm_stop(nicvf_interrupt, eth_dev);
- ret = nicvf_periodic_alarm_start(nicvf_vf_interrupt, nic);
- if (ret) {
- PMD_INIT_LOG(ERR, "Failed to start period alarm");
- goto fail;
- }
/* Detach port by returning positive error number */
return ENOTSUP;
diff --git a/drivers/net/thunderx/nicvf_ethdev.h b/drivers/net/thunderx/nicvf_ethdev.h
index cb474e26b8..a947b55fd4 100644
--- a/drivers/net/thunderx/nicvf_ethdev.h
+++ b/drivers/net/thunderx/nicvf_ethdev.h
@@ -10,10 +10,12 @@
#define THUNDERX_NICVF_PMD_VERSION "2.0"
#define THUNDERX_REG_BYTES 8
-#define NICVF_INTR_POLL_INTERVAL_MS 50
-#define NICVF_HALF_DUPLEX 0x00
-#define NICVF_FULL_DUPLEX 0x01
-#define NICVF_UNKNOWN_DUPLEX 0xff
+#define NICVF_INTR_POLL_INTERVAL_MS 50
+/* Poll for link state for every 2 sec */
+#define NICVF_INTR_LINK_POLL_INTERVAL_MS 2000
+#define NICVF_HALF_DUPLEX 0x00
+#define NICVF_FULL_DUPLEX 0x01
+#define NICVF_UNKNOWN_DUPLEX 0xff
#define NICVF_RSS_OFFLOAD_PASS1 ( \
RTE_ETH_RSS_PORT | \
--
2.18.0
next prev parent reply other threads:[~2022-05-24 8:43 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 17:39 [PATCH 01/12] config: add thundert83 config Harman Kalra
2022-05-17 17:39 ` [PATCH 02/12] event/octeontx: fix SSO fastpath Harman Kalra
2022-05-23 16:10 ` [PATCH v2 01/11] " Harman Kalra
2022-05-23 16:10 ` [PATCH v2 02/11] net/octeontx: fix port close Harman Kalra
2022-05-23 16:10 ` [PATCH v2 03/11] net/octeontx: setting link attributes Harman Kalra
2022-05-23 16:10 ` [PATCH v2 04/11] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-23 16:10 ` [PATCH v2 05/11] net/thunderx: implement polling of link state change Harman Kalra
2022-05-23 16:10 ` [PATCH v2 06/11] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-23 16:10 ` [PATCH v2 07/11] net/thunderx: setting link attributes Harman Kalra
2022-05-23 16:10 ` [PATCH v2 08/11] net/octeontx: implement xstats Harman Kalra
2022-05-23 16:10 ` [PATCH v2 09/11] net/octeontx: support allmulticast Harman Kalra
2022-05-23 16:10 ` [PATCH v2 10/11] net/thunderx: device attach from secondary Harman Kalra
2022-05-23 16:11 ` [PATCH v2 11/11] net/thunderx: populate max and min MTU values Harman Kalra
2022-05-24 8:42 ` [PATCH v3 01/11] event/octeontx: fix SSO fastpath Harman Kalra
2022-05-24 8:42 ` [PATCH v3 02/11] net/octeontx: fix port close Harman Kalra
2022-05-24 8:42 ` [PATCH v3 03/11] net/octeontx: setting link attributes Harman Kalra
2022-05-24 8:42 ` [PATCH v3 04/11] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-24 8:42 ` Harman Kalra [this message]
2022-05-24 8:42 ` [PATCH v3 06/11] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-24 8:42 ` [PATCH v3 07/11] net/thunderx: setting link attributes Harman Kalra
2022-05-24 8:42 ` [PATCH v3 08/11] net/octeontx: implement xstats Harman Kalra
2022-06-09 16:13 ` Jerin Jacob
2022-05-24 8:42 ` [PATCH v3 09/11] net/octeontx: support allmulticast Harman Kalra
2022-05-24 8:42 ` [PATCH v3 10/11] net/thunderx: device attach from secondary Harman Kalra
2022-05-24 8:42 ` [PATCH v3 11/11] net/thunderx: populate max and min MTU values Harman Kalra
2022-06-09 15:55 ` Jerin Jacob
2022-06-09 15:53 ` [PATCH v3 01/11] event/octeontx: fix SSO fastpath Jerin Jacob
2022-05-17 17:39 ` [PATCH 03/12] net/octeontx: fix port close Harman Kalra
2022-05-17 17:39 ` [PATCH 04/12] net/octeontx: setting link attributes Harman Kalra
2022-05-17 17:39 ` [PATCH 05/12] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-17 17:39 ` [PATCH 06/12] net/thunderx: implement polling of link state change Harman Kalra
2022-05-17 17:39 ` [PATCH 07/12] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-17 17:39 ` [PATCH 08/12] net/thunderx: setting link attributes Harman Kalra
2022-05-17 17:39 ` [PATCH 09/12] net/octeontx: implement xstats Harman Kalra
2022-05-17 17:39 ` [PATCH 10/12] net/octeontx: support allmulticast Harman Kalra
2022-05-17 17:39 ` [PATCH 11/12] net/thunderx: device attach from secondary Harman Kalra
2022-05-17 17:39 ` [PATCH 12/12] net/thunderx: populate max and min MTU values Harman Kalra
2022-05-18 6:10 ` [PATCH 01/12] config: add thundert83 config Ruifeng Wang
2022-05-23 13:34 ` [PATCH v2] config: add thunderX t83 config Harman Kalra
2022-06-01 22:02 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220524084235.17796-5-hkalra@marvell.com \
--to=hkalra@marvell.com \
--cc=dev@dpdk.org \
--cc=hpothula@marvell.com \
--cc=jerinj@marvell.com \
--cc=mczekaj@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).