[PATCH v4] app/testpmd: fix protocol header display for Rx buffer split
Wang, YuanX
yuanx.wang at intel.com
Thu Nov 10 08:49:05 CET 2022
Hi Andrew,
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Sent: Thursday, November 10, 2022 2:56 PM
> To: Wang, YuanX <yuanx.wang at intel.com>; Singh, Aman Deep
> <aman.deep.singh at intel.com>; Zhang, Yuying <yuying.zhang at intel.com>
> Cc: Ding, Xuan <xuan.ding at intel.com>; Tang, Yaqi <yaqi.tang at intel.com>;
> dev at dpdk.org
> Subject: Re: [PATCH v4] app/testpmd: fix protocol header display for Rx
> buffer split
>
> On 11/9/22 04:37, Yuan Wang wrote:
> > The "show config rxhdrs" cmd displays the configured protocol headers
> > that are used for protocol-based buffer split.
> > However, it shows inner-ipv6 as inner-ipv4.
> >
> > This patch fixes that by redefining rx_pkt_hdr_protos to hold the full
> > ptypes, and the show and set commands therefore remain symmetrical.
> >
> > Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
> >
> > Signed-off-by: Yuan Wang <yuanx.wang at intel.com>
> >
> > ---
> > v4:
> > - redefine rx_pkt_hdr_protos to hold the full ptypes.
> > - use single switch in get_ptype_str().
> > v3:
> > - use RTE_PTYPE_*_MASK as masks.
> > - refactor to use switch statement.
> > v2:
> > - add fixline.
> >
> > ---
> > app/test-pmd/cmdline.c | 12 ++--
> > app/test-pmd/config.c | 141 +++++++++++++++++++++--------------------
> > app/test-pmd/testpmd.c | 5 +-
> > 3 files changed, 82 insertions(+), 76 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 3fbcb6ca8f..f7df24f105 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -3443,20 +3443,16 @@ parse_hdrs_list(const char *str, const char
> *item_name, unsigned int max_items,
> > unsigned int *parsed_items)
> > {
> > unsigned int nb_item;
> > - char *cur;
> > - char *tmp;
> > - unsigned int cur_item, prev_items = 0;
> > + char *cur, *tmp;
>
> above line is unrelated changes
Sorry for the unrelated changes, they will be removed in the new version.
>
> > + char *str2;
> >
> > nb_item = 0;
> > - char *str2 = strdup(str);
> > + str2 = strdup(str);
>
> I've failed to find where str2 is freed.
This is also an unrelated change to make the code to follow the code style. It is not a new variable that has been freed in the code.
The change will be removed to make the patch clean.
>
> > cur = strtok_r(str2, ",", &tmp);
> > while (cur != NULL) {
> > - cur_item = get_ptype(cur);
> > - cur_item &= ~prev_items;
> > - parsed_items[nb_item] = cur_item;
> > + parsed_items[nb_item] = get_ptype(cur);
> > cur = strtok_r(NULL, ",", &tmp);
> > nb_item++;
> > - prev_items |= cur_item;
> > }
> > if (nb_item > max_items)
> > fprintf(stderr, "Number of %s = %u > %u (maximum
> items)\n", diff
[...]
> >
> > void
> > @@ -5169,6 +5175,7 @@ set_rx_pkt_hdrs(unsigned int *seg_hdrs,
> unsigned
> > int nb_segs)
> >
> > for (i = 0; i < nb_segs; i++)
> > rx_pkt_hdr_protos[i] = (uint32_t)seg_hdrs[i];
> > +
> > /*
> > * We calculate the number of hdrs, but payload is not included,
> > * so rx_pkt_nb_segs would increase 1.
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 7381dfd9e5..b4a1fb360f 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -2654,6 +2654,7 @@ rx_queue_setup(uint16_t port_id, uint16_t
> rx_queue_id,
> > {
> > union rte_eth_rxseg rx_useg[MAX_SEGS_BUFFER_SPLIT] = {};
> > unsigned int i, mp_n;
> > + uint32_t prev_hdrs = 0;
> > int ret;
> >
> > if (rx_pkt_nb_segs <= 1 ||
> > @@ -2668,6 +2669,7 @@ rx_queue_setup(uint16_t port_id, uint16_t
> rx_queue_id,
> > for (i = 0; i < rx_pkt_nb_segs; i++) {
> > struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split;
> > struct rte_mempool *mpx;
> > +
>
> unrelated changes, avoid it
Will fix in v5.
Thanks,
Yuan
More information about the dev
mailing list