Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 0/4] Fix bug of fixing slow command reply
@ 2019-01-15  3:29 ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 1/4] shared: define interval time to retry connection ogawa.yasufumi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ogawa.yasufumi @ 2019-01-15  3:29 UTC (permalink / raw)
  To: ferruh.yigit, spp, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to fix incorrect fixing of slow command reply for spp_vf
and spp_mirror. It was applied as following updates, but not fixed the
problem.

* ab5183201c02 ("spp_vf: add sleep after disconnection detection")
* 5eea2dfa5420 ("fix slow response of command")

To reduce time for making command reply, replace sleep(1) to usleep(100)
for, and add another sleep(1) to avoid sending too much requests if sock
is closed and retry in previous patches. However, response is still slow
because the place of added sleep(1) is incorrect.

This series of update is to fix the problem. It also includes a
definition of interval time `CONN_RETRY_USEC` to be configured in micro
sec.

Yasufumi Ogawa (4):
  shared: define interval time to retry connection
  primary: change interval to retry connection
  spp_nfv: change interval to retry connection
  spp_vf: fix bug of fixing slow command reply

 src/nfv/main.c               | 2 +-
 src/primary/main.c           | 2 +-
 src/shared/common.h          | 3 +++
 src/vf/common/command_conn.c | 4 ++++
 src/vf/common/command_proc.c | 9 ++++-----
 src/vf/spp_vf.c              | 4 +---
 6 files changed, 14 insertions(+), 10 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [spp] [PATCH 1/4] shared: define interval time to retry connection
  2019-01-15  3:29 [spp] [PATCH 0/4] Fix bug of fixing slow command reply ogawa.yasufumi
@ 2019-01-15  3:29 ` ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 2/4] primary: change interval " ogawa.yasufumi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ogawa.yasufumi @ 2019-01-15  3:29 UTC (permalink / raw)
  To: ferruh.yigit, spp, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to define a common const `CONN_RETRY_USEC` for defining
interval time to retry connection in micro sec. The default value is
1,000,000 usec (= 1 sec).

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/common.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/shared/common.h b/src/shared/common.h
index cde013e..e244db9 100644
--- a/src/shared/common.h
+++ b/src/shared/common.h
@@ -23,6 +23,9 @@
 
 #define NO_FLAGS 0
 
+/* Interval time to retry connection. */
+#define CONN_RETRY_USEC (1000 * 1000)  /* micro sec */
+
 /*
  * When doing reads from the NIC or the client queues,
  * use this batch size
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [spp] [PATCH 2/4] primary: change interval to retry connection
  2019-01-15  3:29 [spp] [PATCH 0/4] Fix bug of fixing slow command reply ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 1/4] shared: define interval time to retry connection ogawa.yasufumi
@ 2019-01-15  3:29 ` ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 3/4] spp_nfv: " ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 4/4] spp_vf: fix bug of fixing slow command reply ogawa.yasufumi
  3 siblings, 0 replies; 5+ messages in thread
From: ogawa.yasufumi @ 2019-01-15  3:29 UTC (permalink / raw)
  To: ferruh.yigit, spp, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to change interval time of connection retry from fixed
`sleep(1)` to `usleep(CONN_RETRY_USEC)` to be configurable.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/primary/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/primary/main.c b/src/primary/main.c
index 12b86e5..81d1aec 100644
--- a/src/primary/main.c
+++ b/src/primary/main.c
@@ -414,7 +414,7 @@ main(int argc, char *argv[])
 	while (on) {
 		ret = do_connection(&connected, &sock);
 		if (ret < 0) {
-			sleep(1);
+			usleep(CONN_RETRY_USEC);
 			continue;
 		}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [spp] [PATCH 3/4] spp_nfv: change interval to retry connection
  2019-01-15  3:29 [spp] [PATCH 0/4] Fix bug of fixing slow command reply ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 1/4] shared: define interval time to retry connection ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 2/4] primary: change interval " ogawa.yasufumi
@ 2019-01-15  3:29 ` ogawa.yasufumi
  2019-01-15  3:29 ` [spp] [PATCH 4/4] spp_vf: fix bug of fixing slow command reply ogawa.yasufumi
  3 siblings, 0 replies; 5+ messages in thread
From: ogawa.yasufumi @ 2019-01-15  3:29 UTC (permalink / raw)
  To: ferruh.yigit, spp, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to change interval time of connection retry from fixed
`sleep(1)` to `usleep(CONN_RETRY_USEC)` to be configurable.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/nfv/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nfv/main.c b/src/nfv/main.c
index ce7e07d..701a700 100644
--- a/src/nfv/main.c
+++ b/src/nfv/main.c
@@ -229,7 +229,7 @@ main(int argc, char *argv[])
 	while (on) {
 		ret = do_connection(&connected, &sock);
 		if (ret < 0) {
-			sleep(1);
+			usleep(CONN_RETRY_USEC);
 			continue;
 		}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [spp] [PATCH 4/4] spp_vf: fix bug of fixing slow command reply
  2019-01-15  3:29 [spp] [PATCH 0/4] Fix bug of fixing slow command reply ogawa.yasufumi
                   ` (2 preceding siblings ...)
  2019-01-15  3:29 ` [spp] [PATCH 3/4] spp_nfv: " ogawa.yasufumi
@ 2019-01-15  3:29 ` ogawa.yasufumi
  3 siblings, 0 replies; 5+ messages in thread
From: ogawa.yasufumi @ 2019-01-15  3:29 UTC (permalink / raw)
  To: ferruh.yigit, spp, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to fix incorrect fixing of slow command reply.

To reduce time for making command reply, replace sleep(1) to usleep(100)
for, and add another sleep(1) to avoid sending too much requests if sock
is closed and retry in previous patches. However, response is still slow
because the place of added sleep(1) is incorrect.

Fixes: ab5183201c02 ("spp_vf: add sleep after disconnection detection")
Fixes: 5eea2dfa5420 ("fix slow response of command")

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/vf/common/command_conn.c | 4 ++++
 src/vf/common/command_proc.c | 9 ++++-----
 src/vf/spp_vf.c              | 4 +---
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/vf/common/command_conn.c b/src/vf/common/command_conn.c
index a72180a..915ad20 100644
--- a/src/vf/common/command_conn.c
+++ b/src/vf/common/command_conn.c
@@ -12,6 +12,7 @@
 #include <rte_log.h>
 #include <rte_branch_prediction.h>
 
+#include "shared/common.h"
 #include "string_buffer.h"
 #include "command_conn.h"
 
@@ -70,6 +71,9 @@ spp_connect_to_controller(int *sock)
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
 				"Cannot connect to controller. errno=%d\n",
 				errno);
+		/* Wait to retry */
+		usleep(CONN_RETRY_USEC);
+
 		close(*sock);
 		*sock = -1;
 		return SPP_CONNERR_TEMPORARY;
diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index 0e5c5f1..3011873 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -1644,18 +1644,17 @@ spp_command_proc_do(void)
 	}
 
 	ret = spp_connect_to_controller(&sock);
+
 	if (unlikely(ret != SPP_RET_OK))
 		return SPP_RET_OK;
 
 	msg_ret = spp_receive_message(&sock, &msgbuf);
 	if (unlikely(msg_ret <= 0)) {
-		if (likely(msg_ret == 0)) {
-			sleep(1);
+		if (likely(msg_ret == 0))
 			return SPP_RET_OK;
-		} else if (unlikely(msg_ret == SPP_CONNERR_TEMPORARY)) {
-			sleep(1);
+		else if (unlikely(msg_ret == SPP_CONNERR_TEMPORARY))
 			return SPP_RET_OK;
-		} else
+		else
 			return SPP_RET_NG;
 	}
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index b81ad11..b98444d 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -350,10 +350,8 @@ main(int argc, char *argv[])
 				break;
 
 		       /*
-			* To avoid making CPU busy, this thread waits
-			* here for 100 ms.
+			* Wait to avoid CPU overloaded.
 			*/
-
 			usleep(100);
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-15  3:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15  3:29 [spp] [PATCH 0/4] Fix bug of fixing slow command reply ogawa.yasufumi
2019-01-15  3:29 ` [spp] [PATCH 1/4] shared: define interval time to retry connection ogawa.yasufumi
2019-01-15  3:29 ` [spp] [PATCH 2/4] primary: change interval " ogawa.yasufumi
2019-01-15  3:29 ` [spp] [PATCH 3/4] spp_nfv: " ogawa.yasufumi
2019-01-15  3:29 ` [spp] [PATCH 4/4] spp_vf: fix bug of fixing slow command reply ogawa.yasufumi

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).