DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 3/4] examples/multi_process/client_server_mp/mp_server: fix style
Date: Fri, 2 Aug 2019 13:09:34 +0200	[thread overview]
Message-ID: <CAJFAV8zyDGCxBntzHaeRoLhNgzWhKoR5EYt-ku7s7dSqM7iMSA@mail.gmail.com> (raw)
In-Reply-To: <20190802025826.1174-4-stephen@networkplumber.org>

On Fri, Aug 2, 2019 at 4:59 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Lots of little style complaints from checkpatch.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  .../client_server_mp/mp_server/args.c         | 37 ++++-----
>  .../client_server_mp/mp_server/init.c         | 79 +++++++++++--------
>  .../client_server_mp/mp_server/main.c         | 44 ++++++-----
>  3 files changed, 88 insertions(+), 72 deletions(-)
>
> diff --git a/examples/multi_process/client_server_mp/mp_server/args.c b/examples/multi_process/client_server_mp/mp_server/args.c
> index fdc008b3d677..91c823856a72 100644
> --- a/examples/multi_process/client_server_mp/mp_server/args.c
> +++ b/examples/multi_process/client_server_mp/mp_server/args.c
> @@ -112,33 +112,34 @@ parse_app_args(int argc, char *argv[])
>         progname = argv[0];
>
>         while ((opt = getopt_long(argc, argvopt, "n:p:", lgopts,
> -               &option_index)) != EOF){
> -               switch (opt){
> -                       case 'p':
> -                               if (parse_portmask(optarg) != 0) {
> -                                       usage();
> -                                       return -1;
> -                               }
> -                               break;
> -                       case 'n':
> -                               if (parse_num_clients(optarg) != 0){
> -                                       usage();
> -                                       return -1;
> -                               }
> -                               break;
> -                       default:
> -                               printf("ERROR: Unknown option '%c'\n", opt);
> +                                 &option_index)) != EOF) {
> +
> +               switch (opt) {
> +               case 'p':
> +                       if (parse_portmask(optarg) != 0) {
> +                               usage();
> +                               return -1;
> +                       }
> +                       break;
> +               case 'n':
> +                       if (parse_num_clients(optarg) != 0) {
>                                 usage();
>                                 return -1;
> +                       }
> +                       break;
> +               default:
> +                       printf("ERROR: Unknown option '%c'\n", opt);
> +                       usage();
> +                       return -1;
>                 }
>         }
>
> -       if (ports->num_ports == 0 || num_clients == 0){
> +       if (ports->num_ports == 0 || num_clients == 0) {
>                 usage();
>                 return -1;
>         }
>
> -       if (ports->num_ports % 2 != 0){
> +       if (ports->num_ports % 2 != 0) {
>                 printf("ERROR: application requires an even number of ports to use\n");
>                 return -1;
>         }
> diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
> index 1b0569937b51..96c35f220a7d 100644
> --- a/examples/multi_process/client_server_mp/mp_server/init.c
> +++ b/examples/multi_process/client_server_mp/mp_server/init.c
> @@ -49,7 +49,7 @@
>  struct rte_mempool *pktmbuf_pool;
>
>  /* array of info/queues for clients */
> -struct client *clients = NULL;
> +struct client *clients;
>
>  /* the port details */
>  struct port_info *ports;
> @@ -72,7 +72,8 @@ init_mbuf_pools(void)
>                 num_mbufs_server + num_mbufs_client + num_mbufs_mp_cache;
>
>         /* don't pass single-producer/single-consumer flags to mbuf create as it
> -        * seems faster to use a cache instead */
> +        * seems faster to use a cache instead
> +        */
>         printf("Creating mbuf pool '%s' [%u mbufs] ...\n",
>                         PKTMBUF_POOL_NAME, num_mbufs);
>         pktmbuf_pool = rte_pktmbuf_pool_create(PKTMBUF_POOL_NAME, num_mbufs,
> @@ -108,9 +109,11 @@ init_port(uint16_t port_num)
>         fflush(stdout);
>
>         /* Standard DPDK port initialisation - config port, then set up
> -        * rx and tx rings */
> -       if ((retval = rte_eth_dev_configure(port_num, rx_rings, tx_rings,
> -               &port_conf)) != 0)
> +        * rx and tx rings
> +        */
> +       retval = rte_eth_dev_configure(port_num, rx_rings, tx_rings,
> +                                      &port_conf);
> +       if (retval != 0)
>                 return retval;
>
>         retval = rte_eth_dev_adjust_nb_rx_tx_desc(port_num, &rx_ring_size,
> @@ -122,22 +125,25 @@ init_port(uint16_t port_num)
>                 retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
>                                 rte_eth_dev_socket_id(port_num),
>                                 NULL, pktmbuf_pool);
> -               if (retval < 0) return retval;
> +               if (retval < 0)
> +                       return retval;
>         }
>
> -       for ( q = 0; q < tx_rings; q ++ ) {
> +       for (q = 0; q < tx_rings; q++) {
>                 retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size,
>                                 rte_eth_dev_socket_id(port_num),
>                                 NULL);
> -               if (retval < 0) return retval;
> +               if (retval < 0)
> +                       return retval;
>         }
>
>         rte_eth_promiscuous_enable(port_num);
>
>         retval  = rte_eth_dev_start(port_num);
> -       if (retval < 0) return retval;
> +       if (retval < 0)
> +               return retval;
>
> -       printf( "done: \n");
> +       printf("done:\n");
>
>         return 0;
>  }
> @@ -150,15 +156,15 @@ init_port(uint16_t port_num)
>  static int
>  init_shm_rings(void)
>  {
> -       unsigned i;
> -       unsigned socket_id;
> -       const char * q_name;
> -       const unsigned ringsize = CLIENT_QUEUE_RINGSIZE;
> +       unsigned int i, socket_id;
> +       const char *q_name;
> +       const unsigned int ringsize = CLIENT_QUEUE_RINGSIZE;
>
>         clients = rte_malloc("client details",
>                 sizeof(*clients) * num_clients, 0);
>         if (clients == NULL)
> -               rte_exit(EXIT_FAILURE, "Cannot allocate memory for client program details\n");
> +               rte_exit(EXIT_FAILURE,
> +                        "Cannot allocate memory for client program details\n");
>
>         for (i = 0; i < num_clients; i++) {
>                 /* Create an RX queue for each client */
> @@ -166,13 +172,27 @@ init_shm_rings(void)
>                 q_name = get_rx_queue_name(i);
>                 clients[i].rx_q = rte_ring_create(q_name,
>                                 ringsize, socket_id,
> -                               RING_F_SP_ENQ | RING_F_SC_DEQ ); /* single prod, single cons */
> +                               RING_F_SP_ENQ | RING_F_SC_DEQ);
>                 if (clients[i].rx_q == NULL)
> -                       rte_exit(EXIT_FAILURE, "Cannot create rx ring queue for client %u\n", i);
> +                       rte_exit(EXIT_FAILURE,
> +                                "Cannot create rx ring queue for client %u\n",
> +                                i);
>         }
>         return 0;
>  }
>
> +static void
> +print_link_status(uint16 id, const struct rte_eth_link *link)


uint16_t

See build error at
http://mails.dpdk.org/archives/test-report/2019-August/092150.html


-- 
David Marchand

  reply	other threads:[~2019-08-02 11:09 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 15:09 [dpdk-dev] [PATCH v3 0/2] examples/client_server_mp: fix port issues Stephen Hemminger
2019-07-09 15:09 ` [dpdk-dev] [PATCH v3 1/2] examples/multi_process/client_server_mp: check port validity Stephen Hemminger
2019-07-09 15:09 ` [dpdk-dev] [PATCH v3 2/2] examples/multi_process - fix crash in mp_client with sparse ports Stephen Hemminger
2019-07-26 16:50 ` [dpdk-dev] [PATCH v4 0/4] examples/client_server_mp: fix port issues Stephen Hemminger
2019-07-26 16:50   ` [dpdk-dev] [PATCH v4 1/4] examples/multi_process/client_server_mp: check port validity Stephen Hemminger
2019-07-30  9:21     ` Matan Azrad
2019-07-30 15:56       ` Stephen Hemminger
2019-07-30 16:39         ` Matan Azrad
2019-07-30 16:50           ` Stephen Hemminger
2019-07-26 16:50   ` [dpdk-dev] [PATCH v4 2/4] examples/multi_process/client_server_mp - fix crash in mp_client with sparse ports Stephen Hemminger
2019-07-26 16:50   ` [dpdk-dev] [PATCH v4 3/4] examples/multi_process/client_server_mp/mp_server: fix style Stephen Hemminger
2019-07-26 16:50   ` [dpdk-dev] [PATCH v4 4/4] examples/multi_process/client_server_mp/mp_server: use ether format address Stephen Hemminger
2019-08-02  2:58   ` [dpdk-dev] [PATCH v5 0/4] examples/client_server_mp: port id fixes Stephen Hemminger
2019-08-02  2:58     ` [dpdk-dev] [PATCH v5 1/4] examples/multi_process/client_server_mp: check port validity Stephen Hemminger
2019-08-02  5:33       ` Matan Azrad
2019-08-02 15:53         ` Stephen Hemminger
2019-08-04  8:31           ` Matan Azrad
2019-08-05 16:00             ` Stephen Hemminger
2019-08-06  8:19               ` Matan Azrad
2019-08-06 15:39                 ` Stephen Hemminger
2019-08-06 20:03                   ` Matan Azrad
2019-08-06 23:09                     ` Stephen Hemminger
2019-08-07  5:38                       ` Matan Azrad
2019-08-07  5:53                         ` Stephen Hemminger
2019-08-07  7:02                           ` Matan Azrad
2019-08-07 15:15                             ` Stephen Hemminger
2019-08-02  2:58     ` [dpdk-dev] [PATCH v5 2/4] examples/multi_process/client_server_mp - fix crash in mp_client with sparse ports Stephen Hemminger
2019-08-02  2:58     ` [dpdk-dev] [PATCH v5 3/4] examples/multi_process/client_server_mp/mp_server: fix style Stephen Hemminger
2019-08-02 11:09       ` David Marchand [this message]
2019-08-02  2:58     ` [dpdk-dev] [PATCH v5 4/4] examples/multi_process/client_server_mp/mp_server: use ether format address Stephen Hemminger
2019-08-02 23:52   ` [dpdk-dev] [PATCH v6 0/2] examples/client_server_mp: port id (fixes only) Stephen Hemminger
2019-08-02 23:52     ` [dpdk-dev] [PATCH v6 1/2] examples/multi_process/client_server_mp: check port validity Stephen Hemminger
2019-08-02 23:52     ` [dpdk-dev] [PATCH v6 2/2] examples/multi_process/client_server_mp - fix crash in mp_client with sparse ports Stephen Hemminger
2019-08-05 16:38   ` [dpdk-dev] [PATCH v7 0/2] examples/client_server_mp: port id (fixes only) Stephen Hemminger
2019-08-05 16:38     ` [dpdk-dev] [PATCH v7 1/2] examples/multi_process/client_server_mp: check port validity Stephen Hemminger
2019-08-06 12:07       ` Matan Azrad
2019-11-13 18:53         ` Stephen Hemminger
2019-08-05 16:38     ` [dpdk-dev] [PATCH v7 2/2] examples/multi_process/client_server_mp - fix crash in mp_client with sparse ports Stephen Hemminger
2019-08-07  5:40     ` [dpdk-dev] [PATCH v7 0/2] examples/client_server_mp: port id (fixes only) Matan Azrad
2019-11-25 22:51       ` 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=CAJFAV8zyDGCxBntzHaeRoLhNgzWhKoR5EYt-ku7s7dSqM7iMSA@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).