app/testpmd: support mbuf dynamic flag
authorOri Kam <orika@mellanox.com>
Thu, 16 Jan 2020 12:53:10 +0000 (12:53 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:59:19 +0000 (19:59 +0100)
commitb57b66a97ebfbeb6cd98077db499ecc20ee6fb9d
tree4f16844bd2e55119b5f23ece94e15395cd0e2c8e
parent4a83876faeb6d9e7e19e3b9ee212e55b8d637c3d
app/testpmd: support mbuf dynamic flag

DPDK now supports registration of dynamic flags (dynf) to the mbuf.
dynf can be given any name, and can be used with a supporting PMD or
supporting application.

Due to the generic concept of the dynf, it is impossible and
meaningless, to define register set/get function for each flag.
This commit introduce a generic way to register and set/clear such
flags.

The basic syntax:
port config <port id> dynf <name> <set|clear>

The first step the new flag is registered. Regardless if the action is
set or clear.
There is no way to unregister the flag, after registering it.

The second step, if the action is set then we set the requested flag.
If this is the first flag that is enabled we also register a call back
for the Tx. In this call back we set the flag.
If the action is clear the requested flag is cleared, and if there
are no more flags that are set, the call back is removed.

The reason that the set is only applied in Tx is that in case of Rx
it is assumed that the value comes from the PMD.

If log is enabled the name of the flag, and value will be printed
in the packet info.
In order for the log to work correctly the registration of the flag
must be done before setting verbose.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/cmdline.c
app/test-pmd/testpmd.c
app/test-pmd/testpmd.h
app/test-pmd/util.c
doc/guides/testpmd_app_ug/testpmd_funcs.rst