DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server
@ 2018-09-27 11:26 Raslan Darawsheh
  2018-09-27 11:36 ` Thomas Monjalon
  2018-09-27 11:51 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
  0 siblings, 2 replies; 7+ messages in thread
From: Raslan Darawsheh @ 2018-09-27 11:26 UTC (permalink / raw)
  To: thomas; +Cc: dev, shahafs, rasland, orika

add sigint handler in the server application to stop and close ports

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

---
v2:
	- fix includes order
---
---
 examples/multi_process/client_server_mp/mp_server/main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 93a9a08..16aa944 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -37,6 +37,7 @@
 #include "common.h"
 #include "args.h"
 #include "init.h"
+#include<signal.h>
 
 /*
  * When doing reads from the NIC or the client queues,
@@ -264,9 +265,21 @@ do_packet_forwarding(void)
 	}
 }
 
+static void signal_handler(int signal)
+{
+	uint16_t port_id;
+
+	if (signal == SIGINT)
+		RTE_ETH_FOREACH_DEV(port_id) {
+			rte_eth_dev_stop(port_id);
+			rte_eth_dev_close(port_id);
+		}
+	exit(0);
+}
 int
 main(int argc, char *argv[])
 {
+	signal(SIGINT, signal_handler);
 	/* initialise the system */
 	if (init(argc, argv) < 0 )
 		return -1;
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server
  2018-09-27 11:26 [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server Raslan Darawsheh
@ 2018-09-27 11:36 ` Thomas Monjalon
  2018-09-27 12:30   ` Bruce Richardson
  2018-09-27 11:51 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2018-09-27 11:36 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: dev, shahafs, orika

27/09/2018 13:26, Raslan Darawsheh:
> v2:
> 	- fix includes order

I'm afraid you will need a v3 to fix spacing :)

> --- a/examples/multi_process/client_server_mp/mp_server/main.c
> +++ b/examples/multi_process/client_server_mp/mp_server/main.c
> @@ -37,6 +37,7 @@
>  #include "common.h"
>  #include "args.h"
>  #include "init.h"
> +#include<signal.h>

A space is missing here.

> +static void signal_handler(int signal)
> +{
> +	uint16_t port_id;
> +
> +	if (signal == SIGINT)
> +		RTE_ETH_FOREACH_DEV(port_id) {
> +			rte_eth_dev_stop(port_id);
> +			rte_eth_dev_close(port_id);
> +		}
> +	exit(0);
> +}
>  int
>  main(int argc, char *argv[])

A blank line is missing between the functions.

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

* [dpdk-dev] [PATCH v3] examples/client_server_mp: add sigint handler to server
  2018-09-27 11:26 [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server Raslan Darawsheh
  2018-09-27 11:36 ` Thomas Monjalon
@ 2018-09-27 11:51 ` Raslan Darawsheh
  2018-11-04 20:42   ` Thomas Monjalon
  1 sibling, 1 reply; 7+ messages in thread
From: Raslan Darawsheh @ 2018-09-27 11:51 UTC (permalink / raw)
  To: thomas; +Cc: dev, shahafs, rasland, orika

add sigint handler in the server application to stop and close ports

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

---
v2:
	- fix includes order

v3:
	- fix spacing
---
---
 examples/multi_process/client_server_mp/mp_server/main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 93a9a08..0ddc63e 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -12,6 +12,7 @@
 #include <sys/queue.h>
 #include <errno.h>
 #include <netinet/ip.h>
+#include <signal.h>
 
 #include <rte_common.h>
 #include <rte_memory.h>
@@ -264,9 +265,23 @@ do_packet_forwarding(void)
 	}
 }
 
+static void
+signal_handler(int signal)
+{
+	uint16_t port_id;
+
+	if (signal == SIGINT)
+		RTE_ETH_FOREACH_DEV(port_id) {
+			rte_eth_dev_stop(port_id);
+			rte_eth_dev_close(port_id);
+		}
+	exit(0);
+}
+
 int
 main(int argc, char *argv[])
 {
+	signal(SIGINT, signal_handler);
 	/* initialise the system */
 	if (init(argc, argv) < 0 )
 		return -1;
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server
  2018-09-27 11:36 ` Thomas Monjalon
@ 2018-09-27 12:30   ` Bruce Richardson
  2018-09-27 12:48     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Bruce Richardson @ 2018-09-27 12:30 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Raslan Darawsheh, dev, shahafs, orika

On Thu, Sep 27, 2018 at 01:36:06PM +0200, Thomas Monjalon wrote:
> 27/09/2018 13:26, Raslan Darawsheh:
> > v2:
> > 	- fix includes order
> 
> I'm afraid you will need a v3 to fix spacing :)
> 
> > --- a/examples/multi_process/client_server_mp/mp_server/main.c
> > +++ b/examples/multi_process/client_server_mp/mp_server/main.c
> > @@ -37,6 +37,7 @@
> >  #include "common.h"
> >  #include "args.h"
> >  #include "init.h"
> > +#include<signal.h>
> 
> A space is missing here.
> 

Also, the norm in DPDK is to list all standard headers first, then the DPDK
headers and finally the local headers. "signal.h" therefore should be
further up in the file, with the first group.

> > +static void signal_handler(int signal)
> > +{
> > +	uint16_t port_id;
> > +
> > +	if (signal == SIGINT)
> > +		RTE_ETH_FOREACH_DEV(port_id) {
> > +			rte_eth_dev_stop(port_id);
> > +			rte_eth_dev_close(port_id);
> > +		}
> > +	exit(0);
> > +}
> >  int
> >  main(int argc, char *argv[])
> 
> A blank line is missing between the functions.
> 
> 

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

* Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server
  2018-09-27 12:30   ` Bruce Richardson
@ 2018-09-27 12:48     ` Thomas Monjalon
  2018-09-27 14:37       ` Bruce Richardson
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2018-09-27 12:48 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Raslan Darawsheh, dev, shahafs, orika

27/09/2018 14:30, Bruce Richardson:
> On Thu, Sep 27, 2018 at 01:36:06PM +0200, Thomas Monjalon wrote:
> > 27/09/2018 13:26, Raslan Darawsheh:
> > > v2:
> > > 	- fix includes order
> > 
> > I'm afraid you will need a v3 to fix spacing :)
> > 
> > > --- a/examples/multi_process/client_server_mp/mp_server/main.c
> > > +++ b/examples/multi_process/client_server_mp/mp_server/main.c
> > > @@ -37,6 +37,7 @@
> > >  #include "common.h"
> > >  #include "args.h"
> > >  #include "init.h"
> > > +#include<signal.h>
> > 
> > A space is missing here.
> > 
> 
> Also, the norm in DPDK is to list all standard headers first, then the DPDK
> headers and finally the local headers. "signal.h" therefore should be
> further up in the file, with the first group.

I think he did that already in v3 :)

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

* Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server
  2018-09-27 12:48     ` Thomas Monjalon
@ 2018-09-27 14:37       ` Bruce Richardson
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2018-09-27 14:37 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Raslan Darawsheh, dev, shahafs, orika

On Thu, Sep 27, 2018 at 02:48:38PM +0200, Thomas Monjalon wrote:
> 27/09/2018 14:30, Bruce Richardson:
> > On Thu, Sep 27, 2018 at 01:36:06PM +0200, Thomas Monjalon wrote:
> > > 27/09/2018 13:26, Raslan Darawsheh:
> > > > v2:
> > > > 	- fix includes order
> > > 
> > > I'm afraid you will need a v3 to fix spacing :)
> > > 
> > > > --- a/examples/multi_process/client_server_mp/mp_server/main.c
> > > > +++ b/examples/multi_process/client_server_mp/mp_server/main.c
> > > > @@ -37,6 +37,7 @@
> > > >  #include "common.h"
> > > >  #include "args.h"
> > > >  #include "init.h"
> > > > +#include<signal.h>
> > > 
> > > A space is missing here.
> > > 
> > 
> > Also, the norm in DPDK is to list all standard headers first, then the DPDK
> > headers and finally the local headers. "signal.h" therefore should be
> > further up in the file, with the first group.
> 
> I think he did that already in v3 :)
> 
Yes, he did. I just need the ability to read all mails in parallel, while
also typing up new ones. :-)

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

* Re: [dpdk-dev] [PATCH v3] examples/client_server_mp: add sigint handler to server
  2018-09-27 11:51 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
@ 2018-11-04 20:42   ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-04 20:42 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: dev, shahafs, orika

27/09/2018 13:51, Raslan Darawsheh:
> add sigint handler in the server application to stop and close ports
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

Applied, thanks

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

end of thread, other threads:[~2018-11-04 20:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 11:26 [dpdk-dev] [PATCH v2] examples/client_server_mp: add sigint handler to server Raslan Darawsheh
2018-09-27 11:36 ` Thomas Monjalon
2018-09-27 12:30   ` Bruce Richardson
2018-09-27 12:48     ` Thomas Monjalon
2018-09-27 14:37       ` Bruce Richardson
2018-09-27 11:51 ` [dpdk-dev] [PATCH v3] " Raslan Darawsheh
2018-11-04 20:42   ` Thomas Monjalon

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