From: Harman Kalra <hkalra@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
"Kiran Kumar K" <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>
Subject: [PATCH 1/2] common/cnxk: fix handling up and down interrupts
Date: Thu, 5 Oct 2023 11:55:12 +0530 [thread overview]
Message-ID: <20231005062513.29467-1-hkalra@marvell.com> (raw)
Down messages should be processed only when down interrupt is received
while UP messages should be processed when up interrupt is received.
A scenario has been observed where processing down message on UP
message interrupt causes processing of old message response while
response of latest message is not received.
Fixes: fa4ee2d43188 ("common/cnxk: sync between mbox up and down messages")
Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
drivers/common/cnxk/roc_dev.c | 40 ++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index e41235ea8a..c948caba63 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -770,14 +770,22 @@ roc_pf_vf_mbox_irq(void *param)
* by 1ms until this region is zeroed mbox_wait_for_zero()
*/
mbox_data = plt_read64(dev->bar2 + RVU_VF_VFPF_MBOX0);
- if (mbox_data)
- plt_write64(!mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);
+ /* If interrupt occurred for down message */
+ if (mbox_data & MBOX_DOWN_MSG) {
+ mbox_data &= ~MBOX_DOWN_MSG;
+ plt_write64(mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);
- /* First process all configuration messages */
- process_msgs(dev, dev->mbox);
+ /* First process all configuration messages */
+ process_msgs(dev, dev->mbox);
+ }
+ /* If interrupt occurred for UP message */
+ if (mbox_data & MBOX_UP_MSG) {
+ mbox_data &= ~MBOX_UP_MSG;
+ plt_write64(mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);
- /* Process Uplink messages */
- process_msgs_up(dev, &dev->mbox_up);
+ /* Process Uplink messages */
+ process_msgs_up(dev, &dev->mbox_up);
+ }
}
/* IRQ to PF from AF - PF context (interrupt thread) */
@@ -799,14 +807,22 @@ roc_af_pf_mbox_irq(void *param)
* by 1ms until this region is zeroed mbox_wait_for_zero()
*/
mbox_data = plt_read64(dev->bar2 + RVU_PF_PFAF_MBOX0);
- if (mbox_data)
- plt_write64(!mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);
+ /* If interrupt occurred for down message */
+ if (mbox_data & MBOX_DOWN_MSG) {
+ mbox_data &= ~MBOX_DOWN_MSG;
+ plt_write64(mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);
- /* First process all configuration messages */
- process_msgs(dev, dev->mbox);
+ /* First process all configuration messages */
+ process_msgs(dev, dev->mbox);
+ }
+ /* If interrupt occurred for up message */
+ if (mbox_data & MBOX_UP_MSG) {
+ mbox_data &= ~MBOX_UP_MSG;
+ plt_write64(mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);
- /* Process Uplink messages */
- process_msgs_up(dev, &dev->mbox_up);
+ /* Process Uplink messages */
+ process_msgs_up(dev, &dev->mbox_up);
+ }
}
static int
--
2.18.0
next reply other threads:[~2023-10-05 6:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 6:25 Harman Kalra [this message]
2023-10-05 6:25 ` [PATCH 2/2] common/cnxk: fix race condition between up and down mbox Harman Kalra
2023-10-05 14:16 ` Jerin Jacob
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=20231005062513.29467-1-hkalra@marvell.com \
--to=hkalra@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@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).