DPDK patches and discussions
 help / color / mirror / Atom feed
From: Patrick Robb <probb@iol.unh.edu>
To: Chaoyong He <chaoyong.he@corigine.com>
Cc: dev@dpdk.org, oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>
Subject: Re: [PATCH] examples/l3fwd: support setting the data size of mbuf
Date: Wed, 16 Oct 2024 17:17:06 -0400	[thread overview]
Message-ID: <CAJvnSUDvmjC6gacBQiuce2e11TTNqBUuauXg2hTe+GQgx5tA=w@mail.gmail.com> (raw)
In-Reply-To: <20241016082232.4005800-1-chaoyong.he@corigine.com>

[-- Attachment #1: Type: text/plain, Size: 4835 bytes --]

Sorry to interrupt the conversation - obviously the CI testing fail is a
false failure and should be ignored by the maintainer here.

For those curious, it failed like this, which I have seen previously in a
similar case:
tester: Pkt number not matched,2000 sent and 1999 received

I'm removing this legacy DTS testsuite from our CI testing as it cannot be
trusted and also the testsuite has been rewritten recently (and we are
switching to the new version).

Sorry to be a bother!

On Wed, Oct 16, 2024 at 4:22 AM Chaoyong He <chaoyong.he@corigine.com>
wrote:

> From: Long Wu <long.wu@corigine.com>
>
> The previous code used a macro as the data size for mbuf
> to create the mempool and users cannot modify the size.
>
> Now modify the code to support setting the data size of
> mbuf by '--mbuf-size' parameter. If user does not add the
> parameter in start command line, the default size is still
> 'RTE_MBUF_DEFAULT_BUF_SIZE'.
>
> Examples:
> dpdk-l3fwd -l 0-3 -- -p 0x03 --mbuf-size=4096
>
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> ---
>  examples/l3fwd/main.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 01b763e5ba..ccce16c6bb 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -140,6 +140,7 @@ uint32_t max_pkt_len;
>  #ifdef RTE_LIB_EVENTDEV
>  static struct rte_mempool *vector_pool[RTE_MAX_ETHPORTS];
>  #endif
> +static uint16_t mbuf_seg_size = RTE_MBUF_DEFAULT_BUF_SIZE;
>  static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS];
>  static uint8_t lkp_per_socket[NB_SOCKETS];
>
> @@ -448,7 +449,8 @@ print_usage(const char *prgname)
>                 "                    One is ACL entry at while line leads
> with character '%c',\n"
>                 "                    another is route entry at while line
> leads with character '%c'.\n"
>                 "  --rule_ipv6=FILE: Specify the ipv6 rules entries
> file.\n"
> -               "  --alg: ACL classify method to use, one of: %s.\n\n",
> +               "  --alg: ACL classify method to use, one of: %s.\n"
> +               "  --mbuf-size=N: Set the data size of mbuf to N
> bytes.\n\n",
>                 prgname, RX_DESC_DEFAULT, TX_DESC_DEFAULT,
>                 ACL_LEAD_CHAR, ROUTE_LEAD_CHAR, alg);
>  }
> @@ -698,6 +700,7 @@ static const char short_options[] =
>  #define CMD_LINE_OPT_RULE_IPV4 "rule_ipv4"
>  #define CMD_LINE_OPT_RULE_IPV6 "rule_ipv6"
>  #define CMD_LINE_OPT_ALG "alg"
> +#define CMD_LINE_OPT_MBUF_SIZE "mbuf-size"
>
>  enum {
>         /* long options mapped to a short option */
> @@ -726,7 +729,8 @@ enum {
>         CMD_LINE_OPT_LOOKUP_NUM,
>         CMD_LINE_OPT_ENABLE_VECTOR_NUM,
>         CMD_LINE_OPT_VECTOR_SIZE_NUM,
> -       CMD_LINE_OPT_VECTOR_TMO_NS_NUM
> +       CMD_LINE_OPT_VECTOR_TMO_NS_NUM,
> +       CMD_LINE_OPT_MBUF_SIZE_NUM,
>  };
>
>  static const struct option lgopts[] = {
> @@ -753,6 +757,7 @@ static const struct option lgopts[] = {
>         {CMD_LINE_OPT_RULE_IPV4,   1, 0, CMD_LINE_OPT_RULE_IPV4_NUM},
>         {CMD_LINE_OPT_RULE_IPV6,   1, 0, CMD_LINE_OPT_RULE_IPV6_NUM},
>         {CMD_LINE_OPT_ALG,   1, 0, CMD_LINE_OPT_ALG_NUM},
> +       {CMD_LINE_OPT_MBUF_SIZE, 1, 0, CMD_LINE_OPT_MBUF_SIZE_NUM},
>         {NULL, 0, 0, 0}
>  };
>
> @@ -934,6 +939,12 @@ parse_args(int argc, char **argv)
>                 case CMD_LINE_OPT_ALG_NUM:
>                         l3fwd_set_alg(optarg);
>                         break;
> +               case CMD_LINE_OPT_MBUF_SIZE_NUM:
> +                       mbuf_seg_size = strtoul(optarg, NULL, 10) +
> RTE_PKTMBUF_HEADROOM;
> +                       if (mbuf_seg_size <= 0 || mbuf_seg_size > 0xFFFF)
> +                               rte_exit(EXIT_FAILURE,
> +                                               "mbuf-size should be > 0
> and < 65536\n");
> +                       break;
>                 default:
>                         print_usage(prgname);
>                         return -1;
> @@ -1034,7 +1045,7 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)
>                         pktmbuf_pool[portid][socketid] =
>                                 rte_pktmbuf_pool_create(s, nb_mbuf,
>                                         MEMPOOL_CACHE_SIZE, 0,
> -                                       RTE_MBUF_DEFAULT_BUF_SIZE,
> socketid);
> +                                       mbuf_seg_size, socketid);
>                         if (pktmbuf_pool[portid][socketid] == NULL)
>                                 rte_exit(EXIT_FAILURE,
>                                         "Cannot init mbuf pool on socket
> %d\n",
> --
> 2.39.1
>
>

[-- Attachment #2: Type: text/html, Size: 6168 bytes --]

  parent reply	other threads:[~2024-10-16 21:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  8:22 Chaoyong He
2024-10-16  9:05 ` Morten Brørup
2024-10-16 15:02 ` Stephen Hemminger
2024-10-16 21:17 ` Patrick Robb [this message]
2024-10-17 19:12 ` Stephen Hemminger
2024-10-18  2:42 ` [PATCH v2] " Chaoyong He
2024-10-18  2:50   ` lihuisong (C)
2024-10-18  2:59   ` Stephen Hemminger
2024-10-18  3:21     ` Chaoyong He
2024-10-18  3:42       ` Stephen Hemminger
2024-10-18  5:50         ` Chaoyong He

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='CAJvnSUDvmjC6gacBQiuce2e11TTNqBUuauXg2hTe+GQgx5tA=w@mail.gmail.com' \
    --to=probb@iol.unh.edu \
    --cc=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.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).