DPDK patches and discussions
 help / color / Atom feed
From: Sunil Kumar Kori <skori@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Vamsi Attunuru <vattunuru@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Sunil Kumar Kori <skori@marvell.com>
Subject: [dpdk-dev] [PATCH v2 4/4] drivers/octeontx2: enhancing mbox APIs to get response
Date: Wed, 27 Nov 2019 15:52:22 +0530
Message-ID: <20191127102222.31940-4-skori@marvell.com> (raw)
In-Reply-To: <20191127102222.31940-1-skori@marvell.com>

Based on thread context, mbox API will get response for submitted
request. If thread runs in interrupt context then it uses polling
based get response API otherwise interrupt based.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v2:
 - Included Makefile and meson build changes.
 - Rebased patch on 19.11-rc4

 drivers/common/octeontx2/otx2_dev.c   | 27 ++++++++++++---------------
 drivers/common/octeontx2/otx2_mbox.h  | 21 +++++++++++++++++----
 drivers/net/octeontx2/Makefile        |  2 ++
 drivers/net/octeontx2/meson.build     |  2 ++
 drivers/raw/octeontx2_dma/Makefile    |  2 ++
 drivers/raw/octeontx2_dma/meson.build |  2 ++
 6 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
index 6f29d6108..d61c712fa 100644
--- a/drivers/common/octeontx2/otx2_dev.c
+++ b/drivers/common/octeontx2/otx2_dev.c
@@ -577,17 +577,16 @@ otx2_pf_vf_mbox_irq(void *param)
 
 	intr = otx2_read64(dev->bar2 + RVU_VF_INT);
 	if (intr == 0)
-		return;
+		otx2_base_dbg("Proceeding to check mbox UP messages if any");
 
 	otx2_write64(intr, dev->bar2 + RVU_VF_INT);
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr) {
-		/* First process all configuration messages */
-		otx2_process_msgs(dev, dev->mbox);
 
-		/* Process Uplink messages */
-		otx2_process_msgs_up(dev, &dev->mbox_up);
-	}
+	/* First process all configuration messages */
+	otx2_process_msgs(dev, dev->mbox);
+
+	/* Process Uplink messages */
+	otx2_process_msgs_up(dev, &dev->mbox_up);
 }
 
 static void
@@ -598,18 +597,16 @@ otx2_af_pf_mbox_irq(void *param)
 
 	intr = otx2_read64(dev->bar2 + RVU_PF_INT);
 	if (intr == 0)
-		return;
+		otx2_base_dbg("Proceeding to check mbox UP messages if any");
 
 	otx2_write64(intr, dev->bar2 + RVU_PF_INT);
-
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr) {
-		/* First process all configuration messages */
-		otx2_process_msgs(dev, dev->mbox);
 
-		/* Process Uplink messages */
-		otx2_process_msgs_up(dev, &dev->mbox_up);
-	}
+	/* First process all configuration messages */
+	otx2_process_msgs(dev, dev->mbox);
+
+	/* Process Uplink messages */
+	otx2_process_msgs_up(dev, &dev->mbox_up);
 }
 
 static int
diff --git a/drivers/common/octeontx2/otx2_mbox.h b/drivers/common/octeontx2/otx2_mbox.h
index 237d4cf45..e82dfe530 100644
--- a/drivers/common/octeontx2/otx2_mbox.h
+++ b/drivers/common/octeontx2/otx2_mbox.h
@@ -9,6 +9,7 @@
 #include <stdbool.h>
 
 #include <rte_ether.h>
+#include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
 #include <otx2_common.h>
@@ -1627,28 +1628,40 @@ static inline int
 otx2_mbox_process(struct otx2_mbox *mbox)
 {
 	otx2_mbox_msg_send(mbox, 0);
-	return otx2_mbox_get_rsp(mbox, 0, NULL);
+	if (rte_thread_is_intr())
+		return otx2_mbox_get_rsp_poll(mbox, 0, NULL);
+	else
+		return otx2_mbox_get_rsp(mbox, 0, NULL);
 }
 
 static inline int
 otx2_mbox_process_msg(struct otx2_mbox *mbox, void **msg)
 {
 	otx2_mbox_msg_send(mbox, 0);
-	return otx2_mbox_get_rsp(mbox, 0, msg);
+	if (rte_thread_is_intr())
+		return otx2_mbox_get_rsp_poll(mbox, 0, msg);
+	else
+		return otx2_mbox_get_rsp(mbox, 0, msg);
 }
 
 static inline int
 otx2_mbox_process_tmo(struct otx2_mbox *mbox, uint32_t tmo)
 {
 	otx2_mbox_msg_send(mbox, 0);
-	return otx2_mbox_get_rsp_tmo(mbox, 0, NULL, tmo);
+	if (rte_thread_is_intr())
+		return otx2_mbox_get_rsp_poll_tmo(mbox, 0, NULL, tmo);
+	else
+		return otx2_mbox_get_rsp_tmo(mbox, 0, NULL, tmo);
 }
 
 static inline int
 otx2_mbox_process_msg_tmo(struct otx2_mbox *mbox, void **msg, uint32_t tmo)
 {
 	otx2_mbox_msg_send(mbox, 0);
-	return otx2_mbox_get_rsp_tmo(mbox, 0, msg, tmo);
+	if (rte_thread_is_intr())
+		return otx2_mbox_get_rsp_poll_tmo(mbox, 0, msg, tmo);
+	else
+		return otx2_mbox_get_rsp_tmo(mbox, 0, msg, tmo);
 }
 
 int otx2_send_ready_msg(struct otx2_mbox *mbox, uint16_t *pf_func /* out */);
diff --git a/drivers/net/octeontx2/Makefile b/drivers/net/octeontx2/Makefile
index 68f5765db..3da4d8cc1 100644
--- a/drivers/net/octeontx2/Makefile
+++ b/drivers/net/octeontx2/Makefile
@@ -26,6 +26,8 @@ CFLAGS += -diag-disable 2259
 endif
 endif
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
 EXPORT_MAP := rte_pmd_octeontx2_version.map
 
 #
diff --git a/drivers/net/octeontx2/meson.build b/drivers/net/octeontx2/meson.build
index fad3076a3..a976a2c19 100644
--- a/drivers/net/octeontx2/meson.build
+++ b/drivers/net/octeontx2/meson.build
@@ -24,6 +24,8 @@ sources = files('otx2_rx.c',
 		'otx2_ethdev_devargs.c'
 		)
 
+allow_experimental_apis = true
+
 deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2']
 
 cflags += ['-flax-vector-conversions']
diff --git a/drivers/raw/octeontx2_dma/Makefile b/drivers/raw/octeontx2_dma/Makefile
index c64ca3497..0d0c530fe 100644
--- a/drivers/raw/octeontx2_dma/Makefile
+++ b/drivers/raw/octeontx2_dma/Makefile
@@ -22,6 +22,8 @@ CFLAGS += -diag-disable 2259
 endif
 endif
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
 EXPORT_MAP := rte_rawdev_octeontx2_dma_version.map
 
 #
diff --git a/drivers/raw/octeontx2_dma/meson.build b/drivers/raw/octeontx2_dma/meson.build
index 11f74680a..f8f88aa7e 100644
--- a/drivers/raw/octeontx2_dma/meson.build
+++ b/drivers/raw/octeontx2_dma/meson.build
@@ -5,6 +5,8 @@
 deps += ['bus_pci', 'common_octeontx2', 'rawdev']
 sources = files('otx2_dpi_rawdev.c', 'otx2_dpi_msg.c', 'otx2_dpi_test.c')
 
+allow_experimental_apis = true
+
 extra_flags = []
 # This integrated controller runs only on a arm64 machine, remove 32bit warnings
 if not dpdk_conf.get('RTE_ARCH_64')
-- 
2.17.1


  parent reply index

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 11:35 [dpdk-dev] [PATCH 1/5] drivers/octeontx2: allow experimental symbols Sunil Kumar Kori
2019-11-25 11:35 ` [dpdk-dev] [PATCH v3 2/5] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-11-25 11:35 ` [dpdk-dev] [PATCH 3/5] common/octeontx2: add interrupt offset to mbox structure Sunil Kumar Kori
2019-11-25 11:35 ` [dpdk-dev] [PATCH 4/5] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-11-25 11:35 ` [dpdk-dev] [PATCH 5/5] common/octeontx2: enhancing mbox APIs to get response Sunil Kumar Kori
2019-11-26  6:15 ` [dpdk-dev] [PATCH v2 1/5] drivers/octeontx2: allow experimental symbols Sunil Kumar Kori
2019-11-26 16:21   ` Thomas Monjalon
2019-11-27  8:34     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2019-11-27  9:42       ` Thomas Monjalon
2019-11-27 10:22   ` [dpdk-dev] [PATCH v2 1/4] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-11-27 10:22     ` [dpdk-dev] [PATCH v2 2/4] common/octeontx2: add interrupt offset to mbox structure Sunil Kumar Kori
2019-11-27 10:22     ` [dpdk-dev] [PATCH v2 3/4] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-11-27 10:22     ` Sunil Kumar Kori [this message]
2019-11-28  0:03     ` [dpdk-dev] [PATCH v2 1/4] eal: add API to check if its interrupt context Stephen Hemminger
2019-11-28  8:10       ` [dpdk-dev] [EXT] " Harman Kalra
2019-11-28 16:45         ` Stephen Hemminger
2019-12-04 16:23           ` Harman Kalra
2019-12-16 10:39     ` [dpdk-dev] [PATCH v3 1/2] " Sunil Kumar Kori
2019-12-16 10:39       ` [dpdk-dev] [PATCH v3 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-12-17  8:02         ` Gavin Hu (Arm Technology China)
2019-12-17 11:14           ` Jerin Jacob
2019-12-18  2:45             ` Gavin Hu
2019-12-17 10:42         ` [dpdk-dev] [PATCH v4 1/2] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-12-17 10:42           ` [dpdk-dev] [PATCH v4 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-12-17 16:53         ` [dpdk-dev] [PATCH v4 1/2] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-12-17 16:53           ` [dpdk-dev] [PATCH v4 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-12-18  2:54             ` Gavin Hu
2019-12-18  7:07           ` [dpdk-dev] [PATCH v5 1/2] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-12-18  7:07             ` [dpdk-dev] [PATCH v5 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2019-12-20  6:56               ` [dpdk-dev] [PATCH v6 1/2] eal: add API to check if its interrupt context Sunil Kumar Kori
2019-12-20  6:56                 ` [dpdk-dev] [PATCH v6 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2020-01-14  8:41                   ` Jerin Jacob
2020-01-14 10:17                     ` Thomas Monjalon
2020-01-14  9:04                   ` [dpdk-dev] [PATCH v7 1/2] eal: add API to check if its interrupt context Sunil Kumar Kori
2020-01-14  9:04                     ` [dpdk-dev] [PATCH v7 2/2] common/octeontx2: add polling based response mbox message Sunil Kumar Kori
2020-01-21  8:37                       ` Sunil Kumar Kori
2020-02-06 15:35                     ` [dpdk-dev] [PATCH v7 1/2] eal: add API to check if its interrupt context David Marchand
2020-01-14  8:37                 ` [dpdk-dev] [PATCH v6 " Jerin Jacob

Reply instructions:

You may reply publically 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=20191127102222.31940-4-skori@marvell.com \
    --to=skori@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=vattunuru@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

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox