From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Mike Pattrick <mkp@redhat.com>
Cc: Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>,
ktraynor@redhat.com, dev@dpdk.org
Subject: Re: [PATCH v6] app/testpmd: expand noisy neighbour forward mode support
Date: Thu, 8 Jun 2023 12:42:32 +0100 [thread overview]
Message-ID: <b60e5113-4678-dca8-97b5-f4e50853f66b@amd.com> (raw)
In-Reply-To: <CAHcdBH4pLqFLCWqoogo2KayeWV848vrU9SJ0Kh=o7rzyz9rPAg@mail.gmail.com>
On 6/8/2023 11:43 AM, Mike Pattrick wrote:
> On Thu, Jun 8, 2023 at 6:25 AM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>
>> On 6/8/2023 10:59 AM, Mike Pattrick wrote:
>>> Previously the noisy neighbour vnf simulation would only operate in io
>>> mode, forwarding packets as is. However, this limited the usefulness of
>>> noisy neighbour simulation.
>>>
>>> This feature has now been expanded to supporting mac, macswap, and
>>> 5tswap modes. To facilitate adding this support, some new header files
>>> were added.
>>>
>>> Signed-off-by: Mike Pattrick <mkp@redhat.com>
>>> ---
>>> v2: Reverted changes to random memory lookup
>>> v3: Refactored entire patch
>>> v4: Implemented recommended formatting changes
>>> v5: Corrected copyright statement and formatting changes
>>> v6: Reordered some variables, preserved noisy subtype for display
>>> ---
>>> app/test-pmd/5tswap.c | 118 +----------------------
>>> app/test-pmd/5tswap.h | 130 ++++++++++++++++++++++++++
>>> app/test-pmd/config.c | 18 +++-
>>> app/test-pmd/macfwd.c | 33 +------
>>> app/test-pmd/macfwd.h | 45 +++++++++
>>> app/test-pmd/noisy_vnf.c | 106 +++++++++++++++++----
>>> app/test-pmd/parameters.c | 15 +++
>>> app/test-pmd/testpmd.c | 14 +++
>>> app/test-pmd/testpmd.h | 10 ++
>>> doc/guides/testpmd_app_ug/run_app.rst | 9 ++
>>> 10 files changed, 334 insertions(+), 164 deletions(-)
>>> create mode 100644 app/test-pmd/5tswap.h
>>> create mode 100644 app/test-pmd/macfwd.h
>>>
>>
>> <...>
>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 096c218c12..a3e2c2ac15 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -4052,9 +4052,16 @@ rxtx_config_display(void)
>>> {
>>> portid_t pid;
>>> queueid_t qid;
>>> + char buf[32];
>>> +
>>> + if (cur_fwd_eng == &noisy_vnf_engine)
>>> + snprintf(buf, sizeof(buf), " (%s)", noisy_fwd_mode_desc[noisy_fwd_mode]);
>>> + else
>>> + buf[0] = '\0';
>>>
>>> - printf(" %s packet forwarding%s packets/burst=%d\n",
>>> + printf(" %s%s packet forwarding%s packets/burst=%d\n",
>>> cur_fwd_eng->fwd_mode_name,
>>> + buf,
>>> retry_enabled == 0 ? "" : " with retry",
>>> nb_pkt_per_burst);
>>>
>>> @@ -4816,10 +4823,17 @@ pkt_fwd_config_display(struct fwd_config *cfg)
>>> struct fwd_stream *fs;
>>> lcoreid_t lc_id;
>>> streamid_t sm_id;
>>> + char buf[32];
>>> +
>>> + if (cfg->fwd_eng == &noisy_vnf_engine)
>>> + snprintf(buf, sizeof(buf), " (%s)", noisy_fwd_mode_desc[noisy_fwd_mode]);
>>> + else
>>> + buf[0] = '\0';
>>>
>>> - printf("%s packet forwarding%s - ports=%d - cores=%d - streams=%d - "
>>> + printf("%s%s packet forwarding%s - ports=%d - cores=%d - streams=%d - "
>>> "NUMA support %s, MP allocation mode: %s\n",
>>> cfg->fwd_eng->fwd_mode_name,
>>> + buf,
>>> retry_enabled == 0 ? "" : " with retry",
>>> cfg->nb_fwd_ports, cfg->nb_fwd_lcores, cfg->nb_fwd_streams,
>>> numa_support == 1 ? "enabled" : "disabled",
>>
>>
>> This works but I wonder if we can keep the display functions generic (as
>> much as possible), without forwarding enginee specific checks.
>>
>> What about the idea to update '.fwd_mode_name' in 'noisy_fwd_begin()'?
>> That way generic display code can stay as it is.
>
> I worried that this would interfere with set_pkt_forwarding_mode()
> among other functions. The .fwd_mode_name seems to play double duty as
> view and model.
>
You are right.
> I was also thinking about adding another member to struct fwd_engine
> to display subtype / internal status. But I couldn't think of a
> compelling use case in the other modules. So I leaned towards this
> implementation.
>
> Which do you prefer?
>
I think adding a new field is more proper, although I don't expect to
have subtype for other forwarding modes, perhaps adding something like
"internal status" may be useful later.
>>
>> <...>
>>
>>> +static bool
>>> +pkt_burst_mac(struct fwd_stream *fs)
>>> +{
>>> + struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
>>> + uint16_t nb_rx;
>>> + uint16_t nb_tx;
>>> +
>>> + nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst);
>>> + if (likely(nb_rx != 0))
>>> + do_macfwd(pkts_burst, nb_rx, fs);
>>> + nb_tx = noisy_eth_tx_burst(fs, nb_rx, pkts_burst);
>>> +
>>> + return nb_rx > 0 || nb_tx > 0;
>>> +}
>>> +static bool
>>> +pkt_burst_macswap(struct fwd_stream *fs)
>>> +{
>>> + struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
>>> + uint16_t nb_rx;
>>> + uint16_t nb_tx;
>>> +
>>> + nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst);
>>> + if (likely(nb_rx != 0))
>>> + do_macswap(pkts_burst, nb_rx, &ports[fs->tx_port]);
>>> + nb_tx = noisy_eth_tx_burst(fs, nb_rx, pkts_burst);
>>> +
>>> + return nb_rx > 0 || nb_tx > 0;
>>> +}
>>> +static bool
>>> +pkt_burst_5tswap(struct fwd_stream *fs)
>>> +{
>>> + struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
>>> + uint16_t nb_rx;
>>> + uint16_t nb_tx;
>>> +
>>> + nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst);
>>> + if (likely(nb_rx != 0))
>>> + do_5tswap(pkts_burst, nb_rx, fs);
>>> + nb_tx = noisy_eth_tx_burst(fs, nb_rx, pkts_burst);
>>> +
>>> + return nb_rx > 0 || nb_tx > 0;
>>> +}
>>>
>>
>> Empty lines are missing between functions.
>>
>>
>
next prev parent reply other threads:[~2023-06-08 11:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 18:55 [PATCH v3] " Mike Pattrick
2023-05-26 15:34 ` Kevin Traynor
2023-05-26 17:32 ` Mike Pattrick
2023-06-01 16:23 ` Kevin Traynor
2023-06-06 14:17 ` Ferruh Yigit
2023-06-02 18:29 ` [PATCH v4] " Mike Pattrick
2023-06-06 14:27 ` Ferruh Yigit
2023-06-06 21:12 ` [PATCH v5] " Mike Pattrick
2023-06-06 21:37 ` Ferruh Yigit
2023-06-06 21:42 ` Ferruh Yigit
2023-06-06 22:23 ` Ferruh Yigit
2023-06-07 15:42 ` Mike Pattrick
2023-06-08 9:59 ` [PATCH v6] " Mike Pattrick
2023-06-08 10:25 ` Ferruh Yigit
2023-06-08 10:43 ` Mike Pattrick
2023-06-08 11:42 ` Ferruh Yigit [this message]
2023-06-08 13:31 ` [PATCH v7] " Mike Pattrick
2023-06-08 14:32 ` Ferruh Yigit
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=b60e5113-4678-dca8-97b5-f4e50853f66b@amd.com \
--to=ferruh.yigit@amd.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=ktraynor@redhat.com \
--cc=mkp@redhat.com \
--cc=yuying.zhang@intel.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).