* Re: [dpdk-dev] [PATCH 7/7] ethdev: use opaque user callback object
@ 2017-12-04 10:31 3% ` Bruce Richardson
0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2017-12-04 10:31 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Ananyev, Konstantin, Thomas Monjalon, dev, vladz
On Fri, Dec 01, 2017 at 03:51:52PM -0800, Ferruh Yigit wrote:
> On 12/1/2017 5:17 AM, Bruce Richardson wrote:
> > On Fri, Dec 01, 2017 at 11:22:12AM +0000, Ananyev, Konstantin wrote:
> >>
> >>
> >>> -----Original Message-----
> >>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
> >>> Sent: Friday, December 1, 2017 10:33 AM
> >>> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> >>> Cc: Thomas Monjalon <thomas@monjalon.net>; dev@dpdk.org; vladz@cloudius-systems.com
> >>> Subject: Re: [dpdk-dev] [PATCH 7/7] ethdev: use opaque user callback object
> >>>
> >>> On Fri, Dec 01, 2017 at 02:29:57AM +0000, Ferruh Yigit wrote:
> >>>> "struct rte_eth_rxtx_callback" is defined as internal data structure but
> >>>> used in public APIs.
> >>>>
> >>>> Checking the API documentation shows that intention was using this
> >>>> object as opaque object. Data structure only used in delete APIs which
> >>>> doesn't require to know the internals of the data structure.
> >>>>
> >>>> Converting callback parameter in API to void pointer should not require
> >>>> any modification in user application because this data structure was
> >>>> already marked as internal and only should be used as pointer in
> >>>> application.
> >>>>
> >>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >>>> ---
> >>>
> >>> I disagree on this patch. The structure itself is not exposed, only the
> >>> name, since it is only passed around as a pointer, so there is no need
> >>> to change the parameters to void pointer. It's a named opaque type.
> >>
> >> Personally I think it would be better to do visa-versa:
> >> make rte_eth_add_(rx|tx)_callback() to return struct rte_eth_rxtx_callback *
> >> instead of void *.
> >> Konstantin
> >>
> > I didn't realise that it did, so definite +1 to that suggestion.
>
> No issue on having a named opaque type, but unfortunately struct is exposed
> because of inline functions again.
> It has been moved into rte_ethdev_core.h but accessible by applications.
>
> And since intention is an opaque type, because of "void *" return types, I
> thought it is better to hide type completely so that application can't access
> details.
I wouldn't be worried about applications being able to get into the
structure. The only compelling reason for me to make the type opaque
would be for ABI compatibility, and since that is not a factor here, I
don't see the point in changing it to a void *.
/Bruce
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH 2/4] compat: Add __experimental macro
2017-12-01 18:56 4% [dpdk-dev] [PATCH 0/4] dpdk: enhance EXPERIMENTAL api tagging Neil Horman
@ 2017-12-01 18:56 5% ` Neil Horman
0 siblings, 0 replies; 200+ results
From: Neil Horman @ 2017-12-01 18:56 UTC (permalink / raw)
To: dev; +Cc: Neil Horman, Thomas Monjalon, Mcnamara, John
The __experimental macro tags a given exported function as being part of
the EXPERIMENTAL api. Use of this tag will cause any caller of the
function (that isn't removed by dead code elimination) to emit a warning
that the user is making use of an API whos stabilty isn't guaranteed.
It also places the function in the .text.experimental section, which is
used to validate the tag against the corresponding library version map
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Thomas Monjalon <thomas@monjalon.net>
CC: "Mcnamara, John" <john.mcnamara@intel.com>
---
lib/librte_compat/rte_compat.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h
index 41e8032ba..c7c967d86 100644
--- a/lib/librte_compat/rte_compat.h
+++ b/lib/librte_compat/rte_compat.h
@@ -101,5 +101,7 @@
*/
#endif
+#define __experimental \
+__attribute__(( deprecated("Symbol is not yet part of stable abi"), section(".text.experimental") ))
#endif /* _RTE_COMPAT_H_ */
--
2.14.3
^ permalink raw reply [relevance 5%]
* [dpdk-dev] [PATCH 0/4] dpdk: enhance EXPERIMENTAL api tagging
@ 2017-12-01 18:56 4% Neil Horman
2017-12-01 18:56 5% ` [dpdk-dev] [PATCH 2/4] compat: Add __experimental macro Neil Horman
0 siblings, 1 reply; 200+ results
From: Neil Horman @ 2017-12-01 18:56 UTC (permalink / raw)
To: dev
Hey all-
A few days ago, I was lamenting the fact that, when reviewing patches I
would frequently complain about ABI changes that were actually considered safe
because they were part of the EXPERIMENTAL api set. John M. asked me then what
I might do to improve the situation, and the following patch set is a proposal
that I've come up with.
In thinking about the problem I identified two issues that I think we
can improve on in this area:
1) Make experimental api calls more visible in the source code. That is to say,
when reviewing patches, it would be nice to have some sort of visual reference
that indicates that the changes being made are part of an experimental API and
therefore ABI concerns need not be addressed
2) Make experimenal api usage more visible to consumers of the DPDK, so that
they can make a more informed decision about the API's they consume in their
application. We make an effort to document all the experimental API's, but
there is no guarantee that a user will check the documentation before making use
of a new library.
This patch set attempts to achieve both of the above goals. To do this I've
added an __experimental macro tag, suitable for inserting into api forward
declarations and definitions.
The presence of the tag in the header and c files where the api code resides
increases the likelyhood that any patch submitted against them will include the
tag in the context, making it clear to reviewers that ABI stability isn't a
concern here.
Also, This tag marks each function it is used on with an attibute causing any
use of the fuction to emit a warning during the build
with a message indicating that the API call in question is not yet part of the
stable interface. Developers can then make an informed decision to suppress
that warning or not.
Because there is internal use of several experimental API's, this set also
includes a new override macro ALLOW_EXPERIMENTAL_FUNCTIONS to automatically
suprress these warnings. I think its fair to assume that, for internal use, we
almost always want to suppress these warnings, as by definition any change to
the apis (even their removal) must be done in parallel with an appropriate
change in the calling locations, lest the dpdk build itself break.
Neil
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE ***
2017-12-01 14:47 4% [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Konstantin Ananyev
2017-12-01 14:48 19% ` [dpdk-dev] [RFC PATCH 3/3] doc: ethdev ABI change deprecation notice Konstantin Ananyev
@ 2017-12-01 14:56 0% ` Ananyev, Konstantin
1 sibling, 0 replies; 200+ results
From: Ananyev, Konstantin @ 2017-12-01 14:56 UTC (permalink / raw)
To: dev
Oops sorry, resending with proper subject.
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, December 1, 2017 2:48 PM
> To: dev@dpdk.org; dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [RFC PATCH 0/3] *** SUBJECT HERE ***
>
> The series introduces 2 main changes:
>
> 1.Introduce a separate data structure (rte_eth_queue_local)
> to store local to given process (i.e. no-shareable) information
> for each configured rx/tx queue.
> Memory for that structure is allocated/freed dynamically during
> rte_eth_dev_configure().
> Reserve a space for queue specific (rx|tx)_pkt_burst(),
> tx_pkt_prepare() function pointers inside that structure.
> Move rx/tx callback related information inside that structure.
> That introduces a change in current behavior: all callbacks for
> un-configured queues will be automatically removed.
> Also as size of struct rte_eth_dev changes that patch is an ABI breakage,
> so deprecation notice for 18.05 is filled.
> Further suggestions how to introduce the same functionality
> without ABI breakage are welcome.
>
> 2. Make it safe to remove rx/tx callback at runtime.
> Right now it is not possible for the application to figure out
> when it is safe to free removed callback handle and
> associated with it resources(unless the queue is stopped).
> That's probably not a big problem if all callbacks are static
> hange through whole application lifetime)
> and/or application doesn't allocate any resources for the callback handler.
> Though if callbacks have to be added/removed dynamically and
> callback handler would require more resources to operate properly -
> then it might become an issue.
> So patch #2 fixes that problem - now as soon as
> rte_eth_remove_(rx|tx)_callback() completes successfully, application
> can safely free all associated with the removed callback resources.
>
> Performance impact:
> If application doesn't use RX/TX callbacks, then the tests I run didn't
> reveal any performance degradation.
> Though if application do use RX/TX callbacks - patch #2 does introduce
> some slowdown.
>
> To be more specific here, on BDW (E5-2699 v4) 2.2GHz, 4x10Gb (X520-4)
> with http://dpdk.org/dev/patchwork/patch/31864/ patch installed I got:
> 1) testpmd ... --latencystats=1 - slowdown < 1%
> 2) examples//l3fwd ... --parse-ptype - - slowdown < 1%
> 3) examples/rxtx_callbacks - slowdown ~8%
> All that in terms of packet throughput (Mpps).
>
> Ability to safely remove callbacks at runtime implies
> some sort of synchronization.
> Even I tried to make it as light as possible,
> probably some slowdown is unavoidable.
> Of course instead of introducing these changes at rte_ethdev layer
> similar technique could be applied on individual callback basis.
> In that case it would be up to callback writer/installer to decide
> does he/she need a removable at runtime callback or not.
> Though in that case, each installed callback might introduce extra
> synchronization overhead and slowdown.
>
> Konstantin Ananyev (3):
> ethdev: introduce eth_queue_local
> ethdev: make it safe to remove rx/tx callback at runtime
> doc: ethdev ABI change deprecation notice
>
> doc/guides/rel_notes/deprecation.rst | 5 +
> lib/librte_ether/rte_ethdev.c | 390 ++++++++++++++++++++++-------------
> lib/librte_ether/rte_ethdev.h | 174 ++++++++++++----
> 3 files changed, 387 insertions(+), 182 deletions(-)
>
> --
> 2.13.5
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [RFC PATCH 0/3] ethdev: few changes in rte_ethdev layer
@ 2017-12-01 14:55 4% Konstantin Ananyev
0 siblings, 0 replies; 200+ results
From: Konstantin Ananyev @ 2017-12-01 14:55 UTC (permalink / raw)
To: dev, dev; +Cc: Konstantin Ananyev
The series introduces 2 main changes:
1.Introduce a separate data structure (rte_eth_queue_local)
to store local to given process (i.e. no-shareable) information
for each configured rx/tx queue.
Memory for that structure is allocated/freed dynamically during
rte_eth_dev_configure().
Reserve a space for queue specific (rx|tx)_pkt_burst(),
tx_pkt_prepare() function pointers inside that structure.
Move rx/tx callback related information inside that structure.
That introduces a change in current behavior: all callbacks for
un-configured queues will be automatically removed.
Also as size of struct rte_eth_dev changes that patch is an ABI breakage,
so deprecation notice for 18.05 is filled.
Further suggestions how to introduce the same functionality
without ABI breakage are welcome.
2. Make it safe to remove rx/tx callback at runtime.
Right now it is not possible for the application to figure out
when it is safe to free removed callback handle and
associated with it resources(unless the queue is stopped).
That's probably not a big problem if all callbacks are static
hange through whole application lifetime)
and/or application doesn't allocate any resources for the callback handler.
Though if callbacks have to be added/removed dynamically and
callback handler would require more resources to operate properly -
then it might become an issue.
So patch #2 fixes that problem - now as soon as
rte_eth_remove_(rx|tx)_callback() completes successfully, application
can safely free all associated with the removed callback resources.
Performance impact:
If application doesn't use RX/TX callbacks, then the tests I run didn't
reveal any performance degradation.
Though if application do use RX/TX callbacks - patch #2 does introduce
some slowdown.
To be more specific here, on BDW (E5-2699 v4) 2.2GHz, 4x10Gb (X520-4)
with http://dpdk.org/dev/patchwork/patch/31864/ patch installed I got:
1) testpmd ... --latencystats=1 - slowdown < 1%
2) examples//l3fwd ... --parse-ptype - - slowdown < 1%
3) examples/rxtx_callbacks - slowdown ~8%
All that in terms of packet throughput (Mpps).
Ability to safely remove callbacks at runtime implies
some sort of synchronization.
Even I tried to make it as light as possible,
probably some slowdown is unavoidable.
Of course instead of introducing these changes at rte_ethdev layer
similar technique could be applied on individual callback basis.
In that case it would be up to callback writer/installer to decide
does he/she need a removable at runtime callback or not.
Though in that case, each installed callback might introduce extra
synchronization overhead and slowdown.
Konstantin Ananyev (3):
ethdev: introduce eth_queue_local
ethdev: make it safe to remove rx/tx callback at runtime
doc: ethdev ABI change deprecation notice
doc/guides/rel_notes/deprecation.rst | 5 +
lib/librte_ether/rte_ethdev.c | 390 ++++++++++++++++++++++-------------
lib/librte_ether/rte_ethdev.h | 174 ++++++++++++----
3 files changed, 387 insertions(+), 182 deletions(-)
--
2.13.5
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [RFC PATCH 3/3] doc: ethdev ABI change deprecation notice
2017-12-01 14:47 4% [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Konstantin Ananyev
@ 2017-12-01 14:48 19% ` Konstantin Ananyev
2017-12-01 14:56 0% ` [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Ananyev, Konstantin
1 sibling, 0 replies; 200+ results
From: Konstantin Ananyev @ 2017-12-01 14:48 UTC (permalink / raw)
To: dev, dev; +Cc: Konstantin Ananyev
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 13e85432f..038b55fd5 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,6 +8,11 @@ API and ABI deprecation notices are to be posted here.
Deprecation Notices
-------------------
+* ethdev: an ABI changes for ``rte_ethdev`` are planned in v18.05.
+ The size and layout of struct rte_eth_dev will change.
+ Mainly to accommodate queue specific RX/TX function pointers, plus
+ reorganize RX/TX callback related information.
+
* eal: several API and ABI changes are planned for ``rte_devargs`` in v18.02.
The format of device command line parameters will change. The bus will need
to be explicitly stated in the device declaration. The enum ``rte_devtype``
--
2.13.5
^ permalink raw reply [relevance 19%]
* [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE ***
@ 2017-12-01 14:47 4% Konstantin Ananyev
2017-12-01 14:48 19% ` [dpdk-dev] [RFC PATCH 3/3] doc: ethdev ABI change deprecation notice Konstantin Ananyev
2017-12-01 14:56 0% ` [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Ananyev, Konstantin
0 siblings, 2 replies; 200+ results
From: Konstantin Ananyev @ 2017-12-01 14:47 UTC (permalink / raw)
To: dev, dev; +Cc: Konstantin Ananyev
The series introduces 2 main changes:
1.Introduce a separate data structure (rte_eth_queue_local)
to store local to given process (i.e. no-shareable) information
for each configured rx/tx queue.
Memory for that structure is allocated/freed dynamically during
rte_eth_dev_configure().
Reserve a space for queue specific (rx|tx)_pkt_burst(),
tx_pkt_prepare() function pointers inside that structure.
Move rx/tx callback related information inside that structure.
That introduces a change in current behavior: all callbacks for
un-configured queues will be automatically removed.
Also as size of struct rte_eth_dev changes that patch is an ABI breakage,
so deprecation notice for 18.05 is filled.
Further suggestions how to introduce the same functionality
without ABI breakage are welcome.
2. Make it safe to remove rx/tx callback at runtime.
Right now it is not possible for the application to figure out
when it is safe to free removed callback handle and
associated with it resources(unless the queue is stopped).
That's probably not a big problem if all callbacks are static
hange through whole application lifetime)
and/or application doesn't allocate any resources for the callback handler.
Though if callbacks have to be added/removed dynamically and
callback handler would require more resources to operate properly -
then it might become an issue.
So patch #2 fixes that problem - now as soon as
rte_eth_remove_(rx|tx)_callback() completes successfully, application
can safely free all associated with the removed callback resources.
Performance impact:
If application doesn't use RX/TX callbacks, then the tests I run didn't
reveal any performance degradation.
Though if application do use RX/TX callbacks - patch #2 does introduce
some slowdown.
To be more specific here, on BDW (E5-2699 v4) 2.2GHz, 4x10Gb (X520-4)
with http://dpdk.org/dev/patchwork/patch/31864/ patch installed I got:
1) testpmd ... --latencystats=1 - slowdown < 1%
2) examples//l3fwd ... --parse-ptype - - slowdown < 1%
3) examples/rxtx_callbacks - slowdown ~8%
All that in terms of packet throughput (Mpps).
Ability to safely remove callbacks at runtime implies
some sort of synchronization.
Even I tried to make it as light as possible,
probably some slowdown is unavoidable.
Of course instead of introducing these changes at rte_ethdev layer
similar technique could be applied on individual callback basis.
In that case it would be up to callback writer/installer to decide
does he/she need a removable at runtime callback or not.
Though in that case, each installed callback might introduce extra
synchronization overhead and slowdown.
Konstantin Ananyev (3):
ethdev: introduce eth_queue_local
ethdev: make it safe to remove rx/tx callback at runtime
doc: ethdev ABI change deprecation notice
doc/guides/rel_notes/deprecation.rst | 5 +
lib/librte_ether/rte_ethdev.c | 390 ++++++++++++++++++++++-------------
lib/librte_ether/rte_ethdev.h | 174 ++++++++++++----
3 files changed, 387 insertions(+), 182 deletions(-)
--
2.13.5
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v2 0/2] ethdev: add GENEVE to flow API
2017-11-20 8:21 3% [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Andrew Rybchenko
` (2 preceding siblings ...)
2017-11-23 9:39 4% ` [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Adrien Mazarguil
@ 2017-12-01 10:43 3% ` Andrew Rybchenko
3 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2017-12-01 10:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil, Jingjing Wu
v2:
- add after ESP to avoid ABI breakage
- make default mask to include VNI only
- minor style fixes
Roman Zhukov (2):
ethdev: add GENEVE flow pattern item
app/testpmd: support GENEVE pattern item in flow rules
app/test-pmd/cmdline_flow.c | 31 +++++++++++++++++++++++++++++
app/test-pmd/config.c | 1 +
doc/guides/prog_guide/rte_flow.rst | 12 +++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++++
lib/librte_ether/rte_flow.c | 1 +
lib/librte_ether/rte_flow.h | 30 ++++++++++++++++++++++++++++
6 files changed, 80 insertions(+)
--
2.7.4
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] 17.08.1 patches review and test
2017-11-27 12:21 2% [dpdk-dev] 17.08.1 patches review and test Yuanhan Liu
@ 2017-11-30 19:09 0% ` Patil, Harish
0 siblings, 0 replies; 200+ results
From: Patil, Harish @ 2017-11-30 19:09 UTC (permalink / raw)
To: Yuanhan Liu, dpdk stable; +Cc: dev, Xu, Qian Q, Dept-Eng DPDK Dev
-----Original Message-----
From: dev <dev-bounces@dpdk.org> on behalf of Yuanhan Liu
<yliu@fridaylinux.org>
Date: Monday, November 27, 2017 at 4:21 AM
To: dpdk stable <stable@dpdk.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Xu, Qian Q" <qian.q.xu@intel.com>
Subject: [dpdk-dev] 17.08.1 patches review and test
>Hi all,
>
>Here is a list of patches targeted for stable release 17.08.1. Please
>help review and test. The planned date for the final release is 7th,
>Dec. Before that, please shout if anyone has objections with these
>patches being applied.
>
>These patches are located at branch 17.08 of dpdk-stable repo:
> http://dpdk.org/browse/dpdk-stable/
>
>Thanks.
>
> --yliu
>
>---
>Aaron Conole (1):
> net/enic: fix assignment
>
>Ajit Khaparde (28):
> net/bnxt: fix HWRM macros and locking
> net/bnxt: use 64-bits of address for VLAN table
> net/bnxt: fix an issue with group id calculation
> net/bnxt: fix calculation of number of pools
> net/bnxt: handle multi queue mode properly
> net/bnxt: fix Rx handling and buffer allocation logic
> net/bnxt: fix an issue with broadcast traffic
> net/bnxt: fix usage of VMDq flags
> net/bnxt: set checksum offload flags correctly
> net/bnxt: update status of Rx IP/L4 CKSUM
> net/bnxt: fix config RSS update
> net/bnxt: set the hash key size
> net/bnxt: fix per queue stats display in xstats
> net/bnxt: fix interrupt handler
> net/bnxt: fix number of MAC addresses for VMDq
> net/bnxt: fix the association of a MACVLAN per VNIC
> net/bnxt: fix Tx offload capability
> net/bnxt: fix Rx offload capability
> net/bnxt: handle Rx multi queue creation properly
> net/bnxt: remove redundant code parsing pool map
> net/bnxt: fix a bit shift operation
> net/bnxt: fix a potential null pointer dereference
> net/bnxt: fix a potential null pointer dereference
> net/bnxt: fix a pointer deref before null check
> net/bnxt: fix an unused value
> net/bnxt: check VLANs from pool map only for VMDq
> net/bnxt: do not set hash type unnecessarily
> net/bnxt: fix VLAN spoof configuration
>
>Akhil Goyal (2):
> test/crypto: fix dpaa2 sec macros and definitions
> net/dpaa2: set queues after reconfiguration
>
>Alejandro Lucero (2):
> net/nfp: fix RSS
> net/nfp: fix Rx interrupt when multiqueue
>
>Alok Makhariya (2):
> crypto/dpaa2_sec: remove ICV memset on decryption side
> crypto/dpaa2_sec: add check for segmented buffer
>
>Anatoly Burakov (1):
> vfio: fix secondary process initialization
>
>Andrey Chilikin (1):
> net/i40e: fix flexible payload configuration
>
>Aviad Yehezkel (4):
> examples/ipsec-secgw: fix crypto device mapping
> examples/ipsec-secgw: fix session creation
> examples/ipsec-secgw: fix AAD length setting
> app/testpmd: fix build without ixgbe and bnxt PMDs
>
>Beilei Xing (1):
> net/i40e: fix VF device stop issue
>
>Chas Williams (1):
> net/vmxnet3: fix memory leak when releasing queues
>
>Congwen Zhang (1):
> net/cxgbe: fix memory leak
>
>Daniel Mrzyglod (3):
> net/virtio: fix untrusted scalar value
> app/testpmd: fix DDP package filesize detection
> net/bonding: fix default aggregator mode to stable
>
>David Harton (2):
> net/vmxnet3: fix MAC address set
> net/i40e: fix i40evf MAC filter table
>
>Ferruh Yigit (4):
> ethdev: fix ABI version
> ethdev: revert use port name from device structure
> igb_uio: remove device reset in open
> net/qede: fix icc build
>
>Gaetan Rivet (1):
> net/failsafe: fix errno set on command execution
>
>Gowrishankar Muthukrishnan (1):
> net/bonding: support bifurcated driver in eal
>
>Guduri Prathyusha (2):
> examples/l3fwd: fix NEON instructions
> examples/l3fwd: fix aliasing in port grouping
>
>Harish Patil (2):
> net/qede: fix supported packet types
> net/qede: fix to re-enable LRO during device start
>
>Hemant Agrawal (3):
> net/dpaa2: fix the Tx handling of non HW pool bufs
> examples/l2fwd-crypto: fix uninitialized errno value
> app/crypto-perf: fix uninitialized errno value
>
>Ian Stokes (1):
> cryptodev: fix build with -Ofast
>
>Ivan Malov (2):
> net/sfc: specify correct scale table size on Rx start
> net/sfc: fix unused variable in RSS-agnostic build
>
>Jacek Piasecki (1):
> examples/vhost_scsi: fix product id string termination
>
>Jasvinder Singh (1):
> examples/qos_sched: fix uninitialized config
>
>Jerin Jacob (1):
> timer: use 64-bit specific code on more platforms
>
>Jianbo Liu (1):
> net/i40e: fix Rx packets number for NEON
>
>Jiayu Hu (1):
> gro: fix typo in map file
>
>Jingjing Wu (4):
> net/i40e: fix interrupt throttling setting in PF
> net/i40e: fix memory leak if VF init fails
> net/i40e: fix variable assignment
> net/i40e: fix VF initialization error
>
>John Daley (3):
> net/enic: fix multi-process operation
> net/enic: fix packet loss after MTU change
> net/enic: fix TSO for packets greater than 9208 bytes
>
>John Miller (1):
> net/ark: fix loop counter
>
>Kuba Kozak (2):
> vfio: fix close unchecked file descriptor
> vhost: check poll error code
>
>Li Han (1):
> app/testpmd: fix invalid port id parameters
>
>Lukasz Majczak (1):
> eal: fix auxv open check for ARM and PPC
>
>Mark Spender (1):
> net/sfc/base: fix default RSS context check on Siena
>
>Matan Azrad (7):
> net/failsafe: fix Tx sub device deactivating
> net/mlx5: fix locking in xstats functions
> net/failsafe: fix parameters parsing
> net/mlx5: fix probe failure report
> net/failsafe: fix adding MAC error report miss
> app/testpmd: fix forward port ids setting
> net/failsafe: fix Rx clean race
>
>Maxime Coquelin (1):
> vhost: fix dereferencing invalid pointer after realloc
>
>Michal Jastrzebski (1):
> net/vmxnet3: fix dereference before null check
>
>Nikhil Rao (1):
> eal/x86: fix atomic cmpset
>
>Nirmoy Das (1):
> kni: fix SLE version detection
>
>Nélio Laranjeiro (4):
> net/mlx5: fix clang build
> net/mlx5: fix SSE Rx support verification
> net/mlx5: fix clang compilation error
> app/testpmd: fix RSS structure initialisation
>
>Olivier Matz (12):
> net: fix inner L2 length in packet type parser
> net/bnxt: fix compilation with -Og
> net/qede: fix compilation with -Og
> app/test-crypto-perf: fix memory leak
> app/test-crypto-perf: fix compilation with -Og
> net/virtio: revert not claiming LRO support
> net/virtio: revert not claiming IP checksum offload
> net/virtio: fix log levels in configure
> net/virtio: fix mbuf port for simple Rx function
> net/virtio: fix queue setup consistency
> net/virtio: fix compilation with -Og
> lpm6: fix compilation with -Og
>
>Ophir Munk (3):
> net/tap: fix flow and port commands
> net/failsafe: fix VLAN stripping configuration
> app/testpmd: fix forwarding between non consecutive ports
>
>Pablo de Lara (8):
> hash: fix eviction counter
> crypto/aesni_gcm: fix zero data operation
> app/crypto-perf: fix packet length check
> app/crypto-perf: parse AEAD data from vectors
> crypto/openssl: fix AEAD parameters
> examples/l2fwd-crypto: fix physical address setting
> crypto/qat: fix HMAC supported digest sizes
> app/testpmd: fix topology error message
>
>Patrick MacArthur (1):
> eal: copy raw strings taken from command line
>
>Phil Yang (1):
> app/testpmd: fix quitting in container
>
>Qi Zhang (4):
> net/i40e: fix flow control watermark mismatch
> net/i40e: fix packet count for PF
> net/i40e: fix mbuf free in vector Tx
> net/i40e: fix mirror with firmware 6.0
>
>Rami Rosen (1):
> net/kni: remove driver struct forward declaration
>
>Rasesh Mody (4):
> net/qede/base: fix to use a passed ptt handle
> net/qede/base: fix return code to align with FW
> net/qede: remove duplicate includes
> net/qede/base: fix division by zero
>
>Raslan Darawsheh (2):
> net/failsafe: fix failsafe bus uninit return value
> net/failsafe: fix PCI devices init
>
>RongQiang Xie (2):
> net/enic: fix possible null pointer dereference
> net/qede: fix possible null pointer dereference
>
>Sebastian Basierski (3):
> net/vmxnet3: fix unintentional integer overflow
> net/virtio-user: fix TAP name string termination
> net/virtio: check error on setting non block flag
>
>Sergio Gonzalez Monroy (1):
> crypto/aesni_mb: fix invalid session error
>
>Shahaf Shuler (5):
> net/mlx5: fix num seg assumption in SSE Tx
> net/mlx5: fix Tx stats error counter definition
> net/mlx5: fix Tx stats error counter logic
> net/mlx5: fix TSO segment size verification
> net/mlx5: fix packet type flags for Ethernet only frame
>
>Stefan Baranoff (1):
> net/pcap: fix memory leak in dumper open
>
>Stephen Hemminger (1):
> eal: initialize logging before bus
>
>Tiwei Bie (1):
> net/virtio: flush Rx queues on start
>
>Tomasz Duszynski (3):
> drivers/crypto: use snprintf return value correctly
> examples/ipsec-secgw: fix IP version check
> examples/ipsec-secgw: fix IPv6 payload length
>
>Tomasz Kulasek (3):
> net/bonding: fix slaves capacity check
> net/i40e: fix assignment of enum values
> net/bonding: fix check slaves link properties
>
>Vipin Varghese (1):
> net/tap: fix unregistering callback with invalid fd
>
>Wei Dai (8):
> net/ixgbe: fix mapping of user priority to TC
> net/ixgbe: fix adding a mirror rule
> net/i40e: fix mirror rule reset when port is closed
> net/ixgbe: fix Rx queue interrupt mapping in VF
> net/ixgbe: fix VFIO interrupt mapping in VF
> net/ixgbe: fix PF DCB info
> app/testpmd: fix mapping of user priority to DCB TC
> net/i40e: fix VFIO interrupt mapping in VF
>
>Wei Zhao (4):
> net/ixgbe: fix MAC VLAN filter fail problem
> net/i40e: fix clear xstats bug in VF
> app/testpmd: fix packet throughput after stats reset
> net/ixgbe: fix filter parser for L2 tunnel
>
>Wenzhuo Lu (7):
> net/i40e: fix TM node parameter checking
> net/i40e: fix TM level capability getting
> net/ixgbe: fix TM node parameter checking
> net/ixgbe: fix TM level capability getting
> net/i40e: fix not supporting NULL TM profile
> net/ixgbe: fix not supporting NULL TM profile
> net/i40e: fix parent when adding TM node
>
>Xiaoyun Li (2):
> net/i40e: fix PF notify issue when VF is not up
> net/igb: fix Rx interrupt with VFIO and MSI-X
>
>Xueming Li (5):
> net/mlx5: fix tunnel offload detection
> mem: fix malloc debug config
> mem: fix malloc element free in debug mode
> examples/l2fwd_fork: fix message pool init
> examples/multi_process: fix received message length
>
>Yi Yang (1):
> service: fix build with gcc 4.9
>
>Yong Wang (4):
> net/liquidio: fix uninitialized variable
> net/igb: fix memcpy length
> net/i40e: fix uninitialized variable
> net/ixgbe: fix uninitialized variable
>
>Yongseok Koh (3):
> net/mlx5: fix calculating TSO inline size
> net/mlx5: fix overflow of Rx SW ring
> net/mlx5: fix tunneled TCP/UDP packet type
>
>Zhiyong Yang (2):
> test: fix assignment operation
> net/virtio: fix Tx packet length stats
Hi Yuanhan,
Thanks for the queuing the patches for stable release.
Could you please provide ETA?
I was on PTO for last several days, so we need some time to do review and
sanity etc.
Thanks.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
2017-11-30 15:09 3% ` Gaëtan Rivet
@ 2017-11-30 15:43 3% ` Matan Azrad
0 siblings, 0 replies; 200+ results
From: Matan Azrad @ 2017-11-30 15:43 UTC (permalink / raw)
To: Gaëtan Rivet; +Cc: Neil Horman, Thomas Monjalon, Jingjing Wu, dev
Hi Gaetan
> -----Original Message-----
> From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> Sent: Thursday, November 30, 2017 5:10 PM
> To: Matan Azrad <matan@mellanox.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>; Thomas Monjalon
> <thomas@monjalon.net>; Jingjing Wu <jingjing.wu@intel.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
>
> On Thu, Nov 30, 2017 at 02:30:20PM +0000, Matan Azrad wrote:
> > Hi all
> >
> > > -----Original Message-----
> > > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > > Sent: Thursday, November 30, 2017 3:25 PM
> > > To: Neil Horman <nhorman@tuxdriver.com>
> > > Cc: Matan Azrad <matan@mellanox.com>; Thomas Monjalon
> > > <thomas@monjalon.net>; Jingjing Wu <jingjing.wu@intel.com>;
> > > dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
> > >
> > > Hello Matan, Neil,
> > >
> > > I like the port ownership concept. I think it is needed to clarify
> > > some operations and should be useful to several subsystems.
> > >
> > > This patch could certainly be sub-divided however, and your current
> > > 1/5 should probably come after this one.
> >
> > Can you suggest how to divide it?
> >
>
> Adding first the API to add / remove owners, then in a second patch set / get
> / unset. (by the way, remove / delete is pretty confusing, I'd suggest
> renaming those.) You can also separate the introduction of the new owner-
> wise iterator.
>
> Ultimately, you are the author, it's your job to help us review your work.
>
When you suggest improvement I think you need to propose another method\idea.
The author probably thought about it and arrived to his conclusions.
Exactly as you are doing now in naming.
If you have a specific question, I'm here to answer :)
I agree with unset name instead of remove, will change it in V2.
> > 1/5 could be actually outside of this series, it is just better
> > behavior to use the right function to do release port :)
> >
> > >
> > > Some comments inline.
> > >
> > > On Thu, Nov 30, 2017 at 07:36:11AM -0500, Neil Horman wrote:
> > > > On Tue, Nov 28, 2017 at 11:57:58AM +0000, Matan Azrad wrote:
> > > > > The ownership of a port is implicit in DPDK.
> > > > > Making it explicit is better from the next reasons:
> > > > > 1. It may be convenient for multi-process applications to know which
> > > > > process is in charge of a port.
> > > > > 2. A library could work on top of a port.
> > > > > 3. A port can work on top of another port.
> > > > >
> > > > > Also in the fail-safe case, an issue has been met in testpmd.
> > > > > We need to check that the user is not trying to use a port which
> > > > > is already managed by fail-safe.
> > > > >
> > > > > Add ownership mechanism to DPDK Ethernet devices to avoid
> > > > > multiple management of a device by different DPDK entities.
> > > > >
> > > > > A port owner is built from owner id(number) and owner
> > > > > name(string) while the owner id must be unique to distinguish
> > > > > between two identical entity instances and the owner name can be
> any name.
> > > > > The name helps to logically recognize the owner by different
> > > > > DPDK entities and allows easy debug.
> > > > > Each DPDK entity can allocate an owner unique identifier and can
> > > > > use it and its preferred name to owns valid ethdev ports.
> > > > > Each DPDK entity can get any port owner status to decide if it
> > > > > can manage the port or not.
> > > > >
> > > > > The current ethdev internal port management is not affected by
> > > > > this feature.
> > > > >
> > >
> > > The internal port management is not affected, but the external
> > > interface is, however. In order to respect port ownership,
> > > applications are forced to modify their port iterator, as shown by your
> testpmd patch.
> > >
> > > I think it would be better to modify the current RTE_ETH_FOREACH_DEV
> > > to call RTE_FOREACH_DEV_OWNED_BY, and introduce a default owner
> that
> > > would represent the application itself (probably with the ID 0 and
> > > an owner string ""). Only with specific additional configuration
> > > should this default subset of ethdev be divided.
> > >
> > > This would make this evolution seamless for applications, at no cost
> > > to the complexity of the design.
> >
> > As you can see in patch code and in testpmd example I added option to
> > iterate over all valid ownerless ports which should be more relevant by
> owner_id = 0.
> > So maybe the RTE_ETH_FOREACH_DEV should be changed to run this by
> the new iterator.
>
> That is precisely what I am suggesting.
> Ideally, you should not have to change anything in testpmd, beside some bug
> fixing regarding port iteration to avoid those with a specific owner.
>
> RTE_ETH_FOREACH_DEV must stay valid, and should iterate over ownerless
> ports (read: port owned by the default owner).
>
> > By this way current applications don't need to build their owners but the
> ABI will be broken.
> >
>
> ABI is broken anyway as you will add the owner to rte_eth_dev_data.
>
It is not, rte_eth_dev_data is internal.
> > Actually, I think the old iterator RTE_ETH_FOREACH_DEV should be
> > unexposed or just removed,
>
> I don't think so. Using RTE_ETH_FOREACH_DEV should allow keeping the
> current behavior of iterating over ownerless ports. Applications that do not
> care for this API should not have to change anything to their code.
>
If we will break the ABI later users can use RTE_ETH_FOREACH_DEV_OWNED_BY(p,0)
to do it. RTE_ETH_FOREACH_DEV will be unnecessary anymore but maybe is too much to applications to change also the API.
I can agree with it.
> > also the DEFFERED state should be removed,
>
> Of course.
>
> > I don't really see any usage to iterate over all valid ports by DPDK entities
> different from ethdev itself.
> > I just don't want to break it now.
> >
>
> [snip]
>
> --
> Gaëtan Rivet
> 6WIND
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
2017-11-30 14:30 3% ` Matan Azrad
@ 2017-11-30 15:09 3% ` Gaëtan Rivet
2017-11-30 15:43 3% ` Matan Azrad
0 siblings, 1 reply; 200+ results
From: Gaëtan Rivet @ 2017-11-30 15:09 UTC (permalink / raw)
To: Matan Azrad; +Cc: Neil Horman, Thomas Monjalon, Jingjing Wu, dev
On Thu, Nov 30, 2017 at 02:30:20PM +0000, Matan Azrad wrote:
> Hi all
>
> > -----Original Message-----
> > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> > Sent: Thursday, November 30, 2017 3:25 PM
> > To: Neil Horman <nhorman@tuxdriver.com>
> > Cc: Matan Azrad <matan@mellanox.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Jingjing Wu <jingjing.wu@intel.com>;
> > dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
> >
> > Hello Matan, Neil,
> >
> > I like the port ownership concept. I think it is needed to clarify some
> > operations and should be useful to several subsystems.
> >
> > This patch could certainly be sub-divided however, and your current 1/5
> > should probably come after this one.
>
> Can you suggest how to divide it?
>
Adding first the API to add / remove owners, then in a second patch
set / get / unset. (by the way, remove / delete is pretty confusing, I'd
suggest renaming those.) You can also separate the introduction of the
new owner-wise iterator.
Ultimately, you are the author, it's your job to help us review your
work.
> 1/5 could be actually outside of this series, it is just better behavior to use the right function to do release port :)
>
> >
> > Some comments inline.
> >
> > On Thu, Nov 30, 2017 at 07:36:11AM -0500, Neil Horman wrote:
> > > On Tue, Nov 28, 2017 at 11:57:58AM +0000, Matan Azrad wrote:
> > > > The ownership of a port is implicit in DPDK.
> > > > Making it explicit is better from the next reasons:
> > > > 1. It may be convenient for multi-process applications to know which
> > > > process is in charge of a port.
> > > > 2. A library could work on top of a port.
> > > > 3. A port can work on top of another port.
> > > >
> > > > Also in the fail-safe case, an issue has been met in testpmd.
> > > > We need to check that the user is not trying to use a port which is
> > > > already managed by fail-safe.
> > > >
> > > > Add ownership mechanism to DPDK Ethernet devices to avoid multiple
> > > > management of a device by different DPDK entities.
> > > >
> > > > A port owner is built from owner id(number) and owner name(string)
> > > > while the owner id must be unique to distinguish between two
> > > > identical entity instances and the owner name can be any name.
> > > > The name helps to logically recognize the owner by different DPDK
> > > > entities and allows easy debug.
> > > > Each DPDK entity can allocate an owner unique identifier and can use
> > > > it and its preferred name to owns valid ethdev ports.
> > > > Each DPDK entity can get any port owner status to decide if it can
> > > > manage the port or not.
> > > >
> > > > The current ethdev internal port management is not affected by this
> > > > feature.
> > > >
> >
> > The internal port management is not affected, but the external interface is,
> > however. In order to respect port ownership, applications are forced to
> > modify their port iterator, as shown by your testpmd patch.
> >
> > I think it would be better to modify the current RTE_ETH_FOREACH_DEV to
> > call RTE_FOREACH_DEV_OWNED_BY, and introduce a default owner that
> > would represent the application itself (probably with the ID 0 and an owner
> > string ""). Only with specific additional configuration should this default
> > subset of ethdev be divided.
> >
> > This would make this evolution seamless for applications, at no cost to the
> > complexity of the design.
>
> As you can see in patch code and in testpmd example I added option to iterate
> over all valid ownerless ports which should be more relevant by owner_id = 0.
> So maybe the RTE_ETH_FOREACH_DEV should be changed to run this by the new iterator.
That is precisely what I am suggesting.
Ideally, you should not have to change anything in testpmd, beside some
bug fixing regarding port iteration to avoid those with a specific
owner.
RTE_ETH_FOREACH_DEV must stay valid, and should iterate over ownerless
ports (read: port owned by the default owner).
> By this way current applications don't need to build their owners but the ABI will be broken.
>
ABI is broken anyway as you will add the owner to rte_eth_dev_data.
> Actually, I think the old iterator RTE_ETH_FOREACH_DEV should be unexposed or just removed,
I don't think so. Using RTE_ETH_FOREACH_DEV should allow keeping the
current behavior of iterating over ownerless ports. Applications that do
not care for this API should not have to change anything to their code.
> also the DEFFERED state should be removed,
Of course.
> I don't really see any usage to iterate over all valid ports by DPDK entities different from ethdev itself.
> I just don't want to break it now.
>
[snip]
--
Gaëtan Rivet
6WIND
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
@ 2017-11-30 14:30 3% ` Matan Azrad
2017-11-30 15:09 3% ` Gaëtan Rivet
0 siblings, 1 reply; 200+ results
From: Matan Azrad @ 2017-11-30 14:30 UTC (permalink / raw)
To: Gaëtan Rivet, Neil Horman; +Cc: Thomas Monjalon, Jingjing Wu, dev
Hi all
> -----Original Message-----
> From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> Sent: Thursday, November 30, 2017 3:25 PM
> To: Neil Horman <nhorman@tuxdriver.com>
> Cc: Matan Azrad <matan@mellanox.com>; Thomas Monjalon
> <thomas@monjalon.net>; Jingjing Wu <jingjing.wu@intel.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/5] ethdev: add port ownership
>
> Hello Matan, Neil,
>
> I like the port ownership concept. I think it is needed to clarify some
> operations and should be useful to several subsystems.
>
> This patch could certainly be sub-divided however, and your current 1/5
> should probably come after this one.
Can you suggest how to divide it?
1/5 could be actually outside of this series, it is just better behavior to use the right function to do release port :)
>
> Some comments inline.
>
> On Thu, Nov 30, 2017 at 07:36:11AM -0500, Neil Horman wrote:
> > On Tue, Nov 28, 2017 at 11:57:58AM +0000, Matan Azrad wrote:
> > > The ownership of a port is implicit in DPDK.
> > > Making it explicit is better from the next reasons:
> > > 1. It may be convenient for multi-process applications to know which
> > > process is in charge of a port.
> > > 2. A library could work on top of a port.
> > > 3. A port can work on top of another port.
> > >
> > > Also in the fail-safe case, an issue has been met in testpmd.
> > > We need to check that the user is not trying to use a port which is
> > > already managed by fail-safe.
> > >
> > > Add ownership mechanism to DPDK Ethernet devices to avoid multiple
> > > management of a device by different DPDK entities.
> > >
> > > A port owner is built from owner id(number) and owner name(string)
> > > while the owner id must be unique to distinguish between two
> > > identical entity instances and the owner name can be any name.
> > > The name helps to logically recognize the owner by different DPDK
> > > entities and allows easy debug.
> > > Each DPDK entity can allocate an owner unique identifier and can use
> > > it and its preferred name to owns valid ethdev ports.
> > > Each DPDK entity can get any port owner status to decide if it can
> > > manage the port or not.
> > >
> > > The current ethdev internal port management is not affected by this
> > > feature.
> > >
>
> The internal port management is not affected, but the external interface is,
> however. In order to respect port ownership, applications are forced to
> modify their port iterator, as shown by your testpmd patch.
>
> I think it would be better to modify the current RTE_ETH_FOREACH_DEV to
> call RTE_FOREACH_DEV_OWNED_BY, and introduce a default owner that
> would represent the application itself (probably with the ID 0 and an owner
> string ""). Only with specific additional configuration should this default
> subset of ethdev be divided.
>
> This would make this evolution seamless for applications, at no cost to the
> complexity of the design.
As you can see in patch code and in testpmd example I added option to iterate over all valid ownerless ports which should be more relevant by owner_id = 0.
So maybe the RTE_ETH_FOREACH_DEV should be changed to run this by the new iterator.
By this way current applications don't need to build their owners but the ABI will be broken.
Actually, I think the old iterator RTE_ETH_FOREACH_DEV should be unexposed or just removed,
also the DEFFERED state should be removed,
I don't really see any usage to iterate over all valid ports by DPDK entities different from ethdev itself.
I just don't want to break it now.
>
> > > Signed-off-by: Matan Azrad <matan@mellanox.com>
> >
> >
> > This seems fairly racy. What if one thread attempts to set ownership
> > on a port, while another is checking it on another cpu in parallel.
> > It doesn't seem like it will protect against that at all. It also
> > doesn't protect against the possibility of multiple threads attempting
> > to poll for rx in parallel, which I think was part of Thomas's
> > origional statement regarding port ownership (he noted that the
> > lockless design implied only a single thread should be allowed to poll for
> receive or make configuration changes at a time.
> >
> > Neil
> >
>
> Isn't this race already there for any configuration operation / polling
> function? The DPDK arch is expecting applications to solve it. Why should port
> ownership be designed differently from other DPDK components?
>
> Embedding checks for port ownership within operations will force everyone
> to bear their costs, even those not interested in using this API. These checks
> should be kept outside, within the entity claiming ownership of the port, in
> the form of using the proper port iterator IMO.
As Gaetan said, there is a race in ethdev in many places, think about new port creation in parallel.
If one day ethdev will be race safe than the port ownership should be too.
>
> > > ---
> > > doc/guides/prog_guide/poll_mode_drv.rst | 12 +++-
> > > lib/librte_ether/rte_ethdev.c | 121
> ++++++++++++++++++++++++++++++++
> > > lib/librte_ether/rte_ethdev.h | 86 +++++++++++++++++++++++
> > > lib/librte_ether/rte_ethdev_version.map | 12 ++++
> > > 4 files changed, 230 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/doc/guides/prog_guide/poll_mode_drv.rst
> > > b/doc/guides/prog_guide/poll_mode_drv.rst
> > > index 6a0c9f9..af639a1 100644
> > > --- a/doc/guides/prog_guide/poll_mode_drv.rst
> > > +++ b/doc/guides/prog_guide/poll_mode_drv.rst
> > > @@ -156,7 +156,7 @@ concurrently on the same tx queue without SW
> > > lock. This PMD feature found in som
> > >
> > > See `Hardware Offload`_ for ``DEV_TX_OFFLOAD_MT_LOCKFREE``
> capability probing details.
> > >
> > > -Device Identification and Configuration
> > > +Device Identification, Ownership and Configuration
> > > ---------------------------------------
> > >
> > > Device Identification
> > > @@ -171,6 +171,16 @@ Based on their PCI identifier, NIC ports are
> assigned two other identifiers:
> > > * A port name used to designate the port in console messages, for
> administration or debugging purposes.
> > > For ease of use, the port name includes the port index.
> > >
> > > +Port Ownership
> > > +~~~~~~~~~~~~~
> > > +The Ethernet devices ports can be owned by a single DPDK entity
> (application, library, PMD, process, etc).
> > > +The ownership mechanism is controlled by ethdev APIs and allows to
> set/remove/get a port owner by DPDK entities.
> > > +Allowing this should prevent any multiple management of Ethernet port
> by different entities.
> > > +
> > > +.. note::
> > > +
> > > + It is the DPDK entity responsibility either to check the port owner
> before using it or to set the port owner to prevent others from using it.
> > > +
> > > Device Configuration
> > > ~~~~~~~~~~~~~~~~~~~~
> > >
> > > diff --git a/lib/librte_ether/rte_ethdev.c
> > > b/lib/librte_ether/rte_ethdev.c index 2d754d9..836991e 100644
> > > --- a/lib/librte_ether/rte_ethdev.c
> > > +++ b/lib/librte_ether/rte_ethdev.c
> > > @@ -71,6 +71,7 @@
> > > static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
> > > struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
> > > static struct rte_eth_dev_data *rte_eth_dev_data;
> > > +static uint16_t rte_eth_next_owner_id = RTE_ETH_DEV_NO_OWNER +
> 1;
> > > static uint8_t eth_dev_last_created_port;
> > >
> > > /* spinlock for eth device callbacks */ @@ -278,6 +279,7 @@ struct
> > > rte_eth_dev *
> > > if (eth_dev == NULL)
> > > return -EINVAL;
> > >
> > > + memset(ð_dev->data->owner, 0, sizeof(struct
> > > +rte_eth_dev_owner));
> > > eth_dev->state = RTE_ETH_DEV_UNUSED;
> > > return 0;
> > > }
> > > @@ -293,6 +295,125 @@ struct rte_eth_dev *
> > > return 1;
> > > }
> > >
> > > +static int
> > > +rte_eth_is_valid_owner_id(uint16_t owner_id) {
> > > + if (owner_id == RTE_ETH_DEV_NO_OWNER ||
> > > + (rte_eth_next_owner_id != RTE_ETH_DEV_NO_OWNER &&
> > > + rte_eth_next_owner_id <= owner_id)) {
> > > + RTE_LOG(ERR, EAL, "Invalid owner_id=%d.\n", owner_id);
> > > + return 0;
> > > + }
> > > + return 1;
> > > +}
> > > +
> > > +uint16_t
> > > +rte_eth_find_next_owned_by(uint16_t port_id, const uint16_t
> > > +owner_id) {
> > > + while (port_id < RTE_MAX_ETHPORTS &&
> > > + (rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED ||
> > > + rte_eth_devices[port_id].data->owner.id != owner_id))
> > > + port_id++;
> > > +
> > > + if (port_id >= RTE_MAX_ETHPORTS)
> > > + return RTE_MAX_ETHPORTS;
> > > +
> > > + return port_id;
> > > +}
> > > +
> > > +int
> > > +rte_eth_dev_owner_new(uint16_t *owner_id) {
> > > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> > > + RTE_PMD_DEBUG_TRACE("Not primary process cannot own
> ports.\n");
> > > + return -EPERM;
> > > + }
> > > + if (rte_eth_next_owner_id == RTE_ETH_DEV_NO_OWNER) {
> > > + RTE_PMD_DEBUG_TRACE("Reached maximum number of
> Ethernet port owners.\n");
> > > + return -EUSERS;
> > > + }
> > > + *owner_id = rte_eth_next_owner_id++;
> > > + return 0;
> > > +}
> > > +
> > > +int
> > > +rte_eth_dev_owner_set(const uint16_t port_id,
> > > + const struct rte_eth_dev_owner *owner) {
> > > + struct rte_eth_dev_owner *port_owner;
> > > + int ret;
> > > +
> > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> > > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> > > + RTE_PMD_DEBUG_TRACE("Not primary process cannot own
> ports.\n");
> > > + return -EPERM;
> > > + }
> > > + if (!rte_eth_is_valid_owner_id(owner->id))
> > > + return -EINVAL;
> > > + port_owner = &rte_eth_devices[port_id].data->owner;
> > > + if (port_owner->id != RTE_ETH_DEV_NO_OWNER &&
> > > + port_owner->id != owner->id) {
> > > + RTE_LOG(ERR, EAL,
> > > + "Cannot set owner to port %d already owned by
> %s_%05d.\n",
> > > + port_id, port_owner->name, port_owner->id);
> > > + return -EPERM;
> > > + }
> > > + ret = snprintf(port_owner->name,
> RTE_ETH_MAX_OWNER_NAME_LEN, "%s",
> > > + owner->name);
> > > + if (ret < 0 || ret >= RTE_ETH_MAX_OWNER_NAME_LEN) {
> > > + memset(port_owner->name, 0,
> RTE_ETH_MAX_OWNER_NAME_LEN);
> > > + RTE_LOG(ERR, EAL, "Invalid owner name.\n");
> > > + return -EINVAL;
> > > + }
> > > + port_owner->id = owner->id;
> > > + RTE_PMD_DEBUG_TRACE("Port %d owner is %s_%05d.\n", port_id,
> > > + owner->name, owner->id);
> > > + return 0;
> > > +}
> > > +
> > > +int
> > > +rte_eth_dev_owner_remove(const uint16_t port_id, const uint16_t
> > > +owner_id) {
> > > + struct rte_eth_dev_owner *port_owner;
> > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> > > + if (!rte_eth_is_valid_owner_id(owner_id))
> > > + return -EINVAL;
> > > + port_owner = &rte_eth_devices[port_id].data->owner;
> > > + if (port_owner->id != owner_id) {
> > > + RTE_LOG(ERR, EAL,
> > > + "Cannot remove port %d owner %s_%05d by
> different owner id %5d.\n",
> > > + port_id, port_owner->name, port_owner->id,
> owner_id);
> > > + return -EPERM;
> > > + }
> > > + RTE_PMD_DEBUG_TRACE("Port %d owner %s_%05d has
> removed.\n", port_id,
> > > + port_owner->name, port_owner->id);
> > > + memset(port_owner, 0, sizeof(struct rte_eth_dev_owner));
> > > + return 0;
> > > +}
> > > +
> > > +void
> > > +rte_eth_dev_owner_delete(const uint16_t owner_id) {
> > > + uint16_t p;
> > > +
> > > + if (!rte_eth_is_valid_owner_id(owner_id))
> > > + return;
> > > + RTE_ETH_FOREACH_DEV_OWNED_BY(p, owner_id)
> > > + memset(&rte_eth_devices[p].data->owner, 0,
> > > + sizeof(struct rte_eth_dev_owner));
> > > + RTE_PMD_DEBUG_TRACE("All port owners owned by "
> > > + "%05d identifier has removed.\n", owner_id); }
> > > +
> > > +const struct rte_eth_dev_owner *
> > > +rte_eth_dev_owner_get(const uint16_t port_id) {
> > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, NULL);
> > > + if (rte_eth_devices[port_id].data->owner.id ==
> RTE_ETH_DEV_NO_OWNER)
> > > + return NULL;
> > > + return &rte_eth_devices[port_id].data->owner;
> > > +}
> > > +
> > > int
> > > rte_eth_dev_socket_id(uint16_t port_id) { diff --git
> > > a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> > > index 341c2d6..f54c26d 100644
> > > --- a/lib/librte_ether/rte_ethdev.h
> > > +++ b/lib/librte_ether/rte_ethdev.h
> > > @@ -1760,6 +1760,15 @@ struct rte_eth_dev_sriov {
> > >
> > > #define RTE_ETH_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
> > >
> > > +#define RTE_ETH_DEV_NO_OWNER 0
> > > +
> > > +#define RTE_ETH_MAX_OWNER_NAME_LEN 64
> > > +
> > > +struct rte_eth_dev_owner {
> > > + uint16_t id; /**< The owner unique identifier. */
> > > + char name[RTE_ETH_MAX_OWNER_NAME_LEN]; /**< The owner
> name. */ };
> > > +
> > > /**
> > > * @internal
> > > * The data part, with no function pointers, associated with each
> ethernet device.
> > > @@ -1810,6 +1819,7 @@ struct rte_eth_dev_data {
> > > int numa_node; /**< NUMA node connection */
> > > struct rte_vlan_filter_conf vlan_filter_conf;
> > > /**< VLAN filter configuration. */
> > > + struct rte_eth_dev_owner owner; /**< The port owner. */
> > > };
> > >
> > > /** Device supports link state interrupt */ @@ -1846,6 +1856,82 @@
> > > struct rte_eth_dev_data {
> > >
> > >
> > > /**
> > > + * Iterates over valid ethdev ports owned by a specific owner.
> > > + *
> > > + * @param port_id
> > > + * The id of the next possible valid owned port.
> > > + * @param owner_id
> > > + * The owner identifier.
> > > + * RTE_ETH_DEV_NO_OWNER means iterate over all valid ownerless
> ports.
> > > + * @return
> > > + * Next valid port id owned by owner_id, RTE_MAX_ETHPORTS if there
> is none.
> > > + */
> > > +uint16_t rte_eth_find_next_owned_by(uint16_t port_id, const
> > > +uint16_t owner_id);
> > > +
> > > +/**
> > > + * Macro to iterate over all enabled ethdev ports owned by a specific
> owner.
> > > + */
> > > +#define RTE_ETH_FOREACH_DEV_OWNED_BY(p, o) \
> > > + for (p = rte_eth_find_next_owned_by(0, o); \
> > > + (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
> > > + p = rte_eth_find_next_owned_by(p + 1, o))
> > > +
> > > +/**
> > > + * Get a new unique owner identifier.
> > > + * An owner identifier is used to owns Ethernet devices by only one
> > > +DPDK entity
> > > + * to avoid multiple management of device by different entities.
> > > + *
> > > + * @param owner_id
> > > + * Owner identifier pointer.
> > > + * @return
> > > + * Negative errno value on error, 0 on success.
> > > + */
> > > +int rte_eth_dev_owner_new(uint16_t *owner_id);
> > > +
> > > +/**
> > > + * Set an Ethernet device owner.
> > > + *
> > > + * @param port_id
> > > + * The identifier of the port to own.
> > > + * @param owner
> > > + * The owner pointer.
> > > + * @return
> > > + * Negative errno value on error, 0 on success.
> > > + */
> > > +int rte_eth_dev_owner_set(const uint16_t port_id,
> > > + const struct rte_eth_dev_owner *owner);
> > > +
> > > +/**
> > > + * Remove Ethernet device owner to make the device ownerless.
> > > + *
> > > + * @param port_id
> > > + * The identifier of port to make ownerless.
> > > + * @param owner
> > > + * The owner identifier.
> > > + * @return
> > > + * 0 on success, negative errno value on error.
> > > + */
> > > +int rte_eth_dev_owner_remove(const uint16_t port_id, const uint16_t
> > > +owner_id);
> > > +
> > > +/**
> > > + * Remove owner from all Ethernet devices owned by a specific owner.
> > > + *
> > > + * @param owner
> > > + * The owner identifier.
> > > + */
> > > +void rte_eth_dev_owner_delete(const uint16_t owner_id);
> > > +
> > > +/**
> > > + * Get the owner of an Ethernet device.
> > > + *
> > > + * @param port_id
> > > + * The port identifier.
> > > + * @return
> > > + * NULL when the device is ownerless, else the device owner pointer.
> > > + */
> > > +const struct rte_eth_dev_owner *rte_eth_dev_owner_get(const
> > > +uint16_t port_id);
> > > +
> > > +/**
> > > * Get the total number of Ethernet devices that have been successfully
> > > * initialized by the matching Ethernet driver during the PCI probing
> phase
> > > * and that are available for applications to use. These devices
> > > must be diff --git a/lib/librte_ether/rte_ethdev_version.map
> > > b/lib/librte_ether/rte_ethdev_version.map
> > > index e9681ac..7d07edb 100644
> > > --- a/lib/librte_ether/rte_ethdev_version.map
> > > +++ b/lib/librte_ether/rte_ethdev_version.map
> > > @@ -198,6 +198,18 @@ DPDK_17.11 {
> > >
> > > } DPDK_17.08;
> > >
> > > +DPDK_18.02 {
> > > + global:
> > > +
> > > + rte_eth_find_next_owned_by;
> > > + rte_eth_dev_owner_new;
> > > + rte_eth_dev_owner_set;
> > > + rte_eth_dev_owner_remove;
> > > + rte_eth_dev_owner_delete;
> > > + rte_eth_dev_owner_get;
> > > +
> > > +} DPDK_17.11;
> > > +
> > > EXPERIMENTAL {
> > > global:
> > >
> > > --
> > > 1.8.3.1
> > >
> > >
>
> --
> Gaëtan Rivet
> 6WIND
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [RFC 2/2] net/tap: add eBPF instructions
2017-11-30 8:01 1% [dpdk-dev] [RFC 1/2] net/tap: add eBPF to TAP device Ophir Munk
@ 2017-11-30 8:01 1% ` Ophir Munk
0 siblings, 0 replies; 200+ results
From: Ophir Munk @ 2017-11-30 8:01 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon, Olga Shern, Pascal Mazon, Ophir Munk
The C source file (tap_bpf_insns.c) includes eBPF "assembly
instructions" in the format of an array of struct bpf_insns.
This array is passed to the kernel for execution in BPF system call.
The C language source file (tap_bpf_program.c) from which the
"assembly instructions" were generated is included in TAP source tree,
however it does not take part in dpdk compilation.
TAP documentation details the process of eBPF "assembly instructions"
generation.
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
drivers/net/tap/Makefile | 1 +
drivers/net/tap/tap_bpf_api.h | 276 ++
drivers/net/tap/tap_bpf_insns.c | 5427 +++++++++++++++++++++++++++++++++++++
drivers/net/tap/tap_bpf_program.c | 321 +++
drivers/net/tap/tap_bpf_shared.h | 40 +
drivers/net/tap/tap_flow.c | 11 +-
6 files changed, 6075 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/tap/tap_bpf_api.h
create mode 100644 drivers/net/tap/tap_bpf_insns.c
create mode 100644 drivers/net/tap/tap_bpf_program.c
create mode 100644 drivers/net/tap/tap_bpf_shared.h
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index 9afae5e..c334d90 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -59,6 +59,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap_netlink.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap_tcmsgs.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap_bpf_insns.c
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/tap/tap_bpf_api.h b/drivers/net/tap/tap_bpf_api.h
new file mode 100644
index 0000000..0328dd8
--- /dev/null
+++ b/drivers/net/tap/tap_bpf_api.h
@@ -0,0 +1,276 @@
+/*******************************************************************************
+
+ Copyright (C) 2015 Daniel Borkmann <daniel@iogearbox.net>
+
+ Copied from iproute2's include/bpf_api.h, available at:
+ https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
+
+ This file is licensed under GNU General Public License (GPL) v2.
+
+ The full GNU General Public License is included in this distribution in
+ the file called "LICENSE.GPL".
+
+*******************************************************************************/
+
+
+#ifndef __BPF_API__
+#define __BPF_API__
+
+/* Note:
+ *
+ * This file can be included into eBPF kernel programs. It contains
+ * a couple of useful helper functions, map/section ABI (bpf_elf.h),
+ * misc macros and some eBPF specific LLVM built-ins.
+ */
+
+#include <stdint.h>
+
+#include <linux/pkt_cls.h>
+#include <linux/bpf.h>
+#include <linux/filter.h>
+
+#include <asm/byteorder.h>
+
+#include "tap_bpf_elf.h"
+
+/** Misc macros. */
+
+#ifndef __stringify
+# define __stringify(X) #X
+#endif
+
+#ifndef __maybe_unused
+# define __maybe_unused __attribute__((__unused__))
+#endif
+
+#ifndef offsetof
+# define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
+#endif
+
+#ifndef likely
+# define likely(X) __builtin_expect(!!(X), 1)
+#endif
+
+#ifndef unlikely
+# define unlikely(X) __builtin_expect(!!(X), 0)
+#endif
+
+#ifndef htons
+# define htons(X) __constant_htons((X))
+#endif
+
+#ifndef ntohs
+# define ntohs(X) __constant_ntohs((X))
+#endif
+
+#ifndef htonl
+# define htonl(X) __constant_htonl((X))
+#endif
+
+#ifndef ntohl
+# define ntohl(X) __constant_ntohl((X))
+#endif
+
+#ifndef __inline__
+# define __inline__ __attribute__((always_inline))
+#endif
+
+/** Section helper macros. */
+
+#ifndef __section
+# define __section(NAME) \
+ __attribute__((section(NAME), used))
+#endif
+
+#ifndef __section_tail
+# define __section_tail(ID, KEY) \
+ __section(__stringify(ID) "/" __stringify(KEY))
+#endif
+
+#ifndef __section_xdp_entry
+# define __section_xdp_entry \
+ __section(ELF_SECTION_PROG)
+#endif
+
+#ifndef __section_cls_entry
+# define __section_cls_entry \
+ __section(ELF_SECTION_CLASSIFIER)
+#endif
+
+#ifndef __section_act_entry
+# define __section_act_entry \
+ __section(ELF_SECTION_ACTION)
+#endif
+
+#ifndef __section_lwt_entry
+# define __section_lwt_entry \
+ __section(ELF_SECTION_PROG)
+#endif
+
+#ifndef __section_license
+# define __section_license \
+ __section(ELF_SECTION_LICENSE)
+#endif
+
+#ifndef __section_maps
+# define __section_maps \
+ __section(ELF_SECTION_MAPS)
+#endif
+
+/** Declaration helper macros. */
+
+#ifndef BPF_LICENSE
+# define BPF_LICENSE(NAME) \
+ char ____license[] __section_license = NAME
+#endif
+
+/** Classifier helper */
+
+#ifndef BPF_H_DEFAULT
+# define BPF_H_DEFAULT -1
+#endif
+
+/** BPF helper functions for tc. Individual flags are in linux/bpf.h */
+
+#ifndef __BPF_FUNC
+# define __BPF_FUNC(NAME, ...) \
+ (* NAME)(__VA_ARGS__)__maybe_unused
+#endif
+
+#ifndef BPF_FUNC
+# define BPF_FUNC(NAME, ...) \
+ __BPF_FUNC(NAME, __VA_ARGS__) = (void *)BPF_FUNC_##NAME
+#endif
+
+/* Map access/manipulation */
+static void *BPF_FUNC(map_lookup_elem, void *map, const void *key);
+static int BPF_FUNC(map_update_elem, void *map, const void *key,
+ const void *value, uint32_t flags);
+static int BPF_FUNC(map_delete_elem, void *map, const void *key);
+
+/* Time access */
+static uint64_t BPF_FUNC(ktime_get_ns);
+
+/* Debugging */
+
+/* FIXME: __attribute__ ((format(printf, 1, 3))) not possible unless
+ * llvm bug https://llvm.org/bugs/show_bug.cgi?id=26243 gets resolved.
+ * It would require ____fmt to be made const, which generates a reloc
+ * entry (non-map).
+ */
+static void BPF_FUNC(trace_printk, const char *fmt, int fmt_size, ...);
+
+#ifndef printt
+# define printt(fmt, ...) \
+ ({ \
+ char ____fmt[] = fmt; \
+ trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \
+ })
+#endif
+
+/* Random numbers */
+static uint32_t BPF_FUNC(get_prandom_u32);
+
+/* Tail calls */
+static void BPF_FUNC(tail_call, struct __sk_buff *skb, void *map,
+ uint32_t index);
+
+/* System helpers */
+static uint32_t BPF_FUNC(get_smp_processor_id);
+static uint32_t BPF_FUNC(get_numa_node_id);
+
+/* Packet misc meta data */
+static uint32_t BPF_FUNC(get_cgroup_classid, struct __sk_buff *skb);
+static int BPF_FUNC(skb_under_cgroup, void *map, uint32_t index);
+
+static uint32_t BPF_FUNC(get_route_realm, struct __sk_buff *skb);
+static uint32_t BPF_FUNC(get_hash_recalc, struct __sk_buff *skb);
+static uint32_t BPF_FUNC(set_hash_invalid, struct __sk_buff *skb);
+
+/* Packet redirection */
+static int BPF_FUNC(redirect, int ifindex, uint32_t flags);
+static int BPF_FUNC(clone_redirect, struct __sk_buff *skb, int ifindex,
+ uint32_t flags);
+
+/* Packet manipulation */
+static int BPF_FUNC(skb_load_bytes, struct __sk_buff *skb, uint32_t off,
+ void *to, uint32_t len);
+static int BPF_FUNC(skb_store_bytes, struct __sk_buff *skb, uint32_t off,
+ const void *from, uint32_t len, uint32_t flags);
+
+static int BPF_FUNC(l3_csum_replace, struct __sk_buff *skb, uint32_t off,
+ uint32_t from, uint32_t to, uint32_t flags);
+static int BPF_FUNC(l4_csum_replace, struct __sk_buff *skb, uint32_t off,
+ uint32_t from, uint32_t to, uint32_t flags);
+static int BPF_FUNC(csum_diff, const void *from, uint32_t from_size,
+ const void *to, uint32_t to_size, uint32_t seed);
+static int BPF_FUNC(csum_update, struct __sk_buff *skb, uint32_t wsum);
+
+static int BPF_FUNC(skb_change_type, struct __sk_buff *skb, uint32_t type);
+static int BPF_FUNC(skb_change_proto, struct __sk_buff *skb, uint32_t proto,
+ uint32_t flags);
+static int BPF_FUNC(skb_change_tail, struct __sk_buff *skb, uint32_t nlen,
+ uint32_t flags);
+
+static int BPF_FUNC(skb_pull_data, struct __sk_buff *skb, uint32_t len);
+
+/* Event notification */
+static int __BPF_FUNC(skb_event_output, struct __sk_buff *skb, void *map,
+ uint64_t index, const void *data, uint32_t size) =
+ (void *) BPF_FUNC_perf_event_output;
+
+/* Packet vlan encap/decap */
+static int BPF_FUNC(skb_vlan_push, struct __sk_buff *skb, uint16_t proto,
+ uint16_t vlan_tci);
+static int BPF_FUNC(skb_vlan_pop, struct __sk_buff *skb);
+
+/* Packet tunnel encap/decap */
+static int BPF_FUNC(skb_get_tunnel_key, struct __sk_buff *skb,
+ struct bpf_tunnel_key *to, uint32_t size, uint32_t flags);
+static int BPF_FUNC(skb_set_tunnel_key, struct __sk_buff *skb,
+ const struct bpf_tunnel_key *from, uint32_t size,
+ uint32_t flags);
+
+static int BPF_FUNC(skb_get_tunnel_opt, struct __sk_buff *skb,
+ void *to, uint32_t size);
+static int BPF_FUNC(skb_set_tunnel_opt, struct __sk_buff *skb,
+ const void *from, uint32_t size);
+
+/** LLVM built-ins, mem*() routines work for constant size */
+
+#ifndef lock_xadd
+# define lock_xadd(ptr, val) ((void) __sync_fetch_and_add(ptr, val))
+#endif
+
+#ifndef memset
+# define memset(s, c, n) __builtin_memset((s), (c), (n))
+#endif
+
+#ifndef memcpy
+# define memcpy(d, s, n) __builtin_memcpy((d), (s), (n))
+#endif
+
+#ifndef memmove
+# define memmove(d, s, n) __builtin_memmove((d), (s), (n))
+#endif
+
+/* FIXME: __builtin_memcmp() is not yet fully useable unless llvm bug
+ * https://llvm.org/bugs/show_bug.cgi?id=26218 gets resolved. Also
+ * this one would generate a reloc entry (non-map), otherwise.
+ */
+#if 0
+#ifndef memcmp
+# define memcmp(a, b, n) __builtin_memcmp((a), (b), (n))
+#endif
+#endif
+
+unsigned long long load_byte(void *skb, unsigned long long off)
+ asm ("llvm.bpf.load.byte");
+
+unsigned long long load_half(void *skb, unsigned long long off)
+ asm ("llvm.bpf.load.half");
+
+unsigned long long load_word(void *skb, unsigned long long off)
+ asm ("llvm.bpf.load.word");
+
+#endif /* __BPF_API__ */
diff --git a/drivers/net/tap/tap_bpf_insns.c b/drivers/net/tap/tap_bpf_insns.c
new file mode 100644
index 0000000..951d037
--- /dev/null
+++ b/drivers/net/tap/tap_bpf_insns.c
@@ -0,0 +1,5427 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright 2017 6WIND S.A.
+ * Copyright 2017 Mellanox.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of 6WIND S.A. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <asm/types.h>
+#include <unistd.h>
+#include <string.h>
+#include <linux/in.h>
+#include <linux/if.h>
+#include <linux/if_ether.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/if_tunnel.h>
+#include <linux/filter.h>
+#include <linux/bpf.h>
+
+#include "tap_bpf_shared.h"
+
+#define ERROR 0
+
+/*
+ * The queue number is offset by 1, to distinguish packets that have
+ * gone through this rule (skb->cb[1] != 0) from others.
+ */
+#define QUEUE_OFFSET 1
+
+#define INV_KEY_IDX 0xdeadbeef
+
+/*
+ *
+ * __section("maps")
+ * struct bpf_elf_map map_keys = {
+ * .type = BPF_MAP_TYPE_HASH,
+ * .id = BPF_MAP_ID_KEY,
+ * .size_key = sizeof(__u32),
+ * .size_value = sizeof(struct rss_key),
+ * .max_elem = 256,
+ * .pinning = PIN_GLOBAL_NS,
+ * };
+ */
+
+/*
+ * struct bpf_insn {
+ * __u8 code; opcode
+ * __u8 dst_reg:4; dest register
+ * __u8 src_reg:4; source register
+ * __s16 off; signed offset
+ * __s32 imm; signed immediate constant
+ * };
+ */
+
+/*
+ * The next bpf_insn array matches cls_q section
+ * see tap_bpf_program.c file
+ *
+ * __section("cls_q") int
+ * match_q (struct __sk_buff *skb)
+ * {
+ * __u32 queue = skb->cb[1];
+ * volatile __u32 q = INV_KEY_IDX;
+ * __u32 match_queue = QUEUE_OFFSET + q;
+ *
+ * if (queue != match_queue)
+ * return TC_ACT_OK;
+ * return TC_ACT_UNSPEC;
+ *
+ * }
+ */
+
+static struct bpf_insn cls_q_insns[] = {
+ {0x61, 1, 1, 52, 0x00000000},
+ {0x18, 2, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 2, -4, 0x00000000},
+ {0x61, 2, 10, -4, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000001},
+ {0x67, 2, 0, 0, 0x00000020},
+ {0x77, 2, 0, 0, 0x00000020},
+ {0xb7, 0, 0, 0, 0xffffffff},
+ {0x1d, 1, 2, 1, 0x00000000},
+ {0xb7, 0, 0, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define CLS_Q_INSNS_CNT \
+ (sizeof(cls_q_insns) / sizeof(cls_q_insns[0]))
+
+/**
+ * Load BPF program (section cls_q) into the kernel and return a bpf fd
+ *
+ * @param queue_idx
+ * Queue index matching packet cb
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_cls_q_insns(__u32 queue_idx)
+{
+ cls_q_insns[1].imm = queue_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)cls_q_insns,
+ CLS_Q_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches tailing section
+ * see tap_bpf_program.c file
+ *
+ * __section("tailing") int
+ * tail(struct __sk_buff *skb)
+ * {
+ * skb_change_tail(skb, skb->len + sizeof(__u32), 0);
+ *
+ * return TC_ACT_UNSPEC;
+ * }
+ */
+
+static struct bpf_insn tailing_insns[] = {
+ {0x61, 2, 1, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000004},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000026},
+ {0x18, 0, 0, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define TAILING_INSNS_CNT \
+ (sizeof(tailing_insns) / sizeof(tailing_insns[0]))
+
+/**
+ * Load BPF program (section tailing) into the kernel and return a bpf fd.
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_tailing_insns(void)
+{
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)tailing_insns,
+ TAILING_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches hash_pending section
+ * see tap_bpf_program.c file
+ *
+ * __section("hash_appending") int
+ * append_hash(struct __sk_buff *skb)
+ * {
+ * __u32 hash = skb->cb[0];
+ *
+ * skb_store_bytes(skb, skb->len - sizeof(hash), &hash, sizeof(hash), 0);
+ *
+ * return TC_ACT_PIPE;
+ * }
+ */
+
+static struct bpf_insn hash_appending_insns[] = {
+ {0x61, 2, 1, 48, 0x00000000},
+ {0x63, 10, 2, -4, 0x00000000},
+ {0x61, 2, 1, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0xbf, 3, 10, 0, 0x00000000},
+ {0x07, 3, 0, 0, 0xfffffffc},
+ {0xb7, 4, 0, 0, 0x00000004},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000009},
+ {0xb7, 0, 0, 0, 0x00000003},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define HASH_APPENDING_INSNS_CNT \
+ (sizeof(hash_appending_insns) / sizeof(hash_appending_insns[0]))
+
+/**
+ * Load BPF program into the kernel and return a bpf fd.
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_hash_appending_insns(void)
+{
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)hash_appending_insns,
+ HASH_APPENDING_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches queue_setting section
+ * see tap_bpf_program.c file
+ *
+ * static void __attribute__((always_inline))
+ * __section("queue_setting") int
+ * set_queue(struct __sk_buff *skb)
+ * {
+ * __u32 key_idx = INV_KEY_IDX;
+ * __u64 hash = skb->cb[0];
+ * struct rss_key *rsskey;
+ * __u32 queue = 0;
+ *
+ * rsskey = map_lookup_elem(&map_keys, &key_idx);
+ * if (rsskey && rsskey->nb_queues <= TAP_MAX_QUEUES)
+ * queue = rsskey->queues[(hash % rsskey->nb_queues) &
+ * (TAP_MAX_QUEUES - 1)];
+ *
+ * skb->cb[1] = QUEUE_OFFSET + queue;
+ *
+ * return TC_ACT_RECLASSIFY;
+ * }
+ */
+
+static struct bpf_insn queue_setting_insns[] = {
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 7, 6, 48, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0xb7, 1, 0, 0, 0x00000001},
+ {0x15, 0, 0, 13, 0x00000000},
+ {0x61, 2, 0, 200, 0x00000000},
+ {0x25, 2, 0, 11, 0x00000010},
+ {0x67, 7, 0, 0, 0x00000020},
+ {0x77, 7, 0, 0, 0x00000020},
+ {0xbf, 1, 7, 0, 0x00000000},
+ {0x3f, 1, 2, 0, 0x00000000},
+ {0x2f, 1, 2, 0, 0x00000000},
+ {0x1f, 7, 1, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x0000000f},
+ {0x67, 7, 0, 0, 0x00000002},
+ {0x0f, 0, 7, 0, 0x00000000},
+ {0x61, 1, 0, 136, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000001},
+ {0x63, 6, 1, 52, 0x00000000},
+ {0xb7, 0, 0, 0, 0x00000001},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define QUEUE_SETTING_INSNS_CNT \
+ (sizeof(queue_setting_insns) / sizeof(queue_setting_insns[0]))
+
+/**
+ * Load BPF program (section queue_setting) into the kernel and return a bpf fd
+ *
+ * @param queue_idx
+ * Queue index matching packet cb
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_queue_setting_insns(__u32 queue_idx)
+{
+ queue_setting_insns[1].imm = queue_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)queue_setting_insns,
+ QUEUE_SETTING_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches l2_src_hash section
+ * see tap_bpf_program.c file
+ *
+ * #define HASH(L) \
+ * __section(#L) int \
+ * L ## _hash(struct __sk_buff *skb) \
+ * { \
+ * return hash(skb, HASH_FIELD_ ## L); \
+ * }
+ *
+ * HASH(L2_SRC)
+ */
+
+
+static struct bpf_insn l2_src_hash_insns[] = {
+ {0xbf, 7, 1, 0, 0x00000000},
+ {0x61, 6, 7, 16, 0x00000000},
+ {0x61, 9, 7, 76, 0x00000000},
+ {0x61, 8, 7, 80, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 1, 7, 48, 0x00000000},
+ {0x7b, 10, 1, -56, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0x55, 0, 0, 21, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000a64},
+ {0x6b, 10, 1, -16, 0x00000000},
+ {0x18, 1, 0, 0, 0x69666e6f},
+ {0x00, 0, 0, 0, 0x65727567},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x6e207369},
+ {0x00, 0, 0, 0, 0x6320746f},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x20737372},
+ {0x00, 0, 0, 0, 0x2079656b},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x203a2928},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x73, 10, 7, -14, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000023},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 543, 0x00000000},
+ {0xb7, 1, 0, 0, 0x0000000e},
+ {0x61, 2, 7, 20, 0x00000000},
+ {0x15, 2, 0, 10, 0x00000000},
+ {0x61, 2, 7, 28, 0x00000000},
+ {0x55, 2, 0, 8, 0x0000a888},
+ {0xbf, 2, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000012},
+ {0x2d, 1, 8, 533, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000012},
+ {0x69, 6, 9, 16, 0x00000000},
+ {0xbf, 7, 2, 0, 0x00000000},
+ {0x61, 2, 0, 128, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x1d, 3, 4, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0x57, 2, 0, 0, 0x00000002},
+ {0x15, 2, 0, 508, 0x00000000},
+ {0x7b, 10, 7, -64, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x0000000c},
+ {0x2d, 1, 8, 517, 0x00000000},
+ {0x71, 1, 0, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000018},
+ {0x71, 6, 0, 1, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000010},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 5, 9, 6, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 7, 0, 4, 0x00000000},
+ {0xbf, 1, 7, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 7, 0, 0x00000000},
+ {0x71, 5, 9, 7, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 7, 0, 5, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 7, 0, 0x00000000},
+ {0x71, 5, 9, 8, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 7, 0, 6, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 7, 0, 0x00000000},
+ {0x71, 5, 9, 9, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 7, 0, 7, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 7, 0, 0x00000000},
+ {0x71, 5, 9, 10, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 7, 0, 8, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x57, 7, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 7, 0, 0x00000000},
+ {0x71, 5, 9, 11, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000038},
+ {0xc7, 5, 0, 0, 0x00000038},
+ {0x6d, 5, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 9, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 5, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003f},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x79, 1, 10, -64, 0x00000000},
+ {0x63, 1, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000020},
+ {0xb7, 3, 0, 0, 0x00000001},
+ {0xb7, 5, 0, 0, 0x00000006},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 13, 0x00000000},
+ {0x57, 6, 0, 0, 0x0000ffff},
+ {0x15, 6, 0, 7, 0x0000dd86},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x55, 6, 0, 10, 0x00000008},
+ {0x0f, 9, 1, 0, 0x00000000},
+ {0x07, 9, 0, 0, 0x00000014},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x2d, 9, 8, 6, 0x00000000},
+ {0x05, 0, 0, 4, 0x00000000},
+ {0x0f, 9, 1, 0, 0x00000000},
+ {0x07, 9, 0, 0, 0x00000028},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x2d, 9, 8, 1, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0xbf, 0, 7, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define L2_SRC_HASH_INSNS_CNT \
+ (sizeof(l2_src_hash_insns) / sizeof(l2_src_hash_insns[0]))
+
+/**
+ * Load BPF program (section l2_src_hash) into the kernel and return a bpf fd.
+ *
+ * @param key_idx
+ * RSS MAP key index
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_l2_src_hash_insns(__u32 key_idx)
+{
+ l2_src_hash_insns[4].imm = key_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)l2_src_hash_insns,
+ L2_SRC_HASH_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches l2_dst_hash section
+ * see tap_bpf_program.c file
+ *
+ * HASH(L2_DST)
+ */
+
+static struct bpf_insn l2_dst_hash_insns[] = {
+ {0xbf, 7, 1, 0, 0x00000000},
+ {0x61, 6, 7, 16, 0x00000000},
+ {0x61, 9, 7, 76, 0x00000000},
+ {0x61, 8, 7, 80, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 1, 7, 48, 0x00000000},
+ {0x7b, 10, 1, -56, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0x55, 0, 0, 21, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000a64},
+ {0x6b, 10, 1, -16, 0x00000000},
+ {0x18, 1, 0, 0, 0x69666e6f},
+ {0x00, 0, 0, 0, 0x65727567},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x6e207369},
+ {0x00, 0, 0, 0, 0x6320746f},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x20737372},
+ {0x00, 0, 0, 0, 0x2079656b},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x203a2928},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x73, 10, 7, -14, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000023},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 538, 0x00000000},
+ {0xb7, 1, 0, 0, 0x0000000e},
+ {0x61, 2, 7, 20, 0x00000000},
+ {0x15, 2, 0, 10, 0x00000000},
+ {0x61, 2, 7, 28, 0x00000000},
+ {0x55, 2, 0, 8, 0x0000a888},
+ {0xbf, 2, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000012},
+ {0x2d, 1, 8, 528, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000012},
+ {0x69, 6, 9, 16, 0x00000000},
+ {0xbf, 7, 2, 0, 0x00000000},
+ {0x71, 2, 0, 128, 0x00000000},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x15, 2, 0, 508, 0x00000000},
+ {0xbf, 5, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000006},
+ {0x2d, 1, 8, 517, 0x00000000},
+ {0x71, 1, 0, 1, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000010},
+ {0x71, 6, 0, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000018},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 3, 9, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0xbf, 7, 5, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 5, 0, 4, 0x00000000},
+ {0xbf, 1, 5, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0x71, 3, 9, 1, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 5, 0, 5, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0x71, 3, 9, 2, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 5, 0, 6, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0x71, 3, 9, 3, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 5, 0, 7, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0x71, 3, 9, 4, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 5, 0, 8, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 3, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 5, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0x71, 3, 9, 5, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000038},
+ {0xc7, 3, 0, 0, 0x00000038},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x6d, 3, 2, 1, 0x00000000},
+ {0xbf, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x71, 2, 0, 9, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000007},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x00000039},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000006},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003a},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000005},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003b},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000004},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003c},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000003},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003d},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0xbf, 5, 2, 0, 0x00000000},
+ {0x77, 5, 0, 0, 0x00000002},
+ {0x57, 5, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 5, 0, 0x00000000},
+ {0xbf, 5, 3, 0, 0x00000000},
+ {0x67, 5, 0, 0, 0x0000003e},
+ {0xc7, 5, 0, 0, 0x0000003f},
+ {0x5f, 5, 1, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003f},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x63, 7, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000020},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0xb7, 5, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 13, 0x00000000},
+ {0x57, 6, 0, 0, 0x0000ffff},
+ {0x15, 6, 0, 7, 0x0000dd86},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x55, 6, 0, 10, 0x00000008},
+ {0x0f, 9, 1, 0, 0x00000000},
+ {0x07, 9, 0, 0, 0x00000014},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x2d, 9, 8, 6, 0x00000000},
+ {0x05, 0, 0, 4, 0x00000000},
+ {0x0f, 9, 1, 0, 0x00000000},
+ {0x07, 9, 0, 0, 0x00000028},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x2d, 9, 8, 1, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0xbf, 0, 7, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+#define L2_DST_HASH_INSNS_CNT \
+ (sizeof(l2_dst_hash_insns) / sizeof(l2_dst_hash_insns[0]))
+
+/**
+ * Load BPF program (section l2_dst_hash) into the kernel and return a bpf fd.
+ *
+ * @param key_idx
+ * RSS MAP key index
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_l2_dst_hash_insns(__u32 key_idx)
+{
+ l2_dst_hash_insns[4].imm = key_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)l2_dst_hash_insns,
+ L2_DST_HASH_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches l3_dst_hash section
+ * see tap_bpf_program.c file
+ *
+ * HASH(L3_DST)
+ */
+
+
+static struct bpf_insn l3_dst_hash_insns[] = {
+ {0xbf, 7, 1, 0, 0x00000000},
+ {0x61, 6, 7, 16, 0x00000000},
+ {0x61, 9, 7, 76, 0x00000000},
+ {0x61, 8, 7, 80, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 1, 7, 48, 0x00000000},
+ {0x7b, 10, 1, -56, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0x55, 0, 0, 21, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000a64},
+ {0x6b, 10, 1, -16, 0x00000000},
+ {0x18, 1, 0, 0, 0x69666e6f},
+ {0x00, 0, 0, 0, 0x65727567},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x6e207369},
+ {0x00, 0, 0, 0, 0x6320746f},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x20737372},
+ {0x00, 0, 0, 0, 0x2079656b},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x203a2928},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x73, 10, 7, -14, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000023},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 1689, 0x00000000},
+ {0xb7, 5, 0, 0, 0x0000000e},
+ {0x61, 1, 7, 20, 0x00000000},
+ {0x15, 1, 0, 10, 0x00000000},
+ {0x61, 1, 7, 28, 0x00000000},
+ {0x55, 1, 0, 8, 0x0000a888},
+ {0xbf, 2, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000012},
+ {0x2d, 1, 8, 1679, 0x00000000},
+ {0xb7, 5, 0, 0, 0x00000012},
+ {0x69, 6, 9, 16, 0x00000000},
+ {0xbf, 7, 2, 0, 0x00000000},
+ {0x61, 1, 0, 128, 0x00000000},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0x7b, 10, 7, -64, 0x00000000},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000002},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x0000ffff},
+ {0x15, 6, 0, 355, 0x0000dd86},
+ {0x55, 6, 0, 1661, 0x00000008},
+ {0x0f, 9, 5, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000014},
+ {0x2d, 2, 8, 1656, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0x57, 2, 0, 0, 0x00000004},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0x1d, 2, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000004},
+ {0x57, 1, 0, 0, 0x00000008},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x15, 1, 0, 1648, 0x00000000},
+ {0x71, 1, 0, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000018},
+ {0x71, 6, 0, 1, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000010},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x71, 7, 8, 16, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 9, 0, 4, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 17, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 5, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 18, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 6, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 19, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 7, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x79, 1, 10, -64, 0x00000000},
+ {0x63, 1, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0x07, 5, 0, 0, 0x00000010},
+ {0x05, 0, 0, 1301, 0x00000000},
+ {0x0f, 9, 5, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000028},
+ {0x2d, 2, 8, 1302, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0x57, 2, 0, 0, 0x00000004},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0x1d, 2, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000010},
+ {0x57, 1, 0, 0, 0x00000008},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x15, 1, 0, 1294, 0x00000000},
+ {0x71, 1, 0, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000018},
+ {0x71, 6, 0, 1, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000010},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x71, 7, 8, 24, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 9, 0, 4, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 25, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 5, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 26, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 6, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 27, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 7, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 28, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 8, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 29, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 9, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 30, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 10, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 31, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 11, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 32, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 12, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 33, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 13, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 34, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 14, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 35, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 15, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 36, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 16, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 37, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 17, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 38, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 18, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 39, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 19, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x79, 1, 10, -64, 0x00000000},
+ {0x63, 1, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0x07, 5, 0, 0, 0x00000018},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0xb7, 2, 0, 0, 0x00000020},
+ {0xb7, 3, 0, 0, 0x00000003},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0xbf, 0, 7, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define L3_DST_HASH_INSNS_CNT \
+ (sizeof(l3_dst_hash_insns) / sizeof(l3_dst_hash_insns[0]))
+
+/**
+ * Load BPF program (section l3_dst_hash) into the kernel and return a bpf fd.
+ *
+ * @param queue_idx
+ * RSS MAP key index
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_l3_dst_hash_insns(__u32 key_idx)
+{
+ l3_dst_hash_insns[4].imm = key_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)l3_dst_hash_insns,
+ L3_DST_HASH_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches l3_src_hash section
+ * see tap_bpf_program.c file
+ *
+ * HASH(L3_SRC)
+ */
+
+static struct bpf_insn l3_src_hash_insns[] = {
+ {0xbf, 7, 1, 0, 0x00000000},
+ {0x61, 6, 7, 16, 0x00000000},
+ {0x61, 9, 7, 76, 0x00000000},
+ {0x61, 8, 7, 80, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 1, 7, 48, 0x00000000},
+ {0x7b, 10, 1, -56, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0x55, 0, 0, 21, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000a64},
+ {0x6b, 10, 1, -16, 0x00000000},
+ {0x18, 1, 0, 0, 0x69666e6f},
+ {0x00, 0, 0, 0, 0x65727567},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x6e207369},
+ {0x00, 0, 0, 0, 0x6320746f},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x20737372},
+ {0x00, 0, 0, 0, 0x2079656b},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x203a2928},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x73, 10, 7, -14, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000023},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 1679, 0x00000000},
+ {0xb7, 5, 0, 0, 0x0000000e},
+ {0x61, 1, 7, 20, 0x00000000},
+ {0x15, 1, 0, 10, 0x00000000},
+ {0x61, 1, 7, 28, 0x00000000},
+ {0x55, 1, 0, 8, 0x0000a888},
+ {0xbf, 2, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000012},
+ {0x2d, 1, 8, 1669, 0x00000000},
+ {0xb7, 5, 0, 0, 0x00000012},
+ {0x69, 6, 9, 16, 0x00000000},
+ {0xbf, 7, 2, 0, 0x00000000},
+ {0x61, 1, 0, 128, 0x00000000},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000002},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0x7b, 10, 7, -64, 0x00000000},
+ {0x57, 6, 0, 0, 0x0000ffff},
+ {0x15, 6, 0, 351, 0x0000dd86},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x55, 6, 0, 1651, 0x00000008},
+ {0x0f, 9, 5, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000014},
+ {0x2d, 2, 8, 1646, 0x00000000},
+ {0x57, 1, 0, 0, 0x00000004},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x15, 1, 0, 1643, 0x00000000},
+ {0x71, 1, 0, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000018},
+ {0x71, 6, 0, 1, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000010},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x71, 7, 8, 12, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 9, 0, 4, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 13, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 5, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 14, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 6, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 15, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 7, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x79, 1, 10, -64, 0x00000000},
+ {0x63, 1, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0x07, 5, 0, 0, 0x0000000c},
+ {0x05, 0, 0, 1296, 0x00000000},
+ {0x0f, 9, 5, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0x00000028},
+ {0x2d, 2, 8, 1297, 0x00000000},
+ {0x57, 1, 0, 0, 0x00000004},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x15, 1, 0, 1294, 0x00000000},
+ {0x71, 1, 0, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000018},
+ {0x71, 6, 0, 1, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000010},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 6, 1, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x71, 7, 8, 8, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 4, 6, 0, 0x00000000},
+ {0x79, 1, 10, -56, 0x00000000},
+ {0xaf, 4, 1, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000001},
+ {0x71, 9, 0, 4, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 9, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 5, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 10, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 6, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 11, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 7, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 12, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 8, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 13, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 9, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 14, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 10, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 15, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 11, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 16, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 12, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 17, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 13, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 18, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 14, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 19, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 15, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 20, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 16, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 21, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 17, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 22, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 6, 0, 0, 0x00000000},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x71, 9, 0, 18, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000007},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x00000039},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000006},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003a},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000005},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003b},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000004},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003c},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000003},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003d},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000002},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0xbf, 6, 7, 0, 0x00000000},
+ {0x67, 6, 0, 0, 0x0000003e},
+ {0xc7, 6, 0, 0, 0x0000003f},
+ {0x5f, 6, 1, 0, 0x00000000},
+ {0xaf, 4, 6, 0, 0x00000000},
+ {0xbf, 6, 9, 0, 0x00000000},
+ {0x77, 6, 0, 0, 0x00000001},
+ {0x57, 6, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 6, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 8, 23, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 19, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x79, 1, 10, -64, 0x00000000},
+ {0x63, 1, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0x07, 5, 0, 0, 0x00000008},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000020},
+ {0xb7, 3, 0, 0, 0x00000002},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0xbf, 0, 7, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define L3_SRC_HASH_INSNS_CNT \
+ (sizeof(l3_src_hash_insns) / sizeof(l3_src_hash_insns[0]))
+
+/**
+ * Load BPF program (section l3_src_hash) into the kernel and return a bpf fd.
+ *
+ * @param queue_idx
+ * RSS MAP key index
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_l3_src_hash_insns(__u32 key_idx)
+{
+ l3_src_hash_insns[4].imm = key_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)l3_src_hash_insns,
+ L3_SRC_HASH_INSNS_CNT,
+ "GPL", 0);
+}
+
+/*
+ * The next bpf_insn array matches l4_src_hash section
+ * see tap_bpf_program.c file
+ *
+ * HASH(L4_SRC)
+ */
+
+static struct bpf_insn l4_src_hash_insns[] = {
+ {0xbf, 6, 1, 0, 0x00000000},
+ {0x61, 8, 6, 16, 0x00000000},
+ {0x61, 9, 6, 76, 0x00000000},
+ {0x61, 1, 6, 80, 0x00000000},
+ {0x7b, 10, 1, -56, 0x00000000},
+ {0x18, 1, 0, 0, 0xdeadbeef},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x63, 10, 1, -4, 0x00000000},
+ {0x61, 7, 6, 48, 0x00000000},
+ {0xbf, 2, 10, 0, 0x00000000},
+ {0x07, 2, 0, 0, 0xfffffffc},
+ {0x18, 1, 1, 0, 0xffffffff},
+ {0x00, 0, 0, 0, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000001},
+ {0x55, 0, 0, 21, 0x00000000},
+ {0xb7, 1, 0, 0, 0x00000a64},
+ {0x6b, 10, 1, -16, 0x00000000},
+ {0x18, 1, 0, 0, 0x69666e6f},
+ {0x00, 0, 0, 0, 0x65727567},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x6e207369},
+ {0x00, 0, 0, 0, 0x6320746f},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x20737372},
+ {0x00, 0, 0, 0, 0x2079656b},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x203a2928},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0x73, 10, 7, -14, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000023},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0x05, 0, 0, 272, 0x00000000},
+ {0xb7, 4, 0, 0, 0x0000000e},
+ {0x61, 1, 6, 20, 0x00000000},
+ {0x15, 1, 0, 11, 0x00000000},
+ {0x61, 1, 6, 28, 0x00000000},
+ {0x55, 1, 0, 9, 0x0000a888},
+ {0xbf, 2, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000012},
+ {0x79, 3, 10, -56, 0x00000000},
+ {0x2d, 1, 3, 261, 0x00000000},
+ {0xb7, 4, 0, 0, 0x00000012},
+ {0x69, 8, 9, 16, 0x00000000},
+ {0xbf, 7, 2, 0, 0x00000000},
+ {0x61, 1, 0, 128, 0x00000000},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0xbf, 3, 1, 0, 0x00000000},
+ {0x57, 3, 0, 0, 0x00000002},
+ {0x1d, 3, 2, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000006},
+ {0x57, 8, 0, 0, 0x0000ffff},
+ {0x15, 8, 0, 24, 0x0000dd86},
+ {0xbf, 5, 7, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x55, 8, 0, 243, 0x00000008},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x0f, 2, 4, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x07, 3, 0, 0, 0x00000014},
+ {0x79, 8, 10, -56, 0x00000000},
+ {0x2d, 3, 8, 236, 0x00000000},
+ {0xbf, 7, 4, 0, 0x00000000},
+ {0xbf, 4, 1, 0, 0x00000000},
+ {0x57, 4, 0, 0, 0x00000004},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0x1d, 4, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000004},
+ {0xbf, 4, 1, 0, 0x00000000},
+ {0x57, 4, 0, 0, 0x00000008},
+ {0x1d, 4, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000004},
+ {0xbf, 4, 7, 0, 0x00000000},
+ {0x07, 4, 0, 0, 0x00000014},
+ {0x07, 2, 0, 0, 0x00000009},
+ {0x05, 0, 0, 21, 0x00000000},
+ {0xbf, 5, 7, 0, 0x00000000},
+ {0xbf, 2, 9, 0, 0x00000000},
+ {0x0f, 2, 4, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x07, 3, 0, 0, 0x00000028},
+ {0x79, 8, 10, -56, 0x00000000},
+ {0x2d, 3, 8, 214, 0x00000000},
+ {0xbf, 7, 4, 0, 0x00000000},
+ {0xbf, 4, 1, 0, 0x00000000},
+ {0x57, 4, 0, 0, 0x00000004},
+ {0xb7, 3, 0, 0, 0x00000000},
+ {0x1d, 4, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000010},
+ {0xbf, 4, 1, 0, 0x00000000},
+ {0x57, 4, 0, 0, 0x00000008},
+ {0x1d, 4, 3, 1, 0x00000000},
+ {0x07, 0, 0, 0, 0x00000010},
+ {0xbf, 4, 7, 0, 0x00000000},
+ {0x07, 4, 0, 0, 0x00000028},
+ {0x07, 2, 0, 0, 0x00000006},
+ {0x71, 2, 2, 0, 0x00000000},
+ {0x15, 2, 0, 2, 0x00000011},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x55, 2, 0, 197, 0x00000006},
+ {0x57, 1, 0, 0, 0x00000010},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0x15, 1, 0, 194, 0x00000000},
+ {0xbf, 3, 9, 0, 0x00000000},
+ {0x0f, 3, 4, 0, 0x00000000},
+ {0xb7, 7, 0, 0, 0x00000000},
+ {0xbf, 1, 3, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0x00000002},
+ {0x79, 2, 10, -56, 0x00000000},
+ {0x2d, 1, 2, 187, 0x00000000},
+ {0x7b, 10, 4, -56, 0x00000000},
+ {0x71, 1, 0, 1, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000010},
+ {0x71, 8, 0, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x00000018},
+ {0x4f, 8, 1, 0, 0x00000000},
+ {0x71, 1, 0, 2, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000008},
+ {0x4f, 8, 1, 0, 0x00000000},
+ {0x71, 1, 0, 3, 0x00000000},
+ {0x4f, 8, 1, 0, 0x00000000},
+ {0x71, 7, 3, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 2, 0, 0, 0x00000000},
+ {0xb7, 1, 0, 0, 0xffffffff},
+ {0xb7, 4, 0, 0, 0x00000000},
+ {0x6d, 7, 1, 1, 0x00000000},
+ {0xbf, 4, 8, 0, 0x00000000},
+ {0xaf, 4, 5, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x00000001},
+ {0x71, 9, 0, 4, 0x00000000},
+ {0xbf, 1, 9, 0, 0x00000000},
+ {0x77, 1, 0, 0, 0x00000007},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x00000039},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000006},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x0000003a},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000005},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x0000003b},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000004},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x0000003c},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000003},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x0000003d},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000002},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0xbf, 8, 7, 0, 0x00000000},
+ {0x67, 8, 0, 0, 0x0000003e},
+ {0xc7, 8, 0, 0, 0x0000003f},
+ {0x5f, 8, 1, 0, 0x00000000},
+ {0xaf, 4, 8, 0, 0x00000000},
+ {0xbf, 8, 9, 0, 0x00000000},
+ {0x77, 8, 0, 0, 0x00000001},
+ {0x57, 8, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 8, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x57, 9, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 9, 0, 0x00000000},
+ {0x71, 7, 3, 1, 0x00000000},
+ {0x67, 7, 0, 0, 0x00000038},
+ {0xc7, 7, 0, 0, 0x00000038},
+ {0xb7, 3, 0, 0, 0xffffffff},
+ {0x6d, 7, 3, 1, 0x00000000},
+ {0xbf, 2, 1, 0, 0x00000000},
+ {0xaf, 4, 2, 0, 0x00000000},
+ {0x71, 2, 0, 5, 0x00000000},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000007},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x00000039},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000006},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003a},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000005},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003b},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000004},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003c},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000003},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003d},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0xbf, 3, 2, 0, 0x00000000},
+ {0x77, 3, 0, 0, 0x00000002},
+ {0x57, 3, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 3, 0, 0x00000000},
+ {0xbf, 3, 7, 0, 0x00000000},
+ {0x67, 3, 0, 0, 0x0000003e},
+ {0xc7, 3, 0, 0, 0x0000003f},
+ {0x5f, 3, 1, 0, 0x00000000},
+ {0xaf, 4, 3, 0, 0x00000000},
+ {0x77, 2, 0, 0, 0x00000001},
+ {0x57, 2, 0, 0, 0x00000001},
+ {0x67, 1, 0, 0, 0x00000001},
+ {0x4f, 1, 2, 0, 0x00000000},
+ {0x67, 7, 0, 0, 0x0000003f},
+ {0xc7, 7, 0, 0, 0x0000003f},
+ {0x5f, 7, 1, 0, 0x00000000},
+ {0xaf, 4, 7, 0, 0x00000000},
+ {0x63, 6, 4, 48, 0x00000000},
+ {0x18, 1, 0, 0, 0x25203d20},
+ {0x00, 0, 0, 0, 0x000a2964},
+ {0x7b, 10, 1, -24, 0x00000000},
+ {0x18, 1, 0, 0, 0x20782520},
+ {0x00, 0, 0, 0, 0x66666f28},
+ {0x7b, 10, 1, -32, 0x00000000},
+ {0x18, 1, 0, 0, 0x6168203a},
+ {0x00, 0, 0, 0, 0x3d206873},
+ {0x7b, 10, 1, -40, 0x00000000},
+ {0x18, 1, 0, 0, 0x68736168},
+ {0x00, 0, 0, 0, 0x29642528},
+ {0x7b, 10, 1, -48, 0x00000000},
+ {0xbf, 1, 10, 0, 0x00000000},
+ {0x07, 1, 0, 0, 0xffffffd0},
+ {0xb7, 2, 0, 0, 0x00000020},
+ {0xb7, 3, 0, 0, 0x00000004},
+ {0x79, 5, 10, -56, 0x00000000},
+ {0x85, 0, 0, 0, 0x00000006},
+ {0xb7, 7, 0, 0, 0x00000003},
+ {0xbf, 0, 7, 0, 0x00000000},
+ {0x95, 0, 0, 0, 0x00000000},
+};
+
+#define L4_SRC_HASH_INSNS_CNT \
+ (sizeof(l4_src_hash_insns) / sizeof(l4_src_hash_insns[0]))
+
+/**
+ * Load BPF program (section l4_src_hash) into the kernel and return a bpf fd.
+ *
+ * @param queue_idx
+ * RSS MAP key index
+ *
+ * @return
+ * -1 if the BPF program couldn't be loaded. An fd (int) otherwise.
+ */
+int bpf_load_l4_src_hash_insns(__u32 key_idx)
+{
+ l4_src_hash_insns[4].imm = key_idx;
+
+ return bpf_load(BPF_PROG_TYPE_SCHED_ACT,
+ (struct bpf_insn *)l4_src_hash_insns,
+ L4_SRC_HASH_INSNS_CNT,
+ "GPL", 0);
+}
+
+#ifndef __NR_bpf
+# if defined(__i386__)
+# define __NR_bpf 357
+# elif defined(__x86_64__)
+# define __NR_bpf 321
+# elif defined(__aarch64__)
+# define __NR_bpf 280
+# elif defined(__sparc__)
+# define __NR_bpf 349
+# elif defined(__s390__)
+# define __NR_bpf 351
+# else
+# error __NR_bpf not defined. libbpf does not support your arch.
+# endif
+#endif
+
+static inline __u64 ptr_to_u64(const void *ptr)
+{
+ return (__u64)(unsigned long)ptr;
+}
+
+static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
+ unsigned int size)
+{
+ return syscall(__NR_bpf, cmd, attr, size);
+}
+
+int bpf_load(enum bpf_prog_type type,
+ const struct bpf_insn *insns,
+ size_t insns_cnt,
+ const char *license,
+ __u32 kern_version)
+{
+ union bpf_attr attr;
+
+ bzero(&attr, sizeof(attr));
+ attr.prog_type = type;
+ attr.insn_cnt = (__u32)insns_cnt;
+ attr.insns = ptr_to_u64(insns);
+ attr.license = ptr_to_u64(license);
+ attr.log_buf = ptr_to_u64(NULL);
+ attr.log_level = 0;
+ attr.kern_version = kern_version;
+
+ return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
+}
diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c
new file mode 100644
index 0000000..e1ae0c5
--- /dev/null
+++ b/drivers/net/tap/tap_bpf_program.c
@@ -0,0 +1,321 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright 2017 6WIND S.A.
+ * Copyright 2017 Mellanox.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of 6WIND S.A. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <asm/types.h>
+#include <linux/in.h>
+#include <linux/if.h>
+#include <linux/if_ether.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/if_tunnel.h>
+#include <linux/filter.h>
+#include <linux/bpf.h>
+
+/* BPF helper functions for our example. */
+#include "tap_bpf_api.h"
+#include "tap_bpf_shared.h"
+
+#define ERROR 0
+
+/*
+ * The queue number is offset by 1, to distinguish packets that have
+ * gone through this rule (skb->cb[1] != 0) from others.
+ */
+#define QUEUE_OFFSET 1
+
+#define INV_KEY_IDX 0xdeadbeef
+
+struct vlan_hdr {
+ __be16 proto;
+ __be16 tci;
+};
+
+__section("maps")
+struct bpf_elf_map map_keys = {
+ .type = BPF_MAP_TYPE_HASH,
+ .id = BPF_MAP_ID_KEY,
+ .size_key = sizeof(__u32),
+ .size_value = sizeof(struct rss_key),
+ .max_elem = 256,
+ .pinning = PIN_GLOBAL_NS,
+};
+
+__section("cls_q") int
+match_q(struct __sk_buff *skb)
+{
+ __u32 queue = skb->cb[1];
+ volatile __u32 q = INV_KEY_IDX;
+ __u32 match_queue = QUEUE_OFFSET + q;
+
+ /* printt("match_q$i() queue = %d\n", queue); */
+
+ if (queue != match_queue)
+ return TC_ACT_OK;
+ return TC_ACT_UNSPEC;
+}
+
+__section("tailing") int
+tail(struct __sk_buff *skb)
+{
+ skb_change_tail(skb, skb->len + sizeof(__u32), 0);
+
+ return TC_ACT_UNSPEC;
+}
+
+static void __attribute__((always_inline))
+toeplitz_hash(__u32 *hash, __u8 *key, __u32 *v, __u8 *data, __u8 data_len)
+{
+ u_int i, b;
+
+#pragma unroll
+ for (i = 0; i < data_len; i++) {
+#pragma unroll
+ for (b = 0; b < 8; b++) {
+ if (data[i] & (1 << (7 - b)))
+ *hash ^= *v;
+ *v <<= 1;
+ if (key[i + 4] & (1 << (7 - b)))
+ *v |= 1;
+ }
+ }
+}
+
+static int __attribute__((always_inline))
+hash(struct __sk_buff *skb, enum hash_field f)
+{
+ void *data_end = (void *)(long)skb->data_end;
+ void *data = (void *)(long)skb->data;
+ __u16 proto = (__u16)skb->protocol;
+ __u32 key_idx = INV_KEY_IDX;
+ __u32 hash = skb->cb[0];
+ struct rss_key *rsskey;
+ __u64 off = ETH_HLEN;
+ __u8 ip_proto = 0;
+ __u8 *key = 0;
+ __u32 v, len;
+
+ rsskey = map_lookup_elem(&map_keys, &key_idx);
+ if (!rsskey) {
+ printt("hash(): rss key is not configured\n");
+ return TC_ACT_OK;
+ }
+ key = (__u8 *)rsskey->key;
+
+ /* Get correct proto for 802.1ad */
+ if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) {
+ if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) +
+ sizeof(proto) > data_end)
+ return TC_ACT_OK;
+ proto = *(__u16 *)(data + ETH_ALEN * 2 +
+ sizeof(struct vlan_hdr));
+ off += sizeof(struct vlan_hdr);
+ }
+
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L2_DST)) {
+ if (f == HASH_FIELD_L2_DST) {
+ v = (key[0] << 24) + (key[1] << 16) + (key[2] << 8) + key[3];
+ if (data + ETH_ALEN > data_end)
+ return TC_ACT_OK;
+ toeplitz_hash(&hash, key, &v, data, ETH_ALEN);
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0], 0);
+ return TC_ACT_PIPE;
+ }
+ key += ETH_ALEN;
+ }
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L2_SRC)) {
+ if (f == HASH_FIELD_L2_SRC) {
+ v = (key[0] << 24) + (key[1] << 16) + (key[2] << 8) + key[3];
+ if (data + ETH_ALEN * 2 > data_end)
+ return TC_ACT_OK;
+ toeplitz_hash(&hash, key, &v, data + ETH_ALEN, ETH_ALEN);
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0], ETH_ALEN);
+ return TC_ACT_PIPE;
+ }
+ key += ETH_ALEN;
+ }
+
+ if (proto == htons(ETH_P_IP)) {
+ struct iphdr *ip;
+
+ if (data + off + sizeof(struct iphdr) > data_end)
+ return TC_ACT_OK;
+ ip = data + off;
+ ip_proto = ip->protocol;
+
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L3_SRC)) {
+ if (f == HASH_FIELD_L3_SRC) {
+ v = (key[0] << 24) + (key[1] << 16) +
+ (key[2] << 8) + key[3];
+ toeplitz_hash(&hash, key, &v, data + off +
+ offsetof(struct iphdr, saddr),
+ sizeof(__u32));
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0],
+ off + offsetof(struct iphdr, saddr));
+ return TC_ACT_PIPE;
+ }
+ key += sizeof(__u32);
+ }
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L3_DST)) {
+ if (f == HASH_FIELD_L3_DST) {
+ v = (key[0] << 24) + (key[1] << 16) +
+ (key[2] << 8) + key[3];
+ toeplitz_hash(&hash, key, &v, data + off +
+ offsetof(struct iphdr, daddr),
+ sizeof(__u32));
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0],
+ off + offsetof(struct iphdr, daddr));
+ return TC_ACT_PIPE;
+ }
+ key += sizeof(__u32);
+ }
+ off += sizeof(struct iphdr);
+ } else if (proto == htons(ETH_P_IPV6)) {
+ struct ipv6hdr *ip;
+
+ if (data + off + sizeof(struct ipv6hdr) > data_end)
+ return TC_ACT_OK;
+ ip = data + off;
+ ip_proto = ip->nexthdr;
+
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L3_SRC)) {
+ if (f == HASH_FIELD_L3_SRC) {
+ v = (key[0] << 24) + (key[1] << 16) +
+ (key[2] << 8) + key[3];
+ toeplitz_hash(&hash, key, &v, data + off +
+ offsetof(struct ipv6hdr, saddr),
+ sizeof(struct in6_addr));
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0],
+ off + offsetof(struct ipv6hdr, saddr));
+ return TC_ACT_PIPE;
+ }
+ key += sizeof(struct in6_addr);
+ }
+ if (rsskey->hash_fields & (1 << HASH_FIELD_L3_DST)) {
+ if (f == HASH_FIELD_L3_DST) {
+ v = (key[0] << 24) + (key[1] << 16) +
+ (key[2] << 8) + key[3];
+ toeplitz_hash(&hash, key, &v, data + off +
+ offsetof(struct ipv6hdr, daddr),
+ sizeof(struct in6_addr));
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0],
+ off + offsetof(struct ipv6hdr, daddr));
+ return TC_ACT_PIPE;
+ }
+ key += sizeof(struct in6_addr);
+ }
+ off += sizeof(struct ipv6hdr);
+ } else {
+ /* Unknown protocol: stop hashing there */
+ return TC_ACT_PIPE;
+ }
+
+ /* Unknown ip_proto: stop hashing there */
+ if ((ip_proto == IPPROTO_TCP || ip_proto == IPPROTO_UDP) &&
+ (rsskey->hash_fields & (1 << HASH_FIELD_L4_SRC)) &&
+ (f == HASH_FIELD_L4_SRC)) {
+ v = (key[0] << 24) + (key[1] << 16) + (key[2] << 8) + key[3];
+ if (data + off + sizeof(__u16) > data_end)
+ return TC_ACT_OK;
+ toeplitz_hash(&hash, key, &v, data + off,
+ sizeof(__u16));
+ skb->cb[0] = hash;
+ printt("hash(%d): hash = %x (off = %d)\n",
+ f, skb->cb[0], off);
+ return TC_ACT_PIPE;
+ }
+
+ return TC_ACT_PIPE;
+}
+
+#define HASH(L) \
+ __section(#L) int \
+ L ## _hash(struct __sk_buff *skb) \
+ { \
+ return hash(skb, HASH_FIELD_ ## L); \
+ }
+
+HASH(L2_DST)
+
+HASH(L2_SRC)
+
+HASH(L3_SRC)
+
+HASH(L3_DST)
+
+HASH(L4_SRC)
+
+__section("hash_appending") int
+append_hash(struct __sk_buff *skb)
+{
+ __u32 hash = skb->cb[0];
+
+ skb_store_bytes(skb, skb->len - sizeof(hash), &hash, sizeof(hash), 0);
+
+ return TC_ACT_PIPE;
+}
+
+__section("queue_setting") int
+set_queue(struct __sk_buff *skb)
+{
+ __u32 key_idx = INV_KEY_IDX;
+ __u64 hash = skb->cb[0];
+ struct rss_key *rsskey;
+ __u32 queue = 0;
+
+ rsskey = map_lookup_elem(&map_keys, &key_idx);
+ if (rsskey && rsskey->nb_queues <= TAP_MAX_QUEUES)
+ queue = rsskey->queues[(hash % rsskey->nb_queues) &
+ (TAP_MAX_QUEUES - 1)];
+
+ skb->cb[1] = QUEUE_OFFSET + queue;
+
+ return TC_ACT_RECLASSIFY;
+}
+
+BPF_LICENSE("GPL");
diff --git a/drivers/net/tap/tap_bpf_shared.h b/drivers/net/tap/tap_bpf_shared.h
new file mode 100644
index 0000000..6895cf4
--- /dev/null
+++ b/drivers/net/tap/tap_bpf_shared.h
@@ -0,0 +1,40 @@
+#ifndef __BPF_SHARED__
+#define __BPF_SHARED__
+
+#define TAP_MAX_QUEUES 16
+
+enum hash_field {
+ HASH_FIELD_L2_DST,
+ HASH_FIELD_L2_SRC,
+ HASH_FIELD_L3_SRC,
+ HASH_FIELD_L3_DST,
+ HASH_FIELD_L4_SRC,
+};
+
+enum {
+ BPF_MAP_ID_KEY,
+ BPF_MAP_ID_SIMPLE,
+};
+
+struct rss_key {
+ __u32 key[32];
+ __u32 hash_fields;
+ __u32 key_size;
+ __u32 queues[TAP_MAX_QUEUES];
+ __u32 nb_queues;
+};
+
+int bpf_load_cls_q_insns(__u32 queue_idx);
+int bpf_load_tailing_insns(void);
+int bpf_load_hash_appending_insns(void);
+int bpf_load_queue_setting_insns(__u32 queue_idx);
+int bpf_load_l2_src_hash_insns(__u32 key_idx);
+int bpf_load_l2_dst_hash_insns(__u32 key_idx);
+int bpf_load_l3_dst_hash_insns(__u32 key_idx);
+int bpf_load_l3_src_hash_insns(__u32 key_idx);
+int bpf_load_l4_src_hash_insns(__u32 key_idx);
+
+int bpf_load(enum bpf_prog_type type, const struct bpf_insn *insns,
+ size_t insns_cnt, const char *license, __u32 kern_version);
+
+#endif /* __BPF_SHARED__ */
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index 43bab7d..355f493 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -46,6 +46,8 @@
#include <linux/bpf.h>
#include <linux/tc_act/tc_bpf.h>
+#include <tap_bpf_shared.h>
+
#ifndef HAVE_TC_FLOWER
/*
* For kernels < 4.2, this enum is not defined. Runtime checks will be made to
@@ -1673,7 +1675,9 @@ static int rss_enable(struct pmd_internals *pmd)
},
};
- bpf_fd = 0;
+ bpf_fd = bpf_load_cls_q_insns(i);
+ if (bpf_fd == -1)
+ return -1;
rss_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
if (!rss_flow) {
@@ -1708,6 +1712,11 @@ static int rss_enable(struct pmd_internals *pmd)
LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
}
+ /* Add a rule that adds 4 bytes at packet's end to hold the hash */
+ bpf_fd = bpf_load_tailing_insns();
+ if (bpf_fd == -1)
+ return -1;
+
snprintf(annotation, sizeof(annotation), "%s:[%s]", BPF_PROGRAM,
section);
rss_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
--
1.8.3.1
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [RFC 1/2] net/tap: add eBPF to TAP device
@ 2017-11-30 8:01 1% Ophir Munk
2017-11-30 8:01 1% ` [dpdk-dev] [RFC 2/2] net/tap: add eBPF instructions Ophir Munk
0 siblings, 1 reply; 200+ results
From: Ophir Munk @ 2017-11-30 8:01 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon, Olga Shern, Pascal Mazon, Ophir Munk
The DPDK traffic classifier is the rte_flow API and the tap PMD
must support it including RSS queue mapping actions.
An example usage for this requirement is failsafe transparent
switching from a PCI device to TAP device while RSS queues are the
same on both devices.
TC was chosen as TAP classifier but TC alone does not support RSS
queue mapping. This commit uses a combination of TC rules and eBPF
actions in order to support TAP RSS.
eBPF requires Linux version 3.19. eBPF is effective only when running
with an appropriate kernel version. It must be compiled with the
appropriate Linux kernel headers. In case the kernel headers do
not include eBPF definitions a warning will be issued during
compilation time and TAP RSS will not be supported.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
The DPDK traffic classifier is the rte_flow API and the tap PMD
must support it including RSS queue mapping actions.
An example usage for this requirement is failsafe transparent
switching from a PCI device to TAP device while RSS queues are the
same on both devices.
TC was chosen as TAP classifier but TC alone does not support RSS
queue mapping. This RFC suggests using a combination of TC rules and eBPF
actions in order to support TAP RSS.
eBPF requires Linux version 3.19. eBPF is effective only when running
with an appropriate kernel version. It must be compiled with the
appropriate Linux kernel headers. In case the kernel headers do
not include eBPF definitions a warning will be issued during
compilation time and TAP RSS will not be supported.
The C source file (tap_bpf_insns.c) includes eBPF "assembly
instructions" in the format of an array of struct bpf_insns.
This array is passed to the kernel for execution in BPF system call.
The C language source file (tap_bpf_program.c) from which the
"assembly instructions" were generated is included in TAP source tree,
however it does not take part in dpdk compilation.
TAP documentation will detail the process of eBPF "assembly instructions"
generation.
eBPF programs controlled from tap PMD will be used to match packets, compute a
hash given the configured key, and send packets using the desired queue.
In an eBPF program, it is typically not possible to edit the queue_mapping field
in skb to direct the packet in the correct queue. That part would be addressed by
chaining a ``skbedit queue_mapping`` action.
A packet would go through these TC rules (on the local side of the tap netdevice):
+-----+---------------------------+----------------------------------+----------+
|PRIO | Match | Action 1 | Action 2 |
+=====+===========================+==================================+==========+
| 1 | marked? | skbedit queue 'mark' --> DPDK | |
+-----+---------------------------+----------------------------------+----------+
| 2 | marked? | skbedit queue 'mark' --> DPDK | |
+-----+---------------------------+----------------------------------+----------+
| ... | | | |
+-----+---------------------------+----------------------------------+----------+
| x | ANY | BPF: append NULL 32bits for hash | |
| | | | |
+-----+---------------------------+----------------------------------+----------+
|x + 1| ACTUAL FLOW RULE 1 MATCH | ... | |
| | | | |
+-----+---------------------------+----------------------------------+----------+
|x + 2| ACTUAL FLOW RULE 2 MATCH | ... | |
| | | | |
+-----+---------------------------+----------------------------------+----------+
| ... | | | |
+-----+---------------------------+----------------------------------+----------+
| BPF compute hash into packet |reclassify|
| | | tailroom && set queue in skb->cb | |
+-----+---------------------------+----------------------------------+----------+
| BPF compute hash into packet |reclassify|
| | | tailroom && set queue in skb->cb | |
+-----+---------------------------+----------------------------------+----------+
| ... | | | |
+-----+---------------------------+----------------------------------+----------+
| BPF compute hash into packet |reclassify|
| | | tailroom && set queue in skb->cb | |
+-----+---------------------------+----------------------------------+----------+
| z | ANY (isolate mode) | DROP | |
+-----+---------------------------+----------------------------------+----------+
Rules 1..x will match marked packets and will redirect them to their queues however
on first classification packets are not marked there will not be redirected.
Only when going later through RSS rules y..z BPF computes RSS hash,
sets queue in dkb->cb, and reclassifies packets. Then packets are classified again
through rules 1-x while being marked and will be redirected.
Rules (x+1)..y are non-RSS TC rules already used in dpdk versions prior to 18.02
doc/guides/prog_guide/rte_flow_tap.rst | 962 +++++++++++++++++++++++++++++++++
drivers/net/tap/Makefile | 6 +-
drivers/net/tap/rte_eth_tap.h | 7 +-
drivers/net/tap/tap_bpf_elf.h | 56 ++
drivers/net/tap/tap_flow.c | 336 ++++++++----
5 files changed, 1263 insertions(+), 104 deletions(-)
create mode 100644 doc/guides/prog_guide/rte_flow_tap.rst
create mode 100644 drivers/net/tap/tap_bpf_elf.h
diff --git a/doc/guides/prog_guide/rte_flow_tap.rst b/doc/guides/prog_guide/rte_flow_tap.rst
new file mode 100644
index 0000000..04ddda6
--- /dev/null
+++ b/doc/guides/prog_guide/rte_flow_tap.rst
@@ -0,0 +1,962 @@
+=====================================
+Flow API support in TAP PMD, using TC
+=====================================
+
+.. contents::
+.. sectnum::
+
+.. footer::
+
+ v0.8 - page ###Page###
+
+.. raw:: pdf
+
+ PageBreak
+
+Rationale
+=========
+
+For this project, the tap PMD has to receive selected traffic from a different
+netdevice (refer to *VM migration with Microsoft Hyper-V and Mellanox
+ConnectX-3* document) and only cover the same set of rules as supported by the
+mlx4 PMD.
+
+The DPDK traffic classifier is the rte_flow API, and the tap PMD must therefore
+implement it. For that, TC was chosen for several reasons:
+
+- it happens very early in the kernel stack for ingress (faster than netfilter).
+- it supports dropping packets given a specific flow.
+- it supports redirecting packets to a different netdevice.
+- it has a "flower" classifier type that meets mostly the pattern items in
+ rte_flow.
+- it can be configured through a netlink socket, without an external tool.
+
+Modes of operation
+==================
+
+There should be two modes of operation for the tap PMD regarding rte_flow:
+*local* and *remote*. Only one mode can be in use at a time for a specific tap
+interface.
+
+The *local* mode would be the default one, if no specific parameter is specified
+in the command line. To start the application with tap in *remote* mode, set the
+``remote`` tap parameter to the interface you want to redirect packets from,
+e.g.::
+
+ testpmd -n 4 -c 0xf -m 1024 --vdev=net_tap,iface=tap0,remote=eth3 -- \
+ -i --burst=64 --coremask=0x2
+
+*Local* mode
+------------
+
+In *local* mode, flow rules would be applied as-is, on the tap netdevice itself
+(e.g.: ``tap0``).
+
+The typical use-case is having a linux program (e.g. a webserver) communicating
+with the DPDK app through the tap netdevice::
+
+ +-------------------------+
+ | DPDK application |
+ +-------------------------+
+ | ^
+ | rte_flow rte_flow |
+ v egress ingress |
+ +-------------------------+
+ | Tap PMD |
+ +-------------------------+
+ | ^
+ | TC TC |
+ v ingress egress |
+ +-------------------------+ +-------------------------+
+ | |<-------------| |
+ | Tap netdevice (tap0) | | Linux app (webserver) |
+ | |------------->| |
+ +-------------------------+ +-------------------------+
+
+.. raw:: pdf
+
+ PageBreak
+
+*Remote* mode
+-------------
+
+In *remote* mode, flow rules would be applied on the tap netdevice (e.g.:
+``tap0``), and use a similar match to redirect specific packets from another
+netdevice (e.g.: ``eth3``, a NetVSC netdevice in our project scenario)::
+
+ +-------------------------+
+ | DPDK application |
+ +-------------------------+
+ | ^
+ | rte_flow rte_flow |
+ v egress ingress |
+ +-------------------------+
+ | Tap PMD |
+ +-------------------------+
+ | ^
+ | TC TC |
+ v ingress egress |
+ +-------------------------+ +-------------------------+
+ | |<------------------redirection-------\ |
+ | Tap netdevice (tap0) | | | |
+ | |------------->|-\ eth3 | |
+ +-------------------------+ +--|--------------------|-+
+ | TC TC ^
+ | egress ingress |
+ v |
+
+.. raw:: pdf
+
+ PageBreak
+
+rte_flow rules conversion
+=========================
+
+Netlink
+-------
+
+The only way to create TC rules in the kernel is through netlink messages.
+Two possibilities arise for managing TC rules:
+
+- Using native netlink API calls in the tap PMD
+- Calling the ``tc`` command from iproute2 inside our PMD, via ``system()``.
+
+The former will be done, as library calls are faster than changing context and
+executing an external program from within the tap PMD. Moreover, the kernel TC
+API might propose features not yet implemented in iproute2. Furthermore, a
+custom implementation enables finer tuning and better control.
+
+..
+ Some implementations for TC configuration through Netlink exist already. It's a
+ good source of inspiration on how to do it:
+
+ - iproute2's tc `source code`__
+ - ovs's tc implementation__ (not yet upstream)
+
+ __ https://github.com/shemminger/iproute2/tree/master/tc
+ __ https://mail.openvswitch.org/pipermail/ovs-dev/2016-November/324693.html
+
+Conversion examples
+-------------------
+
+Here are a few examples of rules and how they can be translated from rte_flow
+rules to TC rules. rte_flow rules will be expressed using testpmd's ``flow``
+command syntax, while TC rules will use iproute2 ``tc`` command syntax.
+
+**Notes**:
+ - rte_flow ``ingress`` direction can be translated into a TC ``egress`` rule,
+ and vice versa, when it applies to a tap interface, as TC considers the
+ kernel netdevice standpoint.
+ - in TC, redirecting a packet works by taking a packet from ``ingress`` and
+ sending to another device's ``egress``.
+
+*Local* mode
+~~~~~~~~~~~~
+
+#. Flow rule to give packets coming on the ``tap0`` interface to RX queue 0:
+
+ Using rte_flow::
+
+ flow validate 0 ingress pattern port index is 0 / end \
+ actions queue index 0 / end
+
+ Using ``tc``::
+
+ tc filter add dev tap0 parent 1: flower indev tap0 \
+ action skbedit queue_mapping 0
+
+#. Flow rule to get packets with source mac ``de:ad:ca:fe:00:02`` on RX queue 2:
+
+ Using rte_flow::
+
+ flow create 0 ingress pattern eth src is de:ad:ca:fe:00:02 / end \
+ actions queue 2 / end
+
+ Using ``tc``::
+
+ tc filter add dev tap0 parent 1: flower src_mac de:ad:ca:fe:00:02 \
+ action skbedit queue_mapping 2
+
+#. Flow rule to drop packets matching specific 5-tuple info:
+
+ Using rte_flow::
+
+ flow create 0 ingress pattern eth dst is 3a:80:ce:61:36:54 \
+ src is 52:43:7b:fd:ac:f3 / ipv4 src is 1.1.1.1 dst is 2.2.2.2 \
+ / udp src is 4444 dst is 5555 / end actions drop / end
+
+ Using ``tc``::
+
+ tc filter add dev tap0 parent 1: flower dst_mac 3a:80:ce:61:36:54 \
+ src_mac 52:43:7b:fd:ac:f3 eth_type ip src_ip 1.1.1.1 dst_ip 2.2.2.2 \
+ ip_proto udp src_port 4444 dst_port 5555 action drop
+
+*Remote* mode
+~~~~~~~~~~~~~
+
+In *remote* mode, an additional rule for redirecting packet is systematically
+required. The examples are similar to the previous section (the rte_flow rule
+will thus be omitted).
+
+#. TC rules to give packets coming on the ``eth3`` interface to ``tap0`` RX
+ queue 0::
+
+ # redirection rule
+ tc filter add dev eth3 parent ffff: flower indev eth3 \
+ action mirred egress redirect dev tap0
+ # actual tap rule
+ tc filter add dev tap0 parent 1: flower indev tap0 \
+ action skbedit queue_mapping 0
+
+#. TC rules to get packets with source mac ``de:ad:ca:fe:00:02`` on RX queue 2::
+
+ # redirection rule
+ tc filter add dev eth3 parent ffff: flower src_mac de:ad:ca:fe:00:02 \
+ action mirred egress redirect dev tap0
+ # actual tap rule
+ tc filter add dev tap0 parent 1: flower src_mac de:ad:ca:fe:00:02 \
+ action skbedit queue_mapping 2
+
+#. TC rules to drop packets matching specific 5-tuple info::
+
+ # redirection rule
+ tc filter add dev eth3 parent ffff: flower dst_mac 3a:80:ce:61:36:54 \
+ src_mac 52:43:7b:fd:ac:f3 eth_type ip src_ip 1.1.1.1 dst_ip 2.2.2.2 \
+ ip_proto udp src_port 4444 dst_port 5555 \
+ action mirred egress redirect dev tap0
+ # actual tap rule
+ tc filter add dev tap0 parent 1: flower dst_mac 3a:80:ce:61:36:54 \
+ src_mac 52:43:7b:fd:ac:f3 eth_type ip src_ip 1.1.1.1 dst_ip 2.2.2.2 \
+ ip_proto udp src_port 4444 dst_port 5555 action drop
+
+One last thing, to redirect packets the other way around (from ``tap0`` to
+``eth3``), we would use a similar rule, exchanging interfaces and using an
+appropriate match, e.g.::
+
+ tc filter add dev tap0 parent ffff: flower indev tap0 \
+ action mirred egress redirect dev eth3
+
+..
+ **Note:** ``parent ffff:`` is for TC ``ingress`` while ``parent 1:`` is for TC
+ ``egress``.
+
+Broadcast and promiscuous support
++++++++++++++++++++++++++++++++++
+
+*Remote* mode requirements:
+
+#. When turning the tap netdevice promiscuous, the remote netdevice should
+ implicitly be turned promiscuous too, to get as many packets as possible.
+
+#. Packets matching the destination MAC configured in the tap PMD should be
+ redirected from the remote without being processed by the stack there in the
+ kernel.
+
+#. In promiscuous mode, an incoming packet should be duplicated to be processed
+ both by the tap PMD and the remote netdevice itself.
+
+#. Incoming packets with broadcast destination MAC (i.e.: ``ff:ff:ff:ff:ff:ff``)
+ should be duplicated to be processed both by the tap PMD and the remote
+ netdevice itself.
+
+#. Incoming packets with IPv6 multicast destination MAC (i.e.:
+ ``33:33:00:00:00:00/33:33:00:00:00:00``) should be duplicated to be processed
+ both by the tap PMD and the remote netdevice itself.
+
+#. Incoming packets with broadcast/multicast bit set in the destination MAC
+ (i.e.: ``01:00:00:00:00:00/01:00:00:00:00:00``) should be duplicated to be
+ processed both by the tap PMD and the remote netdevice itself.
+
+Each of these requirements (except the first one) can be directly translated
+into a TC rule, e.g.::
+
+ # local mac (notice the REDIRECT for mirred action):
+ tc filter add dev eth3 parent ffff: prio 1 flower dst_mac de:ad:be:ef:01:02 \
+ action mirred egress redirect dev tap0
+
+ # tap promisc:
+ tc filter add dev eth3 parent ffff: prio 2 basic \
+ action mirred egress mirror dev tap0
+
+ # broadcast:
+ tc filter add dev eth3 parent ffff: prio 3 flower dst_mac ff:ff:ff:ff:ff:ff \
+ action mirred egress mirror dev tap0
+
+ # broadcast v6 (can't express mac_mask with tc, but it works via netlink):
+ tc filter add dev eth3 parent ffff: prio 4 flower dst_mac 33:33:00:00:00:00 \
+ action mirred egress mirror dev tap0
+
+ # all_multi (can't express mac_mask with tc, but it works via netlink):
+ tc filter add dev eth3 parent ffff: prio 5 flower dst_mac 01:00:00:00:00:00 \
+ action mirred egress mirror dev tap0
+
+When promiscuous mode is switched off or on, the first TC rule will be modified
+to have respectively an empty action (``continue``) or the ``mirror`` action.
+
+The first 5 priorities are always reserved, and can only be used for these
+filters.
+
+On top of that, the tap PMD can configure explicit rte_flow rules, translated as
+TC rules on both the remote netdevice and the tap netdevice. On the remote,
+those would need to be processed after the default rules handling promiscuous
+mode, broadcast and all_multi packets.
+
+When using the ``mirror`` action, the packet is duplicated and sent to the tap
+netdevice, while the original packet gets directly processed by the kernel
+without going through later TC rules for the remote. On the tap netdevice, the
+duplicated packet will go through tap TC rules and be classified depending on
+those rules.
+
+**Note:** It is possible to combine a ``mirror`` action and a ``continue``
+action for a single TC rule. Then the original packet would undergo remaining TC
+rules on the remote netdevice side.
+
+When using the ``redirect`` action, the behavior is similar on the tap side, but
+the packet is not duplicated, no further kernel processing is done for the
+remote side.
+
+The following diagram sums it up. A packet that match a TC rule follows the
+associated action (the number in the diamond represents the rule prio as set in
+the above TC rules)::
+
+
+ Incoming packet |
+ on remote (eth3) |
+ | Going through
+ | TC ingress rules
+ v
+ / \
+ / 5 \
+ / \ yes
+ / mac \____________________> tap0
+ \ match?/ duplicated pkt
+ \ /
+ \ /
+ \ /
+ V no, then continue
+ | with TC rules
+ |
+ v
+ / \
+ / 2 \
+ eth3 yes / \ yes
+ kernel <____________________ /promisc\____________________> tap0
+ stack original pkt \ match?/ duplicated pkt
+ \ /
+ \ /
+ \ /
+ V no, then continue
+ | with TC rules
+ |
+ v
+ / \
+ / 3 \
+ eth3 yes / \ yes
+ kernel <____________________ / bcast \____________________> tap0
+ stack original pkt \ match?/ duplicated pkt
+ \ /
+ \ /
+ \ /
+ V no, then continue
+ | with TC rules
+ |
+ v
+ / \
+ / 4 \
+ eth3 yes / \ yes
+ kernel <____________________ / bcast6\____________________> tap0
+ stack original pkt \ match?/ duplicated pkt
+ \ /
+ \ /
+ \ /
+ V no, then continue
+ | with TC rules
+ |
+ v
+ / \
+ / 5 \
+ eth3 yes / all \ yes
+ kernel <____________________ / multi \____________________> tap0
+ stack original pkt \ match?/ duplicated pkt
+ \ /
+ \ /
+ \ /
+ V no, then continue
+ | with TC rules
+ |
+ v
+ |
+ . remaining TC rules
+ .
+ eth3 |
+ kernel <________________________/
+ stack original pkt
+
+.. raw:: pdf
+
+ PageBreak
+
+Associating an rte_flow rule with a TC one
+==========================================
+
+A TC rule is identified by a ``priority`` (16-bit value) and a ``handle``
+(32-bit value). To delete a rule, the priority must be specified, and if several
+rules have the same priority, the handle is needed to select the correct one.
+
+..
+ Specifying an empty priority and handle when requesting a TC rule creation will
+ let the kernel automatically decide what values to set. In fact, the kernel will
+ start with a high priority (i.e. 49152) and subsequent rules will get decreasing
+ priorities (lower priorites get evaluated first).
+
+To avoid further requests to the kernel to identify what priority/handle has
+been automatically allocated, the tap PMD can set priorities and handles
+systematically when creating a rule.
+
+In *local* mode, an rte_flow rule should be translated into a single TC flow
+identified by priority+handle.
+
+In *remote* mode, an rte_flow rule requires two TC rules, one on the tap
+netdevice itself (for the correct action) and another one on the other netdevice
+where packets are redirected from. Both TC rules' priorities+handles must be
+stored for a specific rte_flow rule, and associated with the device they are
+applied on.
+
+.. raw:: pdf
+
+ PageBreak
+
+Considerations regarding Flow API support
+=========================================
+
+Flow rule attributes
+--------------------
+
+Groups and priorities:
+ There is no native support of groups in TC. Instead, the priority field
+ (which is part of the netlink TC msg header) can be adapted. The four MSB
+ would be used to define the group (allowing for 16 groups), while the 12 LSB
+ would be left to define the actual priority (up to 4096).
+
+ Rules with lower priorities are evaluated first. For rules with identical
+ priorities, the one with the highest handle value gets evaluated first.
+
+Direction:
+ Both ingress and egress filtering can be supported.
+
+Meta item types
+---------------
+
+Most applications will use: ``(END | VOID)``
+
+END, VOID:
+ Supported without problem.
+
+INVERT:
+ There is no easy way to support that in TC. It won't be supported
+
+ **mlx4 will not support it either.**
+
+PF, VF, PORT:
+ Not applicable to a tap netdevice.
+
+Data matching item types
+------------------------
+
+Most applications will use:
+``ETH / (IPV4 | IPV6 | END) / (TCP | UDP | END) / END``
+
+ANY:
+ Should be supported.
+
+ **mlx4 will partially support it.**
+
+RAW:
+ It is not planned to support it for now. Matching Raw packets would require
+ using a different classifier than "flower", which is the most simple and
+ applicable for otherwise most other cases. With TC, it's not possible to
+ support in the same rule both "flower" and raw packets.
+
+ **mlx4 will not support it either**.
+
+VLAN:
+ Matching VLAN ID and prio supported.
+ **Note: linux v4.9 required for VLAN support.**
+
+ETH, IPV4, IPV6, UDP, TCP:
+ Matching source/destination MAC/IP/port is supported, with masks.
+
+ **mlx4 does not support partial bit-masks (full or zeroed only).**
+
+ICMP:
+ By specifying the appropriate ether type, ICMP packets can be matched.
+ However, there is no support for ICMP type or code.
+
+ **mlx4 will not support it, however.**
+
+SCTP:
+ By specifying the appropriate IP protocol, SCTP packets can be matched.
+ However, no specific SCTP fields can be matched.
+
+ **mlx4 will not support it, however.**
+
+VXLAN:
+ VXLAN is not recognized by the "flower" classifier. Kernel-managed VXLAN
+ traffic would come through an additional netdevice, which falls outside
+ the scope of this project. VXLAN traffic should occur outside VMs anyway.
+
+Action types
+------------
+
+Most applications will use: ``(VOID | END | QUEUE | DROP) / END``
+
+By default, multiple actions are possible for TC flow rules. However, they are
+ordered in the kernel. The implementation will need to handle actions in a way
+that orders them intelligently when creating them.
+
+VOID, END:
+ Supported.
+
+PASSTHRU:
+ The generic "continue" action can be used.
+
+ **mlx4 will not support it, however**.
+
+MARK / FLAG:
+ The mark is a field inside an skbuff. However, the tap reads messages (mostly
+ packet data), without that info. As an alternative, it may be possible to
+ create a specific queue to pass packets with a specific mark. Further testing
+ are needed to ensure it is feasable.
+
+QUEUE:
+ The ``skbedit`` action with the ``queue_mapping`` option enables directing
+ packets to specific queues.
+
+ Like rte_flow, specifying several ``skbedit queue_mapping`` actions in TC
+ only considers the last one.
+
+DROP:
+ The generic "drop" action can be used. Packets will effectively be dropped,
+ and not left for the kernel to process.
+
+COUNT: Stats are automatically stored in the kernel. The COUNT action will thus
+ be ignored when creating the rule. ``rte_flow_query()`` can be implemented
+ to request a rule's stats from the kernel.
+
+DUP:
+ Duplicating packets is not supported.
+
+RSS:
+ There's no built-in mechanism for RSS in TC.
+
+ By default, incoming packets go to the tap PMD queue 0. To support RSS in
+ software, several additional queues must be set up. Packets coming in on
+ queue 0 can be considered as requiring RSS, and the PMD will apply software
+ rss (using something like ``rte_softrss()``) to select a queue for the
+ packet.
+
+PF, VF:
+ Not applicable to a tap netdevice.
+
+.. raw:: pdf
+
+ PageBreak
+
+TC limitations for flow collision
+=================================
+
+From TC standpoint, filter rules with identical priorities do not collide, if
+they do specify values (at least one different) for the same fields in the TC
+message, with identical fields masks.
+
+Unfortunately, some flows that obviously are not colliding can be considered
+otherwise by the kernel when parsing the TC messages, and thus their creation
+would be rejected.
+
+Here is a table for matching TC fields with their flow API equivalent:
+
++------------------------------+-----------------------------------+-----------+
+| TC message field | rte_flow API | maskable? |
++==============================+===================================+===========+
+| TCA_FLOWER_KEY_ETH_DST | eth dst | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_ETH_SRC | eth src | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_ETH_TYPE | eth type is 0xZZZZ || | no |
+| | eth / {ipv4|ipv6} | |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_IP_PROTO | eth / {ipv4|ipv6} / {tcp|udp} | no |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_IPV4_SRC | eth / ipv4 src | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_IPV4_DST | eth / ipv4 dst | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_IPV6_SRC | eth / ipv6 src | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_IPV6_DST | eth / ipv6 dst | yes |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_L4_SRC | eth / {ipv4|ipv6} / {tcp|udp} dst | no |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_L4_DST | eth / {ipv4|ipv6} / {tcp|udp} src | no |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_VLAN_ID | eth / vlan vid | no |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_VLAN_PRIO | eth / vlan pcp | no |
++------------------------------+-----------------------------------+-----------+
+| TCA_FLOWER_KEY_VLAN_ETH_TYPE | eth / vlan tpid | no |
++------------------------------+-----------------------------------+-----------+
+
+When creating rules with identical priorities, one must make sure that they
+would be translated in TC using the same fields as shown in the above table.
+
+The following flow rules can share the same priority, as they use the same
+fields with identical masks under the hood::
+
+ > flow create 0 ingress priority 0 pattern eth / ipv4 / end
+ actions drop / end
+ Flow rule #0 created
+ > flow create 0 ingress priority 0 pattern eth type is 0x86dd / end
+ actions drop / end
+ Flow rule #1 created
+
+**Note:** Both rules use ETH_TYPE (mask 0xffff) in their TC form.
+
+Sadly, the following flow rules cannot share the same priority, since fields for
+matching IPv4 and IPv6 src/dst addresses are different::
+
+ > flow create 0 ingress priority 1 pattern eth / ipv4 src is 1.1.1.1 / end
+ actions drop / end
+ Flow rule #0 created
+ > flow create 0 ingress priority 1 pattern eth / ipv6 src is ::1 / end
+ actions drop / end
+ PMD: Kernel refused TC filter rule creation (22): Invalid argument
+ Caught error type 2 (flow rule (handle)): overlapping rules
+
+**Note:** First rule uses ETH_TYPE and IPV4_SRC, while the second uses ETH_TYPE
+and IPV6_SRC.
+
+It is however possible to match different IPvX addresses with the same
+priority::
+
+ > flow create 0 ingress priority 2 pattern eth / ipv4 src is 1.1.1.1 / end
+ actions drop / end
+ Flow rule #0 created
+ > flow create 0 ingress priority 2 pattern eth / ipv4 src is 2.2.2.2 / end
+ actions drop / end
+ Flow rule #1 created
+
+If the first rule specifies both destination and source addresses, then the
+other rule with the same priority must too (with identical masks)::
+
+ > flow create 0 ingress priority 3 pattern eth / ipv4 src is 1.1.1.1
+ dst is 1.1.1.2 / end actions drop / end
+ Flow rule #0 created
+ > flow create 0 ingress priority 3 pattern eth / ipv4 src is 2.2.2.2 / end
+ actions drop / end
+ PMD: Kernel refused TC filter rule creation (22): Invalid argument
+ Caught error type 2 (flow rule (handle)): overlapping rules
+ > flow create 0 ingress priority 3 pattern eth / ipv4 src is 2.2.2.2
+ dst spec 2.2.2.3 dst mask 255.255.255.0 / end actions drop / end
+ PMD: Kernel refused TC filter rule creation (22): Invalid argument
+ Caught error type 2 (flow rule (handle)): overlapping rules
+ > flow create 0 ingress priority 3 pattern eth / ipv4 src is 2.2.2.2
+ dst is 2.2.2.3 / end actions drop / end
+ Flow rule #1 created
+
+**Note:** First rule uses ETH_TYPE, IPV4_SRC and IPV4_DST (with full masks). The
+two others must also use those to share the same priority.
+
+It is possible to match TCP/UDP packets with different ports whatever the
+underlying L3, if the same fields are used (thus no l3 addresses specification).
+For instance::
+
+ > flow create 0 ingress priority 4 pattern eth / ipv4 / tcp dst is 3333 / end
+ actions drop / end
+ Flow rule #0 created
+ > flow create 0 ingress priority 4 pattern eth / ipv6 / udp dst is 4444 / end
+ actions drop / end
+ Flow rule #1 created
+ > flow create 0 ingress priority 4 pattern eth / ipv6 / udp src is 5555 / end
+ actions drop / end
+ PMD: Kernel refused TC filter rule creation (22): Invalid argument
+ Caught error type 2 (flow rule (handle)): overlapping rules
+
+**Note:** First 2 rules use ETH_TYPE, IP_PROTO and L4_DST with different values
+but identical masks, so they're OK. Last rule used L4_SRC instead of L4_DST.
+
+.. raw:: pdf
+
+ PageBreak
+
+RSS implementation for tap
+==========================
+
+There are several areas of research for a tap RSS implementation:
+
+#. userland implementation in tap PMD
+#. userland implementation in DPDK (generic)
+#. userland implementation using combination of TC rules and BPF filters/actions
+#. kernel-side implementation in tap driver
+#. kernel-side implementation as a BPF classifier/action
+#. kernel-side implementation as a separate TC action
+
++--------------+------------------------------+------------------------------+
+| | Pros | Cons |
++==============+==============================+==============================+
+| tap PMD | - no kernel upstreaming | - tap PMD is supposed to be |
+| | | simple, and would no longer|
+| | | be. |
+| | | |
+| | | - complex rework, with many |
+| | | rings for enqueuing packets|
+| | | to the right queue |
+| | | |
+| | | - slower |
+| | | |
+| | | - won't be accepted as it |
+| | | doesn't make sense to redo |
+| | | what the kernel did |
+| | | previously |
++--------------+------------------------------+------------------------------+
+| generic DPDK | - would be useful to others | - design must be compatible |
+| | | with most PMDs |
+| | | |
+| | | - probably the longest to |
+| | | develop |
+| | | |
+| | | - requires DPDK community |
+| | | approval |
+| | | |
+| | | - requires heavy changes in |
+| | | tap PMD itself anyway |
++--------------+------------------------------+------------------------------+
+| TC rules | - no kernel upstreaming | - BPF is complicated to learn|
+| combination | | |
+| | - fast | - Runtime BPF compilation / |
+| | | or bytecode change, would |
+| | - per-flow RSS | be tricky |
+| | | |
+| | - no change in tap PMD | - much rework in the tap PMD |
+| | datapath | to handle lots of new |
+| | | netlink messages / actions |
++--------------+------------------------------+------------------------------+
+| tap driver | - pretty fast as it | - might not be accepted by |
+| | intervenes early in packet | the kernel community as |
+| | RX | they may cling to their |
+| | | jhash2 hashing function for|
+| | | RX. |
+| | | |
+| | | - only a single RSS context |
++--------------+------------------------------+------------------------------+
+| BPF | - fast | - BPF is complicated to learn|
+| classifier - | | |
+| action | - per-flow RSS | - would require changing the |
+| | | kernel API to support |
+| | | editing queue_mapping in an|
+| | | skb |
+| | | |
+| | | - hashing would be performed |
+| | | for each queue of a |
+| | | specific RSS context |
+| | | |
+| | | - probably difficult to gain |
+| | | community acceptance |
++--------------+------------------------------+------------------------------+
+| TC action | - much more flexibility, with| - needs to be in sync with |
+| | per-flow RSS, multiple | iproute2's tc program |
+| | keys, multiple packet | |
+| | fields for the hash... | - kernel upstreaming is not |
+| | | necessarily easy |
+| | - it's a separate kernel | |
+| | module that can be | - rework in tap PMD to |
+| | maintained out-of-tree and | support new RSS action and |
+| | optionally upstreamed | configuration |
+| | anytime | |
+| | | |
+| | - most logical to be handled | |
+| | in kernel as RSS is | |
+| | supposed to be computed in | |
+| | the "NIC" exactly once. | |
+| | | |
+| | - fastest | |
+| | | |
+| | - no change in tap PMD | |
+| | datapath | |
++--------------+------------------------------+------------------------------+
+
+TC rules using BPF from tap PMD
+-------------------------------
+
+The third solution is the best for userland-based solutions.
+It does the job well, fast (datapath running in kernel), is logically happening
+in the kernel in runtime, supports flow-based RSS, has the best potential to
+be accepted by the community.
+
+Advantages with this solution:
+- hash can be recorded in the packet data and read in tap PMD
+- no kernel customization, everything in DPDK
+- packet gets in tap PMD on the correct queue directly
+
+Drawbacks:
+- complicates tap PMD a lot:
+ - 3 BPF programs
+ - new implicit rules
+ - new action and filter support
+ - packet stripping
+- numerous TC rules required (in proportion with the number of queues)
+- fast (kernel + JIT BPF), but several TC rules must be crossed
+
+BPF programs controlled from tap PMD will be used to match packets, compute a
+hash given the configured key, and send packets to tap using the desired queue.
+
+Design
+~~~~~~
+
+BPF has a limited set of functions for editing the skb in TC. They are listed
+in ``linux/net/core/filter.c:tc_cls_act_func_proto()``:
+
+- skb_store_bytes
+- skb_load_bytes
+- skb_pull_data
+- csum_diff
+- csum_update
+- l3_csum_replace
+- l4_csum_replace
+- clone_redirect
+- get_cgroup_classid
+- skb_vlan_push
+- skb_vlan_pop
+- skb_change_proto
+- skb_change_type
+- skb_change_tail
+- skb_get_tunnel_key
+- skb_set_tunnel_key
+- skb_get_tunnel_opt
+- skb_set_tunnel_opt
+- redirect
+- get_route_realm
+- get_hash_recalc
+- set_hash_invalid
+- perf_event_output
+- get_smp_processor_id
+- skb_under_cgroup
+
+In a BPF program, it is typically not possible to edit the queue_mapping field
+to direct the packet in the correct queue. That part would be done by chaining a
+``skbedit queue_mapping`` action.
+
+It is not possible either to directly prepend data to a packet (appending works,
+though).
+
+A packet would go through these rules (on the local side of the tap netdevice):
+
++-----+---------------------------+----------------------------------+----------+
+|PRIO | Match | Action 1 | Action 2 |
++=====+===========================+==================================+==========+
+| 1 | marked? | skbedit queue 'mark' --> DPDK | |
++-----+---------------------------+----------------------------------+----------+
+| 2 | marked? | skbedit queue 'mark' --> DPDK | |
++-----+---------------------------+----------------------------------+----------+
+| ... | | | |
++-----+---------------------------+----------------------------------+----------+
+| x | ANY | BPF: append NULL 32bits for hash | |
+| | | | |
++-----+---------------------------+----------------------------------+----------+
+|x + 1| ACTUAL FLOW RULE 1 MATCH | ... | |
+| | | | |
++-----+---------------------------+----------------------------------+----------+
+|x + 2| ACTUAL FLOW RULE 2 MATCH | ... | |
+| | | | |
++-----+---------------------------+----------------------------------+----------+
+| ... | | | |
++-----+---------------------------+----------------------------------+----------+
+| y | FLOW RULE RSS 1 MATCH | BPF compute hash into packet |reclassify|
+| | | tailroom && set queue in skb->cb | |
++-----+---------------------------+----------------------------------+----------+
+|y + 1| FLOW RULE RSS 2 MATCH | BPF compute hash into packet |reclassify|
+| | | tailroom && set queue in skb->cb | |
++-----+---------------------------+----------------------------------+----------+
+| ... | | | |
++-----+---------------------------+----------------------------------+----------+
+| z | ANY (default RSS) | BPF compute hash into packet |reclassify|
+| | | tailroom && set queue in skb->cb | |
++-----+---------------------------+----------------------------------+----------+
+| z | ANY (isolate mode) | DROP | |
++-----+---------------------------+----------------------------------+----------+
+
+
+
+TC kernel action
+----------------
+
+The latest solution (implementing a TC action) would probably be the most simple
+to implement. It is also very flexible, opening more possibilities for filtering
+and RSS combined.
+
+For this solution, the following parameters could be used to configure RSS in a
+TC netlink message:
+
+``queues`` (u16 \*):
+ list of queues to spread incoming traffic on. That's actually the reta.
+ **Note:** the queue in an ``skb`` is on 16-bits, hence the type here.
+
+``key`` (u8 \*):
+ key to use for the Toeplitz-hash in this flow.
+
+``hash_fields`` (bitfield):
+ similar to what's in DPDK, the bitfield should determine what fields in the
+ packet header to use for hashing. It is likely another means of configuring
+ which fields to pick would be used actually.
+
+``algo`` (unsigned):
+ an enum value from the kernel act_rss header can be used to determine which
+ algorithm (implemented in the kernel) to use. Possible algos could be
+ toeplitz, xor, symmetric hash...
+
+**Note:** The number of queues to use is automatically deduced from the
+``queues`` netlink attribute length. The ``key`` length can be similarly
+obtained.
+
+.. raw:: pdf
+
+ PageBreak
+
+Appendix: TC netlink message
+============================
+
+**Note:** For deterministic behavior, TC queueing disciplines (QDISC), filters
+and classes must be flushed before starting to apply TC rules. There is a little
+bit of boilerplate (with specific netlink messages) to ensure TC rules can be
+applied. Typically, the TC ``ingress`` QDISC must be created first.
+
+For information, netlink messages regarding TC will look like this::
+
+ 0 8 16 24 32
+ +----------+----------+----------+----------+ ---
+ 0 | Length | \
+ +---------------------+---------------------+ \
+ 4 | Type | Flags | |
+ +----------- ---------+---------------------+ >-- struct
+ 8 | Sequence number | | nlmsghdr
+ +-------------------------------------------+ /
+ 12 | Process Port ID (PID) | /
+ +==========+==========+==========+==========+ ---
+ 16 | Family | Rsvd1 | Reserved2 | \
+ +----------+----------+---------------------+ \
+ 20 | Interface index | |
+ +-------------------------------------------+ |
+ 24 | Handle | |
+ +-------------------------------------------+ >-- struct
+ 28 | Parent handle | | tcmsg
+ | MAJOR + MINOR | |
+ +-------------------------------------------+ |
+ 32 | TCM info | /
+ | priority + protocol | /
+ +===========================================+ ---
+ | |
+ | Payload |
+ | |
+ ........................................
+ | |
+ | |
+ +-------------------------------------------+
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index 405b49e..9afae5e 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -39,6 +39,9 @@ EXPORT_MAP := rte_pmd_tap_version.map
LIBABIVER := 1
+# TAP_MAX_QUEUES must be a power of 2 as it will be used for masking */
+TAP_MAX_QUEUES = 16
+
CFLAGS += -O3
CFLAGS += -I$(SRCDIR)
CFLAGS += -I.
@@ -47,6 +50,8 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
LDLIBS += -lrte_bus_vdev
+CFLAGS += -DTAP_MAX_QUEUES=$(TAP_MAX_QUEUES)
+
#
# all source are stored in SRCS-y
#
@@ -89,7 +94,6 @@ tap_autoconf.h: tap_autoconf.h.new
mv '$<' '$@'
$(SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP):.c=.o): tap_autoconf.h
-
clean_tap: FORCE
$Q rm -f -- tap_autoconf.h tap_autoconf.h.new
diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h
index 829f32f..01ac153 100644
--- a/drivers/net/tap/rte_eth_tap.h
+++ b/drivers/net/tap/rte_eth_tap.h
@@ -45,7 +45,7 @@
#include <rte_ether.h>
#ifdef IFF_MULTI_QUEUE
-#define RTE_PMD_TAP_MAX_QUEUES 16
+#define RTE_PMD_TAP_MAX_QUEUES TAP_MAX_QUEUES
#else
#define RTE_PMD_TAP_MAX_QUEUES 1
#endif
@@ -90,6 +90,11 @@ struct pmd_internals {
int ioctl_sock; /* socket for ioctl calls */
int nlsk_fd; /* Netlink socket fd */
int flow_isolate; /* 1 if flow isolation is enabled */
+ int flower_support; /* 1 if kernel supports, else 0 */
+ int flower_vlan_support; /* 1 if kernel supports, else 0 */
+ int rss_enabled; /* 1 if RSS is enabled, else 0 */
+ /* implicit rules set when RSS is enabled */
+ LIST_HEAD(tap_rss_flows, rte_flow) rss_flows;
LIST_HEAD(tap_flows, rte_flow) flows; /* rte_flow rules */
/* implicit rte_flow rules set when a remote device is active */
LIST_HEAD(tap_implicit_flows, rte_flow) implicit_flows;
diff --git a/drivers/net/tap/tap_bpf_elf.h b/drivers/net/tap/tap_bpf_elf.h
new file mode 100644
index 0000000..f3db1bf
--- /dev/null
+++ b/drivers/net/tap/tap_bpf_elf.h
@@ -0,0 +1,56 @@
+/*******************************************************************************
+
+ Copyright (C) 2015 Daniel Borkmann <daniel@iogearbox.net>
+
+ Copied from iproute2's include/bpf_elf.h, available at:
+ https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
+
+ This file is licensed under GNU General Public License (GPL) v2.
+
+ The full GNU General Public License is included in this distribution in
+ the file called "LICENSE.GPL".
+
+*******************************************************************************/
+
+
+#ifndef __BPF_ELF__
+#define __BPF_ELF__
+
+#include <asm/types.h>
+
+/* Note:
+ *
+ * Below ELF section names and bpf_elf_map structure definition
+ * are not (!) kernel ABI. It's rather a "contract" between the
+ * application and the BPF loader in tc. For compatibility, the
+ * section names should stay as-is. Introduction of aliases, if
+ * needed, are a possibility, though.
+ */
+
+/* ELF section names, etc */
+#define ELF_SECTION_LICENSE "license"
+#define ELF_SECTION_MAPS "maps"
+#define ELF_SECTION_PROG "prog"
+#define ELF_SECTION_CLASSIFIER "classifier"
+#define ELF_SECTION_ACTION "action"
+
+#define ELF_MAX_MAPS 64
+#define ELF_MAX_LICENSE_LEN 128
+
+/* Object pinning settings */
+#define PIN_NONE 0
+#define PIN_OBJECT_NS 1
+#define PIN_GLOBAL_NS 2
+
+/* ELF map definition */
+struct bpf_elf_map {
+ __u32 type;
+ __u32 size_key;
+ __u32 size_value;
+ __u32 max_elem;
+ __u32 flags;
+ __u32 id;
+ __u32 pinning;
+};
+
+#endif /* __BPF_ELF__ */
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index ffc0b85..43bab7d 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -43,6 +43,9 @@
#include <tap_autoconf.h>
#include <tap_tcmsgs.h>
+#include <linux/bpf.h>
+#include <linux/tc_act/tc_bpf.h>
+
#ifndef HAVE_TC_FLOWER
/*
* For kernels < 4.2, this enum is not defined. Runtime checks will be made to
@@ -104,6 +107,23 @@ struct remote_rule {
int mirred;
};
+struct action_data {
+ char id[16];
+
+ union {
+ struct tc_gact gact;
+ struct tc_mirred mirred;
+ struct skbedit {
+ struct tc_skbedit skbedit;
+ uint16_t queue;
+ } skbedit;
+ struct bpf {
+ int bpf_fd;
+ char *annotation;
+ } bpf;
+ };
+};
+
static int tap_flow_create_eth(const struct rte_flow_item *item, void *data);
static int tap_flow_create_vlan(const struct rte_flow_item *item, void *data);
static int tap_flow_create_ipv4(const struct rte_flow_item *item, void *data);
@@ -134,6 +154,8 @@ struct remote_rule {
int set,
struct rte_flow_error *error);
+static int rss_enable(struct pmd_internals *pmd);
+
static const struct rte_flow_ops tap_flow_ops = {
.validate = tap_flow_validate,
.create = tap_flow_create,
@@ -816,111 +838,64 @@ struct tap_flow_items {
}
/**
- * Transform a DROP/PASSTHRU action item in the provided flow for TC.
- *
- * @param[in, out] flow
- * Flow to be filled.
- * @param[in] action
- * Appropriate action to be set in the TCA_GACT_PARMS structure.
- *
- * @return
- * 0 if checks are alright, -1 otherwise.
+ * FIXME
*/
static int
-add_action_gact(struct rte_flow *flow, int action)
+add_action(struct rte_flow *flow, size_t *act_index, struct action_data *adata)
{
struct nlmsg *msg = &flow->msg;
- size_t act_index = 1;
- struct tc_gact p = {
- .action = action
- };
- if (nlattr_nested_start(msg, TCA_FLOWER_ACT) < 0)
- return -1;
- if (nlattr_nested_start(msg, act_index++) < 0)
+ if (nlattr_nested_start(msg, ++(*act_index)) < 0)
return -1;
- nlattr_add(&msg->nh, TCA_ACT_KIND, sizeof("gact"), "gact");
- if (nlattr_nested_start(msg, TCA_ACT_OPTIONS) < 0)
- return -1;
- nlattr_add(&msg->nh, TCA_GACT_PARMS, sizeof(p), &p);
- nlattr_nested_finish(msg); /* nested TCA_ACT_OPTIONS */
- nlattr_nested_finish(msg); /* nested act_index */
- nlattr_nested_finish(msg); /* nested TCA_FLOWER_ACT */
- return 0;
-}
-
-/**
- * Transform a MIRRED action item in the provided flow for TC.
- *
- * @param[in, out] flow
- * Flow to be filled.
- * @param[in] ifindex
- * Netdevice ifindex, where to mirror/redirect packet to.
- * @param[in] action_type
- * Either TCA_EGRESS_REDIR for redirection or TCA_EGRESS_MIRROR for mirroring.
- *
- * @return
- * 0 if checks are alright, -1 otherwise.
- */
-static int
-add_action_mirred(struct rte_flow *flow, uint16_t ifindex, uint16_t action_type)
-{
- struct nlmsg *msg = &flow->msg;
- size_t act_index = 1;
- struct tc_mirred p = {
- .eaction = action_type,
- .ifindex = ifindex,
- };
- if (nlattr_nested_start(msg, TCA_FLOWER_ACT) < 0)
- return -1;
- if (nlattr_nested_start(msg, act_index++) < 0)
- return -1;
- nlattr_add(&msg->nh, TCA_ACT_KIND, sizeof("mirred"), "mirred");
+ nlattr_add(&msg->nh, TCA_ACT_KIND, strlen(adata->id), adata->id);
if (nlattr_nested_start(msg, TCA_ACT_OPTIONS) < 0)
return -1;
- if (action_type == TCA_EGRESS_MIRROR)
- p.action = TC_ACT_PIPE;
- else /* REDIRECT */
- p.action = TC_ACT_STOLEN;
- nlattr_add(&msg->nh, TCA_MIRRED_PARMS, sizeof(p), &p);
+ if (strcmp("gact", adata->id) == 0) {
+ nlattr_add(&msg->nh, TCA_GACT_PARMS, sizeof(adata->gact),
+ &adata->gact);
+ } else if (strcmp("mirred", adata->id) == 0) {
+ if (adata->mirred.eaction == TCA_EGRESS_MIRROR)
+ adata->mirred.action = TC_ACT_PIPE;
+ else /* REDIRECT */
+ adata->mirred.action = TC_ACT_STOLEN;
+ nlattr_add(&msg->nh, TCA_MIRRED_PARMS, sizeof(adata->mirred),
+ &adata->mirred);
+ } else if (strcmp("skbedit", adata->id) == 0) {
+ nlattr_add(&msg->nh, TCA_SKBEDIT_PARMS,
+ sizeof(adata->skbedit.skbedit),
+ &adata->skbedit.skbedit);
+ nlattr_add16(&msg->nh, TCA_SKBEDIT_QUEUE_MAPPING,
+ adata->skbedit.queue);
+ } else if (strcmp("bpf", adata->id) == 0) {
+ nlattr_add32(&msg->nh, TCA_ACT_BPF_FD, adata->bpf.bpf_fd);
+ nlattr_add(&msg->nh, TCA_ACT_BPF_NAME,
+ strlen(adata->bpf.annotation),
+ adata->bpf.annotation);
+ } else {
+ return -1;
+ }
nlattr_nested_finish(msg); /* nested TCA_ACT_OPTIONS */
nlattr_nested_finish(msg); /* nested act_index */
- nlattr_nested_finish(msg); /* nested TCA_FLOWER_ACT */
return 0;
}
/**
- * Transform a QUEUE action item in the provided flow for TC.
- *
- * @param[in, out] flow
- * Flow to be filled.
- * @param[in] queue
- * Queue id to use.
- *
- * @return
- * 0 if checks are alright, -1 otherwise.
+ * FIXME
*/
static int
-add_action_skbedit(struct rte_flow *flow, uint16_t queue)
+add_actions(struct rte_flow *flow, int nb_actions, struct action_data *data,
+ int classifier_action)
{
struct nlmsg *msg = &flow->msg;
- size_t act_index = 1;
- struct tc_skbedit p = {
- .action = TC_ACT_PIPE
- };
+ size_t act_index = 0;
+ int i;
- if (nlattr_nested_start(msg, TCA_FLOWER_ACT) < 0)
- return -1;
- if (nlattr_nested_start(msg, act_index++) < 0)
+ if (nlattr_nested_start(msg, classifier_action) < 0)
return -1;
- nlattr_add(&msg->nh, TCA_ACT_KIND, sizeof("skbedit"), "skbedit");
- if (nlattr_nested_start(msg, TCA_ACT_OPTIONS) < 0)
- return -1;
- nlattr_add(&msg->nh, TCA_SKBEDIT_PARMS, sizeof(p), &p);
- nlattr_add16(&msg->nh, TCA_SKBEDIT_QUEUE_MAPPING, queue);
- nlattr_nested_finish(msg); /* nested TCA_ACT_OPTIONS */
- nlattr_nested_finish(msg); /* nested act_index */
+ for (i = 0; i < nb_actions; i++)
+ if (add_action(flow, &act_index, data + i) < 0)
+ return -1;
nlattr_nested_finish(msg); /* nested TCA_FLOWER_ACT */
return 0;
}
@@ -1053,7 +1028,12 @@ struct tap_flow_items {
}
}
if (mirred && flow) {
- uint16_t if_index = pmd->if_index;
+ struct action_data adata = {
+ .id = "mirred",
+ .mirred = {
+ .eaction = mirred,
+ },
+ };
/*
* If attr->egress && mirred, then this is a special
@@ -1061,9 +1041,13 @@ struct tap_flow_items {
* redirect packets coming from the DPDK App, out
* through the remote netdevice.
*/
- if (attr->egress)
- if_index = pmd->remote_if_index;
- if (add_action_mirred(flow, if_index, mirred) < 0)
+ adata.mirred.ifindex = attr->ingress ? pmd->if_index :
+ pmd->remote_if_index;
+ if (mirred == TCA_EGRESS_MIRROR)
+ adata.mirred.action = TC_ACT_PIPE;
+ else
+ adata.mirred.action = TC_ACT_STOLEN;
+ if (add_actions(flow, 1, &adata, TCA_FLOWER_ACT) < 0)
goto exit_action_not_supported;
else
goto end;
@@ -1077,14 +1061,33 @@ struct tap_flow_items {
if (action)
goto exit_action_not_supported;
action = 1;
- if (flow)
- err = add_action_gact(flow, TC_ACT_SHOT);
+ if (flow) {
+ struct action_data adata = {
+ .id = "gact",
+ .gact = {
+ .action = TC_ACT_SHOT,
+ },
+ };
+
+ err = add_actions(flow, 1, &adata,
+ TCA_FLOWER_ACT);
+ }
} else if (actions->type == RTE_FLOW_ACTION_TYPE_PASSTHRU) {
if (action)
goto exit_action_not_supported;
action = 1;
- if (flow)
- err = add_action_gact(flow, TC_ACT_UNSPEC);
+ if (flow) {
+ struct action_data adata = {
+ .id = "gact",
+ .gact = {
+ /* continue */
+ .action = TC_ACT_UNSPEC,
+ },
+ };
+
+ err = add_actions(flow, 1, &adata,
+ TCA_FLOWER_ACT);
+ }
} else if (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
const struct rte_flow_action_queue *queue =
(const struct rte_flow_action_queue *)
@@ -1096,22 +1099,30 @@ struct tap_flow_items {
if (!queue ||
(queue->index > pmd->dev->data->nb_rx_queues - 1))
goto exit_action_not_supported;
- if (flow)
- err = add_action_skbedit(flow, queue->index);
+ if (flow) {
+ struct action_data adata = {
+ .id = "skbedit",
+ .skbedit = {
+ .skbedit = {
+ .action = TC_ACT_PIPE,
+ },
+ .queue = queue->index,
+ },
+ };
+
+ err = add_actions(flow, 1, &adata,
+ TCA_FLOWER_ACT);
+ }
} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
- /* Fake RSS support. */
const struct rte_flow_action_rss *rss =
(const struct rte_flow_action_rss *)
actions->conf;
- if (action)
- goto exit_action_not_supported;
- action = 1;
- if (!rss || rss->num < 1 ||
- (rss->queue[0] > pmd->dev->data->nb_rx_queues - 1))
+ if (action++)
goto exit_action_not_supported;
- if (flow)
- err = add_action_skbedit(flow, rss->queue[0]);
+ if (!pmd->rss_enabled)
+ err = rss_enable(pmd);
+ (void)rss;
} else {
goto exit_action_not_supported;
}
@@ -1632,6 +1643,127 @@ int tap_flow_implicit_destroy(struct pmd_internals *pmd,
return 0;
}
+#define BPF_PROGRAM "tap_bpf_program.o"
+
+/**
+ * Enable RSS on tap: create leading TC rules for queuing.
+ */
+static int rss_enable(struct pmd_internals *pmd)
+{
+ struct rte_flow *rss_flow = NULL;
+ char section[64];
+ struct nlmsg *msg = NULL;
+ /* 4096 is the maximum number of instructions for a BPF program */
+ char annotation[256];
+ int bpf_fd;
+ int i;
+
+ /*
+ * Add a rule per queue to match reclassified packets and direct them to
+ * the correct queue.
+ */
+ for (i = 0; i < pmd->dev->data->nb_rx_queues; i++) {
+ struct action_data adata = {
+ .id = "skbedit",
+ .skbedit = {
+ .skbedit = {
+ .action = TC_ACT_PIPE,
+ },
+ .queue = i,
+ },
+ };
+
+ bpf_fd = 0;
+
+ rss_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ if (!rss_flow) {
+ RTE_LOG(ERR, PMD,
+ "Cannot allocate memory for rte_flow");
+ return -1;
+ }
+ msg = &rss_flow->msg;
+ tc_init_msg(msg, pmd->if_index, RTM_NEWTFILTER, NLM_F_REQUEST |
+ NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE);
+ msg->t.tcm_info = TC_H_MAKE((i + PRIORITY_OFFSET) << 16,
+ htons(ETH_P_ALL));
+ msg->t.tcm_parent = TC_H_MAKE(MULTIQ_MAJOR_HANDLE, 0);
+ tap_flow_set_handle(rss_flow);
+ nlattr_add(&msg->nh, TCA_KIND, sizeof("bpf"), "bpf");
+ if (nlattr_nested_start(msg, TCA_OPTIONS) < 0)
+ return -1;
+ nlattr_add32(&msg->nh, TCA_BPF_FD, bpf_fd);
+ snprintf(annotation, sizeof(annotation), "%s:[%s]",
+ BPF_PROGRAM, section);
+ nlattr_add(&msg->nh, TCA_BPF_NAME, strlen(annotation),
+ annotation);
+
+ if (add_actions(rss_flow, 1, &adata, TCA_BPF_ACT) < 0)
+ return -1;
+ nlattr_nested_finish(msg); /* nested TCA_ACT_OPTIONS */
+ /* Netlink message is now ready to be sent */
+ if (nl_send(pmd->nlsk_fd, &msg->nh) < 0)
+ return -1;
+ if (nl_recv_ack(pmd->nlsk_fd) < 0)
+ return -1;
+ LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
+ }
+
+ snprintf(annotation, sizeof(annotation), "%s:[%s]", BPF_PROGRAM,
+ section);
+ rss_flow = rte_malloc(__func__, sizeof(struct rte_flow), 0);
+ if (!rss_flow) {
+ RTE_LOG(ERR, PMD,
+ "Cannot allocate memory for rte_flow");
+ return -1;
+ }
+ msg = &rss_flow->msg;
+ tc_init_msg(msg, pmd->if_index, RTM_NEWTFILTER,
+ NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE);
+ msg->t.tcm_info =
+ TC_H_MAKE((RTE_PMD_TAP_MAX_QUEUES + PRIORITY_OFFSET) << 16,
+ htons(ETH_P_ALL));
+ msg->t.tcm_parent = TC_H_MAKE(MULTIQ_MAJOR_HANDLE, 0);
+ tap_flow_set_handle(rss_flow);
+ nlattr_add(&msg->nh, TCA_KIND, sizeof("flower"), "flower");
+ if (nlattr_nested_start(msg, TCA_OPTIONS) < 0)
+ return -1;
+
+ /* no fields for matching: all packets must match */
+ {
+ /* Actions */
+ struct action_data data[2] = {
+ [0] = {
+ .id = "bpf",
+ .bpf = {
+ .bpf_fd = bpf_fd,
+ .annotation = annotation,
+ },
+ },
+ [1] = {
+ .id = "gact",
+ .gact = {
+ /* continue */
+ .action = TC_ACT_UNSPEC,
+ },
+ },
+ };
+
+ if (add_actions(rss_flow, 2, data, TCA_FLOWER_ACT) < 0)
+ return -1;
+ }
+ nlattr_nested_finish(msg); /* nested TCA_FLOWER_ACT */
+ nlattr_nested_finish(msg); /* nested TCA_OPTIONS */
+ /* Netlink message is now ready to be sent */
+ if (nl_send(pmd->nlsk_fd, &msg->nh) < 0)
+ return -1;
+ if (nl_recv_ack(pmd->nlsk_fd) < 0)
+ return -1;
+ LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
+
+ pmd->rss_enabled = 1;
+ return 0;
+}
+
/**
* Manage filter operations.
*
--
1.8.3.1
^ permalink raw reply [relevance 1%]
* Re: [dpdk-dev] [PATCH v2 1/2] lib/security: add support for get metadata
2017-11-22 14:13 0% ` Anoob
@ 2017-11-27 13:55 0% ` Neil Horman
0 siblings, 0 replies; 200+ results
From: Neil Horman @ 2017-11-27 13:55 UTC (permalink / raw)
To: Anoob
Cc: Akhil Goyal, Declan Doherty, Radu Nicolau,
Sergio Gonzalez Monroy, Jerin Jacob, Narayana Prasad, dev
On Wed, Nov 22, 2017 at 07:43:13PM +0530, Anoob wrote:
> Hi,
>
> Please see inline.
>
>
> On 11/22/2017 06:57 PM, Neil Horman wrote:
> > On Wed, Nov 22, 2017 at 06:55:15AM +0000, Anoob Joseph wrote:
> > > In case of inline protocol processed ingress traffic, the packet may not
> > > have enough information to determine the security parameters with which
> > > the packet was processed. For such cases, application could register a
> > > 64 bit metadata in security session, which could be retrieved from the
> > > packet using "rte_security_get_pkt_metadata" API. Application can use
> > > this metadata to identify the parameters it need.
> > >
> > > Application can choose what it should register as the metadata. It can
> > > register SPI or a pointer to SA.
> > >
> > > Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> > > ---
> > > v2:
> > > * Replaced get_session and get_cookie APIs with get_pkt_metadata API
> > >
> > > lib/librte_security/rte_security.c | 13 +++++++++++++
> > > lib/librte_security/rte_security.h | 19 +++++++++++++++++++
> > > lib/librte_security/rte_security_driver.h | 16 ++++++++++++++++
> > > 3 files changed, 48 insertions(+)
> > >
> > > diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
> > > index 1227fca..804f11f 100644
> > > --- a/lib/librte_security/rte_security.c
> > > +++ b/lib/librte_security/rte_security.c
> > > @@ -108,6 +108,19 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
> > > sess, m, params);
> > > }
> > > +uint64_t
> > > +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
> > > + struct rte_mbuf *pkt)
> > > +{
> > > + uint64_t mdata = 0;
> > > +
> > > + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_pkt_metadata, 0);
> > > + if (instance->ops->get_pkt_metadata(instance->device, pkt, &mdata))
> > > + return 0;
> > > +
> > > + return mdata;
> > > +}
> > > +
> > > const struct rte_security_capability *
> > > rte_security_capabilities_get(struct rte_security_ctx *instance)
> > > {
> > > diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
> > > index 653929b..aa3a471 100644
> > > --- a/lib/librte_security/rte_security.h
> > > +++ b/lib/librte_security/rte_security.h
> > > @@ -274,6 +274,8 @@ struct rte_security_session_conf {
> > > /**< Configuration parameters for security session */
> > > struct rte_crypto_sym_xform *crypto_xform;
> > > /**< Security Session Crypto Transformations */
> > > + uint64_t metadata;
> > > + /**< Metadata registered by application */
> > This is going to break ABI. You need to announce the change so that application
> > providers can be prepared for it.
> The security library is under experimental tag. So is the announcement
> required?
Ah, thats correct, its not required. That said, thats probably the fourth time
I've reviewed a patch and tripped over the fact that it was experimental. We
should probably look at ways at making that fact more visible at review, compile
and run time
Neil
> >
> > > };
> > > struct rte_security_session {
> > > @@ -346,6 +348,23 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
> > > struct rte_mbuf *mb, void *params);
> > > /**
> > > + * Get metadata from the packet. This is an application registered 64 bit
> > > + * value, associated with the security session which processed the packet.
> > > + *
> > > + * This is valid only for inline processed ingress packets.
> > > + *
> > > + * @param instance security instance
> > > + * @param pkt packet mbuf
> > > + *
> > > + * @return
> > > + * - On success, metadata
> > > + * - On failure, 0
> > > + */
> > > +uint64_t
> > > +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
> > > + struct rte_mbuf *pkt);
> > > +
> > > +/**
> > > * Attach a session to a symmetric crypto operation
> > > *
> > > * @param sym_op crypto operation
> > > diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
> > > index 997fbe7..da0ebf4 100644
> > > --- a/lib/librte_security/rte_security_driver.h
> > > +++ b/lib/librte_security/rte_security_driver.h
> > > @@ -122,6 +122,20 @@ typedef int (*security_set_pkt_metadata_t)(void *device,
> > > void *params);
> > > /**
> > > + * Get application interpretable metadata from the packet.
> > > + *
> > > + * @param device Crypto/eth device pointer
> > > + * @param pkt Packet mbuf
> > > + * @param mt Pointer to receive metadata
> > > + *
> > > + * @return
> > > + * - Returns 0 if metadata is retrieved successfully.
> > > + * - Returns -ve value for errors.
> > > + */
> > > +typedef int (*security_get_pkt_metadata_t)(void *device,
> > > + struct rte_mbuf *pkt, uint64_t *mt);
> > > +
> > > +/**
> > > * Get security capabilities of the device.
> > > *
> > > * @param device crypto/eth device pointer
> > > @@ -145,6 +159,8 @@ struct rte_security_ops {
> > > /**< Clear a security sessions private data. */
> > > security_set_pkt_metadata_t set_pkt_metadata;
> > > /**< Update mbuf metadata. */
> > > + security_get_pkt_metadata_t get_pkt_metadata;
> > > + /**< Get metadata from packet. */
> > > security_capabilities_get_t capabilities_get;
> > > /**< Get security capabilities. */
> > > };
> > > --
> > > 2.7.4
> > >
> > >
>
>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH] ethdev: increase flow type limit from 32 to 64
@ 2017-11-27 12:29 6% Kirill Rybalchenko
0 siblings, 0 replies; 200+ results
From: Kirill Rybalchenko @ 2017-11-27 12:29 UTC (permalink / raw)
To: dev
Cc: jingjing.wu, beilei.xing, johndale, neescoba, adrien.mazarguil,
nelio.laranjeiro, yskoh, wenzhuo.lu, konstantin.ananyev,
kirill.rybalchenko, andrey.chilikin
Increase the internal limit for flow types from 32 to 64
to support future flow type extensions.
Change type of variables from uint32_t[] to uint64_t[]:
rte_eth_fdir_info.flow_types_mask
rte_eth_hash_global_conf.sym_hash_enable_mask
rte_eth_hash_global_conf.valid_bit_mask
This modification affects the following components:
net/i40e
net/enic
net/mlx5
net/ixgbe
app/testpmd
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
app/test-pmd/cmdline.c | 22 +++++++++++-----------
drivers/net/enic/enic_clsf.c | 6 +++++-
drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++-------------------
drivers/net/i40e/i40e_fdir.c | 25 ++++++++++++++-----------
drivers/net/ixgbe/ixgbe_fdir.c | 22 ++++++++++++----------
drivers/net/mlx5/mlx5_flow.c | 4 +++-
lib/librte_ether/rte_eth_ctrl.h | 12 ++++++------
7 files changed, 70 insertions(+), 59 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d963..3e57715 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10681,7 +10681,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
struct rte_eth_fdir_info fdir_info;
struct rte_eth_fdir_flex_mask flex_mask;
struct rte_port *port;
- uint32_t flow_type_mask;
+ uint64_t flow_type_mask;
uint16_t i;
int ret;
@@ -10734,7 +10734,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
return;
}
for (i = RTE_ETH_FLOW_UNKNOWN; i < RTE_ETH_FLOW_MAX; i++) {
- if (flow_type_mask & (1 << i)) {
+ if (flow_type_mask & (1ULL << i)) {
flex_mask.flow_type = i;
fdir_set_flex_mask(res->port_id, &flex_mask);
}
@@ -10743,7 +10743,7 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
return;
}
flex_mask.flow_type = str2flowtype(res->flow_type);
- if (!(flow_type_mask & (1 << flex_mask.flow_type))) {
+ if (!(flow_type_mask & (1ULL << flex_mask.flow_type))) {
printf("Flow type %s not supported on port %d\n",
res->flow_type, res->port_id);
return;
@@ -11105,10 +11105,10 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
}
for (i = 0; i < RTE_ETH_FLOW_MAX; i++) {
- idx = i / UINT32_BIT;
- offset = i % UINT32_BIT;
+ idx = i / UINT64_BIT;
+ offset = i % UINT64_BIT;
if (!(info.info.global_conf.valid_bit_mask[idx] &
- (1UL << offset)))
+ (1ULL << offset)))
continue;
str = flowtype_to_str(i);
if (!str)
@@ -11116,7 +11116,7 @@ cmd_get_hash_global_config_parsed(void *parsed_result,
printf("Symmetric hash is %s globally for flow type %s "
"by port %d\n",
((info.info.global_conf.sym_hash_enable_mask[idx] &
- (1UL << offset)) ? "enabled" : "disabled"), str,
+ (1ULL << offset)) ? "enabled" : "disabled"), str,
res->port_id);
}
}
@@ -11177,12 +11177,12 @@ cmd_set_hash_global_config_parsed(void *parsed_result,
RTE_ETH_HASH_FUNCTION_DEFAULT;
ftype = str2flowtype(res->flow_type);
- idx = ftype / (CHAR_BIT * sizeof(uint32_t));
- offset = ftype % (CHAR_BIT * sizeof(uint32_t));
- info.info.global_conf.valid_bit_mask[idx] |= (1UL << offset);
+ idx = ftype / UINT64_BIT;
+ offset = ftype % UINT64_BIT;
+ info.info.global_conf.valid_bit_mask[idx] |= (1ULL << offset);
if (!strcmp(res->enable, "enable"))
info.info.global_conf.sym_hash_enable_mask[idx] |=
- (1UL << offset);
+ (1ULL << offset);
ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,
RTE_ETH_FILTER_SET, &info);
if (ret < 0)
diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c
index 9b46142..c5644cb 100644
--- a/drivers/net/enic/enic_clsf.c
+++ b/drivers/net/enic/enic_clsf.c
@@ -74,8 +74,12 @@ void enic_fdir_stats_get(struct enic *enic, struct rte_eth_fdir_stats *stats)
void enic_fdir_info_get(struct enic *enic, struct rte_eth_fdir_info *info)
{
+ uint32_t i;
+
info->mode = (enum rte_fdir_mode)enic->fdir.modes;
- info->flow_types_mask[0] = enic->fdir.types_mask;
+ info->flow_types_mask[0] = (uint64_t)enic->fdir.types_mask;
+ for (i = 1; i < RTE_FLOW_MASK_ARRAY_SIZE; i++)
+ info->flow_types_mask[i] = 0ULL;
}
void enic_fdir_info(struct enic *enic)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9f..78744c2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7984,14 +7984,17 @@ i40e_get_hash_filter_global_config(struct i40e_hw *hw,
(reg & I40E_GLQF_CTL_HTOEP_MASK) ? "Toeplitz" : "Simple XOR");
/*
- * We work only with lowest 32 bits which is not correct, but to work
- * properly the valid_bit_mask size should be increased up to 64 bits
- * and this will brake ABI. This modification will be done in next
- * release
+ * As i40e supports less than 64 flow types, only first 64 bits need to
+ * be checked.
*/
- g_cfg->valid_bit_mask[0] = (uint32_t)adapter->flow_types_mask;
+ for (i = 1; i < RTE_SYM_HASH_MASK_ARRAY_SIZE; i++) {
+ g_cfg->valid_bit_mask[i] = 0ULL;
+ g_cfg->sym_hash_enable_mask[i] = 0ULL;
+ }
- for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < UINT32_BIT; i++) {
+ g_cfg->valid_bit_mask[0] = adapter->flow_types_mask;
+
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < UINT64_BIT; i++) {
if (!adapter->pctypes_tbl[i])
continue;
for (j = I40E_FILTER_PCTYPE_INVALID + 1;
@@ -8000,7 +8003,7 @@ i40e_get_hash_filter_global_config(struct i40e_hw *hw,
reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(j));
if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK) {
g_cfg->sym_hash_enable_mask[0] |=
- (1UL << i);
+ (1ULL << i);
}
}
}
@@ -8014,7 +8017,7 @@ i40e_hash_global_config_check(const struct i40e_adapter *adapter,
const struct rte_eth_hash_global_conf *g_cfg)
{
uint32_t i;
- uint32_t mask0, i40e_mask = adapter->flow_types_mask;
+ uint64_t mask0, i40e_mask = adapter->flow_types_mask;
if (g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&
g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
@@ -8025,7 +8028,7 @@ i40e_hash_global_config_check(const struct i40e_adapter *adapter,
}
/*
- * As i40e supports less than 32 flow types, only first 32 bits need to
+ * As i40e supports less than 64 flow types, only first 64 bits need to
* be checked.
*/
mask0 = g_cfg->valid_bit_mask[0];
@@ -8061,23 +8064,20 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,
int ret;
uint16_t i, j;
uint32_t reg;
- /*
- * We work only with lowest 32 bits which is not correct, but to work
- * properly the valid_bit_mask size should be increased up to 64 bits
- * and this will brake ABI. This modification will be done in next
- * release
- */
- uint32_t mask0 = g_cfg->valid_bit_mask[0] &
- (uint32_t)adapter->flow_types_mask;
+ uint64_t mask0 = g_cfg->valid_bit_mask[0] & adapter->flow_types_mask;
/* Check the input parameters */
ret = i40e_hash_global_config_check(adapter, g_cfg);
if (ret < 0)
return ret;
- for (i = RTE_ETH_FLOW_UNKNOWN + 1; mask0 && i < UINT32_BIT; i++) {
+ /*
+ * As i40e supports less than 64 flow types, only first 64 bits need to
+ * be configured.
+ */
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; mask0 && i < UINT64_BIT; i++) {
if (mask0 & (1UL << i)) {
- reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
+ reg = (g_cfg->sym_hash_enable_mask[0] & (1ULL << i)) ?
I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
for (j = I40E_FILTER_PCTYPE_INVALID + 1;
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 3d7170d..fbc46ee 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -95,17 +95,17 @@
#define I40E_COUNTER_INDEX_FDIR(pf_id) (0 + (pf_id) * I40E_COUNTER_PF)
#define I40E_FDIR_FLOWS ( \
- (1 << RTE_ETH_FLOW_FRAG_IPV4) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_UDP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_TCP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) | \
- (1 << RTE_ETH_FLOW_FRAG_IPV6) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
- (1 << RTE_ETH_FLOW_L2_PAYLOAD))
+ (1ULL << RTE_ETH_FLOW_FRAG_IPV4) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) | \
+ (1ULL << RTE_ETH_FLOW_FRAG_IPV6) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
+ (1ULL << RTE_ETH_FLOW_L2_PAYLOAD))
static int i40e_fdir_filter_programming(struct i40e_pf *pf,
enum i40e_filter_pctype pctype,
@@ -2020,6 +2020,7 @@ i40e_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir)
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint16_t num_flex_set = 0;
uint16_t num_flex_mask = 0;
+ uint16_t i;
if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
fdir->mode = RTE_FDIR_MODE_PERFECT;
@@ -2032,6 +2033,8 @@ i40e_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir)
(uint32_t)hw->func_caps.fd_filters_best_effort;
fdir->max_flexpayload = I40E_FDIR_MAX_FLEX_LEN;
fdir->flow_types_mask[0] = I40E_FDIR_FLOWS;
+ for (i = 1; i < RTE_FLOW_MASK_ARRAY_SIZE; i++)
+ fdir->flow_types_mask[i] = 0ULL;
fdir->flex_payload_unit = sizeof(uint16_t);
fdir->flex_bitmask_unit = sizeof(uint16_t);
fdir->max_flex_payload_segment_num = I40E_MAX_FLXPLD_FIED;
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 9281dc1..6870a57 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -70,14 +70,14 @@
#define IXGBE_FDIRCMD_CMD_INTERVAL_US 10
#define IXGBE_FDIR_FLOW_TYPES ( \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_UDP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_TCP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
- (1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER))
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
+ (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER))
#define IPV6_ADDR_TO_MASK(ipaddr, ipv6m) do { \
uint8_t ipv6_addr[16]; \
@@ -1435,7 +1435,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
- uint32_t fdirctrl, max_num;
+ uint32_t fdirctrl, max_num, i;
uint8_t offset;
fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
@@ -1467,9 +1467,11 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN ||
fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
- fdir_info->flow_types_mask[0] = 0;
+ fdir_info->flow_types_mask[0] = 0ULL;
else
fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+ for (i = 1; i < RTE_FLOW_MASK_ARRAY_SIZE; i++)
+ fdir_info->flow_types_mask[i] = 0ULL;
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f32dfdd..84927ff 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2987,6 +2987,7 @@ priv_fdir_filter_flush(struct priv *priv)
static void
priv_fdir_info_get(struct priv *priv, struct rte_eth_fdir_info *fdir_info)
{
+ uint32_t i;
struct rte_eth_fdir_masks *mask =
&priv->dev->data->dev_conf.fdir_conf.mask;
@@ -2994,7 +2995,8 @@ priv_fdir_info_get(struct priv *priv, struct rte_eth_fdir_info *fdir_info)
fdir_info->guarant_spc = 0;
rte_memcpy(&fdir_info->mask, mask, sizeof(fdir_info->mask));
fdir_info->max_flexpayload = 0;
- fdir_info->flow_types_mask[0] = 0;
+ for (i = 0; i < RTE_FLOW_MASK_ARRAY_SIZE; i++)
+ info->flow_types_mask[i] = 0ULL;
fdir_info->flex_payload_unit = 0;
fdir_info->max_flex_payload_segment_num = 0;
fdir_info->flex_payload_limit = 0;
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 8386904..4f24a93 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -691,9 +691,9 @@ enum rte_fdir_mode {
RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
};
-#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
+#define UINT64_BIT (CHAR_BIT * sizeof(uint64_t))
#define RTE_FLOW_MASK_ARRAY_SIZE \
- (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
+ (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
/**
* A structure used to get the information of flow director filter.
@@ -710,7 +710,7 @@ struct rte_eth_fdir_info {
uint32_t guarant_spc; /**< Guaranteed spaces.*/
uint32_t best_spc; /**< Best effort spaces.*/
/** Bit mask for every supported flow type. */
- uint32_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
+ uint64_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
uint32_t max_flexpayload; /**< Total flex payload in bytes. */
/** Flexible payload unit in bytes. Size and alignments of all flex
payload segments should be multiplies of this value. */
@@ -803,7 +803,7 @@ enum rte_eth_hash_function {
};
#define RTE_SYM_HASH_MASK_ARRAY_SIZE \
- (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
+ (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
/**
* A structure used to set or get global hash function configurations which
* include symmetric hash enable per flow type and hash function type.
@@ -816,9 +816,9 @@ enum rte_eth_hash_function {
struct rte_eth_hash_global_conf {
enum rte_eth_hash_function hash_func; /**< Hash function type */
/** Bit mask for symmetric hash enable per flow type */
- uint32_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
+ uint64_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
/** Bit mask indicates if the corresponding bit is valid */
- uint32_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
+ uint64_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
};
/**
--
2.5.5
^ permalink raw reply [relevance 6%]
* [dpdk-dev] 17.08.1 patches review and test
@ 2017-11-27 12:21 2% Yuanhan Liu
2017-11-30 19:09 0% ` Patil, Harish
0 siblings, 1 reply; 200+ results
From: Yuanhan Liu @ 2017-11-27 12:21 UTC (permalink / raw)
To: dpdk stable; +Cc: dev, Xu, Qian Q
Hi all,
Here is a list of patches targeted for stable release 17.08.1. Please
help review and test. The planned date for the final release is 7th,
Dec. Before that, please shout if anyone has objections with these
patches being applied.
These patches are located at branch 17.08 of dpdk-stable repo:
http://dpdk.org/browse/dpdk-stable/
Thanks.
--yliu
---
Aaron Conole (1):
net/enic: fix assignment
Ajit Khaparde (28):
net/bnxt: fix HWRM macros and locking
net/bnxt: use 64-bits of address for VLAN table
net/bnxt: fix an issue with group id calculation
net/bnxt: fix calculation of number of pools
net/bnxt: handle multi queue mode properly
net/bnxt: fix Rx handling and buffer allocation logic
net/bnxt: fix an issue with broadcast traffic
net/bnxt: fix usage of VMDq flags
net/bnxt: set checksum offload flags correctly
net/bnxt: update status of Rx IP/L4 CKSUM
net/bnxt: fix config RSS update
net/bnxt: set the hash key size
net/bnxt: fix per queue stats display in xstats
net/bnxt: fix interrupt handler
net/bnxt: fix number of MAC addresses for VMDq
net/bnxt: fix the association of a MACVLAN per VNIC
net/bnxt: fix Tx offload capability
net/bnxt: fix Rx offload capability
net/bnxt: handle Rx multi queue creation properly
net/bnxt: remove redundant code parsing pool map
net/bnxt: fix a bit shift operation
net/bnxt: fix a potential null pointer dereference
net/bnxt: fix a potential null pointer dereference
net/bnxt: fix a pointer deref before null check
net/bnxt: fix an unused value
net/bnxt: check VLANs from pool map only for VMDq
net/bnxt: do not set hash type unnecessarily
net/bnxt: fix VLAN spoof configuration
Akhil Goyal (2):
test/crypto: fix dpaa2 sec macros and definitions
net/dpaa2: set queues after reconfiguration
Alejandro Lucero (2):
net/nfp: fix RSS
net/nfp: fix Rx interrupt when multiqueue
Alok Makhariya (2):
crypto/dpaa2_sec: remove ICV memset on decryption side
crypto/dpaa2_sec: add check for segmented buffer
Anatoly Burakov (1):
vfio: fix secondary process initialization
Andrey Chilikin (1):
net/i40e: fix flexible payload configuration
Aviad Yehezkel (4):
examples/ipsec-secgw: fix crypto device mapping
examples/ipsec-secgw: fix session creation
examples/ipsec-secgw: fix AAD length setting
app/testpmd: fix build without ixgbe and bnxt PMDs
Beilei Xing (1):
net/i40e: fix VF device stop issue
Chas Williams (1):
net/vmxnet3: fix memory leak when releasing queues
Congwen Zhang (1):
net/cxgbe: fix memory leak
Daniel Mrzyglod (3):
net/virtio: fix untrusted scalar value
app/testpmd: fix DDP package filesize detection
net/bonding: fix default aggregator mode to stable
David Harton (2):
net/vmxnet3: fix MAC address set
net/i40e: fix i40evf MAC filter table
Ferruh Yigit (4):
ethdev: fix ABI version
ethdev: revert use port name from device structure
igb_uio: remove device reset in open
net/qede: fix icc build
Gaetan Rivet (1):
net/failsafe: fix errno set on command execution
Gowrishankar Muthukrishnan (1):
net/bonding: support bifurcated driver in eal
Guduri Prathyusha (2):
examples/l3fwd: fix NEON instructions
examples/l3fwd: fix aliasing in port grouping
Harish Patil (2):
net/qede: fix supported packet types
net/qede: fix to re-enable LRO during device start
Hemant Agrawal (3):
net/dpaa2: fix the Tx handling of non HW pool bufs
examples/l2fwd-crypto: fix uninitialized errno value
app/crypto-perf: fix uninitialized errno value
Ian Stokes (1):
cryptodev: fix build with -Ofast
Ivan Malov (2):
net/sfc: specify correct scale table size on Rx start
net/sfc: fix unused variable in RSS-agnostic build
Jacek Piasecki (1):
examples/vhost_scsi: fix product id string termination
Jasvinder Singh (1):
examples/qos_sched: fix uninitialized config
Jerin Jacob (1):
timer: use 64-bit specific code on more platforms
Jianbo Liu (1):
net/i40e: fix Rx packets number for NEON
Jiayu Hu (1):
gro: fix typo in map file
Jingjing Wu (4):
net/i40e: fix interrupt throttling setting in PF
net/i40e: fix memory leak if VF init fails
net/i40e: fix variable assignment
net/i40e: fix VF initialization error
John Daley (3):
net/enic: fix multi-process operation
net/enic: fix packet loss after MTU change
net/enic: fix TSO for packets greater than 9208 bytes
John Miller (1):
net/ark: fix loop counter
Kuba Kozak (2):
vfio: fix close unchecked file descriptor
vhost: check poll error code
Li Han (1):
app/testpmd: fix invalid port id parameters
Lukasz Majczak (1):
eal: fix auxv open check for ARM and PPC
Mark Spender (1):
net/sfc/base: fix default RSS context check on Siena
Matan Azrad (7):
net/failsafe: fix Tx sub device deactivating
net/mlx5: fix locking in xstats functions
net/failsafe: fix parameters parsing
net/mlx5: fix probe failure report
net/failsafe: fix adding MAC error report miss
app/testpmd: fix forward port ids setting
net/failsafe: fix Rx clean race
Maxime Coquelin (1):
vhost: fix dereferencing invalid pointer after realloc
Michal Jastrzebski (1):
net/vmxnet3: fix dereference before null check
Nikhil Rao (1):
eal/x86: fix atomic cmpset
Nirmoy Das (1):
kni: fix SLE version detection
Nélio Laranjeiro (4):
net/mlx5: fix clang build
net/mlx5: fix SSE Rx support verification
net/mlx5: fix clang compilation error
app/testpmd: fix RSS structure initialisation
Olivier Matz (12):
net: fix inner L2 length in packet type parser
net/bnxt: fix compilation with -Og
net/qede: fix compilation with -Og
app/test-crypto-perf: fix memory leak
app/test-crypto-perf: fix compilation with -Og
net/virtio: revert not claiming LRO support
net/virtio: revert not claiming IP checksum offload
net/virtio: fix log levels in configure
net/virtio: fix mbuf port for simple Rx function
net/virtio: fix queue setup consistency
net/virtio: fix compilation with -Og
lpm6: fix compilation with -Og
Ophir Munk (3):
net/tap: fix flow and port commands
net/failsafe: fix VLAN stripping configuration
app/testpmd: fix forwarding between non consecutive ports
Pablo de Lara (8):
hash: fix eviction counter
crypto/aesni_gcm: fix zero data operation
app/crypto-perf: fix packet length check
app/crypto-perf: parse AEAD data from vectors
crypto/openssl: fix AEAD parameters
examples/l2fwd-crypto: fix physical address setting
crypto/qat: fix HMAC supported digest sizes
app/testpmd: fix topology error message
Patrick MacArthur (1):
eal: copy raw strings taken from command line
Phil Yang (1):
app/testpmd: fix quitting in container
Qi Zhang (4):
net/i40e: fix flow control watermark mismatch
net/i40e: fix packet count for PF
net/i40e: fix mbuf free in vector Tx
net/i40e: fix mirror with firmware 6.0
Rami Rosen (1):
net/kni: remove driver struct forward declaration
Rasesh Mody (4):
net/qede/base: fix to use a passed ptt handle
net/qede/base: fix return code to align with FW
net/qede: remove duplicate includes
net/qede/base: fix division by zero
Raslan Darawsheh (2):
net/failsafe: fix failsafe bus uninit return value
net/failsafe: fix PCI devices init
RongQiang Xie (2):
net/enic: fix possible null pointer dereference
net/qede: fix possible null pointer dereference
Sebastian Basierski (3):
net/vmxnet3: fix unintentional integer overflow
net/virtio-user: fix TAP name string termination
net/virtio: check error on setting non block flag
Sergio Gonzalez Monroy (1):
crypto/aesni_mb: fix invalid session error
Shahaf Shuler (5):
net/mlx5: fix num seg assumption in SSE Tx
net/mlx5: fix Tx stats error counter definition
net/mlx5: fix Tx stats error counter logic
net/mlx5: fix TSO segment size verification
net/mlx5: fix packet type flags for Ethernet only frame
Stefan Baranoff (1):
net/pcap: fix memory leak in dumper open
Stephen Hemminger (1):
eal: initialize logging before bus
Tiwei Bie (1):
net/virtio: flush Rx queues on start
Tomasz Duszynski (3):
drivers/crypto: use snprintf return value correctly
examples/ipsec-secgw: fix IP version check
examples/ipsec-secgw: fix IPv6 payload length
Tomasz Kulasek (3):
net/bonding: fix slaves capacity check
net/i40e: fix assignment of enum values
net/bonding: fix check slaves link properties
Vipin Varghese (1):
net/tap: fix unregistering callback with invalid fd
Wei Dai (8):
net/ixgbe: fix mapping of user priority to TC
net/ixgbe: fix adding a mirror rule
net/i40e: fix mirror rule reset when port is closed
net/ixgbe: fix Rx queue interrupt mapping in VF
net/ixgbe: fix VFIO interrupt mapping in VF
net/ixgbe: fix PF DCB info
app/testpmd: fix mapping of user priority to DCB TC
net/i40e: fix VFIO interrupt mapping in VF
Wei Zhao (4):
net/ixgbe: fix MAC VLAN filter fail problem
net/i40e: fix clear xstats bug in VF
app/testpmd: fix packet throughput after stats reset
net/ixgbe: fix filter parser for L2 tunnel
Wenzhuo Lu (7):
net/i40e: fix TM node parameter checking
net/i40e: fix TM level capability getting
net/ixgbe: fix TM node parameter checking
net/ixgbe: fix TM level capability getting
net/i40e: fix not supporting NULL TM profile
net/ixgbe: fix not supporting NULL TM profile
net/i40e: fix parent when adding TM node
Xiaoyun Li (2):
net/i40e: fix PF notify issue when VF is not up
net/igb: fix Rx interrupt with VFIO and MSI-X
Xueming Li (5):
net/mlx5: fix tunnel offload detection
mem: fix malloc debug config
mem: fix malloc element free in debug mode
examples/l2fwd_fork: fix message pool init
examples/multi_process: fix received message length
Yi Yang (1):
service: fix build with gcc 4.9
Yong Wang (4):
net/liquidio: fix uninitialized variable
net/igb: fix memcpy length
net/i40e: fix uninitialized variable
net/ixgbe: fix uninitialized variable
Yongseok Koh (3):
net/mlx5: fix calculating TSO inline size
net/mlx5: fix overflow of Rx SW ring
net/mlx5: fix tunneled TCP/UDP packet type
Zhiyong Yang (2):
test: fix assignment operation
net/virtio: fix Tx packet length stats
^ permalink raw reply [relevance 2%]
* [dpdk-dev] [RFC PATCH 0/6] mempool: add bucket mempool driver
@ 2017-11-24 16:06 4% Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2017-11-24 16:06 UTC (permalink / raw)
To: dev; +Cc: Olivier Matz
The patch series adds bucket mempool driver which allows to allocate
(both physically and virtually) contiguous blocks of objects and adds
mempool API to do it. It is still capable to provide separate objects,
but it is definitely more heavy-weight than ring/stack drivers.
The target usecase is dequeue in blocks and enqueue separate objects
back (which are collected in buckets to be dequeued). So, the memory
pool with bucket driver is created by an application and provided to
networking PMD receive queue. The choice of bucket driver is done using
rte_eth_dev_pool_ops_supported(). A PMD that relies upon contiguous
block allocation should report the bucket driver as the only supported
and preferred one.
The number of objects in the contiguous block is a function of bucket
memory size (.config option) and total element size.
As I understand it breaks ABI so it requires 3 acks in accordance with
policy, deprecation notice and mempool shared library version bump.
If there is a way to avoid ABI breakage, please, let us know.
In any case we would like to start from RFC discussion. Comments and
ideas are welcome.
The target DPDK release is 18.05.
Artem V. Andreev (6):
mempool: implement abstract mempool info API
mempool: implement clustered object allocation
mempool/bucket: implement bucket mempool manager
mempool: add a function to flush default cache
mempool: support block dequeue operation
mempool/bucket: implement block dequeue operation
MAINTAINERS | 9 +
config/common_base | 2 +
drivers/mempool/Makefile | 1 +
drivers/mempool/bucket/Makefile | 49 ++
drivers/mempool/bucket/rte_mempool_bucket.c | 559 +++++++++++++++++++++
.../mempool/bucket/rte_mempool_bucket_version.map | 4 +
lib/librte_mempool/rte_mempool.c | 41 +-
lib/librte_mempool/rte_mempool.h | 179 ++++++-
lib/librte_mempool/rte_mempool_ops.c | 16 +
mk/rte.app.mk | 1 +
test/test/test_mempool.c | 2 +-
11 files changed, 857 insertions(+), 6 deletions(-)
create mode 100644 drivers/mempool/bucket/Makefile
create mode 100644 drivers/mempool/bucket/rte_mempool_bucket.c
create mode 100644 drivers/mempool/bucket/rte_mempool_bucket_version.map
--
2.7.4
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API
2017-11-23 9:39 4% ` [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Adrien Mazarguil
@ 2017-11-23 10:07 0% ` Andrew Rybchenko
0 siblings, 0 replies; 200+ results
From: Andrew Rybchenko @ 2017-11-23 10:07 UTC (permalink / raw)
To: Adrien Mazarguil; +Cc: dev, Jingjing Wu
Hi Adrien,
On 11/23/2017 12:39 PM, Adrien Mazarguil wrote:
> Hi Andrew,
>
> On Mon, Nov 20, 2017 at 08:21:59AM +0000, Andrew Rybchenko wrote:
>> enum rte_flow_item_type states that items matching protocol headers
>> must be stacked in the same order as the protocol layers to match.
>> As the result the patch changes ABI since Geneve is added just after
>> VXLAN (the closest protocol).
>>
>> In fact as far as I can see many items do not follow the requirement
>> already. May be the comment/requirement should be removed and GENEVE
>> should be added at the end of the list. If so, should be keep it just
>> after VXLAN in all other places or move after ESP as well?
> Perhaps documentation is unclear, this requirement only applies to
> applications when constructing patterns out of those items (e.g. to make
> sense, TCP is supposed to come after IPv4, not before).
>
> New item/action definitions must obviously be added at the end of both lists
> to avoid ABI breakage, there is no specific order to follow other than that.
>
> What may have confused you is most of them are apparently ordered by
> protocol layer, that's because those are here from day one; it's not the
> case anymore starting with E_TAG, which was added much later.
>
> Besides addressing the ABI breakage, I don't see any issue with adding
> GENEVE to rte_flow, I only have a few more comments on subsequent patches in
> the series. Otherwise good job, looks like you didn't miss anything.
Many thinks for review and clarification. We'll process review notes and
send v2.
--
Andrew
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: support GENEVE pattern item in flow rules
@ 2017-11-23 9:40 3% ` Adrien Mazarguil
0 siblings, 0 replies; 200+ results
From: Adrien Mazarguil @ 2017-11-23 9:40 UTC (permalink / raw)
To: Andrew Rybchenko; +Cc: dev, Jingjing Wu, Roman Zhukov
On Mon, Nov 20, 2017 at 08:22:01AM +0000, Andrew Rybchenko wrote:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>
> Add the ability to match a VNI field of GENEVE protocol header.
>
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Same comments as previously basically, keep the same order as rte_flow.h
after fixing the ABI breakage.
One minor comment below.
> ---
> app/test-pmd/cmdline_flow.c | 31 +++++++++++++++++++++++++++++
> app/test-pmd/config.c | 1 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++++
> 3 files changed, 37 insertions(+)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index df16d2a..cee99f3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -161,6 +161,9 @@ enum index {
> ITEM_SCTP_CKSUM,
> ITEM_VXLAN,
> ITEM_VXLAN_VNI,
> + ITEM_GENEVE,
> + ITEM_GENEVE_VNI,
> + ITEM_GENEVE_PROTO,
> ITEM_E_TAG,
> ITEM_E_TAG_GRP_ECID_B,
> ITEM_NVGRE,
> @@ -452,6 +455,7 @@ static const enum index next_item[] = {
> ITEM_TCP,
> ITEM_SCTP,
> ITEM_VXLAN,
> + ITEM_GENEVE,
> ITEM_E_TAG,
> ITEM_NVGRE,
> ITEM_MPLS,
> @@ -573,6 +577,13 @@ static const enum index item_vxlan[] = {
> ZERO,
> };
>
> +static const enum index item_geneve[] = {
> + ITEM_GENEVE_VNI,
> + ITEM_GENEVE_PROTO,
> + ITEM_NEXT,
> + ZERO,
> +};
> +
> static const enum index item_e_tag[] = {
> ITEM_E_TAG_GRP_ECID_B,
> ITEM_NEXT,
> @@ -1371,6 +1382,26 @@ static const struct token token_list[] = {
> .next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
> .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
> },
> + [ITEM_GENEVE] = {
> + .name = "geneve",
> + .help = "match GENEVE header",
> + .priv = PRIV_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
> + .next = NEXT(item_geneve),
> + .call = parse_vc,
> + },
> + [ITEM_GENEVE_VNI] = {
> + .name = "vni",
> + .help = "Virtual Network Identifier",
How about "virtual network identifier" (all lower caps)?
> + .next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, vni)),
> + },
> + [ITEM_GENEVE_PROTO] = {
> + .name = "protocol",
> + .help = "GENEVE protocol type",
> + .next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve,
> + protocol)),
> + },
> [ITEM_E_TAG] = {
> .name = "e_tag",
> .help = "match E-Tag header",
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index cd2ac11..4eda37f 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -965,6 +965,7 @@ static const struct {
> MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
> MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
> MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
> + MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
> MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
> MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
> MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 9789139..8c2fd12 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3083,6 +3083,11 @@ This section lists supported pattern items and their attributes, if any.
>
> - ``vni {unsigned}``: VXLAN identifier.
>
> +- ``geneve``: match GENEVE header.
> +
> + - ``vni {unsigned}``: virtual network identifier.
> + - ``protocol {unsigned}``: protocol type.
> +
> - ``e_tag``: match IEEE 802.1BR E-Tag header.
>
> - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
> --
> 2.7.4
>
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH 1/2] ethdev: add GENEVE flow pattern item
@ 2017-11-23 9:39 3% ` Adrien Mazarguil
0 siblings, 0 replies; 200+ results
From: Adrien Mazarguil @ 2017-11-23 9:39 UTC (permalink / raw)
To: Andrew Rybchenko; +Cc: dev, Jingjing Wu, Roman Zhukov
On Mon, Nov 20, 2017 at 08:22:00AM +0000, Andrew Rybchenko wrote:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>
> Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
> This commit also adds default mask for these item.
>
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
OK, the main issue in this patch is you're inserting GENEVE in the middle of
everything (enums, documentation, etc). Just append it to the enum to avoid
ABI breakage as described in my previous message and use the same position
everywhere else for consistency.
It must appear after RTE_FLOW_ITEM_TYPE_ESP.
More comments below.
> ---
> doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
> lib/librte_ether/rte_flow.c | 1 +
> lib/librte_ether/rte_flow.h | 31 +++++++++++++++++++++++++++++++
> 3 files changed, 44 insertions(+)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index d158be5..2f96623 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -863,6 +863,18 @@ Matches a VXLAN header (RFC 7348).
> - ``rsvd1``: reserved, normally 0x00.
> - Default ``mask`` matches VNI only.
>
> +Item: ``GENEVE``
> +^^^^^^^^^^^^^^^
> +
> +Matches a GENEVE header.
> +
> +- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b),
> + OAM packet (1b), critical options present (1b), reserved 0 (6b).
> +- ``protocol``: protocol type.
> +- ``vni``: virtual network identifier.
> +- ``rsvd1``: reserved, normally 0x00.
> +- Default ``mask`` matches protocol type and VNI.
> +
I'm not sure about the default mask. It should be the least common
denominator, not necessarily what the first implementation supports. How
about making it like VXLAN, i.e. VNI only? Does that make sense at all?
> Item: ``E_TAG``
> ^^^^^^^^^^^^^^^
>
> diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
> index 6659063..bf1b253 100644
> --- a/lib/librte_ether/rte_flow.c
> +++ b/lib/librte_ether/rte_flow.c
> @@ -77,6 +77,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
> MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
> MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
> MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
> + MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
You should add it at the end but some items are already missing from that
list. Since I plan to send an overhaul for this function, you can leave this
change out for the time being.
> MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
> MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
> MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
> diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
> index 47c88ea..29d81d4 100644
> --- a/lib/librte_ether/rte_flow.h
> +++ b/lib/librte_ether/rte_flow.h
> @@ -272,6 +272,13 @@ enum rte_flow_item_type {
> RTE_FLOW_ITEM_TYPE_VXLAN,
>
> /**
> + * Matches a GENEVE header.
> + *
> + * See struct rte_flow_item_geneve.
> + */
> + RTE_FLOW_ITEM_TYPE_GENEVE,
> +
> + /**
> * Matches a E_TAG header.
> *
> * See struct rte_flow_item_e_tag.
> @@ -651,6 +658,30 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
> #endif
>
> /**
> + * RTE_FLOW_ITEM_TYPE_GENEVE.
> + *
> + * Matches a GENEVE header.
> + */
> +struct rte_flow_item_geneve {
> + /**
> + * Version (2b), length of the options fields (6b), OAM packet (1b),
> + * critical options present (1b), reserved 0 (6b).
> + */
> + rte_be16_t ver_opt_len_o_c_rsvd0;
> + rte_be16_t protocol; /**< Protocol type. */
> + uint8_t vni[3]; /**< Virtual Network Identifier. */
> + uint8_t rsvd1; /**< Reserved, normally 0x00. */
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
> + .protocol = RTE_BE16(0xffff),
> + .vni = "\xff\xff\xff",
> +};
> +#endif
So how about removing .protocol from the default mask?
> +
> +/**
> * RTE_FLOW_ITEM_TYPE_E_TAG.
> *
> * Matches a E-tag header.
> --
> 2.7.4
>
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API
2017-11-20 8:21 3% [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Andrew Rybchenko
@ 2017-11-23 9:39 4% ` Adrien Mazarguil
2017-11-23 10:07 0% ` Andrew Rybchenko
2017-12-01 10:43 3% ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
3 siblings, 1 reply; 200+ results
From: Adrien Mazarguil @ 2017-11-23 9:39 UTC (permalink / raw)
To: Andrew Rybchenko; +Cc: dev, Jingjing Wu
Hi Andrew,
On Mon, Nov 20, 2017 at 08:21:59AM +0000, Andrew Rybchenko wrote:
> enum rte_flow_item_type states that items matching protocol headers
> must be stacked in the same order as the protocol layers to match.
> As the result the patch changes ABI since Geneve is added just after
> VXLAN (the closest protocol).
>
> In fact as far as I can see many items do not follow the requirement
> already. May be the comment/requirement should be removed and GENEVE
> should be added at the end of the list. If so, should be keep it just
> after VXLAN in all other places or move after ESP as well?
Perhaps documentation is unclear, this requirement only applies to
applications when constructing patterns out of those items (e.g. to make
sense, TCP is supposed to come after IPv4, not before).
New item/action definitions must obviously be added at the end of both lists
to avoid ABI breakage, there is no specific order to follow other than that.
What may have confused you is most of them are apparently ordered by
protocol layer, that's because those are here from day one; it's not the
case anymore starting with E_TAG, which was added much later.
Besides addressing the ABI breakage, I don't see any issue with adding
GENEVE to rte_flow, I only have a few more comments on subsequent patches in
the series. Otherwise good job, looks like you didn't miss anything.
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v2] doc: add template release notes for 18.02
2017-11-17 22:41 6% [dpdk-dev] [PATCH v1] doc: add template release notes for 18.02 John McNamara
@ 2017-11-22 17:38 6% ` John McNamara
0 siblings, 0 replies; 200+ results
From: John McNamara @ 2017-11-22 17:38 UTC (permalink / raw)
To: dev; +Cc: John McNamara
Add template release notes for DPDK 18.02 with inline
comments and explanations of the various sections.
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
V2: Added "Removed Items" and removed "Resolved Issues".
doc/guides/rel_notes/release_18_02.rst | 186 +++++++++++++++++++++++++++++++++
1 file changed, 186 insertions(+)
create mode 100644 doc/guides/rel_notes/release_18_02.rst
diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst
new file mode 100644
index 0000000..24b67bb
--- /dev/null
+++ b/doc/guides/rel_notes/release_18_02.rst
@@ -0,0 +1,186 @@
+DPDK Release 18.02
+==================
+
+.. **Read this first.**
+
+ The text in the sections below explains how to update the release notes.
+
+ Use proper spelling, capitalization and punctuation in all sections.
+
+ Variable and config names should be quoted as fixed width text:
+ ``LIKE_THIS``.
+
+ Build the docs and view the output file to ensure the changes are correct::
+
+ make doc-guides-html
+
+ xdg-open build/doc/html/guides/rel_notes/release_18_02.html
+
+
+New Features
+------------
+
+.. This section should contain new features added in this release. Sample
+ format:
+
+ * **Add a title in the past tense with a full stop.**
+
+ Add a short 1-2 sentence description in the past tense. The description
+ should be enough to allow someone scanning the release notes to
+ understand the new feature.
+
+ If the feature adds a lot of sub-features you can use a bullet list like
+ this:
+
+ * Added feature foo to do something.
+ * Enhanced feature bar to do something else.
+
+ Refer to the previous release notes for examples.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+API Changes
+-----------
+
+.. This section should contain API changes. Sample format:
+
+ * Add a short 1-2 sentence description of the API change. Use fixed width
+ quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past
+ tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+ABI Changes
+-----------
+
+.. This section should contain ABI changes. Sample format:
+
+ * Add a short 1-2 sentence description of the ABI change that was announced
+ in the previous releases and made in this release. Use fixed width quotes
+ for ``rte_function_names`` or ``rte_struct_names``. Use the past tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+Removed Items
+-------------
+
+.. This section should contain removed items in this release. Sample format:
+
+ * Add a short 1-2 sentence description of the removed item in the past
+ tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+Known Issues
+------------
+
+.. This section should contain new known issues in this release. Sample format:
+
+ * **Add title in present tense with full stop.**
+
+ Add a short 1-2 sentence description of the known issue in the present
+ tense. Add information on any known workarounds.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+Shared Library Versions
+-----------------------
+
+.. Update any library version updated in this release and prepend with a ``+``
+ sign, like this:
+
+ librte_acl.so.2
+ + librte_cfgfile.so.2
+ librte_cmdline.so.2
+
+ This section is a comment. do not overwrite or remove it.
+ =========================================================
+
+
+The libraries prepended with a plus sign were incremented in this version.
+
+.. code-block:: diff
+
+ librte_acl.so.2
+ librte_bitratestats.so.2
+ librte_bus_dpaa.so.1
+ librte_bus_fslmc.so.1
+ librte_bus_pci.so.1
+ librte_bus_vdev.so.1
+ librte_cfgfile.so.2
+ librte_cmdline.so.2
+ librte_cryptodev.so.4
+ librte_distributor.so.1
+ librte_eal.so.6
+ librte_ethdev.so.8
+ librte_eventdev.so.3
+ librte_flow_classify.so.1
+ librte_gro.so.1
+ librte_gso.so.1
+ librte_hash.so.2
+ librte_ip_frag.so.1
+ librte_jobstats.so.1
+ librte_kni.so.2
+ librte_kvargs.so.1
+ librte_latencystats.so.1
+ librte_lpm.so.2
+ librte_mbuf.so.3
+ librte_mempool.so.3
+ librte_meter.so.1
+ librte_metrics.so.1
+ librte_net.so.1
+ librte_pci.so.1
+ librte_pdump.so.2
+ librte_pipeline.so.3
+ librte_pmd_bnxt.so.2
+ librte_pmd_bond.so.2
+ librte_pmd_i40e.so.2
+ librte_pmd_ixgbe.so.2
+ librte_pmd_ring.so.2
+ librte_pmd_softnic.so.1
+ librte_pmd_vhost.so.2
+ librte_port.so.3
+ librte_power.so.1
+ librte_reorder.so.1
+ librte_ring.so.1
+ librte_sched.so.1
+ librte_security.so.1
+ librte_table.so.3
+ librte_timer.so.1
+ librte_vhost.so.3
+
+
+
+Tested Platforms
+----------------
+
+.. This section should contain a list of platforms that were tested with this
+ release.
+
+ The format is:
+
+ * <vendor> platform with <vendor> <type of devices> combinations
+
+ * List of CPU
+ * List of OS
+ * List of devices
+ * Other relevant details...
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
--
2.7.5
^ permalink raw reply [relevance 6%]
* Re: [dpdk-dev] [PATCH 2/3] crypto: fix pedentic compilation errors
2017-11-22 14:31 0% ` Gaëtan Rivet
@ 2017-11-22 16:50 0% ` De Lara Guarch, Pablo
0 siblings, 0 replies; 200+ results
From: De Lara Guarch, Pablo @ 2017-11-22 16:50 UTC (permalink / raw)
To: Gaëtan Rivet, Neil Horman
Cc: Nelio Laranjeiro, Akhil Goyal, Doherty, Declan, dev, stable
> -----Original Message-----
> From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com]
> Sent: Wednesday, November 22, 2017 2:32 PM
> To: Neil Horman <nhorman@tuxdriver.com>
> Cc: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>; Akhil Goyal
> <akhil.goyal@nxp.com>; Doherty, Declan <declan.doherty@intel.com>;
> dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/3] crypto: fix pedentic compilation errors
>
> On Wed, Nov 22, 2017 at 08:56:14AM -0500, Neil Horman wrote:
> > On Wed, Nov 22, 2017 at 09:10:17AM +0100, Nelio Laranjeiro wrote:
> > > /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_crypto.h:126:28:
> error: ISO C forbids zero-size array ‘sym’ [-Werror=pedantic]
> > > struct rte_crypto_sym_op sym[0];
> > > ^~~
> > >
> > > Fixes: d2a4223c4c6d ("cryptodev: do not store pointer to op specific
> > > params")
> > > Cc: pablo.de.lara.guarch@intel.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > > ---
> > > lib/librte_cryptodev/rte_crypto.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/lib/librte_cryptodev/rte_crypto.h
> > > b/lib/librte_cryptodev/rte_crypto.h
> > > index 3d672fe7d..dc6e91d1d 100644
> > > --- a/lib/librte_cryptodev/rte_crypto.h
> > > +++ b/lib/librte_cryptodev/rte_crypto.h
> > > @@ -123,7 +123,7 @@ struct rte_crypto_op {
> > >
> > > RTE_STD_C11
> > > union {
> > > - struct rte_crypto_sym_op sym[0];
> > > + struct rte_crypto_sym_op *sym;
> > > /**< Symmetric operation parameters */
> > > }; /**< operation specific parameters */ };
> > > --
> > > 2.11.0
> > >
> > >
> > As Laura notes, this isn't the right solution. In addition to adding a 64 bit
> > pointer, it I think also results in incorrect semantics. That is to say, the
> > allocation path for this structure allocates the rte_crypto_op and
> additional
> > memory for the sym array contiguously, which the sym[0] syntax
> correctly
> > interprets to mean the storage for the array is inline with the structure.
> > Changing to a pointer means you are using the first elements of the array
> > storage as your pointer, which could be filled with any old value, leading
> to
> > corruption.
> >
> > If you can't use zero length array semantics (which I assume you cant, as I
> > don't think clang supports that), a better soution might be to remove the
> sym
> > variable entirely, and replace it with a macro that access the sym array as
> an
> > offset from the start of the pointer. That would seem to be an ABI
> change, but
> > if you went through that process you would wind up with the same sized
> struct,
> > which would be nice
> >
> > Neil
> >
>
> ISO C forbids zero-size arrays, but ISO C99 allows flexible arrays.
> Why is this symbole within a union? Why not remove the union, change
> sym[0] to sym[]?
It is a union because there were going to be other types of crypto operations (might still happen in the future).
For instance:
union{
struct rte_crypto_sym_op sym[0];
struct rte_crypto_asym_op asym[0];
}
Thanks,
Pablo
>
> --
> Gaëtan Rivet
> 6WIND
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH 2/3] crypto: fix pedentic compilation errors
2017-11-22 13:56 3% ` Neil Horman
@ 2017-11-22 14:31 0% ` Gaëtan Rivet
2017-11-22 16:50 0% ` De Lara Guarch, Pablo
0 siblings, 1 reply; 200+ results
From: Gaëtan Rivet @ 2017-11-22 14:31 UTC (permalink / raw)
To: Neil Horman
Cc: Nelio Laranjeiro, Akhil Goyal, Declan Doherty, dev,
pablo.de.lara.guarch, stable
On Wed, Nov 22, 2017 at 08:56:14AM -0500, Neil Horman wrote:
> On Wed, Nov 22, 2017 at 09:10:17AM +0100, Nelio Laranjeiro wrote:
> > /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_crypto.h:126:28: error: ISO C forbids zero-size array ‘sym’ [-Werror=pedantic]
> > struct rte_crypto_sym_op sym[0];
> > ^~~
> >
> > Fixes: d2a4223c4c6d ("cryptodev: do not store pointer to op specific params")
> > Cc: pablo.de.lara.guarch@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > ---
> > lib/librte_cryptodev/rte_crypto.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h
> > index 3d672fe7d..dc6e91d1d 100644
> > --- a/lib/librte_cryptodev/rte_crypto.h
> > +++ b/lib/librte_cryptodev/rte_crypto.h
> > @@ -123,7 +123,7 @@ struct rte_crypto_op {
> >
> > RTE_STD_C11
> > union {
> > - struct rte_crypto_sym_op sym[0];
> > + struct rte_crypto_sym_op *sym;
> > /**< Symmetric operation parameters */
> > }; /**< operation specific parameters */
> > };
> > --
> > 2.11.0
> >
> >
> As Laura notes, this isn't the right solution. In addition to adding a 64 bit
> pointer, it I think also results in incorrect semantics. That is to say, the
> allocation path for this structure allocates the rte_crypto_op and additional
> memory for the sym array contiguously, which the sym[0] syntax correctly
> interprets to mean the storage for the array is inline with the structure.
> Changing to a pointer means you are using the first elements of the array
> storage as your pointer, which could be filled with any old value, leading to
> corruption.
>
> If you can't use zero length array semantics (which I assume you cant, as I
> don't think clang supports that), a better soution might be to remove the sym
> variable entirely, and replace it with a macro that access the sym array as an
> offset from the start of the pointer. That would seem to be an ABI change, but
> if you went through that process you would wind up with the same sized struct,
> which would be nice
>
> Neil
>
ISO C forbids zero-size arrays, but ISO C99 allows flexible arrays.
Why is this symbole within a union? Why not remove the union, change
sym[0] to sym[]?
--
Gaëtan Rivet
6WIND
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v2 1/2] lib/security: add support for get metadata
2017-11-22 13:27 3% ` Neil Horman
@ 2017-11-22 14:13 0% ` Anoob
2017-11-27 13:55 0% ` Neil Horman
0 siblings, 1 reply; 200+ results
From: Anoob @ 2017-11-22 14:13 UTC (permalink / raw)
To: Neil Horman
Cc: Akhil Goyal, Declan Doherty, Radu Nicolau,
Sergio Gonzalez Monroy, Jerin Jacob, Narayana Prasad, dev
Hi,
Please see inline.
On 11/22/2017 06:57 PM, Neil Horman wrote:
> On Wed, Nov 22, 2017 at 06:55:15AM +0000, Anoob Joseph wrote:
>> In case of inline protocol processed ingress traffic, the packet may not
>> have enough information to determine the security parameters with which
>> the packet was processed. For such cases, application could register a
>> 64 bit metadata in security session, which could be retrieved from the
>> packet using "rte_security_get_pkt_metadata" API. Application can use
>> this metadata to identify the parameters it need.
>>
>> Application can choose what it should register as the metadata. It can
>> register SPI or a pointer to SA.
>>
>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
>> ---
>> v2:
>> * Replaced get_session and get_cookie APIs with get_pkt_metadata API
>>
>> lib/librte_security/rte_security.c | 13 +++++++++++++
>> lib/librte_security/rte_security.h | 19 +++++++++++++++++++
>> lib/librte_security/rte_security_driver.h | 16 ++++++++++++++++
>> 3 files changed, 48 insertions(+)
>>
>> diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
>> index 1227fca..804f11f 100644
>> --- a/lib/librte_security/rte_security.c
>> +++ b/lib/librte_security/rte_security.c
>> @@ -108,6 +108,19 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
>> sess, m, params);
>> }
>>
>> +uint64_t
>> +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
>> + struct rte_mbuf *pkt)
>> +{
>> + uint64_t mdata = 0;
>> +
>> + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_pkt_metadata, 0);
>> + if (instance->ops->get_pkt_metadata(instance->device, pkt, &mdata))
>> + return 0;
>> +
>> + return mdata;
>> +}
>> +
>> const struct rte_security_capability *
>> rte_security_capabilities_get(struct rte_security_ctx *instance)
>> {
>> diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
>> index 653929b..aa3a471 100644
>> --- a/lib/librte_security/rte_security.h
>> +++ b/lib/librte_security/rte_security.h
>> @@ -274,6 +274,8 @@ struct rte_security_session_conf {
>> /**< Configuration parameters for security session */
>> struct rte_crypto_sym_xform *crypto_xform;
>> /**< Security Session Crypto Transformations */
>> + uint64_t metadata;
>> + /**< Metadata registered by application */
> This is going to break ABI. You need to announce the change so that application
> providers can be prepared for it.
The security library is under experimental tag. So is the announcement
required?
>
>> };
>>
>> struct rte_security_session {
>> @@ -346,6 +348,23 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
>> struct rte_mbuf *mb, void *params);
>>
>> /**
>> + * Get metadata from the packet. This is an application registered 64 bit
>> + * value, associated with the security session which processed the packet.
>> + *
>> + * This is valid only for inline processed ingress packets.
>> + *
>> + * @param instance security instance
>> + * @param pkt packet mbuf
>> + *
>> + * @return
>> + * - On success, metadata
>> + * - On failure, 0
>> + */
>> +uint64_t
>> +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
>> + struct rte_mbuf *pkt);
>> +
>> +/**
>> * Attach a session to a symmetric crypto operation
>> *
>> * @param sym_op crypto operation
>> diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
>> index 997fbe7..da0ebf4 100644
>> --- a/lib/librte_security/rte_security_driver.h
>> +++ b/lib/librte_security/rte_security_driver.h
>> @@ -122,6 +122,20 @@ typedef int (*security_set_pkt_metadata_t)(void *device,
>> void *params);
>>
>> /**
>> + * Get application interpretable metadata from the packet.
>> + *
>> + * @param device Crypto/eth device pointer
>> + * @param pkt Packet mbuf
>> + * @param mt Pointer to receive metadata
>> + *
>> + * @return
>> + * - Returns 0 if metadata is retrieved successfully.
>> + * - Returns -ve value for errors.
>> + */
>> +typedef int (*security_get_pkt_metadata_t)(void *device,
>> + struct rte_mbuf *pkt, uint64_t *mt);
>> +
>> +/**
>> * Get security capabilities of the device.
>> *
>> * @param device crypto/eth device pointer
>> @@ -145,6 +159,8 @@ struct rte_security_ops {
>> /**< Clear a security sessions private data. */
>> security_set_pkt_metadata_t set_pkt_metadata;
>> /**< Update mbuf metadata. */
>> + security_get_pkt_metadata_t get_pkt_metadata;
>> + /**< Get metadata from packet. */
>> security_capabilities_get_t capabilities_get;
>> /**< Get security capabilities. */
>> };
>> --
>> 2.7.4
>>
>>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH 2/3] crypto: fix pedentic compilation errors
@ 2017-11-22 13:56 3% ` Neil Horman
2017-11-22 14:31 0% ` Gaëtan Rivet
0 siblings, 1 reply; 200+ results
From: Neil Horman @ 2017-11-22 13:56 UTC (permalink / raw)
To: Nelio Laranjeiro
Cc: Akhil Goyal, Declan Doherty, dev, pablo.de.lara.guarch, stable
On Wed, Nov 22, 2017 at 09:10:17AM +0100, Nelio Laranjeiro wrote:
> /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_crypto.h:126:28: error: ISO C forbids zero-size array ‘sym’ [-Werror=pedantic]
> struct rte_crypto_sym_op sym[0];
> ^~~
>
> Fixes: d2a4223c4c6d ("cryptodev: do not store pointer to op specific params")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
> lib/librte_cryptodev/rte_crypto.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h
> index 3d672fe7d..dc6e91d1d 100644
> --- a/lib/librte_cryptodev/rte_crypto.h
> +++ b/lib/librte_cryptodev/rte_crypto.h
> @@ -123,7 +123,7 @@ struct rte_crypto_op {
>
> RTE_STD_C11
> union {
> - struct rte_crypto_sym_op sym[0];
> + struct rte_crypto_sym_op *sym;
> /**< Symmetric operation parameters */
> }; /**< operation specific parameters */
> };
> --
> 2.11.0
>
>
As Laura notes, this isn't the right solution. In addition to adding a 64 bit
pointer, it I think also results in incorrect semantics. That is to say, the
allocation path for this structure allocates the rte_crypto_op and additional
memory for the sym array contiguously, which the sym[0] syntax correctly
interprets to mean the storage for the array is inline with the structure.
Changing to a pointer means you are using the first elements of the array
storage as your pointer, which could be filled with any old value, leading to
corruption.
If you can't use zero length array semantics (which I assume you cant, as I
don't think clang supports that), a better soution might be to remove the sym
variable entirely, and replace it with a macro that access the sym array as an
offset from the start of the pointer. That would seem to be an ABI change, but
if you went through that process you would wind up with the same sized struct,
which would be nice
Neil
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v2 1/2] lib/security: add support for get metadata
@ 2017-11-22 13:27 3% ` Neil Horman
2017-11-22 14:13 0% ` Anoob
0 siblings, 1 reply; 200+ results
From: Neil Horman @ 2017-11-22 13:27 UTC (permalink / raw)
To: Anoob Joseph
Cc: Akhil Goyal, Declan Doherty, Radu Nicolau,
Sergio Gonzalez Monroy, Jerin Jacob, Narayana Prasad, dev
On Wed, Nov 22, 2017 at 06:55:15AM +0000, Anoob Joseph wrote:
> In case of inline protocol processed ingress traffic, the packet may not
> have enough information to determine the security parameters with which
> the packet was processed. For such cases, application could register a
> 64 bit metadata in security session, which could be retrieved from the
> packet using "rte_security_get_pkt_metadata" API. Application can use
> this metadata to identify the parameters it need.
>
> Application can choose what it should register as the metadata. It can
> register SPI or a pointer to SA.
>
> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> ---
> v2:
> * Replaced get_session and get_cookie APIs with get_pkt_metadata API
>
> lib/librte_security/rte_security.c | 13 +++++++++++++
> lib/librte_security/rte_security.h | 19 +++++++++++++++++++
> lib/librte_security/rte_security_driver.h | 16 ++++++++++++++++
> 3 files changed, 48 insertions(+)
>
> diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
> index 1227fca..804f11f 100644
> --- a/lib/librte_security/rte_security.c
> +++ b/lib/librte_security/rte_security.c
> @@ -108,6 +108,19 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
> sess, m, params);
> }
>
> +uint64_t
> +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
> + struct rte_mbuf *pkt)
> +{
> + uint64_t mdata = 0;
> +
> + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_pkt_metadata, 0);
> + if (instance->ops->get_pkt_metadata(instance->device, pkt, &mdata))
> + return 0;
> +
> + return mdata;
> +}
> +
> const struct rte_security_capability *
> rte_security_capabilities_get(struct rte_security_ctx *instance)
> {
> diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
> index 653929b..aa3a471 100644
> --- a/lib/librte_security/rte_security.h
> +++ b/lib/librte_security/rte_security.h
> @@ -274,6 +274,8 @@ struct rte_security_session_conf {
> /**< Configuration parameters for security session */
> struct rte_crypto_sym_xform *crypto_xform;
> /**< Security Session Crypto Transformations */
> + uint64_t metadata;
> + /**< Metadata registered by application */
This is going to break ABI. You need to announce the change so that application
providers can be prepared for it.
> };
>
> struct rte_security_session {
> @@ -346,6 +348,23 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
> struct rte_mbuf *mb, void *params);
>
> /**
> + * Get metadata from the packet. This is an application registered 64 bit
> + * value, associated with the security session which processed the packet.
> + *
> + * This is valid only for inline processed ingress packets.
> + *
> + * @param instance security instance
> + * @param pkt packet mbuf
> + *
> + * @return
> + * - On success, metadata
> + * - On failure, 0
> + */
> +uint64_t
> +rte_security_get_pkt_metadata(struct rte_security_ctx *instance,
> + struct rte_mbuf *pkt);
> +
> +/**
> * Attach a session to a symmetric crypto operation
> *
> * @param sym_op crypto operation
> diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
> index 997fbe7..da0ebf4 100644
> --- a/lib/librte_security/rte_security_driver.h
> +++ b/lib/librte_security/rte_security_driver.h
> @@ -122,6 +122,20 @@ typedef int (*security_set_pkt_metadata_t)(void *device,
> void *params);
>
> /**
> + * Get application interpretable metadata from the packet.
> + *
> + * @param device Crypto/eth device pointer
> + * @param pkt Packet mbuf
> + * @param mt Pointer to receive metadata
> + *
> + * @return
> + * - Returns 0 if metadata is retrieved successfully.
> + * - Returns -ve value for errors.
> + */
> +typedef int (*security_get_pkt_metadata_t)(void *device,
> + struct rte_mbuf *pkt, uint64_t *mt);
> +
> +/**
> * Get security capabilities of the device.
> *
> * @param device crypto/eth device pointer
> @@ -145,6 +159,8 @@ struct rte_security_ops {
> /**< Clear a security sessions private data. */
> security_set_pkt_metadata_t set_pkt_metadata;
> /**< Update mbuf metadata. */
> + security_get_pkt_metadata_t get_pkt_metadata;
> + /**< Get metadata from packet. */
> security_capabilities_get_t capabilities_get;
> /**< Get security capabilities. */
> };
> --
> 2.7.4
>
>
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API
@ 2017-11-20 8:21 3% Andrew Rybchenko
` (3 more replies)
0 siblings, 4 replies; 200+ results
From: Andrew Rybchenko @ 2017-11-20 8:21 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil, Jingjing Wu
enum rte_flow_item_type states that items matching protocol headers
must be stacked in the same order as the protocol layers to match.
As the result the patch changes ABI since Geneve is added just after
VXLAN (the closest protocol).
In fact as far as I can see many items do not follow the requirement
already. May be the comment/requirement should be removed and GENEVE
should be added at the end of the list. If so, should be keep it just
after VXLAN in all other places or move after ESP as well?
Roman Zhukov (2):
ethdev: add GENEVE flow pattern item
app/testpmd: support GENEVE pattern item in flow rules
app/test-pmd/cmdline_flow.c | 31 +++++++++++++++++++++++++++++
app/test-pmd/config.c | 1 +
doc/guides/prog_guide/rte_flow.rst | 12 +++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++++
lib/librte_ether/rte_flow.c | 1 +
lib/librte_ether/rte_flow.h | 31 +++++++++++++++++++++++++++++
6 files changed, 81 insertions(+)
--
2.7.4
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v1] doc: add template release notes for 18.02
@ 2017-11-17 22:41 6% John McNamara
2017-11-22 17:38 6% ` [dpdk-dev] [PATCH v2] " John McNamara
0 siblings, 1 reply; 200+ results
From: John McNamara @ 2017-11-17 22:41 UTC (permalink / raw)
To: dev; +Cc: John McNamara
Add template release notes for DPDK 18.02 with inline
comments and explanations of the various sections.
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_18_02.rst | 214 +++++++++++++++++++++++++++++++++
1 file changed, 214 insertions(+)
create mode 100644 doc/guides/rel_notes/release_18_02.rst
diff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst
new file mode 100644
index 0000000..8a513b8
--- /dev/null
+++ b/doc/guides/rel_notes/release_18_02.rst
@@ -0,0 +1,214 @@
+DPDK Release 18.02
+==================
+
+.. **Read this first.**
+
+ The text in the sections below explains how to update the release notes.
+
+ Use proper spelling, capitalization and punctuation in all sections.
+
+ Variable and config names should be quoted as fixed width text:
+ ``LIKE_THIS``.
+
+ Build the docs and view the output file to ensure the changes are correct::
+
+ make doc-guides-html
+
+ xdg-open build/doc/html/guides/rel_notes/release_18_02.html
+
+
+New Features
+------------
+
+.. This section should contain new features added in this release. Sample
+ format:
+
+ * **Add a title in the past tense with a full stop.**
+
+ Add a short 1-2 sentence description in the past tense. The description
+ should be enough to allow someone scanning the release notes to
+ understand the new feature.
+
+ If the feature adds a lot of sub-features you can use a bullet list like
+ this:
+
+ * Added feature foo to do something.
+ * Enhanced feature bar to do something else.
+
+ Refer to the previous release notes for examples.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+Resolved Issues
+---------------
+
+.. This section should contain bug fixes added to the relevant
+ sections. Sample format:
+
+ * **code/section Fixed issue in the past tense with a full stop.**
+
+ Add a short 1-2 sentence description of the resolved issue in the past
+ tense.
+
+ The title should contain the code/lib section like a commit message.
+
+ Add the entries in alphabetic order in the relevant sections below.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+EAL
+~~~
+
+
+Drivers
+~~~~~~~
+
+
+Libraries
+~~~~~~~~~
+
+
+Examples
+~~~~~~~~
+
+
+Other
+~~~~~
+
+
+Known Issues
+------------
+
+.. This section should contain new known issues in this release. Sample format:
+
+ * **Add title in present tense with full stop.**
+
+ Add a short 1-2 sentence description of the known issue in the present
+ tense. Add information on any known workarounds.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+API Changes
+-----------
+
+.. This section should contain API changes. Sample format:
+
+ * Add a short 1-2 sentence description of the API change. Use fixed width
+ quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past
+ tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+ABI Changes
+-----------
+
+.. This section should contain ABI changes. Sample format:
+
+ * Add a short 1-2 sentence description of the ABI change that was announced
+ in the previous releases and made in this release. Use fixed width quotes
+ for ``rte_function_names`` or ``rte_struct_names``. Use the past tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+
+
+Shared Library Versions
+-----------------------
+
+.. Update any library version updated in this release and prepend with a ``+``
+ sign, like this:
+
+ librte_acl.so.2
+ + librte_cfgfile.so.2
+ librte_cmdline.so.2
+
+ This section is a comment. do not overwrite or remove it.
+ =========================================================
+
+
+The libraries prepended with a plus sign were incremented in this version.
+
+.. code-block:: diff
+
+ librte_acl.so.2
+ librte_bitratestats.so.2
+ librte_bus_dpaa.so.1
+ librte_bus_fslmc.so.1
+ librte_bus_pci.so.1
+ librte_bus_vdev.so.1
+ librte_cfgfile.so.2
+ librte_cmdline.so.2
+ librte_cryptodev.so.4
+ librte_distributor.so.1
+ librte_eal.so.6
+ librte_ethdev.so.8
+ librte_eventdev.so.3
+ librte_flow_classify.so.1
+ librte_gro.so.1
+ librte_gso.so.1
+ librte_hash.so.2
+ librte_ip_frag.so.1
+ librte_jobstats.so.1
+ librte_kni.so.2
+ librte_kvargs.so.1
+ librte_latencystats.so.1
+ librte_lpm.so.2
+ librte_mbuf.so.3
+ librte_mempool.so.3
+ librte_meter.so.1
+ librte_metrics.so.1
+ librte_net.so.1
+ librte_pci.so.1
+ librte_pdump.so.2
+ librte_pipeline.so.3
+ librte_pmd_bnxt.so.2
+ librte_pmd_bond.so.2
+ librte_pmd_i40e.so.2
+ librte_pmd_ixgbe.so.2
+ librte_pmd_ring.so.2
+ librte_pmd_softnic.so.1
+ librte_pmd_vhost.so.2
+ librte_port.so.3
+ librte_power.so.1
+ librte_reorder.so.1
+ librte_ring.so.1
+ librte_sched.so.1
+ librte_security.so.1
+ librte_table.so.3
+ librte_timer.so.1
+ librte_vhost.so.3
+
+
+
+Tested Platforms
+----------------
+
+.. This section should contain a list of platforms that were tested with this
+ release.
+
+ The format is:
+
+ * <vendor> platform with <vendor> <type of devices> combinations
+
+ * List of CPU
+ * List of OS
+ * List of devices
+ * Other relevant details...
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
--
2.7.5
^ permalink raw reply [relevance 6%]
* [dpdk-dev] [PATCH] virtio: add new driver for crypto devices
@ 2017-11-17 17:10 1% Jay Zhou
0 siblings, 0 replies; 200+ results
From: Jay Zhou @ 2017-11-17 17:10 UTC (permalink / raw)
To: dev
Cc: yliu, maxime.coquelin, arei.gonglei, roy.fan.zhang, xin.zeng,
weidong.huang, wangxinxin.wang, longpeng2, jianjay.zhou
This patch series add a PMD for the virtio-crypto devices.
This patch series support a limited subset of crypto services.
Currently supporting symmetric algorithms(cipher only or chained algorithms),
and only the following algorithms are tested(because the backend of the virtio-crypto
only supports cipher only now):
Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES_CBC (with 128-bit, 192-bit and 256-bit keys supported)
- RTE_CRYPTO_CIPHER_AES_CTR (with 128-bit, 192-bit and 256-bit keys supported)
Firstly build QEMU with libgcrypt cryptography support.
QEMU can then be started using the following parameters:
qemu-system-x86_64 \
[...] \
-object cryptodev-backend-builtin,id=cryptodev0 \
-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
[...]
Follow the steps listed in the link below
https://www.kernel.org/doc/html/v4.12/driver-api/uio-howto.html
to bind the uio_generic driver for the virtio-crypto device.
For example, 0000:00:04.0 is the domain, bus, device and function
number of the virtio-crypto device,
modprobe uio_pci_generic
echo -n 0000:00:04.0 > /sys/bus/pci/drivers/virtio-pci/unbind
echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id
The front-end virtio crypto PMD driver can be installed:
cd to the top-level DPDK directory
sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO\)=n,\1=y,' config/common_base
make config T=x86_64-native-linuxapp-gcc
make install T=x86_64-native-linuxapp-gcc
The test cases can be compiled as below:
cd to the top-level DPDK directory
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=`pwd`
cd to test/test
make
./test (MUST reserve huge pages memory)
type the command "cryptodev_virtio_autotest" to test
The result should be like this:
RTE>>cryptodev_virtio_autotest
+ ------------------------------------------------------- +
+ Test Suite : Crypto VIRTIO Unit Test Suite
+ ------------------------------------------------------- +
0) TestCase AES-128-CBC Encryption PASS
1) TestCase AES-128-CBC Decryption PASS
2) TestCase AES-192-CBC Encryption PASS
3) TestCase AES-192-CBC Decryption PASS
4) TestCase AES-256-CBC Encryption PASS
5) TestCase AES-256-CBC Decryption PASS
6) TestCase AES-256-CBC OOP Encryption PASS
7) TestCase AES-256-CBC OOP Decryption PASS
8) TestCase AES-128-CTR Encryption PASS
9) TestCase AES-128-CTR Decryption PASS
10) TestCase AES-192-CTR Encryption PASS
11) TestCase AES-192-CTR Decryption PASS
12) TestCase AES-256-CTR Encryption PASS
13) TestCase AES-256-CTR Decryption PASS
+ TestCase [ 0] : test_AES_cipheronly_virtio_all succeeded
+ ------------------------------------------------------- +
+ Test Suite Summary
+ Tests Total : 1
+ Tests Skipped : 0
+ Tests Executed : 1
+ Tests Unsupported: 0
+ Tests Passed : 1
+ Tests Failed : 0
+ ------------------------------------------------------- +
Test OK
TODO:
- Only some function tests (chained algorithms and performance
tests are not supported)
- Only supports session-oriented API implementation(session-less
APIs are not supported)
- Hash only is not supported (depends on the backend of virtio-crypto)
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
---
MAINTAINERS | 4 +
config/common_base | 20 +
drivers/crypto/Makefile | 1 +
drivers/crypto/virtio/Makefile | 59 +
drivers/crypto/virtio/virtio_crypto.h | 452 ++++++++
drivers/crypto/virtio/virtio_crypto_algs.h | 56 +
drivers/crypto/virtio/virtio_cryptodev.c | 1542 +++++++++++++++++++++++++++
drivers/crypto/virtio/virtio_cryptodev.h | 87 ++
drivers/crypto/virtio/virtio_logs.h | 76 ++
drivers/crypto/virtio/virtio_pci.c | 714 +++++++++++++
drivers/crypto/virtio/virtio_pci.h | 286 +++++
drivers/crypto/virtio/virtio_ring.h | 169 +++
drivers/crypto/virtio/virtio_rxtx.c | 569 ++++++++++
drivers/crypto/virtio/virtqueue.c | 80 ++
drivers/crypto/virtio/virtqueue.h | 208 ++++
mk/rte.app.mk | 1 +
test/test/test_cryptodev.c | 49 +
test/test/test_cryptodev.h | 1 +
test/test/test_cryptodev_aes_test_vectors.h | 45 +-
test/test/test_cryptodev_blockcipher.c | 9 +-
test/test/test_cryptodev_blockcipher.h | 1 +
21 files changed, 4413 insertions(+), 16 deletions(-)
create mode 100644 drivers/crypto/virtio/Makefile
create mode 100644 drivers/crypto/virtio/virtio_crypto.h
create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
create mode 100644 drivers/crypto/virtio/virtio_cryptodev.c
create mode 100644 drivers/crypto/virtio/virtio_cryptodev.h
create mode 100644 drivers/crypto/virtio/virtio_logs.h
create mode 100644 drivers/crypto/virtio/virtio_pci.c
create mode 100644 drivers/crypto/virtio/virtio_pci.h
create mode 100644 drivers/crypto/virtio/virtio_ring.h
create mode 100644 drivers/crypto/virtio/virtio_rxtx.c
create mode 100644 drivers/crypto/virtio/virtqueue.c
create mode 100644 drivers/crypto/virtio/virtqueue.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 8ab08d2..deccd45 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -519,6 +519,10 @@ F: drivers/net/virtio/
F: doc/guides/nics/virtio.rst
F: doc/guides/nics/features/virtio*.ini
+Virtio crypto PMD
+M: Jay Zhou <jianjay.zhou@huawei.com>
+F: drivers/crypto/virtio/
+
Wind River AVP
M: Allain Legacy <allain.legacy@windriver.com>
M: Matt Peters <matt.peters@windriver.com>
diff --git a/config/common_base b/config/common_base
index 82ee754..011a6fe 100644
--- a/config/common_base
+++ b/config/common_base
@@ -504,6 +504,26 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
#
+# Compile PMD for virtio crypto devices
+#
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_SESSION=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DRIVER=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DUMP=n
+#
+# Number of maximum virtio crypto devices
+#
+CONFIG_RTE_MAX_VIRTIO_CRYPTO=32
+#
+# Number of sessions to create in the session memory pool
+# on a single virtio crypto device.
+#
+CONFIG_RTE_VIRTIO_CRYPTO_PMD_MAX_NB_SESSIONS=1024
+
+#
# Compile PMD for AESNI backed device
#
CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 645b696..df44026 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -44,5 +44,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO) += mrvl
DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null
DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += dpaa2_sec
DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_SEC) += dpaa_sec
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/virtio/Makefile b/drivers/crypto/virtio/Makefile
new file mode 100644
index 0000000..084e657
--- /dev/null
+++ b/drivers/crypto/virtio/Makefile
@@ -0,0 +1,59 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_virtio_crypto.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_virtio_crypto_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtqueue.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_pci.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_cryptodev.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_mempool lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_cryptodev
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/virtio/virtio_crypto.h b/drivers/crypto/virtio/virtio_crypto.h
new file mode 100644
index 0000000..ba94e80
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto.h
@@ -0,0 +1,452 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_CRYPTO_H_
+#define _VIRTIO_CRYPTO_H_
+
+#define VIRTIO_CRYPTO_SERVICE_CIPHER 0
+#define VIRTIO_CRYPTO_SERVICE_HASH 1
+#define VIRTIO_CRYPTO_SERVICE_MAC 2
+#define VIRTIO_CRYPTO_SERVICE_AEAD 3
+
+#define VIRTIO_CRYPTO_OPCODE(service, op) (((service) << 8) | (op))
+
+struct virtio_crypto_ctrl_header {
+#define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02)
+#define VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x03)
+#define VIRTIO_CRYPTO_HASH_CREATE_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x02)
+#define VIRTIO_CRYPTO_HASH_DESTROY_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x03)
+#define VIRTIO_CRYPTO_MAC_CREATE_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x02)
+#define VIRTIO_CRYPTO_MAC_DESTROY_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03)
+#define VIRTIO_CRYPTO_AEAD_CREATE_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02)
+#define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03)
+ uint32_t opcode;
+ uint32_t algo;
+ uint32_t flag;
+ /* data virtqueue id */
+ uint32_t queue_id;
+};
+
+struct virtio_crypto_cipher_session_para {
+#define VIRTIO_CRYPTO_NO_CIPHER 0
+#define VIRTIO_CRYPTO_CIPHER_ARC4 1
+#define VIRTIO_CRYPTO_CIPHER_AES_ECB 2
+#define VIRTIO_CRYPTO_CIPHER_AES_CBC 3
+#define VIRTIO_CRYPTO_CIPHER_AES_CTR 4
+#define VIRTIO_CRYPTO_CIPHER_DES_ECB 5
+#define VIRTIO_CRYPTO_CIPHER_DES_CBC 6
+#define VIRTIO_CRYPTO_CIPHER_3DES_ECB 7
+#define VIRTIO_CRYPTO_CIPHER_3DES_CBC 8
+#define VIRTIO_CRYPTO_CIPHER_3DES_CTR 9
+#define VIRTIO_CRYPTO_CIPHER_KASUMI_F8 10
+#define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2 11
+#define VIRTIO_CRYPTO_CIPHER_AES_F8 12
+#define VIRTIO_CRYPTO_CIPHER_AES_XTS 13
+#define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3 14
+ uint32_t algo;
+ /* length of key */
+ uint32_t keylen;
+
+#define VIRTIO_CRYPTO_OP_ENCRYPT 1
+#define VIRTIO_CRYPTO_OP_DECRYPT 2
+ /* encrypt or decrypt */
+ uint32_t op;
+ uint32_t padding;
+};
+
+struct virtio_crypto_session_input {
+ /* Device-writable part */
+ uint64_t session_id;
+ uint32_t status;
+ uint32_t padding;
+};
+
+struct virtio_crypto_cipher_session_req {
+ struct virtio_crypto_cipher_session_para para;
+ uint8_t padding[32];
+};
+
+struct virtio_crypto_hash_session_para {
+#define VIRTIO_CRYPTO_NO_HASH 0
+#define VIRTIO_CRYPTO_HASH_MD5 1
+#define VIRTIO_CRYPTO_HASH_SHA1 2
+#define VIRTIO_CRYPTO_HASH_SHA_224 3
+#define VIRTIO_CRYPTO_HASH_SHA_256 4
+#define VIRTIO_CRYPTO_HASH_SHA_384 5
+#define VIRTIO_CRYPTO_HASH_SHA_512 6
+#define VIRTIO_CRYPTO_HASH_SHA3_224 7
+#define VIRTIO_CRYPTO_HASH_SHA3_256 8
+#define VIRTIO_CRYPTO_HASH_SHA3_384 9
+#define VIRTIO_CRYPTO_HASH_SHA3_512 10
+#define VIRTIO_CRYPTO_HASH_SHA3_SHAKE128 11
+#define VIRTIO_CRYPTO_HASH_SHA3_SHAKE256 12
+ uint32_t algo;
+ /* hash result length */
+ uint32_t hash_result_len;
+ uint8_t padding[8];
+};
+
+struct virtio_crypto_hash_create_session_req {
+ struct virtio_crypto_hash_session_para para;
+ uint8_t padding[40];
+};
+
+struct virtio_crypto_mac_session_para {
+#define VIRTIO_CRYPTO_NO_MAC 0
+#define VIRTIO_CRYPTO_MAC_HMAC_MD5 1
+#define VIRTIO_CRYPTO_MAC_HMAC_SHA1 2
+#define VIRTIO_CRYPTO_MAC_HMAC_SHA_224 3
+#define VIRTIO_CRYPTO_MAC_HMAC_SHA_256 4
+#define VIRTIO_CRYPTO_MAC_HMAC_SHA_384 5
+#define VIRTIO_CRYPTO_MAC_HMAC_SHA_512 6
+#define VIRTIO_CRYPTO_MAC_CMAC_3DES 25
+#define VIRTIO_CRYPTO_MAC_CMAC_AES 26
+#define VIRTIO_CRYPTO_MAC_KASUMI_F9 27
+#define VIRTIO_CRYPTO_MAC_SNOW3G_UIA2 28
+#define VIRTIO_CRYPTO_MAC_GMAC_AES 41
+#define VIRTIO_CRYPTO_MAC_GMAC_TWOFISH 42
+#define VIRTIO_CRYPTO_MAC_CBCMAC_AES 49
+#define VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9 50
+#define VIRTIO_CRYPTO_MAC_XCBC_AES 53
+ uint32_t algo;
+ /* hash result length */
+ uint32_t hash_result_len;
+ /* length of authenticated key */
+ uint32_t auth_key_len;
+ uint32_t padding;
+};
+
+struct virtio_crypto_mac_create_session_req {
+ struct virtio_crypto_mac_session_para para;
+ uint8_t padding[40];
+};
+
+struct virtio_crypto_aead_session_para {
+#define VIRTIO_CRYPTO_NO_AEAD 0
+#define VIRTIO_CRYPTO_AEAD_GCM 1
+#define VIRTIO_CRYPTO_AEAD_CCM 2
+#define VIRTIO_CRYPTO_AEAD_CHACHA20_POLY1305 3
+ uint32_t algo;
+ /* length of key */
+ uint32_t key_len;
+ /* hash result length */
+ uint32_t hash_result_len;
+ /* length of the additional authenticated data (AAD) in bytes */
+ uint32_t aad_len;
+ /* encrypt or decrypt, See above VIRTIO_CRYPTO_OP_* */
+ uint32_t op;
+ uint32_t padding;
+};
+
+struct virtio_crypto_aead_create_session_req {
+ struct virtio_crypto_aead_session_para para;
+ uint8_t padding[32];
+};
+
+struct virtio_crypto_alg_chain_session_para {
+#define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1
+#define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2
+ uint32_t alg_chain_order;
+/* Plain hash */
+#define VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN 1
+/* Authenticated hash (mac) */
+#define VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH 2
+/* Nested hash */
+#define VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED 3
+ uint32_t hash_mode;
+ struct virtio_crypto_cipher_session_para cipher_param;
+ union {
+ struct virtio_crypto_hash_session_para hash_param;
+ struct virtio_crypto_mac_session_para mac_param;
+ uint8_t padding[16];
+ } u;
+ /* length of the additional authenticated data (AAD) in bytes */
+ uint32_t aad_len;
+ uint32_t padding;
+};
+
+struct virtio_crypto_alg_chain_session_req {
+ struct virtio_crypto_alg_chain_session_para para;
+};
+
+struct virtio_crypto_sym_create_session_req {
+ union {
+ struct virtio_crypto_cipher_session_req cipher;
+ struct virtio_crypto_alg_chain_session_req chain;
+ uint8_t padding[48];
+ } u;
+
+ /* Device-readable part */
+
+/* No operation */
+#define VIRTIO_CRYPTO_SYM_OP_NONE 0
+/* Cipher only operation on the data */
+#define VIRTIO_CRYPTO_SYM_OP_CIPHER 1
+/*
+ * Chain any cipher with any hash or mac operation. The order
+ * depends on the value of alg_chain_order param
+ */
+#define VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING 2
+ uint32_t op_type;
+ uint32_t padding;
+};
+
+struct virtio_crypto_destroy_session_req {
+ /* Device-readable part */
+ uint64_t session_id;
+ uint8_t padding[48];
+};
+
+/* The request of the control virtqueue's packet */
+struct virtio_crypto_op_ctrl_req {
+ struct virtio_crypto_ctrl_header header;
+
+ union {
+ struct virtio_crypto_sym_create_session_req
+ sym_create_session;
+ struct virtio_crypto_hash_create_session_req
+ hash_create_session;
+ struct virtio_crypto_mac_create_session_req
+ mac_create_session;
+ struct virtio_crypto_aead_create_session_req
+ aead_create_session;
+ struct virtio_crypto_destroy_session_req
+ destroy_session;
+ uint8_t padding[56];
+ } u;
+};
+
+struct virtio_crypto_op_header {
+#define VIRTIO_CRYPTO_CIPHER_ENCRYPT \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x00)
+#define VIRTIO_CRYPTO_CIPHER_DECRYPT \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x01)
+#define VIRTIO_CRYPTO_HASH \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x00)
+#define VIRTIO_CRYPTO_MAC \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00)
+#define VIRTIO_CRYPTO_AEAD_ENCRYPT \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00)
+#define VIRTIO_CRYPTO_AEAD_DECRYPT \
+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01)
+ uint32_t opcode;
+ /* algo should be service-specific algorithms */
+ uint32_t algo;
+ /* session_id should be service-specific algorithms */
+ uint64_t session_id;
+ /* control flag to control the request */
+ uint32_t flag;
+ uint32_t padding;
+};
+
+struct virtio_crypto_cipher_para {
+ /*
+ * Byte Length of valid IV/Counter
+ *
+ * For block ciphers in CBC or F8 mode, or for Kasumi in F8 mode, or for
+ * SNOW3G in UEA2 mode, this is the length of the IV (which
+ * must be the same as the block length of the cipher).
+ * For block ciphers in CTR mode, this is the length of the counter
+ * (which must be the same as the block length of the cipher).
+ * For AES-XTS, this is the 128bit tweak, i, from IEEE Std 1619-2007.
+ *
+ * The IV/Counter will be updated after every partial cryptographic
+ * operation.
+ */
+ uint32_t iv_len;
+ /* length of source data */
+ uint32_t src_data_len;
+ /* length of dst data */
+ uint32_t dst_data_len;
+ uint32_t padding;
+};
+
+struct virtio_crypto_hash_para {
+ /* length of source data */
+ uint32_t src_data_len;
+ /* hash result length */
+ uint32_t hash_result_len;
+};
+
+struct virtio_crypto_mac_para {
+ struct virtio_crypto_hash_para hash;
+};
+
+struct virtio_crypto_aead_para {
+ /*
+ * Byte Length of valid IV data pointed to by the below iv_addr
+ * parameter.
+ *
+ * For GCM mode, this is either 12 (for 96-bit IVs) or 16, in which
+ * case iv_addr points to J0.
+ * For CCM mode, this is the length of the nonce, which can be in the
+ * range 7 to 13 inclusive.
+ */
+ uint32_t iv_len;
+ /* length of additional auth data */
+ uint32_t aad_len;
+ /* length of source data */
+ uint32_t src_data_len;
+ /* length of dst data */
+ uint32_t dst_data_len;
+};
+
+struct virtio_crypto_cipher_data_req {
+ /* Device-readable part */
+ struct virtio_crypto_cipher_para para;
+ uint8_t padding[24];
+};
+
+struct virtio_crypto_hash_data_req {
+ /* Device-readable part */
+ struct virtio_crypto_hash_para para;
+ uint8_t padding[40];
+};
+
+struct virtio_crypto_mac_data_req {
+ /* Device-readable part */
+ struct virtio_crypto_mac_para para;
+ uint8_t padding[40];
+};
+
+struct virtio_crypto_alg_chain_data_para {
+ uint32_t iv_len;
+ /* Length of source data */
+ uint32_t src_data_len;
+ /* Length of destination data */
+ uint32_t dst_data_len;
+ /* Starting point for cipher processing in source data */
+ uint32_t cipher_start_src_offset;
+ /* Length of the source data that the cipher will be computed on */
+ uint32_t len_to_cipher;
+ /* Starting point for hash processing in source data */
+ uint32_t hash_start_src_offset;
+ /* Length of the source data that the hash will be computed on */
+ uint32_t len_to_hash;
+ /* Length of the additional auth data */
+ uint32_t aad_len;
+ /* Length of the hash result */
+ uint32_t hash_result_len;
+ uint32_t reserved;
+};
+
+struct virtio_crypto_alg_chain_data_req {
+ /* Device-readable part */
+ struct virtio_crypto_alg_chain_data_para para;
+};
+
+struct virtio_crypto_sym_data_req {
+ union {
+ struct virtio_crypto_cipher_data_req cipher;
+ struct virtio_crypto_alg_chain_data_req chain;
+ uint8_t padding[40];
+ } u;
+
+ /* See above VIRTIO_CRYPTO_SYM_OP_* */
+ uint32_t op_type;
+ uint32_t padding;
+};
+
+struct virtio_crypto_aead_data_req {
+ /* Device-readable part */
+ struct virtio_crypto_aead_para para;
+ uint8_t padding[32];
+};
+
+/* The request of the data virtqueue's packet */
+struct virtio_crypto_op_data_req {
+ struct virtio_crypto_op_header header;
+
+ union {
+ struct virtio_crypto_sym_data_req sym_req;
+ struct virtio_crypto_hash_data_req hash_req;
+ struct virtio_crypto_mac_data_req mac_req;
+ struct virtio_crypto_aead_data_req aead_req;
+ uint8_t padding[48];
+ } u;
+};
+
+#define VIRTIO_CRYPTO_OK 0
+#define VIRTIO_CRYPTO_ERR 1
+#define VIRTIO_CRYPTO_BADMSG 2
+#define VIRTIO_CRYPTO_NOTSUPP 3
+#define VIRTIO_CRYPTO_INVSESS 4 /* Invalid session id */
+
+/* The accelerator hardware is ready */
+#define VIRTIO_CRYPTO_S_HW_READY (1 << 0)
+
+struct virtio_crypto_config {
+ /* See VIRTIO_CRYPTO_OP_* above */
+ uint32_t status;
+
+ /*
+ * Maximum number of data queue
+ */
+ uint32_t max_dataqueues;
+
+ /*
+ * Specifies the services mask which the device support,
+ * see VIRTIO_CRYPTO_SERVICE_* above
+ */
+ uint32_t crypto_services;
+
+ /* Detailed algorithms mask */
+ uint32_t cipher_algo_l;
+ uint32_t cipher_algo_h;
+ uint32_t hash_algo;
+ uint32_t mac_algo_l;
+ uint32_t mac_algo_h;
+ uint32_t aead_algo;
+ /* Maximum length of cipher key */
+ uint32_t max_cipher_key_len;
+ /* Maximum length of authenticated key */
+ uint32_t max_auth_key_len;
+ uint32_t reserve;
+ /* Maximum size of each crypto request's content */
+ uint64_t max_size;
+};
+
+struct virtio_crypto_inhdr {
+ /* See VIRTIO_CRYPTO_* above */
+ uint8_t status;
+};
+
+#endif /* _VIRTIO_CRYPTO_H_ */
diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h b/drivers/crypto/virtio/virtio_crypto_algs.h
new file mode 100644
index 0000000..76dc6f6
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto_algs.h
@@ -0,0 +1,56 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_CRYPTO_ALGS_H_
+#define _VIRTIO_CRYPTO_ALGS_H_
+
+#include <rte_memory.h>
+#include "virtio_crypto.h"
+
+struct virtio_crypto_session {
+ uint64_t session_id;
+
+ struct {
+ uint16_t offset;
+ uint16_t length;
+ } iv;
+
+ struct {
+ uint32_t length;
+ phys_addr_t phys_addr;
+ } aad;
+
+ struct virtio_crypto_op_ctrl_req ctrl;
+};
+
+#endif /* _VIRTIO_CRYPTO_ALGS_H_ */
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
new file mode 100644
index 0000000..9e6cd20
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -0,0 +1,1542 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#ifdef RTE_EXEC_ENV_LINUXAPP
+#include <dirent.h>
+#include <fcntl.h>
+#endif
+
+#include <rte_cryptodev.h>
+#include <rte_cryptodev_pmd.h>
+#include <rte_memcpy.h>
+#include <rte_string_fns.h>
+#include <rte_memzone.h>
+#include <rte_malloc.h>
+#include <rte_atomic.h>
+#include <rte_branch_prediction.h>
+#include <rte_pci.h>
+#include <rte_common.h>
+#include <rte_errno.h>
+
+#include <rte_memory.h>
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_log.h>
+
+#include "virtio_crypto.h"
+#include "virtio_cryptodev.h"
+#include "virtio_logs.h"
+#include "virtqueue.h"
+#include "virtio_crypto_algs.h"
+
+static int virtio_crypto_dev_configure(struct rte_cryptodev *dev,
+ struct rte_cryptodev_config *config);
+static int virtio_crypto_dev_start(struct rte_cryptodev *dev);
+static void virtio_crypto_dev_stop(struct rte_cryptodev *dev);
+static int virtio_crypto_dev_close(struct rte_cryptodev *dev);
+static void virtio_crypto_dev_info_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_info *dev_info);
+static void virtio_crypto_dev_stats_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_stats *stats);
+static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev);
+static int virtio_crypto_qp_setup(struct rte_cryptodev *dev,
+ uint16_t queue_pair_id,
+ const struct rte_cryptodev_qp_conf *qp_conf,
+ int socket_id,
+ struct rte_mempool *session_pool);
+static int virtio_crypto_qp_release(struct rte_cryptodev *dev,
+ uint16_t queue_pair_id);
+static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev);
+static unsigned virtio_crypto_sym_get_session_private_size(
+ struct rte_cryptodev *dev);
+static void virtio_crypto_sym_clear_session( struct rte_cryptodev *dev,
+ struct rte_cryptodev_sym_session *sess);
+static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
+ struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *session,
+ struct rte_mempool *mp);
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static const struct rte_pci_id pci_id_virtio_crypto_map[] = {
+ { RTE_PCI_DEVICE(VIRTIO_CRYPTO_PCI_VENDORID,
+ VIRTIO_CRYPTO_PCI_LEGACY_DEVICEID) },
+ { RTE_PCI_DEVICE(VIRTIO_CRYPTO_PCI_VENDORID,
+ VIRTIO_CRYPTO_PCI_MODERN_DEVICEID) },
+ { .vendor_id = 0, /* sentinel */ },
+};
+
+uint8_t cryptodev_virtio_driver_id;
+
+#define NUM_ENTRY_VIRTIO_CRYPTO_SYM_CREATE_SESSION 4
+
+static int
+virtio_crypto_send_command(struct virtqueue *vq,
+ struct virtio_crypto_op_ctrl_req *ctrl, uint8_t *cipher_key,
+ uint8_t *auth_key, struct virtio_crypto_session *session)
+{
+ uint8_t idx;
+ uint8_t needed = 1;
+ uint32_t head;
+ uint32_t cipher_keylen = 0;
+ uint32_t auth_keylen = 0;
+ uint32_t ctrl_req_length = sizeof(struct virtio_crypto_op_ctrl_req);
+ uint32_t input_length = sizeof(struct virtio_crypto_session_input);
+ uint32_t total_size = 0;
+ uint32_t input_offset = 0;
+ void *virt_addr_started = NULL;
+ phys_addr_t phys_addr_started;
+ struct vring_desc *desc;
+ uint32_t desc_offset;
+ struct virtio_crypto_session_input *input;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (vq == NULL) {
+ PMD_SESSION_LOG(ERR, "vq is NULL");
+ return -EINVAL;
+ }
+ if (ctrl == NULL) {
+ PMD_SESSION_LOG(ERR, "ctrl is NULL.");
+ return -EINVAL;
+ }
+ if (session == NULL) {
+ PMD_SESSION_LOG(ERR, "session is NULL.");
+ return -EINVAL;
+ }
+
+ /* cipher only is supported, it is available if auth_key is NULL */
+ if (!cipher_key) {
+ PMD_SESSION_LOG(ERR, "cipher key is NULL.");
+ return -EINVAL;
+ }
+ head = vq->vq_desc_head_idx;
+ PMD_INIT_LOG(DEBUG, "vq->vq_desc_head_idx = %d, vq = %p", head, vq);
+
+ if (vq->vq_free_cnt < needed) {
+ PMD_SESSION_LOG(ERR, "Not enough entry");
+ return -ENOSPC;
+ }
+
+ /* calculate the length of cipher key */
+ if (cipher_key) {
+ switch (ctrl->u.sym_create_session.op_type) {
+ case VIRTIO_CRYPTO_SYM_OP_CIPHER:
+ cipher_keylen
+ = ctrl->u.sym_create_session.u.cipher
+ .para.keylen;
+ break;
+ case VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING:
+ cipher_keylen
+ = ctrl->u.sym_create_session.u.chain
+ .para.cipher_param.keylen;
+ break;
+ default:
+ PMD_SESSION_LOG(ERR, "invalid op type");
+ return -EINVAL;
+ }
+ }
+
+ /* calculate the length of auth key */
+ if (auth_key) {
+ auth_keylen =
+ ctrl->u.sym_create_session.u.chain.para.u.mac_param
+ .auth_key_len;
+ }
+
+ /*
+ * malloc memory to store indirect vring_desc entries, including
+ * ctrl request, cipher key, auth key, session input and desc vring
+ */
+ desc_offset = ctrl_req_length + cipher_keylen + auth_keylen
+ + input_length;
+ virt_addr_started = rte_malloc(NULL,
+ desc_offset + NUM_ENTRY_VIRTIO_CRYPTO_SYM_CREATE_SESSION
+ * sizeof(struct vring_desc), RTE_CACHE_LINE_SIZE);
+ if (virt_addr_started == NULL) {
+ PMD_SESSION_LOG(ERR, "not enough heap memory");
+ return -ENOSPC;
+ }
+ phys_addr_started = rte_malloc_virt2phy(virt_addr_started);
+
+ /* address to store indirect vring desc entries */
+ desc = (struct vring_desc *)
+ ((uint8_t *)virt_addr_started + desc_offset);
+
+ idx = 0;
+ /* ctrl req part */
+ memcpy(virt_addr_started, ctrl, ctrl_req_length);
+ desc[idx].addr = phys_addr_started;
+ desc[idx].len = ctrl_req_length;
+ desc[idx].flags = VRING_DESC_F_NEXT;
+ desc[idx].next = idx + 1;
+ idx++;
+ total_size += ctrl_req_length;
+ input_offset += ctrl_req_length;
+
+ /* cipher key part */
+ if (cipher_keylen > 0) {
+ memcpy((uint8_t *)virt_addr_started + total_size,
+ cipher_key, cipher_keylen);
+
+ desc[idx].addr = phys_addr_started + total_size;
+ desc[idx].len = cipher_keylen;
+ desc[idx].flags = VRING_DESC_F_NEXT;
+ desc[idx].next = idx + 1;
+ idx++;
+
+ total_size += cipher_keylen;
+ input_offset += cipher_keylen;
+ }
+ /* auth key part */
+ if (auth_keylen > 0) {
+ memcpy((uint8_t *)virt_addr_started + total_size,
+ auth_key, auth_keylen);
+
+ desc[idx].addr = phys_addr_started + total_size;
+ desc[idx].len = auth_keylen;
+ desc[idx].flags = VRING_DESC_F_NEXT;
+ desc[idx].next = idx + 1;
+ idx++;
+ total_size += auth_keylen;
+ input_offset += auth_keylen;
+ }
+
+ /* input part */
+ input = (struct virtio_crypto_session_input *)
+ ((uint8_t *)virt_addr_started + input_offset);
+ input->status = VIRTIO_CRYPTO_ERR;
+ input->session_id = ~0ULL;
+ desc[idx].addr = phys_addr_started + total_size;
+ desc[idx].len = input_length;
+ desc[idx].flags = VRING_DESC_F_WRITE;
+ idx++;
+
+ /* use a single buffer */
+ vq->vq_ring.desc[head].flags = VRING_DESC_F_INDIRECT;
+ vq->vq_ring.desc[head].addr = phys_addr_started + desc_offset;
+ vq->vq_ring.desc[head].len = idx * sizeof(struct vring_desc);
+ vq->vq_free_cnt--;
+
+ vq->vq_desc_head_idx = vq->vq_ring.desc[head].next;
+
+ vq_crypto_update_avail_ring(vq, head);
+ vq_crypto_update_avail_idx(vq);
+
+ PMD_INIT_LOG(DEBUG, "vq->vq_queue_index = %d", vq->vq_queue_index);
+
+ virtqueue_crypto_notify(vq);
+
+ rte_rmb();
+ while (vq->vq_used_cons_idx == vq->vq_ring.used->idx) {
+ rte_rmb();
+ usleep(100);
+ }
+
+ while (vq->vq_used_cons_idx != vq->vq_ring.used->idx) {
+ uint32_t idx, desc_idx, used_idx;
+ struct vring_used_elem *uep;
+
+ used_idx = (uint32_t)(vq->vq_used_cons_idx
+ & (vq->vq_nentries - 1));
+ uep = &vq->vq_ring.used->ring[used_idx];
+ idx = (uint32_t) uep->id;
+ desc_idx = idx;
+
+ while (vq->vq_ring.desc[desc_idx].flags & VRING_DESC_F_NEXT) {
+ desc_idx = vq->vq_ring.desc[desc_idx].next;
+ vq->vq_free_cnt++;
+ }
+
+ vq->vq_ring.desc[desc_idx].next = vq->vq_desc_head_idx;
+ vq->vq_desc_head_idx = idx;
+
+ vq->vq_used_cons_idx++;
+ vq->vq_free_cnt++;
+ }
+
+ PMD_INIT_LOG(DEBUG, "vq->vq_free_cnt=%d\nvq->vq_desc_head_idx=%d",
+ vq->vq_free_cnt, vq->vq_desc_head_idx);
+
+ /* get the result */
+ if (input->status != VIRTIO_CRYPTO_OK) {
+ PMD_SESSION_LOG(ERR, "Something wrong on backend! "
+ "status=%"PRIu32", session_id=%"PRIu64"",
+ input->status, input->session_id);
+ rte_free(virt_addr_started);
+ return -1;
+ } else {
+ session->session_id = input->session_id;
+
+ PMD_SESSION_LOG(INFO, "Create session successfully, "
+ "session_id=%"PRIu64"", input->session_id);
+ rte_free(virt_addr_started);
+ return 0;
+ }
+}
+
+void virtio_crypto_queue_release(struct virtqueue *vq) {
+ struct virtio_crypto_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (vq) {
+ hw = vq->hw;
+ /* Select and deactivate the queue */
+ VTPCI_OPS(hw)->del_queue(hw, vq);
+
+ rte_memzone_free(vq->mz);
+ rte_free(vq);
+ }
+}
+
+int virtio_crypto_queue_setup(struct rte_cryptodev *dev,
+ int queue_type,
+ uint16_t vtpci_queue_idx,
+ uint16_t nb_desc,
+ int socket_id,
+ struct virtqueue **pvq)
+{
+ char vq_name[VIRTQUEUE_MAX_NAME_SZ];
+ const struct rte_memzone *mz;
+ unsigned int vq_size, size;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+ struct virtqueue *vq = NULL;
+
+ PMD_INIT_FUNC_TRACE();
+
+ PMD_INIT_LOG(DEBUG, "setting up queue: %u", vtpci_queue_idx);
+
+ /*
+ * Read the virtqueue size from the Queue Size field
+ * Always power of 2 and if 0 virtqueue does not exist
+ */
+ vq_size = VTPCI_OPS(hw)->get_queue_num(hw, vtpci_queue_idx);
+ if (vq_size == 0) {
+ PMD_INIT_LOG(ERR, "virtqueue does not exist");
+ return -EINVAL;
+ }
+ PMD_INIT_LOG(DEBUG, "vq_size: %u", vq_size);
+
+ if (!rte_is_power_of_2(vq_size)) {
+ PMD_INIT_LOG(ERR, "virtqueue size is not powerof 2");
+ return -EINVAL;
+ }
+
+ if (queue_type == VTCRYPTO_DATAQ)
+ snprintf(vq_name, sizeof(vq_name), "dev%d_dataqueue%d",
+ dev->data->dev_id, vtpci_queue_idx);
+ else if (queue_type == VTCRYPTO_CTRLQ)
+ snprintf(vq_name, sizeof(vq_name), "dev%d_controlqueue",
+ dev->data->dev_id);
+ size = RTE_ALIGN_CEIL(sizeof(*vq) +
+ vq_size * sizeof(struct vq_desc_extra),
+ RTE_CACHE_LINE_SIZE);
+ vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
+ socket_id);
+ if (vq == NULL) {
+ PMD_INIT_LOG(ERR, "Can not allocate virtqueue");
+ return -ENOMEM;
+ }
+
+ vq->hw = hw;
+ vq->dev_id = dev->data->dev_id;
+ vq->vq_queue_index = vtpci_queue_idx;
+ vq->vq_nentries = vq_size;
+
+ /*
+ * Using part of the vring entries is permitted, but the maximum
+ * is vq_size
+ */
+ if (nb_desc == 0 || nb_desc > vq_size)
+ nb_desc = vq_size;
+ vq->vq_free_cnt = nb_desc;
+
+ /*
+ * Reserve a memzone for vring elements
+ */
+ size = vring_crypto_size(vq_size, VIRTIO_PCI_VRING_ALIGN);
+ vq->vq_ring_size = RTE_ALIGN_CEIL(size, VIRTIO_PCI_VRING_ALIGN);
+ PMD_INIT_LOG(DEBUG, "%s vring_size: %d, rounded_vring_size: %d",
+ (queue_type == VTCRYPTO_DATAQ) ? "dataq" : "ctrlq",
+ size, vq->vq_ring_size);
+
+ mz = rte_memzone_reserve_aligned(vq_name, vq->vq_ring_size,
+ socket_id, 0, VIRTIO_PCI_VRING_ALIGN);
+ if (mz == NULL) {
+ if (rte_errno == EEXIST)
+ mz = rte_memzone_lookup(vq_name);
+ if (mz == NULL) {
+ PMD_INIT_LOG(ERR, "not enough memory");
+ rte_free(vq);
+ return -ENOMEM;
+ }
+ }
+
+ /*
+ * Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
+ * and only accepts 32 bit page frame number.
+ * Check if the allocated physical memory exceeds 16TB.
+ */
+ if ((mz->phys_addr + vq->vq_ring_size - 1)
+ >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+ PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
+ rte_free(vq);
+ rte_memzone_free(mz);
+ return -ENOMEM;
+ }
+
+ memset(mz->addr, 0, sizeof(mz->len));
+ vq->mz = mz;
+ vq->vq_ring_mem = mz->phys_addr;
+ vq->vq_ring_virt_mem = mz->addr;
+ PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem(physical): 0x%"PRIx64,
+ (uint64_t)mz->phys_addr);
+ PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64,
+ (uint64_t)(uintptr_t)mz->addr);
+
+ *pvq = vq;
+
+ return 0;
+}
+
+static int
+virtio_crypto_cq_setup(struct rte_cryptodev *dev, uint16_t queue_idx)
+{
+ struct virtqueue *vq;
+ int ret;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ /* if virtio dev is started, do not touch the virtqueues */
+ if (dev->data->dev_started)
+ return 0;
+
+ PMD_INIT_FUNC_TRACE();
+
+ ret = virtio_crypto_queue_setup(dev, VTCRYPTO_CTRLQ, queue_idx,
+ 0, SOCKET_ID_ANY, &vq);
+ if (ret < 0) {
+ PMD_INIT_LOG(ERR, "control vq initialization failed");
+ return ret;
+ }
+
+ hw->cvq = vq;
+
+ return 0;
+}
+
+static void
+virtio_crypto_free_queues(struct rte_cryptodev *dev)
+{
+ unsigned int i;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ for (i = 0; i < hw->max_dataqueues; i++)
+ virtio_crypto_queue_release(dev->data->queue_pairs[i]);
+}
+
+static int
+virtio_crypto_dev_close(struct rte_cryptodev *dev __rte_unused)
+{
+ return 0;
+}
+
+/*
+ * dev_ops for virtio, bare necessities for basic operation
+ */
+static struct rte_cryptodev_ops virtio_crypto_dev_ops = {
+ /* Device related operations */
+ .dev_configure = virtio_crypto_dev_configure,
+ .dev_start = virtio_crypto_dev_start,
+ .dev_stop = virtio_crypto_dev_stop,
+ .dev_close = virtio_crypto_dev_close,
+ .dev_infos_get = virtio_crypto_dev_info_get,
+
+ .stats_get = virtio_crypto_dev_stats_get,
+ .stats_reset = virtio_crypto_dev_stats_reset,
+
+ .queue_pair_setup = virtio_crypto_qp_setup,
+ .queue_pair_release = virtio_crypto_qp_release,
+ .queue_pair_start = NULL,
+ .queue_pair_stop = NULL,
+ .queue_pair_count = NULL,
+
+ /* Crypto related operations */
+ .session_get_size = virtio_crypto_sym_get_session_private_size,
+ .session_configure = virtio_crypto_sym_configure_session,
+ .session_clear = virtio_crypto_sym_clear_session,
+ .qp_attach_session = NULL,
+ .qp_detach_session = NULL
+};
+
+static void
+virtio_crypto_update_stats(struct rte_cryptodev *dev,
+ struct rte_cryptodev_stats *stats)
+{
+ unsigned i;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (stats == NULL) {
+ PMD_DRV_LOG(ERR, "invalid pointer");
+ return;
+ }
+
+ for (i = 0; i < hw->max_dataqueues; i++) {
+ const struct virtqueue *data_queue
+ = dev->data->queue_pairs[i];
+ if (data_queue == NULL)
+ continue;
+
+ stats->enqueued_count += data_queue->packets_sent_total;
+ stats->enqueue_err_count += data_queue->packets_sent_failed;
+
+ stats->dequeued_count += data_queue->packets_received_total;
+ stats->dequeue_err_count
+ += data_queue->packets_received_failed;
+ }
+}
+
+static void
+virtio_crypto_dev_stats_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_stats *stats)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ virtio_crypto_update_stats(dev, stats);
+}
+
+static void
+virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev)
+{
+ unsigned int i;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ for (i = 0; i < hw->max_dataqueues; i++) {
+ struct virtqueue *data_queue = dev->data->queue_pairs[i];
+ if (data_queue == NULL)
+ continue;
+
+ data_queue->packets_sent_total = 0;
+ data_queue->packets_sent_failed = 0;
+
+ data_queue->packets_received_total = 0;
+ data_queue->packets_received_failed = 0;
+ }
+}
+
+static int
+virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
+ const struct rte_cryptodev_qp_conf *qp_conf,
+ int socket_id,
+ struct rte_mempool *session_pool __rte_unused)
+{
+ int ret;
+ struct virtqueue *vq;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* if virtio dev is started, do not touch the virtqueues */
+ if (dev->data->dev_started)
+ return 0;
+
+ ret = virtio_crypto_queue_setup(dev, VTCRYPTO_DATAQ, queue_pair_id,
+ qp_conf->nb_descriptors, socket_id, &vq);
+ if (ret < 0) {
+ PMD_INIT_LOG(ERR,
+ "virtio crypto data queue initialization failed\n");
+ return ret;
+ }
+
+ dev->data->queue_pairs[queue_pair_id] = vq;
+
+ return 0;
+}
+
+static int
+virtio_crypto_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
+{
+ struct virtqueue *vq
+ = (struct virtqueue *)dev->data->queue_pairs[queue_pair_id];
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (vq == NULL) {
+ PMD_DRV_LOG(DEBUG, "vq already freed");
+ return 0;
+ }
+
+ virtio_crypto_queue_release(vq);
+ return 0;
+}
+
+static inline int
+vtpci_with_feature(struct virtio_crypto_hw *hw, uint64_t bit)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ return (hw->guest_features & (1ULL << bit)) != 0;
+}
+
+static int
+virtio_negotiate_features(struct virtio_crypto_hw *hw, uint64_t req_features)
+{
+ uint64_t host_features;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Prepare guest_features: feature that driver wants to support */
+ PMD_INIT_LOG(DEBUG, "guest_features before negotiate = %" PRIx64,
+ req_features);
+
+ /* Read device(host) feature bits */
+ host_features = VTPCI_OPS(hw)->get_features(hw);
+ PMD_INIT_LOG(DEBUG, "host_features before negotiate = %" PRIx64,
+ host_features);
+
+ /*
+ * Negotiate features: Subset of device feature bits are written back
+ * guest feature bits.
+ */
+ hw->guest_features = req_features;
+ hw->guest_features = vtpci_negotiate_features_crypto(hw, host_features);
+ PMD_INIT_LOG(DEBUG, "features after negotiate = %" PRIx64,
+ hw->guest_features);
+
+ if (hw->modern) {
+ if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) {
+ PMD_INIT_LOG(ERR,
+ "VIRTIO_F_VERSION_1 features is not enabled.");
+ return -1;
+ }
+ vtpci_set_status_crypto(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK);
+ if (!(vtpci_get_status_crypto(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) {
+ PMD_INIT_LOG(ERR,
+ "failed to set FEATURES_OK status!");
+ return -1;
+ }
+ }
+
+ hw->req_guest_features = req_features;
+
+ return 0;
+}
+
+/* reset device and renegotiate features if needed */
+static int
+virtio_crypto_init_device(struct rte_cryptodev *cryptodev, uint64_t req_features)
+{
+ struct virtio_crypto_hw *hw = cryptodev->data->dev_private;
+ struct virtio_crypto_config *config;
+ struct virtio_crypto_config local_config;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Reset the device although not necessary at startup */
+ vtpci_reset_crypto(hw);
+
+ /* Tell the host we've noticed this device. */
+ vtpci_set_status_crypto(hw, VIRTIO_CONFIG_STATUS_ACK);
+
+ /* Tell the host we've known how to drive the device. */
+ vtpci_set_status_crypto(hw, VIRTIO_CONFIG_STATUS_DRIVER);
+ if (virtio_negotiate_features(hw, req_features) < 0)
+ return -1;
+
+ config = &local_config;
+ /* Get status of the device */
+ vtpci_read_dev_config_crypto(hw,
+ offsetof(struct virtio_crypto_config, status),
+ &config->status, sizeof(config->status));
+ if (config->status != VIRTIO_CRYPTO_S_HW_READY) {
+ PMD_DRV_LOG(ERR, "accelerator hardware is "
+ "not ready");
+ return -1;
+ }
+
+ /* Get number of data queues */
+ vtpci_read_dev_config_crypto(hw,
+ offsetof(struct virtio_crypto_config, max_dataqueues),
+ &config->max_dataqueues,
+ sizeof(config->max_dataqueues));
+ hw->max_dataqueues =
+ (config->max_dataqueues > VIRTIO_MAX_DATA_QUEUES) ?
+ VIRTIO_MAX_DATA_QUEUES : config->max_dataqueues;
+
+ PMD_INIT_LOG(DEBUG, "config->max_dataqueues=%d",
+ config->max_dataqueues);
+ PMD_INIT_LOG(DEBUG, "config->status=%d", config->status);
+
+ PMD_INIT_LOG(DEBUG, "hw->max_dataqueues=%d",
+ hw->max_dataqueues);
+
+ /* setup and start control queue only */
+ if (virtio_crypto_cq_setup(cryptodev, config->max_dataqueues) < 0) {
+ PMD_INIT_LOG(ERR, "control queue setup error");
+ return -1;
+ }
+ virtio_crypto_cq_start(cryptodev);
+
+ return 0;
+}
+
+/*
+ * This function is based on probe() function
+ * It returns 0 on success.
+ */
+static int
+crypto_virtio_create(const char *name, struct rte_pci_device *pci_dev,
+ struct rte_cryptodev_pmd_init_params *init_params)
+{
+ struct rte_cryptodev *cryptodev;
+ struct virtio_crypto_hw *hw;
+
+ PMD_INIT_FUNC_TRACE();
+
+ cryptodev = rte_cryptodev_pmd_create(name, &pci_dev->device,
+ init_params);
+ if (cryptodev == NULL)
+ return -ENODEV;
+
+ cryptodev->driver_id = cryptodev_virtio_driver_id;
+ cryptodev->dev_ops = &virtio_crypto_dev_ops;
+
+ cryptodev->enqueue_burst = virtio_crypto_pkt_tx_burst;
+ cryptodev->dequeue_burst = virtio_crypto_pkt_rx_burst;
+
+ cryptodev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
+ RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING;
+
+ hw = cryptodev->data->dev_private;
+ hw->dev_id = cryptodev->data->dev_id;
+
+ PMD_INIT_LOG(DEBUG, "dev %d vendorID=0x%x deviceID=0x%x",
+ cryptodev->data->dev_id, pci_dev->id.vendor_id,
+ pci_dev->id.device_id);
+
+ /* init legacy or modern device */
+ if (vtpci_init_crypto(pci_dev, hw))
+ return -1;
+
+ /* reset device and negotiate default features */
+ if (virtio_crypto_init_device(cryptodev,
+ VIRTIO_CRYPTO_PMD_GUEST_FEATURES))
+ return -1;
+
+ return 0;
+}
+
+static int
+virtio_crypto_dev_uninit(struct rte_cryptodev *cryptodev)
+{
+ struct virtio_crypto_hw *hw = cryptodev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ return -EPERM;
+
+ if (cryptodev->data->dev_started) {
+ virtio_crypto_dev_stop(cryptodev);
+ virtio_crypto_dev_close(cryptodev);
+ }
+
+ cryptodev->dev_ops = NULL;
+ cryptodev->enqueue_burst = NULL;
+ cryptodev->dequeue_burst = NULL;
+
+ /* release control queue */
+ virtio_crypto_queue_release(hw->cvq);
+
+ rte_free(cryptodev->data);
+ cryptodev->data = NULL;
+
+ PMD_DRV_LOG(INFO, "dev_uninit completed");
+
+ return 0;
+}
+
+static int
+virtio_crypto_dev_configure(struct rte_cryptodev *dev __rte_unused,
+ struct rte_cryptodev_config *config __rte_unused)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ return 0;
+}
+
+static void
+virtio_crypto_dev_stop(struct rte_cryptodev *dev)
+{
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+ PMD_DRV_LOG(DEBUG, "virtio_dev_stop");
+
+ vtpci_reset_crypto(hw);
+
+ virtio_crypto_dev_free_mbufs(dev);
+ virtio_crypto_free_queues(dev);
+
+ dev->data->dev_started = 0;
+}
+
+static int
+virtio_crypto_dev_start(struct rte_cryptodev *dev)
+{
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ if (dev->data->dev_started)
+ return 0;
+
+ /* Do final configuration before queue engine starts */
+ virtio_crypto_dq_start(dev);
+ vtpci_reinit_complete_crypto(hw);
+
+ dev->data->dev_started = 1;
+
+ return 0;
+}
+
+static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev)
+{
+ uint32_t i;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ for (i = 0; i < hw->max_dataqueues; i++) {
+ PMD_INIT_LOG(DEBUG, "Before freeing dataq[%d] used "
+ "and unused buf", i);
+ VIRTQUEUE_DUMP((struct virtqueue *)
+ dev->data->queue_pairs[i]);
+
+ PMD_INIT_LOG(DEBUG, "queue_pairs[%d]=%p",
+ i, dev->data->queue_pairs[i]);
+
+ virtqueue_crypto_detatch_unused(dev->data->queue_pairs[i]);
+
+ PMD_INIT_LOG(DEBUG, "After freeing dataq[%d] used and "
+ "unused buf", i);
+ VIRTQUEUE_DUMP(
+ (struct virtqueue *)dev->data->queue_pairs[i]);
+ }
+}
+
+static unsigned virtio_crypto_sym_get_session_private_size(
+ struct rte_cryptodev *dev __rte_unused)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ return RTE_ALIGN_CEIL(sizeof(struct virtio_crypto_session), 8);
+}
+
+static int virtio_crypto_check_sym_session_paras(
+ struct rte_cryptodev *dev)
+{
+ struct virtio_crypto_hw *hw;
+ struct virtqueue *vq;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (unlikely(dev == NULL)) {
+ PMD_SESSION_LOG(ERR, "dev is NULL");
+ return -1;
+ }
+ if (unlikely(dev->data == NULL)) {
+ PMD_SESSION_LOG(ERR, "dev->data is NULL");
+ return -1;
+ }
+ hw = dev->data->dev_private;
+ if (unlikely(hw == NULL)) {
+ PMD_SESSION_LOG(ERR, "hw is NULL");
+ return -1;
+ }
+ vq = hw->cvq;
+ if (unlikely(vq == NULL)) {
+ PMD_SESSION_LOG(ERR, "vq is NULL");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int virtio_crypto_check_sym_clear_session_paras(
+ struct rte_cryptodev *dev,
+ struct rte_cryptodev_sym_session *sess)
+{
+ PMD_INIT_FUNC_TRACE();
+
+ if (sess == NULL) {
+ PMD_SESSION_LOG(ERR, "vq is NULL");
+ return -1;
+ }
+
+ return virtio_crypto_check_sym_session_paras(dev);
+}
+
+#define NUM_ENTRY_VIRTIO_CRYPTO_SYM_CLEAR_SESSION 2
+
+static void virtio_crypto_sym_clear_session(
+ struct rte_cryptodev *dev,
+ struct rte_cryptodev_sym_session *sess)
+{
+ struct virtio_crypto_hw *hw;
+ struct virtqueue *vq;
+ struct virtio_crypto_session *session;
+ struct virtio_crypto_op_ctrl_req *ctrl;
+ struct vring_desc *desc;
+ uint8_t *status;
+ uint8_t needed = 1;
+ uint32_t head;
+ uint8_t *malloc_addr;
+ uint64_t malloc_phys_addr;
+ uint8_t status_len = sizeof(struct virtio_crypto_inhdr);
+ uint32_t op_ctrl_req_len = sizeof(struct virtio_crypto_op_ctrl_req);
+ uint32_t desc_offset_len = op_ctrl_req_len + status_len;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (virtio_crypto_check_sym_clear_session_paras(dev, sess) < 0)
+ return;
+
+ hw = dev->data->dev_private;
+ vq = hw->cvq;
+ session = (struct virtio_crypto_session *)get_session_private_data(
+ sess, cryptodev_virtio_driver_id);
+
+ if (session == NULL) {
+ PMD_SESSION_LOG(ERR, "Invalid session parameter");
+ }
+
+ PMD_SESSION_LOG(INFO, "vq->vq_desc_head_idx = %d, "
+ "vq = %p", vq->vq_desc_head_idx, vq);
+
+ if (vq->vq_free_cnt < needed) {
+ PMD_SESSION_LOG(ERR,
+ "vq->vq_free_cnt = %d is less than %d, "
+ "not enough", vq->vq_free_cnt, needed);
+ return;
+ }
+
+ /*
+ * malloc memory to store information of ctrl request op,
+ * return status and desc vring
+ */
+ malloc_addr = rte_malloc(NULL, op_ctrl_req_len + status_len
+ + NUM_ENTRY_VIRTIO_CRYPTO_SYM_CLEAR_SESSION
+ * sizeof(struct vring_desc), RTE_CACHE_LINE_SIZE);
+ if (malloc_addr == NULL) {
+ PMD_SESSION_LOG(ERR, "not enough heap room");
+ return;
+ }
+ malloc_phys_addr = rte_malloc_virt2phy(malloc_addr);
+
+ /* assign ctrl request op part */
+ ctrl = (struct virtio_crypto_op_ctrl_req *)malloc_addr;
+ ctrl->header.opcode = VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION;
+ /* Set the default dataqueue id to 0 */
+ ctrl->header.queue_id = 0;
+ ctrl->u.destroy_session.session_id = session->session_id;
+
+ /* assign status part */
+ status = &(((struct virtio_crypto_inhdr *)
+ ((uint8_t *)malloc_addr + op_ctrl_req_len))->status);
+ *status = VIRTIO_CRYPTO_ERR;
+
+ /* assign indirect desc vring part */
+ desc = (struct vring_desc *)((uint8_t *)malloc_addr
+ + desc_offset_len);
+
+ /* ctrl request part */
+ desc[0].addr = malloc_phys_addr;
+ desc[0].len = op_ctrl_req_len;
+ desc[0].flags = VRING_DESC_F_NEXT;
+ desc[0].next = 1;
+
+ /* status part */
+ desc[1].addr = malloc_phys_addr + op_ctrl_req_len;
+ desc[1].len = status_len;
+ desc[1].flags = VRING_DESC_F_WRITE;
+
+ /* use only a single buffer */
+ head = vq->vq_desc_head_idx;
+ vq->vq_ring.desc[head].flags = VRING_DESC_F_INDIRECT;
+ vq->vq_ring.desc[head].addr = malloc_phys_addr + desc_offset_len;
+ vq->vq_ring.desc[head].len
+ = NUM_ENTRY_VIRTIO_CRYPTO_SYM_CLEAR_SESSION
+ * sizeof(struct vring_desc);
+
+ vq->vq_free_cnt -= needed;
+
+ vq->vq_desc_head_idx = vq->vq_ring.desc[head].next;
+
+ vq_crypto_update_avail_ring(vq, head);
+ vq_crypto_update_avail_idx(vq);
+
+ PMD_INIT_LOG(DEBUG, "vq->vq_queue_index = %d", vq->vq_queue_index);
+
+ virtqueue_crypto_notify(vq);
+
+ rte_rmb();
+ while (vq->vq_used_cons_idx == vq->vq_ring.used->idx) {
+ rte_rmb();
+ usleep(100);
+ }
+
+ while (vq->vq_used_cons_idx != vq->vq_ring.used->idx) {
+ uint32_t idx, desc_idx, used_idx;
+ struct vring_used_elem *uep;
+
+ used_idx = (uint32_t)(vq->vq_used_cons_idx
+ & (vq->vq_nentries - 1));
+ uep = &vq->vq_ring.used->ring[used_idx];
+ idx = (uint32_t) uep->id;
+ desc_idx = idx;
+ while (vq->vq_ring.desc[desc_idx].flags
+ & VRING_DESC_F_NEXT) {
+ desc_idx = vq->vq_ring.desc[desc_idx].next;
+ vq->vq_free_cnt++;
+ }
+
+ vq->vq_ring.desc[desc_idx].next = vq->vq_desc_head_idx;
+ vq->vq_desc_head_idx = idx;
+ vq->vq_used_cons_idx++;
+ vq->vq_free_cnt++;
+ }
+
+ if (*status != VIRTIO_CRYPTO_OK) {
+ PMD_SESSION_LOG(ERR, "Close session failed "
+ "status=%"PRIu32", session_id=%"PRIu64"",
+ *status, session->session_id);
+ rte_free(malloc_addr);
+ return;
+ }
+
+ PMD_INIT_LOG(DEBUG, "vq->vq_free_cnt=%d\nvq->vq_desc_head_idx=%d",
+ vq->vq_free_cnt, vq->vq_desc_head_idx);
+
+ PMD_SESSION_LOG(INFO, "Close session successfully "
+ "session_id=%"PRIu64"", session->session_id);
+
+ if (sess) {
+ memset(sess, 0, sizeof(struct virtio_crypto_session));
+ rte_free(malloc_addr);
+ }
+}
+
+static struct rte_crypto_cipher_xform *
+virtio_crypto_get_cipher_xform(struct rte_crypto_sym_xform *xform)
+{
+ do {
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER)
+ return &xform->cipher;
+
+ xform = xform->next;
+ } while (xform);
+
+ return NULL;
+}
+
+static struct rte_crypto_auth_xform *
+virtio_crypto_get_auth_xform(struct rte_crypto_sym_xform *xform)
+{
+ do {
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH)
+ return &xform->auth;
+
+ xform = xform->next;
+ } while (xform);
+
+ return NULL;
+}
+
+/** Get xform chain order */
+static int
+virtio_crypto_get_chain_order(struct rte_crypto_sym_xform *xform)
+{
+ if (xform == NULL)
+ return -1;
+
+ /* Cipher Only */
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER &&
+ xform->next == NULL)
+ return VIRTIO_CRYPTO_CMD_CIPHER;
+
+ /* Authentication Only */
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH &&
+ xform->next == NULL)
+ return VIRTIO_CRYPTO_CMD_AUTH;
+
+ /* Authenticate then Cipher */
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH &&
+ xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER)
+ return VIRTIO_CRYPTO_CMD_HASH_CIPHER;
+
+ /* Cipher then Authenticate */
+ if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER &&
+ xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH)
+ return VIRTIO_CRYPTO_CMD_CIPHER_HASH;
+
+ return -1;
+}
+
+static int virtio_crypto_sym_pad_cipher_param(struct virtio_crypto_cipher_session_para *para,
+ struct rte_crypto_cipher_xform *cipher_xform)
+{
+ switch (cipher_xform->algo) {
+ case RTE_CRYPTO_CIPHER_NULL:
+ para->algo = VIRTIO_CRYPTO_NO_CIPHER;
+ break;
+ case RTE_CRYPTO_CIPHER_3DES_CBC:
+ para->algo = VIRTIO_CRYPTO_CIPHER_3DES_CBC;
+ break;
+ case RTE_CRYPTO_CIPHER_3DES_CTR:
+ para->algo = VIRTIO_CRYPTO_CIPHER_3DES_CTR;
+ break;
+ case RTE_CRYPTO_CIPHER_3DES_ECB:
+ para->algo = VIRTIO_CRYPTO_CIPHER_3DES_ECB;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_CBC:
+ para->algo = VIRTIO_CRYPTO_CIPHER_AES_CBC;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_CTR:
+ para->algo = VIRTIO_CRYPTO_CIPHER_AES_CTR;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_ECB:
+ para->algo = VIRTIO_CRYPTO_CIPHER_AES_ECB;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_F8:
+ para->algo = VIRTIO_CRYPTO_CIPHER_AES_F8;
+ break;
+ case RTE_CRYPTO_CIPHER_AES_XTS:
+ para->algo = VIRTIO_CRYPTO_CIPHER_AES_XTS;
+ break;
+ case RTE_CRYPTO_CIPHER_ARC4:
+ para->algo = VIRTIO_CRYPTO_CIPHER_ARC4;
+ break;
+ case RTE_CRYPTO_CIPHER_KASUMI_F8:
+ para->algo = VIRTIO_CRYPTO_CIPHER_KASUMI_F8;
+ break;
+ case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
+ para->algo = VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2;
+ break;
+ case RTE_CRYPTO_CIPHER_ZUC_EEA3:
+ para->algo = VIRTIO_CRYPTO_CIPHER_ZUC_EEA3;
+ break;
+ case RTE_CRYPTO_CIPHER_DES_CBC:
+ para->algo = VIRTIO_CRYPTO_CIPHER_DES_CBC;
+ break;
+ default:
+ PMD_SESSION_LOG(ERR, "Crypto: Unsupported Cipher alg %u",
+ cipher_xform->algo);
+ return -1;
+ }
+
+ para->keylen = cipher_xform->key.length;
+ switch (cipher_xform->op) {
+ case RTE_CRYPTO_CIPHER_OP_ENCRYPT:
+ para->op = VIRTIO_CRYPTO_OP_ENCRYPT;
+ break;
+ case RTE_CRYPTO_CIPHER_OP_DECRYPT:
+ para->op = VIRTIO_CRYPTO_OP_DECRYPT;
+ break;
+ default:
+ PMD_SESSION_LOG(ERR, "Unsupported cipher operation parameter");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int virtio_crypto_sym_pad_auth_param(
+ struct virtio_crypto_op_ctrl_req *ctrl,
+ struct rte_crypto_auth_xform *auth_xform)
+{
+ uint32_t *algo;
+
+ switch (ctrl->u.sym_create_session.u.chain.para.hash_mode) {
+ case VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN:
+ algo = &ctrl->u.sym_create_session.u.chain.para.u.hash_param.algo;
+ break;
+ case VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH:
+ algo = &ctrl->u.sym_create_session.u.chain.para.u.mac_param.algo;
+ break;
+ default:
+ PMD_SESSION_LOG(ERR, "Unsupported hash mode %u specified",
+ ctrl->u.sym_create_session.u.chain.para.hash_mode);
+ return -1;
+ }
+
+ switch (auth_xform->algo) {
+ case RTE_CRYPTO_AUTH_NULL:
+ *algo = VIRTIO_CRYPTO_NO_MAC;
+ break;
+ case RTE_CRYPTO_AUTH_AES_CBC_MAC:
+ *algo = VIRTIO_CRYPTO_MAC_CBCMAC_AES;
+ break;
+ case RTE_CRYPTO_AUTH_AES_CMAC:
+ *algo = VIRTIO_CRYPTO_MAC_CMAC_AES;
+ break;
+ case RTE_CRYPTO_AUTH_AES_GMAC:
+ *algo = VIRTIO_CRYPTO_MAC_GMAC_AES;
+ break;
+ case RTE_CRYPTO_AUTH_AES_XCBC_MAC:
+ *algo = VIRTIO_CRYPTO_MAC_XCBC_AES;
+ break;
+ case RTE_CRYPTO_AUTH_KASUMI_F9:
+ *algo = VIRTIO_CRYPTO_MAC_KASUMI_F9;
+ break;
+ case RTE_CRYPTO_AUTH_MD5:
+ *algo = VIRTIO_CRYPTO_HASH_MD5;
+ break;
+ case RTE_CRYPTO_AUTH_MD5_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_MD5;
+ break;
+ case RTE_CRYPTO_AUTH_SHA1:
+ *algo = VIRTIO_CRYPTO_HASH_SHA1;
+ break;
+ case RTE_CRYPTO_AUTH_SHA1_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA1;
+ break;
+ case RTE_CRYPTO_AUTH_SHA224:
+ *algo = VIRTIO_CRYPTO_HASH_SHA_224;
+ break;
+ case RTE_CRYPTO_AUTH_SHA224_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA_224;
+ break;
+ case RTE_CRYPTO_AUTH_SHA256:
+ *algo = VIRTIO_CRYPTO_HASH_SHA_256;
+ break;
+ case RTE_CRYPTO_AUTH_SHA256_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA_256;
+ break;
+ case RTE_CRYPTO_AUTH_SHA384:
+ *algo = VIRTIO_CRYPTO_HASH_SHA_384;
+ break;
+ case RTE_CRYPTO_AUTH_SHA384_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA_384;
+ break;
+ case RTE_CRYPTO_AUTH_SHA512:
+ *algo = VIRTIO_CRYPTO_HASH_SHA_512;
+ break;
+ case RTE_CRYPTO_AUTH_SHA512_HMAC:
+ *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA_512;
+ break;
+ case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
+ *algo = VIRTIO_CRYPTO_MAC_SNOW3G_UIA2;
+ break;
+ default:
+ PMD_SESSION_LOG(ERR,
+ "Crypto: Undefined Hash algo %u specified",
+ auth_xform->algo);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int virtio_crypto_sym_pad_op_ctrl_req(
+ struct virtio_crypto_op_ctrl_req *ctrl,
+ struct rte_crypto_sym_xform *xform, bool is_chainned,
+ uint8_t **cipher_key_data, uint8_t **auth_key_data,
+ struct virtio_crypto_session *session)
+{
+ int ret;
+ struct rte_crypto_auth_xform *auth_xform = NULL;
+ struct rte_crypto_cipher_xform *cipher_xform = NULL;
+
+ if (ctrl == NULL) {
+ PMD_SESSION_LOG(ERR, "ctrl request is NULL");
+ return -1;
+ }
+
+ if (xform == NULL) {
+ PMD_SESSION_LOG(ERR, "xform is NULL");
+ return -1;
+ }
+
+ /* Get cipher xform from crypto xform chain */
+ cipher_xform = virtio_crypto_get_cipher_xform(xform);
+ if (cipher_xform) {
+ if (is_chainned)
+ ret = virtio_crypto_sym_pad_cipher_param(
+ &ctrl->u.sym_create_session.u.chain.para
+ .cipher_param, cipher_xform);
+ else
+ ret = virtio_crypto_sym_pad_cipher_param(
+ &ctrl->u.sym_create_session.u.cipher.para,
+ cipher_xform);
+
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR,
+ "pad cipher parameter failed");
+ return -1;
+ }
+
+ *cipher_key_data = cipher_xform->key.data;
+
+ session->iv.offset = cipher_xform->iv.offset;
+ session->iv.length = cipher_xform->iv.length;
+ }
+
+ /* Get auth xform from crypto xform chain */
+ auth_xform = virtio_crypto_get_auth_xform(xform);
+ if (auth_xform) {
+ /* FIXME: support VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED */
+ if (auth_xform->key.length) {
+ ctrl->u.sym_create_session.u.chain.para.hash_mode
+ = VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH;
+ ctrl->u.sym_create_session.u.chain.para.u.mac_param.
+ auth_key_len = (uint32_t)auth_xform->key.length;
+ ctrl->u.sym_create_session.u.chain.para.u.mac_param.
+ hash_result_len = auth_xform->digest_length;
+
+ *auth_key_data = auth_xform->key.data;
+ } else {
+ ctrl->u.sym_create_session.u.chain.para.hash_mode
+ = VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN;
+ ctrl->u.sym_create_session.u.chain.para.u.hash_param.
+ hash_result_len = auth_xform->digest_length;
+ }
+
+ ret = virtio_crypto_sym_pad_auth_param(ctrl, auth_xform);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR, "pad auth parameter failed");
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int virtio_crypto_check_sym_configure_session_paras(
+ struct rte_cryptodev *dev,
+ struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sym_sess,
+ struct rte_mempool *mempool)
+{
+ if (unlikely(xform == NULL) || unlikely(sym_sess == NULL) ||
+ unlikely(mempool == NULL)) {
+ PMD_SESSION_LOG(ERR, "NULL pointer");
+ return -1;
+ }
+
+ if (virtio_crypto_check_sym_session_paras(dev) < 0)
+ return -1;
+
+ return 0;
+}
+
+static int virtio_crypto_sym_configure_session(
+ struct rte_cryptodev *dev,
+ struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess,
+ struct rte_mempool *mempool)
+{
+ void *session_private;
+ int ret;
+ uint8_t *cipher_key_data = NULL;
+ uint8_t *auth_key_data = NULL;
+ struct virtio_crypto_hw *hw;
+ struct virtqueue *vq;
+ struct virtio_crypto_session *session;
+ struct virtio_crypto_op_ctrl_req *ctrl;
+ enum virtio_crypto_cmd_id cmd_id;
+
+ PMD_INIT_FUNC_TRACE();
+
+ ret = virtio_crypto_check_sym_configure_session_paras(dev, xform,
+ sess, mempool);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR, "Invalid parameters");
+ return ret;
+ }
+
+ if (rte_mempool_get(mempool, &session_private)) {
+ PMD_SESSION_LOG(ERR,
+ "Couldn't get object from session mempool");
+ return -ENOMEM;
+ }
+
+ session = (struct virtio_crypto_session *)session_private;
+ ctrl = &session->ctrl;
+ memset(ctrl, 0, sizeof(struct virtio_crypto_op_ctrl_req));
+ ctrl->header.opcode = VIRTIO_CRYPTO_CIPHER_CREATE_SESSION;
+ /* FIXME: support multiqueue */
+ ctrl->header.queue_id = 0;
+
+ hw = dev->data->dev_private;
+ vq = hw->cvq;
+
+ cmd_id = virtio_crypto_get_chain_order(xform);
+ if (cmd_id == VIRTIO_CRYPTO_CMD_CIPHER_HASH)
+ ctrl->u.sym_create_session.u.chain.para.alg_chain_order
+ = VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH;
+ if (cmd_id == VIRTIO_CRYPTO_CMD_HASH_CIPHER)
+ ctrl->u.sym_create_session.u.chain.para.alg_chain_order
+ = VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER;
+
+ switch (cmd_id) {
+ case VIRTIO_CRYPTO_CMD_CIPHER_HASH:
+ case VIRTIO_CRYPTO_CMD_HASH_CIPHER:
+ ctrl->u.sym_create_session.op_type
+ = VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING;
+
+ ret = virtio_crypto_sym_pad_op_ctrl_req(ctrl,
+ xform, true, &cipher_key_data, &auth_key_data, session);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR,
+ "padding sym op ctrl req failed");
+ goto error_out;
+ }
+ ret = virtio_crypto_send_command(vq, ctrl,
+ cipher_key_data, auth_key_data, session);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR,
+ "create session failed: %d", ret);
+ goto error_out;
+ }
+ break;
+ case VIRTIO_CRYPTO_CMD_CIPHER:
+ ctrl->u.sym_create_session.op_type
+ = VIRTIO_CRYPTO_SYM_OP_CIPHER;
+ ret = virtio_crypto_sym_pad_op_ctrl_req(ctrl,
+ xform, false, &cipher_key_data, &auth_key_data, session);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR,
+ "padding sym op ctrl req failed");
+ goto error_out;
+ }
+ ret = virtio_crypto_send_command(vq, ctrl,
+ cipher_key_data, NULL, session);
+ if (ret < 0) {
+ PMD_SESSION_LOG(ERR,
+ "create session failed: %d", ret);
+ goto error_out;
+ }
+ break;
+ default:
+ PMD_SESSION_LOG(ERR,
+ "Unsupported operation chain order parameter");
+ goto error_out;
+ }
+
+ set_session_private_data(sess, dev->driver_id,
+ session_private);
+
+ return 0;
+
+error_out:
+ return -1;
+}
+
+static void
+virtio_crypto_dev_info_get(struct rte_cryptodev *dev,
+ struct rte_cryptodev_info *info)
+{
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (info != NULL) {
+ info->driver_id = cryptodev_virtio_driver_id;
+ info->pci_dev = RTE_DEV_TO_PCI(dev->device);
+ info->feature_flags = dev->feature_flags;
+ info->max_nb_queue_pairs = hw->max_dataqueues;
+ info->sym.max_nb_sessions = RTE_VIRTIO_CRYPTO_PMD_MAX_NB_SESSIONS;
+ }
+}
+
+static int crypto_virtio_pci_probe(
+ struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ struct rte_cryptodev_pmd_init_params init_params = {
+ .name = "",
+ .socket_id = rte_socket_id(),
+ .private_data_size = sizeof(struct virtio_crypto_hw),
+ .max_nb_sessions = RTE_VIRTIO_CRYPTO_PMD_MAX_NB_SESSIONS
+ };
+ char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+ PMD_DRV_LOG(DEBUG, "Found Crypto device at %02x:%02x.%x",
+ pci_dev->addr.bus,
+ pci_dev->addr.devid,
+ pci_dev->addr.function);
+
+ rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
+
+ return crypto_virtio_create(name, pci_dev, &init_params);
+}
+
+static int crypto_virtio_pci_remove(struct rte_pci_device *pci_dev)
+{
+ struct rte_cryptodev *cryptodev;
+ char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+ if (pci_dev == NULL)
+ return -EINVAL;
+
+ rte_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
+
+ cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
+ if (cryptodev == NULL)
+ return -ENODEV;
+
+ return virtio_crypto_dev_uninit(cryptodev);
+}
+
+static struct rte_pci_driver rte_virtio_crypto_driver = {
+ .id_table = pci_id_virtio_crypto_map,
+ .drv_flags = 0,
+ .probe = crypto_virtio_pci_probe,
+ .remove = crypto_virtio_pci_remove
+};
+
+static struct cryptodev_driver virtio_crypto_drv;
+
+RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_VIRTIO_SYM_PMD, rte_virtio_crypto_driver);
+RTE_PMD_REGISTER_CRYPTO_DRIVER(virtio_crypto_drv, rte_virtio_crypto_driver,
+ cryptodev_virtio_driver_id);
diff --git a/drivers/crypto/virtio/virtio_cryptodev.h b/drivers/crypto/virtio/virtio_cryptodev.h
new file mode 100644
index 0000000..5d22ab8
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_cryptodev.h
@@ -0,0 +1,87 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_CRYPTODEV_H_
+#define _VIRTIO_CRYPTODEV_H_
+
+#include "virtio_pci.h"
+#include "virtio_crypto.h"
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+#define CRYPTODEV_NAME_VIRTIO_SYM_PMD crypto_virtio
+
+#define VIRTIO_MAX_DATA_QUEUES 128
+
+/* Features desired/implemented by this driver. */
+#define VIRTIO_CRYPTO_PMD_GUEST_FEATURES (1ULL << VIRTIO_F_VERSION_1)
+
+extern uint8_t cryptodev_virtio_driver_id;
+
+enum virtio_crypto_cmd_id {
+ VIRTIO_CRYPTO_CMD_CIPHER = 0,
+ VIRTIO_CRYPTO_CMD_AUTH = 1,
+ VIRTIO_CRYPTO_CMD_CIPHER_HASH = 2,
+ VIRTIO_CRYPTO_CMD_HASH_CIPHER = 3
+};
+
+/*
+ * Control queue function prototype
+ */
+void virtio_crypto_cq_start(struct rte_cryptodev *dev);
+
+/*
+ * Data queue function prototype
+ */
+void virtio_crypto_dq_start(struct rte_cryptodev *dev);
+
+int virtio_crypto_queue_setup(struct rte_cryptodev *dev,
+ int queue_type,
+ uint16_t vtpci_queue_idx,
+ uint16_t nb_desc,
+ int socket_id,
+ struct virtqueue **pvq);
+
+void virtio_crypto_queue_release(struct virtqueue *vq);
+
+uint16_t virtio_crypto_pkt_tx_burst(void *tx_queue,
+ struct rte_crypto_op **tx_pkts,
+ uint16_t nb_pkts);
+
+uint16_t virtio_crypto_pkt_rx_burst(void *tx_queue,
+ struct rte_crypto_op **tx_pkts,
+ uint16_t nb_pkts);
+
+#endif /* _VIRTIO_CRYPTODEV_H_ */
diff --git a/drivers/crypto/virtio/virtio_logs.h b/drivers/crypto/virtio/virtio_logs.h
new file mode 100644
index 0000000..41c663d
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_logs.h
@@ -0,0 +1,76 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_LOGS_H_
+#define _VIRTIO_LOGS_H_
+
+#include <rte_log.h>
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_INIT
+#define PMD_INIT_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+#else
+#define PMD_INIT_LOG(level, fmt, args...) do { } while (0)
+#define PMD_INIT_FUNC_TRACE() do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_SESSION
+#define PMD_SESSION_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s() session: " fmt "\n", __func__, ## args)
+#else
+#define PMD_SESSION_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_RX
+#define PMD_RX_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_TX
+#define PMD_TX_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DRIVER
+#define PMD_DRV_LOG(level, fmt, args...) \
+ RTE_LOG(level, PMD, "%s(): driver " fmt "\n", __func__, ## args)
+#else
+#define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#endif /* _VIRTIO_LOGS_H_ */
\ No newline at end of file
diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
new file mode 100644
index 0000000..d594ea5
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -0,0 +1,714 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+
+#ifdef RTE_EXEC_ENV_LINUXAPP
+ #include <dirent.h>
+ #include <fcntl.h>
+#endif
+
+#include <rte_io.h>
+#include <rte_bus.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+#include "virtio_pci.h"
+#include "virtio_logs.h"
+#include "virtqueue.h"
+
+/*
+ * Following macros are derived from linux/pci_regs.h, however,
+ * we can't simply include that header here, as there is no such
+ * file for non-Linux platform.
+ */
+#define PCI_CAPABILITY_LIST 0x34
+#define PCI_CAP_ID_VNDR 0x09
+#define PCI_CAP_ID_MSIX 0x11
+
+/*
+ * The remaining space is defined by each driver as the per-driver
+ * configuration space.
+ */
+#define VIRTIO_PCI_CONFIG(hw) (((hw)->use_msix) ? 24 : 20)
+
+static inline int
+check_vq_phys_addr_ok(struct virtqueue *vq)
+{
+ /* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
+ * and only accepts 32 bit page frame number.
+ * Check if the allocated physical memory exceeds 16TB.
+ */
+ if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
+ (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+ PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * Since we are in legacy mode:
+ * http://ozlabs.org/~rusty/virtio-spec/virtio-0.9.5.pdf
+ *
+ * "Note that this is possible because while the virtio header is PCI (i.e.
+ * little) endian, the device-specific region is encoded in the native endian of
+ * the guest (where such distinction is applicable)."
+ *
+ * For powerpc which supports both, qemu supposes that cpu is big endian and
+ * enforces this for the virtio-net stuff.
+ */
+static void
+legacy_read_dev_config(struct virtio_crypto_hw *hw, size_t offset,
+ void *dst, int length)
+{
+#ifdef RTE_ARCH_PPC_64
+ int size;
+
+ while (length > 0) {
+ if (length >= 4) {
+ size = 4;
+ rte_pci_ioport_read(VTPCI_IO(hw), dst, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ *(uint32_t *)dst = rte_be_to_cpu_32(*(uint32_t *)dst);
+ } else if (length >= 2) {
+ size = 2;
+ rte_pci_ioport_read(VTPCI_IO(hw), dst, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ *(uint16_t *)dst = rte_be_to_cpu_16(*(uint16_t *)dst);
+ } else {
+ size = 1;
+ rte_pci_ioport_read(VTPCI_IO(hw), dst, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ }
+
+ dst = (char *)dst + size;
+ offset += size;
+ length -= size;
+ }
+#else
+ rte_pci_ioport_read(VTPCI_IO(hw), dst, length,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+#endif
+}
+
+static void
+legacy_write_dev_config(struct virtio_crypto_hw *hw, size_t offset,
+ const void *src, int length)
+{
+#ifdef RTE_ARCH_PPC_64
+ union {
+ uint32_t u32;
+ uint16_t u16;
+ } tmp;
+ int size;
+
+ while (length > 0) {
+ if (length >= 4) {
+ size = 4;
+ tmp.u32 = rte_cpu_to_be_32(*(const uint32_t *)src);
+ rte_pci_ioport_write(VTPCI_IO(hw), &tmp.u32, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ } else if (length >= 2) {
+ size = 2;
+ tmp.u16 = rte_cpu_to_be_16(*(const uint16_t *)src);
+ rte_pci_ioport_write(VTPCI_IO(hw), &tmp.u16, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ } else {
+ size = 1;
+ rte_pci_ioport_write(VTPCI_IO(hw), src, size,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+ }
+
+ src = (const char *)src + size;
+ offset += size;
+ length -= size;
+ }
+#else
+ rte_pci_ioport_write(VTPCI_IO(hw), src, length,
+ VIRTIO_PCI_CONFIG(hw) + offset);
+#endif
+}
+
+static uint64_t
+legacy_get_features(struct virtio_crypto_hw *hw)
+{
+ uint32_t dst;
+
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 4, VIRTIO_PCI_HOST_FEATURES);
+ return dst;
+}
+
+static void
+legacy_set_features(struct virtio_crypto_hw *hw, uint64_t features)
+{
+ if ((features >> 32) != 0) {
+ PMD_DRV_LOG(ERR,
+ "only 32 bit features are allowed for legacy virtio!");
+ return;
+ }
+ rte_pci_ioport_write(VTPCI_IO(hw), &features, 4,
+ VIRTIO_PCI_GUEST_FEATURES);
+}
+
+static uint8_t
+legacy_get_status(struct virtio_crypto_hw *hw)
+{
+ uint8_t dst;
+
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 1, VIRTIO_PCI_STATUS);
+ return dst;
+}
+
+static void
+legacy_set_status(struct virtio_crypto_hw *hw, uint8_t status)
+{
+ rte_pci_ioport_write(VTPCI_IO(hw), &status, 1, VIRTIO_PCI_STATUS);
+}
+
+static void
+legacy_reset(struct virtio_crypto_hw *hw)
+{
+ legacy_set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
+}
+
+static uint8_t
+legacy_get_isr(struct virtio_crypto_hw *hw)
+{
+ uint8_t dst;
+
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 1, VIRTIO_PCI_ISR);
+ return dst;
+}
+
+/* Enable one vector (0) for Link State Intrerrupt */
+static uint16_t
+legacy_set_config_irq(struct virtio_crypto_hw *hw, uint16_t vec)
+{
+ uint16_t dst;
+
+ rte_pci_ioport_write(VTPCI_IO(hw), &vec, 2, VIRTIO_MSI_CONFIG_VECTOR);
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 2, VIRTIO_MSI_CONFIG_VECTOR);
+ return dst;
+}
+
+static uint16_t
+legacy_set_queue_irq(struct virtio_crypto_hw *hw, struct virtqueue *vq, uint16_t vec)
+{
+ uint16_t dst;
+
+ rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
+ VIRTIO_PCI_QUEUE_SEL);
+ rte_pci_ioport_write(VTPCI_IO(hw), &vec, 2, VIRTIO_MSI_QUEUE_VECTOR);
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 2, VIRTIO_MSI_QUEUE_VECTOR);
+ return dst;
+}
+
+static uint16_t
+legacy_get_queue_num(struct virtio_crypto_hw *hw, uint16_t queue_id)
+{
+ uint16_t dst;
+
+ rte_pci_ioport_write(VTPCI_IO(hw), &queue_id, 2, VIRTIO_PCI_QUEUE_SEL);
+ rte_pci_ioport_read(VTPCI_IO(hw), &dst, 2, VIRTIO_PCI_QUEUE_NUM);
+ return dst;
+}
+
+static int
+legacy_setup_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq)
+{
+ uint32_t src;
+
+ if (!check_vq_phys_addr_ok(vq))
+ return -1;
+
+ rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
+ VIRTIO_PCI_QUEUE_SEL);
+ src = vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT;
+ rte_pci_ioport_write(VTPCI_IO(hw), &src, 4, VIRTIO_PCI_QUEUE_PFN);
+
+ return 0;
+}
+
+static void
+legacy_del_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq)
+{
+ uint32_t src = 0;
+
+ rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
+ VIRTIO_PCI_QUEUE_SEL);
+ rte_pci_ioport_write(VTPCI_IO(hw), &src, 4, VIRTIO_PCI_QUEUE_PFN);
+}
+
+static void
+legacy_notify_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq)
+{
+ rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
+ VIRTIO_PCI_QUEUE_NOTIFY);
+}
+
+const struct virtio_pci_ops legacy_ops_crypto = {
+ .read_dev_cfg = legacy_read_dev_config,
+ .write_dev_cfg = legacy_write_dev_config,
+ .reset = legacy_reset,
+ .get_status = legacy_get_status,
+ .set_status = legacy_set_status,
+ .get_features = legacy_get_features,
+ .set_features = legacy_set_features,
+ .get_isr = legacy_get_isr,
+ .set_config_irq = legacy_set_config_irq,
+ .set_queue_irq = legacy_set_queue_irq,
+ .get_queue_num = legacy_get_queue_num,
+ .setup_queue = legacy_setup_queue,
+ .del_queue = legacy_del_queue,
+ .notify_queue = legacy_notify_queue,
+};
+
+static inline void
+io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi)
+{
+ rte_write32(val & ((1ULL << 32) - 1), lo);
+ rte_write32(val >> 32, hi);
+}
+
+static void
+modern_read_dev_config(struct virtio_crypto_hw *hw, size_t offset,
+ void *dst, int length)
+{
+ int i;
+ uint8_t *p;
+ uint8_t old_gen, new_gen;
+
+ do {
+ old_gen = rte_read8(&hw->common_cfg->config_generation);
+
+ p = dst;
+ for (i = 0; i < length; i++)
+ *p++ = rte_read8((uint8_t *)hw->dev_cfg + offset + i);
+
+ new_gen = rte_read8(&hw->common_cfg->config_generation);
+ } while (old_gen != new_gen);
+}
+
+static void
+modern_write_dev_config(struct virtio_crypto_hw *hw, size_t offset,
+ const void *src, int length)
+{
+ int i;
+ const uint8_t *p = src;
+
+ for (i = 0; i < length; i++)
+ rte_write8((*p++), (((uint8_t *)hw->dev_cfg) + offset + i));
+}
+
+static uint64_t
+modern_get_features(struct virtio_crypto_hw *hw)
+{
+ uint32_t features_lo, features_hi;
+
+ rte_write32(0, &hw->common_cfg->device_feature_select);
+ features_lo = rte_read32(&hw->common_cfg->device_feature);
+
+ rte_write32(1, &hw->common_cfg->device_feature_select);
+ features_hi = rte_read32(&hw->common_cfg->device_feature);
+
+ return ((uint64_t)features_hi << 32) | features_lo;
+}
+
+static void
+modern_set_features(struct virtio_crypto_hw *hw, uint64_t features)
+{
+ rte_write32(0, &hw->common_cfg->guest_feature_select);
+ rte_write32(features & ((1ULL << 32) - 1),
+ &hw->common_cfg->guest_feature);
+
+ rte_write32(1, &hw->common_cfg->guest_feature_select);
+ rte_write32(features >> 32,
+ &hw->common_cfg->guest_feature);
+}
+
+static uint8_t
+modern_get_status(struct virtio_crypto_hw *hw)
+{
+ return rte_read8(&hw->common_cfg->device_status);
+}
+
+static void
+modern_set_status(struct virtio_crypto_hw *hw, uint8_t status)
+{
+ rte_write8(status, &hw->common_cfg->device_status);
+}
+
+static void
+modern_reset(struct virtio_crypto_hw *hw)
+{
+ modern_set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
+ modern_get_status(hw);
+}
+
+static uint8_t
+modern_get_isr(struct virtio_crypto_hw *hw)
+{
+ return rte_read8(hw->isr);
+}
+
+static uint16_t
+modern_set_config_irq(struct virtio_crypto_hw *hw, uint16_t vec)
+{
+ rte_write16(vec, &hw->common_cfg->msix_config);
+ return rte_read16(&hw->common_cfg->msix_config);
+}
+
+static uint16_t
+modern_set_queue_irq(struct virtio_crypto_hw *hw, struct virtqueue *vq, uint16_t vec)
+{
+ rte_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
+ rte_write16(vec, &hw->common_cfg->queue_msix_vector);
+ return rte_read16(&hw->common_cfg->queue_msix_vector);
+}
+
+static uint16_t
+modern_get_queue_num(struct virtio_crypto_hw *hw, uint16_t queue_id)
+{
+ rte_write16(queue_id, &hw->common_cfg->queue_select);
+ return rte_read16(&hw->common_cfg->queue_size);
+}
+
+static int
+modern_setup_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq)
+{
+ uint64_t desc_addr, avail_addr, used_addr;
+ uint16_t notify_off;
+
+ if (!check_vq_phys_addr_ok(vq))
+ return -1;
+
+ desc_addr = vq->vq_ring_mem;
+ avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
+ used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail,
+ ring[vq->vq_nentries]),
+ VIRTIO_PCI_VRING_ALIGN);
+
+ rte_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
+
+ io_write64_twopart(desc_addr, &hw->common_cfg->queue_desc_lo,
+ &hw->common_cfg->queue_desc_hi);
+ io_write64_twopart(avail_addr, &hw->common_cfg->queue_avail_lo,
+ &hw->common_cfg->queue_avail_hi);
+ io_write64_twopart(used_addr, &hw->common_cfg->queue_used_lo,
+ &hw->common_cfg->queue_used_hi);
+
+ notify_off = rte_read16(&hw->common_cfg->queue_notify_off);
+ vq->notify_addr = (void *)((uint8_t *)hw->notify_base +
+ notify_off * hw->notify_off_multiplier);
+
+ rte_write16(1, &hw->common_cfg->queue_enable);
+
+ PMD_INIT_LOG(DEBUG, "queue %u addresses:", vq->vq_queue_index);
+ PMD_INIT_LOG(DEBUG, "\t desc_addr: %" PRIx64, desc_addr);
+ PMD_INIT_LOG(DEBUG, "\t aval_addr: %" PRIx64, avail_addr);
+ PMD_INIT_LOG(DEBUG, "\t used_addr: %" PRIx64, used_addr);
+ PMD_INIT_LOG(DEBUG, "\t notify addr: %p (notify offset: %u)",
+ vq->notify_addr, notify_off);
+
+ return 0;
+}
+
+static void
+modern_del_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq)
+{
+ rte_write16(vq->vq_queue_index, &hw->common_cfg->queue_select);
+
+ io_write64_twopart(0, &hw->common_cfg->queue_desc_lo,
+ &hw->common_cfg->queue_desc_hi);
+ io_write64_twopart(0, &hw->common_cfg->queue_avail_lo,
+ &hw->common_cfg->queue_avail_hi);
+ io_write64_twopart(0, &hw->common_cfg->queue_used_lo,
+ &hw->common_cfg->queue_used_hi);
+
+ rte_write16(0, &hw->common_cfg->queue_enable);
+}
+
+static void
+modern_notify_queue(struct virtio_crypto_hw *hw __rte_unused, struct virtqueue *vq)
+{
+ rte_write16(vq->vq_queue_index, vq->notify_addr);
+}
+
+const struct virtio_pci_ops modern_ops_crypto = {
+ .read_dev_cfg = modern_read_dev_config,
+ .write_dev_cfg = modern_write_dev_config,
+ .reset = modern_reset,
+ .get_status = modern_get_status,
+ .set_status = modern_set_status,
+ .get_features = modern_get_features,
+ .set_features = modern_set_features,
+ .get_isr = modern_get_isr,
+ .set_config_irq = modern_set_config_irq,
+ .set_queue_irq = modern_set_queue_irq,
+ .get_queue_num = modern_get_queue_num,
+ .setup_queue = modern_setup_queue,
+ .del_queue = modern_del_queue,
+ .notify_queue = modern_notify_queue,
+};
+
+void
+vtpci_read_dev_config_crypto(struct virtio_crypto_hw *hw, size_t offset,
+ void *dst, int length)
+{
+ VTPCI_OPS(hw)->read_dev_cfg(hw, offset, dst, length);
+}
+
+void
+vtpci_write_dev_config_crypto(struct virtio_crypto_hw *hw, size_t offset,
+ const void *src, int length)
+{
+ VTPCI_OPS(hw)->write_dev_cfg(hw, offset, src, length);
+}
+
+uint64_t
+vtpci_negotiate_features_crypto(struct virtio_crypto_hw *hw, uint64_t host_features)
+{
+ uint64_t features;
+
+ /*
+ * Limit negotiated features to what the driver, virtqueue, and
+ * host all support.
+ */
+ features = host_features & hw->guest_features;
+ VTPCI_OPS(hw)->set_features(hw, features);
+
+ return features;
+}
+
+void
+vtpci_reset_crypto(struct virtio_crypto_hw *hw)
+{
+ VTPCI_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
+ /* flush status write */
+ VTPCI_OPS(hw)->get_status(hw);
+}
+
+void
+vtpci_reinit_complete_crypto(struct virtio_crypto_hw *hw)
+{
+ vtpci_set_status_crypto(hw, VIRTIO_CONFIG_STATUS_DRIVER_OK);
+}
+
+void
+vtpci_set_status_crypto(struct virtio_crypto_hw *hw, uint8_t status)
+{
+ if (status != VIRTIO_CONFIG_STATUS_RESET)
+ status |= VTPCI_OPS(hw)->get_status(hw);
+
+ VTPCI_OPS(hw)->set_status(hw, status);
+}
+
+uint8_t
+vtpci_get_status_crypto(struct virtio_crypto_hw *hw)
+{
+ return VTPCI_OPS(hw)->get_status(hw);
+}
+
+uint8_t
+vtpci_isr_crypto(struct virtio_crypto_hw *hw)
+{
+ return VTPCI_OPS(hw)->get_isr(hw);
+}
+
+static void *
+get_cfg_addr(struct rte_pci_device *dev, struct virtio_pci_cap *cap)
+{
+ uint8_t bar = cap->bar;
+ uint32_t length = cap->length;
+ uint32_t offset = cap->offset;
+ uint8_t *base;
+
+ if (bar >= PCI_MAX_RESOURCE) {
+ PMD_INIT_LOG(ERR, "invalid bar: %u", bar);
+ return NULL;
+ }
+
+ if (offset + length < offset) {
+ PMD_INIT_LOG(ERR, "offset(%u) + length(%u) overflows",
+ offset, length);
+ return NULL;
+ }
+
+ if (offset + length > dev->mem_resource[bar].len) {
+ PMD_INIT_LOG(ERR,
+ "invalid cap: overflows bar space: %u > %" PRIu64,
+ offset + length, dev->mem_resource[bar].len);
+ return NULL;
+ }
+
+ base = dev->mem_resource[bar].addr;
+ if (base == NULL) {
+ PMD_INIT_LOG(ERR, "bar %u base addr is NULL", bar);
+ return NULL;
+ }
+
+ return base + offset;
+}
+
+#define PCI_MSIX_ENABLE 0x8000
+
+static int
+virtio_read_caps(struct rte_pci_device *dev, struct virtio_crypto_hw *hw)
+{
+ uint8_t pos;
+ struct virtio_pci_cap cap;
+ int ret;
+
+ if (rte_pci_map_device(dev)) {
+ PMD_INIT_LOG(DEBUG, "failed to map pci device!");
+ return -1;
+ }
+
+ ret = rte_pci_read_config(dev, &pos, 1, PCI_CAPABILITY_LIST);
+ if (ret < 0) {
+ PMD_INIT_LOG(DEBUG, "failed to read pci capability list");
+ return -1;
+ }
+
+ while (pos) {
+ ret = rte_pci_read_config(dev, &cap, sizeof(cap), pos);
+ if (ret < 0) {
+ PMD_INIT_LOG(ERR,
+ "failed to read pci cap at pos: %x", pos);
+ break;
+ }
+
+ if (cap.cap_vndr == PCI_CAP_ID_MSIX) {
+ /* Transitional devices would also have this capability,
+ * that's why we also check if msix is enabled.
+ * 1st byte is cap ID; 2nd byte is the position of next
+ * cap; next two bytes are the flags.
+ */
+ uint16_t flags = ((uint16_t *)&cap)[1];
+
+ if (flags & PCI_MSIX_ENABLE)
+ hw->use_msix = 1;
+ }
+
+ if (cap.cap_vndr != PCI_CAP_ID_VNDR) {
+ PMD_INIT_LOG(DEBUG,
+ "[%2x] skipping non VNDR cap id: %02x",
+ pos, cap.cap_vndr);
+ goto next;
+ }
+
+ PMD_INIT_LOG(DEBUG,
+ "[%2x] cfg type: %u, bar: %u, offset: %04x, len: %u",
+ pos, cap.cfg_type, cap.bar, cap.offset, cap.length);
+
+ switch (cap.cfg_type) {
+ case VIRTIO_PCI_CAP_COMMON_CFG:
+ hw->common_cfg = get_cfg_addr(dev, &cap);
+ break;
+ case VIRTIO_PCI_CAP_NOTIFY_CFG:
+ rte_pci_read_config(dev, &hw->notify_off_multiplier,
+ 4, pos + sizeof(cap));
+ hw->notify_base = get_cfg_addr(dev, &cap);
+ break;
+ case VIRTIO_PCI_CAP_DEVICE_CFG:
+ hw->dev_cfg = get_cfg_addr(dev, &cap);
+ break;
+ case VIRTIO_PCI_CAP_ISR_CFG:
+ hw->isr = get_cfg_addr(dev, &cap);
+ break;
+ }
+
+next:
+ pos = cap.cap_next;
+ }
+
+ if (hw->common_cfg == NULL || hw->notify_base == NULL ||
+ hw->dev_cfg == NULL || hw->isr == NULL) {
+ PMD_INIT_LOG(INFO, "no modern virtio pci device found.");
+ return -1;
+ }
+
+ PMD_INIT_LOG(INFO, "found modern virtio pci device.");
+
+ PMD_INIT_LOG(DEBUG, "common cfg mapped at: %p", hw->common_cfg);
+ PMD_INIT_LOG(DEBUG, "device cfg mapped at: %p", hw->dev_cfg);
+ PMD_INIT_LOG(DEBUG, "isr cfg mapped at: %p", hw->isr);
+ PMD_INIT_LOG(DEBUG, "notify base: %p, notify off multiplier: %u",
+ hw->notify_base, hw->notify_off_multiplier);
+
+ return 0;
+}
+
+/*
+ * Return -1:
+ * if there is error mapping with VFIO/UIO.
+ * if port map error when driver type is KDRV_NONE.
+ * if whitelisted but driver type is KDRV_UNKNOWN.
+ * Return 1 if kernel driver is managing the device.
+ * Return 0 on success.
+ */
+int
+vtpci_init_crypto(struct rte_pci_device *dev, struct virtio_crypto_hw *hw)
+{
+ /*
+ * Try if we can succeed reading virtio pci caps, which exists
+ * only on modern pci device. If failed, we fallback to legacy
+ * virtio handling.
+ */
+ if (virtio_read_caps(dev, hw) == 0) {
+ PMD_INIT_LOG(INFO, "modern virtio pci detected.");
+ virtio_hw_internal[hw->dev_id].vtpci_ops = &modern_ops_crypto;
+ hw->modern = 1;
+ return 0;
+ }
+
+ PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
+ if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
+ if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+ (!dev->device.devargs ||
+ dev->device.devargs->bus !=
+ rte_bus_find_by_name("pci"))) {
+ PMD_INIT_LOG(INFO,
+ "skip kernel managed virtio device.");
+ return -1;
+ }
+ return -1;
+ }
+
+ virtio_hw_internal[hw->dev_id].vtpci_ops = &legacy_ops_crypto;
+ hw->modern = 0;
+
+ return 0;
+}
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
new file mode 100644
index 0000000..888a4c2
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -0,0 +1,286 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_PCI_H_
+#define _VIRTIO_PCI_H_
+
+#include <stdint.h>
+
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <machine/cpufunc.h>
+#else
+#include <sys/io.h>
+#endif
+
+#include <rte_cryptodev.h>
+#include <rte_bus_pci.h>
+
+struct virtqueue;
+
+/* VirtIO PCI vendor/device ID. */
+#define VIRTIO_CRYPTO_PCI_VENDORID 0x1AF4
+#define VIRTIO_CRYPTO_PCI_LEGACY_DEVICEID 0x1014
+#define VIRTIO_CRYPTO_PCI_MODERN_DEVICEID 0x1054
+
+/* VirtIO ABI version, this must match exactly. */
+#define VIRTIO_PCI_ABI_VERSION 0
+
+/*
+ * VirtIO Header, located in BAR 0.
+ */
+#define VIRTIO_PCI_HOST_FEATURES 0 /* host's supported features (32bit, RO)*/
+#define VIRTIO_PCI_GUEST_FEATURES 4 /* guest's supported features (32, RW) */
+#define VIRTIO_PCI_QUEUE_PFN 8 /* physical address of VQ (32, RW) */
+#define VIRTIO_PCI_QUEUE_NUM 12 /* number of ring entries (16, RO) */
+#define VIRTIO_PCI_QUEUE_SEL 14 /* current VQ selection (16, RW) */
+#define VIRTIO_PCI_QUEUE_NOTIFY 16 /* notify host regarding VQ (16, RW) */
+#define VIRTIO_PCI_STATUS 18 /* device status register (8, RW) */
+/* interrupt status register, reading also clears the register (8, RO) */
+#define VIRTIO_PCI_ISR 19
+/* Only if MSIX is enabled: */
+#define VIRTIO_MSI_CONFIG_VECTOR 20 /* configuration change vector (16, RW) */
+/* vector for selected VQ notifications (16, RW) */
+#define VIRTIO_MSI_QUEUE_VECTOR 22
+
+/* The bit of the ISR which indicates a device has an interrupt. */
+#define VIRTIO_PCI_ISR_INTR 0x1
+/* The bit of the ISR which indicates a device configuration change. */
+#define VIRTIO_PCI_ISR_CONFIG 0x2
+/* Vector value used to disable MSI for queue. */
+#define VIRTIO_MSI_NO_VECTOR 0xFFFF
+
+/* Status byte for guest to report progress. */
+#define VIRTIO_CONFIG_STATUS_RESET 0x00
+#define VIRTIO_CONFIG_STATUS_ACK 0x01
+#define VIRTIO_CONFIG_STATUS_DRIVER 0x02
+#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
+#define VIRTIO_CONFIG_STATUS_FEATURES_OK 0x08
+#define VIRTIO_CONFIG_STATUS_FAILED 0x80
+
+/*
+ * Each virtqueue indirect descriptor list must be physically contiguous.
+ * To allow us to malloc(9) each list individually, limit the number
+ * supported to what will fit in one page. With 4KB pages, this is a limit
+ * of 256 descriptors. If there is ever a need for more, we can switch to
+ * contigmalloc(9) for the larger allocations, similar to what
+ * bus_dmamem_alloc(9) does.
+ *
+ * Note the sizeof(struct vring_desc) is 16 bytes.
+ */
+#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
+
+/* The feature bitmap for virtio crypto */
+
+/* virtio_crypto_config.status available */
+#define VIRTIO_CRYPTO_F_STATUS 0
+/* Device supports Receive Flow Steering */
+#define VIRTIO_CRYPTO_F_MQ 1
+
+/*
+ * Do we get callbacks when the ring is completely used, even if we've
+ * suppressed them?
+ */
+#define VIRTIO_F_NOTIFY_ON_EMPTY 24
+
+/* Can the device handle any descriptor layout? */
+#define VIRTIO_F_ANY_LAYOUT 27
+
+/* We support indirect buffer descriptors */
+#define VIRTIO_RING_F_INDIRECT_DESC 28
+
+#define VIRTIO_F_VERSION_1 32
+#define VIRTIO_F_IOMMU_PLATFORM 33
+
+/*
+ * The Guest publishes the used index for which it expects an interrupt
+ * at the end of the avail ring. Host should ignore the avail->flags field.
+ */
+/*
+ * The Host publishes the avail index for which it expects a kick
+ * at the end of the used ring. Guest should ignore the used->flags field.
+ */
+#define VIRTIO_RING_F_EVENT_IDX 29
+
+/*
+ * Maximum number of virtqueues per device.
+ */
+#define VIRTIO_MAX_VIRTQUEUES_PAIRS 8
+
+/* Common configuration */
+#define VIRTIO_PCI_CAP_COMMON_CFG 1
+/* Notifications */
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2
+/* ISR Status */
+#define VIRTIO_PCI_CAP_ISR_CFG 3
+/* Device specific configuration */
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4
+/* PCI configuration access */
+#define VIRTIO_PCI_CAP_PCI_CFG 5
+
+/* This is the PCI capability header: */
+struct virtio_pci_cap {
+ uint8_t cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */
+ uint8_t cap_next; /* Generic PCI field: next ptr. */
+ uint8_t cap_len; /* Generic PCI field: capability length */
+ uint8_t cfg_type; /* Identifies the structure. */
+ uint8_t bar; /* Where to find it. */
+ uint8_t padding[3]; /* Pad to full dword. */
+ uint32_t offset; /* Offset within bar. */
+ uint32_t length; /* Length of the structure, in bytes. */
+};
+
+struct virtio_pci_notify_cap {
+ struct virtio_pci_cap cap;
+ uint32_t notify_off_multiplier; /* Multiplier for queue_notify_off. */
+};
+
+/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
+struct virtio_pci_common_cfg {
+ /* About the whole device. */
+ uint32_t device_feature_select; /* read-write */
+ uint32_t device_feature; /* read-only */
+ uint32_t guest_feature_select; /* read-write */
+ uint32_t guest_feature; /* read-write */
+ uint16_t msix_config; /* read-write */
+ uint16_t num_queues; /* read-only */
+ uint8_t device_status; /* read-write */
+ uint8_t config_generation; /* read-only */
+
+ /* About a specific virtqueue. */
+ uint16_t queue_select; /* read-write */
+ uint16_t queue_size; /* read-write, power of 2. */
+ uint16_t queue_msix_vector; /* read-write */
+ uint16_t queue_enable; /* read-write */
+ uint16_t queue_notify_off; /* read-only */
+ uint32_t queue_desc_lo; /* read-write */
+ uint32_t queue_desc_hi; /* read-write */
+ uint32_t queue_avail_lo; /* read-write */
+ uint32_t queue_avail_hi; /* read-write */
+ uint32_t queue_used_lo; /* read-write */
+ uint32_t queue_used_hi; /* read-write */
+};
+
+struct virtio_crypto_hw;
+
+struct virtio_pci_ops {
+ void (*read_dev_cfg)(struct virtio_crypto_hw *hw, size_t offset,
+ void *dst, int len);
+ void (*write_dev_cfg)(struct virtio_crypto_hw *hw, size_t offset,
+ const void *src, int len);
+ void (*reset)(struct virtio_crypto_hw *hw);
+
+ uint8_t (*get_status)(struct virtio_crypto_hw *hw);
+ void (*set_status)(struct virtio_crypto_hw *hw, uint8_t status);
+
+ uint64_t (*get_features)(struct virtio_crypto_hw *hw);
+ void (*set_features)(struct virtio_crypto_hw *hw, uint64_t features);
+
+ uint8_t (*get_isr)(struct virtio_crypto_hw *hw);
+
+ uint16_t (*set_config_irq)(struct virtio_crypto_hw *hw, uint16_t vec);
+
+ uint16_t (*set_queue_irq)(struct virtio_crypto_hw *hw, struct virtqueue *vq,
+ uint16_t vec);
+
+ uint16_t (*get_queue_num)(struct virtio_crypto_hw *hw, uint16_t queue_id);
+ int (*setup_queue)(struct virtio_crypto_hw *hw, struct virtqueue *vq);
+ void (*del_queue)(struct virtio_crypto_hw *hw, struct virtqueue *vq);
+ void (*notify_queue)(struct virtio_crypto_hw *hw, struct virtqueue *vq);
+};
+
+struct virtio_crypto_config;
+
+struct virtio_crypto_hw {
+ /* control queue */
+ struct virtqueue *cvq;
+ uint16_t dev_id;
+ uint16_t max_dataqueues;
+ uint64_t req_guest_features;
+ uint64_t guest_features;
+ uint8_t use_msix;
+ uint8_t modern;
+ uint32_t notify_off_multiplier;
+ uint8_t *isr;
+ uint16_t *notify_base;
+ struct virtio_pci_common_cfg *common_cfg;
+ struct virtio_crypto_config *dev_cfg;
+};
+
+/*
+ * While virtio_crypto_hw is stored in shared memory, this structure stores
+ * some infos that may vary in the multiple process model locally.
+ * For example, the vtpci_ops pointer.
+ */
+struct virtio_hw_internal {
+ const struct virtio_pci_ops *vtpci_ops;
+ struct rte_pci_ioport io;
+};
+
+#define VTPCI_OPS(hw) (virtio_hw_internal[(hw)->dev_id].vtpci_ops)
+#define VTPCI_IO(hw) (&virtio_hw_internal[(hw)->dev_id].io)
+
+extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_VIRTIO_CRYPTO];
+
+/*
+ * How many bits to shift physical queue address written to QUEUE_PFN.
+ * 12 is historical, and due to x86 page size.
+ */
+#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
+
+/* The alignment to use between consumer and producer parts of vring. */
+#define VIRTIO_PCI_VRING_ALIGN 4096
+
+/*
+ * Function declaration from virtio_pci.c
+ */
+int vtpci_init_crypto(struct rte_pci_device *dev, struct virtio_crypto_hw *hw);
+
+void vtpci_reset_crypto(struct virtio_crypto_hw *);
+
+void vtpci_reinit_complete_crypto(struct virtio_crypto_hw *);
+
+uint8_t vtpci_get_status_crypto(struct virtio_crypto_hw *);
+void vtpci_set_status_crypto(struct virtio_crypto_hw *, uint8_t);
+
+uint64_t vtpci_negotiate_features_crypto(struct virtio_crypto_hw *, uint64_t);
+
+void vtpci_write_dev_config_crypto(struct virtio_crypto_hw *, size_t, const void *, int);
+
+void vtpci_read_dev_config_crypto(struct virtio_crypto_hw *, uint64_t, void *, int);
+
+uint8_t vtpci_isr_crypto(struct virtio_crypto_hw *);
+
+uint16_t vtpci_irq_config(struct virtio_crypto_hw *, uint16_t);
+
+#endif /* _VIRTIO_PCI_H_ */
diff --git a/drivers/crypto/virtio/virtio_ring.h b/drivers/crypto/virtio/virtio_ring.h
new file mode 100644
index 0000000..00209d4
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_ring.h
@@ -0,0 +1,169 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTIO_RING_H_
+#define _VIRTIO_RING_H_
+
+#include <stdint.h>
+
+#include <rte_common.h>
+
+/* This marks a buffer as continuing via the next field. */
+#define VRING_DESC_F_NEXT 1
+/* This marks a buffer as write-only (otherwise read-only). */
+#define VRING_DESC_F_WRITE 2
+/* This means the buffer contains a list of buffer descriptors. */
+#define VRING_DESC_F_INDIRECT 4
+
+/*
+ * The Host uses this in used->flags to advise the Guest: don't kick me
+ * when you add a buffer. It's unreliable, so it's simply an
+ * optimization. Guest will still kick if it's out of buffers.
+ */
+#define VRING_USED_F_NO_NOTIFY 1
+/*
+ * The Guest uses this in avail->flags to advise the Host: don't
+ * interrupt me when you consume a buffer. It's unreliable, so it's
+ * simply an optimization.
+ */
+#define VRING_AVAIL_F_NO_INTERRUPT 1
+
+/*
+ * VirtIO ring descriptors: 16 bytes.
+ * These can chain together via "next".
+ */
+struct vring_desc {
+ uint64_t addr; /* Address (guest-physical). */
+ uint32_t len; /* Length. */
+ uint16_t flags; /* The flags as indicated above. */
+ uint16_t next; /* We chain unused descriptors via this. */
+};
+
+struct vring_avail {
+ uint16_t flags;
+ uint16_t idx;
+ uint16_t ring[0];
+};
+
+/* id is a 16bit index. uint32_t is used here for ids for padding reasons. */
+struct vring_used_elem {
+ /* Index of start of used descriptor chain. */
+ uint32_t id;
+ /* Total length of the descriptor chain which was written to. */
+ uint32_t len;
+};
+
+struct vring_used {
+ uint16_t flags;
+ uint16_t idx;
+ struct vring_used_elem ring[0];
+};
+
+struct vring {
+ unsigned int num;
+ struct vring_desc *desc;
+ struct vring_avail *avail;
+ struct vring_used *used;
+};
+
+/* The standard layout for the ring is a continuous chunk of memory which
+ * looks like this. We assume num is a power of 2.
+ *
+ * struct vring {
+ * // The actual descriptors (16 bytes each)
+ * struct vring_desc desc[num];
+ *
+ * // A ring of available descriptor heads with free-running index.
+ * __u16 avail_flags;
+ * __u16 avail_idx;
+ * __u16 available[num];
+ * __u16 used_event_idx;
+ *
+ * // Padding to the next align boundary.
+ * char pad[];
+ *
+ * // A ring of used descriptor heads with free-running index.
+ * __u16 used_flags;
+ * __u16 used_idx;
+ * struct vring_used_elem used[num];
+ * __u16 avail_event_idx;
+ * };
+ *
+ * NOTE: for VirtIO PCI, align is 4096.
+ */
+
+/*
+ * We publish the used event index at the end of the available ring, and vice
+ * versa. They are at the end for backwards compatibility.
+ */
+#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
+#define vring_avail_event(vr) (*(uint16_t *)&(vr)->used->ring[(vr)->num])
+
+static inline size_t
+vring_crypto_size(unsigned int num, unsigned long align)
+{
+ size_t size;
+
+ size = num * sizeof(struct vring_desc);
+ size += sizeof(struct vring_avail) + (num * sizeof(uint16_t));
+ size = RTE_ALIGN_CEIL(size, align);
+ size += sizeof(struct vring_used) +
+ (num * sizeof(struct vring_used_elem));
+ return size;
+}
+
+static inline void
+vring_crypto_init(struct vring *vr, unsigned int num, uint8_t *p,
+ unsigned long align)
+{
+ vr->num = num;
+ vr->desc = (struct vring_desc *) p;
+ vr->avail = (struct vring_avail *) (p +
+ num * sizeof(struct vring_desc));
+ vr->used = (void *)
+ RTE_ALIGN_CEIL((uintptr_t)(&vr->avail->ring[num]), align);
+}
+
+/*
+ * The following is used with VIRTIO_RING_F_EVENT_IDX.
+ * Assuming a given event_idx value from the other size, if we have
+ * just incremented index from old to new_idx, should we trigger an
+ * event?
+ */
+static inline int
+vring_crypto_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old)
+{
+ return (uint16_t)(new_idx - event_idx - 1) < (uint16_t)(new_idx - old);
+}
+
+#endif /* _VIRTIO_RING_H_ */
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
new file mode 100644
index 0000000..6085a8f
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -0,0 +1,569 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <rte_cycles.h>
+#include <rte_memory.h>
+#include <rte_memcpy.h>
+#include <rte_memzone.h>
+#include <rte_branch_prediction.h>
+#include <rte_mempool.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_cryptodev.h>
+#include <rte_prefetch.h>
+#include <rte_string_fns.h>
+#include <rte_errno.h>
+#include <rte_byteorder.h>
+#include <rte_cryptodev_pmd.h>
+
+#include "virtio_logs.h"
+#include "virtio_cryptodev.h"
+#include "virtio_pci.h"
+#include "virtqueue.h"
+#include "virtio_crypto_algs.h"
+#include "virtio_crypto.h"
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DUMP
+#define VIRTIO_DUMP_PACKET(m, len) rte_pktmbuf_dump(stdout, m, len)
+#else
+#define VIRTIO_DUMP_PACKET(m, len) do { } while (0)
+#endif
+
+#define NUM_ENTRY_VIRTIO_CRYPTO_TX 7
+
+enum rte_crypto_op_status status_transfer[VIRTIO_CRYPTO_INVSESS + 1] = {
+ RTE_CRYPTO_OP_STATUS_SUCCESS,
+ RTE_CRYPTO_OP_STATUS_ERROR,
+ RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
+ RTE_CRYPTO_OP_STATUS_INVALID_ARGS,
+ RTE_CRYPTO_OP_STATUS_INVALID_SESSION,
+};
+
+static void
+vq_crypto_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
+{
+ struct vring_desc *dp, *dp_tail;
+ struct vq_desc_extra *dxp;
+ uint16_t desc_idx_last = desc_idx;
+
+ dp = &vq->vq_ring.desc[desc_idx];
+ dxp = &vq->vq_descx[desc_idx];
+ vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt + dxp->ndescs);
+ if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) {
+ while (dp->flags & VRING_DESC_F_NEXT) {
+ desc_idx_last = dp->next;
+ dp = &vq->vq_ring.desc[dp->next];
+ }
+ }
+ dxp->ndescs = 0;
+
+ /*
+ * We must append the existing free chain, if any, to the end of
+ * newly freed chain. If the virtqueue was completely used, then
+ * head would be VQ_RING_DESC_CHAIN_END (ASSERTed above).
+ */
+ if (vq->vq_desc_tail_idx == VQ_RING_DESC_CHAIN_END) {
+ vq->vq_desc_head_idx = desc_idx;
+ } else {
+ dp_tail = &vq->vq_ring.desc[vq->vq_desc_tail_idx];
+ dp_tail->next = desc_idx;
+ }
+
+ vq->vq_desc_tail_idx = desc_idx_last;
+ dp->next = VQ_RING_DESC_CHAIN_END;
+}
+
+static uint16_t
+virtqueue_crypto_dequeue_burst_rx(struct virtqueue *vq,
+ struct rte_crypto_op **rx_pkts, uint16_t num)
+{
+ struct vring_used_elem *uep;
+ struct rte_crypto_op *cop;
+ uint16_t used_idx, desc_idx;
+ uint16_t i;
+ struct virtio_crypto_inhdr *inhdr;
+
+ /* Caller does the check */
+ for (i = 0; i < num ; i++) {
+ used_idx = (uint16_t)(vq->vq_used_cons_idx
+ & (vq->vq_nentries - 1));
+ uep = &vq->vq_ring.used->ring[used_idx];
+ desc_idx = (uint16_t)uep->id;
+ cop = (struct rte_crypto_op *)
+ vq->vq_descx[desc_idx].crypto_op;
+
+ /*
+ * status is saved just after virtio_crypto_op_data_req,
+ * see virtqueue_crypto_sym_enqueue_xmit() for more details
+ */
+ inhdr = (struct virtio_crypto_inhdr *)(
+ (uint8_t *)vq->vq_descx[desc_idx].malloc_addr +
+ sizeof(struct virtio_crypto_op_data_req));
+ if (inhdr->status == VIRTIO_CRYPTO_OK) {
+ cop->status = status_transfer[inhdr->status];
+ } else if (inhdr->status <= VIRTIO_CRYPTO_INVSESS) {
+ cop->status = status_transfer[inhdr->status];
+ vq->packets_received_failed++;
+ } else
+ vq->packets_received_failed++;
+
+ vq->packets_received_total++;
+
+ rx_pkts[i] = cop;
+ vq->vq_used_cons_idx++;
+ vq_crypto_ring_free_chain(vq, desc_idx);
+ vq->vq_descx[desc_idx].crypto_op = NULL;
+ rte_free(vq->vq_descx[desc_idx].malloc_addr);
+ vq->vq_descx[desc_idx].malloc_addr = NULL;
+ }
+
+ return i;
+}
+
+static int
+virtqueue_crypto_sym_pkt_header_arrange(
+ struct rte_crypto_op *cop,
+ struct virtio_crypto_op_data_req *data,
+ struct virtio_crypto_session *session)
+{
+ struct rte_crypto_sym_op *sym_op = cop->sym;
+ struct virtio_crypto_op_data_req *req_data = data;
+ struct virtio_crypto_op_ctrl_req *ctrl = &session->ctrl;
+ struct virtio_crypto_cipher_session_para *para;
+
+ req_data->header.session_id = session->session_id;
+
+ switch (ctrl->u.sym_create_session.op_type) {
+ case VIRTIO_CRYPTO_SYM_OP_CIPHER:
+ req_data->u.sym_req.op_type = VIRTIO_CRYPTO_SYM_OP_CIPHER;
+
+ para = &ctrl->u.sym_create_session.u.cipher.para;
+ if (para->op == VIRTIO_CRYPTO_OP_ENCRYPT)
+ req_data->header.opcode = VIRTIO_CRYPTO_CIPHER_ENCRYPT;
+ else
+ req_data->header.opcode = VIRTIO_CRYPTO_CIPHER_DECRYPT;
+
+ req_data->u.sym_req.u.cipher.para.iv_len
+ = session->iv.length;
+
+ req_data->u.sym_req.u.cipher.para.src_data_len =
+ (sym_op->cipher.data.length + sym_op->cipher.data.offset);
+ req_data->u.sym_req.u.cipher.para.dst_data_len =
+ req_data->u.sym_req.u.cipher.para.src_data_len;
+ break;
+ case VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING:
+ req_data->u.sym_req.op_type = VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING;
+
+ para = &ctrl->u.sym_create_session.u.chain.para.cipher_param;
+ if (para->op == VIRTIO_CRYPTO_OP_ENCRYPT)
+ req_data->header.opcode = VIRTIO_CRYPTO_CIPHER_ENCRYPT;
+ else
+ req_data->header.opcode = VIRTIO_CRYPTO_CIPHER_DECRYPT;
+
+ req_data->u.sym_req.u.chain.para.iv_len = session->iv.length;
+ req_data->u.sym_req.u.chain.para.aad_len = session->aad.length;
+
+ req_data->u.sym_req.u.chain.para.src_data_len =
+ (sym_op->cipher.data.length + sym_op->cipher.data.offset);
+ req_data->u.sym_req.u.chain.para.dst_data_len =
+ req_data->u.sym_req.u.chain.para.src_data_len;
+ req_data->u.sym_req.u.chain.para.cipher_start_src_offset =
+ sym_op->cipher.data.offset;
+ req_data->u.sym_req.u.chain.para.len_to_cipher =
+ sym_op->cipher.data.length;
+ req_data->u.sym_req.u.chain.para.hash_start_src_offset =
+ sym_op->auth.data.offset;
+ req_data->u.sym_req.u.chain.para.len_to_hash =
+ sym_op->auth.data.length;
+ req_data->u.sym_req.u.chain.para.aad_len =
+ ctrl->u.sym_create_session.u.chain.para.aad_len;
+
+ if (ctrl->u.sym_create_session.u.chain.para.hash_mode ==
+ VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN)
+ req_data->u.sym_req.u.chain.para.hash_result_len =
+ ctrl->u.sym_create_session.u.chain.para.u.hash_param.
+ hash_result_len;
+ if (ctrl->u.sym_create_session.u.chain.para.hash_mode ==
+ VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH)
+ req_data->u.sym_req.u.chain.para.hash_result_len =
+ ctrl->u.sym_create_session.u.chain.para.u.mac_param.
+ hash_result_len;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+virtqueue_crypto_sym_enqueue_xmit(
+ struct virtqueue *txvq,
+ struct rte_crypto_op *cop)
+{
+ uint16_t idx = 0;
+ uint16_t num_entry;
+ uint16_t needed = 1;
+ uint16_t head_idx;
+ struct vq_desc_extra *dxp;
+ struct vring_desc *start_dp;
+ struct vring_desc *desc;
+ uint8_t *malloc_addr;
+ uint64_t malloc_phys_addr;
+ uint16_t req_data_len = sizeof(struct virtio_crypto_op_data_req);
+ uint32_t indirect_vring_addr_offset = req_data_len +
+ sizeof(struct virtio_crypto_inhdr);
+ struct rte_crypto_sym_op *sym_op = cop->sym;
+ struct virtio_crypto_session *session =
+ (struct virtio_crypto_session *)get_session_private_data(
+ cop->sym->session, cryptodev_virtio_driver_id);
+ struct virtio_crypto_op_data_req *op_data_req;
+ uint32_t hash_result_len = 0;
+
+ if (unlikely(sym_op->m_src->nb_segs != 1))
+ return -EMSGSIZE;
+ if (unlikely(txvq->vq_free_cnt == 0))
+ return -ENOSPC;
+ if (unlikely(txvq->vq_free_cnt < needed))
+ return -EMSGSIZE;
+ head_idx = txvq->vq_desc_head_idx;
+ if (unlikely(head_idx >= txvq->vq_nentries))
+ return -EFAULT;
+ if (unlikely(session == NULL))
+ return -EFAULT;
+
+ /*
+ * malloc memory to store virtio_crypto_op_data_req, status returned
+ * and indirect vring entries
+ */
+ malloc_addr = rte_malloc(NULL, req_data_len + sizeof(struct virtio_crypto_inhdr)
+ + NUM_ENTRY_VIRTIO_CRYPTO_TX * sizeof(struct vring_desc),
+ RTE_CACHE_LINE_SIZE);
+ if (malloc_addr == NULL) {
+ PMD_TX_LOG(ERR, "not enough heap room");
+ return -ENOSPC;
+ }
+ op_data_req = (struct virtio_crypto_op_data_req *)malloc_addr;
+ malloc_phys_addr = rte_malloc_virt2phy(malloc_addr);
+
+ if (virtqueue_crypto_sym_pkt_header_arrange(cop, op_data_req, session)) {
+ rte_free(malloc_addr);
+ return -EFAULT;
+ }
+
+ /* status is initialized to VIRTIO_CRYPTO_ERR */
+ ((struct virtio_crypto_inhdr *)
+ ((uint8_t *)malloc_addr + req_data_len))->status =
+ VIRTIO_CRYPTO_ERR;
+
+ /* point to indirect vring entry */
+ desc = (struct vring_desc *)
+ ((uint8_t *)malloc_addr + indirect_vring_addr_offset);
+ for (idx = 0; idx < (NUM_ENTRY_VIRTIO_CRYPTO_TX - 1); idx++)
+ desc[idx].next = idx + 1;
+ desc[NUM_ENTRY_VIRTIO_CRYPTO_TX - 1].next = VQ_RING_DESC_CHAIN_END;
+
+ idx = 0;
+
+ /* indirect vring: first part, virtio_crypto_op_data_req */
+ desc[idx].addr = malloc_phys_addr;
+ desc[idx].len = req_data_len;
+ desc[idx++].flags = VRING_DESC_F_NEXT;
+
+ /* indirect vring: iv of cipher */
+ if (session->iv.length) {
+ desc[idx].addr = cop->phys_addr + session->iv.offset;
+ desc[idx].len = session->iv.length;
+ desc[idx++].flags = VRING_DESC_F_NEXT;
+ }
+
+ /* indirect vring: additional auth data */
+ if (session->aad.length) {
+ desc[idx].addr = session->aad.phys_addr;
+ desc[idx].len = session->aad.length;
+ desc[idx++].flags = VRING_DESC_F_NEXT;
+ }
+
+ /* indirect vring: src data */
+ desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_src, 0);
+ desc[idx].len = (sym_op->cipher.data.offset
+ + sym_op->cipher.data.length);
+ desc[idx++].flags = VRING_DESC_F_NEXT;
+
+ /* indirect vring: dst data */
+ if (sym_op->m_dst) {
+ desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_dst, 0);
+ desc[idx].len = (sym_op->cipher.data.offset
+ + sym_op->cipher.data.length);
+ } else {
+ desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_src, 0);
+ desc[idx].len = (sym_op->cipher.data.offset
+ + sym_op->cipher.data.length);
+ }
+ desc[idx++].flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;
+
+ /* indirect vring: digest result */
+ if (session->ctrl.u.sym_create_session.u.chain.para.hash_mode ==
+ VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN)
+ hash_result_len =
+ session->ctrl.u.sym_create_session.u.chain.para.u.hash_param.
+ hash_result_len;
+ if (session->ctrl.u.sym_create_session.u.chain.para.hash_mode ==
+ VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH)
+ hash_result_len =
+ session->ctrl.u.sym_create_session.u.chain.para.u.mac_param.
+ hash_result_len;
+ if (hash_result_len > 0) {
+ desc[idx].addr = sym_op->auth.digest.phys_addr;
+ desc[idx].len = hash_result_len;
+ desc[idx++].flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;
+ }
+
+ /* indirect vring: last part, status returned */
+ desc[idx].addr = malloc_phys_addr + req_data_len;
+ desc[idx].len = sizeof(struct virtio_crypto_inhdr);
+ desc[idx++].flags = VRING_DESC_F_WRITE;
+
+ num_entry = idx;
+
+ /* save the infos to use when receiving packets */
+ dxp = &txvq->vq_descx[head_idx];
+ dxp->crypto_op = (void *)cop;
+ dxp->malloc_addr = malloc_addr;
+ dxp->ndescs = needed;
+
+ /* use a single buffer */
+ start_dp = txvq->vq_ring.desc;
+ start_dp[head_idx].addr = malloc_phys_addr + indirect_vring_addr_offset;
+ start_dp[head_idx].len = num_entry * sizeof(struct vring_desc);
+ start_dp[head_idx].flags = VRING_DESC_F_INDIRECT;
+
+ idx = start_dp[head_idx].next;
+ txvq->vq_desc_head_idx = idx;
+ if (txvq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
+ txvq->vq_desc_tail_idx = idx;
+ txvq->vq_free_cnt = (uint16_t)(txvq->vq_free_cnt - needed);
+ vq_crypto_update_avail_ring(txvq, head_idx);
+
+ return 0;
+}
+
+static int
+virtqueue_crypto_enqueue_xmit(struct virtqueue *txvq,
+ struct rte_crypto_op *cop)
+{
+ int ret;
+
+ switch (cop->type) {
+ case RTE_CRYPTO_OP_TYPE_SYMMETRIC:
+ ret = virtqueue_crypto_sym_enqueue_xmit(txvq, cop);
+ break;
+ default:
+ PMD_TX_LOG(ERR, "invalid crypto op type %u", cop->type);
+ ret = -EFAULT;
+ break;
+ }
+
+ return ret;
+}
+
+static int
+virtio_crypto_vring_start(struct virtqueue *vq)
+{
+ struct virtio_crypto_hw *hw = vq->hw;
+ int i, size = vq->vq_nentries;
+ struct vring *vr = &vq->vq_ring;
+ uint8_t *ring_mem = vq->vq_ring_virt_mem;
+
+ PMD_INIT_FUNC_TRACE();
+
+ vring_crypto_init(vr, size, ring_mem, VIRTIO_PCI_VRING_ALIGN);
+ vq->vq_desc_tail_idx = (uint16_t)(vq->vq_nentries - 1);
+ vq->vq_free_cnt = vq->vq_nentries;
+
+ /* Chain all the descriptors in the ring with an END */
+ for (i = 0; i < size - 1; i++)
+ vr->desc[i].next = (uint16_t)(i + 1);
+ vr->desc[i].next = VQ_RING_DESC_CHAIN_END;
+
+ /*
+ * Disable device(host) interrupting guest
+ */
+ virtqueue_crypto_disable_intr(vq);
+
+ /*
+ * Set guest physical address of the virtqueue
+ * in VIRTIO_PCI_QUEUE_PFN config register of device
+ * to share with the backend
+ */
+ if (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) {
+ PMD_INIT_LOG(ERR, "setup_queue failed");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+void
+virtio_crypto_cq_start(struct rte_cryptodev *dev)
+{
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ if (hw->cvq) {
+ virtio_crypto_vring_start(hw->cvq);
+ VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
+ }
+}
+
+void
+virtio_crypto_dq_start(struct rte_cryptodev *dev)
+{
+ /*
+ * Start data vrings
+ * - Setup vring structure for data queues
+ */
+ uint32_t i;
+ struct virtio_crypto_hw *hw = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Start data vring. */
+ for (i = 0; i < hw->max_dataqueues; i++) {
+ virtio_crypto_vring_start(dev->data->queue_pairs[i]);
+ VIRTQUEUE_DUMP((struct virtqueue *)dev->data->queue_pairs[i]);
+ }
+}
+
+/* vring size of data queue is 1024 */
+#define VIRTIO_MBUF_BURST_SZ 1024
+
+uint16_t
+virtio_crypto_pkt_rx_burst(void *tx_queue, struct rte_crypto_op **rx_pkts,
+ uint16_t nb_pkts)
+{
+ struct virtqueue *txvq = tx_queue;
+ uint16_t nb_used, num, nb_rx;
+
+ nb_used = VIRTQUEUE_NUSED(txvq);
+
+ virtio_rmb();
+
+ num = (uint16_t)(likely(nb_used <= nb_pkts) ? nb_used : nb_pkts);
+ num = (uint16_t)(likely(num <= VIRTIO_MBUF_BURST_SZ)
+ ? num : VIRTIO_MBUF_BURST_SZ);
+
+ if (num == 0)
+ return 0;
+
+ nb_rx = virtqueue_crypto_dequeue_burst_rx(txvq, rx_pkts, num);
+ PMD_RX_LOG(DEBUG, "used:%d dequeue:%d", nb_used, num);
+
+ return nb_rx;
+}
+
+uint16_t
+virtio_crypto_pkt_tx_burst(void *tx_queue, struct rte_crypto_op **tx_pkts,
+ uint16_t nb_pkts)
+{
+ struct virtqueue *txvq;
+ uint16_t nb_tx;
+ int error;
+
+ if (unlikely(nb_pkts < 1))
+ return nb_pkts;
+ if (unlikely(tx_queue == NULL)) {
+ PMD_TX_LOG(ERR, "tx_queue is NULL");
+ return 0;
+ }
+ txvq = tx_queue;
+
+ PMD_TX_LOG(DEBUG, "%d packets to xmit", nb_pkts);
+
+ for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+ struct rte_mbuf *txm = tx_pkts[nb_tx]->sym->m_src;
+ /* nb_segs is always 1 at virtio crypto situation */
+ int need = txm->nb_segs - txvq->vq_free_cnt;
+
+ /*
+ * Positive value indicates it hasn't enough space in vring
+ * descriptors
+ */
+ if (unlikely(need > 0)) {
+ /*
+ * try it again because the receive process may be
+ * free some space
+ */
+ need = txm->nb_segs - txvq->vq_free_cnt;
+ if (unlikely(need > 0)) {
+ PMD_TX_LOG(ERR, "No free tx descriptors "
+ "to transmit");
+ break;
+ }
+ }
+
+ txvq->packets_sent_total++;
+
+ /* Enqueue Packet buffers */
+ error = virtqueue_crypto_enqueue_xmit(txvq, tx_pkts[nb_tx]);
+ if (unlikely(error)) {
+ if (error == ENOSPC)
+ PMD_TX_LOG(ERR,
+ "virtqueue_enqueue Free count = 0");
+ else if (error == EMSGSIZE)
+ PMD_TX_LOG(ERR,
+ "virtqueue_enqueue Free count < 1");
+ else
+ PMD_TX_LOG(ERR,
+ "virtqueue_enqueue error: %d", error);
+ txvq->packets_sent_failed++;
+ break;
+ }
+ }
+
+ if (likely(nb_tx)) {
+ vq_crypto_update_avail_idx(txvq);
+
+ if (unlikely(virtqueue_crypto_kick_prepare(txvq))) {
+ virtqueue_crypto_notify(txvq);
+ PMD_TX_LOG(DEBUG, "Notified backend after xmit");
+ }
+ }
+
+ return nb_tx;
+}
diff --git a/drivers/crypto/virtio/virtqueue.c b/drivers/crypto/virtio/virtqueue.c
new file mode 100644
index 0000000..be3a5a6
--- /dev/null
+++ b/drivers/crypto/virtio/virtqueue.c
@@ -0,0 +1,80 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdint.h>
+
+#include <rte_mbuf.h>
+#include <rte_crypto.h>
+#include <rte_malloc.h>
+
+#include "virtqueue.h"
+#include "virtio_logs.h"
+#include "virtio_pci.h"
+
+void
+virtqueue_crypto_disable_intr(struct virtqueue *vq)
+{
+ /*
+ * Set VRING_AVAIL_F_NO_INTERRUPT to hint host
+ * not to interrupt when it consumes packets
+ * Note: this is only considered a hint to the host
+ */
+ vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
+}
+
+void
+virtqueue_crypto_detatch_unused(struct virtqueue *vq)
+{
+ struct rte_crypto_op *cop = NULL;
+ uint8_t *malloc_addr = NULL;
+
+ int idx;
+
+ if (vq != NULL)
+ for (idx = 0; idx < vq->vq_nentries; idx++) {
+ cop = vq->vq_descx[idx].crypto_op;
+ if (cop) {
+ if (cop->sym->m_src)
+ rte_pktmbuf_free(cop->sym->m_src);
+ if (cop->sym->m_dst)
+ rte_pktmbuf_free(cop->sym->m_dst);
+ rte_crypto_op_free(cop);
+ vq->vq_descx[idx].crypto_op = NULL;
+ }
+
+ malloc_addr = vq->vq_descx[idx].malloc_addr;
+ if (malloc_addr) {
+ rte_free(malloc_addr);
+ vq->vq_descx[idx].malloc_addr = NULL;
+ }
+ }
+}
diff --git a/drivers/crypto/virtio/virtqueue.h b/drivers/crypto/virtio/virtqueue.h
new file mode 100644
index 0000000..d666c3a
--- /dev/null
+++ b/drivers/crypto/virtio/virtqueue.h
@@ -0,0 +1,208 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 HUAWEI TECHNOLOGIES CO., LTD. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of HUAWEI TECHNOLOGIES CO., LTD nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _VIRTQUEUE_H_
+#define _VIRTQUEUE_H_
+
+#include <stdint.h>
+
+#include <rte_atomic.h>
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_mempool.h>
+
+#include "virtio_pci.h"
+#include "virtio_ring.h"
+#include "virtio_logs.h"
+#include "virtio_crypto.h"
+
+struct rte_mbuf;
+
+/*
+ * Per virtio_config.h in Linux.
+ * For virtio_pci on SMP, we don't need to order with respect to MMIO
+ * accesses through relaxed memory I/O windows, so smp_mb() et al are
+ * sufficient.
+ *
+ */
+#define virtio_mb() rte_smp_mb()
+#define virtio_rmb() rte_smp_rmb()
+#define virtio_wmb() rte_smp_wmb()
+
+#define VIRTQUEUE_MAX_NAME_SZ 32
+
+enum { VTCRYPTO_DATAQ = 0, VTCRYPTO_CTRLQ = 1 };
+
+/**
+ * The maximum virtqueue size is 2^15. Use that value as the end of
+ * descriptor chain terminator since it will never be a valid index
+ * in the descriptor table. This is used to verify we are correctly
+ * handling vq_free_cnt.
+ */
+#define VQ_RING_DESC_CHAIN_END 32768
+
+struct virtqueue {
+ /**< virtio_crypto_hw structure pointer. */
+ struct virtio_crypto_hw *hw;
+ /**< mem zone to populate RX ring. */
+ const struct rte_memzone *mz;
+ /**< memzone to populate hdr. */
+ struct rte_mempool *mpool;
+ uint8_t dev_id; /**< Device identifier. */
+ uint16_t vq_queue_index; /**< PCI queue index */
+
+ void *vq_ring_virt_mem; /**< linear address of vring*/
+ unsigned int vq_ring_size;
+ phys_addr_t vq_ring_mem; /**< physical address of vring */
+
+ struct vring vq_ring; /**< vring keeping desc, used and avail */
+ uint16_t vq_free_cnt; /**< num of desc available */
+ uint16_t vq_nentries; /**< vring desc numbers */
+ uint16_t vq_free_thresh; /**< free threshold */
+ /**
+ * Head of the free chain in the descriptor table. If
+ * there are no free descriptors, this will be set to
+ * VQ_RING_DESC_CHAIN_END.
+ */
+ uint16_t vq_desc_head_idx;
+ uint16_t vq_desc_tail_idx;
+ /**
+ * Last consumed descriptor in the used table,
+ * trails vq_ring.used->idx.
+ */
+ uint16_t vq_used_cons_idx;
+ uint16_t vq_avail_idx;
+
+ /* Statistics */
+ uint64_t packets_sent_total;
+ uint64_t packets_sent_failed;
+ uint64_t packets_received_total;
+ uint64_t packets_received_failed;
+
+ uint16_t *notify_addr;
+
+ struct vq_desc_extra {
+ void *crypto_op;
+ uint8_t *malloc_addr;
+ uint16_t ndescs;
+ } vq_descx[0];
+};
+
+/* If multiqueue is provided by host, then we suppport it. */
+#define VIRTIO_CRYPTO_CTRL_MQ 4
+#define VIRTIO_CRYPTO_CTRL_MQ_VQ_PAIRS_SET 0
+#define VIRTIO_CRYPTO_CTRL_MQ_VQ_PAIRS_MIN 1
+#define VIRTIO_CRYPTO_CTRL_MQ_VQ_PAIRS_MAX 0x8000
+
+/**
+ * Tell the backend not to interrupt us.
+ */
+void virtqueue_crypto_disable_intr(struct virtqueue *vq);
+/**
+ * Dump virtqueue internal structures, for debug purpose only.
+ */
+void virtqueue_crypto_dump(struct virtqueue *vq);
+/**
+ * Get all mbufs to be freed.
+ */
+void virtqueue_crypto_detatch_unused(struct virtqueue *vq);
+
+static inline int
+virtqueue_crypto_full(const struct virtqueue *vq)
+{
+ return vq->vq_free_cnt == 0;
+}
+
+#define VIRTQUEUE_NUSED(vq) \
+ ((uint16_t)((vq)->vq_ring.used->idx - (vq)->vq_used_cons_idx))
+
+static inline void
+vq_crypto_update_avail_idx(struct virtqueue *vq)
+{
+ virtio_wmb();
+ vq->vq_ring.avail->idx = vq->vq_avail_idx;
+}
+
+static inline void
+vq_crypto_update_avail_ring(struct virtqueue *vq, uint16_t desc_idx)
+{
+ uint16_t avail_idx;
+ /*
+ * Place the head of the descriptor chain into the next slot and make
+ * it usable to the host. The chain is made available now rather than
+ * deferring to virtqueue_notify() in the hopes that if the host is
+ * currently running on another CPU, we can keep it processing the new
+ * descriptor.
+ */
+ avail_idx = (uint16_t)(vq->vq_avail_idx & (vq->vq_nentries - 1));
+ vq->vq_ring.avail->ring[avail_idx] = desc_idx;
+ vq->vq_avail_idx++;
+}
+
+static inline int
+virtqueue_crypto_kick_prepare(struct virtqueue *vq)
+{
+ return !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY);
+}
+
+static inline void
+virtqueue_crypto_notify(struct virtqueue *vq)
+{
+ struct virtio_crypto_hw *hw = vq->hw;
+ /*
+ * Ensure updated avail->idx is visible to host.
+ * For virtio on IA, the notificaiton is through io port operation
+ * which is a serialization instruction itself.
+ */
+ VTPCI_OPS(hw)->notify_queue(hw, vq);
+}
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DUMP
+#define VIRTQUEUE_DUMP(vq) do { \
+ uint16_t used_idx, nused; \
+ used_idx = (vq)->vq_ring.used->idx; \
+ nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \
+ PMD_INIT_LOG(DEBUG, \
+ "VQ: - size=%d; free=%d; used=%d; desc_head_idx=%d;" \
+ " avail.idx=%d; used_cons_idx=%d; used.idx=%d;" \
+ " avail.flags=0x%x; used.flags=0x%x", \
+ (vq)->vq_nentries, (vq)->vq_free_cnt, nused, \
+ (vq)->vq_desc_head_idx, (vq)->vq_ring.avail->idx, \
+ (vq)->vq_used_cons_idx, (vq)->vq_ring.used->idx, \
+ (vq)->vq_ring.avail->flags, (vq)->vq_ring.used->flags); \
+} while (0)
+#else
+#define VIRTQUEUE_DUMP(vq) do { } while (0)
+#endif
+
+#endif /* _VIRTQUEUE_H_ */
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 047121d..56d7c51 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -169,6 +169,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH)
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += -lrte_pmd_openssl -lcrypto
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += -lrte_pmd_virtio_crypto -lcrypto
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += -lrte_pmd_kasumi
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 72988c5..2d03d32 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -1790,6 +1790,25 @@ struct crypto_unittest_params {
}
static int
+test_AES_cipheronly_virtio_all(void)
+{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+ int status;
+
+ status = test_blockcipher_all_tests(ts_params->mbuf_pool,
+ ts_params->op_mpool,
+ ts_params->session_mpool,
+ ts_params->valid_devs[0],
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_VIRTIO_SYM_PMD)),
+ BLKCIPHER_AES_CIPHERONLY_TYPE);
+
+ TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+ return TEST_SUCCESS;
+}
+
+static int
test_AES_chain_dpaa_sec_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -8732,6 +8751,18 @@ struct test_crypto_vector {
}
};
+static struct unit_test_suite cryptodev_virtio_testsuite = {
+ .suite_name = "Crypto VIRTIO Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_cipheronly_virtio_all),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
static struct unit_test_suite cryptodev_aesni_mb_testsuite = {
.suite_name = "Crypto Device AESNI MB Unit Test Suite",
.setup = testsuite_setup,
@@ -9597,6 +9628,23 @@ struct test_crypto_vector {
}
static int
+test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
+{
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_VIRTIO_SYM_PMD));
+
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "VIRTIO PMD must be loaded. Check if "
+ "CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO is enabled "
+ "in config file to run this testsuite.\n");
+ return TEST_FAILED;
+ }
+
+ return unit_test_suite_runner(&cryptodev_virtio_testsuite);
+}
+
+
+static int
test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
{
gbl_driver_id = rte_cryptodev_driver_id_get(
@@ -9812,3 +9860,4 @@ struct test_crypto_vector {
REGISTER_TEST_COMMAND(cryptodev_sw_mrvl_autotest, test_cryptodev_mrvl);
REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec);
REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_autotest, test_cryptodev_dpaa_sec);
+REGISTER_TEST_COMMAND(cryptodev_virtio_autotest, test_cryptodev_virtio);
diff --git a/test/test/test_cryptodev.h b/test/test/test_cryptodev.h
index 2e9eb0b..3ca9918 100644
--- a/test/test/test_cryptodev.h
+++ b/test/test/test_cryptodev.h
@@ -89,6 +89,7 @@
#define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec
#define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler
#define CRYPTODEV_NAME_MRVL_PMD crypto_mrvl
+#define CRYPTODEV_NAME_VIRTIO_SYM_PMD crypto_virtio
/**
* Write (spread) data from buffer to mbuf data
diff --git a/test/test/test_cryptodev_aes_test_vectors.h b/test/test/test_cryptodev_aes_test_vectors.h
index 9c13041..e07ca8c 100644
--- a/test/test/test_cryptodev_aes_test_vectors.h
+++ b/test/test/test_cryptodev_aes_test_vectors.h
@@ -1277,7 +1277,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@@ -1541,7 +1542,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CBC Decryption",
@@ -1553,7 +1555,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-192-CBC Encryption",
@@ -1564,7 +1567,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-192-CBC Encryption Scater gather",
@@ -1583,7 +1587,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CBC Encryption",
@@ -1595,7 +1600,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CBC Decryption",
@@ -1607,7 +1613,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CBC OOP Encryption",
@@ -1617,7 +1624,8 @@
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CBC OOP Decryption",
@@ -1627,7 +1635,8 @@
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CTR Encryption",
@@ -1639,7 +1648,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CTR Decryption",
@@ -1651,7 +1661,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-192-CTR Encryption",
@@ -1662,7 +1673,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-192-CTR Decryption",
@@ -1673,7 +1685,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC
+ BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CTR Encryption",
@@ -1685,7 +1698,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-256-CTR Decryption",
@@ -1697,7 +1711,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+ BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CTR Encryption (12-byte IV)",
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 9a9fd8b..195180f 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -96,6 +96,8 @@
RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
int mrvl_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
+ int virtio_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_VIRTIO_SYM_PMD));
int nb_segs = 1;
@@ -122,7 +124,8 @@
driver_id == qat_pmd ||
driver_id == openssl_pmd ||
driver_id == armv8_pmd ||
- driver_id == mrvl_pmd) { /* Fall through */
+ driver_id == mrvl_pmd ||
+ driver_id == virtio_pmd) { /* Fall through */
digest_len = tdata->digest.len;
} else if (driver_id == aesni_mb_pmd ||
driver_id == scheduler_pmd) {
@@ -597,6 +600,8 @@
RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
int mrvl_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
+ int virtio_pmd = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_VIRTIO_SYM_PMD));
switch (test_type) {
case BLKCIPHER_AES_CHAIN_TYPE:
@@ -659,6 +664,8 @@
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
else if (driver_id == mrvl_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MRVL;
+ else if (driver_id == virtio_pmd)
+ target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
else
TEST_ASSERT(0, "Unrecognized cryptodev type");
diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h
index 67c78d4..fadb81d 100644
--- a/test/test/test_cryptodev_blockcipher.h
+++ b/test/test/test_cryptodev_blockcipher.h
@@ -55,6 +55,7 @@
#define BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC 0x0020 /* DPAA2_SEC flag */
#define BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC 0x0040 /* DPAA_SEC flag */
#define BLOCKCIPHER_TEST_TARGET_PMD_MRVL 0x0080 /* Marvell flag */
+#define BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO 0x0100 /* VIRTIO flag */
#define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \
BLOCKCIPHER_TEST_OP_DECRYPT)
--
1.8.3.1
^ permalink raw reply [relevance 1%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-09 13:43 1% [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit Adrien Mazarguil
2017-11-15 4:12 0% ` Wiles, Keith
@ 2017-11-16 16:53 0% ` Jim Thompson
1 sibling, 0 replies; 200+ results
From: Jim Thompson @ 2017-11-16 16:53 UTC (permalink / raw)
To: Adrien Mazarguil
Cc: Olivier Matz, Jingjing Wu, dev, Thomas Monjalon, Ferruh Yigit
How does this fit with all the work that Keith Wiles just discussed at DPDK Summit?
https://dpdk17.sched.com/event/Cqv3/new-command-line-interface-for-dpdk <https://dpdk17.sched.com/event/Cqv3/new-command-line-interface-for-dpdk>
Jim
> On Nov 9, 2017, at 7:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>
> This patch removes all code associated with symbols not internally relied
> on by other DPDK components, makes struct cmdline opaque and then proceeds
> to re-implement the remaining functionality as a wrapper to the editline
> library (also known as libedit) [1].
>
> Besides adding a new external dependency to its users, its large impact on
> librte_cmdline's API/ABI also warrants a major version number bump.
>
> While librte_cmdline served DPDK well all these years as a small, easy to
> use and self-sufficient interactive command-line handler, it started to
> show its limits with testpmd's flow (rte_flow) command, which required
> support for dynamic tokens and very long commands.
>
> This is the main motivation behind this rework. Long commands often need to
> be displayed on multiple lines, which are not properly supported by
> librte_cmdline's limited terminal handling capabilities, resulting in a
> rather frustrating user experience.
>
> Testpmd being one of the main tools used by PMD developers and given flow
> command lines won't get any shorter, this issue had to be addressed.
>
> Three options were considered:
>
> - Fixing and enhancing librte_cmdline.
>
> The amount of work necessary to add support for edition on multiple lines
> was deemed significant and the result would still have lacked in some
> areas, such as working backspace/delete keys in all terminals (i.e. full
> termcap support).
>
> - Making testpmd directly rely on a more capable library.
>
> All testpmd commands rely on the cmdline_parse interface provided by
> librte_cmdline. This approach would have required either a complete
> rewrite or importing the missing bits from librte_cmdline to wrap them
> around the new library, which naturally led to...
>
> - Converting librte_cmdline as a wrapper to a more capable library.
>
> Let's be honest, interactive command line handling isn't what makes DPDK
> shine. It's also far removed from its core functionality, but is still
> necessary in order to easily implement test and example programs; the
> cmdline_parse interface is particularly good at this.
>
> DPDK actually only relies on cmdline_parse. By removing all the other
> unused interfaces, implementing what remains on top of a different
> terminal-handling library would be quick and easy.
>
> This last approach was chosen for the stated reasons. Libedit is
> well-known, BSD-licensed, widely available [2], used by many projects, does
> everything needed and more [3].
>
> This rework results in the following changes:
>
> - Removed circular buffer management interface for command history
> (cmdline_cirbuf.c), command history being handled by libedit.
> - Removed raw command-line interpreter (cmdline_rdline.c).
> - Removed raw terminal handler (cmdline_vt100.c).
> - Removed all test/example code for the above.
> - Re-implemented high level interactive and non-interactive command-line
> handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
> native interface, not its readline compatibility layer.
> - Made struct cmdline opaque so that applications relying on librte_cmdline
> do not need to include any libedit headers.
> - The only visible change for most applications besides being linked to
> libedit is they do not have to include cmdline_rdline.h anymore.
>
> As an added bonus, terminal resizing is now automatically handled.
>
> In the future, cmdline_parse could use libedit's advanced tokenizer as
> well to interpret quoted strings and escape sequences.
>
> [1] http://thrysoee.dk/editline/
> [2] It usually goes by the name "libedit" in Linux distributions.
> [3] http://netbsd.gw.com/cgi-bin/man-cgi?editline++NetBSD-current
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> ---
> app/test-pmd/cmdline.c | 1 -
> examples/bond/main.c | 1 -
> examples/cmdline/commands.c | 1 -
> examples/cmdline/main.c | 1 -
> .../ip_pipeline/pipeline/pipeline_common_fe.c | 1 -
> .../ip_pipeline/pipeline/pipeline_firewall.c | 1 -
> .../pipeline/pipeline_flow_actions.c | 1 -
> .../pipeline/pipeline_flow_classification.c | 1 -
> examples/ip_pipeline/thread_fe.c | 1 -
> examples/multi_process/simple_mp/main.c | 1 -
> examples/multi_process/simple_mp/mp_commands.c | 1 -
> examples/qos_sched/cmdline.c | 1 -
> examples/quota_watermark/qwctl/commands.c | 1 -
> examples/quota_watermark/qwctl/qwctl.c | 1 -
> .../guest_cli/vm_power_cli_guest.c | 1 -
> examples/vm_power_manager/vm_power_cli.c | 1 -
> lib/librte_cmdline/Makefile | 10 +-
> lib/librte_cmdline/cmdline.c | 385 +++--
> lib/librte_cmdline/cmdline.h | 22 +-
> lib/librte_cmdline/cmdline_cirbuf.c | 466 ------
> lib/librte_cmdline/cmdline_cirbuf.h | 245 ----
> lib/librte_cmdline/cmdline_parse.c | 7 +-
> lib/librte_cmdline/cmdline_rdline.c | 697 ---------
> lib/librte_cmdline/cmdline_rdline.h | 255 ----
> lib/librte_cmdline/cmdline_socket.c | 36 +-
> lib/librte_cmdline/cmdline_vt100.c | 185 ---
> lib/librte_cmdline/cmdline_vt100.h | 153 --
> lib/librte_cmdline/rte_cmdline_version.map | 41 +-
> mk/rte.app.mk | 2 +
> test/cmdline_test/cmdline_test.c | 1 -
> test/cmdline_test/commands.c | 69 -
> test/test/Makefile | 1 -
> test/test/commands.c | 1 -
> test/test/test.c | 1 -
> test/test/test_cmdline.c | 9 -
> test/test/test_cmdline.h | 6 -
> test/test/test_cmdline_cirbuf.c | 1330 ------------------
> test/test/test_cmdline_lib.c | 117 +-
> 38 files changed, 293 insertions(+), 3762 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index f71d963..9fe625c 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -77,7 +77,6 @@
> #include <rte_flow.h>
> #include <rte_gro.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index 8e3b1f3..d903314 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -71,7 +71,6 @@
> #include <rte_arp.h>
> #include <rte_spinlock.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
> index f3ba247..e8fa7f0 100644
> --- a/examples/cmdline/commands.c
> +++ b/examples/cmdline/commands.c
> @@ -74,7 +74,6 @@
> #endif
> #endif
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_ipaddr.h>
> #include <cmdline_parse_num.h>
> diff --git a/examples/cmdline/main.c b/examples/cmdline/main.c
> index c6de944..c229f50 100644
> --- a/examples/cmdline/main.c
> +++ b/examples/cmdline/main.c
> @@ -65,7 +65,6 @@
> #include <termios.h>
> #include <sys/queue.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_socket.h>
> #include <cmdline.h>
> diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
> index 7521187..f1df197 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c
> +++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
> @@ -37,7 +37,6 @@
>
> #include <rte_common.h>
> #include <rte_malloc.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c
> index a82e552..e49d9ca 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c
> +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c
> @@ -41,7 +41,6 @@
> #include <rte_common.h>
> #include <rte_hexdump.h>
> #include <rte_malloc.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
> index 349db6b..0f680db 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
> +++ b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
> @@ -40,7 +40,6 @@
> #include <rte_common.h>
> #include <rte_hexdump.h>
> #include <rte_malloc.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
> index 70b1938..b9e4ed5 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
> +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
> @@ -40,7 +40,6 @@
> #include <rte_common.h>
> #include <rte_hexdump.h>
> #include <rte_malloc.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c
> index 4590c2b..4f54094 100644
> --- a/examples/ip_pipeline/thread_fe.c
> +++ b/examples/ip_pipeline/thread_fe.c
> @@ -1,7 +1,6 @@
> #include <rte_common.h>
> #include <rte_ring.h>
> #include <rte_malloc.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
> index 62537b0..c0fc6ea 100644
> --- a/examples/multi_process/simple_mp/main.c
> +++ b/examples/multi_process/simple_mp/main.c
> @@ -64,7 +64,6 @@
> #include <rte_ring.h>
> #include <rte_log.h>
> #include <rte_mempool.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_socket.h>
> diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c
> index ef6dc58..264dea2 100644
> --- a/examples/multi_process/simple_mp/mp_commands.c
> +++ b/examples/multi_process/simple_mp/mp_commands.c
> @@ -54,7 +54,6 @@
> #include <rte_mempool.h>
> #include <rte_string_fns.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_socket.h>
> diff --git a/examples/qos_sched/cmdline.c b/examples/qos_sched/cmdline.c
> index b62d165..c2a4f6b 100644
> --- a/examples/qos_sched/cmdline.c
> +++ b/examples/qos_sched/cmdline.c
> @@ -36,7 +36,6 @@
> #include <inttypes.h>
> #include <string.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/quota_watermark/qwctl/commands.c b/examples/quota_watermark/qwctl/commands.c
> index 5cac0e1..a30a35c 100644
> --- a/examples/quota_watermark/qwctl/commands.c
> +++ b/examples/quota_watermark/qwctl/commands.c
> @@ -36,7 +36,6 @@
> #include <string.h>
> #include <termios.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
> diff --git a/examples/quota_watermark/qwctl/qwctl.c b/examples/quota_watermark/qwctl/qwctl.c
> index 18ec17a..2831667 100644
> --- a/examples/quota_watermark/qwctl/qwctl.c
> +++ b/examples/quota_watermark/qwctl/qwctl.c
> @@ -42,7 +42,6 @@
> #include <rte_log.h>
> #include <rte_memzone.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_socket.h>
> #include <cmdline.h>
> diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
> index 63f711e..83cd215 100644
> --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
> +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
> @@ -37,7 +37,6 @@
> #include <stdio.h>
> #include <termios.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_parse_num.h>
> diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
> index 6f234fb..d013715 100644
> --- a/examples/vm_power_manager/vm_power_cli.c
> +++ b/examples/vm_power_manager/vm_power_cli.c
> @@ -39,7 +39,6 @@
> #include <termios.h>
> #include <errno.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_parse_num.h>
> diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
> index 2c48e62..35c8972 100644
> --- a/lib/librte_cmdline/Makefile
> +++ b/lib/librte_cmdline/Makefile
> @@ -38,28 +38,24 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
>
> EXPORT_MAP := rte_cmdline_version.map
>
> -LIBABIVER := 2
> +LIBABIVER := 3
>
> # all source are stored in SRCS-y
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
> -SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_etheraddr.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_ipaddr.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_num.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_string.c
> -SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_rdline.c
> -SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_vt100.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_socket.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_portlist.c
>
> -CFLAGS += -D_GNU_SOURCE
> LDLIBS += -lrte_eal
>
> # install includes
> INCS := cmdline.h cmdline_parse.h cmdline_parse_num.h cmdline_parse_ipaddr.h
> -INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h cmdline_rdline.h
> -INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist.h
> +INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h
> +INCS += cmdline_socket.h cmdline_parse_portlist.h
> SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)
>
> include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
> index d749165..1c19546 100644
> --- a/lib/librte_cmdline/cmdline.c
> +++ b/lib/librte_cmdline/cmdline.c
> @@ -58,79 +58,181 @@
> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> +#include <ctype.h>
> +#include <histedit.h>
> +#include <stdint.h>
> #include <stdio.h>
> #include <string.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdarg.h>
> -#include <inttypes.h>
> #include <fcntl.h>
> #include <poll.h>
> #include <errno.h>
> -#include <termios.h>
> -#include <netinet/in.h>
> -
> -#include <rte_string_fns.h>
>
> #include "cmdline_parse.h"
> -#include "cmdline_rdline.h"
> #include "cmdline.h"
>
> -static void
> -cmdline_valid_buffer(struct rdline *rdl, const char *buf,
> - __attribute__((unused)) unsigned int size)
> +struct cmdline {
> + char *line;
> + FILE *f_in;
> + FILE *f_out;
> + cmdline_parse_ctx_t *ctx;
> + EditLine *el;
> + History *hist;
> + HistEvent histev;
> + uint32_t eof:1;
> + uint32_t error:1;
> + char prompt[RDLINE_PROMPT_SIZE];
> +};
> +
> +void
> +cmdline_set_prompt(struct cmdline *cl, const char *prompt)
> {
> - struct cmdline *cl = rdl->opaque;
> - int ret;
> - ret = cmdline_parse(cl, buf);
> - if (ret == CMDLINE_PARSE_AMBIGUOUS)
> - cmdline_printf(cl, "Ambiguous command\n");
> - else if (ret == CMDLINE_PARSE_NOMATCH)
> - cmdline_printf(cl, "Command not found\n");
> - else if (ret == CMDLINE_PARSE_BAD_ARGS)
> - cmdline_printf(cl, "Bad arguments\n");
> + if (!cl || !prompt)
> + return;
> + snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
> }
>
> -static int
> -cmdline_complete_buffer(struct rdline *rdl, const char *buf,
> - char *dstbuf, unsigned int dstsize,
> - int *state)
> +void *
> +cmdline_ctx_get(struct cmdline *cl)
> {
> - struct cmdline *cl = rdl->opaque;
> - return cmdline_complete(cl, buf, state, dstbuf, dstsize);
> + if (!cl)
> + return NULL;
> + return cl->ctx;
> }
>
> -int
> -cmdline_write_char(struct rdline *rdl, char c)
> +static char *
> +cmdline_el_prompt(EditLine *el)
> {
> - int ret = -1;
> struct cmdline *cl;
>
> - if (!rdl)
> - return -1;
> -
> - cl = rdl->opaque;
> + if (el_get(el, EL_CLIENTDATA, &cl))
> + return NULL;
> + return cl->prompt;
> +}
>
> - if (cl->s_out >= 0)
> - ret = write(cl->s_out, &c, 1);
> +static unsigned char
> +cmdline_el_execute(EditLine *el, int c)
> +{
> + const LineInfo *li = el_line(el);
> + size_t len = li->lastchar - li->buffer;
> + char *line;
> + struct cmdline *cl;
> + int ret;
>
> - return ret;
> + (void)c;
> + if (el_get(el, EL_CLIENTDATA, &cl))
> + return CC_FATAL;
> + line = realloc(cl->line, len + 2);
> + if (!line) {
> + cl->error = 1;
> + return CC_FATAL;
> + }
> + cl->line = line;
> + memcpy(line, li->buffer, len);
> + line[len] = '\n';
> + line[len + 1] = '\0';
> + fputs("\r\n", cl->f_out);
> + ret = cmdline_parse(cl, line);
> + if (ret == CMDLINE_PARSE_AMBIGUOUS)
> + fprintf(cl->f_out, "Ambiguous command\r\n");
> + else if (ret == CMDLINE_PARSE_NOMATCH)
> + fprintf(cl->f_out, "Command not found\r\n");
> + else if (ret == CMDLINE_PARSE_BAD_ARGS)
> + fprintf(cl->f_out, "Bad arguments\r\n");
> + if (cl->error)
> + return CC_FATAL;
> + if (cl->eof)
> + return CC_EOF;
> + if (len) {
> + line[len] = '\0';
> + history(cl->hist, &cl->histev, H_ENTER, line);
> + }
> + return CC_NEWLINE;
> }
>
> +static unsigned char
> +cmdline_el_complete(EditLine *el, int c)
> +{
> + const LineInfo *li = el_line(el);
> + size_t pos = li->cursor - li->buffer;
> + char *line;
> + struct cmdline *cl;
> + char complete_buf[RDLINE_COMPLETE_SIZE];
> + int complete_state;
> + int ret;
>
> -void
> -cmdline_set_prompt(struct cmdline *cl, const char *prompt)
> + if (el_get(el, EL_CLIENTDATA, &cl))
> + return CC_FATAL;
> + line = realloc(cl->line, pos + 1);
> + if (!line) {
> + cl->error = 1;
> + return CC_FATAL;
> + }
> + cl->line = line;
> + memcpy(line, li->buffer, pos);
> + line[pos] = '\0';
> + if (c == '\t')
> + complete_state = 0;
> + else
> + complete_state = -1;
> + /* see in parse.h for help on complete() */
> + ret = cmdline_complete(cl, line, &complete_state,
> + complete_buf, sizeof(complete_buf));
> + /* no completion or error */
> + if (ret <= 0)
> + return CC_ARGHACK;
> + /* string must be NUL-terminated */
> + if (strnlen(complete_buf, sizeof(complete_buf)) == sizeof(complete_buf))
> + return CC_ERROR;
> + /* add chars */
> + if (ret == CMDLINE_PARSE_COMPLETED_BUFFER) {
> + /* if in the middle of a token, remove its suffix first */
> + for (pos = 0; li->cursor + pos != li->lastchar; pos++)
> + if (isblank(li->cursor[pos]))
> + break;
> + el_cursor(el, pos);
> + el_deletestr(el, pos);
> + if (el_insertstr(el, complete_buf))
> + return CC_ERROR;
> + return CC_REFRESH;
> + }
> + /* choice */
> + fputs("\r\n", cl->f_out);
> + while (ret) {
> + fputc(' ', cl->f_out);
> + fputs(complete_buf, cl->f_out);
> + fputs("\r\n", cl->f_out);
> + ret = cmdline_complete(cl, line, &complete_state,
> + complete_buf, sizeof(complete_buf));
> + }
> + el_set(el, EL_REFRESH);
> + return CC_REDISPLAY;
> +}
> +
> +static unsigned char
> +cmdline_el_delete_next_char_or_eof(EditLine *el, int c)
> {
> - if (!cl || !prompt)
> - return;
> - snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
> + const LineInfo *li = el_line(el);
> + struct cmdline *cl;
> +
> + (void)c;
> + if (el_get(el, EL_CLIENTDATA, &cl))
> + return CC_FATAL;
> + if (li->buffer == li->lastchar) {
> + cl->eof = 1;
> + return CC_EOF;
> + }
> + el_cursor(el, 1);
> + el_deletestr(el, 1);
> + return CC_REFRESH;
> }
>
> struct cmdline *
> cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out)
> {
> struct cmdline *cl;
> - int ret;
>
> if (!ctx || !prompt)
> return NULL;
> @@ -139,36 +241,89 @@ cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out)
> if (cl == NULL)
> return NULL;
> memset(cl, 0, sizeof(struct cmdline));
> - cl->s_in = s_in;
> - cl->s_out = s_out;
> + cl->line = NULL;
> + s_in = dup(s_in);
> + s_out = s_out != -1 ? dup(s_out) : open("/dev/null", O_WRONLY);
> + if (s_in == -1 || s_out == -1)
> + goto error;
> + cl->f_in = fdopen(s_in, "rb");
> + cl->f_out = fdopen(s_out, "wb");
> + if (!cl->f_in || !cl->f_out)
> + goto error;
> cl->ctx = ctx;
> -
> - ret = rdline_init(&cl->rdl, cmdline_write_char, cmdline_valid_buffer,
> - cmdline_complete_buffer);
> - if (ret != 0) {
> - free(cl);
> - return NULL;
> - }
> -
> - cl->rdl.opaque = cl;
> + cl->el = el_init("dpdk", cl->f_in, cl->f_out, stderr);
> + if (!cl->el)
> + goto error;
> + if (el_set(cl->el, EL_CLIENTDATA, cl))
> + goto error;
> cmdline_set_prompt(cl, prompt);
> - rdline_newline(&cl->rdl, cl->prompt);
> -
> + if (el_set(cl->el, EL_PROMPT, cmdline_el_prompt))
> + goto error;
> + if (el_set(cl->el, EL_EDITOR, "emacs"))
> + goto error;
> + if (el_set(cl->el, EL_SIGNAL, 1))
> + goto error;
> + cl->hist = history_init();
> + if (!cl->hist)
> + goto error;
> + if (history(cl->hist, &cl->histev, H_SETSIZE,
> + RDLINE_HISTORY_MAX_LINE) < 0)
> + goto error;
> + if (history(cl->hist, &cl->histev, H_SETUNIQUE, 1))
> + goto error;
> + if (el_set(cl->el, EL_HIST, history, cl->hist))
> + goto error;
> + if (el_set(cl->el, EL_ADDFN, "ed-execute", "Execute command",
> + cmdline_el_execute))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "^J", "ed-execute", NULL))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "^M", "ed-execute", NULL))
> + goto error;
> + if (el_set(cl->el, EL_ADDFN, "ed-complete", "Complete argument",
> + cmdline_el_complete))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "^I", "ed-complete", NULL))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "?", "ed-complete", NULL))
> + goto error;
> + if (el_set(cl->el, EL_ADDFN, "ed-delete-next-char-or-eof",
> + "Delete next character or assume EOF",
> + cmdline_el_delete_next_char_or_eof))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "^D",
> + "ed-delete-next-char-or-eof", NULL))
> + goto error;
> + if (el_set(cl->el, EL_BIND, "^W", "ed-delete-prev-word", NULL))
> + goto error;
> return cl;
> +error:
> + if (cl->hist)
> + history_end(cl->hist);
> + if (cl->el)
> + el_end(cl->el);
> + if (cl->f_out)
> + fclose(cl->f_out);
> + else if (s_out != -1)
> + close(s_out);
> + if (cl->f_in)
> + fclose(cl->f_in);
> + else if (s_in != -1)
> + close(s_in);
> + free(cl);
> + return NULL;
> }
>
> void
> cmdline_free(struct cmdline *cl)
> {
> - dprintf("called\n");
> -
> if (!cl)
> return;
> -
> - if (cl->s_in > 2)
> - close(cl->s_in);
> - if (cl->s_out != cl->s_in && cl->s_out > 2)
> - close(cl->s_out);
> + history_end(cl->hist);
> + el_end(cl->el);
> + fclose(cl->f_out);
> + fclose(cl->f_in);
> + free(cl->line);
> free(cl);
> }
>
> @@ -180,70 +335,23 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
> if (!cl || !fmt)
> return;
>
> -#ifdef _GNU_SOURCE
> - if (cl->s_out < 0)
> - return;
> - va_start(ap, fmt);
> - vdprintf(cl->s_out, fmt, ap);
> - va_end(ap);
> -#else
> - int ret;
> - char *buf;
> -
> - if (cl->s_out < 0)
> - return;
> -
> - buf = malloc(BUFSIZ);
> - if (buf == NULL)
> - return;
> va_start(ap, fmt);
> - ret = vsnprintf(buf, BUFSIZ, fmt, ap);
> + vfprintf(cl->f_out, fmt, ap);
> va_end(ap);
> - if (ret < 0) {
> - free(buf);
> - return;
> - }
> - if (ret >= BUFSIZ)
> - ret = BUFSIZ - 1;
> - ret = write(cl->s_out, buf, ret);
> - (void)ret;
> - free(buf);
> -#endif
> }
>
> int
> cmdline_in(struct cmdline *cl, const char *buf, int size)
> {
> - const char *history, *buffer;
> - size_t histlen, buflen;
> - int ret = 0;
> - int i, same;
> + int i;
>
> if (!cl || !buf)
> return -1;
>
> for (i=0; i<size; i++) {
> - ret = rdline_char_in(&cl->rdl, buf[i]);
> -
> - if (ret == RDLINE_RES_VALIDATED) {
> - buffer = rdline_get_buffer(&cl->rdl);
> - history = rdline_get_history_item(&cl->rdl, 0);
> - if (history) {
> - histlen = strnlen(history, RDLINE_BUF_SIZE);
> - same = !memcmp(buffer, history, histlen) &&
> - buffer[histlen] == '\n';
> - }
> - else
> - same = 0;
> - buflen = strnlen(buffer, RDLINE_BUF_SIZE);
> - if (buflen > 1 && !same)
> - rdline_add_history(&cl->rdl, buffer);
> - rdline_newline(&cl->rdl, cl->prompt);
> - }
> - else if (ret == RDLINE_RES_EOF)
> - return -1;
> - else if (ret == RDLINE_RES_EXITED)
> - return -1;
> + char tmp[2] = { buf[i], '\0' };
> +
> + el_push(cl->el, tmp);
> }
> return i;
> }
> @@ -253,7 +361,7 @@ cmdline_quit(struct cmdline *cl)
> {
> if (!cl)
> return;
> - rdline_quit(&cl->rdl);
> + cl->eof = 1;
> }
>
> int
> @@ -261,48 +369,49 @@ cmdline_poll(struct cmdline *cl)
> {
> struct pollfd pfd;
> int status;
> - ssize_t read_status;
> - char c;
> + int read_status;
> + int flags;
>
> if (!cl)
> return -EINVAL;
> - else if (cl->rdl.status == RDLINE_EXITED)
> + else if (cl->error)
> + return RDLINE_ERROR;
> + else if (cl->eof)
> return RDLINE_EXITED;
>
> - pfd.fd = cl->s_in;
> + pfd.fd = fileno(cl->f_in);
> pfd.events = POLLIN;
> pfd.revents = 0;
>
> status = poll(&pfd, 1, 0);
> if (status < 0)
> - return status;
> - else if (status > 0) {
> - c = -1;
> - read_status = read(cl->s_in, &c, 1);
> - if (read_status < 0)
> - return read_status;
> -
> - status = cmdline_in(cl, &c, 1);
> - if (status < 0 && cl->rdl.status != RDLINE_EXITED)
> - return status;
> - }
> -
> - return cl->rdl.status;
> + return RDLINE_ERROR;
> + if (!status)
> + return RDLINE_RUNNING;
> + flags = fcntl(pfd.fd, F_GETFL);
> + if (!(flags & O_NONBLOCK))
> + fcntl(pfd.fd, F_SETFL, flags | O_NONBLOCK);
> + if (!el_gets(cl->el, &read_status) && read_status == -1)
> + cl->error = 1;
> + if (!(flags & O_NONBLOCK))
> + fcntl(pfd.fd, F_SETFL, flags);
> + return cl->error ? RDLINE_ERROR :
> + cl->eof ? RDLINE_EXITED :
> + RDLINE_RUNNING;
> }
>
> void
> cmdline_interact(struct cmdline *cl)
> {
> - char c;
> -
> if (!cl)
> return;
>
> - c = -1;
> - while (1) {
> - if (read(cl->s_in, &c, 1) <= 0)
> - break;
> - if (cmdline_in(cl, &c, 1) < 0)
> - break;
> + while (!cl->error && !cl->eof) {
> + int read_status;
> +
> + if (el_gets(cl->el, &read_status))
> + continue;
> + if (read_status == -1)
> + cl->error = 1;
> }
> }
> diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h
> index 65d73b0..4507268 100644
> --- a/lib/librte_cmdline/cmdline.h
> +++ b/lib/librte_cmdline/cmdline.h
> @@ -61,8 +61,6 @@
> #ifndef _CMDLINE_H_
> #define _CMDLINE_H_
>
> -#include <termios.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
>
> /**
> @@ -75,22 +73,26 @@
> extern "C" {
> #endif
>
> -struct cmdline {
> - int s_in;
> - int s_out;
> - cmdline_parse_ctx_t *ctx;
> - struct rdline rdl;
> - char prompt[RDLINE_PROMPT_SIZE];
> - struct termios oldterm;
> +#define RDLINE_PROMPT_SIZE 32
> +#define RDLINE_HISTORY_MAX_LINE 64
> +#define RDLINE_COMPLETE_SIZE 128
> +
> +enum rdline_status {
> + RDLINE_ERROR = -1,
> + RDLINE_INIT,
> + RDLINE_RUNNING,
> + RDLINE_EXITED,
> };
>
> +struct cmdline;
> +
> +void *cmdline_ctx_get(struct cmdline *cl);
> struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
> void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
> void cmdline_free(struct cmdline *cl);
> void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
> __attribute__((format(printf,2,3)));
> int cmdline_in(struct cmdline *cl, const char *buf, int size);
> -int cmdline_write_char(struct rdline *rdl, char c);
>
> /**
> * This function is nonblocking equivalent of ``cmdline_interact()``. It polls
> diff --git a/lib/librte_cmdline/cmdline_cirbuf.c b/lib/librte_cmdline/cmdline_cirbuf.c
> deleted file mode 100644
> index f506f88..0000000
> --- a/lib/librte_cmdline/cmdline_cirbuf.c
> +++ /dev/null
> @@ -1,466 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#include <string.h>
> -#include <errno.h>
> -#include <stdio.h>
> -
> -#include "cmdline_cirbuf.h"
> -
> -
> -int
> -cirbuf_init(struct cirbuf *cbuf, char *buf, unsigned int start, unsigned int maxlen)
> -{
> - if (!cbuf || !buf)
> - return -EINVAL;
> - cbuf->maxlen = maxlen;
> - cbuf->len = 0;
> - cbuf->start = start;
> - cbuf->end = start;
> - cbuf->buf = buf;
> - return 0;
> -}
> -
> -/* multiple add */
> -
> -int
> -cirbuf_add_buf_head(struct cirbuf *cbuf, const char *c, unsigned int n)
> -{
> - unsigned int e;
> -
> - if (!cbuf || !c || !n || n > CIRBUF_GET_FREELEN(cbuf))
> - return -EINVAL;
> -
> - e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0;
> -
> - if (n < cbuf->start + e) {
> - dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->start - n + e, n);
> - memcpy(cbuf->buf + cbuf->start - n + e, c, n);
> - }
> - else {
> - dprintf("s[%d] -> d[%d] (%d)\n", + n - (cbuf->start + e), 0,
> - cbuf->start + e);
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - n +
> - (cbuf->start + e), 0, n - (cbuf->start + e));
> - memcpy(cbuf->buf, c + n - (cbuf->start + e) , cbuf->start + e);
> - memcpy(cbuf->buf + cbuf->maxlen - n + (cbuf->start + e), c,
> - n - (cbuf->start + e));
> - }
> - cbuf->len += n;
> - cbuf->start += (cbuf->maxlen - n + e);
> - cbuf->start %= cbuf->maxlen;
> - return n;
> -}
> -
> -/* multiple add */
> -
> -int
> -cirbuf_add_buf_tail(struct cirbuf *cbuf, const char *c, unsigned int n)
> -{
> - unsigned int e;
> -
> - if (!cbuf || !c || !n || n > CIRBUF_GET_FREELEN(cbuf))
> - return -EINVAL;
> -
> - e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0;
> -
> - if (n < cbuf->maxlen - cbuf->end - 1 + e) {
> - dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->end + !e, n);
> - memcpy(cbuf->buf + cbuf->end + !e, c, n);
> - }
> - else {
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end + !e, 0,
> - cbuf->maxlen - cbuf->end - 1 + e);
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - cbuf->end - 1 +
> - e, 0, n - cbuf->maxlen + cbuf->end + 1 - e);
> - memcpy(cbuf->buf + cbuf->end + !e, c, cbuf->maxlen -
> - cbuf->end - 1 + e);
> - memcpy(cbuf->buf, c + cbuf->maxlen - cbuf->end - 1 + e,
> - n - cbuf->maxlen + cbuf->end + 1 - e);
> - }
> - cbuf->len += n;
> - cbuf->end += n - e;
> - cbuf->end %= cbuf->maxlen;
> - return n;
> -}
> -
> -/* add at head */
> -
> -static inline void
> -__cirbuf_add_head(struct cirbuf * cbuf, char c)
> -{
> - if (!CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->start += (cbuf->maxlen - 1);
> - cbuf->start %= cbuf->maxlen;
> - }
> - cbuf->buf[cbuf->start] = c;
> - cbuf->len ++;
> -}
> -
> -int
> -cirbuf_add_head_safe(struct cirbuf * cbuf, char c)
> -{
> - if (cbuf && !CIRBUF_IS_FULL(cbuf)) {
> - __cirbuf_add_head(cbuf, c);
> - return 0;
> - }
> - return -EINVAL;
> -}
> -
> -void
> -cirbuf_add_head(struct cirbuf * cbuf, char c)
> -{
> - __cirbuf_add_head(cbuf, c);
> -}
> -
> -/* add at tail */
> -
> -static inline void
> -__cirbuf_add_tail(struct cirbuf * cbuf, char c)
> -{
> - if (!CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->end ++;
> - cbuf->end %= cbuf->maxlen;
> - }
> - cbuf->buf[cbuf->end] = c;
> - cbuf->len ++;
> -}
> -
> -int
> -cirbuf_add_tail_safe(struct cirbuf * cbuf, char c)
> -{
> - if (cbuf && !CIRBUF_IS_FULL(cbuf)) {
> - __cirbuf_add_tail(cbuf, c);
> - return 0;
> - }
> - return -EINVAL;
> -}
> -
> -void
> -cirbuf_add_tail(struct cirbuf * cbuf, char c)
> -{
> - __cirbuf_add_tail(cbuf, c);
> -}
> -
> -
> -static inline void
> -__cirbuf_shift_left(struct cirbuf *cbuf)
> -{
> - unsigned int i;
> - char tmp = cbuf->buf[cbuf->start];
> -
> - for (i=0 ; i<cbuf->len ; i++) {
> - cbuf->buf[(cbuf->start+i)%cbuf->maxlen] =
> - cbuf->buf[(cbuf->start+i+1)%cbuf->maxlen];
> - }
> - cbuf->buf[(cbuf->start-1+cbuf->maxlen)%cbuf->maxlen] = tmp;
> - cbuf->start += (cbuf->maxlen - 1);
> - cbuf->start %= cbuf->maxlen;
> - cbuf->end += (cbuf->maxlen - 1);
> - cbuf->end %= cbuf->maxlen;
> -}
> -
> -static inline void
> -__cirbuf_shift_right(struct cirbuf *cbuf)
> -{
> - unsigned int i;
> - char tmp = cbuf->buf[cbuf->end];
> -
> - for (i=0 ; i<cbuf->len ; i++) {
> - cbuf->buf[(cbuf->end+cbuf->maxlen-i)%cbuf->maxlen] =
> - cbuf->buf[(cbuf->end+cbuf->maxlen-i-1)%cbuf->maxlen];
> - }
> - cbuf->buf[(cbuf->end+1)%cbuf->maxlen] = tmp;
> - cbuf->start += 1;
> - cbuf->start %= cbuf->maxlen;
> - cbuf->end += 1;
> - cbuf->end %= cbuf->maxlen;
> -}
> -
> -/* XXX we could do a better algorithm here... */
> -int
> -cirbuf_align_left(struct cirbuf * cbuf)
> -{
> - if (!cbuf)
> - return -EINVAL;
> -
> - if (cbuf->start < cbuf->maxlen/2) {
> - while (cbuf->start != 0) {
> - __cirbuf_shift_left(cbuf);
> - }
> - }
> - else {
> - while (cbuf->start != 0) {
> - __cirbuf_shift_right(cbuf);
> - }
> - }
> -
> - return 0;
> -}
> -
> -/* XXX we could do a better algorithm here... */
> -int
> -cirbuf_align_right(struct cirbuf * cbuf)
> -{
> - if (!cbuf)
> - return -EINVAL;
> -
> - if (cbuf->start >= cbuf->maxlen/2) {
> - while (cbuf->end != cbuf->maxlen-1) {
> - __cirbuf_shift_left(cbuf);
> - }
> - }
> - else {
> - while (cbuf->start != cbuf->maxlen-1) {
> - __cirbuf_shift_right(cbuf);
> - }
> - }
> -
> - return 0;
> -}
> -
> -/* buffer del */
> -
> -int
> -cirbuf_del_buf_head(struct cirbuf *cbuf, unsigned int size)
> -{
> - if (!cbuf || !size || size > CIRBUF_GET_LEN(cbuf))
> - return -EINVAL;
> -
> - cbuf->len -= size;
> - if (CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->start += size - 1;
> - cbuf->start %= cbuf->maxlen;
> - }
> - else {
> - cbuf->start += size;
> - cbuf->start %= cbuf->maxlen;
> - }
> - return 0;
> -}
> -
> -/* buffer del */
> -
> -int
> -cirbuf_del_buf_tail(struct cirbuf *cbuf, unsigned int size)
> -{
> - if (!cbuf || !size || size > CIRBUF_GET_LEN(cbuf))
> - return -EINVAL;
> -
> - cbuf->len -= size;
> - if (CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->end += (cbuf->maxlen - size + 1);
> - cbuf->end %= cbuf->maxlen;
> - }
> - else {
> - cbuf->end += (cbuf->maxlen - size);
> - cbuf->end %= cbuf->maxlen;
> - }
> - return 0;
> -}
> -
> -/* del at head */
> -
> -static inline void
> -__cirbuf_del_head(struct cirbuf * cbuf)
> -{
> - cbuf->len --;
> - if (!CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->start ++;
> - cbuf->start %= cbuf->maxlen;
> - }
> -}
> -
> -int
> -cirbuf_del_head_safe(struct cirbuf * cbuf)
> -{
> - if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) {
> - __cirbuf_del_head(cbuf);
> - return 0;
> - }
> - return -EINVAL;
> -}
> -
> -void
> -cirbuf_del_head(struct cirbuf * cbuf)
> -{
> - __cirbuf_del_head(cbuf);
> -}
> -
> -/* del at tail */
> -
> -static inline void
> -__cirbuf_del_tail(struct cirbuf * cbuf)
> -{
> - cbuf->len --;
> - if (!CIRBUF_IS_EMPTY(cbuf)) {
> - cbuf->end += (cbuf->maxlen - 1);
> - cbuf->end %= cbuf->maxlen;
> - }
> -}
> -
> -int
> -cirbuf_del_tail_safe(struct cirbuf * cbuf)
> -{
> - if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) {
> - __cirbuf_del_tail(cbuf);
> - return 0;
> - }
> - return -EINVAL;
> -}
> -
> -void
> -cirbuf_del_tail(struct cirbuf * cbuf)
> -{
> - __cirbuf_del_tail(cbuf);
> -}
> -
> -/* convert to buffer */
> -
> -int
> -cirbuf_get_buf_head(struct cirbuf *cbuf, char *c, unsigned int size)
> -{
> - unsigned int n;
> -
> - if (!cbuf || !c)
> - return -EINVAL;
> -
> - n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf);
> -
> - if (!n)
> - return 0;
> -
> - if (cbuf->start <= cbuf->end) {
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0, n);
> - memcpy(c, cbuf->buf + cbuf->start , n);
> - }
> - else {
> - /* check if we need to go from end to the beginning */
> - if (n <= cbuf->maxlen - cbuf->start) {
> - dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->start, n);
> - memcpy(c, cbuf->buf + cbuf->start , n);
> - }
> - else {
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0,
> - cbuf->maxlen - cbuf->start);
> - dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->maxlen - cbuf->start,
> - n - cbuf->maxlen + cbuf->start);
> - memcpy(c, cbuf->buf + cbuf->start , cbuf->maxlen - cbuf->start);
> - memcpy(c + cbuf->maxlen - cbuf->start, cbuf->buf,
> - n - cbuf->maxlen + cbuf->start);
> - }
> - }
> - return n;
> -}
> -
> -/* convert to buffer */
> -
> -int
> -cirbuf_get_buf_tail(struct cirbuf *cbuf, char *c, unsigned int size)
> -{
> - unsigned int n;
> -
> - if (!cbuf || !c)
> - return -EINVAL;
> -
> - n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf);
> -
> - if (!n)
> - return 0;
> -
> - if (cbuf->start <= cbuf->end) {
> - dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end - n + 1, 0, n);
> - memcpy(c, cbuf->buf + cbuf->end - n + 1, n);
> - }
> - else {
> - /* check if we need to go from end to the beginning */
> - if (n <= cbuf->end + 1) {
> - dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->end - n + 1, n);
> - memcpy(c, cbuf->buf + cbuf->end - n + 1, n);
> - }
> - else {
> - dprintf("s[%d] -> d[%d] (%d)\n", 0,
> - cbuf->maxlen - cbuf->start, cbuf->end + 1);
> - dprintf("s[%d] -> d[%d] (%d)\n",
> - cbuf->maxlen - n + cbuf->end + 1, 0, n - cbuf->end - 1);
> - memcpy(c + cbuf->maxlen - cbuf->start,
> - cbuf->buf, cbuf->end + 1);
> - memcpy(c, cbuf->buf + cbuf->maxlen - n + cbuf->end +1,
> - n - cbuf->end - 1);
> - }
> - }
> - return n;
> -}
> -
> -/* get head or get tail */
> -
> -char
> -cirbuf_get_head(struct cirbuf * cbuf)
> -{
> - return cbuf->buf[cbuf->start];
> -}
> -
> -/* get head or get tail */
> -
> -char
> -cirbuf_get_tail(struct cirbuf * cbuf)
> -{
> - return cbuf->buf[cbuf->end];
> -}
> diff --git a/lib/librte_cmdline/cmdline_cirbuf.h b/lib/librte_cmdline/cmdline_cirbuf.h
> deleted file mode 100644
> index 6321dec..0000000
> --- a/lib/librte_cmdline/cmdline_cirbuf.h
> +++ /dev/null
> @@ -1,245 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#ifndef _CIRBUF_H_
> -#define _CIRBUF_H_
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -/**
> - * This structure is the header of a cirbuf type.
> - */
> -struct cirbuf {
> - unsigned int maxlen; /**< total len of the fifo (number of elements) */
> - unsigned int start; /**< indice of the first elt */
> - unsigned int end; /**< indice of the last elt */
> - unsigned int len; /**< current len of fifo */
> - char *buf;
> -};
> -
> -#ifdef RTE_LIBRTE_CMDLINE_DEBUG
> -#define dprintf_(fmt, ...) printf("line %3.3d - " fmt "%.0s", __LINE__, __VA_ARGS__)
> -#define dprintf(...) dprintf_(__VA_ARGS__, "dummy")
> -#else
> -#define dprintf(...) (void)0
> -#endif
> -
> -
> -/**
> - * Init the circular buffer
> - */
> -int cirbuf_init(struct cirbuf *cbuf, char *buf, unsigned int start, unsigned int maxlen);
> -
> -
> -/**
> - * Return 1 if the circular buffer is full
> - */
> -#define CIRBUF_IS_FULL(cirbuf) ((cirbuf)->maxlen == (cirbuf)->len)
> -
> -/**
> - * Return 1 if the circular buffer is empty
> - */
> -#define CIRBUF_IS_EMPTY(cirbuf) ((cirbuf)->len == 0)
> -
> -/**
> - * return current size of the circular buffer (number of used elements)
> - */
> -#define CIRBUF_GET_LEN(cirbuf) ((cirbuf)->len)
> -
> -/**
> - * return size of the circular buffer (used + free elements)
> - */
> -#define CIRBUF_GET_MAXLEN(cirbuf) ((cirbuf)->maxlen)
> -
> -/**
> - * return the number of free elts
> - */
> -#define CIRBUF_GET_FREELEN(cirbuf) ((cirbuf)->maxlen - (cirbuf)->len)
> -
> -/**
> - * Iterator for a circular buffer
> - * c: struct cirbuf pointer
> - * i: an integer type internally used in the macro
> - * e: char that takes the value for each iteration
> - */
> -#define CIRBUF_FOREACH(c, i, e) \
> - for ( i=0, e=(c)->buf[(c)->start] ; \
> - i<((c)->len) ; \
> - i ++, e=(c)->buf[((c)->start+i)%((c)->maxlen)])
> -
> -
> -/**
> - * Add a character at head of the circular buffer. Return 0 on success, or
> - * a negative value on error.
> - */
> -int cirbuf_add_head_safe(struct cirbuf *cbuf, char c);
> -
> -/**
> - * Add a character at head of the circular buffer. You _must_ check that you
> - * have enough free space in the buffer before calling this func.
> - */
> -void cirbuf_add_head(struct cirbuf *cbuf, char c);
> -
> -/**
> - * Add a character at tail of the circular buffer. Return 0 on success, or
> - * a negative value on error.
> - */
> -int cirbuf_add_tail_safe(struct cirbuf *cbuf, char c);
> -
> -/**
> - * Add a character at tail of the circular buffer. You _must_ check that you
> - * have enough free space in the buffer before calling this func.
> - */
> -void cirbuf_add_tail(struct cirbuf *cbuf, char c);
> -
> -/**
> - * Remove a char at the head of the circular buffer. Return 0 on
> - * success, or a negative value on error.
> - */
> -int cirbuf_del_head_safe(struct cirbuf *cbuf);
> -
> -/**
> - * Remove a char at the head of the circular buffer. You _must_ check
> - * that buffer is not empty before calling the function.
> - */
> -void cirbuf_del_head(struct cirbuf *cbuf);
> -
> -/**
> - * Remove a char at the tail of the circular buffer. Return 0 on
> - * success, or a negative value on error.
> - */
> -int cirbuf_del_tail_safe(struct cirbuf *cbuf);
> -
> -/**
> - * Remove a char at the tail of the circular buffer. You _must_ check
> - * that buffer is not empty before calling the function.
> - */
> -void cirbuf_del_tail(struct cirbuf *cbuf);
> -
> -/**
> - * Return the head of the circular buffer. You _must_ check that
> - * buffer is not empty before calling the function.
> - */
> -char cirbuf_get_head(struct cirbuf *cbuf);
> -
> -/**
> - * Return the tail of the circular buffer. You _must_ check that
> - * buffer is not empty before calling the function.
> - */
> -char cirbuf_get_tail(struct cirbuf *cbuf);
> -
> -/**
> - * Add a buffer at head of the circular buffer. 'c' is a pointer to a
> - * buffer, and n is the number of char to add. Return the number of
> - * copied bytes on success, or a negative value on error.
> - */
> -int cirbuf_add_buf_head(struct cirbuf *cbuf, const char *c, unsigned int n);
> -
> -/**
> - * Add a buffer at tail of the circular buffer. 'c' is a pointer to a
> - * buffer, and n is the number of char to add. Return the number of
> - * copied bytes on success, or a negative value on error.
> - */
> -int cirbuf_add_buf_tail(struct cirbuf *cbuf, const char *c, unsigned int n);
> -
> -/**
> - * Remove chars at the head of the circular buffer. Return 0 on
> - * success, or a negative value on error.
> - */
> -int cirbuf_del_buf_head(struct cirbuf *cbuf, unsigned int size);
> -
> -/**
> - * Remove chars at the tail of the circular buffer. Return 0 on
> - * success, or a negative value on error.
> - */
> -int cirbuf_del_buf_tail(struct cirbuf *cbuf, unsigned int size);
> -
> -/**
> - * Copy a maximum of 'size' characters from the head of the circular
> - * buffer to a flat one pointed by 'c'. Return the number of copied
> - * chars.
> - */
> -int cirbuf_get_buf_head(struct cirbuf *cbuf, char *c, unsigned int size);
> -
> -/**
> - * Copy a maximum of 'size' characters from the tail of the circular
> - * buffer to a flat one pointed by 'c'. Return the number of copied
> - * chars.
> - */
> -int cirbuf_get_buf_tail(struct cirbuf *cbuf, char *c, unsigned int size);
> -
> -
> -/**
> - * Set the start of the data to the index 0 of the internal buffer.
> - */
> -int cirbuf_align_left(struct cirbuf *cbuf);
> -
> -/**
> - * Set the end of the data to the last index of the internal buffer.
> - */
> -int cirbuf_align_right(struct cirbuf *cbuf);
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -#endif /* _CIRBUF_H_ */
> diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
> index 3e12ee5..0cc0b57 100644
> --- a/lib/librte_cmdline/cmdline_parse.c
> +++ b/lib/librte_cmdline/cmdline_parse.c
> @@ -70,7 +70,6 @@
>
> #include <rte_string_fns.h>
>
> -#include "cmdline_rdline.h"
> #include "cmdline_parse.h"
> #include "cmdline.h"
>
> @@ -267,7 +266,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
> if (!cl || !buf)
> return CMDLINE_PARSE_BAD_ARGS;
>
> - ctx = cl->ctx;
> + ctx = cmdline_ctx_get(cl);
>
> /*
> * - look if the buffer contains at least one line
> @@ -386,7 +385,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
> if (!cl || !buf || !state || !dst)
> return -1;
>
> - ctx = cl->ctx;
> + ctx = cmdline_ctx_get(cl);
>
> debug_printf("%s called\n", __func__);
> memset(&token_hdr, 0, sizeof(token_hdr));
> @@ -398,7 +397,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
> if (isblank2(buf[i]) && !isblank2(buf[i+1]))
> partial_tok = buf+i+1;
> }
> - partial_tok_len = strnlen(partial_tok, RDLINE_BUF_SIZE);
> + partial_tok_len = strlen(partial_tok);
>
> /* first call -> do a first pass */
> if (*state <= 0) {
> diff --git a/lib/librte_cmdline/cmdline_rdline.c b/lib/librte_cmdline/cmdline_rdline.c
> deleted file mode 100644
> index 1ef2258..0000000
> --- a/lib/librte_cmdline/cmdline_rdline.c
> +++ /dev/null
> @@ -1,697 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <stdint.h>
> -#include <string.h>
> -#include <stdarg.h>
> -#include <errno.h>
> -#include <ctype.h>
> -
> -#include "cmdline_cirbuf.h"
> -#include "cmdline_rdline.h"
> -
> -static void rdline_puts(struct rdline *rdl, const char *buf);
> -static void rdline_miniprintf(struct rdline *rdl,
> - const char *buf, unsigned int val);
> -
> -static void rdline_remove_old_history_item(struct rdline *rdl);
> -static void rdline_remove_first_history_item(struct rdline *rdl);
> -static unsigned int rdline_get_history_size(struct rdline *rdl);
> -
> -
> -/* isblank() needs _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE, so use our
> - * own. */
> -static int
> -isblank2(char c)
> -{
> - if (c == ' ' ||
> - c == '\t' )
> - return 1;
> - return 0;
> -}
> -
> -int
> -rdline_init(struct rdline *rdl,
> - rdline_write_char_t *write_char,
> - rdline_validate_t *validate,
> - rdline_complete_t *complete)
> -{
> - if (!rdl || !write_char || !validate || !complete)
> - return -EINVAL;
> - memset(rdl, 0, sizeof(*rdl));
> - rdl->validate = validate;
> - rdl->complete = complete;
> - rdl->write_char = write_char;
> - rdl->status = RDLINE_INIT;
> - return cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE);
> -}
> -
> -void
> -rdline_newline(struct rdline *rdl, const char *prompt)
> -{
> - unsigned int i;
> -
> - if (!rdl || !prompt)
> - return;
> -
> - vt100_init(&rdl->vt100);
> - cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
> -
> - rdl->prompt_size = strnlen(prompt, RDLINE_PROMPT_SIZE-1);
> - if (prompt != rdl->prompt)
> - memcpy(rdl->prompt, prompt, rdl->prompt_size);
> - rdl->prompt[RDLINE_PROMPT_SIZE-1] = '\0';
> -
> - for (i=0 ; i<rdl->prompt_size ; i++)
> - rdl->write_char(rdl, rdl->prompt[i]);
> - rdl->status = RDLINE_RUNNING;
> -
> - rdl->history_cur_line = -1;
> -}
> -
> -void
> -rdline_stop(struct rdline *rdl)
> -{
> - if (!rdl)
> - return;
> - rdl->status = RDLINE_INIT;
> -}
> -
> -void
> -rdline_quit(struct rdline *rdl)
> -{
> - if (!rdl)
> - return;
> - rdl->status = RDLINE_EXITED;
> -}
> -
> -void
> -rdline_restart(struct rdline *rdl)
> -{
> - if (!rdl)
> - return;
> - rdl->status = RDLINE_RUNNING;
> -}
> -
> -void
> -rdline_reset(struct rdline *rdl)
> -{
> - if (!rdl)
> - return;
> - vt100_init(&rdl->vt100);
> - cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
> -
> - rdl->status = RDLINE_RUNNING;
> -
> - rdl->history_cur_line = -1;
> -}
> -
> -const char *
> -rdline_get_buffer(struct rdline *rdl)
> -{
> - if (!rdl)
> - return NULL;
> - unsigned int len_l, len_r;
> - cirbuf_align_left(&rdl->left);
> - cirbuf_align_left(&rdl->right);
> -
> - len_l = CIRBUF_GET_LEN(&rdl->left);
> - len_r = CIRBUF_GET_LEN(&rdl->right);
> - memcpy(rdl->left_buf+len_l, rdl->right_buf, len_r);
> -
> - rdl->left_buf[len_l + len_r] = '\n';
> - rdl->left_buf[len_l + len_r + 1] = '\0';
> - return rdl->left_buf;
> -}
> -
> -static void
> -display_right_buffer(struct rdline *rdl, int force)
> -{
> - unsigned int i;
> - char tmp;
> -
> - if (!force && CIRBUF_IS_EMPTY(&rdl->right))
> - return;
> -
> - rdline_puts(rdl, vt100_clear_right);
> - CIRBUF_FOREACH(&rdl->right, i, tmp) {
> - rdl->write_char(rdl, tmp);
> - }
> - if (!CIRBUF_IS_EMPTY(&rdl->right))
> - rdline_miniprintf(rdl, vt100_multi_left,
> - CIRBUF_GET_LEN(&rdl->right));
> -}
> -
> -void
> -rdline_redisplay(struct rdline *rdl)
> -{
> - unsigned int i;
> - char tmp;
> -
> - if (!rdl)
> - return;
> -
> - rdline_puts(rdl, vt100_home);
> - for (i=0 ; i<rdl->prompt_size ; i++)
> - rdl->write_char(rdl, rdl->prompt[i]);
> - CIRBUF_FOREACH(&rdl->left, i, tmp) {
> - rdl->write_char(rdl, tmp);
> - }
> - display_right_buffer(rdl, 1);
> -}
> -
> -int
> -rdline_char_in(struct rdline *rdl, char c)
> -{
> - unsigned int i;
> - int cmd;
> - char tmp;
> - char *buf;
> -
> - if (!rdl)
> - return -EINVAL;
> -
> - if (rdl->status == RDLINE_EXITED)
> - return RDLINE_RES_EXITED;
> - if (rdl->status != RDLINE_RUNNING)
> - return RDLINE_RES_NOT_RUNNING;
> -
> - cmd = vt100_parser(&rdl->vt100, c);
> - if (cmd == -2)
> - return RDLINE_RES_SUCCESS;
> -
> - if (cmd >= 0) {
> - switch (cmd) {
> - /* move caret 1 char to the left */
> - case CMDLINE_KEY_CTRL_B:
> - case CMDLINE_KEY_LEFT_ARR:
> - if (CIRBUF_IS_EMPTY(&rdl->left))
> - break;
> - tmp = cirbuf_get_tail(&rdl->left);
> - cirbuf_del_tail(&rdl->left);
> - cirbuf_add_head(&rdl->right, tmp);
> - rdline_puts(rdl, vt100_left_arr);
> - break;
> -
> - /* move caret 1 char to the right */
> - case CMDLINE_KEY_CTRL_F:
> - case CMDLINE_KEY_RIGHT_ARR:
> - if (CIRBUF_IS_EMPTY(&rdl->right))
> - break;
> - tmp = cirbuf_get_head(&rdl->right);
> - cirbuf_del_head(&rdl->right);
> - cirbuf_add_tail(&rdl->left, tmp);
> - rdline_puts(rdl, vt100_right_arr);
> - break;
> -
> - /* move caret 1 word to the left */
> - /* keyboard equivalent: Alt+B */
> - case CMDLINE_KEY_WLEFT:
> - while (! CIRBUF_IS_EMPTY(&rdl->left) &&
> - (tmp = cirbuf_get_tail(&rdl->left)) &&
> - isblank2(tmp)) {
> - rdline_puts(rdl, vt100_left_arr);
> - cirbuf_del_tail(&rdl->left);
> - cirbuf_add_head(&rdl->right, tmp);
> - }
> - while (! CIRBUF_IS_EMPTY(&rdl->left) &&
> - (tmp = cirbuf_get_tail(&rdl->left)) &&
> - !isblank2(tmp)) {
> - rdline_puts(rdl, vt100_left_arr);
> - cirbuf_del_tail(&rdl->left);
> - cirbuf_add_head(&rdl->right, tmp);
> - }
> - break;
> -
> - /* move caret 1 word to the right */
> - /* keyboard equivalent: Alt+F */
> - case CMDLINE_KEY_WRIGHT:
> - while (! CIRBUF_IS_EMPTY(&rdl->right) &&
> - (tmp = cirbuf_get_head(&rdl->right)) &&
> - isblank2(tmp)) {
> - rdline_puts(rdl, vt100_right_arr);
> - cirbuf_del_head(&rdl->right);
> - cirbuf_add_tail(&rdl->left, tmp);
> - }
> - while (! CIRBUF_IS_EMPTY(&rdl->right) &&
> - (tmp = cirbuf_get_head(&rdl->right)) &&
> - !isblank2(tmp)) {
> - rdline_puts(rdl, vt100_right_arr);
> - cirbuf_del_head(&rdl->right);
> - cirbuf_add_tail(&rdl->left, tmp);
> - }
> - break;
> -
> - /* move caret to the left */
> - case CMDLINE_KEY_CTRL_A:
> - if (CIRBUF_IS_EMPTY(&rdl->left))
> - break;
> - rdline_miniprintf(rdl, vt100_multi_left,
> - CIRBUF_GET_LEN(&rdl->left));
> - while (! CIRBUF_IS_EMPTY(&rdl->left)) {
> - tmp = cirbuf_get_tail(&rdl->left);
> - cirbuf_del_tail(&rdl->left);
> - cirbuf_add_head(&rdl->right, tmp);
> - }
> - break;
> -
> - /* move caret to the right */
> - case CMDLINE_KEY_CTRL_E:
> - if (CIRBUF_IS_EMPTY(&rdl->right))
> - break;
> - rdline_miniprintf(rdl, vt100_multi_right,
> - CIRBUF_GET_LEN(&rdl->right));
> - while (! CIRBUF_IS_EMPTY(&rdl->right)) {
> - tmp = cirbuf_get_head(&rdl->right);
> - cirbuf_del_head(&rdl->right);
> - cirbuf_add_tail(&rdl->left, tmp);
> - }
> - break;
> -
> - /* delete 1 char from the left */
> - case CMDLINE_KEY_BKSPACE:
> - if(!cirbuf_del_tail_safe(&rdl->left)) {
> - rdline_puts(rdl, vt100_bs);
> - display_right_buffer(rdl, 1);
> - }
> - break;
> -
> - /* delete 1 char from the right */
> - case CMDLINE_KEY_SUPPR:
> - case CMDLINE_KEY_CTRL_D:
> - if (cmd == CMDLINE_KEY_CTRL_D &&
> - CIRBUF_IS_EMPTY(&rdl->left) &&
> - CIRBUF_IS_EMPTY(&rdl->right)) {
> - return RDLINE_RES_EOF;
> - }
> - if (!cirbuf_del_head_safe(&rdl->right)) {
> - display_right_buffer(rdl, 1);
> - }
> - break;
> -
> - /* delete 1 word from the left */
> - case CMDLINE_KEY_META_BKSPACE:
> - case CMDLINE_KEY_CTRL_W:
> - while (! CIRBUF_IS_EMPTY(&rdl->left) && isblank2(cirbuf_get_tail(&rdl->left))) {
> - rdline_puts(rdl, vt100_bs);
> - cirbuf_del_tail(&rdl->left);
> - }
> - while (! CIRBUF_IS_EMPTY(&rdl->left) && !isblank2(cirbuf_get_tail(&rdl->left))) {
> - rdline_puts(rdl, vt100_bs);
> - cirbuf_del_tail(&rdl->left);
> - }
> - display_right_buffer(rdl, 1);
> - break;
> -
> - /* delete 1 word from the right */
> - case CMDLINE_KEY_META_D:
> - while (! CIRBUF_IS_EMPTY(&rdl->right) && isblank2(cirbuf_get_head(&rdl->right)))
> - cirbuf_del_head(&rdl->right);
> - while (! CIRBUF_IS_EMPTY(&rdl->right) && !isblank2(cirbuf_get_head(&rdl->right)))
> - cirbuf_del_head(&rdl->right);
> - display_right_buffer(rdl, 1);
> - break;
> -
> - /* set kill buffer to contents on the right side of caret */
> - case CMDLINE_KEY_CTRL_K:
> - cirbuf_get_buf_head(&rdl->right, rdl->kill_buf, RDLINE_BUF_SIZE);
> - rdl->kill_size = CIRBUF_GET_LEN(&rdl->right);
> - cirbuf_del_buf_head(&rdl->right, rdl->kill_size);
> - rdline_puts(rdl, vt100_clear_right);
> - break;
> -
> - /* paste contents of kill buffer to the left side of caret */
> - case CMDLINE_KEY_CTRL_Y:
> - i=0;
> - while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
> - RDLINE_BUF_SIZE &&
> - i < rdl->kill_size) {
> - cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
> - rdl->write_char(rdl, rdl->kill_buf[i]);
> - i++;
> - }
> - display_right_buffer(rdl, 0);
> - break;
> -
> - /* clear and newline */
> - case CMDLINE_KEY_CTRL_C:
> - rdline_puts(rdl, "\r\n");
> - rdline_newline(rdl, rdl->prompt);
> - break;
> -
> - /* redisplay (helps when prompt is lost in other output) */
> - case CMDLINE_KEY_CTRL_L:
> - rdline_redisplay(rdl);
> - break;
> -
> - /* autocomplete */
> - case CMDLINE_KEY_TAB:
> - case CMDLINE_KEY_HELP:
> - cirbuf_align_left(&rdl->left);
> - rdl->left_buf[CIRBUF_GET_LEN(&rdl->left)] = '\0';
> - if (rdl->complete) {
> - char tmp_buf[BUFSIZ];
> - int complete_state;
> - int ret;
> - unsigned int tmp_size;
> -
> - if (cmd == CMDLINE_KEY_TAB)
> - complete_state = 0;
> - else
> - complete_state = -1;
> -
> - /* see in parse.h for help on complete() */
> - ret = rdl->complete(rdl, rdl->left_buf,
> - tmp_buf, sizeof(tmp_buf),
> - &complete_state);
> - /* no completion or error */
> - if (ret <= 0) {
> - return RDLINE_RES_COMPLETE;
> - }
> -
> - tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
> - /* add chars */
> - if (ret == RDLINE_RES_COMPLETE) {
> - i=0;
> - while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
> - RDLINE_BUF_SIZE &&
> - i < tmp_size) {
> - cirbuf_add_tail(&rdl->left, tmp_buf[i]);
> - rdl->write_char(rdl, tmp_buf[i]);
> - i++;
> - }
> - display_right_buffer(rdl, 1);
> - return RDLINE_RES_COMPLETE; /* ?? */
> - }
> -
> - /* choice */
> - rdline_puts(rdl, "\r\n");
> - while (ret) {
> - rdl->write_char(rdl, ' ');
> - for (i=0 ; tmp_buf[i] ; i++)
> - rdl->write_char(rdl, tmp_buf[i]);
> - rdline_puts(rdl, "\r\n");
> - ret = rdl->complete(rdl, rdl->left_buf,
> - tmp_buf, sizeof(tmp_buf),
> - &complete_state);
> - }
> -
> - rdline_redisplay(rdl);
> - }
> - return RDLINE_RES_COMPLETE;
> -
> - /* complete buffer */
> - case CMDLINE_KEY_RETURN:
> - case CMDLINE_KEY_RETURN2:
> - rdline_get_buffer(rdl);
> - rdl->status = RDLINE_INIT;
> - rdline_puts(rdl, "\r\n");
> - if (rdl->history_cur_line != -1)
> - rdline_remove_first_history_item(rdl);
> -
> - if (rdl->validate)
> - rdl->validate(rdl, rdl->left_buf, CIRBUF_GET_LEN(&rdl->left)+2);
> - /* user may have stopped rdline */
> - if (rdl->status == RDLINE_EXITED)
> - return RDLINE_RES_EXITED;
> - return RDLINE_RES_VALIDATED;
> -
> - /* previous element in history */
> - case CMDLINE_KEY_UP_ARR:
> - case CMDLINE_KEY_CTRL_P:
> - if (rdl->history_cur_line == 0) {
> - rdline_remove_first_history_item(rdl);
> - }
> - if (rdl->history_cur_line <= 0) {
> - rdline_add_history(rdl, rdline_get_buffer(rdl));
> - rdl->history_cur_line = 0;
> - }
> -
> - buf = rdline_get_history_item(rdl, rdl->history_cur_line + 1);
> - if (!buf)
> - break;
> -
> - rdl->history_cur_line ++;
> - vt100_init(&rdl->vt100);
> - cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_add_buf_tail(&rdl->left, buf, strnlen(buf, RDLINE_BUF_SIZE));
> - rdline_redisplay(rdl);
> - break;
> -
> - /* next element in history */
> - case CMDLINE_KEY_DOWN_ARR:
> - case CMDLINE_KEY_CTRL_N:
> - if (rdl->history_cur_line - 1 < 0)
> - break;
> -
> - rdl->history_cur_line --;
> - buf = rdline_get_history_item(rdl, rdl->history_cur_line);
> - if (!buf)
> - break;
> - vt100_init(&rdl->vt100);
> - cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
> - cirbuf_add_buf_tail(&rdl->left, buf, strnlen(buf, RDLINE_BUF_SIZE));
> - rdline_redisplay(rdl);
> -
> - break;
> -
> -
> - default:
> - break;
> - }
> -
> - return RDLINE_RES_SUCCESS;
> - }
> -
> - if (!isprint((int)c))
> - return RDLINE_RES_SUCCESS;
> -
> - /* standard chars */
> - if (CIRBUF_GET_LEN(&rdl->left) + CIRBUF_GET_LEN(&rdl->right) >= RDLINE_BUF_SIZE)
> - return RDLINE_RES_SUCCESS;
> -
> - if (cirbuf_add_tail_safe(&rdl->left, c))
> - return RDLINE_RES_SUCCESS;
> -
> - rdl->write_char(rdl, c);
> - display_right_buffer(rdl, 0);
> -
> - return RDLINE_RES_SUCCESS;
> -}
> -
> -
> -/* HISTORY */
> -
> -static void
> -rdline_remove_old_history_item(struct rdline * rdl)
> -{
> - char tmp;
> -
> - while (! CIRBUF_IS_EMPTY(&rdl->history) ) {
> - tmp = cirbuf_get_head(&rdl->history);
> - cirbuf_del_head(&rdl->history);
> - if (!tmp)
> - break;
> - }
> -}
> -
> -static void
> -rdline_remove_first_history_item(struct rdline * rdl)
> -{
> - char tmp;
> -
> - if ( CIRBUF_IS_EMPTY(&rdl->history) ) {
> - return;
> - }
> - else {
> - cirbuf_del_tail(&rdl->history);
> - }
> -
> - while (! CIRBUF_IS_EMPTY(&rdl->history) ) {
> - tmp = cirbuf_get_tail(&rdl->history);
> - if (!tmp)
> - break;
> - cirbuf_del_tail(&rdl->history);
> - }
> -}
> -
> -static unsigned int
> -rdline_get_history_size(struct rdline * rdl)
> -{
> - unsigned int i, tmp, ret=0;
> -
> - CIRBUF_FOREACH(&rdl->history, i, tmp) {
> - if (tmp == 0)
> - ret ++;
> - }
> -
> - return ret;
> -}
> -
> -char *
> -rdline_get_history_item(struct rdline * rdl, unsigned int idx)
> -{
> - unsigned int len, i, tmp;
> -
> - if (!rdl)
> - return NULL;
> -
> - len = rdline_get_history_size(rdl);
> - if ( idx >= len ) {
> - return NULL;
> - }
> -
> - cirbuf_align_left(&rdl->history);
> -
> - CIRBUF_FOREACH(&rdl->history, i, tmp) {
> - if ( idx == len - 1) {
> - return rdl->history_buf + i;
> - }
> - if (tmp == 0)
> - len --;
> - }
> -
> - return NULL;
> -}
> -
> -int
> -rdline_add_history(struct rdline * rdl, const char * buf)
> -{
> - unsigned int len, i;
> -
> - if (!rdl || !buf)
> - return -EINVAL;
> -
> - len = strnlen(buf, RDLINE_BUF_SIZE);
> - for (i=0; i<len ; i++) {
> - if (buf[i] == '\n') {
> - len = i;
> - break;
> - }
> - }
> -
> - if ( len >= RDLINE_HISTORY_BUF_SIZE )
> - return -1;
> -
> - while ( len >= CIRBUF_GET_FREELEN(&rdl->history) ) {
> - rdline_remove_old_history_item(rdl);
> - }
> -
> - cirbuf_add_buf_tail(&rdl->history, buf, len);
> - cirbuf_add_tail(&rdl->history, 0);
> -
> - return 0;
> -}
> -
> -void
> -rdline_clear_history(struct rdline * rdl)
> -{
> - if (!rdl)
> - return;
> - cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE);
> -}
> -
> -
> -/* STATIC USEFUL FUNCS */
> -
> -static void
> -rdline_puts(struct rdline * rdl, const char * buf)
> -{
> - char c;
> - while ( (c = *(buf++)) != '\0' ) {
> - rdl->write_char(rdl, c);
> - }
> -}
> -
> -/* a very very basic printf with one arg and one format 'u' */
> -static void
> -rdline_miniprintf(struct rdline *rdl, const char * buf, unsigned int val)
> -{
> - char c, started=0, div=100;
> -
> - while ( (c=*(buf++)) ) {
> - if (c != '%') {
> - rdl->write_char(rdl, c);
> - continue;
> - }
> - c = *(buf++);
> - if (c != 'u') {
> - rdl->write_char(rdl, '%');
> - rdl->write_char(rdl, c);
> - continue;
> - }
> - /* val is never more than 255 */
> - while (div) {
> - c = (char)(val / div);
> - if (c || started) {
> - rdl->write_char(rdl, (char)(c+'0'));
> - started = 1;
> - }
> - val %= div;
> - div /= 10;
> - }
> - }
> -}
> diff --git a/lib/librte_cmdline/cmdline_rdline.h b/lib/librte_cmdline/cmdline_rdline.h
> deleted file mode 100644
> index 72e2dad..0000000
> --- a/lib/librte_cmdline/cmdline_rdline.h
> +++ /dev/null
> @@ -1,255 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#ifndef _RDLINE_H_
> -#define _RDLINE_H_
> -
> -/**
> - * This file is a small equivalent to the GNU readline library, but it
> - * was originally designed for small systems, like Atmel AVR
> - * microcontrollers (8 bits). Indeed, we don't use any malloc that is
> - * sometimes not implemented (or just not recommended) on such
> - * systems.
> - *
> - * Obviously, it does not support as many things as the GNU readline,
> - * but at least it supports some interesting features like a kill
> - * buffer and a command history.
> - *
> - * It also have a feature that does not have the GNU readline (as far
> - * as I know): we can have several instances of it running at the same
> - * time, even on a monothread program, since it works with callbacks.
> - *
> - * The lib is designed for a client-side or a server-side use:
> - * - server-side: the server receives all data from a socket, including
> - * control chars, like arrows, tabulations, ... The client is
> - * very simple, it can be a telnet or a minicom through a serial line.
> - * - client-side: the client receives its data through its stdin for
> - * instance.
> - */
> -
> -#include <stdio.h>
> -#include <cmdline_cirbuf.h>
> -#include <cmdline_vt100.h>
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -/* configuration */
> -#define RDLINE_BUF_SIZE 512
> -#define RDLINE_PROMPT_SIZE 32
> -#define RDLINE_VT100_BUF_SIZE 8
> -#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
> -#define RDLINE_HISTORY_MAX_LINE 64
> -
> -enum rdline_status {
> - RDLINE_INIT,
> - RDLINE_RUNNING,
> - RDLINE_EXITED
> -};
> -
> -struct rdline;
> -
> -typedef int (rdline_write_char_t)(struct rdline *rdl, char);
> -typedef void (rdline_validate_t)(struct rdline *rdl,
> - const char *buf, unsigned int size);
> -typedef int (rdline_complete_t)(struct rdline *rdl, const char *buf,
> - char *dstbuf, unsigned int dstsize,
> - int *state);
> -
> -struct rdline {
> - enum rdline_status status;
> - /* rdline bufs */
> - struct cirbuf left;
> - struct cirbuf right;
> - char left_buf[RDLINE_BUF_SIZE+2]; /* reserve 2 chars for the \n\0 */
> - char right_buf[RDLINE_BUF_SIZE];
> -
> - char prompt[RDLINE_PROMPT_SIZE];
> - unsigned int prompt_size;
> -
> - char kill_buf[RDLINE_BUF_SIZE];
> - unsigned int kill_size;
> -
> - /* history */
> - struct cirbuf history;
> - char history_buf[RDLINE_HISTORY_BUF_SIZE];
> - int history_cur_line;
> -
> - /* callbacks and func pointers */
> - rdline_write_char_t *write_char;
> - rdline_validate_t *validate;
> - rdline_complete_t *complete;
> -
> - /* vt100 parser */
> - struct cmdline_vt100 vt100;
> -
> - /* opaque pointer */
> - void *opaque;
> -};
> -
> -/**
> - * Init fields for a struct rdline. Call this only once at the beginning
> - * of your program.
> - * \param rdl A pointer to an uninitialized struct rdline
> - * \param write_char The function used by the function to write a character
> - * \param validate A pointer to the function to execute when the
> - * user validates the buffer.
> - * \param complete A pointer to the function to execute when the
> - * user completes the buffer.
> - */
> -int rdline_init(struct rdline *rdl,
> - rdline_write_char_t *write_char,
> - rdline_validate_t *validate,
> - rdline_complete_t *complete);
> -
> -
> -/**
> - * Init the current buffer, and display a prompt.
> - * \param rdl A pointer to a struct rdline
> - * \param prompt A string containing the prompt
> - */
> -void rdline_newline(struct rdline *rdl, const char *prompt);
> -
> -/**
> - * Call it and all received chars will be ignored.
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_stop(struct rdline *rdl);
> -
> -/**
> - * Same than rdline_stop() except that next calls to rdline_char_in()
> - * will return RDLINE_RES_EXITED.
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_quit(struct rdline *rdl);
> -
> -/**
> - * Restart after a call to rdline_stop() or rdline_quit()
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_restart(struct rdline *rdl);
> -
> -/**
> - * Redisplay the current buffer
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_redisplay(struct rdline *rdl);
> -
> -/**
> - * Reset the current buffer and setup for a new line.
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_reset(struct rdline *rdl);
> -
> -
> -/* return status for rdline_char_in() */
> -#define RDLINE_RES_SUCCESS 0
> -#define RDLINE_RES_VALIDATED 1
> -#define RDLINE_RES_COMPLETE 2
> -#define RDLINE_RES_NOT_RUNNING -1
> -#define RDLINE_RES_EOF -2
> -#define RDLINE_RES_EXITED -3
> -
> -/**
> - * append a char to the readline buffer.
> - * Return RDLINE_RES_VALIDATE when the line has been validated.
> - * Return RDLINE_RES_COMPLETE when the user asked to complete the buffer.
> - * Return RDLINE_RES_NOT_RUNNING if it is not running.
> - * Return RDLINE_RES_EOF if EOF (ctrl-d on an empty line).
> - * Else return RDLINE_RES_SUCCESS.
> - * XXX error case when the buffer is full ?
> - *
> - * \param rdl A pointer to a struct rdline
> - * \param c The character to append
> - */
> -int rdline_char_in(struct rdline *rdl, char c);
> -
> -/**
> - * Return the current buffer, terminated by '\0'.
> - * \param rdl A pointer to a struct rdline
> - */
> -const char *rdline_get_buffer(struct rdline *rdl);
> -
> -
> -/**
> - * Add the buffer to history.
> - * return < 0 on error.
> - * \param rdl A pointer to a struct rdline
> - * \param buf A buffer that is terminated by '\0'
> - */
> -int rdline_add_history(struct rdline *rdl, const char *buf);
> -
> -/**
> - * Clear current history
> - * \param rdl A pointer to a struct rdline
> - */
> -void rdline_clear_history(struct rdline *rdl);
> -
> -/**
> - * Get the i-th history item
> - */
> -char *rdline_get_history_item(struct rdline *rdl, unsigned int i);
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -#endif /* _RDLINE_H_ */
> diff --git a/lib/librte_cmdline/cmdline_socket.c b/lib/librte_cmdline/cmdline_socket.c
> index 3fc243b..11524b5 100644
> --- a/lib/librte_cmdline/cmdline_socket.c
> +++ b/lib/librte_cmdline/cmdline_socket.c
> @@ -58,23 +58,18 @@
> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> -#include <stdio.h>
> -#include <string.h>
> +#include <stddef.h>
> #include <unistd.h>
> -#include <stdlib.h>
> -#include <stdarg.h>
> -#include <inttypes.h>
> #include <fcntl.h>
> -#include <termios.h>
>
> #include "cmdline_parse.h"
> -#include "cmdline_rdline.h"
> #include "cmdline_socket.h"
> #include "cmdline.h"
>
> struct cmdline *
> cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
> {
> + struct cmdline *cl;
> int fd;
>
> /* everything else is checked in cmdline_new() */
> @@ -83,37 +78,22 @@ cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
>
> fd = open(path, O_RDONLY, 0);
> if (fd < 0) {
> - dprintf("open() failed\n");
> return NULL;
> }
> - return cmdline_new(ctx, prompt, fd, -1);
> + cl = cmdline_new(ctx, prompt, fd, -1);
> + /* cmdline_new() duplicates fd */
> + close(fd);
> + return cl;
> }
>
> struct cmdline *
> cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
> {
> - struct cmdline *cl;
> - struct termios oldterm, term;
> -
> - tcgetattr(0, &oldterm);
> - memcpy(&term, &oldterm, sizeof(term));
> - term.c_lflag &= ~(ICANON | ECHO | ISIG);
> - tcsetattr(0, TCSANOW, &term);
> - setbuf(stdin, NULL);
> -
> - cl = cmdline_new(ctx, prompt, 0, 1);
> -
> - if (cl)
> - memcpy(&cl->oldterm, &oldterm, sizeof(term));
> -
> - return cl;
> + return cmdline_new(ctx, prompt, 0, 1);
> }
>
> void
> cmdline_stdin_exit(struct cmdline *cl)
> {
> - if (!cl)
> - return;
> -
> - tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
> + cmdline_free(cl);
> }
> diff --git a/lib/librte_cmdline/cmdline_vt100.c b/lib/librte_cmdline/cmdline_vt100.c
> deleted file mode 100644
> index a253e8b..0000000
> --- a/lib/librte_cmdline/cmdline_vt100.c
> +++ /dev/null
> @@ -1,185 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#include <stdlib.h>
> -#include <stdint.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <stdarg.h>
> -#include <ctype.h>
> -#include <termios.h>
> -
> -#include "cmdline_vt100.h"
> -
> -const char *cmdline_vt100_commands[] = {
> - vt100_up_arr,
> - vt100_down_arr,
> - vt100_right_arr,
> - vt100_left_arr,
> - "\177",
> - "\n",
> - "\001",
> - "\005",
> - "\013",
> - "\031",
> - "\003",
> - "\006",
> - "\002",
> - vt100_suppr,
> - vt100_tab,
> - "\004",
> - "\014",
> - "\r",
> - "\033\177",
> - vt100_word_left,
> - vt100_word_right,
> - "?",
> - "\027",
> - "\020",
> - "\016",
> - "\033\144",
> -};
> -
> -void
> -vt100_init(struct cmdline_vt100 *vt)
> -{
> - if (!vt)
> - return;
> - vt->state = CMDLINE_VT100_INIT;
> -}
> -
> -
> -static int
> -match_command(char *buf, unsigned int size)
> -{
> - const char *cmd;
> - size_t cmdlen;
> - unsigned int i = 0;
> -
> - for (i=0 ; i<sizeof(cmdline_vt100_commands)/sizeof(const char *) ; i++) {
> - cmd = *(cmdline_vt100_commands + i);
> -
> - cmdlen = strnlen(cmd, CMDLINE_VT100_BUF_SIZE);
> - if (size == cmdlen &&
> - !strncmp(buf, cmd, cmdlen)) {
> - return i;
> - }
> - }
> -
> - return -1;
> -}
> -
> -int
> -vt100_parser(struct cmdline_vt100 *vt, char ch)
> -{
> - unsigned int size;
> - uint8_t c = (uint8_t) ch;
> -
> - if (!vt)
> - return -1;
> -
> - if (vt->bufpos >= CMDLINE_VT100_BUF_SIZE) {
> - vt->state = CMDLINE_VT100_INIT;
> - vt->bufpos = 0;
> - }
> -
> - vt->buf[vt->bufpos++] = c;
> - size = vt->bufpos;
> -
> - switch (vt->state) {
> - case CMDLINE_VT100_INIT:
> - if (c == 033) {
> - vt->state = CMDLINE_VT100_ESCAPE;
> - }
> - else {
> - vt->bufpos = 0;
> - goto match_command;
> - }
> - break;
> -
> - case CMDLINE_VT100_ESCAPE:
> - if (c == 0133) {
> - vt->state = CMDLINE_VT100_ESCAPE_CSI;
> - }
> - else if (c >= 060 && c <= 0177) { /* XXX 0177 ? */
> - vt->bufpos = 0;
> - vt->state = CMDLINE_VT100_INIT;
> - goto match_command;
> - }
> - break;
> -
> - case CMDLINE_VT100_ESCAPE_CSI:
> - if (c >= 0100 && c <= 0176) {
> - vt->bufpos = 0;
> - vt->state = CMDLINE_VT100_INIT;
> - goto match_command;
> - }
> - break;
> -
> - default:
> - vt->bufpos = 0;
> - break;
> - }
> -
> - return -2;
> -
> - match_command:
> - return match_command(vt->buf, size);
> -}
> diff --git a/lib/librte_cmdline/cmdline_vt100.h b/lib/librte_cmdline/cmdline_vt100.h
> deleted file mode 100644
> index 963add8..0000000
> --- a/lib/librte_cmdline/cmdline_vt100.h
> +++ /dev/null
> @@ -1,153 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -/*
> - * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
> - * All rights reserved.
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in the
> - * documentation and/or other materials provided with the distribution.
> - * * Neither the name of the University of California, Berkeley nor the
> - * names of its contributors may be used to endorse or promote products
> - * derived from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
> - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
> - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#ifndef _CMDLINE_VT100_H_
> -#define _CMDLINE_VT100_H_
> -
> -#include <stdint.h>
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -#define vt100_bell "\007"
> -#define vt100_bs "\010"
> -#define vt100_bs_clear "\010 \010"
> -#define vt100_tab "\011"
> -#define vt100_crnl "\012\015"
> -#define vt100_clear_right "\033[0K"
> -#define vt100_clear_left "\033[1K"
> -#define vt100_clear_down "\033[0J"
> -#define vt100_clear_up "\033[1J"
> -#define vt100_clear_line "\033[2K"
> -#define vt100_clear_screen "\033[2J"
> -#define vt100_up_arr "\033\133\101"
> -#define vt100_down_arr "\033\133\102"
> -#define vt100_right_arr "\033\133\103"
> -#define vt100_left_arr "\033\133\104"
> -#define vt100_multi_right "\033\133%uC"
> -#define vt100_multi_left "\033\133%uD"
> -#define vt100_suppr "\033\133\063\176"
> -#define vt100_home "\033M\033E"
> -#define vt100_word_left "\033\142"
> -#define vt100_word_right "\033\146"
> -
> -/* Result of parsing : it must be synchronized with
> - * cmdline_vt100_commands[] in vt100.c */
> -#define CMDLINE_KEY_UP_ARR 0
> -#define CMDLINE_KEY_DOWN_ARR 1
> -#define CMDLINE_KEY_RIGHT_ARR 2
> -#define CMDLINE_KEY_LEFT_ARR 3
> -#define CMDLINE_KEY_BKSPACE 4
> -#define CMDLINE_KEY_RETURN 5
> -#define CMDLINE_KEY_CTRL_A 6
> -#define CMDLINE_KEY_CTRL_E 7
> -#define CMDLINE_KEY_CTRL_K 8
> -#define CMDLINE_KEY_CTRL_Y 9
> -#define CMDLINE_KEY_CTRL_C 10
> -#define CMDLINE_KEY_CTRL_F 11
> -#define CMDLINE_KEY_CTRL_B 12
> -#define CMDLINE_KEY_SUPPR 13
> -#define CMDLINE_KEY_TAB 14
> -#define CMDLINE_KEY_CTRL_D 15
> -#define CMDLINE_KEY_CTRL_L 16
> -#define CMDLINE_KEY_RETURN2 17
> -#define CMDLINE_KEY_META_BKSPACE 18
> -#define CMDLINE_KEY_WLEFT 19
> -#define CMDLINE_KEY_WRIGHT 20
> -#define CMDLINE_KEY_HELP 21
> -#define CMDLINE_KEY_CTRL_W 22
> -#define CMDLINE_KEY_CTRL_P 23
> -#define CMDLINE_KEY_CTRL_N 24
> -#define CMDLINE_KEY_META_D 25
> -
> -extern const char *cmdline_vt100_commands[];
> -
> -enum cmdline_vt100_parser_state {
> - CMDLINE_VT100_INIT,
> - CMDLINE_VT100_ESCAPE,
> - CMDLINE_VT100_ESCAPE_CSI
> -};
> -
> -#define CMDLINE_VT100_BUF_SIZE 8
> -struct cmdline_vt100 {
> - uint8_t bufpos;
> - char buf[CMDLINE_VT100_BUF_SIZE];
> - enum cmdline_vt100_parser_state state;
> -};
> -
> -/**
> - * Init
> - */
> -void vt100_init(struct cmdline_vt100 *vt);
> -
> -/**
> - * Input a new character.
> - * Return -1 if the character is not part of a control sequence
> - * Return -2 if c is not the last char of a control sequence
> - * Else return the index in vt100_commands[]
> - */
> -int vt100_parser(struct cmdline_vt100 *vt, char c);
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -#endif
> diff --git a/lib/librte_cmdline/rte_cmdline_version.map b/lib/librte_cmdline/rte_cmdline_version.map
> index 04bcb38..3133199 100644
> --- a/lib/librte_cmdline/rte_cmdline_version.map
> +++ b/lib/librte_cmdline/rte_cmdline_version.map
> @@ -1,25 +1,6 @@
> DPDK_2.0 {
> global:
>
> - cirbuf_add_buf_head;
> - cirbuf_add_buf_tail;
> - cirbuf_add_head;
> - cirbuf_add_head_safe;
> - cirbuf_add_tail;
> - cirbuf_add_tail_safe;
> - cirbuf_align_left;
> - cirbuf_align_right;
> - cirbuf_del_buf_head;
> - cirbuf_del_buf_tail;
> - cirbuf_del_head;
> - cirbuf_del_head_safe;
> - cirbuf_del_tail;
> - cirbuf_del_tail_safe;
> - cirbuf_get_buf_head;
> - cirbuf_get_buf_tail;
> - cirbuf_get_head;
> - cirbuf_get_tail;
> - cirbuf_init;
> cmdline_complete;
> cmdline_complete_get_elt_string;
> cmdline_complete_get_nb_string;
> @@ -50,21 +31,6 @@ DPDK_2.0 {
> cmdline_token_num_ops;
> cmdline_token_portlist_ops;
> cmdline_token_string_ops;
> - cmdline_write_char;
> - rdline_add_history;
> - rdline_char_in;
> - rdline_clear_history;
> - rdline_get_buffer;
> - rdline_get_history_item;
> - rdline_init;
> - rdline_newline;
> - rdline_quit;
> - rdline_redisplay;
> - rdline_reset;
> - rdline_restart;
> - rdline_stop;
> - vt100_init;
> - vt100_parser;
>
> local: *;
> };
> @@ -75,3 +41,10 @@ DPDK_2.1 {
> cmdline_poll;
>
> } DPDK_2.0;
> +
> +DPDK_18.02 {
> + global:
> +
> + cmdline_ctx_get;
> +
> +} DPDK_2.1;
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 6a6a745..504bb4e 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -102,6 +102,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
> _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci
> _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
> _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
> +
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += $(shell pkg-config --libs libedit)
> _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
> _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
>
> diff --git a/test/cmdline_test/cmdline_test.c b/test/cmdline_test/cmdline_test.c
> index 716b5f1..595efa5 100644
> --- a/test/cmdline_test/cmdline_test.c
> +++ b/test/cmdline_test/cmdline_test.c
> @@ -41,7 +41,6 @@
> #include <ctype.h>
> #include <sys/queue.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_socket.h>
> #include <cmdline.h>
> diff --git a/test/cmdline_test/commands.c b/test/cmdline_test/commands.c
> index 404f51a..8481af9 100644
> --- a/test/cmdline_test/commands.c
> +++ b/test/cmdline_test/commands.c
> @@ -36,7 +36,6 @@
> #include <termios.h>
> #include <inttypes.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_parse_num.h>
> @@ -306,72 +305,6 @@ cmdline_parse_inst_t cmd_ambig_2 = {
>
>
>
> -/*** get_history_bufsize ***/
> -/* command that displays total space in history buffer
> - * this will be useful for testing history (to fill it up just enough to
> - * remove the last entry, we need to know how big it is).
> - */
> -
> -struct cmd_get_history_bufsize_result {
> - cmdline_fixed_string_t str;
> -};
> -
> -static void
> -cmd_get_history_bufsize_parsed(__attribute__((unused)) void *parsed_result,
> - struct cmdline *cl,
> - __attribute__((unused)) void *data)
> -{
> - cmdline_printf(cl, "History buffer size: %zu\n",
> - sizeof(cl->rdl.history_buf));
> -}
> -
> -cmdline_parse_token_string_t cmd_get_history_bufsize_tok =
> - TOKEN_STRING_INITIALIZER(struct cmd_get_history_bufsize_result, str,
> - "get_history_bufsize");
> -
> -cmdline_parse_inst_t cmd_get_history_bufsize = {
> - .f = cmd_get_history_bufsize_parsed, /* function to call */
> - .data = NULL, /* 2nd arg of func */
> - .help_str = "command that displays total space in history buffer",
> - .tokens = { /* token list, NULL terminated */
> - (void *)&cmd_get_history_bufsize_tok,
> - NULL,
> - },
> -};
> -
> -
> -
> -/*** clear_history ***/
> -/* clears history buffer */
> -
> -struct cmd_clear_history_result {
> - cmdline_fixed_string_t str;
> -};
> -
> -static void
> -cmd_clear_history_parsed(__attribute__((unused)) void *parsed_result,
> - struct cmdline *cl,
> - __attribute__((unused)) void *data)
> -{
> - rdline_clear_history(&cl->rdl);
> -}
> -
> -cmdline_parse_token_string_t cmd_clear_history_tok =
> - TOKEN_STRING_INITIALIZER(struct cmd_clear_history_result, str,
> - "clear_history");
> -
> -cmdline_parse_inst_t cmd_clear_history = {
> - .f = cmd_clear_history_parsed, /* function to call */
> - .data = NULL, /* 2nd arg of func */
> - .help_str = "clear command history",
> - .tokens = { /* token list, NULL terminated */
> - (void *)&cmd_clear_history_tok,
> - NULL,
> - },
> -};
> -
> -
> -
> /****************/
>
> cmdline_parse_ctx_t main_ctx[] = {
> @@ -381,8 +314,6 @@ cmdline_parse_ctx_t main_ctx[] = {
> (cmdline_parse_inst_t *)&cmd_single,
> (cmdline_parse_inst_t *)&cmd_single_long,
> (cmdline_parse_inst_t *)&cmd_num,
> - (cmdline_parse_inst_t *)&cmd_get_history_bufsize,
> - (cmdline_parse_inst_t *)&cmd_clear_history,
> (cmdline_parse_inst_t *)&cmd_autocomplete_1,
> (cmdline_parse_inst_t *)&cmd_autocomplete_2,
> NULL,
> diff --git a/test/test/Makefile b/test/test/Makefile
> index bb54c98..49e907c 100644
> --- a/test/test/Makefile
> +++ b/test/test/Makefile
> @@ -164,7 +164,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
> -SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
> SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
>
> diff --git a/test/test/commands.c b/test/test/commands.c
> index 4097a33..21a4a06 100644
> --- a/test/test/commands.c
> +++ b/test/test/commands.c
> @@ -66,7 +66,6 @@
> #include <rte_mbuf.h>
> #include <rte_devargs.h>
>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_parse_ipaddr.h>
> #include <cmdline_parse_num.h>
> diff --git a/test/test/test.c b/test/test/test.c
> index 0e6ff7c..6f48892 100644
> --- a/test/test/test.c
> +++ b/test/test/test.c
> @@ -42,7 +42,6 @@
> #include <sys/queue.h>
>
> #ifdef RTE_LIBRTE_CMDLINE
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_socket.h>
> #include <cmdline.h>
> diff --git a/test/test/test_cmdline.c b/test/test/test_cmdline.c
> index 38c7256..056b569 100644
> --- a/test/test/test_cmdline.c
> +++ b/test/test/test_cmdline.c
> @@ -74,15 +74,6 @@ test_cmdline(void)
> return -1;
> if (test_parse_string_invalid_param() < 0)
> return -1;
> - printf("Testing circular buffer...\n");
> - if (test_cirbuf_char() < 0)
> - return -1;
> - if (test_cirbuf_string() < 0)
> - return -1;
> - if (test_cirbuf_align() < 0)
> - return -1;
> - if (test_cirbuf_invalid_param() < 0)
> - return -1;
> printf("Testing library functions...\n");
> if (test_cmdline_lib() < 0)
> return -1;
> diff --git a/test/test/test_cmdline.h b/test/test/test_cmdline.h
> index 0ee91c1..b55caa9 100644
> --- a/test/test/test_cmdline.h
> +++ b/test/test/test_cmdline.h
> @@ -61,12 +61,6 @@ int test_parse_string_valid(void);
> int test_parse_string_invalid_data(void);
> int test_parse_string_invalid_param(void);
>
> -/* cmdline_cirbuf tests */
> -int test_cirbuf_invalid_param(void);
> -int test_cirbuf_char(void);
> -int test_cirbuf_string(void);
> -int test_cirbuf_align(void);
> -
> /* test the rest of the library */
> int test_cmdline_lib(void);
>
> diff --git a/test/test/test_cmdline_cirbuf.c b/test/test/test_cmdline_cirbuf.c
> deleted file mode 100644
> index 2c32145..0000000
> --- a/test/test/test_cmdline_cirbuf.c
> +++ /dev/null
> @@ -1,1330 +0,0 @@
> -/*-
> - * BSD LICENSE
> - *
> - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - *
> - * * Redistributions of source code must retain the above copyright
> - * notice, this list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> - * notice, this list of conditions and the following disclaimer in
> - * the documentation and/or other materials provided with the
> - * distribution.
> - * * Neither the name of Intel Corporation nor the names of its
> - * contributors may be used to endorse or promote products derived
> - * from this software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -
> -#include <rte_string_fns.h>
> -
> -#include <cmdline_cirbuf.h>
> -
> -#include "test_cmdline.h"
> -
> -/* different length strings */
> -#define CIRBUF_STR_HEAD " HEAD"
> -#define CIRBUF_STR_TAIL "TAIL"
> -
> -/* miscellaneous tests - they make bullseye happy */
> -static int
> -test_cirbuf_string_misc(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /*
> - * add strings to head and tail, but read only tail
> - * this results in read operation that does not transcend
> - * from buffer end to buffer beginning (in other words,
> - * strlen <= cb->maxlen - cb->end)
> - */
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* add string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* read string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to get string from tail!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: tail strings do not match!\n");
> - return -1;
> - }
> - /* clear buffers */
> - memset(tmp, 0, sizeof(tmp));
> - memset(buf, 0, sizeof(buf));
> -
> -
> -
> - /*
> - * add a string to buffer when start/end is at end of buffer
> - */
> -
> - /*
> - * reinitialize circular buffer with start at the end of cirbuf
> - */
> - if (cirbuf_init(&cb, buf, CMDLINE_TEST_BUFSIZE - 2, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> -
> - /* add string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to add string to tail!\n");
> - return -1;
> - }
> - /* read string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to get string from tail!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: tail strings do not match!\n");
> - return -1;
> - }
> - /* clear tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* read string from tail */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to get string from head!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
> - printf("Error: headstrings do not match!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* test adding and deleting strings */
> -static int
> -test_cirbuf_string_add_del(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* read string from head */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to get string from head!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
> - printf("Error: head strings do not match!\n");
> - return -1;
> - }
> - /* clear tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> - /* read string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to get string from head!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
> - printf("Error: head strings do not match!\n");
> - return -1;
> - }
> - /* delete string from head*/
> - if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_HEAD)) < 0) {
> - printf("Error: failed to delete string from head!\n");
> - return -1;
> - }
> - /* verify string was deleted */
> - if (cirbuf_del_head_safe(&cb) == 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> - /* clear tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> -
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to add string to tail!\n");
> - return -1;
> - }
> - /* get string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to get string from tail!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: tail strings do not match!\n");
> - return -1;
> - }
> - /* clear tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> - /* get string from head */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to get string from tail!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: tail strings do not match!\n");
> - return -1;
> - }
> - /* delete string from tail */
> - if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to delete string from tail!\n");
> - return -1;
> - }
> - /* verify string was deleted */
> - if (cirbuf_del_tail_safe(&cb) == 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* test adding from head and deleting from tail, and vice versa */
> -static int
> -test_cirbuf_string_add_del_reverse(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* delete string from tail */
> - if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_HEAD)) < 0) {
> - printf("Error: failed to delete string from tail!\n");
> - return -1;
> - }
> - /* verify string was deleted */
> - if (cirbuf_del_tail_safe(&cb) == 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> - /* clear tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to add string to tail!\n");
> - return -1;
> - }
> - /* delete string from head */
> - if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to delete string from head!\n");
> - return -1;
> - }
> - /* verify string was deleted */
> - if (cirbuf_del_head_safe(&cb) == 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* try to write more than available */
> -static int
> -test_cirbuf_string_add_boundaries(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - unsigned i;
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* fill the buffer from tail */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE - sizeof(CIRBUF_STR_TAIL) + 1; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* try adding a string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - > 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* try adding a string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - > 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* fill the buffer from head */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE - sizeof(CIRBUF_STR_HEAD) + 1; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* try adding a string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - > 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* try adding a string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - > 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* try to read/delete more than written */
> -static int
> -test_cirbuf_string_get_del_boundaries(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* read more than written (head) */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) + 1)
> - != sizeof(CIRBUF_STR_HEAD)) {
> - printf("Error: unexpected result when reading too much data!\n");
> - return -1;
> - }
> - /* read more than written (tail) */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) + 1)
> - != sizeof(CIRBUF_STR_HEAD)) {
> - printf("Error: unexpected result when reading too much data!\n");
> - return -1;
> - }
> - /* delete more than written (head) */
> - if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_HEAD) + 1) == 0) {
> - printf("Error: unexpected result when deleting too much data!\n");
> - return -1;
> - }
> - /* delete more than written (tail) */
> - if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_HEAD) + 1) == 0) {
> - printf("Error: unexpected result when deleting too much data!\n");
> - return -1;
> - }
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to tail */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
> - != (sizeof(CIRBUF_STR_TAIL))) {
> - printf("Error: failed to add string to tail!\n");
> - return -1;
> - }
> - /* read more than written (tail) */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL) + 1)
> - != sizeof(CIRBUF_STR_TAIL)) {
> - printf("Error: unexpected result when reading too much data!\n");
> - return -1;
> - }
> - /* read more than written (head) */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_TAIL) + 1)
> - != sizeof(CIRBUF_STR_TAIL)) {
> - printf("Error: unexpected result when reading too much data!\n");
> - return -1;
> - }
> - /* delete more than written (tail) */
> - if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL) + 1) == 0) {
> - printf("Error: unexpected result when deleting too much data!\n");
> - return -1;
> - }
> - /* delete more than written (head) */
> - if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL) + 1) == 0) {
> - printf("Error: unexpected result when deleting too much data!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* try to read/delete less than written */
> -static int
> -test_cirbuf_string_get_del_partial(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> - char tmp2[CMDLINE_TEST_BUFSIZE];
> -
> - /* initialize buffers */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> - memset(tmp2, 0, sizeof(tmp));
> -
> - snprintf(tmp2, sizeof(tmp2), "%s", CIRBUF_STR_HEAD);
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
> - != (sizeof(CIRBUF_STR_HEAD))) {
> - printf("Error: failed to add string to head!\n");
> - return -1;
> - }
> - /* read less than written (head) */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
> - != sizeof(CIRBUF_STR_HEAD) - 1) {
> - printf("Error: unexpected result when reading from head!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, tmp2, sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> - memset(tmp, 0, sizeof(tmp));
> - /* read less than written (tail) */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
> - != sizeof(CIRBUF_STR_HEAD) - 1) {
> - printf("Error: unexpected result when reading from tail!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - /*
> - * verify correct deletion
> - */
> -
> - /* clear buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> - /* delete less than written (head) */
> - if (cirbuf_del_buf_head(&cb, 1) != 0) {
> - printf("Error: delete from head failed!\n");
> - return -1;
> - }
> - /* read from head */
> - if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
> - != sizeof(CIRBUF_STR_HEAD) - 1) {
> - printf("Error: unexpected result when reading from head!\n");
> - return -1;
> - }
> - /* since we deleted from head, first char should be deleted */
> - if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> - /* clear buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> - /* delete less than written (tail) */
> - if (cirbuf_del_buf_tail(&cb, 1) != 0) {
> - printf("Error: delete from tail failed!\n");
> - return -1;
> - }
> - /* read from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 2)
> - != sizeof(CIRBUF_STR_HEAD) - 2) {
> - printf("Error: unexpected result when reading from head!\n");
> - return -1;
> - }
> - /* since we deleted from tail, last char should be deleted */
> - if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 2) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* test cmdline_cirbuf char add/del functions */
> -static int
> -test_cirbuf_char_add_del(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> -
> - /* clear buffer */
> - memset(buf, 0, sizeof(buf));
> - memset(tmp, 0, sizeof(tmp));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /*
> - * try to delete something from cirbuf. since it's empty,
> - * these should fail.
> - */
> - if (cirbuf_del_head_safe(&cb) == 0) {
> - printf("Error: deleting from empty cirbuf head succeeded!\n");
> - return -1;
> - }
> - if (cirbuf_del_tail_safe(&cb) == 0) {
> - printf("Error: deleting from empty cirbuf tail succeeded!\n");
> - return -1;
> - }
> -
> - /*
> - * add, verify and delete. these should pass.
> - */
> - if (cirbuf_add_head_safe(&cb,'h') < 0) {
> - printf("Error: adding to cirbuf head failed!\n");
> - return -1;
> - }
> - if (cirbuf_get_head(&cb) != 'h') {
> - printf("Error: wrong head content!\n");
> - return -1;
> - }
> - if (cirbuf_del_head_safe(&cb) < 0) {
> - printf("Error: deleting from cirbuf head failed!\n");
> - return -1;
> - }
> - if (cirbuf_add_tail_safe(&cb,'t') < 0) {
> - printf("Error: adding to cirbuf tail failed!\n");
> - return -1;
> - }
> - if (cirbuf_get_tail(&cb) != 't') {
> - printf("Error: wrong tail content!\n");
> - return -1;
> - }
> - if (cirbuf_del_tail_safe(&cb) < 0) {
> - printf("Error: deleting from cirbuf tail failed!\n");
> - return -1;
> - }
> - /* do the same for unsafe versions. those are void. */
> - cirbuf_add_head(&cb,'h');
> - if (cirbuf_get_head(&cb) != 'h') {
> - printf("Error: wrong head content!\n");
> - return -1;
> - }
> - cirbuf_del_head(&cb);
> -
> - /* test if char has been deleted. we can't call cirbuf_get_head
> - * because it's unsafe, but we can call cirbuf_get_buf_head.
> - */
> - if (cirbuf_get_buf_head(&cb, tmp, 1) > 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - cirbuf_add_tail(&cb,'t');
> - if (cirbuf_get_tail(&cb) != 't') {
> - printf("Error: wrong tail content!\n");
> - return -1;
> - }
> - cirbuf_del_tail(&cb);
> -
> - /* test if char has been deleted. we can't call cirbuf_get_tail
> - * because it's unsafe, but we can call cirbuf_get_buf_tail.
> - */
> - if (cirbuf_get_buf_tail(&cb, tmp, 1) > 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* test filling up buffer with chars */
> -static int
> -test_cirbuf_char_fill(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - unsigned i;
> -
> - /* clear buffer */
> - memset(buf, 0, sizeof(buf));
> -
> - /*
> - * initialize circular buffer
> - */
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /*
> - * fill the buffer from head or tail, verify contents, test boundaries
> - * and clear the buffer
> - */
> -
> - /* fill the buffer from tail */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> - /* verify that contents of the buffer are what they are supposed to be */
> - for (i = 0; i < sizeof(buf); i++) {
> - if (buf[i] != 't') {
> - printf("Error: wrong content in buffer!\n");
> - return -1;
> - }
> - }
> - /* try to add to a full buffer from tail */
> - if (cirbuf_add_tail_safe(&cb, 't') == 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* try to add to a full buffer from head */
> - if (cirbuf_add_head_safe(&cb, 'h') == 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* delete buffer from tail */
> - for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
> - cirbuf_del_tail_safe(&cb);
> - /* try to delete from an empty buffer */
> - if (cirbuf_del_tail_safe(&cb) >= 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - /* fill the buffer from head */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> - /* verify that contents of the buffer are what they are supposed to be */
> - for (i = 0; i < sizeof(buf); i++) {
> - if (buf[i] != 'h') {
> - printf("Error: wrong content in buffer!\n");
> - return -1;
> - }
> - }
> - /* try to add to a full buffer from head */
> - if (cirbuf_add_head_safe(&cb,'h') >= 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* try to add to a full buffer from tail */
> - if (cirbuf_add_tail_safe(&cb, 't') == 0) {
> - printf("Error: buffer should have been full!\n");
> - return -1;
> - }
> - /* delete buffer from head */
> - for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
> - cirbuf_del_head_safe(&cb);
> - /* try to delete from an empty buffer */
> - if (cirbuf_del_head_safe(&cb) >= 0) {
> - printf("Error: buffer should have been empty!\n");
> - return -1;
> - }
> -
> - /*
> - * fill the buffer from both head and tail, with alternating characters,
> - * verify contents and clear the buffer
> - */
> -
> - /* fill half of buffer from tail */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE / 2; i++)
> - cirbuf_add_tail_safe(&cb, (char) (i % 2 ? 't' : 'T'));
> - /* fill other half of the buffer from head */
> - for (i = 0; i < CMDLINE_TEST_BUFSIZE / 2; i++)
> - cirbuf_add_head_safe(&cb, (char) (i % 2 ? 'H' : 'h')); /* added in reverse */
> -
> - /* verify that contents of the buffer are what they are supposed to be */
> - for (i = 0; i < sizeof(buf) / 2; i++) {
> - if (buf[i] != (char) (i % 2 ? 't' : 'T')) {
> - printf("Error: wrong content in buffer at %u!\n", i);
> - return -1;
> - }
> - }
> - for (i = sizeof(buf) / 2; i < sizeof(buf); i++) {
> - if (buf[i] != (char) (i % 2 ? 'h' : 'H')) {
> - printf("Error: wrong content in buffer %u!\n", i);
> - return -1;
> - }
> - }
> -
> - return 0;
> -}
> -
> -/* test left alignment */
> -static int
> -test_cirbuf_align_left(void)
> -{
> -#define HALF_OFFSET CMDLINE_TEST_BUFSIZE / 2
> -#define SMALL_OFFSET HALF_OFFSET / 2
> -/* resulting buffer lengths for each of the test cases */
> -#define LEN1 HALF_OFFSET - SMALL_OFFSET - 1
> -#define LEN2 HALF_OFFSET + SMALL_OFFSET + 2
> -#define LEN3 HALF_OFFSET - SMALL_OFFSET
> -#define LEN4 HALF_OFFSET + SMALL_OFFSET - 1
> -
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> - unsigned i;
> -
> - /*
> - * align left when start < end and start in left half
> - */
> -
> - /*
> - * initialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push end into left half */
> - for (i = 0; i < HALF_OFFSET - 1; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* push start into left half < end */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_del_head_safe(&cb);
> -
> - /* align */
> - if (cirbuf_align_left(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* verify result */
> - if (cb.start != 0 || cb.len != LEN1 || cb.end != cb.len - 1) {
> - printf("Error: buffer alignment is wrong!\n");
> - return -1;
> - }
> -
> - /*
> - * align left when start > end and start in left half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into left half */
> - for (i = 0; i < HALF_OFFSET + 2; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half > start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* align */
> - if (cirbuf_align_left(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* verify result */
> - if (cb.start != 0 || cb.len != LEN2 || cb.end != cb.len - 1) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * align left when start < end and start in right half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into the right half */
> - for (i = 0; i < HALF_OFFSET; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half > start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_del_tail_safe(&cb);
> -
> - /* align */
> - if (cirbuf_align_left(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* verify result */
> - if (cb.start != 0 || cb.len != LEN3 || cb.end != cb.len - 1) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * align left when start > end and start in right half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into the right half */
> - for (i = 0; i < HALF_OFFSET - 1; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half < start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* align */
> - if (cirbuf_align_left(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* verify result */
> - if (cb.start != 0 || cb.len != LEN4 ||
> - cb.end != cb.len - 1) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * Verify that alignment doesn't corrupt data
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to tail and head */
> - if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD,
> - sizeof(CIRBUF_STR_HEAD)) < 0 || cirbuf_add_buf_tail(&cb,
> - CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to add strings!\n");
> - return -1;
> - }
> -
> - /* align */
> - if (cirbuf_align_left(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* get string from head */
> - if (cirbuf_get_buf_head(&cb, tmp,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to read string from head!\n");
> - return -1;
> - }
> -
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - /* reset tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> - /* get string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to read string from head!\n");
> - return -1;
> - }
> -
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* test right alignment */
> -static int
> -test_cirbuf_align_right(void)
> -{
> -#define END_OFFSET CMDLINE_TEST_BUFSIZE - 1
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> - char tmp[CMDLINE_TEST_BUFSIZE];
> - unsigned i;
> -
> -
> - /*
> - * align right when start < end and start in left half
> - */
> -
> - /*
> - * initialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to initialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push end into left half */
> - for (i = 0; i < HALF_OFFSET - 1; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* push start into left half < end */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_del_head_safe(&cb);
> -
> - /* align */
> - cirbuf_align_right(&cb);
> -
> - /* verify result */
> - if (cb.start != END_OFFSET || cb.len != LEN1 || cb.end != cb.len - 2) {
> - printf("Error: buffer alignment is wrong!\n");
> - return -1;
> - }
> -
> - /*
> - * align right when start > end and start in left half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into left half */
> - for (i = 0; i < HALF_OFFSET + 2; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half > start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* align */
> - cirbuf_align_right(&cb);
> -
> - /* verify result */
> - if (cb.start != END_OFFSET || cb.len != LEN2 || cb.end != cb.len - 2) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * align right when start < end and start in right half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into the right half */
> - for (i = 0; i < HALF_OFFSET; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half > start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_del_tail_safe(&cb);
> -
> - /* align */
> - cirbuf_align_right(&cb);
> -
> - /* verify result */
> - if (cb.end != END_OFFSET || cb.len != LEN3 || cb.start != cb.end - cb.len + 1) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * align right when start > end and start in right half
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* push start into the right half */
> - for (i = 0; i < HALF_OFFSET - 1; i++)
> - cirbuf_add_head_safe(&cb, 'h');
> -
> - /* push end into left half < start */
> - for (i = 0; i < SMALL_OFFSET; i++)
> - cirbuf_add_tail_safe(&cb, 't');
> -
> - /* align */
> - cirbuf_align_right(&cb);
> -
> - /* verify result */
> - if (cb.end != END_OFFSET || cb.len != LEN4 || cb.start != cb.end - cb.len + 1) {
> - printf("Error: buffer alignment is wrong!");
> - return -1;
> - }
> -
> - /*
> - * Verify that alignment doesn't corrupt data
> - */
> -
> - /*
> - * reinitialize circular buffer
> - */
> - memset(buf, 0, sizeof(buf));
> - if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
> - printf("Error: failed to reinitialize circular buffer!\n");
> - return -1;
> - }
> -
> - /* add string to tail and head */
> - if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL,
> - sizeof(CIRBUF_STR_TAIL)) < 0 || cirbuf_add_buf_head(&cb,
> - CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) < 0) {
> - printf("Error: failed to add strings!\n");
> - return -1;
> - }
> -
> - /* align */
> - if (cirbuf_align_right(&cb) < 0) {
> - printf("Error: alignment failed!\n");
> - return -1;
> - }
> -
> - /* get string from head */
> - if (cirbuf_get_buf_head(&cb, tmp,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to read string from head!\n");
> - return -1;
> - }
> -
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - /* reset tmp buffer */
> - memset(tmp, 0, sizeof(tmp));
> -
> - /* get string from tail */
> - if (cirbuf_get_buf_tail(&cb, tmp,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
> - printf("Error: failed to read string from head!\n");
> - return -1;
> - }
> - /* verify string */
> - if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
> - sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
> - printf("Error: strings mismatch!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> -/* call functions with invalid parameters */
> -int
> -test_cirbuf_invalid_param(void)
> -{
> - struct cirbuf cb;
> - char buf[CMDLINE_TEST_BUFSIZE];
> -
> - /* null cirbuf */
> - if (cirbuf_init(0, buf, 0, sizeof(buf)) == 0)
> - return -1;
> - /* null buffer */
> - if (cirbuf_init(&cb, 0, 0, sizeof(buf)) == 0)
> - return -1;
> - /* null cirbuf */
> - if (cirbuf_add_head_safe(0, 'h') == 0)
> - return -1;
> - if (cirbuf_add_tail_safe(0, 't') == 0)
> - return -1;
> - if (cirbuf_del_head_safe(0) == 0)
> - return -1;
> - if (cirbuf_del_tail_safe(0) == 0)
> - return -1;
> - /* null buffer */
> - if (cirbuf_add_buf_head(&cb, 0, 0) == 0)
> - return -1;
> - if (cirbuf_add_buf_tail(&cb, 0, 0) == 0)
> - return -1;
> - /* null cirbuf */
> - if (cirbuf_add_buf_head(0, buf, 0) == 0)
> - return -1;
> - if (cirbuf_add_buf_tail(0, buf, 0) == 0)
> - return -1;
> - /* null size */
> - if (cirbuf_add_buf_head(&cb, buf, 0) == 0)
> - return -1;
> - if (cirbuf_add_buf_tail(&cb, buf, 0) == 0)
> - return -1;
> - /* null cirbuf */
> - if (cirbuf_del_buf_head(0, 0) == 0)
> - return -1;
> - if (cirbuf_del_buf_tail(0, 0) == 0)
> - return -1;
> - /* null size */
> - if (cirbuf_del_buf_head(&cb, 0) == 0)
> - return -1;
> - if (cirbuf_del_buf_tail(&cb, 0) == 0)
> - return -1;
> - /* null cirbuf */
> - if (cirbuf_get_buf_head(0, 0, 0) == 0)
> - return -1;
> - if (cirbuf_get_buf_tail(0, 0, 0) == 0)
> - return -1;
> - /* null buffer */
> - if (cirbuf_get_buf_head(&cb, 0, 0) == 0)
> - return -1;
> - if (cirbuf_get_buf_tail(&cb, 0, 0) == 0)
> - return -1;
> - /* null size, this is valid but should return 0 */
> - if (cirbuf_get_buf_head(&cb, buf, 0) != 0)
> - return -1;
> - if (cirbuf_get_buf_tail(&cb, buf, 0) != 0)
> - return -1;
> - /* null cirbuf */
> - if (cirbuf_align_left(0) == 0)
> - return -1;
> - if (cirbuf_align_right(0) == 0)
> - return -1;
> -
> - return 0;
> -}
> -
> -/* test cmdline_cirbuf char functions */
> -int
> -test_cirbuf_char(void)
> -{
> - int ret;
> -
> - ret = test_cirbuf_char_add_del();
> - if (ret < 0)
> - return -1;
> -
> - ret = test_cirbuf_char_fill();
> - if (ret < 0)
> - return -1;
> -
> - return 0;
> -}
> -
> -/* test cmdline_cirbuf string functions */
> -int
> -test_cirbuf_string(void)
> -{
> - if (test_cirbuf_string_add_del() < 0)
> - return -1;
> -
> - if (test_cirbuf_string_add_del_reverse() < 0)
> - return -1;
> -
> - if (test_cirbuf_string_add_boundaries() < 0)
> - return -1;
> -
> - if (test_cirbuf_string_get_del_boundaries() < 0)
> - return -1;
> -
> - if (test_cirbuf_string_get_del_partial() < 0)
> - return -1;
> -
> - if (test_cirbuf_string_misc() < 0)
> - return -1;
> -
> - return 0;
> -}
> -
> -/* test cmdline_cirbuf align functions */
> -int
> -test_cirbuf_align(void)
> -{
> - if (test_cirbuf_align_left() < 0)
> - return -1;
> - if (test_cirbuf_align_right() < 0)
> - return -1;
> - return 0;
> -}
> diff --git a/test/test/test_cmdline_lib.c b/test/test/test_cmdline_lib.c
> index 65b823a..93a80d0 100644
> --- a/test/test/test_cmdline_lib.c
> +++ b/test/test/test_cmdline_lib.c
> @@ -41,8 +41,6 @@
> #include <ctype.h>
> #include <sys/queue.h>
>
> -#include <cmdline_vt100.h>
> -#include <cmdline_rdline.h>
> #include <cmdline_parse.h>
> #include <cmdline_socket.h>
> #include <cmdline.h>
> @@ -50,113 +48,41 @@
> #include "test_cmdline.h"
>
> /****************************************************************/
> -/* static functions required for some tests */
> -static void
> -valid_buffer(__attribute__((unused))struct rdline *rdl,
> - __attribute__((unused))const char *buf,
> - __attribute__((unused)) unsigned int size)
> -{
> -}
> -
> -static int
> -complete_buffer(__attribute__((unused)) struct rdline *rdl,
> - __attribute__((unused)) const char *buf,
> - __attribute__((unused)) char *dstbuf,
> - __attribute__((unused)) unsigned int dstsize,
> - __attribute__((unused)) int *state)
> -{
> - return 0;
> -}
> -
> -/****************************************************************/
>
> static int
> test_cmdline_parse_fns(void)
> {
> - struct cmdline cl;
> + struct cmdline *cl;
> int i = 0;
> char dst[CMDLINE_TEST_BUFSIZE];
>
> + cl = cmdline_new(NULL, "prompt", 0, 1);
> + if (!cl)
> + goto error;
> if (cmdline_parse(NULL, "buffer") >= 0)
> goto error;
> - if (cmdline_parse(&cl, NULL) >= 0)
> + if (cmdline_parse(cl, NULL) >= 0)
> goto error;
>
> if (cmdline_complete(NULL, "buffer", &i, dst, sizeof(dst)) >= 0)
> goto error;
> - if (cmdline_complete(&cl, NULL, &i, dst, sizeof(dst)) >= 0)
> + if (cmdline_complete(cl, NULL, &i, dst, sizeof(dst)) >= 0)
> goto error;
> - if (cmdline_complete(&cl, "buffer", NULL, dst, sizeof(dst)) >= 0)
> + if (cmdline_complete(cl, "buffer", NULL, dst, sizeof(dst)) >= 0)
> goto error;
> - if (cmdline_complete(&cl, "buffer", &i, NULL, sizeof(dst)) >= 0)
> + if (cmdline_complete(cl, "buffer", &i, NULL, sizeof(dst)) >= 0)
> goto error;
>
> return 0;
>
> error:
> + if (cl)
> + cmdline_free(cl);
> printf("Error: function accepted null parameter!\n");
> return -1;
> }
>
> static int
> -test_cmdline_rdline_fns(void)
> -{
> - struct rdline rdl;
> - rdline_write_char_t *wc = &cmdline_write_char;
> - rdline_validate_t *v = &valid_buffer;
> - rdline_complete_t *c = &complete_buffer;
> -
> - if (rdline_init(NULL, wc, v, c) >= 0)
> - goto error;
> - if (rdline_init(&rdl, NULL, v, c) >= 0)
> - goto error;
> - if (rdline_init(&rdl, wc, NULL, c) >= 0)
> - goto error;
> - if (rdline_init(&rdl, wc, v, NULL) >= 0)
> - goto error;
> - if (rdline_char_in(NULL, 0) >= 0)
> - goto error;
> - if (rdline_get_buffer(NULL) != NULL)
> - goto error;
> - if (rdline_add_history(NULL, "history") >= 0)
> - goto error;
> - if (rdline_add_history(&rdl, NULL) >= 0)
> - goto error;
> - if (rdline_get_history_item(NULL, 0) != NULL)
> - goto error;
> -
> - /* void functions */
> - rdline_newline(NULL, "prompt");
> - rdline_newline(&rdl, NULL);
> - rdline_stop(NULL);
> - rdline_quit(NULL);
> - rdline_restart(NULL);
> - rdline_redisplay(NULL);
> - rdline_reset(NULL);
> - rdline_clear_history(NULL);
> -
> - return 0;
> -
> -error:
> - printf("Error: function accepted null parameter!\n");
> - return -1;
> -}
> -
> -static int
> -test_cmdline_vt100_fns(void)
> -{
> - if (vt100_parser(NULL, 0) >= 0) {
> - printf("Error: function accepted null parameter!\n");
> - return -1;
> - }
> -
> - /* void functions */
> - vt100_init(NULL);
> -
> - return 0;
> -}
> -
> -static int
> test_cmdline_socket_fns(void)
> {
> cmdline_parse_ctx_t ctx;
> @@ -193,7 +119,7 @@ static int
> test_cmdline_fns(void)
> {
> cmdline_parse_ctx_t ctx;
> - struct cmdline cl, *tmp;
> + struct cmdline *tmp;
>
> memset(&ctx, 0, sizeof(ctx));
> tmp = cmdline_new(&ctx, "test", -1, -1);
> @@ -206,10 +132,6 @@ test_cmdline_fns(void)
> goto error;
> if (cmdline_in(NULL, "buffer", CMDLINE_TEST_BUFSIZE) >= 0)
> goto error;
> - if (cmdline_in(&cl, NULL, CMDLINE_TEST_BUFSIZE) >= 0)
> - goto error;
> - if (cmdline_write_char(NULL, 0) >= 0)
> - goto error;
>
> /* void functions */
> cmdline_set_prompt(NULL, "prompt");
> @@ -220,16 +142,6 @@ test_cmdline_fns(void)
> cmdline_interact(NULL);
> cmdline_quit(NULL);
>
> - /* check if void calls change anything when they should fail */
> - cl = *tmp;
> -
> - cmdline_printf(&cl, NULL);
> - if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
> - cmdline_set_prompt(&cl, NULL);
> - if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
> - cmdline_in(&cl, NULL, CMDLINE_TEST_BUFSIZE);
> - if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
> -
> cmdline_free(tmp);
>
> return 0;
> @@ -237,9 +149,6 @@ test_cmdline_fns(void)
> error:
> printf("Error: function accepted null parameter!\n");
> return -1;
> -mismatch:
> - printf("Error: data changed!\n");
> - return -1;
> }
>
> /* test library functions. the point of these tests is not so much to test
> @@ -251,10 +160,6 @@ test_cmdline_lib(void)
> {
> if (test_cmdline_parse_fns() < 0)
> return -1;
> - if (test_cmdline_rdline_fns() < 0)
> - return -1;
> - if (test_cmdline_vt100_fns() < 0)
> - return -1;
> if (test_cmdline_socket_fns() < 0)
> return -1;
> if (test_cmdline_fns() < 0)
> --
> 2.1.4
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-16 9:23 0% ` Adrien Mazarguil
@ 2017-11-16 16:48 0% ` Wiles, Keith
0 siblings, 0 replies; 200+ results
From: Wiles, Keith @ 2017-11-16 16:48 UTC (permalink / raw)
To: Adrien Mazarguil
Cc: Olivier Matz, Wu, Jingjing, dev, Thomas Monjalon, Yigit, Ferruh
> On Nov 16, 2017, at 1:23 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>
> Hi Keith,
>
> On Wed, Nov 15, 2017 at 04:12:07AM +0000, Wiles, Keith wrote:
>>
>>
>>> On Nov 9, 2017, at 5:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>>>
>>> This patch removes all code associated with symbols not internally relied
>>> on by other DPDK components, makes struct cmdline opaque and then proceeds
>>> to re-implement the remaining functionality as a wrapper to the editline
>>> library (also known as libedit) [1].
>>>
>>> Besides adding a new external dependency to its users, its large impact on
>>> librte_cmdline's API/ABI also warrants a major version number bump.
>>>
>>> While librte_cmdline served DPDK well all these years as a small, easy to
>>> use and self-sufficient interactive command-line handler, it started to
>>> show its limits with testpmd's flow (rte_flow) command, which required
>>> support for dynamic tokens and very long commands.
>>>
>>> This is the main motivation behind this rework. Long commands often need to
>>> be displayed on multiple lines, which are not properly supported by
>>> librte_cmdline's limited terminal handling capabilities, resulting in a
>>> rather frustrating user experience.
>>>
>>> Testpmd being one of the main tools used by PMD developers and given flow
>>> command lines won't get any shorter, this issue had to be addressed.
>>>
>>> Three options were considered:
>>>
>>> - Fixing and enhancing librte_cmdline.
>>>
>>> The amount of work necessary to add support for edition on multiple lines
>>> was deemed significant and the result would still have lacked in some
>>> areas, such as working backspace/delete keys in all terminals (i.e. full
>>> termcap support).
>>>
>>> - Making testpmd directly rely on a more capable library.
>>>
>>> All testpmd commands rely on the cmdline_parse interface provided by
>>> librte_cmdline. This approach would have required either a complete
>>> rewrite or importing the missing bits from librte_cmdline to wrap them
>>> around the new library, which naturally led to...
>>>
>>> - Converting librte_cmdline as a wrapper to a more capable library.
>>>
>>> Let's be honest, interactive command line handling isn't what makes DPDK
>>> shine. It's also far removed from its core functionality, but is still
>>> necessary in order to easily implement test and example programs; the
>>> cmdline_parse interface is particularly good at this.
>>>
>>> DPDK actually only relies on cmdline_parse. By removing all the other
>>> unused interfaces, implementing what remains on top of a different
>>> terminal-handling library would be quick and easy.
>>>
>>> This last approach was chosen for the stated reasons. Libedit is
>>> well-known, BSD-licensed, widely available [2], used by many projects, does
>>> everything needed and more [3].
>>>
>>> This rework results in the following changes:
>>>
>>> - Removed circular buffer management interface for command history
>>> (cmdline_cirbuf.c), command history being handled by libedit.
>>> - Removed raw command-line interpreter (cmdline_rdline.c).
>>> - Removed raw terminal handler (cmdline_vt100.c).
>>> - Removed all test/example code for the above.
>>> - Re-implemented high level interactive and non-interactive command-line
>>> handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
>>> native interface, not its readline compatibility layer.
>>> - Made struct cmdline opaque so that applications relying on librte_cmdline
>>> do not need to include any libedit headers.
>>> - The only visible change for most applications besides being linked to
>>> libedit is they do not have to include cmdline_rdline.h anymore.
>>>
>>> As an added bonus, terminal resizing is now automatically handled.
>>>
>>> In the future, cmdline_parse could use libedit's advanced tokenizer as
>>> well to interpret quoted strings and escape sequences.
>>>
>>
>> I do agree that cmdline is getting pretty old and using libedit is one solution around the long commands, but it has a lot more problems IMO.
>
> Before going further, I'd like to put emphasis on the fact this RFC is not
> pushing to retain librte_cmdline over your librte_cli proposal. Rather, it
> removes about 30% of its code and shifts the blame to an external library
> without modifying user applications.
>
> It started some time ago as a quick hack to improve user experience with the
> flow command in testpmd using the least amount of time and effort, which I
> only recently reformatted as a proper RFC in order to get feedback from the
> community.
>
>> I do not agree it has severed DPDK well, just look at test-pmd and the hoops people have to jump thru to get a new command or variation of an existing command integrated into test-pmd it is very difficult. Also if you look at the command sets in test-pmd they are very odd in that similar commands can some times be set up completely different as cmdline is too rigid and difficult to use.
>
> Testpmd is indeed messy, but this is not librte_cmdline's fundamental fault
> in my opinion, more likely the result of using a copy/paste approach to new
> commands due to lack of time or interest in making things nicer than the
> bare minimum to validate features. There's no design direction for it hence
> the lack of uniformity in the command hierarchy.
>
>> I had decided to not use the circular buffer code in cmdline as it did have a few problems for what I wanted and decided to write a standard gap buffer scheme used in most editors for lines. I had looked at libedit at one point decided I did not want another dependence for DPDK. I expect even my version does not solve the long line problem, but we can convert to libedit. (and toss my pretty code :-)
>
> I'm not sure adding dependencies to DPDK is an issue anymore. Not in the
> sense "there's so many of them already, no one will notice" but more with
> the need to focus community efforts a bit more on what DPDK brings that
> doesn't exist elsewhere.
>
> How many DPDK contributors are experts in termcap handling and would care to
> invest time in this area, compared to say, squeezing the last drop of
> performance out of their employer's HW?
>
> I understand you've invested a lot of effort in this but I think that even
> if DPDK moves to librte_cli, the switch to libedit will be unavoidable.
>
> Keep in mind every time some feature will be requested, someone will raise
> the question "why not move to libedit instead?"
>
>> Fixing the long line problem is a very minor issue compared to everything
>> else wrong with cmdline.
>
> I beg to differ on this point, however the reason may not be obvious if
> you are not familiar with the flow command (the main reason behind this
> RFC).
>
> You should try it. It basically uses dynamic cmdline_parse tokens and help
> strings which enables flexible arguments with contextual help (without
> printing it for hundreds of unrelated commands) and more or less infinite
> command lines. That was the only sane approach to interface rte_flow.
>
> My point is there's already a case today for long lines support, it's not
> minor given rte_flow is bound to replace a lot of the legacy APIs and
> associated testpmd commands (flow_director_* to name a few).
>
>> I would suggest we look at CLI and improve it instead. We can add libedit to CLI and then finish testing the CLI with test-pmd. The first time I converted test-pmd I did remove and simplify the commands, but I was afraid that would cause a lot of problems for testing and scripts that people have written, but it is possible to fix these problems too.
>>
>> I do not think fixing cmdline is the best answer and working to convert over to CLI is the better answer here.
>
> In truth I didn't do my homework. Before your reply I completely forgot
> about the librte_cli proposal and related dpdk-draft-cli tree. It didn't
> cross my mind to check it out before working on this RFC.
>
> I'm now aware of how much effort you put in this and what it takes to
> reorder and reimplement all testpmd commands. That's huge. It seems like
> we're fighting unrelated battles though.
>
> To summarize:
>
> - You don't like librte_cmdline for various reasons and provide librte_cli
> as an alternative along a testpmd implementation. I assume the goal is to
> remove librte_cmdline once every application has switched.
>
> - I don't mind librte_cmdline, but I don't expect it to grow nor to be used
> by applications outside test programs in DPDK itself, hence I choose to
> strip its unused parts and make the rest a wrapper to libedit without
> modifying applications.
>
> Both are not incompatible, and since I think libedit will be unavoidable for
> librte_cli, my approach can be seen as temporary until something replaces
> librte_cmdline. In the meantime, users still benefit from much better
> command line handling at no extra cost.
OK, I understand your points and not to state your work was in vain, but it would have been better if we had applied the effort to the CLI. I do not agree per-say that libedit is required for CLI as the only feature we need is to handle long lines and their are easier ways to do then using libedit.
I was looking at the problem and I think we can handle long lines without libedit, I will try to put together an example soon.
For now we can accept your patch for cmdline as it does add the support without much effort.
>
> --
> Adrien Mazarguil
> 6WIND
Regards,
Keith
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-15 4:12 0% ` Wiles, Keith
2017-11-15 8:04 0% ` Olivier MATZ
@ 2017-11-16 9:23 0% ` Adrien Mazarguil
2017-11-16 16:48 0% ` Wiles, Keith
1 sibling, 1 reply; 200+ results
From: Adrien Mazarguil @ 2017-11-16 9:23 UTC (permalink / raw)
To: Wiles, Keith
Cc: Olivier Matz, Wu, Jingjing, dev, Thomas Monjalon, Yigit, Ferruh
Hi Keith,
On Wed, Nov 15, 2017 at 04:12:07AM +0000, Wiles, Keith wrote:
>
>
> > On Nov 9, 2017, at 5:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> >
> > This patch removes all code associated with symbols not internally relied
> > on by other DPDK components, makes struct cmdline opaque and then proceeds
> > to re-implement the remaining functionality as a wrapper to the editline
> > library (also known as libedit) [1].
> >
> > Besides adding a new external dependency to its users, its large impact on
> > librte_cmdline's API/ABI also warrants a major version number bump.
> >
> > While librte_cmdline served DPDK well all these years as a small, easy to
> > use and self-sufficient interactive command-line handler, it started to
> > show its limits with testpmd's flow (rte_flow) command, which required
> > support for dynamic tokens and very long commands.
> >
> > This is the main motivation behind this rework. Long commands often need to
> > be displayed on multiple lines, which are not properly supported by
> > librte_cmdline's limited terminal handling capabilities, resulting in a
> > rather frustrating user experience.
> >
> > Testpmd being one of the main tools used by PMD developers and given flow
> > command lines won't get any shorter, this issue had to be addressed.
> >
> > Three options were considered:
> >
> > - Fixing and enhancing librte_cmdline.
> >
> > The amount of work necessary to add support for edition on multiple lines
> > was deemed significant and the result would still have lacked in some
> > areas, such as working backspace/delete keys in all terminals (i.e. full
> > termcap support).
> >
> > - Making testpmd directly rely on a more capable library.
> >
> > All testpmd commands rely on the cmdline_parse interface provided by
> > librte_cmdline. This approach would have required either a complete
> > rewrite or importing the missing bits from librte_cmdline to wrap them
> > around the new library, which naturally led to...
> >
> > - Converting librte_cmdline as a wrapper to a more capable library.
> >
> > Let's be honest, interactive command line handling isn't what makes DPDK
> > shine. It's also far removed from its core functionality, but is still
> > necessary in order to easily implement test and example programs; the
> > cmdline_parse interface is particularly good at this.
> >
> > DPDK actually only relies on cmdline_parse. By removing all the other
> > unused interfaces, implementing what remains on top of a different
> > terminal-handling library would be quick and easy.
> >
> > This last approach was chosen for the stated reasons. Libedit is
> > well-known, BSD-licensed, widely available [2], used by many projects, does
> > everything needed and more [3].
> >
> > This rework results in the following changes:
> >
> > - Removed circular buffer management interface for command history
> > (cmdline_cirbuf.c), command history being handled by libedit.
> > - Removed raw command-line interpreter (cmdline_rdline.c).
> > - Removed raw terminal handler (cmdline_vt100.c).
> > - Removed all test/example code for the above.
> > - Re-implemented high level interactive and non-interactive command-line
> > handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
> > native interface, not its readline compatibility layer.
> > - Made struct cmdline opaque so that applications relying on librte_cmdline
> > do not need to include any libedit headers.
> > - The only visible change for most applications besides being linked to
> > libedit is they do not have to include cmdline_rdline.h anymore.
> >
> > As an added bonus, terminal resizing is now automatically handled.
> >
> > In the future, cmdline_parse could use libedit's advanced tokenizer as
> > well to interpret quoted strings and escape sequences.
> >
>
> I do agree that cmdline is getting pretty old and using libedit is one solution around the long commands, but it has a lot more problems IMO.
Before going further, I'd like to put emphasis on the fact this RFC is not
pushing to retain librte_cmdline over your librte_cli proposal. Rather, it
removes about 30% of its code and shifts the blame to an external library
without modifying user applications.
It started some time ago as a quick hack to improve user experience with the
flow command in testpmd using the least amount of time and effort, which I
only recently reformatted as a proper RFC in order to get feedback from the
community.
> I do not agree it has severed DPDK well, just look at test-pmd and the hoops people have to jump thru to get a new command or variation of an existing command integrated into test-pmd it is very difficult. Also if you look at the command sets in test-pmd they are very odd in that similar commands can some times be set up completely different as cmdline is too rigid and difficult to use.
Testpmd is indeed messy, but this is not librte_cmdline's fundamental fault
in my opinion, more likely the result of using a copy/paste approach to new
commands due to lack of time or interest in making things nicer than the
bare minimum to validate features. There's no design direction for it hence
the lack of uniformity in the command hierarchy.
> I had decided to not use the circular buffer code in cmdline as it did have a few problems for what I wanted and decided to write a standard gap buffer scheme used in most editors for lines. I had looked at libedit at one point decided I did not want another dependence for DPDK. I expect even my version does not solve the long line problem, but we can convert to libedit. (and toss my pretty code :-)
I'm not sure adding dependencies to DPDK is an issue anymore. Not in the
sense "there's so many of them already, no one will notice" but more with
the need to focus community efforts a bit more on what DPDK brings that
doesn't exist elsewhere.
How many DPDK contributors are experts in termcap handling and would care to
invest time in this area, compared to say, squeezing the last drop of
performance out of their employer's HW?
I understand you've invested a lot of effort in this but I think that even
if DPDK moves to librte_cli, the switch to libedit will be unavoidable.
Keep in mind every time some feature will be requested, someone will raise
the question "why not move to libedit instead?"
> Fixing the long line problem is a very minor issue compared to everything
> else wrong with cmdline.
I beg to differ on this point, however the reason may not be obvious if
you are not familiar with the flow command (the main reason behind this
RFC).
You should try it. It basically uses dynamic cmdline_parse tokens and help
strings which enables flexible arguments with contextual help (without
printing it for hundreds of unrelated commands) and more or less infinite
command lines. That was the only sane approach to interface rte_flow.
My point is there's already a case today for long lines support, it's not
minor given rte_flow is bound to replace a lot of the legacy APIs and
associated testpmd commands (flow_director_* to name a few).
> I would suggest we look at CLI and improve it instead. We can add libedit to CLI and then finish testing the CLI with test-pmd. The first time I converted test-pmd I did remove and simplify the commands, but I was afraid that would cause a lot of problems for testing and scripts that people have written, but it is possible to fix these problems too.
>
> I do not think fixing cmdline is the best answer and working to convert over to CLI is the better answer here.
In truth I didn't do my homework. Before your reply I completely forgot
about the librte_cli proposal and related dpdk-draft-cli tree. It didn't
cross my mind to check it out before working on this RFC.
I'm now aware of how much effort you put in this and what it takes to
reorder and reimplement all testpmd commands. That's huge. It seems like
we're fighting unrelated battles though.
To summarize:
- You don't like librte_cmdline for various reasons and provide librte_cli
as an alternative along a testpmd implementation. I assume the goal is to
remove librte_cmdline once every application has switched.
- I don't mind librte_cmdline, but I don't expect it to grow nor to be used
by applications outside test programs in DPDK itself, hence I choose to
strip its unused parts and make the rest a wrapper to libedit without
modifying applications.
Both are not incompatible, and since I think libedit will be unavoidable for
librte_cli, my approach can be seen as temporary until something replaces
librte_cmdline. In the meantime, users still benefit from much better
command line handling at no extra cost.
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-15 8:04 0% ` Olivier MATZ
@ 2017-11-15 16:31 0% ` Wiles, Keith
0 siblings, 0 replies; 200+ results
From: Wiles, Keith @ 2017-11-15 16:31 UTC (permalink / raw)
To: Olivier MATZ
Cc: Adrien Mazarguil, Wu, Jingjing, dev, Thomas Monjalon, Yigit, Ferruh
> On Nov 15, 2017, at 12:04 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
>
> Hi,
>
> On Wed, Nov 15, 2017 at 04:12:07AM +0000, Wiles, Keith wrote:
>>
>>
>>> On Nov 9, 2017, at 5:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>>>
>>> This patch removes all code associated with symbols not internally relied
>>> on by other DPDK components, makes struct cmdline opaque and then proceeds
>>> to re-implement the remaining functionality as a wrapper to the editline
>>> library (also known as libedit) [1].
>>>
>>> Besides adding a new external dependency to its users, its large impact on
>>> librte_cmdline's API/ABI also warrants a major version number bump.
>>>
>>> While librte_cmdline served DPDK well all these years as a small, easy to
>>> use and self-sufficient interactive command-line handler, it started to
>>> show its limits with testpmd's flow (rte_flow) command, which required
>>> support for dynamic tokens and very long commands.
>>>
>>> This is the main motivation behind this rework. Long commands often need to
>>> be displayed on multiple lines, which are not properly supported by
>>> librte_cmdline's limited terminal handling capabilities, resulting in a
>>> rather frustrating user experience.
>>>
>>> Testpmd being one of the main tools used by PMD developers and given flow
>>> command lines won't get any shorter, this issue had to be addressed.
>>>
>>> Three options were considered:
>>>
>>> - Fixing and enhancing librte_cmdline.
>>>
>>> The amount of work necessary to add support for edition on multiple lines
>>> was deemed significant and the result would still have lacked in some
>>> areas, such as working backspace/delete keys in all terminals (i.e. full
>>> termcap support).
>>>
>>> - Making testpmd directly rely on a more capable library.
>>>
>>> All testpmd commands rely on the cmdline_parse interface provided by
>>> librte_cmdline. This approach would have required either a complete
>>> rewrite or importing the missing bits from librte_cmdline to wrap them
>>> around the new library, which naturally led to...
>>>
>>> - Converting librte_cmdline as a wrapper to a more capable library.
>>>
>>> Let's be honest, interactive command line handling isn't what makes DPDK
>>> shine. It's also far removed from its core functionality, but is still
>>> necessary in order to easily implement test and example programs; the
>>> cmdline_parse interface is particularly good at this.
>>>
>>> DPDK actually only relies on cmdline_parse. By removing all the other
>>> unused interfaces, implementing what remains on top of a different
>>> terminal-handling library would be quick and easy.
>>>
>>> This last approach was chosen for the stated reasons. Libedit is
>>> well-known, BSD-licensed, widely available [2], used by many projects, does
>>> everything needed and more [3].
>>>
>>> This rework results in the following changes:
>>>
>>> - Removed circular buffer management interface for command history
>>> (cmdline_cirbuf.c), command history being handled by libedit.
>>> - Removed raw command-line interpreter (cmdline_rdline.c).
>>> - Removed raw terminal handler (cmdline_vt100.c).
>>> - Removed all test/example code for the above.
>>> - Re-implemented high level interactive and non-interactive command-line
>>> handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
>>> native interface, not its readline compatibility layer.
>>> - Made struct cmdline opaque so that applications relying on librte_cmdline
>>> do not need to include any libedit headers.
>>> - The only visible change for most applications besides being linked to
>>> libedit is they do not have to include cmdline_rdline.h anymore.
>>>
>>> As an added bonus, terminal resizing is now automatically handled.
>>>
>>> In the future, cmdline_parse could use libedit's advanced tokenizer as
>>> well to interpret quoted strings and escape sequences.
>>>
>>
>> I do agree that cmdline is getting pretty old and using libedit is one solution around the long commands, but it has a lot more problems IMO.
>>
>> I do not agree it has severed DPDK well, just look at test-pmd and the hoops people have to jump thru to get a new command or variation of an existing command integrated into test-pmd it is very difficult. Also if you look at the command sets in test-pmd they are very odd in that similar commands can some times be set up completely different as cmdline is too rigid and difficult to use.
>>
>> I had decided to not use the circular buffer code in cmdline as it did have a few problems for what I wanted and decided to write a standard gap buffer scheme used in most editors for lines. I had looked at libedit at one point decided I did not want another dependence for DPDK. I expect even my version does not solve the long line problem, but we can convert to libedit. (and toss my pretty code :-)
>>
>> Fixing the long line problem is a very minor issue compared to everything else wrong with cmdline. I would suggest we look at CLI and improve it instead. We can add libedit to CLI and then finish testing the CLI with test-pmd. The first time I converted test-pmd I did remove and simplify the commands, but I was afraid that would cause a lot of problems for testing and scripts that people have written, but it is possible to fix these problems too.
>>
>>
>> I do not think fixing cmdline is the best answer and working to convert over to CLI is the better answer here.
>
> On my side, I think this patch goes in the correct direction:
> - it solves an issue of the command line library
> - it replaces a specific dpdk code by a well-known library which is widely used
We are ignoring the fact we are trying to patch something that is difficult to use and does not create a clean/simple design for the developer.
Just patching this with libedit now adds two more dependencies to the DPDK libedit and now ncurses. If we moved to CLI then we can fix the one thing we need fixed is the long command line and not require more dependencies to DPDK. Adding more dependencies to DPDK is going ti cause problems with the distro’s but I assume these are around. In Ubuntu 17.04 I had to pull in libedit and ncurses to use libedit.
>
> Olivier
Regards,
Keith
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-15 4:12 0% ` Wiles, Keith
@ 2017-11-15 8:04 0% ` Olivier MATZ
2017-11-15 16:31 0% ` Wiles, Keith
2017-11-16 9:23 0% ` Adrien Mazarguil
1 sibling, 1 reply; 200+ results
From: Olivier MATZ @ 2017-11-15 8:04 UTC (permalink / raw)
To: Wiles, Keith
Cc: Adrien Mazarguil, Wu, Jingjing, dev, Thomas Monjalon, Yigit, Ferruh
Hi,
On Wed, Nov 15, 2017 at 04:12:07AM +0000, Wiles, Keith wrote:
>
>
> > On Nov 9, 2017, at 5:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> >
> > This patch removes all code associated with symbols not internally relied
> > on by other DPDK components, makes struct cmdline opaque and then proceeds
> > to re-implement the remaining functionality as a wrapper to the editline
> > library (also known as libedit) [1].
> >
> > Besides adding a new external dependency to its users, its large impact on
> > librte_cmdline's API/ABI also warrants a major version number bump.
> >
> > While librte_cmdline served DPDK well all these years as a small, easy to
> > use and self-sufficient interactive command-line handler, it started to
> > show its limits with testpmd's flow (rte_flow) command, which required
> > support for dynamic tokens and very long commands.
> >
> > This is the main motivation behind this rework. Long commands often need to
> > be displayed on multiple lines, which are not properly supported by
> > librte_cmdline's limited terminal handling capabilities, resulting in a
> > rather frustrating user experience.
> >
> > Testpmd being one of the main tools used by PMD developers and given flow
> > command lines won't get any shorter, this issue had to be addressed.
> >
> > Three options were considered:
> >
> > - Fixing and enhancing librte_cmdline.
> >
> > The amount of work necessary to add support for edition on multiple lines
> > was deemed significant and the result would still have lacked in some
> > areas, such as working backspace/delete keys in all terminals (i.e. full
> > termcap support).
> >
> > - Making testpmd directly rely on a more capable library.
> >
> > All testpmd commands rely on the cmdline_parse interface provided by
> > librte_cmdline. This approach would have required either a complete
> > rewrite or importing the missing bits from librte_cmdline to wrap them
> > around the new library, which naturally led to...
> >
> > - Converting librte_cmdline as a wrapper to a more capable library.
> >
> > Let's be honest, interactive command line handling isn't what makes DPDK
> > shine. It's also far removed from its core functionality, but is still
> > necessary in order to easily implement test and example programs; the
> > cmdline_parse interface is particularly good at this.
> >
> > DPDK actually only relies on cmdline_parse. By removing all the other
> > unused interfaces, implementing what remains on top of a different
> > terminal-handling library would be quick and easy.
> >
> > This last approach was chosen for the stated reasons. Libedit is
> > well-known, BSD-licensed, widely available [2], used by many projects, does
> > everything needed and more [3].
> >
> > This rework results in the following changes:
> >
> > - Removed circular buffer management interface for command history
> > (cmdline_cirbuf.c), command history being handled by libedit.
> > - Removed raw command-line interpreter (cmdline_rdline.c).
> > - Removed raw terminal handler (cmdline_vt100.c).
> > - Removed all test/example code for the above.
> > - Re-implemented high level interactive and non-interactive command-line
> > handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
> > native interface, not its readline compatibility layer.
> > - Made struct cmdline opaque so that applications relying on librte_cmdline
> > do not need to include any libedit headers.
> > - The only visible change for most applications besides being linked to
> > libedit is they do not have to include cmdline_rdline.h anymore.
> >
> > As an added bonus, terminal resizing is now automatically handled.
> >
> > In the future, cmdline_parse could use libedit's advanced tokenizer as
> > well to interpret quoted strings and escape sequences.
> >
>
> I do agree that cmdline is getting pretty old and using libedit is one solution around the long commands, but it has a lot more problems IMO.
>
> I do not agree it has severed DPDK well, just look at test-pmd and the hoops people have to jump thru to get a new command or variation of an existing command integrated into test-pmd it is very difficult. Also if you look at the command sets in test-pmd they are very odd in that similar commands can some times be set up completely different as cmdline is too rigid and difficult to use.
>
> I had decided to not use the circular buffer code in cmdline as it did have a few problems for what I wanted and decided to write a standard gap buffer scheme used in most editors for lines. I had looked at libedit at one point decided I did not want another dependence for DPDK. I expect even my version does not solve the long line problem, but we can convert to libedit. (and toss my pretty code :-)
>
> Fixing the long line problem is a very minor issue compared to everything else wrong with cmdline. I would suggest we look at CLI and improve it instead. We can add libedit to CLI and then finish testing the CLI with test-pmd. The first time I converted test-pmd I did remove and simplify the commands, but I was afraid that would cause a lot of problems for testing and scripts that people have written, but it is possible to fix these problems too.
>
>
> I do not think fixing cmdline is the best answer and working to convert over to CLI is the better answer here.
On my side, I think this patch goes in the correct direction:
- it solves an issue of the command line library
- it replaces a specific dpdk code by a well-known library which is widely used
Olivier
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
2017-11-09 13:43 1% [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit Adrien Mazarguil
@ 2017-11-15 4:12 0% ` Wiles, Keith
2017-11-15 8:04 0% ` Olivier MATZ
2017-11-16 9:23 0% ` Adrien Mazarguil
2017-11-16 16:53 0% ` Jim Thompson
1 sibling, 2 replies; 200+ results
From: Wiles, Keith @ 2017-11-15 4:12 UTC (permalink / raw)
To: Adrien Mazarguil
Cc: Olivier Matz, Wu, Jingjing, dev, Thomas Monjalon, Yigit, Ferruh
> On Nov 9, 2017, at 5:43 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>
> This patch removes all code associated with symbols not internally relied
> on by other DPDK components, makes struct cmdline opaque and then proceeds
> to re-implement the remaining functionality as a wrapper to the editline
> library (also known as libedit) [1].
>
> Besides adding a new external dependency to its users, its large impact on
> librte_cmdline's API/ABI also warrants a major version number bump.
>
> While librte_cmdline served DPDK well all these years as a small, easy to
> use and self-sufficient interactive command-line handler, it started to
> show its limits with testpmd's flow (rte_flow) command, which required
> support for dynamic tokens and very long commands.
>
> This is the main motivation behind this rework. Long commands often need to
> be displayed on multiple lines, which are not properly supported by
> librte_cmdline's limited terminal handling capabilities, resulting in a
> rather frustrating user experience.
>
> Testpmd being one of the main tools used by PMD developers and given flow
> command lines won't get any shorter, this issue had to be addressed.
>
> Three options were considered:
>
> - Fixing and enhancing librte_cmdline.
>
> The amount of work necessary to add support for edition on multiple lines
> was deemed significant and the result would still have lacked in some
> areas, such as working backspace/delete keys in all terminals (i.e. full
> termcap support).
>
> - Making testpmd directly rely on a more capable library.
>
> All testpmd commands rely on the cmdline_parse interface provided by
> librte_cmdline. This approach would have required either a complete
> rewrite or importing the missing bits from librte_cmdline to wrap them
> around the new library, which naturally led to...
>
> - Converting librte_cmdline as a wrapper to a more capable library.
>
> Let's be honest, interactive command line handling isn't what makes DPDK
> shine. It's also far removed from its core functionality, but is still
> necessary in order to easily implement test and example programs; the
> cmdline_parse interface is particularly good at this.
>
> DPDK actually only relies on cmdline_parse. By removing all the other
> unused interfaces, implementing what remains on top of a different
> terminal-handling library would be quick and easy.
>
> This last approach was chosen for the stated reasons. Libedit is
> well-known, BSD-licensed, widely available [2], used by many projects, does
> everything needed and more [3].
>
> This rework results in the following changes:
>
> - Removed circular buffer management interface for command history
> (cmdline_cirbuf.c), command history being handled by libedit.
> - Removed raw command-line interpreter (cmdline_rdline.c).
> - Removed raw terminal handler (cmdline_vt100.c).
> - Removed all test/example code for the above.
> - Re-implemented high level interactive and non-interactive command-line
> handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
> native interface, not its readline compatibility layer.
> - Made struct cmdline opaque so that applications relying on librte_cmdline
> do not need to include any libedit headers.
> - The only visible change for most applications besides being linked to
> libedit is they do not have to include cmdline_rdline.h anymore.
>
> As an added bonus, terminal resizing is now automatically handled.
>
> In the future, cmdline_parse could use libedit's advanced tokenizer as
> well to interpret quoted strings and escape sequences.
>
I do agree that cmdline is getting pretty old and using libedit is one solution around the long commands, but it has a lot more problems IMO.
I do not agree it has severed DPDK well, just look at test-pmd and the hoops people have to jump thru to get a new command or variation of an existing command integrated into test-pmd it is very difficult. Also if you look at the command sets in test-pmd they are very odd in that similar commands can some times be set up completely different as cmdline is too rigid and difficult to use.
I had decided to not use the circular buffer code in cmdline as it did have a few problems for what I wanted and decided to write a standard gap buffer scheme used in most editors for lines. I had looked at libedit at one point decided I did not want another dependence for DPDK. I expect even my version does not solve the long line problem, but we can convert to libedit. (and toss my pretty code :-)
Fixing the long line problem is a very minor issue compared to everything else wrong with cmdline. I would suggest we look at CLI and improve it instead. We can add libedit to CLI and then finish testing the CLI with test-pmd. The first time I converted test-pmd I did remove and simplify the commands, but I was afraid that would cause a lot of problems for testing and scripts that people have written, but it is possible to fix these problems too.
I do not think fixing cmdline is the best answer and working to convert over to CLI is the better answer here.
Regards,
Keith
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] doc: update ABI/API policy
2017-11-06 14:48 4% ` Mcnamara, John
@ 2017-11-11 11:37 4% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-11 11:37 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev, Mcnamara, John
06/11/2017 15:48, Mcnamara, John:
> From: Richardson, Bruce
> >
> > Following agreement at the DPDK Technical Board meeting of 2017-10-13 [1],
> > update the documentation with the ABI/API policy changes.
> >
> > [1] http://dpdk.org/ml/archives/dev/2017-October/079961.html
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > doc/guides/contributing/versioning.rst | 19 ++++++++++++++++++-
> > 1 file changed, 18 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/guides/contributing/versioning.rst
> > b/doc/guides/contributing/versioning.rst
> > index 8d0fdb777..a1d8492a1 100644
> > --- a/doc/guides/contributing/versioning.rst
> > +++ b/doc/guides/contributing/versioning.rst
> > @@ -13,7 +13,9 @@ General Guidelines
> > ------------------
> >
> > #. Whenever possible, ABI should be preserved -#. The libraries marked in
> > experimental state may change without constraint.
> > +#. Libraries or APIs marked in ``experimental`` state may change without
> > constraint.
> > +#. New API will be marked as ``experimental`` for at least one release to
>
> s/API/APIs/
>
>
> > +APIs marked as ``experimental`` are not considered part of the ABI and
> > +may change without warning at any time. Since changes to APIs are most
> > +likely immediately after their introduction, as users begin to take
> > +advantage of those new API and start finding issues with them, new DPDK
>
> s/API/APIs/
>
>
> > + - The acknowledgment of the maintainer of the component is mandatory, or if
> > + no maintainer is available for the component, the tree/sub-tree maintainer
> > + for that component must be acknowledge the ABI change instead.
>
> s/must be/must/
>
> Apart from that:
>
> Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Applied with suggested changes, thanks
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v1] doc: update release notes for 17.11
@ 2017-11-10 12:27 4% John McNamara
0 siblings, 0 replies; 200+ results
From: John McNamara @ 2017-11-10 12:27 UTC (permalink / raw)
To: dev; +Cc: John McNamara
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 24297 bytes --]
Fix grammar, spelling and formatting of DPDK 17.11 release notes.
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 327 +++++++++++++++------------------
1 file changed, 152 insertions(+), 175 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index e6e4407..b31b6bc 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -43,40 +43,39 @@ New Features
* **Extended port_id range from uint8_t to uint16_t.**
- Increased port_id range from 8 bits to 16 bits in order to support more than
- 256 ports in dpdk. All ethdev APIs which have port_id as parameter are changed
- in the meantime.
+ Increased the ``port_id`` range from 8 bits to 16 bits in order to support
+ more than 256 ports in DPDK. All ethdev APIs which have ``port_id`` as
+ parameter have been changed.
* **Modified the return type of rte_eth_stats_reset.**
- Changed return type of ``rte_eth_stats_reset`` from ``void`` to ``int``
- so the caller may know whether a device supports the operation or not
+ Changed return type of ``rte_eth_stats_reset`` from ``void`` to ``int`` so
+ that the caller can determine whether a device supports the operation or not
and if the operation was carried out.
* **Added a new driver for Marvell Armada 7k/8k devices.**
- Added the new mrvl net driver for Marvell Armada 7k/8k devices. See the
- "Network Interface Controller Drivers" document for more details on this new
- driver.
+ Added the new ``mrvl`` net driver for Marvell Armada 7k/8k devices. See the
+ :doc:`../nics/mrvl` NIC guide for more details on this new driver.
* **Updated mlx5 driver.**
Updated the mlx5 driver including the following changes:
- * Enabled PMD to run on top of upstream linux kernel and rdma-core libs.
- By that removed the dependency on specific Mellanox OFED libraries.
+ * Enabled the PMD to run on top of upstream Linux kernel and rdma-core
+ libs, removing the dependency on specific Mellanox OFED libraries.
* Improved PMD latency performance.
* Improved PMD memory footprint.
- * Supported vectorized Rx/Tx burst for ARMv8.
- * Supported secondary process.
- * Supported flow counters.
- * Supported Rx hardware timestamp offload.
- * Supported device removal event.
+ * Added support for vectorized Rx/Tx burst for ARMv8.
+ * Added support for secondary process.
+ * Added support for flow counters.
+ * Added support for Rx hardware timestamp offload.
+ * Added support for device removal event.
* **Added SoftNIC PMD.**
- Added new SoftNIC PMD. This virtual device offers applications a software
- fallback support for traffic management.
+ Added a new SoftNIC PMD. This virtual device provides applications with
+ software fallback support for traffic management.
* **Added support for NXP DPAA Devices.**
@@ -86,24 +85,23 @@ New Features
* DPAA Mempool driver for supporting offloaded packet memory pool
* DPAA PMD for DPAA devices
- See the "Network Interface Controller Drivers" document for more details of
- this new driver.
+ See the :doc:`../nics/dpaa` document for more details of this new driver.
* **Updated support for Cavium OCTEONTX Device.**
- Updated support for Cavium's OCTEONTX device(CN83xx). This includes:
+ Updated support for Cavium's OCTEONTX device (CN83xx). This includes:
* OCTEONTX Mempool driver for supporting offloaded packet memory pool
* OCTEONTX Ethdev PMD
* OCTEONTX Eventdev-Ethdev Rx adapter
- See the "Network Interface Controller Drivers" document for more details of
- this new driver.
+ See the :doc:`../nics/octeontx` document for more details of this new driver.
-* **nfp: Added PF support.**
+* **Added PF support to the Netronome NFP PMD.**
- Previously Netronome's NFP PMD had just support for VFs. PF support is
- just as a basic DPDK port and has no VF management yet.
+ Added PF support to the Netronome NFP PMD. Previously the NFP PMD only
+ supported VFs. PF support is just as a basic DPDK port and has no VF
+ management yet.
PF support comes with firmware upload support which allows the PMD to
independently work from kernel netdev NFP drivers.
@@ -117,113 +115,115 @@ New Features
* Support for Flow API
* Support for Tx and Rx descriptor status functions
-* **Add bus agnostic functions to cryptodev for PMD initialisation**
+* **Added bus agnostic functions to cryptodev for PMD initialization**
- Adds new PMD assist functions ``rte_cryptodev_pmd_parse_input_args()``,
- ``rte_cryptodev_pmd_create()`` and ``rte_cryptodev_pmd_destroy()`` which
- are bus independent for driver to manage creation and destruction of new
- device instances.
+ Added new PMD assist, bus independent, functions
+ ``rte_cryptodev_pmd_parse_input_args()``, ``rte_cryptodev_pmd_create()`` and
+ ``rte_cryptodev_pmd_destroy()`` for drivers to manage creation and
+ destruction of new device instances.
* **Updated QAT crypto PMD.**
- Performance enhancements:
+ Added several performance enhancements:
* Removed atomics from the internal queue pair structure.
- * Coalesce writes to HEAD CSR on response processing.
- * Coalesce writes to TAIL CSR on request processing.
+ * Added coalesce writes to HEAD CSR on response processing.
+ * Added coalesce writes to TAIL CSR on request processing.
- Additional support for:
-
- * AES CCM algorithm.
+ In addition support was added for the AES CCM algorithm.
* **Updated the AESNI MB PMD.**
The AESNI MB PMD has been updated with additional support for:
- * DES CBC algorithm.
- * DES DOCSIS BPI algorithm.
+ * The DES CBC algorithm.
+ * The DES DOCSIS BPI algorithm.
- This requires the IPSec Multi-buffer library 0.47. For more details,
- check out the AESNI MB PMD documenation.
+ This change requires version 0.47 of the IPSec Multi-buffer library. For
+ more details see the :doc:`../cryptodevs/aesni_mb` documentation.
* **Updated the OpenSSL PMD.**
The OpenSSL PMD has been updated with additional support for:
- * DES CBC algorithm.
- * AES CCM algorithm.
+ * The DES CBC algorithm.
+ * The AES CCM algorithm.
* **Added NXP DPAA SEC crypto PMD.**
- A new "dpaa_sec" hardware based crypto PMD for NXP DPAA devices has been
- added. See the "Crypto Device Drivers" document for more details on this
- driver.
+ A new ``dpaa_sec`` hardware based crypto PMD for NXP DPAA devices has been
+ added. See the :doc:`../cryptodevs/dpaa_sec` document for more details.
* **Added MRVL crypto PMD.**
A new crypto PMD has been added, which provides several ciphering and hashing
algorithms. All cryptography operations use the MUSDK library crypto API.
+ See the :doc:`../cryptodevs/mrvl` document for more details.
* **Add new benchmarking mode to dpdk-test-crypto-perf application.**
- Added new "PMD cyclecount" benchmark mode to dpdk-test-crypto-perf application
- that displays more detailed breakdown of CPU cycles used by hardware
+ Added a new "PMD cyclecount" benchmark mode to the ``dpdk-test-crypto-perf``
+ application to display a detailed breakdown of CPU cycles used by hardware
acceleration.
* **Added the Security Offload Library.**
- Added an experimental library - rte_security. It provide security APIs for
- protocols like IPSec using inline ipsec offload to ethernet device or full
- protocol offload with lookaside crypto device.
+ Added an experimental library - ``rte_security``. This provide security APIs
+ for protocols like IPSec using inline ipsec offload to ethernet devices or
+ full protocol offload with lookaside crypto devices.
- See the "Security_Library" section of the DPDK Programmers Guide document,
- for more information.
+ See the :doc:`../prog_guide/rte_security` section of the DPDK Programmers
+ Guide document for more information.
-* **Updated DPAA2_SEC crypto driver.**
+* **Updated the DPAA2_SEC crypto driver to support rte_security.**
- Updated dpaa2_sec crypto PMD to support rte_security lookaside protocol
- offload for IPSec.
+ Updated the ``dpaa2_sec`` crypto PMD to support ``rte_security`` lookaside
+ protocol offload for IPSec.
-* **Updated IXGBE ethernet driver.**
+* **Updated the IXGBE ethernet driver to support rte_security.**
- Updated ixgbe ethernet PMD to support rte_security inline IPSec offload.
+ Updated ixgbe ethernet PMD to support ``rte_security`` inline IPSec offload.
-* **Updated ipsec-secgw application**
+* **Updated ipsec-secgw application to support rte_security.**
- Updated ipsec-secgw sample application to support rte_security actions for
- ipsec inline and full protocol offload using lookaside crypto offload.
+ Updated the ``ipsec-secgw`` sample application to support ``rte_security``
+ actions for ipsec inline and full protocol offload using lookaside crypto
+ offload.
* **Added IOMMU support to libvhost-user**
- Implemented device IOTLB in Vhost-user backend, and enabled Virtio's IOMMU
- feature. The feature is disabled by default, and can be enabled by setting
- RTE_VHOST_USER_IOMMU_SUPPORT flag at vhost device registration time.
+ Implemented device IOTLB in the Vhost-user backend, and enabled Virtio's
+ IOMMU feature. The feature is disabled by default, and can be enabled by
+ setting ``RTE_VHOST_USER_IOMMU_SUPPORT`` flag at vhost device registration
+ time.
* **Added the Event Ethernet Adapter Library.**
- Added the Event Ethernet Adapter library. It provices APIs for
- eventdev applications to configure the ethdev to eventdev packet flow.
+ Added the Event Ethernet Adapter library. This library provides APIs for
+ eventdev applications to configure the ethdev for eventdev packet flow.
-* **Updated DPAA2 Event PMD.**
+* **Updated DPAA2 Event PMD for the Event Ethernet Adapter.**
- Added support for eventdev ethernet adapter for DPAA2.
+ Added support for the eventdev ethernet adapter for DPAA2.
* **Added Membership library (rte_member).**
- Added membership library. It provides an API for DPDK applications to insert a
- new member, delete an existing member, or query the existence of a member in a
- given set, or a group of sets. For the case of a group of sets the library
- will return not only whether the element has been inserted before in one of
- the sets but also which set it belongs to.
+ Added a new data structure library called the Membership Library.
The Membership Library is an extension and generalization of a traditional
- filter (for example Bloom Filter) structure that has multiple usages in a wide
- variety of workloads and applications. In general, the Membership Library is a
- data structure that provides a “set-summary” and responds to set-membership
- queries whether a certain member belongs to a set(s).
+ filter (for example Bloom Filter) structure that has multiple usages in a
+ wide variety of workloads and applications. In general, the Membership
+ Library is a data structure that provides a "set-summary" and responds to
+ set-membership queries whether a certain member belongs to a set(s).
+
+ The library provides APIs for DPDK applications to insert a new member,
+ delete an existing member, and query the existence of a member in a given
+ set, or a group of sets. For the case of a group of sets the library will
+ return not only whether the element has been inserted in one of the sets but
+ also which set it belongs to.
- See the :ref:`Membership Library <Member_Library>` documentation in
- the Programmers Guide document, for more information.
+ See the :doc:`../prog_guide/member_lib` documentation in the Programmers
+ Guide, for more information.
* **Added the Generic Segmentation Offload Library.**
@@ -243,9 +243,9 @@ New Features
* **Added the Flow Classification Library.**
- Added the Flow Classification library, it provides an API for DPDK
- applications to classify an input packet by matching it against a set of flow
- rules. It uses the librte_table API to manage the flow rules.
+ Added an experimental Flow Classification library to provide APIs for DPDK
+ applications to classify an input packet by matching it against a set of
+ flow rules. It uses the ``librte_table`` API to manage the flow rules.
Resolved Issues
@@ -268,9 +268,6 @@ Resolved Issues
=========================================================
-EAL
-~~~
-
* **Service core fails to call service callback due to atomic lock**
In a specific configuration of multi-thread unsafe services and service
@@ -279,36 +276,6 @@ EAL
looked like another thread was executing the service callback. The logic for
atomic locking of the services has been fixed and refactored for readability.
-Drivers
-~~~~~~~
-
-
-Libraries
-~~~~~~~~~
-
-
-Examples
-~~~~~~~~
-
-
-Other
-~~~~~
-
-
-Known Issues
-------------
-
-.. This section should contain new known issues in this release. Sample format:
-
- * **Add title in present tense with full stop.**
-
- Add a short 1-2 sentence description of the known issue in the present
- tense. Add information on any known workarounds.
-
- This section is a comment. do not overwrite or remove it.
- Also, make sure to start the actual text at the margin.
- =========================================================
-
API Changes
-----------
@@ -323,43 +290,46 @@ API Changes
Also, make sure to start the actual text at the margin.
=========================================================
-* **Ethdev device name length increased**
+* **Ethdev device name length increased.**
- The size of internal device name is increased to 64 characters
- to allow for storing longer bus specific name.
+ The size of internal device name has been increased to 64 characters
+ to allow for storing longer bus specific names.
-* **Ethdev flag RTE_ETH_DEV_DETACHABLE was removed**
+* **Removed the Ethdev RTE_ETH_DEV_DETACHABLE flag.**
- This flag is not necessary anymore, with the new hotplug implementation.
- It is now removed from the ether library. Its semantic is expressed at the bus
- and PMD level.
+ Removed the Ethdev ``RTE_ETH_DEV_DETACHABLE`` flag. This flag is not
+ required anymore, with the new hotplug implementation. It has been removed
+ from the ether library. Its semantics are now expressed at the bus and PMD
+ level.
* **Service cores API updated for usability**
- The service cores API has been changed, removing pointers from the API
- where possible, instead using integer IDs to identify each service. This
- simplifed application code, aids debugging, and provides better
+ The service cores API has been changed, removing pointers from the API where
+ possible, and instead using integer IDs to identify each service. This
+ simplifies application code, aids debugging, and provides better
encapsulation. A summary of the main changes made is as follows:
* Services identified by ID not by ``rte_service_spec`` pointer
* Reduced API surface by using ``set`` functions instead of enable/disable
* Reworked ``rte_service_register`` to provide the service ID to registrar
- * Rework start and stop APIs into ``rte_service_runstate_set``
- * Added API to set runstate of service implementation to indicate readyness
+ * Reworked start and stop APIs into ``rte_service_runstate_set``
+ * Added API to set runstate of service implementation to indicate readiness
-* **The following changes made in mempool library**
+* **The following changes have been made in the mempool library**
- * Moved ``flags`` datatype from int to unsigned int for ``rte_mempool``.
+ * Moved ``flags`` datatype from ``int`` to ``unsigned int`` for
+ ``rte_mempool``.
* Removed ``__rte_unused int flag`` param from ``rte_mempool_generic_put``
and ``rte_mempool_generic_get`` API.
* Added ``flags`` param in ``rte_mempool_xmem_size`` and
``rte_mempool_xmem_usage``.
+ * ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
+ remove this API as Xen dom0 support was removed.
-* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
- remove this API as Xen dom0 support was removed.
+* **Added IOVA aliases related to physical address handling.**
-* **Some data type, structure members and functions related to physical address
- are deprecated and have new alias with IOVA wording.**
+ Some data types, structure members and functions related to physical address
+ handling are deprecated and have new aliases with IOVA wording. For example:
* ``phys_addr_t`` can be often replaced by ``rte_iova_t`` of same size.
* ``RTE_BAD_PHYS_ADDR`` is often replaced by ``RTE_BAD_IOVA`` of same value.
@@ -367,10 +337,13 @@ API Changes
* ``rte_mem_virt2phy()`` can often be replaced by ``rte_mem_virt2iova``.
* ``rte_malloc_virt2phy`` is aliased with ``rte_malloc_virt2iova``.
* ``rte_memzone.phys_addr`` is aliased with ``rte_memzone.iova``.
- * ``rte_mempool_objhdr.physaddr`` is aliased with ``rte_mempool_objhdr.iova``.
- * ``rte_mempool_memhdr.phys_addr`` is aliased with ``rte_mempool_memhdr.iova``.
+ * ``rte_mempool_objhdr.physaddr`` is aliased with
+ ``rte_mempool_objhdr.iova``.
+ * ``rte_mempool_memhdr.phys_addr`` is aliased with
+ ``rte_mempool_memhdr.iova``.
* ``rte_mempool_virt2phy()`` can be replaced by ``rte_mempool_virt2iova()``.
- * ``rte_mempool_populate_phys*()`` are aliased with ``rte_mempool_populate_iova*()``
+ * ``rte_mempool_populate_phys*()`` are aliased with
+ ``rte_mempool_populate_iova*()``
* ``rte_mbuf.buf_physaddr`` is aliased with ``rte_mbuf.buf_iova``.
* ``rte_mbuf_data_dma_addr*()`` are aliased with ``rte_mbuf_data_iova*()``.
* ``rte_pktmbuf_mtophys*`` are aliased with ``rte_pktmbuf_iova*()``.
@@ -380,26 +353,26 @@ API Changes
The PCI bus previously implemented within the EAL has been moved.
A first part has been added as an RTE library providing PCI helpers to
parse device locations or other such utilities.
- A second part consisting in the actual bus driver has been moved to its
+ A second part consisting of the actual bus driver has been moved to its
proper subdirectory, without changing its functionalities.
- As such, several PCI-related functions are not proposed by the EAL anymore:
-
- * rte_pci_detach
- * rte_pci_dump
- * rte_pci_ioport_map
- * rte_pci_ioport_read
- * rte_pci_ioport_unmap
- * rte_pci_ioport_write
- * rte_pci_map_device
- * rte_pci_probe
- * rte_pci_probe_one
- * rte_pci_read_config
- * rte_pci_register
- * rte_pci_scan
- * rte_pci_unmap_device
- * rte_pci_unregister
- * rte_pci_write_config
+ As such, several PCI-related functions are not exposed by the EAL anymore:
+
+ * ``rte_pci_detach``
+ * ``rte_pci_dump``
+ * ``rte_pci_ioport_map``
+ * ``rte_pci_ioport_read``
+ * ``rte_pci_ioport_unmap``
+ * ``rte_pci_ioport_write``
+ * ``rte_pci_map_device``
+ * ``rte_pci_probe``
+ * ``rte_pci_probe_one``
+ * ``rte_pci_read_config``
+ * ``rte_pci_register``
+ * ``rte_pci_scan``
+ * ``rte_pci_unmap_device``
+ * ``rte_pci_unregister``
+ * ``rte_pci_write_config``
These functions are made available either as part of ``librte_pci`` or
``librte_bus_pci``.
@@ -407,6 +380,7 @@ API Changes
* **Moved vdev bus APIs outside of the EAL**
Moved the following APIs from ``librte_eal`` to ``librte_bus_vdev``:
+
* ``rte_vdev_init``
* ``rte_vdev_register``
* ``rte_vdev_uninit``
@@ -415,13 +389,14 @@ API Changes
* **Add return value to stats_get dev op API**
The ``stats_get`` dev op API return value has been changed to be int.
- By this way PMDs can return an error value in case of failure at stats
+ In this way PMDs can return an error value in case of failure at stats
getting process time.
-* **Modified the rte_cryptodev_allocate_driver function in the cryptodev library.**
+* **Modified the rte_cryptodev_allocate_driver function.**
- The function ``rte_cryptodev_allocate_driver()`` has been modified.
- An extra parameter ``struct cryptodev_driver *crypto_drv`` has been added.
+ Modified the ``rte_cryptodev_allocate_driver()`` function in the cryptodev
+ library. An extra parameter ``struct cryptodev_driver *crypto_drv`` has been
+ added.
* **Removed virtual device bus specific functions from librte_cryptodev.**
@@ -430,8 +405,9 @@ API Changes
and have been replaced by non bus specific functions
``rte_cryptodev_pmd_parse_input_args()`` and ``rte_cryptodev_pmd_create()``.
-* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
- in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+ The ``rte_cryptodev_create_vdev()`` function was removed to avoid the
+ dependency on vdev in librte_cryptodev; instead, users can call
+ ``rte_vdev_init()`` directly.
* **Removed PCI device bus specific functions from librte_cryptodev.**
@@ -444,29 +420,30 @@ API Changes
The functions ``rte_set_log_level()``, ``rte_get_log_level()``,
``rte_set_log_type()`` and ``rte_get_log_type()`` have been removed.
+
They are respectively replaced by ``rte_log_set_global_level()``,
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
-* **Removed ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT``.**
+* **Removed mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT.**
The ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT`` have
- been removed since their behavior were not properly described.
+ been removed since their behavior was not properly described.
-* **Added ``mbuf`` flags ``PKT_RX_VLAN`` and ``PKT_RX_QINQ``.**
+* **Added mbuf flags PKT_RX_VLAN and PKT_RX_QINQ.**
Two ``mbuf`` flags have been added to indicate that the VLAN
identifier has been saved in in the ``mbuf`` structure. For instance:
- - if VLAN is not stripped and TCI is saved: ``PKT_RX_VLAN``
- - if VLAN is stripped and TCI is saved: ``PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED``
+ - If VLAN is not stripped and TCI is saved: ``PKT_RX_VLAN``
+ - If VLAN is stripped and TCI is saved: ``PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED``
* **Modified the vlan_offload_set_t function prototype in the ethdev library.**
- Changed the function prototype of ``vlan_offload_set_t``. The return value
- has been changed from ``void`` to ``int`` so the caller to knows whether
- the backing device supports the operation or if the operation was
- successfully performed.
+ Modified the ``vlan_offload_set_t`` function prototype in the ethdev
+ library. The return value has been changed from ``void`` to ``int`` so the
+ caller can determine whether the backing device supports the operation or if
+ the operation was successfully performed.
ABI Changes
@@ -485,17 +462,17 @@ ABI Changes
* **Extended port_id range.**
The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure
- changed, as described in the `New Features` section.
+ has changed, as described in the `New Features` section above.
* **New parameter added to rte_eth_dev.**
- New parameter ``security_ctx`` added to ``rte_eth_dev`` to support security
- operations like IPSec inline.
+ A new parameter ``security_ctx`` has been added to ``rte_eth_dev`` to
+ support security operations like IPSec inline.
* **New parameter added to rte_cryptodev.**
- New parameter ``security_ctx`` added to ``rte_cryptodev`` to support security
- operations like lookaside crypto.
+ A new parameter ``security_ctx`` has been added to ``rte_cryptodev`` to
+ support security operations like lookaside crypto.
Removed Items
@@ -510,10 +487,10 @@ Removed Items
Also, make sure to start the actual text at the margin.
=========================================================
-* Xen dom0 in EAL was removed, as well as xenvirt PMD and vhost_xen.
+* Xen dom0 in EAL has been removed, as well as the xenvirt PMD and vhost_xen.
* The crypto performance unit tests have been removed,
- replaced by the dpdk-test-crypto-perf application.
+ replaced by the ``dpdk-test-crypto-perf`` application.
Shared Library Versions
--
2.7.5
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit
@ 2017-11-09 13:43 1% Adrien Mazarguil
2017-11-15 4:12 0% ` Wiles, Keith
2017-11-16 16:53 0% ` Jim Thompson
0 siblings, 2 replies; 200+ results
From: Adrien Mazarguil @ 2017-11-09 13:43 UTC (permalink / raw)
To: Olivier Matz, Jingjing Wu; +Cc: dev, Thomas Monjalon, Ferruh Yigit
This patch removes all code associated with symbols not internally relied
on by other DPDK components, makes struct cmdline opaque and then proceeds
to re-implement the remaining functionality as a wrapper to the editline
library (also known as libedit) [1].
Besides adding a new external dependency to its users, its large impact on
librte_cmdline's API/ABI also warrants a major version number bump.
While librte_cmdline served DPDK well all these years as a small, easy to
use and self-sufficient interactive command-line handler, it started to
show its limits with testpmd's flow (rte_flow) command, which required
support for dynamic tokens and very long commands.
This is the main motivation behind this rework. Long commands often need to
be displayed on multiple lines, which are not properly supported by
librte_cmdline's limited terminal handling capabilities, resulting in a
rather frustrating user experience.
Testpmd being one of the main tools used by PMD developers and given flow
command lines won't get any shorter, this issue had to be addressed.
Three options were considered:
- Fixing and enhancing librte_cmdline.
The amount of work necessary to add support for edition on multiple lines
was deemed significant and the result would still have lacked in some
areas, such as working backspace/delete keys in all terminals (i.e. full
termcap support).
- Making testpmd directly rely on a more capable library.
All testpmd commands rely on the cmdline_parse interface provided by
librte_cmdline. This approach would have required either a complete
rewrite or importing the missing bits from librte_cmdline to wrap them
around the new library, which naturally led to...
- Converting librte_cmdline as a wrapper to a more capable library.
Let's be honest, interactive command line handling isn't what makes DPDK
shine. It's also far removed from its core functionality, but is still
necessary in order to easily implement test and example programs; the
cmdline_parse interface is particularly good at this.
DPDK actually only relies on cmdline_parse. By removing all the other
unused interfaces, implementing what remains on top of a different
terminal-handling library would be quick and easy.
This last approach was chosen for the stated reasons. Libedit is
well-known, BSD-licensed, widely available [2], used by many projects, does
everything needed and more [3].
This rework results in the following changes:
- Removed circular buffer management interface for command history
(cmdline_cirbuf.c), command history being handled by libedit.
- Removed raw command-line interpreter (cmdline_rdline.c).
- Removed raw terminal handler (cmdline_vt100.c).
- Removed all test/example code for the above.
- Re-implemented high level interactive and non-interactive command-line
handlers (cmdline.c and cmdline_socket.c) on top of libedit using its
native interface, not its readline compatibility layer.
- Made struct cmdline opaque so that applications relying on librte_cmdline
do not need to include any libedit headers.
- The only visible change for most applications besides being linked to
libedit is they do not have to include cmdline_rdline.h anymore.
As an added bonus, terminal resizing is now automatically handled.
In the future, cmdline_parse could use libedit's advanced tokenizer as
well to interpret quoted strings and escape sequences.
[1] http://thrysoee.dk/editline/
[2] It usually goes by the name "libedit" in Linux distributions.
[3] http://netbsd.gw.com/cgi-bin/man-cgi?editline++NetBSD-current
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
app/test-pmd/cmdline.c | 1 -
examples/bond/main.c | 1 -
examples/cmdline/commands.c | 1 -
examples/cmdline/main.c | 1 -
.../ip_pipeline/pipeline/pipeline_common_fe.c | 1 -
.../ip_pipeline/pipeline/pipeline_firewall.c | 1 -
.../pipeline/pipeline_flow_actions.c | 1 -
.../pipeline/pipeline_flow_classification.c | 1 -
examples/ip_pipeline/thread_fe.c | 1 -
examples/multi_process/simple_mp/main.c | 1 -
examples/multi_process/simple_mp/mp_commands.c | 1 -
examples/qos_sched/cmdline.c | 1 -
examples/quota_watermark/qwctl/commands.c | 1 -
examples/quota_watermark/qwctl/qwctl.c | 1 -
.../guest_cli/vm_power_cli_guest.c | 1 -
examples/vm_power_manager/vm_power_cli.c | 1 -
lib/librte_cmdline/Makefile | 10 +-
lib/librte_cmdline/cmdline.c | 385 +++--
lib/librte_cmdline/cmdline.h | 22 +-
lib/librte_cmdline/cmdline_cirbuf.c | 466 ------
lib/librte_cmdline/cmdline_cirbuf.h | 245 ----
lib/librte_cmdline/cmdline_parse.c | 7 +-
lib/librte_cmdline/cmdline_rdline.c | 697 ---------
lib/librte_cmdline/cmdline_rdline.h | 255 ----
lib/librte_cmdline/cmdline_socket.c | 36 +-
lib/librte_cmdline/cmdline_vt100.c | 185 ---
lib/librte_cmdline/cmdline_vt100.h | 153 --
lib/librte_cmdline/rte_cmdline_version.map | 41 +-
mk/rte.app.mk | 2 +
test/cmdline_test/cmdline_test.c | 1 -
test/cmdline_test/commands.c | 69 -
test/test/Makefile | 1 -
test/test/commands.c | 1 -
test/test/test.c | 1 -
test/test/test_cmdline.c | 9 -
test/test/test_cmdline.h | 6 -
test/test/test_cmdline_cirbuf.c | 1330 ------------------
test/test/test_cmdline_lib.c | 117 +-
38 files changed, 293 insertions(+), 3762 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d963..9fe625c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -77,7 +77,6 @@
#include <rte_flow.h>
#include <rte_gro.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 8e3b1f3..d903314 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -71,7 +71,6 @@
#include <rte_arp.h>
#include <rte_spinlock.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index f3ba247..e8fa7f0 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -74,7 +74,6 @@
#endif
#endif
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
#include <cmdline_parse_num.h>
diff --git a/examples/cmdline/main.c b/examples/cmdline/main.c
index c6de944..c229f50 100644
--- a/examples/cmdline/main.c
+++ b/examples/cmdline/main.c
@@ -65,7 +65,6 @@
#include <termios.h>
#include <sys/queue.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_socket.h>
#include <cmdline.h>
diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
index 7521187..f1df197 100644
--- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c
+++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
@@ -37,7 +37,6 @@
#include <rte_common.h>
#include <rte_malloc.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c
index a82e552..e49d9ca 100644
--- a/examples/ip_pipeline/pipeline/pipeline_firewall.c
+++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c
@@ -41,7 +41,6 @@
#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_malloc.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
index 349db6b..0f680db 100644
--- a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
+++ b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
@@ -40,7 +40,6 @@
#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_malloc.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
index 70b1938..b9e4ed5 100644
--- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
+++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
@@ -40,7 +40,6 @@
#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_malloc.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c
index 4590c2b..4f54094 100644
--- a/examples/ip_pipeline/thread_fe.c
+++ b/examples/ip_pipeline/thread_fe.c
@@ -1,7 +1,6 @@
#include <rte_common.h>
#include <rte_ring.h>
#include <rte_malloc.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
index 62537b0..c0fc6ea 100644
--- a/examples/multi_process/simple_mp/main.c
+++ b/examples/multi_process/simple_mp/main.c
@@ -64,7 +64,6 @@
#include <rte_ring.h>
#include <rte_log.h>
#include <rte_mempool.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
#include <cmdline_socket.h>
diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c
index ef6dc58..264dea2 100644
--- a/examples/multi_process/simple_mp/mp_commands.c
+++ b/examples/multi_process/simple_mp/mp_commands.c
@@ -54,7 +54,6 @@
#include <rte_mempool.h>
#include <rte_string_fns.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
#include <cmdline_socket.h>
diff --git a/examples/qos_sched/cmdline.c b/examples/qos_sched/cmdline.c
index b62d165..c2a4f6b 100644
--- a/examples/qos_sched/cmdline.c
+++ b/examples/qos_sched/cmdline.c
@@ -36,7 +36,6 @@
#include <inttypes.h>
#include <string.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/quota_watermark/qwctl/commands.c b/examples/quota_watermark/qwctl/commands.c
index 5cac0e1..a30a35c 100644
--- a/examples/quota_watermark/qwctl/commands.c
+++ b/examples/quota_watermark/qwctl/commands.c
@@ -36,7 +36,6 @@
#include <string.h>
#include <termios.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
diff --git a/examples/quota_watermark/qwctl/qwctl.c b/examples/quota_watermark/qwctl/qwctl.c
index 18ec17a..2831667 100644
--- a/examples/quota_watermark/qwctl/qwctl.c
+++ b/examples/quota_watermark/qwctl/qwctl.c
@@ -42,7 +42,6 @@
#include <rte_log.h>
#include <rte_memzone.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_socket.h>
#include <cmdline.h>
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 63f711e..83cd215 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -37,7 +37,6 @@
#include <stdio.h>
#include <termios.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
#include <cmdline_parse_num.h>
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index 6f234fb..d013715 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -39,7 +39,6 @@
#include <termios.h>
#include <errno.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
#include <cmdline_parse_num.h>
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 2c48e62..35c8972 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -38,28 +38,24 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_cmdline_version.map
-LIBABIVER := 2
+LIBABIVER := 3
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_etheraddr.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_ipaddr.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_num.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_string.c
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_rdline.c
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_vt100.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_socket.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_portlist.c
-CFLAGS += -D_GNU_SOURCE
LDLIBS += -lrte_eal
# install includes
INCS := cmdline.h cmdline_parse.h cmdline_parse_num.h cmdline_parse_ipaddr.h
-INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h cmdline_rdline.h
-INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist.h
+INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h
+INCS += cmdline_socket.h cmdline_parse_portlist.h
SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index d749165..1c19546 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -58,79 +58,181 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <ctype.h>
+#include <histedit.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <inttypes.h>
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
-#include <termios.h>
-#include <netinet/in.h>
-
-#include <rte_string_fns.h>
#include "cmdline_parse.h"
-#include "cmdline_rdline.h"
#include "cmdline.h"
-static void
-cmdline_valid_buffer(struct rdline *rdl, const char *buf,
- __attribute__((unused)) unsigned int size)
+struct cmdline {
+ char *line;
+ FILE *f_in;
+ FILE *f_out;
+ cmdline_parse_ctx_t *ctx;
+ EditLine *el;
+ History *hist;
+ HistEvent histev;
+ uint32_t eof:1;
+ uint32_t error:1;
+ char prompt[RDLINE_PROMPT_SIZE];
+};
+
+void
+cmdline_set_prompt(struct cmdline *cl, const char *prompt)
{
- struct cmdline *cl = rdl->opaque;
- int ret;
- ret = cmdline_parse(cl, buf);
- if (ret == CMDLINE_PARSE_AMBIGUOUS)
- cmdline_printf(cl, "Ambiguous command\n");
- else if (ret == CMDLINE_PARSE_NOMATCH)
- cmdline_printf(cl, "Command not found\n");
- else if (ret == CMDLINE_PARSE_BAD_ARGS)
- cmdline_printf(cl, "Bad arguments\n");
+ if (!cl || !prompt)
+ return;
+ snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
}
-static int
-cmdline_complete_buffer(struct rdline *rdl, const char *buf,
- char *dstbuf, unsigned int dstsize,
- int *state)
+void *
+cmdline_ctx_get(struct cmdline *cl)
{
- struct cmdline *cl = rdl->opaque;
- return cmdline_complete(cl, buf, state, dstbuf, dstsize);
+ if (!cl)
+ return NULL;
+ return cl->ctx;
}
-int
-cmdline_write_char(struct rdline *rdl, char c)
+static char *
+cmdline_el_prompt(EditLine *el)
{
- int ret = -1;
struct cmdline *cl;
- if (!rdl)
- return -1;
-
- cl = rdl->opaque;
+ if (el_get(el, EL_CLIENTDATA, &cl))
+ return NULL;
+ return cl->prompt;
+}
- if (cl->s_out >= 0)
- ret = write(cl->s_out, &c, 1);
+static unsigned char
+cmdline_el_execute(EditLine *el, int c)
+{
+ const LineInfo *li = el_line(el);
+ size_t len = li->lastchar - li->buffer;
+ char *line;
+ struct cmdline *cl;
+ int ret;
- return ret;
+ (void)c;
+ if (el_get(el, EL_CLIENTDATA, &cl))
+ return CC_FATAL;
+ line = realloc(cl->line, len + 2);
+ if (!line) {
+ cl->error = 1;
+ return CC_FATAL;
+ }
+ cl->line = line;
+ memcpy(line, li->buffer, len);
+ line[len] = '\n';
+ line[len + 1] = '\0';
+ fputs("\r\n", cl->f_out);
+ ret = cmdline_parse(cl, line);
+ if (ret == CMDLINE_PARSE_AMBIGUOUS)
+ fprintf(cl->f_out, "Ambiguous command\r\n");
+ else if (ret == CMDLINE_PARSE_NOMATCH)
+ fprintf(cl->f_out, "Command not found\r\n");
+ else if (ret == CMDLINE_PARSE_BAD_ARGS)
+ fprintf(cl->f_out, "Bad arguments\r\n");
+ if (cl->error)
+ return CC_FATAL;
+ if (cl->eof)
+ return CC_EOF;
+ if (len) {
+ line[len] = '\0';
+ history(cl->hist, &cl->histev, H_ENTER, line);
+ }
+ return CC_NEWLINE;
}
+static unsigned char
+cmdline_el_complete(EditLine *el, int c)
+{
+ const LineInfo *li = el_line(el);
+ size_t pos = li->cursor - li->buffer;
+ char *line;
+ struct cmdline *cl;
+ char complete_buf[RDLINE_COMPLETE_SIZE];
+ int complete_state;
+ int ret;
-void
-cmdline_set_prompt(struct cmdline *cl, const char *prompt)
+ if (el_get(el, EL_CLIENTDATA, &cl))
+ return CC_FATAL;
+ line = realloc(cl->line, pos + 1);
+ if (!line) {
+ cl->error = 1;
+ return CC_FATAL;
+ }
+ cl->line = line;
+ memcpy(line, li->buffer, pos);
+ line[pos] = '\0';
+ if (c == '\t')
+ complete_state = 0;
+ else
+ complete_state = -1;
+ /* see in parse.h for help on complete() */
+ ret = cmdline_complete(cl, line, &complete_state,
+ complete_buf, sizeof(complete_buf));
+ /* no completion or error */
+ if (ret <= 0)
+ return CC_ARGHACK;
+ /* string must be NUL-terminated */
+ if (strnlen(complete_buf, sizeof(complete_buf)) == sizeof(complete_buf))
+ return CC_ERROR;
+ /* add chars */
+ if (ret == CMDLINE_PARSE_COMPLETED_BUFFER) {
+ /* if in the middle of a token, remove its suffix first */
+ for (pos = 0; li->cursor + pos != li->lastchar; pos++)
+ if (isblank(li->cursor[pos]))
+ break;
+ el_cursor(el, pos);
+ el_deletestr(el, pos);
+ if (el_insertstr(el, complete_buf))
+ return CC_ERROR;
+ return CC_REFRESH;
+ }
+ /* choice */
+ fputs("\r\n", cl->f_out);
+ while (ret) {
+ fputc(' ', cl->f_out);
+ fputs(complete_buf, cl->f_out);
+ fputs("\r\n", cl->f_out);
+ ret = cmdline_complete(cl, line, &complete_state,
+ complete_buf, sizeof(complete_buf));
+ }
+ el_set(el, EL_REFRESH);
+ return CC_REDISPLAY;
+}
+
+static unsigned char
+cmdline_el_delete_next_char_or_eof(EditLine *el, int c)
{
- if (!cl || !prompt)
- return;
- snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
+ const LineInfo *li = el_line(el);
+ struct cmdline *cl;
+
+ (void)c;
+ if (el_get(el, EL_CLIENTDATA, &cl))
+ return CC_FATAL;
+ if (li->buffer == li->lastchar) {
+ cl->eof = 1;
+ return CC_EOF;
+ }
+ el_cursor(el, 1);
+ el_deletestr(el, 1);
+ return CC_REFRESH;
}
struct cmdline *
cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out)
{
struct cmdline *cl;
- int ret;
if (!ctx || !prompt)
return NULL;
@@ -139,36 +241,89 @@ cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out)
if (cl == NULL)
return NULL;
memset(cl, 0, sizeof(struct cmdline));
- cl->s_in = s_in;
- cl->s_out = s_out;
+ cl->line = NULL;
+ s_in = dup(s_in);
+ s_out = s_out != -1 ? dup(s_out) : open("/dev/null", O_WRONLY);
+ if (s_in == -1 || s_out == -1)
+ goto error;
+ cl->f_in = fdopen(s_in, "rb");
+ cl->f_out = fdopen(s_out, "wb");
+ if (!cl->f_in || !cl->f_out)
+ goto error;
cl->ctx = ctx;
-
- ret = rdline_init(&cl->rdl, cmdline_write_char, cmdline_valid_buffer,
- cmdline_complete_buffer);
- if (ret != 0) {
- free(cl);
- return NULL;
- }
-
- cl->rdl.opaque = cl;
+ cl->el = el_init("dpdk", cl->f_in, cl->f_out, stderr);
+ if (!cl->el)
+ goto error;
+ if (el_set(cl->el, EL_CLIENTDATA, cl))
+ goto error;
cmdline_set_prompt(cl, prompt);
- rdline_newline(&cl->rdl, cl->prompt);
-
+ if (el_set(cl->el, EL_PROMPT, cmdline_el_prompt))
+ goto error;
+ if (el_set(cl->el, EL_EDITOR, "emacs"))
+ goto error;
+ if (el_set(cl->el, EL_SIGNAL, 1))
+ goto error;
+ cl->hist = history_init();
+ if (!cl->hist)
+ goto error;
+ if (history(cl->hist, &cl->histev, H_SETSIZE,
+ RDLINE_HISTORY_MAX_LINE) < 0)
+ goto error;
+ if (history(cl->hist, &cl->histev, H_SETUNIQUE, 1))
+ goto error;
+ if (el_set(cl->el, EL_HIST, history, cl->hist))
+ goto error;
+ if (el_set(cl->el, EL_ADDFN, "ed-execute", "Execute command",
+ cmdline_el_execute))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "^J", "ed-execute", NULL))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "^M", "ed-execute", NULL))
+ goto error;
+ if (el_set(cl->el, EL_ADDFN, "ed-complete", "Complete argument",
+ cmdline_el_complete))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "^I", "ed-complete", NULL))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "?", "ed-complete", NULL))
+ goto error;
+ if (el_set(cl->el, EL_ADDFN, "ed-delete-next-char-or-eof",
+ "Delete next character or assume EOF",
+ cmdline_el_delete_next_char_or_eof))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "^D",
+ "ed-delete-next-char-or-eof", NULL))
+ goto error;
+ if (el_set(cl->el, EL_BIND, "^W", "ed-delete-prev-word", NULL))
+ goto error;
return cl;
+error:
+ if (cl->hist)
+ history_end(cl->hist);
+ if (cl->el)
+ el_end(cl->el);
+ if (cl->f_out)
+ fclose(cl->f_out);
+ else if (s_out != -1)
+ close(s_out);
+ if (cl->f_in)
+ fclose(cl->f_in);
+ else if (s_in != -1)
+ close(s_in);
+ free(cl);
+ return NULL;
}
void
cmdline_free(struct cmdline *cl)
{
- dprintf("called\n");
-
if (!cl)
return;
-
- if (cl->s_in > 2)
- close(cl->s_in);
- if (cl->s_out != cl->s_in && cl->s_out > 2)
- close(cl->s_out);
+ history_end(cl->hist);
+ el_end(cl->el);
+ fclose(cl->f_out);
+ fclose(cl->f_in);
+ free(cl->line);
free(cl);
}
@@ -180,70 +335,23 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
if (!cl || !fmt)
return;
-#ifdef _GNU_SOURCE
- if (cl->s_out < 0)
- return;
- va_start(ap, fmt);
- vdprintf(cl->s_out, fmt, ap);
- va_end(ap);
-#else
- int ret;
- char *buf;
-
- if (cl->s_out < 0)
- return;
-
- buf = malloc(BUFSIZ);
- if (buf == NULL)
- return;
va_start(ap, fmt);
- ret = vsnprintf(buf, BUFSIZ, fmt, ap);
+ vfprintf(cl->f_out, fmt, ap);
va_end(ap);
- if (ret < 0) {
- free(buf);
- return;
- }
- if (ret >= BUFSIZ)
- ret = BUFSIZ - 1;
- ret = write(cl->s_out, buf, ret);
- (void)ret;
- free(buf);
-#endif
}
int
cmdline_in(struct cmdline *cl, const char *buf, int size)
{
- const char *history, *buffer;
- size_t histlen, buflen;
- int ret = 0;
- int i, same;
+ int i;
if (!cl || !buf)
return -1;
for (i=0; i<size; i++) {
- ret = rdline_char_in(&cl->rdl, buf[i]);
-
- if (ret == RDLINE_RES_VALIDATED) {
- buffer = rdline_get_buffer(&cl->rdl);
- history = rdline_get_history_item(&cl->rdl, 0);
- if (history) {
- histlen = strnlen(history, RDLINE_BUF_SIZE);
- same = !memcmp(buffer, history, histlen) &&
- buffer[histlen] == '\n';
- }
- else
- same = 0;
- buflen = strnlen(buffer, RDLINE_BUF_SIZE);
- if (buflen > 1 && !same)
- rdline_add_history(&cl->rdl, buffer);
- rdline_newline(&cl->rdl, cl->prompt);
- }
- else if (ret == RDLINE_RES_EOF)
- return -1;
- else if (ret == RDLINE_RES_EXITED)
- return -1;
+ char tmp[2] = { buf[i], '\0' };
+
+ el_push(cl->el, tmp);
}
return i;
}
@@ -253,7 +361,7 @@ cmdline_quit(struct cmdline *cl)
{
if (!cl)
return;
- rdline_quit(&cl->rdl);
+ cl->eof = 1;
}
int
@@ -261,48 +369,49 @@ cmdline_poll(struct cmdline *cl)
{
struct pollfd pfd;
int status;
- ssize_t read_status;
- char c;
+ int read_status;
+ int flags;
if (!cl)
return -EINVAL;
- else if (cl->rdl.status == RDLINE_EXITED)
+ else if (cl->error)
+ return RDLINE_ERROR;
+ else if (cl->eof)
return RDLINE_EXITED;
- pfd.fd = cl->s_in;
+ pfd.fd = fileno(cl->f_in);
pfd.events = POLLIN;
pfd.revents = 0;
status = poll(&pfd, 1, 0);
if (status < 0)
- return status;
- else if (status > 0) {
- c = -1;
- read_status = read(cl->s_in, &c, 1);
- if (read_status < 0)
- return read_status;
-
- status = cmdline_in(cl, &c, 1);
- if (status < 0 && cl->rdl.status != RDLINE_EXITED)
- return status;
- }
-
- return cl->rdl.status;
+ return RDLINE_ERROR;
+ if (!status)
+ return RDLINE_RUNNING;
+ flags = fcntl(pfd.fd, F_GETFL);
+ if (!(flags & O_NONBLOCK))
+ fcntl(pfd.fd, F_SETFL, flags | O_NONBLOCK);
+ if (!el_gets(cl->el, &read_status) && read_status == -1)
+ cl->error = 1;
+ if (!(flags & O_NONBLOCK))
+ fcntl(pfd.fd, F_SETFL, flags);
+ return cl->error ? RDLINE_ERROR :
+ cl->eof ? RDLINE_EXITED :
+ RDLINE_RUNNING;
}
void
cmdline_interact(struct cmdline *cl)
{
- char c;
-
if (!cl)
return;
- c = -1;
- while (1) {
- if (read(cl->s_in, &c, 1) <= 0)
- break;
- if (cmdline_in(cl, &c, 1) < 0)
- break;
+ while (!cl->error && !cl->eof) {
+ int read_status;
+
+ if (el_gets(cl->el, &read_status))
+ continue;
+ if (read_status == -1)
+ cl->error = 1;
}
}
diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h
index 65d73b0..4507268 100644
--- a/lib/librte_cmdline/cmdline.h
+++ b/lib/librte_cmdline/cmdline.h
@@ -61,8 +61,6 @@
#ifndef _CMDLINE_H_
#define _CMDLINE_H_
-#include <termios.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
/**
@@ -75,22 +73,26 @@
extern "C" {
#endif
-struct cmdline {
- int s_in;
- int s_out;
- cmdline_parse_ctx_t *ctx;
- struct rdline rdl;
- char prompt[RDLINE_PROMPT_SIZE];
- struct termios oldterm;
+#define RDLINE_PROMPT_SIZE 32
+#define RDLINE_HISTORY_MAX_LINE 64
+#define RDLINE_COMPLETE_SIZE 128
+
+enum rdline_status {
+ RDLINE_ERROR = -1,
+ RDLINE_INIT,
+ RDLINE_RUNNING,
+ RDLINE_EXITED,
};
+struct cmdline;
+
+void *cmdline_ctx_get(struct cmdline *cl);
struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
void cmdline_free(struct cmdline *cl);
void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
__attribute__((format(printf,2,3)));
int cmdline_in(struct cmdline *cl, const char *buf, int size);
-int cmdline_write_char(struct rdline *rdl, char c);
/**
* This function is nonblocking equivalent of ``cmdline_interact()``. It polls
diff --git a/lib/librte_cmdline/cmdline_cirbuf.c b/lib/librte_cmdline/cmdline_cirbuf.c
deleted file mode 100644
index f506f88..0000000
--- a/lib/librte_cmdline/cmdline_cirbuf.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "cmdline_cirbuf.h"
-
-
-int
-cirbuf_init(struct cirbuf *cbuf, char *buf, unsigned int start, unsigned int maxlen)
-{
- if (!cbuf || !buf)
- return -EINVAL;
- cbuf->maxlen = maxlen;
- cbuf->len = 0;
- cbuf->start = start;
- cbuf->end = start;
- cbuf->buf = buf;
- return 0;
-}
-
-/* multiple add */
-
-int
-cirbuf_add_buf_head(struct cirbuf *cbuf, const char *c, unsigned int n)
-{
- unsigned int e;
-
- if (!cbuf || !c || !n || n > CIRBUF_GET_FREELEN(cbuf))
- return -EINVAL;
-
- e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0;
-
- if (n < cbuf->start + e) {
- dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->start - n + e, n);
- memcpy(cbuf->buf + cbuf->start - n + e, c, n);
- }
- else {
- dprintf("s[%d] -> d[%d] (%d)\n", + n - (cbuf->start + e), 0,
- cbuf->start + e);
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - n +
- (cbuf->start + e), 0, n - (cbuf->start + e));
- memcpy(cbuf->buf, c + n - (cbuf->start + e) , cbuf->start + e);
- memcpy(cbuf->buf + cbuf->maxlen - n + (cbuf->start + e), c,
- n - (cbuf->start + e));
- }
- cbuf->len += n;
- cbuf->start += (cbuf->maxlen - n + e);
- cbuf->start %= cbuf->maxlen;
- return n;
-}
-
-/* multiple add */
-
-int
-cirbuf_add_buf_tail(struct cirbuf *cbuf, const char *c, unsigned int n)
-{
- unsigned int e;
-
- if (!cbuf || !c || !n || n > CIRBUF_GET_FREELEN(cbuf))
- return -EINVAL;
-
- e = CIRBUF_IS_EMPTY(cbuf) ? 1 : 0;
-
- if (n < cbuf->maxlen - cbuf->end - 1 + e) {
- dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->end + !e, n);
- memcpy(cbuf->buf + cbuf->end + !e, c, n);
- }
- else {
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end + !e, 0,
- cbuf->maxlen - cbuf->end - 1 + e);
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - cbuf->end - 1 +
- e, 0, n - cbuf->maxlen + cbuf->end + 1 - e);
- memcpy(cbuf->buf + cbuf->end + !e, c, cbuf->maxlen -
- cbuf->end - 1 + e);
- memcpy(cbuf->buf, c + cbuf->maxlen - cbuf->end - 1 + e,
- n - cbuf->maxlen + cbuf->end + 1 - e);
- }
- cbuf->len += n;
- cbuf->end += n - e;
- cbuf->end %= cbuf->maxlen;
- return n;
-}
-
-/* add at head */
-
-static inline void
-__cirbuf_add_head(struct cirbuf * cbuf, char c)
-{
- if (!CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->start += (cbuf->maxlen - 1);
- cbuf->start %= cbuf->maxlen;
- }
- cbuf->buf[cbuf->start] = c;
- cbuf->len ++;
-}
-
-int
-cirbuf_add_head_safe(struct cirbuf * cbuf, char c)
-{
- if (cbuf && !CIRBUF_IS_FULL(cbuf)) {
- __cirbuf_add_head(cbuf, c);
- return 0;
- }
- return -EINVAL;
-}
-
-void
-cirbuf_add_head(struct cirbuf * cbuf, char c)
-{
- __cirbuf_add_head(cbuf, c);
-}
-
-/* add at tail */
-
-static inline void
-__cirbuf_add_tail(struct cirbuf * cbuf, char c)
-{
- if (!CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->end ++;
- cbuf->end %= cbuf->maxlen;
- }
- cbuf->buf[cbuf->end] = c;
- cbuf->len ++;
-}
-
-int
-cirbuf_add_tail_safe(struct cirbuf * cbuf, char c)
-{
- if (cbuf && !CIRBUF_IS_FULL(cbuf)) {
- __cirbuf_add_tail(cbuf, c);
- return 0;
- }
- return -EINVAL;
-}
-
-void
-cirbuf_add_tail(struct cirbuf * cbuf, char c)
-{
- __cirbuf_add_tail(cbuf, c);
-}
-
-
-static inline void
-__cirbuf_shift_left(struct cirbuf *cbuf)
-{
- unsigned int i;
- char tmp = cbuf->buf[cbuf->start];
-
- for (i=0 ; i<cbuf->len ; i++) {
- cbuf->buf[(cbuf->start+i)%cbuf->maxlen] =
- cbuf->buf[(cbuf->start+i+1)%cbuf->maxlen];
- }
- cbuf->buf[(cbuf->start-1+cbuf->maxlen)%cbuf->maxlen] = tmp;
- cbuf->start += (cbuf->maxlen - 1);
- cbuf->start %= cbuf->maxlen;
- cbuf->end += (cbuf->maxlen - 1);
- cbuf->end %= cbuf->maxlen;
-}
-
-static inline void
-__cirbuf_shift_right(struct cirbuf *cbuf)
-{
- unsigned int i;
- char tmp = cbuf->buf[cbuf->end];
-
- for (i=0 ; i<cbuf->len ; i++) {
- cbuf->buf[(cbuf->end+cbuf->maxlen-i)%cbuf->maxlen] =
- cbuf->buf[(cbuf->end+cbuf->maxlen-i-1)%cbuf->maxlen];
- }
- cbuf->buf[(cbuf->end+1)%cbuf->maxlen] = tmp;
- cbuf->start += 1;
- cbuf->start %= cbuf->maxlen;
- cbuf->end += 1;
- cbuf->end %= cbuf->maxlen;
-}
-
-/* XXX we could do a better algorithm here... */
-int
-cirbuf_align_left(struct cirbuf * cbuf)
-{
- if (!cbuf)
- return -EINVAL;
-
- if (cbuf->start < cbuf->maxlen/2) {
- while (cbuf->start != 0) {
- __cirbuf_shift_left(cbuf);
- }
- }
- else {
- while (cbuf->start != 0) {
- __cirbuf_shift_right(cbuf);
- }
- }
-
- return 0;
-}
-
-/* XXX we could do a better algorithm here... */
-int
-cirbuf_align_right(struct cirbuf * cbuf)
-{
- if (!cbuf)
- return -EINVAL;
-
- if (cbuf->start >= cbuf->maxlen/2) {
- while (cbuf->end != cbuf->maxlen-1) {
- __cirbuf_shift_left(cbuf);
- }
- }
- else {
- while (cbuf->start != cbuf->maxlen-1) {
- __cirbuf_shift_right(cbuf);
- }
- }
-
- return 0;
-}
-
-/* buffer del */
-
-int
-cirbuf_del_buf_head(struct cirbuf *cbuf, unsigned int size)
-{
- if (!cbuf || !size || size > CIRBUF_GET_LEN(cbuf))
- return -EINVAL;
-
- cbuf->len -= size;
- if (CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->start += size - 1;
- cbuf->start %= cbuf->maxlen;
- }
- else {
- cbuf->start += size;
- cbuf->start %= cbuf->maxlen;
- }
- return 0;
-}
-
-/* buffer del */
-
-int
-cirbuf_del_buf_tail(struct cirbuf *cbuf, unsigned int size)
-{
- if (!cbuf || !size || size > CIRBUF_GET_LEN(cbuf))
- return -EINVAL;
-
- cbuf->len -= size;
- if (CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->end += (cbuf->maxlen - size + 1);
- cbuf->end %= cbuf->maxlen;
- }
- else {
- cbuf->end += (cbuf->maxlen - size);
- cbuf->end %= cbuf->maxlen;
- }
- return 0;
-}
-
-/* del at head */
-
-static inline void
-__cirbuf_del_head(struct cirbuf * cbuf)
-{
- cbuf->len --;
- if (!CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->start ++;
- cbuf->start %= cbuf->maxlen;
- }
-}
-
-int
-cirbuf_del_head_safe(struct cirbuf * cbuf)
-{
- if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) {
- __cirbuf_del_head(cbuf);
- return 0;
- }
- return -EINVAL;
-}
-
-void
-cirbuf_del_head(struct cirbuf * cbuf)
-{
- __cirbuf_del_head(cbuf);
-}
-
-/* del at tail */
-
-static inline void
-__cirbuf_del_tail(struct cirbuf * cbuf)
-{
- cbuf->len --;
- if (!CIRBUF_IS_EMPTY(cbuf)) {
- cbuf->end += (cbuf->maxlen - 1);
- cbuf->end %= cbuf->maxlen;
- }
-}
-
-int
-cirbuf_del_tail_safe(struct cirbuf * cbuf)
-{
- if (cbuf && !CIRBUF_IS_EMPTY(cbuf)) {
- __cirbuf_del_tail(cbuf);
- return 0;
- }
- return -EINVAL;
-}
-
-void
-cirbuf_del_tail(struct cirbuf * cbuf)
-{
- __cirbuf_del_tail(cbuf);
-}
-
-/* convert to buffer */
-
-int
-cirbuf_get_buf_head(struct cirbuf *cbuf, char *c, unsigned int size)
-{
- unsigned int n;
-
- if (!cbuf || !c)
- return -EINVAL;
-
- n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf);
-
- if (!n)
- return 0;
-
- if (cbuf->start <= cbuf->end) {
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0, n);
- memcpy(c, cbuf->buf + cbuf->start , n);
- }
- else {
- /* check if we need to go from end to the beginning */
- if (n <= cbuf->maxlen - cbuf->start) {
- dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->start, n);
- memcpy(c, cbuf->buf + cbuf->start , n);
- }
- else {
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->start, 0,
- cbuf->maxlen - cbuf->start);
- dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->maxlen - cbuf->start,
- n - cbuf->maxlen + cbuf->start);
- memcpy(c, cbuf->buf + cbuf->start , cbuf->maxlen - cbuf->start);
- memcpy(c + cbuf->maxlen - cbuf->start, cbuf->buf,
- n - cbuf->maxlen + cbuf->start);
- }
- }
- return n;
-}
-
-/* convert to buffer */
-
-int
-cirbuf_get_buf_tail(struct cirbuf *cbuf, char *c, unsigned int size)
-{
- unsigned int n;
-
- if (!cbuf || !c)
- return -EINVAL;
-
- n = (size < CIRBUF_GET_LEN(cbuf)) ? size : CIRBUF_GET_LEN(cbuf);
-
- if (!n)
- return 0;
-
- if (cbuf->start <= cbuf->end) {
- dprintf("s[%d] -> d[%d] (%d)\n", cbuf->end - n + 1, 0, n);
- memcpy(c, cbuf->buf + cbuf->end - n + 1, n);
- }
- else {
- /* check if we need to go from end to the beginning */
- if (n <= cbuf->end + 1) {
- dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->end - n + 1, n);
- memcpy(c, cbuf->buf + cbuf->end - n + 1, n);
- }
- else {
- dprintf("s[%d] -> d[%d] (%d)\n", 0,
- cbuf->maxlen - cbuf->start, cbuf->end + 1);
- dprintf("s[%d] -> d[%d] (%d)\n",
- cbuf->maxlen - n + cbuf->end + 1, 0, n - cbuf->end - 1);
- memcpy(c + cbuf->maxlen - cbuf->start,
- cbuf->buf, cbuf->end + 1);
- memcpy(c, cbuf->buf + cbuf->maxlen - n + cbuf->end +1,
- n - cbuf->end - 1);
- }
- }
- return n;
-}
-
-/* get head or get tail */
-
-char
-cirbuf_get_head(struct cirbuf * cbuf)
-{
- return cbuf->buf[cbuf->start];
-}
-
-/* get head or get tail */
-
-char
-cirbuf_get_tail(struct cirbuf * cbuf)
-{
- return cbuf->buf[cbuf->end];
-}
diff --git a/lib/librte_cmdline/cmdline_cirbuf.h b/lib/librte_cmdline/cmdline_cirbuf.h
deleted file mode 100644
index 6321dec..0000000
--- a/lib/librte_cmdline/cmdline_cirbuf.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _CIRBUF_H_
-#define _CIRBUF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This structure is the header of a cirbuf type.
- */
-struct cirbuf {
- unsigned int maxlen; /**< total len of the fifo (number of elements) */
- unsigned int start; /**< indice of the first elt */
- unsigned int end; /**< indice of the last elt */
- unsigned int len; /**< current len of fifo */
- char *buf;
-};
-
-#ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define dprintf_(fmt, ...) printf("line %3.3d - " fmt "%.0s", __LINE__, __VA_ARGS__)
-#define dprintf(...) dprintf_(__VA_ARGS__, "dummy")
-#else
-#define dprintf(...) (void)0
-#endif
-
-
-/**
- * Init the circular buffer
- */
-int cirbuf_init(struct cirbuf *cbuf, char *buf, unsigned int start, unsigned int maxlen);
-
-
-/**
- * Return 1 if the circular buffer is full
- */
-#define CIRBUF_IS_FULL(cirbuf) ((cirbuf)->maxlen == (cirbuf)->len)
-
-/**
- * Return 1 if the circular buffer is empty
- */
-#define CIRBUF_IS_EMPTY(cirbuf) ((cirbuf)->len == 0)
-
-/**
- * return current size of the circular buffer (number of used elements)
- */
-#define CIRBUF_GET_LEN(cirbuf) ((cirbuf)->len)
-
-/**
- * return size of the circular buffer (used + free elements)
- */
-#define CIRBUF_GET_MAXLEN(cirbuf) ((cirbuf)->maxlen)
-
-/**
- * return the number of free elts
- */
-#define CIRBUF_GET_FREELEN(cirbuf) ((cirbuf)->maxlen - (cirbuf)->len)
-
-/**
- * Iterator for a circular buffer
- * c: struct cirbuf pointer
- * i: an integer type internally used in the macro
- * e: char that takes the value for each iteration
- */
-#define CIRBUF_FOREACH(c, i, e) \
- for ( i=0, e=(c)->buf[(c)->start] ; \
- i<((c)->len) ; \
- i ++, e=(c)->buf[((c)->start+i)%((c)->maxlen)])
-
-
-/**
- * Add a character at head of the circular buffer. Return 0 on success, or
- * a negative value on error.
- */
-int cirbuf_add_head_safe(struct cirbuf *cbuf, char c);
-
-/**
- * Add a character at head of the circular buffer. You _must_ check that you
- * have enough free space in the buffer before calling this func.
- */
-void cirbuf_add_head(struct cirbuf *cbuf, char c);
-
-/**
- * Add a character at tail of the circular buffer. Return 0 on success, or
- * a negative value on error.
- */
-int cirbuf_add_tail_safe(struct cirbuf *cbuf, char c);
-
-/**
- * Add a character at tail of the circular buffer. You _must_ check that you
- * have enough free space in the buffer before calling this func.
- */
-void cirbuf_add_tail(struct cirbuf *cbuf, char c);
-
-/**
- * Remove a char at the head of the circular buffer. Return 0 on
- * success, or a negative value on error.
- */
-int cirbuf_del_head_safe(struct cirbuf *cbuf);
-
-/**
- * Remove a char at the head of the circular buffer. You _must_ check
- * that buffer is not empty before calling the function.
- */
-void cirbuf_del_head(struct cirbuf *cbuf);
-
-/**
- * Remove a char at the tail of the circular buffer. Return 0 on
- * success, or a negative value on error.
- */
-int cirbuf_del_tail_safe(struct cirbuf *cbuf);
-
-/**
- * Remove a char at the tail of the circular buffer. You _must_ check
- * that buffer is not empty before calling the function.
- */
-void cirbuf_del_tail(struct cirbuf *cbuf);
-
-/**
- * Return the head of the circular buffer. You _must_ check that
- * buffer is not empty before calling the function.
- */
-char cirbuf_get_head(struct cirbuf *cbuf);
-
-/**
- * Return the tail of the circular buffer. You _must_ check that
- * buffer is not empty before calling the function.
- */
-char cirbuf_get_tail(struct cirbuf *cbuf);
-
-/**
- * Add a buffer at head of the circular buffer. 'c' is a pointer to a
- * buffer, and n is the number of char to add. Return the number of
- * copied bytes on success, or a negative value on error.
- */
-int cirbuf_add_buf_head(struct cirbuf *cbuf, const char *c, unsigned int n);
-
-/**
- * Add a buffer at tail of the circular buffer. 'c' is a pointer to a
- * buffer, and n is the number of char to add. Return the number of
- * copied bytes on success, or a negative value on error.
- */
-int cirbuf_add_buf_tail(struct cirbuf *cbuf, const char *c, unsigned int n);
-
-/**
- * Remove chars at the head of the circular buffer. Return 0 on
- * success, or a negative value on error.
- */
-int cirbuf_del_buf_head(struct cirbuf *cbuf, unsigned int size);
-
-/**
- * Remove chars at the tail of the circular buffer. Return 0 on
- * success, or a negative value on error.
- */
-int cirbuf_del_buf_tail(struct cirbuf *cbuf, unsigned int size);
-
-/**
- * Copy a maximum of 'size' characters from the head of the circular
- * buffer to a flat one pointed by 'c'. Return the number of copied
- * chars.
- */
-int cirbuf_get_buf_head(struct cirbuf *cbuf, char *c, unsigned int size);
-
-/**
- * Copy a maximum of 'size' characters from the tail of the circular
- * buffer to a flat one pointed by 'c'. Return the number of copied
- * chars.
- */
-int cirbuf_get_buf_tail(struct cirbuf *cbuf, char *c, unsigned int size);
-
-
-/**
- * Set the start of the data to the index 0 of the internal buffer.
- */
-int cirbuf_align_left(struct cirbuf *cbuf);
-
-/**
- * Set the end of the data to the last index of the internal buffer.
- */
-int cirbuf_align_right(struct cirbuf *cbuf);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CIRBUF_H_ */
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index 3e12ee5..0cc0b57 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -70,7 +70,6 @@
#include <rte_string_fns.h>
-#include "cmdline_rdline.h"
#include "cmdline_parse.h"
#include "cmdline.h"
@@ -267,7 +266,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
if (!cl || !buf)
return CMDLINE_PARSE_BAD_ARGS;
- ctx = cl->ctx;
+ ctx = cmdline_ctx_get(cl);
/*
* - look if the buffer contains at least one line
@@ -386,7 +385,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
if (!cl || !buf || !state || !dst)
return -1;
- ctx = cl->ctx;
+ ctx = cmdline_ctx_get(cl);
debug_printf("%s called\n", __func__);
memset(&token_hdr, 0, sizeof(token_hdr));
@@ -398,7 +397,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
if (isblank2(buf[i]) && !isblank2(buf[i+1]))
partial_tok = buf+i+1;
}
- partial_tok_len = strnlen(partial_tok, RDLINE_BUF_SIZE);
+ partial_tok_len = strlen(partial_tok);
/* first call -> do a first pass */
if (*state <= 0) {
diff --git a/lib/librte_cmdline/cmdline_rdline.c b/lib/librte_cmdline/cmdline_rdline.c
deleted file mode 100644
index 1ef2258..0000000
--- a/lib/librte_cmdline/cmdline_rdline.c
+++ /dev/null
@@ -1,697 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include "cmdline_cirbuf.h"
-#include "cmdline_rdline.h"
-
-static void rdline_puts(struct rdline *rdl, const char *buf);
-static void rdline_miniprintf(struct rdline *rdl,
- const char *buf, unsigned int val);
-
-static void rdline_remove_old_history_item(struct rdline *rdl);
-static void rdline_remove_first_history_item(struct rdline *rdl);
-static unsigned int rdline_get_history_size(struct rdline *rdl);
-
-
-/* isblank() needs _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE, so use our
- * own. */
-static int
-isblank2(char c)
-{
- if (c == ' ' ||
- c == '\t' )
- return 1;
- return 0;
-}
-
-int
-rdline_init(struct rdline *rdl,
- rdline_write_char_t *write_char,
- rdline_validate_t *validate,
- rdline_complete_t *complete)
-{
- if (!rdl || !write_char || !validate || !complete)
- return -EINVAL;
- memset(rdl, 0, sizeof(*rdl));
- rdl->validate = validate;
- rdl->complete = complete;
- rdl->write_char = write_char;
- rdl->status = RDLINE_INIT;
- return cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE);
-}
-
-void
-rdline_newline(struct rdline *rdl, const char *prompt)
-{
- unsigned int i;
-
- if (!rdl || !prompt)
- return;
-
- vt100_init(&rdl->vt100);
- cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
-
- rdl->prompt_size = strnlen(prompt, RDLINE_PROMPT_SIZE-1);
- if (prompt != rdl->prompt)
- memcpy(rdl->prompt, prompt, rdl->prompt_size);
- rdl->prompt[RDLINE_PROMPT_SIZE-1] = '\0';
-
- for (i=0 ; i<rdl->prompt_size ; i++)
- rdl->write_char(rdl, rdl->prompt[i]);
- rdl->status = RDLINE_RUNNING;
-
- rdl->history_cur_line = -1;
-}
-
-void
-rdline_stop(struct rdline *rdl)
-{
- if (!rdl)
- return;
- rdl->status = RDLINE_INIT;
-}
-
-void
-rdline_quit(struct rdline *rdl)
-{
- if (!rdl)
- return;
- rdl->status = RDLINE_EXITED;
-}
-
-void
-rdline_restart(struct rdline *rdl)
-{
- if (!rdl)
- return;
- rdl->status = RDLINE_RUNNING;
-}
-
-void
-rdline_reset(struct rdline *rdl)
-{
- if (!rdl)
- return;
- vt100_init(&rdl->vt100);
- cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
-
- rdl->status = RDLINE_RUNNING;
-
- rdl->history_cur_line = -1;
-}
-
-const char *
-rdline_get_buffer(struct rdline *rdl)
-{
- if (!rdl)
- return NULL;
- unsigned int len_l, len_r;
- cirbuf_align_left(&rdl->left);
- cirbuf_align_left(&rdl->right);
-
- len_l = CIRBUF_GET_LEN(&rdl->left);
- len_r = CIRBUF_GET_LEN(&rdl->right);
- memcpy(rdl->left_buf+len_l, rdl->right_buf, len_r);
-
- rdl->left_buf[len_l + len_r] = '\n';
- rdl->left_buf[len_l + len_r + 1] = '\0';
- return rdl->left_buf;
-}
-
-static void
-display_right_buffer(struct rdline *rdl, int force)
-{
- unsigned int i;
- char tmp;
-
- if (!force && CIRBUF_IS_EMPTY(&rdl->right))
- return;
-
- rdline_puts(rdl, vt100_clear_right);
- CIRBUF_FOREACH(&rdl->right, i, tmp) {
- rdl->write_char(rdl, tmp);
- }
- if (!CIRBUF_IS_EMPTY(&rdl->right))
- rdline_miniprintf(rdl, vt100_multi_left,
- CIRBUF_GET_LEN(&rdl->right));
-}
-
-void
-rdline_redisplay(struct rdline *rdl)
-{
- unsigned int i;
- char tmp;
-
- if (!rdl)
- return;
-
- rdline_puts(rdl, vt100_home);
- for (i=0 ; i<rdl->prompt_size ; i++)
- rdl->write_char(rdl, rdl->prompt[i]);
- CIRBUF_FOREACH(&rdl->left, i, tmp) {
- rdl->write_char(rdl, tmp);
- }
- display_right_buffer(rdl, 1);
-}
-
-int
-rdline_char_in(struct rdline *rdl, char c)
-{
- unsigned int i;
- int cmd;
- char tmp;
- char *buf;
-
- if (!rdl)
- return -EINVAL;
-
- if (rdl->status == RDLINE_EXITED)
- return RDLINE_RES_EXITED;
- if (rdl->status != RDLINE_RUNNING)
- return RDLINE_RES_NOT_RUNNING;
-
- cmd = vt100_parser(&rdl->vt100, c);
- if (cmd == -2)
- return RDLINE_RES_SUCCESS;
-
- if (cmd >= 0) {
- switch (cmd) {
- /* move caret 1 char to the left */
- case CMDLINE_KEY_CTRL_B:
- case CMDLINE_KEY_LEFT_ARR:
- if (CIRBUF_IS_EMPTY(&rdl->left))
- break;
- tmp = cirbuf_get_tail(&rdl->left);
- cirbuf_del_tail(&rdl->left);
- cirbuf_add_head(&rdl->right, tmp);
- rdline_puts(rdl, vt100_left_arr);
- break;
-
- /* move caret 1 char to the right */
- case CMDLINE_KEY_CTRL_F:
- case CMDLINE_KEY_RIGHT_ARR:
- if (CIRBUF_IS_EMPTY(&rdl->right))
- break;
- tmp = cirbuf_get_head(&rdl->right);
- cirbuf_del_head(&rdl->right);
- cirbuf_add_tail(&rdl->left, tmp);
- rdline_puts(rdl, vt100_right_arr);
- break;
-
- /* move caret 1 word to the left */
- /* keyboard equivalent: Alt+B */
- case CMDLINE_KEY_WLEFT:
- while (! CIRBUF_IS_EMPTY(&rdl->left) &&
- (tmp = cirbuf_get_tail(&rdl->left)) &&
- isblank2(tmp)) {
- rdline_puts(rdl, vt100_left_arr);
- cirbuf_del_tail(&rdl->left);
- cirbuf_add_head(&rdl->right, tmp);
- }
- while (! CIRBUF_IS_EMPTY(&rdl->left) &&
- (tmp = cirbuf_get_tail(&rdl->left)) &&
- !isblank2(tmp)) {
- rdline_puts(rdl, vt100_left_arr);
- cirbuf_del_tail(&rdl->left);
- cirbuf_add_head(&rdl->right, tmp);
- }
- break;
-
- /* move caret 1 word to the right */
- /* keyboard equivalent: Alt+F */
- case CMDLINE_KEY_WRIGHT:
- while (! CIRBUF_IS_EMPTY(&rdl->right) &&
- (tmp = cirbuf_get_head(&rdl->right)) &&
- isblank2(tmp)) {
- rdline_puts(rdl, vt100_right_arr);
- cirbuf_del_head(&rdl->right);
- cirbuf_add_tail(&rdl->left, tmp);
- }
- while (! CIRBUF_IS_EMPTY(&rdl->right) &&
- (tmp = cirbuf_get_head(&rdl->right)) &&
- !isblank2(tmp)) {
- rdline_puts(rdl, vt100_right_arr);
- cirbuf_del_head(&rdl->right);
- cirbuf_add_tail(&rdl->left, tmp);
- }
- break;
-
- /* move caret to the left */
- case CMDLINE_KEY_CTRL_A:
- if (CIRBUF_IS_EMPTY(&rdl->left))
- break;
- rdline_miniprintf(rdl, vt100_multi_left,
- CIRBUF_GET_LEN(&rdl->left));
- while (! CIRBUF_IS_EMPTY(&rdl->left)) {
- tmp = cirbuf_get_tail(&rdl->left);
- cirbuf_del_tail(&rdl->left);
- cirbuf_add_head(&rdl->right, tmp);
- }
- break;
-
- /* move caret to the right */
- case CMDLINE_KEY_CTRL_E:
- if (CIRBUF_IS_EMPTY(&rdl->right))
- break;
- rdline_miniprintf(rdl, vt100_multi_right,
- CIRBUF_GET_LEN(&rdl->right));
- while (! CIRBUF_IS_EMPTY(&rdl->right)) {
- tmp = cirbuf_get_head(&rdl->right);
- cirbuf_del_head(&rdl->right);
- cirbuf_add_tail(&rdl->left, tmp);
- }
- break;
-
- /* delete 1 char from the left */
- case CMDLINE_KEY_BKSPACE:
- if(!cirbuf_del_tail_safe(&rdl->left)) {
- rdline_puts(rdl, vt100_bs);
- display_right_buffer(rdl, 1);
- }
- break;
-
- /* delete 1 char from the right */
- case CMDLINE_KEY_SUPPR:
- case CMDLINE_KEY_CTRL_D:
- if (cmd == CMDLINE_KEY_CTRL_D &&
- CIRBUF_IS_EMPTY(&rdl->left) &&
- CIRBUF_IS_EMPTY(&rdl->right)) {
- return RDLINE_RES_EOF;
- }
- if (!cirbuf_del_head_safe(&rdl->right)) {
- display_right_buffer(rdl, 1);
- }
- break;
-
- /* delete 1 word from the left */
- case CMDLINE_KEY_META_BKSPACE:
- case CMDLINE_KEY_CTRL_W:
- while (! CIRBUF_IS_EMPTY(&rdl->left) && isblank2(cirbuf_get_tail(&rdl->left))) {
- rdline_puts(rdl, vt100_bs);
- cirbuf_del_tail(&rdl->left);
- }
- while (! CIRBUF_IS_EMPTY(&rdl->left) && !isblank2(cirbuf_get_tail(&rdl->left))) {
- rdline_puts(rdl, vt100_bs);
- cirbuf_del_tail(&rdl->left);
- }
- display_right_buffer(rdl, 1);
- break;
-
- /* delete 1 word from the right */
- case CMDLINE_KEY_META_D:
- while (! CIRBUF_IS_EMPTY(&rdl->right) && isblank2(cirbuf_get_head(&rdl->right)))
- cirbuf_del_head(&rdl->right);
- while (! CIRBUF_IS_EMPTY(&rdl->right) && !isblank2(cirbuf_get_head(&rdl->right)))
- cirbuf_del_head(&rdl->right);
- display_right_buffer(rdl, 1);
- break;
-
- /* set kill buffer to contents on the right side of caret */
- case CMDLINE_KEY_CTRL_K:
- cirbuf_get_buf_head(&rdl->right, rdl->kill_buf, RDLINE_BUF_SIZE);
- rdl->kill_size = CIRBUF_GET_LEN(&rdl->right);
- cirbuf_del_buf_head(&rdl->right, rdl->kill_size);
- rdline_puts(rdl, vt100_clear_right);
- break;
-
- /* paste contents of kill buffer to the left side of caret */
- case CMDLINE_KEY_CTRL_Y:
- i=0;
- while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
- RDLINE_BUF_SIZE &&
- i < rdl->kill_size) {
- cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
- rdl->write_char(rdl, rdl->kill_buf[i]);
- i++;
- }
- display_right_buffer(rdl, 0);
- break;
-
- /* clear and newline */
- case CMDLINE_KEY_CTRL_C:
- rdline_puts(rdl, "\r\n");
- rdline_newline(rdl, rdl->prompt);
- break;
-
- /* redisplay (helps when prompt is lost in other output) */
- case CMDLINE_KEY_CTRL_L:
- rdline_redisplay(rdl);
- break;
-
- /* autocomplete */
- case CMDLINE_KEY_TAB:
- case CMDLINE_KEY_HELP:
- cirbuf_align_left(&rdl->left);
- rdl->left_buf[CIRBUF_GET_LEN(&rdl->left)] = '\0';
- if (rdl->complete) {
- char tmp_buf[BUFSIZ];
- int complete_state;
- int ret;
- unsigned int tmp_size;
-
- if (cmd == CMDLINE_KEY_TAB)
- complete_state = 0;
- else
- complete_state = -1;
-
- /* see in parse.h for help on complete() */
- ret = rdl->complete(rdl, rdl->left_buf,
- tmp_buf, sizeof(tmp_buf),
- &complete_state);
- /* no completion or error */
- if (ret <= 0) {
- return RDLINE_RES_COMPLETE;
- }
-
- tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
- /* add chars */
- if (ret == RDLINE_RES_COMPLETE) {
- i=0;
- while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
- RDLINE_BUF_SIZE &&
- i < tmp_size) {
- cirbuf_add_tail(&rdl->left, tmp_buf[i]);
- rdl->write_char(rdl, tmp_buf[i]);
- i++;
- }
- display_right_buffer(rdl, 1);
- return RDLINE_RES_COMPLETE; /* ?? */
- }
-
- /* choice */
- rdline_puts(rdl, "\r\n");
- while (ret) {
- rdl->write_char(rdl, ' ');
- for (i=0 ; tmp_buf[i] ; i++)
- rdl->write_char(rdl, tmp_buf[i]);
- rdline_puts(rdl, "\r\n");
- ret = rdl->complete(rdl, rdl->left_buf,
- tmp_buf, sizeof(tmp_buf),
- &complete_state);
- }
-
- rdline_redisplay(rdl);
- }
- return RDLINE_RES_COMPLETE;
-
- /* complete buffer */
- case CMDLINE_KEY_RETURN:
- case CMDLINE_KEY_RETURN2:
- rdline_get_buffer(rdl);
- rdl->status = RDLINE_INIT;
- rdline_puts(rdl, "\r\n");
- if (rdl->history_cur_line != -1)
- rdline_remove_first_history_item(rdl);
-
- if (rdl->validate)
- rdl->validate(rdl, rdl->left_buf, CIRBUF_GET_LEN(&rdl->left)+2);
- /* user may have stopped rdline */
- if (rdl->status == RDLINE_EXITED)
- return RDLINE_RES_EXITED;
- return RDLINE_RES_VALIDATED;
-
- /* previous element in history */
- case CMDLINE_KEY_UP_ARR:
- case CMDLINE_KEY_CTRL_P:
- if (rdl->history_cur_line == 0) {
- rdline_remove_first_history_item(rdl);
- }
- if (rdl->history_cur_line <= 0) {
- rdline_add_history(rdl, rdline_get_buffer(rdl));
- rdl->history_cur_line = 0;
- }
-
- buf = rdline_get_history_item(rdl, rdl->history_cur_line + 1);
- if (!buf)
- break;
-
- rdl->history_cur_line ++;
- vt100_init(&rdl->vt100);
- cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_add_buf_tail(&rdl->left, buf, strnlen(buf, RDLINE_BUF_SIZE));
- rdline_redisplay(rdl);
- break;
-
- /* next element in history */
- case CMDLINE_KEY_DOWN_ARR:
- case CMDLINE_KEY_CTRL_N:
- if (rdl->history_cur_line - 1 < 0)
- break;
-
- rdl->history_cur_line --;
- buf = rdline_get_history_item(rdl, rdl->history_cur_line);
- if (!buf)
- break;
- vt100_init(&rdl->vt100);
- cirbuf_init(&rdl->left, rdl->left_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_init(&rdl->right, rdl->right_buf, 0, RDLINE_BUF_SIZE);
- cirbuf_add_buf_tail(&rdl->left, buf, strnlen(buf, RDLINE_BUF_SIZE));
- rdline_redisplay(rdl);
-
- break;
-
-
- default:
- break;
- }
-
- return RDLINE_RES_SUCCESS;
- }
-
- if (!isprint((int)c))
- return RDLINE_RES_SUCCESS;
-
- /* standard chars */
- if (CIRBUF_GET_LEN(&rdl->left) + CIRBUF_GET_LEN(&rdl->right) >= RDLINE_BUF_SIZE)
- return RDLINE_RES_SUCCESS;
-
- if (cirbuf_add_tail_safe(&rdl->left, c))
- return RDLINE_RES_SUCCESS;
-
- rdl->write_char(rdl, c);
- display_right_buffer(rdl, 0);
-
- return RDLINE_RES_SUCCESS;
-}
-
-
-/* HISTORY */
-
-static void
-rdline_remove_old_history_item(struct rdline * rdl)
-{
- char tmp;
-
- while (! CIRBUF_IS_EMPTY(&rdl->history) ) {
- tmp = cirbuf_get_head(&rdl->history);
- cirbuf_del_head(&rdl->history);
- if (!tmp)
- break;
- }
-}
-
-static void
-rdline_remove_first_history_item(struct rdline * rdl)
-{
- char tmp;
-
- if ( CIRBUF_IS_EMPTY(&rdl->history) ) {
- return;
- }
- else {
- cirbuf_del_tail(&rdl->history);
- }
-
- while (! CIRBUF_IS_EMPTY(&rdl->history) ) {
- tmp = cirbuf_get_tail(&rdl->history);
- if (!tmp)
- break;
- cirbuf_del_tail(&rdl->history);
- }
-}
-
-static unsigned int
-rdline_get_history_size(struct rdline * rdl)
-{
- unsigned int i, tmp, ret=0;
-
- CIRBUF_FOREACH(&rdl->history, i, tmp) {
- if (tmp == 0)
- ret ++;
- }
-
- return ret;
-}
-
-char *
-rdline_get_history_item(struct rdline * rdl, unsigned int idx)
-{
- unsigned int len, i, tmp;
-
- if (!rdl)
- return NULL;
-
- len = rdline_get_history_size(rdl);
- if ( idx >= len ) {
- return NULL;
- }
-
- cirbuf_align_left(&rdl->history);
-
- CIRBUF_FOREACH(&rdl->history, i, tmp) {
- if ( idx == len - 1) {
- return rdl->history_buf + i;
- }
- if (tmp == 0)
- len --;
- }
-
- return NULL;
-}
-
-int
-rdline_add_history(struct rdline * rdl, const char * buf)
-{
- unsigned int len, i;
-
- if (!rdl || !buf)
- return -EINVAL;
-
- len = strnlen(buf, RDLINE_BUF_SIZE);
- for (i=0; i<len ; i++) {
- if (buf[i] == '\n') {
- len = i;
- break;
- }
- }
-
- if ( len >= RDLINE_HISTORY_BUF_SIZE )
- return -1;
-
- while ( len >= CIRBUF_GET_FREELEN(&rdl->history) ) {
- rdline_remove_old_history_item(rdl);
- }
-
- cirbuf_add_buf_tail(&rdl->history, buf, len);
- cirbuf_add_tail(&rdl->history, 0);
-
- return 0;
-}
-
-void
-rdline_clear_history(struct rdline * rdl)
-{
- if (!rdl)
- return;
- cirbuf_init(&rdl->history, rdl->history_buf, 0, RDLINE_HISTORY_BUF_SIZE);
-}
-
-
-/* STATIC USEFUL FUNCS */
-
-static void
-rdline_puts(struct rdline * rdl, const char * buf)
-{
- char c;
- while ( (c = *(buf++)) != '\0' ) {
- rdl->write_char(rdl, c);
- }
-}
-
-/* a very very basic printf with one arg and one format 'u' */
-static void
-rdline_miniprintf(struct rdline *rdl, const char * buf, unsigned int val)
-{
- char c, started=0, div=100;
-
- while ( (c=*(buf++)) ) {
- if (c != '%') {
- rdl->write_char(rdl, c);
- continue;
- }
- c = *(buf++);
- if (c != 'u') {
- rdl->write_char(rdl, '%');
- rdl->write_char(rdl, c);
- continue;
- }
- /* val is never more than 255 */
- while (div) {
- c = (char)(val / div);
- if (c || started) {
- rdl->write_char(rdl, (char)(c+'0'));
- started = 1;
- }
- val %= div;
- div /= 10;
- }
- }
-}
diff --git a/lib/librte_cmdline/cmdline_rdline.h b/lib/librte_cmdline/cmdline_rdline.h
deleted file mode 100644
index 72e2dad..0000000
--- a/lib/librte_cmdline/cmdline_rdline.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RDLINE_H_
-#define _RDLINE_H_
-
-/**
- * This file is a small equivalent to the GNU readline library, but it
- * was originally designed for small systems, like Atmel AVR
- * microcontrollers (8 bits). Indeed, we don't use any malloc that is
- * sometimes not implemented (or just not recommended) on such
- * systems.
- *
- * Obviously, it does not support as many things as the GNU readline,
- * but at least it supports some interesting features like a kill
- * buffer and a command history.
- *
- * It also have a feature that does not have the GNU readline (as far
- * as I know): we can have several instances of it running at the same
- * time, even on a monothread program, since it works with callbacks.
- *
- * The lib is designed for a client-side or a server-side use:
- * - server-side: the server receives all data from a socket, including
- * control chars, like arrows, tabulations, ... The client is
- * very simple, it can be a telnet or a minicom through a serial line.
- * - client-side: the client receives its data through its stdin for
- * instance.
- */
-
-#include <stdio.h>
-#include <cmdline_cirbuf.h>
-#include <cmdline_vt100.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* configuration */
-#define RDLINE_BUF_SIZE 512
-#define RDLINE_PROMPT_SIZE 32
-#define RDLINE_VT100_BUF_SIZE 8
-#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
-#define RDLINE_HISTORY_MAX_LINE 64
-
-enum rdline_status {
- RDLINE_INIT,
- RDLINE_RUNNING,
- RDLINE_EXITED
-};
-
-struct rdline;
-
-typedef int (rdline_write_char_t)(struct rdline *rdl, char);
-typedef void (rdline_validate_t)(struct rdline *rdl,
- const char *buf, unsigned int size);
-typedef int (rdline_complete_t)(struct rdline *rdl, const char *buf,
- char *dstbuf, unsigned int dstsize,
- int *state);
-
-struct rdline {
- enum rdline_status status;
- /* rdline bufs */
- struct cirbuf left;
- struct cirbuf right;
- char left_buf[RDLINE_BUF_SIZE+2]; /* reserve 2 chars for the \n\0 */
- char right_buf[RDLINE_BUF_SIZE];
-
- char prompt[RDLINE_PROMPT_SIZE];
- unsigned int prompt_size;
-
- char kill_buf[RDLINE_BUF_SIZE];
- unsigned int kill_size;
-
- /* history */
- struct cirbuf history;
- char history_buf[RDLINE_HISTORY_BUF_SIZE];
- int history_cur_line;
-
- /* callbacks and func pointers */
- rdline_write_char_t *write_char;
- rdline_validate_t *validate;
- rdline_complete_t *complete;
-
- /* vt100 parser */
- struct cmdline_vt100 vt100;
-
- /* opaque pointer */
- void *opaque;
-};
-
-/**
- * Init fields for a struct rdline. Call this only once at the beginning
- * of your program.
- * \param rdl A pointer to an uninitialized struct rdline
- * \param write_char The function used by the function to write a character
- * \param validate A pointer to the function to execute when the
- * user validates the buffer.
- * \param complete A pointer to the function to execute when the
- * user completes the buffer.
- */
-int rdline_init(struct rdline *rdl,
- rdline_write_char_t *write_char,
- rdline_validate_t *validate,
- rdline_complete_t *complete);
-
-
-/**
- * Init the current buffer, and display a prompt.
- * \param rdl A pointer to a struct rdline
- * \param prompt A string containing the prompt
- */
-void rdline_newline(struct rdline *rdl, const char *prompt);
-
-/**
- * Call it and all received chars will be ignored.
- * \param rdl A pointer to a struct rdline
- */
-void rdline_stop(struct rdline *rdl);
-
-/**
- * Same than rdline_stop() except that next calls to rdline_char_in()
- * will return RDLINE_RES_EXITED.
- * \param rdl A pointer to a struct rdline
- */
-void rdline_quit(struct rdline *rdl);
-
-/**
- * Restart after a call to rdline_stop() or rdline_quit()
- * \param rdl A pointer to a struct rdline
- */
-void rdline_restart(struct rdline *rdl);
-
-/**
- * Redisplay the current buffer
- * \param rdl A pointer to a struct rdline
- */
-void rdline_redisplay(struct rdline *rdl);
-
-/**
- * Reset the current buffer and setup for a new line.
- * \param rdl A pointer to a struct rdline
- */
-void rdline_reset(struct rdline *rdl);
-
-
-/* return status for rdline_char_in() */
-#define RDLINE_RES_SUCCESS 0
-#define RDLINE_RES_VALIDATED 1
-#define RDLINE_RES_COMPLETE 2
-#define RDLINE_RES_NOT_RUNNING -1
-#define RDLINE_RES_EOF -2
-#define RDLINE_RES_EXITED -3
-
-/**
- * append a char to the readline buffer.
- * Return RDLINE_RES_VALIDATE when the line has been validated.
- * Return RDLINE_RES_COMPLETE when the user asked to complete the buffer.
- * Return RDLINE_RES_NOT_RUNNING if it is not running.
- * Return RDLINE_RES_EOF if EOF (ctrl-d on an empty line).
- * Else return RDLINE_RES_SUCCESS.
- * XXX error case when the buffer is full ?
- *
- * \param rdl A pointer to a struct rdline
- * \param c The character to append
- */
-int rdline_char_in(struct rdline *rdl, char c);
-
-/**
- * Return the current buffer, terminated by '\0'.
- * \param rdl A pointer to a struct rdline
- */
-const char *rdline_get_buffer(struct rdline *rdl);
-
-
-/**
- * Add the buffer to history.
- * return < 0 on error.
- * \param rdl A pointer to a struct rdline
- * \param buf A buffer that is terminated by '\0'
- */
-int rdline_add_history(struct rdline *rdl, const char *buf);
-
-/**
- * Clear current history
- * \param rdl A pointer to a struct rdline
- */
-void rdline_clear_history(struct rdline *rdl);
-
-/**
- * Get the i-th history item
- */
-char *rdline_get_history_item(struct rdline *rdl, unsigned int i);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RDLINE_H_ */
diff --git a/lib/librte_cmdline/cmdline_socket.c b/lib/librte_cmdline/cmdline_socket.c
index 3fc243b..11524b5 100644
--- a/lib/librte_cmdline/cmdline_socket.c
+++ b/lib/librte_cmdline/cmdline_socket.c
@@ -58,23 +58,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdio.h>
-#include <string.h>
+#include <stddef.h>
#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <inttypes.h>
#include <fcntl.h>
-#include <termios.h>
#include "cmdline_parse.h"
-#include "cmdline_rdline.h"
#include "cmdline_socket.h"
#include "cmdline.h"
struct cmdline *
cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
{
+ struct cmdline *cl;
int fd;
/* everything else is checked in cmdline_new() */
@@ -83,37 +78,22 @@ cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
fd = open(path, O_RDONLY, 0);
if (fd < 0) {
- dprintf("open() failed\n");
return NULL;
}
- return cmdline_new(ctx, prompt, fd, -1);
+ cl = cmdline_new(ctx, prompt, fd, -1);
+ /* cmdline_new() duplicates fd */
+ close(fd);
+ return cl;
}
struct cmdline *
cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
{
- struct cmdline *cl;
- struct termios oldterm, term;
-
- tcgetattr(0, &oldterm);
- memcpy(&term, &oldterm, sizeof(term));
- term.c_lflag &= ~(ICANON | ECHO | ISIG);
- tcsetattr(0, TCSANOW, &term);
- setbuf(stdin, NULL);
-
- cl = cmdline_new(ctx, prompt, 0, 1);
-
- if (cl)
- memcpy(&cl->oldterm, &oldterm, sizeof(term));
-
- return cl;
+ return cmdline_new(ctx, prompt, 0, 1);
}
void
cmdline_stdin_exit(struct cmdline *cl)
{
- if (!cl)
- return;
-
- tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
+ cmdline_free(cl);
}
diff --git a/lib/librte_cmdline/cmdline_vt100.c b/lib/librte_cmdline/cmdline_vt100.c
deleted file mode 100644
index a253e8b..0000000
--- a/lib/librte_cmdline/cmdline_vt100.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <termios.h>
-
-#include "cmdline_vt100.h"
-
-const char *cmdline_vt100_commands[] = {
- vt100_up_arr,
- vt100_down_arr,
- vt100_right_arr,
- vt100_left_arr,
- "\177",
- "\n",
- "\001",
- "\005",
- "\013",
- "\031",
- "\003",
- "\006",
- "\002",
- vt100_suppr,
- vt100_tab,
- "\004",
- "\014",
- "\r",
- "\033\177",
- vt100_word_left,
- vt100_word_right,
- "?",
- "\027",
- "\020",
- "\016",
- "\033\144",
-};
-
-void
-vt100_init(struct cmdline_vt100 *vt)
-{
- if (!vt)
- return;
- vt->state = CMDLINE_VT100_INIT;
-}
-
-
-static int
-match_command(char *buf, unsigned int size)
-{
- const char *cmd;
- size_t cmdlen;
- unsigned int i = 0;
-
- for (i=0 ; i<sizeof(cmdline_vt100_commands)/sizeof(const char *) ; i++) {
- cmd = *(cmdline_vt100_commands + i);
-
- cmdlen = strnlen(cmd, CMDLINE_VT100_BUF_SIZE);
- if (size == cmdlen &&
- !strncmp(buf, cmd, cmdlen)) {
- return i;
- }
- }
-
- return -1;
-}
-
-int
-vt100_parser(struct cmdline_vt100 *vt, char ch)
-{
- unsigned int size;
- uint8_t c = (uint8_t) ch;
-
- if (!vt)
- return -1;
-
- if (vt->bufpos >= CMDLINE_VT100_BUF_SIZE) {
- vt->state = CMDLINE_VT100_INIT;
- vt->bufpos = 0;
- }
-
- vt->buf[vt->bufpos++] = c;
- size = vt->bufpos;
-
- switch (vt->state) {
- case CMDLINE_VT100_INIT:
- if (c == 033) {
- vt->state = CMDLINE_VT100_ESCAPE;
- }
- else {
- vt->bufpos = 0;
- goto match_command;
- }
- break;
-
- case CMDLINE_VT100_ESCAPE:
- if (c == 0133) {
- vt->state = CMDLINE_VT100_ESCAPE_CSI;
- }
- else if (c >= 060 && c <= 0177) { /* XXX 0177 ? */
- vt->bufpos = 0;
- vt->state = CMDLINE_VT100_INIT;
- goto match_command;
- }
- break;
-
- case CMDLINE_VT100_ESCAPE_CSI:
- if (c >= 0100 && c <= 0176) {
- vt->bufpos = 0;
- vt->state = CMDLINE_VT100_INIT;
- goto match_command;
- }
- break;
-
- default:
- vt->bufpos = 0;
- break;
- }
-
- return -2;
-
- match_command:
- return match_command(vt->buf, size);
-}
diff --git a/lib/librte_cmdline/cmdline_vt100.h b/lib/librte_cmdline/cmdline_vt100.h
deleted file mode 100644
index 963add8..0000000
--- a/lib/librte_cmdline/cmdline_vt100.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of California, Berkeley nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _CMDLINE_VT100_H_
-#define _CMDLINE_VT100_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define vt100_bell "\007"
-#define vt100_bs "\010"
-#define vt100_bs_clear "\010 \010"
-#define vt100_tab "\011"
-#define vt100_crnl "\012\015"
-#define vt100_clear_right "\033[0K"
-#define vt100_clear_left "\033[1K"
-#define vt100_clear_down "\033[0J"
-#define vt100_clear_up "\033[1J"
-#define vt100_clear_line "\033[2K"
-#define vt100_clear_screen "\033[2J"
-#define vt100_up_arr "\033\133\101"
-#define vt100_down_arr "\033\133\102"
-#define vt100_right_arr "\033\133\103"
-#define vt100_left_arr "\033\133\104"
-#define vt100_multi_right "\033\133%uC"
-#define vt100_multi_left "\033\133%uD"
-#define vt100_suppr "\033\133\063\176"
-#define vt100_home "\033M\033E"
-#define vt100_word_left "\033\142"
-#define vt100_word_right "\033\146"
-
-/* Result of parsing : it must be synchronized with
- * cmdline_vt100_commands[] in vt100.c */
-#define CMDLINE_KEY_UP_ARR 0
-#define CMDLINE_KEY_DOWN_ARR 1
-#define CMDLINE_KEY_RIGHT_ARR 2
-#define CMDLINE_KEY_LEFT_ARR 3
-#define CMDLINE_KEY_BKSPACE 4
-#define CMDLINE_KEY_RETURN 5
-#define CMDLINE_KEY_CTRL_A 6
-#define CMDLINE_KEY_CTRL_E 7
-#define CMDLINE_KEY_CTRL_K 8
-#define CMDLINE_KEY_CTRL_Y 9
-#define CMDLINE_KEY_CTRL_C 10
-#define CMDLINE_KEY_CTRL_F 11
-#define CMDLINE_KEY_CTRL_B 12
-#define CMDLINE_KEY_SUPPR 13
-#define CMDLINE_KEY_TAB 14
-#define CMDLINE_KEY_CTRL_D 15
-#define CMDLINE_KEY_CTRL_L 16
-#define CMDLINE_KEY_RETURN2 17
-#define CMDLINE_KEY_META_BKSPACE 18
-#define CMDLINE_KEY_WLEFT 19
-#define CMDLINE_KEY_WRIGHT 20
-#define CMDLINE_KEY_HELP 21
-#define CMDLINE_KEY_CTRL_W 22
-#define CMDLINE_KEY_CTRL_P 23
-#define CMDLINE_KEY_CTRL_N 24
-#define CMDLINE_KEY_META_D 25
-
-extern const char *cmdline_vt100_commands[];
-
-enum cmdline_vt100_parser_state {
- CMDLINE_VT100_INIT,
- CMDLINE_VT100_ESCAPE,
- CMDLINE_VT100_ESCAPE_CSI
-};
-
-#define CMDLINE_VT100_BUF_SIZE 8
-struct cmdline_vt100 {
- uint8_t bufpos;
- char buf[CMDLINE_VT100_BUF_SIZE];
- enum cmdline_vt100_parser_state state;
-};
-
-/**
- * Init
- */
-void vt100_init(struct cmdline_vt100 *vt);
-
-/**
- * Input a new character.
- * Return -1 if the character is not part of a control sequence
- * Return -2 if c is not the last char of a control sequence
- * Else return the index in vt100_commands[]
- */
-int vt100_parser(struct cmdline_vt100 *vt, char c);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_cmdline/rte_cmdline_version.map b/lib/librte_cmdline/rte_cmdline_version.map
index 04bcb38..3133199 100644
--- a/lib/librte_cmdline/rte_cmdline_version.map
+++ b/lib/librte_cmdline/rte_cmdline_version.map
@@ -1,25 +1,6 @@
DPDK_2.0 {
global:
- cirbuf_add_buf_head;
- cirbuf_add_buf_tail;
- cirbuf_add_head;
- cirbuf_add_head_safe;
- cirbuf_add_tail;
- cirbuf_add_tail_safe;
- cirbuf_align_left;
- cirbuf_align_right;
- cirbuf_del_buf_head;
- cirbuf_del_buf_tail;
- cirbuf_del_head;
- cirbuf_del_head_safe;
- cirbuf_del_tail;
- cirbuf_del_tail_safe;
- cirbuf_get_buf_head;
- cirbuf_get_buf_tail;
- cirbuf_get_head;
- cirbuf_get_tail;
- cirbuf_init;
cmdline_complete;
cmdline_complete_get_elt_string;
cmdline_complete_get_nb_string;
@@ -50,21 +31,6 @@ DPDK_2.0 {
cmdline_token_num_ops;
cmdline_token_portlist_ops;
cmdline_token_string_ops;
- cmdline_write_char;
- rdline_add_history;
- rdline_char_in;
- rdline_clear_history;
- rdline_get_buffer;
- rdline_get_history_item;
- rdline_init;
- rdline_newline;
- rdline_quit;
- rdline_redisplay;
- rdline_reset;
- rdline_restart;
- rdline_stop;
- vt100_init;
- vt100_parser;
local: *;
};
@@ -75,3 +41,10 @@ DPDK_2.1 {
cmdline_poll;
} DPDK_2.0;
+
+DPDK_18.02 {
+ global:
+
+ cmdline_ctx_get;
+
+} DPDK_2.1;
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 6a6a745..504bb4e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -102,6 +102,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
+
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += $(shell pkg-config --libs libedit)
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
diff --git a/test/cmdline_test/cmdline_test.c b/test/cmdline_test/cmdline_test.c
index 716b5f1..595efa5 100644
--- a/test/cmdline_test/cmdline_test.c
+++ b/test/cmdline_test/cmdline_test.c
@@ -41,7 +41,6 @@
#include <ctype.h>
#include <sys/queue.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_socket.h>
#include <cmdline.h>
diff --git a/test/cmdline_test/commands.c b/test/cmdline_test/commands.c
index 404f51a..8481af9 100644
--- a/test/cmdline_test/commands.c
+++ b/test/cmdline_test/commands.c
@@ -36,7 +36,6 @@
#include <termios.h>
#include <inttypes.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_string.h>
#include <cmdline_parse_num.h>
@@ -306,72 +305,6 @@ cmdline_parse_inst_t cmd_ambig_2 = {
-/*** get_history_bufsize ***/
-/* command that displays total space in history buffer
- * this will be useful for testing history (to fill it up just enough to
- * remove the last entry, we need to know how big it is).
- */
-
-struct cmd_get_history_bufsize_result {
- cmdline_fixed_string_t str;
-};
-
-static void
-cmd_get_history_bufsize_parsed(__attribute__((unused)) void *parsed_result,
- struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- cmdline_printf(cl, "History buffer size: %zu\n",
- sizeof(cl->rdl.history_buf));
-}
-
-cmdline_parse_token_string_t cmd_get_history_bufsize_tok =
- TOKEN_STRING_INITIALIZER(struct cmd_get_history_bufsize_result, str,
- "get_history_bufsize");
-
-cmdline_parse_inst_t cmd_get_history_bufsize = {
- .f = cmd_get_history_bufsize_parsed, /* function to call */
- .data = NULL, /* 2nd arg of func */
- .help_str = "command that displays total space in history buffer",
- .tokens = { /* token list, NULL terminated */
- (void *)&cmd_get_history_bufsize_tok,
- NULL,
- },
-};
-
-
-
-/*** clear_history ***/
-/* clears history buffer */
-
-struct cmd_clear_history_result {
- cmdline_fixed_string_t str;
-};
-
-static void
-cmd_clear_history_parsed(__attribute__((unused)) void *parsed_result,
- struct cmdline *cl,
- __attribute__((unused)) void *data)
-{
- rdline_clear_history(&cl->rdl);
-}
-
-cmdline_parse_token_string_t cmd_clear_history_tok =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_history_result, str,
- "clear_history");
-
-cmdline_parse_inst_t cmd_clear_history = {
- .f = cmd_clear_history_parsed, /* function to call */
- .data = NULL, /* 2nd arg of func */
- .help_str = "clear command history",
- .tokens = { /* token list, NULL terminated */
- (void *)&cmd_clear_history_tok,
- NULL,
- },
-};
-
-
-
/****************/
cmdline_parse_ctx_t main_ctx[] = {
@@ -381,8 +314,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_single,
(cmdline_parse_inst_t *)&cmd_single_long,
(cmdline_parse_inst_t *)&cmd_num,
- (cmdline_parse_inst_t *)&cmd_get_history_bufsize,
- (cmdline_parse_inst_t *)&cmd_clear_history,
(cmdline_parse_inst_t *)&cmd_autocomplete_1,
(cmdline_parse_inst_t *)&cmd_autocomplete_2,
NULL,
diff --git a/test/test/Makefile b/test/test/Makefile
index bb54c98..49e907c 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -164,7 +164,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
diff --git a/test/test/commands.c b/test/test/commands.c
index 4097a33..21a4a06 100644
--- a/test/test/commands.c
+++ b/test/test/commands.c
@@ -66,7 +66,6 @@
#include <rte_mbuf.h>
#include <rte_devargs.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
#include <cmdline_parse_num.h>
diff --git a/test/test/test.c b/test/test/test.c
index 0e6ff7c..6f48892 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -42,7 +42,6 @@
#include <sys/queue.h>
#ifdef RTE_LIBRTE_CMDLINE
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_socket.h>
#include <cmdline.h>
diff --git a/test/test/test_cmdline.c b/test/test/test_cmdline.c
index 38c7256..056b569 100644
--- a/test/test/test_cmdline.c
+++ b/test/test/test_cmdline.c
@@ -74,15 +74,6 @@ test_cmdline(void)
return -1;
if (test_parse_string_invalid_param() < 0)
return -1;
- printf("Testing circular buffer...\n");
- if (test_cirbuf_char() < 0)
- return -1;
- if (test_cirbuf_string() < 0)
- return -1;
- if (test_cirbuf_align() < 0)
- return -1;
- if (test_cirbuf_invalid_param() < 0)
- return -1;
printf("Testing library functions...\n");
if (test_cmdline_lib() < 0)
return -1;
diff --git a/test/test/test_cmdline.h b/test/test/test_cmdline.h
index 0ee91c1..b55caa9 100644
--- a/test/test/test_cmdline.h
+++ b/test/test/test_cmdline.h
@@ -61,12 +61,6 @@ int test_parse_string_valid(void);
int test_parse_string_invalid_data(void);
int test_parse_string_invalid_param(void);
-/* cmdline_cirbuf tests */
-int test_cirbuf_invalid_param(void);
-int test_cirbuf_char(void);
-int test_cirbuf_string(void);
-int test_cirbuf_align(void);
-
/* test the rest of the library */
int test_cmdline_lib(void);
diff --git a/test/test/test_cmdline_cirbuf.c b/test/test/test_cmdline_cirbuf.c
deleted file mode 100644
index 2c32145..0000000
--- a/test/test/test_cmdline_cirbuf.c
+++ /dev/null
@@ -1,1330 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <rte_string_fns.h>
-
-#include <cmdline_cirbuf.h>
-
-#include "test_cmdline.h"
-
-/* different length strings */
-#define CIRBUF_STR_HEAD " HEAD"
-#define CIRBUF_STR_TAIL "TAIL"
-
-/* miscellaneous tests - they make bullseye happy */
-static int
-test_cirbuf_string_misc(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /*
- * add strings to head and tail, but read only tail
- * this results in read operation that does not transcend
- * from buffer end to buffer beginning (in other words,
- * strlen <= cb->maxlen - cb->end)
- */
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* add string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* read string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to get string from tail!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: tail strings do not match!\n");
- return -1;
- }
- /* clear buffers */
- memset(tmp, 0, sizeof(tmp));
- memset(buf, 0, sizeof(buf));
-
-
-
- /*
- * add a string to buffer when start/end is at end of buffer
- */
-
- /*
- * reinitialize circular buffer with start at the end of cirbuf
- */
- if (cirbuf_init(&cb, buf, CMDLINE_TEST_BUFSIZE - 2, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
-
- /* add string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to add string to tail!\n");
- return -1;
- }
- /* read string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to get string from tail!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: tail strings do not match!\n");
- return -1;
- }
- /* clear tmp buffer */
- memset(tmp, 0, sizeof(tmp));
-
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* read string from tail */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to get string from head!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
- printf("Error: headstrings do not match!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* test adding and deleting strings */
-static int
-test_cirbuf_string_add_del(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* read string from head */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to get string from head!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
- printf("Error: head strings do not match!\n");
- return -1;
- }
- /* clear tmp buffer */
- memset(tmp, 0, sizeof(tmp));
- /* read string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to get string from head!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) != 0) {
- printf("Error: head strings do not match!\n");
- return -1;
- }
- /* delete string from head*/
- if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_HEAD)) < 0) {
- printf("Error: failed to delete string from head!\n");
- return -1;
- }
- /* verify string was deleted */
- if (cirbuf_del_head_safe(&cb) == 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
- /* clear tmp buffer */
- memset(tmp, 0, sizeof(tmp));
-
-
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* add string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to add string to tail!\n");
- return -1;
- }
- /* get string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to get string from tail!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: tail strings do not match!\n");
- return -1;
- }
- /* clear tmp buffer */
- memset(tmp, 0, sizeof(tmp));
- /* get string from head */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to get string from tail!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: tail strings do not match!\n");
- return -1;
- }
- /* delete string from tail */
- if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to delete string from tail!\n");
- return -1;
- }
- /* verify string was deleted */
- if (cirbuf_del_tail_safe(&cb) == 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* test adding from head and deleting from tail, and vice versa */
-static int
-test_cirbuf_string_add_del_reverse(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* delete string from tail */
- if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_HEAD)) < 0) {
- printf("Error: failed to delete string from tail!\n");
- return -1;
- }
- /* verify string was deleted */
- if (cirbuf_del_tail_safe(&cb) == 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
- /* clear tmp buffer */
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* add string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to add string to tail!\n");
- return -1;
- }
- /* delete string from head */
- if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to delete string from head!\n");
- return -1;
- }
- /* verify string was deleted */
- if (cirbuf_del_head_safe(&cb) == 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* try to write more than available */
-static int
-test_cirbuf_string_add_boundaries(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- unsigned i;
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* fill the buffer from tail */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE - sizeof(CIRBUF_STR_TAIL) + 1; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* try adding a string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- > 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* try adding a string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- > 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* fill the buffer from head */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE - sizeof(CIRBUF_STR_HEAD) + 1; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* try adding a string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- > 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* try adding a string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- > 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* try to read/delete more than written */
-static int
-test_cirbuf_string_get_del_boundaries(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* read more than written (head) */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) + 1)
- != sizeof(CIRBUF_STR_HEAD)) {
- printf("Error: unexpected result when reading too much data!\n");
- return -1;
- }
- /* read more than written (tail) */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) + 1)
- != sizeof(CIRBUF_STR_HEAD)) {
- printf("Error: unexpected result when reading too much data!\n");
- return -1;
- }
- /* delete more than written (head) */
- if (cirbuf_del_buf_head(&cb, sizeof(CIRBUF_STR_HEAD) + 1) == 0) {
- printf("Error: unexpected result when deleting too much data!\n");
- return -1;
- }
- /* delete more than written (tail) */
- if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_HEAD) + 1) == 0) {
- printf("Error: unexpected result when deleting too much data!\n");
- return -1;
- }
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* add string to tail */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL))
- != (sizeof(CIRBUF_STR_TAIL))) {
- printf("Error: failed to add string to tail!\n");
- return -1;
- }
- /* read more than written (tail) */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_TAIL) + 1)
- != sizeof(CIRBUF_STR_TAIL)) {
- printf("Error: unexpected result when reading too much data!\n");
- return -1;
- }
- /* read more than written (head) */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_TAIL) + 1)
- != sizeof(CIRBUF_STR_TAIL)) {
- printf("Error: unexpected result when reading too much data!\n");
- return -1;
- }
- /* delete more than written (tail) */
- if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL) + 1) == 0) {
- printf("Error: unexpected result when deleting too much data!\n");
- return -1;
- }
- /* delete more than written (head) */
- if (cirbuf_del_buf_tail(&cb, sizeof(CIRBUF_STR_TAIL) + 1) == 0) {
- printf("Error: unexpected result when deleting too much data!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* try to read/delete less than written */
-static int
-test_cirbuf_string_get_del_partial(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
- char tmp2[CMDLINE_TEST_BUFSIZE];
-
- /* initialize buffers */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
- memset(tmp2, 0, sizeof(tmp));
-
- snprintf(tmp2, sizeof(tmp2), "%s", CIRBUF_STR_HEAD);
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* add string to head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD))
- != (sizeof(CIRBUF_STR_HEAD))) {
- printf("Error: failed to add string to head!\n");
- return -1;
- }
- /* read less than written (head) */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
- != sizeof(CIRBUF_STR_HEAD) - 1) {
- printf("Error: unexpected result when reading from head!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, tmp2, sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
- memset(tmp, 0, sizeof(tmp));
- /* read less than written (tail) */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
- != sizeof(CIRBUF_STR_HEAD) - 1) {
- printf("Error: unexpected result when reading from tail!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- /*
- * verify correct deletion
- */
-
- /* clear buffer */
- memset(tmp, 0, sizeof(tmp));
-
- /* delete less than written (head) */
- if (cirbuf_del_buf_head(&cb, 1) != 0) {
- printf("Error: delete from head failed!\n");
- return -1;
- }
- /* read from head */
- if (cirbuf_get_buf_head(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 1)
- != sizeof(CIRBUF_STR_HEAD) - 1) {
- printf("Error: unexpected result when reading from head!\n");
- return -1;
- }
- /* since we deleted from head, first char should be deleted */
- if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 1) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
- /* clear buffer */
- memset(tmp, 0, sizeof(tmp));
-
- /* delete less than written (tail) */
- if (cirbuf_del_buf_tail(&cb, 1) != 0) {
- printf("Error: delete from tail failed!\n");
- return -1;
- }
- /* read from tail */
- if (cirbuf_get_buf_tail(&cb, tmp, sizeof(CIRBUF_STR_HEAD) - 2)
- != sizeof(CIRBUF_STR_HEAD) - 2) {
- printf("Error: unexpected result when reading from head!\n");
- return -1;
- }
- /* since we deleted from tail, last char should be deleted */
- if (strncmp(tmp, &tmp2[1], sizeof(CIRBUF_STR_HEAD) - 2) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* test cmdline_cirbuf char add/del functions */
-static int
-test_cirbuf_char_add_del(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
-
- /* clear buffer */
- memset(buf, 0, sizeof(buf));
- memset(tmp, 0, sizeof(tmp));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /*
- * try to delete something from cirbuf. since it's empty,
- * these should fail.
- */
- if (cirbuf_del_head_safe(&cb) == 0) {
- printf("Error: deleting from empty cirbuf head succeeded!\n");
- return -1;
- }
- if (cirbuf_del_tail_safe(&cb) == 0) {
- printf("Error: deleting from empty cirbuf tail succeeded!\n");
- return -1;
- }
-
- /*
- * add, verify and delete. these should pass.
- */
- if (cirbuf_add_head_safe(&cb,'h') < 0) {
- printf("Error: adding to cirbuf head failed!\n");
- return -1;
- }
- if (cirbuf_get_head(&cb) != 'h') {
- printf("Error: wrong head content!\n");
- return -1;
- }
- if (cirbuf_del_head_safe(&cb) < 0) {
- printf("Error: deleting from cirbuf head failed!\n");
- return -1;
- }
- if (cirbuf_add_tail_safe(&cb,'t') < 0) {
- printf("Error: adding to cirbuf tail failed!\n");
- return -1;
- }
- if (cirbuf_get_tail(&cb) != 't') {
- printf("Error: wrong tail content!\n");
- return -1;
- }
- if (cirbuf_del_tail_safe(&cb) < 0) {
- printf("Error: deleting from cirbuf tail failed!\n");
- return -1;
- }
- /* do the same for unsafe versions. those are void. */
- cirbuf_add_head(&cb,'h');
- if (cirbuf_get_head(&cb) != 'h') {
- printf("Error: wrong head content!\n");
- return -1;
- }
- cirbuf_del_head(&cb);
-
- /* test if char has been deleted. we can't call cirbuf_get_head
- * because it's unsafe, but we can call cirbuf_get_buf_head.
- */
- if (cirbuf_get_buf_head(&cb, tmp, 1) > 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- cirbuf_add_tail(&cb,'t');
- if (cirbuf_get_tail(&cb) != 't') {
- printf("Error: wrong tail content!\n");
- return -1;
- }
- cirbuf_del_tail(&cb);
-
- /* test if char has been deleted. we can't call cirbuf_get_tail
- * because it's unsafe, but we can call cirbuf_get_buf_tail.
- */
- if (cirbuf_get_buf_tail(&cb, tmp, 1) > 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* test filling up buffer with chars */
-static int
-test_cirbuf_char_fill(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- unsigned i;
-
- /* clear buffer */
- memset(buf, 0, sizeof(buf));
-
- /*
- * initialize circular buffer
- */
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /*
- * fill the buffer from head or tail, verify contents, test boundaries
- * and clear the buffer
- */
-
- /* fill the buffer from tail */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
- cirbuf_add_tail_safe(&cb, 't');
- /* verify that contents of the buffer are what they are supposed to be */
- for (i = 0; i < sizeof(buf); i++) {
- if (buf[i] != 't') {
- printf("Error: wrong content in buffer!\n");
- return -1;
- }
- }
- /* try to add to a full buffer from tail */
- if (cirbuf_add_tail_safe(&cb, 't') == 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* try to add to a full buffer from head */
- if (cirbuf_add_head_safe(&cb, 'h') == 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* delete buffer from tail */
- for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
- cirbuf_del_tail_safe(&cb);
- /* try to delete from an empty buffer */
- if (cirbuf_del_tail_safe(&cb) >= 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- /* fill the buffer from head */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
- cirbuf_add_head_safe(&cb, 'h');
- /* verify that contents of the buffer are what they are supposed to be */
- for (i = 0; i < sizeof(buf); i++) {
- if (buf[i] != 'h') {
- printf("Error: wrong content in buffer!\n");
- return -1;
- }
- }
- /* try to add to a full buffer from head */
- if (cirbuf_add_head_safe(&cb,'h') >= 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* try to add to a full buffer from tail */
- if (cirbuf_add_tail_safe(&cb, 't') == 0) {
- printf("Error: buffer should have been full!\n");
- return -1;
- }
- /* delete buffer from head */
- for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
- cirbuf_del_head_safe(&cb);
- /* try to delete from an empty buffer */
- if (cirbuf_del_head_safe(&cb) >= 0) {
- printf("Error: buffer should have been empty!\n");
- return -1;
- }
-
- /*
- * fill the buffer from both head and tail, with alternating characters,
- * verify contents and clear the buffer
- */
-
- /* fill half of buffer from tail */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE / 2; i++)
- cirbuf_add_tail_safe(&cb, (char) (i % 2 ? 't' : 'T'));
- /* fill other half of the buffer from head */
- for (i = 0; i < CMDLINE_TEST_BUFSIZE / 2; i++)
- cirbuf_add_head_safe(&cb, (char) (i % 2 ? 'H' : 'h')); /* added in reverse */
-
- /* verify that contents of the buffer are what they are supposed to be */
- for (i = 0; i < sizeof(buf) / 2; i++) {
- if (buf[i] != (char) (i % 2 ? 't' : 'T')) {
- printf("Error: wrong content in buffer at %u!\n", i);
- return -1;
- }
- }
- for (i = sizeof(buf) / 2; i < sizeof(buf); i++) {
- if (buf[i] != (char) (i % 2 ? 'h' : 'H')) {
- printf("Error: wrong content in buffer %u!\n", i);
- return -1;
- }
- }
-
- return 0;
-}
-
-/* test left alignment */
-static int
-test_cirbuf_align_left(void)
-{
-#define HALF_OFFSET CMDLINE_TEST_BUFSIZE / 2
-#define SMALL_OFFSET HALF_OFFSET / 2
-/* resulting buffer lengths for each of the test cases */
-#define LEN1 HALF_OFFSET - SMALL_OFFSET - 1
-#define LEN2 HALF_OFFSET + SMALL_OFFSET + 2
-#define LEN3 HALF_OFFSET - SMALL_OFFSET
-#define LEN4 HALF_OFFSET + SMALL_OFFSET - 1
-
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
- unsigned i;
-
- /*
- * align left when start < end and start in left half
- */
-
- /*
- * initialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* push end into left half */
- for (i = 0; i < HALF_OFFSET - 1; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* push start into left half < end */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_del_head_safe(&cb);
-
- /* align */
- if (cirbuf_align_left(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* verify result */
- if (cb.start != 0 || cb.len != LEN1 || cb.end != cb.len - 1) {
- printf("Error: buffer alignment is wrong!\n");
- return -1;
- }
-
- /*
- * align left when start > end and start in left half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into left half */
- for (i = 0; i < HALF_OFFSET + 2; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half > start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* align */
- if (cirbuf_align_left(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* verify result */
- if (cb.start != 0 || cb.len != LEN2 || cb.end != cb.len - 1) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * align left when start < end and start in right half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into the right half */
- for (i = 0; i < HALF_OFFSET; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half > start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_del_tail_safe(&cb);
-
- /* align */
- if (cirbuf_align_left(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* verify result */
- if (cb.start != 0 || cb.len != LEN3 || cb.end != cb.len - 1) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * align left when start > end and start in right half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into the right half */
- for (i = 0; i < HALF_OFFSET - 1; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half < start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* align */
- if (cirbuf_align_left(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* verify result */
- if (cb.start != 0 || cb.len != LEN4 ||
- cb.end != cb.len - 1) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * Verify that alignment doesn't corrupt data
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* add string to tail and head */
- if (cirbuf_add_buf_head(&cb, CIRBUF_STR_HEAD,
- sizeof(CIRBUF_STR_HEAD)) < 0 || cirbuf_add_buf_tail(&cb,
- CIRBUF_STR_TAIL, sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to add strings!\n");
- return -1;
- }
-
- /* align */
- if (cirbuf_align_left(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* get string from head */
- if (cirbuf_get_buf_head(&cb, tmp,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to read string from head!\n");
- return -1;
- }
-
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- /* reset tmp buffer */
- memset(tmp, 0, sizeof(tmp));
-
- /* get string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to read string from head!\n");
- return -1;
- }
-
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* test right alignment */
-static int
-test_cirbuf_align_right(void)
-{
-#define END_OFFSET CMDLINE_TEST_BUFSIZE - 1
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
- char tmp[CMDLINE_TEST_BUFSIZE];
- unsigned i;
-
-
- /*
- * align right when start < end and start in left half
- */
-
- /*
- * initialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to initialize circular buffer!\n");
- return -1;
- }
-
- /* push end into left half */
- for (i = 0; i < HALF_OFFSET - 1; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* push start into left half < end */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_del_head_safe(&cb);
-
- /* align */
- cirbuf_align_right(&cb);
-
- /* verify result */
- if (cb.start != END_OFFSET || cb.len != LEN1 || cb.end != cb.len - 2) {
- printf("Error: buffer alignment is wrong!\n");
- return -1;
- }
-
- /*
- * align right when start > end and start in left half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into left half */
- for (i = 0; i < HALF_OFFSET + 2; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half > start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* align */
- cirbuf_align_right(&cb);
-
- /* verify result */
- if (cb.start != END_OFFSET || cb.len != LEN2 || cb.end != cb.len - 2) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * align right when start < end and start in right half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into the right half */
- for (i = 0; i < HALF_OFFSET; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half > start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_del_tail_safe(&cb);
-
- /* align */
- cirbuf_align_right(&cb);
-
- /* verify result */
- if (cb.end != END_OFFSET || cb.len != LEN3 || cb.start != cb.end - cb.len + 1) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * align right when start > end and start in right half
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* push start into the right half */
- for (i = 0; i < HALF_OFFSET - 1; i++)
- cirbuf_add_head_safe(&cb, 'h');
-
- /* push end into left half < start */
- for (i = 0; i < SMALL_OFFSET; i++)
- cirbuf_add_tail_safe(&cb, 't');
-
- /* align */
- cirbuf_align_right(&cb);
-
- /* verify result */
- if (cb.end != END_OFFSET || cb.len != LEN4 || cb.start != cb.end - cb.len + 1) {
- printf("Error: buffer alignment is wrong!");
- return -1;
- }
-
- /*
- * Verify that alignment doesn't corrupt data
- */
-
- /*
- * reinitialize circular buffer
- */
- memset(buf, 0, sizeof(buf));
- if (cirbuf_init(&cb, buf, 0, sizeof(buf)) < 0) {
- printf("Error: failed to reinitialize circular buffer!\n");
- return -1;
- }
-
- /* add string to tail and head */
- if (cirbuf_add_buf_tail(&cb, CIRBUF_STR_TAIL,
- sizeof(CIRBUF_STR_TAIL)) < 0 || cirbuf_add_buf_head(&cb,
- CIRBUF_STR_HEAD, sizeof(CIRBUF_STR_HEAD)) < 0) {
- printf("Error: failed to add strings!\n");
- return -1;
- }
-
- /* align */
- if (cirbuf_align_right(&cb) < 0) {
- printf("Error: alignment failed!\n");
- return -1;
- }
-
- /* get string from head */
- if (cirbuf_get_buf_head(&cb, tmp,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to read string from head!\n");
- return -1;
- }
-
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- /* reset tmp buffer */
- memset(tmp, 0, sizeof(tmp));
-
- /* get string from tail */
- if (cirbuf_get_buf_tail(&cb, tmp,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) < 0) {
- printf("Error: failed to read string from head!\n");
- return -1;
- }
- /* verify string */
- if (strncmp(tmp, CIRBUF_STR_HEAD "\0" CIRBUF_STR_TAIL,
- sizeof(CIRBUF_STR_HEAD) + sizeof(CIRBUF_STR_TAIL)) != 0) {
- printf("Error: strings mismatch!\n");
- return -1;
- }
-
- return 0;
-}
-
-/* call functions with invalid parameters */
-int
-test_cirbuf_invalid_param(void)
-{
- struct cirbuf cb;
- char buf[CMDLINE_TEST_BUFSIZE];
-
- /* null cirbuf */
- if (cirbuf_init(0, buf, 0, sizeof(buf)) == 0)
- return -1;
- /* null buffer */
- if (cirbuf_init(&cb, 0, 0, sizeof(buf)) == 0)
- return -1;
- /* null cirbuf */
- if (cirbuf_add_head_safe(0, 'h') == 0)
- return -1;
- if (cirbuf_add_tail_safe(0, 't') == 0)
- return -1;
- if (cirbuf_del_head_safe(0) == 0)
- return -1;
- if (cirbuf_del_tail_safe(0) == 0)
- return -1;
- /* null buffer */
- if (cirbuf_add_buf_head(&cb, 0, 0) == 0)
- return -1;
- if (cirbuf_add_buf_tail(&cb, 0, 0) == 0)
- return -1;
- /* null cirbuf */
- if (cirbuf_add_buf_head(0, buf, 0) == 0)
- return -1;
- if (cirbuf_add_buf_tail(0, buf, 0) == 0)
- return -1;
- /* null size */
- if (cirbuf_add_buf_head(&cb, buf, 0) == 0)
- return -1;
- if (cirbuf_add_buf_tail(&cb, buf, 0) == 0)
- return -1;
- /* null cirbuf */
- if (cirbuf_del_buf_head(0, 0) == 0)
- return -1;
- if (cirbuf_del_buf_tail(0, 0) == 0)
- return -1;
- /* null size */
- if (cirbuf_del_buf_head(&cb, 0) == 0)
- return -1;
- if (cirbuf_del_buf_tail(&cb, 0) == 0)
- return -1;
- /* null cirbuf */
- if (cirbuf_get_buf_head(0, 0, 0) == 0)
- return -1;
- if (cirbuf_get_buf_tail(0, 0, 0) == 0)
- return -1;
- /* null buffer */
- if (cirbuf_get_buf_head(&cb, 0, 0) == 0)
- return -1;
- if (cirbuf_get_buf_tail(&cb, 0, 0) == 0)
- return -1;
- /* null size, this is valid but should return 0 */
- if (cirbuf_get_buf_head(&cb, buf, 0) != 0)
- return -1;
- if (cirbuf_get_buf_tail(&cb, buf, 0) != 0)
- return -1;
- /* null cirbuf */
- if (cirbuf_align_left(0) == 0)
- return -1;
- if (cirbuf_align_right(0) == 0)
- return -1;
-
- return 0;
-}
-
-/* test cmdline_cirbuf char functions */
-int
-test_cirbuf_char(void)
-{
- int ret;
-
- ret = test_cirbuf_char_add_del();
- if (ret < 0)
- return -1;
-
- ret = test_cirbuf_char_fill();
- if (ret < 0)
- return -1;
-
- return 0;
-}
-
-/* test cmdline_cirbuf string functions */
-int
-test_cirbuf_string(void)
-{
- if (test_cirbuf_string_add_del() < 0)
- return -1;
-
- if (test_cirbuf_string_add_del_reverse() < 0)
- return -1;
-
- if (test_cirbuf_string_add_boundaries() < 0)
- return -1;
-
- if (test_cirbuf_string_get_del_boundaries() < 0)
- return -1;
-
- if (test_cirbuf_string_get_del_partial() < 0)
- return -1;
-
- if (test_cirbuf_string_misc() < 0)
- return -1;
-
- return 0;
-}
-
-/* test cmdline_cirbuf align functions */
-int
-test_cirbuf_align(void)
-{
- if (test_cirbuf_align_left() < 0)
- return -1;
- if (test_cirbuf_align_right() < 0)
- return -1;
- return 0;
-}
diff --git a/test/test/test_cmdline_lib.c b/test/test/test_cmdline_lib.c
index 65b823a..93a80d0 100644
--- a/test/test/test_cmdline_lib.c
+++ b/test/test/test_cmdline_lib.c
@@ -41,8 +41,6 @@
#include <ctype.h>
#include <sys/queue.h>
-#include <cmdline_vt100.h>
-#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_socket.h>
#include <cmdline.h>
@@ -50,113 +48,41 @@
#include "test_cmdline.h"
/****************************************************************/
-/* static functions required for some tests */
-static void
-valid_buffer(__attribute__((unused))struct rdline *rdl,
- __attribute__((unused))const char *buf,
- __attribute__((unused)) unsigned int size)
-{
-}
-
-static int
-complete_buffer(__attribute__((unused)) struct rdline *rdl,
- __attribute__((unused)) const char *buf,
- __attribute__((unused)) char *dstbuf,
- __attribute__((unused)) unsigned int dstsize,
- __attribute__((unused)) int *state)
-{
- return 0;
-}
-
-/****************************************************************/
static int
test_cmdline_parse_fns(void)
{
- struct cmdline cl;
+ struct cmdline *cl;
int i = 0;
char dst[CMDLINE_TEST_BUFSIZE];
+ cl = cmdline_new(NULL, "prompt", 0, 1);
+ if (!cl)
+ goto error;
if (cmdline_parse(NULL, "buffer") >= 0)
goto error;
- if (cmdline_parse(&cl, NULL) >= 0)
+ if (cmdline_parse(cl, NULL) >= 0)
goto error;
if (cmdline_complete(NULL, "buffer", &i, dst, sizeof(dst)) >= 0)
goto error;
- if (cmdline_complete(&cl, NULL, &i, dst, sizeof(dst)) >= 0)
+ if (cmdline_complete(cl, NULL, &i, dst, sizeof(dst)) >= 0)
goto error;
- if (cmdline_complete(&cl, "buffer", NULL, dst, sizeof(dst)) >= 0)
+ if (cmdline_complete(cl, "buffer", NULL, dst, sizeof(dst)) >= 0)
goto error;
- if (cmdline_complete(&cl, "buffer", &i, NULL, sizeof(dst)) >= 0)
+ if (cmdline_complete(cl, "buffer", &i, NULL, sizeof(dst)) >= 0)
goto error;
return 0;
error:
+ if (cl)
+ cmdline_free(cl);
printf("Error: function accepted null parameter!\n");
return -1;
}
static int
-test_cmdline_rdline_fns(void)
-{
- struct rdline rdl;
- rdline_write_char_t *wc = &cmdline_write_char;
- rdline_validate_t *v = &valid_buffer;
- rdline_complete_t *c = &complete_buffer;
-
- if (rdline_init(NULL, wc, v, c) >= 0)
- goto error;
- if (rdline_init(&rdl, NULL, v, c) >= 0)
- goto error;
- if (rdline_init(&rdl, wc, NULL, c) >= 0)
- goto error;
- if (rdline_init(&rdl, wc, v, NULL) >= 0)
- goto error;
- if (rdline_char_in(NULL, 0) >= 0)
- goto error;
- if (rdline_get_buffer(NULL) != NULL)
- goto error;
- if (rdline_add_history(NULL, "history") >= 0)
- goto error;
- if (rdline_add_history(&rdl, NULL) >= 0)
- goto error;
- if (rdline_get_history_item(NULL, 0) != NULL)
- goto error;
-
- /* void functions */
- rdline_newline(NULL, "prompt");
- rdline_newline(&rdl, NULL);
- rdline_stop(NULL);
- rdline_quit(NULL);
- rdline_restart(NULL);
- rdline_redisplay(NULL);
- rdline_reset(NULL);
- rdline_clear_history(NULL);
-
- return 0;
-
-error:
- printf("Error: function accepted null parameter!\n");
- return -1;
-}
-
-static int
-test_cmdline_vt100_fns(void)
-{
- if (vt100_parser(NULL, 0) >= 0) {
- printf("Error: function accepted null parameter!\n");
- return -1;
- }
-
- /* void functions */
- vt100_init(NULL);
-
- return 0;
-}
-
-static int
test_cmdline_socket_fns(void)
{
cmdline_parse_ctx_t ctx;
@@ -193,7 +119,7 @@ static int
test_cmdline_fns(void)
{
cmdline_parse_ctx_t ctx;
- struct cmdline cl, *tmp;
+ struct cmdline *tmp;
memset(&ctx, 0, sizeof(ctx));
tmp = cmdline_new(&ctx, "test", -1, -1);
@@ -206,10 +132,6 @@ test_cmdline_fns(void)
goto error;
if (cmdline_in(NULL, "buffer", CMDLINE_TEST_BUFSIZE) >= 0)
goto error;
- if (cmdline_in(&cl, NULL, CMDLINE_TEST_BUFSIZE) >= 0)
- goto error;
- if (cmdline_write_char(NULL, 0) >= 0)
- goto error;
/* void functions */
cmdline_set_prompt(NULL, "prompt");
@@ -220,16 +142,6 @@ test_cmdline_fns(void)
cmdline_interact(NULL);
cmdline_quit(NULL);
- /* check if void calls change anything when they should fail */
- cl = *tmp;
-
- cmdline_printf(&cl, NULL);
- if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
- cmdline_set_prompt(&cl, NULL);
- if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
- cmdline_in(&cl, NULL, CMDLINE_TEST_BUFSIZE);
- if (memcmp(&cl, tmp, sizeof(cl))) goto mismatch;
-
cmdline_free(tmp);
return 0;
@@ -237,9 +149,6 @@ test_cmdline_fns(void)
error:
printf("Error: function accepted null parameter!\n");
return -1;
-mismatch:
- printf("Error: data changed!\n");
- return -1;
}
/* test library functions. the point of these tests is not so much to test
@@ -251,10 +160,6 @@ test_cmdline_lib(void)
{
if (test_cmdline_parse_fns() < 0)
return -1;
- if (test_cmdline_rdline_fns() < 0)
- return -1;
- if (test_cmdline_vt100_fns() < 0)
- return -1;
if (test_cmdline_socket_fns() < 0)
return -1;
if (test_cmdline_fns() < 0)
--
2.1.4
^ permalink raw reply [relevance 1%]
* Re: [dpdk-dev] [PATCH] doc: update ABI/API policy
2017-11-06 11:28 28% [dpdk-dev] [PATCH] doc: update ABI/API policy Bruce Richardson
2017-11-06 14:48 4% ` Mcnamara, John
2017-11-07 6:05 4% ` Yuanhan Liu
@ 2017-11-08 19:09 4% ` Kevin Traynor
2 siblings, 0 replies; 200+ results
From: Kevin Traynor @ 2017-11-08 19:09 UTC (permalink / raw)
To: Bruce Richardson, john.mcnamara; +Cc: dev
On 11/06/2017 11:28 AM, Bruce Richardson wrote:
> Following agreement at the DPDK Technical Board meeting of 2017-10-13 [1],
> update the documentation with the ABI/API policy changes.
>
> [1] http://dpdk.org/ml/archives/dev/2017-October/079961.html
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH] doc: postpone devargs clean-up
@ 2017-11-08 9:53 16% Gaetan Rivet
0 siblings, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-11-08 9:53 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
These changes were planned for 17.11 but were proposed too late.
Postpone those to v18.02 instead.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
The related series:
[PATCH v2 00/18] devargs cleanup
http://dpdk.org/ml/archives/dev/2017-October/078761.html
doc/guides/rel_notes/deprecation.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 7fcebf1..a89a394 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,14 +8,14 @@ API and ABI deprecation notices are to be posted here.
Deprecation Notices
-------------------
-* eal: several API and ABI changes are planned for ``rte_devargs`` in v17.11.
+* eal: several API and ABI changes are planned for ``rte_devargs`` in v18.02.
The format of device command line parameters will change. The bus will need
to be explicitly stated in the device declaration. The enum ``rte_devtype``
was used to identify a bus and will disappear.
The structure ``rte_devargs`` will change.
The ``rte_devargs_list`` will be made private.
The following functions are deprecated starting from 17.08 and will either be
- modified or removed in 17.11:
+ modified or removed in 18.02:
- ``rte_eal_devargs_add``
- ``rte_eal_devargs_type_count``
--
2.1.4
^ permalink raw reply [relevance 16%]
* Re: [dpdk-dev] [PATCH v2] doc: update release notes for rte_security
2017-11-07 6:44 8% ` [dpdk-dev] [PATCH v2] " Akhil Goyal
@ 2017-11-08 1:07 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-08 1:07 UTC (permalink / raw)
To: Akhil Goyal
Cc: dev, declan.doherty, pablo.de.lara.guarch, hemant.agrawal,
radu.nicolau, borisp, aviadye, jerin.jacob, john.mcnamara,
konstantin.ananyev
07/11/2017 07:44, Akhil Goyal:
> Removed the deprication notice for ABI breakage and updated
> release notes for rte_security.
>
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Applied, thanks
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v5] devtools: rework abi checker script
2017-10-05 7:53 27% ` [dpdk-dev] [PATCH v5] " Olivier Matz
2017-10-05 13:15 4% ` Neil Horman
@ 2017-11-07 23:24 4% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-07 23:24 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, nhorman, bruce.richardson
05/10/2017 09:53, Olivier Matz:
> The initial version of the script had some limitations:
> - cannot work on a non-clean workspace
> - environment variables are not documented
> - no compilation log in case of failure
> - return success even it abi is incompatible
>
> This patch addresses these issues and rework the code.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
Applied, thanks
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v12 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-11-07 6:54 4% ` [dpdk-dev] [PATCH v12 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-11-07 6:54 1% ` Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-11-07 6:54 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
config/common_base | 5 +
doc/guides/rel_notes/release_17_11.rst | 9 +
drivers/bus/Makefile | 2 +
drivers/bus/vdev/Makefile | 57 +++++
drivers/bus/vdev/rte_bus_vdev.h | 153 +++++++++++++
drivers/bus/vdev/rte_bus_vdev_version.map | 8 +
drivers/bus/vdev/vdev.c | 344 ++++++++++++++++++++++++++++
drivers/crypto/aesni_gcm/Makefile | 1 +
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +-
drivers/crypto/aesni_mb/Makefile | 1 +
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 +-
drivers/crypto/armv8/Makefile | 1 +
drivers/crypto/armv8/rte_armv8_pmd.c | 2 +-
drivers/crypto/kasumi/Makefile | 1 +
drivers/crypto/kasumi/rte_kasumi_pmd.c | 2 +-
drivers/crypto/mrvl/Makefile | 1 +
drivers/crypto/mrvl/rte_mrvl_pmd.c | 2 +-
drivers/crypto/null/Makefile | 1 +
drivers/crypto/null/null_crypto_pmd.c | 2 +-
drivers/crypto/openssl/Makefile | 1 +
drivers/crypto/openssl/rte_openssl_pmd.c | 2 +-
drivers/crypto/scheduler/Makefile | 1 +
drivers/crypto/scheduler/scheduler_pmd.c | 2 +-
drivers/crypto/snow3g/Makefile | 1 +
drivers/crypto/snow3g/rte_snow3g_pmd.c | 2 +-
drivers/crypto/zuc/Makefile | 1 +
drivers/crypto/zuc/rte_zuc_pmd.c | 2 +-
drivers/event/dpaa2/Makefile | 1 +
drivers/event/dpaa2/dpaa2_eventdev.c | 2 +-
drivers/event/octeontx/Makefile | 1 +
drivers/event/octeontx/ssovf_evdev.c | 2 +-
drivers/event/skeleton/Makefile | 1 +
drivers/event/skeleton/skeleton_eventdev.c | 2 +-
drivers/event/sw/Makefile | 1 +
drivers/event/sw/sw_evdev.c | 2 +-
drivers/net/af_packet/Makefile | 1 +
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/Makefile | 1 +
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/failsafe/Makefile | 1 +
drivers/net/failsafe/failsafe.c | 2 +-
drivers/net/kni/Makefile | 1 +
drivers/net/kni/rte_eth_kni.c | 2 +-
drivers/net/mrvl/Makefile | 1 +
drivers/net/mrvl/mrvl_ethdev.c | 2 +-
drivers/net/null/Makefile | 1 +
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/octeontx/Makefile | 1 +
drivers/net/octeontx/octeontx_ethdev.c | 2 +-
drivers/net/pcap/Makefile | 1 +
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/Makefile | 1 +
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/softnic/Makefile | 1 +
drivers/net/softnic/rte_eth_softnic.c | 2 +-
drivers/net/tap/Makefile | 1 +
drivers/net/tap/rte_eth_tap.c | 2 +-
drivers/net/vhost/Makefile | 1 +
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/Makefile | 3 +
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 -
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_vdev.c | 342 ---------------------------
lib/librte_eal/common/include/rte_dev.h | 24 +-
lib/librte_eal/common/include/rte_vdev.h | 131 -----------
lib/librte_eal/linuxapp/eal/Makefile | 1 -
lib/librte_eal/rte_eal_version.map | 4 -
lib/librte_ether/rte_ethdev_vdev.h | 2 +-
lib/librte_eventdev/rte_eventdev_pmd_vdev.h | 2 +-
mk/rte.app.mk | 1 +
test/test/test_cryptodev.c | 1 +
test/test/test_event_eth_rx_adapter.c | 1 +
test/test/test_eventdev.c | 1 +
test/test/test_eventdev_octeontx.c | 1 +
test/test/test_eventdev_sw.c | 1 +
| 1 +
78 files changed, 646 insertions(+), 533 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev.h
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/vdev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/config/common_base b/config/common_base
index 82ee754..9ae5ec3 100644
--- a/config/common_base
+++ b/config/common_base
@@ -158,6 +158,11 @@ CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n
CONFIG_RTE_LIBRTE_PCI_BUS=y
#
+# Compile the vdev bus
+#
+CONFIG_RTE_LIBRTE_VDEV_BUS=y
+
+#
# Compile burst-oriented Amazon ENA PMD driver
#
CONFIG_RTE_LIBRTE_ENA_PMD=y
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 158a9ca..714234a 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -434,6 +434,14 @@ API Changes
* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+* **Moved vdev bus APIs outside of the EAL**
+
+ Moved the following APIs from ``librte_eal`` to ``librte_bus_vdev``:
+ * ``rte_vdev_init``
+ * ``rte_vdev_register``
+ * ``rte_vdev_uninit``
+ * ``rte_vdev_unregister``
+
ABI Changes
-----------
@@ -489,6 +497,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_acl.so.2
+ librte_bitratestats.so.2
+ + librte_bus_vdev.so.1
librte_cfgfile.so.2
librte_cmdline.so.2
+ librte_cryptodev.so.4
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index e3fbc50..d9fe4c4 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -34,4 +34,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile
new file mode 100644
index 0000000..84bd724
--- /dev/null
+++ b/drivers/bus/vdev/Makefile
@@ -0,0 +1,57 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_bus_vdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# versioning export map
+EXPORT_MAP := rte_bus_vdev_version.map
+
+# library version
+LIBABIVER := 1
+
+SRCS-y += vdev.c
+
+LDLIBS += -lrte_eal
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_bus_vdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
new file mode 100644
index 0000000..41762b8
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -0,0 +1,153 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
+ struct rte_device device; /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.name)
+ return dev->device.name;
+ return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.devargs)
+ return dev->device.devargs->args;
+ return "";
+}
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_probe_t *probe; /**< Virtual device probe function. */
+ rte_vdev_remove_t *remove; /**< Virtual device remove function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static const char *vdrvinit_ ## nm ## _alias;\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+ rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+/**
+ * Initialize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @param args
+ * The pointer to arguments used by driver initialization.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_init(const char *name, const char *args);
+
+/**
+ * Uninitalize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_uninit(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/bus/vdev/rte_bus_vdev_version.map b/drivers/bus/vdev/rte_bus_vdev_version.map
new file mode 100644
index 0000000..6ccb789
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev_version.map
@@ -0,0 +1,8 @@
+DPDK_17.11 {
+ global:
+
+ rte_vdev_init;
+ rte_vdev_register;
+ rte_vdev_uninit;
+ rte_vdev_unregister;
+};
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
new file mode 100644
index 0000000..04ed49b
--- /dev/null
+++ b/drivers/bus/vdev/vdev.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/queue.h>
+
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_bus.h>
+#include <rte_common.h>
+#include <rte_devargs.h>
+#include <rte_memory.h>
+#include <rte_errno.h>
+
+#include "rte_bus_vdev.h"
+
+/* Forward declare to access virtual bus name */
+static struct rte_bus rte_vdev_bus;
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+ TAILQ_HEAD_INITIALIZER(vdev_device_list);
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_vdev_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_vdev_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+static int
+vdev_parse(const char *name, void *addr)
+{
+ struct rte_vdev_driver **out = addr;
+ struct rte_vdev_driver *driver = NULL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)) == 0)
+ break;
+ if (driver->driver.alias &&
+ strncmp(driver->driver.alias, name,
+ strlen(driver->driver.alias)) == 0)
+ break;
+ }
+ if (driver != NULL &&
+ addr != NULL)
+ *out = driver;
+ return driver == NULL;
+}
+
+static int
+vdev_probe_all_drivers(struct rte_vdev_device *dev)
+{
+ const char *name;
+ struct rte_vdev_driver *driver;
+ int ret;
+
+ name = rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
+
+ if (vdev_parse(name, &driver))
+ return -1;
+ dev->device.driver = &driver->driver;
+ ret = driver->probe(dev);
+ if (ret)
+ dev->device.driver = NULL;
+ return ret;
+}
+
+static struct rte_vdev_device *
+find_vdev(const char *name)
+{
+ struct rte_vdev_device *dev;
+
+ if (!name)
+ return NULL;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ const char *devname = rte_vdev_device_name(dev);
+
+ if (!strncmp(devname, name, strlen(name)))
+ return dev;
+ }
+
+ return NULL;
+}
+
+static struct rte_devargs *
+alloc_devargs(const char *name, const char *args)
+{
+ struct rte_devargs *devargs;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ return NULL;
+
+ devargs->bus = &rte_vdev_bus;
+ if (args)
+ devargs->args = strdup(args);
+ else
+ devargs->args = strdup("");
+
+ ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
+ free(devargs->args);
+ free(devargs);
+ return NULL;
+ }
+
+ return devargs;
+}
+
+int
+rte_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (dev)
+ return -EEXIST;
+
+ devargs = alloc_devargs(name, args);
+ if (!devargs)
+ return -ENOMEM;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ ret = vdev_probe_all_drivers(dev);
+ if (ret) {
+ if (ret > 0)
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ goto fail;
+ }
+
+ TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ return 0;
+
+fail:
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return ret;
+}
+
+static int
+vdev_remove_driver(struct rte_vdev_device *dev)
+{
+ const char *name = rte_vdev_device_name(dev);
+ const struct rte_vdev_driver *driver;
+
+ if (!dev->device.driver) {
+ RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
+ return 1;
+ }
+
+ driver = container_of(dev->device.driver, const struct rte_vdev_driver,
+ driver);
+ return driver->remove(dev);
+}
+
+int
+rte_vdev_uninit(const char *name)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (!dev)
+ return -ENOENT;
+
+ devargs = dev->device.devargs;
+
+ ret = vdev_remove_driver(dev);
+ if (ret)
+ return ret;
+
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
+
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return 0;
+}
+
+static int
+vdev_scan(void)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+
+ /* for virtual devices we scan the devargs_list populated via cmdline */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->bus != &rte_vdev_bus)
+ continue;
+
+ dev = find_vdev(devargs->name);
+ if (dev)
+ continue;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev)
+ return -1;
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ }
+
+ return 0;
+}
+
+static int
+vdev_probe(void)
+{
+ struct rte_vdev_device *dev;
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+
+ if (dev->device.driver)
+ continue;
+
+ if (vdev_probe_all_drivers(dev)) {
+ RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
+ rte_vdev_device_name(dev));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static struct rte_device *
+vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+ const void *data)
+{
+ struct rte_vdev_device *dev;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ if (start && &dev->device == start) {
+ start = NULL;
+ continue;
+ }
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
+static int
+vdev_plug(struct rte_device *dev)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+static int
+vdev_unplug(struct rte_device *dev)
+{
+ return rte_vdev_uninit(dev->name);
+}
+
+static struct rte_bus rte_vdev_bus = {
+ .scan = vdev_scan,
+ .probe = vdev_probe,
+ .find_device = vdev_find_device,
+ .plug = vdev_plug,
+ .unplug = vdev_unplug,
+ .parse = vdev_parse,
+};
+
+RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index 44979a4..ddfec4c 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -55,6 +55,7 @@ CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)/include
LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm_pmd.c
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 444cfa2..08dcacc 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_byteorder.h>
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index 7c7e970..a49f06f 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -55,6 +55,7 @@ CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)/include
LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index a589557..7004389 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index 8bf60e2..79c260f 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -59,6 +59,7 @@ CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)/asm/include
LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd.c
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 2d2f3ff..97719f2 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index b9daf45..cf56b7a 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -56,6 +56,7 @@ CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index b677e54..f5db5e3 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/mrvl/Makefile b/drivers/crypto/mrvl/Makefile
index abf4035..3532f7c 100644
--- a/drivers/crypto/mrvl/Makefile
+++ b/drivers/crypto/mrvl/Makefile
@@ -57,6 +57,7 @@ EXPORT_MAP := rte_mrvl_pmd_version.map
# external library dependencies
LDLIBS += -L$(LIBMUSDK_PATH)/lib -lmusdk
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO) += rte_mrvl_pmd.c
diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
index f778a80..31f3fe5 100644
--- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
+++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index b368161..49ada09 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -39,6 +39,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library version
LIBABIVER := 1
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 3f2a90d..f031d3b 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -32,7 +32,7 @@
#include <rte_common.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 85e5d87..1a00643 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -47,6 +47,7 @@ EXPORT_MAP := rte_pmd_openssl_version.map
LDLIBS += -lcrypto
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 25c1154..06e1a6d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/scheduler/Makefile b/drivers/crypto/scheduler/Makefile
index b1a468e..123b0f6 100644
--- a/drivers/crypto/scheduler/Makefile
+++ b/drivers/crypto/scheduler/Makefile
@@ -38,6 +38,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev -lrte_kvargs -lrte_reorder
+LDLIBS += -lrte_bus_vdev
# library version
LIBABIVER := 1
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 40ab304..acdf636 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,7 +33,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_reorder.h>
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index 1fb0571..183c6ce 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -56,6 +56,7 @@ CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 094ddc4..4cc9a94 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index 9d03cf0..af77bc8 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -56,6 +56,7 @@ CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 5c1f71f..590224b 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index d268e33..f34eebf 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -46,6 +46,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
LDLIBS += -lrte_eal -lrte_eventdev -lrte_bus_fslmc -lrte_pmd_dpaa2
+LDLIBS += -lrte_bus_vdev
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index a23c734..eeeb231 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -51,7 +51,7 @@
#include <rte_memcpy.h>
#include <rte_memory.h>
#include <rte_pci.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_ethdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
index ae901a3..fdf1b73 100644
--- a/drivers/event/octeontx/Makefile
+++ b/drivers/event/octeontx/Makefile
@@ -43,6 +43,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/
LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index ca866ea..117b145 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -42,7 +42,7 @@
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_memory.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "ssovf_evdev.h"
diff --git a/drivers/event/skeleton/Makefile b/drivers/event/skeleton/Makefile
index 65e1641..a24738b 100644
--- a/drivers/event/skeleton/Makefile
+++ b/drivers/event/skeleton/Makefile
@@ -40,6 +40,7 @@ LIB = librte_pmd_skeleton_event.a
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_eventdev
LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_skeleton_event_version.map
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index a014dcf..bb554c3 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -46,7 +46,7 @@
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_lcore.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "skeleton_eventdev.h"
diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile
index 61a108c..2f2b67b 100644
--- a/drivers/event/sw/Makefile
+++ b/drivers/event/sw/Makefile
@@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers
endif
endif
LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring
+LDLIBS += -lrte_bus_vdev
# library version
LIBABIVER := 1
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index 1ba0fb6..fd11079 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -33,7 +33,7 @@
#include <inttypes.h>
#include <string.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_ring.h>
#include <rte_errno.h>
diff --git a/drivers/net/af_packet/Makefile b/drivers/net/af_packet/Makefile
index b97c2a6..bb37d67 100644
--- a/drivers/net/af_packet/Makefile
+++ b/drivers/net/af_packet/Makefile
@@ -46,6 +46,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vdev
#
# all source are stored in SRCS-y
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 28e6a94..fa84eb9 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -41,7 +41,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index b86b240..dea1bd5 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -41,6 +41,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cmdline
LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_bond_version.map
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 8c602f8..980e636 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -37,7 +37,7 @@
#include <rte_malloc.h>
#include <rte_ethdev.h>
#include <rte_tcp.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 53d8e98..fe23289 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -43,7 +43,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
diff --git a/drivers/net/failsafe/Makefile b/drivers/net/failsafe/Makefile
index e533d54..ea2a8fe 100644
--- a/drivers/net/failsafe/Makefile
+++ b/drivers/net/failsafe/Makefile
@@ -60,5 +60,6 @@ CFLAGS += -Wno-strict-prototypes
CFLAGS += -pedantic
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vdev
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 6006bef..6bc5aba 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -37,7 +37,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "failsafe_private.h"
diff --git a/drivers/net/kni/Makefile b/drivers/net/kni/Makefile
index 00d099f..a3f51f9 100644
--- a/drivers/net/kni/Makefile
+++ b/drivers/net/kni/Makefile
@@ -40,6 +40,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lpthread
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_kni
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_kni_version.map
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index d68ff7a..36e90fd 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -40,7 +40,7 @@
#include <rte_kni.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
/* Only single queue supported */
#define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/mrvl/Makefile b/drivers/net/mrvl/Makefile
index a313055..815c3ba 100644
--- a/drivers/net/mrvl/Makefile
+++ b/drivers/net/mrvl/Makefile
@@ -59,6 +59,7 @@ LDLIBS += -L$(LIBMUSDK_PATH)/lib
LDLIBS += -lmusdk
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
+LDLIBS += -lrte_bus_vdev
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) += mrvl_ethdev.c
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index a897ba0..2936165 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -36,7 +36,7 @@
#include <rte_kvargs.h>
#include <rte_log.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
/* Unluckily, container_of is defined by both DPDK and MUSDK,
* we'll declare only one version.
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index c2404f4..9331cca 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_null_version.map
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 3433c9c..032c30e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -36,7 +36,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile
index 078fcd4..9c27fdf 100644
--- a/drivers/net/octeontx/Makefile
+++ b/drivers/net/octeontx/Makefile
@@ -74,5 +74,6 @@ LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_mempool_octeontx
LDLIBS += -lrte_eventdev
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 86de5d1..bd24ec3 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -44,7 +44,7 @@
#include <rte_kvargs.h>
#include <rte_malloc.h>
#include <rte_prefetch.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "octeontx_ethdev.h"
#include "octeontx_rxtx.h"
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 9ea9670..b6487d4 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -42,6 +42,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lpcap
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_pcap_version.map
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 3205df8..f683d3a 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -44,7 +44,7 @@
#include <rte_kvargs.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#define RTE_ETH_PCAP_SNAPSHOT_LEN 65535
#define RTE_ETH_PCAP_SNAPLEN ETHER_MAX_JUMBO_FRAME_LEN
diff --git a/drivers/net/ring/Makefile b/drivers/net/ring/Makefile
index 9edd7d5..085ffa5 100644
--- a/drivers/net/ring/Makefile
+++ b/drivers/net/ring/Makefile
@@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_ring_version.map
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 76355a1..a73c631 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -37,7 +37,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
diff --git a/drivers/net/softnic/Makefile b/drivers/net/softnic/Makefile
index 4b15f00..09ed62e 100644
--- a/drivers/net/softnic/Makefile
+++ b/drivers/net/softnic/Makefile
@@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_sched
+LDLIBS += -lrte_bus_vdev
EXPORT_MAP := rte_pmd_eth_softnic_version.map
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index abb617a..3e47c2f 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -38,7 +38,7 @@
#include <rte_ethdev.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
#include <rte_ring.h>
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index b5c5a35..405b49e 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -45,6 +45,7 @@ CFLAGS += -I.
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
+LDLIBS += -lrte_bus_vdev
#
# all source are stored in SRCS-y
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 64dd3b0..6b27679 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -39,7 +39,7 @@
#include <rte_ethdev.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_net.h>
#include <rte_debug.h>
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 1085a52..c411745 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -39,6 +39,7 @@ LIB = librte_pmd_vhost.a
LDLIBS += -lpthread
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_vhost
+LDLIBS += -lrte_bus_vdev
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index f98c980..53f61f0 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -39,7 +39,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_vhost.h>
#include <rte_spinlock.h>
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 32e99da..f2b5d1c 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
+ifeq ($(CONFIG_RTE_VIRTIO_USER),y)
+LDLIBS += -lrte_bus_vdev
+endif
EXPORT_MAP := rte_pmd_virtio_version.map
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 0cfa27b..7be57ce 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -40,7 +40,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
#include <rte_ethdev_vdev.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_alarm.h>
#include "virtio_ethdev.h"
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index eb94f3e..afa117d 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -67,7 +67,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 16a2f26..9effd0d 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
INC += rte_service.h rte_service_component.h
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index f7e547a..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/queue.h>
-
-#include <rte_eal.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
-#include <rte_vdev.h>
-#include <rte_common.h>
-#include <rte_devargs.h>
-#include <rte_memory.h>
-#include <rte_errno.h>
-
-/* Forward declare to access virtual bus name */
-static struct rte_bus rte_vdev_bus;
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
-
-static struct vdev_device_list vdev_device_list =
- TAILQ_HEAD_INITIALIZER(vdev_device_list);
-struct vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_vdev_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_vdev_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-static int
-vdev_parse(const char *name, void *addr)
-{
- struct rte_vdev_driver **out = addr;
- struct rte_vdev_driver *driver = NULL;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (strncmp(driver->driver.name, name,
- strlen(driver->driver.name)) == 0)
- break;
- if (driver->driver.alias &&
- strncmp(driver->driver.alias, name,
- strlen(driver->driver.alias)) == 0)
- break;
- }
- if (driver != NULL &&
- addr != NULL)
- *out = driver;
- return driver == NULL;
-}
-
-static int
-vdev_probe_all_drivers(struct rte_vdev_device *dev)
-{
- const char *name;
- struct rte_vdev_driver *driver;
- int ret;
-
- name = rte_vdev_device_name(dev);
-
- RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
- rte_vdev_device_name(dev));
-
- if (vdev_parse(name, &driver))
- return -1;
- dev->device.driver = &driver->driver;
- ret = driver->probe(dev);
- if (ret)
- dev->device.driver = NULL;
- return ret;
-}
-
-static struct rte_vdev_device *
-find_vdev(const char *name)
-{
- struct rte_vdev_device *dev;
-
- if (!name)
- return NULL;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- const char *devname = rte_vdev_device_name(dev);
- if (!strncmp(devname, name, strlen(name)))
- return dev;
- }
-
- return NULL;
-}
-
-static struct rte_devargs *
-alloc_devargs(const char *name, const char *args)
-{
- struct rte_devargs *devargs;
- int ret;
-
- devargs = calloc(1, sizeof(*devargs));
- if (!devargs)
- return NULL;
-
- devargs->bus = &rte_vdev_bus;
- if (args)
- devargs->args = strdup(args);
- else
- devargs->args = strdup("");
-
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
- if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
- free(devargs->args);
- free(devargs);
- return NULL;
- }
-
- return devargs;
-}
-
-int
-rte_vdev_init(const char *name, const char *args)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (dev)
- return -EEXIST;
-
- devargs = alloc_devargs(name, args);
- if (!devargs)
- return -ENOMEM;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
- ret = -ENOMEM;
- goto fail;
- }
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- ret = vdev_probe_all_drivers(dev);
- if (ret) {
- if (ret > 0)
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- goto fail;
- }
-
- TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- return 0;
-
-fail:
- free(devargs->args);
- free(devargs);
- free(dev);
- return ret;
-}
-
-static int
-vdev_remove_driver(struct rte_vdev_device *dev)
-{
- const char *name = rte_vdev_device_name(dev);
- const struct rte_vdev_driver *driver;
-
- if (!dev->device.driver) {
- RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
- return 1;
- }
-
- driver = container_of(dev->device.driver, const struct rte_vdev_driver,
- driver);
- return driver->remove(dev);
-}
-
-int
-rte_vdev_uninit(const char *name)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (!dev)
- return -ENOENT;
-
- devargs = dev->device.devargs;
-
- ret = vdev_remove_driver(dev);
- if (ret)
- return ret;
-
- TAILQ_REMOVE(&vdev_device_list, dev, next);
-
- TAILQ_REMOVE(&devargs_list, devargs, next);
-
- free(devargs->args);
- free(devargs);
- free(dev);
- return 0;
-}
-
-static int
-vdev_scan(void)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
-
- /* for virtual devices we scan the devargs_list populated via cmdline */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->bus != &rte_vdev_bus)
- continue;
-
- dev = find_vdev(devargs->name);
- if (dev)
- continue;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev)
- return -1;
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- }
-
- return 0;
-}
-
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
-
- if (dev->device.driver)
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
- RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
- rte_vdev_device_name(dev));
- return -1;
- }
- }
-
- return 0;
-}
-
-static struct rte_device *
-vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
- const void *data)
-{
- struct rte_vdev_device *dev;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- if (start && &dev->device == start) {
- start = NULL;
- continue;
- }
- if (cmp(&dev->device, data) == 0)
- return &dev->device;
- }
- return NULL;
-}
-
-static int
-vdev_plug(struct rte_device *dev)
-{
- return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
-}
-
-static int
-vdev_unplug(struct rte_device *dev)
-{
- return rte_vdev_uninit(dev->name);
-}
-
-static struct rte_bus rte_vdev_bus = {
- .scan = vdev_scan,
- .probe = vdev_probe,
- .find_device = vdev_find_device,
- .plug = vdev_plug,
- .unplug = vdev_unplug,
- .parse = vdev_parse,
-};
-
-RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index c3f7246..9342e0c 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -169,28 +169,6 @@ struct rte_device {
};
/**
- * Initialize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @param args
- * The pointer to arguments used by driver initialization.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_init(const char *name, const char *args);
-
-/**
- * Uninitalize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_uninit(const char *name);
-
-/**
* Attach a device to a registered driver.
*
* @param name
@@ -315,4 +293,4 @@ __attribute__((used)) = str
}
#endif
-#endif /* _RTE_VDEV_H_ */
+#endif /* _RTE_DEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 29f5a52..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_VDEV_H
-#define RTE_VDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
- TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
- struct rte_device device; /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
- container_of(ptr, struct rte_vdev_device, device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.name)
- return dev->device.name;
- return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.devargs)
- return dev->device.devargs->args;
- return "";
-}
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
- rte_vdev_probe_t *probe; /**< Virtual device probe function. */
- rte_vdev_remove_t *remove; /**< Virtual device remove function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-RTE_INIT(vdrvinitfn_ ##vdrv);\
-static const char *vdrvinit_ ## nm ## _alias;\
-static void vdrvinitfn_ ##vdrv(void)\
-{\
- (vdrv).driver.name = RTE_STR(nm);\
- (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
- rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 919d371..5a7b8b2 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -74,7 +74,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 5521d01..f4f46c1 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -163,10 +163,6 @@ DPDK_17.05 {
rte_log_set_global_level;
rte_log_set_level;
rte_log_set_level_regexp;
- rte_vdev_init;
- rte_vdev_register;
- rte_vdev_uninit;
- rte_vdev_unregister;
vfio_get_container_fd;
vfio_get_group_fd;
vfio_get_group_no;
diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h
index 4d2c3e2..ff92e6e 100644
--- a/lib/librte_ether/rte_ethdev_vdev.h
+++ b/lib/librte_ether/rte_ethdev_vdev.h
@@ -35,7 +35,7 @@
#define _RTE_ETHDEV_VDEV_H_
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_ethdev.h>
/**
diff --git a/lib/librte_eventdev/rte_eventdev_pmd_vdev.h b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
index 135e8b8..56232de 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
@@ -48,7 +48,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_eal.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "rte_eventdev_pmd.h"
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 047121d..6a6a745 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -110,6 +110,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
endif
_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
# plugins (link only if static libraries)
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 060b498..1bed65d 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_bus_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index 56ed1f8..90a5c64 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
+#include <rte_bus_vdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 4118b75..ba39cba 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -37,6 +37,7 @@
#include <rte_memcpy.h>
#include <rte_eventdev.h>
#include <rte_dev.h>
+#include <rte_bus_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index b88b0d2..dbc36d9 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -45,6 +45,7 @@
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_random.h>
+#include <rte_bus_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index 01aa4d9..f524b6f 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -50,6 +50,7 @@
#include <rte_pause.h>
#include <rte_service.h>
#include <rte_service_component.h>
+#include <rte_bus_vdev.h>
#include "test.h"
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 7dccc6e..54cbf12 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -48,6 +48,7 @@
#include <rte_log.h>
#include <rte_lcore.h>
#include <rte_memory.h>
+#include <rte_bus_vdev.h>
#include <rte_string_fns.h>
#include <rte_errno.h>
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v12 1/4] cryptodev: remove crypto vdev init API
@ 2017-11-07 6:54 4% ` Jianfeng Tan
2017-11-07 6:54 1% ` [dpdk-dev] [PATCH v12 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-11-07 6:54 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 2 ++
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
5 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 817f192..d38ce5c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -53,10 +53,5 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* librte_meter: The API will change to accommodate configuration profiles.
Most of the API functions will have an additional opaque parameter.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 4846448..158a9ca 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -431,6 +431,8 @@ API Changes
the backing device supports the operation or if the operation was
successfully performed.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index e5f2876..b40c028 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index a25bff9..dade554 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -435,23 +435,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index e82296c..eb47308 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v2] doc: update release notes for rte_security
2017-10-30 12:27 8% [dpdk-dev] [PATCH] doc: update release notes for rte_security Akhil Goyal
2017-10-30 14:22 0% ` Thomas Monjalon
@ 2017-11-07 6:44 8% ` Akhil Goyal
2017-11-08 1:07 0% ` Thomas Monjalon
1 sibling, 1 reply; 200+ results
From: Akhil Goyal @ 2017-11-07 6:44 UTC (permalink / raw)
To: dev
Cc: declan.doherty, pablo.de.lara.guarch, hemant.agrawal,
radu.nicolau, borisp, aviadye, thomas, jerin.jacob,
john.mcnamara, konstantin.ananyev, Akhil Goyal
Removed the deprication notice for ABI breakage and updated
release notes for rte_security.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
Changes in v2: incorporated comment from John
doc/guides/rel_notes/deprecation.rst | 10 ----------
doc/guides/rel_notes/release_17_11.rst | 33 +++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e1..b8dff0e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -50,16 +50,6 @@ Deprecation Notices
Target release for removal of the legacy API will be defined once most
PMDs have switched to rte_flow.
-* ethdev: new parameters - ``rte_security_capabilities`` and
- ``rte_security_ops`` will be added to ``rte_eth_dev_info`` and
- ``rte_eth_dev`` respectively to support security operations like
- ipsec inline.
-
-* cryptodev: new parameters - ``rte_security_capabilities`` and
- ``rte_security_ops`` will be added to ``rte_cryptodev_info`` and
- ``rte_cryptodev`` respectively to support security protocol offloaded
- operations.
-
* cryptodev: the following function is deprecated starting from 17.08 and will
be removed in 17.11:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index b96b236..13cc2d9 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -208,6 +208,29 @@ New Features
applications to classify an input packet by matching it against a set of flow
rules. It uses the librte_table API to manage the flow rules.
+* **Added the Security Offload Library.**
+
+ Added an experimental library - rte_security. It provide security APIs for
+ protocols like IPSec using inline ipsec offload to ethernet device or full
+ protocol offload with lookaside crypto device.
+
+ See the "Security_Library" section of the DPDK Programmers Guide document,
+ for more information.
+
+* **Updated DPAA2_SEC crypto driver.**
+
+ Updated dpaa2_sec crypto PMD to support rte_security lookaside protocol
+ offload for IPSec.
+
+* **Updated IXGBE ethernet driver.**
+
+ Updated ixgbe ethernet PMD to support rte_security inline IPSec offload.
+
+* **Updated ipsec-secgw application**
+
+ Updated ipsec-secgw sample application to support rte_security actions for
+ ipsec inline and full protocol offload using lookaside crypto offload.
+
Resolved Issues
---------------
@@ -422,6 +445,16 @@ ABI Changes
The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure
changed, as described in the `New Features` section.
+* **New parameter added to rte_eth_dev.**
+
+ New parameter ``security_ctx`` added to ``rte_eth_dev`` to support security
+ operations like IPSec inline.
+
+* **New parameter added to rte_cryptodev.**
+
+ New parameter ``security_ctx`` added to ``rte_cryptodev`` to support security
+ operations like lookaside crypto.
+
Removed Items
-------------
--
2.9.3
^ permalink raw reply [relevance 8%]
* Re: [dpdk-dev] [PATCH] doc: update ABI/API policy
2017-11-06 11:28 28% [dpdk-dev] [PATCH] doc: update ABI/API policy Bruce Richardson
2017-11-06 14:48 4% ` Mcnamara, John
@ 2017-11-07 6:05 4% ` Yuanhan Liu
2017-11-08 19:09 4% ` Kevin Traynor
2 siblings, 0 replies; 200+ results
From: Yuanhan Liu @ 2017-11-07 6:05 UTC (permalink / raw)
To: Bruce Richardson; +Cc: john.mcnamara, dev
On Mon, Nov 06, 2017 at 11:28:06AM +0000, Bruce Richardson wrote:
> Following agreement at the DPDK Technical Board meeting of 2017-10-13 [1],
> update the documentation with the ABI/API policy changes.
>
> [1] http://dpdk.org/ml/archives/dev/2017-October/079961.html
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
--yliu
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [dpdk-techboard] DPDK techboard minutes of October 26
@ 2017-11-07 3:09 3% Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-07 3:09 UTC (permalink / raw)
To: dev; +Cc: techboard
Hi,
Here are the minutes of the latest DPDK technical board meeting
held on 2017-10-26.
Attendees:
- Bruce Richardson
- Hemant Agrawal
- Jerin Jacob
- Konstantin Ananyev
- Stephen Hemminger
- Thomas Monjalon
- Yuanhan Liu
1) update on ABI stability guidelines
Bruce takes the action to update the guidelines (or delegate this task),
according to recent techboard decision:
http://dpdk.org/ml/archives/dev/2017-October/079961.html
2) update on license discussion
The Linux Foundation made an audit about licenses.
Jan Blunck (as the current techboard representative) is supposed to meet
with them and propose an action plan.
It is going to be a long term plan.
3) The techboard is not allowed to disclose this item.
A private meeting will be organized.
4) next chair, recurring meeting date?
The next meetings should happen at a recurring fixed day and time.
A poll will be organized in the techboard.
Yuanhan will lead the next meeting.
A technical panel session will be organized during the US summit,
including a lot of techboard members.
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [dpdk-techboard] [DRAFT] DPDK techboard minutes of October 26
@ 2017-11-07 3:08 3% Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-07 3:08 UTC (permalink / raw)
To: dev; +Cc: techboard
Hi,
Here are the minutes of the last DPDK technical board meeting
held on 2017-10-26.
Attendees:
- Bruce Richardson
- Hemant Agrawal
- Jerin Jacob
- Konstantin Ananyev
- Stephen Hemminger
- Thomas Monjalon
- Yuanhan Liu
1) update on ABI stability guidelines
Bruce takes the action to update the guidelines (or delegate this task),
according to recent techboard decision:
http://dpdk.org/ml/archives/dev/2017-October/079961.html
2) update on license discussion
The Linux Foundation made an audit about licenses.
Jan Blunck (as the current techboard representative) is supposed to meet
with them and propose an action plan.
It is going to be a long term plan.
3) The techboard is not allowed to disclose this item.
A private meeting will be organized.
4) next chair, recurring meeting date?
The next meetings should happen at a recurring fixed day and time.
A poll will be organized in the techboard.
Yuanhan will lead the next meeting.
A technical panel session will be organized during the US summit,
including a lot of techboard members.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH] eal: fix version map experimental export section
2017-10-25 12:29 4% [dpdk-dev] [PATCH] eal: fix version map experimental export section Harry van Haaren
@ 2017-11-06 23:07 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-06 23:07 UTC (permalink / raw)
To: Harry van Haaren; +Cc: dev, santosh.shukla
25/10/2017 14:29, Harry van Haaren:
> Before this commit, the EXPERIMENTAL version of ABI
> derived from the DPDK_17.08 tag. In parallel there
> was a DPDK_17.11 tag.
>
> Experimental map should always derive from the latest ABI,
> so this patch moves the 17.11 section above EXPERIMENTAL,
> and updates EXPERIMENTAL to derive from the 17.11 map.
>
> Fixes: aadc3eb002d3 ("pci: export match function")
> Cc: santosh.shukla@caviumnetworks.com
>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Rebased and applied, thanks
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] mempool: increase ABI version
2017-11-06 11:33 4% ` santosh
@ 2017-11-06 22:59 4% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-06 22:59 UTC (permalink / raw)
To: santosh, olivier.matz; +Cc: dev
06/11/2017 12:33, santosh:
>
> On Monday 06 November 2017 04:38 PM, Thomas Monjalon wrote:
> > API and ABI of mempool library has been changed in 17.11.
> >
> > Fixes: 02604520b2f2 ("mempool: remove unused flags argument")
> > Fixes: 0cc0f8aaa35d ("mempool: change flags from int to unsigned int")
> > Fixes: 6eac187bff30 ("mempool: add flags arg in xmem size and usage")
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
>
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Applied
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH] doc: update ABI/API policy
2017-11-06 11:28 28% [dpdk-dev] [PATCH] doc: update ABI/API policy Bruce Richardson
@ 2017-11-06 14:48 4% ` Mcnamara, John
2017-11-11 11:37 4% ` Thomas Monjalon
2017-11-07 6:05 4% ` Yuanhan Liu
2017-11-08 19:09 4% ` Kevin Traynor
2 siblings, 1 reply; 200+ results
From: Mcnamara, John @ 2017-11-06 14:48 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Monday, November 6, 2017 11:28 AM
> To: Mcnamara, John <john.mcnamara@intel.com>
> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH] doc: update ABI/API policy
>
> Following agreement at the DPDK Technical Board meeting of 2017-10-13 [1],
> update the documentation with the ABI/API policy changes.
>
> [1] http://dpdk.org/ml/archives/dev/2017-October/079961.html
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> doc/guides/contributing/versioning.rst | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/contributing/versioning.rst
> b/doc/guides/contributing/versioning.rst
> index 8d0fdb777..a1d8492a1 100644
> --- a/doc/guides/contributing/versioning.rst
> +++ b/doc/guides/contributing/versioning.rst
> @@ -13,7 +13,9 @@ General Guidelines
> ------------------
>
> #. Whenever possible, ABI should be preserved -#. The libraries marked in
> experimental state may change without constraint.
> +#. Libraries or APIs marked in ``experimental`` state may change without
> constraint.
> +#. New API will be marked as ``experimental`` for at least one release to
s/API/APIs/
> +APIs marked as ``experimental`` are not considered part of the ABI and
> +may change without warning at any time. Since changes to APIs are most
> +likely immediately after their introduction, as users begin to take
> +advantage of those new API and start finding issues with them, new DPDK
s/API/APIs/
> + - The acknowledgment of the maintainer of the component is mandatory, or if
> + no maintainer is available for the component, the tree/sub-tree maintainer
> + for that component must be acknowledge the ABI change instead.
s/must be/must/
Apart from that:
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH] doc: update ABI/API policy
@ 2017-11-06 11:28 28% Bruce Richardson
2017-11-06 14:48 4% ` Mcnamara, John
` (2 more replies)
0 siblings, 3 replies; 200+ results
From: Bruce Richardson @ 2017-11-06 11:28 UTC (permalink / raw)
To: john.mcnamara; +Cc: dev, Bruce Richardson
Following agreement at the DPDK Technical Board meeting of 2017-10-13 [1],
update the documentation with the ABI/API policy changes.
[1] http://dpdk.org/ml/archives/dev/2017-October/079961.html
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
doc/guides/contributing/versioning.rst | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/doc/guides/contributing/versioning.rst b/doc/guides/contributing/versioning.rst
index 8d0fdb777..a1d8492a1 100644
--- a/doc/guides/contributing/versioning.rst
+++ b/doc/guides/contributing/versioning.rst
@@ -13,7 +13,9 @@ General Guidelines
------------------
#. Whenever possible, ABI should be preserved
-#. The libraries marked in experimental state may change without constraint.
+#. Libraries or APIs marked in ``experimental`` state may change without constraint.
+#. New API will be marked as ``experimental`` for at least one release to allow
+ any issues found by users of the new API to be fixed quickly
#. The addition of symbols is generally not problematic
#. The modification of symbols can generally be managed with versioning
#. The removal of symbols generally is an ABI break and requires bumping of the
@@ -41,6 +43,13 @@ ABI versions are set at the time of major release labeling, and the ABI may
change multiple times, without warning, between the last release label and the
HEAD label of the git tree.
+APIs marked as ``experimental`` are not considered part of the ABI and may
+change without warning at any time. Since changes to APIs are most likely
+immediately after their introduction, as users begin to take advantage of
+those new API and start finding issues with them, new DPDK APIs will be
+automatically marked as ``experimental`` to allow for a period of stabilization
+before they become part of a tracked ABI.
+
ABI versions, once released, are available until such time as their
deprecation has been noted in the Release Notes for at least one major release
cycle. For example consider the case where the ABI for DPDK 2.0 has been
@@ -58,6 +67,14 @@ being provided. The requirements for doing so are:
#. At least 3 acknowledgments of the need to do so must be made on the
dpdk.org mailing list.
+ - The acknowledgment of the maintainer of the component is mandatory, or if
+ no maintainer is available for the component, the tree/sub-tree maintainer
+ for that component must be acknowledge the ABI change instead.
+
+ - It is also recommended that acknowledgments from different "areas of
+ interest" be sought for each deprecation, for example: from NIC vendors,
+ CPU vendors, end-users, etc.
+
#. The changes (including an alternative map file) must be gated with
the ``RTE_NEXT_ABI`` option, and provided with a deprecation notice at the
same time.
--
2.13.6
^ permalink raw reply [relevance 28%]
* Re: [dpdk-dev] [PATCH] mempool: increase ABI version
2017-11-06 11:08 7% [dpdk-dev] [PATCH] mempool: increase ABI version Thomas Monjalon
@ 2017-11-06 11:33 4% ` santosh
2017-11-06 22:59 4% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: santosh @ 2017-11-06 11:33 UTC (permalink / raw)
To: Thomas Monjalon, olivier.matz; +Cc: dev
On Monday 06 November 2017 04:38 PM, Thomas Monjalon wrote:
> API and ABI of mempool library has been changed in 17.11.
>
> Fixes: 02604520b2f2 ("mempool: remove unused flags argument")
> Fixes: 0cc0f8aaa35d ("mempool: change flags from int to unsigned int")
> Fixes: 6eac187bff30 ("mempool: add flags arg in xmem size and usage")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH] mempool: increase ABI version
@ 2017-11-06 11:08 7% Thomas Monjalon
2017-11-06 11:33 4% ` santosh
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-11-06 11:08 UTC (permalink / raw)
To: olivier.matz, santosh.shukla; +Cc: dev
API and ABI of mempool library has been changed in 17.11.
Fixes: 02604520b2f2 ("mempool: remove unused flags argument")
Fixes: 0cc0f8aaa35d ("mempool: change flags from int to unsigned int")
Fixes: 6eac187bff30 ("mempool: add flags arg in xmem size and usage")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/release_17_11.rst | 2 +-
lib/librte_mempool/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 85505fa8e..b7546e605 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -494,7 +494,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_latencystats.so.1
librte_lpm.so.2
librte_mbuf.so.3
- librte_mempool.so.2
+ + librte_mempool.so.3
librte_meter.so.1
librte_metrics.so.1
librte_net.so.1
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index bafd1b9a0..46654e32e 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -39,7 +39,7 @@ LDLIBS += -lrte_eal -lrte_ring
EXPORT_MAP := rte_mempool_version.map
-LIBABIVER := 2
+LIBABIVER := 3
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool.c
--
2.14.2
^ permalink raw reply [relevance 7%]
* Re: [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
2017-11-06 1:41 10% ` [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes Thomas Monjalon
2017-11-06 5:56 0% ` santosh
@ 2017-11-06 8:50 0% ` Mcnamara, John
1 sibling, 0 replies; 200+ results
From: Mcnamara, John @ 2017-11-06 8:50 UTC (permalink / raw)
To: Thomas Monjalon, Santosh Shukla
Cc: olivier.matz, Gonzalez Monroy, Sergio, Burakov, Anatoly, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Monday, November 6, 2017 1:42 AM
> To: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Cc: olivier.matz@6wind.com; Gonzalez Monroy, Sergio
> <sergio.gonzalez.monroy@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in
> release notes
>
> The wording changes have been done in the API without breaking the ABI.
> The deprecated fields and symbols can be removed later when an another ABI
> change will be required.
> The deprecation notice can be removed.
>
> The release notes describe the new available API with IOVA wording.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
2017-11-06 1:41 10% ` [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes Thomas Monjalon
@ 2017-11-06 5:56 0% ` santosh
2017-11-06 8:50 0% ` Mcnamara, John
1 sibling, 0 replies; 200+ results
From: santosh @ 2017-11-06 5:56 UTC (permalink / raw)
To: Thomas Monjalon
Cc: olivier.matz, sergio.gonzalez.monroy, anatoly.burakov, dev
On Monday 06 November 2017 07:11 AM, Thomas Monjalon wrote:
> The wording changes have been done in the API without breaking
> the ABI. The deprecated fields and symbols can be removed later
> when an another ABI change will be required.
> The deprecation notice can be removed.
>
> The release notes describe the new available API with IOVA wording.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
2017-11-06 1:41 2% ` [dpdk-dev] [PATCH v4 00/15] make DPDK IOVA aware Thomas Monjalon
@ 2017-11-06 1:41 10% ` Thomas Monjalon
2017-11-06 5:56 0% ` santosh
2017-11-06 8:50 0% ` Mcnamara, John
0 siblings, 2 replies; 200+ results
From: Thomas Monjalon @ 2017-11-06 1:41 UTC (permalink / raw)
To: Santosh Shukla; +Cc: olivier.matz, sergio.gonzalez.monroy, anatoly.burakov, dev
The wording changes have been done in the API without breaking
the ABI. The deprecated fields and symbols can be removed later
when an another ABI change will be required.
The deprecation notice can be removed.
The release notes describe the new available API with IOVA wording.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/deprecation.rst | 7 -------
doc/guides/rel_notes/release_17_11.rst | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e170..817f19213 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -21,13 +21,6 @@ Deprecation Notices
- ``rte_eal_devargs_type_count``
- ``rte_eal_parse_devargs_str``, replaced by ``rte_eal_devargs_parse``
-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
- translation scheme.
- Reference to phys address in EAL data-structure or functions may change to
- IOVA address or more appropriate name.
- The change will be only for the name.
- Functional aspects of the API or data-structure will remain same.
-
* pci: Several exposed functions are misnamed.
The following functions are deprecated starting from v17.11 and are replaced:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index b96b23614..85505fa8e 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -321,6 +321,23 @@ API Changes
* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
remove this API as Xen dom0 support was removed.
+* **Some data type, structure members and functions related to physical address
+ are deprecated and have new alias with IOVA wording.**
+
+ * ``phys_addr_t`` can be often replaced by ``rte_iova_t`` of same size.
+ * ``RTE_BAD_PHYS_ADDR`` is often replaced by ``RTE_BAD_IOVA`` of same value.
+ * ``rte_memseg.phys_addr`` is aliased with ``rte_memseg.iova_addr``.
+ * ``rte_mem_virt2phy()`` can often be replaced by ``rte_mem_virt2iova``.
+ * ``rte_malloc_virt2phy`` is aliased with ``rte_malloc_virt2iova``.
+ * ``rte_memzone.phys_addr`` is aliased with ``rte_memzone.iova``.
+ * ``rte_mempool_objhdr.physaddr`` is aliased with ``rte_mempool_objhdr.iova``.
+ * ``rte_mempool_memhdr.phys_addr`` is aliased with ``rte_mempool_memhdr.iova``.
+ * ``rte_mempool_virt2phy()`` can be replaced by ``rte_mempool_virt2iova()``.
+ * ``rte_mempool_populate_phys*()`` are aliased with ``rte_mempool_populate_iova*()``
+ * ``rte_mbuf.buf_physaddr`` is aliased with ``rte_mbuf.buf_iova``.
+ * ``rte_mbuf_data_dma_addr*()`` are aliased with ``rte_mbuf_data_iova*()``.
+ * ``rte_pktmbuf_mtophys*`` are aliased with ``rte_pktmbuf_iova*()``.
+
* **PCI bus API moved outside of the EAL**
The PCI bus previously implemented within the EAL has been moved.
--
2.14.2
^ permalink raw reply [relevance 10%]
* [dpdk-dev] [PATCH v4 00/15] make DPDK IOVA aware
@ 2017-11-06 1:41 2% ` Thomas Monjalon
2017-11-06 1:41 10% ` [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-11-06 1:41 UTC (permalink / raw)
To: Santosh Shukla; +Cc: olivier.matz, sergio.gonzalez.monroy, anatoly.burakov, dev
This v4 is a big rework to complete the patches sent by Santosh.
The core components for memory handling (memseg, malloc, memzone,
mempool, mbuf) are almost fully updated for IOVA awareness.
It will ease maintenance and upcoming reworks; that's why we should push
it in 17.11 LTS.
The most important changes in this revision v4 are:
- No API break: everything is aliased to keep old names during next
releases. It will ease apps migration, waiting for major ABI break.
- Rename type from iova_addr_t to rte_iova_t.
- Convert memzone field.
- Convert mempool fields.
- Convert mbuf address helpers.
- Reword doxygen comments and variable names in functions.
In PMDs, only the address type is renamed.
All PMDs will require some attention to transition to IOVA scheme.
KNI and NXP bus drivers are not reworded.
Santosh Shukla (5):
mem: rename segment address from physical to IOVA
malloc: use pointer diff macro in IOVA mapping
mbuf: rename physical address to IOVA
cryptodev: rename physical address type to IOVA
drivers/net: rename physical address type to IOVA
Thomas Monjalon (10):
mem: hide physical address error in VA mode
mem: introduce IOVA type
mem: rename address mapping function to IOVA
malloc: rename address mapping function to IOVA
memzone: rename address from physical to IOVA
mempool: rename addresses from physical to IOVA
mempool: rename address mapping function to IOVA
mempool: rename populate functions to IOVA
mbuf: rename data address helpers to IOVA
doc: add IOVA aware API changes in release notes
app/test-crypto-perf/cperf_ops.c | 6 +-
app/test-crypto-perf/cperf_test_common.c | 6 +-
app/test-crypto-perf/cperf_test_vector_parsing.c | 4 +-
app/test-crypto-perf/cperf_test_vectors.c | 6 +-
app/test-crypto-perf/cperf_test_vectors.h | 4 +-
doc/guides/prog_guide/cryptodev_lib.rst | 6 +-
doc/guides/prog_guide/img/mbuf1.svg | 2 +-
doc/guides/rel_notes/deprecation.rst | 7 --
doc/guides/rel_notes/release_17_11.rst | 17 ++++
drivers/bus/dpaa/base/qbman/qman.c | 2 +-
drivers/bus/dpaa/base/qbman/qman.h | 2 +-
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +-
drivers/crypto/dpaa_sec/dpaa_sec.c | 28 +++---
drivers/crypto/mrvl/rte_mrvl_pmd.c | 4 +-
drivers/crypto/qat/qat_adf/qat_algs.h | 6 +-
drivers/crypto/qat/qat_crypto.c | 22 ++---
drivers/crypto/qat/qat_crypto.h | 2 +-
drivers/crypto/qat/qat_qp.c | 8 +-
drivers/mempool/dpaa/dpaa_mempool.c | 4 +-
drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 4 +-
drivers/mempool/dpaa2/dpaa2_hw_mempool.h | 2 +-
drivers/mempool/octeontx/octeontx_fpavf.c | 4 +-
drivers/mempool/octeontx/rte_mempool_octeontx.c | 2 +-
drivers/net/ark/ark_ddm.c | 2 +-
drivers/net/ark/ark_ddm.h | 4 +-
drivers/net/ark/ark_ethdev_rx.c | 24 ++---
drivers/net/ark/ark_ethdev_tx.c | 8 +-
drivers/net/ark/ark_mpu.c | 2 +-
drivers/net/ark/ark_mpu.h | 4 +-
drivers/net/ark/ark_udm.c | 2 +-
drivers/net/ark/ark_udm.h | 4 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/avp/rte_avp_common.h | 20 ++--
drivers/net/bnx2x/bnx2x.c | 44 ++++-----
drivers/net/bnx2x/bnx2x.h | 22 ++---
drivers/net/bnx2x/bnx2x_rxtx.c | 14 +--
drivers/net/bnx2x/bnx2x_stats.c | 2 +-
drivers/net/bnx2x/bnx2x_vfpf.c | 2 +-
drivers/net/bnx2x/ecore_sp.h | 2 +-
drivers/net/bnxt/bnxt.h | 10 +-
drivers/net/bnxt/bnxt_cpr.h | 4 +-
drivers/net/bnxt/bnxt_ethdev.c | 14 +--
drivers/net/bnxt/bnxt_hwrm.c | 26 +++---
drivers/net/bnxt/bnxt_ring.c | 10 +-
drivers/net/bnxt/bnxt_ring.h | 4 +-
drivers/net/bnxt/bnxt_rxr.h | 4 +-
drivers/net/bnxt/bnxt_txr.h | 2 +-
drivers/net/bnxt/bnxt_vnic.c | 8 +-
drivers/net/bnxt/bnxt_vnic.h | 6 +-
drivers/net/cxgbe/sge.c | 6 +-
drivers/net/dpaa/dpaa_rxtx.c | 6 +-
drivers/net/e1000/em_rxtx.c | 12 +--
drivers/net/e1000/igb_rxtx.c | 12 +--
drivers/net/ena/base/ena_plat_dpdk.h | 4 +-
drivers/net/ena/ena_ethdev.c | 6 +-
drivers/net/enic/enic_main.c | 8 +-
drivers/net/enic/enic_rxtx.c | 6 +-
drivers/net/fm10k/fm10k.h | 4 +-
drivers/net/fm10k/fm10k_ethdev.c | 4 +-
drivers/net/fm10k/fm10k_rxtx_vec.c | 4 +-
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/i40e/i40e_rxtx.c | 22 ++---
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 4 +-
drivers/net/i40e/i40e_rxtx_vec_neon.c | 6 +-
drivers/net/i40e/i40e_rxtx_vec_sse.c | 6 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++--
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 6 +-
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 6 +-
drivers/net/liquidio/lio_rxtx.c | 20 ++--
drivers/net/liquidio/lio_rxtx.h | 6 +-
drivers/net/mrvl/mrvl_ethdev.c | 8 +-
drivers/net/nfp/nfp_net.c | 8 +-
drivers/net/octeontx/base/octeontx_pkovf.c | 4 +-
drivers/net/octeontx/octeontx_rxtx.c | 2 +-
drivers/net/qede/base/bcm_osal.c | 10 +-
drivers/net/qede/base/bcm_osal.h | 2 +-
drivers/net/qede/qede_fdir.c | 2 +-
drivers/net/qede/qede_rxtx.c | 16 ++--
drivers/net/sfc/efsys.h | 2 +-
drivers/net/sfc/sfc.c | 4 +-
drivers/net/sfc/sfc_ef10_rx.c | 4 +-
drivers/net/sfc/sfc_ef10_tx.c | 6 +-
drivers/net/sfc/sfc_rx.c | 2 +-
drivers/net/sfc/sfc_tso.c | 4 +-
drivers/net/sfc/sfc_tx.c | 2 +-
drivers/net/thunderx/base/nicvf_hw.c | 2 +-
drivers/net/thunderx/base/nicvf_hw.h | 2 +-
drivers/net/thunderx/base/nicvf_hw_defs.h | 6 +-
drivers/net/thunderx/nicvf_ethdev.c | 10 +-
drivers/net/thunderx/nicvf_ethdev.h | 6 +-
drivers/net/thunderx/nicvf_rxtx.h | 4 +-
drivers/net/thunderx/nicvf_struct.h | 6 +-
drivers/net/virtio/virtio_ethdev.c | 10 +-
drivers/net/virtio/virtio_rxtx.h | 4 +-
drivers/net/virtio/virtqueue.h | 6 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 10 +-
drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +-
examples/ipsec-secgw/esp.c | 12 +--
examples/l2fwd-crypto/main.c | 8 +-
lib/librte_cryptodev/rte_crypto.h | 2 +-
lib/librte_cryptodev/rte_crypto_sym.h | 6 +-
lib/librte_cryptodev/rte_cryptodev.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.h | 2 +-
lib/librte_eal/bsdapp/eal/eal_memory.c | 15 ++-
lib/librte_eal/common/eal_common_memory.c | 4 +-
lib/librte_eal/common/eal_common_memzone.c | 6 +-
lib/librte_eal/common/include/rte_malloc.h | 17 +++-
lib/librte_eal/common/include/rte_memory.h | 28 +++++-
lib/librte_eal/common/include/rte_memzone.h | 6 +-
lib/librte_eal/common/rte_malloc.c | 22 ++---
lib/librte_eal/linuxapp/eal/eal_memory.c | 40 ++++----
lib/librte_eal/linuxapp/eal/eal_vfio.c | 6 +-
lib/librte_eal/rte_eal_version.map | 3 +-
lib/librte_kni/rte_kni.c | 2 +-
lib/librte_mbuf/rte_mbuf.c | 6 +-
lib/librte_mbuf/rte_mbuf.h | 53 ++++++++---
lib/librte_mempool/rte_mempool.c | 111 +++++++++++++----------
lib/librte_mempool/rte_mempool.h | 86 +++++++++++-------
lib/librte_mempool/rte_mempool_ops.c | 4 +-
lib/librte_mempool/rte_mempool_version.map | 2 +
lib/librte_vhost/vhost.h | 2 +-
lib/librte_vhost/vhost_user.c | 4 +-
lib/librte_vhost/virtio_net.c | 2 +-
test/test/test_cryptodev.c | 42 ++++-----
test/test/test_cryptodev.h | 4 +-
test/test/test_mbuf.c | 2 +-
test/test/test_mempool.c | 4 +-
test/test/test_memzone.c | 80 ++++++++--------
129 files changed, 708 insertions(+), 591 deletions(-)
--
2.14.2
^ permalink raw reply [relevance 2%]
* Re: [dpdk-dev] [PATCH v1] i40e: highlight change to flexible payload for RSS config
2017-11-03 15:24 5% [dpdk-dev] [PATCH v1] i40e: highlight change to flexible payload for RSS config John McNamara
@ 2017-11-04 19:41 0% ` Chilikin, Andrey
0 siblings, 0 replies; 200+ results
From: Chilikin, Andrey @ 2017-11-04 19:41 UTC (permalink / raw)
To: Mcnamara, John, dev; +Cc: Rybalchenko, Kirill
> -----Original Message-----
> From: Mcnamara, John
> Sent: Friday, November 3, 2017 3:24 PM
> To: dev@dpdk.org
> Cc: Rybalchenko, Kirill <kirill.rybalchenko@intel.com>; Chilikin, Andrey
> <andrey.chilikin@intel.com>; Mcnamara, John <john.mcnamara@intel.com>
> Subject: [PATCH v1] i40e: highlight change to flexible payload for RSS config
>
> Add deprecation notice to highlight a future change in the
> default configuration behavior for flexible payload for RSS.
>
> Signed-off-by: John McNamara <john.mcnamara@intel.com>
> ---
> doc/guides/rel_notes/deprecation.rst | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/doc/guides/rel_notes/deprecation.rst
> b/doc/guides/rel_notes/deprecation.rst
> index a93c3e1..9e9caa6 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -67,3 +67,9 @@ Deprecation Notices
>
> * librte_meter: The API will change to accommodate configuration profiles.
> Most of the API functions will have an additional opaque parameter.
> +
> +* i40e: The default flexible payload configuration which extracts the first 16
> + bytes of the payload for RSS will be deprecated starting from 18.02. If
> + required the previous behavior can be configured using existing flow
> + director APIs. There is no ABI/API break. This change will just remove a
> + global configuration setting and require explicit configuration.
> --
> 2.7.5
Acked-by: Andrey Chilikin <andrey.chilikin@intel.com>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v1] i40e: highlight change to flexible payload for RSS config
@ 2017-11-03 15:24 5% John McNamara
2017-11-04 19:41 0% ` Chilikin, Andrey
0 siblings, 1 reply; 200+ results
From: John McNamara @ 2017-11-03 15:24 UTC (permalink / raw)
To: dev; +Cc: kirill.rybalchenko, andrey.chilikin, John McNamara
Add deprecation notice to highlight a future change in the
default configuration behavior for flexible payload for RSS.
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e1..9e9caa6 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -67,3 +67,9 @@ Deprecation Notices
* librte_meter: The API will change to accommodate configuration profiles.
Most of the API functions will have an additional opaque parameter.
+
+* i40e: The default flexible payload configuration which extracts the first 16
+ bytes of the payload for RSS will be deprecated starting from 18.02. If
+ required the previous behavior can be configured using existing flow
+ director APIs. There is no ABI/API break. This change will just remove a
+ global configuration setting and require explicit configuration.
--
2.7.5
^ permalink raw reply [relevance 5%]
* Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iovatypes
2017-11-03 13:58 0% ` Thomas Monjalon
@ 2017-11-03 15:22 0% ` Jonas Pfefferle1
0 siblings, 0 replies; 200+ results
From: Jonas Pfefferle1 @ 2017-11-03 15:22 UTC (permalink / raw)
To: Thomas Monjalon
Cc: santosh, dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
"dev" <dev-bounces@dpdk.org> wrote on 11/03/2017 02:58:43 PM:
> From: Thomas Monjalon <thomas@monjalon.net>
> To: santosh <santosh.shukla@caviumnetworks.com>
> Cc: dev@dpdk.org, olivier.matz@6wind.com,
> jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com,
> anatoly.burakov@intel.com
> Date: 11/03/2017 02:59 PM
> Subject: Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API
> to iova types
> Sent by: "dev" <dev-bounces@dpdk.org>
>
> 03/11/2017 12:35, santosh:
> > On Friday 03 November 2017 04:41 PM, Thomas Monjalon wrote:
> > > 20/10/2017 14:31, Santosh Shukla:
> > >> Renamed memory translational api to _iova types.
> > >> The following api renamed from:
> > >>
> > >> rte_mempool_populate_phys()
> > >> rte_mempool_populate_phys_tab()
> > > These functions still have "physical addresses" in their description.
> > > It is not consistent.
> > >
> > > Please provide ABI compatibility for mempool functions.
> > >
> > >> rte_eal_using_phys_addrs()
> > > Why renaming rte_eal_using_phys_addrs?
> > > I think we need to review how it is used.
> > > Maybe it requires a rework.
> > >
> > >> rte_mem_virt2phy()
> > >> rte_dump_physmem_layout()
> > >> rte_eal_get_physmem_layout()
> > >> rte_eal_get_physmem_size()
> > > Those 3 functions deal with physical memory layout.
> > > I don't see a need to rename them.
> >
> > In iova=va mode, those api will have va address.
>
> Yes addresses can be virtual.
> But it is still physically segmented.
>
> > > But the dump function needs a change to avoid printing
> > > "phys" even in VA case.
> > >
> > >> rte_malloc_virt2phy()
> > >> rte_mem_phy2mch()
> > > This last function was removed with Xen.
> > > It is wrong to rename it in the release notes.
> > > It should just be removed from the map file (I will send a patch).
> > >
> > >> To the following iova types api:
> > >>
> > >> rte_mempool_populate_iova()
> > >> rte_mempool_populate_iova_tab()
> > >> rte_eal_using_iova_addrs()
> > >> rte_mem_virt2iova()
> > > [...]
> > >> rte_malloc_virt2iova()
> > > I am not convinced by the names virt2iova.
> > > I sounds like "virt to virt".
> > > What about "virt2io" or "virt2io_addr"?
> >
> > no, iova can be _pa or _va, its an io_addr indeed but
> > I prefer virt2iova, same mentioned in deprecation notice (no
> strong opinion),
> >
> > More suggestion on naming pl.?
>
> I like virt2io_addr but virt2iova is not so bad.
> I agree with Santosh that we need more opinions.
virt2iova +1
Another suggestion va2iova to be consistent with the names
>
> > > As the ABI is broken in EAL 17.11, we do not care about
compatibility.
> > > But we must keep an alias to the old function name in order to allow
> > > a smooth API transition for applications.
> > > I suggest to add static inline functions with the old names and set
> > > the deprecated attribute.
> >
> > ok, Will address in 18.02.
>
> I would prefer these changes made in 17.11 as announced.
> As you are not willing to work on it, I am trying to send some
> updated patches.
>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types
2017-11-03 11:35 0% ` santosh
@ 2017-11-03 13:58 0% ` Thomas Monjalon
2017-11-03 15:22 0% ` [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iovatypes Jonas Pfefferle1
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-11-03 13:58 UTC (permalink / raw)
To: santosh; +Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
03/11/2017 12:35, santosh:
> On Friday 03 November 2017 04:41 PM, Thomas Monjalon wrote:
> > 20/10/2017 14:31, Santosh Shukla:
> >> Renamed memory translational api to _iova types.
> >> The following api renamed from:
> >>
> >> rte_mempool_populate_phys()
> >> rte_mempool_populate_phys_tab()
> > These functions still have "physical addresses" in their description.
> > It is not consistent.
> >
> > Please provide ABI compatibility for mempool functions.
> >
> >> rte_eal_using_phys_addrs()
> > Why renaming rte_eal_using_phys_addrs?
> > I think we need to review how it is used.
> > Maybe it requires a rework.
> >
> >> rte_mem_virt2phy()
> >> rte_dump_physmem_layout()
> >> rte_eal_get_physmem_layout()
> >> rte_eal_get_physmem_size()
> > Those 3 functions deal with physical memory layout.
> > I don't see a need to rename them.
>
> In iova=va mode, those api will have va address.
Yes addresses can be virtual.
But it is still physically segmented.
> > But the dump function needs a change to avoid printing
> > "phys" even in VA case.
> >
> >> rte_malloc_virt2phy()
> >> rte_mem_phy2mch()
> > This last function was removed with Xen.
> > It is wrong to rename it in the release notes.
> > It should just be removed from the map file (I will send a patch).
> >
> >> To the following iova types api:
> >>
> >> rte_mempool_populate_iova()
> >> rte_mempool_populate_iova_tab()
> >> rte_eal_using_iova_addrs()
> >> rte_mem_virt2iova()
> > [...]
> >> rte_malloc_virt2iova()
> > I am not convinced by the names virt2iova.
> > I sounds like "virt to virt".
> > What about "virt2io" or "virt2io_addr"?
>
> no, iova can be _pa or _va, its an io_addr indeed but
> I prefer virt2iova, same mentioned in deprecation notice (no strong opinion),
>
> More suggestion on naming pl.?
I like virt2io_addr but virt2iova is not so bad.
I agree with Santosh that we need more opinions.
> > As the ABI is broken in EAL 17.11, we do not care about compatibility.
> > But we must keep an alias to the old function name in order to allow
> > a smooth API transition for applications.
> > I suggest to add static inline functions with the old names and set
> > the deprecated attribute.
>
> ok, Will address in 18.02.
I would prefer these changes made in 17.11 as announced.
As you are not willing to work on it, I am trying to send some
updated patches.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] mem: remove old function from symbol list
2017-11-03 11:34 3% ` Gonzalez Monroy, Sergio
@ 2017-11-03 13:52 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-11-03 13:52 UTC (permalink / raw)
To: Gonzalez Monroy, Sergio; +Cc: jianfeng.tan, dev, bluca
03/11/2017 12:34, Gonzalez Monroy, Sergio:
> Hi Thomas,
>
> I reckon you need to bump ABI version when you remove public symbol from
> .map file.
Yes, of course, unless it has already been dumped:
http://dpdk.org/commit/f26ab687a74
> On 03/11/2017 11:24, Thomas Monjalon wrote:
> > The function rte_mem_phy2mch() was removed with the support
> > of Xen dom0.
> >
> > Fixes: a7cb2e20d23c ("mem: remove API to get physical address in dom0")
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > lib/librte_eal/rte_eal_version.map | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> > index d2a4ff974..7c9bdc2ae 100644
> > --- a/lib/librte_eal/rte_eal_version.map
> > +++ b/lib/librte_eal/rte_eal_version.map
> > @@ -62,7 +62,6 @@ DPDK_2.0 {
> > rte_malloc_validate;
> > rte_malloc_virt2phy;
> > rte_mem_lock_page;
> > - rte_mem_phy2mch;
> > rte_mem_virt2phy;
> > rte_memdump;
> > rte_memory_get_nchannel;
>
>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types
2017-11-03 11:11 4% ` Thomas Monjalon
@ 2017-11-03 11:35 0% ` santosh
2017-11-03 13:58 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: santosh @ 2017-11-03 11:35 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
On Friday 03 November 2017 04:41 PM, Thomas Monjalon wrote:
> 20/10/2017 14:31, Santosh Shukla:
>> Renamed memory translational api to _iova types.
>> The following api renamed from:
>>
>> rte_mempool_populate_phys()
>> rte_mempool_populate_phys_tab()
> These functions still have "physical addresses" in their description.
> It is not consistent.
>
> Please provide ABI compatibility for mempool functions.
>
>> rte_eal_using_phys_addrs()
> Why renaming rte_eal_using_phys_addrs?
> I think we need to review how it is used.
> Maybe it requires a rework.
>
>> rte_mem_virt2phy()
>> rte_dump_physmem_layout()
>> rte_eal_get_physmem_layout()
>> rte_eal_get_physmem_size()
> Those 3 functions deal with physical memory layout.
> I don't see a need to rename them.
In iova=va mode, those api will have va address.
> But the dump function needs a change to avoid printing
> "phys" even in VA case.
>
>> rte_malloc_virt2phy()
>> rte_mem_phy2mch()
> This last function was removed with Xen.
> It is wrong to rename it in the release notes.
> It should just be removed from the map file (I will send a patch).
>
>> To the following iova types api:
>>
>> rte_mempool_populate_iova()
>> rte_mempool_populate_iova_tab()
>> rte_eal_using_iova_addrs()
>> rte_mem_virt2iova()
> [...]
>> rte_malloc_virt2iova()
> I am not convinced by the names virt2iova.
> I sounds like "virt to virt".
> What about "virt2io" or "virt2io_addr"?
no, iova can be _pa or _va, its an io_addr indeed but
I prefer virt2iova, same mentioned in deprecation notice (no strong opinion),
More suggestion on naming pl.?
> As the ABI is broken in EAL 17.11, we do not care about compatibility.
> But we must keep an alias to the old function name in order to allow
> a smooth API transition for applications.
> I suggest to add static inline functions with the old names and set
> the deprecated attribute.
ok, Will address in 18.02.
Thanks.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] mem: remove old function from symbol list
@ 2017-11-03 11:34 3% ` Gonzalez Monroy, Sergio
2017-11-03 13:52 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Gonzalez Monroy, Sergio @ 2017-11-03 11:34 UTC (permalink / raw)
To: Thomas Monjalon, jianfeng.tan; +Cc: dev, bluca
Hi Thomas,
I reckon you need to bump ABI version when you remove public symbol from
.map file.
Thanks,
Sergio
On 03/11/2017 11:24, Thomas Monjalon wrote:
> The function rte_mem_phy2mch() was removed with the support
> of Xen dom0.
>
> Fixes: a7cb2e20d23c ("mem: remove API to get physical address in dom0")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> lib/librte_eal/rte_eal_version.map | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index d2a4ff974..7c9bdc2ae 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -62,7 +62,6 @@ DPDK_2.0 {
> rte_malloc_validate;
> rte_malloc_virt2phy;
> rte_mem_lock_page;
> - rte_mem_phy2mch;
> rte_mem_virt2phy;
> rte_memdump;
> rte_memory_get_nchannel;
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types
@ 2017-11-03 11:11 4% ` Thomas Monjalon
2017-11-03 11:35 0% ` santosh
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-11-03 11:11 UTC (permalink / raw)
To: Santosh Shukla
Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
20/10/2017 14:31, Santosh Shukla:
> Renamed memory translational api to _iova types.
> The following api renamed from:
>
> rte_mempool_populate_phys()
> rte_mempool_populate_phys_tab()
These functions still have "physical addresses" in their description.
It is not consistent.
Please provide ABI compatibility for mempool functions.
> rte_eal_using_phys_addrs()
Why renaming rte_eal_using_phys_addrs?
I think we need to review how it is used.
Maybe it requires a rework.
> rte_mem_virt2phy()
> rte_dump_physmem_layout()
> rte_eal_get_physmem_layout()
> rte_eal_get_physmem_size()
Those 3 functions deal with physical memory layout.
I don't see a need to rename them.
But the dump function needs a change to avoid printing
"phys" even in VA case.
> rte_malloc_virt2phy()
> rte_mem_phy2mch()
This last function was removed with Xen.
It is wrong to rename it in the release notes.
It should just be removed from the map file (I will send a patch).
> To the following iova types api:
>
> rte_mempool_populate_iova()
> rte_mempool_populate_iova_tab()
> rte_eal_using_iova_addrs()
> rte_mem_virt2iova()
[...]
> rte_malloc_virt2iova()
I am not convinced by the names virt2iova.
I sounds like "virt to virt".
What about "virt2io" or "virt2io_addr"?
As the ABI is broken in EAL 17.11, we do not care about compatibility.
But we must keep an alias to the old function name in order to allow
a smooth API transition for applications.
I suggest to add static inline functions with the old names and set
the deprecated attribute.
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH ] examples/l3fwd: fix aliasing in port grouping
@ 2017-11-03 5:42 3% ` Guduri Prathyusha
0 siblings, 0 replies; 200+ results
From: Guduri Prathyusha @ 2017-11-03 5:42 UTC (permalink / raw)
To: konstantin.ananyev
Cc: dev, guduri.prathyusha, guduriprathyusha, tomasz.kantecki,
konstantin.ananyev
On Fri, Nov 03, 2017 at 11:21:43AM +0800, Jianbo.Liu@arm.com wrote:
> The 11/02/2017 15:52, Ananyev, Konstantin wrote:
> >
> >
> > > -----Original Message-----
> > > From: Guduri Prathyusha [mailto:gprathyusha@caviumnetworks.com]
> > > Sent: Thursday, November 2, 2017 3:34 PM
> > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > > Cc: dev@dpdk.org; Jianbo.Liu@arm.com; guduriprathyusha@gmail.com; Kantecki, Tomasz <tomasz.kantecki@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH ] examples/l3fwd: fix aliasing in port grouping
> > >
> > > On Thu, Nov 02, 2017 at 02:46:43PM +0000, Ananyev, Konstantin wrote:
> > > > Hi,
> > > Hi
> > > >
> > > > > -----Original Message-----
> > > > > From: Guduri Prathyusha [mailto:gprathyusha@caviumnetworks.com]
> > > > > Sent: Thursday, November 2, 2017 2:31 PM
> > > > > To: Kantecki, Tomasz <tomasz.kantecki@intel.com>
> > > > > Cc: Jianbo.Liu@arm.com; guduriprathyusha@gmail.com; Ananyev, Konstantin <konstantin.ananyev@intel.com>; dev@dpdk.org; Guduri
> > > > > Prathyusha <gprathyusha@caviumnetworks.com>
> > > > > Subject: [dpdk-dev] [PATCH ] examples/l3fwd: fix aliasing in port grouping
> > > > >
> > > > > With -f-strict-aliasing enabled by default from -O2, gcc > 5.x gives
>
> May I ask the detail version about the gcc you are using?
>
Am using gcc provided by ubuntu rootfs
root@localhost:~/dpdk# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/5/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
5.4.0-6ubuntu1~16.04.4'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
--prefix=/usr --program-suffix=-5 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libquadmath --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-arm64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-arm64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-arm64
--with-arch-directory=aarch64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch
--enable-fix-cortex-a53-843419 --disable-werror
--enable-checking=release --build=aarch64-linux-gnu
--host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4)
> > > > > undefined behavior in port_groupx4. 'pn' and 'pnum' are two different
> > > > > pointers pointing to same chunk of memory and with -f-strict-aliasing the
> > > > > pointers are assumed to be pointing to different memory and compiler
> > > > > reorders instructions that depend on pnum and pn. This breaks port
> > > > > grouping algorithm.
> > > > >
> > > > > This patch eliminates the usage of union and uses memcpy for copying
> > > > > gptbl[v].pnum to pn. memcpy when applied on built_in constant size does
> > > > > not call its library implementation but uses appropriate LD and ST
> > > > > instructions directly and hence no performance overhead.
> > > > >
> > > > > Fixes: 569b290cdb36 ("examples/l3fwd: add NEON implementation")
> > > > > Fixes: af1694d94bf1 ("examples/l3fwd: fix crash with gcc 5")
> > > > > Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
> > > > > ---
> > > > > examples/l3fwd/l3fwd_neon.h | 11 +++--------
> > > > > examples/l3fwd/l3fwd_sse.h | 11 +++--------
> > > > > 2 files changed, 6 insertions(+), 16 deletions(-)
> > > > >
> > > > > diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h
> > > > > index 4bc161394..10a602a04 100644
> > > > > --- a/examples/l3fwd/l3fwd_neon.h
> > > > > +++ b/examples/l3fwd/l3fwd_neon.h
> > > > > @@ -100,11 +100,6 @@ static inline uint16_t *
> > > > > port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
> > > > > uint16x8_t dp2)
> > > > > {
> > > > > - union {
> > > > > - uint16_t u16[FWDSTEP + 1];
> > > > > - uint64_t u64;
> > > > > - } *pnum = (void *)pn;
> > > > > -
> > > > > int32_t v;
> > > > > uint16x8_t mask = {1, 2, 4, 8, 0, 0, 0, 0};
> > > > >
> > > > > @@ -117,9 +112,9 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
> > > > >
> > > > > /* if dest port value has changed. */
> > > > > if (v != GRPMSK) {
> > > > > - pnum->u64 = gptbl[v].pnum;
> > > > > - pnum->u16[FWDSTEP] = 1;
> > > > > - lp = pnum->u16 + gptbl[v].idx;
> > > > > + rte_memcpy(pn, &gptbl[v].pnum, sizeof(gptbl[v].pnum));
> > > > > + pn[FWDSTEP] = 1;
> > > > > + lp = pn + gptbl[v].idx;
> > > > > }
> > > > >
> > > > > return lp;
> > > > > diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h
> > > > > index 831760f02..79a71d77e 100644
> > > > > --- a/examples/l3fwd/l3fwd_sse.h
> > > > > +++ b/examples/l3fwd/l3fwd_sse.h
> > > > > @@ -98,11 +98,6 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
> > > > > static inline uint16_t *
> > > > > port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
> > > > > {
> > > > > - union {
> > > > > - uint16_t u16[FWDSTEP + 1];
> > > > > - uint64_t u64;
> > > > > - } *pnum = (void *)pn;
> > > > > -
> > > > > int32_t v;
> > > > >
> > > > > dp1 = _mm_cmpeq_epi16(dp1, dp2);
> > > > > @@ -114,9 +109,9 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
> > > > >
> > > > > /* if dest port value has changed. */
> > > > > if (v != GRPMSK) {
> > > > > - pnum->u64 = gptbl[v].pnum;
> > > > > - pnum->u16[FWDSTEP] = 1;
> > > > > - lp = pnum->u16 + gptbl[v].idx;
> > > > > + rte_memcpy(pn, &gptbl[v].pnum, sizeof(gptbl[v].pnum));
> > > > > + pn[FWDSTEP] = 1;
> > > > > + lp = pn + gptbl[v].idx;
> > > >
> > > > Could you explain a bit more here - which exactly instructions were reordered
> > > > and what kind of problems did it cause?
> > > > Specially on IA?
> > >
> > > This issue is observed on ARM since ARM gcc is more aggressive in
> > > reordering than x86 gcc.
> >
> > Ok, then if x86 is not affected why to modify l3fwd_sse.h at all?
> > Unless there is a reproducible problem with x86 -
> > my preference would be to keep that file intact.
> >
> > > In ARM when v != GRPMSK, the following
> > > instructions ordering is not guarenteed because of strict aliasing.
> > >
> > > lp[0] += gptbl[v].lpv;
> > > pnum->u64 = gptbl[v].pnum;
> > > pnum->u16[FWDSTEP] = 1;
> > > lp = pnum->u16 + gptbl[v].idx;
> >
> > Ok, so what in particular is reordered by the compiler:
> >
> > lp[0] += gptbl[v].lpv; (1)
> > pnum->u64 = gptbl[v].pnum; (2)
> > pnum->u16[FWDSTEP] = 1; (3)
> > lp = pnum->u16 + gptbl[v].idx; (4)
> >
> > (2) and (3)?
> > If so I am not sure how it could be a problem:
> > they do stores to the different locations.
> > (1) and (4) as I can see shouldn't be reordered.
> > Anyway - if you think this a compiler reordering issue,
> > then adding rte_compiler_barrier() should fix the issue, right?
>
> Agree.
>
Yes, rte_compiler_barrier() solves the issue. I will spin a V2 if you
are ok with it.
> >
> > >
> > > That results in wrong lp[0] updation.
> > > memcpy in this case will avoid this problem.
> > >
> > > > In any case I don't think using rte_memcpy is a good thing to use here:
> > > > it is a huge inline function - way too much to copy just 64 bit variable.
> > >
> > > I agree that rte_memcpy is overhead in this case but how about using
> > > memcpy that will not use library implementation if the size is constant.
> > > memcpy with constant size uses built_in_memcpy that does not add
> > > performance overhead.
> >
> > On x86 rte_memcpy() doesn't call libc memcpy() at all - it is a separate function:
> > ib/librte_eal/common/include/arch/x86/rte_memcpy.h
> >
> > >
> > > Thoughts?
> >
> > As I said - if x86 is not affected - please keep l3fwd_sse.h intact.
> > If it does (still not sure how) - check would compiler barrier help here.
> > Konstantin
> >
>
> --
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH] doc: update release notes for rte_security
2017-11-01 6:20 0% ` Akhil Goyal
@ 2017-11-02 16:36 0% ` Mcnamara, John
0 siblings, 0 replies; 200+ results
From: Mcnamara, John @ 2017-11-02 16:36 UTC (permalink / raw)
To: Akhil Goyal, Thomas Monjalon
Cc: dev, Doherty, Declan, De Lara Guarch, Pablo, hemant.agrawal,
Nicolau, Radu, borisp, aviadye, jerin.jacob, Ananyev, Konstantin
> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> Sent: Wednesday, November 1, 2017 6:21 AM
> To: Thomas Monjalon <thomas@monjalon.net>; Mcnamara, John
> <john.mcnamara@intel.com>
> Cc: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; De Lara
> Guarch, Pablo <pablo.de.lara.guarch@intel.com>; hemant.agrawal@nxp.com;
> Nicolau, Radu <radu.nicolau@intel.com>; borisp@mellanox.com;
> aviadye@mellanox.com; jerin.jacob@caviumnetworks.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Subject: Re: [PATCH] doc: update release notes for rte_security
>
> Hi Thomas,
> On 10/30/2017 7:52 PM, Thomas Monjalon wrote:
> > 30/10/2017 13:27, Akhil Goyal:
> >> Removed the deprication notice for ABI breakage and updated release
> >> notes for rte_security.
> >>
> >> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> >> ---
> >> +.. _security_library:
> >> +
> >> Security Library
> >> ================
> > [...]
> >> +* **Added the Security Offload Library.**
> >> +
> >> + Added an experimental library - rte_security. It provide security
> >> + APIs for protocols like IPSec using inline ipsec offload to
> >> + ethernet device or full protocol offload with lookaside crypto
> device.
> >> +
> >> + See the :ref:`Security Library <Security_Library>` documentation
> >> + in the Programmers Guide document, for more information.
> >
> > I think the reference to the programmer's guide is not so useful.
> > I prefer avoiding it because it won't work in PDF format.
> >
> > John, any opinion?
> >
>
> I added this reference as there was another one in the release notes
> already for membership library.
>
> I will remove reference to security library, if it is not required.
> Please let me know.
>
You could refer to it without a link:
See the "Security_Library" section of the DPDK Programmers Guide document,
for more information.
John
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] doc: update release notes for rte_security
2017-10-30 14:22 0% ` Thomas Monjalon
@ 2017-11-01 6:20 0% ` Akhil Goyal
2017-11-02 16:36 0% ` Mcnamara, John
0 siblings, 1 reply; 200+ results
From: Akhil Goyal @ 2017-11-01 6:20 UTC (permalink / raw)
To: Thomas Monjalon, john.mcnamara
Cc: dev, declan.doherty, pablo.de.lara.guarch, hemant.agrawal,
radu.nicolau, borisp, aviadye, jerin.jacob, konstantin.ananyev
Hi Thomas,
On 10/30/2017 7:52 PM, Thomas Monjalon wrote:
> 30/10/2017 13:27, Akhil Goyal:
>> Removed the deprication notice for ABI breakage and updated
>> release notes for rte_security.
>>
>> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
>> ---
>> +.. _security_library:
>> +
>> Security Library
>> ================
> [...]
>> +* **Added the Security Offload Library.**
>> +
>> + Added an experimental library - rte_security. It provide security APIs for
>> + protocols like IPSec using inline ipsec offload to ethernet device or full
>> + protocol offload with lookaside crypto device.
>> +
>> + See the :ref:`Security Library <Security_Library>` documentation in
>> + the Programmers Guide document, for more information.
>
> I think the reference to the programmer's guide is not so useful.
> I prefer avoiding it because it won't work in PDF format.
>
> John, any opinion?
>
I added this reference as there was another one in the release notes
already for membership library.
I will remove reference to security library, if it is not required.
Please let me know.
Thanks,
Akhil
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] doc: update release notes for rte_security
2017-10-30 12:27 8% [dpdk-dev] [PATCH] doc: update release notes for rte_security Akhil Goyal
@ 2017-10-30 14:22 0% ` Thomas Monjalon
2017-11-01 6:20 0% ` Akhil Goyal
2017-11-07 6:44 8% ` [dpdk-dev] [PATCH v2] " Akhil Goyal
1 sibling, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-30 14:22 UTC (permalink / raw)
To: Akhil Goyal, john.mcnamara
Cc: dev, declan.doherty, pablo.de.lara.guarch, hemant.agrawal,
radu.nicolau, borisp, aviadye, jerin.jacob, konstantin.ananyev
30/10/2017 13:27, Akhil Goyal:
> Removed the deprication notice for ABI breakage and updated
> release notes for rte_security.
>
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---
> +.. _security_library:
> +
> Security Library
> ================
[...]
> +* **Added the Security Offload Library.**
> +
> + Added an experimental library - rte_security. It provide security APIs for
> + protocols like IPSec using inline ipsec offload to ethernet device or full
> + protocol offload with lookaside crypto device.
> +
> + See the :ref:`Security Library <Security_Library>` documentation in
> + the Programmers Guide document, for more information.
I think the reference to the programmer's guide is not so useful.
I prefer avoiding it because it won't work in PDF format.
John, any opinion?
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH] doc: update release notes for rte_security
@ 2017-10-30 12:27 8% Akhil Goyal
2017-10-30 14:22 0% ` Thomas Monjalon
2017-11-07 6:44 8% ` [dpdk-dev] [PATCH v2] " Akhil Goyal
0 siblings, 2 replies; 200+ results
From: Akhil Goyal @ 2017-10-30 12:27 UTC (permalink / raw)
To: dev
Cc: declan.doherty, pablo.de.lara.guarch, hemant.agrawal,
radu.nicolau, borisp, aviadye, thomas, jerin.jacob,
john.mcnamara, konstantin.ananyev, Akhil Goyal
Removed the deprication notice for ABI breakage and updated
release notes for rte_security.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
doc/guides/prog_guide/rte_security.rst | 2 ++
doc/guides/rel_notes/deprecation.rst | 10 ----------
doc/guides/rel_notes/release_17_11.rst | 33 +++++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index 71be036..ef6ed0f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -28,6 +28,8 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.. _security_library:
+
Security Library
================
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e1..b8dff0e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -50,16 +50,6 @@ Deprecation Notices
Target release for removal of the legacy API will be defined once most
PMDs have switched to rte_flow.
-* ethdev: new parameters - ``rte_security_capabilities`` and
- ``rte_security_ops`` will be added to ``rte_eth_dev_info`` and
- ``rte_eth_dev`` respectively to support security operations like
- ipsec inline.
-
-* cryptodev: new parameters - ``rte_security_capabilities`` and
- ``rte_security_ops`` will be added to ``rte_cryptodev_info`` and
- ``rte_cryptodev`` respectively to support security protocol offloaded
- operations.
-
* cryptodev: the following function is deprecated starting from 17.08 and will
be removed in 17.11:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index b96b236..132a916 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -208,6 +208,29 @@ New Features
applications to classify an input packet by matching it against a set of flow
rules. It uses the librte_table API to manage the flow rules.
+* **Added the Security Offload Library.**
+
+ Added an experimental library - rte_security. It provide security APIs for
+ protocols like IPSec using inline ipsec offload to ethernet device or full
+ protocol offload with lookaside crypto device.
+
+ See the :ref:`Security Library <Security_Library>` documentation in
+ the Programmers Guide document, for more information.
+
+* **Updated DPAA2_SEC crypto driver.**
+
+ Updated dpaa2_sec crypto PMD to support rte_security lookaside protocol
+ offload for IPSec.
+
+* **Updated IXGBE ethernet driver.**
+
+ Updated ixgbe ethernet PMD to support rte_security inline IPSec offload.
+
+* **Updated ipsec-secgw application**
+
+ Updated ipsec-secgw sample application to support rte_security actions for
+ ipsec inline and full protocol offload using lookaside crypto offload.
+
Resolved Issues
---------------
@@ -422,6 +445,16 @@ ABI Changes
The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure
changed, as described in the `New Features` section.
+* **New parameter added to rte_eth_dev.**
+
+ New parameter ``security_ctx`` added to ``rte_eth_dev`` to support security
+ operations like IPSec inline.
+
+* **New parameter added to rte_cryptodev.**
+
+ New parameter ``security_ctx`` added to ``rte_cryptodev`` to support security
+ operations like lookaside crypto.
+
Removed Items
-------------
--
2.9.3
^ permalink raw reply [relevance 8%]
* Re: [dpdk-dev] rte_security deprecation
2017-10-30 11:06 3% [dpdk-dev] rte_security deprecation Thomas Monjalon
@ 2017-10-30 11:30 0% ` Akhil Goyal
0 siblings, 0 replies; 200+ results
From: Akhil Goyal @ 2017-10-30 11:30 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: pablo.de.lara.guarch, declan.doherty, dev
Hi Thomas,
On 10/30/2017 4:36 PM, Thomas Monjalon wrote:
> Hi,
>
> The deprecation notice for rte_security was not removed:
> http://dpdk.org/commit/be7c7cce25
>
> Please submit a patch to remove it and explain what was really done.
> The API and ABI changes must be described in the release notes.
>
> Thanks
>
Will do that shortly. Thanks for reminding this.
-Akhil
^ permalink raw reply [relevance 0%]
* [dpdk-dev] rte_security deprecation
@ 2017-10-30 11:06 3% Thomas Monjalon
2017-10-30 11:30 0% ` Akhil Goyal
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-30 11:06 UTC (permalink / raw)
To: akhil.goyal; +Cc: pablo.de.lara.guarch, declan.doherty, dev
Hi,
The deprecation notice for rte_security was not removed:
http://dpdk.org/commit/be7c7cce25
Please submit a patch to remove it and explain what was really done.
The API and ABI changes must be described in the release notes.
Thanks
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v11 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-10-30 8:28 4% ` [dpdk-dev] [PATCH v11 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-10-30 8:28 1% ` Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-30 8:28 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
config/common_base | 5 +
doc/guides/rel_notes/release_17_11.rst | 9 +
drivers/bus/Makefile | 4 +-
drivers/bus/vdev/Makefile | 57 +++++
drivers/bus/vdev/rte_bus_vdev.h | 153 +++++++++++++
drivers/bus/vdev/rte_bus_vdev_version.map | 8 +
drivers/bus/vdev/vdev.c | 344 ++++++++++++++++++++++++++++
drivers/crypto/Makefile | 1 +
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 +-
drivers/crypto/armv8/rte_armv8_pmd.c | 2 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 2 +-
drivers/crypto/mrvl/rte_mrvl_pmd.c | 2 +-
drivers/crypto/null/null_crypto_pmd.c | 2 +-
drivers/crypto/openssl/rte_openssl_pmd.c | 2 +-
drivers/crypto/scheduler/scheduler_pmd.c | 2 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 2 +-
drivers/crypto/zuc/rte_zuc_pmd.c | 2 +-
drivers/event/Makefile | 2 +-
drivers/event/dpaa2/dpaa2_eventdev.c | 2 +-
drivers/event/octeontx/ssovf_evdev.c | 2 +-
drivers/event/skeleton/skeleton_eventdev.c | 2 +-
drivers/event/sw/sw_evdev.c | 2 +-
drivers/net/Makefile | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/failsafe/failsafe.c | 2 +-
drivers/net/kni/rte_eth_kni.c | 2 +-
drivers/net/mrvl/mrvl_ethdev.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/octeontx/octeontx_ethdev.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/softnic/rte_eth_softnic.c | 2 +-
drivers/net/tap/rte_eth_tap.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
lib/librte_eal/bsdapp/eal/Makefile | 3 +-
lib/librte_eal/common/.eal_common_dev.c.swp | Bin 0 -> 16384 bytes
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_vdev.c | 342 ---------------------------
lib/librte_eal/common/include/rte_dev.h | 24 +-
lib/librte_eal/common/include/rte_vdev.h | 131 -----------
lib/librte_eal/linuxapp/eal/Makefile | 3 +-
lib/librte_eal/rte_eal_version.map | 4 -
lib/librte_ether/rte_ethdev_vdev.h | 2 +-
lib/librte_eventdev/rte_eventdev_pmd_vdev.h | 2 +-
mk/rte.app.mk | 1 +
test/test/autotest_data.pyc | Bin 0 -> 6122 bytes
test/test/autotest_test_funcs.pyc | Bin 0 -> 6812 bytes
test/test/test_cryptodev.c | 1 +
test/test/test_event_eth_rx_adapter.c | 1 +
test/test/test_eventdev.c | 1 +
test/test/test_eventdev_octeontx.c | 1 +
test/test/test_eventdev_sw.c | 1 +
| 1 +
57 files changed, 622 insertions(+), 539 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev.h
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/vdev.c
create mode 100644 lib/librte_eal/common/.eal_common_dev.c.swp
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
create mode 100644 test/test/autotest_data.pyc
create mode 100644 test/test/autotest_test_funcs.pyc
diff --git a/config/common_base b/config/common_base
index 82ee754..d39e657 100644
--- a/config/common_base
+++ b/config/common_base
@@ -814,3 +814,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y
# Compile the eventdev application
#
CONFIG_RTE_APP_EVENTDEV=y
+
+#
+# Compile the vdev bus
+#
+CONFIG_RTE_LIBRTE_VDEV_BUS=y
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index bab5d73..8f76ecd 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -406,6 +406,14 @@ API Changes
* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+* **Moved vdev bus APIs outside of the EAL**
+
+ Moved the following APIs from ``librte_eal`` to ``librte_bus_vdev``:
+ * ``rte_vdev_init``
+ * ``rte_vdev_register``
+ * ``rte_vdev_uninit``
+ * ``rte_vdev_unregister``
+
ABI Changes
-----------
@@ -461,6 +469,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_acl.so.2
+ librte_bitratestats.so.2
+ + librte_bus_vdev.so.1
librte_cfgfile.so.2
librte_cmdline.so.2
+ librte_cryptodev.so.4
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index a220d27..6c7e203 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -30,12 +30,12 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-
DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile
new file mode 100644
index 0000000..84bd724
--- /dev/null
+++ b/drivers/bus/vdev/Makefile
@@ -0,0 +1,57 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_bus_vdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# versioning export map
+EXPORT_MAP := rte_bus_vdev_version.map
+
+# library version
+LIBABIVER := 1
+
+SRCS-y += vdev.c
+
+LDLIBS += -lrte_eal
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_bus_vdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
new file mode 100644
index 0000000..41762b8
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -0,0 +1,153 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
+ struct rte_device device; /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.name)
+ return dev->device.name;
+ return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.devargs)
+ return dev->device.devargs->args;
+ return "";
+}
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_probe_t *probe; /**< Virtual device probe function. */
+ rte_vdev_remove_t *remove; /**< Virtual device remove function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static const char *vdrvinit_ ## nm ## _alias;\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+ rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+/**
+ * Initialize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @param args
+ * The pointer to arguments used by driver initialization.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_init(const char *name, const char *args);
+
+/**
+ * Uninitalize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_uninit(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/bus/vdev/rte_bus_vdev_version.map b/drivers/bus/vdev/rte_bus_vdev_version.map
new file mode 100644
index 0000000..6ccb789
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev_version.map
@@ -0,0 +1,8 @@
+DPDK_17.11 {
+ global:
+
+ rte_vdev_init;
+ rte_vdev_register;
+ rte_vdev_uninit;
+ rte_vdev_unregister;
+};
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
new file mode 100644
index 0000000..04ed49b
--- /dev/null
+++ b/drivers/bus/vdev/vdev.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/queue.h>
+
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_bus.h>
+#include <rte_common.h>
+#include <rte_devargs.h>
+#include <rte_memory.h>
+#include <rte_errno.h>
+
+#include "rte_bus_vdev.h"
+
+/* Forward declare to access virtual bus name */
+static struct rte_bus rte_vdev_bus;
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+ TAILQ_HEAD_INITIALIZER(vdev_device_list);
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_vdev_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_vdev_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+static int
+vdev_parse(const char *name, void *addr)
+{
+ struct rte_vdev_driver **out = addr;
+ struct rte_vdev_driver *driver = NULL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)) == 0)
+ break;
+ if (driver->driver.alias &&
+ strncmp(driver->driver.alias, name,
+ strlen(driver->driver.alias)) == 0)
+ break;
+ }
+ if (driver != NULL &&
+ addr != NULL)
+ *out = driver;
+ return driver == NULL;
+}
+
+static int
+vdev_probe_all_drivers(struct rte_vdev_device *dev)
+{
+ const char *name;
+ struct rte_vdev_driver *driver;
+ int ret;
+
+ name = rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
+
+ if (vdev_parse(name, &driver))
+ return -1;
+ dev->device.driver = &driver->driver;
+ ret = driver->probe(dev);
+ if (ret)
+ dev->device.driver = NULL;
+ return ret;
+}
+
+static struct rte_vdev_device *
+find_vdev(const char *name)
+{
+ struct rte_vdev_device *dev;
+
+ if (!name)
+ return NULL;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ const char *devname = rte_vdev_device_name(dev);
+
+ if (!strncmp(devname, name, strlen(name)))
+ return dev;
+ }
+
+ return NULL;
+}
+
+static struct rte_devargs *
+alloc_devargs(const char *name, const char *args)
+{
+ struct rte_devargs *devargs;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ return NULL;
+
+ devargs->bus = &rte_vdev_bus;
+ if (args)
+ devargs->args = strdup(args);
+ else
+ devargs->args = strdup("");
+
+ ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
+ free(devargs->args);
+ free(devargs);
+ return NULL;
+ }
+
+ return devargs;
+}
+
+int
+rte_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (dev)
+ return -EEXIST;
+
+ devargs = alloc_devargs(name, args);
+ if (!devargs)
+ return -ENOMEM;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ ret = vdev_probe_all_drivers(dev);
+ if (ret) {
+ if (ret > 0)
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ goto fail;
+ }
+
+ TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ return 0;
+
+fail:
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return ret;
+}
+
+static int
+vdev_remove_driver(struct rte_vdev_device *dev)
+{
+ const char *name = rte_vdev_device_name(dev);
+ const struct rte_vdev_driver *driver;
+
+ if (!dev->device.driver) {
+ RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
+ return 1;
+ }
+
+ driver = container_of(dev->device.driver, const struct rte_vdev_driver,
+ driver);
+ return driver->remove(dev);
+}
+
+int
+rte_vdev_uninit(const char *name)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (!dev)
+ return -ENOENT;
+
+ devargs = dev->device.devargs;
+
+ ret = vdev_remove_driver(dev);
+ if (ret)
+ return ret;
+
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
+
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return 0;
+}
+
+static int
+vdev_scan(void)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+
+ /* for virtual devices we scan the devargs_list populated via cmdline */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->bus != &rte_vdev_bus)
+ continue;
+
+ dev = find_vdev(devargs->name);
+ if (dev)
+ continue;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev)
+ return -1;
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ }
+
+ return 0;
+}
+
+static int
+vdev_probe(void)
+{
+ struct rte_vdev_device *dev;
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+
+ if (dev->device.driver)
+ continue;
+
+ if (vdev_probe_all_drivers(dev)) {
+ RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
+ rte_vdev_device_name(dev));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static struct rte_device *
+vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+ const void *data)
+{
+ struct rte_vdev_device *dev;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ if (start && &dev->device == start) {
+ start = NULL;
+ continue;
+ }
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
+static int
+vdev_plug(struct rte_device *dev)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+static int
+vdev_unplug(struct rte_device *dev)
+{
+ return rte_vdev_uninit(dev->name);
+}
+
+static struct rte_bus rte_vdev_bus = {
+ .scan = vdev_scan,
+ .probe = vdev_probe,
+ .find_device = vdev_find_device,
+ .plug = vdev_plug,
+ .unplug = vdev_unplug,
+ .parse = vdev_parse,
+};
+
+RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index d551541..1cb4cdb 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -32,6 +32,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
+core-libs += librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 1d18217..88554c3 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_byteorder.h>
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index a589557..7004389 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 2d2f3ff..97719f2 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 7c1b56b..e76821d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
index 63895c5..1f09d7d 100644
--- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
+++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
@@ -36,7 +36,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 4b9a58a..62a2802 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 25c1154..06e1a6d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 40ab304..acdf636 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,7 +33,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_reorder.h>
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index fe7bb86..2738b2c 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index b99f6ec..1f4ca7b 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 05dec1b..9c9ae82 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_ether librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 45e2ebc..c293087 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -52,7 +52,7 @@
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_pci.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_ethdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index cfbd958..7606b60 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -43,7 +43,7 @@
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_memzone.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "ssovf_evdev.h"
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 4d1a1da..70bb186 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -47,7 +47,7 @@
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_lcore.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "skeleton_eventdev.h"
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index 178f169..0b54afa 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -33,7 +33,7 @@
#include <inttypes.h>
#include <string.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_memzone.h>
#include <rte_kvargs.h>
#include <rte_ring.h>
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index cf33233..00be153 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -37,7 +37,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)
endif
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-core-libs += librte_net librte_kvargs
+core-libs += librte_net librte_kvargs librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 28e6a94..fa84eb9 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -41,7 +41,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 8c602f8..980e636 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -37,7 +37,7 @@
#include <rte_malloc.h>
#include <rte_ethdev.h>
#include <rte_tcp.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include "rte_eth_bond.h"
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index af33529..9f66dfc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -43,7 +43,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 6006bef..6bc5aba 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -37,7 +37,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "failsafe_private.h"
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index d68ff7a..36e90fd 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -40,7 +40,7 @@
#include <rte_kni.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
/* Only single queue supported */
#define KNI_MAX_QUEUE_PER_PORT 1
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 03d9fec..c60ee37 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -36,7 +36,7 @@
#include <rte_kvargs.h>
#include <rte_log.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
/* Unluckily, container_of is defined by both DPDK and MUSDK,
* we'll declare only one version.
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 3433c9c..032c30e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -36,7 +36,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 86de5d1..bd24ec3 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -44,7 +44,7 @@
#include <rte_kvargs.h>
#include <rte_malloc.h>
#include <rte_prefetch.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "octeontx_ethdev.h"
#include "octeontx_rxtx.h"
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 3205df8..f683d3a 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -44,7 +44,7 @@
#include <rte_kvargs.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#define RTE_ETH_PCAP_SNAPSHOT_LEN 65535
#define RTE_ETH_PCAP_SNAPLEN ETHER_MAX_JUMBO_FRAME_LEN
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index d82d207..cdc3cc1 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index abb617a..3e47c2f 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -38,7 +38,7 @@
#include <rte_ethdev.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
#include <rte_ring.h>
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 64dd3b0..6b27679 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -39,7 +39,7 @@
#include <rte_ethdev.h>
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_net.h>
#include <rte_debug.h>
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index f98c980..53f61f0 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -39,7 +39,7 @@
#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_vhost.h>
#include <rte_spinlock.h>
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 0cfa27b..7be57ce 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -40,7 +40,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
#include <rte_ethdev_vdev.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_alarm.h>
#include "virtio_ethdev.h"
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 934c12b..5d9ace9 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -48,7 +48,7 @@ LDLIBS += -lgcc_s
EXPORT_MAP := ../../rte_eal_version.map
-LIBABIVER := 6
+LIBABIVER := 7
# specific to bsdapp exec-env
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c
@@ -67,7 +67,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/common/.eal_common_dev.c.swp b/lib/librte_eal/common/.eal_common_dev.c.swp
new file mode 100644
index 0000000000000000000000000000000000000000..86626d122c3c6ce6980bc1ff0419c99ff5647222
GIT binary patch
literal 16384
zcmeI2Ym6IL6~`wj(6~v%qX_X3;>J;ky?7sKLn|fO4PJY8cZ%0uX2!c+NM(&Z<K1cP
z8E0m^VQDC+P$(3{LwtY=Xak4>f={%i`A}6zNQjq&RKbU~Qom5~6e4L6MbMW2xp&4M
zd%f9&FH~q&`mODm>vPZjpL6frIpg}&va-l-nm8)q?{$*&#JP*B-#Bucbn5VKDKH#5
zy5nDQsrcTh8+U9b-3fz}Yj!YccFfzyH%x0|vSrr^FR*Hs(VA?y?Y8So;%!a5t)bCG
zV`tMzi$sA$fgKgNR=VN(BU9AuVEO>N?hVx)zmYUZ6i5_E6i5_E6i5_E6i5_E6i5{K
z|4|_5?3O-);p`5FbVvBQYv}c=@bl^L_3Y63@MH3lD3B<SD3B<SD3B<SD3B<SD3B<S
zD3B<SD3B=d3RJ)_C21f0dLtD8@cciz|Nr-ECF#%L58zwiF0c+P@OJQ<{gU)k@Dp$r
zyc_)KT1h$wZUu8-H#iUD9&o`s!83a$=}X{d@bWb{4;*k1JeiWD&jA_a!F#|scni1+
z{ACY(0>1@62Hyc+0B6A+pbiX>2K&K2aN%l6`WtuxoCiMu-v{@CPl0>DNiYr4-~f=o
zORtfn7s2D;G4LSxHn<a<1mj=~WWmd?hF{>j;C}E~@M%y4`@mlC!mA|d5%4hhCO8Kk
z0H=WqRzU@n!7*?(_&bU&7r_PaD{vls6r2V%a0+|?oCMc^e;|g>gXh4L;Md@b;A3C|
z1i%LtI0y~^iu-jS{+DX38y*{TjJ9<g3DNAfTJ$@N8Xd?qT*nWXXi@L_ITk;FR)Yr&
zZ_Uq2eqaQ4Bm9yieOO9)R?zhvhL__~DwV?b#%IWUmOiSwTq{-PGqS4Yn4B-=Si0!h
z8<xi!hU2&aGp)dAtg~R<!rKkIVX@31KYPka=cJU~WEq&v@;=x!gOB4gU8mFPu4T{|
z9Y`rS5P2{zmn*tfUD~GK*{;u;U8fP)uEVHnzuW1!__>OS-pE<%F4hH`o@V80sgz}y
zNQ3<-<>h?o@<v+_!))4)N&d5@>x~{Los9LE;-4A)ng;J`^!-|WlVS&rMvuPd)d<lQ
zXTxaOX4G}Zb2n_$GACj~hv~Qj(8CGBsQQ7|ZQz4&hK<1^$|l}G{M?5pm55~~);bL7
z7)2|dEd5X+eCeVHyb<tJuzlt_t<8RTxMoWQg&EM0ergns!jHV)GG4?hN{aC3NVRo0
zpuDLWrYV9<DVk&AKWy^s4wC=_XtX==X6a7DPG?D;DR%ZO8_|IL3R@sw2ePskm(-=E
zMb$CtEsF&%<GEt=vL!Y(4j=Ll_ov2{WQ>^bVgK9tw?#*m9?BaeFNEs0Ehq3<lti%{
zq7I@YBB4TIqeEgU#qxuOuw6EZbQoBqM6`xhDX}iaR-!OE=vypABFcQVh<{c1%D6I=
z&Ed*MNsZ_auaYsRVVKq_O6q8Z+;B0s#<;10Jiml1QGy-`la9M<inZ}TxbjG;$uZ{N
zZg-dv!-^&_RGUPSUurnv$pO!{43Q?BWnSi3aiy`HMyqRDEKNV_>%dtfuqM{iu`?%V
z!nNGBiS?O&bAHgY>fMot`P>`Teq-xFBn%ylnf5pR$<tk{3qRsLB8<Ui$KtJfZl6Fr
zY-h*`KQL{V8zoWM7-Ot5$Mgk7V_IcSU&*U7E?vuVnJIHDUtCr+xhPu5Y^kDY%B)gS
z^i?{fRSOHOm|x7#%M-#<MkyCc)uK|KXJvW5q|D3Zg3Kx^tLO`|x&m8SmRA*x8YpF!
zFR!wdJZx3<sEev53sd+)MdjU;l)UIO$5s|(GDP1kRLZ)VFX%a@>8euDS*#g4)GMkk
z3>EWwK1V(*sg*fJ*N)Ts*(!XHH4T<@T&$~0x>6};*+OLnLswZL4?l|V4@2i}3R5Lz
zQPFW+ujI&Dp{mM@a+&+CRcAF_(W|=5<|~z=MxAJ~x~vpr^jLy$G(uR-2~*mVTu^9(
zAm1V{E|v1?D)$ki(&YD5VH77rZ8g@HH3!dih6}&2Qdud(TXe<MP;joIYHU{KVw7Yy
zhf^eSQBh@*N-6i>6_g^nfeXS^o-O57T`5%I3tOtHh_#GZ$@s2TDCLz!xi~?(mn%Fw
zbfzujOC=<ZjLw%<Rb_r5bSkbAomMbD1*##n)I0_zb14>OwXlGXVQjh92oDbm+!juy
z^N5g^<|k<!@-0g$MGeE+YL$i;X5WxZ1KACO6ue~&zsP1+2S<PmC>3RBNTH953V(!4
zm@lm9xozy>aOw8lW^l&vEOy2Y*4-|4SsklkH?d{Ja)Hao8P5&^%V8bMYumn$y;wL?
z$PCsqOwf8aa6O;3jZId!Sl7p@hpVFHm^f-N*uaIS?FJUTn%I~4xXjSHX-58xv9g8U
zvB{)sCtv5?CR3ciYO#XrVbg~_EZ+q7TVT`CWOm?3HW)K)S}owrppX1=>^Ar{P?*8C
zWD;JvyvH_HM9(%_{mUa)f;{P)#_khWkepDgg?^}W4BoV<GoNpCsGp|WYPn~yVv#eA
zmSMLsCfkV&jWN}Vd+FmGtJ{v@ZPK2p&Dvd<_AH?j_7*T{)ZGmWeRVcHdu=_4OflLK
z|JOeCLb%l<49s`C9<G-S7Z;AuqriZtqumi6Q3kcG;F$Q-c1=nlE_V()5QLu62Z?0%
zb|Ell1l(p{wZ5dn&Y)aeW~3LX7Wzm#%$R_<C89K@oD0(#c7&;XtHrp2J_PnH59t@G
zP>8h6G_vgasUt_(jVoAYm^P8$rp44aZ?+{tC)hT<2p49xB9^s+j0IAf92=MD{y&TR
z(-htJ;{HE+zW*HV@h^f$!2{r4un1<ragYN4!ae^#!3*FK@OAK2@CnccI+zF3-~@OR
z*bRP;y1=90Vek;R53GWl!A;;OxB=_}e?`sUY48+y415oK1>6Jf1|J8ffC^568Spmn
zdhilz3@?H|0;)Uw68r*u27C}qgDLP1un(lb9&iD*h-blr;LG4{a2M!;+kg#j1v&6m
zupjINyTJ3PQ~Vx03w{Ug2VVo91P(Ak15AS~xPThPGvI0P6nGp^J);fY4_3f3V1Viw
zKSP{;1RerE1owf@0~Hj&o55Z{@!SKFzeIsVfkc5sfgKbWE=oo<Alzb8v7qKzZES+5
zz9R|>I8JYP!Sa7vzwA|tMpR<rg+!`kt@Vlly^1N7TcUwbF%uu-l@}UXR7K_WM0}=V
zA{9AN$cWWEaxqIo#iD+Rl`52%uJq1D)mBln9W1)CI=1&H{|uIUxy`V7tQxw-3EZer
z{dEVO;`XVtxHxn!*26aSR{BPiD7=D1<snh(9$gWFSFsb+$*B5PRE-QXF<!?B-Ha+r
zqB<W1HeN#&UNk++%7o*xJdc;4jtRN=DbwI-9ljr*iPt$VcV1B0j%>pVeEk@9B<P!J
z{!<uj+yP$qTyyDet=F8wbfuFjtOU~yg2>UKETM-2@QK`r5_-!+fe~(q=2Uww%FB^o
zQBLfXOCl*p%sTPl0Dcan6aP#(H$Jo7TpKFB4Nkh$R{uvn4)O6ECBrlGGQKe!aNEJ1
zOOW9?f-vpe<*<Q{fm?E(e(;_$O=Mor5Q$4d_my9i7jb~EPR5{M_=tx>xZ!PNj^vnc
zf5>v1nK4)uqk{=bIf`E22HEdfk$8O_RtBGP^(GWTLhZTE;WXH?u0+p|u3&Ma%)9KR
zjW>=hJ6jxh1uSgwM~3mm4Em95D0~|TVQiJdiKrkxcp|?1VHJokbD^>9z(b^HS)_+F
z@y5Ln#t%l}jIW7dzWEM{O-|4ZGqYtmc<y+}KX%B^9rDvTnwC5ZsFr|-ns7Syz=ke|
zI5KiQaJwy&$C~FUN<BQ+qD6{&-{xTmU#>*9#*!S4QRjF;*7lqh*W;;6y3F3i@ZbPZ
Nz%;1^3>J<{{{d!`pU?mR
literal 0
HcmV?d00001
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 16a2f26..9effd0d 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
INC += rte_service.h rte_service_component.h
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index f7e547a..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/queue.h>
-
-#include <rte_eal.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
-#include <rte_vdev.h>
-#include <rte_common.h>
-#include <rte_devargs.h>
-#include <rte_memory.h>
-#include <rte_errno.h>
-
-/* Forward declare to access virtual bus name */
-static struct rte_bus rte_vdev_bus;
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
-
-static struct vdev_device_list vdev_device_list =
- TAILQ_HEAD_INITIALIZER(vdev_device_list);
-struct vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_vdev_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_vdev_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-static int
-vdev_parse(const char *name, void *addr)
-{
- struct rte_vdev_driver **out = addr;
- struct rte_vdev_driver *driver = NULL;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (strncmp(driver->driver.name, name,
- strlen(driver->driver.name)) == 0)
- break;
- if (driver->driver.alias &&
- strncmp(driver->driver.alias, name,
- strlen(driver->driver.alias)) == 0)
- break;
- }
- if (driver != NULL &&
- addr != NULL)
- *out = driver;
- return driver == NULL;
-}
-
-static int
-vdev_probe_all_drivers(struct rte_vdev_device *dev)
-{
- const char *name;
- struct rte_vdev_driver *driver;
- int ret;
-
- name = rte_vdev_device_name(dev);
-
- RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
- rte_vdev_device_name(dev));
-
- if (vdev_parse(name, &driver))
- return -1;
- dev->device.driver = &driver->driver;
- ret = driver->probe(dev);
- if (ret)
- dev->device.driver = NULL;
- return ret;
-}
-
-static struct rte_vdev_device *
-find_vdev(const char *name)
-{
- struct rte_vdev_device *dev;
-
- if (!name)
- return NULL;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- const char *devname = rte_vdev_device_name(dev);
- if (!strncmp(devname, name, strlen(name)))
- return dev;
- }
-
- return NULL;
-}
-
-static struct rte_devargs *
-alloc_devargs(const char *name, const char *args)
-{
- struct rte_devargs *devargs;
- int ret;
-
- devargs = calloc(1, sizeof(*devargs));
- if (!devargs)
- return NULL;
-
- devargs->bus = &rte_vdev_bus;
- if (args)
- devargs->args = strdup(args);
- else
- devargs->args = strdup("");
-
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
- if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
- free(devargs->args);
- free(devargs);
- return NULL;
- }
-
- return devargs;
-}
-
-int
-rte_vdev_init(const char *name, const char *args)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (dev)
- return -EEXIST;
-
- devargs = alloc_devargs(name, args);
- if (!devargs)
- return -ENOMEM;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
- ret = -ENOMEM;
- goto fail;
- }
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- ret = vdev_probe_all_drivers(dev);
- if (ret) {
- if (ret > 0)
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- goto fail;
- }
-
- TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- return 0;
-
-fail:
- free(devargs->args);
- free(devargs);
- free(dev);
- return ret;
-}
-
-static int
-vdev_remove_driver(struct rte_vdev_device *dev)
-{
- const char *name = rte_vdev_device_name(dev);
- const struct rte_vdev_driver *driver;
-
- if (!dev->device.driver) {
- RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
- return 1;
- }
-
- driver = container_of(dev->device.driver, const struct rte_vdev_driver,
- driver);
- return driver->remove(dev);
-}
-
-int
-rte_vdev_uninit(const char *name)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (!dev)
- return -ENOENT;
-
- devargs = dev->device.devargs;
-
- ret = vdev_remove_driver(dev);
- if (ret)
- return ret;
-
- TAILQ_REMOVE(&vdev_device_list, dev, next);
-
- TAILQ_REMOVE(&devargs_list, devargs, next);
-
- free(devargs->args);
- free(devargs);
- free(dev);
- return 0;
-}
-
-static int
-vdev_scan(void)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
-
- /* for virtual devices we scan the devargs_list populated via cmdline */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->bus != &rte_vdev_bus)
- continue;
-
- dev = find_vdev(devargs->name);
- if (dev)
- continue;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev)
- return -1;
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- }
-
- return 0;
-}
-
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
-
- if (dev->device.driver)
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
- RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
- rte_vdev_device_name(dev));
- return -1;
- }
- }
-
- return 0;
-}
-
-static struct rte_device *
-vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
- const void *data)
-{
- struct rte_vdev_device *dev;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- if (start && &dev->device == start) {
- start = NULL;
- continue;
- }
- if (cmp(&dev->device, data) == 0)
- return &dev->device;
- }
- return NULL;
-}
-
-static int
-vdev_plug(struct rte_device *dev)
-{
- return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
-}
-
-static int
-vdev_unplug(struct rte_device *dev)
-{
- return rte_vdev_uninit(dev->name);
-}
-
-static struct rte_bus rte_vdev_bus = {
- .scan = vdev_scan,
- .probe = vdev_probe,
- .find_device = vdev_find_device,
- .plug = vdev_plug,
- .unplug = vdev_unplug,
- .parse = vdev_parse,
-};
-
-RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4c4ac7e..8088dcc 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -170,28 +170,6 @@ struct rte_device {
};
/**
- * Initialize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @param args
- * The pointer to arguments used by driver initialization.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_init(const char *name, const char *args);
-
-/**
- * Uninitalize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_uninit(const char *name);
-
-/**
* Attach a device to a registered driver.
*
* @param name
@@ -316,4 +294,4 @@ __attribute__((used)) = str
}
#endif
-#endif /* _RTE_VDEV_H_ */
+#endif /* _RTE_DEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 29f5a52..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_VDEV_H
-#define RTE_VDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
- TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
- struct rte_device device; /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
- container_of(ptr, struct rte_vdev_device, device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.name)
- return dev->device.name;
- return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.devargs)
- return dev->device.devargs->args;
- return "";
-}
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
- rte_vdev_probe_t *probe; /**< Virtual device probe function. */
- rte_vdev_remove_t *remove; /**< Virtual device remove function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-RTE_INIT(vdrvinitfn_ ##vdrv);\
-static const char *vdrvinit_ ## nm ## _alias;\
-static void vdrvinitfn_ ##vdrv(void)\
-{\
- (vdrv).driver.name = RTE_STR(nm);\
- (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
- rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 1d3a42d..2975c25c 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -37,7 +37,7 @@ ARCH_DIR ?= $(RTE_ARCH)
EXPORT_MAP := ../../rte_eal_version.map
VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)
-LIBABIVER := 6
+LIBABIVER := 7
VPATH += $(RTE_SDK)/lib/librte_eal/common
@@ -74,7 +74,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index d2a4ff9..5966a03 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -166,10 +166,6 @@ DPDK_17.05 {
rte_log_set_global_level;
rte_log_set_level;
rte_log_set_level_regexp;
- rte_vdev_init;
- rte_vdev_register;
- rte_vdev_uninit;
- rte_vdev_unregister;
vfio_get_container_fd;
vfio_get_group_fd;
vfio_get_group_no;
diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h
index 4d2c3e2..ff92e6e 100644
--- a/lib/librte_ether/rte_ethdev_vdev.h
+++ b/lib/librte_ether/rte_ethdev_vdev.h
@@ -35,7 +35,7 @@
#define _RTE_ETHDEV_VDEV_H_
#include <rte_malloc.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include <rte_ethdev.h>
/**
diff --git a/lib/librte_eventdev/rte_eventdev_pmd_vdev.h b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
index 135e8b8..56232de 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h
@@ -48,7 +48,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_eal.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
#include "rte_eventdev_pmd.h"
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 047121d..de2f557 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -101,6 +101,7 @@ _LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
diff --git a/test/test/autotest_data.pyc b/test/test/autotest_data.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e2e917de5c2ffd5315f7d32c484f4fa4659a25a6
GIT binary patch
literal 6122
zcmb_f340vH5$%<PWyuG|nEP6efG~)~vc22{AsZ0Zie+UC7?Nc))4LjLE>HJLh&z}B
z5|W>iUzZ;M^}5#6J^Rh<mpHbi@$`H3s=I2ctJ|~xIkvd^@9w9*82>p=|Gq`P>Vv~V
z1oYDokr1&ESA}R`JR_opxE#!ip9q@~!JK)S72&K1?hwHt(U$Z!FK#qMa9Fg%IT0*~
zU{SP#BO*9TECI)8^iL5SXZlX2PcVIGlD>=SlQrtQnLbrR-^291HS~Q<-(N#N!1RL^
z^l)AT4^aRV?87GP;E^KWM_Kk5%gC@CaFglBnLa#8Kf&~qOjGj8>Zh3gL&chq?5CN2
zriNZ(`q>)#G}F)3(9biyTtN>hj&VL-D9WJamcffGK2ssa!dI9+TSK2?`g{%DX8NTX
z`emkHsi9wG`n3vrNCi2L>-8e8H{7`1Wbq#>#E9!HrdMm|x0zn6p)W9fv4(z!>33`B
z_n2O<pq;qh=lZ==)b9q%IxJh9tiVmCKdA7EfV)h8SVQ-i-m0N5GyPEoJ*56J{uEb=
zPf;qdk6HXlg%~UQl<BKA^k+<eUPJ$h=|9)deWt&tpq+(#oa^l(*FMXF3K^CxnI6>8
zL#B5s=pl6`$`<vht4B<C4teTp#nihjj;h4ey~nAJCuIrC(&@5nQg)qX`E;2wG8`e=
z-D4vb?@br)7vfS?e97X2>Ef@d#b2}do9W_jIa+%Je8;lyr^|krl>LQeKTen3n3Vm*
zvcFE3{jEB}pIQ9Nbn)M-#s6UOul3^L5pngXp!0rf>0flQ2!EqLOAUI{bMzQS={Ao5
zoi_Inyv@?@8vUxL>7nU|3bKKUpr3Dr_(tF+vO6PkIxT0#7LB)-;BQksO3#)$P_01j
zg}zjH*D`J;X&}wxbVwE=#4JlQ^w5|ql1Y#L5xkZ|^p;CCiu95J@lY%DXzir2Y-ulP
z4MW`uvS4?4kLGD<sWd;lkxnt{2cGs`$PV-ok|m?KuTp<kYV{0U(cOx!Qzsio8*>dG
z3n_*C2muuAH4`;OMj;OyLeGdBLY$((mRa^Dr9_D5m#})1%4=zum{^p~d&mXH0-ol-
zJ%MC0zZuAj<X0hoqM_&MIn2{h)<2_>yKXKA;g=!8G~<qp)BHf)N#nHxKa#3>GfigY
zn_et6NZ*kCf`s3-G>*L_Foy4p65lxN$t=ya!fo|(7|Y!H1Ec{JUX0ZRxjh<|tpY%0
ztBZM_q-84!sBG1ddU8fuzdNG|l-8Xl)|rXVVAk7RwAh|h=_vQ5wFFAlXVAh{-+@@E
zu#}VS6)FlL&a_QtImy-yCX7wu3n%J+!g|sRTKjpZWiz6hEDQ2|U{-L91RLql`CvdI
zLafb6Le{z;H3yOB8X^oo8yVCZpCI&#%vI>-2H+lp*780AFRpGh2O$-V*~8_fN-ydU
zCYE9B%gey(j45F29bvrZsU7PR$POWejg#oJp`c8wqhzwt?N|+fD2oe;GWqIu+SbJ6
zD~sFK1|Nn#mY*G1tMSJo%-SI<WcO8?IK=^wzA8X#3H6rF!^A0ZVAKf+vv$}VtC5$-
zc49ytpu)-t`&{?~ydcW%+PW11$o#O7aQ%4^)s8hXAsNit-Alp_wbgJr%TsF3PF>wY
zR19j&SP?SV*&Yq7YalTp)&^g>EA!>ZPje?*fYGxIY^|a1m9hn-lq)9-=glrVyP{Ch
zTUnTtw+&D=M(q@L6Z-Z6?Xffu+-`vtZ4+)_Yi>H(>iWiqHb~RSyfC_Mt&pQ}KU|K&
z$+Ga{0H8I;8rBo)O!+9&PO7m6Ix842%$<na>R~c5-4^>amom}0m-tS>qLU1$9rrC+
zcv9oa&C)co@r)}MVA*n2r*Y^z>qF&u2DFCAGL99geP_=C&Bmy;MS1pQV5bI<%b>7u
zLVd}6-1a&1al4%h&GIh71g0*s*vd_IR((^yQK)p&PboicteDXAojCC^xBMM<QGgU6
zyDS`-a*vWtcM5ZqpFgu=diKRJNHdjB6?}%9iawLp9j+b)srJ<=8W*0_zReE^$IyDf
z<zY7oO$WHNIne=#u$G9J`jYv&wBrUL?ldM*)WS?508Mi`%iXii?0QFL9b)n15FHUp
z^$?B86}o1nC&b{`TSp5-n7(e@JU}DU_bZ)XXB4*91<u|q-KP@@AFYcwn>;{<wDzX$
zz^d>0S=h%Zn9J)X1QxHZb=R9?*m^>UV^5CEx<!te-`$J*d$B@0Wrvrpbei;IeIc=~
zt@W}<4BwDULLQ_c-=Qiqf*xY6trujKHwHcqvf4vKt@MF(6t;zn%_Y-@i4z*L+`RSm
z&Gi|*MVV`C4^wG$k3bGQIw1-Ve0ijku!k9XNM8?)tA`tO?<_qu_DAOBbPUOe9rHaE
z+g8IiNt1q^fxR=Ew_E)m0Cx53aT<&w`Q{V!t}?nyoM<f0Ei5b?nr+NCj?Lm}{?6R`
z+wnQ0y)C}xi*>Nq|7V4_%ftNt9NDeT{NH5q)IvGilbY(W&Ew?Ss>e3wYJZcw<Nq+$
HXUD$-S%8l+
literal 0
HcmV?d00001
diff --git a/test/test/autotest_test_funcs.pyc b/test/test/autotest_test_funcs.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..794b45b4e9a79cc3ddbd08d5031d78e4c7a2387a
GIT binary patch
literal 6812
zcmcgxOK%)m8NF3)x4UCI?_?54GL=jc+8GBwA|$X#G?^s8fW|S^Mwub9Os8+zuDH9}
zsau^m$PtSS5<4VTgM?VkmRTT##BL<S9*Grf_yH4X7A#nXbH3YMUDfS&fEd!<*Y{QD
zKI)wB`|eHQACm`e{$}aJy6XIM@%J74%m+v`zK&`r^+RM_^${|T(gn%5N{>jUp!BF@
zMwBi}W>o1h$rP0?NoGvxvSdmGtX2*HJba0Ni**iIz;6`4Tlkp($&OMFkvi(RqZ}46
zEWQ}Cpb}R-EU0yihVLkPIL}<QgQlX|bX9y)=|if@a#_mXSNgCmk4w3x^bu9nM=^_I
z7-`XrAzcnk;@$n88Sm!5RSO$|Hb+pt)oM0tk@lii;;psXkxuwT5;lWYI|)C++(QQy
zvYccDIX)Y5S>|x3<lSHFKD-igvF2dfvTT7?LewaMuD0v-z?cdl1l1>gued90rg;$C
zHgW);pcT$CDIqaIq#I!rBt;a0?X94m$P~6R`Q`WCzjOBo%N5Q$;ajS2gbkgPS;V%j
zMzyAWJ`PN~kyKExBr#t{Zf2v^3}%vAG_xKiGkQyJUVW^C$1{A?Cbf3b5+F&|+ELwn
zb?a%uz0<*34UntdE`&A5ktk=<nQ%_wH<JE@Nn9R(!X&=E9FxGFsw{p{cH3@-Y%_W)
zVM2HFx#d2WEPLnkmHXVW{aW56uynh*m9CAOW%y#aHdzbzniaB^-y)M=i=)VU(FWMw
zQ3Yr(BB3e@Y6sdJQJV!(1ylff@_|wHu&AD6{1J5;N`3CCXJ`;XZ8|D$ib5<hM5GUN
z!GQ+wagm$_pAbp?T2W3M?4XoCRr(ktb{w010@GeJ?;_pWcxo1Ax9`th{YLHT+RBw_
zuMtEG6_!`7Oig=_!#K&en^t`@NLE9=U_1FhQQ_~HNRIYnHzAQZ<`5DJ(Yya{O?xK%
zaj>$N(nGOG^3p}jBt?cELx#$TZkO>gtzEN_soG1WIVKAA$V8tgK3U;Yt_kbHC=pFI
zYe{`WRJ<Oy+FPa~-BQ*{OB}32*3vzUbg(VPiaWDkoaP=hgJvs!nzH&GRGD)~$m*hd
zPSkp)quCRA?Q+UonDG4#yat$jP@E~)mh}kR|5OQxdQ@CPm-5yfU{@ZFsCBp?I3I8u
zI<VY!gqk0!rAKFk>m@0FLX$@9qI!tlGUjPG9Vlv3srY9ih26VgY8@!+SiTqrRS>AZ
zh)9M&6}nJXP%lM5RHPNu8AUN+w0rslM0FCIWG&cUlr~>Nx9<dvM$21^TTQRtiUY5!
zH}AZe%Qrs>lZ`O);-KD+P53zQ8jzo{kM^Fj8swW24=3&^<BzDdR;+{Ay19^y-A$sY
z(E2sj^O!xTjA&lbJWNv}-@FDfvAn^jaTkLxvRIDWL7(3I3HG4f_Bl?!!o+OA3S(zt
zpYz-=Rnd!?tuW&INOe_Z<t!5A6!DpK%J>xcaZkALiiHX1P54GCP5z=xPg!!svv4a?
zrTrZRtF*kv{v;avo2cWJ8nf=eYOF5N81x0dvns4#dUR5Jkrm3P!-Qfr_X{Ea5TQVG
z7HU%D`$q<t6r!!PYJt+A7AghR_w-39<_)az^%XM%ly5g$4{8nXNgO6tB3@G43?i=;
zdCi(hf;g`;tCvo=3u*`xPXovLruPx&)z$+qG+r|_CXCis`Xk4l4kU6MCMk&#`_;7P
zK>uf1`HZ$-At`ZisnhZq>FukO=%C^!IU%)CWu}o(Nc}RRXi_ObLS;&8q$8r7yZR*n
za`H)!E6Cui0*-F`)Wz+U?{?i8yo|(WIK=eMG<{yndZ{1L5mf09pdhH~vYc@qT~_xv
zCJsh&66$~eGXuiIPlYCA(NF}-cdE-bmzL%hydaKSvDdT&6kpM6tApKP9W>vid49ng
zXyz+h-u(!b5rD)iLn0{~kBeKN3C(cxb!@uuiNp5suHSak_BUGVtBugu^A8J6v%at7
zqvrswNo_beV=f{=Y*Y~2?UW0oAoF6yLAR32@(F9VX-7yqiI9$CVL8fmxFF}`9v6gS
zy+iV-*v%VCziAJ}mSBrYdnj8n9blOM3V@#|eLf5DbEPk&0OS7#z-LOol?C{-(idU0
zixdY_FdC_ZanFisd(?$nj=yj_Q=CwGGBXG|<Eew0y8ye)OU_b+O@jBb%lw+7FWEs4
z$u`_^^kr3jdUwDfjVcC#&&CECO17ai&~V5$l-0ecq#Vc5Us2T$c5v@;L`Hh)Q0w-F
z;xlKb%w<N?3K`T>(l4AH+>IQSQ1OL>o;X6;)-_k1#IMTs<7yMz@Y2y0RprWnZ&!NT
zWoMlAa0BwT%g5mnr6zqGV<Hj;2)rafZo7Ia1+m-nvAZK1PLP0r*#F2A9E^fV{#1}p
zb!t*%V4fDtk6nEw#k5=ex!S>G?85&bn8hw8DuMY|!Thpd7S$l;3s=7lPyV^W_Z~J2
zaGc-a0vCCf+lQL&V|p6a?kW_rXig!mCbc;6cvTa7Cc*uL@p#E#`tNx%QLTh=G*aSF
ztur1pL1Hh5p?mXUYO~D`Y9_3A#(obIqp9V+iocLX<S?tXM&m)PzUhVfdKz)papRQq
ziU>1uaeVdwV9&5LcZR;!Mi{qh5ihQ`YOx9I9aBiRYTinFGz9Scbx$&@*sWQwa!F5n
zm-N(1$OF7wxmY-9tw)J>!<(O589=$7L7D5J<N@Y93vg|A5Fk5^`5r*XBV-<BK7&Fd
zYUh`(;hI<9s7336CWv?ShO8!!fG)BS&SPp2L3Uxv%P#2}!KPOF!z{WP4*%bItsx#U
z1NOhhAHtT*3`m*X2r#Tm<`oa?l6il_x@2CE?SfehIkfdTcpGf?9oXnSdlz})+Y{EM
zoSDrR=kmq*eDNAQBm#OZ*DxRw4lEt0{W|#3?1=43BZl9j#{3EiB8E;}V9#|UdzN@Y
z#0P!KZZ@`%yHnJh#^)@ej8TNR2y$_+T67K~HzsA~i)pEhT(-4W9!GDq*hqy|h_t<h
zpP_lB<3>7oqyLIP1Ch$Ob=lUrAySz@oG=MH&;8l+`rev#c};n<zT1@qzy@yo{sZCh
z@!Yi?pOyQBK5EK6dLIq<i!lr_V;mw=!kojp<$8wKZxc>>;pSG#oE|Cbi!AsbAO2A$
zyj=2mRPcF!<X>PyXVIIZ<X-P`zXZT<He0&g2ySo$nd3yUe7IaHA1hxdUo4+3Z~O}Z
C_uuIN
literal 0
HcmV?d00001
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 72988c5..a83b361 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_bus_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index 56ed1f8..90a5c64 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
+#include <rte_bus_vdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 4118b75..ba39cba 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -37,6 +37,7 @@
#include <rte_memcpy.h>
#include <rte_eventdev.h>
#include <rte_dev.h>
+#include <rte_bus_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index b88b0d2..dbc36d9 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -45,6 +45,7 @@
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_random.h>
+#include <rte_bus_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index 5c7751b..f6a3fa3 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -51,6 +51,7 @@
#include <rte_pause.h>
#include <rte_service.h>
#include <rte_service_component.h>
+#include <rte_bus_vdev.h>
#include "test.h"
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 7dccc6e..54cbf12 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -48,6 +48,7 @@
#include <rte_log.h>
#include <rte_lcore.h>
#include <rte_memory.h>
+#include <rte_bus_vdev.h>
#include <rte_string_fns.h>
#include <rte_errno.h>
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v11 1/4] cryptodev: remove crypto vdev init API
@ 2017-10-30 8:28 4% ` Jianfeng Tan
2017-10-30 8:28 1% ` [dpdk-dev] [PATCH v11 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-30 8:28 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 2 ++
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
5 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e1..9120121 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -60,10 +60,5 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* librte_meter: The API will change to accommodate configuration profiles.
Most of the API functions will have an additional opaque parameter.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index b96b236..bab5d73 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -403,6 +403,8 @@ API Changes
the backing device supports the operation or if the operation was
successfully performed.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 8063211..973c8db 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index a0d3a12..2c1377b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -435,23 +435,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index e82296c..eb47308 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v10 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-10-27 3:23 4% ` [dpdk-dev] [PATCH v10 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-10-27 3:23 1% ` Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-27 3:23 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
config/common_base | 5 +
doc/guides/rel_notes/release_17_11.rst | 8 +
drivers/bus/Makefile | 4 +-
drivers/bus/vdev/Makefile | 57 +++++
drivers/bus/vdev/rte_bus_vdev_version.map | 8 +
drivers/bus/vdev/rte_vdev.h | 153 +++++++++++++
drivers/bus/vdev/vdev.c | 344 ++++++++++++++++++++++++++++++
drivers/crypto/Makefile | 1 +
drivers/event/Makefile | 2 +-
drivers/net/Makefile | 2 +-
lib/librte_eal/bsdapp/eal/Makefile | 3 +-
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_vdev.c | 342 -----------------------------
lib/librte_eal/common/include/rte_dev.h | 24 +--
lib/librte_eal/common/include/rte_vdev.h | 131 ------------
lib/librte_eal/linuxapp/eal/Makefile | 3 +-
lib/librte_eal/rte_eal_version.map | 4 -
mk/rte.app.mk | 1 +
test/test/test_cryptodev.c | 1 +
test/test/test_event_eth_rx_adapter.c | 1 +
test/test/test_eventdev.c | 1 +
test/test/test_eventdev_octeontx.c | 1 +
test/test/test_eventdev_sw.c | 1 +
| 1 +
24 files changed, 591 insertions(+), 509 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/rte_vdev.h
create mode 100644 drivers/bus/vdev/vdev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/config/common_base b/config/common_base
index 82ee754..d39e657 100644
--- a/config/common_base
+++ b/config/common_base
@@ -814,3 +814,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y
# Compile the eventdev application
#
CONFIG_RTE_APP_EVENTDEV=y
+
+#
+# Compile the vdev bus
+#
+CONFIG_RTE_LIBRTE_VDEV_BUS=y
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index bab5d73..08b1c3d 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -406,6 +406,13 @@ API Changes
* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+* **Moved the following APIs from eal library to bus_vdev library**
+
+ * ``rte_vdev_init``
+ * ``rte_vdev_register``
+ * ``rte_vdev_uninit``
+ * ``rte_vdev_unregister``
+
ABI Changes
-----------
@@ -461,6 +468,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_acl.so.2
+ librte_bitratestats.so.2
+ + librte_bus_vdev.so.1
librte_cfgfile.so.2
librte_cmdline.so.2
+ librte_cryptodev.so.4
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index a220d27..6c7e203 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -30,12 +30,12 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-
DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile
new file mode 100644
index 0000000..fe31654
--- /dev/null
+++ b/drivers/bus/vdev/Makefile
@@ -0,0 +1,57 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_bus_vdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# versioning export map
+EXPORT_MAP := rte_bus_vdev_version.map
+
+# library version
+LIBABIVER := 1
+
+SRCS-y += vdev.c
+
+LDLIBS += -lrte_eal
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_vdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/vdev/rte_bus_vdev_version.map b/drivers/bus/vdev/rte_bus_vdev_version.map
new file mode 100644
index 0000000..6ccb789
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev_version.map
@@ -0,0 +1,8 @@
+DPDK_17.11 {
+ global:
+
+ rte_vdev_init;
+ rte_vdev_register;
+ rte_vdev_uninit;
+ rte_vdev_unregister;
+};
diff --git a/drivers/bus/vdev/rte_vdev.h b/drivers/bus/vdev/rte_vdev.h
new file mode 100644
index 0000000..41762b8
--- /dev/null
+++ b/drivers/bus/vdev/rte_vdev.h
@@ -0,0 +1,153 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
+ struct rte_device device; /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.name)
+ return dev->device.name;
+ return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.devargs)
+ return dev->device.devargs->args;
+ return "";
+}
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_probe_t *probe; /**< Virtual device probe function. */
+ rte_vdev_remove_t *remove; /**< Virtual device remove function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static const char *vdrvinit_ ## nm ## _alias;\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+ rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+/**
+ * Initialize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @param args
+ * The pointer to arguments used by driver initialization.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_init(const char *name, const char *args);
+
+/**
+ * Uninitalize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_uninit(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
new file mode 100644
index 0000000..a16eb71
--- /dev/null
+++ b/drivers/bus/vdev/vdev.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/queue.h>
+
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_bus.h>
+#include <rte_common.h>
+#include <rte_devargs.h>
+#include <rte_memory.h>
+#include <rte_errno.h>
+
+#include "rte_vdev.h"
+
+/* Forward declare to access virtual bus name */
+static struct rte_bus rte_vdev_bus;
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+ TAILQ_HEAD_INITIALIZER(vdev_device_list);
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_vdev_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_vdev_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+static int
+vdev_parse(const char *name, void *addr)
+{
+ struct rte_vdev_driver **out = addr;
+ struct rte_vdev_driver *driver = NULL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)) == 0)
+ break;
+ if (driver->driver.alias &&
+ strncmp(driver->driver.alias, name,
+ strlen(driver->driver.alias)) == 0)
+ break;
+ }
+ if (driver != NULL &&
+ addr != NULL)
+ *out = driver;
+ return driver == NULL;
+}
+
+static int
+vdev_probe_all_drivers(struct rte_vdev_device *dev)
+{
+ const char *name;
+ struct rte_vdev_driver *driver;
+ int ret;
+
+ name = rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
+
+ if (vdev_parse(name, &driver))
+ return -1;
+ dev->device.driver = &driver->driver;
+ ret = driver->probe(dev);
+ if (ret)
+ dev->device.driver = NULL;
+ return ret;
+}
+
+static struct rte_vdev_device *
+find_vdev(const char *name)
+{
+ struct rte_vdev_device *dev;
+
+ if (!name)
+ return NULL;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ const char *devname = rte_vdev_device_name(dev);
+
+ if (!strncmp(devname, name, strlen(name)))
+ return dev;
+ }
+
+ return NULL;
+}
+
+static struct rte_devargs *
+alloc_devargs(const char *name, const char *args)
+{
+ struct rte_devargs *devargs;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ return NULL;
+
+ devargs->bus = &rte_vdev_bus;
+ if (args)
+ devargs->args = strdup(args);
+ else
+ devargs->args = strdup("");
+
+ ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
+ free(devargs->args);
+ free(devargs);
+ return NULL;
+ }
+
+ return devargs;
+}
+
+int
+rte_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (dev)
+ return -EEXIST;
+
+ devargs = alloc_devargs(name, args);
+ if (!devargs)
+ return -ENOMEM;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ ret = vdev_probe_all_drivers(dev);
+ if (ret) {
+ if (ret > 0)
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ goto fail;
+ }
+
+ TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ return 0;
+
+fail:
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return ret;
+}
+
+static int
+vdev_remove_driver(struct rte_vdev_device *dev)
+{
+ const char *name = rte_vdev_device_name(dev);
+ const struct rte_vdev_driver *driver;
+
+ if (!dev->device.driver) {
+ RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
+ return 1;
+ }
+
+ driver = container_of(dev->device.driver, const struct rte_vdev_driver,
+ driver);
+ return driver->remove(dev);
+}
+
+int
+rte_vdev_uninit(const char *name)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (!dev)
+ return -ENOENT;
+
+ devargs = dev->device.devargs;
+
+ ret = vdev_remove_driver(dev);
+ if (ret)
+ return ret;
+
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
+
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return 0;
+}
+
+static int
+vdev_scan(void)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+
+ /* for virtual devices we scan the devargs_list populated via cmdline */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->bus != &rte_vdev_bus)
+ continue;
+
+ dev = find_vdev(devargs->name);
+ if (dev)
+ continue;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev)
+ return -1;
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ }
+
+ return 0;
+}
+
+static int
+vdev_probe(void)
+{
+ struct rte_vdev_device *dev;
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+
+ if (dev->device.driver)
+ continue;
+
+ if (vdev_probe_all_drivers(dev)) {
+ RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
+ rte_vdev_device_name(dev));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static struct rte_device *
+vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+ const void *data)
+{
+ struct rte_vdev_device *dev;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ if (start && &dev->device == start) {
+ start = NULL;
+ continue;
+ }
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
+static int
+vdev_plug(struct rte_device *dev)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+static int
+vdev_unplug(struct rte_device *dev)
+{
+ return rte_vdev_uninit(dev->name);
+}
+
+static struct rte_bus rte_vdev_bus = {
+ .scan = vdev_scan,
+ .probe = vdev_probe,
+ .find_device = vdev_find_device,
+ .plug = vdev_plug,
+ .unplug = vdev_unplug,
+ .parse = vdev_parse,
+};
+
+RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index d551541..1cb4cdb 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -32,6 +32,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
+core-libs += librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 05dec1b..9c9ae82 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_ether librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index cf33233..00be153 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -37,7 +37,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)
endif
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-core-libs += librte_net librte_kvargs
+core-libs += librte_net librte_kvargs librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 934c12b..5d9ace9 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -48,7 +48,7 @@ LDLIBS += -lgcc_s
EXPORT_MAP := ../../rte_eal_version.map
-LIBABIVER := 6
+LIBABIVER := 7
# specific to bsdapp exec-env
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c
@@ -67,7 +67,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 16a2f26..9effd0d 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
INC += rte_service.h rte_service_component.h
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index f7e547a..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/queue.h>
-
-#include <rte_eal.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
-#include <rte_vdev.h>
-#include <rte_common.h>
-#include <rte_devargs.h>
-#include <rte_memory.h>
-#include <rte_errno.h>
-
-/* Forward declare to access virtual bus name */
-static struct rte_bus rte_vdev_bus;
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
-
-static struct vdev_device_list vdev_device_list =
- TAILQ_HEAD_INITIALIZER(vdev_device_list);
-struct vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_vdev_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_vdev_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-static int
-vdev_parse(const char *name, void *addr)
-{
- struct rte_vdev_driver **out = addr;
- struct rte_vdev_driver *driver = NULL;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (strncmp(driver->driver.name, name,
- strlen(driver->driver.name)) == 0)
- break;
- if (driver->driver.alias &&
- strncmp(driver->driver.alias, name,
- strlen(driver->driver.alias)) == 0)
- break;
- }
- if (driver != NULL &&
- addr != NULL)
- *out = driver;
- return driver == NULL;
-}
-
-static int
-vdev_probe_all_drivers(struct rte_vdev_device *dev)
-{
- const char *name;
- struct rte_vdev_driver *driver;
- int ret;
-
- name = rte_vdev_device_name(dev);
-
- RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
- rte_vdev_device_name(dev));
-
- if (vdev_parse(name, &driver))
- return -1;
- dev->device.driver = &driver->driver;
- ret = driver->probe(dev);
- if (ret)
- dev->device.driver = NULL;
- return ret;
-}
-
-static struct rte_vdev_device *
-find_vdev(const char *name)
-{
- struct rte_vdev_device *dev;
-
- if (!name)
- return NULL;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- const char *devname = rte_vdev_device_name(dev);
- if (!strncmp(devname, name, strlen(name)))
- return dev;
- }
-
- return NULL;
-}
-
-static struct rte_devargs *
-alloc_devargs(const char *name, const char *args)
-{
- struct rte_devargs *devargs;
- int ret;
-
- devargs = calloc(1, sizeof(*devargs));
- if (!devargs)
- return NULL;
-
- devargs->bus = &rte_vdev_bus;
- if (args)
- devargs->args = strdup(args);
- else
- devargs->args = strdup("");
-
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
- if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
- free(devargs->args);
- free(devargs);
- return NULL;
- }
-
- return devargs;
-}
-
-int
-rte_vdev_init(const char *name, const char *args)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (dev)
- return -EEXIST;
-
- devargs = alloc_devargs(name, args);
- if (!devargs)
- return -ENOMEM;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
- ret = -ENOMEM;
- goto fail;
- }
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- ret = vdev_probe_all_drivers(dev);
- if (ret) {
- if (ret > 0)
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- goto fail;
- }
-
- TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- return 0;
-
-fail:
- free(devargs->args);
- free(devargs);
- free(dev);
- return ret;
-}
-
-static int
-vdev_remove_driver(struct rte_vdev_device *dev)
-{
- const char *name = rte_vdev_device_name(dev);
- const struct rte_vdev_driver *driver;
-
- if (!dev->device.driver) {
- RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
- return 1;
- }
-
- driver = container_of(dev->device.driver, const struct rte_vdev_driver,
- driver);
- return driver->remove(dev);
-}
-
-int
-rte_vdev_uninit(const char *name)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (!dev)
- return -ENOENT;
-
- devargs = dev->device.devargs;
-
- ret = vdev_remove_driver(dev);
- if (ret)
- return ret;
-
- TAILQ_REMOVE(&vdev_device_list, dev, next);
-
- TAILQ_REMOVE(&devargs_list, devargs, next);
-
- free(devargs->args);
- free(devargs);
- free(dev);
- return 0;
-}
-
-static int
-vdev_scan(void)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
-
- /* for virtual devices we scan the devargs_list populated via cmdline */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->bus != &rte_vdev_bus)
- continue;
-
- dev = find_vdev(devargs->name);
- if (dev)
- continue;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev)
- return -1;
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- }
-
- return 0;
-}
-
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
-
- if (dev->device.driver)
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
- RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
- rte_vdev_device_name(dev));
- return -1;
- }
- }
-
- return 0;
-}
-
-static struct rte_device *
-vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
- const void *data)
-{
- struct rte_vdev_device *dev;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- if (start && &dev->device == start) {
- start = NULL;
- continue;
- }
- if (cmp(&dev->device, data) == 0)
- return &dev->device;
- }
- return NULL;
-}
-
-static int
-vdev_plug(struct rte_device *dev)
-{
- return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
-}
-
-static int
-vdev_unplug(struct rte_device *dev)
-{
- return rte_vdev_uninit(dev->name);
-}
-
-static struct rte_bus rte_vdev_bus = {
- .scan = vdev_scan,
- .probe = vdev_probe,
- .find_device = vdev_find_device,
- .plug = vdev_plug,
- .unplug = vdev_unplug,
- .parse = vdev_parse,
-};
-
-RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4c4ac7e..8088dcc 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -170,28 +170,6 @@ struct rte_device {
};
/**
- * Initialize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @param args
- * The pointer to arguments used by driver initialization.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_init(const char *name, const char *args);
-
-/**
- * Uninitalize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_uninit(const char *name);
-
-/**
* Attach a device to a registered driver.
*
* @param name
@@ -316,4 +294,4 @@ __attribute__((used)) = str
}
#endif
-#endif /* _RTE_VDEV_H_ */
+#endif /* _RTE_DEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 29f5a52..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_VDEV_H
-#define RTE_VDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
- TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
- struct rte_device device; /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
- container_of(ptr, struct rte_vdev_device, device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.name)
- return dev->device.name;
- return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.devargs)
- return dev->device.devargs->args;
- return "";
-}
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
- rte_vdev_probe_t *probe; /**< Virtual device probe function. */
- rte_vdev_remove_t *remove; /**< Virtual device remove function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-RTE_INIT(vdrvinitfn_ ##vdrv);\
-static const char *vdrvinit_ ## nm ## _alias;\
-static void vdrvinitfn_ ##vdrv(void)\
-{\
- (vdrv).driver.name = RTE_STR(nm);\
- (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
- rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 1d3a42d..2975c25c 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -37,7 +37,7 @@ ARCH_DIR ?= $(RTE_ARCH)
EXPORT_MAP := ../../rte_eal_version.map
VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)
-LIBABIVER := 6
+LIBABIVER := 7
VPATH += $(RTE_SDK)/lib/librte_eal/common
@@ -74,7 +74,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_errno.c
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index d2a4ff9..5966a03 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -166,10 +166,6 @@ DPDK_17.05 {
rte_log_set_global_level;
rte_log_set_level;
rte_log_set_level_regexp;
- rte_vdev_init;
- rte_vdev_register;
- rte_vdev_uninit;
- rte_vdev_unregister;
vfio_get_container_fd;
vfio_get_group_fd;
vfio_get_group_no;
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 047121d..de2f557 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -101,6 +101,7 @@ _LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 72988c5..9045873 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index 56ed1f8..c0b864b 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
+#include <rte_vdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 4118b75..a56f5a2 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -37,6 +37,7 @@
#include <rte_memcpy.h>
#include <rte_eventdev.h>
#include <rte_dev.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index b88b0d2..ecae3e9 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -45,6 +45,7 @@
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_random.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index 5c7751b..5e41140 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -51,6 +51,7 @@
#include <rte_pause.h>
#include <rte_service.h>
#include <rte_service_component.h>
+#include <rte_vdev.h>
#include "test.h"
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 7dccc6e..6199188 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -48,6 +48,7 @@
#include <rte_log.h>
#include <rte_lcore.h>
#include <rte_memory.h>
+#include <rte_vdev.h>
#include <rte_string_fns.h>
#include <rte_errno.h>
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v10 1/4] cryptodev: remove crypto vdev init API
@ 2017-10-27 3:23 4% ` Jianfeng Tan
2017-10-27 3:23 1% ` [dpdk-dev] [PATCH v10 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-27 3:23 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 2 ++
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
5 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a93c3e1..9120121 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -60,10 +60,5 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* librte_meter: The API will change to accommodate configuration profiles.
Most of the API functions will have an additional opaque parameter.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index b96b236..bab5d73 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -403,6 +403,8 @@ API Changes
the backing device supports the operation or if the operation was
successfully performed.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 8063211..973c8db 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index a0d3a12..2c1377b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -435,23 +435,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index e82296c..eb47308 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v9 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-10-27 1:06 4% ` [dpdk-dev] [PATCH v9 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-10-27 1:06 1% ` Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-27 1:06 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
config/common_base | 5 +
doc/guides/rel_notes/release_17_11.rst | 8 +
drivers/bus/Makefile | 4 +-
drivers/bus/vdev/Makefile | 57 +++++
drivers/bus/vdev/rte_bus_vdev_version.map | 8 +
drivers/bus/vdev/rte_vdev.h | 153 +++++++++++++
drivers/bus/vdev/vdev.c | 344 ++++++++++++++++++++++++++++++
drivers/crypto/Makefile | 1 +
drivers/event/Makefile | 2 +-
drivers/net/Makefile | 2 +-
lib/librte_eal/bsdapp/eal/Makefile | 3 +-
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_vdev.c | 342 -----------------------------
lib/librte_eal/common/include/rte_dev.h | 24 +--
lib/librte_eal/common/include/rte_vdev.h | 131 ------------
lib/librte_eal/linuxapp/eal/Makefile | 3 +-
lib/librte_eal/rte_eal_version.map | 4 -
mk/rte.app.mk | 1 +
test/test/test_cryptodev.c | 1 +
test/test/test_event_eth_rx_adapter.c | 1 +
test/test/test_eventdev.c | 1 +
test/test/test_eventdev_octeontx.c | 1 +
test/test/test_eventdev_sw.c | 1 +
| 1 +
24 files changed, 591 insertions(+), 509 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/rte_vdev.h
create mode 100644 drivers/bus/vdev/vdev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/config/common_base b/config/common_base
index 4ddde59..65b13e5 100644
--- a/config/common_base
+++ b/config/common_base
@@ -800,3 +800,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y
# Compile the eventdev application
#
CONFIG_RTE_APP_EVENTDEV=y
+
+#
+# Compile the vdev bus
+#
+CONFIG_RTE_LIBRTE_VDEV_BUS=y
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 06de87b..58d4c58 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -300,6 +300,13 @@ API Changes
* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+* **Moved the following APIs from eal library to bus_vdev library**
+
+ * ``rte_vdev_init``
+ * ``rte_vdev_register``
+ * ``rte_vdev_uninit``
+ * ``rte_vdev_unregister``
+
ABI Changes
-----------
@@ -355,6 +362,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_acl.so.2
+ librte_bitratestats.so.2
+ + librte_bus_vdev.so.1
librte_cfgfile.so.2
librte_cmdline.so.2
librte_cryptodev.so.3
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 4b29e3d..038e10c 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -30,10 +30,10 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-
DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
+DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile
new file mode 100644
index 0000000..fe31654
--- /dev/null
+++ b/drivers/bus/vdev/Makefile
@@ -0,0 +1,57 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_bus_vdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# versioning export map
+EXPORT_MAP := rte_bus_vdev_version.map
+
+# library version
+LIBABIVER := 1
+
+SRCS-y += vdev.c
+
+LDLIBS += -lrte_eal
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_vdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/vdev/rte_bus_vdev_version.map b/drivers/bus/vdev/rte_bus_vdev_version.map
new file mode 100644
index 0000000..6ccb789
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev_version.map
@@ -0,0 +1,8 @@
+DPDK_17.11 {
+ global:
+
+ rte_vdev_init;
+ rte_vdev_register;
+ rte_vdev_uninit;
+ rte_vdev_unregister;
+};
diff --git a/drivers/bus/vdev/rte_vdev.h b/drivers/bus/vdev/rte_vdev.h
new file mode 100644
index 0000000..41762b8
--- /dev/null
+++ b/drivers/bus/vdev/rte_vdev.h
@@ -0,0 +1,153 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
+ struct rte_device device; /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.name)
+ return dev->device.name;
+ return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.devargs)
+ return dev->device.devargs->args;
+ return "";
+}
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_probe_t *probe; /**< Virtual device probe function. */
+ rte_vdev_remove_t *remove; /**< Virtual device remove function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static const char *vdrvinit_ ## nm ## _alias;\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+ rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+/**
+ * Initialize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @param args
+ * The pointer to arguments used by driver initialization.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_init(const char *name, const char *args);
+
+/**
+ * Uninitalize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_uninit(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
new file mode 100644
index 0000000..a16eb71
--- /dev/null
+++ b/drivers/bus/vdev/vdev.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/queue.h>
+
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_bus.h>
+#include <rte_common.h>
+#include <rte_devargs.h>
+#include <rte_memory.h>
+#include <rte_errno.h>
+
+#include "rte_vdev.h"
+
+/* Forward declare to access virtual bus name */
+static struct rte_bus rte_vdev_bus;
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+ TAILQ_HEAD_INITIALIZER(vdev_device_list);
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_vdev_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_vdev_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+static int
+vdev_parse(const char *name, void *addr)
+{
+ struct rte_vdev_driver **out = addr;
+ struct rte_vdev_driver *driver = NULL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)) == 0)
+ break;
+ if (driver->driver.alias &&
+ strncmp(driver->driver.alias, name,
+ strlen(driver->driver.alias)) == 0)
+ break;
+ }
+ if (driver != NULL &&
+ addr != NULL)
+ *out = driver;
+ return driver == NULL;
+}
+
+static int
+vdev_probe_all_drivers(struct rte_vdev_device *dev)
+{
+ const char *name;
+ struct rte_vdev_driver *driver;
+ int ret;
+
+ name = rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
+
+ if (vdev_parse(name, &driver))
+ return -1;
+ dev->device.driver = &driver->driver;
+ ret = driver->probe(dev);
+ if (ret)
+ dev->device.driver = NULL;
+ return ret;
+}
+
+static struct rte_vdev_device *
+find_vdev(const char *name)
+{
+ struct rte_vdev_device *dev;
+
+ if (!name)
+ return NULL;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ const char *devname = rte_vdev_device_name(dev);
+
+ if (!strncmp(devname, name, strlen(name)))
+ return dev;
+ }
+
+ return NULL;
+}
+
+static struct rte_devargs *
+alloc_devargs(const char *name, const char *args)
+{
+ struct rte_devargs *devargs;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ return NULL;
+
+ devargs->bus = &rte_vdev_bus;
+ if (args)
+ devargs->args = strdup(args);
+ else
+ devargs->args = strdup("");
+
+ ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
+ free(devargs->args);
+ free(devargs);
+ return NULL;
+ }
+
+ return devargs;
+}
+
+int
+rte_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (dev)
+ return -EEXIST;
+
+ devargs = alloc_devargs(name, args);
+ if (!devargs)
+ return -ENOMEM;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ ret = vdev_probe_all_drivers(dev);
+ if (ret) {
+ if (ret > 0)
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ goto fail;
+ }
+
+ TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ return 0;
+
+fail:
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return ret;
+}
+
+static int
+vdev_remove_driver(struct rte_vdev_device *dev)
+{
+ const char *name = rte_vdev_device_name(dev);
+ const struct rte_vdev_driver *driver;
+
+ if (!dev->device.driver) {
+ RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
+ return 1;
+ }
+
+ driver = container_of(dev->device.driver, const struct rte_vdev_driver,
+ driver);
+ return driver->remove(dev);
+}
+
+int
+rte_vdev_uninit(const char *name)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (!dev)
+ return -ENOENT;
+
+ devargs = dev->device.devargs;
+
+ ret = vdev_remove_driver(dev);
+ if (ret)
+ return ret;
+
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
+
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return 0;
+}
+
+static int
+vdev_scan(void)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+
+ /* for virtual devices we scan the devargs_list populated via cmdline */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->bus != &rte_vdev_bus)
+ continue;
+
+ dev = find_vdev(devargs->name);
+ if (dev)
+ continue;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev)
+ return -1;
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ }
+
+ return 0;
+}
+
+static int
+vdev_probe(void)
+{
+ struct rte_vdev_device *dev;
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+
+ if (dev->device.driver)
+ continue;
+
+ if (vdev_probe_all_drivers(dev)) {
+ RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
+ rte_vdev_device_name(dev));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static struct rte_device *
+vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+ const void *data)
+{
+ struct rte_vdev_device *dev;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ if (start && &dev->device == start) {
+ start = NULL;
+ continue;
+ }
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
+static int
+vdev_plug(struct rte_device *dev)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+static int
+vdev_unplug(struct rte_device *dev)
+{
+ return rte_vdev_uninit(dev->name);
+}
+
+static struct rte_bus rte_vdev_bus = {
+ .scan = vdev_scan,
+ .probe = vdev_probe,
+ .find_device = vdev_find_device,
+ .plug = vdev_plug,
+ .unplug = vdev_unplug,
+ .parse = vdev_parse,
+};
+
+RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index d551541..1cb4cdb 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -32,6 +32,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
+core-libs += librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 05dec1b..9c9ae82 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_ether librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index cf33233..00be153 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -37,7 +37,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)
endif
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-core-libs += librte_net librte_kvargs
+core-libs += librte_net librte_kvargs librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 351fa57..25a48d1 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -48,7 +48,7 @@ LDLIBS += -lgcc_s
EXPORT_MAP := ../../rte_eal_version.map
-LIBABIVER := 6
+LIBABIVER := 7
# specific to bsdapp exec-env
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c
@@ -68,7 +68,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 6f5b3f3..2fb5635 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
INC += rte_service.h rte_service_component.h
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index f7e547a..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/queue.h>
-
-#include <rte_eal.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
-#include <rte_vdev.h>
-#include <rte_common.h>
-#include <rte_devargs.h>
-#include <rte_memory.h>
-#include <rte_errno.h>
-
-/* Forward declare to access virtual bus name */
-static struct rte_bus rte_vdev_bus;
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
-
-static struct vdev_device_list vdev_device_list =
- TAILQ_HEAD_INITIALIZER(vdev_device_list);
-struct vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_vdev_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_vdev_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-static int
-vdev_parse(const char *name, void *addr)
-{
- struct rte_vdev_driver **out = addr;
- struct rte_vdev_driver *driver = NULL;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (strncmp(driver->driver.name, name,
- strlen(driver->driver.name)) == 0)
- break;
- if (driver->driver.alias &&
- strncmp(driver->driver.alias, name,
- strlen(driver->driver.alias)) == 0)
- break;
- }
- if (driver != NULL &&
- addr != NULL)
- *out = driver;
- return driver == NULL;
-}
-
-static int
-vdev_probe_all_drivers(struct rte_vdev_device *dev)
-{
- const char *name;
- struct rte_vdev_driver *driver;
- int ret;
-
- name = rte_vdev_device_name(dev);
-
- RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
- rte_vdev_device_name(dev));
-
- if (vdev_parse(name, &driver))
- return -1;
- dev->device.driver = &driver->driver;
- ret = driver->probe(dev);
- if (ret)
- dev->device.driver = NULL;
- return ret;
-}
-
-static struct rte_vdev_device *
-find_vdev(const char *name)
-{
- struct rte_vdev_device *dev;
-
- if (!name)
- return NULL;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- const char *devname = rte_vdev_device_name(dev);
- if (!strncmp(devname, name, strlen(name)))
- return dev;
- }
-
- return NULL;
-}
-
-static struct rte_devargs *
-alloc_devargs(const char *name, const char *args)
-{
- struct rte_devargs *devargs;
- int ret;
-
- devargs = calloc(1, sizeof(*devargs));
- if (!devargs)
- return NULL;
-
- devargs->bus = &rte_vdev_bus;
- if (args)
- devargs->args = strdup(args);
- else
- devargs->args = strdup("");
-
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
- if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
- free(devargs->args);
- free(devargs);
- return NULL;
- }
-
- return devargs;
-}
-
-int
-rte_vdev_init(const char *name, const char *args)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (dev)
- return -EEXIST;
-
- devargs = alloc_devargs(name, args);
- if (!devargs)
- return -ENOMEM;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
- ret = -ENOMEM;
- goto fail;
- }
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- ret = vdev_probe_all_drivers(dev);
- if (ret) {
- if (ret > 0)
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- goto fail;
- }
-
- TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- return 0;
-
-fail:
- free(devargs->args);
- free(devargs);
- free(dev);
- return ret;
-}
-
-static int
-vdev_remove_driver(struct rte_vdev_device *dev)
-{
- const char *name = rte_vdev_device_name(dev);
- const struct rte_vdev_driver *driver;
-
- if (!dev->device.driver) {
- RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
- return 1;
- }
-
- driver = container_of(dev->device.driver, const struct rte_vdev_driver,
- driver);
- return driver->remove(dev);
-}
-
-int
-rte_vdev_uninit(const char *name)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (!dev)
- return -ENOENT;
-
- devargs = dev->device.devargs;
-
- ret = vdev_remove_driver(dev);
- if (ret)
- return ret;
-
- TAILQ_REMOVE(&vdev_device_list, dev, next);
-
- TAILQ_REMOVE(&devargs_list, devargs, next);
-
- free(devargs->args);
- free(devargs);
- free(dev);
- return 0;
-}
-
-static int
-vdev_scan(void)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
-
- /* for virtual devices we scan the devargs_list populated via cmdline */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->bus != &rte_vdev_bus)
- continue;
-
- dev = find_vdev(devargs->name);
- if (dev)
- continue;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev)
- return -1;
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- }
-
- return 0;
-}
-
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
-
- if (dev->device.driver)
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
- RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
- rte_vdev_device_name(dev));
- return -1;
- }
- }
-
- return 0;
-}
-
-static struct rte_device *
-vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
- const void *data)
-{
- struct rte_vdev_device *dev;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- if (start && &dev->device == start) {
- start = NULL;
- continue;
- }
- if (cmp(&dev->device, data) == 0)
- return &dev->device;
- }
- return NULL;
-}
-
-static int
-vdev_plug(struct rte_device *dev)
-{
- return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
-}
-
-static int
-vdev_unplug(struct rte_device *dev)
-{
- return rte_vdev_uninit(dev->name);
-}
-
-static struct rte_bus rte_vdev_bus = {
- .scan = vdev_scan,
- .probe = vdev_probe,
- .find_device = vdev_find_device,
- .plug = vdev_plug,
- .unplug = vdev_unplug,
- .parse = vdev_parse,
-};
-
-RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4c4ac7e..8088dcc 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -170,28 +170,6 @@ struct rte_device {
};
/**
- * Initialize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @param args
- * The pointer to arguments used by driver initialization.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_init(const char *name, const char *args);
-
-/**
- * Uninitalize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_uninit(const char *name);
-
-/**
* Attach a device to a registered driver.
*
* @param name
@@ -316,4 +294,4 @@ __attribute__((used)) = str
}
#endif
-#endif /* _RTE_VDEV_H_ */
+#endif /* _RTE_DEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 29f5a52..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_VDEV_H
-#define RTE_VDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
- TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
- struct rte_device device; /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
- container_of(ptr, struct rte_vdev_device, device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.name)
- return dev->device.name;
- return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.devargs)
- return dev->device.devargs->args;
- return "";
-}
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
- rte_vdev_probe_t *probe; /**< Virtual device probe function. */
- rte_vdev_remove_t *remove; /**< Virtual device remove function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-RTE_INIT(vdrvinitfn_ ##vdrv);\
-static const char *vdrvinit_ ## nm ## _alias;\
-static void vdrvinitfn_ ##vdrv(void)\
-{\
- (vdrv).driver.name = RTE_STR(nm);\
- (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
- rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 965da6e..eef80eb 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -37,7 +37,7 @@ ARCH_DIR ?= $(RTE_ARCH)
EXPORT_MAP := ../../rte_eal_version.map
VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)
-LIBABIVER := 6
+LIBABIVER := 7
VPATH += $(RTE_SDK)/lib/librte_eal/common
@@ -77,7 +77,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 8eb53ab..f9edb29 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -181,10 +181,6 @@ DPDK_17.05 {
rte_pci_unmap_device;
rte_pci_unregister;
rte_pci_write_config;
- rte_vdev_init;
- rte_vdev_register;
- rte_vdev_uninit;
- rte_vdev_unregister;
vfio_get_container_fd;
vfio_get_group_fd;
vfio_get_group_no;
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 482656c..6780f4f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -99,6 +99,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool
_LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index a926779..2e80062 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index 56ed1f8..c0b864b 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
+#include <rte_vdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index d6ade78..e3d36f3 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -37,6 +37,7 @@
#include <rte_memcpy.h>
#include <rte_eventdev.h>
#include <rte_dev.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index b88b0d2..ecae3e9 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -45,6 +45,7 @@
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_random.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index 7219886..385e743 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -49,6 +49,7 @@
#include <rte_cycles.h>
#include <rte_eventdev.h>
#include <rte_pause.h>
+#include <rte_vdev.h>
#include "test.h"
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 7dccc6e..6199188 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -48,6 +48,7 @@
#include <rte_log.h>
#include <rte_lcore.h>
#include <rte_memory.h>
+#include <rte_vdev.h>
#include <rte_string_fns.h>
#include <rte_errno.h>
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v9 1/4] cryptodev: remove crypto vdev init API
@ 2017-10-27 1:06 4% ` Jianfeng Tan
2017-10-27 1:06 1% ` [dpdk-dev] [PATCH v9 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-27 1:06 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 2 ++
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
5 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3a5d093..6d859c0 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -66,11 +66,6 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* cryptodev: the following function will be static in 17.11 and included
by all crypto drivers, therefore, will not be public:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 3298ef5..06de87b 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -297,6 +297,8 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 21da40e..279b861 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index b74bbdd..f8341cf 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -433,23 +433,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 874c1b5..f148872 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v8 24/25] doc: add notes on EAL PCI API update
@ 2017-10-26 10:06 4% ` Gaetan Rivet
0 siblings, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-26 10:06 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add a section related to EAL API changes to 17.11 release notes.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 93f94fc..6619711 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -369,6 +369,34 @@ API Changes
the backing device supports the operation or if the operation was
successfully performed.
+* **PCI bus API moved outside of the EAL**
+
+ The PCI bus previously implemented within the EAL has been moved.
+ A first part has been added as an RTE library providing PCI helpers to
+ parse device locations or other such utilities.
+ A second part consisting in the actual bus driver has been moved to its
+ proper subdirectory, without changing its functionalities.
+
+ As such, several PCI-related functions are not proposed by the EAL anymore:
+
+ * rte_pci_detach
+ * rte_pci_dump
+ * rte_pci_ioport_map
+ * rte_pci_ioport_read
+ * rte_pci_ioport_unmap
+ * rte_pci_ioport_write
+ * rte_pci_map_device
+ * rte_pci_probe
+ * rte_pci_probe_one
+ * rte_pci_read_config
+ * rte_pci_register
+ * rte_pci_scan
+ * rte_pci_unmap_device
+ * rte_pci_unregister
+ * rte_pci_write_config
+
+ These functions are made available either as part of ``librte_pci`` or
+ ``librte_bus_pci``.
ABI Changes
-----------
--
2.1.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v7 24/25] doc: add notes on EAL PCI API update
@ 2017-10-25 22:38 4% ` Gaetan Rivet
1 sibling, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-25 22:38 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add a section related to EAL API changes to 17.11 release notes.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 3298ef5..5aa0f4d 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -297,6 +297,34 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* **PCI bus API moved outside of the EAL**
+
+ The PCI bus previously implemented within the EAL has been moved.
+ A first part has been added as an RTE library providing PCI helpers to
+ parse device locations or other such utilities.
+ A second part consisting in the actual bus driver has been moved to its
+ proper subdirectory, without changing its functionalities.
+
+ As such, several PCI-related functions are not proposed by the EAL anymore:
+
+ * rte_pci_detach
+ * rte_pci_dump
+ * rte_pci_ioport_map
+ * rte_pci_ioport_read
+ * rte_pci_ioport_unmap
+ * rte_pci_ioport_write
+ * rte_pci_map_device
+ * rte_pci_probe
+ * rte_pci_probe_one
+ * rte_pci_read_config
+ * rte_pci_register
+ * rte_pci_scan
+ * rte_pci_unmap_device
+ * rte_pci_unregister
+ * rte_pci_write_config
+
+ These functions are made available either as part of ``librte_pci`` or
+ ``librte_bus_pci``.
ABI Changes
-----------
--
2.1.4
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-10-25 17:10 1% ` [dpdk-dev] [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
@ 2017-10-25 21:32 3% ` De Lara Guarch, Pablo
0 siblings, 0 replies; 200+ results
From: De Lara Guarch, Pablo @ 2017-10-25 21:32 UTC (permalink / raw)
To: Tan, Jianfeng, dev
Cc: jblunck, Richardson, Bruce, Ananyev, Konstantin, thomas, yliu,
maxime.coquelin, mtetsuyah, Yigit, Ferruh
Hi Jianfeng,
> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Wednesday, October 25, 2017 6:11 PM
> To: dev@dpdk.org
> Cc: jblunck@infradead.org; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; thomas@monjalon.net;
> yliu@fridaylinux.org; maxime.coquelin@redhat.com;
> mtetsuyah@gmail.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Tan,
> Jianfeng <jianfeng.tan@intel.com>
> Subject: [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus
>
> Move the vdev bus from lib/librte_eal to drivers/bus.
>
> As the crypto vdev helper function refers to data structure in rte_vdev.h, so
> we move those helper function into drivers/bus too.
>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
...
> ABI Changes
> -----------
>
> @@ -355,11 +362,12 @@ The libraries prepended with a plus sign were
> incremented in this version.
>
> librte_acl.so.2
> + librte_bitratestats.so.2
> + + librte_bus_vdev.so.1
> librte_cfgfile.so.2
> librte_cmdline.so.2
> librte_cryptodev.so.4
> librte_distributor.so.1
> - + librte_eal.so.6
> + + librte_eal.so.7
EAL ABI version has been bumped already in this release,
so there is no need to do it again.
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v8 1/4] cryptodev: remove crypto vdev init API
@ 2017-10-25 17:10 4% ` Jianfeng Tan
2017-10-25 17:10 1% ` [dpdk-dev] [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
1 sibling, 0 replies; 200+ results
From: Jianfeng Tan @ 2017-10-25 17:10 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 4 +++-
lib/librte_cryptodev/Makefile | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
6 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3a5d093..6d859c0 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -66,11 +66,6 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* cryptodev: the following function will be static in 17.11 and included
by all crypto drivers, therefore, will not be public:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 3298ef5..898f7a5 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -297,6 +297,8 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
@@ -355,7 +357,7 @@ The libraries prepended with a plus sign were incremented in this version.
+ librte_bitratestats.so.2
librte_cfgfile.so.2
librte_cmdline.so.2
- librte_cryptodev.so.3
+ librte_cryptodev.so.4
librte_distributor.so.1
+ librte_eal.so.6
+ librte_ethdev.so.8
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 455151f..9569c99 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_cryptodev.a
# library version
-LIBABIVER := 3
+LIBABIVER := 4
# build flags
CFLAGS += -O3
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 21da40e..279b861 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index b74bbdd..f8341cf 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -433,23 +433,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 874c1b5..f148872 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus
2017-10-25 17:10 4% ` [dpdk-dev] [PATCH v8 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-10-25 17:10 1% ` Jianfeng Tan
2017-10-25 21:32 3% ` De Lara Guarch, Pablo
1 sibling, 1 reply; 200+ results
From: Jianfeng Tan @ 2017-10-25 17:10 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
config/common_base | 5 +
doc/guides/rel_notes/release_17_11.rst | 10 +-
drivers/bus/Makefile | 3 +
drivers/bus/vdev/Makefile | 55 +++++
drivers/bus/vdev/rte_bus_vdev_version.map | 8 +
drivers/bus/vdev/rte_vdev.h | 153 +++++++++++++
drivers/bus/vdev/vdev.c | 344 ++++++++++++++++++++++++++++++
drivers/crypto/Makefile | 1 +
drivers/event/Makefile | 2 +-
drivers/net/Makefile | 2 +-
lib/librte_eal/bsdapp/eal/Makefile | 3 +-
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_vdev.c | 342 -----------------------------
lib/librte_eal/common/include/rte_dev.h | 24 +--
lib/librte_eal/common/include/rte_vdev.h | 131 ------------
lib/librte_eal/linuxapp/eal/Makefile | 3 +-
lib/librte_eal/rte_eal_version.map | 4 -
mk/rte.app.mk | 1 +
test/test/test_cryptodev.c | 1 +
test/test/test_event_eth_rx_adapter.c | 1 +
test/test/test_eventdev.c | 1 +
test/test/test_eventdev_octeontx.c | 1 +
test/test/test_eventdev_sw.c | 1 +
| 1 +
24 files changed, 591 insertions(+), 508 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/rte_vdev.h
create mode 100644 drivers/bus/vdev/vdev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/config/common_base b/config/common_base
index 4ddde59..65b13e5 100644
--- a/config/common_base
+++ b/config/common_base
@@ -800,3 +800,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y
# Compile the eventdev application
#
CONFIG_RTE_APP_EVENTDEV=y
+
+#
+# Compile the vdev bus
+#
+CONFIG_RTE_LIBRTE_VDEV_BUS=y
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 898f7a5..79f810a 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -300,6 +300,13 @@ API Changes
* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
in librte_cryptodev; instead, users can call rte_vdev_init() directly.
+* **Moved the following APIs from eal library to bus_vdev library**
+
+ * ``rte_vdev_init``
+ * ``rte_vdev_register``
+ * ``rte_vdev_uninit``
+ * ``rte_vdev_unregister``
+
ABI Changes
-----------
@@ -355,11 +362,12 @@ The libraries prepended with a plus sign were incremented in this version.
librte_acl.so.2
+ librte_bitratestats.so.2
+ + librte_bus_vdev.so.1
librte_cfgfile.so.2
librte_cmdline.so.2
librte_cryptodev.so.4
librte_distributor.so.1
- + librte_eal.so.6
+ + librte_eal.so.7
+ librte_ethdev.so.8
+ librte_eventdev.so.3
+ librte_flow_classify.so.1
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 4b29e3d..cb12d19 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -36,4 +36,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
+DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+DEPDIRS-vdev = $(core-libs)
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile
new file mode 100644
index 0000000..6c48ba0
--- /dev/null
+++ b/drivers/bus/vdev/Makefile
@@ -0,0 +1,55 @@
+# BSD LICENSE
+#
+# Copyright(c) 2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_bus_vdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# versioning export map
+EXPORT_MAP := rte_bus_vdev_version.map
+
+# library version
+LIBABIVER := 1
+
+SRCS-y += vdev.c
+
+#
+# Export include files
+#
+SYMLINK-y-include += rte_vdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/vdev/rte_bus_vdev_version.map b/drivers/bus/vdev/rte_bus_vdev_version.map
new file mode 100644
index 0000000..6ccb789
--- /dev/null
+++ b/drivers/bus/vdev/rte_bus_vdev_version.map
@@ -0,0 +1,8 @@
+DPDK_17.11 {
+ global:
+
+ rte_vdev_init;
+ rte_vdev_register;
+ rte_vdev_uninit;
+ rte_vdev_unregister;
+};
diff --git a/drivers/bus/vdev/rte_vdev.h b/drivers/bus/vdev/rte_vdev.h
new file mode 100644
index 0000000..41762b8
--- /dev/null
+++ b/drivers/bus/vdev/rte_vdev.h
@@ -0,0 +1,153 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+
+struct rte_vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
+ struct rte_device device; /**< Inherit core device */
+};
+
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
+static inline const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.name)
+ return dev->device.name;
+ return NULL;
+}
+
+static inline const char *
+rte_vdev_device_args(const struct rte_vdev_device *dev)
+{
+ if (dev && dev->device.devargs)
+ return dev->device.devargs->args;
+ return "";
+}
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Probe function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
+
+/**
+ * Remove function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_probe_t *probe; /**< Virtual device probe function. */
+ rte_vdev_remove_t *remove; /**< Virtual device remove function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_vdev_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_vdev_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static const char *vdrvinit_ ## nm ## _alias;\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
+ rte_vdev_register(&vdrv);\
+} \
+RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+
+#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
+static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
+
+/**
+ * Initialize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @param args
+ * The pointer to arguments used by driver initialization.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_init(const char *name, const char *args);
+
+/**
+ * Uninitalize a driver specified by name.
+ *
+ * @param name
+ * The pointer to a driver name to be initialized.
+ * @return
+ * 0 on success, negative on error
+ */
+int rte_vdev_uninit(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
new file mode 100644
index 0000000..a16eb71
--- /dev/null
+++ b/drivers/bus/vdev/vdev.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/queue.h>
+
+#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_bus.h>
+#include <rte_common.h>
+#include <rte_devargs.h>
+#include <rte_memory.h>
+#include <rte_errno.h>
+
+#include "rte_vdev.h"
+
+/* Forward declare to access virtual bus name */
+static struct rte_bus rte_vdev_bus;
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+ TAILQ_HEAD_INITIALIZER(vdev_device_list);
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_vdev_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_vdev_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+static int
+vdev_parse(const char *name, void *addr)
+{
+ struct rte_vdev_driver **out = addr;
+ struct rte_vdev_driver *driver = NULL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)) == 0)
+ break;
+ if (driver->driver.alias &&
+ strncmp(driver->driver.alias, name,
+ strlen(driver->driver.alias)) == 0)
+ break;
+ }
+ if (driver != NULL &&
+ addr != NULL)
+ *out = driver;
+ return driver == NULL;
+}
+
+static int
+vdev_probe_all_drivers(struct rte_vdev_device *dev)
+{
+ const char *name;
+ struct rte_vdev_driver *driver;
+ int ret;
+
+ name = rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
+
+ if (vdev_parse(name, &driver))
+ return -1;
+ dev->device.driver = &driver->driver;
+ ret = driver->probe(dev);
+ if (ret)
+ dev->device.driver = NULL;
+ return ret;
+}
+
+static struct rte_vdev_device *
+find_vdev(const char *name)
+{
+ struct rte_vdev_device *dev;
+
+ if (!name)
+ return NULL;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ const char *devname = rte_vdev_device_name(dev);
+
+ if (!strncmp(devname, name, strlen(name)))
+ return dev;
+ }
+
+ return NULL;
+}
+
+static struct rte_devargs *
+alloc_devargs(const char *name, const char *args)
+{
+ struct rte_devargs *devargs;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ return NULL;
+
+ devargs->bus = &rte_vdev_bus;
+ if (args)
+ devargs->args = strdup(args);
+ else
+ devargs->args = strdup("");
+
+ ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
+ free(devargs->args);
+ free(devargs);
+ return NULL;
+ }
+
+ return devargs;
+}
+
+int
+rte_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (dev)
+ return -EEXIST;
+
+ devargs = alloc_devargs(name, args);
+ if (!devargs)
+ return -ENOMEM;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ ret = vdev_probe_all_drivers(dev);
+ if (ret) {
+ if (ret > 0)
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ goto fail;
+ }
+
+ TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ return 0;
+
+fail:
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return ret;
+}
+
+static int
+vdev_remove_driver(struct rte_vdev_device *dev)
+{
+ const char *name = rte_vdev_device_name(dev);
+ const struct rte_vdev_driver *driver;
+
+ if (!dev->device.driver) {
+ RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
+ return 1;
+ }
+
+ driver = container_of(dev->device.driver, const struct rte_vdev_driver,
+ driver);
+ return driver->remove(dev);
+}
+
+int
+rte_vdev_uninit(const char *name)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+ int ret;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ dev = find_vdev(name);
+ if (!dev)
+ return -ENOENT;
+
+ devargs = dev->device.devargs;
+
+ ret = vdev_remove_driver(dev);
+ if (ret)
+ return ret;
+
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
+
+ TAILQ_REMOVE(&devargs_list, devargs, next);
+
+ free(devargs->args);
+ free(devargs);
+ free(dev);
+ return 0;
+}
+
+static int
+vdev_scan(void)
+{
+ struct rte_vdev_device *dev;
+ struct rte_devargs *devargs;
+
+ /* for virtual devices we scan the devargs_list populated via cmdline */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->bus != &rte_vdev_bus)
+ continue;
+
+ dev = find_vdev(devargs->name);
+ if (dev)
+ continue;
+
+ dev = calloc(1, sizeof(*dev));
+ if (!dev)
+ return -1;
+
+ dev->device.devargs = devargs;
+ dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->name;
+
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
+ }
+
+ return 0;
+}
+
+static int
+vdev_probe(void)
+{
+ struct rte_vdev_device *dev;
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+
+ if (dev->device.driver)
+ continue;
+
+ if (vdev_probe_all_drivers(dev)) {
+ RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
+ rte_vdev_device_name(dev));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static struct rte_device *
+vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+ const void *data)
+{
+ struct rte_vdev_device *dev;
+
+ TAILQ_FOREACH(dev, &vdev_device_list, next) {
+ if (start && &dev->device == start) {
+ start = NULL;
+ continue;
+ }
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
+static int
+vdev_plug(struct rte_device *dev)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+static int
+vdev_unplug(struct rte_device *dev)
+{
+ return rte_vdev_uninit(dev->name);
+}
+
+static struct rte_bus rte_vdev_bus = {
+ .scan = vdev_scan,
+ .probe = vdev_probe,
+ .find_device = vdev_find_device,
+ .plug = vdev_plug,
+ .unplug = vdev_unplug,
+ .parse = vdev_parse,
+};
+
+RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index d551541..1cb4cdb 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -32,6 +32,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
+core-libs += librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 05dec1b..9c9ae82 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_ether librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index cf33233..00be153 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -37,7 +37,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)
endif
core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
-core-libs += librte_net librte_kvargs
+core-libs += librte_net librte_kvargs librte_bus_vdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 351fa57..25a48d1 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -48,7 +48,7 @@ LDLIBS += -lgcc_s
EXPORT_MAP := ../../rte_eal_version.map
-LIBABIVER := 6
+LIBABIVER := 7
# specific to bsdapp exec-env
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c
@@ -68,7 +68,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 6f5b3f3..2fb5635 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -39,7 +39,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
INC += rte_service.h rte_service_component.h
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index f7e547a..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/queue.h>
-
-#include <rte_eal.h>
-#include <rte_dev.h>
-#include <rte_bus.h>
-#include <rte_vdev.h>
-#include <rte_common.h>
-#include <rte_devargs.h>
-#include <rte_memory.h>
-#include <rte_errno.h>
-
-/* Forward declare to access virtual bus name */
-static struct rte_bus rte_vdev_bus;
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_device_list, rte_vdev_device);
-
-static struct vdev_device_list vdev_device_list =
- TAILQ_HEAD_INITIALIZER(vdev_device_list);
-struct vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_vdev_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_vdev_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-static int
-vdev_parse(const char *name, void *addr)
-{
- struct rte_vdev_driver **out = addr;
- struct rte_vdev_driver *driver = NULL;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (strncmp(driver->driver.name, name,
- strlen(driver->driver.name)) == 0)
- break;
- if (driver->driver.alias &&
- strncmp(driver->driver.alias, name,
- strlen(driver->driver.alias)) == 0)
- break;
- }
- if (driver != NULL &&
- addr != NULL)
- *out = driver;
- return driver == NULL;
-}
-
-static int
-vdev_probe_all_drivers(struct rte_vdev_device *dev)
-{
- const char *name;
- struct rte_vdev_driver *driver;
- int ret;
-
- name = rte_vdev_device_name(dev);
-
- RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
- rte_vdev_device_name(dev));
-
- if (vdev_parse(name, &driver))
- return -1;
- dev->device.driver = &driver->driver;
- ret = driver->probe(dev);
- if (ret)
- dev->device.driver = NULL;
- return ret;
-}
-
-static struct rte_vdev_device *
-find_vdev(const char *name)
-{
- struct rte_vdev_device *dev;
-
- if (!name)
- return NULL;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- const char *devname = rte_vdev_device_name(dev);
- if (!strncmp(devname, name, strlen(name)))
- return dev;
- }
-
- return NULL;
-}
-
-static struct rte_devargs *
-alloc_devargs(const char *name, const char *args)
-{
- struct rte_devargs *devargs;
- int ret;
-
- devargs = calloc(1, sizeof(*devargs));
- if (!devargs)
- return NULL;
-
- devargs->bus = &rte_vdev_bus;
- if (args)
- devargs->args = strdup(args);
- else
- devargs->args = strdup("");
-
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
- if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
- free(devargs->args);
- free(devargs);
- return NULL;
- }
-
- return devargs;
-}
-
-int
-rte_vdev_init(const char *name, const char *args)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (dev)
- return -EEXIST;
-
- devargs = alloc_devargs(name, args);
- if (!devargs)
- return -ENOMEM;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev) {
- ret = -ENOMEM;
- goto fail;
- }
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- ret = vdev_probe_all_drivers(dev);
- if (ret) {
- if (ret > 0)
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- goto fail;
- }
-
- TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- return 0;
-
-fail:
- free(devargs->args);
- free(devargs);
- free(dev);
- return ret;
-}
-
-static int
-vdev_remove_driver(struct rte_vdev_device *dev)
-{
- const char *name = rte_vdev_device_name(dev);
- const struct rte_vdev_driver *driver;
-
- if (!dev->device.driver) {
- RTE_LOG(DEBUG, EAL, "no driver attach to device %s\n", name);
- return 1;
- }
-
- driver = container_of(dev->device.driver, const struct rte_vdev_driver,
- driver);
- return driver->remove(dev);
-}
-
-int
-rte_vdev_uninit(const char *name)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
- int ret;
-
- if (name == NULL)
- return -EINVAL;
-
- dev = find_vdev(name);
- if (!dev)
- return -ENOENT;
-
- devargs = dev->device.devargs;
-
- ret = vdev_remove_driver(dev);
- if (ret)
- return ret;
-
- TAILQ_REMOVE(&vdev_device_list, dev, next);
-
- TAILQ_REMOVE(&devargs_list, devargs, next);
-
- free(devargs->args);
- free(devargs);
- free(dev);
- return 0;
-}
-
-static int
-vdev_scan(void)
-{
- struct rte_vdev_device *dev;
- struct rte_devargs *devargs;
-
- /* for virtual devices we scan the devargs_list populated via cmdline */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->bus != &rte_vdev_bus)
- continue;
-
- dev = find_vdev(devargs->name);
- if (dev)
- continue;
-
- dev = calloc(1, sizeof(*dev));
- if (!dev)
- return -1;
-
- dev->device.devargs = devargs;
- dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
-
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- }
-
- return 0;
-}
-
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
-
- if (dev->device.driver)
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
- RTE_LOG(ERR, EAL, "failed to initialize %s device\n",
- rte_vdev_device_name(dev));
- return -1;
- }
- }
-
- return 0;
-}
-
-static struct rte_device *
-vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
- const void *data)
-{
- struct rte_vdev_device *dev;
-
- TAILQ_FOREACH(dev, &vdev_device_list, next) {
- if (start && &dev->device == start) {
- start = NULL;
- continue;
- }
- if (cmp(&dev->device, data) == 0)
- return &dev->device;
- }
- return NULL;
-}
-
-static int
-vdev_plug(struct rte_device *dev)
-{
- return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
-}
-
-static int
-vdev_unplug(struct rte_device *dev)
-{
- return rte_vdev_uninit(dev->name);
-}
-
-static struct rte_bus rte_vdev_bus = {
- .scan = vdev_scan,
- .probe = vdev_probe,
- .find_device = vdev_find_device,
- .plug = vdev_plug,
- .unplug = vdev_unplug,
- .parse = vdev_parse,
-};
-
-RTE_REGISTER_BUS(vdev, rte_vdev_bus);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4c4ac7e..8088dcc 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -170,28 +170,6 @@ struct rte_device {
};
/**
- * Initialize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @param args
- * The pointer to arguments used by driver initialization.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_init(const char *name, const char *args);
-
-/**
- * Uninitalize a driver specified by name.
- *
- * @param name
- * The pointer to a driver name to be initialized.
- * @return
- * 0 on success, negative on error
- */
-int rte_vdev_uninit(const char *name);
-
-/**
* Attach a device to a registered driver.
*
* @param name
@@ -316,4 +294,4 @@ __attribute__((used)) = str
}
#endif
-#endif /* _RTE_VDEV_H_ */
+#endif /* _RTE_DEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 29f5a52..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of RehiveTech nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_VDEV_H
-#define RTE_VDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-#include <rte_dev.h>
-#include <rte_devargs.h>
-
-struct rte_vdev_device {
- TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */
- struct rte_device device; /**< Inherit core device */
-};
-
-/**
- * @internal
- * Helper macro for drivers that need to convert to struct rte_vdev_device.
- */
-#define RTE_DEV_TO_VDEV(ptr) \
- container_of(ptr, struct rte_vdev_device, device)
-
-static inline const char *
-rte_vdev_device_name(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.name)
- return dev->device.name;
- return NULL;
-}
-
-static inline const char *
-rte_vdev_device_args(const struct rte_vdev_device *dev)
-{
- if (dev && dev->device.devargs)
- return dev->device.devargs->args;
- return "";
-}
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
-
-/**
- * Probe function called for each virtual device driver once.
- */
-typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
-
-/**
- * Remove function called for each virtual device driver once.
- */
-typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
-
-/**
- * A virtual device driver abstraction.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
- rte_vdev_probe_t *probe; /**< Virtual device probe function. */
- rte_vdev_remove_t *remove; /**< Virtual device remove function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be registered.
- */
-void rte_vdev_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev_driver structure describing the driver
- * to be unregistered.
- */
-void rte_vdev_unregister(struct rte_vdev_driver *driver);
-
-#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
-RTE_INIT(vdrvinitfn_ ##vdrv);\
-static const char *vdrvinit_ ## nm ## _alias;\
-static void vdrvinitfn_ ##vdrv(void)\
-{\
- (vdrv).driver.name = RTE_STR(nm);\
- (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
- rte_vdev_register(&vdrv);\
-} \
-RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
-
-#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
-static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 965da6e..eef80eb 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -37,7 +37,7 @@ ARCH_DIR ?= $(RTE_ARCH)
EXPORT_MAP := ../../rte_eal_version.map
VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)
-LIBABIVER := 6
+LIBABIVER := 7
VPATH += $(RTE_SDK)/lib/librte_eal/common
@@ -77,7 +77,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
-SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 8eb53ab..f9edb29 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -181,10 +181,6 @@ DPDK_17.05 {
rte_pci_unmap_device;
rte_pci_unregister;
rte_pci_write_config;
- rte_vdev_init;
- rte_vdev_register;
- rte_vdev_uninit;
- rte_vdev_unregister;
vfio_get_container_fd;
vfio_get_group_fd;
vfio_get_group_no;
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 482656c..6780f4f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -99,6 +99,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool
_LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index a926779..2e80062 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -36,6 +36,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index 56ed1f8..c0b864b 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -35,6 +35,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
+#include <rte_vdev.h>
#include <rte_event_eth_rx_adapter.h>
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index d6ade78..e3d36f3 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -37,6 +37,7 @@
#include <rte_memcpy.h>
#include <rte_eventdev.h>
#include <rte_dev.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c
index b88b0d2..ecae3e9 100644
--- a/test/test/test_eventdev_octeontx.c
+++ b/test/test/test_eventdev_octeontx.c
@@ -45,6 +45,7 @@
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_random.h>
+#include <rte_vdev.h>
#include "test.h"
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index 7219886..385e743 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -49,6 +49,7 @@
#include <rte_cycles.h>
#include <rte_eventdev.h>
#include <rte_pause.h>
+#include <rte_vdev.h>
#include "test.h"
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 7dccc6e..6199188 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -48,6 +48,7 @@
#include <rte_log.h>
#include <rte_lcore.h>
#include <rte_memory.h>
+#include <rte_vdev.h>
#include <rte_string_fns.h>
#include <rte_errno.h>
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v2] mbuf: rename deprecated VLAN flags
2017-10-23 12:16 2% [dpdk-dev] [PATCH] mbuf: rename deprecated VLAN flags Olivier Matz
@ 2017-10-25 15:12 2% ` Olivier Matz
0 siblings, 0 replies; 200+ results
From: Olivier Matz @ 2017-10-25 15:12 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas
PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated for a while.
As explained in [1], these flags were kept to let the applications and
PMDs move to the new flag. There is also a need to support Rx vlan
offload without vlan strip (at least for the ixgbe driver).
This patch renames the old flags for this feature, knowing that some
PMDs were using PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT to indicate that
the vlan tci has been saved in the mbuf structure.
It is likely that some PMDs do not set the proper flags when doing vlan
offload, and it would be worth making a pass on all of them.
Link: [1] http://dpdk.org/ml/archives/dev/2017-June/067712.html
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
v1->v2
- rebase on latest net-next
- clarify api documentation to highlight that when using the
flag PKT_RX_xyz_STRIPPED, then PKT_RX_xyz must be set too.
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 13 ++++++++++++
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/avp/avp_ethdev.c | 4 ++--
drivers/net/bnx2x/bnx2x_rxtx.c | 2 +-
drivers/net/bnxt/bnxt_rxr.c | 4 ++--
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/cxgbe/sge.c | 4 ++--
drivers/net/dpaa/dpaa_rxtx.c | 2 +-
drivers/net/dpaa2/dpaa2_rxtx.c | 2 +-
drivers/net/e1000/em_rxtx.c | 6 +++---
drivers/net/e1000/igb_rxtx.c | 6 +++---
drivers/net/enic/enic_rxtx.c | 2 +-
drivers/net/fm10k/fm10k_rxtx.c | 8 ++++----
drivers/net/fm10k/fm10k_rxtx_vec.c | 4 ++--
drivers/net/i40e/i40e_rxtx.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_sse.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 2 +-
drivers/net/mlx5/mlx5_rxtx.c | 2 +-
drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 4 ++--
drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +++++-----
drivers/net/nfp/nfp_net.c | 2 +-
drivers/net/qede/qede_rxtx.c | 2 +-
drivers/net/vmxnet3/vmxnet3_rxtx.c | 3 ++-
lib/librte_mbuf/rte_mbuf.c | 5 +++--
lib/librte_mbuf/rte_mbuf.h | 33 ++++++++++++++++++-------------
lib/librte_net/rte_ether.h | 2 +-
32 files changed, 83 insertions(+), 68 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3a5d09366..d14fd021c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -28,11 +28,6 @@ Deprecation Notices
The change will be only for the name.
Functional aspects of the API or data-structure will remain same.
-* The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
- are respectively replaced by PKT_RX_VLAN_STRIPPED and
- PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
- their behavior will be kept until 17.08 and will be removed in 17.11.
-
* ethdev: Tx offloads will no longer be enabled by default in 17.11.
Instead, the ``rte_eth_txmode`` structure will be extended with
bit field to enable each Tx offload.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index e505a4dcd..ffe74030b 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -322,6 +322,19 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* **Removed ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT``.**
+
+ The ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT`` have
+ been removed since their behavior were not properly described.
+
+* **Added ``mbuf`` flags ``PKT_RX_VLAN`` and ``PKT_RX_QINQ``.**
+
+ Two ``mbuf`` flags have been added to indicate that the VLAN
+ identifier has been saved in in the ``mbuf`` structure. For instance:
+
+ - if VLAN is not stripped and TCI is saved: ``PKT_RX_VLAN``
+ - if VLAN is stripped and TCI is saved: ``PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED``
+
ABI Changes
-----------
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 46b8250d0..dc1867057 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -167,7 +167,7 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
/* check for vlan info */
if (ppd->tp_status & TP_STATUS_VLAN_VALID) {
mbuf->vlan_tci = ppd->tp_vlan_tci;
- mbuf->ol_flags |= (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ mbuf->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
}
/* release incoming frame and advance ring buffer */
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index b97a90cea..43b33dbf2 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -1361,7 +1361,7 @@ avp_dev_copy_from_buffers(struct avp_dev *avp,
src_offset = 0;
if (pkt_buf->ol_flags & RTE_AVP_RX_VLAN_PKT) {
- ol_flags = PKT_RX_VLAN_PKT;
+ ol_flags = PKT_RX_VLAN;
vlan_tci = pkt_buf->vlan_tci;
} else {
ol_flags = 0;
@@ -1619,7 +1619,7 @@ avp_recv_pkts(void *rx_queue,
m->port = avp->port_id;
if (pkt_buf->ol_flags & RTE_AVP_RX_VLAN_PKT) {
- m->ol_flags = PKT_RX_VLAN_PKT;
+ m->ol_flags = PKT_RX_VLAN;
m->vlan_tci = pkt_buf->vlan_tci;
}
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 5dd4aee7f..c72067f6f 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -422,7 +422,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
*/
if (cqe_fp->pars_flags.flags & PARSING_FLAGS_VLAN) {
rx_mb->vlan_tci = cqe_fp->vlan_tag;
- rx_mb->ol_flags |= PKT_RX_VLAN_PKT;
+ rx_mb->ol_flags |= PKT_RX_VLAN;
}
rx_pkts[nb_rx] = rx_mb;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index d68d26f17..30891b74f 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -199,7 +199,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
if (tpa_start1->flags2 &
rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN)) {
mbuf->vlan_tci = rte_le_to_cpu_32(tpa_start1->metadata);
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
}
if (likely(tpa_start1->flags2 &
rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_L4_CS_CALC)))
@@ -464,7 +464,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
(RX_PKT_CMPL_METADATA_VID_MASK |
RX_PKT_CMPL_METADATA_DE |
RX_PKT_CMPL_METADATA_PRI_MASK);
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
}
if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 3fbc1b123..c48993940 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -129,7 +129,7 @@ is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf)
{
const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
- return !((mbuf->ol_flags & PKT_RX_VLAN_PKT) ? mbuf->vlan_tci : 0) &&
+ return !((mbuf->ol_flags & PKT_RX_VLAN) ? mbuf->vlan_tci : 0) &&
(ethertype == ether_type_slow_be &&
(subtype == SLOW_SUBTYPE_MARKER || subtype == SLOW_SUBTYPE_LACP));
}
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5376fc500..33f7f0bc2 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1405,7 +1405,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
}
if (pkt->vlan_ex) {
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
mbuf->vlan_tci = ntohs(pkt->vlan);
}
rxq->stats.pkts++;
@@ -1550,7 +1550,7 @@ static int process_responses(struct sge_rspq *q, int budget,
}
if (cpl->vlan_ex) {
- pkt->ol_flags |= PKT_RX_VLAN_PKT;
+ pkt->ol_flags |= PKT_RX_VLAN;
pkt->vlan_tci = ntohs(cpl->vlan);
}
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 0433f3bb1..f7cfff798 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -219,7 +219,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m,
/* Check if Vlan is present */
if (prs & DPAA_PARSE_VLAN_MASK)
- m->ol_flags |= PKT_RX_VLAN_PKT;
+ m->ol_flags |= PKT_RX_VLAN;
/* Packet received without stripping the vlan */
}
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a8c..3f57dc227 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -122,7 +122,7 @@ dpaa2_dev_rx_offload(uint64_t hw_annot_addr, struct rte_mbuf *mbuf)
if (BIT_ISSET_AT_POS(annotation->word3,
L2_VLAN_1_PRESENT | L2_VLAN_N_PRESENT))
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L3CE))
mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 92b66b0ea..d4d5fe6e1 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -675,7 +675,7 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
/* Check if VLAN present */
pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ?
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED : 0);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED : 0);
return pkt_flags;
}
@@ -830,7 +830,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->ol_flags = rxm->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
/*
@@ -1056,7 +1056,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->ol_flags = first_seg->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
/* Prefetch data of first segment, if configured to do so. */
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 8a1e5b18e..d25ea048d 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -785,7 +785,7 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
/* Check if VLAN present */
pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ?
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED : 0);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED : 0);
#if defined(RTE_LIBRTE_IEEE1588)
if (rx_status & E1000_RXD_STAT_TMST)
@@ -946,7 +946,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(rxq, hlen_type_rss);
@@ -1180,7 +1180,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
/*
- * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+ * The vlan_tci field is only valid when PKT_RX_VLAN is
* set in the pkt_flags field.
*/
first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index a39172f14..1d43bde9a 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -243,7 +243,7 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
/* VLAN STRIPPED flag. The L2 packet type updated here also */
if (bwflags & CQ_ENET_RQ_DESC_FLAGS_VLAN_STRIPPED) {
- pkt_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ pkt_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
mbuf->packet_type |= RTE_PTYPE_L2_ETHER;
} else {
if (vlan_tci != 0)
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 4e84926f8..d6081e485 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -158,10 +158,10 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
* Packets in fm10k device always carry at least one VLAN tag.
* For those packets coming in without VLAN tag,
* the port default VLAN tag will be used.
- * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * So, always PKT_RX_VLAN flag is set and vlan_tci
* is valid for each RX packet's mbuf.
*/
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
mbuf->vlan_tci = desc.w.vlan;
/**
* mbuf->vlan_tci_outer is an idle field in fm10k driver,
@@ -319,10 +319,10 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
* Packets in fm10k device always carry at least one VLAN tag.
* For those packets coming in without VLAN tag,
* the port default VLAN tag will be used.
- * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * So, always PKT_RX_VLAN flag is set and vlan_tci
* is valid for each RX packet's mbuf.
*/
- first_seg->ol_flags |= PKT_RX_VLAN_PKT;
+ first_seg->ol_flags |= PKT_RX_VLAN;
first_seg->vlan_tci = desc.w.vlan;
/**
* mbuf->vlan_tci_outer is an idle field in fm10k driver,
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index d23bfe9b7..edc4ae16e 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -81,8 +81,8 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
const __m128i pkttype_msk = _mm_set_epi16(
0x0000, 0x0000, 0x0000, 0x0000,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT);
+ PKT_RX_VLAN, PKT_RX_VLAN,
+ PKT_RX_VLAN, PKT_RX_VLAN);
/* mask everything except rss type */
const __m128i rsstype_msk = _mm_set_epi16(
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index f21c1c5d2..904d37f08 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -108,7 +108,7 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
{
if (rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len) &
(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
- mb->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
mb->vlan_tci =
rte_le_to_cpu_16(rxdp->wb.qword0.lo_dword.l2tag1);
PMD_RX_LOG(DEBUG, "Descriptor l2tag1: %u",
diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index f4036ea28..5ab9445ed 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -146,7 +146,7 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
/* map rss and vlan type to rss hash and vlan flag */
const vector unsigned char vlan_flags = (vector unsigned char){
0, 0, 0, 0,
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 694e91f33..d0e604068 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -137,7 +137,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, uint64x2_t descs[4],
/* map rss and vlan type to rss hash and vlan flag */
const uint8x16_t vlan_flags = {
0, 0, 0, 0,
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 779f14e53..86e16ddf9 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -151,7 +151,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, __m128i descs[4],
/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, 0, PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ 0, 0, 0, PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
0, 0, 0, 0);
const __m128i rss_flags = _mm_set_epi8(0, 0, 0, 0,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2ff904119..3c6e29594 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1960,9 +1960,9 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on)
rxq = dev->data->rx_queues[queue];
if (on)
- rxq->vlan_flags = PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ rxq->vlan_flags = PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
else
- rxq->vlan_flags = PKT_RX_VLAN_PKT;
+ rxq->vlan_flags = PKT_RX_VLAN;
}
static void
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 0038dfbb4..ea2813a43 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1849,7 +1849,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->port = rxq->port_id;
pkt_info = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_status_to_pkt_flags(staterr, vlan_flags);
@@ -1940,7 +1940,7 @@ ixgbe_fill_cluster_head_buf(
head->port = rxq->port_id;
- /* The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+ /* The vlan_tci field is only valid when PKT_RX_VLAN is
* set in the pkt_flags field.
*/
head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 44de1caac..18e3d199f 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -126,8 +126,8 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2,
} vol;
const uint8x16_t pkttype_msk = {
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
+ PKT_RX_VLAN, PKT_RX_VLAN,
+ PKT_RX_VLAN, PKT_RX_VLAN,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index e704a7f35..fe6937bf3 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -397,7 +397,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
sw_ring = &rxq->sw_ring[rxq->rx_tail];
/* ensure these 2 flags are in the lower 8 bits */
- RTE_BUILD_BUG_ON((PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED) > UINT8_MAX);
+ RTE_BUILD_BUG_ON((PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED) > UINT8_MAX);
vlan_flags = rxq->vlan_flags & UINT8_MAX;
/* A. load 4 packet in one loop
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 67e7e0639..af0a75546 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1884,7 +1884,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
if (rxq->vlan_strip &&
(cqe->hdr_type_etc &
rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) {
- pkt->ol_flags |= PKT_RX_VLAN_PKT |
+ pkt->ol_flags |= PKT_RX_VLAN |
PKT_RX_VLAN_STRIPPED;
pkt->vlan_tci =
rte_be_to_cpu_16(cqe->vlan_info);
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 4cb7f2889..da3c96f4a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -572,7 +572,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
const uint32x4_t ptype_ol_mask = { 0x106, 0x106, 0x106, 0x106 };
const uint8x16_t cv_flag_sel = {
0,
- (uint8_t)(PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED),
+ (uint8_t)(PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED),
(uint8_t)(PKT_RX_IP_CKSUM_GOOD >> 1),
0,
(uint8_t)(PKT_RX_L4_CKSUM_GOOD >> 1),
@@ -582,7 +582,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
};
const uint32x4_t cv_mask =
vdupq_n_u32(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
const uint64x1_t mbuf_init = vld1_u64(&rxq->mbuf_initializer);
const uint64x1_t r32_mask = vcreate_u64(0xffffffff);
uint64x2_t rearm0, rearm1, rearm2, rearm3;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index e9819b762..95e41d51a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -563,17 +563,17 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq, __m128i cqes[4],
(uint8_t)(PKT_RX_L4_CKSUM_GOOD >> 1),
0,
(uint8_t)(PKT_RX_IP_CKSUM_GOOD >> 1),
- (uint8_t)(PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED),
+ (uint8_t)(PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED),
0);
const __m128i cv_mask =
_mm_set_epi32(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
const __m128i mbuf_init =
_mm_loadl_epi64((__m128i *)&rxq->mbuf_initializer);
__m128i rearm0, rearm1, rearm2, rearm3;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 0917b9c49..098dbcb62 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2067,7 +2067,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if ((rxds->rxd.flags & PCIE_DESC_RX_VLAN) &&
(hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN)) {
mb->vlan_tci = rte_cpu_to_le_32(rxds->rxd.vlan);
- mb->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
}
/* Adding the mbuff to the mbuff array passed by the app */
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index aba51aba6..49de13b48 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -1450,7 +1450,7 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if (CQE_HAS_VLAN(parse_flag) ||
CQE_HAS_OUTER_VLAN(parse_flag)) {
/* Note: FW doesn't indicate Q-in-Q packet */
- ol_flags |= PKT_RX_VLAN_PKT;
+ ol_flags |= PKT_RX_VLAN;
if (qdev->vlan_strip_flg) {
ol_flags |= PKT_RX_VLAN_STRIPPED;
rx_mb->vlan_tci = vlan_tci;
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index c9a2df3f4..01c85f138 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -847,7 +847,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
/* Check for hardware stripped VLAN tag */
if (rcd->ts) {
- start->ol_flags |= (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ start->ol_flags |= (PKT_RX_VLAN |
+ PKT_RX_VLAN_STRIPPED);
start->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
}
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0e18709d9..92fc704ee 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -308,7 +308,7 @@ const void *__rte_pktmbuf_read(const struct rte_mbuf *m, uint32_t off,
const char *rte_get_rx_ol_flag_name(uint64_t mask)
{
switch (mask) {
- case PKT_RX_VLAN_PKT: return "PKT_RX_VLAN_PKT";
+ case PKT_RX_VLAN: return "PKT_RX_VLAN";
case PKT_RX_RSS_HASH: return "PKT_RX_RSS_HASH";
case PKT_RX_FDIR: return "PKT_RX_FDIR";
case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD";
@@ -339,7 +339,7 @@ int
rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
{
const struct flag_mask rx_flags[] = {
- { PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT, NULL },
+ { PKT_RX_VLAN, PKT_RX_VLAN, NULL },
{ PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, NULL },
{ PKT_RX_FDIR, PKT_RX_FDIR, NULL },
{ PKT_RX_L4_CKSUM_BAD, PKT_RX_L4_CKSUM_MASK, NULL },
@@ -359,6 +359,7 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
{ PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL },
{ PKT_RX_LRO, PKT_RX_LRO, NULL },
{ PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL },
+ { PKT_RX_QINQ, PKT_RX_QINQ, NULL },
};
const char *name;
unsigned int i;
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index cc380400d..9094095fd 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -89,12 +89,13 @@ extern "C" {
*/
/**
- * RX packet is a 802.1q VLAN packet. This flag was set by PMDs when
- * the packet is recognized as a VLAN, but the behavior between PMDs
- * was not the same. This flag is kept for some time to avoid breaking
- * applications and should be replaced by PKT_RX_VLAN_STRIPPED.
+ * The RX packet is a 802.1q VLAN packet, and the tci has been
+ * saved in in mbuf->vlan_tci.
+ * If the flag PKT_RX_VLAN_STRIPPED is also present, the VLAN
+ * header has been stripped from mbuf data, else it is still
+ * present.
*/
-#define PKT_RX_VLAN_PKT (1ULL << 0)
+#define PKT_RX_VLAN (1ULL << 0)
#define PKT_RX_RSS_HASH (1ULL << 1) /**< RX packet with RSS hash result. */
#define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */
@@ -123,6 +124,7 @@ extern "C" {
* A vlan has been stripped by the hardware and its tci is saved in
* mbuf->vlan_tci. This can only happen if vlan stripping is enabled
* in the RX configuration of the PMD.
+ * When PKT_RX_VLAN_STRIPPED is set, PKT_RX_VLAN must also be set.
*/
#define PKT_RX_VLAN_STRIPPED (1ULL << 6)
@@ -165,19 +167,13 @@ extern "C" {
* The 2 vlans have been stripped by the hardware and their tci are
* saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).
* This can only happen if vlan stripping is enabled in the RX
- * configuration of the PMD. If this flag is set, PKT_RX_VLAN_STRIPPED
- * must also be set.
+ * configuration of the PMD. If this flag is set,
+ * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN |
+ * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set.
*/
#define PKT_RX_QINQ_STRIPPED (1ULL << 15)
/**
- * Deprecated.
- * RX packet with double VLAN stripped.
- * This flag is replaced by PKT_RX_QINQ_STRIPPED.
- */
-#define PKT_RX_QINQ_PKT PKT_RX_QINQ_STRIPPED
-
-/**
* When packets are coalesced by a hardware or virtual driver, this flag
* can be set in the RX mbuf, meaning that the m->tso_segsz field is
* valid and is set to the segment size of original packets.
@@ -189,6 +185,15 @@ extern "C" {
*/
#define PKT_RX_TIMESTAMP (1ULL << 17)
+/**
+ * The RX packet is a double VLAN, and the outer tci has been
+ * saved in in mbuf->vlan_tci_outer.
+ * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
+ * headers have been stripped from mbuf data, else they are still
+ * present.
+ */
+#define PKT_RX_QINQ (1ULL << 18)
+
/* add new RX flags here */
/* add new TX flags here */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 917d42a1a..06d7b486c 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -358,7 +358,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m)
return -1;
struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);
- m->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci);
/* Copy ether header over rather than moving whole packet */
--
2.11.0
^ permalink raw reply [relevance 2%]
* [dpdk-dev] [PATCH] eal: fix version map experimental export section
@ 2017-10-25 12:29 4% Harry van Haaren
2017-11-06 23:07 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Harry van Haaren @ 2017-10-25 12:29 UTC (permalink / raw)
To: dev; +Cc: thomas, Harry van Haaren, santosh.shukla
Before this commit, the EXPERIMENTAL version of ABI
derived from the DPDK_17.08 tag. In parallel there
was a DPDK_17.11 tag.
Experimental map should always derive from the latest ABI,
so this patch moves the 17.11 section above EXPERIMENTAL,
and updates EXPERIMENTAL to derive from the 17.11 map.
Fixes: aadc3eb002d3 ("pci: export match function")
Cc: santosh.shukla@caviumnetworks.com
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
lib/librte_eal/rte_eal_version.map | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 8802b28..c0df978 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -201,6 +201,19 @@ DPDK_17.08 {
} DPDK_17.05;
+DPDK_17.11 {
+ global:
+
+ rte_bus_get_iommu_class;
+ rte_eal_iova_mode;
+ rte_eal_mbuf_default_mempool_ops;
+ rte_lcore_has_role;
+ rte_memcpy_ptr;
+ rte_pci_get_iommu_class;
+ rte_pci_match;
+
+} DPDK_17.08;
+
EXPERIMENTAL {
global:
@@ -234,17 +247,4 @@ EXPERIMENTAL {
rte_service_set_stats_enable;
rte_service_start_with_defaults;
-} DPDK_17.08;
-
-DPDK_17.11 {
- global:
-
- rte_bus_get_iommu_class;
- rte_eal_iova_mode;
- rte_eal_mbuf_default_mempool_ops;
- rte_lcore_has_role;
- rte_memcpy_ptr;
- rte_pci_get_iommu_class;
- rte_pci_match;
-
-} DPDK_17.08;
+} DPDK_17.11;
--
2.7.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI device bus
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-25 12:00 1% ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
@ 2017-10-25 12:00 3% ` Declan Doherty
2 siblings, 0 replies; 200+ results
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
To: dev; +Cc: Declan Doherty
Removes any dependency of librte_cryptodev on the PCI device
infrastructure code and removes the functions which were virtual
device specific.
Updates QAT crypto PMD to remove dependencies on rte_cryptodev_pci.h
and replaces those calls with the new bus independent functions.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 7 ++
drivers/crypto/qat/qat_crypto.c | 3 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 55 +++++++++++----
lib/librte_cryptodev/Makefile | 1 -
lib/librte_cryptodev/rte_cryptodev_pci.h | 92 -------------------------
lib/librte_cryptodev/rte_cryptodev_pmd.c | 95 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 2 -
7 files changed, 52 insertions(+), 203 deletions(-)
delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 7755768..78170e1 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -305,6 +305,13 @@ API Changes
and have been replaced by non bus specific functions
``rte_cryptodev_pmd_parse_input_args()`` and ``rte_cryptodev_pmd_create()``.
+* **Removed PCI device bus specific functions from librte_cryptodev.**
+
+ The functions ``rte_cryptodev_pci_generic_probe()`` and
+ ``rte_cryptodev_pci_generic_remove()`` have been removed from librte_cryptodev
+ and have been replaced by non bus specific functions
+ ``rte_cryptodev_pmd_create()`` and ``rte_cryptodev_pmd_destroy()``.
+
ABI Changes
-----------
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index ae73c78..87f232e 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -58,8 +58,9 @@
#include <rte_spinlock.h>
#include <rte_hexdump.h>
#include <rte_crypto_sym.h>
-#include <rte_cryptodev_pci.h>
#include <rte_byteorder.h>
+#include <rte_pci.h>
+
#include <openssl/evp.h>
#include "qat_logs.h"
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 3d9f3c8..701c5a6 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -34,8 +34,8 @@
#include <rte_common.h>
#include <rte_dev.h>
#include <rte_malloc.h>
+#include <rte_pci.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_pci.h>
#include "qat_crypto.h"
#include "qat_logs.h"
@@ -97,15 +97,18 @@ static const struct rte_pci_id pci_id_qat_map[] = {
};
static int
-crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
+crypto_qat_create(const char *name, struct rte_pci_device *pci_dev,
+ struct rte_cryptodev_pmd_init_params *init_params)
{
+ struct rte_cryptodev *cryptodev;
struct qat_pmd_private *internals;
PMD_INIT_FUNC_TRACE();
- PMD_DRV_LOG(DEBUG, "Found crypto device at %02x:%02x.%x",
- RTE_DEV_TO_PCI(cryptodev->device)->addr.bus,
- RTE_DEV_TO_PCI(cryptodev->device)->addr.devid,
- RTE_DEV_TO_PCI(cryptodev->device)->addr.function);
+
+ cryptodev = rte_cryptodev_pmd_create(name, &pci_dev->device,
+ init_params);
+ if (cryptodev == NULL)
+ return -ENODEV;
cryptodev->driver_id = cryptodev_qat_driver_id;
cryptodev->dev_ops = &crypto_qat_ops;
@@ -119,8 +122,8 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
internals = cryptodev->data->dev_private;
- internals->max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS;
- switch (RTE_DEV_TO_PCI(cryptodev->device)->id.device_id) {
+ internals->max_nb_sessions = init_params->max_nb_sessions;
+ switch (pci_dev->id.device_id) {
case 0x0443:
internals->qat_dev_gen = QAT_GEN1;
internals->qat_dev_capabilities = qat_gen1_capabilities;
@@ -151,15 +154,43 @@ crypto_qat_dev_init(struct rte_cryptodev *cryptodev)
}
static int crypto_qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
- struct rte_pci_device *pci_dev)
+ struct rte_pci_device *pci_dev)
{
- return rte_cryptodev_pci_generic_probe(pci_dev,
- sizeof(struct qat_pmd_private), crypto_qat_dev_init);
+ struct rte_cryptodev_pmd_init_params init_params = {
+ .name = "",
+ .socket_id = rte_socket_id(),
+ .private_data_size = sizeof(struct qat_pmd_private),
+ .max_nb_sessions = RTE_QAT_PMD_MAX_NB_SESSIONS
+ };
+ char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+ PMD_DRV_LOG(DEBUG, "Found QAT device at %02x:%02x.%x",
+ pci_dev->addr.bus,
+ pci_dev->addr.devid,
+ pci_dev->addr.function);
+
+ rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
+
+ return crypto_qat_create(name, pci_dev, &init_params);
}
static int crypto_qat_pci_remove(struct rte_pci_device *pci_dev)
{
- return rte_cryptodev_pci_generic_remove(pci_dev, NULL);
+ struct rte_cryptodev *cryptodev;
+ char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+
+ if (pci_dev == NULL)
+ return -EINVAL;
+
+ rte_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
+
+ cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
+ if (cryptodev == NULL)
+ return -ENODEV;
+
+ /* free crypto device */
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_pci_driver rte_qat_pmd = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 0e019ed..ee00e8c 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -50,7 +50,6 @@ SYMLINK-y-include += rte_crypto.h
SYMLINK-y-include += rte_crypto_sym.h
SYMLINK-y-include += rte_cryptodev.h
SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_pci.h
# versioning export map
EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pci.h b/lib/librte_cryptodev/rte_cryptodev_pci.h
deleted file mode 100644
index 67eda96..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_pci.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_PCI_H_
-#define _RTE_CRYPTODEV_PCI_H_
-
-#include <rte_pci.h>
-#include "rte_cryptodev.h"
-
-/**
- * Initialisation function of a crypto driver invoked for each matching
- * crypto PCI device detected during the PCI probing phase.
- *
- * @param dev The dev pointer is the address of the *rte_cryptodev*
- * structure associated with the matching device and which
- * has been [automatically] allocated in the
- * *rte_crypto_devices* array.
- *
- * @return
- * - 0: Success, the device is properly initialised by the driver.
- * In particular, the driver MUST have set up the *dev_ops* pointer
- * of the *dev* structure.
- * - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_init_t)(struct rte_cryptodev *dev);
-
-/**
- * Finalisation function of a driver invoked for each matching
- * PCI device detected during the PCI closing phase.
- *
- * @param dev The dev pointer is the address of the *rte_cryptodev*
- * structure associated with the matching device and which
- * has been [automatically] allocated in the
- * *rte_crypto_devices* array.
- *
- * * @return
- * - 0: Success, the device is properly finalised by the driver.
- * In particular, the driver MUST free the *dev_ops* pointer
- * of the *dev* structure.
- * - <0: Error code of the device initialisation failure.
- */
-typedef int (*cryptodev_pci_uninit_t)(struct rte_cryptodev *dev);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
- size_t private_data_size,
- cryptodev_pci_init_t dev_init);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .remove function to detach a crypto
- * interface.
- */
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
- cryptodev_pci_uninit_t dev_uninit);
-
-#endif /* _RTE_CRYPTODEV_PCI_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index 0b5741a..8d4b78a 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
#include <rte_malloc.h>
-#include "rte_cryptodev_pci.h"
#include "rte_cryptodev_pmd.h"
/**
@@ -177,8 +176,6 @@ rte_cryptodev_pmd_create(const char *name,
return cryptodev;
}
-
-
int
rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
{
@@ -203,95 +200,3 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
return 0;
}
-int
-rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
- size_t private_data_size,
- cryptodev_pci_init_t dev_init)
-{
- struct rte_cryptodev *cryptodev;
-
- char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
-
- int retval;
-
- rte_pci_device_name(&pci_dev->addr, cryptodev_name,
- sizeof(cryptodev_name));
-
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
- if (cryptodev == NULL)
- return -ENOMEM;
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- cryptodev->data->dev_private =
- rte_zmalloc_socket(
- "cryptodev private structure",
- private_data_size,
- RTE_CACHE_LINE_SIZE,
- rte_socket_id());
-
- if (cryptodev->data->dev_private == NULL)
- rte_panic("Cannot allocate memzone for private "
- "device data");
- }
-
- cryptodev->device = &pci_dev->device;
-
- /* init user callbacks */
- TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
- /* Invoke PMD device initialization function */
- RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
- retval = dev_init(cryptodev);
- if (retval == 0)
- return 0;
-
- CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_dev->device.driver->name,
- (unsigned int) pci_dev->id.vendor_id,
- (unsigned int) pci_dev->id.device_id);
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(cryptodev->data->dev_private);
-
- /* free crypto device */
- rte_cryptodev_pmd_release_device(cryptodev);
-
- return -ENXIO;
-}
-
-int
-rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
- cryptodev_pci_uninit_t dev_uninit)
-{
- struct rte_cryptodev *cryptodev;
- char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
- int ret;
-
- if (pci_dev == NULL)
- return -EINVAL;
-
- rte_pci_device_name(&pci_dev->addr, cryptodev_name,
- sizeof(cryptodev_name));
-
- cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
- if (cryptodev == NULL)
- return -ENODEV;
-
- /* Invoke PMD device uninit function */
- if (dev_uninit) {
- ret = dev_uninit(cryptodev);
- if (ret)
- return ret;
- }
-
- /* free crypto device */
- rte_cryptodev_pmd_release_device(cryptodev);
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(cryptodev->data->dev_private);
-
- cryptodev->device = NULL;
- cryptodev->data = NULL;
-
- return 0;
-}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index d3e4515..4355166 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -68,8 +68,6 @@ DPDK_17.08 {
rte_cryptodev_get_aead_algo_enum;
rte_cryptodev_get_header_session_size;
rte_cryptodev_get_private_session_size;
- rte_cryptodev_pci_generic_probe;
- rte_cryptodev_pci_generic_remove;
rte_cryptodev_sym_capability_check_aead;
rte_cryptodev_sym_session_init;
rte_cryptodev_sym_session_clear;
--
2.9.4
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
@ 2017-10-25 12:00 1% ` Declan Doherty
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
2 siblings, 0 replies; 200+ results
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
To: dev; +Cc: Declan Doherty
Removes any dependency of librte_cryptodev on the virtual device
infrastructure code and removes the functions which were virtual
device specific.
Updates all virtual PMDs to remove dependencies on rte_cryptodev_vdev.h
and replaces those calls with the new bus independent functions.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 --
doc/guides/rel_notes/release_17_11.rst | 7 ++
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 56 ++++--------
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 73 +++++++--------
drivers/crypto/armv8/rte_armv8_pmd.c | 41 +++------
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 11 +--
drivers/crypto/dpaa_sec/dpaa_sec.c | 14 +--
drivers/crypto/kasumi/rte_kasumi_pmd.c | 49 ++++------
drivers/crypto/mrvl/rte_mrvl_pmd.c | 56 ++++--------
drivers/crypto/null/null_crypto_pmd.c | 72 ++++++---------
drivers/crypto/openssl/rte_openssl_pmd.c | 42 +++------
drivers/crypto/scheduler/scheduler_pmd.c | 45 +++-------
drivers/crypto/scheduler/scheduler_pmd_ops.c | 3 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 41 +++------
drivers/crypto/zuc/rte_zuc_pmd.c | 41 +++------
lib/librte_cryptodev/Makefile | 1 -
lib/librte_cryptodev/rte_cryptodev_pmd.c | 120 -------------------------
lib/librte_cryptodev/rte_cryptodev_vdev.h | 100 ---------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 2 -
19 files changed, 190 insertions(+), 589 deletions(-)
delete mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.h
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 0d99251..ffd5e24 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -71,11 +71,6 @@ Deprecation Notices
- ``rte_cryptodev_create_vdev``
-* cryptodev: the following function will be static in 17.11 and included
- by all crypto drivers, therefore, will not be public:
-
- - ``rte_cryptodev_vdev_pmd_init``
-
* librte_meter: The API will change to accommodate configuration profiles.
Most of the API functions will have an additional opaque parameter.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 0a90db4..7755768 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -298,6 +298,13 @@ API Changes
are bus independent for driver to manage creation and destruction of new
device instances.
+* **Removed virtual device bus specific functions from librte_cryptodev.**
+
+ The functions ``rte_cryptodev_vdev_parse_init_params()`` and
+ ``rte_cryptodev_vdev_pmd_init()`` have been removed from librte_cryptodev
+ and have been replaced by non bus specific functions
+ ``rte_cryptodev_pmd_parse_input_args()`` and ``rte_cryptodev_pmd_create()``.
+
ABI Changes
-----------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 29c14e5..1d18217 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -35,7 +35,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -486,22 +485,24 @@ static int aesni_gcm_remove(struct rte_vdev_device *vdev);
static int
aesni_gcm_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct aesni_gcm_private *internals;
enum aesni_gcm_vector_mode vector_mode;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
-
/* Check CPU for support for AES instruction set */
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) {
GCM_LOG_ERR("AES instructions not supported by CPU");
return -EFAULT;
}
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+ if (dev == NULL) {
+ GCM_LOG_ERR("driver %s: create failed", init_params->name);
+ return -ENODEV;
+ }
+
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
vector_mode = RTE_AESNI_GCM_AVX2;
@@ -510,14 +511,6 @@ aesni_gcm_create(const char *name,
else
vector_mode = RTE_AESNI_GCM_SSE;
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct aesni_gcm_private), init_params->socket_id,
- vdev);
- if (dev == NULL) {
- GCM_LOG_ERR("failed to create cryptodev vdev");
- goto init_error;
- }
-
dev->driver_id = cryptodev_driver_id;
dev->dev_ops = rte_aesni_gcm_pmd_ops;
@@ -552,22 +545,17 @@ aesni_gcm_create(const char *name,
internals->max_nb_sessions = init_params->max_nb_sessions;
return 0;
-
-init_error:
- GCM_LOG_ERR("driver %s: create failed", init_params->name);
-
- aesni_gcm_remove(vdev);
- return -EFAULT;
}
static int
aesni_gcm_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct aesni_gcm_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -576,17 +564,7 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
if (name == NULL)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return aesni_gcm_create(name, vdev, &init_params);
}
@@ -594,16 +572,18 @@ aesni_gcm_probe(struct rte_vdev_device *vdev)
static int
aesni_gcm_remove(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- GCM_LOG_INFO("Closing AESNI crypto device %s on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 49242fc..a589557 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -36,7 +36,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -715,15 +714,23 @@ static int cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev);
static int
cryptodev_aesni_mb_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct aesni_mb_private *internals;
enum aesni_mb_vector_mode vector_mode;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
+ /* Check CPU for support for AES instruction set */
+ if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) {
+ MB_LOG_ERR("AES instructions not supported by CPU");
+ return -EFAULT;
+ }
+
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+ if (dev == NULL) {
+ MB_LOG_ERR("failed to create cryptodev vdev");
+ return -ENODEV;
+ }
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F))
@@ -735,14 +742,6 @@ cryptodev_aesni_mb_create(const char *name,
else
vector_mode = RTE_AESNI_MB_SSE;
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct aesni_mb_private), init_params->socket_id,
- vdev);
- if (dev == NULL) {
- MB_LOG_ERR("failed to create cryptodev vdev");
- goto init_error;
- }
-
dev->driver_id = cryptodev_driver_id;
dev->dev_ops = rte_aesni_mb_pmd_ops;
@@ -779,41 +778,33 @@ cryptodev_aesni_mb_create(const char *name,
internals->max_nb_sessions = init_params->max_nb_sessions;
return 0;
-init_error:
- MB_LOG_ERR("driver %s: cryptodev_aesni_create failed",
- init_params->name);
-
- cryptodev_aesni_mb_remove(vdev);
- return -EFAULT;
}
static int
cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct aesni_mb_private),
rte_socket_id(),
- ""
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
- const char *name;
- const char *input_args;
+ const char *name, *args;
+ int retval;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+
+ args = rte_vdev_device_args(vdev);
+
+ retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+ if (retval) {
+ MB_LOG_ERR("Failed to parse initialisation arguments[%s]\n",
+ args);
+ return -EINVAL;
+ }
return cryptodev_aesni_mb_create(name, vdev, &init_params);
}
@@ -821,16 +812,18 @@ cryptodev_aesni_mb_probe(struct rte_vdev_device *vdev)
static int
cryptodev_aesni_mb_remove(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Closing AESNI crypto device %s on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index dbe6bee..2d2f3ff 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -36,7 +36,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -759,7 +758,7 @@ armv8_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
static int
cryptodev_armv8_crypto_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct armv8_crypto_private *internals;
@@ -786,14 +785,7 @@ cryptodev_armv8_crypto_create(const char *name,
return -EFAULT;
}
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct armv8_crypto_private),
- init_params->socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
ARMV8_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -832,11 +824,12 @@ cryptodev_armv8_crypto_create(const char *name,
static int
cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct armv8_crypto_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -845,18 +838,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
if (name == NULL)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0') {
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- }
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return cryptodev_armv8_crypto_create(name, vdev, &init_params);
}
@@ -865,6 +847,7 @@ cryptodev_armv8_crypto_init(struct rte_vdev_device *vdev)
static int
cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
@@ -875,7 +858,11 @@ cryptodev_armv8_crypto_uninit(struct rte_vdev_device *vdev)
"Closing ARMv8 crypto device %s on numa socket %u\n",
name, rte_socket_id());
- return 0;
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
+
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver armv8_crypto_pmd_drv = {
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index c67548e..dd19b9b 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2016,16 +2016,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
if (ret)
return ret;
- /* free crypto device */
- rte_cryptodev_pmd_release_device(cryptodev);
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(cryptodev->data->dev_private);
-
- cryptodev->device = NULL;
- cryptodev->data = NULL;
-
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_dpaa2_driver rte_dpaa2_sec_driver = {
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 26a29a4..30a2a38 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -1529,19 +1529,7 @@ cryptodev_dpaa_sec_remove(struct rte_dpaa_device *dpaa_dev)
if (ret)
return ret;
- /* free crypto device */
- rte_cryptodev_pmd_release_device(cryptodev);
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(cryptodev->data->dev_private);
-
- PMD_INIT_LOG(INFO, "Closing dpaa crypto device %s",
- cryptodev->data->name);
-
- cryptodev->device = NULL;
- cryptodev->data = NULL;
-
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_dpaa_driver rte_dpaa_sec_driver = {
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 7a00bd3..7c1b56b 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -553,15 +552,17 @@ static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
static int
cryptodev_kasumi_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct kasumi_private *internals;
uint64_t cpu_flags = 0;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
+ if (dev == NULL) {
+ KASUMI_LOG_ERR("failed to create cryptodev vdev");
+ goto init_error;
+ }
/* Check CPU for supported vector instruction set */
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
@@ -569,14 +570,6 @@ cryptodev_kasumi_create(const char *name,
else
cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct kasumi_private), init_params->socket_id,
- vdev);
- if (dev == NULL) {
- KASUMI_LOG_ERR("failed to create cryptodev vdev");
- goto init_error;
- }
-
dev->driver_id = cryptodev_driver_id;
dev->dev_ops = rte_kasumi_pmd_ops;
@@ -605,11 +598,12 @@ cryptodev_kasumi_create(const char *name,
static int
cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct kasumi_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return cryptodev_kasumi_create(name, vdev, &init_params);
}
@@ -637,17 +621,18 @@ cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
static int
cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Closing KASUMI crypto device %s"
- " on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c
index 6a9c8da..63895c5 100644
--- a/drivers/crypto/mrvl/rte_mrvl_pmd.c
+++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c
@@ -36,7 +36,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair,
static int
cryptodev_mrvl_crypto_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct mrvl_crypto_private *internals;
struct sam_init_params sam_params;
int ret;
- if (init_params->name[0] == '\0') {
- ret = rte_cryptodev_pmd_create_dev_name(
- init_params->name, name);
-
- if (ret < 0) {
- MRVL_CRYPTO_LOG_ERR("failed to create unique name");
- return ret;
- }
- }
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct mrvl_crypto_private),
- init_params->socket_id, vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -796,40 +783,28 @@ cryptodev_mrvl_crypto_create(const char *name,
static int
cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = { };
- const char *name;
- const char *input_args;
+ struct rte_cryptodev_pmd_init_params init_params = { };
+ const char *name, *args;
int ret;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- input_args = rte_vdev_device_args(vdev);
-
- if (!input_args)
- return -EINVAL;
+ args = rte_vdev_device_args(vdev);
+ init_params.private_data_size = sizeof(struct mrvl_crypto_private);
init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM;
init_params.max_nb_sessions =
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
init_params.socket_id = rte_socket_id();
- ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
+ ret = rte_cryptodev_pmd_parse_input_args(&init_params, args);
if (ret) {
- RTE_LOG(ERR, PMD, "Failed to parse input arguments\n");
- return ret;
- }
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0') {
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
+ RTE_LOG(ERR, PMD,
+ "Failed to parse initialisation arguments[%s]\n",
+ args);
+ return -EINVAL;
}
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
return cryptodev_mrvl_crypto_create(name, vdev, &init_params);
}
@@ -843,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev)
static int
cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name = rte_vdev_device_name(vdev);
if (name == NULL)
@@ -854,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev)
sam_deinit();
- return 0;
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
+
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
/**
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index d5d2bb3..4b9a58a 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,6 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
@@ -183,28 +182,19 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
return nb_dequeued;
}
-static int cryptodev_null_remove(const char *name);
-
/** Create crypto device */
static int
cryptodev_null_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct null_crypto_private *internals;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct null_crypto_private),
- init_params->socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
- goto init_error;
+ return -EFAULT;
}
dev->driver_id = cryptodev_driver_id;
@@ -224,61 +214,53 @@ cryptodev_null_create(const char *name,
internals->max_nb_sessions = init_params->max_nb_sessions;
return 0;
-
-init_error:
- NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed",
- init_params->name);
- cryptodev_null_remove(init_params->name);
-
- return -EFAULT;
}
/** Initialise null crypto device */
static int
cryptodev_null_probe(struct rte_vdev_device *dev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct null_crypto_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
- const char *name;
+ const char *name, *args;
+ int retval;
name = rte_vdev_device_name(dev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
- name, init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ args = rte_vdev_device_args(dev);
+
+ retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
+ if (retval) {
+ RTE_LOG(ERR, PMD,
+ "Failed to parse initialisation arguments[%s]\n", args);
+ return -EINVAL;
+ }
return cryptodev_null_create(name, dev, &init_params);
}
-/** Uninitialise null crypto device */
static int
-cryptodev_null_remove(const char *name)
+cryptodev_null_remove_dev(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
+ const char *name;
+
+ name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Closing null crypto device %s on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
-}
-
-static int
-cryptodev_null_remove_dev(struct rte_vdev_device *dev)
-{
- return cryptodev_null_remove(rte_vdev_device_name(dev));
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 95c0236..25c1154 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -34,7 +34,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -1668,19 +1667,12 @@ openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
static int
cryptodev_openssl_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct openssl_private *internals;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct openssl_private),
- init_params->socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
OPENSSL_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -1718,11 +1710,12 @@ cryptodev_openssl_create(const char *name,
static int
cryptodev_openssl_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct openssl_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -1732,17 +1725,7 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return cryptodev_openssl_create(name, vdev, &init_params);
}
@@ -1751,17 +1734,18 @@ cryptodev_openssl_probe(struct rte_vdev_device *vdev)
static int
cryptodev_openssl_remove(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD,
- "Closing OPENSSL crypto device %s on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 3170f7f..40ab304 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -33,7 +33,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -45,7 +44,7 @@
uint8_t cryptodev_driver_id;
struct scheduler_init_params {
- struct rte_crypto_vdev_init_params def_p;
+ struct rte_cryptodev_pmd_init_params def_p;
uint32_t nb_slaves;
enum rte_cryptodev_scheduler_mode mode;
uint32_t enable_ordering;
@@ -107,21 +106,18 @@ cryptodev_scheduler_create(const char *name,
uint32_t i;
int ret;
- if (init_params->def_p.name[0] == '\0')
- snprintf(init_params->def_p.name,
- sizeof(init_params->def_p.name),
- "%s", name);
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->def_p.name,
- sizeof(struct scheduler_ctx),
- init_params->def_p.socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device,
+ &init_params->def_p);
if (dev == NULL) {
CS_LOG_ERR("driver %s: failed to create cryptodev vdev",
name);
return -EFAULT;
}
+ if (init_params->wcmask != 0)
+ RTE_LOG(INFO, PMD, " workers core mask = %"PRIx64"\n",
+ init_params->wcmask);
+
dev->driver_id = cryptodev_driver_id;
dev->dev_ops = rte_crypto_scheduler_pmd_ops;
@@ -240,10 +236,7 @@ cryptodev_scheduler_remove(struct rte_vdev_device *vdev)
sched_ctx->slaves[i].dev_id);
}
- RTE_LOG(INFO, PMD, "Closing Crypto Scheduler device %s on numa "
- "socket %u\n", name, rte_socket_id());
-
- return 0;
+ return rte_cryptodev_pmd_destroy(dev);
}
/** Parse integer from integer argument */
@@ -304,7 +297,7 @@ static int
parse_name_arg(const char *key __rte_unused,
const char *value, void *extra_args)
{
- struct rte_crypto_vdev_init_params *params = extra_args;
+ struct rte_cryptodev_pmd_init_params *params = extra_args;
if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
CS_LOG_ERR("Invalid name %s, should be less than "
@@ -462,10 +455,11 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
{
struct scheduler_init_params init_params = {
.def_p = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ "",
+ sizeof(struct scheduler_ctx),
rte_socket_id(),
- ""
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
},
.nb_slaves = 0,
.mode = CDEV_SCHED_MODE_NOT_SET,
@@ -481,19 +475,6 @@ cryptodev_scheduler_probe(struct rte_vdev_device *vdev)
scheduler_parse_init_params(&init_params,
rte_vdev_device_args(vdev));
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n",
- name,
- init_params.def_p.socket_id);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.def_p.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.def_p.max_nb_sessions);
- if (init_params.def_p.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.def_p.name);
- if (init_params.wcmask != 0)
- RTE_LOG(INFO, PMD, " workers core mask = %"PRIx64"\n",
- init_params.wcmask);
return cryptodev_scheduler_create(name,
vdev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index d379534..fef686f 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -37,7 +37,6 @@
#include <rte_dev.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_reorder.h>
#include "scheduler_pmd_private.h"
@@ -347,7 +346,7 @@ scheduler_pmd_info_get(struct rte_cryptodev *dev,
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
uint32_t max_nb_sessions = sched_ctx->nb_slaves ?
- UINT32_MAX : RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS;
+ UINT32_MAX : RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS;
uint32_t i;
if (!dev_info)
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 8e1d1ec..fe7bb86 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -559,19 +558,13 @@ static int cryptodev_snow3g_remove(struct rte_vdev_device *vdev);
static int
cryptodev_snow3g_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct snow3g_private *internals;
uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
-
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct snow3g_private), init_params->socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
SNOW3G_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -605,11 +598,12 @@ cryptodev_snow3g_create(const char *name,
static int
cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct snow3g_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -619,17 +613,7 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return cryptodev_snow3g_create(name, vdev, &init_params);
}
@@ -637,17 +621,18 @@ cryptodev_snow3g_probe(struct rte_vdev_device *vdev)
static int
cryptodev_snow3g_remove(struct rte_vdev_device *vdev)
{
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Closing SNOW 3G crypto device %s"
- " on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index f1f9291..b99f6ec 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -35,7 +35,6 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_cryptodev_vdev.h>
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -463,19 +462,14 @@ static int cryptodev_zuc_remove(struct rte_vdev_device *vdev);
static int
cryptodev_zuc_create(const char *name,
struct rte_vdev_device *vdev,
- struct rte_crypto_vdev_init_params *init_params)
+ struct rte_cryptodev_pmd_init_params *init_params)
{
struct rte_cryptodev *dev;
struct zuc_private *internals;
uint64_t cpu_flags = RTE_CRYPTODEV_FF_CPU_SSE;
- if (init_params->name[0] == '\0')
- snprintf(init_params->name, sizeof(init_params->name),
- "%s", name);
- dev = rte_cryptodev_vdev_pmd_init(init_params->name,
- sizeof(struct zuc_private), init_params->socket_id,
- vdev);
+ dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
ZUC_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -509,11 +503,12 @@ cryptodev_zuc_create(const char *name,
static int
cryptodev_zuc_probe(struct rte_vdev_device *vdev)
{
- struct rte_crypto_vdev_init_params init_params = {
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
- RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+ struct rte_cryptodev_pmd_init_params init_params = {
+ "",
+ sizeof(struct zuc_private),
rte_socket_id(),
- {0}
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS,
+ RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS
};
const char *name;
const char *input_args;
@@ -523,17 +518,7 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
return -EINVAL;
input_args = rte_vdev_device_args(vdev);
- rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
-
- RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
- init_params.socket_id);
- if (init_params.name[0] != '\0')
- RTE_LOG(INFO, PMD, " User defined name = %s\n",
- init_params.name);
- RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
- init_params.max_nb_queue_pairs);
- RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
- init_params.max_nb_sessions);
+ rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
return cryptodev_zuc_create(name, vdev, &init_params);
}
@@ -541,17 +526,19 @@ cryptodev_zuc_probe(struct rte_vdev_device *vdev)
static int
cryptodev_zuc_remove(struct rte_vdev_device *vdev)
{
+
+ struct rte_cryptodev *cryptodev;
const char *name;
name = rte_vdev_device_name(vdev);
if (name == NULL)
return -EINVAL;
- RTE_LOG(INFO, PMD, "Closing ZUC crypto device %s"
- " on numa socket %u\n",
- name, rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_get_named_dev(name);
+ if (cryptodev == NULL)
+ return -ENODEV;
- return 0;
+ return rte_cryptodev_pmd_destroy(cryptodev);
}
static struct rte_vdev_driver cryptodev_zuc_pmd_drv = {
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index bb58ea1..0e019ed 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -50,7 +50,6 @@ SYMLINK-y-include += rte_crypto.h
SYMLINK-y-include += rte_crypto_sym.h
SYMLINK-y-include += rte_cryptodev.h
SYMLINK-y-include += rte_cryptodev_pmd.h
-SYMLINK-y-include += rte_cryptodev_vdev.h
SYMLINK-y-include += rte_cryptodev_pci.h
# versioning export map
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index ca6d459..0b5741a 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -32,7 +32,6 @@
#include <rte_malloc.h>
-#include "rte_cryptodev_vdev.h"
#include "rte_cryptodev_pci.h"
#include "rte_cryptodev_pmd.h"
@@ -204,125 +203,6 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
return 0;
}
-/**
- * Parse name from argument
- */
-static int
-rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- struct rte_crypto_vdev_init_params *params = extra_args;
-
- if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
- CDEV_LOG_ERR("Invalid name %s, should be less than "
- "%u bytes", value,
- RTE_CRYPTODEV_NAME_MAX_LEN - 1);
- return -1;
- }
-
- strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
-
- return 0;
-}
-
-/**
- * Parse integer from argument
- */
-static int
-rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
- const char *value, void *extra_args)
-{
- int *i = extra_args;
-
- *i = atoi(value);
- if (*i < 0) {
- CDEV_LOG_ERR("Argument has to be positive.");
- return -1;
- }
-
- return 0;
-}
-
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev)
-{
- struct rte_cryptodev *cryptodev;
-
- /* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
- if (cryptodev == NULL)
- return NULL;
-
- /* allocate private device structure */
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- cryptodev->data->dev_private =
- rte_zmalloc_socket("cryptodev device private",
- dev_private_size,
- RTE_CACHE_LINE_SIZE,
- socket_id);
-
- if (cryptodev->data->dev_private == NULL)
- rte_panic("Cannot allocate memzone for private device"
- " data");
- }
-
- cryptodev->device = &vdev->device;
-
- /* initialise user call-back tail queue */
- TAILQ_INIT(&(cryptodev->link_intr_cbs));
-
- return cryptodev;
-}
-
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
- const char *input_args)
-{
- struct rte_kvargs *kvlist = NULL;
- int ret = 0;
-
- if (params == NULL)
- return -EINVAL;
-
- if (input_args) {
- kvlist = rte_kvargs_parse(input_args,
- cryptodev_vdev_valid_params);
- if (kvlist == NULL)
- return -1;
-
- ret = rte_kvargs_process(kvlist,
- RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
- &rte_cryptodev_vdev_parse_integer_arg,
- ¶ms->max_nb_queue_pairs);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist,
- RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
- &rte_cryptodev_vdev_parse_integer_arg,
- ¶ms->max_nb_sessions);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
- &rte_cryptodev_vdev_parse_integer_arg,
- ¶ms->socket_id);
- if (ret < 0)
- goto free_kvlist;
-
- ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
- &rte_cryptodev_vdev_parse_name_arg,
- params);
- if (ret < 0)
- goto free_kvlist;
- }
-
-free_kvlist:
- rte_kvargs_free(kvlist);
- return ret;
-}
-
int
rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
size_t private_data_size,
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
deleted file mode 100644
index 94ab9d3..0000000
--- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2017 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_CRYPTODEV_VDEV_H_
-#define _RTE_CRYPTODEV_VDEV_H_
-
-#include <rte_vdev.h>
-#include <inttypes.h>
-
-#include "rte_cryptodev.h"
-
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS 8
-#define RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS 2048
-
-#define RTE_CRYPTODEV_VDEV_NAME ("name")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG ("max_nb_queue_pairs")
-#define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG ("max_nb_sessions")
-#define RTE_CRYPTODEV_VDEV_SOCKET_ID ("socket_id")
-
-static const char * const cryptodev_vdev_valid_params[] = {
- RTE_CRYPTODEV_VDEV_NAME,
- RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
- RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
- RTE_CRYPTODEV_VDEV_SOCKET_ID
-};
-
-/**
- * @internal
- * Initialisation parameters for virtual crypto devices
- */
-struct rte_crypto_vdev_init_params {
- unsigned int max_nb_queue_pairs;
- unsigned int max_nb_sessions;
- uint8_t socket_id;
- char name[RTE_CRYPTODEV_NAME_MAX_LEN];
-};
-
-/**
- * @internal
- * Creates a new virtual crypto device and returns the pointer
- * to that device.
- *
- * @param name PMD type name
- * @param dev_private_size Size of crypto PMDs private data
- * @param socket_id Socket to allocate resources on.
- * @param vdev Pointer to virtual device structure.
- *
- * @return
- * - Cryptodev pointer if device is successfully created.
- * - NULL if device cannot be created.
- */
-struct rte_cryptodev *
-rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev);
-
-/**
- * @internal
- * Parse virtual device initialisation parameters input arguments
- *
- * @params params Initialisation parameters with defaults set.
- * @params input_args Command line arguments
- *
- * @return
- * 0 on successful parse
- * <0 on failure to parse
- */
-int
-rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
- const char *input_args);
-
-#endif /* _RTE_CRYPTODEV_VDEV_H_ */
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a0ea7bf..d3e4515 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -73,8 +73,6 @@ DPDK_17.08 {
rte_cryptodev_sym_capability_check_aead;
rte_cryptodev_sym_session_init;
rte_cryptodev_sym_session_clear;
- rte_cryptodev_vdev_parse_init_params;
- rte_cryptodev_vdev_pmd_init;
rte_crypto_aead_algorithm_strings;
rte_crypto_aead_operation_strings;
--
2.9.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation
@ 2017-10-25 12:00 3% ` Declan Doherty
2017-10-25 12:00 1% ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
2 siblings, 0 replies; 200+ results
From: Declan Doherty @ 2017-10-25 12:00 UTC (permalink / raw)
To: dev; +Cc: Declan Doherty
Adds new PMD assist functions which are bus independent for driver to
create and destroy new device instances.
Also includes function to parse parameters which can be passed to
driver on device initialisation.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 6 +
lib/librte_cryptodev/rte_cryptodev.h | 8 +-
lib/librte_cryptodev/rte_cryptodev_pmd.c | 168 +++++++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_pmd.h | 86 +++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 3 +
5 files changed, 267 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index e4e98f7..0a90db4 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -291,6 +291,12 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* **Add bus agnostic functions to crytpodev for PMD initialisation**
+
+ Adds new PMD assist functions ``rte_cryptodev_pmd_parse_input_args()``,
+ ``rte_cryptodev_pmd_create()`` and ``rte_cryptodev_pmd_destroy()`` which
+ are bus independent for driver to manage creation and destruction of new
+ device instances.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index fd0e3f1..e054c50 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -60,10 +60,10 @@ extern const char **rte_cyptodev_names;
RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
-#define CDEV_PMD_LOG_ERR(dev, ...) \
- RTE_LOG(ERR, CRYPTODEV, \
- RTE_FMT("[%s] %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
- dev, __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+#define CDEV_LOG_INFO(...) \
+ RTE_LOG(INFO, CRYPTODEV, \
+ RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+ RTE_FMT_TAIL(__VA_ARGS__,)))
#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
#define CDEV_LOG_DEBUG(...) \
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index a57faad..ca6d459 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -40,6 +40,174 @@
* Parse name from argument
*/
static int
+rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
+ const char *value, void *extra_args)
+{
+ struct rte_cryptodev_pmd_init_params *params = extra_args;
+ int n;
+
+ n = snprintf(params->name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s",value);
+ if (n >= RTE_CRYPTODEV_NAME_MAX_LEN)
+ return -EINVAL;
+
+ return 0;
+}
+
+/**
+ * Parse unsigned integer from argument
+ */
+static int
+rte_cryptodev_pmd_parse_uint_arg(const char *key __rte_unused,
+ const char *value, void *extra_args)
+{
+ int i;
+ char *end;
+ errno = 0;
+
+ i = strtol(value, &end, 10);
+ if (*end != 0 || errno != 0 || i < 0)
+ return -EINVAL;
+
+ *((uint32_t *)extra_args) = i;
+ return 0;
+}
+
+int
+rte_cryptodev_pmd_parse_input_args(
+ struct rte_cryptodev_pmd_init_params *params,
+ const char *args)
+{
+ struct rte_kvargs *kvlist = NULL;
+ int ret = 0;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (args) {
+ kvlist = rte_kvargs_parse(args, cryptodev_pmd_valid_params);
+ if (kvlist == NULL)
+ return -EINVAL;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+ &rte_cryptodev_pmd_parse_uint_arg,
+ ¶ms->max_nb_queue_pairs);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+ &rte_cryptodev_pmd_parse_uint_arg,
+ ¶ms->max_nb_sessions);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
+ &rte_cryptodev_pmd_parse_uint_arg,
+ ¶ms->socket_id);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_PMD_NAME_ARG,
+ &rte_cryptodev_pmd_parse_name_arg,
+ params);
+ if (ret < 0)
+ goto free_kvlist;
+ }
+
+free_kvlist:
+ rte_kvargs_free(kvlist);
+ return ret;
+}
+
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+ struct rte_device *device,
+ struct rte_cryptodev_pmd_init_params *params)
+{
+ struct rte_cryptodev *cryptodev;
+
+ if (params->name[0] != '\0') {
+ CDEV_LOG_INFO("[%s] User specified device name = %s\n",
+ device->driver->name, params->name);
+ name = params->name;
+ }
+
+ CDEV_LOG_INFO("[%s] - Creating cryptodev %s\n",
+ device->driver->name, name);
+
+ CDEV_LOG_INFO("[%s] - Initialisation parameters - name: %s,"
+ "socket id: %d, max queue pairs: %u, max sessions: %u",
+ device->driver->name, name,
+ params->socket_id, params->max_nb_queue_pairs,
+ params->max_nb_sessions);
+
+ /* allocate device structure */
+ cryptodev = rte_cryptodev_pmd_allocate(name, params->socket_id);
+ if (cryptodev == NULL) {
+ CDEV_LOG_ERR("[%s] Failed to allocate crypto device for %s",
+ device->driver->name, name);
+ return NULL;
+ }
+
+ /* allocate private device structure */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ cryptodev->data->dev_private =
+ rte_zmalloc_socket("cryptodev device private",
+ params->private_data_size,
+ RTE_CACHE_LINE_SIZE,
+ params->socket_id);
+
+ if (cryptodev->data->dev_private == NULL) {
+ CDEV_LOG_ERR("[%s] Cannot allocate memory for "
+ "cryptodev %s private data",
+ device->driver->name, name);
+
+ rte_cryptodev_pmd_release_device(cryptodev);
+ return NULL;
+ }
+ }
+
+ cryptodev->device = device;
+
+ /* initialise user call-back tail queue */
+ TAILQ_INIT(&(cryptodev->link_intr_cbs));
+
+ return cryptodev;
+}
+
+
+
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
+{
+ int retval;
+
+ CDEV_LOG_INFO("[%s] Closing crypto device %s",
+ cryptodev->device->driver->name,
+ cryptodev->device->name);
+
+ /* free crypto device */
+ retval = rte_cryptodev_pmd_release_device(cryptodev);
+ if (retval)
+ return retval;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+ rte_free(cryptodev->data->dev_private);
+
+
+ cryptodev->device = NULL;
+ cryptodev->data = NULL;
+
+ return 0;
+}
+
+/**
+ * Parse name from argument
+ */
+static int
rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
const char *value, void *extra_args)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index ba074e1..744405e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -56,6 +56,35 @@ extern "C" {
#include "rte_crypto.h"
#include "rte_cryptodev.h"
+
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS 8
+#define RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS 2048
+
+#define RTE_CRYPTODEV_PMD_NAME_ARG ("name")
+#define RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG ("max_nb_queue_pairs")
+#define RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG ("max_nb_sessions")
+#define RTE_CRYPTODEV_PMD_SOCKET_ID_ARG ("socket_id")
+
+
+static const char * const cryptodev_pmd_valid_params[] = {
+ RTE_CRYPTODEV_PMD_NAME_ARG,
+ RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
+ RTE_CRYPTODEV_PMD_MAX_NB_SESS_ARG,
+ RTE_CRYPTODEV_PMD_SOCKET_ID_ARG
+};
+
+/**
+ * @internal
+ * Initialisation parameters for crypto devices
+ */
+struct rte_cryptodev_pmd_init_params {
+ char name[RTE_CRYPTODEV_NAME_MAX_LEN];
+ size_t private_data_size;
+ int socket_id;
+ unsigned int max_nb_queue_pairs;
+ unsigned int max_nb_sessions;
+};
+
/** Global structure used for maintaining state of allocated crypto devices */
struct rte_cryptodev_global {
struct rte_cryptodev *devs; /**< Device information array */
@@ -392,6 +421,63 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
+
+/**
+ * @internal
+ *
+ * PMD assist function to parse initialisation arguments for crypto driver
+ * when creating a new crypto PMD device instance.
+ *
+ * PMD driver should set default values for that PMD before calling function,
+ * these default values will be over-written with successfully parsed values
+ * from args string.
+ *
+ * @param params parsed PMD initialisation parameters
+ * @param args input argument string to parse
+ *
+ * @return
+ * - 0 on success
+ * - errno on failure
+ */
+int
+rte_cryptodev_pmd_parse_input_args(
+ struct rte_cryptodev_pmd_init_params *params,
+ const char *args);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to create
+ * and allocate resources for a new crypto PMD device instance.
+ *
+ * @param name crypto device name.
+ * @param device base device instance
+ * @param params PMD initialisation parameters
+ *
+ * @return
+ * - crypto device instance on success
+ * - NULL on creation failure
+ */
+struct rte_cryptodev *
+rte_cryptodev_pmd_create(const char *name,
+ struct rte_device *device,
+ struct rte_cryptodev_pmd_init_params *params);
+
+/**
+ * @internal
+ *
+ * PMD assist function to provide boiler plate code for crypto driver to
+ * destroy and free resources associated with a crypto PMD device instance.
+ *
+ * @param cryptodev crypto device handle.
+ *
+ * @return
+ * - 0 on success
+ * - errno on failure
+ */
+int
+rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
+
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 919b6cc..a0ea7bf 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -84,5 +84,8 @@ DPDK_17.11 {
global:
rte_cryptodev_name_get;
+ rte_cryptodev_pmd_create;
+ rte_cryptodev_pmd_destroy;
+ rte_cryptodev_pmd_parse_input_args;
} DPDK_17.08;
--
2.9.4
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-25 10:12 0% ` Thomas Monjalon
@ 2017-10-25 10:32 0% ` Bruce Richardson
0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2017-10-25 10:32 UTC (permalink / raw)
To: Thomas Monjalon
Cc: santosh, dev, olivier.matz, jerin.jacob, hemant.agrawal, Burakov,
Anatoly
On Wed, Oct 25, 2017 at 12:12:57PM +0200, Thomas Monjalon wrote:
> 25/10/2017 12:05, Bruce Richardson:
> > On Wed, Oct 25, 2017 at 12:01:26PM +0200, Thomas Monjalon wrote:
> > > 25/10/2017 11:50, Richardson, Bruce:
> > > > From: Thomas Monjalon
> > > > > > On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > > > > > > 20/10/2017 14:31, Santosh Shukla:
> > > > > > >> Removed dpdk iova aware ABI deprecation notice, and updated ABI
> > > > > > >> change details in release_17.11.rst.
> > > > > > >>
> > > > > > >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> > > > > > >> Acked-by: John McNamara <john.mcnamara@intel.com>
> > > > > > >> ---
> > > > > > >> --- a/doc/guides/rel_notes/deprecation.rst
> > > > > > >> +++ b/doc/guides/rel_notes/deprecation.rst
> > > > > > >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of
> > > > > > >> IOVA address
> > > > > > >> - translation scheme.
> > > > > > >> - Reference to phys address in EAL data-structure or functions may
> > > > > > >> change to
> > > > > > >> - IOVA address or more appropriate name.
> > > > > > >> - The change will be only for the name.
> > > > > > >> - Functional aspects of the API or data-structure will remain same.
> > > > > > > Sorry, this series cannot be applied as is because it is breaking
> > > > > > > more than EAL API. The API of mbuf and mempool are also changed.
> > > > > > > We need to choose one of these three options:
> > > > > > > 1/ accept to break all API in 17.11
> > > > > > > 2/ postpone the whole series to 18.02
> > > > > >
> > > > > > Theme of series is to make dpdk iova aware so I would prefer option 1)
> > > > > or 2).
> > > > > > However I have no strong opinion on this topic.
> > > > > > Lets get more opinion from others about option 1/2/3.
> > > > > >
> > > > > > > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
> > > > >
> > > > > After discussing with Olivier it appeared there is a fourth solution.
> > > > > We should not break any API (EAL, mbuf, mempool).
> > > > >
> > > > > I would like to merge these changes in RC2, but keeping compatibility with
> > > > > old names:
> > > > > - When you rename a function or a type, you can define a macro for the old
> > > > > name, alias the new name.
> > > >
> > > > Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
> > >
> > > True
> > > We can use an inline function to avoid ABI breakage.
> >
> > Nope, inline function won't work either, since that ends up the same as
> > the macro and compiled into the end app, not the library ABI. You
> > need a public non-inline wrapper function to keep ABI, or else function
> > renaming via symbol versioning/mapping.
>
> Ah ah ah, I'm writing before thinking :)
> Yes, the function must not be inlined.
>
> And generally speaking it is not an issue,
> even for performance critical functions.
> Adding one more function call in the path is not a bad thing
> for deprecated functions.
> I've seen another project (don't remember which one) adding a
> sleep() in deprecated functions and increasing the sleep time
> at each new release :)
Genius!!
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-25 10:05 4% ` Bruce Richardson
@ 2017-10-25 10:12 0% ` Thomas Monjalon
2017-10-25 10:32 0% ` Bruce Richardson
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-25 10:12 UTC (permalink / raw)
To: Bruce Richardson
Cc: santosh, dev, olivier.matz, jerin.jacob, hemant.agrawal, Burakov,
Anatoly
25/10/2017 12:05, Bruce Richardson:
> On Wed, Oct 25, 2017 at 12:01:26PM +0200, Thomas Monjalon wrote:
> > 25/10/2017 11:50, Richardson, Bruce:
> > > From: Thomas Monjalon
> > > > > On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > > > > > 20/10/2017 14:31, Santosh Shukla:
> > > > > >> Removed dpdk iova aware ABI deprecation notice, and updated ABI
> > > > > >> change details in release_17.11.rst.
> > > > > >>
> > > > > >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> > > > > >> Acked-by: John McNamara <john.mcnamara@intel.com>
> > > > > >> ---
> > > > > >> --- a/doc/guides/rel_notes/deprecation.rst
> > > > > >> +++ b/doc/guides/rel_notes/deprecation.rst
> > > > > >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of
> > > > > >> IOVA address
> > > > > >> - translation scheme.
> > > > > >> - Reference to phys address in EAL data-structure or functions may
> > > > > >> change to
> > > > > >> - IOVA address or more appropriate name.
> > > > > >> - The change will be only for the name.
> > > > > >> - Functional aspects of the API or data-structure will remain same.
> > > > > > Sorry, this series cannot be applied as is because it is breaking
> > > > > > more than EAL API. The API of mbuf and mempool are also changed.
> > > > > > We need to choose one of these three options:
> > > > > > 1/ accept to break all API in 17.11
> > > > > > 2/ postpone the whole series to 18.02
> > > > >
> > > > > Theme of series is to make dpdk iova aware so I would prefer option 1)
> > > > or 2).
> > > > > However I have no strong opinion on this topic.
> > > > > Lets get more opinion from others about option 1/2/3.
> > > > >
> > > > > > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
> > > >
> > > > After discussing with Olivier it appeared there is a fourth solution.
> > > > We should not break any API (EAL, mbuf, mempool).
> > > >
> > > > I would like to merge these changes in RC2, but keeping compatibility with
> > > > old names:
> > > > - When you rename a function or a type, you can define a macro for the old
> > > > name, alias the new name.
> > >
> > > Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
> >
> > True
> > We can use an inline function to avoid ABI breakage.
>
> Nope, inline function won't work either, since that ends up the same as
> the macro and compiled into the end app, not the library ABI. You
> need a public non-inline wrapper function to keep ABI, or else function
> renaming via symbol versioning/mapping.
Ah ah ah, I'm writing before thinking :)
Yes, the function must not be inlined.
And generally speaking it is not an issue,
even for performance critical functions.
Adding one more function call in the path is not a bad thing
for deprecated functions.
I've seen another project (don't remember which one) adding a
sleep() in deprecated functions and increasing the sleep time
at each new release :)
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-25 10:01 3% ` Thomas Monjalon
@ 2017-10-25 10:05 4% ` Bruce Richardson
2017-10-25 10:12 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Bruce Richardson @ 2017-10-25 10:05 UTC (permalink / raw)
To: Thomas Monjalon
Cc: santosh, dev, olivier.matz, jerin.jacob, hemant.agrawal, Burakov,
Anatoly
On Wed, Oct 25, 2017 at 12:01:26PM +0200, Thomas Monjalon wrote:
> 25/10/2017 11:50, Richardson, Bruce:
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> > > Sent: Wednesday, October 25, 2017 10:46 AM
> > > To: santosh <santosh.shukla@caviumnetworks.com>
> > > Cc: dev@dpdk.org; olivier.matz@6wind.com; jerin.jacob@caviumnetworks.com;
> > > hemant.agrawal@nxp.com; Burakov, Anatoly <anatoly.burakov@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
> > >
> > > Hi Santosh,
> > >
> > > 24/10/2017 07:06, santosh:
> > > > Hi Thomas,
> > > >
> > > >
> > > > On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > > > > 20/10/2017 14:31, Santosh Shukla:
> > > > >> Removed dpdk iova aware ABI deprecation notice, and updated ABI
> > > > >> change details in release_17.11.rst.
> > > > >>
> > > > >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> > > > >> Acked-by: John McNamara <john.mcnamara@intel.com>
> > > > >> ---
> > > > >> --- a/doc/guides/rel_notes/deprecation.rst
> > > > >> +++ b/doc/guides/rel_notes/deprecation.rst
> > > > >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of
> > > > >> IOVA address
> > > > >> - translation scheme.
> > > > >> - Reference to phys address in EAL data-structure or functions may
> > > > >> change to
> > > > >> - IOVA address or more appropriate name.
> > > > >> - The change will be only for the name.
> > > > >> - Functional aspects of the API or data-structure will remain same.
> > > > > Sorry, this series cannot be applied as is because it is breaking
> > > > > more than EAL API. The API of mbuf and mempool are also changed.
> > > > > We need to choose one of these three options:
> > > > > 1/ accept to break all API in 17.11
> > > > > 2/ postpone the whole series to 18.02
> > > >
> > > > Theme of series is to make dpdk iova aware so I would prefer option 1)
> > > or 2).
> > > > However I have no strong opinion on this topic.
> > > > Lets get more opinion from others about option 1/2/3.
> > > >
> > > > > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
> > >
> > > After discussing with Olivier it appeared there is a fourth solution.
> > > We should not break any API (EAL, mbuf, mempool).
> > >
> > > I would like to merge these changes in RC2, but keeping compatibility with
> > > old names:
> > > - When you rename a function or a type, you can define a macro for the old
> > > name, alias the new name.
> >
> > Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
>
> True
> We can use an inline function to avoid ABI breakage.
Nope, inline function won't work either, since that ends up the same as
the macro and compiled into the end app, not the library ABI. You
need a public non-inline wrapper function to keep ABI, or else function
renaming via symbol versioning/mapping.
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-25 9:50 3% ` Richardson, Bruce
@ 2017-10-25 10:01 3% ` Thomas Monjalon
2017-10-25 10:05 4% ` Bruce Richardson
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-25 10:01 UTC (permalink / raw)
To: Richardson, Bruce
Cc: santosh, dev, olivier.matz, jerin.jacob, hemant.agrawal, Burakov,
Anatoly
25/10/2017 11:50, Richardson, Bruce:
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> > Sent: Wednesday, October 25, 2017 10:46 AM
> > To: santosh <santosh.shukla@caviumnetworks.com>
> > Cc: dev@dpdk.org; olivier.matz@6wind.com; jerin.jacob@caviumnetworks.com;
> > hemant.agrawal@nxp.com; Burakov, Anatoly <anatoly.burakov@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
> >
> > Hi Santosh,
> >
> > 24/10/2017 07:06, santosh:
> > > Hi Thomas,
> > >
> > >
> > > On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > > > 20/10/2017 14:31, Santosh Shukla:
> > > >> Removed dpdk iova aware ABI deprecation notice, and updated ABI
> > > >> change details in release_17.11.rst.
> > > >>
> > > >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> > > >> Acked-by: John McNamara <john.mcnamara@intel.com>
> > > >> ---
> > > >> --- a/doc/guides/rel_notes/deprecation.rst
> > > >> +++ b/doc/guides/rel_notes/deprecation.rst
> > > >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of
> > > >> IOVA address
> > > >> - translation scheme.
> > > >> - Reference to phys address in EAL data-structure or functions may
> > > >> change to
> > > >> - IOVA address or more appropriate name.
> > > >> - The change will be only for the name.
> > > >> - Functional aspects of the API or data-structure will remain same.
> > > > Sorry, this series cannot be applied as is because it is breaking
> > > > more than EAL API. The API of mbuf and mempool are also changed.
> > > > We need to choose one of these three options:
> > > > 1/ accept to break all API in 17.11
> > > > 2/ postpone the whole series to 18.02
> > >
> > > Theme of series is to make dpdk iova aware so I would prefer option 1)
> > or 2).
> > > However I have no strong opinion on this topic.
> > > Lets get more opinion from others about option 1/2/3.
> > >
> > > > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
> >
> > After discussing with Olivier it appeared there is a fourth solution.
> > We should not break any API (EAL, mbuf, mempool).
> >
> > I would like to merge these changes in RC2, but keeping compatibility with
> > old names:
> > - When you rename a function or a type, you can define a macro for the old
> > name, alias the new name.
>
> Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
True
We can use an inline function to avoid ABI breakage.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-25 9:45 0% ` Thomas Monjalon
@ 2017-10-25 9:50 3% ` Richardson, Bruce
2017-10-25 10:01 3% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Richardson, Bruce @ 2017-10-25 9:50 UTC (permalink / raw)
To: Thomas Monjalon, santosh
Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, Burakov, Anatoly
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Wednesday, October 25, 2017 10:46 AM
> To: santosh <santosh.shukla@caviumnetworks.com>
> Cc: dev@dpdk.org; olivier.matz@6wind.com; jerin.jacob@caviumnetworks.com;
> hemant.agrawal@nxp.com; Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
>
> Hi Santosh,
>
> 24/10/2017 07:06, santosh:
> > Hi Thomas,
> >
> >
> > On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > > 20/10/2017 14:31, Santosh Shukla:
> > >> Removed dpdk iova aware ABI deprecation notice, and updated ABI
> > >> change details in release_17.11.rst.
> > >>
> > >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> > >> Acked-by: John McNamara <john.mcnamara@intel.com>
> > >> ---
> > >> --- a/doc/guides/rel_notes/deprecation.rst
> > >> +++ b/doc/guides/rel_notes/deprecation.rst
> > >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of
> > >> IOVA address
> > >> - translation scheme.
> > >> - Reference to phys address in EAL data-structure or functions may
> > >> change to
> > >> - IOVA address or more appropriate name.
> > >> - The change will be only for the name.
> > >> - Functional aspects of the API or data-structure will remain same.
> > > Sorry, this series cannot be applied as is because it is breaking
> > > more than EAL API. The API of mbuf and mempool are also changed.
> > > We need to choose one of these three options:
> > > 1/ accept to break all API in 17.11
> > > 2/ postpone the whole series to 18.02
> >
> > Theme of series is to make dpdk iova aware so I would prefer option 1)
> or 2).
> > However I have no strong opinion on this topic.
> > Lets get more opinion from others about option 1/2/3.
> >
> > > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
>
> After discussing with Olivier it appeared there is a fourth solution.
> We should not break any API (EAL, mbuf, mempool).
>
> I would like to merge these changes in RC2, but keeping compatibility with
> old names:
> - When you rename a function or a type, you can define a macro for the old
> name, alias the new name.
Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-24 5:06 0% ` santosh
@ 2017-10-25 9:45 0% ` Thomas Monjalon
2017-10-25 9:50 3% ` Richardson, Bruce
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-25 9:45 UTC (permalink / raw)
To: santosh; +Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
Hi Santosh,
24/10/2017 07:06, santosh:
> Hi Thomas,
>
>
> On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> > 20/10/2017 14:31, Santosh Shukla:
> >> Removed dpdk iova aware ABI deprecation notice,
> >> and updated ABI change details in release_17.11.rst.
> >>
> >> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> >> Acked-by: John McNamara <john.mcnamara@intel.com>
> >> ---
> >> --- a/doc/guides/rel_notes/deprecation.rst
> >> +++ b/doc/guides/rel_notes/deprecation.rst
> >> -* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
> >> - translation scheme.
> >> - Reference to phys address in EAL data-structure or functions may change to
> >> - IOVA address or more appropriate name.
> >> - The change will be only for the name.
> >> - Functional aspects of the API or data-structure will remain same.
> > Sorry, this series cannot be applied as is because it is breaking
> > more than EAL API. The API of mbuf and mempool are also changed.
> > We need to choose one of these three options:
> > 1/ accept to break all API in 17.11
> > 2/ postpone the whole series to 18.02
>
> Theme of series is to make dpdk iova aware so I would prefer option 1) or 2).
> However I have no strong opinion on this topic.
> Lets get more opinion from others about option 1/2/3.
>
> > 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
After discussing with Olivier it appeared there is a fourth solution.
We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility
with old names:
- When you rename a function or a type, you can define a macro for the
old name, alias the new name.
- When you rename a struct field, you can make an anonymous union
to allow both names.
Then we can deprecate the old names and remove them later.
Are you able to do these small changes today please?
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v5] ethdev: allow returning error on VLAN offload ops
@ 2017-10-25 3:01 4% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2017-10-25 3:01 UTC (permalink / raw)
To: John McNamara, Allain Legacy, Matt Peters, Stephen Hurd,
Ajit Khaparde, Hemant Agrawal, Shreyansh Jain, Wenzhuo Lu,
John Daley, Nelson Escobar, Jing Chen, Jingjing Wu, Beilei Xing,
Konstantin Ananyev, Adrien Mazarguil, Nelio Laranjeiro,
Yongseok Koh, Alejandro Lucero, Rasesh Mody, Harish Patil,
Shahed Shaikh, Yuanhan Liu, Maxime Coquelin, Shrikrishna Khare,
Thomas Monjalon
Cc: dev, Ferruh Yigit, David Harton
From: David Harton <dharton@cisco.com>
Some devices may not support or fail setting VLAN offload
configuration based on dynamic circumstances so the
vlan_offload_set_t vector is modified to return an int so
the caller can determine success or not.
rte_eth_dev_set_vlan_offload is updated to return the
value provided by the vector when called along with restoring
the original offload configs on failure.
Existing vlan_offload_set_t vectors are modified to return
an int. Majority of cases return 0 but a few that actually
can fail now return their failure codes.
Finally, a vlan_offload_set_t vector is added to virtio
to facilitate dynamically turning VLAN strip on or off.
Signed-off-by: David Harton <dharton@cisco.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v5
* rebase on latest next-net
* add ETH_VLAN_FILTER_MASK mask check to virtio
v4
* Modified commit message heading
* Moved rel_note comments from ABI to API section
* Renamed locals of rte_eth_dev_set_vlan_offload from 'org*' to 'orig*'
v3
* Fixed a format error.
* Apologies...need to figure out why checkpatches.pl keeps saying
valid patch when I've got soft tabs.
v2
* Fixed a missed format error.
* Removed vlan offload vector call casts and replaced with checks
for return values.
v1
* This is an ABI breakage that has been previously negotiated
with Thomas and the proposed rel note change is included as well.
---
doc/guides/rel_notes/release_17_11.rst | 7 +++++++
drivers/net/avp/avp_ethdev.c | 13 ++++++++++---
drivers/net/bnxt/bnxt_ethdev.c | 10 +++++++---
drivers/net/dpaa2/dpaa2_ethdev.c | 15 ++++++++++++---
drivers/net/e1000/em_ethdev.c | 13 ++++++++++---
drivers/net/e1000/igb_ethdev.c | 13 ++++++++++---
drivers/net/enic/enic_ethdev.c | 9 ++++++---
drivers/net/fm10k/fm10k_ethdev.c | 4 +++-
drivers/net/i40e/i40e_ethdev.c | 12 +++++++++---
drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
drivers/net/ixgbe/ixgbe_ethdev.c | 27 ++++++++++++++++++++-------
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_vlan.c | 6 ++++--
drivers/net/nfp/nfp_net.c | 12 +++++++-----
drivers/net/qede/qede_ethdev.c | 9 +++++++--
drivers/net/virtio/virtio_ethdev.c | 25 +++++++++++++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.c | 12 ++++++++----
lib/librte_ether/rte_ethdev.c | 12 +++++++++++-
lib/librte_ether/rte_ethdev.h | 2 +-
19 files changed, 163 insertions(+), 50 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index e505a4dcd..65ab4b767 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -322,6 +322,13 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* **Modified the vlan_offload_set_t function prototype in the ethdev library.**
+
+ Changed the function prototype of ``vlan_offload_set_t``. The return value
+ has been changed from ``void`` to ``int`` so the caller to knows whether
+ the backing device supports the operation or if the operation was
+ successfully performed.
+
ABI Changes
-----------
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index b97a90cea..7853fbf15 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -70,7 +70,7 @@ static void avp_dev_stop(struct rte_eth_dev *dev);
static void avp_dev_close(struct rte_eth_dev *dev);
static void avp_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
-static void avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -2031,7 +2031,12 @@ avp_dev_configure(struct rte_eth_dev *eth_dev)
mask = (ETH_VLAN_STRIP_MASK |
ETH_VLAN_FILTER_MASK |
ETH_VLAN_EXTEND_MASK);
- avp_vlan_offload_set(eth_dev, mask);
+ ret = avp_vlan_offload_set(eth_dev, mask);
+ if (ret < 0) {
+ PMD_DRV_LOG(ERR, "VLAN offload set failed by host, ret=%d\n",
+ ret);
+ goto unlock;
+ }
/* update device config */
memset(&config, 0, sizeof(config));
@@ -2214,7 +2219,7 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
}
}
-static void
+static int
avp_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2239,6 +2244,8 @@ avp_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
if (eth_dev->data->dev_conf.rxmode.hw_vlan_extend)
PMD_DRV_LOG(ERR, "VLAN extend offload not supported\n");
}
+
+ return 0;
}
static int
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c2d54efd8..ad50045ac 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -145,7 +145,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
ETH_RSS_NONFRAG_IPV6_TCP | \
ETH_RSS_NONFRAG_IPV6_UDP)
-static void bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
+static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
/***********************/
@@ -591,7 +591,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
vlan_mask |= ETH_VLAN_FILTER_MASK;
if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
vlan_mask |= ETH_VLAN_STRIP_MASK;
- bnxt_vlan_offload_set_op(eth_dev, vlan_mask);
+ rc = bnxt_vlan_offload_set_op(eth_dev, vlan_mask);
+ if (rc)
+ goto error;
return 0;
@@ -1350,7 +1352,7 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
return bnxt_del_vlan_filter(bp, vlan_id);
}
-static void
+static int
bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
{
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
@@ -1382,6 +1384,8 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
if (mask & ETH_VLAN_EXTEND_MASK)
RTE_LOG(ERR, PMD, "Extend VLAN Not supported\n");
+
+ return 0;
}
static void
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 1ac607cb0..881a209d8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -162,7 +162,7 @@ dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
return ret;
}
-static void
+static int
dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
@@ -188,6 +188,8 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
RTE_LOG(INFO, PMD,
"VLAN extend offload not supported\n");
}
+
+ return 0;
}
static int
@@ -754,8 +756,15 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
return ret;
}
/* VLAN Offload Settings */
- if (priv->max_vlan_filters)
- dpaa2_vlan_offload_set(dev, ETH_VLAN_FILTER_MASK);
+ if (priv->max_vlan_filters) {
+ ret = dpaa2_vlan_offload_set(dev, ETH_VLAN_FILTER_MASK);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Error to dpaa2_vlan_offload_set:"
+ "code = %d\n", ret);
+ return ret;
+ }
+ }
+
/* if the interrupts were configured on this devices*/
if (intr_handle && (intr_handle->fd) &&
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 6ebfa6d4c..770ab8141 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -99,7 +99,7 @@ static int eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
static int eth_em_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
-static void eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void em_vlan_hw_filter_enable(struct rte_eth_dev *dev);
static void em_vlan_hw_filter_disable(struct rte_eth_dev *dev);
static void em_vlan_hw_strip_enable(struct rte_eth_dev *dev);
@@ -669,7 +669,12 @@ eth_em_start(struct rte_eth_dev *dev)
mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \
ETH_VLAN_EXTEND_MASK;
- eth_em_vlan_offload_set(dev, mask);
+ ret = eth_em_vlan_offload_set(dev, mask);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Unable to update vlan offload");
+ em_dev_clear_queues(dev);
+ return ret;
+ }
/* Set Interrupt Throttling Rate to maximum allowed value. */
E1000_WRITE_REG(hw, E1000_ITR, UINT16_MAX);
@@ -1449,7 +1454,7 @@ em_vlan_hw_strip_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_CTRL, reg);
}
-static void
+static int
eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
if(mask & ETH_VLAN_STRIP_MASK){
@@ -1465,6 +1470,8 @@ eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask)
else
em_vlan_hw_filter_disable(dev);
}
+
+ return 0;
}
/*
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 003bdf0f6..53f160030 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -157,7 +157,7 @@ static int eth_igb_vlan_filter_set(struct rte_eth_dev *dev,
static int eth_igb_vlan_tpid_set(struct rte_eth_dev *dev,
enum rte_vlan_type vlan_type,
uint16_t tpid_id);
-static void eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void igb_vlan_hw_filter_enable(struct rte_eth_dev *dev);
static void igb_vlan_hw_filter_disable(struct rte_eth_dev *dev);
@@ -1403,7 +1403,12 @@ eth_igb_start(struct rte_eth_dev *dev)
*/
mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \
ETH_VLAN_EXTEND_MASK;
- eth_igb_vlan_offload_set(dev, mask);
+ ret = eth_igb_vlan_offload_set(dev, mask);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Unable to set vlan offload");
+ igb_dev_clear_queues(dev);
+ return ret;
+ }
if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_ONLY) {
/* Enable VLAN filter since VMDq always use VLAN filter */
@@ -2720,7 +2725,7 @@ igb_vlan_hw_extend_enable(struct rte_eth_dev *dev)
2 * VLAN_TAG_SIZE);
}
-static void
+static int
eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
if(mask & ETH_VLAN_STRIP_MASK){
@@ -2743,6 +2748,8 @@ eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask)
else
igb_vlan_hw_extend_disable(dev);
}
+
+ return 0;
}
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 5386b2ae3..c02f9b7b3 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -362,7 +362,7 @@ static int enicpmd_vlan_filter_set(struct rte_eth_dev *eth_dev,
return err;
}
-static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
+static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
{
struct enic *enic = pmd_priv(eth_dev);
@@ -386,6 +386,8 @@ static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
dev_warning(enic,
"Configuration of extended VLAN is not supported\n");
}
+
+ return 0;
}
static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev)
@@ -410,9 +412,10 @@ static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev)
eth_dev->data->dev_conf.rxmode.split_hdr_size);
}
- enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK);
enic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum;
- return 0;
+ ret = enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK);
+
+ return ret;
}
/* Start the device.
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 7baa9279d..46a312fad 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1594,7 +1594,7 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
return 0;
}
-static void
+static int
fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
if (mask & ETH_VLAN_STRIP_MASK) {
@@ -1613,6 +1613,8 @@ fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask)
if (!dev->data->dev_conf.rxmode.hw_vlan_filter)
PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k");
}
+
+ return 0;
}
/* Add/Remove a MAC address, and update filters to main VSI */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 48db2dde3..86c43881b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -276,7 +276,7 @@ static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
static int i40e_vlan_tpid_set(struct rte_eth_dev *dev,
enum rte_vlan_type vlan_type,
uint16_t tpid);
-static void i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void i40e_vlan_strip_queue_set(struct rte_eth_dev *dev,
uint16_t queue,
int on);
@@ -3221,7 +3221,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
return ret;
}
-static void
+static int
i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3254,6 +3254,8 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
else
i40e_vsi_config_double_vlan(vsi, FALSE);
}
+
+ return 0;
}
static void
@@ -5314,7 +5316,11 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev)
/* Apply vlan offload setting */
mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK;
- i40e_vlan_offload_set(dev, mask);
+ ret = i40e_vlan_offload_set(dev, mask);
+ if (ret) {
+ PMD_DRV_LOG(INFO, "Failed to update vlan offload");
+ return ret;
+ }
/* Apply double-vlan setting, not implemented yet */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 9f1487509..ca1d9f930 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -118,7 +118,7 @@ static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev,
static void i40evf_dev_xstats_reset(struct rte_eth_dev *dev);
static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
-static void i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void i40evf_dev_close(struct rte_eth_dev *dev);
static int i40evf_dev_reset(struct rte_eth_dev *dev);
static void i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
@@ -1588,12 +1588,10 @@ static int
i40evf_init_vlan(struct rte_eth_dev *dev)
{
/* Apply vlan offload setting */
- i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
-
- return I40E_SUCCESS;
+ return i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
}
-static void
+static int
i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
@@ -1606,6 +1604,8 @@ i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
else
i40evf_disable_vlan_strip(dev);
}
+
+ return 0;
}
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2ff904119..371998e42 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -219,7 +219,7 @@ static void ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev,
uint16_t queue, bool on);
static void ixgbe_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue,
int on);
-static void ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue);
static void ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue);
static void ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev);
@@ -276,7 +276,7 @@ static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev,
uint16_t queue, int on);
-static void ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on);
static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,
uint16_t queue_id);
@@ -2126,7 +2126,7 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev)
*/
}
-static void
+static int
ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
if (mask & ETH_VLAN_STRIP_MASK) {
@@ -2149,6 +2149,8 @@ ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask)
else
ixgbe_vlan_hw_extend_disable(dev);
}
+
+ return 0;
}
static void
@@ -2570,9 +2572,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
goto error;
}
- mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
+ mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
ETH_VLAN_EXTEND_MASK;
- ixgbe_vlan_offload_set(dev, mask);
+ err = ixgbe_vlan_offload_set(dev, mask);
+ if (err) {
+ PMD_INIT_LOG(ERR, "Unable to set VLAN offload");
+ goto error;
+ }
if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_ONLY) {
/* Enable vlan filtering for VMDq */
@@ -5024,7 +5030,12 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
/* Set HW strip */
mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
ETH_VLAN_EXTEND_MASK;
- ixgbevf_vlan_offload_set(dev, mask);
+ err = ixgbevf_vlan_offload_set(dev, mask);
+ if (err) {
+ PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err);
+ ixgbe_dev_clear_queues(dev);
+ return err;
+ }
ixgbevf_dev_rxtx_start(dev);
@@ -5213,7 +5224,7 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
ixgbe_vlan_hw_strip_bitmap_set(dev, queue, on);
}
-static void
+static int
ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct ixgbe_hw *hw =
@@ -5228,6 +5239,8 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
for (i = 0; i < hw->mac.max_rx_queues; i++)
ixgbevf_vlan_strip_queue_set(dev, i, on);
}
+
+ return 0;
}
int
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 3f452b2f0..e6a69b823 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -248,7 +248,7 @@ int mlx5_xstats_get_names(struct rte_eth_dev *,
/* mlx5_vlan.c */
int mlx5_vlan_filter_set(struct rte_eth_dev *, uint16_t, int);
-void mlx5_vlan_offload_set(struct rte_eth_dev *, int);
+int mlx5_vlan_offload_set(struct rte_eth_dev *, int);
void mlx5_vlan_strip_queue_set(struct rte_eth_dev *, uint16_t, int);
/* mlx5_trigger.c */
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index ed91d9b28..89874aabd 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -178,7 +178,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
* @param mask
* VLAN offload bit mask.
*/
-void
+int
mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct priv *priv = dev->data->dev_private;
@@ -189,7 +189,7 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask)
if (!priv->hw_vlan_strip) {
ERROR("VLAN stripping is not supported");
- return;
+ return 0;
}
/* Run on every RX queue and set/reset VLAN stripping. */
@@ -198,4 +198,6 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask)
priv_vlan_strip_queue_set(priv, i, hw_vlan_strip);
priv_unlock(priv);
}
+
+ return 0;
}
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 0917b9c49..71d4a8629 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2306,11 +2306,12 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
return i;
}
-static void
+static int
nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
uint32_t new_ctrl, update;
struct nfp_net_hw *hw;
+ int ret;
hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
new_ctrl = 0;
@@ -2331,14 +2332,15 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_RXVLAN;
if (new_ctrl == 0)
- return;
+ return 0;
update = NFP_NET_CFG_UPDATE_GEN;
- if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
- return;
+ ret = nfp_net_reconfig(hw, new_ctrl, update);
+ if (!ret)
+ hw->ctrl = new_ctrl;
- hw->ctrl = new_ctrl;
+ return ret;
}
/* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 8b3f0ff7f..661d9381e 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1005,7 +1005,7 @@ static int qede_vlan_filter_set(struct rte_eth_dev *eth_dev,
return rc;
}
-static void qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
+static int qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
{
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
@@ -1043,6 +1043,8 @@ static void qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
DP_INFO(edev, "vlan offload mask %d vlan-strip %d vlan-filter %d\n",
mask, rxmode->hw_vlan_strip, rxmode->hw_vlan_filter);
+
+ return 0;
}
static void qede_prandom_bytes(uint32_t *buff)
@@ -1192,6 +1194,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
struct rte_eth_rxmode *rxmode = ð_dev->data->dev_conf.rxmode;
+ int ret;
PMD_INIT_FUNC_TRACE(edev);
@@ -1262,9 +1265,11 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
qdev->new_mtu = qdev->mtu;
/* Enable VLAN offloads by default */
- qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK |
+ ret = qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK |
ETH_VLAN_FILTER_MASK |
ETH_VLAN_EXTEND_MASK);
+ if (ret)
+ return ret;
DP_INFO(edev, "Device configured with RSS=%d TSS=%d\n",
QEDE_RSS_COUNT(qdev), QEDE_TSS_COUNT(qdev));
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index bfbd73770..2e4a49ea9 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -73,6 +73,7 @@ static void virtio_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int virtio_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
+static int virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void virtio_set_hwaddr(struct virtio_hw *hw);
static void virtio_get_hwaddr(struct virtio_hw *hw);
@@ -779,6 +780,7 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
.stats_reset = virtio_dev_stats_reset,
.xstats_reset = virtio_dev_stats_reset,
.link_update = virtio_dev_link_update,
+ .vlan_offload_set = virtio_dev_vlan_offload_set,
.rx_queue_setup = virtio_dev_rx_queue_setup,
.rx_queue_intr_enable = virtio_dev_rx_queue_intr_enable,
.rx_queue_intr_disable = virtio_dev_rx_queue_intr_disable,
@@ -1953,6 +1955,29 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet
return (old.link_status == link.link_status) ? -1 : 0;
}
+static int
+virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
+{
+ const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
+ struct virtio_hw *hw = dev->data->dev_private;
+
+ if (mask & ETH_VLAN_FILTER_MASK) {
+ if (rxmode->hw_vlan_filter &&
+ !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {
+
+ PMD_DRV_LOG(NOTICE,
+ "vlan filtering not available on this host");
+
+ return -ENOTSUP;
+ }
+ }
+
+ if (mask & ETH_VLAN_STRIP_MASK)
+ hw->vlan_strip = rxmode->hw_vlan_strip;
+
+ return 0;
+}
+
static void
virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 58bc4f2f2..cde112301 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -100,7 +100,7 @@ static const uint32_t *
vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev);
static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vid, int on);
-static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
static void vmxnet3_interrupt_handler(void *param);
@@ -730,8 +730,10 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
devRead->rssConfDesc.confPA = hw->rss_confPA;
}
- vmxnet3_dev_vlan_offload_set(dev,
- ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
+ ret = vmxnet3_dev_vlan_offload_set(dev,
+ ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
+ if (ret)
+ return ret;
vmxnet3_write_mac(hw, dev->data->mac_addrs->addr_bytes);
@@ -1279,7 +1281,7 @@ vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on)
return 0;
}
-static void
+static int
vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1305,6 +1307,8 @@ vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
VMXNET3_CMD_UPDATE_VLAN_FILTERS);
}
+
+ return 0;
}
static void
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0b13a58db..94c2fe2f1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2180,10 +2180,14 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
int ret = 0;
int mask = 0;
int cur, org = 0;
+ uint64_t orig_offloads;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ /* save original values in case of failure */
+ orig_offloads = dev->data->dev_conf.rxmode.offloads;
+
/*check which option changed by application*/
cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD);
org = !!(dev->data->dev_conf.rxmode.offloads &
@@ -2236,7 +2240,13 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
*/
rte_eth_convert_rx_offloads(dev->data->dev_conf.rxmode.offloads,
&dev->data->dev_conf.rxmode);
- (*dev->dev_ops->vlan_offload_set)(dev, mask);
+ ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
+ if (ret) {
+ /* hit an error restore original values */
+ dev->data->dev_conf.rxmode.offloads = orig_offloads;
+ rte_eth_convert_rx_offloads(dev->data->dev_conf.rxmode.offloads,
+ &dev->data->dev_conf.rxmode);
+ }
return ret;
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2a0129a2a..be74b2af2 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1323,7 +1323,7 @@ typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
enum rte_vlan_type type, uint16_t tpid);
/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
-typedef void (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
+typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
/**< @internal set VLAN offload function by an Ethernet device. */
typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
--
2.13.6
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
2017-10-24 9:53 0% ` Iremonger, Bernard
@ 2017-10-24 10:25 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-24 10:25 UTC (permalink / raw)
To: Iremonger, Bernard
Cc: Mcnamara, John, dev, Yigit, Ferruh, Ananyev, Konstantin,
Dumitrescu, Cristian, adrien.mazarguil, Singh, Jasvinder
24/10/2017 11:53, Iremonger, Bernard:
> Hi Thomas,
>
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 24/10/2017 11:23, Mcnamara, John:
> > > From: Iremonger, Bernard
> > > >
> > > > Hi Thomas,
> > > >
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > >
> > > > > I suppose you are OK to wait one more release and call for more
> > > > reviewers?
> > > >
> > > > This library was not ready for 17.11.RC1 having received some
> > > > comments just before the RC1 deadline.
> > > > It was then targeted for RC2 and we have pulled out all the stops to
> > > > get it ready for RC2.
> > > >
> > > > It is now at v10 of the patch set, there have been no review
> > > > comments from the community (apart from Intel), since RFC v3.
> > > >
> > > > I think that there has been ample time for the community to review
> > > > this patch set, calling for more reviewers at this point is not helpful.
> >
> > I have to review some basic things in your series.
> > I did not take time to review it because I thought John told me it would not
> > make 17.11.
> >
> > > > The API's of the library are marked as experimental, so there will
> > > > be no issues with ABI breakage, if there are requests for changes later.
> >
> > It is not marked EXPERIMENTAL in the MAINTAINERS file.
>
> My mistake, it is marked as experimental in rte_flow_classify_version.map
> I can send a v11 patch set if needed.
>
> > > > I am not OK to wait one more release, I believe we have followed the
> > > > process correctly.
> >
> > Yes, you followed the process.
> >
> > > +1 for inclusion in RC2.
> >
> > It is not common to add a new library in RC2.
> >
> > When doing the RC1 announce, I did not mention this library as a possible
> > inclusion exception in RC2, and I had no feedback:
> > http://dpdk.org/ml/archives/announce/2017-October/000153.html
>
> I probably should have replied to this email.
>
> > I was really sure you were not targetting 17.11.
>
> We have always been targeting 17.11
>
> > So I did not do the last pass review. Probably my mistake.
> >
> > We are having a hard time with 17.11 release, so I would prefer avoiding
> > adding one more new library at this stage.
>
> This is a new library and should not impact anyone.
>
> I believe we have followed the process, so I think it should not be deferred to 18.02.
OK, let's make a deal:
If you can address my comments in v11 and if there is no compilation issue,
then I will take it in RC2.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
2017-10-24 9:38 0% ` Thomas Monjalon
@ 2017-10-24 9:53 0% ` Iremonger, Bernard
2017-10-24 10:25 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Iremonger, Bernard @ 2017-10-24 9:53 UTC (permalink / raw)
To: Thomas Monjalon, Mcnamara, John
Cc: dev, Yigit, Ferruh, Ananyev, Konstantin, Dumitrescu, Cristian,
adrien.mazarguil, Singh, Jasvinder, Iremonger, Bernard
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, October 24, 2017 10:39 AM
> To: Mcnamara, John <john.mcnamara@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Ananyev,
> Konstantin <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; adrien.mazarguil@6wind.com; Singh,
> Jasvinder <jasvinder.singh@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
>
> 24/10/2017 11:23, Mcnamara, John:
> > From: Iremonger, Bernard
> > >
> > > Hi Thomas,
> > >
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > >
> > > > I suppose you are OK to wait one more release and call for more
> > > reviewers?
> > >
> > > This library was not ready for 17.11.RC1 having received some
> > > comments just before the RC1 deadline.
> > > It was then targeted for RC2 and we have pulled out all the stops to
> > > get it ready for RC2.
> > >
> > > It is now at v10 of the patch set, there have been no review
> > > comments from the community (apart from Intel), since RFC v3.
> > >
> > > I think that there has been ample time for the community to review
> > > this patch set, calling for more reviewers at this point is not helpful.
>
> I have to review some basic things in your series.
> I did not take time to review it because I thought John told me it would not
> make 17.11.
>
> > > The API's of the library are marked as experimental, so there will
> > > be no issues with ABI breakage, if there are requests for changes later.
>
> It is not marked EXPERIMENTAL in the MAINTAINERS file.
My mistake, it is marked as experimental in rte_flow_classify_version.map
I can send a v11 patch set if needed.
> > > I am not OK to wait one more release, I believe we have followed the
> > > process correctly.
>
> Yes, you followed the process.
>
> > +1 for inclusion in RC2.
>
> It is not common to add a new library in RC2.
>
> When doing the RC1 announce, I did not mention this library as a possible
> inclusion exception in RC2, and I had no feedback:
> http://dpdk.org/ml/archives/announce/2017-October/000153.html
I probably should have replied to this email.
> I was really sure you were not targetting 17.11.
We have always been targeting 17.11
> So I did not do the last pass review. Probably my mistake.
>
> We are having a hard time with 17.11 release, so I would prefer avoiding
> adding one more new library at this stage.
This is a new library and should not impact anyone.
I believe we have followed the process, so I think it should not be deferred to 18.02.
Regards,
Bernard.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
2017-10-24 9:23 0% ` Mcnamara, John
@ 2017-10-24 9:38 0% ` Thomas Monjalon
2017-10-24 9:53 0% ` Iremonger, Bernard
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-24 9:38 UTC (permalink / raw)
To: Mcnamara, John, Iremonger, Bernard
Cc: dev, Yigit, Ferruh, Ananyev, Konstantin, Dumitrescu, Cristian,
adrien.mazarguil, Singh, Jasvinder
24/10/2017 11:23, Mcnamara, John:
> From: Iremonger, Bernard
> >
> > Hi Thomas,
> >
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >
> > > I suppose you are OK to wait one more release and call for more
> > reviewers?
> >
> > This library was not ready for 17.11.RC1 having received some comments
> > just before the RC1 deadline.
> > It was then targeted for RC2 and we have pulled out all the stops to get
> > it ready for RC2.
> >
> > It is now at v10 of the patch set, there have been no review comments from
> > the community (apart from Intel), since RFC v3.
> >
> > I think that there has been ample time for the community to review this
> > patch set, calling for more reviewers at this point is not helpful.
I have to review some basic things in your series.
I did not take time to review it because I thought John told me it
would not make 17.11.
> > The API's of the library are marked as experimental, so there will be no
> > issues with ABI breakage, if there are requests for changes later.
It is not marked EXPERIMENTAL in the MAINTAINERS file.
> > I am not OK to wait one more release, I believe we have followed the
> > process correctly.
Yes, you followed the process.
> +1 for inclusion in RC2.
It is not common to add a new library in RC2.
When doing the RC1 announce, I did not mention this library
as a possible inclusion exception in RC2, and I had no feedback:
http://dpdk.org/ml/archives/announce/2017-October/000153.html
I was really sure you were not targetting 17.11.
So I did not do the last pass review. Probably my mistake.
We are having a hard time with 17.11 release, so I would prefer avoiding
adding one more new library at this stage.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
2017-10-24 8:40 3% ` Iremonger, Bernard
@ 2017-10-24 9:23 0% ` Mcnamara, John
2017-10-24 9:38 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Mcnamara, John @ 2017-10-24 9:23 UTC (permalink / raw)
To: Iremonger, Bernard, Thomas Monjalon
Cc: dev, Yigit, Ferruh, Ananyev, Konstantin, Dumitrescu, Cristian,
adrien.mazarguil, Singh, Jasvinder
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Tuesday, October 24, 2017 9:41 AM
> To: Thomas Monjalon <thomas@monjalon.net>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Ananyev,
> Konstantin <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; adrien.mazarguil@6wind.com; Singh,
> Jasvinder <jasvinder.singh@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v10 0/4] flow classification library
>
> Hi Thomas,
>
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Monday, October 23, 2017 9:59 PM
> > To: Iremonger, Bernard <bernard.iremonger@intel.com>
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Ananyev,
> > Konstantin <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; adrien.mazarguil@6wind.com; Singh,
> > Jasvinder <jasvinder.singh@intel.com>; Mcnamara, John
> > <john.mcnamara@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
>
> > I suppose you are OK to wait one more release and call for more
> reviewers?
>
> This library was not ready for 17.11.RC1 having received some comments
> just before the RC1 deadline.
> It was then targeted for RC2 and we have pulled out all the stops to get
> it ready for RC2.
>
> It is now at v10 of the patch set, there have been no review comments from
> the community (apart from Intel), since RFC v3.
>
> I think that there has been ample time for the community to review this
> patch set, calling for more reviewers at this point is not helpful.
>
> The API's of the library are marked as experimental, so there will be no
> issues with ABI breakage, if there are requests for changes later.
>
> I am not OK to wait one more release, I believe we have followed the
> process correctly.
+1 for inclusion in RC2.
John
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
@ 2017-10-24 8:40 3% ` Iremonger, Bernard
2017-10-24 9:23 0% ` Mcnamara, John
0 siblings, 1 reply; 200+ results
From: Iremonger, Bernard @ 2017-10-24 8:40 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, Ananyev, Konstantin, Dumitrescu, Cristian,
adrien.mazarguil, Singh, Jasvinder, Mcnamara, John, Iremonger,
Bernard
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Monday, October 23, 2017 9:59 PM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Ananyev,
> Konstantin <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; adrien.mazarguil@6wind.com; Singh,
> Jasvinder <jasvinder.singh@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v10 0/4] flow classification library
>
> 23/10/2017 17:16, Bernard Iremonger:
> > The initial implementation is to provide counting of IPv4 five tuple
> > packets for UDP, TCP and SCTP, but the library is planned to be as generic
> as possible.
> >
> > The flow information provided by this library is missing to implement
> > full IPFIX features, but this is planned to be the initial step.
> >
> > Flows are defined using rte_flow, also measurements (actions) are
> provided by rte_flow.
> > To support more IPFIX measurements, the implementation may require
> > extending rte_flow in addition to extending this library.
> >
> > The library uses both flows and actions defined by rte_flow.h so this
> > library has a dependency on rte_flow.h
> >
> > This patch set also contains a set of unit tests for the Flow Classify
> > library, patch(4) and a patch(3) containing additional functions added to the
> packet burst generator code.
> >
> > For further steps, this library may be expanded to benefit from hardware
> filters for better performance.
> >
> > It will be more beneficial to shape this library to cover more use
> > cases, please feel free to comment on possible other use cases and desired
> functionalities.
>
> I had some feedbacks that this library won't be ready for 17.11.
> So I did not review it.
>
> I suppose you are OK to wait one more release and call for more reviewers?
This library was not ready for 17.11.RC1 having received some comments just before the RC1 deadline.
It was then targeted for RC2 and we have pulled out all the stops to get it ready for RC2.
It is now at v10 of the patch set, there have been no review comments from the community (apart from Intel), since RFC v3.
I think that there has been ample time for the community to review this patch set, calling for more reviewers at this point is not helpful.
The API's of the library are marked as experimental, so there will be no issues with ABI breakage, if there are requests for changes later.
I am not OK to wait one more release, I believe we have followed the process correctly.
Regards,
Bernard.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-23 20:29 0% ` Thomas Monjalon
@ 2017-10-24 5:06 0% ` santosh
2017-10-25 9:45 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: santosh @ 2017-10-24 5:06 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
Hi Thomas,
On Tuesday 24 October 2017 01:59 AM, Thomas Monjalon wrote:
> 20/10/2017 14:31, Santosh Shukla:
>> Removed dpdk iova aware ABI deprecation notice,
>> and updated ABI change details in release_17.11.rst.
>>
>> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>> Acked-by: John McNamara <john.mcnamara@intel.com>
>> ---
>> --- a/doc/guides/rel_notes/deprecation.rst
>> +++ b/doc/guides/rel_notes/deprecation.rst
>> -* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
>> - translation scheme.
>> - Reference to phys address in EAL data-structure or functions may change to
>> - IOVA address or more appropriate name.
>> - The change will be only for the name.
>> - Functional aspects of the API or data-structure will remain same.
> Sorry, this series cannot be applied as is because it is breaking
> more than EAL API. The API of mbuf and mempool are also changed.
> We need to choose one of these three options:
> 1/ accept to break all API in 17.11
> 2/ postpone the whole series to 18.02
Theme of series is to make dpdk iova aware so I would prefer option 1) or 2).
However I have no strong opinion on this topic.
Lets get more opinion from others about option 1/2/3.
> 3/ rename only EAL API in 17.11 and postpone mbuf/mempool
>
> One more comment:
> For such a large change, we should provide a script in devtools
> to help porting the applications. I suggest a sed script.
+1.
Thanks.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v2] doc: fix highlight of bumped libs in release notes
2017-10-23 16:26 0% ` Ferruh Yigit
@ 2017-10-23 20:39 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-23 20:39 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
23/10/2017 18:26, Ferruh Yigit:
> On 10/23/2017 3:15 AM, Thomas Monjalon wrote:
> > The libraries which have their ABI version increased in this release
> > must be prepended with a + sign to make them appear clearly.
> >
> > Fixes: f8244c6399d9 ("ethdev: increase port id range")
> > Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
2017-10-20 12:31 15% ` [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice Santosh Shukla
@ 2017-10-23 20:29 0% ` Thomas Monjalon
2017-10-24 5:06 0% ` santosh
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-23 20:29 UTC (permalink / raw)
To: Santosh Shukla
Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal, anatoly.burakov
20/10/2017 14:31, Santosh Shukla:
> Removed dpdk iova aware ABI deprecation notice,
> and updated ABI change details in release_17.11.rst.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Acked-by: John McNamara <john.mcnamara@intel.com>
> ---
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> -* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
> - translation scheme.
> - Reference to phys address in EAL data-structure or functions may change to
> - IOVA address or more appropriate name.
> - The change will be only for the name.
> - Functional aspects of the API or data-structure will remain same.
Sorry, this series cannot be applied as is because it is breaking
more than EAL API. The API of mbuf and mempool are also changed.
We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
One more comment:
For such a large change, we should provide a script in devtools
to help porting the applications. I suggest a sed script.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v2] doc: fix highlight of bumped libs in release notes
2017-10-23 10:15 3% ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2017-10-23 16:26 0% ` Ferruh Yigit
2017-10-23 20:39 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2017-10-23 16:26 UTC (permalink / raw)
To: Thomas Monjalon, dev
On 10/23/2017 3:15 AM, Thomas Monjalon wrote:
> The libraries which have their ABI version increased in this release
> must be prepended with a + sign to make them appear clearly.
>
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version
2017-10-16 13:42 3% ` [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version Santosh Shukla
2017-10-17 9:50 0% ` Hemant Agrawal
@ 2017-10-23 14:38 3% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-23 14:38 UTC (permalink / raw)
To: Santosh Shukla; +Cc: dev, olivier.matz, jerin.jacob, hemant.agrawal
This change is rejected because this PMD has no API/ABI.
16/10/2017 15:42, Santosh Shukla:
> This commit bumps the library version to reflect the ABI change
> caused by removing the below function from event/octeontx:
> * octeontx_ssovf_info
> * octeontx_ssovf_bar
> * octeontx_ssovf_mbox_send
>
> And moved to mempool/octeontx area.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> ---
> doc/guides/rel_notes/release_17_11.rst | 1 +
> drivers/event/octeontx/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
> index 8db35f5e4..eac2f677a 100644
> --- a/doc/guides/rel_notes/release_17_11.rst
> +++ b/doc/guides/rel_notes/release_17_11.rst
> @@ -377,6 +377,7 @@ The libraries prepended with a plus sign were incremented in this version.
> librte_table.so.2
> librte_timer.so.1
> librte_vhost.so.3
> + librte_pmd_octeontx_ssovf.so.2
>
>
> Tested Platforms
> diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
> index 50434a384..08fc16775 100644
> --- a/drivers/event/octeontx/Makefile
> +++ b/drivers/event/octeontx/Makefile
> @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
>
> EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
>
> -LIBABIVER := 1
> +LIBABIVER := 2
>
> #
> # all source are stored in SRCS-y
>
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH] mbuf: rename deprecated VLAN flags
@ 2017-10-23 12:16 2% Olivier Matz
2017-10-25 15:12 2% ` [dpdk-dev] [PATCH v2] " Olivier Matz
0 siblings, 1 reply; 200+ results
From: Olivier Matz @ 2017-10-23 12:16 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas
PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated for a while.
As explained in [1], these flags were kept to let the applications and
PMDs move to the new flag. There is also a need to support Rx vlan
offload without vlan strip (at least for the ixgbe driver).
This patch renames the old flags for this feature, knowing that some
PMDs were using PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT to indicate that
the vlan tci has been saved in the mbuf structure.
It is likely that some PMDs do not set the proper flags when doing vlan
offload, and it would be worth making a pass on all of them.
Link: [1] http://dpdk.org/ml/archives/dev/2017-June/067712.html
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
An alternative would have been to keep PKT_RX_VLAN_PKT and
PKT_RX_QINQ_PKT and recycle them for this new feature.
I choosed this way (rename the flags) because:
- changing the name is a good way to highlight that something
changed
- the old name was not that good (PKT_blabla_PKT)
- there was no reaction to the proposition in [1]
I'm also open to recycle the old name if we find good reasons
for it. It would make the patch smaller since there would be no
modification in drivers.
In both cases, it is important that PMD maintainers check
that their use of VLAN flags is correct. Example:
- vlan is not stripped and tci is saved: PKT_RX_VLAN
- vlan is stripped and tci is saved: PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED
This can be completed by the packet type which describes the
packet data. I hope the API documentation is clear enough.
Ferruh, do you think you could check with PMD maintainers for next
version?
This patch has no impact on applications that do not
use the deprecated flags. For other applications, renaming
the flag would restore the same behavior. But, since we are
close to the release, applying it early after the release could
also be considered.
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 13 +++++++++++++
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/avp/avp_ethdev.c | 4 ++--
drivers/net/bnx2x/bnx2x_rxtx.c | 2 +-
drivers/net/bnxt/bnxt_rxr.c | 4 ++--
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/cxgbe/sge.c | 4 ++--
drivers/net/dpaa/dpaa_rxtx.c | 2 +-
drivers/net/dpaa2/dpaa2_rxtx.c | 2 +-
drivers/net/e1000/em_rxtx.c | 6 +++---
drivers/net/e1000/igb_rxtx.c | 6 +++---
drivers/net/enic/enic_rxtx.c | 2 +-
drivers/net/fm10k/fm10k_rxtx.c | 8 ++++----
drivers/net/fm10k/fm10k_rxtx_vec.c | 4 ++--
drivers/net/i40e/i40e_rxtx.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_neon.c | 2 +-
drivers/net/i40e/i40e_rxtx_vec_sse.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 4 ++--
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 2 +-
drivers/net/mlx5/mlx5_rxtx.c | 2 +-
drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 4 ++--
drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +++++-----
drivers/net/nfp/nfp_net.c | 2 +-
drivers/net/qede/qede_rxtx.c | 4 ++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 3 ++-
lib/librte_mbuf/rte_mbuf.c | 5 +++--
lib/librte_mbuf/rte_mbuf.h | 27 +++++++++++++++------------
lib/librte_net/rte_ether.h | 2 +-
32 files changed, 80 insertions(+), 67 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 0d9925126..741c1e899 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -28,11 +28,6 @@ Deprecation Notices
The change will be only for the name.
Functional aspects of the API or data-structure will remain same.
-* The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
- are respectively replaced by PKT_RX_VLAN_STRIPPED and
- PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
- their behavior will be kept until 17.08 and will be removed in 17.11.
-
* ethdev: Tx offloads will no longer be enabled by default in 17.11.
Instead, the ``rte_eth_txmode`` structure will be extended with
bit field to enable each Tx offload.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 0370aed89..702399ed8 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -291,6 +291,19 @@ API Changes
``rte_log_get_global_level()``, ``rte_log_set_level()`` and
``rte_log_get_level()``.
+* **Removed ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT``.**
+
+ The ``mbuf`` flags ``PKT_RX_VLAN_PKT`` and ``PKT_RX_QINQ_PKT`` have
+ been removed since their behavior were not properly described.
+
+* **Added ``mbuf`` flags ``PKT_RX_VLAN`` and ``PKT_RX_QINQ``.**
+
+ Two ``mbuf`` flags have been added to indicate that the VLAN
+ identifier has been saved in in the ``mbuf`` structure. For instance:
+
+ - if VLAN is not stripped and TCI is saved: ``PKT_RX_VLAN``
+ - if VLAN is stripped and TCI is saved: ``PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED``
+
ABI Changes
-----------
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 46b8250d0..dc1867057 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -167,7 +167,7 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
/* check for vlan info */
if (ppd->tp_status & TP_STATUS_VLAN_VALID) {
mbuf->vlan_tci = ppd->tp_vlan_tci;
- mbuf->ol_flags |= (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ mbuf->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
}
/* release incoming frame and advance ring buffer */
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index b97a90cea..43b33dbf2 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -1361,7 +1361,7 @@ avp_dev_copy_from_buffers(struct avp_dev *avp,
src_offset = 0;
if (pkt_buf->ol_flags & RTE_AVP_RX_VLAN_PKT) {
- ol_flags = PKT_RX_VLAN_PKT;
+ ol_flags = PKT_RX_VLAN;
vlan_tci = pkt_buf->vlan_tci;
} else {
ol_flags = 0;
@@ -1619,7 +1619,7 @@ avp_recv_pkts(void *rx_queue,
m->port = avp->port_id;
if (pkt_buf->ol_flags & RTE_AVP_RX_VLAN_PKT) {
- m->ol_flags = PKT_RX_VLAN_PKT;
+ m->ol_flags = PKT_RX_VLAN;
m->vlan_tci = pkt_buf->vlan_tci;
}
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 5dd4aee7f..c72067f6f 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -422,7 +422,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
*/
if (cqe_fp->pars_flags.flags & PARSING_FLAGS_VLAN) {
rx_mb->vlan_tci = cqe_fp->vlan_tag;
- rx_mb->ol_flags |= PKT_RX_VLAN_PKT;
+ rx_mb->ol_flags |= PKT_RX_VLAN;
}
rx_pkts[nb_rx] = rx_mb;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 153ca93ed..a677183f1 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -199,7 +199,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
if (tpa_start1->flags2 &
rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN)) {
mbuf->vlan_tci = rte_le_to_cpu_32(tpa_start1->metadata);
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
}
if (likely(tpa_start1->flags2 &
rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_L4_CS_CALC)))
@@ -464,7 +464,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
(RX_PKT_CMPL_METADATA_VID_MASK |
RX_PKT_CMPL_METADATA_DE |
RX_PKT_CMPL_METADATA_PRI_MASK);
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
}
if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 3fbc1b123..c48993940 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -129,7 +129,7 @@ is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf)
{
const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
- return !((mbuf->ol_flags & PKT_RX_VLAN_PKT) ? mbuf->vlan_tci : 0) &&
+ return !((mbuf->ol_flags & PKT_RX_VLAN) ? mbuf->vlan_tci : 0) &&
(ethertype == ether_type_slow_be &&
(subtype == SLOW_SUBTYPE_MARKER || subtype == SLOW_SUBTYPE_LACP));
}
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 5376fc500..33f7f0bc2 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1405,7 +1405,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
}
if (pkt->vlan_ex) {
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
mbuf->vlan_tci = ntohs(pkt->vlan);
}
rxq->stats.pkts++;
@@ -1550,7 +1550,7 @@ static int process_responses(struct sge_rspq *q, int budget,
}
if (cpl->vlan_ex) {
- pkt->ol_flags |= PKT_RX_VLAN_PKT;
+ pkt->ol_flags |= PKT_RX_VLAN;
pkt->vlan_tci = ntohs(cpl->vlan);
}
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 0433f3bb1..f7cfff798 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -219,7 +219,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m,
/* Check if Vlan is present */
if (prs & DPAA_PARSE_VLAN_MASK)
- m->ol_flags |= PKT_RX_VLAN_PKT;
+ m->ol_flags |= PKT_RX_VLAN;
/* Packet received without stripping the vlan */
}
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a8c..3f57dc227 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -122,7 +122,7 @@ dpaa2_dev_rx_offload(uint64_t hw_annot_addr, struct rte_mbuf *mbuf)
if (BIT_ISSET_AT_POS(annotation->word3,
L2_VLAN_1_PRESENT | L2_VLAN_N_PRESENT))
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L3CE))
mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 92b66b0ea..d4d5fe6e1 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -675,7 +675,7 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
/* Check if VLAN present */
pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ?
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED : 0);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED : 0);
return pkt_flags;
}
@@ -830,7 +830,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->ol_flags = rxm->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
/*
@@ -1056,7 +1056,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->ol_flags = first_seg->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
/* Prefetch data of first segment, if configured to do so. */
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 8a1e5b18e..d25ea048d 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -785,7 +785,7 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
/* Check if VLAN present */
pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ?
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED : 0);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED : 0);
#if defined(RTE_LIBRTE_IEEE1588)
if (rx_status & E1000_RXD_STAT_TMST)
@@ -946,7 +946,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(rxq, hlen_type_rss);
@@ -1180,7 +1180,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
/*
- * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+ * The vlan_tci field is only valid when PKT_RX_VLAN is
* set in the pkt_flags field.
*/
first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index a39172f14..1d43bde9a 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -243,7 +243,7 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
/* VLAN STRIPPED flag. The L2 packet type updated here also */
if (bwflags & CQ_ENET_RQ_DESC_FLAGS_VLAN_STRIPPED) {
- pkt_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ pkt_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
mbuf->packet_type |= RTE_PTYPE_L2_ETHER;
} else {
if (vlan_tci != 0)
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 4e84926f8..d6081e485 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -158,10 +158,10 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
* Packets in fm10k device always carry at least one VLAN tag.
* For those packets coming in without VLAN tag,
* the port default VLAN tag will be used.
- * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * So, always PKT_RX_VLAN flag is set and vlan_tci
* is valid for each RX packet's mbuf.
*/
- mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->ol_flags |= PKT_RX_VLAN;
mbuf->vlan_tci = desc.w.vlan;
/**
* mbuf->vlan_tci_outer is an idle field in fm10k driver,
@@ -319,10 +319,10 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
* Packets in fm10k device always carry at least one VLAN tag.
* For those packets coming in without VLAN tag,
* the port default VLAN tag will be used.
- * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * So, always PKT_RX_VLAN flag is set and vlan_tci
* is valid for each RX packet's mbuf.
*/
- first_seg->ol_flags |= PKT_RX_VLAN_PKT;
+ first_seg->ol_flags |= PKT_RX_VLAN;
first_seg->vlan_tci = desc.w.vlan;
/**
* mbuf->vlan_tci_outer is an idle field in fm10k driver,
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index d23bfe9b7..edc4ae16e 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -81,8 +81,8 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
const __m128i pkttype_msk = _mm_set_epi16(
0x0000, 0x0000, 0x0000, 0x0000,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT);
+ PKT_RX_VLAN, PKT_RX_VLAN,
+ PKT_RX_VLAN, PKT_RX_VLAN);
/* mask everything except rss type */
const __m128i rsstype_msk = _mm_set_epi16(
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index f21c1c5d2..904d37f08 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -108,7 +108,7 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
{
if (rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len) &
(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
- mb->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
mb->vlan_tci =
rte_le_to_cpu_16(rxdp->wb.qword0.lo_dword.l2tag1);
PMD_RX_LOG(DEBUG, "Descriptor l2tag1: %u",
diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index f4036ea28..5ab9445ed 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -146,7 +146,7 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
/* map rss and vlan type to rss hash and vlan flag */
const vector unsigned char vlan_flags = (vector unsigned char){
0, 0, 0, 0,
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 694e91f33..d0e604068 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -137,7 +137,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, uint64x2_t descs[4],
/* map rss and vlan type to rss hash and vlan flag */
const uint8x16_t vlan_flags = {
0, 0, 0, 0,
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 779f14e53..86e16ddf9 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -151,7 +151,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, __m128i descs[4],
/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, 0, PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ 0, 0, 0, PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
0, 0, 0, 0);
const __m128i rss_flags = _mm_set_epi8(0, 0, 0, 0,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 14b9c5303..a16921afd 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1960,9 +1960,9 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on)
rxq = dev->data->rx_queues[queue];
if (on)
- rxq->vlan_flags = PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ rxq->vlan_flags = PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
else
- rxq->vlan_flags = PKT_RX_VLAN_PKT;
+ rxq->vlan_flags = PKT_RX_VLAN;
}
static void
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 0038dfbb4..ea2813a43 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1849,7 +1849,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->port = rxq->port_id;
pkt_info = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
- /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
+ /* Only valid if PKT_RX_VLAN set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_status_to_pkt_flags(staterr, vlan_flags);
@@ -1940,7 +1940,7 @@ ixgbe_fill_cluster_head_buf(
head->port = rxq->port_id;
- /* The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+ /* The vlan_tci field is only valid when PKT_RX_VLAN is
* set in the pkt_flags field.
*/
head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 44de1caac..18e3d199f 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -126,8 +126,8 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2,
} vol;
const uint8x16_t pkttype_msk = {
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
- PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT,
+ PKT_RX_VLAN, PKT_RX_VLAN,
+ PKT_RX_VLAN, PKT_RX_VLAN,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index e704a7f35..fe6937bf3 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -397,7 +397,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
sw_ring = &rxq->sw_ring[rxq->rx_tail];
/* ensure these 2 flags are in the lower 8 bits */
- RTE_BUILD_BUG_ON((PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED) > UINT8_MAX);
+ RTE_BUILD_BUG_ON((PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED) > UINT8_MAX);
vlan_flags = rxq->vlan_flags & UINT8_MAX;
/* A. load 4 packet in one loop
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 961967bf4..763d5bb59 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1882,7 +1882,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
if (rxq->vlan_strip &&
(cqe->hdr_type_etc &
rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) {
- pkt->ol_flags |= PKT_RX_VLAN_PKT |
+ pkt->ol_flags |= PKT_RX_VLAN |
PKT_RX_VLAN_STRIPPED;
pkt->vlan_tci =
rte_be_to_cpu_16(cqe->vlan_info);
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 4cb7f2889..da3c96f4a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -572,7 +572,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
const uint32x4_t ptype_ol_mask = { 0x106, 0x106, 0x106, 0x106 };
const uint8x16_t cv_flag_sel = {
0,
- (uint8_t)(PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED),
+ (uint8_t)(PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED),
(uint8_t)(PKT_RX_IP_CKSUM_GOOD >> 1),
0,
(uint8_t)(PKT_RX_L4_CKSUM_GOOD >> 1),
@@ -582,7 +582,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
};
const uint32x4_t cv_mask =
vdupq_n_u32(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
const uint64x1_t mbuf_init = vld1_u64(&rxq->mbuf_initializer);
const uint64x1_t r32_mask = vcreate_u64(0xffffffff);
uint64x2_t rearm0, rearm1, rearm2, rearm3;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index e9819b762..95e41d51a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -563,17 +563,17 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq, __m128i cqes[4],
(uint8_t)(PKT_RX_L4_CKSUM_GOOD >> 1),
0,
(uint8_t)(PKT_RX_IP_CKSUM_GOOD >> 1),
- (uint8_t)(PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED),
+ (uint8_t)(PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED),
0);
const __m128i cv_mask =
_mm_set_epi32(PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED,
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED,
PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD |
- PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
const __m128i mbuf_init =
_mm_loadl_epi64((__m128i *)&rxq->mbuf_initializer);
__m128i rearm0, rearm1, rearm2, rearm3;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 0917b9c49..098dbcb62 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2067,7 +2067,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if ((rxds->rxd.flags & PCIE_DESC_RX_VLAN) &&
(hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN)) {
mb->vlan_tci = rte_cpu_to_le_32(rxds->rxd.vlan);
- mb->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
}
/* Adding the mbuff to the mbuff array passed by the app */
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 45b4aeb8a..f2b62e8bf 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -1276,14 +1276,14 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
}
if (CQE_HAS_VLAN(parse_flag)) {
- ol_flags |= PKT_RX_VLAN_PKT;
+ ol_flags |= PKT_RX_VLAN;
if (qdev->vlan_strip_flg) {
ol_flags |= PKT_RX_VLAN_STRIPPED;
rx_mb->vlan_tci = vlan_tci;
}
}
if (CQE_HAS_OUTER_VLAN(parse_flag)) {
- ol_flags |= PKT_RX_QINQ_PKT;
+ ol_flags |= PKT_RX_QINQ;
if (qdev->vlan_strip_flg) {
rx_mb->vlan_tci = vlan_tci;
ol_flags |= PKT_RX_QINQ_STRIPPED;
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index c9a2df3f4..01c85f138 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -847,7 +847,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
/* Check for hardware stripped VLAN tag */
if (rcd->ts) {
- start->ol_flags |= (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ start->ol_flags |= (PKT_RX_VLAN |
+ PKT_RX_VLAN_STRIPPED);
start->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
}
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0e18709d9..92fc704ee 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -308,7 +308,7 @@ const void *__rte_pktmbuf_read(const struct rte_mbuf *m, uint32_t off,
const char *rte_get_rx_ol_flag_name(uint64_t mask)
{
switch (mask) {
- case PKT_RX_VLAN_PKT: return "PKT_RX_VLAN_PKT";
+ case PKT_RX_VLAN: return "PKT_RX_VLAN";
case PKT_RX_RSS_HASH: return "PKT_RX_RSS_HASH";
case PKT_RX_FDIR: return "PKT_RX_FDIR";
case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD";
@@ -339,7 +339,7 @@ int
rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
{
const struct flag_mask rx_flags[] = {
- { PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT, NULL },
+ { PKT_RX_VLAN, PKT_RX_VLAN, NULL },
{ PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, NULL },
{ PKT_RX_FDIR, PKT_RX_FDIR, NULL },
{ PKT_RX_L4_CKSUM_BAD, PKT_RX_L4_CKSUM_MASK, NULL },
@@ -359,6 +359,7 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
{ PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL },
{ PKT_RX_LRO, PKT_RX_LRO, NULL },
{ PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL },
+ { PKT_RX_QINQ, PKT_RX_QINQ, NULL },
};
const char *name;
unsigned int i;
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index cc380400d..5f250f364 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -89,12 +89,13 @@ extern "C" {
*/
/**
- * RX packet is a 802.1q VLAN packet. This flag was set by PMDs when
- * the packet is recognized as a VLAN, but the behavior between PMDs
- * was not the same. This flag is kept for some time to avoid breaking
- * applications and should be replaced by PKT_RX_VLAN_STRIPPED.
+ * The RX packet is a 802.1q VLAN packet, and the tci has been
+ * saved in in mbuf->vlan_tci.
+ * If the flag PKT_RX_VLAN_STRIPPED is also present, the VLAN
+ * header has been stripped from mbuf data, else it is still
+ * present.
*/
-#define PKT_RX_VLAN_PKT (1ULL << 0)
+#define PKT_RX_VLAN (1ULL << 0)
#define PKT_RX_RSS_HASH (1ULL << 1) /**< RX packet with RSS hash result. */
#define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */
@@ -171,13 +172,6 @@ extern "C" {
#define PKT_RX_QINQ_STRIPPED (1ULL << 15)
/**
- * Deprecated.
- * RX packet with double VLAN stripped.
- * This flag is replaced by PKT_RX_QINQ_STRIPPED.
- */
-#define PKT_RX_QINQ_PKT PKT_RX_QINQ_STRIPPED
-
-/**
* When packets are coalesced by a hardware or virtual driver, this flag
* can be set in the RX mbuf, meaning that the m->tso_segsz field is
* valid and is set to the segment size of original packets.
@@ -189,6 +183,15 @@ extern "C" {
*/
#define PKT_RX_TIMESTAMP (1ULL << 17)
+/**
+ * The RX packet is a double VLAN, and the outer tci has been
+ * saved in in mbuf->vlan_tci_outer.
+ * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs
+ * headers have been stripped from mbuf data, else they are still
+ * present.
+ */
+#define PKT_RX_QINQ (1ULL << 18)
+
/* add new RX flags here */
/* add new TX flags here */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 917d42a1a..06d7b486c 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -358,7 +358,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m)
return -1;
struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);
- m->ol_flags |= PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+ m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci);
/* Copy ether header over rather than moving whole packet */
--
2.11.0
^ permalink raw reply [relevance 2%]
* [dpdk-dev] DPDK techboard minutes of October 13
@ 2017-10-23 11:50 3% Olivier MATZ
0 siblings, 0 replies; 200+ results
From: Olivier MATZ @ 2017-10-23 11:50 UTC (permalink / raw)
To: dev
Hi,
Here are the minutes of the last DPDK technical board meeting
held on 2017-10-13.
Attendees:
- Bruce Richardson
- Hemant Agrawal
- Jan Blunck
- Jerin Jacob
- Konstantin Ananyev
- Olivier Matz
- Stephen Hemminger
- Thomas Monjalon
- Yuanhan Liu
1) Vendor trees
The proposal to introduce new next-net-* repositories for vendors drivers
has been approved to optimize the process.
- A specific maintainer for this tree will be in charge of reviewing
and integrating the incoming patches.
- The next-net maintainer still has the responsibility of re-checking
that patches do not conflict with deprecations and DPDK evolutions
in net drivers or ethdev. This will be described in the
contributing guide.
- This applies to the most active vendors, where the number of
patches justifies the additional work.
- These trees are restricted to network drivers.
2) API/ABI stability
a) one LTS per year
The techboard approved the proposal made at userspace of having
one LTS per year. The next version (17.11) will be a LTS.
- Luca Bocassi accepted to be LTS maintainer, he will maintain
16.11.
- Yuanhan Liu will manage 17.11.
b) experimental APIs
Every new API will have the "experimental" tag, meaning that
the API is not guaranteed to follow the API deprecation
process. This won't apply to changes on existing APIs.
This tag will remain for at least one release, and it is the
responsibility of the developer and maintainer to send a patch
to remove it.
c) enforce acknowledging of deprecation notices
It was suggested to require 3 acks coming from different
companies for deprecations. The techboard did not approved it.
However, the techboard agreed that the ack of the maintainer of
the related code has to be mandatory (and 3 acks will still be
required, as of today). The techboard also recommends to have
acks from different "areas of interest" (ex: nics vendors, cpu
vendors, sw vendors, ...)
[1] http://dpdk.org/ml/archives/dev/2017-October/077937.html
[2] http://dpdk.org/ml/archives/dev/2017-October/077935.html
3) license of the optimized division code from libdivide
The original author would like to keep the license of its code and
declined to put it under BSD [3]. The techboard asks to remove this
code and rewrite it as a BSD-licensed code. It could possibly be
based on rte_reciprocal.
[3] http://dpdk.org/ml/archives/dev/2017-October/077338.html
4) update on IPSec offload (rte_security)
- Discussions are ongoing on the mailing list.
- Target is rc2.
- Since it's a new API, it will be marked experimental.
5) VF are broken with igb-uio
A suggestion was made [4] to revert the initial patch, whose
objective was to avoid to leave the devices in unknown state.
It was suggested to give a chance to the fix [5] into rc1.
[4] http://dpdk.org/ml/archives/dev/2017-October/079111.html
[5] http://dpdk.org/ml/archives/dev/2017-October/079159.html
6) next chair
Thomas will chair the next meeting as Stephen (next per alphabetical
order) may be unavailable.
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v2] doc: fix highlight of bumped libs in release notes
2017-10-14 0:09 3% [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes Thomas Monjalon
2017-10-16 8:33 0% ` Yang, Zhiyong
2017-10-18 20:57 0% ` Ferruh Yigit
@ 2017-10-23 10:15 3% ` Thomas Monjalon
2017-10-23 16:26 0% ` Ferruh Yigit
2 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-23 10:15 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
The libraries which have their ABI version increased in this release
must be prepended with a + sign to make them appear clearly.
Fixes: f8244c6399d9 ("ethdev: increase port id range")
Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
v2: highlight vhost too
---
doc/guides/rel_notes/release_17_11.rst | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 8db35f5e4..a8b113bb1 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -338,16 +338,16 @@ The libraries prepended with a plus sign were incremented in this version.
.. code-block:: diff
librte_acl.so.2
- librte_bitratestats.so.2
+ + librte_bitratestats.so.2
librte_cfgfile.so.2
librte_cmdline.so.2
librte_cryptodev.so.3
librte_distributor.so.1
librte_eal.so.5
- librte_ethdev.so.8
- librte_eventdev.so.3
+ + librte_ethdev.so.8
+ + librte_eventdev.so.3
librte_gro.so.1
- librte_gso.so.1
+ + librte_gso.so.1
librte_hash.so.2
librte_ip_frag.so.1
librte_jobstats.so.1
@@ -360,15 +360,15 @@ The libraries prepended with a plus sign were incremented in this version.
librte_meter.so.1
librte_metrics.so.1
librte_net.so.1
- librte_pdump.so.2
+ + librte_pdump.so.2
librte_pipeline.so.3
- librte_pmd_bnxt.so.2
- librte_pmd_bond.so.2
- librte_pmd_i40e.so.2
- librte_pmd_ixgbe.so.2
+ + librte_pmd_bnxt.so.2
+ + librte_pmd_bond.so.2
+ + librte_pmd_i40e.so.2
+ + librte_pmd_ixgbe.so.2
librte_pmd_ring.so.2
+ librte_pmd_softnic.so.1
- librte_pmd_vhost.so.2
+ + librte_pmd_vhost.so.2
librte_port.so.3
librte_power.so.1
librte_reorder.so.1
--
2.14.2
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes
2017-10-18 20:57 0% ` Ferruh Yigit
@ 2017-10-23 10:13 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-23 10:13 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
18/10/2017 22:57, Ferruh Yigit:
> On 10/13/2017 5:09 PM, Thomas Monjalon wrote:
> > The libraries which have their ABI version increased in this release
> > must be prepended with a + sign to make them appear clearly.
> >
> > Fixes: f8244c6399d9 ("ethdev: increase port id range")
> > Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
> <...>
>
> > + + librte_pmd_ixgbe.so.2
> > librte_pmd_ring.so.2
> > + librte_pmd_softnic.so.1
> > librte_pmd_vhost.so.2
>
> librte_pmd_vhost.so.2 also requires a "+"
Right, I send a v2, thanks
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v7 1/4] cryptodev: remove crypto vdev init API
2017-10-13 11:51 4% ` [dpdk-dev] [PATCH v7 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
@ 2017-10-23 10:06 3% ` De Lara Guarch, Pablo
0 siblings, 0 replies; 200+ results
From: De Lara Guarch, Pablo @ 2017-10-23 10:06 UTC (permalink / raw)
To: Tan, Jianfeng, dev
Cc: jblunck, Richardson, Bruce, Ananyev, Konstantin, thomas, yliu,
maxime.coquelin, mtetsuyah, Yigit, Ferruh
Hi Jianfeng,
> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Friday, October 13, 2017 12:52 PM
> To: dev@dpdk.org
> Cc: jblunck@infradead.org; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; thomas@monjalon.net;
> yliu@fridaylinux.org; maxime.coquelin@redhat.com;
> mtetsuyah@gmail.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Tan,
> Jianfeng <jianfeng.tan@intel.com>
> Subject: [PATCH v7 1/4] cryptodev: remove crypto vdev init API
>
> Remove rte_cryptodev_create_vdev() for duplication.
>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
...
> --- a/lib/librte_cryptodev/Makefile
> +++ b/lib/librte_cryptodev/Makefile
> @@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB =
> librte_cryptodev.a
>
> # library version
> -LIBABIVER := 3
> +LIBABIVER := 4
Sorry for the late review.
Since you are bumping the ABI version, you should also change it in
"Share Library Versions", in release_17_11.rst.
Thanks,
Pablo
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH] eal: remove deprecated log functions
@ 2017-10-23 9:56 10% Olivier Matz
0 siblings, 0 replies; 200+ results
From: Olivier Matz @ 2017-10-23 9:56 UTC (permalink / raw)
To: dev; +Cc: thomas
Remove rte_set_log_level(), rte_get_log_level(),
rte_set_log_type(), and rte_get_log_type().
Also update librte_eal.so version in docuementation.
The LIBABIVER variable in eal has already been modified in
commit f26ab687a74f ("eal: remove Xen dom0 support").
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 8 -----
doc/guides/rel_notes/release_17_11.rst | 10 ++++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 ---
lib/librte_eal/common/eal_common_log.c | 40 -------------------------
lib/librte_eal/common/include/rte_log.h | 29 ------------------
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 ---
6 files changed, 9 insertions(+), 86 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 52058f580..0d9925126 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,14 +8,6 @@ API and ABI deprecation notices are to be posted here.
Deprecation Notices
-------------------
-* eal: the following functions are deprecated starting from 17.05 and will
- be removed in 17.11:
-
- - ``rte_set_log_level``, replaced by ``rte_log_set_global_level``
- - ``rte_get_log_level``, replaced by ``rte_log_get_global_level``
- - ``rte_set_log_type``, replaced by ``rte_log_set_level``
- - ``rte_get_log_type``, replaced by ``rte_log_get_level``
-
* eal: several API and ABI changes are planned for ``rte_devargs`` in v17.11.
The format of device command line parameters will change. The bus will need
to be explicitly stated in the device declaration. The enum ``rte_devtype``
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 8db35f5e4..0370aed89 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -283,6 +283,14 @@ API Changes
The function ``rte_cryptodev_allocate_driver()`` has been modified.
An extra parameter ``struct cryptodev_driver *crypto_drv`` has been added.
+* **Removed deprecated functions to manage log level or type.**
+
+ The functions ``rte_set_log_level()``, ``rte_get_log_level()``,
+ ``rte_set_log_type()`` and ``rte_get_log_type()`` have been removed.
+ They are respectively replaced by ``rte_log_set_global_level()``,
+ ``rte_log_get_global_level()``, ``rte_log_set_level()`` and
+ ``rte_log_get_level()``.
+
ABI Changes
-----------
@@ -343,7 +351,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_cmdline.so.2
librte_cryptodev.so.3
librte_distributor.so.1
- librte_eal.so.5
+ + librte_eal.so.6
librte_ethdev.so.8
librte_eventdev.so.3
librte_gro.so.1
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 080896f73..7dc687f88 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -44,8 +44,6 @@ DPDK_2.0 {
rte_free;
rte_get_hpet_cycles;
rte_get_hpet_hz;
- rte_get_log_level;
- rte_get_log_type;
rte_get_tsc_hz;
rte_hexdump;
rte_intr_callback_register;
@@ -78,8 +76,6 @@ DPDK_2.0 {
rte_openlog_stream;
rte_realloc;
rte_set_application_usage_hook;
- rte_set_log_level;
- rte_set_log_type;
rte_socket_id;
rte_strerror;
rte_strsplit;
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index b62b0a6d6..be404136d 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -89,14 +89,6 @@ rte_log_set_global_level(uint32_t level)
rte_logs.level = (uint32_t)level;
}
-/* Set global log level */
-/* replaced by rte_log_set_global_level */
-__rte_deprecated void
-rte_set_log_level(uint32_t level)
-{
- rte_log_set_global_level(level);
-}
-
/* Get global log level */
uint32_t
rte_log_get_global_level(void)
@@ -104,14 +96,6 @@ rte_log_get_global_level(void)
return rte_logs.level;
}
-/* Get global log level */
-/* replaced by rte_log_get_global_level */
-uint32_t
-rte_get_log_level(void)
-{
- return rte_log_get_global_level();
-}
-
int
rte_log_get_level(uint32_t type)
{
@@ -121,30 +105,6 @@ rte_log_get_level(uint32_t type)
return rte_logs.dynamic_types[type].loglevel;
}
-/* Set global log type */
-__rte_deprecated void
-rte_set_log_type(uint32_t type, int enable)
-{
- if (type < RTE_LOGTYPE_FIRST_EXT_ID) {
- if (enable)
- rte_logs.type |= 1 << type;
- else
- rte_logs.type &= ~(1 << type);
- }
-
- if (enable)
- rte_log_set_level(type, 0);
- else
- rte_log_set_level(type, RTE_LOG_DEBUG);
-}
-
-/* Get global log type */
-__rte_deprecated uint32_t
-rte_get_log_type(void)
-{
- return rte_logs.type;
-}
-
int
rte_log_set_level(uint32_t type, uint32_t level)
{
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index 2fa119983..16564d41b 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -139,12 +139,6 @@ int rte_openlog_stream(FILE *f);
void rte_log_set_global_level(uint32_t level);
/**
- * Deprecated, replaced by rte_log_set_global_level().
- */
-__rte_deprecated
-void rte_set_log_level(uint32_t level);
-
-/**
* Get the global log level.
*
* @return
@@ -153,29 +147,6 @@ void rte_set_log_level(uint32_t level);
uint32_t rte_log_get_global_level(void);
/**
- * Deprecated, replaced by rte_log_get_global_level().
- */
-__rte_deprecated
-uint32_t rte_get_log_level(void);
-
-/**
- * Enable or disable the log type.
- *
- * @param type
- * Log type, for example, RTE_LOGTYPE_EAL.
- * @param enable
- * True for enable; false for disable.
- */
-__rte_deprecated
-void rte_set_log_type(uint32_t type, int enable);
-
-/**
- * Get the global log type.
- */
-__rte_deprecated
-uint32_t rte_get_log_type(void);
-
-/**
* Get the log level for a given type.
*
* @param logtype
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index c173ccfdb..8802b288e 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -44,8 +44,6 @@ DPDK_2.0 {
rte_free;
rte_get_hpet_cycles;
rte_get_hpet_hz;
- rte_get_log_level;
- rte_get_log_type;
rte_get_tsc_hz;
rte_hexdump;
rte_intr_callback_register;
@@ -78,8 +76,6 @@ DPDK_2.0 {
rte_openlog_stream;
rte_realloc;
rte_set_application_usage_hook;
- rte_set_log_level;
- rte_set_log_type;
rte_socket_id;
rte_strerror;
rte_strsplit;
--
2.11.0
^ permalink raw reply [relevance 10%]
* Re: [dpdk-dev] [PATCH v2 01/25] ethdev: introduce generic flow API
@ 2017-10-23 8:53 0% ` Zhao1, Wei
0 siblings, 0 replies; 200+ results
From: Zhao1, Wei @ 2017-10-23 8:53 UTC (permalink / raw)
To: Adrien Mazarguil; +Cc: dev, Adrien Mazarguil
Hi, Adrien
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil
> Sent: Saturday, December 17, 2016 12:25 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 01/25] ethdev: introduce generic flow API
>
> This new API supersedes all the legacy filter types described in rte_eth_ctrl.h.
> It is slightly higher level and as a result relies more on PMDs to process and
> validate flow rules.
>
> Benefits:
>
> - A unified API is easier to program for, applications do not have to be
> written for a specific filter type which may or may not be supported by
> the underlying device.
>
> - The behavior of a flow rule is the same regardless of the underlying
> device, applications do not need to be aware of hardware quirks.
>
> - Extensible by design, API/ABI breakage should rarely occur if at all.
>
> - Documentation is self-standing, no need to look up elsewhere.
>
> Existing filter types will be deprecated and removed in the near future.
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> ---
> MAINTAINERS | 4 +
> doc/api/doxy-api-index.md | 2 +
> lib/librte_ether/Makefile | 3 +
> lib/librte_ether/rte_eth_ctrl.h | 1 +
> lib/librte_ether/rte_ether_version.map | 11 +
> lib/librte_ether/rte_flow.c | 159 +++++
> lib/librte_ether/rte_flow.h | 942 ++++++++++++++++++++++++++++
> lib/librte_ether/rte_flow_driver.h | 181 ++++++
> 8 files changed, 1303 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 26d9590..5975cff 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -243,6 +243,10 @@ M: Thomas Monjalon
> <thomas.monjalon@6wind.com>
> F: lib/librte_ether/
> F: scripts/test-null.sh
>
+/**
+ * RTE_FLOW_ACTION_TYPE_RSS
+ *
+ * Similar to QUEUE, except RSS is additionally performed on packets to
+ * spread them among several queues according to the provided parameters.
+ *
+ * Note: RSS hash result is normally stored in the hash.rss mbuf field,
+ * however it conflicts with the MARK action as they share the same
+ * space. When both actions are specified, the RSS hash is discarded
+and
+ * PKT_RX_RSS_HASH is not set in ol_flags. MARK has priority. The mbuf
+ * structure should eventually evolve to store both.
+ *
+ * Terminating by default.
+ */
+struct rte_flow_action_rss {
+ const struct rte_eth_rss_conf *rss_conf; /**< RSS parameters. */
+ uint16_t num; /**< Number of entries in queue[]. */
+ uint16_t queue[]; /**< Queues indices to use. */ };
+
I am plan for moving rss to rte_flow.
May I ask you some question for this struct of rte_flow_action_rss.
1. why do you use pointer mode for rss_conf, why not use " struct rte_eth_rss_conf rss_conf "?
we need to fill these rss info which get from CLI to this struct, if we use the pointer mode, how can we fill in these info?
2. And also why the" const" is not need? We need a const ?How can we config this parameter?
3. what is your expect mode for CLI command for rss config? When I type in :
" flow create 0 pattern eth / tcp / end actions rss queues queue 0 /end "
Or " flow create 0 pattern eth / tcp / end actions rss queues {0 1 2} /end "
I get " Bad arguments ".
So, the right CLI command is ?
Thank you!
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice
@ 2017-10-20 12:31 15% ` Santosh Shukla
2017-10-23 20:29 0% ` Thomas Monjalon
1 sibling, 1 reply; 200+ results
From: Santosh Shukla @ 2017-10-20 12:31 UTC (permalink / raw)
To: dev
Cc: olivier.matz, thomas, jerin.jacob, hemant.agrawal,
anatoly.burakov, Santosh Shukla
Removed dpdk iova aware ABI deprecation notice,
and updated ABI change details in release_17.11.rst.
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 7 -------
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 52058f580..d89d35320 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -29,13 +29,6 @@ Deprecation Notices
- ``rte_eal_devargs_type_count``
- ``rte_eal_parse_devargs_str``, replaced by ``rte_eal_devargs_parse``
-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
- translation scheme.
- Reference to phys address in EAL data-structure or functions may change to
- IOVA address or more appropriate name.
- The change will be only for the name.
- Functional aspects of the API or data-structure will remain same.
-
* The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
are respectively replaced by PKT_RX_VLAN_STRIPPED and
PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 6f3b92bc5..5287e96c3 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -302,6 +302,34 @@ ABI Changes
The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure
changed, as described in the `New Features` section.
+* **Following datatypes, structure member and function renamed to iova type.**
+
+ * Renamed ``phys_addr_t`` to ``iova_addr_t``.
+ * Renamed ``buf_physaddr`` to ``buf_iovaaddr`` for struct rte_mbuf.
+ * Renamed ``phys_addr`` to ``iova_addr`` for struct rte_memseg.
+ * The Following memory translation api renamed from:
+
+ * ``rte_mempool_populate_phys()``
+ * ``rte_mempool_populate_phys_tab()``
+ * ``rte_eal_using_phys_addrs()``
+ * ``rte_mem_virt2phy()``
+ * ``rte_dump_physmem_layout()``
+ * ``rte_eal_get_physmem_layout()``
+ * ``rte_eal_get_physmem_size()``
+ * ``rte_malloc_virt2phy()``
+ * ``rte_mem_phy2mch()``
+
+ * To the following iova types api:
+
+ * ``rte_mempool_populate_iova()``
+ * ``rte_mempool_populate_iova_tab()``
+ * ``rte_eal_using_iova_addrs()``
+ * ``rte_mem_virt2iova()``
+ * ``rte_dump_iovamem_layout()``
+ * ``rte_eal_get_iovamem_layout()``
+ * ``rte_eal_get_iovamem_size()``
+ * ``rte_malloc_virt2iova()``
+ * ``rte_mem_phy2iova()``
Removed Items
-------------
--
2.14.1
^ permalink raw reply [relevance 15%]
* Re: [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes
2017-10-14 0:09 3% [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes Thomas Monjalon
2017-10-16 8:33 0% ` Yang, Zhiyong
@ 2017-10-18 20:57 0% ` Ferruh Yigit
2017-10-23 10:13 0% ` Thomas Monjalon
2017-10-23 10:15 3% ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2017-10-18 20:57 UTC (permalink / raw)
To: Thomas Monjalon, dev
On 10/13/2017 5:09 PM, Thomas Monjalon wrote:
> The libraries which have their ABI version increased in this release
> must be prepended with a + sign to make them appear clearly.
>
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
<...>
> + + librte_pmd_ixgbe.so.2
> librte_pmd_ring.so.2
> + librte_pmd_softnic.so.1
> librte_pmd_vhost.so.2
librte_pmd_vhost.so.2 also requires a "+"
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v2 00/18] devargs cleanup
@ 2017-10-18 8:36 4% ` Gaëtan Rivet
0 siblings, 0 replies; 200+ results
From: Gaëtan Rivet @ 2017-10-18 8:36 UTC (permalink / raw)
To: Aaron Conole; +Cc: dev
On Tue, Oct 17, 2017 at 02:18:02PM -0400, Aaron Conole wrote:
> Gaetan Rivet <gaetan.rivet@6wind.com> writes:
>
> > The use of rte_devargs is inconsistent in the light of new functionalities
> > such as device hotplug.
> >
> > Most of its API is still experimental and needs stabilization.
> > Older functions were deprecated and need to be rewritten or removed.
> > The rte_devtype is meant to disappear.
> >
> > v2:
> >
> > Big rework.
> >
> > * Enact requiring bus name prepended in rte_devargs parsing functions.
> > * Remove rte_devtype. Use new probe mode setter along with generic
> > bus reference within rte_devargs.
> > * Rework devargs parsing API.
> > The function is now variadic, does not enforce bus rules on the devargs
> > being inserted as the bus has been configured previously.
> > Old parsing function is removed.
> > * Expose bus guessing from device name.
> > This uses the "parse" bus operator, which may be meant to disappear.
> > This is optional, but nice to have in a transition period.
> > * Introduce new --dev generic device declaration parameter.
> >
> > This patchset depends on:
>
> It is weird to me that you introduce patch sets, and then introduce
> cleanups later? Shouldn't we revise the existing patchsets?
>
> Maybe I missed a discussion somewhere?
>
No discussion missed :)
The way it happened here was that I started cleaning up the mess I did
last release in the rte_devargs to streamline somewhat the subsystem.
Several things needed to disappear:
1. List of devargs manipulated by buses. With hotplug feature they had
to be properly managed (i.e. freed on device unplug).
2. rte_devtype, which was meant to disappear last release but was kept
to smooth the transition to the new API.
3. Different usages of devargs_add among applications / PMDs
There had been some different last release about the exposed API,
thus I made a compromise that could potentially benefit everyone.
Points 1 and 3 did not require additional work on the buses.
Point 2 however, required a way for buses to be configured in whitelist
/ blacklist mode. To clean up the rte_devtype, a configuration facility
is necessary.
While working on this facility, I found that I was once again breaking
the ABI of rte_bus, along with the IOVA configuration. I thought it
could be streamlined in a more stable way, thus I wrote the separate
patchset for a cleaner integration of these changes in this release.
All in all, the PCI move is not necessary but was sent a few weeks ago
already and it could be skipped with a small rework.
The bus control could be done in a more hackish way as well, without
having a whole separate patchset to introduce the control facility. I
wanted to propose a cleaner approach that could possibly keep the
rte_bus ABI stable for some time.
> > Move PCI away from the EAL
> > http://dpdk.org/ml/archives/dev/2017-August/073512.html
> >
> > Bus control framework
> > http://dpdk.org/ml/archives/dev/2017-October/078752.html
> >
> > Gaetan Rivet (18):
> > eal: prepend busname on legacy device declaration
> > eal: remove generic devtype
> > devargs: introduce iterator
> > devargs: introduce foreach macro
> > vdev: do not reference devargs list
> > bus/pci: do not reference devargs list
> > test: remove devargs unit tests
> > devargs: make devargs list private
> > devargs: make parsing variadic
> > devargs: require bus name prefix
> > devargs: simplify implementation
> > eal: add generic device declaration parameter
> > bus: make device recognition function public
> > net/failsafe: keep legacy sub-device declaration
> > ether: use new devargs parsing function
> > devargs: remove old devargs parsing function
> > devargs: use proper prefix
> > doc: remove devargs deprecation notices
> >
> > MAINTAINERS | 1 -
> > app/test-pmd/cmdline.c | 2 +-
> > doc/guides/rel_notes/deprecation.rst | 13 ---
> > drivers/bus/pci/pci_common.c | 22 +---
> > drivers/net/failsafe/failsafe_args.c | 11 +-
> > examples/bond/main.c | 2 +-
> > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 15 ++-
> > lib/librte_eal/common/eal_common_dev.c | 39 ++-----
> > lib/librte_eal/common/eal_common_devargs.c | 129 +++++++++--------------
> > lib/librte_eal/common/eal_common_options.c | 47 ++++++---
> > lib/librte_eal/common/eal_common_vdev.c | 11 +-
> > lib/librte_eal/common/eal_options.h | 2 +
> > lib/librte_eal/common/include/rte_bus.h | 12 +++
> > lib/librte_eal/common/include/rte_dev.h | 8 --
> > lib/librte_eal/common/include/rte_devargs.h | 120 ++++++++--------------
> > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 15 ++-
> > lib/librte_ether/rte_ethdev.c | 11 +-
> > test/test/Makefile | 1 -
> > test/test/commands.c | 2 +-
> > test/test/test_devargs.c | 131 ------------------------
> > 20 files changed, 186 insertions(+), 408 deletions(-)
> > delete mode 100644 test/test/test_devargs.c
--
Gaëtan Rivet
6WIND
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version
2017-10-16 13:42 3% ` [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version Santosh Shukla
@ 2017-10-17 9:50 0% ` Hemant Agrawal
2017-10-23 14:38 3% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Hemant Agrawal @ 2017-10-17 9:50 UTC (permalink / raw)
To: Santosh Shukla, dev; +Cc: olivier.matz, thomas, jerin.jacob
On 10/16/2017 7:12 PM, Santosh Shukla wrote:
> This commit bumps the library version to reflect the ABI change
> caused by removing the below function from event/octeontx:
> * octeontx_ssovf_info
> * octeontx_ssovf_bar
> * octeontx_ssovf_mbox_send
>
> And moved to mempool/octeontx area.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> ---
> doc/guides/rel_notes/release_17_11.rst | 1 +
> drivers/event/octeontx/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
> index 8db35f5e4..eac2f677a 100644
> --- a/doc/guides/rel_notes/release_17_11.rst
> +++ b/doc/guides/rel_notes/release_17_11.rst
> @@ -377,6 +377,7 @@ The libraries prepended with a plus sign were incremented in this version.
> librte_table.so.2
> librte_timer.so.1
> librte_vhost.so.3
> + librte_pmd_octeontx_ssovf.so.2
>
>
> Tested Platforms
> diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
> index 50434a384..08fc16775 100644
> --- a/drivers/event/octeontx/Makefile
> +++ b/drivers/event/octeontx/Makefile
> @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
>
> EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
>
> -LIBABIVER := 1
> +LIBABIVER := 2
>
> #
> # all source are stored in SRCS-y
>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version
@ 2017-10-16 13:42 3% ` Santosh Shukla
2017-10-17 9:50 0% ` Hemant Agrawal
2017-10-23 14:38 3% ` Thomas Monjalon
0 siblings, 2 replies; 200+ results
From: Santosh Shukla @ 2017-10-16 13:42 UTC (permalink / raw)
To: dev; +Cc: olivier.matz, thomas, jerin.jacob, hemant.agrawal, Santosh Shukla
This commit bumps the library version to reflect the ABI change
caused by removing the below function from event/octeontx:
* octeontx_ssovf_info
* octeontx_ssovf_bar
* octeontx_ssovf_mbox_send
And moved to mempool/octeontx area.
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
doc/guides/rel_notes/release_17_11.rst | 1 +
drivers/event/octeontx/Makefile | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 8db35f5e4..eac2f677a 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -377,6 +377,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_table.so.2
librte_timer.so.1
librte_vhost.so.3
+ librte_pmd_octeontx_ssovf.so.2
Tested Platforms
diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
index 50434a384..08fc16775 100644
--- a/drivers/event/octeontx/Makefile
+++ b/drivers/event/octeontx/Makefile
@@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
-LIBABIVER := 1
+LIBABIVER := 2
#
# all source are stored in SRCS-y
--
2.13.0
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes
2017-10-14 0:09 3% [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes Thomas Monjalon
@ 2017-10-16 8:33 0% ` Yang, Zhiyong
2017-10-18 20:57 0% ` Ferruh Yigit
2017-10-23 10:15 3% ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2 siblings, 0 replies; 200+ results
From: Yang, Zhiyong @ 2017-10-16 8:33 UTC (permalink / raw)
To: Thomas Monjalon, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Saturday, October 14, 2017 8:10 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes
>
> The libraries which have their ABI version increased in this release must be
> prepended with a + sign to make them appear clearly.
>
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes
@ 2017-10-14 0:09 3% Thomas Monjalon
2017-10-16 8:33 0% ` Yang, Zhiyong
` (2 more replies)
0 siblings, 3 replies; 200+ results
From: Thomas Monjalon @ 2017-10-14 0:09 UTC (permalink / raw)
To: dev
The libraries which have their ABI version increased in this release
must be prepended with a + sign to make them appear clearly.
Fixes: f8244c6399d9 ("ethdev: increase port id range")
Fixes: ec51443cc99a ("gso: add Generic Segmentation Offload API framework")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/release_17_11.rst | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 8db35f5e4..1235350e9 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -338,16 +338,16 @@ The libraries prepended with a plus sign were incremented in this version.
.. code-block:: diff
librte_acl.so.2
- librte_bitratestats.so.2
+ + librte_bitratestats.so.2
librte_cfgfile.so.2
librte_cmdline.so.2
librte_cryptodev.so.3
librte_distributor.so.1
librte_eal.so.5
- librte_ethdev.so.8
- librte_eventdev.so.3
+ + librte_ethdev.so.8
+ + librte_eventdev.so.3
librte_gro.so.1
- librte_gso.so.1
+ + librte_gso.so.1
librte_hash.so.2
librte_ip_frag.so.1
librte_jobstats.so.1
@@ -360,12 +360,12 @@ The libraries prepended with a plus sign were incremented in this version.
librte_meter.so.1
librte_metrics.so.1
librte_net.so.1
- librte_pdump.so.2
+ + librte_pdump.so.2
librte_pipeline.so.3
- librte_pmd_bnxt.so.2
- librte_pmd_bond.so.2
- librte_pmd_i40e.so.2
- librte_pmd_ixgbe.so.2
+ + librte_pmd_bnxt.so.2
+ + librte_pmd_bond.so.2
+ + librte_pmd_i40e.so.2
+ + librte_pmd_ixgbe.so.2
librte_pmd_ring.so.2
+ librte_pmd_softnic.so.1
librte_pmd_vhost.so.2
--
2.14.1
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v2] doc: add note on hardware support deprecation
@ 2017-10-13 20:46 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-13 20:46 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, john.mcnamara
18/09/2017 15:59, Bruce Richardson:
> Following agreement at the DPDK Technical Board meeting [1], the policy
> that hardware support deprecation should be treated as though it were an
> ABI break needs to be documented in the contributors guide.
>
> [1] http://dpdk.org/ml/archives/dev/2017-September/074613.html
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: John McNamara <john.mcnamara@intel.com>
Applied, thanks
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH V4 3/5] ethdev: add new api for traffic metering and policing
@ 2017-10-13 12:22 1% ` Cristian Dumitrescu
0 siblings, 0 replies; 200+ results
From: Cristian Dumitrescu @ 2017-10-13 12:22 UTC (permalink / raw)
To: dev
Cc: thomas, adrien.mazarguil, jingjing.wu, john.mcnamara,
hemant.agrawal, jerin.jacob, jasvinder.singh
This patch introduces new ethdev generic API for Traffic Metering and
Policing (MTR), which is yet another standard RX offload for Ethernet
devices.
Similar to rte_flow and rte_tm APIs, the configuration of MTR objects is
done in their own namespace (rte_mtr) within the librte_ether library.
Main features:
1. Traffic metering: determine the color for the current packet (green,
yellow, red) based on history maintained by the MTR object. Supported
algorithms: srTCM (RFC 2697), trTCM (RFC 2698 and RFC 4115).
2. Policing (per meter output color actions): re-color the packet (keep
or change the meter output color) or drop the packet.
3. Statistics
4. Capability API
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
Changes in v4:
- Input from Hemant:
- Added the NONE metering algorithm for meter pass-through mode
- Reordered stats counter types per pkt and per byte
- Copyright cosmetics
- Updated ethdev port_id from uint8_t to uint16_t
Changes in v3:
- None
Changes in v2:
- Implemented input from Hemant:
- Added support for RFC 4115 trTCM algorithm
- Added support for meter pass-through mode: see API functions
rte_mtr_meter_enable() and rte_mtr_meter_disable()
- Implemented input from Jerin:
- Added capability API
- Implemented input from Thomas:
- Added new API functions under the EXPERIMENTAL section in map file
- Improved the mechanism for MTR object chaining: each MTR object can be
configured whther to read input color from a previous MTR object in the
same flow (if any) of from DSCP traslation table
- Improved run-time update functions
- Doxygen: added more descriptions, small fixes
Changes in v1 (from RFC [1]):
- Implemented input from Thomas:
- Added EXPERIMENTAL tag in rte_mtr.h and MANTAINERS for this new API
- Implemented input from Adrien:
- Added more Doxygen comments to re-inforce relationship between MTR and
flow
- Doxygen: added hook in doxy-api-index.md
[1] RFC: http://www.dpdk.org/ml/archives/dev/2017-May/066888.html
MAINTAINERS | 4 +
doc/api/doxy-api-index.md | 1 +
lib/librte_ether/Makefile | 3 +
lib/librte_ether/rte_ethdev_version.map | 18 +
lib/librte_ether/rte_mtr.c | 229 ++++++++++
lib/librte_ether/rte_mtr.h | 730 ++++++++++++++++++++++++++++++++
lib/librte_ether/rte_mtr_driver.h | 221 ++++++++++
7 files changed, 1206 insertions(+)
create mode 100644 lib/librte_ether/rte_mtr.c
create mode 100644 lib/librte_ether/rte_mtr.h
create mode 100644 lib/librte_ether/rte_mtr_driver.h
diff --git a/MAINTAINERS b/MAINTAINERS
index c00d6d8..464ebac 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -255,6 +255,10 @@ M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
T: git://dpdk.org/next/dpdk-next-tm
F: lib/librte_ether/rte_tm*
+Traffic Metering and Policing API - EXPERIMENTAL
+M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
+F: lib/librte_ether/rte_mtr*
+
Crypto API
M: Declan Doherty <declan.doherty@intel.com>
F: lib/librte_cryptodev/
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 990815f..07d6f4a 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[ethctrl] (@ref rte_eth_ctrl.h),
[rte_flow] (@ref rte_flow.h),
[rte_tm] (@ref rte_tm.h),
+ [rte_mtr] (@ref rte_mtr.h),
[cryptodev] (@ref rte_cryptodev.h),
[eventdev] (@ref rte_eventdev.h),
[event_eth_rx_adapter] (@ref rte_event_eth_rx_adapter.h),
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index edcddf7..b2a93bf 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -46,6 +46,7 @@ LIBABIVER := 8
SRCS-y += rte_ethdev.c
SRCS-y += rte_flow.c
SRCS-y += rte_tm.c
+SRCS-y += rte_mtr.c
SRCS-y += ethdev_profile.c
#
@@ -60,5 +61,7 @@ SYMLINK-y-include += rte_flow.h
SYMLINK-y-include += rte_flow_driver.h
SYMLINK-y-include += rte_tm.h
SYMLINK-y-include += rte_tm_driver.h
+SYMLINK-y-include += rte_mtr.h
+SYMLINK-y-include += rte_mtr_driver.h
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map
index e27f596..bc0bbc5 100644
--- a/lib/librte_ether/rte_ethdev_version.map
+++ b/lib/librte_ether/rte_ethdev_version.map
@@ -196,3 +196,21 @@ DPDK_17.11 {
rte_flow_error_set;
} DPDK_17.08;
+
+EXPERIMENTAL {
+ global:
+
+ rte_mtr_capabilities_get;
+ rte_mtr_meter_profile_add;
+ rte_mtr_meter_profile_delete;
+ rte_mtr_create;
+ rte_mtr_destroy;
+ rte_mtr_meter_enable;
+ rte_mtr_meter_disable;
+ rte_mtr_meter_profile_update;
+ rte_mtr_meter_dscp_table_update;
+ rte_mtr_policer_actions_update;
+ rte_mtr_stats_update;
+ rte_mtr_stats_read;
+
+} DPDK_17.11;
diff --git a/lib/librte_ether/rte_mtr.c b/lib/librte_ether/rte_mtr.c
new file mode 100644
index 0000000..4f56f87
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.c
@@ -0,0 +1,229 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr_driver.h"
+#include "rte_mtr.h"
+
+/* Get generic traffic metering & policing operations structure from a port. */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ const struct rte_mtr_ops *ops;
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ rte_mtr_error_set(error,
+ ENODEV,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENODEV));
+ return NULL;
+ }
+
+ if ((dev->dev_ops->mtr_ops_get == NULL) ||
+ (dev->dev_ops->mtr_ops_get(dev, &ops) != 0) ||
+ (ops == NULL)) {
+ rte_mtr_error_set(error,
+ ENOSYS,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENOSYS));
+ return NULL;
+ }
+
+ return ops;
+}
+
+#define RTE_MTR_FUNC(port_id, func) \
+({ \
+ const struct rte_mtr_ops *ops = \
+ rte_mtr_ops_get(port_id, error); \
+ if (ops == NULL) \
+ return -rte_errno; \
+ \
+ if (ops->func == NULL) \
+ return -rte_mtr_error_set(error, \
+ ENOSYS, \
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, \
+ NULL, \
+ rte_strerror(ENOSYS)); \
+ \
+ ops->func; \
+})
+
+/* MTR capabilities get */
+int
+rte_mtr_capabilities_get(uint16_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, capabilities_get)(dev,
+ cap, error);
+}
+
+/* MTR meter profile add */
+int
+rte_mtr_meter_profile_add(uint16_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_add)(dev,
+ meter_profile_id, profile, error);
+}
+
+/** MTR meter profile delete */
+int
+rte_mtr_meter_profile_delete(uint16_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_delete)(dev,
+ meter_profile_id, error);
+}
+
+/** MTR object create */
+int
+rte_mtr_create(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, create)(dev,
+ mtr_id, params, shared, error);
+}
+
+/** MTR object destroy */
+int
+rte_mtr_destroy(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, destroy)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter enable */
+int
+rte_mtr_meter_enable(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_enable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter disable */
+int
+rte_mtr_meter_disable(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_disable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter profile update */
+int
+rte_mtr_meter_profile_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_update)(dev,
+ mtr_id, meter_profile_id, error);
+}
+
+/** MTR object meter DSCP table update */
+int
+rte_mtr_meter_dscp_table_update(uint16_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_dscp_table_update)(dev,
+ mtr_id, dscp_table, error);
+}
+
+/** MTR object policer action update */
+int
+rte_mtr_policer_actions_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, policer_actions_update)(dev,
+ mtr_id, action_mask, actions, error);
+}
+
+/** MTR object enabled stats update */
+int
+rte_mtr_stats_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_update)(dev,
+ mtr_id, stats_mask, error);
+}
+
+/** MTR object stats read */
+int
+rte_mtr_stats_read(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_read)(dev,
+ mtr_id, stats, stats_mask, clear, error);
+}
diff --git a/lib/librte_ether/rte_mtr.h b/lib/librte_ether/rte_mtr.h
new file mode 100644
index 0000000..f6b6ef3
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.h
@@ -0,0 +1,730 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright 2017 Intel Corporation
+ * Copyright 2017 NXP
+ * Copyright 2017 Cavium
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_H__
+#define __INCLUDE_RTE_MTR_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API
+ *
+ * This interface provides the ability to configure the traffic metering and
+ * policing (MTR) in a generic way.
+ *
+ * The processing done for each input packet hitting a MTR object is:
+ * A) Traffic metering: The packet is assigned a color (the meter output
+ * color), based on the previous history of the flow reflected in the
+ * current state of the MTR object, according to the specific traffic
+ * metering algorithm. The traffic metering algorithm can typically work
+ * in color aware mode, in which case the input packet already has an
+ * initial color (the input color), or in color blind mode, which is
+ * equivalent to considering all input packets initially colored as green.
+ * B) Policing: There is a separate policer action configured for each meter
+ * output color, which can:
+ * a) Drop the packet.
+ * b) Keep the same packet color: the policer output color matches the
+ * meter output color (essentially a no-op action).
+ * c) Recolor the packet: the policer output color is different than
+ * the meter output color.
+ * The policer output color is the output color of the packet, which is
+ * set in the packet meta-data (i.e. struct rte_mbuf::sched::color).
+ * C) Statistics: The set of counters maintained for each MTR object is
+ * configurable and subject to the implementation support. This set
+ * includes the number of packets and bytes dropped or passed for each
+ * output color.
+ *
+ * Once successfully created, an MTR object is linked to one or several flows
+ * through the meter action of the flow API.
+ * A) Whether an MTR object is private to a flow or potentially shared by
+ * several flows has to be specified at creation time.
+ * B) Several meter actions can be potentially registered for the same flow.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ */
+#include <stdint.h>
+
+#include <rte_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Color
+ */
+enum rte_mtr_color {
+ RTE_MTR_GREEN = 0, /**< Green */
+ RTE_MTR_YELLOW, /**< Yellow */
+ RTE_MTR_RED, /**< Red */
+ RTE_MTR_COLORS /**< Number of colors. */
+};
+
+/**
+ * Statistics counter type
+ */
+enum rte_mtr_stats_type {
+ /** Number of packets passed as green by the policer. */
+ RTE_MTR_STATS_N_PKTS_GREEN = 1 << 0,
+
+ /** Number of packets passed as yellow by the policer. */
+ RTE_MTR_STATS_N_PKTS_YELLOW = 1 << 1,
+
+ /** Number of packets passed as red by the policer. */
+ RTE_MTR_STATS_N_PKTS_RED = 1 << 2,
+
+ /** Number of packets dropped by the policer. */
+ RTE_MTR_STATS_N_PKTS_DROPPED = 1 << 3,
+
+ /** Number of bytes passed as green by the policer. */
+ RTE_MTR_STATS_N_BYTES_GREEN = 1 << 4,
+
+ /** Number of bytes passed as yellow by the policer. */
+ RTE_MTR_STATS_N_BYTES_YELLOW = 1 << 5,
+
+ /** Number of bytes passed as red by the policer. */
+ RTE_MTR_STATS_N_BYTES_RED = 1 << 6,
+
+ /** Number of bytes dropped by the policer. */
+ RTE_MTR_STATS_N_BYTES_DROPPED = 1 << 7,
+};
+
+/**
+ * Statistics counters
+ */
+struct rte_mtr_stats {
+ /** Number of packets passed by the policer (per color). */
+ uint64_t n_pkts[RTE_MTR_COLORS];
+
+ /** Number of bytes passed by the policer (per color). */
+ uint64_t n_bytes[RTE_MTR_COLORS];
+
+ /** Number of packets dropped by the policer. */
+ uint64_t n_pkts_dropped;
+
+ /** Number of bytes passed by the policer. */
+ uint64_t n_bytes_dropped;
+};
+
+/**
+ * Traffic metering algorithms
+ */
+enum rte_mtr_algorithm {
+ /** No traffic metering performed, the output color is the same as the
+ * input color for every input packet. The meter of the MTR object is
+ * working in pass-through mode, having same effect as meter disable.
+ * @see rte_mtr_meter_disable()
+ */
+ RTE_MTR_NONE = 0,
+
+ /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
+ RTE_MTR_SRTCM_RFC2697,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
+ RTE_MTR_TRTCM_RFC2698,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
+ RTE_MTR_TRTCM_RFC4115,
+};
+
+/**
+ * Meter profile
+ */
+struct rte_mtr_meter_profile {
+ /** Traffic metering algorithm. */
+ enum rte_mtr_algorithm alg;
+
+ RTE_STD_C11
+ union {
+ /** Items only valid when *alg* is set to srTCM - RFC 2697. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Committed Burst Size (CBS) (bytes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } srtcm_rfc2697;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 2698. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Peak Information Rate (PIR) (bytes/second). */
+ uint64_t pir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Peak Burst Size (PBS) (bytes). */
+ uint64_t pbs;
+ } trtcm_rfc2698;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 4115. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Excess Information Rate (EIR) (bytes/second). */
+ uint64_t eir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } trtcm_rfc4115;
+ };
+};
+
+/**
+ * Policer actions
+ */
+enum rte_mtr_policer_action {
+ /** Recolor the packet as green. */
+ MTR_POLICER_ACTION_COLOR_GREEN = 0,
+
+ /** Recolor the packet as yellow. */
+ MTR_POLICER_ACTION_COLOR_YELLOW,
+
+ /** Recolor the packet as red. */
+ MTR_POLICER_ACTION_COLOR_RED,
+
+ /** Drop the packet. */
+ MTR_POLICER_ACTION_DROP,
+};
+
+/**
+ * Parameters for each traffic metering & policing object
+ *
+ * @see enum rte_mtr_stats_type
+ */
+struct rte_mtr_params {
+ /** Meter profile ID. */
+ uint32_t meter_profile_id;
+
+ /** Meter input color in case of MTR object chaining. When non-zero: if
+ * a previous MTR object is enabled in the same flow, then the color
+ * determined by the latest MTR object in the same flow is used as the
+ * input color by the current MTR object, otherwise the current MTR
+ * object uses the *dscp_table* to determine the input color. When zero:
+ * the color determined by any previous MTR object in same flow is
+ * ignored by the current MTR object, which uses the *dscp_table* to
+ * determine the input color.
+ */
+ int use_prev_mtr_color;
+
+ /** Meter input color. When non-NULL: it points to a pre-allocated and
+ * pre-populated table with exactly 64 elements providing the input
+ * color for each value of the IPv4/IPv6 Differentiated Services Code
+ * Point (DSCP) input packet field. When NULL: it is equivalent to
+ * setting this parameter to an all-green populated table (i.e. table
+ * with all the 64 elements set to green color). The color blind mode
+ * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
+ * to either NULL or to an all-green populated table. When
+ * *use_prev_mtr_color* is non-zero value or when *dscp_table* contains
+ * at least one yellow or red color element, then the color aware mode
+ * is configured.
+ */
+ enum rte_mtr_color *dscp_table;
+
+ /** Non-zero to enable the meter, zero to disable the meter at the time
+ * of MTR object creation. Ignored when the meter profile indicated by
+ * *meter_profile_id* is set to NONE.
+ * @see rte_mtr_meter_disable()
+ */
+ int meter_enable;
+
+ /** Policer actions (per meter output color). */
+ enum rte_mtr_policer_action action[RTE_MTR_COLORS];
+
+ /** Set of stats counters to be enabled.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * MTR capabilities
+ */
+struct rte_mtr_capabilities {
+ /** Maximum number of MTR objects. */
+ uint32_t n_max;
+
+ /** Maximum number of MTR objects that can be shared by multiple flows.
+ * The value of zero indicates that shared MTR objects are not
+ * supported. The maximum value is *n_max*.
+ */
+ uint32_t n_shared_max;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * cannot be shared by multiple flows have identical capability set.
+ */
+ int identical;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * can be shared by multiple flows have identical capability set.
+ */
+ int shared_identical;
+
+ /** Maximum number of flows that can share the same MTR object. The
+ * value of zero is invalid. The value of 1 means that shared MTR
+ * objects not supported.
+ */
+ uint32_t shared_n_flows_per_mtr_max;
+
+ /** Maximum number of MTR objects that can be part of the same flow. The
+ * value of zero is invalid. The value of 1 indicates that MTR object
+ * chaining is not supported. The maximum value is *n_max*.
+ */
+ uint32_t chaining_n_mtrs_per_flow_max;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object can be used as the packet input color by any subsequent
+ * MTR object from the same flow. When zero, it indicates that the color
+ * determined by one MTR object is always ignored by any subsequent MTR
+ * object from the same flow. Only valid when MTR chaining is supported,
+ * i.e. *chaining_n_mtrs_per_flow_max* is greater than 1. When non-zero,
+ * it also means that the color aware mode is supported by at least one
+ * metering algorithm.
+ */
+ int chaining_use_prev_mtr_color_supported;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object is always used as the packet input color by any subsequent
+ * MTR object that is part of the same flow. When zero, it indicates
+ * that whether the color determined by one MTR object is either ignored
+ * or used as the packet input color by any subsequent MTR object from
+ * the same flow is individually configurable for each MTR object. Only
+ * valid when *chaining_use_prev_mtr_color_supported* is non-zero.
+ */
+ int chaining_use_prev_mtr_color_enforced;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the srTCM RFC 2697 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_srtcm_rfc2697_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 2698 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc2698_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 4115 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc4115_n_max;
+
+ /** Maximum traffic rate that can be metered by a single MTR object. For
+ * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
+ * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
+ * value for the sum of PIR and EIR rates.
+ */
+ uint64_t meter_rate_max;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the srTCM RFC 2697 metering algorithm.
+ */
+ int color_aware_srtcm_rfc2697_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 2698 metering algorithm.
+ */
+ int color_aware_trtcm_rfc2698_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 4115 metering algorithm.
+ */
+ int color_aware_trtcm_rfc4115_supported;
+
+ /** When non-zero, it indicates that the policer packet recolor actions
+ * are supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_recolor_supported;
+
+ /** When non-zero, it indicates that the policer packet drop action is
+ * supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_drop_supported;
+
+ /** Set of supported statistics counter types.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * Verbose error types.
+ *
+ * Most of them provide the type of the object referenced by struct
+ * rte_mtr_error::cause.
+ */
+enum rte_mtr_error_type {
+ RTE_MTR_ERROR_TYPE_NONE, /**< No error. */
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
+ RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
+ RTE_MTR_ERROR_TYPE_METER_PROFILE,
+ RTE_MTR_ERROR_TYPE_MTR_ID,
+ RTE_MTR_ERROR_TYPE_MTR_PARAMS,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
+ RTE_MTR_ERROR_TYPE_STATS_MASK,
+ RTE_MTR_ERROR_TYPE_STATS,
+ RTE_MTR_ERROR_TYPE_SHARED,
+};
+
+/**
+ * Verbose error structure definition.
+ *
+ * This object is normally allocated by applications and set by PMDs, the
+ * message points to a constant string which does not need to be freed by
+ * the application, however its pointer can be considered valid only as long
+ * as its associated DPDK port remains configured. Closing the underlying
+ * device or unloading the PMD invalidates it.
+ *
+ * Both cause and message may be NULL regardless of the error type.
+ */
+struct rte_mtr_error {
+ enum rte_mtr_error_type type; /**< Cause field and error type. */
+ const void *cause; /**< Object responsible for the error. */
+ const char *message; /**< Human-readable error message. */
+};
+
+/**
+ * MTR capabilities get
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] cap
+ * MTR capabilities. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_capabilities_get(uint16_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile add
+ *
+ * Create a new meter profile with ID set to *meter_profile_id*. The new profile
+ * is used to create one or several MTR objects.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * ID for the new meter profile. Needs to be unused by any of the existing
+ * meter profiles added for the current port.
+ * @param[in] profile
+ * Meter profile parameters. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_add(uint16_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile delete
+ *
+ * Delete an existing meter profile. This operation fails when there is
+ * currently at least one user (i.e. MTR object) of this profile.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * Meter profile ID. Needs to be the valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_delete(uint16_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object create
+ *
+ * Create a new MTR object for the current port. This object is run as part of
+ * associated flow action for traffic metering and policing.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be unused by any of the existing MTR objects.
+ * created for the current port.
+ * @param[in] params
+ * MTR object params. Needs to be pre-allocated and valid.
+ * @param[in] shared
+ * Non-zero when this MTR object can be shared by multiple flows, zero when
+ * this MTR object can be used by a single flow.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_flow_action_type::RTE_FLOW_ACTION_TYPE_METER
+ */
+int
+rte_mtr_create(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object destroy
+ *
+ * Delete an existing MTR object. This operation fails when there is currently
+ * at least one user (i.e. flow) of this MTR object.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * created for the current port.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_destroy(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter disable
+ *
+ * Disable the meter of an existing MTR object. In disabled state, the meter of
+ * the current MTR object works in pass-through mode, meaning that for each
+ * input packet the meter output color is always the same as the input color. In
+ * particular, when the meter of the current MTR object is configured in color
+ * blind mode, the input color is always green, so the meter output color is
+ * also always green. Note that the policer and the statistics of the current
+ * MTR object are working as usual while the meter is disabled. No action is
+ * taken and this function returns successfully when the meter of the current
+ * MTR object is already disabled.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_disable(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter enable
+ *
+ * Enable the meter of an existing MTR object. If the MTR object has its meter
+ * already enabled, then no action is taken and this function returns
+ * successfully.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_enable(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter profile update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] meter_profile_id
+ * Meter profile ID for the current MTR object. Needs to be valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object DSCP table update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] dscp_table
+ * When non-NULL: it points to a pre-allocated and pre-populated table with
+ * exactly 64 elements providing the input color for each value of the
+ * IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field.
+ * When NULL: it is equivalent to setting this parameter to an “all-green”
+ * populated table (i.e. table with all the 64 elements set to green color).
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_dscp_table_update(uint16_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object policer actions update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] action_mask
+ * Bit mask indicating which policer actions need to be updated. One or more
+ * policer actions can be updated in a single function invocation. To update
+ * the policer action associated with color C, bit (1 << C) needs to be set in
+ * *action_mask* and element at position C in the *actions* array needs to be
+ * valid.
+ * @param[in] actions
+ * Pre-allocated and pre-populated array of policer actions.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_policer_actions_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object enabled statistics counters update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] stats_mask
+ * Mask of statistics counter types to be enabled for the current MTR object.
+ * Any statistics counter type not included in this set is to be disabled for
+ * the current MTR object.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_update(uint16_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object statistics counters read
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[out] stats
+ * When non-NULL, it contains the current value for the statistics counters
+ * enabled for the current MTR object.
+ * @param[out] stats_mask
+ * When non-NULL, it contains the mask of statistics counter types that are
+ * currently enabled for this MTR object, indicating which of the counters
+ * retrieved with the *stats* structure are valid.
+ * @param[in] clear
+ * When this parameter has a non-zero value, the statistics counters are
+ * cleared (i.e. set to zero) immediately after they have been read,
+ * otherwise the statistics counters are left untouched.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_read(uint16_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_H__ */
diff --git a/lib/librte_ether/rte_mtr_driver.h b/lib/librte_ether/rte_mtr_driver.h
new file mode 100644
index 0000000..6a289ef
--- /dev/null
+++ b/lib/librte_ether/rte_mtr_driver.h
@@ -0,0 +1,221 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_DRIVER_H__
+#define __INCLUDE_RTE_MTR_DRIVER_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API (Driver Side)
+ *
+ * This file provides implementation helpers for internal use by PMDs, they
+ * are not intended to be exposed to applications and are not subject to ABI
+ * versioning.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int (*rte_mtr_capabilities_get_t)(struct rte_eth_dev *dev,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+/**< @internal MTR capabilities get */
+
+typedef int (*rte_mtr_meter_profile_add_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile add */
+
+typedef int (*rte_mtr_meter_profile_delete_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile delete */
+
+typedef int (*rte_mtr_create_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+/**< @internal MTR object create */
+
+typedef int (*rte_mtr_destroy_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object destroy */
+
+typedef int (*rte_mtr_meter_enable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter enable */
+
+typedef int (*rte_mtr_meter_disable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter disable */
+
+typedef int (*rte_mtr_meter_profile_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter profile update */
+
+typedef int (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter DSCP table update */
+
+typedef int (*rte_mtr_policer_actions_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+/**< @internal MTR object policer action update*/
+
+typedef int (*rte_mtr_stats_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+/**< @internal MTR object enabled stats update */
+
+typedef int (*rte_mtr_stats_read_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+/**< @internal MTR object stats read */
+
+struct rte_mtr_ops {
+ /** MTR capabilities get */
+ rte_mtr_capabilities_get_t capabilities_get;
+
+ /** MTR meter profile add */
+ rte_mtr_meter_profile_add_t meter_profile_add;
+
+ /** MTR meter profile delete */
+ rte_mtr_meter_profile_delete_t meter_profile_delete;
+
+ /** MTR object create */
+ rte_mtr_create_t create;
+
+ /** MTR object destroy */
+ rte_mtr_destroy_t destroy;
+
+ /** MTR object meter enable */
+ rte_mtr_meter_enable_t meter_enable;
+
+ /** MTR object meter disable */
+ rte_mtr_meter_disable_t meter_disable;
+
+ /** MTR object meter profile update */
+ rte_mtr_meter_profile_update_t meter_profile_update;
+
+ /** MTR object meter DSCP table update */
+ rte_mtr_meter_dscp_table_update_t meter_dscp_table_update;
+
+ /** MTR object policer action update */
+ rte_mtr_policer_actions_update_t policer_actions_update;
+
+ /** MTR object enabled stats update */
+ rte_mtr_stats_update_t stats_update;
+
+ /** MTR object stats read */
+ rte_mtr_stats_read_t stats_read;
+};
+
+/**
+ * Initialize generic error structure.
+ *
+ * This function also sets rte_errno to a given value.
+ *
+ * @param[out] error
+ * Pointer to error structure (may be NULL).
+ * @param[in] code
+ * Related error code (rte_errno).
+ * @param[in] type
+ * Cause field and error type.
+ * @param[in] cause
+ * Object responsible for the error.
+ * @param[in] message
+ * Human-readable error message.
+ *
+ * @return
+ * Error code.
+ */
+static inline int
+rte_mtr_error_set(struct rte_mtr_error *error,
+ int code,
+ enum rte_mtr_error_type type,
+ const void *cause,
+ const char *message)
+{
+ if (error) {
+ *error = (struct rte_mtr_error){
+ .type = type,
+ .cause = cause,
+ .message = message,
+ };
+ }
+ rte_errno = code;
+ return code;
+}
+
+/**
+ * Get generic traffic metering and policing operations structure from a port
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] error
+ * Error details
+ *
+ * @return
+ * The traffic metering and policing operations structure associated with
+ * port_id on success, NULL otherwise.
+ */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_DRIVER_H__ */
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v7 1/4] cryptodev: remove crypto vdev init API
@ 2017-10-13 11:51 4% ` Jianfeng Tan
2017-10-23 10:06 3% ` De Lara Guarch, Pablo
0 siblings, 1 reply; 200+ results
From: Jianfeng Tan @ 2017-10-13 11:51 UTC (permalink / raw)
To: dev
Cc: jblunck, bruce.richardson, konstantin.ananyev,
pablo.de.lara.guarch, thomas, yliu, maxime.coquelin, mtetsuyah,
ferruh.yigit, Jianfeng Tan
Remove rte_cryptodev_create_vdev() for duplication.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_17_11.rst | 2 ++
lib/librte_cryptodev/Makefile | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 6 ------
lib/librte_cryptodev/rte_cryptodev.h | 17 -----------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
6 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index f4269f0..85a9287 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -78,11 +78,6 @@ Deprecation Notices
``rte_cryptodev`` respectively to support security protocol offloaded
operations.
-* cryptodev: the following function is deprecated starting from 17.08 and will
- be removed in 17.11:
-
- - ``rte_cryptodev_create_vdev``
-
* cryptodev: the following function will be static in 17.11 and included
by all crypto drivers, therefore, will not be public:
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 6a75ae0..6b405af 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -183,6 +183,8 @@ API Changes
* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
remove this API as Xen dom0 support was removed.
+* ``rte_cryptodev_create_vdev`` was removed to avoid the dependency on vdev
+ in librte_cryptodev; instead, users can call rte_vdev_init() directly.
ABI Changes
-----------
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 59d9a4e..47f466d 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_cryptodev.a
# library version
-LIBABIVER := 3
+LIBABIVER := 4
# build flags
CFLAGS += -O3
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 5e8f7f4..f2c55cc 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -377,12 +377,6 @@ rte_cryptodev_get_feature_name(uint64_t flag)
}
}
-int
-rte_cryptodev_create_vdev(const char *name, const char *args)
-{
- return rte_vdev_init(name, args);
-}
-
struct rte_cryptodev *
rte_cryptodev_pmd_get_dev(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index ad97ff9..c5d6939 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -433,23 +433,6 @@ struct rte_cryptodev_stats {
/**< Max length of name of crypto PMD */
/**
- * @deprecated
- *
- * Create a virtual crypto device
- *
- * @param name Cryptodev PMD name of device to be created.
- * @param args Options arguments for device.
- *
- * @return
- * - On successful creation of the cryptodev the device index is returned,
- * which will be between 0 and rte_cryptodev_count().
- * - In the case of a failure, returns -1.
- */
-__rte_deprecated
-extern int
-rte_cryptodev_create_vdev(const char *name, const char *args);
-
-/**
* Get the device identifier for the named crypto device.
*
* @param name device name to select the device structure.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index abdbbda..b07f4ca 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -7,7 +7,6 @@ DPDK_16.04 {
rte_cryptodev_close;
rte_cryptodev_count;
rte_cryptodev_configure;
- rte_cryptodev_create_vdev;
rte_cryptodev_get_dev_id;
rte_cryptodev_get_feature_name;
rte_cryptodev_info_get;
--
2.7.4
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper
2017-10-11 19:05 5% ` Aaron Conole
2017-10-12 13:37 4% ` Neil Horman
@ 2017-10-12 14:02 5% ` Adrien Mazarguil
1 sibling, 0 replies; 200+ results
From: Adrien Mazarguil @ 2017-10-12 14:02 UTC (permalink / raw)
To: Aaron Conole
Cc: Thomas Monjalon, dev, Ferruh Yigit, Gaetan Rivet, fbl, Neil Horman
On Wed, Oct 11, 2017 at 03:05:47PM -0400, Aaron Conole wrote:
> Adrien Mazarguil <adrien.mazarguil@6wind.com> writes:
>
> > On Wed, Oct 11, 2017 at 11:23:12AM +0200, Thomas Monjalon wrote:
> >> 05/10/2017 11:49, Adrien Mazarguil:
> >> > rte_flow_error_set() is a convenient helper to initialize error objects.
> >> >
> >> > Since there is no fundamental reason to prevent applications from using it,
> >> > expose it through the public interface after modifying its return value
> >> > from positive to negative. This is done for consistency with the rest of
> >> > the public interface.
> >> >
> >> > Documentation is updated accordingly.
> >> >
> >> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> >> > ---
> >> > --- a/lib/librte_ether/rte_flow.h
> >> > +++ b/lib/librte_ether/rte_flow.h
> >> > /**
> >> > + * Initialize flow error structure.
> >> > + *
> >> > + * @param[out] error
> >> > + * Pointer to flow error structure (may be NULL).
> >> > + * @param code
> >> > + * Related error code (rte_errno).
> >> > + * @param type
> >> > + * Cause field and error types.
> >> > + * @param cause
> >> > + * Object responsible for the error.
> >> > + * @param message
> >> > + * Human-readable error message.
> >> > + *
> >> > + * @return
> >> > + * Negative error code (errno value) and rte_errno is set.
> >> > + */
> >> > +static inline int
> >> > +rte_flow_error_set(struct rte_flow_error *error,
> >> > + int code,
> >> > + enum rte_flow_error_type type,
> >> > + const void *cause,
> >> > + const char *message)
> >>
> >> When calling this function, the performance is not critical.
> >> So it must not be an inline function.
> >> Please move it to the .c file and add it to the .map file.
> >
> > I'll do it as part of moving this patch into my upcoming series for mlx4,
> > since it relies on the new return value.
> >
> > Now for the record, I believe that static inlines, particularly short ones
> > that are not expected to be modified any time soon (provided they are
> > defined properly that is) are harmless.
> >
> > Yes, that means modifying them, depending on what they do, may cause a
> > global ABI breakage of the underlying library which translates to a major
> > version bump, however exactly the same applies to some macros (in particular
> > the *_MAX ones), structure and other type definitions and so on.
>
> Sure. I think if it's small and there's never a chance for it to
> change, then it's okay. But, as you point out - they are similar to
> macros in that they are code directly added to the application. There
> is never a way to fix a bug or adjust some semantic behavior without
> requiring a recompile. That's a strong kind of binding. Certainly we
> would want that communicated as ABI, regardless of which .h/.c file the
> function exists, yes?
Yes, I entirely agree, I must admit the stated reasons behind my previous
message weren't super clear to begin with as I wrote it after some off-list
discussion.
My point is that static inlines must not be considered harmful for what they
are particularly in a project like DPDK where there is almost always a
performance trade-off depending on the use case. They must be considered on
a case basis, and not be forbidden outright with no possible discussion.
> > What I'm getting at is, making this function part of the .map file won't
> > help all that much with the goal of reaching a stable ABI. Making it a
> > normal function on the other hand successfully prevents PMDs and
> > applications from considering its use in their data plane (flow rules
> > management from the data plane is likely the next step for rte_flow).
>
> I don't understand this point well. There are two things - committing
> to a stable ABI, and communicating information about that ABI. Having
> .map files doesn't do anything for a stable ABI. It merely
> communicates information. The stability must come from the developer
> community and maintainers.
Right, nothing against that. I was referring to the fact the .map file in
the case of a shared libray helps with ABI breakage by providing a kind of
run-time error check that ensures an application compiled against an older
version of a symbol is prevented from starting at all, thereby avoiding any
adverse effects later on.
However to benefit from that, some sort of symbol is necessary and that's
only possible on non-inline functions. Since we agree that this, in itself,
doesn't guarantee ABI stability due to other mandatory factors, I think it
cannot be the only ammunition to use against inline functions. Everything
must be considered.
> > In my opinion, performance (even if hypothetical) matters more than ABI
> > stability, particularly since the current pattern is for the whole ABI to be
> > broken every other release. I think that with DPDK, ABI stability can only
> > be properly guaranteed in stable/maintenance releases but that effort is
> > vain in the master branch, affected by way too many changes for it to ever
> > become reality. This doesn't mean we shouldn't even try, however we
> > shouldn't restrict ourselves; when the ABI needs to be broken, so be it.
>
> First, performance isn't hypothetical. You have code which performs,
> and have measured various metrics to show this, or you don't have data.
> No voodoo required. Hypothetical isn't even an argument when it comes
> to predictable devices (like computers). In the case above, you have a
> non-performance critical function. It's an error function. It passes
> strings around. Performance cannot be a consideration here.
>
> Second, it depends on where you want to view the boundary. If a change is
> internal to DPDK (meaning, the application is never expected to interact
> with that area of code), then it shouldn't be part of ABI and changing
> it to your hearts content should be fine.
For the specific case of this function, it basically initializes a
structure. Now that's probably just me, but I believe initializers are a
nice thing to have inline so the compiler can optimize them away wherever it
thinks it's worth a few CPU cycles, somewhat like optimized memcpy's (that
was the possible performance gain I was thinking about).
This function should only change if the target structure changes, the ABI
breakage requiring the major ABI version bump in that case comes from the
structure change, not from the inline function itself.
You have a point with the fact the main change from the original code is the
return value sign update due to bad design. Had it been non-inline, only the
resulting symbol version would have changed, not that of the entire ABI.
Fortunately for this specific case again, that function was neither
versioned nor part of the public facing API until this commit. It would have
been an entirely different story otherwise.
> *rant-on*
>
> I see lots of projects which use DPDK, but I only know of three or so
> projects which don't directly embed a copy of the DPDK source
> tree. I think this is a side effect of not having a stable ABI - it's
> not possible to rely on easily upgrading the library, so people just
> pick a version and never upgrade. That's bad for everyone. It results
> in fewer contributions, and difficulty getting people to participate.
> There's too much text like "Install DPDK 1.8.0. With other versions is
> not guaranted it works properly" that is embedded in downstream users
> (that comes from an actual project README). Even at DPDK summit in
> Dublin, one of the most vocal opponents to ABI stability admitted that
> his company takes the code and never contributes it back. That is
> really not friendly.
I believe all the remaining "bare metal" handling code has been removed by
now, however the fact DPDK started as a framework to embed applications and
not as a shared library to link them against surely didn't help. There's a
lot of design leftovers from this era, such as EAL still snatching argv.
> This even has a different side effect - one of market penetration. It's
> difficult for distributions to support this model. So, there will be
> one or two packages they might pick up, with one or two versions.
> Everything else is "roll your own." And when it's more difficult than
> 'apt-get|yum|dnf|foo install' then users don't use it, and the cycle
> continues.
>
> I'll point out that I can take a number of compiled binaries from 20
> years ago[0], and run on a modern kernel. I wish I could take a
> binary linked to DPDK from 5 months ago, and run it with today's DPDK.
> I believe that *should* be the goal. I am confident it's achievable.
> But, I recognize it's hard and requires extra effort.
I do understand your points and the reasons behind them. My goal and the way
I see things as a PMD developer are likely why we're having this discussion,
so I'd like to summarize why the topic came up on my side:
- DPDK is all about performance *because* without much more performance than
what can be achieved with a vanilla Linux kernel, it's only a pain to use
compared to the much more comfortable (and stable) socket() API. Since no
one would use it, there wouldn't be any market for it.
- Every CPU cycle counts. That makes DPDK difficult to use because we cannot
get away with a friendly socket()-like API. Almost every aspect can be
configured to tailor it to an application needs. This was historically
done at compile time through .config options, now through run-time
parameters with the unfortunate side effect of causing the number of TX/RX
burst functions grow dangerously in many PMDs to maintain the same level
of performance.
- ABI concerns mainly apply to shared libraries [1], which happens to be
what Linux distributions want to use for very good reasons. The problem is
that shared libraries, by their very nature are not as efficient thanks to
PIC, relocations and so on. CPU-bound applications may actually prefer to
link against static libraries to squeeze a handful more pps; DPDK cannot
ignore this as it has a measurable performance impact for those.
Basically ABI stability is good, unless we want more performance on top of
more features. There is no end in sight to new features and associated API
changes/ABI breakages.
While I don't want to sound pessimistic, I don't think expecting things to
settle without killing DPDK is a realistic goal. That's why I was taking
maintenance/stable releases as an example; without new features, ABI
stability is almost guaranteed. Efforts could be diverted from the pursuit
of ABI stability in the master branch to improve maintenance ones.
> Anyway, apologies if I took some bait here, and sorry that I ranted off
> on my own.
No worries, I needed to vent a bit myself :)
Note, from the above comments it may not look like it but I'm actually
concerned about API/ABI stability where applicable, that was one of the
reasons behind the design of rte_flow (which can be extended safely without
wrecking ABIs in the process). Unfortunately several bad design choices led
to the need for the obligatory ABI breakage that will have to occur at some
point in the future.
> > (end of rant, thanks for reading)
>
> [0]: https://www.complang.tuwien.ac.at/anton/linux-binary-compatibility.html
[1] Applications are pretty much guaranteed to be recompiled against static
ones and encounter issues due to API changes first.
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 5%]
* Re: [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper
2017-10-11 19:05 5% ` Aaron Conole
@ 2017-10-12 13:37 4% ` Neil Horman
2017-10-12 14:02 5% ` Adrien Mazarguil
1 sibling, 0 replies; 200+ results
From: Neil Horman @ 2017-10-12 13:37 UTC (permalink / raw)
To: Aaron Conole
Cc: Adrien Mazarguil, Thomas Monjalon, dev, Ferruh Yigit, Gaetan Rivet, fbl
On Wed, Oct 11, 2017 at 03:05:47PM -0400, Aaron Conole wrote:
> Adrien Mazarguil <adrien.mazarguil@6wind.com> writes:
>
> > On Wed, Oct 11, 2017 at 11:23:12AM +0200, Thomas Monjalon wrote:
> >> 05/10/2017 11:49, Adrien Mazarguil:
> >> > rte_flow_error_set() is a convenient helper to initialize error objects.
> >> >
> >> > Since there is no fundamental reason to prevent applications from using it,
> >> > expose it through the public interface after modifying its return value
> >> > from positive to negative. This is done for consistency with the rest of
> >> > the public interface.
> >> >
> >> > Documentation is updated accordingly.
> >> >
> >> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> >> > ---
> >> > --- a/lib/librte_ether/rte_flow.h
> >> > +++ b/lib/librte_ether/rte_flow.h
> >> > /**
> >> > + * Initialize flow error structure.
> >> > + *
> >> > + * @param[out] error
> >> > + * Pointer to flow error structure (may be NULL).
> >> > + * @param code
> >> > + * Related error code (rte_errno).
> >> > + * @param type
> >> > + * Cause field and error types.
> >> > + * @param cause
> >> > + * Object responsible for the error.
> >> > + * @param message
> >> > + * Human-readable error message.
> >> > + *
> >> > + * @return
> >> > + * Negative error code (errno value) and rte_errno is set.
> >> > + */
> >> > +static inline int
> >> > +rte_flow_error_set(struct rte_flow_error *error,
> >> > + int code,
> >> > + enum rte_flow_error_type type,
> >> > + const void *cause,
> >> > + const char *message)
> >>
> >> When calling this function, the performance is not critical.
> >> So it must not be an inline function.
> >> Please move it to the .c file and add it to the .map file.
> >
> > I'll do it as part of moving this patch into my upcoming series for mlx4,
> > since it relies on the new return value.
> >
> > Now for the record, I believe that static inlines, particularly short ones
> > that are not expected to be modified any time soon (provided they are
> > defined properly that is) are harmless.
> >
> > Yes, that means modifying them, depending on what they do, may cause a
> > global ABI breakage of the underlying library which translates to a major
> > version bump, however exactly the same applies to some macros (in particular
> > the *_MAX ones), structure and other type definitions and so on.
>
> Sure. I think if it's small and there's never a chance for it to
> change, then it's okay. But, as you point out - they are similar to
> macros in that they are code directly added to the application. There
> is never a way to fix a bug or adjust some semantic behavior without
> requiring a recompile. That's a strong kind of binding. Certainly we
> would want that communicated as ABI, regardless of which .h/.c file the
> function exists, yes?
>
> > What I'm getting at is, making this function part of the .map file won't
> > help all that much with the goal of reaching a stable ABI. Making it a
> > normal function on the other hand successfully prevents PMDs and
> > applications from considering its use in their data plane (flow rules
> > management from the data plane is likely the next step for rte_flow).
>
> I don't understand this point well. There are two things - committing
> to a stable ABI, and communicating information about that ABI. Having
> .map files doesn't do anything for a stable ABI. It merely
> communicates information. The stability must come from the developer
> community and maintainers.
>
> > In my opinion, performance (even if hypothetical) matters more than ABI
> > stability, particularly since the current pattern is for the whole ABI to be
> > broken every other release. I think that with DPDK, ABI stability can only
> > be properly guaranteed in stable/maintenance releases but that effort is
> > vain in the master branch, affected by way too many changes for it to ever
> > become reality. This doesn't mean we shouldn't even try, however we
> > shouldn't restrict ourselves; when the ABI needs to be broken, so be it.
>
> First, performance isn't hypothetical. You have code which performs,
> and have measured various metrics to show this, or you don't have data.
> No voodoo required. Hypothetical isn't even an argument when it comes
> to predictable devices (like computers). In the case above, you have a
> non-performance critical function. It's an error function. It passes
> strings around. Performance cannot be a consideration here.
>
> Second, it depends on where you want to view the boundary. If a change is
> internal to DPDK (meaning, the application is never expected to interact
> with that area of code), then it shouldn't be part of ABI and changing
> it to your hearts content should be fine.
>
> *rant-on*
>
> I see lots of projects which use DPDK, but I only know of three or so
> projects which don't directly embed a copy of the DPDK source
> tree. I think this is a side effect of not having a stable ABI - it's
> not possible to rely on easily upgrading the library, so people just
> pick a version and never upgrade. That's bad for everyone. It results
> in fewer contributions, and difficulty getting people to participate.
> There's too much text like "Install DPDK 1.8.0. With other versions is
> not guaranted it works properly" that is embedded in downstream users
> (that comes from an actual project README). Even at DPDK summit in
> Dublin, one of the most vocal opponents to ABI stability admitted that
> his company takes the code and never contributes it back. That is
> really not friendly.
>
> This even has a different side effect - one of market penetration. It's
> difficult for distributions to support this model. So, there will be
> one or two packages they might pick up, with one or two versions.
> Everything else is "roll your own." And when it's more difficult than
> 'apt-get|yum|dnf|foo install' then users don't use it, and the cycle
> continues.
>
> I'll point out that I can take a number of compiled binaries from 20
> years ago[0], and run on a modern kernel. I wish I could take a
> binary linked to DPDK from 5 months ago, and run it with today's DPDK.
> I believe that *should* be the goal. I am confident it's achievable.
> But, I recognize it's hard and requires extra effort.
>
> Anyway, apologies if I took some bait here, and sorry that I ranted off
> on my own.
>
I'll add a +1 here. The degree to which the community is concerned about ABI
stability is reflected in the fact that no two major releases of DPDK have had
compatible ABI's. While thats somewhat understandable from a developer
perspective (it really doesn't matter if you have a stable ABI if you always use
the latest version, in fact its a hinderance to doing your job), its potentially
catastrophic from a downstream consumer point of view. No downstream consumer
is going to keep up with the latest version of DPDK on a consistent basis (I'm
going to guess that there are still users of DPDK 2.2 floating out there). They
just embed a copy, get it working, and move on with their lives. Thats
seemingly fine for as long as your foot print is small, but the second that you
hit a major bug or security issue in an old version and can't just upgrade the
DPDK without a major engineering effort, thats going to be a big problem, and
users will look elsewhere for a solution that offers both performance and
compatibility. XDP and iovisor are already gaining ground on the performance
front, and offer that level of upgradability.
Neil
> > (end of rant, thanks for reading)
>
> [0]: https://www.complang.tuwien.ac.at/anton/linux-binary-compatibility.html
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
2017-10-12 5:39 0% ` Shreyansh Jain
@ 2017-10-12 13:20 0% ` Aaron Conole
0 siblings, 0 replies; 200+ results
From: Aaron Conole @ 2017-10-12 13:20 UTC (permalink / raw)
To: Shreyansh Jain
Cc: Don Provan, Jan Blunck, Thomas Monjalon, dev, Hemant Agrawal
Shreyansh Jain <shreyansh.jain@nxp.com> writes:
> Hello Aaron,
>
> On Tuesday 10 October 2017 09:30 PM, Aaron Conole wrote:
>> Shreyansh Jain <shreyansh.jain@nxp.com> writes:
>>
>>> Hello Don,
>>>
>
> [snip]
>
>>>>
>>>> These practical problems confirm to me that the failure of a bus
>>>> scan is more of a strategic issue: when asking "which devices can
>>>> I use?", "none" is a perfectly valid answer that does not seem
>>>> like an error to me even when a failed bus scan is the reason for
>>>> that answer.
>>>
>>> I agree with this.
>>>
>>>>
>>>> From the application's point of view, the potential error here
>>>> is that the device it wants to use isn't available. I don't see that
>>>> either the init function or the probe function will have enough
>>>> information to understand that application-level problem, so
>>>> they should leave it to the application to detect it.
>>>
>>> I think I understand you comment but just want to cross check again:
>>> Scan or probe error should simply be ignored by EAL layer and let the
>>> application take stance when it detects that the device it was looking
>>> for is missing. Is my understanding correct?
>>>
>>> I am trying to come a conclusion so that this patch can either be
>>> modified or pushed as it is. If the above understanding is correct, I
>>> don't see any changes required in the patch.
>>
>> Does it make sense to introduce a way to query the results of the
>> various bus types for their status? That way we can give the relevant
>> information to the application if it wants, and make the bus scanning
>> code *always* succeed? This version shouldn't be an ABI breakage,
>> either (confirm?).
>>
>> half-baked below (not tested or suitable - just an example):
>>
>> ---
>> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
>> index a30a898..cd1ef1e 100644
>> --- a/lib/librte_eal/common/eal_common_bus.c
>> +++ b/lib/librte_eal/common/eal_common_bus.c
>> @@ -38,9 +38,23 @@
>> #include "eal_private.h"
>> +struct rte_bus_failure {
>> + struct rte_bus *bus;
>> + int err;
>> +};
>> +
>> struct rte_bus_list rte_bus_list =
>> TAILQ_HEAD_INITIALIZER(rte_bus_list);
>> +TAILQ_HEAD(rte_bus_scan_failure_list, rte_bus_failure);
>> +struct rte_bus_scan_failure_list rte_bus_scan_failure_list =
>> + TAILQ_HEAD_INITIALIZER(rte_bus_failure);
>> +
>> +TAILQ_HEAD(rte_bus_probe_failure_list, rte_bus_failure);
>> +struct rte_bus_probe_failure_list rte_bus_probe_failure_list =
>> + TAILQ_HEAD_INITIALIZER(rte_bus_failure);
>> +
>> +
>> void
>> rte_bus_register(struct rte_bus *bus)
>> {
>> @@ -64,6 +78,26 @@ rte_bus_unregister(struct rte_bus *bus)
>> RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
>> }
>> +static void
>> +rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
>> +{
>> + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
>> + if (!f) abort();
>> + f->bus = bus;
>> + f->ret = ret;
>> + TAILQ_INSERT_TAIL(&rte_bus_scan_failure_list, f, next);
>> +}
>> +
>> +static void
>> +rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
>> +{
>> + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
>> + if (!f) abort();
>> + f->bus = bus;
>> + f->ret = ret;
>> + TAILQ_INSERT_TAIL(&rte_bus_probe_failure_list, f, next);
>> +}
>> +
>> /* Scan all the buses for registered devices */
>> int
>> rte_bus_scan(void)
>> @@ -76,13 +110,33 @@ rte_bus_scan(void)
>> if (ret) {
>> RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
>> bus->name);
>> - return ret;
>> + rte_bus_append_failed_scan(bus, ret);
>> }
>> }
>> return 0;
>> }
>> +/* Seek through scan failures */
>> +void
>> +rte_bus_scan_errors(rte_bus_error_callback cb)
>> +{
>> + struct rte_bus_failure *f = NULL;
>> + TAILQ_FOREACH(f, &rte_bus_scan_failure_list, next) {
>> + cb(f->bus, f->ret);
>> + }
>> +}
>> +
>> +/* Seek through probe failures */
>> +void
>> +rte_bus_probe_errors(rte_bus_error_callback cb)
>> +{
>> + struct rte_bus_failure *f = NULL;
>> + TAILQ_FOREACH(f, &rte_bus_probe_failure_list, next) {
>> + cb(f->bus, f->ret);
>> + }
>> +}
>> +
>> /* Probe all devices of all buses */
>> int
>> rte_bus_probe(void)
>> @@ -100,7 +154,7 @@ rte_bus_probe(void)
>> if (ret) {
>> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
>> bus->name);
>> - return ret;
>> + rte_bus_append_failed_probe(bus, ret);
>> }
>> }
>> @@ -109,7 +163,7 @@ rte_bus_probe(void)
>> if (ret) {
>> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
>> vbus->name);
>> - return ret;
>> + rte_bus_append_failed_probe(bus, ret);
>> }
>> }
>> diff --git a/lib/librte_eal/common/include/rte_bus.h
>> b/lib/librte_eal/common/include/rte_bus.h
>> index 6fb0834..daddb28 100644
>> --- a/lib/librte_eal/common/include/rte_bus.h
>> +++ b/lib/librte_eal/common/include/rte_bus.h
>> @@ -231,6 +231,20 @@ void rte_bus_register(struct rte_bus *bus);
>> */
>> void rte_bus_unregister(struct rte_bus *bus);
>> +typedef void (*rte_bus_error_callback)(struct rte_bus *bus, int
>> err);
>> +
>> +/**
>> + * Search through all buses, invoking cb for each bus which reports scan
>> + * error.
>> + */
>> +void rte_bus_scan_errors(rte_bus_error_callback cb);
>> +
>> +/**
>> + * Search through all buses, invoking cb for each bus which reports scan
>> + * error.
>> + */
>> +void rte_bus_probe_errors(rte_bus_error_callback cb);
>> +
>> /**
>> * Scan all the buses.
>> *
>>
>
> I am assuming that that aim of this is to have a way so that
> application can query whether its device of interest is there or
> not. But, I think this (creating a list of scan errrors) would be
> overkill.
No. That can be done through a different query.
> Even if we were to create a list of errors from scan/probe, how would
> that help an application? Is there some specific use-case that you are
> hinting at?
Sure. Let's assume that due to some permissions problem, /proc/bus/pci
doesn't exist for the application. The entire PCI bus scan fails. No
PCI devices are found.
In this case, how can the application even start to understand why the
device is missing? I don't think parsing logs makes sense. But if
there's a way to see that the PCI bus scan/probe failed, maybe the
application can start making corrective action (for instance, check that
/proc is mounted, and retry the bus probe/scan).
> Application should worry about devices rather than how they are being
> detected (scan/probe etc). Application can use API like
> rte_eth_dev_get_port_by_name to query its specific device of
> interest. If the scan has failed, this API would be sufficient for the
> application to take counter-measures. Isn't that enough from a DPDK
> application perspective to move from init to I/O?
I'm not sure what you're asking here. I agree that bus probe/scan
shouldn't ever fail, and that we should pass from init to i/o asap.
> I am not discounting that there might be some higher use-cases where
> this list might come of us - but I can't think of one right now and I
> can't comment on this proposal in absence of that understanding -
> sorry.
Maybe the above helps? Not sure if I described my thinking.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
2017-10-11 22:34 0% ` Thomas Monjalon
@ 2017-10-12 13:08 0% ` Aaron Conole
0 siblings, 0 replies; 200+ results
From: Aaron Conole @ 2017-10-12 13:08 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Shreyansh Jain, Don Provan, Jan Blunck, Hemant Agrawal
Thomas Monjalon <thomas@monjalon.net> writes:
> 10/10/2017 18:00, Aaron Conole:
>> Shreyansh Jain <shreyansh.jain@nxp.com> writes:
>>
>> > Hello Don,
>> >
>> > On Monday 09 October 2017 11:51 PM, Don Provan wrote:
>> >>> -----Original Message-----
>> >>> From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com]
>> >>> Sent: Monday, October 09, 2017 4:10 AM
>> >>> To: Jan Blunck <jblunck@infradead.org>; Thomas Monjalon
>> >>> <thomas@monjalon.net>
>> >>> Cc: dev <dev@dpdk.org>; Hemant Agrawal <hemant.agrawal@nxp.com>
>> >>> Subject: Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
>> >>>
>> >>> ...
>> >>> This is where I have disagreement/doubt.
>> >>> Reporting error code from rte_bus_scan would do two things:
>> >>>
>> >>> 1. rte_eal_init is not designed to ignore/log-only these errors - it
>> >>> would quit initialization. (But, this can be changed)
>> >>> 2. What should rte_eal_init do with this error? rte_bus_scan would have
>> >>> already printed the problematic bus->scan() failure.
>> >>
>> >> These practical problems confirm to me that the failure of a bus
>> >> scan is more of a strategic issue: when asking "which devices can
>> >> I use?", "none" is a perfectly valid answer that does not seem
>> >> like an error to me even when a failed bus scan is the reason for
>> >> that answer.
>> >
>> > I agree with this.
>> >
>> >>
>> >> From the application's point of view, the potential error here
>> >> is that the device it wants to use isn't available. I don't see that
>> >> either the init function or the probe function will have enough
>> >> information to understand that application-level problem, so
>> >> they should leave it to the application to detect it.
>> >
>> > I think I understand you comment but just want to cross check again:
>> > Scan or probe error should simply be ignored by EAL layer and let the
>> > application take stance when it detects that the device it was looking
>> > for is missing. Is my understanding correct?
>> >
>> > I am trying to come a conclusion so that this patch can either be
>> > modified or pushed as it is. If the above understanding is correct, I
>> > don't see any changes required in the patch.
>>
>> Does it make sense to introduce a way to query the results of the
>> various bus types for their status? That way we can give the relevant
>> information to the application if it wants, and make the bus scanning
>> code *always* succeed? This version shouldn't be an ABI breakage,
>> either (confirm?).
>>
>> half-baked below (not tested or suitable - just an example):
>
> We are going to need notification callbacks for scan and probe anyway.
> I think errors could be also notified with callbacks?
Definitely. That's part of my half-baked patch. Call the error check
function and get a callback. There's probably a better way to do it
than my patch.
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v5 19/20] doc: add notes on EAL PCI API update
@ 2017-10-12 10:45 4% ` Gaetan Rivet
1 sibling, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-12 10:45 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add a section related to EAL API changes to 17.11 release notes.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 63b9869..ed3d6d8 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -232,6 +232,34 @@ API Changes
By this way PMDs can return an error value in case of failure at stats
getting process time.
+* **PCI bus API moved outside of the EAL**
+
+ The PCI bus previously implemented within the EAL has been moved.
+ A first part has been added as an RTE library providing PCI helpers to
+ parse device locations or other such utilities.
+ A second part consisting in the actual bus driver has been moved to its
+ proper subdirectory, without changing its functionalities.
+
+ As such, several PCI-related functions are not proposed by the EAL anymore:
+
+ * rte_pci_detach
+ * rte_pci_dump
+ * rte_pci_ioport_map
+ * rte_pci_ioport_read
+ * rte_pci_ioport_unmap
+ * rte_pci_ioport_write
+ * rte_pci_map_device
+ * rte_pci_probe
+ * rte_pci_probe_one
+ * rte_pci_read_config
+ * rte_pci_register
+ * rte_pci_scan
+ * rte_pci_unmap_device
+ * rte_pci_unregister
+ * rte_pci_write_config
+
+ These functions are made available either as part of ``librte_pci`` or
+ ``librte_bus_pci``.
ABI Changes
-----------
--
2.1.4
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH 1/2] reorder: fix ready buffers not being nulled out
@ 2017-10-12 8:32 3% ` Bruce Richardson
0 siblings, 0 replies; 200+ results
From: Bruce Richardson @ 2017-10-12 8:32 UTC (permalink / raw)
To: Pavan Nikhilesh; +Cc: reshma.pattan, dev
On Tue, Sep 12, 2017 at 08:36:03PM +0530, Pavan Nikhilesh wrote:
> The ready buffers should be set to NULL when drained else it might
> result in double free (mempool put) when rte_reorder_free is called.
>
> Fixes: b70b56032bff ("reorder: new library")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> ---
> lib/librte_reorder/rte_reorder.c | 1 + 1 file changed, 1 insertion(+)
>
Rather than having an addition write for each entry going through the
reorder library, it should be possible to change free function so that
it only frees entries based on the index values.
In fact, a better solution to having reorder_free just blindly free the
mbufs would be to have reorder_free hand them back to the application,
or allow reorder_free to fail if the reorder buffer is non-empty. Making
such a change would be an ABI break, though.
/Bruce
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v2 18/18] doc: remove devargs deprecation notices
@ 2017-10-12 8:21 10% ` Gaetan Rivet
1 sibling, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-12 8:21 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
These actions have been enacted.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index ef2264f..23faa19 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -16,19 +16,6 @@ Deprecation Notices
- ``rte_set_log_type``, replaced by ``rte_log_set_level``
- ``rte_get_log_type``, replaced by ``rte_log_get_level``
-* eal: several API and ABI changes are planned for ``rte_devargs`` in v17.11.
- The format of device command line parameters will change. The bus will need
- to be explicitly stated in the device declaration. The enum ``rte_devtype``
- was used to identify a bus and will disappear.
- The structure ``rte_devargs`` will change.
- The ``rte_devargs_list`` will be made private.
- The following functions are deprecated starting from 17.08 and will either be
- modified or removed in 17.11:
-
- - ``rte_eal_devargs_add``
- - ``rte_eal_devargs_type_count``
- - ``rte_eal_parse_devargs_str``, replaced by ``rte_eal_devargs_parse``
-
* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
translation scheme.
Reference to phys address in EAL data-structure or functions may change to
--
2.1.4
^ permalink raw reply [relevance 10%]
* [dpdk-dev] [PATCH v1 2/8] bus: introduce opaque control framework
2017-10-12 8:18 4% [dpdk-dev] [PATCH v1 0/8] Bus control framework Gaetan Rivet
@ 2017-10-12 8:18 4% ` Gaetan Rivet
0 siblings, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-12 8:18 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
New configuration elements are added to the buses. They make the ABI
unstable and will continue to do so.
This new control scheme allows to add new bus operators without
breaking the ABI and by only expanding the API.
This helps having more stability in core EAL subsystems, while allowing
flexibility for future evolutions.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
lib/librte_eal/common/eal_common_bus.c | 9 +++++++
lib/librte_eal/common/include/rte_bus.h | 46 +++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index 3c66a02..65d7229 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -42,6 +42,13 @@
struct rte_bus_list rte_bus_list =
TAILQ_HEAD_INITIALIZER(rte_bus_list);
+static rte_bus_ctrl_t
+rte_bus_default_ctrl(enum rte_bus_ctrl_op op __rte_unused,
+ enum rte_bus_ctrl_item item __rte_unused)
+{
+ return NULL;
+}
+
void
rte_bus_register(struct rte_bus *bus)
{
@@ -53,6 +60,8 @@ rte_bus_register(struct rte_bus *bus)
RTE_VERIFY(bus->find_device);
/* Buses supporting driver plug also require unplug. */
RTE_VERIFY(!bus->plug || bus->unplug);
+ if (bus->ctrl == NULL)
+ bus->ctrl = &rte_bus_default_ctrl;
TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index 331d954..bd3c28e 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -183,6 +183,51 @@ struct rte_bus_conf {
enum rte_bus_probe_mode probe_mode; /**< Probe policy. */
};
+/**
+ * Bus configuration items.
+ */
+enum rte_bus_ctrl_item {
+ RTE_BUS_CTRL_PROBE_MODE = 0,
+ RTE_BUS_CTRL_ITEM_MAX,
+};
+
+/**
+ * Bus configuration operations.
+ */
+enum rte_bus_ctrl_op {
+ RTE_BUS_CTRL_GET = 0,
+ RTE_BUS_CTRL_SET,
+ RTE_BUS_CTRL_RESET,
+ RTE_BUS_CTRL_OP_MAX,
+};
+
+/**
+ * Operator for a particular rte_bus configuration item.
+ *
+ * @param arg
+ * Operation parameter.
+ *
+ * @return
+ * 0 on success
+ * !0 otherwise
+ */
+typedef int (*rte_bus_ctrl_t)(void *arg);
+
+/**
+ * Accessor to bus configuration operators.
+ *
+ * @param op
+ * Operation type.
+ *
+ * @param item
+ * Operation element.
+ *
+ * @return
+ * Operator function on success.
+ * NULL if this item is not supported.
+ */
+typedef rte_bus_ctrl_t (*rte_bus_ctrl_get_t)(enum rte_bus_ctrl_op op,
+ enum rte_bus_ctrl_item item);
/**
* Get common iommu class of the all the devices on the bus. The bus may
@@ -211,6 +256,7 @@ struct rte_bus {
rte_bus_parse_t parse; /**< Parse a device name */
struct rte_bus_conf conf; /**< Bus configuration */
rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
+ rte_bus_ctrl_get_t ctrl; /**< Get control operators */
};
/**
--
2.1.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v1 0/8] Bus control framework
@ 2017-10-12 8:18 4% Gaetan Rivet
2017-10-12 8:18 4% ` [dpdk-dev] [PATCH v1 2/8] bus: introduce opaque " Gaetan Rivet
0 siblings, 1 reply; 200+ results
From: Gaetan Rivet @ 2017-10-12 8:18 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Probing policy was introduced in the previous release as a configuration item.
It was thus added to the generic bus structure, breaking its ABI.
In this release, the IOVA mode can be read from a bus to configure the
EAL. This new configuration element also broke the bus ABI when it was
added.
As new operators had to be implemented for the probe policy item, these
patches were developed to help mitigate this issue.
This control framework allows to expand the rte_bus API without breaking
its ABI. It is meant to be used with configuration elements that may
only be valid for a few buses, while the others would remain untouched
and unaware of the evolution.
A central control operator is used, similarly to the working of rte_flow
API in the ether layer. Each driver thus chooses to expose a set of
operators relevant to its implementation. The caller is then free to use
those if they are available.
Both Probe mode and IOVA mode operators are implemented for the PCI bus.
This patchset depends on:
Move PCI away from the EAL
http://dpdk.org/ml/archives/dev/2017-August/073512.html
Gaetan Rivet (8):
bus: rename scan policy as probe policy
bus: introduce opaque control framework
bus: remove probe mode configuration structure
bus: add probe mode setter
bus/pci: implement ctrl operator
bus: add IOVA mode as a ctrl operation
bus/pci: implement IOVA mode getter
bus: remove redundant IOVA mode getter
drivers/bus/pci/bsd/pci.c | 9 +-
drivers/bus/pci/include/rte_bus_pci.h | 12 +--
drivers/bus/pci/linux/pci.c | 20 ++--
drivers/bus/pci/pci_common.c | 53 +++++++++-
drivers/bus/pci/private.h | 13 +++
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 -
lib/librte_eal/common/eal_common_bus.c | 57 +++++++++--
lib/librte_eal/common/eal_common_devargs.c | 8 --
lib/librte_eal/common/eal_common_options.c | 17 +---
lib/librte_eal/common/include/rte_bus.h | 127 ++++++++++++++++--------
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 -
11 files changed, 222 insertions(+), 96 deletions(-)
--
2.1.4
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v4 16/16] doc: add notes on EAL PCI API update
@ 2017-10-12 8:17 4% ` Gaetan Rivet
1 sibling, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-10-12 8:17 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add a section related to EAL API changes to 17.11 release notes.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 63b9869..ed3d6d8 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -232,6 +232,34 @@ API Changes
By this way PMDs can return an error value in case of failure at stats
getting process time.
+* **PCI bus API moved outside of the EAL**
+
+ The PCI bus previously implemented within the EAL has been moved.
+ A first part has been added as an RTE library providing PCI helpers to
+ parse device locations or other such utilities.
+ A second part consisting in the actual bus driver has been moved to its
+ proper subdirectory, without changing its functionalities.
+
+ As such, several PCI-related functions are not proposed by the EAL anymore:
+
+ * rte_pci_detach
+ * rte_pci_dump
+ * rte_pci_ioport_map
+ * rte_pci_ioport_read
+ * rte_pci_ioport_unmap
+ * rte_pci_ioport_write
+ * rte_pci_map_device
+ * rte_pci_probe
+ * rte_pci_probe_one
+ * rte_pci_read_config
+ * rte_pci_register
+ * rte_pci_scan
+ * rte_pci_unmap_device
+ * rte_pci_unregister
+ * rte_pci_write_config
+
+ These functions are made available either as part of ``librte_pci`` or
+ ``librte_bus_pci``.
ABI Changes
-----------
--
2.1.4
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
2017-10-10 16:00 3% ` Aaron Conole
2017-10-11 22:34 0% ` Thomas Monjalon
@ 2017-10-12 5:39 0% ` Shreyansh Jain
2017-10-12 13:20 0% ` Aaron Conole
1 sibling, 1 reply; 200+ results
From: Shreyansh Jain @ 2017-10-12 5:39 UTC (permalink / raw)
To: Aaron Conole; +Cc: Don Provan, Jan Blunck, Thomas Monjalon, dev, Hemant Agrawal
Hello Aaron,
On Tuesday 10 October 2017 09:30 PM, Aaron Conole wrote:
> Shreyansh Jain <shreyansh.jain@nxp.com> writes:
>
>> Hello Don,
>>
[snip]
>>>
>>> These practical problems confirm to me that the failure of a bus
>>> scan is more of a strategic issue: when asking "which devices can
>>> I use?", "none" is a perfectly valid answer that does not seem
>>> like an error to me even when a failed bus scan is the reason for
>>> that answer.
>>
>> I agree with this.
>>
>>>
>>> From the application's point of view, the potential error here
>>> is that the device it wants to use isn't available. I don't see that
>>> either the init function or the probe function will have enough
>>> information to understand that application-level problem, so
>>> they should leave it to the application to detect it.
>>
>> I think I understand you comment but just want to cross check again:
>> Scan or probe error should simply be ignored by EAL layer and let the
>> application take stance when it detects that the device it was looking
>> for is missing. Is my understanding correct?
>>
>> I am trying to come a conclusion so that this patch can either be
>> modified or pushed as it is. If the above understanding is correct, I
>> don't see any changes required in the patch.
>
> Does it make sense to introduce a way to query the results of the
> various bus types for their status? That way we can give the relevant
> information to the application if it wants, and make the bus scanning
> code *always* succeed? This version shouldn't be an ABI breakage,
> either (confirm?).
>
> half-baked below (not tested or suitable - just an example):
>
> ---
> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> index a30a898..cd1ef1e 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -38,9 +38,23 @@
>
> #include "eal_private.h"
>
> +struct rte_bus_failure {
> + struct rte_bus *bus;
> + int err;
> +};
> +
> struct rte_bus_list rte_bus_list =
> TAILQ_HEAD_INITIALIZER(rte_bus_list);
>
> +TAILQ_HEAD(rte_bus_scan_failure_list, rte_bus_failure);
> +struct rte_bus_scan_failure_list rte_bus_scan_failure_list =
> + TAILQ_HEAD_INITIALIZER(rte_bus_failure);
> +
> +TAILQ_HEAD(rte_bus_probe_failure_list, rte_bus_failure);
> +struct rte_bus_probe_failure_list rte_bus_probe_failure_list =
> + TAILQ_HEAD_INITIALIZER(rte_bus_failure);
> +
> +
> void
> rte_bus_register(struct rte_bus *bus)
> {
> @@ -64,6 +78,26 @@ rte_bus_unregister(struct rte_bus *bus)
> RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
> }
>
> +static void
> +rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
> +{
> + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
> + if (!f) abort();
> + f->bus = bus;
> + f->ret = ret;
> + TAILQ_INSERT_TAIL(&rte_bus_scan_failure_list, f, next);
> +}
> +
> +static void
> +rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
> +{
> + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
> + if (!f) abort();
> + f->bus = bus;
> + f->ret = ret;
> + TAILQ_INSERT_TAIL(&rte_bus_probe_failure_list, f, next);
> +}
> +
> /* Scan all the buses for registered devices */
> int
> rte_bus_scan(void)
> @@ -76,13 +110,33 @@ rte_bus_scan(void)
> if (ret) {
> RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
> bus->name);
> - return ret;
> + rte_bus_append_failed_scan(bus, ret);
> }
> }
>
> return 0;
> }
>
> +/* Seek through scan failures */
> +void
> +rte_bus_scan_errors(rte_bus_error_callback cb)
> +{
> + struct rte_bus_failure *f = NULL;
> + TAILQ_FOREACH(f, &rte_bus_scan_failure_list, next) {
> + cb(f->bus, f->ret);
> + }
> +}
> +
> +/* Seek through probe failures */
> +void
> +rte_bus_probe_errors(rte_bus_error_callback cb)
> +{
> + struct rte_bus_failure *f = NULL;
> + TAILQ_FOREACH(f, &rte_bus_probe_failure_list, next) {
> + cb(f->bus, f->ret);
> + }
> +}
> +
> /* Probe all devices of all buses */
> int
> rte_bus_probe(void)
> @@ -100,7 +154,7 @@ rte_bus_probe(void)
> if (ret) {
> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
> bus->name);
> - return ret;
> + rte_bus_append_failed_probe(bus, ret);
> }
> }
>
> @@ -109,7 +163,7 @@ rte_bus_probe(void)
> if (ret) {
> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
> vbus->name);
> - return ret;
> + rte_bus_append_failed_probe(bus, ret);
> }
> }
>
> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> index 6fb0834..daddb28 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -231,6 +231,20 @@ void rte_bus_register(struct rte_bus *bus);
> */
> void rte_bus_unregister(struct rte_bus *bus);
>
> +typedef void (*rte_bus_error_callback)(struct rte_bus *bus, int err);
> +
> +/**
> + * Search through all buses, invoking cb for each bus which reports scan
> + * error.
> + */
> +void rte_bus_scan_errors(rte_bus_error_callback cb);
> +
> +/**
> + * Search through all buses, invoking cb for each bus which reports scan
> + * error.
> + */
> +void rte_bus_probe_errors(rte_bus_error_callback cb);
> +
> /**
> * Scan all the buses.
> *
>
I am assuming that that aim of this is to have a way so that application
can query whether its device of interest is there or not. But, I think
this (creating a list of scan errrors) would be overkill.
Even if we were to create a list of errors from scan/probe, how would
that help an application? Is there some specific use-case that you are
hinting at?
Application should worry about devices rather than how they are being
detected (scan/probe etc). Application can use API like
rte_eth_dev_get_port_by_name to query its specific device of interest.
If the scan has failed, this API would be sufficient for the application
to take counter-measures. Isn't that enough from a DPDK application
perspective to move from init to I/O?
I am not discounting that there might be some higher use-cases where
this list might come of us - but I can't think of one right now and I
can't comment on this proposal in absence of that understanding - sorry.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-10-11 21:21 0% ` Ferruh Yigit
@ 2017-10-12 1:33 0% ` Yang, Zhiyong
0 siblings, 0 replies; 200+ results
From: Yang, Zhiyong @ 2017-10-12 1:33 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Cc: thomas, Nelio Laranjeiro, Gaetan Rivet, Doherty, Declan
Hi ferruh,
> >> Zhiyong Yang (5):
> >> net/bonding: remove bonding APIs using ABI versioning
> >> ethdev: increase port_id range
> >> examples: increase port_id range
> >> test: increase port_id range
> >> librte_mbuf: modify port initialization value
> >
> > Series applied to dpdk-next-net/master, thanks.
>
> Hi Zhiyong,
>
> I can see there are more "uint8_t port_id" usage in testpmd:
>
> $ git grep -c "uint8_t port_id"
> cmdline.c:93
> config.c:7
> testpmd.c:4
> testpmd.h:8
>
> I believe there can be false-positives, but can you please check and send a fix
> patch if required?
>
Ok.
thanks
Zhiyong
> Thanks,
> ferruh
>
> <...>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v9 0/9] Policy Based Power Control for Guest
2017-10-11 16:18 2% ` [dpdk-dev] [PATCH v9 " David Hunt
@ 2017-10-12 0:23 0% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2017-10-12 0:23 UTC (permalink / raw)
To: David Hunt, dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
On 10/11/2017 5:18 PM, David Hunt wrote:
> Policy Based Power Control for Guest
>
> This patchset adds the facility for a guest VM to send a policy down to the
> host that will allow the host to scale up/down cpu frequencies
> depending on the policy criteria independently of the DPDK app running in
> the guest. This differs from the previous vm_power implementation where
> individual scale up/down requests were send from the guest to the host via
> virtio-serial.
>
> V9 patchset changes:
> * Rebased on top of the tip of the master branch
> * changed port_id from uint8 to uint16 due to changes elsewhere
>
> V8 patchset changes:
> * Added Ack's and Reviewed-by's to individual patches in the set so as to
> keep patchwork A/R/T flags properly in sync.
>
> V7 patchset changes:
> * Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
> int64_t to int
>
> V6 patchset changes:
> * Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
> * changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
> as it can return negative error codes.
> * Removed bool enum from channel_commands.h, including stdbool.h instead.
> * Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
> * Renamed a few variables to be more readable.
> * Added returns in a few places if failed to get info on domain.
> * Fixed power_manager_init to keep track of num_freqs for each core.
> * In power_manager_scale_core_med(), changed a hardcoded '5' to instead
> be calculated from the centre of the frequency list
> (global_core_freq_info[core_num].num_freqs / 2)
>
> V5 patchset changes:
> * Removed most of the #ifdef I40_PMD as it will be applicable to
> other PMDs in the future.
> * Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
> to a const struct ether_addr *, rather than casting it later in the
> function.
>
> V4 patchset changes:
> * None, re-post to mailing list under the correct email thread.
>
> V3 patchset changes:
> * Changed to using is_same_ether_addr() instead of looping through
> the mac address bytes to compare them.
> * Tweaked some comments and working in the i40e patch after review.
> * Added a patch to the set to add new i40e function to map file, so
> as to allow shared library builds. The power library API needs a cleanup
> in next release, so will add API/ABI warning for this cleanup in a
> separate patch.
>
> V2 patchset changes:
> * Removed API's in ethdev layer.
> * Now just a single new API in the i40e driver for mapping VF MAC to
> VF index.
> * Moved new function from rte_rxtx.c to rte_pmd_i40e.c
> * Removed function for reading i40e register, moved to using the
> standard stats API.
> * Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
> * Cleaned up policy generation code.
>
> It's a modification of the vm_power_manager app that runs in the host, and
> the guest_vm_power_app example app that runs in the guest. This allows the
> guest to send down a policy to the host via virtio-serial, which then allows
> the host to scale up/down based on the criteria in the policy, resulting in
> quicker scale up/down than individual requests coming from the guest.
> It also means that the DPDK application running in the guest does not need
> to be modified in any way, it is unaware that it's cores are being scaled
> up/down, reducing the effort in implementing a power-aware infrastructure.
>
> The usage model is as follows:
> 1. Set up the VF's and assign to the guest in the usual way.
> 2. run vm_power_manager on the host, creating a channel to the guest.
> 3. Start the guest_vm_power_mgr app on the guest, which establishes
> a virtio-serial channel to the host.
> 4. Send down the profile for the guest using the "send_profile now" command.
> There is an example profile hard-coded into guest_vm_power_mgr.
> 5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
> 6. Send traffic into the VFs at varying traffic rates.
> Observe the frequency change on the host (turbostat -i 1)
>
> The sequence of code changes are as follows:
>
> A new function has been aded to the i40e driver to allow mapping of
> a VF MAC to VF index.
>
> Next we make an addition to librte_power that adds an extra command to allow
> the passing of a policy structure from the guest to the host. This struct
> contains information like busy/quiet hour, packet throughput thresholds, etc.
>
> The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
> physical CPU (pcpu) IDs so that the host can scale up/down the cores used
> in the guest.
>
> The remaining patches are functionality to process the policy, and take action
> when the relevant trigger occurs to cause a frequency change.
Applied to dpdk/master, thanks.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
2017-10-10 16:00 3% ` Aaron Conole
@ 2017-10-11 22:34 0% ` Thomas Monjalon
2017-10-12 13:08 0% ` Aaron Conole
2017-10-12 5:39 0% ` Shreyansh Jain
1 sibling, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-11 22:34 UTC (permalink / raw)
To: Aaron Conole; +Cc: dev, Shreyansh Jain, Don Provan, Jan Blunck, Hemant Agrawal
10/10/2017 18:00, Aaron Conole:
> Shreyansh Jain <shreyansh.jain@nxp.com> writes:
>
> > Hello Don,
> >
> > On Monday 09 October 2017 11:51 PM, Don Provan wrote:
> >>> -----Original Message-----
> >>> From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com]
> >>> Sent: Monday, October 09, 2017 4:10 AM
> >>> To: Jan Blunck <jblunck@infradead.org>; Thomas Monjalon
> >>> <thomas@monjalon.net>
> >>> Cc: dev <dev@dpdk.org>; Hemant Agrawal <hemant.agrawal@nxp.com>
> >>> Subject: Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
> >>>
> >>> ...
> >>> This is where I have disagreement/doubt.
> >>> Reporting error code from rte_bus_scan would do two things:
> >>>
> >>> 1. rte_eal_init is not designed to ignore/log-only these errors - it
> >>> would quit initialization. (But, this can be changed)
> >>> 2. What should rte_eal_init do with this error? rte_bus_scan would have
> >>> already printed the problematic bus->scan() failure.
> >>
> >> These practical problems confirm to me that the failure of a bus
> >> scan is more of a strategic issue: when asking "which devices can
> >> I use?", "none" is a perfectly valid answer that does not seem
> >> like an error to me even when a failed bus scan is the reason for
> >> that answer.
> >
> > I agree with this.
> >
> >>
> >> From the application's point of view, the potential error here
> >> is that the device it wants to use isn't available. I don't see that
> >> either the init function or the probe function will have enough
> >> information to understand that application-level problem, so
> >> they should leave it to the application to detect it.
> >
> > I think I understand you comment but just want to cross check again:
> > Scan or probe error should simply be ignored by EAL layer and let the
> > application take stance when it detects that the device it was looking
> > for is missing. Is my understanding correct?
> >
> > I am trying to come a conclusion so that this patch can either be
> > modified or pushed as it is. If the above understanding is correct, I
> > don't see any changes required in the patch.
>
> Does it make sense to introduce a way to query the results of the
> various bus types for their status? That way we can give the relevant
> information to the application if it wants, and make the bus scanning
> code *always* succeed? This version shouldn't be an ABI breakage,
> either (confirm?).
>
> half-baked below (not tested or suitable - just an example):
We are going to need notification callbacks for scan and probe anyway.
I think errors could be also notified with callbacks?
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
` (2 preceding siblings ...)
2017-10-06 16:02 0% ` Thomas Monjalon
@ 2017-10-11 21:21 0% ` Ferruh Yigit
2017-10-12 1:33 0% ` Yang, Zhiyong
3 siblings, 1 reply; 200+ results
From: Ferruh Yigit @ 2017-10-11 21:21 UTC (permalink / raw)
To: Zhiyong Yang, dev; +Cc: thomas, Nelio Laranjeiro, Gaetan Rivet, Declan Doherty
On 10/6/2017 3:15 AM, Ferruh Yigit wrote:
> On 9/29/2017 8:17 AM, Zhiyong Yang wrote:
>> port_id is currently defined as uint8_t, which is limited to the range
>> 0 to 255. A larger range is required for vdev scalability.
>>
>> It is necessary for a redefinition of port_id to extend it from
>> 1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
>> be changed at the same time.
>>
>> Discussion about port_id is the following thread.
>> http://www.dpdk.org/dev/patchwork/patch/23208/
>>
>> Changes in V2:
>> 1. cover more PMDs to increase port_id range.
>> 2. cover more examples to increase port_id range.
>> 3. add 17.11 release note.
>>
>> Changes in V3:
>> 1. cover mlx4 and mlx5.
>> 2. add to increase port_id range in test code.
>> 3. The patch "librte_mbuf: modify port initialization value" is merged
>> into the patchset.
>>
>> Changes in V4:
>> 1. Add a patch to remove bonding APIs using ABI versioning according to
>> Ferruh's comments.
>> 2. Unify to use typedef portid_t in testpmd code.
>> 3. update release note deprecation doc in 2/5
>> 4. fix some issues according to comments.
>>
>> Changes in V5:
>> 1. For 1/5, bond_mode_8023ad_conf_get_v1708() and bond_mode_8023ad_conf
>> _get() are merged into one function bond_mode_8023ad_conf_get.
>>
>> Changes in V6:
>> 1. For 2/5, remove the unnecessary LIBABIVER in Makefile and update
>> the release notes "Shared Library Versions".
>> Note: The patchset have dependency on the following patch.
>> http://www.dpdk.org/dev/patchwork/patch/28738/
>> http://www.dpdk.org/dev/patchwork/patch/29219/
>>
>> Note: 3/5 and 4/5 patches' building depends on 2/5 patch since 2/5 patch
>> breaks lib/PMD API/ABI.
>>
>> Zhiyong Yang (5):
>> net/bonding: remove bonding APIs using ABI versioning
>> ethdev: increase port_id range
>> examples: increase port_id range
>> test: increase port_id range
>> librte_mbuf: modify port initialization value
>
> Series applied to dpdk-next-net/master, thanks.
Hi Zhiyong,
I can see there are more "uint8_t port_id" usage in testpmd:
$ git grep -c "uint8_t port_id"
cmdline.c:93
config.c:7
testpmd.c:4
testpmd.h:8
I believe there can be false-positives, but can you please check and
send a fix patch if required?
Thanks,
ferruh
<...>
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper
2017-10-11 11:56 5% ` Adrien Mazarguil
@ 2017-10-11 19:05 5% ` Aaron Conole
2017-10-12 13:37 4% ` Neil Horman
2017-10-12 14:02 5% ` Adrien Mazarguil
0 siblings, 2 replies; 200+ results
From: Aaron Conole @ 2017-10-11 19:05 UTC (permalink / raw)
To: Adrien Mazarguil
Cc: Thomas Monjalon, dev, Ferruh Yigit, Gaetan Rivet, fbl, Neil Horman
Adrien Mazarguil <adrien.mazarguil@6wind.com> writes:
> On Wed, Oct 11, 2017 at 11:23:12AM +0200, Thomas Monjalon wrote:
>> 05/10/2017 11:49, Adrien Mazarguil:
>> > rte_flow_error_set() is a convenient helper to initialize error objects.
>> >
>> > Since there is no fundamental reason to prevent applications from using it,
>> > expose it through the public interface after modifying its return value
>> > from positive to negative. This is done for consistency with the rest of
>> > the public interface.
>> >
>> > Documentation is updated accordingly.
>> >
>> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>> > ---
>> > --- a/lib/librte_ether/rte_flow.h
>> > +++ b/lib/librte_ether/rte_flow.h
>> > /**
>> > + * Initialize flow error structure.
>> > + *
>> > + * @param[out] error
>> > + * Pointer to flow error structure (may be NULL).
>> > + * @param code
>> > + * Related error code (rte_errno).
>> > + * @param type
>> > + * Cause field and error types.
>> > + * @param cause
>> > + * Object responsible for the error.
>> > + * @param message
>> > + * Human-readable error message.
>> > + *
>> > + * @return
>> > + * Negative error code (errno value) and rte_errno is set.
>> > + */
>> > +static inline int
>> > +rte_flow_error_set(struct rte_flow_error *error,
>> > + int code,
>> > + enum rte_flow_error_type type,
>> > + const void *cause,
>> > + const char *message)
>>
>> When calling this function, the performance is not critical.
>> So it must not be an inline function.
>> Please move it to the .c file and add it to the .map file.
>
> I'll do it as part of moving this patch into my upcoming series for mlx4,
> since it relies on the new return value.
>
> Now for the record, I believe that static inlines, particularly short ones
> that are not expected to be modified any time soon (provided they are
> defined properly that is) are harmless.
>
> Yes, that means modifying them, depending on what they do, may cause a
> global ABI breakage of the underlying library which translates to a major
> version bump, however exactly the same applies to some macros (in particular
> the *_MAX ones), structure and other type definitions and so on.
Sure. I think if it's small and there's never a chance for it to
change, then it's okay. But, as you point out - they are similar to
macros in that they are code directly added to the application. There
is never a way to fix a bug or adjust some semantic behavior without
requiring a recompile. That's a strong kind of binding. Certainly we
would want that communicated as ABI, regardless of which .h/.c file the
function exists, yes?
> What I'm getting at is, making this function part of the .map file won't
> help all that much with the goal of reaching a stable ABI. Making it a
> normal function on the other hand successfully prevents PMDs and
> applications from considering its use in their data plane (flow rules
> management from the data plane is likely the next step for rte_flow).
I don't understand this point well. There are two things - committing
to a stable ABI, and communicating information about that ABI. Having
.map files doesn't do anything for a stable ABI. It merely
communicates information. The stability must come from the developer
community and maintainers.
> In my opinion, performance (even if hypothetical) matters more than ABI
> stability, particularly since the current pattern is for the whole ABI to be
> broken every other release. I think that with DPDK, ABI stability can only
> be properly guaranteed in stable/maintenance releases but that effort is
> vain in the master branch, affected by way too many changes for it to ever
> become reality. This doesn't mean we shouldn't even try, however we
> shouldn't restrict ourselves; when the ABI needs to be broken, so be it.
First, performance isn't hypothetical. You have code which performs,
and have measured various metrics to show this, or you don't have data.
No voodoo required. Hypothetical isn't even an argument when it comes
to predictable devices (like computers). In the case above, you have a
non-performance critical function. It's an error function. It passes
strings around. Performance cannot be a consideration here.
Second, it depends on where you want to view the boundary. If a change is
internal to DPDK (meaning, the application is never expected to interact
with that area of code), then it shouldn't be part of ABI and changing
it to your hearts content should be fine.
*rant-on*
I see lots of projects which use DPDK, but I only know of three or so
projects which don't directly embed a copy of the DPDK source
tree. I think this is a side effect of not having a stable ABI - it's
not possible to rely on easily upgrading the library, so people just
pick a version and never upgrade. That's bad for everyone. It results
in fewer contributions, and difficulty getting people to participate.
There's too much text like "Install DPDK 1.8.0. With other versions is
not guaranted it works properly" that is embedded in downstream users
(that comes from an actual project README). Even at DPDK summit in
Dublin, one of the most vocal opponents to ABI stability admitted that
his company takes the code and never contributes it back. That is
really not friendly.
This even has a different side effect - one of market penetration. It's
difficult for distributions to support this model. So, there will be
one or two packages they might pick up, with one or two versions.
Everything else is "roll your own." And when it's more difficult than
'apt-get|yum|dnf|foo install' then users don't use it, and the cycle
continues.
I'll point out that I can take a number of compiled binaries from 20
years ago[0], and run on a modern kernel. I wish I could take a
binary linked to DPDK from 5 months ago, and run it with today's DPDK.
I believe that *should* be the goal. I am confident it's achievable.
But, I recognize it's hard and requires extra effort.
Anyway, apologies if I took some bait here, and sorry that I ranted off
on my own.
> (end of rant, thanks for reading)
[0]: https://www.complang.tuwien.ac.at/anton/linux-binary-compatibility.html
^ permalink raw reply [relevance 5%]
* [dpdk-dev] [PATCH v9 0/9] Policy Based Power Control for Guest
2017-10-03 14:08 3% ` [dpdk-dev] [PATCH v3 0/9] Policy Based Power Control for Guest David Hunt
@ 2017-10-11 16:18 2% ` David Hunt
2017-10-12 0:23 0% ` Ferruh Yigit
1 sibling, 1 reply; 200+ results
From: David Hunt @ 2017-10-11 16:18 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V9 patchset changes:
* Rebased on top of the tip of the master branch
* changed port_id from uint8 to uint16 due to changes elsewhere
V8 patchset changes:
* Added Ack's and Reviewed-by's to individual patches in the set so as to
keep patchwork A/R/T flags properly in sync.
V7 patchset changes:
* Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
int64_t to int
V6 patchset changes:
* Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
* changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
as it can return negative error codes.
* Removed bool enum from channel_commands.h, including stdbool.h instead.
* Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
* Renamed a few variables to be more readable.
* Added returns in a few places if failed to get info on domain.
* Fixed power_manager_init to keep track of num_freqs for each core.
* In power_manager_scale_core_med(), changed a hardcoded '5' to instead
be calculated from the centre of the frequency list
(global_core_freq_info[core_num].num_freqs / 2)
V5 patchset changes:
* Removed most of the #ifdef I40_PMD as it will be applicable to
other PMDs in the future.
* Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
to a const struct ether_addr *, rather than casting it later in the
function.
V4 patchset changes:
* None, re-post to mailing list under the correct email thread.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 2%]
* Re: [dpdk-dev] [dpdk-techboard] next techboard meeting (13th, October)
2017-10-11 12:48 0% ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
@ 2017-10-11 12:53 0% ` Wiles, Keith
0 siblings, 0 replies; 200+ results
From: Wiles, Keith @ 2017-10-11 12:53 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: DPDK, techboard, Olivier MATZ
> On Oct 11, 2017, at 7:48 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 11/10/2017 14:41, Wiles, Keith:
>>> On Oct 11, 2017, at 4:36 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
>>> 1) ABI stability:
>>> - one LTS per year
>>> - 17.11 to be a LTS
>>> - every new API has the "experimental" tag
>>> - 3 Acks are needed for deprecation and they should come from different companies
>>> reference: http://dpdk.org/ml/archives/dev/2017-October/077937.html
>>> reference: http://dpdk.org/ml/archives/dev/2017-October/077935.html
>>
>> I assume the person or company that pushes the notice can be one of the ACKs is this correct?
>>
>> Also does the ACK need to come from a person working for a company or can this person be an independent developer? Maybe a very minor point, but someone that is working for a company could Ack independent of the company if so stated. Just be careful how you word the requirement, something like ‘Only one Ack per company or independent developer’
>
> As an open community, we should avoid sorting people per company.
> I prefer talking about different areas of interest.
> Anyway considering acks is a matter of confidence.
> We cannot have strict rules, but we can provide some guidelines.
Sounds reasonable.
Regards,
Keith
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [dpdk-techboard] next techboard meeting (13th, October)
2017-10-11 12:41 0% ` Wiles, Keith
@ 2017-10-11 12:48 0% ` Thomas Monjalon
2017-10-11 12:53 0% ` Wiles, Keith
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-11 12:48 UTC (permalink / raw)
To: dev; +Cc: techboard, Wiles, Keith, Olivier MATZ
11/10/2017 14:41, Wiles, Keith:
> > On Oct 11, 2017, at 4:36 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
> > 1) ABI stability:
> > - one LTS per year
> > - 17.11 to be a LTS
> > - every new API has the "experimental" tag
> > - 3 Acks are needed for deprecation and they should come from different companies
> > reference: http://dpdk.org/ml/archives/dev/2017-October/077937.html
> > reference: http://dpdk.org/ml/archives/dev/2017-October/077935.html
>
> I assume the person or company that pushes the notice can be one of the ACKs is this correct?
>
> Also does the ACK need to come from a person working for a company or can this person be an independent developer? Maybe a very minor point, but someone that is working for a company could Ack independent of the company if so stated. Just be careful how you word the requirement, something like ‘Only one Ack per company or independent developer’
As an open community, we should avoid sorting people per company.
I prefer talking about different areas of interest.
Anyway considering acks is a matter of confidence.
We cannot have strict rules, but we can provide some guidelines.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] next techboard meeting (13th, October)
2017-10-11 9:36 3% [dpdk-dev] next techboard meeting (13th, October) Olivier MATZ
@ 2017-10-11 12:41 0% ` Wiles, Keith
2017-10-11 12:48 0% ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Wiles, Keith @ 2017-10-11 12:41 UTC (permalink / raw)
To: Olivier MATZ; +Cc: dev, techboard
> On Oct 11, 2017, at 4:36 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
>
> Hi all,
>
> The next techboard meeting will happen on IRC #dpdk-board, at 3pm UTC,
> this friday 13th of october.
>
> The agenda is updated here:
> https://annuel.framapad.org/p/r.0c3cc4d1e011214183872a98f6b5c7db
>
>
> 1) ABI stability:
> - one LTS per year
> - 17.11 to be a LTS
> - every new API has the "experimental" tag
> - 3 Acks are needed for deprecation and they should come from different companies
> reference: http://dpdk.org/ml/archives/dev/2017-October/077937.html
> reference: http://dpdk.org/ml/archives/dev/2017-October/077935.html
I assume the person or company that pushes the notice can be one of the ACKs is this correct?
Also does the ACK need to come from a person working for a company or can this person be an independent developer? Maybe a very minor point, but someone that is working for a company could Ack independent of the company if so stated. Just be careful how you word the requirement, something like ‘Only one Ack per company or independent developer’
>
> 2) update on license discussion concerning the optimized version of 64bit division
> code from libdivide
> - any feedback from governing board?
>
> 3) update on IPSec offload (rte_security)
> - the conclusion on this topic was to post concerns/proposals on dpdk-dev
> - is there still something expected from techboard?
>
> Olivier
Regards,
Keith
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper
@ 2017-10-11 11:56 5% ` Adrien Mazarguil
2017-10-11 19:05 5% ` Aaron Conole
0 siblings, 1 reply; 200+ results
From: Adrien Mazarguil @ 2017-10-11 11:56 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ferruh Yigit, Gaetan Rivet, aconole, fbl
On Wed, Oct 11, 2017 at 11:23:12AM +0200, Thomas Monjalon wrote:
> 05/10/2017 11:49, Adrien Mazarguil:
> > rte_flow_error_set() is a convenient helper to initialize error objects.
> >
> > Since there is no fundamental reason to prevent applications from using it,
> > expose it through the public interface after modifying its return value
> > from positive to negative. This is done for consistency with the rest of
> > the public interface.
> >
> > Documentation is updated accordingly.
> >
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > ---
> > --- a/lib/librte_ether/rte_flow.h
> > +++ b/lib/librte_ether/rte_flow.h
> > /**
> > + * Initialize flow error structure.
> > + *
> > + * @param[out] error
> > + * Pointer to flow error structure (may be NULL).
> > + * @param code
> > + * Related error code (rte_errno).
> > + * @param type
> > + * Cause field and error types.
> > + * @param cause
> > + * Object responsible for the error.
> > + * @param message
> > + * Human-readable error message.
> > + *
> > + * @return
> > + * Negative error code (errno value) and rte_errno is set.
> > + */
> > +static inline int
> > +rte_flow_error_set(struct rte_flow_error *error,
> > + int code,
> > + enum rte_flow_error_type type,
> > + const void *cause,
> > + const char *message)
>
> When calling this function, the performance is not critical.
> So it must not be an inline function.
> Please move it to the .c file and add it to the .map file.
I'll do it as part of moving this patch into my upcoming series for mlx4,
since it relies on the new return value.
Now for the record, I believe that static inlines, particularly short ones
that are not expected to be modified any time soon (provided they are
defined properly that is) are harmless.
Yes, that means modifying them, depending on what they do, may cause a
global ABI breakage of the underlying library which translates to a major
version bump, however exactly the same applies to some macros (in particular
the *_MAX ones), structure and other type definitions and so on.
What I'm getting at is, making this function part of the .map file won't
help all that much with the goal of reaching a stable ABI. Making it a
normal function on the other hand successfully prevents PMDs and
applications from considering its use in their data plane (flow rules
management from the data plane is likely the next step for rte_flow).
In my opinion, performance (even if hypothetical) matters more than ABI
stability, particularly since the current pattern is for the whole ABI to be
broken every other release. I think that with DPDK, ABI stability can only
be properly guaranteed in stable/maintenance releases but that effort is
vain in the master branch, affected by way too many changes for it to ever
become reality. This doesn't mean we shouldn't even try, however we
shouldn't restrict ourselves; when the ABI needs to be broken, so be it.
(end of rant, thanks for reading)
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 5%]
* [dpdk-dev] next techboard meeting (13th, October)
@ 2017-10-11 9:36 3% Olivier MATZ
2017-10-11 12:41 0% ` Wiles, Keith
0 siblings, 1 reply; 200+ results
From: Olivier MATZ @ 2017-10-11 9:36 UTC (permalink / raw)
To: dev, techboard
Hi all,
The next techboard meeting will happen on IRC #dpdk-board, at 3pm UTC,
this friday 13th of october.
The agenda is updated here:
https://annuel.framapad.org/p/r.0c3cc4d1e011214183872a98f6b5c7db
1) ABI stability:
- one LTS per year
- 17.11 to be a LTS
- every new API has the "experimental" tag
- 3 Acks are needed for deprecation and they should come from different companies
reference: http://dpdk.org/ml/archives/dev/2017-October/077937.html
reference: http://dpdk.org/ml/archives/dev/2017-October/077935.html
2) update on license discussion concerning the optimized version of 64bit division
code from libdivide
- any feedback from governing board?
3) update on IPSec offload (rte_security)
- the conclusion on this topic was to post concerns/proposals on dpdk-dev
- is there still something expected from techboard?
Olivier
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v2] ethdev: add return value to stats get dev op
2017-10-09 16:12 4% ` [dpdk-dev] [PATCH 2/2] doc: update stats get API change Matan Azrad
@ 2017-10-10 20:20 1% ` Matan Azrad
1 sibling, 0 replies; 200+ results
From: Matan Azrad @ 2017-10-10 20:20 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
The stats_get dev op API doesn't include return value, so PMD cannot
return an error in case of failure at stats getting process time.
Since PCI devices can be removed and there is a time between the
physical removal to the RMV interrupt, the user may get invalid stats
without any indication.
This patch changes the stats_get API return value to be int instead of
void.
All the net PMDs stats_get dev ops are adjusted by this patch.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
V2:
Rebased patch with next_net master.
Adjusted dpaa, octeontx and mrvl PMDs.
Merged release notes patch.
doc/guides/rel_notes/release_17_11.rst | 6 ++++++
drivers/net/af_packet/rte_eth_af_packet.c | 3 ++-
drivers/net/ark/ark_ethdev.c | 9 +++++----
drivers/net/ark/ark_ext.h | 2 +-
drivers/net/ark/ark_global.h | 2 +-
drivers/net/avp/avp_ethdev.c | 6 ++++--
drivers/net/bnx2x/bnx2x_ethdev.c | 4 +++-
drivers/net/bnxt/bnxt_stats.c | 16 ++++++++++++----
drivers/net/bnxt/bnxt_stats.h | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
drivers/net/cxgbe/cxgbe_ethdev.c | 3 ++-
drivers/net/dpaa/dpaa_ethdev.c | 3 ++-
drivers/net/dpaa2/dpaa2_ethdev.c | 10 +++++-----
drivers/net/e1000/em_ethdev.c | 7 ++++---
drivers/net/e1000/igb_ethdev.c | 14 ++++++++------
drivers/net/ena/ena_ethdev.c | 9 +++++----
drivers/net/enic/enic.h | 2 +-
drivers/net/enic/enic_ethdev.c | 4 ++--
drivers/net/enic/enic_main.c | 8 +++++---
drivers/net/failsafe/failsafe_ops.c | 11 +++++++++--
drivers/net/fm10k/fm10k_ethdev.c | 3 ++-
drivers/net/i40e/i40e_ethdev.c | 5 +++--
drivers/net/i40e/i40e_ethdev_vf.c | 5 +++--
drivers/net/ixgbe/ixgbe_ethdev.c | 14 ++++++++------
drivers/net/kni/rte_eth_kni.c | 4 +++-
drivers/net/liquidio/lio_ethdev.c | 4 +++-
drivers/net/mlx4/mlx4.h | 2 +-
drivers/net/mlx4/mlx4_ethdev.c | 3 ++-
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_stats.c | 3 ++-
drivers/net/mrvl/mrvl_ethdev.c | 9 +++++++--
drivers/net/nfp/nfp_net.c | 9 ++++++---
drivers/net/null/rte_eth_null.c | 6 ++++--
drivers/net/octeontx/octeontx_ethdev.c | 12 ++++++++----
drivers/net/pcap/rte_eth_pcap.c | 4 +++-
drivers/net/qede/qede_ethdev.c | 4 +++-
drivers/net/ring/rte_eth_ring.c | 4 +++-
drivers/net/sfc/sfc_ethdev.c | 7 +++++--
drivers/net/szedata2/rte_eth_szedata2.c | 4 +++-
drivers/net/tap/rte_eth_tap.c | 3 ++-
drivers/net/thunderx/nicvf_ethdev.c | 4 +++-
drivers/net/vhost/rte_eth_vhost.c | 4 +++-
drivers/net/virtio/virtio_ethdev.c | 6 ++++--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 6 ++++--
lib/librte_ether/rte_ethdev.c | 3 +--
lib/librte_ether/rte_ethdev.h | 2 +-
46 files changed, 169 insertions(+), 88 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index c184f1e..0513b95 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -216,6 +216,12 @@ API Changes
* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
remove this API as Xen dom0 support was removed.
+* **Add return value to stats_get dev op API**
+
+ The ``stats_get`` dev op API return value has been changed to be int.
+ By this way PMDs can return an error value in case of failure at stats
+ getting process time.
+
ABI Changes
-----------
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 295b7a7..46b8250 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -331,7 +331,7 @@ struct pmd_internals {
dev_info->min_rx_bufsize = 0;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
{
unsigned i, imax;
@@ -364,6 +364,7 @@ struct pmd_internals {
igb_stats->opackets = tx_total;
igb_stats->oerrors = tx_err_total;
igb_stats->obytes = tx_bytes_total;
+ return 0;
}
static void
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 0d60846..dae1f3d 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -65,7 +65,7 @@ static int eth_ark_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
-static void eth_ark_dev_stats_get(struct rte_eth_dev *dev,
+static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
static void eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
@@ -241,7 +241,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(int (*)(struct rte_eth_dev *, void *))
dlsym(ark->d_handle, "dev_set_link_down");
ark->user_ext.stats_get =
- (void (*)(struct rte_eth_dev *, struct rte_eth_stats *,
+ (int (*)(struct rte_eth_dev *, struct rte_eth_stats *,
void *))
dlsym(ark->d_handle, "stats_get");
ark->user_ext.stats_reset =
@@ -816,7 +816,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
uint16_t i;
@@ -835,8 +835,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
for (i = 0; i < dev->data->nb_rx_queues; i++)
eth_rx_queue_stats_get(dev->data->rx_queues[i], stats);
if (ark->user_ext.stats_get)
- ark->user_ext.stats_get(dev, stats,
+ return ark->user_ext.stats_get(dev, stats,
ark->user_data[dev->data->port_id]);
+ return 0;
}
static void
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h
index 63b7a26..d26c819 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/ark_ext.h
@@ -91,7 +91,7 @@ int dev_set_link_up(struct rte_eth_dev *dev,
int dev_set_link_down(struct rte_eth_dev *dev,
void *user_data);
-void stats_get(struct rte_eth_dev *dev,
+int stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats,
void *user_data);
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 2a6375f..aef2cf7 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -97,7 +97,7 @@ struct ark_user_ext {
int (*link_update)(struct rte_eth_dev *, int wait_to_complete, void *);
int (*dev_set_link_up)(struct rte_eth_dev *, void *);
int (*dev_set_link_down)(struct rte_eth_dev *, void *);
- void (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *);
+ int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *);
void (*stats_reset)(struct rte_eth_dev *, void *);
void (*mac_addr_add)(struct rte_eth_dev *,
struct ether_addr *,
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index b5cc955..b97a90c 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -107,7 +107,7 @@ static uint16_t avp_xmit_pkts(void *tx_queue,
static void avp_dev_rx_queue_release(void *rxq);
static void avp_dev_tx_queue_release(void *txq);
-static void avp_dev_stats_get(struct rte_eth_dev *dev,
+static int avp_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static void avp_dev_stats_reset(struct rte_eth_dev *dev);
@@ -2241,7 +2241,7 @@ struct avp_queue {
}
}
-static void
+static int
avp_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2274,6 +2274,8 @@ struct avp_queue {
stats->q_errors[i] += txq->errors;
}
}
+
+ return 0;
}
static void
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 6f62a37..95861a0 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -329,7 +329,7 @@ struct rte_bnx2x_xstats_name_off {
return old_link_status == dev->data->dev_link.link_status ? -1 : 0;
}
-static void
+static int
bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct bnx2x_softc *sc = dev->data->dev_private;
@@ -389,6 +389,8 @@ struct rte_bnx2x_xstats_name_off {
stats->imissed = brb_drops + brb_truncates +
brb_truncate_discard + stats->rx_nombuf;
+
+ return 0;
}
static int
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 87feac6..fe83d37 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -228,9 +228,10 @@ void bnxt_free_stats(struct bnxt *bp)
}
}
-void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
+int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *bnxt_stats)
{
+ int rc = 0;
unsigned int i;
struct bnxt *bp = eth_dev->data->dev_private;
@@ -240,19 +241,26 @@ void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct bnxt_rx_queue *rxq = bp->rx_queues[i];
struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
- bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
+ rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
bnxt_stats, 1);
+ if (unlikely(rc))
+ return rc;
}
for (i = 0; i < bp->tx_cp_nr_rings; i++) {
struct bnxt_tx_queue *txq = bp->tx_queues[i];
struct bnxt_cp_ring_info *cpr = txq->cp_ring;
- bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
+ rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
bnxt_stats, 0);
+ if (unlikely(rc))
+ return rc;
}
- bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
+ rc = bnxt_hwrm_func_qstats(bp, 0xffff, bnxt_stats);
+ if (unlikely(rc))
+ return rc;
bnxt_stats->rx_nombuf = rte_atomic64_read(&bp->rx_mbuf_alloc_fail);
+ return rc;
}
void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/bnxt/bnxt_stats.h b/drivers/net/bnxt/bnxt_stats.h
index daeb3d9..51d16f5 100644
--- a/drivers/net/bnxt/bnxt_stats.h
+++ b/drivers/net/bnxt/bnxt_stats.h
@@ -37,7 +37,7 @@
#include <rte_ethdev.h>
void bnxt_free_stats(struct bnxt *bp);
-void bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
+int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *bnxt_stats);
void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 4bc5329..eb40348 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2370,7 +2370,7 @@ struct bwg_slave {
}
-static void
+static int
bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct bond_dev_private *internals = dev->data->dev_private;
@@ -2398,6 +2398,8 @@ struct bwg_slave {
}
}
+
+ return 0;
}
static void
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 7bca456..02b4f62 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -647,7 +647,7 @@ static void cxgbe_dev_rx_queue_release(void *q)
/*
* Get port statistics.
*/
-static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
+static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *eth_stats)
{
struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
@@ -690,6 +690,7 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
eth_stats->q_obytes[i] = txq->stats.tx_bytes;
eth_stats->q_errors[i] = txq->stats.mapping_err;
}
+ return 0;
}
/*
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 9f33e44..551da20 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -283,7 +283,7 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev,
return 0;
}
-static void dpaa_eth_stats_get(struct rte_eth_dev *dev,
+static int dpaa_eth_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
struct dpaa_if *dpaa_intf = dev->data->dev_private;
@@ -291,6 +291,7 @@ static void dpaa_eth_stats_get(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
fman_if_stats_get(dpaa_intf->fif, stats);
+ return 0;
}
static void dpaa_eth_stats_reset(struct rte_eth_dev *dev)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 39c32b3..1ac607c 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1061,7 +1061,7 @@ static int dpaa2_dev_link_update(struct rte_eth_dev *dev,
"error: Setting the MAC ADDR failed %d\n", ret);
}
static
-void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
+int dpaa2_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
@@ -1076,12 +1076,12 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
if (!dpni) {
RTE_LOG(ERR, PMD, "dpni is NULL\n");
- return;
+ return -EINVAL;
}
if (!stats) {
RTE_LOG(ERR, PMD, "stats is NULL\n");
- return;
+ return -EINVAL;
}
/*Get Counters from page_0*/
@@ -1116,11 +1116,11 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
stats->oerrors = value.page_2.egress_discarded_frames;
stats->imissed = value.page_2.ingress_nobuffer_discards;
- return;
+ return 0;
err:
RTE_LOG(ERR, PMD, "Operation not completed:Error Code = %d\n", retcode);
- return;
+ return retcode;
};
static int
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index a59947d..e724205 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -72,7 +72,7 @@
static void eth_em_allmulticast_disable(struct rte_eth_dev *dev);
static int eth_em_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
-static void eth_em_stats_get(struct rte_eth_dev *dev,
+static int eth_em_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *rte_stats);
static void eth_em_stats_reset(struct rte_eth_dev *dev);
static void eth_em_infos_get(struct rte_eth_dev *dev,
@@ -906,7 +906,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev)
}
/* This function is based on em_update_stats_counters() in e1000/if_em.c */
-static void
+static int
eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1006,7 +1006,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev)
}
if (rte_stats == NULL)
- return;
+ return -EINVAL;
/* Rx Errors */
rte_stats->imissed = stats->mpc;
@@ -1021,6 +1021,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev)
rte_stats->opackets = stats->gptc;
rte_stats->ibytes = stats->gorc;
rte_stats->obytes = stats->gotc;
+ return 0;
}
static void
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 040dd9f..f3b1d70 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -112,7 +112,7 @@
static void eth_igb_allmulticast_disable(struct rte_eth_dev *dev);
static int eth_igb_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
-static void eth_igb_stats_get(struct rte_eth_dev *dev,
+static int eth_igb_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *rte_stats);
static int eth_igb_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -188,7 +188,7 @@ static void eth_igb_default_mac_addr_set(struct rte_eth_dev *dev,
static void igbvf_allmulticast_enable(struct rte_eth_dev *dev);
static void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
static int eth_igbvf_link_update(struct e1000_hw *hw);
-static void eth_igbvf_stats_get(struct rte_eth_dev *dev,
+static int eth_igbvf_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *rte_stats);
static int eth_igbvf_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -1830,7 +1830,7 @@ static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev)
stats->tsctfc += E1000_READ_REG(hw, E1000_TSCTFC);
}
-static void
+static int
eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1840,7 +1840,7 @@ static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev)
igb_read_stats_registers(hw, stats);
if (rte_stats == NULL)
- return;
+ return -EINVAL;
/* Rx Errors */
rte_stats->imissed = stats->mpc;
@@ -1855,6 +1855,7 @@ static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev)
rte_stats->opackets = stats->gptc;
rte_stats->ibytes = stats->gorc;
rte_stats->obytes = stats->gotc;
+ return 0;
}
static void
@@ -2095,7 +2096,7 @@ static int eth_igbvf_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
return IGBVF_NB_XSTATS;
}
-static void
+static int
eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2105,12 +2106,13 @@ static int eth_igbvf_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
igbvf_read_stats_registers(hw, hw_stats);
if (rte_stats == NULL)
- return;
+ return -EINVAL;
rte_stats->ipackets = hw_stats->gprc;
rte_stats->ibytes = hw_stats->gorc;
rte_stats->opackets = hw_stats->gptc;
rte_stats->obytes = hw_stats->gotc;
+ return 0;
}
static void
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 80ce1f3..a62c398 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -205,7 +205,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue,
static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
static int ena_start(struct rte_eth_dev *dev);
static void ena_close(struct rte_eth_dev *dev);
-static void ena_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
+static int ena_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
static void ena_rx_queue_release_all(struct rte_eth_dev *dev);
static void ena_tx_queue_release_all(struct rte_eth_dev *dev);
static void ena_rx_queue_release(void *queue);
@@ -811,7 +811,7 @@ static void ena_stats_restart(struct rte_eth_dev *dev)
rte_atomic64_init(&adapter->drv_stats->rx_nombuf);
}
-static void ena_stats_get(struct rte_eth_dev *dev,
+static int ena_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
struct ena_admin_basic_stats ena_stats;
@@ -821,13 +821,13 @@ static void ena_stats_get(struct rte_eth_dev *dev,
int rc;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return;
+ return -ENOTSUP;
memset(&ena_stats, 0, sizeof(ena_stats));
rc = ena_com_get_dev_basic_stats(ena_dev, &ena_stats);
if (unlikely(rc)) {
RTE_LOG(ERR, PMD, "Could not retrieve statistics from ENA");
- return;
+ return rc;
}
/* Set of basic statistics from ENA */
@@ -846,6 +846,7 @@ static void ena_stats_get(struct rte_eth_dev *dev,
stats->ierrors = rte_atomic64_read(&adapter->drv_stats->ierrors);
stats->oerrors = rte_atomic64_read(&adapter->drv_stats->oerrors);
stats->rx_nombuf = rte_atomic64_read(&adapter->drv_stats->rx_nombuf);
+ return 0;
}
static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index e28f223..da0c176 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -287,7 +287,7 @@ extern int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
extern int enic_disable(struct enic *enic);
extern void enic_remove(struct enic *enic);
extern int enic_get_link_status(struct enic *enic);
-extern void enic_dev_stats_get(struct enic *enic,
+extern int enic_dev_stats_get(struct enic *enic,
struct rte_eth_stats *r_stats);
extern void enic_dev_stats_clear(struct enic *enic);
extern void enic_add_packet_filter(struct enic *enic);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 33a3f87..5386b2a 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -468,13 +468,13 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
return enic_link_update(enic);
}
-static void enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
+static int enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *stats)
{
struct enic *enic = pmd_priv(eth_dev);
ENICPMD_FUNC_TRACE();
- enic_dev_stats_get(enic, stats);
+ return enic_dev_stats_get(enic, stats);
}
static void enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9b0439b..48cfb82 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -156,16 +156,17 @@ void enic_dev_stats_clear(struct enic *enic)
enic_clear_soft_stats(enic);
}
-void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
+int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
{
struct vnic_stats *stats;
struct enic_soft_stats *soft_stats = &enic->soft_stats;
int64_t rx_truncated;
uint64_t rx_packet_errors;
+ int ret = vnic_dev_stats_dump(enic->vdev, &stats);
- if (vnic_dev_stats_dump(enic->vdev, &stats)) {
+ if (ret) {
dev_err(enic, "Error in getting stats\n");
- return;
+ return ret;
}
/* The number of truncated packets can only be calculated by
@@ -191,6 +192,7 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
r_stats->imissed = stats->rx.rx_no_bufs + rx_truncated;
r_stats->rx_nombuf = rte_atomic64_read(&soft_stats->rx_nombuf);
+ return 0;
}
void enic_del_mac_address(struct enic *enic, int mac_index)
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index e0f1b0b..d360965 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -582,18 +582,25 @@
return -1;
}
-static void
+static int
fs_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
struct sub_device *sdev;
uint8_t i;
+ int ret;
rte_memcpy(stats, &PRIV(dev)->stats_accumulator, sizeof(*stats));
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
- rte_eth_stats_get(PORT_ID(sdev), &sdev->stats_snapshot);
+ ret = rte_eth_stats_get(PORT_ID(sdev), &sdev->stats_snapshot);
+ if (ret) {
+ ERROR("Operation rte_eth_stats_get failed for sub_device %d with error %d",
+ i, ret);
+ return ret;
+ }
failsafe_stats_increment(stats, &sdev->stats_snapshot);
}
+ return 0;
}
static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 15ea2a5..2d351c1 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1346,7 +1346,7 @@ static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
return FM10K_NB_XSTATS;
}
-static void
+static int
fm10k_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
uint64_t ipackets, opackets, ibytes, obytes;
@@ -1376,6 +1376,7 @@ static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
stats->opackets = opackets;
stats->ibytes = ibytes;
stats->obytes = obytes;
+ return 0;
}
static void
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 536365d..f7dfb97 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -258,7 +258,7 @@
static void i40e_dev_allmulticast_disable(struct rte_eth_dev *dev);
static int i40e_dev_set_link_up(struct rte_eth_dev *dev);
static int i40e_dev_set_link_down(struct rte_eth_dev *dev);
-static void i40e_dev_stats_get(struct rte_eth_dev *dev,
+static int i40e_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int i40e_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -2728,7 +2728,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)
}
/* Get all statistics of a port */
-static void
+static int
i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2828,6 +2828,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)
ns->checksum_error);
PMD_DRV_LOG(DEBUG, "fdir_match: %"PRIu64"", ns->fd_sb_match);
PMD_DRV_LOG(DEBUG, "***************** PF stats end ********************");
+ return 0;
}
/* Reset the statistics */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 111ac39..a52321a 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -108,7 +108,7 @@ static void i40evf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int i40evf_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
-static void i40evf_dev_stats_get(struct rte_eth_dev *dev,
+static int i40evf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -2230,7 +2230,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev)
};
}
-static void
+static int
i40evf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
int ret;
@@ -2253,6 +2253,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev)
} else {
PMD_DRV_LOG(ERR, "Get statistics failed");
}
+ return ret;
}
static void
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index a7d7acc..d22d7ac 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -176,7 +176,7 @@
static void ixgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
static int ixgbe_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
-static void ixgbe_dev_stats_get(struct rte_eth_dev *dev,
+static int ixgbe_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int ixgbe_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -269,7 +269,7 @@ static int ixgbevf_dev_link_update(struct rte_eth_dev *dev,
static int ixgbevf_dev_reset(struct rte_eth_dev *dev);
static void ixgbevf_intr_disable(struct ixgbe_hw *hw);
static void ixgbevf_intr_enable(struct ixgbe_hw *hw);
-static void ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
+static int ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
@@ -3104,7 +3104,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
/*
* This function is based on ixgbe_update_stats_counters() in ixgbe/ixgbe.c
*/
-static void
+static int
ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct ixgbe_hw *hw =
@@ -3126,7 +3126,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
&total_qbrc, &total_qprc, &total_qprdc);
if (stats == NULL)
- return;
+ return -EINVAL;
/* Fill out the rte_eth_stats statistics structure */
stats->ipackets = total_qprc;
@@ -3157,6 +3157,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
/* Tx Errors */
stats->oerrors = 0;
+ return 0;
}
static void
@@ -3568,7 +3569,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
return IXGBEVF_NB_XSTATS;
}
-static void
+static int
ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
@@ -3577,12 +3578,13 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
ixgbevf_update_stats(dev);
if (stats == NULL)
- return;
+ return -EINVAL;
stats->ipackets = hw_stats->vfgprc;
stats->ibytes = hw_stats->vfgorc;
stats->opackets = hw_stats->vfgptc;
stats->obytes = hw_stats->vfgotc;
+ return 0;
}
static void
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 72a2733..d290c79 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -283,7 +283,7 @@ struct pmd_internals {
return 0;
}
-static void
+static int
eth_kni_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned long rx_packets_total = 0, rx_bytes_total = 0;
@@ -320,6 +320,8 @@ struct pmd_internals {
stats->opackets = tx_packets_total;
stats->obytes = tx_bytes_total;
stats->oerrors = tx_packets_err_total;
+
+ return 0;
}
static void
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index a3c8e67..5407e39 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -311,7 +311,7 @@ struct rte_lio_xstats_name_off {
}
/* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */
-static void
+static int
lio_dev_stats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *stats)
{
@@ -359,6 +359,8 @@ struct rte_lio_xstats_name_off {
stats->ibytes = bytes;
stats->ipackets = pkts;
stats->ierrors = drop;
+
+ return 0;
}
static void
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 93e5502..9bd2acc 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -117,7 +117,7 @@ struct priv {
int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
-void mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
+int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
void mlx4_stats_reset(struct rte_eth_dev *dev);
void mlx4_dev_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *info);
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index a9e8059..8962be1 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -571,7 +571,7 @@
* @param[out] stats
* Stats structure output buffer.
*/
-void
+int
mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct rte_eth_stats tmp;
@@ -613,6 +613,7 @@
tmp.oerrors += txq->stats.odropped;
}
*stats = tmp;
+ return 0;
}
/**
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 643bab6..bcdcc26 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -236,7 +236,7 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *,
/* mlx5_stats.c */
void priv_xstats_init(struct priv *);
-void mlx5_stats_get(struct rte_eth_dev *, struct rte_eth_stats *);
+int mlx5_stats_get(struct rte_eth_dev *, struct rte_eth_stats *);
void mlx5_stats_reset(struct rte_eth_dev *);
int mlx5_xstats_get(struct rte_eth_dev *,
struct rte_eth_xstat *, unsigned int);
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 6b4772c..5e225d3 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -318,7 +318,7 @@ struct mlx5_counter_ctrl {
* @param[out] stats
* Stats structure output buffer.
*/
-void
+int
mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct priv *priv = mlx5_get_priv(dev);
@@ -373,6 +373,7 @@ struct mlx5_counter_ctrl {
#endif
*stats = tmp;
priv_unlock(priv);
+ return 0;
}
/**
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 46879a4..4beaa1d 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -845,8 +845,11 @@ struct mrvl_txq {
* Pointer to Ethernet device structure.
* @param stats
* Stats structure output buffer.
+ *
+ * @return
+ * 0 on success, negative error value otherwise.
*/
-static void
+static int
mrvl_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct mrvl_priv *priv = dev->data->dev_private;
@@ -919,7 +922,7 @@ struct mrvl_txq {
ret = pp2_ppio_get_statistics(priv->ppio, &ppio_stats, 0);
if (unlikely(ret)) {
RTE_LOG(ERR, PMD, "Failed to update port statistics\n");
- return;
+ return ret;
}
stats->ipackets += ppio_stats.rx_packets - drop_mac;
@@ -930,6 +933,8 @@ struct mrvl_txq {
ppio_stats.rx_fifo_dropped +
ppio_stats.rx_cls_dropped;
stats->ierrors = drop_mac;
+
+ return 0;
}
/**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 4ef9d2b..0917b9c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -88,7 +88,7 @@ static int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
uint16_t nb_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
static int nfp_net_start(struct rte_eth_dev *dev);
-static void nfp_net_stats_get(struct rte_eth_dev *dev,
+static int nfp_net_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static void nfp_net_stats_reset(struct rte_eth_dev *dev);
static void nfp_net_stop(struct rte_eth_dev *dev);
@@ -1027,7 +1027,7 @@ enum nfp_qcp_ptr {
return -1;
}
-static void
+static int
nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
int i;
@@ -1113,8 +1113,11 @@ enum nfp_qcp_ptr {
nfp_dev_stats.imissed -= hw->eth_stats_base.imissed;
- if (stats)
+ if (stats) {
memcpy(stats, &nfp_dev_stats, sizeof(*stats));
+ return 0;
+ }
+ return -EINVAL;
}
static void
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index fa9313d..47c7b14 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -298,7 +298,7 @@ struct pmd_internals {
dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
{
unsigned i, num_stats;
@@ -306,7 +306,7 @@ struct pmd_internals {
const struct pmd_internals *internal;
if ((dev == NULL) || (igb_stats == NULL))
- return;
+ return -EINVAL;
internal = dev->data->dev_private;
num_stats = RTE_MIN((unsigned)RTE_ETHDEV_QUEUE_STAT_CNTRS,
@@ -333,6 +333,8 @@ struct pmd_internals {
igb_stats->ipackets = rx_total;
igb_stats->opackets = tx_total;
igb_stats->oerrors = tx_err_total;
+
+ return 0;
}
static void
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d41904f..d5f236e 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -199,7 +199,7 @@ enum octeontx_link_speed {
nic->port_id, en ? "set" : "unset");
}
-static void
+static int
octeontx_port_stats(struct octeontx_nic *nic, struct rte_eth_stats *stats)
{
octeontx_mbox_bgx_port_stats_t bgx_stats;
@@ -208,8 +208,10 @@ enum octeontx_link_speed {
PMD_INIT_FUNC_TRACE();
res = octeontx_bgx_port_stats(nic->port_id, &bgx_stats);
- if (res < 0)
+ if (res < 0) {
octeontx_log_err("failed to get port stats %d", nic->port_id);
+ return res;
+ }
stats->ipackets = bgx_stats.rx_packets;
stats->ibytes = bgx_stats.rx_bytes;
@@ -221,6 +223,8 @@ enum octeontx_link_speed {
octeontx_log_dbg("port %d get stats done inpkts=%ld outpkts=%ld",
nic->port_id, stats->ipackets, stats->opackets);
+
+ return 0;
}
static void
@@ -574,13 +578,13 @@ enum octeontx_link_speed {
return octeontx_atomic_write_link_status(dev, &link);
}
-static void
+static int
octeontx_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
PMD_INIT_FUNC_TRACE();
- octeontx_port_stats(nic, stats);
+ return octeontx_port_stats(nic, stats);
}
static void
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index b51f16c..1b8a74e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -560,7 +560,7 @@ struct pmd_devargs {
dev_info->min_rx_bufsize = 0;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned int i;
@@ -592,6 +592,8 @@ struct pmd_devargs {
stats->opackets = tx_packets_total;
stats->obytes = tx_bytes_total;
stats->oerrors = tx_packets_err_total;
+
+ return 0;
}
static void
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index fe130d4..a238781 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1460,7 +1460,7 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
}
-static void
+static int
qede_get_stats(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats)
{
struct qede_dev *qdev = eth_dev->data->dev_private;
@@ -1544,6 +1544,8 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
if (j == txq_stat_cntrs)
break;
}
+
+ return 0;
}
static unsigned
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index e3fa7b0..61473ca 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -190,7 +190,7 @@ struct pmd_internals {
dev_info->min_rx_bufsize = 0;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned i;
@@ -214,6 +214,8 @@ struct pmd_internals {
stats->ipackets = rx_total;
stats->opackets = tx_total;
stats->oerrors = tx_err_total;
+
+ return 0;
}
static void
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 7a57472..5b089dc 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -521,16 +521,18 @@
sfc_adapter_unlock(sa);
}
-static void
+static int
sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct sfc_adapter *sa = dev->data->dev_private;
struct sfc_port *port = &sa->port;
uint64_t *mac_stats;
+ int ret;
rte_spinlock_lock(&port->mac_stats_lock);
- if (sfc_port_update_mac_stats(sa) != 0)
+ ret = sfc_port_update_mac_stats(sa);
+ if (ret != 0)
goto unlock;
mac_stats = port->mac_stats_buf;
@@ -587,6 +589,7 @@
unlock:
rte_spinlock_unlock(&port->mac_stats_lock);
+ return ret;
}
static void
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index d141acf..c5486b7 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1042,7 +1042,7 @@ struct pmd_internals {
dev_info->speed_capa = ETH_LINK_SPEED_100G;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
@@ -1077,6 +1077,8 @@ struct pmd_internals {
stats->ibytes = rx_total_bytes;
stats->obytes = tx_total_bytes;
stats->oerrors = tx_err_total;
+
+ return 0;
}
static void
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 52380b4..61c6774 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -687,7 +687,7 @@ enum ioctl_mode {
DEV_TX_OFFLOAD_TCP_CKSUM);
}
-static void
+static int
tap_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *tap_stats)
{
unsigned int i, imax;
@@ -728,6 +728,7 @@ enum ioctl_mode {
tap_stats->opackets = tx_total;
tap_stats->oerrors = tx_err_total;
tap_stats->obytes = tx_bytes_total;
+ return 0;
}
static void
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4654a4c..551b371 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -242,7 +242,7 @@ static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
return -ENOTSUP;
}
-static void
+static int
nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
uint16_t qidx;
@@ -332,6 +332,8 @@ static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
stats->opackets += port_stats.tx_bcast_frames_ok;
stats->opackets += port_stats.tx_mcast_frames_ok;
stats->oerrors = port_stats.tx_drops;
+
+ return 0;
}
static const uint32_t *
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 04179b4..3534649 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -890,7 +890,7 @@ struct vhost_xstats_name_off {
dev_info->min_rx_bufsize = 0;
}
-static void
+static int
eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned i;
@@ -928,6 +928,8 @@ struct vhost_xstats_name_off {
stats->oerrors = tx_missed_total;
stats->ibytes = rx_total_bytes;
stats->obytes = tx_total_bytes;
+
+ return 0;
}
static void
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e320811..8660074 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -76,7 +76,7 @@ static int virtio_dev_link_update(struct rte_eth_dev *dev,
static void virtio_set_hwaddr(struct virtio_hw *hw);
static void virtio_get_hwaddr(struct virtio_hw *hw);
-static void virtio_dev_stats_get(struct rte_eth_dev *dev,
+static int virtio_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int virtio_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
@@ -964,10 +964,12 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
return count;
}
-static void
+static int
virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
virtio_update_stats(dev, stats);
+
+ return 0;
}
static void
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 1cc3ffd..58bc4f2 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -87,7 +87,7 @@ static int __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
static int vmxnet3_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw);
-static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
+static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats,
@@ -1034,7 +1034,7 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
return count;
}
-static void
+static int
vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
unsigned int i;
@@ -1080,6 +1080,8 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
stats->ierrors += rxStats.pktsRxError;
stats->rx_nombuf += rxStats.pktsRxOutOfBuf;
}
+
+ return 0;
}
static void
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3c5441e..d88f734 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1531,8 +1531,7 @@ struct rte_eth_dev *
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
- (*dev->dev_ops->stats_get)(dev, stats);
- return 0;
+ return (*dev->dev_ops->stats_get)(dev, stats);
}
int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8e928da..71e6b33 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1207,7 +1207,7 @@ typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
int wait_to_complete);
/**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
-typedef void (*eth_stats_get_t)(struct rte_eth_dev *dev,
+typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
struct rte_eth_stats *igb_stats);
/**< @internal Get global I/O statistics of an Ethernet device. */
--
1.8.3.1
^ permalink raw reply [relevance 1%]
* Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
@ 2017-10-10 16:00 3% ` Aaron Conole
2017-10-11 22:34 0% ` Thomas Monjalon
2017-10-12 5:39 0% ` Shreyansh Jain
0 siblings, 2 replies; 200+ results
From: Aaron Conole @ 2017-10-10 16:00 UTC (permalink / raw)
To: Shreyansh Jain
Cc: Don Provan, Jan Blunck, Thomas Monjalon, dev, Hemant Agrawal
Shreyansh Jain <shreyansh.jain@nxp.com> writes:
> Hello Don,
>
> On Monday 09 October 2017 11:51 PM, Don Provan wrote:
>>> -----Original Message-----
>>> From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com]
>>> Sent: Monday, October 09, 2017 4:10 AM
>>> To: Jan Blunck <jblunck@infradead.org>; Thomas Monjalon
>>> <thomas@monjalon.net>
>>> Cc: dev <dev@dpdk.org>; Hemant Agrawal <hemant.agrawal@nxp.com>
>>> Subject: Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail
>>>
>>> ...
>>> This is where I have disagreement/doubt.
>>> Reporting error code from rte_bus_scan would do two things:
>>>
>>> 1. rte_eal_init is not designed to ignore/log-only these errors - it
>>> would quit initialization. (But, this can be changed)
>>> 2. What should rte_eal_init do with this error? rte_bus_scan would have
>>> already printed the problematic bus->scan() failure.
>>
>> These practical problems confirm to me that the failure of a bus
>> scan is more of a strategic issue: when asking "which devices can
>> I use?", "none" is a perfectly valid answer that does not seem
>> like an error to me even when a failed bus scan is the reason for
>> that answer.
>
> I agree with this.
>
>>
>> From the application's point of view, the potential error here
>> is that the device it wants to use isn't available. I don't see that
>> either the init function or the probe function will have enough
>> information to understand that application-level problem, so
>> they should leave it to the application to detect it.
>
> I think I understand you comment but just want to cross check again:
> Scan or probe error should simply be ignored by EAL layer and let the
> application take stance when it detects that the device it was looking
> for is missing. Is my understanding correct?
>
> I am trying to come a conclusion so that this patch can either be
> modified or pushed as it is. If the above understanding is correct, I
> don't see any changes required in the patch.
Does it make sense to introduce a way to query the results of the
various bus types for their status? That way we can give the relevant
information to the application if it wants, and make the bus scanning
code *always* succeed? This version shouldn't be an ABI breakage,
either (confirm?).
half-baked below (not tested or suitable - just an example):
---
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index a30a898..cd1ef1e 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -38,9 +38,23 @@
#include "eal_private.h"
+struct rte_bus_failure {
+ struct rte_bus *bus;
+ int err;
+};
+
struct rte_bus_list rte_bus_list =
TAILQ_HEAD_INITIALIZER(rte_bus_list);
+TAILQ_HEAD(rte_bus_scan_failure_list, rte_bus_failure);
+struct rte_bus_scan_failure_list rte_bus_scan_failure_list =
+ TAILQ_HEAD_INITIALIZER(rte_bus_failure);
+
+TAILQ_HEAD(rte_bus_probe_failure_list, rte_bus_failure);
+struct rte_bus_probe_failure_list rte_bus_probe_failure_list =
+ TAILQ_HEAD_INITIALIZER(rte_bus_failure);
+
+
void
rte_bus_register(struct rte_bus *bus)
{
@@ -64,6 +78,26 @@ rte_bus_unregister(struct rte_bus *bus)
RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name);
}
+static void
+rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
+{
+ struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
+ if (!f) abort();
+ f->bus = bus;
+ f->ret = ret;
+ TAILQ_INSERT_TAIL(&rte_bus_scan_failure_list, f, next);
+}
+
+static void
+rte_bus_append_failed_scan(struct rte_bus *bus, int ret)
+{
+ struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure));
+ if (!f) abort();
+ f->bus = bus;
+ f->ret = ret;
+ TAILQ_INSERT_TAIL(&rte_bus_probe_failure_list, f, next);
+}
+
/* Scan all the buses for registered devices */
int
rte_bus_scan(void)
@@ -76,13 +110,33 @@ rte_bus_scan(void)
if (ret) {
RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
bus->name);
- return ret;
+ rte_bus_append_failed_scan(bus, ret);
}
}
return 0;
}
+/* Seek through scan failures */
+void
+rte_bus_scan_errors(rte_bus_error_callback cb)
+{
+ struct rte_bus_failure *f = NULL;
+ TAILQ_FOREACH(f, &rte_bus_scan_failure_list, next) {
+ cb(f->bus, f->ret);
+ }
+}
+
+/* Seek through probe failures */
+void
+rte_bus_probe_errors(rte_bus_error_callback cb)
+{
+ struct rte_bus_failure *f = NULL;
+ TAILQ_FOREACH(f, &rte_bus_probe_failure_list, next) {
+ cb(f->bus, f->ret);
+ }
+}
+
/* Probe all devices of all buses */
int
rte_bus_probe(void)
@@ -100,7 +154,7 @@ rte_bus_probe(void)
if (ret) {
RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
bus->name);
- return ret;
+ rte_bus_append_failed_probe(bus, ret);
}
}
@@ -109,7 +163,7 @@ rte_bus_probe(void)
if (ret) {
RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
vbus->name);
- return ret;
+ rte_bus_append_failed_probe(bus, ret);
}
}
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index 6fb0834..daddb28 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -231,6 +231,20 @@ void rte_bus_register(struct rte_bus *bus);
*/
void rte_bus_unregister(struct rte_bus *bus);
+typedef void (*rte_bus_error_callback)(struct rte_bus *bus, int err);
+
+/**
+ * Search through all buses, invoking cb for each bus which reports scan
+ * error.
+ */
+void rte_bus_scan_errors(rte_bus_error_callback cb);
+
+/**
+ * Search through all buses, invoking cb for each bus which reports scan
+ * error.
+ */
+void rte_bus_probe_errors(rte_bus_error_callback cb);
+
/**
* Scan all the buses.
*
--
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH] drivers: update DPAA2 libs ABIVER and build reproducibility
@ 2017-10-10 15:48 5% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-10 15:48 UTC (permalink / raw)
To: Hemant Agrawal; +Cc: dev, ferruh.yigit
10/10/2017 16:15, Hemant Agrawal:
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> drivers/bus/fslmc/Makefile | 3 ++-
> drivers/crypto/dpaa2_sec/Makefile | 3 ++-
> drivers/event/dpaa2/Makefile | 3 ++-
> drivers/mempool/dpaa2/Makefile | 3 ++-
> drivers/net/dpaa2/Makefile | 3 ++-
> 5 files changed, 10 insertions(+), 5 deletions(-)
Why are you changing LIBABIVER in all these libs?
Generally speaking, a driver should not upgrade its ABI version,
because it should have no interface.
The ABI version must be changed in the patch breaking the ABI.
If you do it later, it must be a fix with Fixes line.
This way we will have the reference to the code breaking the ABI.
^ permalink raw reply [relevance 5%]
* Re: [dpdk-dev] [PATCH v3] rte_vhost: added user callbacks for socket open/close
@ 2017-10-10 3:14 0% ` Yuanhan Liu
0 siblings, 0 replies; 200+ results
From: Yuanhan Liu @ 2017-10-10 3:14 UTC (permalink / raw)
To: Dariusz Stojaczyk; +Cc: dev, Pawel Wodkowski, jfreimann, maxime.coquelin
On Wed, Aug 30, 2017 at 12:50:58PM +0200, Dariusz Stojaczyk wrote:
> Added new callbacks to notify about socket connection status.
> As destroy_device is used for virtqueue processing *pause* as well as
> connection close, the user has no distinction between those.
>
> Consider the following scenario:
> rte_vhost: received SET_VRING_BASE message,
> calling destroy_device() as usual
>
> user: end-user asks to remove the device (together with socket file),
> OK, device is not *in use* - that's NOT the behavior we want
> calling rte_vhost_driver_unregister() etc.
>
> Instead of changing new_device/destroy_device callbacks and breaking
> the ABI, a set of new functions new_connection/destroy_connection
> has been added.
>
> Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
> ---
> v3: improved err-handling path and updated commit msg
> v2: also updated vhost_lib.rst
The doc update is missing. I have cherry-picked it from v2.
Applied to dpdk-next-virtio.
Thanks.
--yliu
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v8 0/9] Policy Based Power Control for Guest
2017-10-05 14:34 2% ` [dpdk-dev] [PATCH v8 " David Hunt
@ 2017-10-09 22:34 0% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2017-10-09 22:34 UTC (permalink / raw)
To: David Hunt, dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
On 10/5/2017 3:34 PM, David Hunt wrote:
> Policy Based Power Control for Guest
>
> This patchset adds the facility for a guest VM to send a policy down to the
> host that will allow the host to scale up/down cpu frequencies
> depending on the policy criteria independently of the DPDK app running in
> the guest. This differs from the previous vm_power implementation where
> individual scale up/down requests were send from the guest to the host via
> virtio-serial.
>
> V8 patchset changes:
> * Added Ack's and Reviewed-by's to individual patches in the set so as to
> keep patchwork A/R/T flags properly in sync.
>
> V7 patchset changes:
> * Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
> int64_t to int
>
> V6 patchset changes:
> * Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
> * changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
> as it can return negative error codes.
> * Removed bool enum from channel_commands.h, including stdbool.h instead.
> * Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
> * Renamed a few variables to be more readable.
> * Added returns in a few places if failed to get info on domain.
> * Fixed power_manager_init to keep track of num_freqs for each core.
> * In power_manager_scale_core_med(), changed a hardcoded '5' to instead
> be calculated from the centre of the frequency list
> (global_core_freq_info[core_num].num_freqs / 2)
>
> V5 patchset changes:
> * Removed most of the #ifdef I40_PMD as it will be applicable to
> other PMDs in the future.
> * Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
> to a const struct ether_addr *, rather than casting it later in the
> function.
>
> V4 patchset changes:
> * None, re-post to mailing list under the correct email thread.
>
> V3 patchset changes:
> * Changed to using is_same_ether_addr() instead of looping through
> the mac address bytes to compare them.
> * Tweaked some comments and working in the i40e patch after review.
> * Added a patch to the set to add new i40e function to map file, so
> as to allow shared library builds. The power library API needs a cleanup
> in next release, so will add API/ABI warning for this cleanup in a
> separate patch.
>
> V2 patchset changes:
> * Removed API's in ethdev layer.
> * Now just a single new API in the i40e driver for mapping VF MAC to
> VF index.
> * Moved new function from rte_rxtx.c to rte_pmd_i40e.c
> * Removed function for reading i40e register, moved to using the
> standard stats API.
> * Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
> * Cleaned up policy generation code.
>
> It's a modification of the vm_power_manager app that runs in the host, and
> the guest_vm_power_app example app that runs in the guest. This allows the
> guest to send down a policy to the host via virtio-serial, which then allows
> the host to scale up/down based on the criteria in the policy, resulting in
> quicker scale up/down than individual requests coming from the guest.
> It also means that the DPDK application running in the guest does not need
> to be modified in any way, it is unaware that it's cores are being scaled
> up/down, reducing the effort in implementing a power-aware infrastructure.
>
> The usage model is as follows:
> 1. Set up the VF's and assign to the guest in the usual way.
> 2. run vm_power_manager on the host, creating a channel to the guest.
> 3. Start the guest_vm_power_mgr app on the guest, which establishes
> a virtio-serial channel to the host.
> 4. Send down the profile for the guest using the "send_profile now" command.
> There is an example profile hard-coded into guest_vm_power_mgr.
> 5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
> 6. Send traffic into the VFs at varying traffic rates.
> Observe the frequency change on the host (turbostat -i 1)
>
> The sequence of code changes are as follows:
>
> A new function has been aded to the i40e driver to allow mapping of
> a VF MAC to VF index.
>
> Next we make an addition to librte_power that adds an extra command to allow
> the passing of a policy structure from the guest to the host. This struct
> contains information like busy/quiet hour, packet throughput thresholds, etc.
>
> The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
> physical CPU (pcpu) IDs so that the host can scale up/down the cores used
> in the guest.
>
> The remaining patches are functionality to process the policy, and take action
> when the relevant trigger occurs to cause a frequency change.
Hi Dave,
Can you please rebase the set on top of latest main repo?
There are two set of changes:
1- There are more i40e updates in main repo, conflicts with this one.
2- Port id increased to 16 bits, there are some code still using uint8_t
in this patch
Thanks,
ferruh
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH 2/2] doc: update stats get API change
@ 2017-10-09 16:12 4% ` Matan Azrad
2017-10-10 20:20 1% ` [dpdk-dev] [PATCH v2] ethdev: add return value to stats get dev op Matan Azrad
1 sibling, 0 replies; 200+ results
From: Matan Azrad @ 2017-10-09 16:12 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1410 bytes --]
Updated change info in release_17.11.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
doc/guides/rel_notes/release_17_11.rst | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 36139e5..b62083d 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -75,7 +75,7 @@ New Features
The Membership Library is an extension and generalization of a traditional
filter (for example Bloom Filter) structure that has multiple usages in a wide
variety of workloads and applications. In general, the Membership Library is a
- data structure that provides a “set-summary” and responds to set-membership
+ data structure that provides a ���set-summary��� and responds to set-membership
queries whether a certain member belongs to a set(s).
See the :ref:`Membership Library <Member_Library>` documentation in
@@ -199,6 +199,12 @@ API Changes
* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
remove this API as Xen dom0 support was removed.
+* **Add return value to stats_get dev op API**
+
+ The stats_get dev op API return value has been changed to be int.
+ By this way PMDs can return an error value in case of failure at stats
+ getting process time.
+
ABI Changes
-----------
--
1.8.3.1
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h
2017-10-05 13:13 0% ` Jan Blunck
@ 2017-10-09 1:04 0% ` Tan, Jianfeng
0 siblings, 0 replies; 200+ results
From: Tan, Jianfeng @ 2017-10-09 1:04 UTC (permalink / raw)
To: Jan Blunck
Cc: dev, Richardson, Bruce, Ananyev, Konstantin, De Lara Guarch,
Pablo, Thomas Monjalon, yliu, Maxime Coquelin, Tetsuya Mukawa,
Yigit, Ferruh
Hi Jan,
> -----Original Message-----
> From: jblunck@gmail.com [mailto:jblunck@gmail.com] On Behalf Of Jan
> Blunck
> Sent: Thursday, October 5, 2017 9:14 PM
> To: Tan, Jianfeng
> Cc: dev; Richardson, Bruce; Ananyev, Konstantin; De Lara Guarch, Pablo;
> Thomas Monjalon; yliu@fridaylinux.org; Maxime Coquelin; Tetsuya Mukawa;
> Yigit, Ferruh
> Subject: Re: [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on
> rte_vdev.h
>
> On Thu, Sep 28, 2017 at 3:55 PM, Jianfeng Tan <jianfeng.tan@intel.com>
> wrote:
> > The helper API, rte_cryptodev_vdev_pmd_init(), has a parameter of
> > struct rte_vdev_device *, which needs to include rte_vdev.h.
> >
> > We will move vdev into drivers/bus, so we need to avoid such
> > dependency. And also, we cannot break the ABI.
> >
> > This patch changes that pointer to void *, and defines an internal
> > structure same with struct rte_vdev_device.
> >
>
> This code duplication is unnecessary. Also you are doing evil thinks
> and define a type with the same name in multiple places. Look at my
> series how to do this properly.
>
Moving related things into header file is also my plan. Thank for doing that, I'll rebase on your patchset.
Thanks,
Jianfeng
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-06 23:27 0% ` Mokhtar, Amr
@ 2017-10-07 11:42 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-07 11:42 UTC (permalink / raw)
To: Mokhtar, Amr; +Cc: dev, fbl, aconole, bluca
07/10/2017 01:27, Mokhtar, Amr:
>
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Thursday 5 October 2017 23:23
> > To: Mokhtar, Amr <amr.mokhtar@intel.com>
> > Cc: dev@dpdk.org; fbl@redhat.com; aconole@redhat.com; bluca@debian.org
> > Subject: Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
> >
> > 05/10/2017 23:55, Mokhtar, Amr:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > 03/10/2017 16:29, Mokhtar, Amr:
> > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > > 25/08/2017 15:46, Amr Mokhtar:
> > > > > > > +int
> > > > > > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > > > > > + const struct rte_bbdev_conf *conf);
> > > > > >
> > > > > > I am not convinced by the "configure all" function in ethdev.
> > > > > > We break the ABI each time we add a new feature to configure.
> > > > > > And it does not really help to have all configurations in one struct.
> > > > > > Would you mind to split the struct rte_bbdev_conf and split the
> > > > > > function accordingly?
> > > > >
> > > > > There is nothing to split tbh. The only parameter it has is the socket_id.
> > > > > And in fact, it's optional, can be null. The only config we need is
> > num_queues.
> > > >
> > > > Indeed, there is nothing in this struct.
> > > > If you need only to allocate queues, you just have to rename this function.
> > > >
> > > > > I don't see in the near future that we may need to add more config params.
> > > > > As a side, in the time of the implementation we were trying to
> > > > > avoid any diversions from the current design ideology of ethdev and
> > cryptodev.
> > > >
> > > > There is no ideology in ethdev, just some mistakes ;)
> > > >
> > > > > Can we leave it for consideration with future releases?
> > > >
> > > > No it should be addressed from the beginning.
> > > >
> > > > When you will need to add something more to configure port-wise, you
> > > > should add a new function instead of breaking the ABI of the global conf
> > struct.
> > > > That's why the configure option should be more specialized.
> > > >
> > > > Distro people were complaining about ABI breakage last week.
> > > > This is exactly an example of how to avoid it from the beginning.
> > > >
> > >
> > > Ok, got your point. I was looking at it from an API-only standpoint.
> > > How about modifying it into?
> > > int
> > > rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int
> > > socket_id);
> >
> > Yes OK
> >
> > [...]
> > > > > > > +struct __rte_cache_aligned rte_bbdev {
> > > > > > > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue
> > function */
> > > > > > > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue
> > function */
> > > > > > > + const struct rte_bbdev_ops *dev_ops; /**< Functions
> > > > > > > +exported by PMD
> > > > > > */
> > > > > > > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > > > > > > + bool attached; /**< If device is currently attached or not
> > > > > > > +*/
> > > > > >
> > > > > > What "attached" means?
> > > > > > I'm afraid you are trying to manage hotplug in the wrong layer.
> > > > >
> > > > > Hotplug is not supported in the current release.
> > > >
> > > > It is not answering the question.
> > > > What is an "attached" device?
> > >
> > > "Attached" means that the PCI device was probed and the bbdev device slot is
> > allocated.
> > > For software devices, means that a virtual bbdev device (vdev) is allocated for
> > bbdev.
> > > Same way the "attached" approach used in cryptodev.
> >
> > Not sure to understand.
> > If "attached" means "allocated", when is it false?
>
> Currently in bbdev, it is set to true and never goes false.
> As I said the Hotplug feature is not fully supported in the current version. I can remove that flag for now.
>
> But generally, it should be cleared to false when rte_pci_driver->remove function is called. (Hotplug?)
Hotplug is still a work in progress in DPDK.
Please remove this flag if it is useless.
We will add something if needed when hotplug support will be better designed.
> > [...]
> > > > > > > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > > > > > > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > > > > > > + int status; /**< Status of operation that was performed */
> > > > > > > + struct rte_mempool *mempool; /**< Mempool which op
> > instance
> > > > > > > +is in
> > > > > > */
> > > > > > > + void *opaque_data; /**< Opaque pointer for user data */
> > > > > > > + /**
> > > > > > > + * Anonymous union of operation-type specific parameters.
> > > > > > > +When
> > > > > > allocated
> > > > > > > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > > > > > > + * parameters at the end of each rte_bbdev_op structure, and
> > the
> > > > > > > + * pointers here point to it.
> > > > > > > + */
> > > > > > > + RTE_STD_C11
> > > > > > > + union {
> > > > > > > + void *generic;
> > > > > > > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > > > > > > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > > > > > > + };
> > > > > > > +};
> > > > > >
> > > > > > I am not sure it is a good idea to fit every operations in the
> > > > > > same struct and the same functions.
> > > > >
> > > > > Due to the fact that our design adopts this idea that a device can
> > > > > support both the encode and decode operations.
> > > > > Then, at the time of PMD registration, the enqueue functions is allocated.
> > > > > This enqueue() function is common for both operations.
> > > > > This fitted operation structure is essential for the driver to
> > > > > decide on the
> > > > operation.
> > > >
> > > > Sorry I do not understand why you must have a "generic operation".
> > > > Please, could you try again to explain this design to someone not
> > > > fully understanding how turbo enc/dec works?
> > >
> > > Oh, sorry, I was not paying attention that you're referring to "void *generic"
> > > It is just a place-holder for any other operation types. Can be removed if you
> > like.
> >
> > No I was not referring to void *generic.
> > It is the same question as in the RFC.
> > I don't understand the benefit of grouping different things in an union.
>
> There is no benefit, this is a restriction because there is only one function pointer
> for enq and another one for deq in the ops structure. Again for the same reason
> of trying to keep things in sync with ethdev and cryptodev.
> I've always wanted to make it as you proposed, that way it is more performant
> (no checking for the type of operation.) If this is agreed, I will do it with all my pleasure :)
>
> The optimum solution though IMHO would be to make the generic enq/deq function pointers
> per queue, instead of being per device; that way every enqueue goes straight to
> the queue-specific function that matches its operation type.
> Notice that currently we have turbo_enc/turbo_dec, but in the future we may have more..
Please do not impose some restrictions to your API just because you want
to mimic ethdev.
Feel free to innovate :)
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-05 22:22 0% ` Thomas Monjalon
@ 2017-10-06 23:27 0% ` Mokhtar, Amr
2017-10-07 11:42 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Mokhtar, Amr @ 2017-10-06 23:27 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, fbl, aconole, bluca
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday 5 October 2017 23:23
> To: Mokhtar, Amr <amr.mokhtar@intel.com>
> Cc: dev@dpdk.org; fbl@redhat.com; aconole@redhat.com; bluca@debian.org
> Subject: Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
>
> 05/10/2017 23:55, Mokhtar, Amr:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 03/10/2017 16:29, Mokhtar, Amr:
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > 25/08/2017 15:46, Amr Mokhtar:
> > > > > > +int
> > > > > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > > > > + const struct rte_bbdev_conf *conf);
> > > > >
> > > > > I am not convinced by the "configure all" function in ethdev.
> > > > > We break the ABI each time we add a new feature to configure.
> > > > > And it does not really help to have all configurations in one struct.
> > > > > Would you mind to split the struct rte_bbdev_conf and split the
> > > > > function accordingly?
> > > >
> > > > There is nothing to split tbh. The only parameter it has is the socket_id.
> > > > And in fact, it's optional, can be null. The only config we need is
> num_queues.
> > >
> > > Indeed, there is nothing in this struct.
> > > If you need only to allocate queues, you just have to rename this function.
> > >
> > > > I don't see in the near future that we may need to add more config params.
> > > > As a side, in the time of the implementation we were trying to
> > > > avoid any diversions from the current design ideology of ethdev and
> cryptodev.
> > >
> > > There is no ideology in ethdev, just some mistakes ;)
> > >
> > > > Can we leave it for consideration with future releases?
> > >
> > > No it should be addressed from the beginning.
> > >
> > > When you will need to add something more to configure port-wise, you
> > > should add a new function instead of breaking the ABI of the global conf
> struct.
> > > That's why the configure option should be more specialized.
> > >
> > > Distro people were complaining about ABI breakage last week.
> > > This is exactly an example of how to avoid it from the beginning.
> > >
> >
> > Ok, got your point. I was looking at it from an API-only standpoint.
> > How about modifying it into?
> > int
> > rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int
> > socket_id);
>
> Yes OK
>
> [...]
> > > > > > +struct __rte_cache_aligned rte_bbdev {
> > > > > > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue
> function */
> > > > > > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue
> function */
> > > > > > + const struct rte_bbdev_ops *dev_ops; /**< Functions
> > > > > > +exported by PMD
> > > > > */
> > > > > > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > > > > > + bool attached; /**< If device is currently attached or not
> > > > > > +*/
> > > > >
> > > > > What "attached" means?
> > > > > I'm afraid you are trying to manage hotplug in the wrong layer.
> > > >
> > > > Hotplug is not supported in the current release.
> > >
> > > It is not answering the question.
> > > What is an "attached" device?
> >
> > "Attached" means that the PCI device was probed and the bbdev device slot is
> allocated.
> > For software devices, means that a virtual bbdev device (vdev) is allocated for
> bbdev.
> > Same way the "attached" approach used in cryptodev.
>
> Not sure to understand.
> If "attached" means "allocated", when is it false?
Currently in bbdev, it is set to true and never goes false.
As I said the Hotplug feature is not fully supported in the current version. I can remove that flag for now.
But generally, it should be cleared to false when rte_pci_driver->remove function is called. (Hotplug?)
>
> [...]
> > > > > > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > > > > > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > > > > > + int status; /**< Status of operation that was performed */
> > > > > > + struct rte_mempool *mempool; /**< Mempool which op
> instance
> > > > > > +is in
> > > > > */
> > > > > > + void *opaque_data; /**< Opaque pointer for user data */
> > > > > > + /**
> > > > > > + * Anonymous union of operation-type specific parameters.
> > > > > > +When
> > > > > allocated
> > > > > > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > > > > > + * parameters at the end of each rte_bbdev_op structure, and
> the
> > > > > > + * pointers here point to it.
> > > > > > + */
> > > > > > + RTE_STD_C11
> > > > > > + union {
> > > > > > + void *generic;
> > > > > > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > > > > > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > > > > > + };
> > > > > > +};
> > > > >
> > > > > I am not sure it is a good idea to fit every operations in the
> > > > > same struct and the same functions.
> > > >
> > > > Due to the fact that our design adopts this idea that a device can
> > > > support both the encode and decode operations.
> > > > Then, at the time of PMD registration, the enqueue functions is allocated.
> > > > This enqueue() function is common for both operations.
> > > > This fitted operation structure is essential for the driver to
> > > > decide on the
> > > operation.
> > >
> > > Sorry I do not understand why you must have a "generic operation".
> > > Please, could you try again to explain this design to someone not
> > > fully understanding how turbo enc/dec works?
> >
> > Oh, sorry, I was not paying attention that you're referring to "void *generic"
> > It is just a place-holder for any other operation types. Can be removed if you
> like.
>
> No I was not referring to void *generic.
> It is the same question as in the RFC.
> I don't understand the benefit of grouping different things in an union.
There is no benefit, this is a restriction because there is only one function pointer
for enq and another one for deq in the ops structure. Again for the same reason
of trying to keep things in sync with ethdev and cryptodev.
I've always wanted to make it as you proposed, that way it is more performant
(no checking for the type of operation.) If this is agreed, I will do it with all my pleasure :)
The optimum solution though IMHO would be to make the generic enq/deq function pointers
per queue, instead of being per device; that way every enqueue goes straight to
the queue-specific function that matches its operation type.
Notice that currently we have turbo_enc/turbo_dec, but in the future we may have more..
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] ABI/API stability in DPDK
2017-10-06 16:21 9% [dpdk-dev] ABI/API stability in DPDK Mcnamara, John
2017-10-06 16:27 4% ` Ferruh Yigit
@ 2017-10-06 17:15 4% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-06 17:15 UTC (permalink / raw)
To: Mcnamara, John
Cc: dev, Kevin Traynor, Stokes, Ian, Luca Boccassi, techboard,
aconole, ktraynor
06/10/2017 18:21, Mcnamara, John:
> Hi,
>
> At the recent DPDK 2017 Userspace in Dublin we had a discussion about API/ABI stability with representation from Intel, OVS-DPDK, Debian, Red Hat and plenty of input from the floor.
>
> The main consensus after looking at different proposals was to maintain the current process (http://dpdk.org/doc/guides/contributing/versioning.html) but to try enforce it more rigidly.
>
> The main points to come out of this discussion were:
>
> 1. That 3 Acks are still needed for deprecation and they should come from different companies.
>
> 2. ABI checks to be run as part of the CI/testing so that patches that break ABI are flagged early. Note, ABI checks can be run manually as follows: http://dpdk.org/doc/guides/contributing/versioning.html#running-the-abi-validator
>
> 3. New API's will be marked as experimental by default for 1 release minimum. This is to address the most common case for breakage which is in new APIs.
Thanks for the summary, John.
The points 1 and 3 must be approved by the technical board.
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] ABI/API stability in DPDK
2017-10-06 16:21 9% [dpdk-dev] ABI/API stability in DPDK Mcnamara, John
@ 2017-10-06 16:27 4% ` Ferruh Yigit
2017-10-06 17:15 4% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Ferruh Yigit @ 2017-10-06 16:27 UTC (permalink / raw)
To: Mcnamara, John, dev; +Cc: Kevin Traynor, Stokes, Ian, Luca Boccassi
On 10/6/2017 5:21 PM, Mcnamara, John wrote:
> Hi,
>
> At the recent DPDK 2017 Userspace in Dublin we had a discussion about API/ABI stability with representation from Intel, OVS-DPDK, Debian, Red Hat and plenty of input from the floor.
>
>
> The main consensus after looking at different proposals was to maintain the current process (http://dpdk.org/doc/guides/contributing/versioning.html) but to try enforce it more rigidly.
>
>
>
>
>
> The main points to come out of this discussion were:
>
>
>
> 1. That 3 Acks are still needed for deprecation and they should come from different companies.
>
>
>
> 2. ABI checks to be run as part of the CI/testing so that patches that break ABI are flagged early. Note, ABI checks can be run manually as follows: http://dpdk.org/doc/guides/contributing/versioning.html#running-the-abi-validator
>
>
>
> 3. New API's will be marked as experimental by default for 1 release minimum. This is to address the most common case for breakage which is in new APIs.
Do we have data for this? Is it really new APIs get broken?
>
>
> If I missed, or misrepresented, anything please update in a reply.
>
> John
>
>
^ permalink raw reply [relevance 4%]
* [dpdk-dev] ABI/API stability in DPDK
@ 2017-10-06 16:21 9% Mcnamara, John
2017-10-06 16:27 4% ` Ferruh Yigit
2017-10-06 17:15 4% ` Thomas Monjalon
0 siblings, 2 replies; 200+ results
From: Mcnamara, John @ 2017-10-06 16:21 UTC (permalink / raw)
To: dev; +Cc: Kevin Traynor, Stokes, Ian, Luca Boccassi
Hi,
At the recent DPDK 2017 Userspace in Dublin we had a discussion about API/ABI stability with representation from Intel, OVS-DPDK, Debian, Red Hat and plenty of input from the floor.
The main consensus after looking at different proposals was to maintain the current process (http://dpdk.org/doc/guides/contributing/versioning.html) but to try enforce it more rigidly.
The main points to come out of this discussion were:
1. That 3 Acks are still needed for deprecation and they should come from different companies.
2. ABI checks to be run as part of the CI/testing so that patches that break ABI are flagged early. Note, ABI checks can be run manually as follows: http://dpdk.org/doc/guides/contributing/versioning.html#running-the-abi-validator
3. New API's will be marked as experimental by default for 1 release minimum. This is to address the most common case for breakage which is in new APIs.
If I missed, or misrepresented, anything please update in a reply.
John
^ permalink raw reply [relevance 9%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
2017-10-06 13:31 0% ` Gaëtan Rivet
2017-10-06 14:29 0% ` Thomas Monjalon
@ 2017-10-06 16:02 0% ` Thomas Monjalon
2017-10-11 21:21 0% ` Ferruh Yigit
3 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-06 16:02 UTC (permalink / raw)
To: Ferruh Yigit, Nelio Laranjeiro
Cc: dev, Zhiyong Yang, Gaetan Rivet, Declan Doherty
06/10/2017 04:15, Ferruh Yigit:
> On 9/29/2017 8:17 AM, Zhiyong Yang wrote:
> > Zhiyong Yang (5):
> > net/bonding: remove bonding APIs using ABI versioning
> > ethdev: increase port_id range
> > examples: increase port_id range
> > test: increase port_id range
> > librte_mbuf: modify port initialization value
>
> Series applied to dpdk-next-net/master, thanks.
>
> There was merge conflict for:
> rte_eth_bond_pmd.c
> failsafe_private.h
> mlx5_rxtx.h
>
> Maintainers of these files cc'ed, can you please double check latest
> files in next-net?
I have re-done the merge of this series in master because
it was wrong for mlx5, as notified by Nelio.
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH V3 3/5] ethdev: add new api for traffic metering and policing
@ 2017-10-06 14:45 1% ` Cristian Dumitrescu
0 siblings, 0 replies; 200+ results
From: Cristian Dumitrescu @ 2017-10-06 14:45 UTC (permalink / raw)
To: dev
Cc: thomas, adrien.mazarguil, jingjing.wu, hemant.agrawal,
jerin.jacob, jasvinder.singh
This patch introduces new ethdev generic API for Traffic Metering and
Policing (MTR), which is yet another standard RX offload for Ethernet
devices.
Similar to rte_flow and rte_tm APIs, the configuration of MTR objects is
done in their own namespace (rte_mtr) within the librte_ether library.
Main features:
1. Traffic metering: determine the color for the current packet (green,
yellow, red) based on history maintained by the MTR object. Supported
algorithms: srTCM (RFC 2697), trTCM (RFC 2698 and RFC 4115).
2. Policing (per meter output color actions): re-color the packet (keep
or change the meter output color) or drop the packet.
3. Statistics
4. Capability API
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
Changes in v3:
- None
Changes in v2:
- Implemented input from Hemant:
- Added support for RFC 4115 trTCM algorithm
- Added support for meter pass-through mode: see API functions
rte_mtr_meter_enable() and rte_mtr_meter_disable()
- Implemented input from Jerin:
- Added capability API
- Implemented input from Thomas:
- Added new API functions under the EXPERIMENTAL section in map file
- Improved the mechanism for MTR object chaining: each MTR object can be
configured whther to read input color from a previous MTR object in the
same flow (if any) of from DSCP traslation table
- Improved run-time update functions
- Doxygen: added more descriptions, small fixes
Changes in v1 (from RFC [1]):
- Implemented input from Thomas:
- Added EXPERIMENTAL tag in rte_mtr.h and MANTAINERS for this new API
- Implemented input from Adrien:
- Added more Doxygen comments to re-inforce relationship between MTR and
flow
- Doxygen: added hook in doxy-api-index.md
[1] RFC: http://www.dpdk.org/ml/archives/dev/2017-May/066888.html
MAINTAINERS | 4 +
doc/api/doxy-api-index.md | 1 +
lib/librte_ether/Makefile | 3 +
lib/librte_ether/rte_ethdev_version.map | 18 +
lib/librte_ether/rte_mtr.c | 229 ++++++++++
lib/librte_ether/rte_mtr.h | 723 ++++++++++++++++++++++++++++++++
lib/librte_ether/rte_mtr_driver.h | 221 ++++++++++
7 files changed, 1199 insertions(+)
create mode 100644 lib/librte_ether/rte_mtr.c
create mode 100644 lib/librte_ether/rte_mtr.h
create mode 100644 lib/librte_ether/rte_mtr_driver.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 5c3abf9..bce6b6f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -260,6 +260,10 @@ M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
T: git://dpdk.org/next/dpdk-next-tm
F: lib/librte_ether/rte_tm*
+Traffic Metering and Policing API - EXPERIMENTAL
+M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
+F: lib/librte_ether/rte_mtr*
+
Crypto API
M: Declan Doherty <declan.doherty@intel.com>
F: lib/librte_cryptodev/
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 19e0d4f..b2342a9 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[ethctrl] (@ref rte_eth_ctrl.h),
[rte_flow] (@ref rte_flow.h),
[rte_tm] (@ref rte_tm.h),
+ [rte_mtr] (@ref rte_mtr.h),
[cryptodev] (@ref rte_cryptodev.h),
[eventdev] (@ref rte_eventdev.h),
[metrics] (@ref rte_metrics.h),
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 201cb96..35ba5d9 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -46,6 +46,7 @@ LIBABIVER := 7
SRCS-y += rte_ethdev.c
SRCS-y += rte_flow.c
SRCS-y += rte_tm.c
+SRCS-y += rte_mtr.c
SRCS-y += ethdev_profile.c
#
@@ -60,5 +61,7 @@ SYMLINK-y-include += rte_flow.h
SYMLINK-y-include += rte_flow_driver.h
SYMLINK-y-include += rte_tm.h
SYMLINK-y-include += rte_tm_driver.h
+SYMLINK-y-include += rte_mtr.h
+SYMLINK-y-include += rte_mtr_driver.h
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map
index 07f9e17..c8f59a0 100644
--- a/lib/librte_ether/rte_ethdev_version.map
+++ b/lib/librte_ether/rte_ethdev_version.map
@@ -194,3 +194,21 @@ DPDK_17.11 {
rte_eth_dev_reset;
} DPDK_17.08;
+
+EXPERIMENTAL {
+ global:
+
+ rte_mtr_capabilities_get;
+ rte_mtr_meter_profile_add;
+ rte_mtr_meter_profile_delete;
+ rte_mtr_create;
+ rte_mtr_destroy;
+ rte_mtr_meter_enable;
+ rte_mtr_meter_disable;
+ rte_mtr_meter_profile_update;
+ rte_mtr_meter_dscp_table_update;
+ rte_mtr_policer_actions_update;
+ rte_mtr_stats_update;
+ rte_mtr_stats_read;
+
+} DPDK_17.11;
diff --git a/lib/librte_ether/rte_mtr.c b/lib/librte_ether/rte_mtr.c
new file mode 100644
index 0000000..6526a97
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.c
@@ -0,0 +1,229 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr_driver.h"
+#include "rte_mtr.h"
+
+/* Get generic traffic metering & policing operations structure from a port. */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint8_t port_id, struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ const struct rte_mtr_ops *ops;
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ rte_mtr_error_set(error,
+ ENODEV,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENODEV));
+ return NULL;
+ }
+
+ if ((dev->dev_ops->mtr_ops_get == NULL) ||
+ (dev->dev_ops->mtr_ops_get(dev, &ops) != 0) ||
+ (ops == NULL)) {
+ rte_mtr_error_set(error,
+ ENOSYS,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENOSYS));
+ return NULL;
+ }
+
+ return ops;
+}
+
+#define RTE_MTR_FUNC(port_id, func) \
+({ \
+ const struct rte_mtr_ops *ops = \
+ rte_mtr_ops_get(port_id, error); \
+ if (ops == NULL) \
+ return -rte_errno; \
+ \
+ if (ops->func == NULL) \
+ return -rte_mtr_error_set(error, \
+ ENOSYS, \
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, \
+ NULL, \
+ rte_strerror(ENOSYS)); \
+ \
+ ops->func; \
+})
+
+/* MTR capabilities get */
+int
+rte_mtr_capabilities_get(uint8_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, capabilities_get)(dev,
+ cap, error);
+}
+
+/* MTR meter profile add */
+int
+rte_mtr_meter_profile_add(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_add)(dev,
+ meter_profile_id, profile, error);
+}
+
+/** MTR meter profile delete */
+int
+rte_mtr_meter_profile_delete(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_delete)(dev,
+ meter_profile_id, error);
+}
+
+/** MTR object create */
+int
+rte_mtr_create(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, create)(dev,
+ mtr_id, params, shared, error);
+}
+
+/** MTR object destroy */
+int
+rte_mtr_destroy(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, destroy)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter enable */
+int
+rte_mtr_meter_enable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_enable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter disable */
+int
+rte_mtr_meter_disable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_disable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter profile update */
+int
+rte_mtr_meter_profile_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_update)(dev,
+ mtr_id, meter_profile_id, error);
+}
+
+/** MTR object meter DSCP table update */
+int
+rte_mtr_meter_dscp_table_update(uint8_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_dscp_table_update)(dev,
+ mtr_id, dscp_table, error);
+}
+
+/** MTR object policer action update */
+int
+rte_mtr_policer_actions_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, policer_actions_update)(dev,
+ mtr_id, action_mask, actions, error);
+}
+
+/** MTR object enabled stats update */
+int
+rte_mtr_stats_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_update)(dev,
+ mtr_id, stats_mask, error);
+}
+
+/** MTR object stats read */
+int
+rte_mtr_stats_read(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_read)(dev,
+ mtr_id, stats, stats_mask, clear, error);
+}
diff --git a/lib/librte_ether/rte_mtr.h b/lib/librte_ether/rte_mtr.h
new file mode 100644
index 0000000..f0f897f
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.h
@@ -0,0 +1,723 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation.
+ * Copyright(c) 2017 NXP.
+ * Copyright(c) 2017 Cavium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_H__
+#define __INCLUDE_RTE_MTR_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API
+ *
+ * This interface provides the ability to configure the traffic metering and
+ * policing (MTR) in a generic way.
+ *
+ * The processing done for each input packet hitting a MTR object is:
+ * A) Traffic metering: The packet is assigned a color (the meter output
+ * color), based on the previous history of the flow reflected in the
+ * current state of the MTR object, according to the specific traffic
+ * metering algorithm. The traffic metering algorithm can typically work
+ * in color aware mode, in which case the input packet already has an
+ * initial color (the input color), or in color blind mode, which is
+ * equivalent to considering all input packets initially colored as green.
+ * B) Policing: There is a separate policer action configured for each meter
+ * output color, which can:
+ * a) Drop the packet.
+ * b) Keep the same packet color: the policer output color matches the
+ * meter output color (essentially a no-op action).
+ * c) Recolor the packet: the policer output color is different than
+ * the meter output color.
+ * The policer output color is the output color of the packet, which is
+ * set in the packet meta-data (i.e. struct rte_mbuf::sched::color).
+ * C) Statistics: The set of counters maintained for each MTR object is
+ * configurable and subject to the implementation support. This set
+ * includes the number of packets and bytes dropped or passed for each
+ * output color.
+ *
+ * Once successfully created, an MTR object is linked to one or several flows
+ * through the meter action of the flow API.
+ * A) Whether an MTR object is private to a flow or potentially shared by
+ * several flows has to be specified at creation time.
+ * B) Several meter actions can be potentially registered for the same flow.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ */
+#include <stdint.h>
+
+#include <rte_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Color
+ */
+enum rte_mtr_color {
+ RTE_MTR_GREEN = 0, /**< Green */
+ RTE_MTR_YELLOW, /**< Yellow */
+ RTE_MTR_RED, /**< Red */
+ RTE_MTR_COLORS /**< Number of colors. */
+};
+
+/**
+ * Statistics counter type
+ */
+enum rte_mtr_stats_type {
+ /** Number of packets passed as green by the policer. */
+ RTE_MTR_STATS_N_PKTS_GREEN = 1 << 0,
+
+ /** Number of bytes passed as green by the policer. */
+ RTE_MTR_STATS_N_BYTES_GREEN = 1 << 1,
+
+ /** Number of packets passed as yellow by the policer. */
+ RTE_MTR_STATS_N_PKTS_YELLOW = 1 << 2,
+
+ /** Number of bytes passed as yellow by the policer. */
+ RTE_MTR_STATS_N_BYTES_YELLOW = 1 << 3,
+
+ /** Number of packets passed as red by the policer. */
+ RTE_MTR_STATS_N_PKTS_RED = 1 << 4,
+
+ /** Number of bytes passed as red by the policer. */
+ RTE_MTR_STATS_N_BYTES_RED = 1 << 5,
+
+ /** Number of packets dropped by the policer. */
+ RTE_MTR_STATS_N_PKTS_DROPPED = 1 << 6,
+
+ /** Number of bytes dropped by the policer. */
+ RTE_MTR_STATS_N_BYTES_DROPPED = 1 << 7,
+};
+
+/**
+ * Statistics counters
+ */
+struct rte_mtr_stats {
+ /** Number of packets passed by the policer (per color). */
+ uint64_t n_pkts[RTE_MTR_COLORS];
+
+ /** Number of bytes passed by the policer (per color). */
+ uint64_t n_bytes[RTE_MTR_COLORS];
+
+ /** Number of packets dropped by the policer. */
+ uint64_t n_pkts_dropped;
+
+ /** Number of bytes passed by the policer. */
+ uint64_t n_bytes_dropped;
+};
+
+/**
+ * Traffic metering algorithms
+ */
+enum rte_mtr_algorithm {
+ /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
+ RTE_MTR_SRTCM_RFC2697,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
+ RTE_MTR_TRTCM_RFC2698,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
+ RTE_MTR_TRTCM_RFC4115,
+};
+
+/**
+ * Meter profile
+ */
+struct rte_mtr_meter_profile {
+ /** Traffic metering algorithm. */
+ enum rte_mtr_algorithm alg;
+
+ RTE_STD_C11
+ union {
+ /** Items only valid when *alg* is set to srTCM - RFC 2697. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Committed Burst Size (CBS) (bytes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } srtcm_rfc2697;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 2698. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Peak Information Rate (PIR) (bytes/second). */
+ uint64_t pir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Peak Burst Size (PBS) (bytes). */
+ uint64_t pbs;
+ } trtcm_rfc2698;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 4115. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Excess Information Rate (EIR) (bytes/second). */
+ uint64_t eir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } trtcm_rfc4115;
+ };
+};
+
+/**
+ * Policer actions
+ */
+enum rte_mtr_policer_action {
+ /** Recolor the packet as green. */
+ MTR_POLICER_ACTION_COLOR_GREEN = 0,
+
+ /** Recolor the packet as yellow. */
+ MTR_POLICER_ACTION_COLOR_YELLOW,
+
+ /** Recolor the packet as red. */
+ MTR_POLICER_ACTION_COLOR_RED,
+
+ /** Drop the packet. */
+ MTR_POLICER_ACTION_DROP,
+};
+
+/**
+ * Parameters for each traffic metering & policing object
+ *
+ * @see enum rte_mtr_stats_type
+ */
+struct rte_mtr_params {
+ /** Meter profile ID. */
+ uint32_t meter_profile_id;
+
+ /** Meter input color in case of MTR object chaining. When non-zero: if
+ * a previous MTR object is enabled in the same flow, then the color
+ * determined by the latest MTR object in the same flow is used as the
+ * input color by the current MTR object, otherwise the current MTR
+ * object uses the *dscp_table* to determine the input color. When zero:
+ * the color determined by any previous MTR object in same flow is
+ * ignored by the current MTR object, which uses the *dscp_table* to
+ * determine the input color.
+ */
+ int use_prev_mtr_color;
+
+ /** Meter input color. When non-NULL: it points to a pre-allocated and
+ * pre-populated table with exactly 64 elements providing the input
+ * color for each value of the IPv4/IPv6 Differentiated Services Code
+ * Point (DSCP) input packet field. When NULL: it is equivalent to
+ * setting this parameter to an all-green populated table (i.e. table
+ * with all the 64 elements set to green color). The color blind mode
+ * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
+ * to either NULL or to an all-green populated table. When
+ * *use_prev_mtr_color* is non-zero value or when *dscp_table* contains
+ * at least one yellow or red color element, then the color aware mode
+ * is configured.
+ */
+ enum rte_mtr_color *dscp_table;
+
+ /** Non-zero to enable the meter, zero to disable the meter at the time
+ * of MTR object creation.
+ * @see rte_mtr_meter_disable()
+ */
+ int meter_enable;
+
+ /** Policer actions (per meter output color). */
+ enum rte_mtr_policer_action action[RTE_MTR_COLORS];
+
+ /** Set of stats counters to be enabled.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * MTR capabilities
+ */
+struct rte_mtr_capabilities {
+ /** Maximum number of MTR objects. */
+ uint32_t n_max;
+
+ /** Maximum number of MTR objects that can be shared by multiple flows.
+ * The value of zero indicates that shared MTR objects are not
+ * supported. The maximum value is *n_max*.
+ */
+ uint32_t n_shared_max;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * cannot be shared by multiple flows have identical capability set.
+ */
+ int identical;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * can be shared by multiple flows have identical capability set.
+ */
+ int shared_identical;
+
+ /** Maximum number of flows that can share the same MTR object. The
+ * value of zero is invalid. The value of 1 means that shared MTR
+ * objects not supported.
+ */
+ uint32_t shared_n_flows_per_mtr_max;
+
+ /** Maximum number of MTR objects that can be part of the same flow. The
+ * value of zero is invalid. The value of 1 indicates that MTR object
+ * chaining is not supported. The maximum value is *n_max*.
+ */
+ uint32_t chaining_n_mtrs_per_flow_max;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object can be used as the packet input color by any subsequent
+ * MTR object from the same flow. When zero, it indicates that the color
+ * determined by one MTR object is always ignored by any subsequent MTR
+ * object from the same flow. Only valid when MTR chaining is supported,
+ * i.e. *chaining_n_mtrs_per_flow_max* is greater than 1. When non-zero,
+ * it also means that the color aware mode is supported by at least one
+ * metering algorithm.
+ */
+ int chaining_use_prev_mtr_color_supported;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object is always used as the packet input color by any subsequent
+ * MTR object that is part of the same flow. When zero, it indicates
+ * that whether the color determined by one MTR object is either ignored
+ * or used as the packet input color by any subsequent MTR object from
+ * the same flow is individually configurable for each MTR object. Only
+ * valid when *chaining_use_prev_mtr_color_supported* is non-zero.
+ */
+ int chaining_use_prev_mtr_color_enforced;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the srTCM RFC 2697 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_srtcm_rfc2697_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 2698 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc2698_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 4115 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc4115_n_max;
+
+ /** Maximum traffic rate that can be metered by a single MTR object. For
+ * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
+ * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
+ * value for the sum of PIR and EIR rates.
+ */
+ uint64_t meter_rate_max;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the srTCM RFC 2697 metering algorithm.
+ */
+ int color_aware_srtcm_rfc2697_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 2698 metering algorithm.
+ */
+ int color_aware_trtcm_rfc2698_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 4115 metering algorithm.
+ */
+ int color_aware_trtcm_rfc4115_supported;
+
+ /** When non-zero, it indicates that the policer packet recolor actions
+ * are supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_recolor_supported;
+
+ /** When non-zero, it indicates that the policer packet drop action is
+ * supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_drop_supported;
+
+ /** Set of supported statistics counter types.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * Verbose error types.
+ *
+ * Most of them provide the type of the object referenced by struct
+ * rte_mtr_error::cause.
+ */
+enum rte_mtr_error_type {
+ RTE_MTR_ERROR_TYPE_NONE, /**< No error. */
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
+ RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
+ RTE_MTR_ERROR_TYPE_METER_PROFILE,
+ RTE_MTR_ERROR_TYPE_MTR_ID,
+ RTE_MTR_ERROR_TYPE_MTR_PARAMS,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
+ RTE_MTR_ERROR_TYPE_STATS_MASK,
+ RTE_MTR_ERROR_TYPE_STATS,
+ RTE_MTR_ERROR_TYPE_SHARED,
+};
+
+/**
+ * Verbose error structure definition.
+ *
+ * This object is normally allocated by applications and set by PMDs, the
+ * message points to a constant string which does not need to be freed by
+ * the application, however its pointer can be considered valid only as long
+ * as its associated DPDK port remains configured. Closing the underlying
+ * device or unloading the PMD invalidates it.
+ *
+ * Both cause and message may be NULL regardless of the error type.
+ */
+struct rte_mtr_error {
+ enum rte_mtr_error_type type; /**< Cause field and error type. */
+ const void *cause; /**< Object responsible for the error. */
+ const char *message; /**< Human-readable error message. */
+};
+
+/**
+ * MTR capabilities get
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] cap
+ * MTR capabilities. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_capabilities_get(uint8_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile add
+ *
+ * Create a new meter profile with ID set to *meter_profile_id*. The new profile
+ * is used to create one or several MTR objects.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * ID for the new meter profile. Needs to be unused by any of the existing
+ * meter profiles added for the current port.
+ * @param[in] profile
+ * Meter profile parameters. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_add(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile delete
+ *
+ * Delete an existing meter profile. This operation fails when there is
+ * currently at least one user (i.e. MTR object) of this profile.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * Meter profile ID. Needs to be the valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_delete(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object create
+ *
+ * Create a new MTR object for the current port. This object is run as part of
+ * associated flow action for traffic metering and policing.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be unused by any of the existing MTR objects.
+ * created for the current port.
+ * @param[in] params
+ * MTR object params. Needs to be pre-allocated and valid.
+ * @param[in] shared
+ * Non-zero when this MTR object can be shared by multiple flows, zero when
+ * this MTR object can be used by a single flow.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_flow_action_type::RTE_FLOW_ACTION_TYPE_METER
+ */
+int
+rte_mtr_create(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object destroy
+ *
+ * Delete an existing MTR object. This operation fails when there is currently
+ * at least one user (i.e. flow) of this MTR object.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * created for the current port.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_destroy(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter disable
+ *
+ * Disable the meter of an existing MTR object. In disabled state, the meter of
+ * the current MTR object works in pass-through mode, meaning that for each
+ * input packet the meter output color is always the same as the input color. In
+ * particular, when the meter of the current MTR object is configured in color
+ * blind mode, the input color is always green, so the meter output color is
+ * also always green. Note that the policer and the statistics of the current
+ * MTR object are working as usual while the meter is disabled. No action is
+ * taken and this function returns successfully when the meter of the current
+ * MTR object is already disabled.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_disable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter enable
+ *
+ * Enable the meter of an existing MTR object. If the MTR object has its meter
+ * already enabled, then no action is taken and this function returns
+ * successfully.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_enable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter profile update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] meter_profile_id
+ * Meter profile ID for the current MTR object. Needs to be valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object DSCP table update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] dscp_table
+ * When non-NULL: it points to a pre-allocated and pre-populated table with
+ * exactly 64 elements providing the input color for each value of the
+ * IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field.
+ * When NULL: it is equivalent to setting this parameter to an “all-green”
+ * populated table (i.e. table with all the 64 elements set to green color).
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_dscp_table_update(uint8_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object policer actions update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] action_mask
+ * Bit mask indicating which policer actions need to be updated. One or more
+ * policer actions can be updated in a single function invocation. To update
+ * the policer action associated with color C, bit (1 << C) needs to be set in
+ * *action_mask* and element at position C in the *actions* array needs to be
+ * valid.
+ * @param[in] actions
+ * Pre-allocated and pre-populated array of policer actions.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_policer_actions_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object enabled statistics counters update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] stats_mask
+ * Mask of statistics counter types to be enabled for the current MTR object.
+ * Any statistics counter type not included in this set is to be disabled for
+ * the current MTR object.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object statistics counters read
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[out] stats
+ * When non-NULL, it contains the current value for the statistics counters
+ * enabled for the current MTR object.
+ * @param[out] stats_mask
+ * When non-NULL, it contains the mask of statistics counter types that are
+ * currently enabled for this MTR object, indicating which of the counters
+ * retrieved with the *stats* structure are valid.
+ * @param[in] clear
+ * When this parameter has a non-zero value, the statistics counters are
+ * cleared (i.e. set to zero) immediately after they have been read,
+ * otherwise the statistics counters are left untouched.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_read(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_H__ */
diff --git a/lib/librte_ether/rte_mtr_driver.h b/lib/librte_ether/rte_mtr_driver.h
new file mode 100644
index 0000000..bb7deed
--- /dev/null
+++ b/lib/librte_ether/rte_mtr_driver.h
@@ -0,0 +1,221 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_DRIVER_H__
+#define __INCLUDE_RTE_MTR_DRIVER_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API (Driver Side)
+ *
+ * This file provides implementation helpers for internal use by PMDs, they
+ * are not intended to be exposed to applications and are not subject to ABI
+ * versioning.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int (*rte_mtr_capabilities_get_t)(struct rte_eth_dev *dev,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+/**< @internal MTR capabilities get */
+
+typedef int (*rte_mtr_meter_profile_add_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile add */
+
+typedef int (*rte_mtr_meter_profile_delete_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile delete */
+
+typedef int (*rte_mtr_create_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+/**< @internal MTR object create */
+
+typedef int (*rte_mtr_destroy_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object destroy */
+
+typedef int (*rte_mtr_meter_enable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter enable */
+
+typedef int (*rte_mtr_meter_disable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter disable */
+
+typedef int (*rte_mtr_meter_profile_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter profile update */
+
+typedef int (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter DSCP table update */
+
+typedef int (*rte_mtr_policer_actions_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+/**< @internal MTR object policer action update*/
+
+typedef int (*rte_mtr_stats_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+/**< @internal MTR object enabled stats update */
+
+typedef int (*rte_mtr_stats_read_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+/**< @internal MTR object stats read */
+
+struct rte_mtr_ops {
+ /** MTR capabilities get */
+ rte_mtr_capabilities_get_t capabilities_get;
+
+ /** MTR meter profile add */
+ rte_mtr_meter_profile_add_t meter_profile_add;
+
+ /** MTR meter profile delete */
+ rte_mtr_meter_profile_delete_t meter_profile_delete;
+
+ /** MTR object create */
+ rte_mtr_create_t create;
+
+ /** MTR object destroy */
+ rte_mtr_destroy_t destroy;
+
+ /** MTR object meter enable */
+ rte_mtr_meter_enable_t meter_enable;
+
+ /** MTR object meter disable */
+ rte_mtr_meter_disable_t meter_disable;
+
+ /** MTR object meter profile update */
+ rte_mtr_meter_profile_update_t meter_profile_update;
+
+ /** MTR object meter DSCP table update */
+ rte_mtr_meter_dscp_table_update_t meter_dscp_table_update;
+
+ /** MTR object policer action update */
+ rte_mtr_policer_actions_update_t policer_actions_update;
+
+ /** MTR object enabled stats update */
+ rte_mtr_stats_update_t stats_update;
+
+ /** MTR object stats read */
+ rte_mtr_stats_read_t stats_read;
+};
+
+/**
+ * Initialize generic error structure.
+ *
+ * This function also sets rte_errno to a given value.
+ *
+ * @param[out] error
+ * Pointer to error structure (may be NULL).
+ * @param[in] code
+ * Related error code (rte_errno).
+ * @param[in] type
+ * Cause field and error type.
+ * @param[in] cause
+ * Object responsible for the error.
+ * @param[in] message
+ * Human-readable error message.
+ *
+ * @return
+ * Error code.
+ */
+static inline int
+rte_mtr_error_set(struct rte_mtr_error *error,
+ int code,
+ enum rte_mtr_error_type type,
+ const void *cause,
+ const char *message)
+{
+ if (error) {
+ *error = (struct rte_mtr_error){
+ .type = type,
+ .cause = cause,
+ .message = message,
+ };
+ }
+ rte_errno = code;
+ return code;
+}
+
+/**
+ * Get generic traffic metering and policing operations structure from a port
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] error
+ * Error details
+ *
+ * @return
+ * The traffic metering and policing operations structure associated with
+ * port_id on success, NULL otherwise.
+ */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint8_t port_id, struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_DRIVER_H__ */
--
2.7.4
^ permalink raw reply [relevance 1%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
2017-10-06 13:31 0% ` Gaëtan Rivet
@ 2017-10-06 14:29 0% ` Thomas Monjalon
2017-10-06 16:02 0% ` Thomas Monjalon
2017-10-11 21:21 0% ` Ferruh Yigit
3 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-06 14:29 UTC (permalink / raw)
To: Ferruh Yigit, Zhiyong Yang
Cc: dev, Nelio Laranjeiro, Gaetan Rivet, Declan Doherty
06/10/2017 04:15, Ferruh Yigit:
> On 9/29/2017 8:17 AM, Zhiyong Yang wrote:
> > port_id is currently defined as uint8_t, which is limited to the range
> > 0 to 255. A larger range is required for vdev scalability.
> >
> > It is necessary for a redefinition of port_id to extend it from
> > 1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
> > be changed at the same time.
> >
> > Discussion about port_id is the following thread.
> > http://www.dpdk.org/dev/patchwork/patch/23208/
> >
> > Changes in V2:
> > 1. cover more PMDs to increase port_id range.
> > 2. cover more examples to increase port_id range.
> > 3. add 17.11 release note.
> >
> > Changes in V3:
> > 1. cover mlx4 and mlx5.
> > 2. add to increase port_id range in test code.
> > 3. The patch "librte_mbuf: modify port initialization value" is merged
> > into the patchset.
> >
> > Changes in V4:
> > 1. Add a patch to remove bonding APIs using ABI versioning according to
> > Ferruh's comments.
> > 2. Unify to use typedef portid_t in testpmd code.
> > 3. update release note deprecation doc in 2/5
> > 4. fix some issues according to comments.
> >
> > Changes in V5:
> > 1. For 1/5, bond_mode_8023ad_conf_get_v1708() and bond_mode_8023ad_conf
> > _get() are merged into one function bond_mode_8023ad_conf_get.
> >
> > Changes in V6:
> > 1. For 2/5, remove the unnecessary LIBABIVER in Makefile and update
> > the release notes "Shared Library Versions".
> > Note: The patchset have dependency on the following patch.
> > http://www.dpdk.org/dev/patchwork/patch/28738/
> > http://www.dpdk.org/dev/patchwork/patch/29219/
> >
> > Note: 3/5 and 4/5 patches' building depends on 2/5 patch since 2/5 patch
> > breaks lib/PMD API/ABI.
> >
> > Zhiyong Yang (5):
> > net/bonding: remove bonding APIs using ABI versioning
> > ethdev: increase port_id range
> > examples: increase port_id range
> > test: increase port_id range
> > librte_mbuf: modify port initialization value
>
> Series applied to dpdk-next-net/master, thanks.
The patches 2, 3, 4 must be squashed, otherwise compilation fails.
Will squash in master branch.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
@ 2017-10-06 13:31 0% ` Gaëtan Rivet
2017-10-06 14:29 0% ` Thomas Monjalon
` (2 subsequent siblings)
3 siblings, 0 replies; 200+ results
From: Gaëtan Rivet @ 2017-10-06 13:31 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Zhiyong Yang, dev, thomas, Nelio Laranjeiro, Declan Doherty
On Fri, Oct 06, 2017 at 03:15:40AM +0100, Ferruh Yigit wrote:
> On 9/29/2017 8:17 AM, Zhiyong Yang wrote:
> > port_id is currently defined as uint8_t, which is limited to the range
> > 0 to 255. A larger range is required for vdev scalability.
> >
> > It is necessary for a redefinition of port_id to extend it from
> > 1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
> > be changed at the same time.
> >
> > Discussion about port_id is the following thread.
> > http://www.dpdk.org/dev/patchwork/patch/23208/
> >
> > Changes in V2:
> > 1. cover more PMDs to increase port_id range.
> > 2. cover more examples to increase port_id range.
> > 3. add 17.11 release note.
> >
> > Changes in V3:
> > 1. cover mlx4 and mlx5.
> > 2. add to increase port_id range in test code.
> > 3. The patch "librte_mbuf: modify port initialization value" is merged
> > into the patchset.
> >
> > Changes in V4:
> > 1. Add a patch to remove bonding APIs using ABI versioning according to
> > Ferruh's comments.
> > 2. Unify to use typedef portid_t in testpmd code.
> > 3. update release note deprecation doc in 2/5
> > 4. fix some issues according to comments.
> >
> > Changes in V5:
> > 1. For 1/5, bond_mode_8023ad_conf_get_v1708() and bond_mode_8023ad_conf
> > _get() are merged into one function bond_mode_8023ad_conf_get.
> >
> > Changes in V6:
> > 1. For 2/5, remove the unnecessary LIBABIVER in Makefile and update
> > the release notes "Shared Library Versions".
> > Note: The patchset have dependency on the following patch.
> > http://www.dpdk.org/dev/patchwork/patch/28738/
> > http://www.dpdk.org/dev/patchwork/patch/29219/
> >
> > Note: 3/5 and 4/5 patches' building depends on 2/5 patch since 2/5 patch
> > breaks lib/PMD API/ABI.
> >
> > Zhiyong Yang (5):
> > net/bonding: remove bonding APIs using ABI versioning
> > ethdev: increase port_id range
> > examples: increase port_id range
> > test: increase port_id range
> > librte_mbuf: modify port initialization value
>
> Series applied to dpdk-next-net/master, thanks.
>
> There was merge conflict for:
> rte_eth_bond_pmd.c
> failsafe_private.h
> mlx5_rxtx.h
>
> Maintainers of these files cc'ed, can you please double check latest
> files in next-net?
Hello Ferruh,
The only potential conflicts I see are on the event callbacks
8<-----
int failsafe_eth_rmv_event_callback(uint16_t port_id,
enum rte_eth_event_type type,
void *arg, void *out);
int failsafe_eth_lsc_event_callback(uint16_t port_id,
enum rte_eth_event_type event,
void *cb_arg, void *out);
----->8
and I see no issue there on next-net.
Let me know if you want me to check something specific.
Regards,
--
Gaëtan Rivet
6WIND
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 0/5] increase port_id range
2017-09-29 7:17 4% ` [dpdk-dev] [PATCH v6 " Zhiyong Yang
2017-09-29 7:17 7% ` [dpdk-dev] [PATCH v6 1/5] net/bonding: remove bonding APIs using ABI versioning Zhiyong Yang
2017-09-29 7:17 1% ` [dpdk-dev] [PATCH v6 2/5] ethdev: increase port_id range Zhiyong Yang
@ 2017-10-06 2:15 0% ` Ferruh Yigit
2017-10-06 13:31 0% ` Gaëtan Rivet
` (3 more replies)
2 siblings, 4 replies; 200+ results
From: Ferruh Yigit @ 2017-10-06 2:15 UTC (permalink / raw)
To: Zhiyong Yang, dev; +Cc: thomas, Nelio Laranjeiro, Gaetan Rivet, Declan Doherty
On 9/29/2017 8:17 AM, Zhiyong Yang wrote:
> port_id is currently defined as uint8_t, which is limited to the range
> 0 to 255. A larger range is required for vdev scalability.
>
> It is necessary for a redefinition of port_id to extend it from
> 1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
> be changed at the same time.
>
> Discussion about port_id is the following thread.
> http://www.dpdk.org/dev/patchwork/patch/23208/
>
> Changes in V2:
> 1. cover more PMDs to increase port_id range.
> 2. cover more examples to increase port_id range.
> 3. add 17.11 release note.
>
> Changes in V3:
> 1. cover mlx4 and mlx5.
> 2. add to increase port_id range in test code.
> 3. The patch "librte_mbuf: modify port initialization value" is merged
> into the patchset.
>
> Changes in V4:
> 1. Add a patch to remove bonding APIs using ABI versioning according to
> Ferruh's comments.
> 2. Unify to use typedef portid_t in testpmd code.
> 3. update release note deprecation doc in 2/5
> 4. fix some issues according to comments.
>
> Changes in V5:
> 1. For 1/5, bond_mode_8023ad_conf_get_v1708() and bond_mode_8023ad_conf
> _get() are merged into one function bond_mode_8023ad_conf_get.
>
> Changes in V6:
> 1. For 2/5, remove the unnecessary LIBABIVER in Makefile and update
> the release notes "Shared Library Versions".
> Note: The patchset have dependency on the following patch.
> http://www.dpdk.org/dev/patchwork/patch/28738/
> http://www.dpdk.org/dev/patchwork/patch/29219/
>
> Note: 3/5 and 4/5 patches' building depends on 2/5 patch since 2/5 patch
> breaks lib/PMD API/ABI.
>
> Zhiyong Yang (5):
> net/bonding: remove bonding APIs using ABI versioning
> ethdev: increase port_id range
> examples: increase port_id range
> test: increase port_id range
> librte_mbuf: modify port initialization value
Series applied to dpdk-next-net/master, thanks.
There was merge conflict for:
rte_eth_bond_pmd.c
failsafe_private.h
mlx5_rxtx.h
Maintainers of these files cc'ed, can you please double check latest
files in next-net?
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-05 21:55 0% ` Mokhtar, Amr
@ 2017-10-05 22:22 0% ` Thomas Monjalon
2017-10-06 23:27 0% ` Mokhtar, Amr
0 siblings, 1 reply; 200+ results
From: Thomas Monjalon @ 2017-10-05 22:22 UTC (permalink / raw)
To: Mokhtar, Amr; +Cc: dev, fbl, aconole, bluca
05/10/2017 23:55, Mokhtar, Amr:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 03/10/2017 16:29, Mokhtar, Amr:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > 25/08/2017 15:46, Amr Mokhtar:
> > > > > +int
> > > > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > > > + const struct rte_bbdev_conf *conf);
> > > >
> > > > I am not convinced by the "configure all" function in ethdev.
> > > > We break the ABI each time we add a new feature to configure.
> > > > And it does not really help to have all configurations in one struct.
> > > > Would you mind to split the struct rte_bbdev_conf and split the
> > > > function accordingly?
> > >
> > > There is nothing to split tbh. The only parameter it has is the socket_id.
> > > And in fact, it's optional, can be null. The only config we need is num_queues.
> >
> > Indeed, there is nothing in this struct.
> > If you need only to allocate queues, you just have to rename this function.
> >
> > > I don't see in the near future that we may need to add more config params.
> > > As a side, in the time of the implementation we were trying to avoid
> > > any diversions from the current design ideology of ethdev and cryptodev.
> >
> > There is no ideology in ethdev, just some mistakes ;)
> >
> > > Can we leave it for consideration with future releases?
> >
> > No it should be addressed from the beginning.
> >
> > When you will need to add something more to configure port-wise, you should
> > add a new function instead of breaking the ABI of the global conf struct.
> > That's why the configure option should be more specialized.
> >
> > Distro people were complaining about ABI breakage last week.
> > This is exactly an example of how to avoid it from the beginning.
> >
>
> Ok, got your point. I was looking at it from an API-only standpoint.
> How about modifying it into?
> int
> rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
Yes OK
[...]
> > > > > +struct __rte_cache_aligned rte_bbdev {
> > > > > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue function */
> > > > > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue function */
> > > > > + const struct rte_bbdev_ops *dev_ops; /**< Functions exported by
> > > > > +PMD
> > > > */
> > > > > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > > > > + bool attached; /**< If device is currently attached or not */
> > > >
> > > > What "attached" means?
> > > > I'm afraid you are trying to manage hotplug in the wrong layer.
> > >
> > > Hotplug is not supported in the current release.
> >
> > It is not answering the question.
> > What is an "attached" device?
>
> "Attached" means that the PCI device was probed and the bbdev device slot is allocated.
> For software devices, means that a virtual bbdev device (vdev) is allocated for bbdev.
> Same way the "attached" approach used in cryptodev.
Not sure to understand.
If "attached" means "allocated", when is it false?
[...]
> > > > > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > > > > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > > > > + int status; /**< Status of operation that was performed */
> > > > > + struct rte_mempool *mempool; /**< Mempool which op instance is
> > > > > +in
> > > > */
> > > > > + void *opaque_data; /**< Opaque pointer for user data */
> > > > > + /**
> > > > > + * Anonymous union of operation-type specific parameters. When
> > > > allocated
> > > > > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > > > > + * parameters at the end of each rte_bbdev_op structure, and the
> > > > > + * pointers here point to it.
> > > > > + */
> > > > > + RTE_STD_C11
> > > > > + union {
> > > > > + void *generic;
> > > > > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > > > > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > > > > + };
> > > > > +};
> > > >
> > > > I am not sure it is a good idea to fit every operations in the same
> > > > struct and the same functions.
> > >
> > > Due to the fact that our design adopts this idea that a device can
> > > support both the encode and decode operations.
> > > Then, at the time of PMD registration, the enqueue functions is allocated.
> > > This enqueue() function is common for both operations.
> > > This fitted operation structure is essential for the driver to decide on the
> > operation.
> >
> > Sorry I do not understand why you must have a "generic operation".
> > Please, could you try again to explain this design to someone not fully
> > understanding how turbo enc/dec works?
>
> Oh, sorry, I was not paying attention that you're referring to "void *generic"
> It is just a place-holder for any other operation types. Can be removed if you like.
No I was not referring to void *generic.
It is the same question as in the RFC.
I don't understand the benefit of grouping different things in an union.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-03 15:17 4% ` Thomas Monjalon
2017-10-04 17:11 0% ` Flavio Leitner
@ 2017-10-05 21:55 0% ` Mokhtar, Amr
2017-10-05 22:22 0% ` Thomas Monjalon
1 sibling, 1 reply; 200+ results
From: Mokhtar, Amr @ 2017-10-05 21:55 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, fbl, aconole, bluca
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday 3 October 2017 16:18
> To: Mokhtar, Amr <amr.mokhtar@intel.com>
> Cc: dev@dpdk.org; fbl@redhat.com; aconole@redhat.com; bluca@debian.org
> Subject: Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
>
> 03/10/2017 16:29, Mokhtar, Amr:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 25/08/2017 15:46, Amr Mokhtar:
> > > > +int
> > > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > > + const struct rte_bbdev_conf *conf);
> > >
> > > I am not convinced by the "configure all" function in ethdev.
> > > We break the ABI each time we add a new feature to configure.
> > > And it does not really help to have all configurations in one struct.
> > > Would you mind to split the struct rte_bbdev_conf and split the
> > > function accordingly?
> >
> > There is nothing to split tbh. The only parameter it has is the socket_id.
> > And in fact, it's optional, can be null. The only config we need is num_queues.
>
> Indeed, there is nothing in this struct.
> If you need only to allocate queues, you just have to rename this function.
>
> > I don't see in the near future that we may need to add more config params.
> > As a side, in the time of the implementation we were trying to avoid
> > any diversions from the current design ideology of ethdev and cryptodev.
>
> There is no ideology in ethdev, just some mistakes ;)
>
> > Can we leave it for consideration with future releases?
>
> No it should be addressed from the beginning.
>
> When you will need to add something more to configure port-wise, you should
> add a new function instead of breaking the ABI of the global conf struct.
> That's why the configure option should be more specialized.
>
> Distro people were complaining about ABI breakage last week.
> This is exactly an example of how to avoid it from the beginning.
>
Ok, got your point. I was looking at it from an API-only standpoint.
How about modifying it into?
int
rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
>
> > > [...]
> > > > +struct __rte_cache_aligned rte_bbdev {
> > > > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue function */
> > > > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue function */
> > > > + const struct rte_bbdev_ops *dev_ops; /**< Functions exported by
> > > > +PMD
> > > */
> > > > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > > > + bool attached; /**< If device is currently attached or not */
> > >
> > > What "attached" means?
> > > I'm afraid you are trying to manage hotplug in the wrong layer.
> >
> > Hotplug is not supported in the current release.
>
> It is not answering the question.
> What is an "attached" device?
"Attached" means that the PCI device was probed and the bbdev device slot is allocated.
For software devices, means that a virtual bbdev device (vdev) is allocated for bbdev.
Same way the "attached" approach used in cryptodev.
>
>
> > > [...]
> > > > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > > > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > > > + int status; /**< Status of operation that was performed */
> > > > + struct rte_mempool *mempool; /**< Mempool which op instance is
> > > > +in
> > > */
> > > > + void *opaque_data; /**< Opaque pointer for user data */
> > > > + /**
> > > > + * Anonymous union of operation-type specific parameters. When
> > > allocated
> > > > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > > > + * parameters at the end of each rte_bbdev_op structure, and the
> > > > + * pointers here point to it.
> > > > + */
> > > > + RTE_STD_C11
> > > > + union {
> > > > + void *generic;
> > > > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > > > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > > > + };
> > > > +};
> > >
> > > I am not sure it is a good idea to fit every operations in the same
> > > struct and the same functions.
> >
> > Due to the fact that our design adopts this idea that a device can
> > support both the encode and decode operations.
> > Then, at the time of PMD registration, the enqueue functions is allocated.
> > This enqueue() function is common for both operations.
> > This fitted operation structure is essential for the driver to decide on the
> operation.
>
> Sorry I do not understand why you must have a "generic operation".
> Please, could you try again to explain this design to someone not fully
> understanding how turbo enc/dec works?
Oh, sorry, I was not paying attention that you're referring to "void *generic"
It is just a place-holder for any other operation types. Can be removed if you like.
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v8 0/9] Policy Based Power Control for Guest
2017-10-05 13:28 2% ` [dpdk-dev] [PATCH v7 " David Hunt
2017-10-05 13:54 0% ` Ananyev, Konstantin
@ 2017-10-05 14:34 2% ` David Hunt
2017-10-09 22:34 0% ` Ferruh Yigit
1 sibling, 1 reply; 200+ results
From: David Hunt @ 2017-10-05 14:34 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V8 patchset changes:
* Added Ack's and Reviewed-by's to individual patches in the set so as to
keep patchwork A/R/T flags properly in sync.
V7 patchset changes:
* Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
int64_t to int
V6 patchset changes:
* Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
* changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
as it can return negative error codes.
* Removed bool enum from channel_commands.h, including stdbool.h instead.
* Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
* Renamed a few variables to be more readable.
* Added returns in a few places if failed to get info on domain.
* Fixed power_manager_init to keep track of num_freqs for each core.
* In power_manager_scale_core_med(), changed a hardcoded '5' to instead
be calculated from the centre of the frequency list
(global_core_freq_info[core_num].num_freqs / 2)
V5 patchset changes:
* Removed most of the #ifdef I40_PMD as it will be applicable to
other PMDs in the future.
* Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
to a const struct ether_addr *, rather than casting it later in the
function.
V4 patchset changes:
* None, re-post to mailing list under the correct email thread.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 2%]
* Re: [dpdk-dev] [PATCH v7 0/9] Policy Based Power Control for Guest
2017-10-05 13:28 2% ` [dpdk-dev] [PATCH v7 " David Hunt
@ 2017-10-05 13:54 0% ` Ananyev, Konstantin
2017-10-05 14:34 2% ` [dpdk-dev] [PATCH v8 " David Hunt
1 sibling, 0 replies; 200+ results
From: Ananyev, Konstantin @ 2017-10-05 13:54 UTC (permalink / raw)
To: Hunt, David, dev; +Cc: Wu, Jingjing, santosh.shukla
> -----Original Message-----
> From: Hunt, David
> Sent: Thursday, October 5, 2017 2:28 PM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; santosh.shukla@caviumnetworks.com
> Subject: [PATCH v7 0/9] Policy Based Power Control for Guest
>
> Policy Based Power Control for Guest
>
> This patchset adds the facility for a guest VM to send a policy down to the
> host that will allow the host to scale up/down cpu frequencies
> depending on the policy criteria independently of the DPDK app running in
> the guest. This differs from the previous vm_power implementation where
> individual scale up/down requests were send from the guest to the host via
> virtio-serial.
>
> V7 patchset changes:
> * Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
> int64_t to int
>
> V6 patchset changes:
> * Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
> * changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
> as it can return negative error codes.
> * Removed bool enum from channel_commands.h, including stdbool.h instead.
> * Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
> * Renamed a few variables to be more readable.
> * Added returns in a few places if failed to get info on domain.
> * Fixed power_manager_init to keep track of num_freqs for each core.
> * In power_manager_scale_core_med(), changed a hardcoded '5' to instead
> be calculated from the centre of the frequency list
> (global_core_freq_info[core_num].num_freqs / 2)
>
> V5 patchset changes:
> * Removed most of the #ifdef I40_PMD as it will be applicable to
> other PMDs in the future.
> * Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
> to a const struct ether_addr *, rather than casting it later in the
> function.
>
> V4 patchset changes:
> * None, re-post to mailing list under the correct email thread.
>
> V3 patchset changes:
> * Changed to using is_same_ether_addr() instead of looping through
> the mac address bytes to compare them.
> * Tweaked some comments and working in the i40e patch after review.
> * Added a patch to the set to add new i40e function to map file, so
> as to allow shared library builds. The power library API needs a cleanup
> in next release, so will add API/ABI warning for this cleanup in a
> separate patch.
>
> V2 patchset changes:
> * Removed API's in ethdev layer.
> * Now just a single new API in the i40e driver for mapping VF MAC to
> VF index.
> * Moved new function from rte_rxtx.c to rte_pmd_i40e.c
> * Removed function for reading i40e register, moved to using the
> standard stats API.
> * Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
> * Cleaned up policy generation code.
>
> It's a modification of the vm_power_manager app that runs in the host, and
> the guest_vm_power_app example app that runs in the guest. This allows the
> guest to send down a policy to the host via virtio-serial, which then allows
> the host to scale up/down based on the criteria in the policy, resulting in
> quicker scale up/down than individual requests coming from the guest.
> It also means that the DPDK application running in the guest does not need
> to be modified in any way, it is unaware that it's cores are being scaled
> up/down, reducing the effort in implementing a power-aware infrastructure.
>
> The usage model is as follows:
> 1. Set up the VF's and assign to the guest in the usual way.
> 2. run vm_power_manager on the host, creating a channel to the guest.
> 3. Start the guest_vm_power_mgr app on the guest, which establishes
> a virtio-serial channel to the host.
> 4. Send down the profile for the guest using the "send_profile now" command.
> There is an example profile hard-coded into guest_vm_power_mgr.
> 5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
> 6. Send traffic into the VFs at varying traffic rates.
> Observe the frequency change on the host (turbostat -i 1)
>
> The sequence of code changes are as follows:
>
> A new function has been aded to the i40e driver to allow mapping of
> a VF MAC to VF index.
>
> Next we make an addition to librte_power that adds an extra command to allow
> the passing of a policy structure from the guest to the host. This struct
> contains information like busy/quiet hour, packet throughput thresholds, etc.
>
> The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
> physical CPU (pcpu) IDs so that the host can scale up/down the cores used
> in the guest.
>
> The remaining patches are functionality to process the policy, and take action
> when the relevant trigger occurs to cause a frequency change.
>
> [1/9] net/i40e: add API to convert VF MAC to VF id
> [2/9] lib/librte_power: add extra msg type for policies
> [3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
> [4/9] examples/vm_power_mgr: add scale to medium freq fn
> [5/9] examples/vm_power_mgr: add policy to channels
> [6/9] examples/vm_power_mgr: add port initialisation
> [7/9] power: add send channel msg function to map file
> [8/9] examples/guest_cli: add send policy to host
> [9/9] examples/vm_power_mgr: set MAC address of VF
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v7 0/9] Policy Based Power Control for Guest
2017-10-05 12:25 2% ` [dpdk-dev] [PATCH v6 " David Hunt
@ 2017-10-05 13:28 2% ` David Hunt
2017-10-05 13:54 0% ` Ananyev, Konstantin
2017-10-05 14:34 2% ` [dpdk-dev] [PATCH v8 " David Hunt
0 siblings, 2 replies; 200+ results
From: David Hunt @ 2017-10-05 13:28 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V7 patchset changes:
* Changed return code of rte_pmd_i40e_query_vfid_by_mac() from an
int64_t to int
V6 patchset changes:
* Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
* changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
as it can return negative error codes.
* Removed bool enum from channel_commands.h, including stdbool.h instead.
* Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
* Renamed a few variables to be more readable.
* Added returns in a few places if failed to get info on domain.
* Fixed power_manager_init to keep track of num_freqs for each core.
* In power_manager_scale_core_med(), changed a hardcoded '5' to instead
be calculated from the centre of the frequency list
(global_core_freq_info[core_num].num_freqs / 2)
V5 patchset changes:
* Removed most of the #ifdef I40_PMD as it will be applicable to
other PMDs in the future.
* Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
to a const struct ether_addr *, rather than casting it later in the
function.
V4 patchset changes:
* None, re-post to mailing list under the correct email thread.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 2%]
* Re: [dpdk-dev] [PATCH v5] devtools: rework abi checker script
2017-10-05 7:53 27% ` [dpdk-dev] [PATCH v5] " Olivier Matz
@ 2017-10-05 13:15 4% ` Neil Horman
2017-11-07 23:24 4% ` Thomas Monjalon
1 sibling, 0 replies; 200+ results
From: Neil Horman @ 2017-10-05 13:15 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, bruce.richardson
On Thu, Oct 05, 2017 at 09:53:27AM +0200, Olivier Matz wrote:
> The initial version of the script had some limitations:
> - cannot work on a non-clean workspace
> - environment variables are not documented
> - no compilation log in case of failure
> - return success even it abi is incompatible
>
> This patch addresses these issues and rework the code.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> ---
>
> v4->v5:
> - Add a log when shared lib has no public ABI
>
> v3->v4:
> - clarify logs on incompatible abi
> - log when an error returned an error
> - [really] fix the report path
> - log the output of make config in the proper file
>
> v2->v3:
> - fix when not launched from dpdk root dir
> - use "-Og -Wno-error" instead of "-O0"
> - fix typo in commit log
>
> v1->v2:
> - use /usr/bin/env to find bash (which is required)
> - fix displayed path to html reports
> - reword help for -f option
>
> devtools/validate-abi.sh | 397 ++++++++++++++++++++++++-----------------------
> 1 file changed, 205 insertions(+), 192 deletions(-)
>
To reiterate with updated logging
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h
2017-09-28 13:55 2% ` [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h Jianfeng Tan
@ 2017-10-05 13:13 0% ` Jan Blunck
2017-10-09 1:04 0% ` Tan, Jianfeng
0 siblings, 1 reply; 200+ results
From: Jan Blunck @ 2017-10-05 13:13 UTC (permalink / raw)
To: Jianfeng Tan
Cc: dev, Bruce Richardson, Ananyev, Konstantin, De Lara Guarch,
Pablo, Thomas Monjalon, yliu, Maxime Coquelin, Tetsuya Mukawa,
Ferruh Yigit
On Thu, Sep 28, 2017 at 3:55 PM, Jianfeng Tan <jianfeng.tan@intel.com> wrote:
> The helper API, rte_cryptodev_vdev_pmd_init(), has a parameter of
> struct rte_vdev_device *, which needs to include rte_vdev.h.
>
> We will move vdev into drivers/bus, so we need to avoid such
> dependency. And also, we cannot break the ABI.
>
> This patch changes that pointer to void *, and defines an internal
> structure same with struct rte_vdev_device.
>
This code duplication is unnecessary. Also you are doing evil thinks
and define a type with the same name in multiple places. Look at my
series how to do this properly.
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
> lib/librte_cryptodev/rte_cryptodev_pmd.c | 9 +-
> lib/librte_cryptodev/rte_cryptodev_vdev.c | 161 ++++++++++++++++++++++++++++++
> lib/librte_cryptodev/rte_cryptodev_vdev.h | 3 +-
> 3 files changed, 169 insertions(+), 4 deletions(-)
> create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.c
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> index a57faad..60b3980 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
> @@ -75,9 +75,14 @@ rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
> return 0;
> }
>
> +struct vdev_device {
> + TAILQ_ENTRY(rte_vdev_device) next;
> + struct rte_device device;
> +};
> +
> struct rte_cryptodev *
> rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> - int socket_id, struct rte_vdev_device *vdev)
> + int socket_id, void *vdev)
> {
> struct rte_cryptodev *cryptodev;
>
> @@ -99,7 +104,7 @@ rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> " data");
> }
>
> - cryptodev->device = &vdev->device;
> + cryptodev->device = &((struct vdev_device *)vdev)->device;
>
> /* initialise user call-back tail queue */
> TAILQ_INIT(&(cryptodev->link_intr_cbs));
> diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.c b/lib/librte_cryptodev/rte_cryptodev_vdev.c
> new file mode 100644
> index 0000000..4af8d51
> --- /dev/null
> +++ b/lib/librte_cryptodev/rte_cryptodev_vdev.c
> @@ -0,0 +1,161 @@
> +/*-
> + * BSD LICENSE
> + *
> + * Copyright(c) 2017 Intel Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * * Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in
> + * the documentation and/or other materials provided with the
> + * distribution.
> + * * Neither the name of the copyright holder nor the names of its
> + * contributors may be used to endorse or promote products derived
> + * from this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include <sys/queue.h>
> +
> +#include "rte_cryptodev_vdev.h"
> +#include "rte_cryptodev_pci.h"
> +#include "rte_cryptodev_pmd.h"
> +
> +/**
> + * Parse name from argument
> + */
> +static int
> +rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
> + const char *value, void *extra_args)
> +{
> + struct rte_crypto_vdev_init_params *params = extra_args;
> +
> + if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
> + CDEV_LOG_ERR("Invalid name %s, should be less than "
> + "%u bytes", value,
> + RTE_CRYPTODEV_NAME_MAX_LEN - 1);
> + return -1;
> + }
> +
> + strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
> +
> + return 0;
> +}
> +
> +/**
> + * Parse integer from argument
> + */
> +static int
> +rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
> + const char *value, void *extra_args)
> +{
> + int *i = extra_args;
> +
> + *i = atoi(value);
> + if (*i < 0) {
> + CDEV_LOG_ERR("Argument has to be positive.");
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> +struct vdev_device {
> + TAILQ_ENTRY(rte_vdev_device) next;
> + struct rte_device device;
> +};
> +
> +struct rte_cryptodev *
> +rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> + int socket_id, void *vdev)
> +{
> + struct rte_cryptodev *cryptodev;
> +
> + /* allocate device structure */
> + cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
> + if (cryptodev == NULL)
> + return NULL;
> +
> + /* allocate private device structure */
> + if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> + cryptodev->data->dev_private =
> + rte_zmalloc_socket("cryptodev device private",
> + dev_private_size,
> + RTE_CACHE_LINE_SIZE,
> + socket_id);
> +
> + if (cryptodev->data->dev_private == NULL)
> + rte_panic("Cannot allocate memzone for private device"
> + " data");
> + }
> +
> + cryptodev->device = &((struct vdev_device *)vdev)->device;
> +
> + /* initialise user call-back tail queue */
> + TAILQ_INIT(&(cryptodev->link_intr_cbs));
> +
> + return cryptodev;
> +}
> +
> +int
> +rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
> + const char *input_args)
> +{
> + struct rte_kvargs *kvlist = NULL;
> + int ret = 0;
> +
> + if (params == NULL)
> + return -EINVAL;
> +
> + if (input_args) {
> + kvlist = rte_kvargs_parse(input_args,
> + cryptodev_vdev_valid_params);
> + if (kvlist == NULL)
> + return -1;
> +
> + ret = rte_kvargs_process(kvlist,
> + RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
> + &rte_cryptodev_vdev_parse_integer_arg,
> + ¶ms->max_nb_queue_pairs);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist,
> + RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
> + &rte_cryptodev_vdev_parse_integer_arg,
> + ¶ms->max_nb_sessions);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
> + &rte_cryptodev_vdev_parse_integer_arg,
> + ¶ms->socket_id);
> + if (ret < 0)
> + goto free_kvlist;
> +
> + ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
> + &rte_cryptodev_vdev_parse_name_arg,
> + params);
> + if (ret < 0)
> + goto free_kvlist;
> + }
> +
> +free_kvlist:
> + rte_kvargs_free(kvlist);
> + return ret;
> +}
> diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
> index 94ab9d3..1142d1d 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
> @@ -33,7 +33,6 @@
> #ifndef _RTE_CRYPTODEV_VDEV_H_
> #define _RTE_CRYPTODEV_VDEV_H_
>
> -#include <rte_vdev.h>
> #include <inttypes.h>
>
> #include "rte_cryptodev.h"
> @@ -80,7 +79,7 @@ struct rte_crypto_vdev_init_params {
> */
> struct rte_cryptodev *
> rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
> - int socket_id, struct rte_vdev_device *vdev);
> + int socket_id, void *vdev);
>
> /**
> * @internal
> --
> 2.7.4
>
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH V2 3/5] ethdev: add new api for traffic metering and policing
@ 2017-10-05 13:09 1% ` Cristian Dumitrescu
0 siblings, 0 replies; 200+ results
From: Cristian Dumitrescu @ 2017-10-05 13:09 UTC (permalink / raw)
To: dev
Cc: thomas, adrien.mazarguil, jingjing.wu, hemant.agrawal,
jerin.jacob, jasvinder.singh
This patch introduces new ethdev generic API for Traffic Metering and
Policing (MTR), which is yet another standard RX offload for Ethernet
devices.
Similar to rte_flow and rte_tm APIs, the configuration of MTR objects is
done in their own namespace (rte_mtr) within the librte_ether library.
Main features:
1. Traffic metering: determine the color for the current packet (green,
yellow, red) based on history maintained by the MTR object. Supported
algorithms: srTCM (RFC 2697), trTCM (RFC 2698 and RFC 4115).
2. Policing (per meter output color actions): re-color the packet (keep
or change the meter output color) or drop the packet.
3. Statistics
4. Capability API
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
Changes in v2:
- Implemented input from Hemant:
- Added support for RFC 4115 trTCM algorithm
- Added support for meter pass-through mode: see API functions
rte_mtr_meter_enable() and rte_mtr_meter_disable()
- Implemented input from Jerin:
- Added capability API
- Implemented input from Thomas:
- Added new API functions under the EXPERIMENTAL section in map file
- Improved the mechanism for MTR object chaining: each MTR object can be
configured whther to read input color from a previous MTR object in the
same flow (if any) of from DSCP traslation table
- Improved run-time update functions
- Doxygen: added more descriptions, small fixes
Changes in v1 (from RFC [1]):
- Implemented input from Thomas:
- Added EXPERIMENTAL tag in rte_mtr.h and MANTAINERS for this new API
- Implemented input from Adrien:
- Added more Doxygen comments to re-inforce relationship between MTR and
flow
- Doxygen: added hook in doxy-api-index.md
[1] RFC: http://www.dpdk.org/ml/archives/dev/2017-May/066888.html
MAINTAINERS | 4 +
doc/api/doxy-api-index.md | 1 +
lib/librte_ether/Makefile | 3 +
lib/librte_ether/rte_ethdev_version.map | 18 +
lib/librte_ether/rte_mtr.c | 229 ++++++++++
lib/librte_ether/rte_mtr.h | 723 ++++++++++++++++++++++++++++++++
lib/librte_ether/rte_mtr_driver.h | 221 ++++++++++
7 files changed, 1199 insertions(+)
create mode 100644 lib/librte_ether/rte_mtr.c
create mode 100644 lib/librte_ether/rte_mtr.h
create mode 100644 lib/librte_ether/rte_mtr_driver.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 8df2a7f..f9aa787 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -260,6 +260,10 @@ M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
T: git://dpdk.org/next/dpdk-next-tm
F: lib/librte_ether/rte_tm*
+Traffic Metering and Policing API - EXPERIMENTAL
+M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
+F: lib/librte_ether/rte_mtr*
+
Crypto API
M: Declan Doherty <declan.doherty@intel.com>
F: lib/librte_cryptodev/
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 19e0d4f..b2342a9 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[ethctrl] (@ref rte_eth_ctrl.h),
[rte_flow] (@ref rte_flow.h),
[rte_tm] (@ref rte_tm.h),
+ [rte_mtr] (@ref rte_mtr.h),
[cryptodev] (@ref rte_cryptodev.h),
[eventdev] (@ref rte_eventdev.h),
[metrics] (@ref rte_metrics.h),
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 201cb96..35ba5d9 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -46,6 +46,7 @@ LIBABIVER := 7
SRCS-y += rte_ethdev.c
SRCS-y += rte_flow.c
SRCS-y += rte_tm.c
+SRCS-y += rte_mtr.c
SRCS-y += ethdev_profile.c
#
@@ -60,5 +61,7 @@ SYMLINK-y-include += rte_flow.h
SYMLINK-y-include += rte_flow_driver.h
SYMLINK-y-include += rte_tm.h
SYMLINK-y-include += rte_tm_driver.h
+SYMLINK-y-include += rte_mtr.h
+SYMLINK-y-include += rte_mtr_driver.h
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map
index 07f9e17..c8f59a0 100644
--- a/lib/librte_ether/rte_ethdev_version.map
+++ b/lib/librte_ether/rte_ethdev_version.map
@@ -194,3 +194,21 @@ DPDK_17.11 {
rte_eth_dev_reset;
} DPDK_17.08;
+
+EXPERIMENTAL {
+ global:
+
+ rte_mtr_capabilities_get;
+ rte_mtr_meter_profile_add;
+ rte_mtr_meter_profile_delete;
+ rte_mtr_create;
+ rte_mtr_destroy;
+ rte_mtr_meter_enable;
+ rte_mtr_meter_disable;
+ rte_mtr_meter_profile_update;
+ rte_mtr_meter_dscp_table_update;
+ rte_mtr_policer_actions_update;
+ rte_mtr_stats_update;
+ rte_mtr_stats_read;
+
+} DPDK_17.11;
diff --git a/lib/librte_ether/rte_mtr.c b/lib/librte_ether/rte_mtr.c
new file mode 100644
index 0000000..6526a97
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.c
@@ -0,0 +1,229 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr_driver.h"
+#include "rte_mtr.h"
+
+/* Get generic traffic metering & policing operations structure from a port. */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint8_t port_id, struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ const struct rte_mtr_ops *ops;
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ rte_mtr_error_set(error,
+ ENODEV,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENODEV));
+ return NULL;
+ }
+
+ if ((dev->dev_ops->mtr_ops_get == NULL) ||
+ (dev->dev_ops->mtr_ops_get(dev, &ops) != 0) ||
+ (ops == NULL)) {
+ rte_mtr_error_set(error,
+ ENOSYS,
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ rte_strerror(ENOSYS));
+ return NULL;
+ }
+
+ return ops;
+}
+
+#define RTE_MTR_FUNC(port_id, func) \
+({ \
+ const struct rte_mtr_ops *ops = \
+ rte_mtr_ops_get(port_id, error); \
+ if (ops == NULL) \
+ return -rte_errno; \
+ \
+ if (ops->func == NULL) \
+ return -rte_mtr_error_set(error, \
+ ENOSYS, \
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, \
+ NULL, \
+ rte_strerror(ENOSYS)); \
+ \
+ ops->func; \
+})
+
+/* MTR capabilities get */
+int
+rte_mtr_capabilities_get(uint8_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, capabilities_get)(dev,
+ cap, error);
+}
+
+/* MTR meter profile add */
+int
+rte_mtr_meter_profile_add(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_add)(dev,
+ meter_profile_id, profile, error);
+}
+
+/** MTR meter profile delete */
+int
+rte_mtr_meter_profile_delete(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_delete)(dev,
+ meter_profile_id, error);
+}
+
+/** MTR object create */
+int
+rte_mtr_create(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, create)(dev,
+ mtr_id, params, shared, error);
+}
+
+/** MTR object destroy */
+int
+rte_mtr_destroy(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, destroy)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter enable */
+int
+rte_mtr_meter_enable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_enable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter disable */
+int
+rte_mtr_meter_disable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_disable)(dev,
+ mtr_id, error);
+}
+
+/** MTR object meter profile update */
+int
+rte_mtr_meter_profile_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_profile_update)(dev,
+ mtr_id, meter_profile_id, error);
+}
+
+/** MTR object meter DSCP table update */
+int
+rte_mtr_meter_dscp_table_update(uint8_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, meter_dscp_table_update)(dev,
+ mtr_id, dscp_table, error);
+}
+
+/** MTR object policer action update */
+int
+rte_mtr_policer_actions_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, policer_actions_update)(dev,
+ mtr_id, action_mask, actions, error);
+}
+
+/** MTR object enabled stats update */
+int
+rte_mtr_stats_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_update)(dev,
+ mtr_id, stats_mask, error);
+}
+
+/** MTR object stats read */
+int
+rte_mtr_stats_read(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error)
+{
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ return RTE_MTR_FUNC(port_id, stats_read)(dev,
+ mtr_id, stats, stats_mask, clear, error);
+}
diff --git a/lib/librte_ether/rte_mtr.h b/lib/librte_ether/rte_mtr.h
new file mode 100644
index 0000000..f0f897f
--- /dev/null
+++ b/lib/librte_ether/rte_mtr.h
@@ -0,0 +1,723 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation.
+ * Copyright(c) 2017 NXP.
+ * Copyright(c) 2017 Cavium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_H__
+#define __INCLUDE_RTE_MTR_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API
+ *
+ * This interface provides the ability to configure the traffic metering and
+ * policing (MTR) in a generic way.
+ *
+ * The processing done for each input packet hitting a MTR object is:
+ * A) Traffic metering: The packet is assigned a color (the meter output
+ * color), based on the previous history of the flow reflected in the
+ * current state of the MTR object, according to the specific traffic
+ * metering algorithm. The traffic metering algorithm can typically work
+ * in color aware mode, in which case the input packet already has an
+ * initial color (the input color), or in color blind mode, which is
+ * equivalent to considering all input packets initially colored as green.
+ * B) Policing: There is a separate policer action configured for each meter
+ * output color, which can:
+ * a) Drop the packet.
+ * b) Keep the same packet color: the policer output color matches the
+ * meter output color (essentially a no-op action).
+ * c) Recolor the packet: the policer output color is different than
+ * the meter output color.
+ * The policer output color is the output color of the packet, which is
+ * set in the packet meta-data (i.e. struct rte_mbuf::sched::color).
+ * C) Statistics: The set of counters maintained for each MTR object is
+ * configurable and subject to the implementation support. This set
+ * includes the number of packets and bytes dropped or passed for each
+ * output color.
+ *
+ * Once successfully created, an MTR object is linked to one or several flows
+ * through the meter action of the flow API.
+ * A) Whether an MTR object is private to a flow or potentially shared by
+ * several flows has to be specified at creation time.
+ * B) Several meter actions can be potentially registered for the same flow.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ */
+#include <stdint.h>
+
+#include <rte_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Color
+ */
+enum rte_mtr_color {
+ RTE_MTR_GREEN = 0, /**< Green */
+ RTE_MTR_YELLOW, /**< Yellow */
+ RTE_MTR_RED, /**< Red */
+ RTE_MTR_COLORS /**< Number of colors. */
+};
+
+/**
+ * Statistics counter type
+ */
+enum rte_mtr_stats_type {
+ /** Number of packets passed as green by the policer. */
+ RTE_MTR_STATS_N_PKTS_GREEN = 1 << 0,
+
+ /** Number of bytes passed as green by the policer. */
+ RTE_MTR_STATS_N_BYTES_GREEN = 1 << 1,
+
+ /** Number of packets passed as yellow by the policer. */
+ RTE_MTR_STATS_N_PKTS_YELLOW = 1 << 2,
+
+ /** Number of bytes passed as yellow by the policer. */
+ RTE_MTR_STATS_N_BYTES_YELLOW = 1 << 3,
+
+ /** Number of packets passed as red by the policer. */
+ RTE_MTR_STATS_N_PKTS_RED = 1 << 4,
+
+ /** Number of bytes passed as red by the policer. */
+ RTE_MTR_STATS_N_BYTES_RED = 1 << 5,
+
+ /** Number of packets dropped by the policer. */
+ RTE_MTR_STATS_N_PKTS_DROPPED = 1 << 6,
+
+ /** Number of bytes dropped by the policer. */
+ RTE_MTR_STATS_N_BYTES_DROPPED = 1 << 7,
+};
+
+/**
+ * Statistics counters
+ */
+struct rte_mtr_stats {
+ /** Number of packets passed by the policer (per color). */
+ uint64_t n_pkts[RTE_MTR_COLORS];
+
+ /** Number of bytes passed by the policer (per color). */
+ uint64_t n_bytes[RTE_MTR_COLORS];
+
+ /** Number of packets dropped by the policer. */
+ uint64_t n_pkts_dropped;
+
+ /** Number of bytes passed by the policer. */
+ uint64_t n_bytes_dropped;
+};
+
+/**
+ * Traffic metering algorithms
+ */
+enum rte_mtr_algorithm {
+ /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
+ RTE_MTR_SRTCM_RFC2697,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
+ RTE_MTR_TRTCM_RFC2698,
+
+ /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
+ RTE_MTR_TRTCM_RFC4115,
+};
+
+/**
+ * Meter profile
+ */
+struct rte_mtr_meter_profile {
+ /** Traffic metering algorithm. */
+ enum rte_mtr_algorithm alg;
+
+ RTE_STD_C11
+ union {
+ /** Items only valid when *alg* is set to srTCM - RFC 2697. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Committed Burst Size (CBS) (bytes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } srtcm_rfc2697;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 2698. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Peak Information Rate (PIR) (bytes/second). */
+ uint64_t pir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Peak Burst Size (PBS) (bytes). */
+ uint64_t pbs;
+ } trtcm_rfc2698;
+
+ /** Items only valid when *alg* is set to trTCM - RFC 4115. */
+ struct {
+ /** Committed Information Rate (CIR) (bytes/second). */
+ uint64_t cir;
+
+ /** Excess Information Rate (EIR) (bytes/second). */
+ uint64_t eir;
+
+ /** Committed Burst Size (CBS) (byes). */
+ uint64_t cbs;
+
+ /** Excess Burst Size (EBS) (bytes). */
+ uint64_t ebs;
+ } trtcm_rfc4115;
+ };
+};
+
+/**
+ * Policer actions
+ */
+enum rte_mtr_policer_action {
+ /** Recolor the packet as green. */
+ MTR_POLICER_ACTION_COLOR_GREEN = 0,
+
+ /** Recolor the packet as yellow. */
+ MTR_POLICER_ACTION_COLOR_YELLOW,
+
+ /** Recolor the packet as red. */
+ MTR_POLICER_ACTION_COLOR_RED,
+
+ /** Drop the packet. */
+ MTR_POLICER_ACTION_DROP,
+};
+
+/**
+ * Parameters for each traffic metering & policing object
+ *
+ * @see enum rte_mtr_stats_type
+ */
+struct rte_mtr_params {
+ /** Meter profile ID. */
+ uint32_t meter_profile_id;
+
+ /** Meter input color in case of MTR object chaining. When non-zero: if
+ * a previous MTR object is enabled in the same flow, then the color
+ * determined by the latest MTR object in the same flow is used as the
+ * input color by the current MTR object, otherwise the current MTR
+ * object uses the *dscp_table* to determine the input color. When zero:
+ * the color determined by any previous MTR object in same flow is
+ * ignored by the current MTR object, which uses the *dscp_table* to
+ * determine the input color.
+ */
+ int use_prev_mtr_color;
+
+ /** Meter input color. When non-NULL: it points to a pre-allocated and
+ * pre-populated table with exactly 64 elements providing the input
+ * color for each value of the IPv4/IPv6 Differentiated Services Code
+ * Point (DSCP) input packet field. When NULL: it is equivalent to
+ * setting this parameter to an all-green populated table (i.e. table
+ * with all the 64 elements set to green color). The color blind mode
+ * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
+ * to either NULL or to an all-green populated table. When
+ * *use_prev_mtr_color* is non-zero value or when *dscp_table* contains
+ * at least one yellow or red color element, then the color aware mode
+ * is configured.
+ */
+ enum rte_mtr_color *dscp_table;
+
+ /** Non-zero to enable the meter, zero to disable the meter at the time
+ * of MTR object creation.
+ * @see rte_mtr_meter_disable()
+ */
+ int meter_enable;
+
+ /** Policer actions (per meter output color). */
+ enum rte_mtr_policer_action action[RTE_MTR_COLORS];
+
+ /** Set of stats counters to be enabled.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * MTR capabilities
+ */
+struct rte_mtr_capabilities {
+ /** Maximum number of MTR objects. */
+ uint32_t n_max;
+
+ /** Maximum number of MTR objects that can be shared by multiple flows.
+ * The value of zero indicates that shared MTR objects are not
+ * supported. The maximum value is *n_max*.
+ */
+ uint32_t n_shared_max;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * cannot be shared by multiple flows have identical capability set.
+ */
+ int identical;
+
+ /** When non-zero, this flag indicates that all the MTR objects that
+ * can be shared by multiple flows have identical capability set.
+ */
+ int shared_identical;
+
+ /** Maximum number of flows that can share the same MTR object. The
+ * value of zero is invalid. The value of 1 means that shared MTR
+ * objects not supported.
+ */
+ uint32_t shared_n_flows_per_mtr_max;
+
+ /** Maximum number of MTR objects that can be part of the same flow. The
+ * value of zero is invalid. The value of 1 indicates that MTR object
+ * chaining is not supported. The maximum value is *n_max*.
+ */
+ uint32_t chaining_n_mtrs_per_flow_max;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object can be used as the packet input color by any subsequent
+ * MTR object from the same flow. When zero, it indicates that the color
+ * determined by one MTR object is always ignored by any subsequent MTR
+ * object from the same flow. Only valid when MTR chaining is supported,
+ * i.e. *chaining_n_mtrs_per_flow_max* is greater than 1. When non-zero,
+ * it also means that the color aware mode is supported by at least one
+ * metering algorithm.
+ */
+ int chaining_use_prev_mtr_color_supported;
+
+ /**
+ * When non-zero, it indicates that the packet color identified by one
+ * MTR object is always used as the packet input color by any subsequent
+ * MTR object that is part of the same flow. When zero, it indicates
+ * that whether the color determined by one MTR object is either ignored
+ * or used as the packet input color by any subsequent MTR object from
+ * the same flow is individually configurable for each MTR object. Only
+ * valid when *chaining_use_prev_mtr_color_supported* is non-zero.
+ */
+ int chaining_use_prev_mtr_color_enforced;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the srTCM RFC 2697 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_srtcm_rfc2697_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 2698 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc2698_n_max;
+
+ /** Maximum number of MTR objects that can have their meter configured
+ * to run the trTCM RFC 4115 algorithm. The value of 0 indicates this
+ * metering algorithm is not supported. The maximum value is *n_max*.
+ */
+ uint32_t meter_trtcm_rfc4115_n_max;
+
+ /** Maximum traffic rate that can be metered by a single MTR object. For
+ * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
+ * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
+ * value for the sum of PIR and EIR rates.
+ */
+ uint64_t meter_rate_max;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the srTCM RFC 2697 metering algorithm.
+ */
+ int color_aware_srtcm_rfc2697_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 2698 metering algorithm.
+ */
+ int color_aware_trtcm_rfc2698_supported;
+
+ /**
+ * When non-zero, it indicates that color aware mode is supported for
+ * the trTCM RFC 4115 metering algorithm.
+ */
+ int color_aware_trtcm_rfc4115_supported;
+
+ /** When non-zero, it indicates that the policer packet recolor actions
+ * are supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_recolor_supported;
+
+ /** When non-zero, it indicates that the policer packet drop action is
+ * supported.
+ * @see enum rte_mtr_policer_action
+ */
+ int policer_action_drop_supported;
+
+ /** Set of supported statistics counter types.
+ * @see enum rte_mtr_stats_type
+ */
+ uint64_t stats_mask;
+};
+
+/**
+ * Verbose error types.
+ *
+ * Most of them provide the type of the object referenced by struct
+ * rte_mtr_error::cause.
+ */
+enum rte_mtr_error_type {
+ RTE_MTR_ERROR_TYPE_NONE, /**< No error. */
+ RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
+ RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
+ RTE_MTR_ERROR_TYPE_METER_PROFILE,
+ RTE_MTR_ERROR_TYPE_MTR_ID,
+ RTE_MTR_ERROR_TYPE_MTR_PARAMS,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
+ RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
+ RTE_MTR_ERROR_TYPE_STATS_MASK,
+ RTE_MTR_ERROR_TYPE_STATS,
+ RTE_MTR_ERROR_TYPE_SHARED,
+};
+
+/**
+ * Verbose error structure definition.
+ *
+ * This object is normally allocated by applications and set by PMDs, the
+ * message points to a constant string which does not need to be freed by
+ * the application, however its pointer can be considered valid only as long
+ * as its associated DPDK port remains configured. Closing the underlying
+ * device or unloading the PMD invalidates it.
+ *
+ * Both cause and message may be NULL regardless of the error type.
+ */
+struct rte_mtr_error {
+ enum rte_mtr_error_type type; /**< Cause field and error type. */
+ const void *cause; /**< Object responsible for the error. */
+ const char *message; /**< Human-readable error message. */
+};
+
+/**
+ * MTR capabilities get
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] cap
+ * MTR capabilities. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_capabilities_get(uint8_t port_id,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile add
+ *
+ * Create a new meter profile with ID set to *meter_profile_id*. The new profile
+ * is used to create one or several MTR objects.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * ID for the new meter profile. Needs to be unused by any of the existing
+ * meter profiles added for the current port.
+ * @param[in] profile
+ * Meter profile parameters. Needs to be pre-allocated and valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_add(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+
+/**
+ * Meter profile delete
+ *
+ * Delete an existing meter profile. This operation fails when there is
+ * currently at least one user (i.e. MTR object) of this profile.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] meter_profile_id
+ * Meter profile ID. Needs to be the valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_delete(uint8_t port_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object create
+ *
+ * Create a new MTR object for the current port. This object is run as part of
+ * associated flow action for traffic metering and policing.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be unused by any of the existing MTR objects.
+ * created for the current port.
+ * @param[in] params
+ * MTR object params. Needs to be pre-allocated and valid.
+ * @param[in] shared
+ * Non-zero when this MTR object can be shared by multiple flows, zero when
+ * this MTR object can be used by a single flow.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_flow_action_type::RTE_FLOW_ACTION_TYPE_METER
+ */
+int
+rte_mtr_create(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object destroy
+ *
+ * Delete an existing MTR object. This operation fails when there is currently
+ * at least one user (i.e. flow) of this MTR object.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * created for the current port.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_destroy(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter disable
+ *
+ * Disable the meter of an existing MTR object. In disabled state, the meter of
+ * the current MTR object works in pass-through mode, meaning that for each
+ * input packet the meter output color is always the same as the input color. In
+ * particular, when the meter of the current MTR object is configured in color
+ * blind mode, the input color is always green, so the meter output color is
+ * also always green. Note that the policer and the statistics of the current
+ * MTR object are working as usual while the meter is disabled. No action is
+ * taken and this function returns successfully when the meter of the current
+ * MTR object is already disabled.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_disable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter enable
+ *
+ * Enable the meter of an existing MTR object. If the MTR object has its meter
+ * already enabled, then no action is taken and this function returns
+ * successfully.
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_enable(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object meter profile update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] meter_profile_id
+ * Meter profile ID for the current MTR object. Needs to be valid.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_profile_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object DSCP table update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] dscp_table
+ * When non-NULL: it points to a pre-allocated and pre-populated table with
+ * exactly 64 elements providing the input color for each value of the
+ * IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field.
+ * When NULL: it is equivalent to setting this parameter to an “all-green”
+ * populated table (i.e. table with all the 64 elements set to green color).
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_meter_dscp_table_update(uint8_t port_id,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object policer actions update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] action_mask
+ * Bit mask indicating which policer actions need to be updated. One or more
+ * policer actions can be updated in a single function invocation. To update
+ * the policer action associated with color C, bit (1 << C) needs to be set in
+ * *action_mask* and element at position C in the *actions* array needs to be
+ * valid.
+ * @param[in] actions
+ * Pre-allocated and pre-populated array of policer actions.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ */
+int
+rte_mtr_policer_actions_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object enabled statistics counters update
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[in] stats_mask
+ * Mask of statistics counter types to be enabled for the current MTR object.
+ * Any statistics counter type not included in this set is to be disabled for
+ * the current MTR object.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_update(uint8_t port_id,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+
+/**
+ * MTR object statistics counters read
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[in] mtr_id
+ * MTR object ID. Needs to be valid.
+ * @param[out] stats
+ * When non-NULL, it contains the current value for the statistics counters
+ * enabled for the current MTR object.
+ * @param[out] stats_mask
+ * When non-NULL, it contains the mask of statistics counter types that are
+ * currently enabled for this MTR object, indicating which of the counters
+ * retrieved with the *stats* structure are valid.
+ * @param[in] clear
+ * When this parameter has a non-zero value, the statistics counters are
+ * cleared (i.e. set to zero) immediately after they have been read,
+ * otherwise the statistics counters are left untouched.
+ * @param[out] error
+ * Error details. Filled in only on error, when not NULL.
+ * @return
+ * 0 on success, non-zero error code otherwise.
+ *
+ * @see enum rte_mtr_stats_type
+ */
+int
+rte_mtr_stats_read(uint8_t port_id,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_H__ */
diff --git a/lib/librte_ether/rte_mtr_driver.h b/lib/librte_ether/rte_mtr_driver.h
new file mode 100644
index 0000000..bb7deed
--- /dev/null
+++ b/lib/librte_ether/rte_mtr_driver.h
@@ -0,0 +1,221 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INCLUDE_RTE_MTR_DRIVER_H__
+#define __INCLUDE_RTE_MTR_DRIVER_H__
+
+/**
+ * @file
+ * RTE Generic Traffic Metering and Policing API (Driver Side)
+ *
+ * This file provides implementation helpers for internal use by PMDs, they
+ * are not intended to be exposed to applications and are not subject to ABI
+ * versioning.
+ */
+
+#include <stdint.h>
+
+#include <rte_errno.h>
+#include "rte_ethdev.h"
+#include "rte_mtr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int (*rte_mtr_capabilities_get_t)(struct rte_eth_dev *dev,
+ struct rte_mtr_capabilities *cap,
+ struct rte_mtr_error *error);
+/**< @internal MTR capabilities get */
+
+typedef int (*rte_mtr_meter_profile_add_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_meter_profile *profile,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile add */
+
+typedef int (*rte_mtr_meter_profile_delete_t)(struct rte_eth_dev *dev,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR meter profile delete */
+
+typedef int (*rte_mtr_create_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_params *params,
+ int shared,
+ struct rte_mtr_error *error);
+/**< @internal MTR object create */
+
+typedef int (*rte_mtr_destroy_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object destroy */
+
+typedef int (*rte_mtr_meter_enable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter enable */
+
+typedef int (*rte_mtr_meter_disable_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter disable */
+
+typedef int (*rte_mtr_meter_profile_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t meter_profile_id,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter profile update */
+
+typedef int (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ enum rte_mtr_color *dscp_table,
+ struct rte_mtr_error *error);
+/**< @internal MTR object meter DSCP table update */
+
+typedef int (*rte_mtr_policer_actions_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint32_t action_mask,
+ enum rte_mtr_policer_action *actions,
+ struct rte_mtr_error *error);
+/**< @internal MTR object policer action update*/
+
+typedef int (*rte_mtr_stats_update_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ uint64_t stats_mask,
+ struct rte_mtr_error *error);
+/**< @internal MTR object enabled stats update */
+
+typedef int (*rte_mtr_stats_read_t)(struct rte_eth_dev *dev,
+ uint32_t mtr_id,
+ struct rte_mtr_stats *stats,
+ uint64_t *stats_mask,
+ int clear,
+ struct rte_mtr_error *error);
+/**< @internal MTR object stats read */
+
+struct rte_mtr_ops {
+ /** MTR capabilities get */
+ rte_mtr_capabilities_get_t capabilities_get;
+
+ /** MTR meter profile add */
+ rte_mtr_meter_profile_add_t meter_profile_add;
+
+ /** MTR meter profile delete */
+ rte_mtr_meter_profile_delete_t meter_profile_delete;
+
+ /** MTR object create */
+ rte_mtr_create_t create;
+
+ /** MTR object destroy */
+ rte_mtr_destroy_t destroy;
+
+ /** MTR object meter enable */
+ rte_mtr_meter_enable_t meter_enable;
+
+ /** MTR object meter disable */
+ rte_mtr_meter_disable_t meter_disable;
+
+ /** MTR object meter profile update */
+ rte_mtr_meter_profile_update_t meter_profile_update;
+
+ /** MTR object meter DSCP table update */
+ rte_mtr_meter_dscp_table_update_t meter_dscp_table_update;
+
+ /** MTR object policer action update */
+ rte_mtr_policer_actions_update_t policer_actions_update;
+
+ /** MTR object enabled stats update */
+ rte_mtr_stats_update_t stats_update;
+
+ /** MTR object stats read */
+ rte_mtr_stats_read_t stats_read;
+};
+
+/**
+ * Initialize generic error structure.
+ *
+ * This function also sets rte_errno to a given value.
+ *
+ * @param[out] error
+ * Pointer to error structure (may be NULL).
+ * @param[in] code
+ * Related error code (rte_errno).
+ * @param[in] type
+ * Cause field and error type.
+ * @param[in] cause
+ * Object responsible for the error.
+ * @param[in] message
+ * Human-readable error message.
+ *
+ * @return
+ * Error code.
+ */
+static inline int
+rte_mtr_error_set(struct rte_mtr_error *error,
+ int code,
+ enum rte_mtr_error_type type,
+ const void *cause,
+ const char *message)
+{
+ if (error) {
+ *error = (struct rte_mtr_error){
+ .type = type,
+ .cause = cause,
+ .message = message,
+ };
+ }
+ rte_errno = code;
+ return code;
+}
+
+/**
+ * Get generic traffic metering and policing operations structure from a port
+ *
+ * @param[in] port_id
+ * The port identifier of the Ethernet device.
+ * @param[out] error
+ * Error details
+ *
+ * @return
+ * The traffic metering and policing operations structure associated with
+ * port_id on success, NULL otherwise.
+ */
+const struct rte_mtr_ops *
+rte_mtr_ops_get(uint8_t port_id, struct rte_mtr_error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INCLUDE_RTE_MTR_DRIVER_H__ */
--
2.7.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v6 0/9] Policy Based Power Control for Guest
2017-10-04 15:25 2% ` [dpdk-dev] [PATCH v5 0/9] " David Hunt
@ 2017-10-05 12:25 2% ` David Hunt
2017-10-05 13:28 2% ` [dpdk-dev] [PATCH v7 " David Hunt
0 siblings, 1 reply; 200+ results
From: David Hunt @ 2017-10-05 12:25 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu, santosh.shukla
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V6 patchset changes:
* Fixed comments in header for rte_pmd_i40e_query_vfid_by_mac.
* changed rte_pmd_i40e_query_vfid_by_mac return code from uint to int
as it can return negative error codes.
* Removed bool enum from channel_commands.h, including stdbool.h instead.
* Added #define VM_MAX_NAME_SZ 32 to channel_commands.h
* Renamed a few variables to be more readable.
* Added returns in a few places if failed to get info on domain.
* Fixed power_manager_init to keep track of num_freqs for each core.
* In power_manager_scale_core_med(), changed a hardcoded '5' to instead
be calculated from the centre of the frequency list
(global_core_freq_info[core_num].num_freqs / 2)
V5 patchset changes:
* Removed most of the #ifdef I40_PMD as it will be applicable to
other PMDs in the future.
* Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
to a const struct ether_addr *, rather than casting it later in the
function.
V4 patchset changes:
* None, re-post to mailing list under the correct email thread.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 2%]
* Re: [dpdk-dev] [PATCH v6 1/3] eal/x86: run-time dispatch over memcpy
@ 2017-10-05 11:26 3% ` Richardson, Bruce
0 siblings, 0 replies; 200+ results
From: Richardson, Bruce @ 2017-10-05 11:26 UTC (permalink / raw)
To: Li, Xiaoyun, Ananyev, Konstantin
Cc: Lu, Wenzhuo, Zhang, Helin, dev,
Thomas Monjalon (thomas.monjalon@6wind.com)
> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Thursday, October 5, 2017 12:19 PM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>; dev@dpdk.org; Thomas Monjalon
> (thomas.monjalon@6wind.com) <thomas.monjalon@6wind.com>
> Subject: RE: [PATCH v6 1/3] eal/x86: run-time dispatch over memcpy
>
>
>
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Thursday, October 5, 2017 17:37
> > To: Li, Xiaoyun <xiaoyun.li@intel.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Helin
> > <helin.zhang@intel.com>; dev@dpdk.org; Thomas Monjalon
> > (thomas.monjalon@6wind.com) <thomas.monjalon@6wind.com>
> > Subject: RE: [PATCH v6 1/3] eal/x86: run-time dispatch over memcpy
> >
> > > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > > b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > > index 8c08b8d..15a2fe9 100644
> > > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > > @@ -241,5 +241,6 @@ EXPERIMENTAL {
> > > rte_service_runstate_set;
> > > rte_service_set_stats_enable;
> > > rte_service_start_with_defaults;
> > > + rte_memcpy_ptr;
> > >
> > > } DPDK_17.08;
> >
> > I am not an expert in DPDK versioning system, But shouldn't we create
> > a
> > 17.11 section here?
> Should we create a 17.11 section? I am not sure who to ask for.
>
Any new functions that are public and are added in the 17.11 release need to
be added to the map file in a new 17.11 section. They are not part of the
ABI for the 17.08 release as they were not present there.
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API
2017-10-05 8:30 3% ` Adrien Mazarguil
@ 2017-10-05 8:39 0% ` Wu, Jingjing
0 siblings, 0 replies; 200+ results
From: Wu, Jingjing @ 2017-10-05 8:39 UTC (permalink / raw)
To: Adrien Mazarguil; +Cc: Sean Harte, Xing, Beilei, Chilikin, Andrey, dev
> -----Original Message-----
> From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> Sent: Thursday, October 5, 2017 4:30 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Sean Harte <seanbh@gmail.com>; Xing, Beilei <beilei.xing@intel.com>; Chilikin,
> Andrey <andrey.chilikin@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API
>
> On Thu, Oct 05, 2017 at 08:06:38AM +0000, Wu, Jingjing wrote:
> >
> >
> > > -----Original Message-----
> > > From: Sean Harte [mailto:seanbh@gmail.com]
> > > Sent: Tuesday, October 3, 2017 4:57 PM
> > > To: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > > Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Chilikin,
> > > Andrey <andrey.chilikin@intel.com>; dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API
> > >
> > > On 2 October 2017 at 13:27, Adrien Mazarguil <adrien.mazarguil@6wind.com>
> wrote:
> > > > On Fri, Sep 29, 2017 at 10:29:55AM +0100, Sean Harte wrote:
> > > >> On 29 September 2017 at 09:54, Xing, Beilei <beilei.xing@intel.com> wrote:
> > > > <snip>
> > > >> >> > /**
> > > >> >> > + * RTE_FLOW_ITEM_TYPE_GTP.
> > > >> >> > + *
> > > >> >> > + * Matches a GTPv1 header.
> > > >> >> > + */
> > > >> >> > +struct rte_flow_item_gtp {
> > > >> >> > + /**
> > > >> >> > + * Version (3b), protocol type (1b), reserved (1b),
> > > >> >> > + * Extension header flag (1b),
> > > >> >> > + * Sequence number flag (1b),
> > > >> >> > + * N-PDU number flag (1b).
> > > >> >> > + */
> > > >> >> > + uint8_t v_pt_rsv_flags;
> > > >> >> > + uint8_t msg_type; /**< Message type. */
> > > >> >> > + rte_be16_t msg_len; /**< Message length. */
> > > >> >> > + rte_be32_t teid; /**< Tunnel endpoint identifier. */ };
> > > >> >>
> > > >> >> In future, you might add support for GTPv2 (which is used since LTE).
> > > >> >> Maybe this structure should have v1 in its name to avoid confusion?
> > > >> >
> > > >> > I considered it before. But I think we can modify it when we support GTPv2 in
> future,
> > > and keep concise 'GTP' currently:) since I have described it matches v1 header.
> > > >> >
> > > >>
> > > >> You could rename v_pt_rsv_flags to version_flags to avoid some future
> > > >> code changes to support GTPv2. There's still the issue that not all
> > > >> GTPv2 messages have a TEID though.
> > > >
> > > > Although they have the same size, the header of these two protocols
> > > > obviously differs. My suggestion would be to go with a separate GTPv2
> > > > pattern item using its own dedicated structure instead.
> > > >
> > > > --
> > > > Adrien Mazarguil
> > > > 6WIND
> > >
> > > The 1st four bytes are the same (flags in first byte have different
> > > meanings, but the bits indicating the version are in the same
> > > location). After that, different fields in each version are optional,
> > > and the headers have variable size. A single structure could be used
> > > if the first field is renamed to something like "version_flags", and
> > > then check that the teid field in item->mask is not set if
> > > ((version_flags >> 5 == 2) && ((version_flags >> 4) & 1) == 1). If
> > > there's going to be two structures, it would be good to put v1 and v2
> > > in the names, in my opinion.
> >
> > I think the name GTP is OK for now. Due to v1 and v2 are different, why not rename
> them
> > when the v2 supporting are introduced?
>
> In any case I'd rather avoid renaming and modifying existing items and
> structure contents once part of the API to avoid API/ABI breakage that
> require deprecation notices, user applications updates and so on; rte_flow
> has been created as a kind of append-only API for this reason (of course
> there are exceptions, such as a bad design choice for the VLAN item I intend
> to fix at some point).
>
> I'm fine with the name "GTP" as defined now and documented as matching
> GTPv1. We can add "GTPv2"-themed definitions later when some implementation
> provides the ability to match this version. If you want to append the "v1"
> suffix right now to be more explicit, I'm also fine with that. Your call.
>
Got your point, I'm also fine with the name now for GTPv1, and add "GTPv2" when
It is supported.
Thanks
Jingjing
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API
@ 2017-10-05 8:30 3% ` Adrien Mazarguil
2017-10-05 8:39 0% ` Wu, Jingjing
0 siblings, 1 reply; 200+ results
From: Adrien Mazarguil @ 2017-10-05 8:30 UTC (permalink / raw)
To: Wu, Jingjing; +Cc: Sean Harte, Xing, Beilei, Chilikin, Andrey, dev
On Thu, Oct 05, 2017 at 08:06:38AM +0000, Wu, Jingjing wrote:
>
>
> > -----Original Message-----
> > From: Sean Harte [mailto:seanbh@gmail.com]
> > Sent: Tuesday, October 3, 2017 4:57 PM
> > To: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Chilikin,
> > Andrey <andrey.chilikin@intel.com>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API
> >
> > On 2 October 2017 at 13:27, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> > > On Fri, Sep 29, 2017 at 10:29:55AM +0100, Sean Harte wrote:
> > >> On 29 September 2017 at 09:54, Xing, Beilei <beilei.xing@intel.com> wrote:
> > > <snip>
> > >> >> > /**
> > >> >> > + * RTE_FLOW_ITEM_TYPE_GTP.
> > >> >> > + *
> > >> >> > + * Matches a GTPv1 header.
> > >> >> > + */
> > >> >> > +struct rte_flow_item_gtp {
> > >> >> > + /**
> > >> >> > + * Version (3b), protocol type (1b), reserved (1b),
> > >> >> > + * Extension header flag (1b),
> > >> >> > + * Sequence number flag (1b),
> > >> >> > + * N-PDU number flag (1b).
> > >> >> > + */
> > >> >> > + uint8_t v_pt_rsv_flags;
> > >> >> > + uint8_t msg_type; /**< Message type. */
> > >> >> > + rte_be16_t msg_len; /**< Message length. */
> > >> >> > + rte_be32_t teid; /**< Tunnel endpoint identifier. */ };
> > >> >>
> > >> >> In future, you might add support for GTPv2 (which is used since LTE).
> > >> >> Maybe this structure should have v1 in its name to avoid confusion?
> > >> >
> > >> > I considered it before. But I think we can modify it when we support GTPv2 in future,
> > and keep concise 'GTP' currently:) since I have described it matches v1 header.
> > >> >
> > >>
> > >> You could rename v_pt_rsv_flags to version_flags to avoid some future
> > >> code changes to support GTPv2. There's still the issue that not all
> > >> GTPv2 messages have a TEID though.
> > >
> > > Although they have the same size, the header of these two protocols
> > > obviously differs. My suggestion would be to go with a separate GTPv2
> > > pattern item using its own dedicated structure instead.
> > >
> > > --
> > > Adrien Mazarguil
> > > 6WIND
> >
> > The 1st four bytes are the same (flags in first byte have different
> > meanings, but the bits indicating the version are in the same
> > location). After that, different fields in each version are optional,
> > and the headers have variable size. A single structure could be used
> > if the first field is renamed to something like "version_flags", and
> > then check that the teid field in item->mask is not set if
> > ((version_flags >> 5 == 2) && ((version_flags >> 4) & 1) == 1). If
> > there's going to be two structures, it would be good to put v1 and v2
> > in the names, in my opinion.
>
> I think the name GTP is OK for now. Due to v1 and v2 are different, why not rename them
> when the v2 supporting are introduced?
In any case I'd rather avoid renaming and modifying existing items and
structure contents once part of the API to avoid API/ABI breakage that
require deprecation notices, user applications updates and so on; rte_flow
has been created as a kind of append-only API for this reason (of course
there are exceptions, such as a bad design choice for the VLAN item I intend
to fix at some point).
I'm fine with the name "GTP" as defined now and documented as matching
GTPv1. We can add "GTPv2"-themed definitions later when some implementation
provides the ability to match this version. If you want to append the "v1"
suffix right now to be more explicit, I'm also fine with that. Your call.
--
Adrien Mazarguil
6WIND
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v5] devtools: rework abi checker script
@ 2017-10-05 7:53 27% ` Olivier Matz
2017-10-05 13:15 4% ` Neil Horman
2017-11-07 23:24 4% ` Thomas Monjalon
0 siblings, 2 replies; 200+ results
From: Olivier Matz @ 2017-10-05 7:53 UTC (permalink / raw)
To: dev, nhorman, bruce.richardson
The initial version of the script had some limitations:
- cannot work on a non-clean workspace
- environment variables are not documented
- no compilation log in case of failure
- return success even it abi is incompatible
This patch addresses these issues and rework the code.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
---
v4->v5:
- Add a log when shared lib has no public ABI
v3->v4:
- clarify logs on incompatible abi
- log when an error returned an error
- [really] fix the report path
- log the output of make config in the proper file
v2->v3:
- fix when not launched from dpdk root dir
- use "-Og -Wno-error" instead of "-O0"
- fix typo in commit log
v1->v2:
- use /usr/bin/env to find bash (which is required)
- fix displayed path to html reports
- reword help for -f option
devtools/validate-abi.sh | 397 ++++++++++++++++++++++++-----------------------
1 file changed, 205 insertions(+), 192 deletions(-)
diff --git a/devtools/validate-abi.sh b/devtools/validate-abi.sh
index 0accc99b1..8caf43e83 100755
--- a/devtools/validate-abi.sh
+++ b/devtools/validate-abi.sh
@@ -1,7 +1,8 @@
-#!/bin/sh
+#!/usr/bin/env bash
# BSD LICENSE
#
# Copyright(c) 2015 Neil Horman. All rights reserved.
+# Copyright(c) 2017 6WIND S.A.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,236 +28,248 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-TAG1=$1
-TAG2=$2
-TARGET=$3
-ABI_DIR=`mktemp -d -p /tmp ABI.XXXXXX`
+set -e
-usage() {
- echo "$0 <REV1> <REV2> <TARGET>"
-}
+abicheck=abi-compliance-checker
+abidump=abi-dumper
+default_dst=abi-check
+default_target=x86_64-native-linuxapp-gcc
-log() {
- local level=$1
- shift
- echo "$*"
+# trap on error
+err_report() {
+ echo "$0: error at line $1"
}
+trap 'err_report $LINENO' ERR
-validate_tags() {
+print_usage () {
+ cat <<- END_OF_HELP
+ $(basename $0) [options] <rev1> <rev2>
- if [ -z "$HASH1" ]
- then
- echo "invalid revision: $TAG1"
- return
- fi
- if [ -z "$HASH2" ]
- then
- echo "invalid revision: $TAG2"
- return
- fi
+ This script compares the ABI of 2 git revisions of the current
+ workspace. The output is a html report and a compilation log.
+
+ The objective is to make sure that applications built against
+ DSOs from the first revision can still run when executed using
+ the DSOs built from the second revision.
+
+ <rev1> and <rev2> are git commit id or tags.
+
+ Options:
+ -h show this help
+ -j <num> enable parallel compilation with <num> threads
+ -v show compilation logs on the console
+ -d <dir> change working directory (default is ${default_dst})
+ -t <target> the dpdk target to use (default is ${default_target})
+ -f overwrite existing files in destination directory
+
+ The script returns 0 on success, or the value of last failing
+ call of ${abicheck} (incompatible abi or the tool has run with errors).
+ The errors returned by ${abidump} are ignored.
+
+ END_OF_HELP
}
-validate_args() {
- if [ -z "$TAG1" ]
- then
- echo "Must Specify REV1"
- return
- fi
- if [ -z "$TAG2" ]
- then
- echo "Must Specify REV2"
- return
- fi
- if [ -z "$TARGET" ]
- then
- echo "Must Specify a build target"
+# log in the file, and on stdout if verbose
+# $1: level string
+# $2: string to be logged
+log() {
+ echo "$1: $2"
+ if [ "${verbose}" != "true" ]; then
+ echo "$1: $2" >&3
fi
}
+# launch a command and log it, taking care of surrounding spaces with quotes
+cmd() {
+ local i s whitespace ret
+ s=""
+ whitespace="[[:space:]]"
+ for i in "$@"; do
+ if [[ $i =~ $whitespace ]]; then
+ i=\"$i\"
+ fi
+ if [ -z "$s" ]; then
+ s="$i"
+ else
+ s="$s $i"
+ fi
+ done
+
+ ret=0
+ log "CMD" "$s"
+ "$@" || ret=$?
+ if [ "$ret" != "0" ]; then
+ log "CMD" "previous command returned $ret"
+ fi
+
+ return $ret
+}
-cleanup_and_exit() {
- rm -rf $ABI_DIR
- git checkout $CURRENT_BRANCH
- exit $1
+# redirect or copy stderr/stdout to a file
+# the syntax is unfamiliar, but it makes the rest of the
+# code easier to read, avoiding the use of pipes
+set_log_file() {
+ # save original stdout and stderr in fd 3 and 4
+ exec 3>&1
+ exec 4>&2
+ # create a new fd 5 that send to a file
+ exec 5> >(cat > $1)
+ # send stdout and stderr to fd 5
+ if [ "${verbose}" = "true" ]; then
+ exec 1> >(tee /dev/fd/5 >&3)
+ exec 2> >(tee /dev/fd/5 >&4)
+ else
+ exec 1>&5
+ exec 2>&5
+ fi
}
# Make sure we configure SHARED libraries
# Also turn off IGB and KNI as those require kernel headers to build
fixup_config() {
- sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" config/defconfig_$TARGET
- sed -i -e"$ a\CONFIG_RTE_NEXT_ABI=n" config/defconfig_$TARGET
- sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" config/defconfig_$TARGET
- sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" config/defconfig_$TARGET
- sed -i -e"$ a\CONFIG_RTE_KNI_KMOD=n" config/defconfig_$TARGET
+ local conf=config/defconfig_$target
+ cmd sed -i -e"$ a\CONFIG_RTE_BUILD_SHARED_LIB=y" $conf
+ cmd sed -i -e"$ a\CONFIG_RTE_NEXT_ABI=n" $conf
+ cmd sed -i -e"$ a\CONFIG_RTE_EAL_IGB_UIO=n" $conf
+ cmd sed -i -e"$ a\CONFIG_RTE_LIBRTE_KNI=n" $conf
+ cmd sed -i -e"$ a\CONFIG_RTE_KNI_KMOD=n" $conf
}
-###########################################
-#START
-############################################
+# build dpdk for the given tag and dump abi
+# $1: hash of the revision
+gen_abi() {
+ local i
+
+ cmd git clone ${dpdkroot} ${dst}/${1}
+ cmd cd ${dst}/${1}
+
+ log "INFO" "Checking out version ${1} of the dpdk"
+ # Move to the old version of the tree
+ cmd git checkout ${1}
+
+ fixup_config
+
+ # Now configure the build
+ log "INFO" "Configuring DPDK ${1}"
+ cmd make config T=$target O=$target
+
+ # Checking abi compliance relies on using the dwarf information in
+ # the shared objects. Build with -g to include them.
+ log "INFO" "Building DPDK ${1}. This might take a moment"
+ cmd make -j$parallel O=$target V=1 EXTRA_CFLAGS="-g -Og -Wno-error" \
+ EXTRA_LDFLAGS="-g" || log "INFO" "The build failed"
+
+ # Move to the lib directory
+ cmd cd ${PWD}/$target/lib
+ log "INFO" "Collecting ABI information for ${1}"
+ for i in *.so; do
+ [ -e "$i" ] || break
+ cmd $abidump ${i} -o $dst/${1}/${i}.dump -lver ${1} || true
+ # hack to ignore empty SymbolsInfo section (no public ABI)
+ if grep -q "'SymbolInfo' => {}," $dst/${1}/${i}.dump \
+ 2> /dev/null; then
+ log "INFO" "${i} has no public ABI, remove dump file"
+ cmd rm -f $dst/${1}/${i}.dump
+ fi
+ done
+}
-#trap on ctrl-c to clean up
-trap cleanup_and_exit SIGINT
+verbose=false
+parallel=1
+dst=${default_dst}
+target=${default_target}
+force=0
+while getopts j:vd:t:fh ARG ; do
+ case $ARG in
+ j ) parallel=$OPTARG ;;
+ v ) verbose=true ;;
+ d ) dst=$OPTARG ;;
+ t ) target=$OPTARG ;;
+ f ) force=1 ;;
+ h ) print_usage ; exit 0 ;;
+ ? ) print_usage ; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
-if [ -z "$DPDK_MAKE_JOBS" ]
-then
- # This counts the number of cpus on the system
- if [ -e /usr/bin/lscpu ]
- then
- DPDK_MAKE_JOBS=`lscpu -p=cpu | grep -v "#" | wc -l`
- else
- DPDK_MAKE_JOBS=1
- fi
+if [ $# != 2 ]; then
+ print_usage
+ exit 1
fi
-#Save the current branch
-CURRENT_BRANCH=`git branch | grep \* | cut -d' ' -f2`
+tag1=$1
+tag2=$2
-if [ -z "$CURRENT_BRANCH" ]
-then
- CURRENT_BRANCH=`git log --pretty=format:%H HEAD~1..HEAD`
-fi
+# convert path to absolute
+case "${dst}" in
+ /*) ;;
+ *) dst=${PWD}/${dst} ;;
+esac
+dpdkroot=$(readlink -e $(dirname $0)/..)
-if [ -n "$VERBOSE" ]
-then
- export VERBOSE=/dev/stdout
-else
- export VERBOSE=/dev/null
+if [ -e "${dst}" -a "$force" = 0 ]; then
+ echo "The ${dst} directory is not empty. Remove it, use another"
+ echo "one (-d <dir>), or force overriding (-f)"
+ exit 1
fi
-# Validate that we have all the arguments we need
-res=$(validate_args)
-if [ -n "$res" ]
-then
- echo $res
- usage
- cleanup_and_exit 1
-fi
+rm -rf ${dst}
+mkdir -p ${dst}
+set_log_file ${dst}/abi-check.log
+log "INFO" "Logs available in ${dst}/abi-check.log"
-HASH1=$(git show -s --format=%H "$TAG1" -- 2> /dev/null | tail -1)
-HASH2=$(git show -s --format=%H "$TAG2" -- 2> /dev/null | tail -1)
+command -v ${abicheck} || log "INFO" "Can't find ${abicheck} utility"
+command -v ${abidump} || log "INFO" "Can't find ${abidump} utility"
-# Make sure our tags exist
-res=$(validate_tags)
-if [ -n "$res" ]
-then
- echo $res
- cleanup_and_exit 1
-fi
+hash1=$(git show -s --format=%h "$tag1" -- 2> /dev/null | tail -1)
+hash2=$(git show -s --format=%h "$tag2" -- 2> /dev/null | tail -1)
# Make hashes available in output for non-local reference
-TAG1="$TAG1 ($HASH1)"
-TAG2="$TAG2 ($HASH2)"
-
-ABICHECK=`which abi-compliance-checker 2>/dev/null`
-if [ $? -ne 0 ]
-then
- log "INFO" "Can't find abi-compliance-checker utility"
- cleanup_and_exit 1
-fi
-
-ABIDUMP=`which abi-dumper 2>/dev/null`
-if [ $? -ne 0 ]
-then
- log "INFO" "Can't find abi-dumper utility"
- cleanup_and_exit 1
-fi
+tag1="$tag1 ($hash1)"
+tag2="$tag2 ($hash2)"
-log "INFO" "We're going to check and make sure that applications built"
-log "INFO" "against DPDK DSOs from version $TAG1 will still run when executed"
-log "INFO" "against DPDK DSOs built from version $TAG2."
-log "INFO" ""
-
-# Check to make sure we have a clean tree
-git status | grep -q clean
-if [ $? -ne 0 ]
-then
- log "WARN" "Working directory not clean, aborting"
- cleanup_and_exit 1
+if [ "$hash1" = "$hash2" ]; then
+ log "ERROR" "$tag1 and $tag2 are the same revisions"
+ exit 1
fi
-# Move to the root of the git tree
-cd $(dirname $0)/..
+cmd mkdir -p ${dst}
-log "INFO" "Checking out version $TAG1 of the dpdk"
-# Move to the old version of the tree
-git checkout $HASH1
+# dump abi for each revision
+gen_abi ${hash1}
+gen_abi ${hash2}
-fixup_config
+# compare the abi dumps
+cmd cd ${dst}
+ret=0
+list=""
+for i in ${hash2}/*.dump; do
+ name=`basename $i`
+ libname=${name%.dump}
-# Checking abi compliance relies on using the dwarf information in
-# The shared objects. Thats only included in the DSO's if we build
-# with -g
-export EXTRA_CFLAGS="$EXTRA_CFLAGS -g -O0"
-export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -g"
-
-# Now configure the build
-log "INFO" "Configuring DPDK $TAG1"
-make config T=$TARGET O=$TARGET > $VERBOSE 2>&1
-
-log "INFO" "Building DPDK $TAG1. This might take a moment"
-make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1
-
-if [ $? -ne 0 ]
-then
- log "INFO" "THE BUILD FAILED. ABORTING"
- cleanup_and_exit 1
-fi
+ if [ ! -f ${hash1}/$name ]; then
+ log "INFO" "$NAME does not exist in $tag1. skipping..."
+ continue
+ fi
-# Move to the lib directory
-cd $TARGET/lib
-log "INFO" "COLLECTING ABI INFORMATION FOR $TAG1"
-for i in `ls *.so`
-do
- $ABIDUMP $i -o $ABI_DIR/$i-ABI-0.dump -lver $HASH1
+ local_ret=0
+ cmd $abicheck -l $libname \
+ -old ${hash1}/$name -new ${hash2}/$name || local_ret=$?
+ if [ $local_ret != 0 ]; then
+ log "NOTICE" "$abicheck returned $local_ret"
+ ret=$local_ret
+ list="$list $libname"
+ fi
done
-cd ../..
-
-# Now clean the tree, checkout the second tag, and rebuild
-git clean -f -d
-git reset --hard
-# Move to the new version of the tree
-log "INFO" "Checking out version $TAG2 of the dpdk"
-git checkout $HASH2
-
-fixup_config
-
-# Now configure the build
-log "INFO" "Configuring DPDK $TAG2"
-make config T=$TARGET O=$TARGET > $VERBOSE 2>&1
-
-log "INFO" "Building DPDK $TAG2. This might take a moment"
-make -j$DPDK_MAKE_JOBS O=$TARGET > $VERBOSE 2>&1
-if [ $? -ne 0 ]
-then
- log "INFO" "THE BUILD FAILED. ABORTING"
- cleanup_and_exit 1
+if [ $ret != 0 ]; then
+ log "NOTICE" "ABI may be incompatible, check reports/logs for details."
+ log "NOTICE" "Incompatible list: $list"
+else
+ log "NOTICE" "No error detected, ABI is compatible."
fi
-cd $TARGET/lib
-log "INFO" "COLLECTING ABI INFORMATION FOR $TAG2"
-for i in `ls *.so`
-do
- $ABIDUMP $i -o $ABI_DIR/$i-ABI-1.dump -lver $HASH2
-done
-cd ../..
-
-# Start comparison of ABI dumps
-for i in `ls $ABI_DIR/*-1.dump`
-do
- NEWNAME=`basename $i`
- OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
- LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
-
- if [ ! -f $ABI_DIR/$OLDNAME ]
- then
- log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..."
- fi
-
- #compare the abi dumps
- $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME
-done
+log "INFO" "Logs are in ${dst}/abi-check.log"
+log "INFO" "HTML reports are in ${dst}/compat_reports directory"
-git reset --hard
-log "INFO" "ABI CHECK COMPLETE. REPORTS ARE IN compat_report directory"
-cleanup_and_exit 0
+exit $ret
--
2.11.0
^ permalink raw reply [relevance 27%]
* Re: [dpdk-dev] [PATCH v6 0/4] ethdev new offloads API
2017-10-04 16:12 0% ` Ananyev, Konstantin
@ 2017-10-05 0:55 0% ` Ferruh Yigit
0 siblings, 0 replies; 200+ results
From: Ferruh Yigit @ 2017-10-05 0:55 UTC (permalink / raw)
To: Ananyev, Konstantin, Shahaf Shuler, thomas, arybchenko, jerin.jacob; +Cc: dev
On 10/4/2017 5:12 PM, Ananyev, Konstantin wrote:
>
>
>> -----Original Message-----
>> From: Shahaf Shuler [mailto:shahafs@mellanox.com]
>> Sent: Wednesday, October 4, 2017 9:18 AM
>> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; thomas@monjalon.net; arybchenko@solarflare.com;
>> jerin.jacob@caviumnetworks.com; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Cc: dev@dpdk.org
>> Subject: [PATCH v6 0/4] ethdev new offloads API
>>
>> Tx offloads configuration is per queue. Tx offloads are enabled by default,
>> and can be disabled using ETH_TXQ_FLAGS_NO* flags.
>> This behaviour is not consistent with the Rx side where the Rx offloads
>> configuration is per port. Rx offloads are disabled by default and enabled
>> according to bit field in rte_eth_rxmode structure.
>>
>> Moreover, considering more Tx and Rx offloads will be added
>> over time, the cost of managing them all inside the PMD will be tremendous,
>> as the PMD will need to check the matching for the entire offload set
>> for each mbuf it handles.
>> In addition, on the current approach each Rx offload added breaks the
>> ABI compatibility as it requires to add entries to existing bit-fields.
>>
>> The series address above issues by defining a new offloads API.
>> In the new API, offloads are divided into per-port and per-queue offloads,
>> with a corresponding capability for each.
>> The offloads are disabled by default. Each offload can be enabled or
>> disabled using the existing DEV_TX_OFFLOADS_* or DEV_RX_OFFLOADS_* flags.
>> Such API will enable to easily add or remove offloads, without breaking the
>> ABI compatibility.
>>
>> In order to provide a smooth transition between the APIs the following actions
>> were taken:
>> * The old offloads API is kept for the meanwhile.
>> * Helper function which copy from old to new API were added to ethdev,
>> enabling the PMD to support only one of the APIs.
>> * Helper function which copy from new to old API were also added,
>> to enable application to use the new API with PMD which still supports
>> the old one.
>>
>> Per discussion made on the RFC of this series [1], the integration plan which was
>> decided is to do the transition in two phases:
>> * ethdev API will move on 17.11.
>> * Apps and examples will move on 18.02.
>>
>> This to enable PMD maintainers sufficient time to adopt the new API.
>>
>> [1]
>> http://dpdk.org/ml/archives/dev/2017-August/072643.html
>>
>> on v6:
>> - Move mbuf fast free Tx offload to a seperate patch.
>>
>> on v5:
>> - Fix documentation.
>> - Fix comments on port offloads configuration.
>>
>> on v4:
>> - Added another patch for documentation.
>> - Fixed ETH_TXQ_FLAGS_IGNORE flag override.
>> - Clarify the description of DEV_TX_OFFLOAD_MBUF_FAST_FREE offload.
>>
>> on v3:
>> - Introduce the DEV_TX_OFFLOAD_MBUF_FAST_FREE to act as an equivalent
>> for the no refcnt and single mempool flags.
>> - Fix features documentation.
>> - Fix comment style.
>>
>> on v2:
>> - Taking new approach of dividing offloads into per-queue and per-port one.
>> - Postpone the Tx/Rx public struct renaming to 18.02
>> - Squash the helper functions into the Rx/Tx offloads intro patches.
>>
>> Shahaf Shuler (4):
>> ethdev: introduce Rx queue offloads API
>> ethdev: introduce Tx queue offloads API
>> ethdev: add mbuf fast free Tx offload
>> doc: add details on ethdev offloads API
>>
>> doc/guides/nics/features.rst | 66 +++++---
>> doc/guides/nics/features/default.ini | 1 +
>> doc/guides/prog_guide/poll_mode_drv.rst | 20 +++
>> lib/librte_ether/rte_ethdev.c | 223 +++++++++++++++++++++++++--
>> lib/librte_ether/rte_ethdev.h | 89 ++++++++++-
>> 5 files changed, 359 insertions(+), 40 deletions(-)
>>
>> Series-reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Series applied to dpdk-next-net/master, thanks.
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] ethdev: fix LIBABIVER
@ 2017-10-04 21:54 3% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-04 21:54 UTC (permalink / raw)
To: Yigit, Ferruh; +Cc: dev, Yang, Zhiyong, stable
Added this comment:
The ethdev ABI has been broken in release 17.08 without being bumped.
> > Fixes: c33ade1227a5 ("doc: notify ethdev callback process API change")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Reviewed-by: Zhiyong Yang <zhiyong.yang@intel.com>
Applied, thanks
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-03 15:17 4% ` Thomas Monjalon
@ 2017-10-04 17:11 0% ` Flavio Leitner
2017-10-05 21:55 0% ` Mokhtar, Amr
1 sibling, 0 replies; 200+ results
From: Flavio Leitner @ 2017-10-04 17:11 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Mokhtar, Amr, dev, aconole, bluca
On Tue, 03 Oct 2017 17:17:53 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:
> 03/10/2017 16:29, Mokhtar, Amr:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 25/08/2017 15:46, Amr Mokhtar:
> > > > +int
> > > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > > + const struct rte_bbdev_conf *conf);
> > >
> > > I am not convinced by the "configure all" function in ethdev.
> > > We break the ABI each time we add a new feature to configure.
> > > And it does not really help to have all configurations in one struct.
> > > Would you mind to split the struct rte_bbdev_conf and split the function
> > > accordingly?
> >
> > There is nothing to split tbh. The only parameter it has is the socket_id.
> > And in fact, it's optional, can be null. The only config we need is num_queues.
>
> Indeed, there is nothing in this struct.
> If you need only to allocate queues, you just have to rename this function.
>
> > I don't see in the near future that we may need to add more config params.
> > As a side, in the time of the implementation we were trying to avoid any
> > diversions from the current design ideology of ethdev and cryptodev.
>
> There is no ideology in ethdev, just some mistakes ;)
>
> > Can we leave it for consideration with future releases?
>
> No it should be addressed from the beginning.
>
> When you will need to add something more to configure port-wise,
> you should add a new function instead of breaking the ABI
> of the global conf struct.
> That's why the configure option should be more specialized.
>
> Distro people were complaining about ABI breakage last week.
> This is exactly an example of how to avoid it from the beginning.
Exactly, and fixing in future is unlikely to happen or could be
more difficult and even if it happens, it will cause another breakage.
--
Flavio
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH v6 0/4] ethdev new offloads API
2017-10-04 8:17 4% ` [dpdk-dev] [PATCH v6 0/4] " Shahaf Shuler
@ 2017-10-04 16:12 0% ` Ananyev, Konstantin
2017-10-05 0:55 0% ` Ferruh Yigit
0 siblings, 1 reply; 200+ results
From: Ananyev, Konstantin @ 2017-10-04 16:12 UTC (permalink / raw)
To: Shahaf Shuler, thomas, arybchenko, jerin.jacob, Yigit, Ferruh; +Cc: dev
> -----Original Message-----
> From: Shahaf Shuler [mailto:shahafs@mellanox.com]
> Sent: Wednesday, October 4, 2017 9:18 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; thomas@monjalon.net; arybchenko@solarflare.com;
> jerin.jacob@caviumnetworks.com; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v6 0/4] ethdev new offloads API
>
> Tx offloads configuration is per queue. Tx offloads are enabled by default,
> and can be disabled using ETH_TXQ_FLAGS_NO* flags.
> This behaviour is not consistent with the Rx side where the Rx offloads
> configuration is per port. Rx offloads are disabled by default and enabled
> according to bit field in rte_eth_rxmode structure.
>
> Moreover, considering more Tx and Rx offloads will be added
> over time, the cost of managing them all inside the PMD will be tremendous,
> as the PMD will need to check the matching for the entire offload set
> for each mbuf it handles.
> In addition, on the current approach each Rx offload added breaks the
> ABI compatibility as it requires to add entries to existing bit-fields.
>
> The series address above issues by defining a new offloads API.
> In the new API, offloads are divided into per-port and per-queue offloads,
> with a corresponding capability for each.
> The offloads are disabled by default. Each offload can be enabled or
> disabled using the existing DEV_TX_OFFLOADS_* or DEV_RX_OFFLOADS_* flags.
> Such API will enable to easily add or remove offloads, without breaking the
> ABI compatibility.
>
> In order to provide a smooth transition between the APIs the following actions
> were taken:
> * The old offloads API is kept for the meanwhile.
> * Helper function which copy from old to new API were added to ethdev,
> enabling the PMD to support only one of the APIs.
> * Helper function which copy from new to old API were also added,
> to enable application to use the new API with PMD which still supports
> the old one.
>
> Per discussion made on the RFC of this series [1], the integration plan which was
> decided is to do the transition in two phases:
> * ethdev API will move on 17.11.
> * Apps and examples will move on 18.02.
>
> This to enable PMD maintainers sufficient time to adopt the new API.
>
> [1]
> http://dpdk.org/ml/archives/dev/2017-August/072643.html
>
> on v6:
> - Move mbuf fast free Tx offload to a seperate patch.
>
> on v5:
> - Fix documentation.
> - Fix comments on port offloads configuration.
>
> on v4:
> - Added another patch for documentation.
> - Fixed ETH_TXQ_FLAGS_IGNORE flag override.
> - Clarify the description of DEV_TX_OFFLOAD_MBUF_FAST_FREE offload.
>
> on v3:
> - Introduce the DEV_TX_OFFLOAD_MBUF_FAST_FREE to act as an equivalent
> for the no refcnt and single mempool flags.
> - Fix features documentation.
> - Fix comment style.
>
> on v2:
> - Taking new approach of dividing offloads into per-queue and per-port one.
> - Postpone the Tx/Rx public struct renaming to 18.02
> - Squash the helper functions into the Rx/Tx offloads intro patches.
>
> Shahaf Shuler (4):
> ethdev: introduce Rx queue offloads API
> ethdev: introduce Tx queue offloads API
> ethdev: add mbuf fast free Tx offload
> doc: add details on ethdev offloads API
>
> doc/guides/nics/features.rst | 66 +++++---
> doc/guides/nics/features/default.ini | 1 +
> doc/guides/prog_guide/poll_mode_drv.rst | 20 +++
> lib/librte_ether/rte_ethdev.c | 223 +++++++++++++++++++++++++--
> lib/librte_ether/rte_ethdev.h | 89 ++++++++++-
> 5 files changed, 359 insertions(+), 40 deletions(-)
>
> Series-reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
>
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 2.12.0
^ permalink raw reply [relevance 0%]
* [dpdk-dev] [PATCH v5 0/9] Policy Based Power Control for Guest
2017-10-04 9:15 3% ` [dpdk-dev] [PATCH v4] " David Hunt
@ 2017-10-04 15:25 2% ` David Hunt
2017-10-05 12:25 2% ` [dpdk-dev] [PATCH v6 " David Hunt
0 siblings, 1 reply; 200+ results
From: David Hunt @ 2017-10-04 15:25 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V5 patchset changes:
* Removed most of the #ifdef I40_PMD from the example code as it will
be applicable to other PMDs in the future.
* Changed the parameter of rte_pmd_i40e_query_vfid_by_mac from a uint64
to a const struct ether_addr *, rather than casting it later in the
function.
V4 patchset changes:
* None, re-post to mailing list under the correct email thread.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 2%]
* [dpdk-dev] [PATCH v2] test/crypto: remove crypto perf tests
@ 2017-10-04 6:48 1% ` Pablo de Lara
0 siblings, 0 replies; 200+ results
From: Pablo de Lara @ 2017-10-04 6:48 UTC (permalink / raw)
To: declan.doherty, hemant.agrawal, akhil.goyal, jerin.jacob,
fiona.trahe, deepak.k.jain, john.griffin
Cc: dev, Pablo de Lara
Since the crypto perf application is flexible enough
to cover all the crypto performance tests, these are not needed
anymore, so they will be removed to avoid duplications.
Besides, the crypto perf application gives the user more options
to get performance, for every single supported algorithm,
such as varying the buffer size as the user wants.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
Changes in v2:
- Rebased against latest code
- Added note in release notes
doc/guides/rel_notes/release_17_11.rst | 15 +
test/test/Makefile | 1 -
test/test/test_cryptodev_perf.c | 4932 --------------------------------
3 files changed, 15 insertions(+), 4933 deletions(-)
delete mode 100644 test/test/test_cryptodev_perf.c
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index ebb5021..58e614b 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -164,6 +164,21 @@ ABI Changes
=========================================================
+Removed Items
+-------------
+
+.. This section should contain removed items in this release. Sample format:
+
+ * Add a short 1-2 sentence description of the removed item in the past
+ tense.
+
+ This section is a comment. do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =========================================================
+
+* The crypto performance unit tests have been removed, substituted
+ by the dpdk-test-crypto-perf application.
+
Shared Library Versions
-----------------------
diff --git a/test/test/Makefile b/test/test/Makefile
index 42d9a49..de360e3 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -198,7 +198,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
-SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c
deleted file mode 100644
index 3b57e6d..0000000
--- a/test/test/test_cryptodev_perf.c
+++ /dev/null
@@ -1,4932 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <rte_common.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-#include <rte_memcpy.h>
-
-#include <rte_crypto.h>
-#include <rte_cryptodev.h>
-#include <rte_cycles.h>
-
-#include "test.h"
-#include "test_cryptodev.h"
-#include "test_cryptodev_gcm_test_vectors.h"
-
-#define AES_CIPHER_IV_LENGTH 16
-#define TRIPLE_DES_CIPHER_IV_LENGTH 8
-#define AES_GCM_AAD_LENGTH 16
-
-#define PERF_NUM_OPS_INFLIGHT (128)
-#define DEFAULT_NUM_REQS_TO_SUBMIT (10000000)
-
-struct crypto_testsuite_params {
- struct rte_mempool *mbuf_mp;
- struct rte_mempool *op_mpool;
- struct rte_mempool *sess_mp;
-
- uint16_t nb_queue_pairs;
-
- struct rte_cryptodev_config conf;
- struct rte_cryptodev_qp_conf qp_conf;
- uint8_t dev_id;
-};
-
-enum chain_mode {
- CIPHER_HASH,
- HASH_CIPHER,
- CIPHER_ONLY,
- HASH_ONLY,
- AEAD
-};
-
-
-struct symmetric_op {
- const uint8_t *aad_data;
-
- const uint8_t *p_data;
- uint32_t p_len;
-
- const uint8_t *c_data;
- uint32_t c_len;
-
- const uint8_t *t_data;
- uint32_t t_len;
-
-};
-
-struct symmetric_session_attrs {
- enum rte_crypto_cipher_operation cipher;
- enum rte_crypto_auth_operation auth;
- enum rte_crypto_aead_operation aead;
-
- enum rte_crypto_cipher_algorithm cipher_algorithm;
- const uint8_t *key_cipher_data;
- uint32_t key_cipher_len;
-
- enum rte_crypto_auth_algorithm auth_algorithm;
- const uint8_t *key_auth_data;
- uint32_t key_auth_len;
-
- enum rte_crypto_aead_algorithm aead_algorithm;
- const uint8_t *key_aead_data;
- uint32_t key_aead_len;
-
- const uint8_t *iv_data;
- uint16_t iv_len;
- uint16_t aad_len;
- uint32_t digest_len;
-};
-
-static struct rte_cryptodev_sym_session *test_crypto_session;
-
-#define ALIGN_POW2_ROUNDUP(num, align) \
- (((num) + (align) - 1) & ~((align) - 1))
-
-/*
- * This struct is needed to avoid unnecessary allocation or checking
- * of allocation of crypto params with current alloc on the fly
- * implementation.
- */
-
-struct crypto_params {
- uint8_t *aad;
- uint8_t *digest;
-};
-
-struct perf_test_params {
-
- unsigned total_operations;
- unsigned burst_size;
- unsigned buf_size;
-
- enum chain_mode chain;
-
- enum rte_crypto_cipher_algorithm cipher_algo;
- unsigned int key_length;
- enum rte_crypto_auth_algorithm auth_algo;
- enum rte_crypto_aead_algorithm aead_algo;
-
- struct symmetric_session_attrs *session_attrs;
-
- struct symmetric_op *symmetric_op;
-};
-
-#define MAX_NUM_OF_OPS_PER_UT (128)
-
-struct crypto_unittest_params {
- struct rte_crypto_sym_xform cipher_xform;
- struct rte_crypto_sym_xform auth_xform;
-
- struct rte_cryptodev_sym_session *sess;
-
- struct rte_crypto_op *op;
-
- struct rte_mbuf *obuf[MAX_NUM_OF_OPS_PER_UT];
- struct rte_mbuf *ibuf[MAX_NUM_OF_OPS_PER_UT];
-
- uint8_t *digest;
-};
-
-static int
-test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo);
-static int
-test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo,
- enum rte_crypto_aead_algorithm aead_algo);
-static int
-test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo);
-
-static struct rte_mbuf *
-test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz);
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len);
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain);
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain __rte_unused);
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain __rte_unused);
-static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo);
-
-
-static const char *chain_mode_name(enum chain_mode mode)
-{
- switch (mode) {
- case CIPHER_HASH: return "cipher_hash"; break;
- case HASH_CIPHER: return "hash_cipher"; break;
- case CIPHER_ONLY: return "cipher_only"; break;
- case HASH_ONLY: return "hash_only"; break;
- case AEAD: return "aead"; break;
- default: return ""; break;
- }
-}
-
-static const char *pmd_name(uint8_t driver_id)
-{
- uint8_t null_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_NULL_PMD));
- uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
- uint8_t snow3g_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
- uint8_t aesni_gcm_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
- uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
- uint8_t qat_pmd = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
-
- if (driver_id == null_pmd)
- return RTE_STR(CRYPTODEV_NAME_NULL_PMD);
- else if (driver_id == aesni_gcm_pmd)
- return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD);
- else if (driver_id == aesni_mb_pmd)
- return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD);
- else if (driver_id == qat_pmd)
- return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
- else if (driver_id == snow3g_pmd)
- return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD);
- else if (driver_id == dpaa2_pmd)
- return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD);
- else
- return "";
-}
-
-static struct rte_mbuf *
-setup_test_string(struct rte_mempool *mpool,
- const uint8_t *data, size_t len, uint8_t blocksize)
-{
- struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
- size_t t_len = len - (blocksize ? (len % blocksize) : 0);
-
- if (m) {
- char *dst = rte_pktmbuf_append(m, t_len);
-
- if (!dst) {
- rte_pktmbuf_free(m);
- return NULL;
- }
-
- rte_memcpy(dst, (const void *)data, t_len);
- }
- return m;
-}
-
-static struct crypto_testsuite_params testsuite_params = { NULL };
-static struct crypto_unittest_params unittest_params;
-static int gbl_driver_id;
-
-static int
-testsuite_setup(void)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_cryptodev_info info;
- unsigned i, nb_devs, valid_dev_id = 0;
- int ret;
- uint16_t qp_id;
-
- ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL");
- if (ts_params->mbuf_mp == NULL) {
- /* Not already created so create */
- ts_params->mbuf_mp = rte_pktmbuf_pool_create(
- "CRYPTO_PERF_MBUFPOOL",
- NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
- rte_socket_id());
- if (ts_params->mbuf_mp == NULL) {
- RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n");
- return TEST_FAILED;
- }
- }
-
-
- ts_params->op_mpool = rte_crypto_op_pool_create("CRYPTO_OP_POOL",
- RTE_CRYPTO_OP_TYPE_SYMMETRIC,
- NUM_MBUFS, MBUF_CACHE_SIZE,
- DEFAULT_NUM_XFORMS *
- sizeof(struct rte_crypto_sym_xform) +
- MAXIMUM_IV_LENGTH,
- rte_socket_id());
- if (ts_params->op_mpool == NULL) {
- RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
- return TEST_FAILED;
- }
-
- /* Create an AESNI MB device if required */
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) {
- nb_devs = rte_cryptodev_device_count_by_driver(
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
- if (nb_devs < 1) {
- ret = rte_vdev_init(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
-
- TEST_ASSERT(ret == 0,
- "Failed to create instance of pmd : %s",
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
- }
- }
-
- /* Create an AESNI GCM device if required */
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) {
- nb_devs = rte_cryptodev_device_count_by_driver(
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)));
- if (nb_devs < 1) {
- ret = rte_vdev_init(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL);
-
- TEST_ASSERT(ret == 0,
- "Failed to create instance of pmd : %s",
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
- }
- }
-
- /* Create a SNOW3G device if required */
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) {
- nb_devs = rte_cryptodev_device_count_by_driver(
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
- if (nb_devs < 1) {
- ret = rte_vdev_init(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL);
-
- TEST_ASSERT(ret == 0,
- "Failed to create instance of pmd : %s",
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
- }
- }
-
- /* Create an OPENSSL device if required */
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) {
- nb_devs = rte_cryptodev_device_count_by_driver(
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
- if (nb_devs < 1) {
- ret = rte_vdev_init(
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
- NULL);
-
- TEST_ASSERT(ret == 0, "Failed to create "
- "instance of pmd : %s",
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
- }
- }
-
- /* Create an ARMv8 device if required */
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) {
- nb_devs = rte_cryptodev_device_count_by_driver(
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
- if (nb_devs < 1) {
- ret = rte_vdev_init(
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
- NULL);
-
- TEST_ASSERT(ret == 0, "Failed to create "
- "instance of pmd : %s",
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
- }
- }
-
- nb_devs = rte_cryptodev_count();
- if (nb_devs < 1) {
- RTE_LOG(ERR, USER1, "No crypto devices found?\n");
- return TEST_FAILED;
- }
-
- /* Search for the first valid */
- for (i = 0; i < nb_devs; i++) {
- rte_cryptodev_info_get(i, &info);
- if (info.driver_id == (uint8_t) gbl_driver_id) {
- ts_params->dev_id = i;
- valid_dev_id = 1;
- break;
- }
- }
-
- if (!valid_dev_id)
- return TEST_FAILED;
-
- /*
- * Using Crypto Device Id 0 by default.
- * Set up all the qps on this device
- */
-
- rte_cryptodev_info_get(ts_params->dev_id, &info);
-
- ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
- ts_params->conf.socket_id = SOCKET_ID_ANY;
-
- unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) +
- rte_cryptodev_get_private_session_size(ts_params->dev_id);
-
- ts_params->sess_mp = rte_mempool_create(
- "test_sess_mp_perf",
- info.sym.max_nb_sessions,
- session_size,
- 0, 0, NULL, NULL, NULL,
- NULL, SOCKET_ID_ANY,
- 0);
-
- TEST_ASSERT_NOT_NULL(ts_params->sess_mp,
- "session mempool allocation failed");
-
- TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
- &ts_params->conf),
- "Failed to configure cryptodev %u",
- ts_params->dev_id);
-
- ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT;
- for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
-
- TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
- ts_params->dev_id, qp_id,
- &ts_params->qp_conf,
- rte_cryptodev_socket_id(ts_params->dev_id),
- ts_params->sess_mp),
- "Failed to setup queue pair %u on cryptodev %u",
- qp_id, ts_params->dev_id);
- }
-
- return TEST_SUCCESS;
-}
-static void
-testsuite_teardown(void)
-{
- struct crypto_testsuite_params *ts_params =
- &testsuite_params;
-
- if (ts_params->mbuf_mp != NULL)
- RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
- rte_mempool_avail_count(ts_params->mbuf_mp));
- if (ts_params->op_mpool != NULL)
- RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n",
- rte_mempool_avail_count(ts_params->op_mpool));
- /* Free session mempool */
- if (ts_params->sess_mp != NULL) {
- rte_mempool_free(ts_params->sess_mp);
- ts_params->sess_mp = NULL;
- }
-
-}
-
-static int
-ut_setup(void)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
-
- /* Clear unit test parameters before running test */
- memset(ut_params, 0, sizeof(*ut_params));
-
- rte_cryptodev_stats_reset(ts_params->dev_id);
-
- /* Start the device */
- TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->dev_id),
- "Failed to start cryptodev %u",
- ts_params->dev_id);
-
- return TEST_SUCCESS;
-}
-
-static void
-ut_teardown(void)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- struct rte_cryptodev_stats stats;
-
- unsigned i;
-
- /* free crypto session structure */
- if (ut_params->sess) {
- rte_cryptodev_sym_session_clear(ts_params->dev_id,
- ut_params->sess);
- rte_cryptodev_sym_session_free(ut_params->sess);
- }
-
- /* free crypto operation structure */
- if (ut_params->op)
- rte_crypto_op_free(ut_params->op);
-
- for (i = 0; i < MAX_NUM_OF_OPS_PER_UT; i++) {
- if (ut_params->obuf[i])
- rte_pktmbuf_free(ut_params->obuf[i]);
- else if (ut_params->ibuf[i])
- rte_pktmbuf_free(ut_params->ibuf[i]);
- }
-
- if (ts_params->mbuf_mp != NULL)
- RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
- rte_mempool_avail_count(ts_params->mbuf_mp));
-
- rte_cryptodev_stats_get(ts_params->dev_id, &stats);
-
- /* Stop the device */
- rte_cryptodev_stop(ts_params->dev_id);
-}
-
-const char plaintext_quote[] =
- "THE COUNT OF MONTE CRISTO by Alexandre Dumas, Pere Chapter 1. "
- "Marseilles--The Arrival. On the 24th of February, 1815, the "
- "look-out at Notre-Dame de la Garde signalled the three-master,"
- " the Pharaon from Smyrna, Trieste, and Naples. As usual, a "
- "pilot put off immediately, and rounding the Chateau d'If, got "
- "on board the vessel between Cape Morgion and Rion island. "
- "Immediately, and according to custom, the ramparts of Fort "
- "Saint-Jean were covered with spectators; it is always an event "
- "at Marseilles for a ship to come into port, especially when "
- "this ship, like the Pharaon, has been built, rigged, and laden"
- " at the old Phocee docks, and belongs to an owner of the city."
- " The ship drew on and had safely passed the strait, which some"
- " volcanic shock has made between the Calasareigne and Jaros "
- "islands; had doubled Pomegue, and approached the harbor under"
- " topsails, jib, and spanker, but so slowly and sedately that"
- " the idlers, with that instinct which is the forerunner of "
- "evil, asked one another what misfortune could have happened "
- "on board. However, those experienced in navigation saw plainly"
- " that if any accident had occurred, it was not to the vessel "
- "herself, for she bore down with all the evidence of being "
- "skilfully handled, the anchor a-cockbill, the jib-boom guys "
- "already eased off, and standing by the side of the pilot, who"
- " was steering the Pharaon towards the narrow entrance of the"
- " inner port, was a young man, who, with activity and vigilant"
- " eye, watched every motion of the ship, and repeated each "
- "direction of the pilot. The vague disquietude which prevailed "
- "among the spectators had so much affected one of the crowd "
- "that he did not await the arrival of the vessel in harbor, but"
- " jumping into a small skiff, desired to be pulled alongside "
- "the Pharaon, which he reached as she rounded into La Reserve "
- "basin. When the young man on board saw this person approach, "
- "he left his station by the pilot, and, hat in hand, leaned "
- "over the ship's bulwarks. He was a fine, tall, slim young "
- "fellow of eighteen or twenty, with black eyes, and hair as "
- "dark as a raven's wing; and his whole appearance bespoke that "
- "calmness and resolution peculiar to men accustomed from their "
- "cradle to contend with danger. \"Ah, is it you, Dantes?\" "
- "cried the man in the skiff. \"What's the matter? and why have "
- "you such an air of sadness aboard?\" \"A great misfortune, M. "
- "Morrel,\" replied the young man,--\"a great misfortune, for me"
- " especially! Off Civita Vecchia we lost our brave Captain "
- "Leclere.\" \"And the cargo?\" inquired the owner, eagerly. "
- "\"Is all safe, M. Morrel; and I think you will be satisfied on"
- " that head. But poor Captain Leclere--\" \"What happened to "
- "him?\" asked the owner, with an air of considerable "
- "resignation. \"What happened to the worthy captain?\" \"He "
- "died.\" \"Fell into the sea?\" \"No, sir, he died of "
- "brain-fever in dreadful agony.\" Then turning to the crew, "
- "he said, \"Bear a hand there, to take in sail!\" All hands "
- "obeyed, and at once the eight or ten seamen who composed the "
- "crew, sprang to their respective stations at the spanker "
- "brails and outhaul, topsail sheets and halyards, the jib "
- "downhaul, and the topsail clewlines and buntlines. The young "
- "sailor gave a look to see that his orders were promptly and "
- "accurately obeyed, and then turned again to the owner. \"And "
- "how did this misfortune occur?\" inquired the latter, resuming"
- " the interrupted conversation. \"Alas, sir, in the most "
- "unexpected manner. After a long talk with the harbor-master, "
- "Captain Leclere left Naples greatly disturbed in mind. In "
- "twenty-four hours he was attacked by a fever, and died three "
- "days afterwards. We performed the usual burial service, and he"
- " is at his rest, sewn up in his hammock with a thirty-six "
- "pound shot at his head and his heels, off El Giglio island. "
- "We bring to his widow his sword and cross of honor. It was "
- "worth while, truly,\" added the young man with a melancholy "
- "smile, \"to make war against the English for ten years, and "
- "to die in his bed at last, like everybody else.";
-
-#define QUOTE_LEN_64B (64)
-#define QUOTE_LEN_128B (128)
-#define QUOTE_LEN_256B (256)
-#define QUOTE_LEN_512B (512)
-#define QUOTE_LEN_768B (768)
-#define QUOTE_LEN_1024B (1024)
-#define QUOTE_LEN_1280B (1280)
-#define QUOTE_LEN_1536B (1536)
-#define QUOTE_LEN_1792B (1792)
-#define QUOTE_LEN_2048B (2048)
-
-
-/* ***** AES-CBC / HMAC-SHA256 Performance Tests ***** */
-
-#define HMAC_KEY_LENGTH_SHA256 (DIGEST_BYTE_LENGTH_SHA256)
-
-#define CIPHER_KEY_LENGTH_AES_CBC (16)
-#define CIPHER_IV_LENGTH_AES_CBC (CIPHER_KEY_LENGTH_AES_CBC)
-
-static uint8_t aes_cbc_128_key[] = {
- 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
- 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA };
-
-static uint8_t aes_cbc_128_iv[] = {
- 0xf5, 0xd3, 0x89, 0x0f, 0x47, 0x00, 0xcb, 0x52,
- 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1 };
-
-static uint8_t hmac_sha256_key[] = {
- 0xff, 0xcb, 0x37, 0x30, 0x1d, 0x4a, 0xc2, 0x41,
- 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A,
- 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76,
- 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 };
-
-
-/* Cipher text output */
-
-static const uint8_t AES_CBC_ciphertext_64B[] = {
- 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50,
- 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0,
- 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36,
- 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e,
- 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c,
- 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e,
- 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6,
- 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c
-};
-
-static const uint8_t AES_CBC_ciphertext_128B[] = {
- 0x79, 0x92, 0x65, 0xc8, 0xfb, 0x0a, 0xc7, 0xc4,
- 0x9b, 0x3b, 0xbe, 0x69, 0x7f, 0x7c, 0xf4, 0x4e,
- 0xa5, 0x0d, 0xf6, 0x33, 0xc4, 0xdf, 0xf3, 0x0d,
- 0xdb, 0xb9, 0x68, 0x34, 0xb0, 0x0d, 0xbd, 0xb9,
- 0xa7, 0xf3, 0x86, 0x50, 0x2a, 0xbe, 0x50, 0x5d,
- 0xb3, 0xbe, 0x72, 0xf9, 0x02, 0xb1, 0x69, 0x0b,
- 0x8c, 0x96, 0x4c, 0x3c, 0x0c, 0x1e, 0x76, 0xe5,
- 0x7e, 0x75, 0xdd, 0xd0, 0xa9, 0x75, 0x00, 0x13,
- 0x6b, 0x1e, 0xc0, 0xad, 0xfc, 0x03, 0xb5, 0x99,
- 0xdc, 0x37, 0x35, 0xfc, 0x16, 0x34, 0xfd, 0xb4,
- 0xea, 0x1e, 0xb6, 0x51, 0xdf, 0xab, 0x87, 0xd6,
- 0x87, 0x41, 0xfa, 0x1c, 0xc6, 0x78, 0xa6, 0x3c,
- 0x1d, 0x76, 0xfe, 0xff, 0x65, 0xfc, 0x63, 0x1e,
- 0x1f, 0xe2, 0x7c, 0x9b, 0xa2, 0x72, 0xc3, 0x34,
- 0x23, 0xdf, 0x01, 0xf0, 0xfd, 0x02, 0x8b, 0x97,
- 0x00, 0x2b, 0x97, 0x4e, 0xab, 0x98, 0x21, 0x3c
-};
-
-static const uint8_t AES_CBC_ciphertext_256B[] = {
- 0xc7, 0x71, 0x2b, 0xed, 0x2c, 0x97, 0x59, 0xfa,
- 0xcf, 0x5a, 0xb9, 0x31, 0x92, 0xe0, 0xc9, 0x92,
- 0xc0, 0x2d, 0xd5, 0x9c, 0x84, 0xbf, 0x70, 0x36,
- 0x13, 0x48, 0xe0, 0xb1, 0xbf, 0x6c, 0xcd, 0x91,
- 0xa0, 0xc3, 0x57, 0x6c, 0x3f, 0x0e, 0x34, 0x41,
- 0xe7, 0x9c, 0xc0, 0xec, 0x18, 0x0c, 0x05, 0x52,
- 0x78, 0xe2, 0x3c, 0x6e, 0xdf, 0xa5, 0x49, 0xc7,
- 0xf2, 0x55, 0x00, 0x8f, 0x65, 0x6d, 0x4b, 0xd0,
- 0xcb, 0xd4, 0xd2, 0x0b, 0xea, 0xf4, 0xb0, 0x85,
- 0x61, 0x9e, 0x36, 0xc0, 0x71, 0xb7, 0x80, 0xad,
- 0x40, 0x78, 0xb4, 0x70, 0x2b, 0xe8, 0x80, 0xc5,
- 0x19, 0x35, 0x96, 0x55, 0x3b, 0x40, 0x03, 0xbb,
- 0x9f, 0xa6, 0xc2, 0x82, 0x92, 0x04, 0xc3, 0xa6,
- 0x96, 0xc4, 0x7f, 0x4c, 0x3e, 0x3c, 0x79, 0x82,
- 0x88, 0x8b, 0x3f, 0x8b, 0xc5, 0x9f, 0x44, 0xbe,
- 0x71, 0xe7, 0x09, 0xa2, 0x40, 0xa2, 0x23, 0x4e,
- 0x9f, 0x31, 0xab, 0x6f, 0xdf, 0x59, 0x40, 0xe1,
- 0x12, 0x15, 0x55, 0x4b, 0xea, 0x3f, 0xa1, 0x41,
- 0x4f, 0xaf, 0xcd, 0x27, 0x2a, 0x61, 0xa1, 0x9e,
- 0x82, 0x30, 0x05, 0x05, 0x55, 0xce, 0x99, 0xd3,
- 0x8f, 0x3f, 0x86, 0x79, 0xdc, 0x9f, 0x33, 0x07,
- 0x75, 0x26, 0xc8, 0x72, 0x81, 0x0f, 0x9b, 0xf7,
- 0xb1, 0xfb, 0xd3, 0x91, 0x36, 0x08, 0xab, 0x26,
- 0x70, 0x53, 0x0c, 0x99, 0xfd, 0xa9, 0x07, 0xb4,
- 0xe9, 0xce, 0xc1, 0xd6, 0xd2, 0x2c, 0x71, 0x80,
- 0xec, 0x59, 0x61, 0x0b, 0x24, 0xf0, 0x6d, 0x33,
- 0x73, 0x45, 0x6e, 0x80, 0x03, 0x45, 0xf2, 0x76,
- 0xa5, 0x8a, 0xc9, 0xcf, 0xaf, 0x4a, 0xed, 0x35,
- 0xc0, 0x97, 0x52, 0xc5, 0x00, 0xdf, 0xef, 0xc7,
- 0x9f, 0xf2, 0xe8, 0x15, 0x3e, 0xb3, 0x30, 0xe7,
- 0x00, 0xd0, 0x4e, 0xeb, 0x79, 0xf6, 0xf6, 0xcf,
- 0xf0, 0xe7, 0x61, 0xd5, 0x3d, 0x6a, 0x73, 0x9d
-};
-
-static const uint8_t AES_CBC_ciphertext_512B[] = {
- 0xb4, 0xc6, 0xc6, 0x5f, 0x7e, 0xca, 0x05, 0x70,
- 0x21, 0x7b, 0x92, 0x9e, 0x23, 0xe7, 0x92, 0xb8,
- 0x27, 0x3d, 0x20, 0x29, 0x57, 0xfa, 0x1f, 0x26,
- 0x0a, 0x04, 0x34, 0xa6, 0xf2, 0xdc, 0x44, 0xb6,
- 0x43, 0x40, 0x62, 0xde, 0x0c, 0xde, 0x1c, 0x30,
- 0x43, 0x85, 0x0b, 0xe8, 0x93, 0x1f, 0xa1, 0x2a,
- 0x8a, 0x27, 0x35, 0x39, 0x14, 0x9f, 0x37, 0x64,
- 0x59, 0xb5, 0x0e, 0x96, 0x82, 0x5d, 0x63, 0x45,
- 0xd6, 0x93, 0x89, 0x46, 0xe4, 0x71, 0x31, 0xeb,
- 0x0e, 0xd1, 0x7b, 0xda, 0x90, 0xb5, 0x81, 0xac,
- 0x76, 0x54, 0x54, 0x85, 0x0b, 0xa9, 0x46, 0x9c,
- 0xf0, 0xfd, 0xde, 0x5d, 0xa8, 0xe3, 0xee, 0xe9,
- 0xf4, 0x9d, 0x34, 0x76, 0x39, 0xe7, 0xc3, 0x4a,
- 0x84, 0x38, 0x92, 0x61, 0xf1, 0x12, 0x9f, 0x05,
- 0xda, 0xdb, 0xc1, 0xd4, 0xb0, 0xa0, 0x27, 0x19,
- 0xa0, 0x56, 0x5d, 0x9b, 0xcc, 0x47, 0x7c, 0x15,
- 0x1d, 0x52, 0x66, 0xd5, 0xff, 0xef, 0x12, 0x23,
- 0x86, 0xe2, 0xee, 0x81, 0x2c, 0x3d, 0x7d, 0x28,
- 0xd5, 0x42, 0xdf, 0xdb, 0x75, 0x1c, 0xeb, 0xdf,
- 0x13, 0x23, 0xd5, 0x17, 0x89, 0xea, 0xd7, 0x01,
- 0xff, 0x57, 0x6a, 0x44, 0x61, 0xf4, 0xea, 0xbe,
- 0x97, 0x9b, 0xc2, 0xb1, 0x9c, 0x5d, 0xff, 0x4f,
- 0x73, 0x2d, 0x3f, 0x57, 0x28, 0x38, 0xbf, 0x3d,
- 0x9f, 0xda, 0x49, 0x55, 0x8f, 0xb2, 0x77, 0xec,
- 0x0f, 0xbc, 0xce, 0xb8, 0xc6, 0xe1, 0x03, 0xed,
- 0x35, 0x9c, 0xf2, 0x4d, 0xa4, 0x29, 0x6c, 0xd6,
- 0x6e, 0x05, 0x53, 0x46, 0xc1, 0x41, 0x09, 0x36,
- 0x0b, 0x7d, 0xf4, 0x9e, 0x0f, 0xba, 0x86, 0x33,
- 0xdd, 0xf1, 0xa7, 0xf7, 0xd5, 0x29, 0xa8, 0xa7,
- 0x4d, 0xce, 0x0c, 0xf5, 0xb4, 0x6c, 0xd8, 0x27,
- 0xb0, 0x87, 0x2a, 0x6f, 0x7f, 0x3f, 0x8f, 0xc3,
- 0xe2, 0x3e, 0x94, 0xcf, 0x61, 0x4a, 0x09, 0x3d,
- 0xf9, 0x55, 0x19, 0x31, 0xf2, 0xd2, 0x4a, 0x3e,
- 0xc1, 0xf5, 0xed, 0x7c, 0x45, 0xb0, 0x0c, 0x7b,
- 0xdd, 0xa6, 0x0a, 0x26, 0x66, 0xec, 0x85, 0x49,
- 0x00, 0x38, 0x05, 0x7c, 0x9c, 0x1c, 0x92, 0xf5,
- 0xf7, 0xdb, 0x5d, 0xbd, 0x61, 0x0c, 0xc9, 0xaf,
- 0xfd, 0x57, 0x3f, 0xee, 0x2b, 0xad, 0x73, 0xef,
- 0xa3, 0xc1, 0x66, 0x26, 0x44, 0x5e, 0xf9, 0x12,
- 0x86, 0x66, 0xa9, 0x61, 0x75, 0xa1, 0xbc, 0x40,
- 0x7f, 0xa8, 0x08, 0x02, 0xc0, 0x76, 0x0e, 0x76,
- 0xb3, 0x26, 0x3d, 0x1c, 0x40, 0x65, 0xe4, 0x18,
- 0x0f, 0x62, 0x17, 0x8f, 0x1e, 0x61, 0xb8, 0x08,
- 0x83, 0x54, 0x42, 0x11, 0x03, 0x30, 0x8e, 0xb7,
- 0xc1, 0x9c, 0xec, 0x69, 0x52, 0x95, 0xfb, 0x7b,
- 0x1a, 0x0c, 0x20, 0x24, 0xf7, 0xb8, 0x38, 0x0c,
- 0xb8, 0x7b, 0xb6, 0x69, 0x70, 0xd0, 0x61, 0xb9,
- 0x70, 0x06, 0xc2, 0x5b, 0x20, 0x47, 0xf7, 0xd9,
- 0x32, 0xc2, 0xf2, 0x90, 0xb6, 0x4d, 0xcd, 0x3c,
- 0x6d, 0x74, 0xea, 0x82, 0x35, 0x1b, 0x08, 0x44,
- 0xba, 0xb7, 0x33, 0x82, 0x33, 0x27, 0x54, 0x77,
- 0x6e, 0x58, 0xfe, 0x46, 0x5a, 0xb4, 0x88, 0x53,
- 0x8d, 0x9b, 0xb1, 0xab, 0xdf, 0x04, 0xe1, 0xfb,
- 0xd7, 0x1e, 0xd7, 0x38, 0x64, 0x54, 0xba, 0xb0,
- 0x6c, 0x84, 0x7a, 0x0f, 0xa7, 0x80, 0x6b, 0x86,
- 0xd9, 0xc9, 0xc6, 0x31, 0x95, 0xfa, 0x8a, 0x2c,
- 0x14, 0xe1, 0x85, 0x66, 0x27, 0xfd, 0x63, 0x3e,
- 0xf0, 0xfa, 0x81, 0xc9, 0x89, 0x4f, 0xe2, 0x6a,
- 0x8c, 0x17, 0xb5, 0xc7, 0x9f, 0x5d, 0x3f, 0x6b,
- 0x3f, 0xcd, 0x13, 0x7a, 0x3c, 0xe6, 0x4e, 0xfa,
- 0x7a, 0x10, 0xb8, 0x7c, 0x40, 0xec, 0x93, 0x11,
- 0x1f, 0xd0, 0x9e, 0xc3, 0x56, 0xb9, 0xf5, 0x21,
- 0x18, 0x41, 0x31, 0xea, 0x01, 0x8d, 0xea, 0x1c,
- 0x95, 0x5e, 0x56, 0x33, 0xbc, 0x7a, 0x3f, 0x6f
-};
-
-static const uint8_t AES_CBC_ciphertext_768B[] = {
- 0x3e, 0x7f, 0x9e, 0x4c, 0x88, 0x15, 0x68, 0x69,
- 0x10, 0x09, 0xe1, 0xa7, 0x0f, 0x27, 0x88, 0x2d,
- 0x90, 0x73, 0x4f, 0x67, 0xd3, 0x8b, 0xaf, 0xa1,
- 0x2c, 0x37, 0xa5, 0x6c, 0x7c, 0xbd, 0x95, 0x4c,
- 0x82, 0xcf, 0x05, 0x49, 0x16, 0x5c, 0xe7, 0x06,
- 0xd4, 0xcb, 0x55, 0x65, 0x9a, 0xd0, 0xe1, 0x46,
- 0x3a, 0x37, 0x71, 0xad, 0xb0, 0xb4, 0x99, 0x1e,
- 0x23, 0x57, 0x48, 0x96, 0x9c, 0xc5, 0xc4, 0xdb,
- 0x64, 0x3e, 0xc9, 0x7f, 0x90, 0x5a, 0xa0, 0x08,
- 0x75, 0x4c, 0x09, 0x06, 0x31, 0x6e, 0x59, 0x29,
- 0xfc, 0x2f, 0x72, 0xde, 0xf2, 0x40, 0x5a, 0xfe,
- 0xd3, 0x66, 0x64, 0xb8, 0x9c, 0xc9, 0xa6, 0x1f,
- 0xc3, 0x52, 0xcd, 0xb5, 0xd1, 0x4f, 0x43, 0x3f,
- 0xf4, 0x59, 0x25, 0xc4, 0xdd, 0x3e, 0x58, 0x7c,
- 0x21, 0xd6, 0x21, 0xce, 0xa4, 0xbe, 0x08, 0x23,
- 0x46, 0x68, 0xc0, 0x00, 0x91, 0x47, 0xca, 0x9b,
- 0xe0, 0xb4, 0xe3, 0xab, 0xbf, 0xcf, 0x68, 0x26,
- 0x97, 0x23, 0x09, 0x93, 0x64, 0x8f, 0x57, 0x59,
- 0xe2, 0x41, 0x7c, 0xa2, 0x48, 0x7e, 0xd5, 0x2c,
- 0x54, 0x09, 0x1b, 0x07, 0x94, 0xca, 0x39, 0x83,
- 0xdd, 0xf4, 0x7a, 0x1d, 0x2d, 0xdd, 0x67, 0xf7,
- 0x3c, 0x30, 0x89, 0x3e, 0xc1, 0xdc, 0x1d, 0x8f,
- 0xfc, 0xb1, 0xe9, 0x13, 0x31, 0xb0, 0x16, 0xdb,
- 0x88, 0xf2, 0x32, 0x7e, 0x73, 0xa3, 0xdf, 0x08,
- 0x6b, 0x53, 0x92, 0x08, 0xc9, 0x9d, 0x98, 0xb2,
- 0xf4, 0x8c, 0xb1, 0x95, 0xdc, 0xb6, 0xfc, 0xec,
- 0xf1, 0xc9, 0x0d, 0x6d, 0x42, 0x2c, 0xf5, 0x38,
- 0x29, 0xf4, 0xd8, 0x98, 0x0f, 0xb0, 0x81, 0xa5,
- 0xaa, 0xe6, 0x1f, 0x6e, 0x87, 0x32, 0x1b, 0x02,
- 0x07, 0x57, 0x38, 0x83, 0xf3, 0xe4, 0x54, 0x7c,
- 0xa8, 0x43, 0xdf, 0x3f, 0x42, 0xfd, 0x67, 0x28,
- 0x06, 0x4d, 0xea, 0xce, 0x1f, 0x84, 0x4a, 0xcd,
- 0x8c, 0x61, 0x5e, 0x8f, 0x61, 0xed, 0x84, 0x03,
- 0x53, 0x6a, 0x9e, 0xbf, 0x68, 0x83, 0xa7, 0x42,
- 0x56, 0x57, 0xcd, 0x45, 0x29, 0xfc, 0x7b, 0x07,
- 0xfc, 0xe9, 0xb9, 0x42, 0xfd, 0x29, 0xd5, 0xfd,
- 0x98, 0x11, 0xd1, 0x8d, 0x67, 0x29, 0x47, 0x61,
- 0xd8, 0x27, 0x37, 0x79, 0x29, 0xd1, 0x94, 0x6f,
- 0x8d, 0xf3, 0x1b, 0x3d, 0x6a, 0xb1, 0x59, 0xef,
- 0x1b, 0xd4, 0x70, 0x0e, 0xac, 0xab, 0xa0, 0x2b,
- 0x1f, 0x5e, 0x04, 0xf0, 0x0e, 0x35, 0x72, 0x90,
- 0xfc, 0xcf, 0x86, 0x43, 0xea, 0x45, 0x6d, 0x22,
- 0x63, 0x06, 0x1a, 0x58, 0xd7, 0x2d, 0xc5, 0xb0,
- 0x60, 0x69, 0xe8, 0x53, 0xc2, 0xa2, 0x57, 0x83,
- 0xc4, 0x31, 0xb4, 0xc6, 0xb3, 0xa1, 0x77, 0xb3,
- 0x1c, 0xca, 0x89, 0x3f, 0xf5, 0x10, 0x3b, 0x36,
- 0x31, 0x7d, 0x00, 0x46, 0x00, 0x92, 0xa0, 0xa0,
- 0x34, 0xd8, 0x5e, 0x62, 0xa9, 0xe0, 0x23, 0x37,
- 0x50, 0x85, 0xc7, 0x3a, 0x20, 0xa3, 0x98, 0xc0,
- 0xac, 0x20, 0x06, 0x0f, 0x17, 0x3c, 0xfc, 0x43,
- 0x8c, 0x9d, 0xec, 0xf5, 0x9a, 0x35, 0x96, 0xf7,
- 0xb7, 0x4c, 0xf9, 0x69, 0xf8, 0xd4, 0x1e, 0x9e,
- 0xf9, 0x7c, 0xc4, 0xd2, 0x11, 0x14, 0x41, 0xb9,
- 0x89, 0xd6, 0x07, 0xd2, 0x37, 0x07, 0x5e, 0x5e,
- 0xae, 0x60, 0xdc, 0xe4, 0xeb, 0x38, 0x48, 0x6d,
- 0x95, 0x8d, 0x71, 0xf2, 0xba, 0xda, 0x5f, 0x08,
- 0x9d, 0x4a, 0x0f, 0x56, 0x90, 0x64, 0xab, 0xb6,
- 0x88, 0x22, 0xa8, 0x90, 0x1f, 0x76, 0x2c, 0x83,
- 0x43, 0xce, 0x32, 0x55, 0x45, 0x84, 0x57, 0x43,
- 0xf9, 0xa8, 0xd1, 0x4f, 0xe3, 0xc1, 0x72, 0x9c,
- 0xeb, 0x64, 0xf7, 0xe4, 0x61, 0x2b, 0x93, 0xd1,
- 0x1f, 0xbb, 0x5c, 0xff, 0xa1, 0x59, 0x69, 0xcf,
- 0xf7, 0xaf, 0x58, 0x45, 0xd5, 0x3e, 0x98, 0x7d,
- 0x26, 0x39, 0x5c, 0x75, 0x3c, 0x4a, 0xbf, 0x5e,
- 0x12, 0x10, 0xb0, 0x93, 0x0f, 0x86, 0x82, 0xcf,
- 0xb2, 0xec, 0x70, 0x5c, 0x0b, 0xad, 0x5d, 0x63,
- 0x65, 0x32, 0xa6, 0x04, 0x58, 0x03, 0x91, 0x2b,
- 0xdb, 0x8f, 0xd3, 0xa3, 0x2b, 0x3a, 0xf5, 0xa1,
- 0x62, 0x6c, 0xb6, 0xf0, 0x13, 0x3b, 0x8c, 0x07,
- 0x10, 0x82, 0xc9, 0x56, 0x24, 0x87, 0xfc, 0x56,
- 0xe8, 0xef, 0x90, 0x8b, 0xd6, 0x48, 0xda, 0x53,
- 0x04, 0x49, 0x41, 0xa4, 0x67, 0xe0, 0x33, 0x24,
- 0x6b, 0x9c, 0x07, 0x55, 0x4c, 0x5d, 0xe9, 0x35,
- 0xfa, 0xbd, 0xea, 0xa8, 0x3f, 0xe9, 0xf5, 0x20,
- 0x5c, 0x60, 0x0f, 0x0d, 0x24, 0xcb, 0x1a, 0xd6,
- 0xe8, 0x5c, 0xa8, 0x42, 0xae, 0xd0, 0xd2, 0xf2,
- 0xa8, 0xbe, 0xea, 0x0f, 0x8d, 0xfb, 0x81, 0xa3,
- 0xa4, 0xef, 0xb7, 0x3e, 0x91, 0xbd, 0x26, 0x0f,
- 0x8e, 0xf1, 0xb2, 0xa5, 0x47, 0x06, 0xfa, 0x40,
- 0x8b, 0x31, 0x7a, 0x5a, 0x74, 0x2a, 0x0a, 0x7c,
- 0x62, 0x5d, 0x39, 0xa4, 0xae, 0x14, 0x85, 0x08,
- 0x5b, 0x20, 0x85, 0xf1, 0x57, 0x6e, 0x71, 0x13,
- 0x4e, 0x2b, 0x49, 0x87, 0x01, 0xdf, 0x37, 0xed,
- 0x28, 0xee, 0x4d, 0xa1, 0xf4, 0xb3, 0x3b, 0xba,
- 0x2d, 0xb3, 0x46, 0x17, 0x84, 0x80, 0x9d, 0xd7,
- 0x93, 0x1f, 0x28, 0x7c, 0xf5, 0xf9, 0xd6, 0x85,
- 0x8c, 0xa5, 0x44, 0xe9, 0x2c, 0x65, 0x51, 0x5f,
- 0x53, 0x7a, 0x09, 0xd9, 0x30, 0x16, 0x95, 0x89,
- 0x9c, 0x0b, 0xef, 0x90, 0x6d, 0x23, 0xd3, 0x48,
- 0x57, 0x3b, 0x55, 0x69, 0x96, 0xfc, 0xf7, 0x52,
- 0x92, 0x38, 0x36, 0xbf, 0xa9, 0x0a, 0xbb, 0x68,
- 0x45, 0x08, 0x25, 0xee, 0x59, 0xfe, 0xee, 0xf2,
- 0x2c, 0xd4, 0x5f, 0x78, 0x59, 0x0d, 0x90, 0xf1,
- 0xd7, 0xe4, 0x39, 0x0e, 0x46, 0x36, 0xf5, 0x75,
- 0x03, 0x3c, 0x28, 0xfb, 0xfa, 0x8f, 0xef, 0xc9,
- 0x61, 0x00, 0x94, 0xc3, 0xd2, 0x0f, 0xd9, 0xda
-};
-
-static const uint8_t AES_CBC_ciphertext_1024B[] = {
- 0x7d, 0x01, 0x7e, 0x2f, 0x92, 0xb3, 0xea, 0x72,
- 0x4a, 0x3f, 0x10, 0xf9, 0x2b, 0xb0, 0xd5, 0xb9,
- 0x19, 0x68, 0x94, 0xe9, 0x93, 0xe9, 0xd5, 0x26,
- 0x20, 0x44, 0xe2, 0x47, 0x15, 0x8d, 0x75, 0x48,
- 0x8e, 0xe4, 0x40, 0x81, 0xb5, 0x06, 0xa8, 0xb8,
- 0x0e, 0x0f, 0x3b, 0xbc, 0x5b, 0xbe, 0x3b, 0xa2,
- 0x2a, 0x0c, 0x48, 0x98, 0x19, 0xdf, 0xe9, 0x25,
- 0x75, 0xab, 0x93, 0x44, 0xb1, 0x72, 0x70, 0xbb,
- 0x20, 0xcf, 0x78, 0xe9, 0x4d, 0xc6, 0xa9, 0xa9,
- 0x84, 0x78, 0xc5, 0xc0, 0xc4, 0xc9, 0x79, 0x1a,
- 0xbc, 0x61, 0x25, 0x5f, 0xac, 0x01, 0x03, 0xb7,
- 0xef, 0x07, 0xf2, 0x62, 0x98, 0xee, 0xe3, 0xad,
- 0x94, 0x75, 0x30, 0x67, 0xb9, 0x15, 0x00, 0xe7,
- 0x11, 0x32, 0x2e, 0x6b, 0x55, 0x9f, 0xac, 0x68,
- 0xde, 0x61, 0x05, 0x80, 0x01, 0xf3, 0xad, 0xab,
- 0xaf, 0x45, 0xe0, 0xf4, 0x68, 0x5c, 0xc0, 0x52,
- 0x92, 0xc8, 0x21, 0xb6, 0xf5, 0x8a, 0x1d, 0xbb,
- 0xfc, 0x4a, 0x11, 0x62, 0xa2, 0xc4, 0xf1, 0x2d,
- 0x0e, 0xb2, 0xc7, 0x17, 0x34, 0xb4, 0x2a, 0x54,
- 0x81, 0xc2, 0x1e, 0xcf, 0x51, 0x0a, 0x76, 0x54,
- 0xf1, 0x48, 0x0d, 0x5c, 0xcd, 0x38, 0x3e, 0x38,
- 0x3e, 0xf8, 0x46, 0x1d, 0x00, 0xf5, 0x62, 0xe1,
- 0x5c, 0xb7, 0x8d, 0xce, 0xd0, 0x3f, 0xbb, 0x22,
- 0xf1, 0xe5, 0xb1, 0xa0, 0x58, 0x5e, 0x3c, 0x0f,
- 0x15, 0xd1, 0xac, 0x3e, 0xc7, 0x72, 0xc4, 0xde,
- 0x8b, 0x95, 0x3e, 0x91, 0xf7, 0x1d, 0x04, 0x9a,
- 0xc8, 0xe4, 0xbf, 0xd3, 0x22, 0xca, 0x4a, 0xdc,
- 0xb6, 0x16, 0x79, 0x81, 0x75, 0x2f, 0x6b, 0xa7,
- 0x04, 0x98, 0xa7, 0x4e, 0xc1, 0x19, 0x90, 0x33,
- 0x33, 0x3c, 0x7f, 0xdd, 0xac, 0x09, 0x0c, 0xc3,
- 0x91, 0x34, 0x74, 0xab, 0xa5, 0x35, 0x0a, 0x13,
- 0xc3, 0x56, 0x67, 0x6d, 0x1a, 0x3e, 0xbf, 0x56,
- 0x06, 0x67, 0x15, 0x5f, 0xfc, 0x8b, 0xa2, 0x3c,
- 0x5e, 0xaf, 0x56, 0x1f, 0xe3, 0x2e, 0x9d, 0x0a,
- 0xf9, 0x9b, 0xc7, 0xb5, 0x03, 0x1c, 0x68, 0x99,
- 0xfa, 0x3c, 0x37, 0x59, 0xc1, 0xf7, 0x6a, 0x83,
- 0x22, 0xee, 0xca, 0x7f, 0x7d, 0x49, 0xe6, 0x48,
- 0x84, 0x54, 0x7a, 0xff, 0xb3, 0x72, 0x21, 0xd8,
- 0x7a, 0x5d, 0xb1, 0x4b, 0xcc, 0x01, 0x6f, 0x90,
- 0xc6, 0x68, 0x1c, 0x2c, 0xa1, 0xe2, 0x74, 0x40,
- 0x26, 0x9b, 0x57, 0x53, 0xa3, 0x7c, 0x0b, 0x0d,
- 0xcf, 0x05, 0x5d, 0x62, 0x4f, 0x75, 0x06, 0x62,
- 0x1f, 0x26, 0x32, 0xaa, 0x25, 0xcc, 0x26, 0x8d,
- 0xae, 0x01, 0x47, 0xa3, 0x00, 0x42, 0xe2, 0x4c,
- 0xee, 0x29, 0xa2, 0x81, 0xa0, 0xfd, 0xeb, 0xff,
- 0x9a, 0x66, 0x6e, 0x47, 0x5b, 0xab, 0x93, 0x5a,
- 0x02, 0x6d, 0x6f, 0xf2, 0x6e, 0x02, 0x9d, 0xb1,
- 0xab, 0x56, 0xdc, 0x8b, 0x9b, 0x17, 0xa8, 0xfb,
- 0x87, 0x42, 0x7c, 0x91, 0x1e, 0x14, 0xc6, 0x6f,
- 0xdc, 0xf0, 0x27, 0x30, 0xfa, 0x3f, 0xc4, 0xad,
- 0x57, 0x85, 0xd2, 0xc9, 0x32, 0x2c, 0x13, 0xa6,
- 0x04, 0x04, 0x50, 0x05, 0x2f, 0x72, 0xd9, 0x44,
- 0x55, 0x6e, 0x93, 0x40, 0xed, 0x7e, 0xd4, 0x40,
- 0x3e, 0x88, 0x3b, 0x8b, 0xb6, 0xeb, 0xc6, 0x5d,
- 0x9c, 0x99, 0xa1, 0xcf, 0x30, 0xb2, 0xdc, 0x48,
- 0x8a, 0x01, 0xa7, 0x61, 0x77, 0x50, 0x14, 0xf3,
- 0x0c, 0x49, 0x53, 0xb3, 0xb4, 0xb4, 0x28, 0x41,
- 0x4a, 0x2d, 0xd2, 0x4d, 0x2a, 0x30, 0x31, 0x83,
- 0x03, 0x5e, 0xaa, 0xd3, 0xa3, 0xd1, 0xa1, 0xca,
- 0x62, 0xf0, 0xe1, 0xf2, 0xff, 0xf0, 0x19, 0xa6,
- 0xde, 0x22, 0x47, 0xb5, 0x28, 0x7d, 0xf7, 0x07,
- 0x16, 0x0d, 0xb1, 0x55, 0x81, 0x95, 0xe5, 0x1d,
- 0x4d, 0x78, 0xa9, 0x3e, 0xce, 0xe3, 0x1c, 0xf9,
- 0x47, 0xc8, 0xec, 0xc5, 0xc5, 0x93, 0x4c, 0x34,
- 0x20, 0x6b, 0xee, 0x9a, 0xe6, 0x86, 0x57, 0x58,
- 0xd5, 0x58, 0xf1, 0x33, 0x10, 0x29, 0x9e, 0x93,
- 0x2f, 0xf5, 0x90, 0x00, 0x17, 0x67, 0x4f, 0x39,
- 0x18, 0xe1, 0xcf, 0x55, 0x78, 0xbb, 0xe6, 0x29,
- 0x3e, 0x77, 0xd5, 0x48, 0xb7, 0x42, 0x72, 0x53,
- 0x27, 0xfa, 0x5b, 0xe0, 0x36, 0x14, 0x97, 0xb8,
- 0x9b, 0x3c, 0x09, 0x77, 0xc1, 0x0a, 0xe4, 0xa2,
- 0x63, 0xfc, 0xbe, 0x5c, 0x17, 0xcf, 0x01, 0xf5,
- 0x03, 0x0f, 0x17, 0xbc, 0x93, 0xdd, 0x5f, 0xe2,
- 0xf3, 0x08, 0xa8, 0xb1, 0x85, 0xb6, 0x34, 0x3f,
- 0x87, 0x42, 0xa5, 0x42, 0x3b, 0x0e, 0xd6, 0x83,
- 0x6a, 0xfd, 0x5d, 0xc9, 0x67, 0xd5, 0x51, 0xc9,
- 0x2a, 0x4e, 0x91, 0xb0, 0x59, 0xb2, 0x0f, 0xa2,
- 0xe6, 0x47, 0x73, 0xc2, 0xa2, 0xae, 0xbb, 0xc8,
- 0x42, 0xa3, 0x2a, 0x27, 0x29, 0x48, 0x8c, 0x54,
- 0x6c, 0xec, 0x00, 0x2a, 0x42, 0xa3, 0x7a, 0x0f,
- 0x12, 0x66, 0x6b, 0x96, 0xf6, 0xd0, 0x56, 0x4f,
- 0x49, 0x5c, 0x47, 0xec, 0x05, 0x62, 0x54, 0xb2,
- 0x64, 0x5a, 0x69, 0x1f, 0x19, 0xb4, 0x84, 0x5c,
- 0xbe, 0x48, 0x8e, 0xfc, 0x58, 0x21, 0xce, 0xfa,
- 0xaa, 0x84, 0xd2, 0xc1, 0x08, 0xb3, 0x87, 0x0f,
- 0x4f, 0xa3, 0x3a, 0xb6, 0x44, 0xbe, 0x2e, 0x9a,
- 0xdd, 0xb5, 0x44, 0x80, 0xca, 0xf4, 0xc3, 0x6e,
- 0xba, 0x93, 0x77, 0xe0, 0x53, 0xfb, 0x37, 0xfb,
- 0x88, 0xc3, 0x1f, 0x25, 0xde, 0x3e, 0x11, 0xf4,
- 0x89, 0xe7, 0xd1, 0x3b, 0xb4, 0x23, 0xcb, 0x70,
- 0xba, 0x35, 0x97, 0x7c, 0xbe, 0x84, 0x13, 0xcf,
- 0xe0, 0x4d, 0x33, 0x91, 0x71, 0x85, 0xbb, 0x4b,
- 0x97, 0x32, 0x5d, 0xa0, 0xb9, 0x8f, 0xdc, 0x27,
- 0x5a, 0xeb, 0x71, 0xf1, 0xd5, 0x0d, 0x65, 0xb4,
- 0x22, 0x81, 0xde, 0xa7, 0x58, 0x20, 0x0b, 0x18,
- 0x11, 0x76, 0x5c, 0xe6, 0x6a, 0x2c, 0x99, 0x69,
- 0xdc, 0xed, 0x67, 0x08, 0x5d, 0x5e, 0xe9, 0x1e,
- 0x55, 0x70, 0xc1, 0x5a, 0x76, 0x1b, 0x8d, 0x2e,
- 0x0d, 0xf9, 0xcc, 0x30, 0x8c, 0x44, 0x0f, 0x63,
- 0x8c, 0x42, 0x8a, 0x9f, 0x4c, 0xd1, 0x48, 0x28,
- 0x8a, 0xf5, 0x56, 0x2e, 0x23, 0x12, 0xfe, 0x67,
- 0x9a, 0x13, 0x65, 0x75, 0x83, 0xf1, 0x3c, 0x98,
- 0x07, 0x6b, 0xb7, 0x27, 0x5b, 0xf0, 0x70, 0xda,
- 0x30, 0xf8, 0x74, 0x4e, 0x7a, 0x32, 0x84, 0xcc,
- 0x0e, 0xcd, 0x80, 0x8b, 0x82, 0x31, 0x9a, 0x48,
- 0xcf, 0x75, 0x00, 0x1f, 0x4f, 0xe0, 0x8e, 0xa3,
- 0x6a, 0x2c, 0xd4, 0x73, 0x4c, 0x63, 0x7c, 0xa6,
- 0x4d, 0x5e, 0xfd, 0x43, 0x3b, 0x27, 0xe1, 0x5e,
- 0xa3, 0xa9, 0x5c, 0x3b, 0x60, 0xdd, 0xc6, 0x8d,
- 0x5a, 0xf1, 0x3e, 0x89, 0x4b, 0x24, 0xcf, 0x01,
- 0x3a, 0x2d, 0x44, 0xe7, 0xda, 0xe7, 0xa1, 0xac,
- 0x11, 0x05, 0x0c, 0xa9, 0x7a, 0x82, 0x8c, 0x5c,
- 0x29, 0x68, 0x9c, 0x73, 0x13, 0xcc, 0x67, 0x32,
- 0x11, 0x5e, 0xe5, 0xcc, 0x8c, 0xf5, 0xa7, 0x52,
- 0x83, 0x9a, 0x70, 0xef, 0xde, 0x55, 0x9c, 0xc7,
- 0x8a, 0xed, 0xad, 0x28, 0x4a, 0xc5, 0x92, 0x6d,
- 0x8e, 0x47, 0xca, 0xe3, 0xf8, 0x77, 0xb5, 0x26,
- 0x64, 0x84, 0xc2, 0xf1, 0xd7, 0xae, 0x0c, 0xb9,
- 0x39, 0x0f, 0x43, 0x6b, 0xe9, 0xe0, 0x09, 0x4b,
- 0xe5, 0xe3, 0x17, 0xa6, 0x68, 0x69, 0x46, 0xf4,
- 0xf0, 0x68, 0x7f, 0x2f, 0x1c, 0x7e, 0x4c, 0xd2,
- 0xb5, 0xc6, 0x16, 0x85, 0xcf, 0x02, 0x4c, 0x89,
- 0x0b, 0x25, 0xb0, 0xeb, 0xf3, 0x77, 0x08, 0x6a,
- 0x46, 0x5c, 0xf6, 0x2f, 0xf1, 0x24, 0xc3, 0x4d,
- 0x80, 0x60, 0x4d, 0x69, 0x98, 0xde, 0xc7, 0xa1,
- 0xf6, 0x4e, 0x18, 0x0c, 0x2a, 0xb0, 0xb2, 0xe0,
- 0x46, 0xe7, 0x49, 0x37, 0xc8, 0x5a, 0x23, 0x24,
- 0xe3, 0x0f, 0xcc, 0x92, 0xb4, 0x8d, 0xdc, 0x9e
-};
-
-static const uint8_t AES_CBC_ciphertext_1280B[] = {
- 0x91, 0x99, 0x5e, 0x9e, 0x84, 0xff, 0x59, 0x45,
- 0xc1, 0xf4, 0xbc, 0x9c, 0xb9, 0x30, 0x6c, 0x51,
- 0x73, 0x52, 0xb4, 0x44, 0x09, 0x79, 0xe2, 0x89,
- 0x75, 0xeb, 0x54, 0x26, 0xce, 0xd8, 0x24, 0x98,
- 0xaa, 0xf8, 0x13, 0x16, 0x68, 0x58, 0xc4, 0x82,
- 0x0e, 0x31, 0xd3, 0x6a, 0x13, 0x58, 0x31, 0xe9,
- 0x3a, 0xc1, 0x8b, 0xc5, 0x3f, 0x50, 0x42, 0xd1,
- 0x93, 0xe4, 0x9b, 0x65, 0x2b, 0xf4, 0x1d, 0x9e,
- 0x2d, 0xdb, 0x48, 0xef, 0x9a, 0x01, 0x68, 0xb6,
- 0xea, 0x7a, 0x2b, 0xad, 0xfe, 0x77, 0x44, 0x7e,
- 0x5a, 0xc5, 0x64, 0xb4, 0xfe, 0x5c, 0x80, 0xf3,
- 0x20, 0x7e, 0xaf, 0x5b, 0xf8, 0xd1, 0x38, 0xa0,
- 0x8d, 0x09, 0x77, 0x06, 0xfe, 0xf5, 0xf4, 0xe4,
- 0xee, 0xb8, 0x95, 0x27, 0xed, 0x07, 0xb8, 0xaa,
- 0x25, 0xb4, 0xe1, 0x4c, 0xeb, 0x3f, 0xdb, 0x39,
- 0x66, 0x28, 0x1b, 0x60, 0x42, 0x8b, 0x99, 0xd9,
- 0x49, 0xd6, 0x8c, 0xa4, 0x9d, 0xd8, 0x93, 0x58,
- 0x8f, 0xfa, 0xd3, 0xf7, 0x37, 0x9c, 0x88, 0xab,
- 0x16, 0x50, 0xfe, 0x01, 0x1f, 0x88, 0x48, 0xbe,
- 0x21, 0xa9, 0x90, 0x9e, 0x73, 0xe9, 0x82, 0xf7,
- 0xbf, 0x4b, 0x43, 0xf4, 0xbf, 0x22, 0x3c, 0x45,
- 0x47, 0x95, 0x5b, 0x49, 0x71, 0x07, 0x1c, 0x8b,
- 0x49, 0xa4, 0xa3, 0x49, 0xc4, 0x5f, 0xb1, 0xf5,
- 0xe3, 0x6b, 0xf1, 0xdc, 0xea, 0x92, 0x7b, 0x29,
- 0x40, 0xc9, 0x39, 0x5f, 0xdb, 0xbd, 0xf3, 0x6a,
- 0x09, 0x9b, 0x2a, 0x5e, 0xc7, 0x0b, 0x25, 0x94,
- 0x55, 0x71, 0x9c, 0x7e, 0x0e, 0xb4, 0x08, 0x12,
- 0x8c, 0x6e, 0x77, 0xb8, 0x29, 0xf1, 0xc6, 0x71,
- 0x04, 0x40, 0x77, 0x18, 0x3f, 0x01, 0x09, 0x9c,
- 0x23, 0x2b, 0x5d, 0x2a, 0x88, 0x20, 0x23, 0x59,
- 0x74, 0x2a, 0x67, 0x8f, 0xb7, 0xba, 0x38, 0x9f,
- 0x0f, 0xcf, 0x94, 0xdf, 0xe1, 0x8f, 0x35, 0x5e,
- 0x34, 0x0c, 0x32, 0x92, 0x2b, 0x23, 0x81, 0xf4,
- 0x73, 0xa0, 0x5a, 0x2a, 0xbd, 0xa6, 0x6b, 0xae,
- 0x43, 0xe2, 0xdc, 0x01, 0xc1, 0xc6, 0xc3, 0x04,
- 0x06, 0xbb, 0xb0, 0x89, 0xb3, 0x4e, 0xbd, 0x81,
- 0x1b, 0x03, 0x63, 0x93, 0xed, 0x4e, 0xf6, 0xe5,
- 0x94, 0x6f, 0xd6, 0xf3, 0x20, 0xf3, 0xbc, 0x30,
- 0xc5, 0xd6, 0xbe, 0x1c, 0x05, 0x34, 0x26, 0x4d,
- 0x46, 0x5e, 0x56, 0x63, 0xfb, 0xdb, 0xcd, 0xed,
- 0xb0, 0x7f, 0x83, 0x94, 0x55, 0x54, 0x2f, 0xab,
- 0xc9, 0xb7, 0x16, 0x4f, 0x9e, 0x93, 0x25, 0xd7,
- 0x9f, 0x39, 0x2b, 0x63, 0xcf, 0x1e, 0xa3, 0x0e,
- 0x28, 0x47, 0x8a, 0x5f, 0x40, 0x02, 0x89, 0x1f,
- 0x83, 0xe7, 0x87, 0xd1, 0x90, 0x17, 0xb8, 0x27,
- 0x64, 0xe1, 0xe1, 0x48, 0x5a, 0x55, 0x74, 0x99,
- 0x27, 0x9d, 0x05, 0x67, 0xda, 0x70, 0x12, 0x8f,
- 0x94, 0x96, 0xfd, 0x36, 0xa4, 0x1d, 0x22, 0xe5,
- 0x0b, 0xe5, 0x2f, 0x38, 0x55, 0xa3, 0x5d, 0x0b,
- 0xcf, 0xd4, 0xa9, 0xb8, 0xd6, 0x9a, 0x16, 0x2e,
- 0x6c, 0x4a, 0x25, 0x51, 0x7a, 0x09, 0x48, 0xdd,
- 0xf0, 0xa3, 0x5b, 0x08, 0x1e, 0x2f, 0x03, 0x91,
- 0x80, 0xe8, 0x0f, 0xe9, 0x5a, 0x2f, 0x90, 0xd3,
- 0x64, 0xed, 0xd7, 0x51, 0x17, 0x66, 0x53, 0x40,
- 0x43, 0x74, 0xef, 0x0a, 0x0d, 0x49, 0x41, 0xf2,
- 0x67, 0x6e, 0xea, 0x14, 0xc8, 0x74, 0xd6, 0xa9,
- 0xb9, 0x6a, 0xe3, 0xec, 0x7d, 0xe8, 0x6a, 0x21,
- 0x3a, 0x52, 0x42, 0xfe, 0x9a, 0x15, 0x6d, 0x60,
- 0x64, 0x88, 0xc5, 0xb2, 0x8b, 0x15, 0x2c, 0xff,
- 0xe2, 0x35, 0xc3, 0xee, 0x9f, 0xcd, 0x82, 0xd9,
- 0x14, 0x35, 0x2a, 0xb7, 0xf5, 0x2f, 0x7b, 0xbc,
- 0x01, 0xfd, 0xa8, 0xe0, 0x21, 0x4e, 0x73, 0xf9,
- 0xf2, 0xb0, 0x79, 0xc9, 0x10, 0x52, 0x8f, 0xa8,
- 0x3e, 0x3b, 0xbe, 0xc5, 0xde, 0xf6, 0x53, 0xe3,
- 0x1c, 0x25, 0x3a, 0x1f, 0x13, 0xbf, 0x13, 0xbb,
- 0x94, 0xc2, 0x97, 0x43, 0x64, 0x47, 0x8f, 0x76,
- 0xd7, 0xaa, 0xeb, 0xa4, 0x03, 0x50, 0x0c, 0x10,
- 0x50, 0xd8, 0xf7, 0x75, 0x52, 0x42, 0xe2, 0x94,
- 0x67, 0xf4, 0x60, 0xfb, 0x21, 0x9b, 0x7a, 0x05,
- 0x50, 0x7c, 0x1b, 0x4a, 0x8b, 0x29, 0xe1, 0xac,
- 0xd7, 0x99, 0xfd, 0x0d, 0x65, 0x92, 0xcd, 0x23,
- 0xa7, 0x35, 0x8e, 0x13, 0xf2, 0xe4, 0x10, 0x74,
- 0xc6, 0x4f, 0x19, 0xf7, 0x01, 0x0b, 0x46, 0xab,
- 0xef, 0x8d, 0x4a, 0x4a, 0xfa, 0xda, 0xf3, 0xfb,
- 0x40, 0x28, 0x88, 0xa2, 0x65, 0x98, 0x4d, 0x88,
- 0xc7, 0xbf, 0x00, 0xc8, 0xd0, 0x91, 0xcb, 0x89,
- 0x2f, 0xb0, 0x85, 0xfc, 0xa1, 0xc1, 0x9e, 0x83,
- 0x88, 0xad, 0x95, 0xc0, 0x31, 0xa0, 0xad, 0xa2,
- 0x42, 0xb5, 0xe7, 0x55, 0xd4, 0x93, 0x5a, 0x74,
- 0x4e, 0x41, 0xc3, 0xcf, 0x96, 0x83, 0x46, 0xa1,
- 0xb7, 0x5b, 0xb1, 0x34, 0x67, 0x4e, 0xb1, 0xd7,
- 0x40, 0x20, 0x72, 0xe9, 0xc8, 0x74, 0xb7, 0xde,
- 0x72, 0x29, 0x77, 0x4c, 0x74, 0x7e, 0xcc, 0x18,
- 0xa5, 0x8d, 0x79, 0x8c, 0xd6, 0x6e, 0xcb, 0xd9,
- 0xe1, 0x61, 0xe7, 0x36, 0xbc, 0x37, 0xea, 0xee,
- 0xd8, 0x3c, 0x5e, 0x7c, 0x47, 0x50, 0xd5, 0xec,
- 0x37, 0xc5, 0x63, 0xc3, 0xc9, 0x99, 0x23, 0x9f,
- 0x64, 0x39, 0xdf, 0x13, 0x96, 0x6d, 0xea, 0x08,
- 0x0c, 0x27, 0x2d, 0xfe, 0x0f, 0xc2, 0xa3, 0x97,
- 0x04, 0x12, 0x66, 0x0d, 0x94, 0xbf, 0xbe, 0x3e,
- 0xb9, 0xcf, 0x8e, 0xc1, 0x9d, 0xb1, 0x64, 0x17,
- 0x54, 0x92, 0x3f, 0x0a, 0x51, 0xc8, 0xf5, 0x82,
- 0x98, 0x73, 0x03, 0xc0, 0x5a, 0x51, 0x01, 0x67,
- 0xb4, 0x01, 0x04, 0x06, 0xbc, 0x37, 0xde, 0x96,
- 0x23, 0x3c, 0xce, 0x98, 0x3f, 0xd6, 0x51, 0x1b,
- 0x01, 0x83, 0x0a, 0x1c, 0xf9, 0xeb, 0x7e, 0x72,
- 0xa9, 0x51, 0x23, 0xc8, 0xd7, 0x2f, 0x12, 0xbc,
- 0x08, 0xac, 0x07, 0xe7, 0xa7, 0xe6, 0x46, 0xae,
- 0x54, 0xa3, 0xc2, 0xf2, 0x05, 0x2d, 0x06, 0x5e,
- 0xfc, 0xe2, 0xa2, 0x23, 0xac, 0x86, 0xf2, 0x54,
- 0x83, 0x4a, 0xb6, 0x48, 0x93, 0xa1, 0x78, 0xc2,
- 0x07, 0xec, 0x82, 0xf0, 0x74, 0xa9, 0x18, 0xe9,
- 0x53, 0x44, 0x49, 0xc2, 0x94, 0xf8, 0x94, 0x92,
- 0x08, 0x3f, 0xbf, 0xa6, 0xe5, 0xc6, 0x03, 0x8a,
- 0xc6, 0x90, 0x48, 0x6c, 0xee, 0xbd, 0x44, 0x92,
- 0x1f, 0x2a, 0xce, 0x1d, 0xb8, 0x31, 0xa2, 0x9d,
- 0x24, 0x93, 0xa8, 0x9f, 0x36, 0x00, 0x04, 0x7b,
- 0xcb, 0x93, 0x59, 0xa1, 0x53, 0xdb, 0x13, 0x7a,
- 0x54, 0xb1, 0x04, 0xdb, 0xce, 0x48, 0x4f, 0xe5,
- 0x2f, 0xcb, 0xdf, 0x8f, 0x50, 0x7c, 0xfc, 0x76,
- 0x80, 0xb4, 0xdc, 0x3b, 0xc8, 0x98, 0x95, 0xf5,
- 0x50, 0xba, 0x70, 0x5a, 0x97, 0xd5, 0xfc, 0x98,
- 0x4d, 0xf3, 0x61, 0x0f, 0xcf, 0xac, 0x49, 0x0a,
- 0xdb, 0xc1, 0x42, 0x8f, 0xb6, 0x29, 0xd5, 0x65,
- 0xef, 0x83, 0xf1, 0x30, 0x4b, 0x84, 0xd0, 0x69,
- 0xde, 0xd2, 0x99, 0xe5, 0xec, 0xd3, 0x90, 0x86,
- 0x39, 0x2a, 0x6e, 0xd5, 0x32, 0xe3, 0x0d, 0x2d,
- 0x01, 0x8b, 0x17, 0x55, 0x1d, 0x65, 0x57, 0xbf,
- 0xd8, 0x75, 0xa4, 0x85, 0xb6, 0x4e, 0x35, 0x14,
- 0x58, 0xe4, 0x89, 0xb8, 0x7a, 0x58, 0x86, 0x0c,
- 0xbd, 0x8b, 0x05, 0x7b, 0x63, 0xc0, 0x86, 0x80,
- 0x33, 0x46, 0xd4, 0x9b, 0xb6, 0x0a, 0xeb, 0x6c,
- 0xae, 0xd6, 0x57, 0x7a, 0xc7, 0x59, 0x33, 0xa0,
- 0xda, 0xa4, 0x12, 0xbf, 0x52, 0x22, 0x05, 0x8d,
- 0xeb, 0xee, 0xd5, 0xec, 0xea, 0x29, 0x9b, 0x76,
- 0x95, 0x50, 0x6d, 0x99, 0xe1, 0x45, 0x63, 0x09,
- 0x16, 0x5f, 0xb0, 0xf2, 0x5b, 0x08, 0x33, 0xdd,
- 0x8f, 0xb7, 0x60, 0x7a, 0x8e, 0xc6, 0xfc, 0xac,
- 0xa9, 0x56, 0x2c, 0xa9, 0x8b, 0x74, 0x33, 0xad,
- 0x2a, 0x7e, 0x96, 0xb6, 0xba, 0x22, 0x28, 0xcf,
- 0x4d, 0x96, 0xb7, 0xd1, 0xfa, 0x99, 0x4a, 0x61,
- 0xe6, 0x84, 0xd1, 0x94, 0xca, 0xf5, 0x86, 0xb0,
- 0xba, 0x34, 0x7a, 0x04, 0xcc, 0xd4, 0x81, 0xcd,
- 0xd9, 0x86, 0xb6, 0xe0, 0x5a, 0x6f, 0x9b, 0x99,
- 0xf0, 0xdf, 0x49, 0xae, 0x6d, 0xc2, 0x54, 0x67,
- 0xe0, 0xb4, 0x34, 0x2d, 0x1c, 0x46, 0xdf, 0x73,
- 0x3b, 0x45, 0x43, 0xe7, 0x1f, 0xa3, 0x36, 0x35,
- 0x25, 0x33, 0xd9, 0xc0, 0x54, 0x38, 0x6e, 0x6b,
- 0x80, 0xcf, 0x50, 0xa4, 0xb6, 0x21, 0x17, 0xfd,
- 0x9b, 0x5c, 0x36, 0xca, 0xcc, 0x73, 0x73, 0xad,
- 0xe0, 0x57, 0x77, 0x90, 0x0e, 0x7f, 0x0f, 0x87,
- 0x7f, 0xdb, 0x73, 0xbf, 0xda, 0xc2, 0xb3, 0x05,
- 0x22, 0x06, 0xf5, 0xa3, 0xfc, 0x1e, 0x8f, 0xda,
- 0xcf, 0x49, 0xd6, 0xb3, 0x66, 0x2c, 0xb5, 0x00,
- 0xaf, 0x85, 0x6e, 0xb8, 0x5b, 0x8c, 0xa1, 0xa4,
- 0x21, 0xce, 0x40, 0xf3, 0x98, 0xac, 0xec, 0x88,
- 0x62, 0x43, 0x2a, 0xac, 0xca, 0xcf, 0xb9, 0x30,
- 0xeb, 0xfc, 0xef, 0xf0, 0x6e, 0x64, 0x6d, 0xe7,
- 0x54, 0x88, 0x6b, 0x22, 0x29, 0xbe, 0xa5, 0x8c,
- 0x31, 0x23, 0x3b, 0x4a, 0x80, 0x37, 0xe6, 0xd0,
- 0x05, 0xfc, 0x10, 0x0e, 0xdd, 0xbb, 0x00, 0xc5,
- 0x07, 0x20, 0x59, 0xd3, 0x41, 0x17, 0x86, 0x46,
- 0xab, 0x68, 0xf6, 0x48, 0x3c, 0xea, 0x5a, 0x06,
- 0x30, 0x21, 0x19, 0xed, 0x74, 0xbe, 0x0b, 0x97,
- 0xee, 0x91, 0x35, 0x94, 0x1f, 0xcb, 0x68, 0x7f,
- 0xe4, 0x48, 0xb0, 0x16, 0xfb, 0xf0, 0x74, 0xdb,
- 0x06, 0x59, 0x2e, 0x5a, 0x9c, 0xce, 0x8f, 0x7d,
- 0xba, 0x48, 0xd5, 0x3f, 0x5c, 0xb0, 0xc2, 0x33,
- 0x48, 0x60, 0x17, 0x08, 0x85, 0xba, 0xff, 0xb9,
- 0x34, 0x0a, 0x3d, 0x8f, 0x21, 0x13, 0x12, 0x1b
-};
-
-static const uint8_t AES_CBC_ciphertext_1536B[] = {
- 0x89, 0x93, 0x05, 0x99, 0xa9, 0xed, 0xea, 0x62,
- 0xc9, 0xda, 0x51, 0x15, 0xce, 0x42, 0x91, 0xc3,
- 0x80, 0xc8, 0x03, 0x88, 0xc2, 0x63, 0xda, 0x53,
- 0x1a, 0xf3, 0xeb, 0xd5, 0xba, 0x6f, 0x23, 0xb2,
- 0xed, 0x8f, 0x89, 0xb1, 0xb3, 0xca, 0x90, 0x7a,
- 0xdd, 0x3f, 0xf6, 0xca, 0x86, 0x58, 0x54, 0xbc,
- 0xab, 0x0f, 0xf4, 0xab, 0x6d, 0x5d, 0x42, 0xd0,
- 0x17, 0x49, 0x17, 0xd1, 0x93, 0xea, 0xe8, 0x22,
- 0xc1, 0x34, 0x9f, 0x3a, 0x3b, 0xaa, 0xe9, 0x1b,
- 0x93, 0xff, 0x6b, 0x68, 0xba, 0xe6, 0xd2, 0x39,
- 0x3d, 0x55, 0x34, 0x8f, 0x98, 0x86, 0xb4, 0xd8,
- 0x7c, 0x0d, 0x3e, 0x01, 0x63, 0x04, 0x01, 0xff,
- 0x16, 0x0f, 0x51, 0x5f, 0x73, 0x53, 0xf0, 0x3a,
- 0x38, 0xb4, 0x4d, 0x8d, 0xaf, 0xa3, 0xca, 0x2f,
- 0x6f, 0xdf, 0xc0, 0x41, 0x6c, 0x48, 0x60, 0x1a,
- 0xe4, 0xe7, 0x8a, 0x65, 0x6f, 0x8d, 0xd7, 0xe1,
- 0x10, 0xab, 0x78, 0x5b, 0xb9, 0x69, 0x1f, 0xe0,
- 0x5c, 0xf1, 0x19, 0x12, 0x21, 0xc7, 0x51, 0xbc,
- 0x61, 0x5f, 0xc0, 0x36, 0x17, 0xc0, 0x28, 0xd9,
- 0x51, 0xcb, 0x43, 0xd9, 0xfa, 0xd1, 0xad, 0x79,
- 0x69, 0x86, 0x49, 0xc5, 0xe5, 0x69, 0x27, 0xce,
- 0x22, 0xd0, 0xe1, 0x6a, 0xf9, 0x02, 0xca, 0x6c,
- 0x34, 0xc7, 0xb8, 0x02, 0xc1, 0x38, 0x7f, 0xd5,
- 0x15, 0xf5, 0xd6, 0xeb, 0xf9, 0x30, 0x40, 0x43,
- 0xea, 0x87, 0xde, 0x35, 0xf6, 0x83, 0x59, 0x09,
- 0x68, 0x62, 0x00, 0x87, 0xb8, 0xe7, 0xca, 0x05,
- 0x0f, 0xac, 0x42, 0x58, 0x45, 0xaa, 0xc9, 0x9b,
- 0xfd, 0x2a, 0xda, 0x65, 0x33, 0x93, 0x9d, 0xc6,
- 0x93, 0x8d, 0xe2, 0xc5, 0x71, 0xc1, 0x5c, 0x13,
- 0xde, 0x7b, 0xd4, 0xb9, 0x4c, 0x35, 0x61, 0x85,
- 0x90, 0x78, 0xf7, 0x81, 0x98, 0x45, 0x99, 0x24,
- 0x58, 0x73, 0x28, 0xf8, 0x31, 0xab, 0x54, 0x2e,
- 0xc0, 0x38, 0x77, 0x25, 0x5c, 0x06, 0x9c, 0xc3,
- 0x69, 0x21, 0x92, 0x76, 0xe1, 0x16, 0xdc, 0xa9,
- 0xee, 0xb6, 0x80, 0x66, 0x43, 0x11, 0x24, 0xb3,
- 0x07, 0x17, 0x89, 0x0f, 0xcb, 0xe0, 0x60, 0xa8,
- 0x9d, 0x06, 0x4b, 0x6e, 0x72, 0xb7, 0xbc, 0x4f,
- 0xb8, 0xc0, 0x80, 0xa2, 0xfb, 0x46, 0x5b, 0x8f,
- 0x11, 0x01, 0x92, 0x9d, 0x37, 0x09, 0x98, 0xc8,
- 0x0a, 0x46, 0xae, 0x12, 0xac, 0x61, 0x3f, 0xe7,
- 0x41, 0x1a, 0xaa, 0x2e, 0xdc, 0xd7, 0x2a, 0x47,
- 0xee, 0xdf, 0x08, 0xd1, 0xff, 0xea, 0x13, 0xc6,
- 0x05, 0xdb, 0x29, 0xcc, 0x03, 0xba, 0x7b, 0x6d,
- 0x40, 0xc1, 0xc9, 0x76, 0x75, 0x03, 0x7a, 0x71,
- 0xc9, 0x5f, 0xd9, 0xe0, 0x61, 0x69, 0x36, 0x8f,
- 0xb2, 0xbc, 0x28, 0xf3, 0x90, 0x71, 0xda, 0x5f,
- 0x08, 0xd5, 0x0d, 0xc1, 0xe6, 0xbd, 0x2b, 0xc6,
- 0x6c, 0x42, 0xfd, 0xbf, 0x10, 0xe8, 0x5f, 0x87,
- 0x3d, 0x21, 0x42, 0x85, 0x01, 0x0a, 0xbf, 0x8e,
- 0x49, 0xd3, 0x9c, 0x89, 0x3b, 0xea, 0xe1, 0xbf,
- 0xe9, 0x9b, 0x5e, 0x0e, 0xb8, 0xeb, 0xcd, 0x3a,
- 0xf6, 0x29, 0x41, 0x35, 0xdd, 0x9b, 0x13, 0x24,
- 0xe0, 0x1d, 0x8a, 0xcb, 0x20, 0xf8, 0x41, 0x51,
- 0x3e, 0x23, 0x8c, 0x67, 0x98, 0x39, 0x53, 0x77,
- 0x2a, 0x68, 0xf4, 0x3c, 0x7e, 0xd6, 0xc4, 0x6e,
- 0xf1, 0x53, 0xe9, 0xd8, 0x5c, 0xc1, 0xa9, 0x38,
- 0x6f, 0x5e, 0xe4, 0xd4, 0x29, 0x1c, 0x6c, 0xee,
- 0x2f, 0xea, 0xde, 0x61, 0x71, 0x5a, 0xea, 0xce,
- 0x23, 0x6e, 0x1b, 0x16, 0x43, 0xb7, 0xc0, 0xe3,
- 0x87, 0xa1, 0x95, 0x1e, 0x97, 0x4d, 0xea, 0xa6,
- 0xf7, 0x25, 0xac, 0x82, 0x2a, 0xd3, 0xa6, 0x99,
- 0x75, 0xdd, 0xc1, 0x55, 0x32, 0x6b, 0xea, 0x33,
- 0x88, 0xce, 0x06, 0xac, 0x15, 0x39, 0x19, 0xa3,
- 0x59, 0xaf, 0x7a, 0x1f, 0xd9, 0x72, 0x5e, 0xf7,
- 0x4c, 0xf3, 0x5d, 0x6b, 0xf2, 0x16, 0x92, 0xa8,
- 0x9e, 0x3d, 0xd4, 0x4c, 0x72, 0x55, 0x4e, 0x4a,
- 0xf7, 0x8b, 0x2f, 0x67, 0x5a, 0x90, 0xb7, 0xcf,
- 0x16, 0xd3, 0x7b, 0x5a, 0x9a, 0xc8, 0x9f, 0xbf,
- 0x01, 0x76, 0x3b, 0x86, 0x2c, 0x2a, 0x78, 0x10,
- 0x70, 0x05, 0x38, 0xf9, 0xdd, 0x2a, 0x1d, 0x00,
- 0x25, 0xb7, 0x10, 0xac, 0x3b, 0x3c, 0x4d, 0x3c,
- 0x01, 0x68, 0x3c, 0x5a, 0x29, 0xc2, 0xa0, 0x1b,
- 0x95, 0x67, 0xf9, 0x0a, 0x60, 0xb7, 0x11, 0x9c,
- 0x40, 0x45, 0xd7, 0xb0, 0xda, 0x49, 0x87, 0xcd,
- 0xb0, 0x9b, 0x61, 0x8c, 0xf4, 0x0d, 0x94, 0x1d,
- 0x79, 0x66, 0x13, 0x0b, 0xc6, 0x6b, 0x19, 0xee,
- 0xa0, 0x6b, 0x64, 0x7d, 0xc4, 0xff, 0x98, 0x72,
- 0x60, 0xab, 0x7f, 0x0f, 0x4d, 0x5d, 0x6b, 0xc3,
- 0xba, 0x5e, 0x0d, 0x04, 0xd9, 0x59, 0x17, 0xd0,
- 0x64, 0xbe, 0xfb, 0x58, 0xfc, 0xed, 0x18, 0xf6,
- 0xac, 0x19, 0xa4, 0xfd, 0x16, 0x59, 0x80, 0x58,
- 0xb8, 0x0f, 0x79, 0x24, 0x60, 0x18, 0x62, 0xa9,
- 0xa3, 0xa0, 0xe8, 0x81, 0xd6, 0xec, 0x5b, 0xfe,
- 0x5b, 0xb8, 0xa4, 0x00, 0xa9, 0xd0, 0x90, 0x17,
- 0xe5, 0x50, 0x3d, 0x2b, 0x12, 0x6e, 0x2a, 0x13,
- 0x65, 0x7c, 0xdf, 0xdf, 0xa7, 0xdd, 0x9f, 0x78,
- 0x5f, 0x8f, 0x4e, 0x90, 0xa6, 0x10, 0xe4, 0x7b,
- 0x68, 0x6b, 0xfd, 0xa9, 0x6d, 0x47, 0xfa, 0xec,
- 0x42, 0x35, 0x07, 0x12, 0x3e, 0x78, 0x23, 0x15,
- 0xff, 0xe2, 0x65, 0xc7, 0x47, 0x89, 0x2f, 0x97,
- 0x7c, 0xd7, 0x6b, 0x69, 0x35, 0x79, 0x6f, 0x85,
- 0xb4, 0xa9, 0x75, 0x04, 0x32, 0x9a, 0xfe, 0xf0,
- 0xce, 0xe3, 0xf1, 0xab, 0x15, 0x47, 0xe4, 0x9c,
- 0xc1, 0x48, 0x32, 0x3c, 0xbe, 0x44, 0x72, 0xc9,
- 0xaa, 0x50, 0x37, 0xa6, 0xbe, 0x41, 0xcf, 0xe8,
- 0x17, 0x4e, 0x37, 0xbe, 0xf1, 0x34, 0x2c, 0xd9,
- 0x60, 0x48, 0x09, 0xa5, 0x26, 0x00, 0x31, 0x77,
- 0x4e, 0xac, 0x7c, 0x89, 0x75, 0xe3, 0xde, 0x26,
- 0x4c, 0x32, 0x54, 0x27, 0x8e, 0x92, 0x26, 0x42,
- 0x85, 0x76, 0x01, 0x76, 0x62, 0x4c, 0x29, 0xe9,
- 0x38, 0x05, 0x51, 0x54, 0x97, 0xa3, 0x03, 0x59,
- 0x5e, 0xec, 0x0c, 0xe4, 0x96, 0xb7, 0x15, 0xa8,
- 0x41, 0x06, 0x2b, 0x78, 0x95, 0x24, 0xf6, 0x32,
- 0xc5, 0xec, 0xd7, 0x89, 0x28, 0x1e, 0xec, 0xb1,
- 0xc7, 0x21, 0x0c, 0xd3, 0x80, 0x7c, 0x5a, 0xe6,
- 0xb1, 0x3a, 0x52, 0x33, 0x84, 0x4e, 0x32, 0x6e,
- 0x7a, 0xf6, 0x43, 0x15, 0x5b, 0xa6, 0xba, 0xeb,
- 0xa8, 0xe4, 0xff, 0x4f, 0xbd, 0xbd, 0xa8, 0x5e,
- 0xbe, 0x27, 0xaf, 0xc5, 0xf7, 0x9e, 0xdf, 0x48,
- 0x22, 0xca, 0x6a, 0x0b, 0x3c, 0xd7, 0xe0, 0xdc,
- 0xf3, 0x71, 0x08, 0xdc, 0x28, 0x13, 0x08, 0xf2,
- 0x08, 0x1d, 0x9d, 0x7b, 0xd9, 0xde, 0x6f, 0xe6,
- 0xe8, 0x88, 0x18, 0xc2, 0xcd, 0x93, 0xc5, 0x38,
- 0x21, 0x68, 0x4c, 0x9a, 0xfb, 0xb6, 0x18, 0x16,
- 0x73, 0x2c, 0x1d, 0x6f, 0x95, 0xfb, 0x65, 0x4f,
- 0x7c, 0xec, 0x8d, 0x6c, 0xa8, 0xc0, 0x55, 0x28,
- 0xc6, 0xc3, 0xea, 0xeb, 0x05, 0xf5, 0x65, 0xeb,
- 0x53, 0xe1, 0x54, 0xef, 0xb8, 0x64, 0x98, 0x2d,
- 0x98, 0x9e, 0xc8, 0xfe, 0xa2, 0x07, 0x30, 0xf7,
- 0xf7, 0xae, 0xdb, 0x32, 0xf8, 0x71, 0x9d, 0x06,
- 0xdf, 0x9b, 0xda, 0x61, 0x7d, 0xdb, 0xae, 0x06,
- 0x24, 0x63, 0x74, 0xb6, 0xf3, 0x1b, 0x66, 0x09,
- 0x60, 0xff, 0x2b, 0x29, 0xf5, 0xa9, 0x9d, 0x61,
- 0x5d, 0x55, 0x10, 0x82, 0x21, 0xbb, 0x64, 0x0d,
- 0xef, 0x5c, 0xe3, 0x30, 0x1b, 0x60, 0x1e, 0x5b,
- 0xfe, 0x6c, 0xf5, 0x15, 0xa3, 0x86, 0x27, 0x58,
- 0x46, 0x00, 0x20, 0xcb, 0x86, 0x9a, 0x52, 0x29,
- 0x20, 0x68, 0x4d, 0x67, 0x88, 0x70, 0xc2, 0x31,
- 0xd8, 0xbb, 0xa5, 0xa7, 0x88, 0x7f, 0x66, 0xbc,
- 0xaa, 0x0f, 0xe1, 0x78, 0x7b, 0x97, 0x3c, 0xb7,
- 0xd7, 0xd8, 0x04, 0xe0, 0x09, 0x60, 0xc8, 0xd0,
- 0x9e, 0xe5, 0x6b, 0x31, 0x7f, 0x88, 0xfe, 0xc3,
- 0xfd, 0x89, 0xec, 0x76, 0x4b, 0xb3, 0xa7, 0x37,
- 0x03, 0xb7, 0xc6, 0x10, 0x7c, 0x9d, 0x0c, 0x75,
- 0xd3, 0x08, 0x14, 0x94, 0x03, 0x42, 0x25, 0x26,
- 0x85, 0xf7, 0xf0, 0x90, 0x06, 0x3e, 0x6f, 0x60,
- 0x52, 0x55, 0xd5, 0x0f, 0x79, 0x64, 0x69, 0x69,
- 0x46, 0xf9, 0x7f, 0x7f, 0x03, 0xf1, 0x1f, 0xdb,
- 0x39, 0x05, 0xba, 0x4a, 0x8f, 0x17, 0xe7, 0xba,
- 0xe2, 0x07, 0x7c, 0x1d, 0x9e, 0xbc, 0x94, 0xc0,
- 0x61, 0x59, 0x8e, 0x72, 0xaf, 0xfc, 0x99, 0xe4,
- 0xd5, 0xa8, 0xee, 0x0a, 0x48, 0x2d, 0x82, 0x8b,
- 0x34, 0x54, 0x8a, 0xce, 0xc7, 0xfa, 0xdd, 0xba,
- 0x54, 0xdf, 0xb3, 0x30, 0x33, 0x73, 0x2e, 0xd5,
- 0x52, 0xab, 0x49, 0x91, 0x4e, 0x0a, 0xd6, 0x2f,
- 0x67, 0xe4, 0xdd, 0x64, 0x48, 0x16, 0xd9, 0x85,
- 0xaa, 0x52, 0xa5, 0x0b, 0xd3, 0xb4, 0x2d, 0x77,
- 0x5e, 0x52, 0x77, 0x17, 0xcf, 0xbe, 0x88, 0x04,
- 0x01, 0x52, 0xe2, 0xf1, 0x46, 0xe2, 0x91, 0x30,
- 0x65, 0xcf, 0xc0, 0x65, 0x45, 0xc3, 0x7e, 0xf4,
- 0x2e, 0xb5, 0xaf, 0x6f, 0xab, 0x1a, 0xfa, 0x70,
- 0x35, 0xb8, 0x4f, 0x2d, 0x78, 0x90, 0x33, 0xb5,
- 0x9a, 0x67, 0xdb, 0x2f, 0x28, 0x32, 0xb6, 0x54,
- 0xab, 0x4c, 0x6b, 0x85, 0xed, 0x6c, 0x3e, 0x05,
- 0x2a, 0xc7, 0x32, 0xe8, 0xf5, 0xa3, 0x7b, 0x4e,
- 0x7b, 0x58, 0x24, 0x73, 0xf7, 0xfd, 0xc7, 0xc8,
- 0x6c, 0x71, 0x68, 0xb1, 0xf6, 0xc5, 0x9e, 0x1e,
- 0xe3, 0x5c, 0x25, 0xc0, 0x5b, 0x3e, 0x59, 0xa1,
- 0x18, 0x5a, 0xe8, 0xb5, 0xd1, 0x44, 0x13, 0xa3,
- 0xe6, 0x05, 0x76, 0xd2, 0x8d, 0x6e, 0x54, 0x68,
- 0x0c, 0xa4, 0x7b, 0x8b, 0xd3, 0x8c, 0x42, 0x13,
- 0x87, 0xda, 0xdf, 0x8f, 0xa5, 0x83, 0x7a, 0x42,
- 0x99, 0xb7, 0xeb, 0xe2, 0x79, 0xe0, 0xdb, 0xda,
- 0x33, 0xa8, 0x50, 0x3a, 0xd7, 0xe7, 0xd3, 0x61,
- 0x18, 0xb8, 0xaa, 0x2d, 0xc8, 0xd8, 0x2c, 0x28,
- 0xe5, 0x97, 0x0a, 0x7c, 0x6c, 0x7f, 0x09, 0xd7,
- 0x88, 0x80, 0xac, 0x12, 0xed, 0xf8, 0xc6, 0xb5,
- 0x2d, 0xd6, 0x63, 0x9b, 0x98, 0x35, 0x26, 0xde,
- 0xf6, 0x31, 0xee, 0x7e, 0xa0, 0xfb, 0x16, 0x98,
- 0xb1, 0x96, 0x1d, 0xee, 0xe3, 0x2f, 0xfb, 0x41,
- 0xdd, 0xea, 0x10, 0x1e, 0x03, 0x89, 0x18, 0xd2,
- 0x47, 0x0c, 0xa0, 0x57, 0xda, 0x76, 0x3a, 0x37,
- 0x2c, 0xe4, 0xf9, 0x77, 0xc8, 0x43, 0x5f, 0xcb,
- 0xd6, 0x85, 0xf7, 0x22, 0xe4, 0x32, 0x25, 0xa8,
- 0xdc, 0x21, 0xc0, 0xf5, 0x95, 0xb2, 0xf8, 0x83,
- 0xf0, 0x65, 0x61, 0x15, 0x48, 0x94, 0xb7, 0x03,
- 0x7f, 0x66, 0xa1, 0x39, 0x1f, 0xdd, 0xce, 0x96,
- 0xfe, 0x58, 0x81, 0x3d, 0x41, 0x11, 0x87, 0x13,
- 0x26, 0x1b, 0x6d, 0xf3, 0xca, 0x2e, 0x2c, 0x76,
- 0xd3, 0x2f, 0x6d, 0x49, 0x70, 0x53, 0x05, 0x96,
- 0xcc, 0x30, 0x2b, 0x83, 0xf2, 0xc6, 0xb2, 0x4b,
- 0x22, 0x13, 0x95, 0x42, 0xeb, 0x56, 0x4d, 0x22,
- 0xe6, 0x43, 0x6f, 0xba, 0xe7, 0x3b, 0xe5, 0x59,
- 0xce, 0x57, 0x88, 0x85, 0xb6, 0xbf, 0x15, 0x37,
- 0xb3, 0x7a, 0x7e, 0xc4, 0xbc, 0x99, 0xfc, 0xe4,
- 0x89, 0x00, 0x68, 0x39, 0xbc, 0x5a, 0xba, 0xab,
- 0x52, 0xab, 0xe6, 0x81, 0xfd, 0x93, 0x62, 0xe9,
- 0xb7, 0x12, 0xd1, 0x18, 0x1a, 0xb9, 0x55, 0x4a,
- 0x0f, 0xae, 0x35, 0x11, 0x04, 0x27, 0xf3, 0x42,
- 0x4e, 0xca, 0xdf, 0x9f, 0x12, 0x62, 0xea, 0x03,
- 0xc0, 0xa9, 0x22, 0x7b, 0x6c, 0x6c, 0xe3, 0xdf,
- 0x16, 0xad, 0x03, 0xc9, 0xfe, 0xa4, 0xdd, 0x4f
-};
-
-static const uint8_t AES_CBC_ciphertext_1792B[] = {
- 0x59, 0xcc, 0xfe, 0x8f, 0xb4, 0x9d, 0x0e, 0xd1,
- 0x85, 0xfc, 0x9b, 0x43, 0xc1, 0xb7, 0x54, 0x67,
- 0x01, 0xef, 0xb8, 0x71, 0x36, 0xdb, 0x50, 0x48,
- 0x7a, 0xea, 0xcf, 0xce, 0xba, 0x30, 0x10, 0x2e,
- 0x96, 0x2b, 0xfd, 0xcf, 0x00, 0xe3, 0x1f, 0xac,
- 0x66, 0x14, 0x30, 0x86, 0x49, 0xdb, 0x01, 0x8b,
- 0x07, 0xdd, 0x00, 0x9d, 0x0d, 0x5c, 0x19, 0x11,
- 0xe8, 0x44, 0x2b, 0x25, 0x70, 0xed, 0x7c, 0x33,
- 0x0d, 0xe3, 0x34, 0x93, 0x63, 0xad, 0x26, 0xb1,
- 0x11, 0x91, 0x34, 0x2e, 0x1d, 0x50, 0xaa, 0xd4,
- 0xef, 0x3a, 0x6d, 0xd7, 0x33, 0x20, 0x0d, 0x3f,
- 0x9b, 0xdd, 0xc3, 0xa5, 0xc5, 0xf1, 0x99, 0xdc,
- 0xea, 0x52, 0xda, 0x55, 0xea, 0xa2, 0x7a, 0xc5,
- 0x78, 0x44, 0x4a, 0x02, 0x33, 0x19, 0x62, 0x37,
- 0xf8, 0x8b, 0xd1, 0x0c, 0x21, 0xdf, 0x40, 0x19,
- 0x81, 0xea, 0xfb, 0x1c, 0xa7, 0xcc, 0x60, 0xfe,
- 0x63, 0x25, 0x8f, 0xf3, 0x73, 0x0f, 0x45, 0xe6,
- 0x6a, 0x18, 0xbf, 0xbe, 0xad, 0x92, 0x2a, 0x1e,
- 0x15, 0x65, 0x6f, 0xef, 0x92, 0xcd, 0x0e, 0x19,
- 0x3d, 0x42, 0xa8, 0xfc, 0x0d, 0x32, 0x58, 0xe0,
- 0x56, 0x9f, 0xd6, 0x9b, 0x8b, 0xec, 0xe0, 0x45,
- 0x4d, 0x7e, 0x73, 0x87, 0xff, 0x74, 0x92, 0x59,
- 0x60, 0x13, 0x93, 0xda, 0xec, 0xbf, 0xfa, 0x20,
- 0xb6, 0xe7, 0xdf, 0xc7, 0x10, 0xf5, 0x79, 0xb4,
- 0xd7, 0xac, 0xaf, 0x2b, 0x37, 0x52, 0x30, 0x1d,
- 0xbe, 0x0f, 0x60, 0x77, 0x3d, 0x03, 0x63, 0xa9,
- 0xae, 0xb1, 0xf3, 0xca, 0xca, 0xb4, 0x21, 0xd7,
- 0x6f, 0x2e, 0x5e, 0x9b, 0x68, 0x53, 0x80, 0xab,
- 0x30, 0x23, 0x0a, 0x72, 0x6b, 0xb1, 0xd8, 0x25,
- 0x5d, 0x3a, 0x62, 0x9b, 0x4f, 0x59, 0x3b, 0x79,
- 0xa8, 0x9e, 0x08, 0x6d, 0x37, 0xb0, 0xfc, 0x42,
- 0x51, 0x25, 0x86, 0xbd, 0x54, 0x5a, 0x95, 0x20,
- 0x6c, 0xac, 0xb9, 0x30, 0x1c, 0x03, 0xc9, 0x49,
- 0x38, 0x55, 0x31, 0x49, 0xed, 0xa9, 0x0e, 0xc3,
- 0x65, 0xb4, 0x68, 0x6b, 0x07, 0x4c, 0x0a, 0xf9,
- 0x21, 0x69, 0x7c, 0x9f, 0x28, 0x80, 0xe9, 0x49,
- 0x22, 0x7c, 0xec, 0x97, 0xf7, 0x70, 0xb4, 0xb8,
- 0x25, 0xe7, 0x80, 0x2c, 0x43, 0x24, 0x8a, 0x2e,
- 0xac, 0xa2, 0x84, 0x20, 0xe7, 0xf4, 0x6b, 0x86,
- 0x37, 0x05, 0xc7, 0x59, 0x04, 0x49, 0x2a, 0x99,
- 0x80, 0x46, 0x32, 0x19, 0xe6, 0x30, 0xce, 0xc0,
- 0xef, 0x6e, 0xec, 0xe5, 0x2f, 0x24, 0xc1, 0x78,
- 0x45, 0x02, 0xd3, 0x64, 0x99, 0xf5, 0xc7, 0xbc,
- 0x8f, 0x8c, 0x75, 0xb1, 0x0a, 0xc8, 0xc3, 0xbd,
- 0x5e, 0x7e, 0xbd, 0x0e, 0xdf, 0x4b, 0x96, 0x6a,
- 0xfd, 0x03, 0xdb, 0xd1, 0x31, 0x1e, 0x27, 0xf9,
- 0xe5, 0x83, 0x9a, 0xfc, 0x13, 0x4c, 0xd3, 0x04,
- 0xdb, 0xdb, 0x3f, 0x35, 0x93, 0x4e, 0x14, 0x6b,
- 0x00, 0x5c, 0xb6, 0x11, 0x50, 0xee, 0x61, 0x5c,
- 0x10, 0x5c, 0xd0, 0x90, 0x02, 0x2e, 0x12, 0xe0,
- 0x50, 0x44, 0xad, 0x75, 0xcd, 0x94, 0xcf, 0x92,
- 0xcb, 0xe3, 0xe8, 0x77, 0x4b, 0xd7, 0x1a, 0x7c,
- 0xdd, 0x6b, 0x49, 0x21, 0x7c, 0xe8, 0x2c, 0x25,
- 0x49, 0x86, 0x1e, 0x54, 0xae, 0xfc, 0x0e, 0x80,
- 0xb1, 0xd5, 0xa5, 0x23, 0xcf, 0xcc, 0x0e, 0x11,
- 0xe2, 0x7c, 0x3c, 0x25, 0x78, 0x64, 0x03, 0xa1,
- 0xdd, 0x9f, 0x74, 0x12, 0x7b, 0x21, 0xb5, 0x73,
- 0x15, 0x3c, 0xed, 0xad, 0x07, 0x62, 0x21, 0x79,
- 0xd4, 0x2f, 0x0d, 0x72, 0xe9, 0x7c, 0x6b, 0x96,
- 0x6e, 0xe5, 0x36, 0x4a, 0xd2, 0x38, 0xe1, 0xff,
- 0x6e, 0x26, 0xa4, 0xac, 0x83, 0x07, 0xe6, 0x67,
- 0x74, 0x6c, 0xec, 0x8b, 0x4b, 0x79, 0x33, 0x50,
- 0x2f, 0x8f, 0xa0, 0x8f, 0xfa, 0x38, 0x6a, 0xa2,
- 0x3a, 0x42, 0x85, 0x15, 0x90, 0xd0, 0xb3, 0x0d,
- 0x8a, 0xe4, 0x60, 0x03, 0xef, 0xf9, 0x65, 0x8a,
- 0x4e, 0x50, 0x8c, 0x65, 0xba, 0x61, 0x16, 0xc3,
- 0x93, 0xb7, 0x75, 0x21, 0x98, 0x25, 0x60, 0x6e,
- 0x3d, 0x68, 0xba, 0x7c, 0xe4, 0xf3, 0xd9, 0x9b,
- 0xfb, 0x7a, 0xed, 0x1f, 0xb3, 0x4b, 0x88, 0x74,
- 0x2c, 0xb8, 0x8c, 0x22, 0x95, 0xce, 0x90, 0xf1,
- 0xdb, 0x80, 0xa6, 0x39, 0xae, 0x82, 0xa1, 0xef,
- 0x75, 0xec, 0xfe, 0xf1, 0xe8, 0x04, 0xfd, 0x99,
- 0x1b, 0x5f, 0x45, 0x87, 0x4f, 0xfa, 0xa2, 0x3e,
- 0x3e, 0xb5, 0x01, 0x4b, 0x46, 0xeb, 0x13, 0x9a,
- 0xe4, 0x7d, 0x03, 0x87, 0xb1, 0x59, 0x91, 0x8e,
- 0x37, 0xd3, 0x16, 0xce, 0xef, 0x4b, 0xe9, 0x46,
- 0x8d, 0x2a, 0x50, 0x2f, 0x41, 0xd3, 0x7b, 0xcf,
- 0xf0, 0xb7, 0x8b, 0x65, 0x0f, 0xa3, 0x27, 0x10,
- 0xe9, 0xa9, 0xe9, 0x2c, 0xbe, 0xbb, 0x82, 0xe3,
- 0x7b, 0x0b, 0x81, 0x3e, 0xa4, 0x6a, 0x4f, 0x3b,
- 0xd5, 0x61, 0xf8, 0x47, 0x04, 0x99, 0x5b, 0xff,
- 0xf3, 0x14, 0x6e, 0x57, 0x5b, 0xbf, 0x1b, 0xb4,
- 0x3f, 0xf9, 0x31, 0xf6, 0x95, 0xd5, 0x10, 0xa9,
- 0x72, 0x28, 0x23, 0xa9, 0x6a, 0xa2, 0xcf, 0x7d,
- 0xe3, 0x18, 0x95, 0xda, 0xbc, 0x6f, 0xe9, 0xd8,
- 0xef, 0x49, 0x3f, 0xd3, 0xef, 0x1f, 0xe1, 0x50,
- 0xe8, 0x8a, 0xc0, 0xce, 0xcc, 0xb7, 0x5e, 0x0e,
- 0x8b, 0x95, 0x80, 0xfd, 0x58, 0x2a, 0x9b, 0xc8,
- 0xb4, 0x17, 0x04, 0x46, 0x74, 0xd4, 0x68, 0x91,
- 0x33, 0xc8, 0x31, 0x15, 0x84, 0x16, 0x35, 0x03,
- 0x64, 0x6d, 0xa9, 0x4e, 0x20, 0xeb, 0xa9, 0x3f,
- 0x21, 0x5e, 0x9b, 0x09, 0xc3, 0x45, 0xf8, 0x7c,
- 0x59, 0x62, 0x29, 0x9a, 0x5c, 0xcf, 0xb4, 0x27,
- 0x5e, 0x13, 0xea, 0xb3, 0xef, 0xd9, 0x01, 0x2a,
- 0x65, 0x5f, 0x14, 0xf4, 0xbf, 0x28, 0x89, 0x3d,
- 0xdd, 0x9d, 0x52, 0xbd, 0x9e, 0x5b, 0x3b, 0xd2,
- 0xc2, 0x81, 0x35, 0xb6, 0xac, 0xdd, 0x27, 0xc3,
- 0x7b, 0x01, 0x5a, 0x6d, 0x4c, 0x5e, 0x2c, 0x30,
- 0xcb, 0x3a, 0xfa, 0xc1, 0xd7, 0x31, 0x67, 0x3e,
- 0x08, 0x6a, 0xe8, 0x8c, 0x75, 0xac, 0x1a, 0x6a,
- 0x52, 0xf7, 0x51, 0xcd, 0x85, 0x3f, 0x3c, 0xa7,
- 0xea, 0xbc, 0xd7, 0x18, 0x9e, 0x27, 0x73, 0xe6,
- 0x2b, 0x58, 0xb6, 0xd2, 0x29, 0x68, 0xd5, 0x8f,
- 0x00, 0x4d, 0x55, 0xf6, 0x61, 0x5a, 0xcc, 0x51,
- 0xa6, 0x5e, 0x85, 0xcb, 0x0b, 0xfd, 0x06, 0xca,
- 0xf5, 0xbf, 0x0d, 0x13, 0x74, 0x78, 0x6d, 0x9e,
- 0x20, 0x11, 0x84, 0x3e, 0x78, 0x17, 0x04, 0x4f,
- 0x64, 0x2c, 0x3b, 0x3e, 0x93, 0x7b, 0x58, 0x33,
- 0x07, 0x52, 0xf7, 0x60, 0x6a, 0xa8, 0x3b, 0x19,
- 0x27, 0x7a, 0x93, 0xc5, 0x53, 0xad, 0xec, 0xf6,
- 0xc8, 0x94, 0xee, 0x92, 0xea, 0xee, 0x7e, 0xea,
- 0xb9, 0x5f, 0xac, 0x59, 0x5d, 0x2e, 0x78, 0x53,
- 0x72, 0x81, 0x92, 0xdd, 0x1c, 0x63, 0xbe, 0x02,
- 0xeb, 0xa8, 0x1b, 0x2a, 0x6e, 0x72, 0xe3, 0x2d,
- 0x84, 0x0d, 0x8a, 0x22, 0xf6, 0xba, 0xab, 0x04,
- 0x8e, 0x04, 0x24, 0xdb, 0xcc, 0xe2, 0x69, 0xeb,
- 0x4e, 0xfa, 0x6b, 0x5b, 0xc8, 0xc0, 0xd9, 0x25,
- 0xcb, 0x40, 0x8d, 0x4b, 0x8e, 0xa0, 0xd4, 0x72,
- 0x98, 0x36, 0x46, 0x3b, 0x4f, 0x5f, 0x96, 0x84,
- 0x03, 0x28, 0x86, 0x4d, 0xa1, 0x8a, 0xd7, 0xb2,
- 0x5b, 0x27, 0x01, 0x80, 0x62, 0x49, 0x56, 0xb9,
- 0xa0, 0xa1, 0xe3, 0x6e, 0x22, 0x2a, 0x5d, 0x03,
- 0x86, 0x40, 0x36, 0x22, 0x5e, 0xd2, 0xe5, 0xc0,
- 0x6b, 0xfa, 0xac, 0x80, 0x4e, 0x09, 0x99, 0xbc,
- 0x2f, 0x9b, 0xcc, 0xf3, 0x4e, 0xf7, 0x99, 0x98,
- 0x11, 0x6e, 0x6f, 0x62, 0x22, 0x6b, 0x92, 0x95,
- 0x3b, 0xc3, 0xd2, 0x8e, 0x0f, 0x07, 0xc2, 0x51,
- 0x5c, 0x4d, 0xb2, 0x6e, 0xc0, 0x27, 0x73, 0xcd,
- 0x57, 0xb7, 0xf0, 0xe9, 0x2e, 0xc8, 0xe2, 0x0c,
- 0xd1, 0xb5, 0x0f, 0xff, 0xf9, 0xec, 0x38, 0xba,
- 0x97, 0xd6, 0x94, 0x9b, 0xd1, 0x79, 0xb6, 0x6a,
- 0x01, 0x17, 0xe4, 0x7e, 0xa6, 0xd5, 0x86, 0x19,
- 0xae, 0xf3, 0xf0, 0x62, 0x73, 0xc0, 0xf0, 0x0a,
- 0x7a, 0x96, 0x93, 0x72, 0x89, 0x7e, 0x25, 0x57,
- 0xf8, 0xf7, 0xd5, 0x1e, 0xe5, 0xac, 0xd6, 0x38,
- 0x4f, 0xe8, 0x81, 0xd1, 0x53, 0x41, 0x07, 0x2d,
- 0x58, 0x34, 0x1c, 0xef, 0x74, 0x2e, 0x61, 0xca,
- 0xd3, 0xeb, 0xd6, 0x93, 0x0a, 0xf2, 0xf2, 0x86,
- 0x9c, 0xe3, 0x7a, 0x52, 0xf5, 0x42, 0xf1, 0x8b,
- 0x10, 0xf2, 0x25, 0x68, 0x7e, 0x61, 0xb1, 0x19,
- 0xcf, 0x8f, 0x5a, 0x53, 0xb7, 0x68, 0x4f, 0x1a,
- 0x71, 0xe9, 0x83, 0x91, 0x3a, 0x78, 0x0f, 0xf7,
- 0xd4, 0x74, 0xf5, 0x06, 0xd2, 0x88, 0xb0, 0x06,
- 0xe5, 0xc0, 0xfb, 0xb3, 0x91, 0xad, 0xc0, 0x84,
- 0x31, 0xf2, 0x3a, 0xcf, 0x63, 0xe6, 0x4a, 0xd3,
- 0x78, 0xbe, 0xde, 0x73, 0x3e, 0x02, 0x8e, 0xb8,
- 0x3a, 0xf6, 0x55, 0xa7, 0xf8, 0x5a, 0xb5, 0x0e,
- 0x0c, 0xc5, 0xe5, 0x66, 0xd5, 0xd2, 0x18, 0xf3,
- 0xef, 0xa5, 0xc9, 0x68, 0x69, 0xe0, 0xcd, 0x00,
- 0x33, 0x99, 0x6e, 0xea, 0xcb, 0x06, 0x7a, 0xe1,
- 0xe1, 0x19, 0x0b, 0xe7, 0x08, 0xcd, 0x09, 0x1b,
- 0x85, 0xec, 0xc4, 0xd4, 0x75, 0xf0, 0xd6, 0xfb,
- 0x84, 0x95, 0x07, 0x44, 0xca, 0xa5, 0x2a, 0x6c,
- 0xc2, 0x00, 0x58, 0x08, 0x87, 0x9e, 0x0a, 0xd4,
- 0x06, 0xe2, 0x91, 0x5f, 0xb7, 0x1b, 0x11, 0xfa,
- 0x85, 0xfc, 0x7c, 0xf2, 0x0f, 0x6e, 0x3c, 0x8a,
- 0xe1, 0x0f, 0xa0, 0x33, 0x84, 0xce, 0x81, 0x4d,
- 0x32, 0x4d, 0xeb, 0x41, 0xcf, 0x5a, 0x05, 0x60,
- 0x47, 0x6c, 0x2a, 0xc4, 0x17, 0xd5, 0x16, 0x3a,
- 0xe4, 0xe7, 0xab, 0x84, 0x94, 0x22, 0xff, 0x56,
- 0xb0, 0x0c, 0x92, 0x6c, 0x19, 0x11, 0x4c, 0xb3,
- 0xed, 0x58, 0x48, 0x84, 0x2a, 0xe2, 0x19, 0x2a,
- 0xe1, 0xc0, 0x56, 0x82, 0x3c, 0x83, 0xb4, 0x58,
- 0x2d, 0xf0, 0xb5, 0x1e, 0x76, 0x85, 0x51, 0xc2,
- 0xe4, 0x95, 0x27, 0x96, 0xd1, 0x90, 0xc3, 0x17,
- 0x75, 0xa1, 0xbb, 0x46, 0x5f, 0xa6, 0xf2, 0xef,
- 0x71, 0x56, 0x92, 0xc5, 0x8a, 0x85, 0x52, 0xe4,
- 0x63, 0x21, 0x6f, 0x55, 0x85, 0x2b, 0x6b, 0x0d,
- 0xc9, 0x92, 0x77, 0x67, 0xe3, 0xff, 0x2a, 0x2b,
- 0x90, 0x01, 0x3d, 0x74, 0x63, 0x04, 0x61, 0x3c,
- 0x8e, 0xf8, 0xfc, 0x04, 0xdd, 0x21, 0x85, 0x92,
- 0x1e, 0x4d, 0x51, 0x8d, 0xb5, 0x6b, 0xf1, 0xda,
- 0x96, 0xf5, 0x8e, 0x3c, 0x38, 0x5a, 0xac, 0x9b,
- 0xba, 0x0c, 0x84, 0x5d, 0x50, 0x12, 0xc7, 0xc5,
- 0x7a, 0xcb, 0xb1, 0xfa, 0x16, 0x93, 0xdf, 0x98,
- 0xda, 0x3f, 0x49, 0xa3, 0x94, 0x78, 0x70, 0xc7,
- 0x0b, 0xb6, 0x91, 0xa6, 0x16, 0x2e, 0xcf, 0xfd,
- 0x51, 0x6a, 0x5b, 0xad, 0x7a, 0xdd, 0xa9, 0x48,
- 0x48, 0xac, 0xd6, 0x45, 0xbc, 0x23, 0x31, 0x1d,
- 0x86, 0x54, 0x8a, 0x7f, 0x04, 0x97, 0x71, 0x9e,
- 0xbc, 0x2e, 0x6b, 0xd9, 0x33, 0xc8, 0x20, 0xc9,
- 0xe0, 0x25, 0x86, 0x59, 0x15, 0xcf, 0x63, 0xe5,
- 0x99, 0xf1, 0x24, 0xf1, 0xba, 0xc4, 0x15, 0x02,
- 0xe2, 0xdb, 0xfe, 0x4a, 0xf8, 0x3b, 0x91, 0x13,
- 0x8d, 0x03, 0x81, 0x9f, 0xb3, 0x3f, 0x04, 0x03,
- 0x58, 0xc0, 0xef, 0x27, 0x82, 0x14, 0xd2, 0x7f,
- 0x93, 0x70, 0xb7, 0xb2, 0x02, 0x21, 0xb3, 0x07,
- 0x7f, 0x1c, 0xef, 0x88, 0xee, 0x29, 0x7a, 0x0b,
- 0x3d, 0x75, 0x5a, 0x93, 0xfe, 0x7f, 0x14, 0xf7,
- 0x4e, 0x4b, 0x7f, 0x21, 0x02, 0xad, 0xf9, 0x43,
- 0x29, 0x1a, 0xe8, 0x1b, 0xf5, 0x32, 0xb2, 0x96,
- 0xe6, 0xe8, 0x96, 0x20, 0x9b, 0x96, 0x8e, 0x7b,
- 0xfe, 0xd8, 0xc9, 0x9c, 0x65, 0x16, 0xd6, 0x68,
- 0x95, 0xf8, 0x22, 0xe2, 0xae, 0x84, 0x03, 0xfd,
- 0x87, 0xa2, 0x72, 0x79, 0x74, 0x95, 0xfa, 0xe1,
- 0xfe, 0xd0, 0x4e, 0x3d, 0x39, 0x2e, 0x67, 0x55,
- 0x71, 0x6c, 0x89, 0x33, 0x49, 0x0c, 0x1b, 0x46,
- 0x92, 0x31, 0x6f, 0xa6, 0xf0, 0x09, 0xbd, 0x2d,
- 0xe2, 0xca, 0xda, 0x18, 0x33, 0xce, 0x67, 0x37,
- 0xfd, 0x6f, 0xcb, 0x9d, 0xbd, 0x42, 0xbc, 0xb2,
- 0x9c, 0x28, 0xcd, 0x65, 0x3c, 0x61, 0xbc, 0xde,
- 0x9d, 0xe1, 0x2a, 0x3e, 0xbf, 0xee, 0x3c, 0xcb,
- 0xb1, 0x50, 0xa9, 0x2c, 0xbe, 0xb5, 0x43, 0xd0,
- 0xec, 0x29, 0xf9, 0x16, 0x6f, 0x31, 0xd9, 0x9b,
- 0x92, 0xb1, 0x32, 0xae, 0x0f, 0xb6, 0x9d, 0x0e,
- 0x25, 0x7f, 0x89, 0x1f, 0x1d, 0x01, 0x68, 0xab,
- 0x3d, 0xd1, 0x74, 0x5b, 0x4c, 0x38, 0x7f, 0x3d,
- 0x33, 0xa5, 0xa2, 0x9f, 0xda, 0x84, 0xa5, 0x82,
- 0x2d, 0x16, 0x66, 0x46, 0x08, 0x30, 0x14, 0x48,
- 0x5e, 0xca, 0xe3, 0xf4, 0x8c, 0xcb, 0x32, 0xc6,
- 0xf1, 0x43, 0x62, 0xc6, 0xef, 0x16, 0xfa, 0x43,
- 0xae, 0x9c, 0x53, 0xe3, 0x49, 0x45, 0x80, 0xfd,
- 0x1d, 0x8c, 0xa9, 0x6d, 0x77, 0x76, 0xaa, 0x40,
- 0xc4, 0x4e, 0x7b, 0x78, 0x6b, 0xe0, 0x1d, 0xce,
- 0x56, 0x3d, 0xf0, 0x11, 0xfe, 0x4f, 0x6a, 0x6d,
- 0x0f, 0x4f, 0x90, 0x38, 0x92, 0x17, 0xfa, 0x56,
- 0x12, 0xa6, 0xa1, 0x0a, 0xea, 0x2f, 0x50, 0xf9,
- 0x60, 0x66, 0x6c, 0x7d, 0x5a, 0x08, 0x8e, 0x3c,
- 0xf3, 0xf0, 0x33, 0x02, 0x11, 0x02, 0xfe, 0x4c,
- 0x56, 0x2b, 0x9f, 0x0c, 0xbd, 0x65, 0x8a, 0x83,
- 0xde, 0x7c, 0x05, 0x26, 0x93, 0x19, 0xcc, 0xf3,
- 0x71, 0x0e, 0xad, 0x2f, 0xb3, 0xc9, 0x38, 0x50,
- 0x64, 0xd5, 0x4c, 0x60, 0x5f, 0x02, 0x13, 0x34,
- 0xc9, 0x75, 0xc4, 0x60, 0xab, 0x2e, 0x17, 0x7d
-};
-
-static const uint8_t AES_CBC_ciphertext_2048B[] = {
- 0x8b, 0x55, 0xbd, 0xfd, 0x2b, 0x35, 0x76, 0x5c,
- 0xd1, 0x90, 0xd7, 0x6a, 0x63, 0x1e, 0x39, 0x71,
- 0x0d, 0x5c, 0xd8, 0x03, 0x00, 0x75, 0xf1, 0x07,
- 0x03, 0x8d, 0x76, 0xeb, 0x3b, 0x00, 0x1e, 0x33,
- 0x88, 0xfc, 0x8f, 0x08, 0x4d, 0x33, 0xf1, 0x3c,
- 0xee, 0xd0, 0x5d, 0x19, 0x8b, 0x3c, 0x50, 0x86,
- 0xfd, 0x8d, 0x58, 0x21, 0xb4, 0xae, 0x0f, 0x81,
- 0xe9, 0x9f, 0xc9, 0xc0, 0x90, 0xf7, 0x04, 0x6f,
- 0x39, 0x1d, 0x8a, 0x3f, 0x8d, 0x32, 0x23, 0xb5,
- 0x1f, 0xcc, 0x8a, 0x12, 0x2d, 0x46, 0x82, 0x5e,
- 0x6a, 0x34, 0x8c, 0xb1, 0x93, 0x70, 0x3b, 0xde,
- 0x55, 0xaf, 0x16, 0x35, 0x99, 0x84, 0xd5, 0x88,
- 0xc9, 0x54, 0xb1, 0xb2, 0xd3, 0xeb, 0x9e, 0x55,
- 0x9a, 0xa9, 0xa7, 0xf5, 0xda, 0x29, 0xcf, 0xe1,
- 0x98, 0x64, 0x45, 0x77, 0xf2, 0x12, 0x69, 0x8f,
- 0x78, 0xd8, 0x82, 0x41, 0xb2, 0x9f, 0xe2, 0x1c,
- 0x63, 0x9b, 0x24, 0x81, 0x67, 0x95, 0xa2, 0xff,
- 0x26, 0x9d, 0x65, 0x48, 0x61, 0x30, 0x66, 0x41,
- 0x68, 0x84, 0xbb, 0x59, 0x14, 0x8e, 0x9a, 0x62,
- 0xb6, 0xca, 0xda, 0xbe, 0x7c, 0x41, 0x52, 0x6e,
- 0x1b, 0x86, 0xbf, 0x08, 0xeb, 0x37, 0x84, 0x60,
- 0xe4, 0xc4, 0x1e, 0xa8, 0x4c, 0x84, 0x60, 0x2f,
- 0x70, 0x90, 0xf2, 0x26, 0xe7, 0x65, 0x0c, 0xc4,
- 0x58, 0x36, 0x8e, 0x4d, 0xdf, 0xff, 0x9a, 0x39,
- 0x93, 0x01, 0xcf, 0x6f, 0x6d, 0xde, 0xef, 0x79,
- 0xb0, 0xce, 0xe2, 0x98, 0xdb, 0x85, 0x8d, 0x62,
- 0x9d, 0xb9, 0x63, 0xfd, 0xf0, 0x35, 0xb5, 0xa9,
- 0x1b, 0xf9, 0xe5, 0xd4, 0x2e, 0x22, 0x2d, 0xcc,
- 0x42, 0xbf, 0x0e, 0x51, 0xf7, 0x15, 0x07, 0x32,
- 0x75, 0x5b, 0x74, 0xbb, 0x00, 0xef, 0xd4, 0x66,
- 0x8b, 0xad, 0x71, 0x53, 0x94, 0xd7, 0x7d, 0x2c,
- 0x40, 0x3e, 0x69, 0xa0, 0x4c, 0x86, 0x5e, 0x06,
- 0xed, 0xdf, 0x22, 0xe2, 0x24, 0x25, 0x4e, 0x9b,
- 0x5f, 0x49, 0x74, 0xba, 0xed, 0xb1, 0xa6, 0xeb,
- 0xae, 0x3f, 0xc6, 0x9e, 0x0b, 0x29, 0x28, 0x9a,
- 0xb6, 0xb2, 0x74, 0x58, 0xec, 0xa6, 0x4a, 0xed,
- 0xe5, 0x10, 0x00, 0x85, 0xe1, 0x63, 0x41, 0x61,
- 0x30, 0x7c, 0x97, 0xcf, 0x75, 0xcf, 0xb6, 0xf3,
- 0xf7, 0xda, 0x35, 0x3f, 0x85, 0x8c, 0x64, 0xca,
- 0xb7, 0xea, 0x7f, 0xe4, 0xa3, 0x4d, 0x30, 0x84,
- 0x8c, 0x9c, 0x80, 0x5a, 0x50, 0xa5, 0x64, 0xae,
- 0x26, 0xd3, 0xb5, 0x01, 0x73, 0x36, 0x8a, 0x92,
- 0x49, 0xc4, 0x1a, 0x94, 0x81, 0x9d, 0xf5, 0x6c,
- 0x50, 0xe1, 0x58, 0x0b, 0x75, 0xdd, 0x6b, 0x6a,
- 0xca, 0x69, 0xea, 0xc3, 0x33, 0x90, 0x9f, 0x3b,
- 0x65, 0x5d, 0x5e, 0xee, 0x31, 0xb7, 0x32, 0xfd,
- 0x56, 0x83, 0xb6, 0xfb, 0xa8, 0x04, 0xfc, 0x1e,
- 0x11, 0xfb, 0x02, 0x23, 0x53, 0x49, 0x45, 0xb1,
- 0x07, 0xfc, 0xba, 0xe7, 0x5f, 0x5d, 0x2d, 0x7f,
- 0x9e, 0x46, 0xba, 0xe9, 0xb0, 0xdb, 0x32, 0x04,
- 0xa4, 0xa7, 0x98, 0xab, 0x91, 0xcd, 0x02, 0x05,
- 0xf5, 0x74, 0x31, 0x98, 0x83, 0x3d, 0x33, 0x11,
- 0x0e, 0xe3, 0x8d, 0xa8, 0xc9, 0x0e, 0xf3, 0xb9,
- 0x47, 0x67, 0xe9, 0x79, 0x2b, 0x34, 0xcd, 0x9b,
- 0x45, 0x75, 0x29, 0xf0, 0xbf, 0xcc, 0xda, 0x3a,
- 0x91, 0xb2, 0x15, 0x27, 0x7a, 0xe5, 0xf5, 0x6a,
- 0x5e, 0xbe, 0x2c, 0x98, 0xe8, 0x40, 0x96, 0x4f,
- 0x8a, 0x09, 0xfd, 0xf6, 0xb2, 0xe7, 0x45, 0xb6,
- 0x08, 0xc1, 0x69, 0xe1, 0xb3, 0xc4, 0x24, 0x34,
- 0x07, 0x85, 0xd5, 0xa9, 0x78, 0xca, 0xfa, 0x4b,
- 0x01, 0x19, 0x4d, 0x95, 0xdc, 0xa5, 0xc1, 0x9c,
- 0xec, 0x27, 0x5b, 0xa6, 0x54, 0x25, 0xbd, 0xc8,
- 0x0a, 0xb7, 0x11, 0xfb, 0x4e, 0xeb, 0x65, 0x2e,
- 0xe1, 0x08, 0x9c, 0x3a, 0x45, 0x44, 0x33, 0xef,
- 0x0d, 0xb9, 0xff, 0x3e, 0x68, 0x9c, 0x61, 0x2b,
- 0x11, 0xb8, 0x5c, 0x47, 0x0f, 0x94, 0xf2, 0xf8,
- 0x0b, 0xbb, 0x99, 0x18, 0x85, 0xa3, 0xba, 0x44,
- 0xf3, 0x79, 0xb3, 0x63, 0x2c, 0x1f, 0x2a, 0x35,
- 0x3b, 0x23, 0x98, 0xab, 0xf4, 0x16, 0x36, 0xf8,
- 0xde, 0x86, 0xa4, 0xd4, 0x75, 0xff, 0x51, 0xf9,
- 0xeb, 0x42, 0x5f, 0x55, 0xe2, 0xbe, 0xd1, 0x5b,
- 0xb5, 0x38, 0xeb, 0xb4, 0x4d, 0xec, 0xec, 0x99,
- 0xe1, 0x39, 0x43, 0xaa, 0x64, 0xf7, 0xc9, 0xd8,
- 0xf2, 0x9a, 0x71, 0x43, 0x39, 0x17, 0xe8, 0xa8,
- 0xa2, 0xe2, 0xa4, 0x2c, 0x18, 0x11, 0x49, 0xdf,
- 0x18, 0xdd, 0x85, 0x6e, 0x65, 0x96, 0xe2, 0xba,
- 0xa1, 0x0a, 0x2c, 0xca, 0xdc, 0x5f, 0xe4, 0xf4,
- 0x35, 0x03, 0xb2, 0xa9, 0xda, 0xcf, 0xb7, 0x6d,
- 0x65, 0x82, 0x82, 0x67, 0x9d, 0x0e, 0xf3, 0xe8,
- 0x85, 0x6c, 0x69, 0xb8, 0x4c, 0xa6, 0xc6, 0x2e,
- 0x40, 0xb5, 0x54, 0x28, 0x95, 0xe4, 0x57, 0xe0,
- 0x5b, 0xf8, 0xde, 0x59, 0xe0, 0xfd, 0x89, 0x48,
- 0xac, 0x56, 0x13, 0x54, 0xb9, 0x1b, 0xf5, 0x59,
- 0x97, 0xb6, 0xb3, 0xe8, 0xac, 0x2d, 0xfc, 0xd2,
- 0xea, 0x57, 0x96, 0x57, 0xa8, 0x26, 0x97, 0x2c,
- 0x01, 0x89, 0x56, 0xea, 0xec, 0x8c, 0x53, 0xd5,
- 0xd7, 0x9e, 0xc9, 0x98, 0x0b, 0xad, 0x03, 0x75,
- 0xa0, 0x6e, 0x98, 0x8b, 0x97, 0x8d, 0x8d, 0x85,
- 0x7d, 0x74, 0xa7, 0x2d, 0xde, 0x67, 0x0c, 0xcd,
- 0x54, 0xb8, 0x15, 0x7b, 0xeb, 0xf5, 0x84, 0xb9,
- 0x78, 0xab, 0xd8, 0x68, 0x91, 0x1f, 0x6a, 0xa6,
- 0x28, 0x22, 0xf7, 0x00, 0x49, 0x00, 0xbe, 0x41,
- 0x71, 0x0a, 0xf5, 0xe7, 0x9f, 0xb4, 0x11, 0x41,
- 0x3f, 0xcd, 0xa9, 0xa9, 0x01, 0x8b, 0x6a, 0xeb,
- 0x54, 0x4c, 0x58, 0x92, 0x68, 0x02, 0x0e, 0xe9,
- 0xed, 0x65, 0x4c, 0xfb, 0x95, 0x48, 0x58, 0xa2,
- 0xaa, 0x57, 0x69, 0x13, 0x82, 0x0c, 0x2c, 0x4b,
- 0x5d, 0x4e, 0x18, 0x30, 0xef, 0x1c, 0xb1, 0x9d,
- 0x05, 0x05, 0x02, 0x1c, 0x97, 0xc9, 0x48, 0xfe,
- 0x5e, 0x7b, 0x77, 0xa3, 0x1f, 0x2a, 0x81, 0x42,
- 0xf0, 0x4b, 0x85, 0x12, 0x9c, 0x1f, 0x44, 0xb1,
- 0x14, 0x91, 0x92, 0x65, 0x77, 0xb1, 0x87, 0xa2,
- 0xfc, 0xa4, 0xe7, 0xd2, 0x9b, 0xf2, 0x17, 0xf0,
- 0x30, 0x1c, 0x8d, 0x33, 0xbc, 0x25, 0x28, 0x48,
- 0xfd, 0x30, 0x79, 0x0a, 0x99, 0x3e, 0xb4, 0x0f,
- 0x1e, 0xa6, 0x68, 0x76, 0x19, 0x76, 0x29, 0xac,
- 0x5d, 0xb8, 0x1e, 0x42, 0xd6, 0x85, 0x04, 0xbf,
- 0x64, 0x1c, 0x2d, 0x53, 0xe9, 0x92, 0x78, 0xf8,
- 0xc3, 0xda, 0x96, 0x92, 0x10, 0x6f, 0x45, 0x85,
- 0xaf, 0x5e, 0xcc, 0xa8, 0xc0, 0xc6, 0x2e, 0x73,
- 0x51, 0x3f, 0x5e, 0xd7, 0x52, 0x33, 0x71, 0x12,
- 0x6d, 0x85, 0xee, 0xea, 0x85, 0xa8, 0x48, 0x2b,
- 0x40, 0x64, 0x6d, 0x28, 0x73, 0x16, 0xd7, 0x82,
- 0xd9, 0x90, 0xed, 0x1f, 0xa7, 0x5c, 0xb1, 0x5c,
- 0x27, 0xb9, 0x67, 0x8b, 0xb4, 0x17, 0x13, 0x83,
- 0x5f, 0x09, 0x72, 0x0a, 0xd7, 0xa0, 0xec, 0x81,
- 0x59, 0x19, 0xb9, 0xa6, 0x5a, 0x37, 0x34, 0x14,
- 0x47, 0xf6, 0xe7, 0x6c, 0xd2, 0x09, 0x10, 0xe7,
- 0xdd, 0xbb, 0x02, 0xd1, 0x28, 0xfa, 0x01, 0x2c,
- 0x93, 0x64, 0x2e, 0x1b, 0x4c, 0x02, 0x52, 0xcb,
- 0x07, 0xa1, 0xb6, 0x46, 0x02, 0x80, 0xd9, 0x8f,
- 0x5c, 0x62, 0xbe, 0x78, 0x9e, 0x75, 0xc4, 0x97,
- 0x91, 0x39, 0x12, 0x65, 0xb9, 0x3b, 0xc2, 0xd1,
- 0xaf, 0xf2, 0x1f, 0x4e, 0x4d, 0xd1, 0xf0, 0x9f,
- 0xb7, 0x12, 0xfd, 0xe8, 0x75, 0x18, 0xc0, 0x9d,
- 0x8c, 0x70, 0xff, 0x77, 0x05, 0xb6, 0x1a, 0x1f,
- 0x96, 0x48, 0xf6, 0xfe, 0xd5, 0x5d, 0x98, 0xa5,
- 0x72, 0x1c, 0x84, 0x76, 0x3e, 0xb8, 0x87, 0x37,
- 0xdd, 0xd4, 0x3a, 0x45, 0xdd, 0x09, 0xd8, 0xe7,
- 0x09, 0x2f, 0x3e, 0x33, 0x9e, 0x7b, 0x8c, 0xe4,
- 0x85, 0x12, 0x4e, 0xf8, 0x06, 0xb7, 0xb1, 0x85,
- 0x24, 0x96, 0xd8, 0xfe, 0x87, 0x92, 0x81, 0xb1,
- 0xa3, 0x38, 0xb9, 0x56, 0xe1, 0xf6, 0x36, 0x41,
- 0xbb, 0xd6, 0x56, 0x69, 0x94, 0x57, 0xb3, 0xa4,
- 0xca, 0xa4, 0xe1, 0x02, 0x3b, 0x96, 0x71, 0xe0,
- 0xb2, 0x2f, 0x85, 0x48, 0x1b, 0x4a, 0x41, 0x80,
- 0x4b, 0x9c, 0xe0, 0xc9, 0x39, 0xb8, 0xb1, 0xca,
- 0x64, 0x77, 0x46, 0x58, 0xe6, 0x84, 0xd5, 0x2b,
- 0x65, 0xce, 0xe9, 0x09, 0xa3, 0xaa, 0xfb, 0x83,
- 0xa9, 0x28, 0x68, 0xfd, 0xcd, 0xfd, 0x76, 0x83,
- 0xe1, 0x20, 0x22, 0x77, 0x3a, 0xa3, 0xb2, 0x93,
- 0x14, 0x91, 0xfc, 0xe2, 0x17, 0x63, 0x2b, 0xa6,
- 0x29, 0x38, 0x7b, 0x9b, 0x8b, 0x15, 0x77, 0xd6,
- 0xaa, 0x92, 0x51, 0x53, 0x50, 0xff, 0xa0, 0x35,
- 0xa0, 0x59, 0x7d, 0xf0, 0x11, 0x23, 0x49, 0xdf,
- 0x5a, 0x21, 0xc2, 0xfe, 0x35, 0xa0, 0x1d, 0xe2,
- 0xae, 0xa2, 0x8a, 0x61, 0x5b, 0xf7, 0xf1, 0x1c,
- 0x1c, 0xec, 0xc4, 0xf6, 0xdc, 0xaa, 0xc8, 0xc2,
- 0xe5, 0xa1, 0x2e, 0x14, 0xe5, 0xc6, 0xc9, 0x73,
- 0x03, 0x78, 0xeb, 0xed, 0xe0, 0x3e, 0xc5, 0xf4,
- 0xf1, 0x50, 0xb2, 0x01, 0x91, 0x96, 0xf5, 0xbb,
- 0xe1, 0x32, 0xcd, 0xa8, 0x66, 0xbf, 0x73, 0x85,
- 0x94, 0xd6, 0x7e, 0x68, 0xc5, 0xe4, 0xed, 0xd5,
- 0xe3, 0x67, 0x4c, 0xa5, 0xb3, 0x1f, 0xdf, 0xf8,
- 0xb3, 0x73, 0x5a, 0xac, 0xeb, 0x46, 0x16, 0x24,
- 0xab, 0xca, 0xa4, 0xdd, 0x87, 0x0e, 0x24, 0x83,
- 0x32, 0x04, 0x4c, 0xd8, 0xda, 0x7d, 0xdc, 0xe3,
- 0x01, 0x93, 0xf3, 0xc1, 0x5b, 0xbd, 0xc3, 0x1d,
- 0x40, 0x62, 0xde, 0x94, 0x03, 0x85, 0x91, 0x2a,
- 0xa0, 0x25, 0x10, 0xd3, 0x32, 0x9f, 0x93, 0x00,
- 0xa7, 0x8a, 0xfa, 0x77, 0x7c, 0xaf, 0x4d, 0xc8,
- 0x7a, 0xf3, 0x16, 0x2b, 0xba, 0xeb, 0x74, 0x51,
- 0xb8, 0xdd, 0x32, 0xad, 0x68, 0x7d, 0xdd, 0xca,
- 0x60, 0x98, 0xc9, 0x9b, 0xb6, 0x5d, 0x4d, 0x3a,
- 0x66, 0x8a, 0xbe, 0x05, 0xf9, 0x0c, 0xc5, 0xba,
- 0x52, 0x82, 0x09, 0x1f, 0x5a, 0x66, 0x89, 0x69,
- 0xa3, 0x5d, 0x93, 0x50, 0x7d, 0x44, 0xc3, 0x2a,
- 0xb8, 0xab, 0xec, 0xa6, 0x5a, 0xae, 0x4a, 0x6a,
- 0xcd, 0xfd, 0xb6, 0xff, 0x3d, 0x98, 0x05, 0xd9,
- 0x5b, 0x29, 0xc4, 0x6f, 0xe0, 0x76, 0xe2, 0x3f,
- 0xec, 0xd7, 0xa4, 0x91, 0x63, 0xf5, 0x4e, 0x4b,
- 0xab, 0x20, 0x8c, 0x3a, 0x41, 0xed, 0x8b, 0x4b,
- 0xb9, 0x01, 0x21, 0xc0, 0x6d, 0xfd, 0x70, 0x5b,
- 0x20, 0x92, 0x41, 0x89, 0x74, 0xb7, 0xe9, 0x8b,
- 0xfc, 0x6d, 0x17, 0x3f, 0x7f, 0x89, 0x3d, 0x6b,
- 0x8f, 0xbc, 0xd2, 0x57, 0xe9, 0xc9, 0x6e, 0xa7,
- 0x19, 0x26, 0x18, 0xad, 0xef, 0xb5, 0x87, 0xbf,
- 0xb8, 0xa8, 0xd6, 0x7d, 0xdd, 0x5f, 0x94, 0x54,
- 0x09, 0x92, 0x2b, 0xf5, 0x04, 0xf7, 0x36, 0x69,
- 0x8e, 0xf4, 0xdc, 0x1d, 0x6e, 0x55, 0xbb, 0xe9,
- 0x13, 0x05, 0x83, 0x35, 0x9c, 0xed, 0xcf, 0x8c,
- 0x26, 0x8c, 0x7b, 0xc7, 0x0b, 0xba, 0xfd, 0xe2,
- 0x84, 0x5c, 0x2a, 0x79, 0x43, 0x99, 0xb2, 0xc3,
- 0x82, 0x87, 0xc8, 0xcd, 0x37, 0x6d, 0xa1, 0x2b,
- 0x39, 0xb2, 0x38, 0x99, 0xd9, 0xfc, 0x02, 0x15,
- 0x55, 0x21, 0x62, 0x59, 0xeb, 0x00, 0x86, 0x08,
- 0x20, 0xbe, 0x1a, 0x62, 0x4d, 0x7e, 0xdf, 0x68,
- 0x73, 0x5b, 0x5f, 0xaf, 0x84, 0x96, 0x2e, 0x1f,
- 0x6b, 0x03, 0xc9, 0xa6, 0x75, 0x18, 0xe9, 0xd4,
- 0xbd, 0xc8, 0xec, 0x9a, 0x5a, 0xb3, 0x99, 0xab,
- 0x5f, 0x7c, 0x08, 0x7f, 0x69, 0x4d, 0x52, 0xa2,
- 0x30, 0x17, 0x3b, 0x16, 0x15, 0x1b, 0x11, 0x62,
- 0x3e, 0x80, 0x4b, 0x85, 0x7c, 0x9c, 0xd1, 0x3a,
- 0x13, 0x01, 0x5e, 0x45, 0xf1, 0xc8, 0x5f, 0xcd,
- 0x0e, 0x21, 0xf5, 0x82, 0xd4, 0x7b, 0x5c, 0x45,
- 0x27, 0x6b, 0xef, 0xfe, 0xb8, 0xc0, 0x6f, 0xdc,
- 0x60, 0x7b, 0xe4, 0xd5, 0x75, 0x71, 0xe6, 0xe8,
- 0x7d, 0x6b, 0x6d, 0x80, 0xaf, 0x76, 0x41, 0x58,
- 0xb7, 0xac, 0xb7, 0x13, 0x2f, 0x81, 0xcc, 0xf9,
- 0x19, 0x97, 0xe8, 0xee, 0x40, 0x91, 0xfc, 0x89,
- 0x13, 0x1e, 0x67, 0x9a, 0xdb, 0x8f, 0x8f, 0xc7,
- 0x4a, 0xc9, 0xaf, 0x2f, 0x67, 0x01, 0x3c, 0xb8,
- 0xa8, 0x3e, 0x78, 0x93, 0x1b, 0xdf, 0xbb, 0x34,
- 0x0b, 0x1a, 0xfa, 0xc2, 0x2d, 0xc5, 0x1c, 0xec,
- 0x97, 0x4f, 0x48, 0x41, 0x15, 0x0e, 0x75, 0xed,
- 0x66, 0x8c, 0x17, 0x7f, 0xb1, 0x48, 0x13, 0xc1,
- 0xfb, 0x60, 0x06, 0xf9, 0x72, 0x41, 0x3e, 0xcf,
- 0x6e, 0xb6, 0xc8, 0xeb, 0x4b, 0x5a, 0xd2, 0x0c,
- 0x28, 0xda, 0x02, 0x7a, 0x46, 0x21, 0x42, 0xb5,
- 0x34, 0xda, 0xcb, 0x5e, 0xbd, 0x66, 0x5c, 0xca,
- 0xff, 0x52, 0x43, 0x89, 0xf9, 0x10, 0x9a, 0x9e,
- 0x9b, 0xe3, 0xb0, 0x51, 0xe9, 0xf3, 0x0a, 0x35,
- 0x77, 0x54, 0xcc, 0xac, 0xa6, 0xf1, 0x2e, 0x36,
- 0x89, 0xac, 0xc5, 0xc6, 0x62, 0x5a, 0xc0, 0x6d,
- 0xc4, 0xe1, 0xf7, 0x64, 0x30, 0xff, 0x11, 0x40,
- 0x13, 0x89, 0xd8, 0xd7, 0x73, 0x3f, 0x93, 0x08,
- 0x68, 0xab, 0x66, 0x09, 0x1a, 0xea, 0x78, 0xc9,
- 0x52, 0xf2, 0xfd, 0x93, 0x1b, 0x94, 0xbe, 0x5c,
- 0xe5, 0x00, 0x6e, 0x00, 0xb9, 0xea, 0x27, 0xaa,
- 0xb3, 0xee, 0xe3, 0xc8, 0x6a, 0xb0, 0xc1, 0x8e,
- 0x9b, 0x54, 0x40, 0x10, 0x96, 0x06, 0xe8, 0xb3,
- 0xf5, 0x55, 0x77, 0xd7, 0x5c, 0x94, 0xc1, 0x74,
- 0xf3, 0x07, 0x64, 0xac, 0x1c, 0xde, 0xc7, 0x22,
- 0xb0, 0xbf, 0x2a, 0x5a, 0xc0, 0x8f, 0x8a, 0x83,
- 0x50, 0xc2, 0x5e, 0x97, 0xa0, 0xbe, 0x49, 0x7e,
- 0x47, 0xaf, 0xa7, 0x20, 0x02, 0x35, 0xa4, 0x57,
- 0xd9, 0x26, 0x63, 0xdb, 0xf1, 0x34, 0x42, 0x89,
- 0x36, 0xd1, 0x77, 0x6f, 0xb1, 0xea, 0x79, 0x7e,
- 0x95, 0x10, 0x5a, 0xee, 0xa3, 0xae, 0x6f, 0xba,
- 0xa9, 0xef, 0x5a, 0x7e, 0x34, 0x03, 0x04, 0x07,
- 0x92, 0xd6, 0x07, 0x79, 0xaa, 0x14, 0x90, 0x97,
- 0x05, 0x4d, 0xa6, 0x27, 0x10, 0x5c, 0x25, 0x24,
- 0xcb, 0xcc, 0xf6, 0x77, 0x9e, 0x43, 0x23, 0xd4,
- 0x98, 0xef, 0x22, 0xa8, 0xad, 0xf2, 0x26, 0x08,
- 0x59, 0x69, 0xa4, 0xc3, 0x97, 0xe0, 0x5c, 0x6f,
- 0xeb, 0x3d, 0xd4, 0x62, 0x6e, 0x80, 0x61, 0x02,
- 0xf4, 0xfc, 0x94, 0x79, 0xbb, 0x4e, 0x6d, 0xd7,
- 0x30, 0x5b, 0x10, 0x11, 0x5a, 0x3d, 0xa7, 0x50,
- 0x1d, 0x9a, 0x13, 0x5f, 0x4f, 0xa8, 0xa7, 0xb6,
- 0x39, 0xc7, 0xea, 0xe6, 0x19, 0x61, 0x69, 0xc7,
- 0x9a, 0x3a, 0xeb, 0x9d, 0xdc, 0xf7, 0x06, 0x37,
- 0xbd, 0xac, 0xe3, 0x18, 0xff, 0xfe, 0x11, 0xdb,
- 0x67, 0x42, 0xb4, 0xea, 0xa8, 0xbd, 0xb0, 0x76,
- 0xd2, 0x74, 0x32, 0xc2, 0xa4, 0x9c, 0xe7, 0x60,
- 0xc5, 0x30, 0x9a, 0x57, 0x66, 0xcd, 0x0f, 0x02,
- 0x4c, 0xea, 0xe9, 0xd3, 0x2a, 0x5c, 0x09, 0xc2,
- 0xff, 0x6a, 0xde, 0x5d, 0xb7, 0xe9, 0x75, 0x6b,
- 0x29, 0x94, 0xd6, 0xf7, 0xc3, 0xdf, 0xfb, 0x70,
- 0xec, 0xb5, 0x8c, 0xb0, 0x78, 0x7a, 0xee, 0x52,
- 0x5f, 0x8c, 0xae, 0x85, 0xe5, 0x98, 0xa2, 0xb7,
- 0x7c, 0x02, 0x2a, 0xcc, 0x9e, 0xde, 0x99, 0x5f,
- 0x84, 0x20, 0xbb, 0xdc, 0xf2, 0xd2, 0x13, 0x46,
- 0x3c, 0xd6, 0x4d, 0xe7, 0x50, 0xef, 0x55, 0xc3,
- 0x96, 0x9f, 0xec, 0x6c, 0xd8, 0xe2, 0xea, 0xed,
- 0xc7, 0x33, 0xc9, 0xb3, 0x1c, 0x4f, 0x1d, 0x83,
- 0x1d, 0xe4, 0xdd, 0xb2, 0x24, 0x8f, 0xf9, 0xf5
-};
-
-
-static const uint8_t HMAC_SHA256_ciphertext_64B_digest[] = {
- 0xc5, 0x6d, 0x4f, 0x29, 0xf4, 0xd2, 0xcc, 0x87,
- 0x3c, 0x81, 0x02, 0x6d, 0x38, 0x7a, 0x67, 0x3e,
- 0x95, 0x9c, 0x5c, 0x8f, 0xda, 0x5c, 0x06, 0xe0,
- 0x65, 0xf1, 0x6c, 0x51, 0x52, 0x49, 0x3e, 0x5f
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_128B_digest[] = {
- 0x76, 0x64, 0x2d, 0x69, 0x71, 0x5d, 0x6a, 0xd8,
- 0x9f, 0x74, 0x11, 0x2f, 0x58, 0xe0, 0x4a, 0x2f,
- 0x6c, 0x88, 0x5e, 0x4d, 0x9c, 0x79, 0x83, 0x1c,
- 0x8a, 0x14, 0xd0, 0x07, 0xfb, 0xbf, 0x6c, 0x8f
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_256B_digest[] = {
- 0x05, 0xa7, 0x44, 0xcd, 0x91, 0x8c, 0x95, 0xcf,
- 0x7b, 0x8f, 0xd3, 0x90, 0x86, 0x7e, 0x7b, 0xb9,
- 0x05, 0xd6, 0x6e, 0x7a, 0xc1, 0x7b, 0x26, 0xff,
- 0xd3, 0x4b, 0xe0, 0x22, 0x8b, 0xa8, 0x47, 0x52
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_512B_digest[] = {
- 0x08, 0xb7, 0x29, 0x54, 0x18, 0x7e, 0x97, 0x49,
- 0xc6, 0x7c, 0x9f, 0x94, 0xa5, 0x4f, 0xa2, 0x25,
- 0xd0, 0xe2, 0x30, 0x7b, 0xad, 0x93, 0xc9, 0x12,
- 0x0f, 0xf0, 0xf0, 0x71, 0xc2, 0xf6, 0x53, 0x8f
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_768B_digest[] = {
- 0xe4, 0x3e, 0x73, 0x93, 0x03, 0xaf, 0x6f, 0x9c,
- 0xca, 0x57, 0x3b, 0x4a, 0x6e, 0x83, 0x58, 0xf5,
- 0x66, 0xc2, 0xb4, 0xa7, 0xe0, 0xee, 0x63, 0x6b,
- 0x48, 0xb7, 0x50, 0x45, 0x69, 0xdf, 0x5c, 0x5b
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_1024B_digest[] = {
- 0x03, 0xb9, 0x96, 0x26, 0xdc, 0x1c, 0xab, 0xe2,
- 0xf5, 0x70, 0x55, 0x15, 0x67, 0x6e, 0x48, 0x11,
- 0xe7, 0x67, 0xea, 0xfa, 0x5c, 0x6b, 0x28, 0x22,
- 0xc9, 0x0e, 0x67, 0x04, 0xb3, 0x71, 0x7f, 0x88
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_1280B_digest[] = {
- 0x01, 0x91, 0xb8, 0x78, 0xd3, 0x21, 0x74, 0xa5,
- 0x1c, 0x8b, 0xd4, 0xd2, 0xc0, 0x49, 0xd7, 0xd2,
- 0x16, 0x46, 0x66, 0x85, 0x50, 0x6d, 0x08, 0xcc,
- 0xc7, 0x0a, 0xa3, 0x71, 0xcc, 0xde, 0xee, 0xdc
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_1536B_digest[] = {
- 0xf2, 0xe5, 0xe9, 0x57, 0x53, 0xd7, 0x69, 0x28,
- 0x7b, 0x69, 0xb5, 0x49, 0xa3, 0x31, 0x56, 0x5f,
- 0xa4, 0xe9, 0x87, 0x26, 0x2f, 0xe0, 0x2d, 0xd6,
- 0x08, 0x44, 0x01, 0x71, 0x0c, 0x93, 0x85, 0x84
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_1792B_digest[] = {
- 0xf6, 0x57, 0x62, 0x01, 0xbf, 0x2d, 0xea, 0x4a,
- 0xef, 0x43, 0x85, 0x60, 0x18, 0xdf, 0x8b, 0xb4,
- 0x60, 0xc0, 0xfd, 0x2f, 0x90, 0x15, 0xe6, 0x91,
- 0x56, 0x61, 0x68, 0x7f, 0x5e, 0x92, 0xa8, 0xdd
-};
-
-static const uint8_t HMAC_SHA256_ciphertext_2048B_digest[] = {
- 0x81, 0x1a, 0x29, 0xbc, 0x6b, 0x9f, 0xbb, 0xb8,
- 0xef, 0x71, 0x7b, 0x1f, 0x6f, 0xd4, 0x7e, 0x68,
- 0x3a, 0x9c, 0xb9, 0x98, 0x22, 0x81, 0xfa, 0x95,
- 0xee, 0xbc, 0x7f, 0x23, 0x29, 0x88, 0x76, 0xb8
-};
-
-struct crypto_data_params {
- const char *name;
- uint16_t length;
- const char *plaintext;
- struct crypto_expected_output {
- const uint8_t *ciphertext;
- const uint8_t *digest;
- } expected;
-};
-
-#define MAX_PACKET_SIZE_INDEX 10
-
-struct crypto_data_params aes_cbc_hmac_sha256_output[MAX_PACKET_SIZE_INDEX] = {
- { "64B", 64, &plaintext_quote[sizeof(plaintext_quote) - 1 - 64],
- { AES_CBC_ciphertext_64B, HMAC_SHA256_ciphertext_64B_digest } },
- { "128B", 128, &plaintext_quote[sizeof(plaintext_quote) - 1 - 128],
- { AES_CBC_ciphertext_128B, HMAC_SHA256_ciphertext_128B_digest } },
- { "256B", 256, &plaintext_quote[sizeof(plaintext_quote) - 1 - 256],
- { AES_CBC_ciphertext_256B, HMAC_SHA256_ciphertext_256B_digest } },
- { "512B", 512, &plaintext_quote[sizeof(plaintext_quote) - 1 - 512],
- { AES_CBC_ciphertext_512B, HMAC_SHA256_ciphertext_512B_digest } },
- { "768B", 768, &plaintext_quote[sizeof(plaintext_quote) - 1 - 768],
- { AES_CBC_ciphertext_768B, HMAC_SHA256_ciphertext_768B_digest } },
- { "1024B", 1024, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1024],
- { AES_CBC_ciphertext_1024B, HMAC_SHA256_ciphertext_1024B_digest } },
- { "1280B", 1280, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1280],
- { AES_CBC_ciphertext_1280B, HMAC_SHA256_ciphertext_1280B_digest } },
- { "1536B", 1536, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1536],
- { AES_CBC_ciphertext_1536B, HMAC_SHA256_ciphertext_1536B_digest } },
- { "1792B", 1792, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1792],
- { AES_CBC_ciphertext_1792B, HMAC_SHA256_ciphertext_1792B_digest } },
- { "2048B", 2048, &plaintext_quote[sizeof(plaintext_quote) - 1 - 2048],
- { AES_CBC_ciphertext_2048B, HMAC_SHA256_ciphertext_2048B_digest } }
-};
-
-static int
-test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
-{
- uint32_t num_to_submit = 4096;
- struct rte_crypto_op *c_ops[num_to_submit];
- struct rte_crypto_op *proc_ops[num_to_submit];
- uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
- uint32_t burst_sent, burst_received;
- uint32_t i, burst_size, num_sent, num_received;
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices available. Is kernel driver loaded?\n");
- return TEST_FAILED;
- }
-
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = &ut_params->auth_xform;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
- ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
- ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key;
- ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC;
- ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
- ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
-
- /* Setup HMAC Parameters */
- ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ut_params->auth_xform.next = NULL;
-
- ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC;
- ut_params->auth_xform.auth.key.data = hmac_sha256_key;
- ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256;
- ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
-
- /* Create Crypto session*/
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
-
- rte_cryptodev_sym_session_init(ts_params->dev_id, test_crypto_session,
- &ut_params->cipher_xform, ts_params->sess_mp);
-
- TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed");
-
- /* Generate Crypto op data structure(s) */
- for (i = 0; i < num_to_submit ; i++) {
- struct rte_mbuf *m = setup_test_string(ts_params->mbuf_mp,
- data_params[0].expected.ciphertext,
- data_params[0].length, 0);
- TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
-
- ut_params->digest = (uint8_t *)rte_pktmbuf_append(m,
- DIGEST_BYTE_LENGTH_SHA256);
- TEST_ASSERT_NOT_NULL(ut_params->digest,
- "no room to append digest");
-
- rte_memcpy(ut_params->digest, data_params[0].expected.digest,
- DIGEST_BYTE_LENGTH_SHA256);
-
-
- struct rte_crypto_op *op =
- rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
-
- rte_crypto_op_attach_sym_session(op, test_crypto_session);
-
- op->sym->auth.digest.data = ut_params->digest;
- op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
- data_params[0].length);
-
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = data_params[0].length;
-
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- aes_cbc_128_iv, CIPHER_IV_LENGTH_AES_CBC);
-
- op->sym->cipher.data.offset = 0;
- op->sym->cipher.data.length = data_params[0].length;
-
- op->sym->m_src = m;
-
- c_ops[i] = op;
- }
-
- printf("\nTest to measure the IA cycle cost using AES128_CBC_SHA256_HMAC "
- "algorithm with a constant request size of %u.",
- data_params[0].length);
- printf("\nThis test will keep retries at 0 and only measure IA cycle "
- "cost for each request.");
- printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst");
- printf("\tRetries (Device Busy)\tAverage IA cycle cost "
- "(assuming 0 retries)");
- for (i = 2; i <= 128 ; i *= 2) {
- num_sent = 0;
- num_received = 0;
- retries = 0;
- failed_polls = 0;
- burst_size = i;
- total_cycles = 0;
- while (num_sent < num_to_submit) {
- start_cycles = rte_rdtsc_precise();
- burst_sent = rte_cryptodev_enqueue_burst(dev_num,
- 0, &c_ops[num_sent],
- ((num_to_submit-num_sent) < burst_size) ?
- num_to_submit-num_sent : burst_size);
- if (burst_sent == 0)
- retries++;
- else
- num_sent += burst_sent;
- end_cycles = rte_rdtsc_precise();
- total_cycles += (end_cycles - start_cycles);
- /*
- * Wait until requests have been sent.
- */
- rte_delay_ms(1);
-
- start_cycles = rte_rdtsc_precise();
- burst_received = rte_cryptodev_dequeue_burst(
- dev_num, 0, proc_ops, burst_size);
- if (burst_received == 0)
- failed_polls++;
- else
- num_received += burst_received;
- end_cycles = rte_rdtsc_precise();
- total_cycles += end_cycles - start_cycles;
- }
-
- while (num_received != num_to_submit) {
- if (gbl_driver_id ==
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
- rte_cryptodev_enqueue_burst(dev_num, 0,
- NULL, 0);
-
- burst_received = rte_cryptodev_dequeue_burst(
- dev_num, 0, proc_ops, burst_size);
- if (burst_received == 0)
- failed_polls++;
- else
- num_received += burst_received;
- }
-
- printf("\n%u\t%u\t%u\t\t%u\t\t%u", dev_num, 0,
- num_sent, num_received, burst_size);
- printf("\t\t%"PRIu64, retries);
- printf("\t\t\t%"PRIu64, total_cycles/num_received);
- }
- printf("\n");
-
- for (i = 0; i < num_to_submit ; i++) {
- rte_pktmbuf_free(c_ops[i]->sym->m_src);
- rte_crypto_op_free(c_ops[i]);
- }
- return TEST_SUCCESS;
-}
-
-static int
-test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
-{
- uint32_t num_to_submit = pparams->total_operations;
- struct rte_crypto_op *c_ops[num_to_submit];
- struct rte_crypto_op *proc_ops[num_to_submit];
- uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
- uint32_t burst_sent = 0, burst_received = 0;
- uint32_t i, burst_size, num_sent, num_ops_received;
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- static struct rte_cryptodev_sym_session *sess;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- printf("\nAnd is kernel driver loaded for HW PMDs?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_snow3g_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate Crypto op data structure(s)*/
- for (i = 0; i < num_to_submit ; i++) {
- struct rte_mbuf *m = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
- TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
-
- struct rte_crypto_op *op =
- rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
-
- op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size);
- TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
-
- c_ops[i] = op;
- }
-
- if (pparams->chain == AEAD)
- printf("\nOn %s dev%u qp%u, %s, aead algo:%s, "
- "Packet Size %u bytes",
- pmd_name(gbl_driver_id),
- ts_params->dev_id, 0,
- chain_mode_name(pparams->chain),
- rte_crypto_aead_algorithm_strings[pparams->aead_algo],
- pparams->buf_size);
- else
- printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
- "Packet Size %u bytes",
- pmd_name(gbl_driver_id),
- ts_params->dev_id, 0,
- chain_mode_name(pparams->chain),
- rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
- rte_crypto_auth_algorithm_strings[pparams->auth_algo],
- pparams->buf_size);
- printf("\nOps Tx\tOps Rx\tOps/burst ");
- printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
-
- for (i = 2; i <= 128 ; i *= 2) {
- num_sent = 0;
- num_ops_received = 0;
- retries = 0;
- failed_polls = 0;
- burst_size = i;
- total_cycles = 0;
- while (num_sent < num_to_submit) {
- start_cycles = rte_rdtsc_precise();
- burst_sent = rte_cryptodev_enqueue_burst(ts_params->dev_id,
- 0, &c_ops[num_sent],
- ((num_to_submit-num_sent) < burst_size) ?
- num_to_submit-num_sent : burst_size);
- end_cycles = rte_rdtsc_precise();
- if (burst_sent == 0)
- retries++;
- num_sent += burst_sent;
- total_cycles += (end_cycles - start_cycles);
-
- /* Wait until requests have been sent. */
-
- rte_delay_ms(1);
-
- start_cycles = rte_rdtsc_precise();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops, burst_size);
- end_cycles = rte_rdtsc_precise();
- if (burst_received < burst_sent)
- failed_polls++;
- num_ops_received += burst_received;
-
- total_cycles += end_cycles - start_cycles;
- }
-
- while (num_ops_received != num_to_submit) {
- if (gbl_driver_id ==
- rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
- rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
- NULL, 0);
- start_cycles = rte_rdtsc_precise();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops, burst_size);
- end_cycles = rte_rdtsc_precise();
- total_cycles += end_cycles - start_cycles;
- if (burst_received == 0)
- failed_polls++;
- num_ops_received += burst_received;
- }
-
- printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
- printf("\t\t%"PRIu64, retries);
- printf("\t%"PRIu64, failed_polls);
- printf("\t\t%"PRIu64, total_cycles/num_ops_received);
- printf("\t\t%"PRIu64, (total_cycles/num_ops_received)*burst_size);
- printf("\t\t%"PRIu64, total_cycles/(num_ops_received*pparams->buf_size));
- }
- printf("\n");
-
- for (i = 0; i < num_to_submit ; i++) {
- rte_pktmbuf_free(c_ops[i]->sym->m_src);
- rte_crypto_op_free(c_ops[i]);
- }
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id,
- sess);
- rte_cryptodev_sym_session_free(sess);
-
- return TEST_SUCCESS;
-}
-
-static int
-test_perf_snow3G_vary_burst_size(void)
-{
- unsigned total_operations = 4096;
- /*no need to vary pkt size for QAT, should have no effect on IA cycles */
- uint16_t buf_lengths[] = {40};
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_ONLY,
- .cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_NULL,
- },
- {
- .chain = HASH_ONLY,
- .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
- .auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- .key_length = 16
- },
- };
-
- printf("\n\nStart %s.", __func__);
- printf("\nThis Test measures the average IA cycle cost using a "
- "constant request(packet) size. ");
- printf("Cycle cost is only valid when indicators show device is not busy,"
- " i.e. Retries and EmptyPolls = 0");
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- printf("\n");
- params_set[i].total_operations = total_operations;
-
- for (j = 0;
- j < RTE_DIM(buf_lengths);
- j++) {
-
- params_set[i].buf_size = buf_lengths[j];
-
- test_perf_snow3G_optimise_cyclecount(¶ms_set[i]);
- }
-
- }
-
- return 0;
-}
-
-static int
-test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
-{
- uint32_t num_to_submit = pparams->total_operations;
- struct rte_crypto_op *c_ops[num_to_submit];
- struct rte_crypto_op *proc_ops[num_to_submit];
- uint64_t failed_polls, retries, start_cycles,
- end_cycles, total_cycles = 0;
- uint32_t burst_sent = 0, burst_received = 0;
- uint32_t i, burst_size, num_sent, num_ops_received;
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- static struct rte_crypto_op *(*test_perf_set_crypto_op)
- (struct rte_crypto_op *, struct rte_mbuf *,
- struct rte_cryptodev_sym_session *,
- unsigned int,
- enum chain_mode);
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_openssl_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo,
- pparams->aead_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate Crypto op data structure(s)*/
- for (i = 0; i < num_to_submit ; i++) {
- struct rte_mbuf *m = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
- TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
-
- struct rte_crypto_op *op =
- rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
-
- if (pparams->chain == AEAD)
- test_perf_set_crypto_op =
- test_perf_set_crypto_op_aes_gcm;
- else {
- switch (pparams->cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
- break;
- default:
- return TEST_FAILED;
- }
- }
-
- op = test_perf_set_crypto_op(op, m, sess, pparams->buf_size,
- pparams->chain);
- TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
-
- c_ops[i] = op;
- }
-
- if (pparams->chain == AEAD)
- printf("\nOn %s dev%u qp%u, %s, aead_algo:%s, "
- "key length:%u, Packet Size %u bytes",
- pmd_name(gbl_driver_id),
- ts_params->dev_id, 0,
- chain_mode_name(pparams->chain),
- rte_crypto_aead_algorithm_strings[pparams->aead_algo],
- pparams->key_length,
- pparams->buf_size);
- else
- printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
- "key length:%u, Packet Size %u bytes",
- pmd_name(gbl_driver_id),
- ts_params->dev_id, 0,
- chain_mode_name(pparams->chain),
- rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
- rte_crypto_auth_algorithm_strings[pparams->auth_algo],
- pparams->key_length,
- pparams->buf_size);
- printf("\nOps Tx\tOps Rx\tOps/burst ");
- printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t"
- "IACycles/Byte");
-
- for (i = 2; i <= 128 ; i *= 2) {
- num_sent = 0;
- num_ops_received = 0;
- retries = 0;
- failed_polls = 0;
- burst_size = i;
- total_cycles = 0;
- while (num_sent < num_to_submit) {
- start_cycles = rte_rdtsc_precise();
- burst_sent = rte_cryptodev_enqueue_burst(
- ts_params->dev_id,
- 0, &c_ops[num_sent],
- ((num_to_submit - num_sent) <
- burst_size) ?
- num_to_submit - num_sent : burst_size);
- end_cycles = rte_rdtsc_precise();
- if (burst_sent == 0)
- retries++;
- num_sent += burst_sent;
- total_cycles += (end_cycles - start_cycles);
-
- /* Wait until requests have been sent. */
- rte_delay_ms(1);
-
- start_cycles = rte_rdtsc_precise();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops,
- burst_size);
- end_cycles = rte_rdtsc_precise();
- if (burst_received < burst_sent)
- failed_polls++;
- num_ops_received += burst_received;
-
- total_cycles += end_cycles - start_cycles;
- }
-
- while (num_ops_received != num_to_submit) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
- NULL, 0);
-
- start_cycles = rte_rdtsc_precise();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops,
- burst_size);
- end_cycles = rte_rdtsc_precise();
-
- total_cycles += end_cycles - start_cycles;
- if (burst_received == 0)
- failed_polls++;
- num_ops_received += burst_received;
- }
-
- printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
- printf("\t\t%"PRIu64, retries);
- printf("\t%"PRIu64, failed_polls);
- printf("\t\t%"PRIu64, total_cycles/num_ops_received);
- printf("\t\t%"PRIu64, (total_cycles/num_ops_received) *
- burst_size);
- printf("\t\t%"PRIu64,
- total_cycles /
- (num_ops_received * pparams->buf_size));
- }
- printf("\n");
-
- for (i = 0; i < num_to_submit ; i++) {
- rte_pktmbuf_free(c_ops[i]->sym->m_src);
- rte_crypto_op_free(c_ops[i]);
- }
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
-
- return TEST_SUCCESS;
-}
-
-static int
-test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
-{
- uint32_t num_to_submit = pparams->total_operations;
- struct rte_crypto_op *c_ops[num_to_submit];
- struct rte_crypto_op *proc_ops[num_to_submit];
- uint64_t failed_polls, retries, start_cycles, end_cycles,
- total_cycles = 0;
- uint32_t burst_sent = 0, burst_received = 0;
- uint32_t i, burst_size, num_sent, num_ops_received;
- uint32_t nb_ops;
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_armv8_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
-
- /* Generate Crypto op data structure(s)*/
- for (i = 0; i < num_to_submit ; i++) {
- struct rte_mbuf *m = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
- TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
-
- struct rte_crypto_op *op =
- rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
-
- op = test_perf_set_crypto_op_aes(op, m, sess, pparams->buf_size,
- pparams->chain);
- TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
-
- c_ops[i] = op;
- }
-
- printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, "
- "auth_algo:%s, Packet Size %u bytes",
- pmd_name(gbl_driver_id),
- ts_params->dev_id, 0,
- chain_mode_name(pparams->chain),
- rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
- pparams->key_length,
- rte_crypto_auth_algorithm_strings[pparams->auth_algo],
- pparams->buf_size);
- printf("\nOps Tx\tOps Rx\tOps/burst ");
- printf("Retries "
- "EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
-
- for (i = 2; i <= 128 ; i *= 2) {
- num_sent = 0;
- num_ops_received = 0;
- retries = 0;
- failed_polls = 0;
- burst_size = i;
- total_cycles = 0;
- while (num_sent < num_to_submit) {
- if ((num_to_submit - num_sent) < burst_size)
- nb_ops = num_to_submit - num_sent;
- else
- nb_ops = burst_size;
-
- start_cycles = rte_rdtsc();
- burst_sent = rte_cryptodev_enqueue_burst(
- ts_params->dev_id,
- 0, &c_ops[num_sent],
- nb_ops);
- end_cycles = rte_rdtsc();
-
- if (burst_sent == 0)
- retries++;
- num_sent += burst_sent;
- total_cycles += (end_cycles - start_cycles);
-
- start_cycles = rte_rdtsc();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops,
- burst_size);
- end_cycles = rte_rdtsc();
- if (burst_received < burst_sent)
- failed_polls++;
- num_ops_received += burst_received;
-
- total_cycles += end_cycles - start_cycles;
- }
-
- while (num_ops_received != num_to_submit) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(
- ts_params->dev_id, 0, NULL, 0);
-
- start_cycles = rte_rdtsc();
- burst_received = rte_cryptodev_dequeue_burst(
- ts_params->dev_id, 0, proc_ops, burst_size);
- end_cycles = rte_rdtsc();
-
- total_cycles += end_cycles - start_cycles;
- if (burst_received == 0)
- failed_polls++;
- num_ops_received += burst_received;
- }
-
- printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
- printf("\t\t%"PRIu64, retries);
- printf("\t%"PRIu64, failed_polls);
- printf("\t\t%"PRIu64, total_cycles/num_ops_received);
- printf("\t\t%"PRIu64,
- (total_cycles/num_ops_received)*burst_size);
- printf("\t\t%"PRIu64,
- total_cycles/(num_ops_received*pparams->buf_size));
- }
- printf("\n");
-
- for (i = 0; i < num_to_submit ; i++) {
- rte_pktmbuf_free(c_ops[i]->sym->m_src);
- rte_crypto_op_free(c_ops[i]);
- }
-
- return TEST_SUCCESS;
-}
-
-static uint32_t get_auth_key_max_length(enum rte_crypto_auth_algorithm algo)
-{
- switch (algo) {
- case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
- return 16;
- case RTE_CRYPTO_AUTH_SHA1_HMAC:
- return 64;
- case RTE_CRYPTO_AUTH_SHA224_HMAC:
- return 64;
- case RTE_CRYPTO_AUTH_SHA256_HMAC:
- return 64;
- case RTE_CRYPTO_AUTH_SHA384_HMAC:
- return 128;
- case RTE_CRYPTO_AUTH_SHA512_HMAC:
- return 128;
- default:
- return 0;
- }
-}
-
-static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo)
-{
- switch (algo) {
- case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
- return 4;
- case RTE_CRYPTO_AUTH_SHA1_HMAC:
- return TRUNCATED_DIGEST_BYTE_LENGTH_SHA1;
- case RTE_CRYPTO_AUTH_SHA224_HMAC:
- return TRUNCATED_DIGEST_BYTE_LENGTH_SHA224;
- case RTE_CRYPTO_AUTH_SHA256_HMAC:
- return TRUNCATED_DIGEST_BYTE_LENGTH_SHA256;
- case RTE_CRYPTO_AUTH_SHA384_HMAC:
- return TRUNCATED_DIGEST_BYTE_LENGTH_SHA384;
- case RTE_CRYPTO_AUTH_SHA512_HMAC:
- return TRUNCATED_DIGEST_BYTE_LENGTH_SHA512;
- default:
- return 0;
- }
-}
-
-static uint32_t get_aead_digest_length(enum rte_crypto_aead_algorithm algo)
-{
- switch (algo) {
- case RTE_CRYPTO_AEAD_AES_GCM:
- return DIGEST_BYTE_LENGTH_AES_GCM;
- default:
- return 0;
- }
-}
-
-static uint8_t aes_key[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static uint8_t aes_iv[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static uint8_t aes_gcm_aad[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static uint8_t triple_des_key[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static uint8_t triple_des_iv[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static uint8_t hmac_sha_key[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static uint8_t snow3g_cipher_key[] = {
- 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00,
- 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48
-};
-
-static uint8_t snow3g_iv[] = {
- 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
- 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
-};
-
-static uint8_t snow3g_hash_key[] = {
- 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
- 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
-};
-
-static int
-test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_crypto_sym_xform cipher_xform = { 0 };
- struct rte_crypto_sym_xform auth_xform = { 0 };
-
-
- /* Setup Cipher Parameters */
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.cipher.algo = cipher_algo;
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- cipher_xform.cipher.key.data = aes_key;
- cipher_xform.cipher.key.length = cipher_key_len;
- cipher_xform.cipher.iv.offset = IV_OFFSET;
- cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
- if (chain != CIPHER_ONLY) {
- /* Setup HMAC Parameters */
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- auth_xform.auth.algo = auth_algo;
- auth_xform.auth.key.data = hmac_sha_key;
- auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
- auth_xform.auth.digest_length =
- get_auth_digest_length(auth_algo);
- }
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
- switch (chain) {
- case CIPHER_HASH:
- cipher_xform.next = &auth_xform;
- auth_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- case HASH_CIPHER:
- auth_xform.next = &cipher_xform;
- cipher_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &auth_xform,
- ts_params->sess_mp);
- case CIPHER_ONLY:
- cipher_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- default:
- return -1;
- }
-}
-
-#define SNOW3G_CIPHER_IV_LENGTH 16
-
-static int
-test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_crypto_sym_xform cipher_xform = {0};
- struct rte_crypto_sym_xform auth_xform = {0};
-
-
- /* Setup Cipher Parameters */
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.cipher.algo = cipher_algo;
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- cipher_xform.cipher.key.data = snow3g_cipher_key;
- cipher_xform.cipher.key.length = cipher_key_len;
- cipher_xform.cipher.iv.offset = IV_OFFSET;
- cipher_xform.cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
-
-
- /* Setup HMAC Parameters */
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- auth_xform.auth.algo = auth_algo;
-
- auth_xform.auth.key.data = snow3g_hash_key;
- auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
- auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
- /* Auth IV will be after cipher IV */
- auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH;
- auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH;
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
- switch (chain) {
- case CIPHER_HASH:
- cipher_xform.next = &auth_xform;
- auth_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- case HASH_CIPHER:
- auth_xform.next = &cipher_xform;
- cipher_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &auth_xform,
- ts_params->sess_mp);
- case CIPHER_ONLY:
- cipher_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- case HASH_ONLY:
- auth_xform.next = NULL;
- /* Create Crypto session */
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &auth_xform,
- ts_params->sess_mp);
- default:
- return -1;
- }
-}
-
-static int
-test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int key_len,
- enum rte_crypto_auth_algorithm auth_algo,
- enum rte_crypto_aead_algorithm aead_algo)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_crypto_sym_xform cipher_xform = { 0 };
- struct rte_crypto_sym_xform auth_xform = { 0 };
- struct rte_crypto_sym_xform aead_xform = { 0 };
-
- if (chain == CIPHER_HASH || chain == HASH_CIPHER) {
- /* Setup Cipher Parameters */
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.cipher.algo = cipher_algo;
- cipher_xform.cipher.iv.offset = IV_OFFSET;
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- switch (cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- cipher_xform.cipher.key.data = triple_des_key;
- cipher_xform.cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- cipher_xform.cipher.key.data = aes_key;
- cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
- break;
- default:
- return -1;
- }
-
- cipher_xform.cipher.key.length = key_len;
-
- /* Setup Auth Parameters */
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- auth_xform.auth.algo = auth_algo;
-
- switch (auth_algo) {
- case RTE_CRYPTO_AUTH_SHA1_HMAC:
- auth_xform.auth.key.data = hmac_sha_key;
- break;
- default:
- return -1;
- }
-
- auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
- auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
- } else if (chain == AEAD) {
- /* Setup AEAD Parameters */
- aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
- aead_xform.aead.op = RTE_CRYPTO_AEAD_OP_ENCRYPT;
- aead_xform.aead.algo = aead_algo;
- aead_xform.aead.iv.offset = IV_OFFSET;
-
- switch (aead_algo) {
- case RTE_CRYPTO_AEAD_AES_GCM:
- aead_xform.aead.key.data = aes_key;
- aead_xform.aead.iv.length = AES_CIPHER_IV_LENGTH;
- aead_xform.aead.aad_length = AES_GCM_AAD_LENGTH;
- aead_xform.aead.digest_length = get_aead_digest_length(aead_algo);
- break;
- default:
- return -1;
- }
-
- aead_xform.aead.key.length = key_len;
- }
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
- switch (chain) {
- case CIPHER_HASH:
- cipher_xform.next = &auth_xform;
- auth_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- case HASH_CIPHER:
- auth_xform.next = &cipher_xform;
- cipher_xform.next = NULL;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &auth_xform,
- ts_params->sess_mp);
- case AEAD:
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &aead_xform,
- ts_params->sess_mp);
- default:
- return -1;
- }
-}
-
-static int
-test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
- enum rte_crypto_cipher_algorithm cipher_algo,
- unsigned int cipher_key_len,
- enum rte_crypto_auth_algorithm auth_algo)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_crypto_sym_xform cipher_xform = { 0 };
- struct rte_crypto_sym_xform auth_xform = { 0 };
-
- /* Setup Cipher Parameters */
- cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cipher_xform.cipher.algo = cipher_algo;
-
- switch (cipher_algo) {
- case RTE_CRYPTO_CIPHER_AES_CBC:
- cipher_xform.cipher.key.data = aes_cbc_128_key;
- break;
- default:
- return -1;
- }
-
- cipher_xform.cipher.key.length = cipher_key_len;
- cipher_xform.cipher.iv.offset = IV_OFFSET;
- cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
-
- /* Setup Auth Parameters */
- auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
- auth_xform.auth.algo = auth_algo;
-
- auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
-
- switch (chain) {
- case CIPHER_HASH:
- cipher_xform.next = &auth_xform;
- auth_xform.next = NULL;
- /* Encrypt and hash the result */
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &cipher_xform,
- ts_params->sess_mp);
- case HASH_CIPHER:
- auth_xform.next = &cipher_xform;
- cipher_xform.next = NULL;
- /* Hash encrypted message and decrypt */
- cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
- /* Create Crypto session*/
- return rte_cryptodev_sym_session_init(dev_id,
- test_crypto_session, &auth_xform,
- ts_params->sess_mp);
- default:
- return -1;
- }
-}
-
-static struct rte_mbuf *
-test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
-{
- struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
-
- if (rte_pktmbuf_append(m, buf_sz) == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
- }
-
- memset(rte_pktmbuf_mtod(m, uint8_t *), 0, buf_sz);
-
- return m;
-}
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain)
-{
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- /* Authentication Parameters */
- if (chain == CIPHER_ONLY) {
- op->sym->auth.digest.data = NULL;
- op->sym->auth.digest.phys_addr = 0;
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = 0;
- } else {
- op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m,
- uint8_t *, data_len);
- op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
- data_len);
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = data_len;
- }
-
-
- /* Copy the IV at the end of the crypto operation */
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- aes_iv, AES_CIPHER_IV_LENGTH);
-
- /* Cipher Parameters */
- op->sym->cipher.data.offset = 0;
- op->sym->cipher.data.length = data_len;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain __rte_unused)
-{
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- /* Authentication Parameters */
- op->sym->aead.digest.data = (uint8_t *)m->buf_addr +
- (m->data_off + data_len);
- op->sym->aead.digest.phys_addr =
- rte_pktmbuf_mtophys_offset(m, data_len);
- op->sym->aead.aad.data = aes_gcm_aad;
-
- /* Copy IV at the end of the crypto operation */
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- aes_iv, AES_CIPHER_IV_LENGTH);
-
- /* Data lengths/offsets Parameters */
- op->sym->aead.data.offset = 0;
- op->sym->aead.data.length = data_len;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len)
-{
- uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
- uint8_t *, IV_OFFSET);
-
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
-
- /* Authentication Parameters */
- op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
- (m->data_off + data_len);
- op->sym->auth.digest.phys_addr =
- rte_pktmbuf_mtophys_offset(m, data_len);
-
- /* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = data_len << 3;
-
- op->sym->cipher.data.offset = 0;
- op->sym->cipher.data.length = data_len << 3;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op,
- struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess,
- unsigned data_len)
-{
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- /* Copy IV at the end of the crypto operation */
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
-
- /* Cipher Parameters */
- op->sym->cipher.data.offset = 0;
- op->sym->cipher.data.length = data_len << 3;
-
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- snow3g_iv,
- SNOW3G_CIPHER_IV_LENGTH);
-
- op->sym->m_src = m;
-
- return op;
-}
-
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
- struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess,
- unsigned int data_len)
-{
- uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
- uint8_t *, IV_OFFSET);
-
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
-
- /* Authentication Parameters */
-
- op->sym->auth.digest.data =
- (uint8_t *)rte_pktmbuf_mtod_offset(m, uint8_t *,
- data_len);
- op->sym->auth.digest.phys_addr =
- rte_pktmbuf_mtophys_offset(m, data_len +
- SNOW3G_CIPHER_IV_LENGTH);
-
- /* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = data_len << 3;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-
-static inline struct rte_crypto_op *
-test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess, unsigned int data_len,
- enum chain_mode chain __rte_unused)
-{
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- /* Authentication Parameters */
- op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
- (m->data_off + data_len);
- op->sym->auth.digest.phys_addr =
- rte_pktmbuf_mtophys_offset(m, data_len);
-
- /* Copy IV at the end of the crypto operation */
- rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
- triple_des_iv, TRIPLE_DES_CIPHER_IV_LENGTH);
-
- /* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = 0;
- op->sym->auth.data.length = data_len;
-
- op->sym->cipher.data.offset = 0;
- op->sym->cipher.data.length = data_len;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-/* An mbuf set is used in each burst. An mbuf can be used by multiple bursts at
- * same time, i.e. as they're not dereferenced there's no need to wait until
- * finished with to re-use */
-#define NUM_MBUF_SETS 8
-
-static int
-test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams)
-{
- uint16_t i, k, l, m;
- uint16_t j = 0;
- uint16_t ops_unused = 0;
-
- uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
- uint64_t processed = 0, failed_polls = 0, retries = 0;
- uint64_t tsc_start = 0, tsc_end = 0;
-
- uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
-
- struct rte_crypto_op *ops[pparams->burst_size];
- struct rte_crypto_op *proc_ops[pparams->burst_size];
-
- struct rte_mbuf *mbufs[pparams->burst_size * 8];
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices available. Is kernel driver loaded?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_aes_sha_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate a burst of crypto operations */
- for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
- mbufs[i] = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
-
- if (mbufs[i] == NULL) {
- printf("\nFailed to get mbuf - freeing the rest.\n");
- for (k = 0; k < i; k++)
- rte_pktmbuf_free(mbufs[k]);
- return -1;
- }
-
- /* Make room for Digest in mbuf */
- if (pparams->chain != CIPHER_ONLY)
- rte_pktmbuf_append(mbufs[i], digest_length);
- }
-
-
- tsc_start = rte_rdtsc_precise();
-
- while (total_enqueued < pparams->total_operations) {
- uint16_t burst_size =
- total_enqueued+pparams->burst_size <= pparams->total_operations ?
- pparams->burst_size : pparams->total_operations-total_enqueued;
- uint16_t ops_needed = burst_size-ops_unused;
-
- if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
- printf("\nFailed to alloc enough ops, finish dequeuing "
- "and free ops below.");
- } else {
- for (i = 0; i < ops_needed; i++)
- ops[i] = test_perf_set_crypto_op_aes(ops[i],
- mbufs[i + (pparams->burst_size *
- (j % NUM_MBUF_SETS))],
- sess, pparams->buf_size,
- pparams->chain);
-
- /* enqueue burst */
- burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
- queue_id, ops, burst_size);
-
- if (burst_enqueued < burst_size)
- retries++;
-
- ops_unused = burst_size-burst_enqueued;
- total_enqueued += burst_enqueued;
- }
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (l = 0; l < burst_dequeued; l++)
- rte_crypto_op_free(proc_ops[l]);
- }
- j++;
- }
-
- /* Dequeue any operations still in the crypto device */
- while (processed < pparams->total_operations) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (m = 0; m < burst_dequeued; m++)
- rte_crypto_op_free(proc_ops[m]);
- }
- }
-
- tsc_end = rte_rdtsc_precise();
-
- double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
- double throughput = (ops_s * pparams->buf_size * 8) / 1000000000;
-
- printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, ops_s/1000000,
- throughput, retries, failed_polls);
-
- for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
- rte_pktmbuf_free(mbufs[i]);
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
-
- printf("\n");
- return TEST_SUCCESS;
-}
-
-
-static int
-test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams)
-{
- uint16_t i, k, l, m;
- uint16_t j = 0;
- uint16_t ops_unused = 0;
- uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
- uint64_t processed = 0, failed_polls = 0, retries = 0;
- uint64_t tsc_start = 0, tsc_end = 0;
-
- uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
-
- struct rte_crypto_op *ops[pparams->burst_size];
- struct rte_crypto_op *proc_ops[pparams->burst_size];
-
- struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- printf("\nAnd is kernel driver loaded for HW PMDs?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_snow3g_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate a burst of crypto operations */
- for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
- /*
- * Buffer size is allocated, for perf tests they
- * are equal + digest len.
- */
- mbufs[i] = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size +
- digest_length);
-
- if (mbufs[i] == NULL) {
- printf("\nFailed to get mbuf - freeing the rest.\n");
- for (k = 0; k < i; k++)
- rte_pktmbuf_free(mbufs[k]);
- return -1;
- }
-
- }
-
- tsc_start = rte_rdtsc_precise();
-
- while (total_enqueued < pparams->total_operations) {
- uint16_t burst_size =
- (total_enqueued+pparams->burst_size)
- <= pparams->total_operations ?
- pparams->burst_size : pparams->total_operations-total_enqueued;
- uint16_t ops_needed = burst_size-ops_unused;
- /* Handle the last burst correctly */
- uint16_t op_offset = pparams->burst_size - burst_size;
-
- if (ops_needed !=
- rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC,
- ops+op_offset, ops_needed)) {
- printf("\nFailed to alloc enough ops.");
- /*Don't exit, dequeue, more ops should become available*/
- } else {
- for (i = 0; i < ops_needed; i++) {
- if (pparams->chain == HASH_ONLY)
- ops[i+op_offset] =
- test_perf_set_crypto_op_snow3g_hash(ops[i+op_offset],
- mbufs[i +
- (pparams->burst_size * (j % NUM_MBUF_SETS))],
- sess,
- pparams->buf_size);
- else if (pparams->chain == CIPHER_ONLY)
- ops[i+op_offset] =
- test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset],
- mbufs[i +
- (pparams->burst_size * (j % NUM_MBUF_SETS))],
- sess,
- pparams->buf_size);
- else
- return 1;
- }
-
- /* enqueue burst */
- burst_enqueued =
- rte_cryptodev_enqueue_burst(dev_id, queue_id,
- ops+op_offset, burst_size);
-
- if (burst_enqueued < burst_size)
- retries++;
-
- ops_unused = burst_size-burst_enqueued;
- total_enqueued += burst_enqueued;
- }
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0) {
- failed_polls++;
- } else {
- processed += burst_dequeued;
- for (l = 0; l < burst_dequeued; l++)
- rte_crypto_op_free(proc_ops[l]);
- }
- j++;
- }
-
- /* Dequeue any operations still in the crypto device */
- while (processed < pparams->total_operations) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
- for (m = 0; m < burst_dequeued; m++)
- rte_crypto_op_free(proc_ops[m]);
- }
- }
-
- tsc_end = rte_rdtsc_precise();
-
- double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
- double cycles_burst = (double) (tsc_end - tsc_start) /
- (double) processed * pparams->burst_size;
- double cycles_buff = (double) (tsc_end - tsc_start) / (double) processed;
- double cycles_B = cycles_buff / pparams->buf_size;
- double throughput = (ops_s * pparams->buf_size * 8) / 1000000;
-
- if (gbl_driver_id == rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) {
- /* Cycle count misleading on HW devices for this test, so don't print */
- printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a "
- "\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64,
- pparams->buf_size, ops_s/1000000,
- throughput, retries, failed_polls);
- } else {
- printf("%4u\t%6.2f\t%10.2f\t%10.2f\t%8.2f"
- "\t%8.2f\t%8"PRIu64"\t%8"PRIu64,
- pparams->buf_size, ops_s/1000000, throughput, cycles_burst,
- cycles_buff, cycles_B, retries, failed_polls);
- }
-
- for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
- rte_pktmbuf_free(mbufs[i]);
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
-
- printf("\n");
- return TEST_SUCCESS;
-}
-
-static int
-test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams)
-{
- uint16_t i, k, l, m;
- uint16_t j = 0;
- uint16_t ops_unused = 0;
-
- uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
- uint64_t processed = 0, failed_polls = 0, retries = 0;
- uint64_t tsc_start = 0, tsc_end = 0;
-
- struct rte_crypto_op *ops[pparams->burst_size];
- struct rte_crypto_op *proc_ops[pparams->burst_size];
-
- struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- static struct rte_crypto_op *(*test_perf_set_crypto_op)
- (struct rte_crypto_op *, struct rte_mbuf *,
- struct rte_cryptodev_sym_session *,
- unsigned int,
- enum chain_mode);
-
- if (pparams->chain == AEAD)
- test_perf_set_crypto_op =
- test_perf_set_crypto_op_aes_gcm;
- else {
- switch (pparams->cipher_algo) {
- case RTE_CRYPTO_CIPHER_3DES_CBC:
- case RTE_CRYPTO_CIPHER_3DES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
- break;
- case RTE_CRYPTO_CIPHER_AES_CBC:
- case RTE_CRYPTO_CIPHER_AES_CTR:
- test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
- break;
- default:
- return TEST_FAILED;
- }
- }
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_openssl_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo,
- pparams->aead_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate a burst of crypto operations */
- for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
- mbufs[i] = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
-
- if (mbufs[i] == NULL) {
- printf("\nFailed to get mbuf - freeing the rest.\n");
- for (k = 0; k < i; k++)
- rte_pktmbuf_free(mbufs[k]);
- return -1;
- }
- }
-
- tsc_start = rte_rdtsc_precise();
-
- while (total_enqueued < pparams->total_operations) {
- uint16_t burst_size =
- total_enqueued + pparams->burst_size <=
- pparams->total_operations ? pparams->burst_size :
- pparams->total_operations - total_enqueued;
- uint16_t ops_needed = burst_size - ops_unused;
-
- if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
- printf("\nFailed to alloc enough ops, finish dequeuing "
- "and free ops below.");
- } else {
- for (i = 0; i < ops_needed; i++)
- ops[i] = test_perf_set_crypto_op(ops[i],
- mbufs[i + (pparams->burst_size *
- (j % NUM_MBUF_SETS))],
- sess, pparams->buf_size,
- pparams->chain);
-
- /* enqueue burst */
- burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
- queue_id, ops, burst_size);
-
- if (burst_enqueued < burst_size)
- retries++;
-
- ops_unused = burst_size - burst_enqueued;
- total_enqueued += burst_enqueued;
- }
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (l = 0; l < burst_dequeued; l++)
- rte_crypto_op_free(proc_ops[l]);
- }
- j++;
- }
-
- /* Dequeue any operations still in the crypto device */
- while (processed < pparams->total_operations) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (m = 0; m < burst_dequeued; m++)
- rte_crypto_op_free(proc_ops[m]);
- }
- }
-
- tsc_end = rte_rdtsc_precise();
-
- double ops_s = ((double)processed / (tsc_end - tsc_start))
- * rte_get_tsc_hz();
- double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS)
- / 1000000000;
-
- printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size,
- ops_s / 1000000, throughput, retries, failed_polls);
-
- for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
- rte_pktmbuf_free(mbufs[i]);
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
-
- printf("\n");
- return TEST_SUCCESS;
-}
-
-static int
-test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams)
-{
- uint16_t i, k, l, m;
- uint16_t j = 0;
- uint16_t ops_unused = 0;
- uint16_t burst_size;
- uint16_t ops_needed;
-
- uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
- uint64_t processed = 0, failed_polls = 0, retries = 0;
- uint64_t tsc_start = 0, tsc_end = 0;
-
- struct rte_crypto_op *ops[pparams->burst_size];
- struct rte_crypto_op *proc_ops[pparams->burst_size];
-
- struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
-
- struct crypto_testsuite_params *ts_params = &testsuite_params;
-
- static struct rte_cryptodev_sym_session *sess;
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices found. Is PMD build configured?\n");
- return TEST_FAILED;
- }
-
- /* Create Crypto session*/
- if (test_perf_create_armv8_session(ts_params->dev_id,
- pparams->chain, pparams->cipher_algo,
- pparams->key_length, pparams->auth_algo) == 0)
- sess = test_crypto_session;
- else
- sess = NULL;
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- /* Generate a burst of crypto operations */
- for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
- mbufs[i] = test_perf_create_pktmbuf(
- ts_params->mbuf_mp,
- pparams->buf_size);
-
- if (mbufs[i] == NULL) {
- printf("\nFailed to get mbuf - freeing the rest.\n");
- for (k = 0; k < i; k++)
- rte_pktmbuf_free(mbufs[k]);
- return -1;
- }
- }
-
- tsc_start = rte_rdtsc();
-
- while (total_enqueued < pparams->total_operations) {
- if ((total_enqueued + pparams->burst_size) <=
- pparams->total_operations)
- burst_size = pparams->burst_size;
- else
- burst_size = pparams->total_operations - total_enqueued;
-
- ops_needed = burst_size - ops_unused;
-
- if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
- printf("\nFailed to alloc enough ops, finish dequeuing "
- "and free ops below.");
- } else {
- for (i = 0; i < ops_needed; i++)
- ops[i] = test_perf_set_crypto_op_aes(ops[i],
- mbufs[i + (pparams->burst_size *
- (j % NUM_MBUF_SETS))], sess,
- pparams->buf_size,
- pparams->chain);
-
- /* enqueue burst */
- burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
- queue_id, ops, burst_size);
-
- if (burst_enqueued < burst_size)
- retries++;
-
- ops_unused = burst_size - burst_enqueued;
- total_enqueued += burst_enqueued;
- }
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (l = 0; l < burst_dequeued; l++)
- rte_crypto_op_free(proc_ops[l]);
- }
- j++;
- }
-
- /* Dequeue any operations still in the crypto device */
- while (processed < pparams->total_operations) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (m = 0; m < burst_dequeued; m++)
- rte_crypto_op_free(proc_ops[m]);
- }
- }
-
- tsc_end = rte_rdtsc();
-
- double ops_s = ((double)processed / (tsc_end - tsc_start))
- * rte_get_tsc_hz();
- double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS)
- / 1000000000;
-
- printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size,
- ops_s / 1000000, throughput, retries, failed_polls);
-
- for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
- rte_pktmbuf_free(mbufs[i]);
-
- printf("\n");
- return TEST_SUCCESS;
-}
-
-/*
-
- perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA1);
- perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_256);
- perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_512);
-
- perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA1);
- perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_256);
- perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_512);
-
- perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA1);
- perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_256);
- perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_512);
- */
-static int
-test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
-{
- unsigned total_operations = 1000000;
- unsigned burst_size = 32;
- unsigned buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048 };
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_ONLY,
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_NULL
- },
- {
- .chain = CIPHER_HASH,
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 32,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 32,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 32,
- .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
- },
- };
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
-
- params_set[i].total_operations = total_operations;
- params_set[i].burst_size = burst_size;
- printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
- rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
- params_set[i].key_length,
- burst_size);
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
- "Retries\tEmptyPolls\n");
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
- params_set[i].buf_size = buf_lengths[j];
- test_perf_aes_sha(testsuite_params.dev_id, 0,
- ¶ms_set[i]);
- }
- }
- return 0;
-}
-
-static int
-test_perf_snow3G_vary_pkt_size(void)
-{
- unsigned total_operations = 1000000;
- uint8_t i, j;
- unsigned k;
- uint16_t burst_sizes[] = { 64 };
- uint16_t buf_lengths[] = { 40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048 };
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_ONLY,
- .cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_NULL,
- },
- {
- .chain = HASH_ONLY,
- .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
- .auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
- .key_length = 16
- },
- };
-
- printf("\n\nStart %s.", __func__);
- printf("\nTest to measure max throughput at various pkt sizes.");
- printf("\nOn HW devices t'put maximised when high Retries and EmptyPolls"
- " so cycle cost not relevant (n/a displayed).");
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- printf("\n\n");
- params_set[i].total_operations = total_operations;
- for (k = 0; k < RTE_DIM(burst_sizes); k++) {
- enum rte_crypto_cipher_algorithm cipher_algo =
- params_set[i].cipher_algo;
- enum rte_crypto_auth_algorithm auth_algo =
- params_set[i].auth_algo;
- printf("\nOn %s dev%u qp%u, %s, "
- "cipher algo:%s, auth algo:%s, burst_size: %d ops",
- pmd_name(gbl_driver_id),
- testsuite_params.dev_id, 0,
- chain_mode_name(params_set[i].chain),
- rte_crypto_cipher_algorithm_strings[cipher_algo],
- rte_crypto_auth_algorithm_strings[auth_algo],
- burst_sizes[k]);
-
- params_set[i].burst_size = burst_sizes[k];
- printf("\nPktSzB\tOp/s(M)\tThruput(Mbps)\tCycles/Burst\t"
- "Cycles/buf\tCycles/B\tRetries\t\tEmptyPolls\n");
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
-
- params_set[i].buf_size = buf_lengths[j];
-
- test_perf_snow3g(testsuite_params.dev_id, 0, ¶ms_set[i]);
- }
- }
- }
-
- return 0;
-}
-
-static int
-test_perf_openssl_vary_pkt_size(void)
-{
- unsigned int total_operations = 10000;
- unsigned int burst_size = { 64 };
- unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
- 1792, 2048 };
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .key_length = 24,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .key_length = 32,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .key_length = 24,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = AEAD,
-
- .aead_algo = RTE_CRYPTO_AEAD_AES_GCM,
- .key_length = 16,
- },
- };
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- params_set[i].total_operations = total_operations;
- params_set[i].burst_size = burst_size;
- if (params_set[i].chain == AEAD) {
- enum rte_crypto_aead_algorithm aead_algo =
- params_set[i].aead_algo;
- printf("\n%s. aead algo: %s key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- rte_crypto_aead_algorithm_strings[aead_algo],
- params_set[i].key_length,
- burst_size);
- } else {
- enum rte_crypto_cipher_algorithm cipher_algo =
- params_set[i].cipher_algo;
- enum rte_crypto_auth_algorithm auth_algo =
- params_set[i].auth_algo;
- printf("\n%s. cipher algo: %s auth algo: %s key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- rte_crypto_cipher_algorithm_strings[cipher_algo],
- rte_crypto_auth_algorithm_strings[auth_algo],
- params_set[i].key_length,
- burst_size);
- }
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
- "EmptyPolls\n");
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
- params_set[i].buf_size = buf_lengths[j];
- test_perf_openssl(testsuite_params.dev_id, 0,
- ¶ms_set[i]);
- }
- }
-
- return 0;
-}
-
-static int
-test_perf_openssl_vary_burst_size(void)
-{
- unsigned int total_operations = 4096;
- uint16_t buf_lengths[] = { 40 };
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC,
- .key_length = 24,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
- .key_length = 32,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR,
- .key_length = 24,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = AEAD,
-
- .aead_algo = RTE_CRYPTO_AEAD_AES_GCM,
- .key_length = 16,
- },
- };
-
- printf("\n\nStart %s.", __func__);
- printf("\nThis Test measures the average IA cycle cost using a "
- "constant request(packet) size. ");
- printf("Cycle cost is only valid when indicators show device is not"
- " busy, i.e. Retries and EmptyPolls = 0");
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- printf("\n");
- params_set[i].total_operations = total_operations;
-
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
- params_set[i].buf_size = buf_lengths[j];
- test_perf_openssl_optimise_cyclecount(¶ms_set[i]);
- }
- }
-
- return 0;
-}
-
-static int
-test_perf_armv8_vary_pkt_size(void)
-{
- unsigned int total_operations = 100000;
- unsigned int burst_size = { 64 };
- unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
- 1792, 2048 };
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = HASH_CIPHER,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- {
- .chain = HASH_CIPHER,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- };
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- params_set[i].total_operations = total_operations;
- params_set[i].burst_size = burst_size;
- printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set[i].chain),
- rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
- rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
- params_set[i].key_length,
- burst_size);
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
- "EmptyPolls\n");
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
- params_set[i].buf_size = buf_lengths[j];
- test_perf_armv8(testsuite_params.dev_id, 0,
- ¶ms_set[i]);
- }
- }
-
- return 0;
-}
-
-static int
-test_perf_armv8_vary_burst_size(void)
-{
- unsigned int total_operations = 4096;
- uint16_t buf_lengths[] = { 64 };
- uint8_t i, j;
-
- struct perf_test_params params_set[] = {
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = HASH_CIPHER,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- },
- {
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- {
- .chain = HASH_CIPHER,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
- },
- };
-
- printf("\n\nStart %s.", __func__);
- printf("\nThis Test measures the average IA cycle cost using a "
- "constant request(packet) size. ");
- printf("Cycle cost is only valid when indicators show device is "
- "not busy, i.e. Retries and EmptyPolls = 0");
-
- for (i = 0; i < RTE_DIM(params_set); i++) {
- printf("\n");
- params_set[i].total_operations = total_operations;
-
- for (j = 0; j < RTE_DIM(buf_lengths); j++) {
- params_set[i].buf_size = buf_lengths[j];
- test_perf_armv8_optimise_cyclecount(¶ms_set[i]);
- }
- }
-
- return 0;
-}
-
-static int
-test_perf_aes_cbc_vary_burst_size(void)
-{
- return test_perf_crypto_qp_vary_burst_size(testsuite_params.dev_id);
-}
-
-
-static struct rte_cryptodev_sym_session *
-test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_crypto_sym_xform aead_xform = { 0 };
-
- uint8_t aead_key[pparams->session_attrs->key_aead_len];
-
- memcpy(aead_key, pparams->session_attrs->key_aead_data,
- pparams->session_attrs->key_aead_len);
-
- aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
- aead_xform.next = NULL;
-
- aead_xform.aead.algo = pparams->session_attrs->aead_algorithm;
- aead_xform.aead.op = pparams->session_attrs->aead;
- aead_xform.aead.key.data = aead_key;
- aead_xform.aead.key.length = pparams->session_attrs->key_aead_len;
- aead_xform.aead.iv.length = pparams->session_attrs->iv_len;
- aead_xform.aead.iv.offset = IV_OFFSET;
- aead_xform.aead.aad_length = pparams->session_attrs->aad_len;
- aead_xform.aead.digest_length = pparams->session_attrs->digest_len;
-
- test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
-
- rte_cryptodev_sym_session_init(dev_id, test_crypto_session,
- &aead_xform, ts_params->sess_mp);
-
- return test_crypto_session;
-}
-
-static inline struct rte_crypto_op *
-perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
- struct rte_cryptodev_sym_session *sess,
- struct crypto_params *m_hlp,
- struct perf_test_params *params)
-{
- uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
- uint8_t *, IV_OFFSET);
-
- if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
- rte_crypto_op_free(op);
- return NULL;
- }
-
- op->sym->aead.digest.data = m_hlp->digest;
- op->sym->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
- m,
- params->session_attrs->aad_len +
- params->symmetric_op->p_len);
-
-
- op->sym->aead.aad.data = m_hlp->aad;
- op->sym->aead.aad.phys_addr = rte_pktmbuf_mtophys(m);
-
- rte_memcpy(op->sym->aead.aad.data, params->symmetric_op->aad_data,
- params->session_attrs->aad_len);
-
- rte_memcpy(iv_ptr, params->session_attrs->iv_data,
- params->session_attrs->iv_len);
- if (params->session_attrs->iv_len == 12)
- iv_ptr[15] = 1;
-
- op->sym->aead.data.offset =
- params->session_attrs->aad_len;
- op->sym->aead.data.length = params->symmetric_op->p_len;
-
- op->sym->m_src = m;
-
- return op;
-}
-
-static struct rte_mbuf *
-test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
- struct perf_test_params *params,
- unsigned buf_sz, struct crypto_params *m_hlp)
-{
- struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
- uint16_t aad_len = params->session_attrs->aad_len;
- uint16_t digest_size = params->symmetric_op->t_len;
- char *p;
-
- p = rte_pktmbuf_append(m, aad_len);
- if (p == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
- }
- m_hlp->aad = (uint8_t *)p;
-
- p = rte_pktmbuf_append(m, buf_sz);
- if (p == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
- }
- rte_memcpy(p, params->symmetric_op->p_data, buf_sz);
-
- p = rte_pktmbuf_append(m, digest_size);
- if (p == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
- }
- m_hlp->digest = (uint8_t *)p;
-
- return m;
-}
-
-static int
-perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams, uint32_t test_ops)
-{
- int j = 0;
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct rte_cryptodev_sym_session *sess;
- struct rte_crypto_op *ops[pparams->burst_size];
- struct rte_crypto_op *proc_ops[pparams->burst_size];
- uint32_t total_operations = pparams->total_operations;
-
- uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
- uint64_t processed = 0, failed_polls = 0, retries = 0;
- uint64_t tsc_start = 0, tsc_end = 0;
-
- uint16_t i = 0, l = 0, m = 0;
- uint16_t burst = pparams->burst_size * NUM_MBUF_SETS;
- uint16_t ops_unused = 0;
-
- struct rte_mbuf *mbufs[burst];
- struct crypto_params m_hlp[burst];
-
- if (rte_cryptodev_count() == 0) {
- printf("\nNo crypto devices available. "
- "Is kernel driver loaded?\n");
- return TEST_FAILED;
- }
-
- sess = test_perf_create_session(dev_id, pparams);
- TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
-
- for (i = 0; i < burst; i++) {
- mbufs[i] = test_perf_create_pktmbuf_fill(
- ts_params->mbuf_mp,
- pparams, pparams->symmetric_op->p_len,
- &m_hlp[i]);
- }
-
- if (test_ops)
- total_operations = test_ops;
-
- tsc_start = rte_rdtsc_precise();
- while (total_enqueued < total_operations) {
- uint16_t burst_size =
- total_enqueued+pparams->burst_size <= total_operations ?
- pparams->burst_size : total_operations-total_enqueued;
- uint16_t ops_needed = burst_size-ops_unused;
-
- if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
- printf("\nFailed to alloc enough ops, "
- "finish dequeuing");
- } else {
- for (i = 0; i < ops_needed; i++)
- ops[i] = perf_gcm_set_crypto_op(ops[i],
- mbufs[i + (pparams->burst_size *
- (j % NUM_MBUF_SETS))],
- sess, &m_hlp[i + (pparams->burst_size *
- (j % NUM_MBUF_SETS))], pparams);
-
- /* enqueue burst */
- burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
- queue_id, ops, burst_size);
-
- if (burst_enqueued < burst_size)
- retries++;
-
- ops_unused = burst_size-burst_enqueued;
- total_enqueued += burst_enqueued;
- }
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (l = 0; l < burst_dequeued; l++)
- rte_crypto_op_free(proc_ops[l]);
- }
-
- j++;
- }
-
- /* Dequeue any operations still in the crypto device */
- while (processed < total_operations) {
- /* Sending 0 length burst to flush sw crypto device */
- rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
-
- /* dequeue burst */
- burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
- proc_ops, pparams->burst_size);
- if (burst_dequeued == 0)
- failed_polls++;
- else {
- processed += burst_dequeued;
-
- for (m = 0; m < burst_dequeued; m++) {
- if (test_ops) {
- uint8_t *pkt = rte_pktmbuf_mtod(
- proc_ops[m]->sym->m_src,
- uint8_t *);
-
- TEST_ASSERT_BUFFERS_ARE_EQUAL(
- pparams->symmetric_op->c_data,
- pkt +
- pparams->session_attrs->aad_len,
- pparams->symmetric_op->c_len,
- "GCM Ciphertext data not as expected");
-
- TEST_ASSERT_BUFFERS_ARE_EQUAL(
- pparams->symmetric_op->t_data,
- pkt +
- pparams->session_attrs->aad_len +
- pparams->symmetric_op->c_len,
- pparams->symmetric_op->t_len,
- "GCM MAC data not as expected");
-
- }
- rte_crypto_op_free(proc_ops[m]);
- }
- }
- }
-
- tsc_end = rte_rdtsc_precise();
-
- double ops_s = ((double)processed / (tsc_end - tsc_start))
- * rte_get_tsc_hz();
- double throughput = (ops_s * pparams->symmetric_op->p_len * 8)
- / 1000000000;
-
- if (!test_ops) {
- printf("\n%u\t\t%6.2f\t%16.2f\t%8"PRIu64"\t%10"PRIu64,
- pparams->symmetric_op->p_len,
- ops_s/1000000, throughput, retries, failed_polls);
- }
-
- for (i = 0; i < burst; i++)
- rte_pktmbuf_free(mbufs[i]);
-
- rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
- rte_cryptodev_sym_session_free(sess);
-
- return 0;
-}
-
-static int
-test_perf_AES_GCM(int continual_buf_len, int continual_size)
-{
- uint16_t i, j, k, loops = 1;
-
- uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 };
-
- static const struct cryptodev_perf_test_data *gcm_tests[] = {
- &AES_GCM_128_12IV_0AAD
- };
-
- if (continual_buf_len)
- loops = continual_size;
-
- int TEST_CASES_GCM = RTE_DIM(gcm_tests);
-
- const unsigned burst_size = 32;
-
- struct symmetric_op ops_set[TEST_CASES_GCM];
- struct perf_test_params params_set[TEST_CASES_GCM];
- struct symmetric_session_attrs session_attrs[TEST_CASES_GCM];
- static const struct cryptodev_perf_test_data *gcm_test;
-
- for (i = 0; i < TEST_CASES_GCM; ++i) {
-
- gcm_test = gcm_tests[i];
-
- session_attrs[i].aead =
- RTE_CRYPTO_AEAD_OP_ENCRYPT;
- session_attrs[i].aead_algorithm =
- RTE_CRYPTO_AEAD_AES_GCM;
- session_attrs[i].key_aead_data =
- gcm_test->key.data;
- session_attrs[i].key_aead_len =
- gcm_test->key.len;
- session_attrs[i].aad_len = gcm_test->aad.len;
- session_attrs[i].digest_len =
- gcm_test->auth_tag.len;
- session_attrs[i].iv_len = gcm_test->iv.len;
- session_attrs[i].iv_data = gcm_test->iv.data;
-
- ops_set[i].aad_data = gcm_test->aad.data;
- ops_set[i].p_data = gcm_test->plaintext.data;
- ops_set[i].p_len = buf_lengths[i];
- ops_set[i].c_data = gcm_test->ciphertext.data;
- ops_set[i].c_len = buf_lengths[i];
- ops_set[i].t_data = gcm_test->auth_tags[i].data;
- ops_set[i].t_len = gcm_test->auth_tags[i].len;
-
- params_set[i].chain = AEAD;
- params_set[i].session_attrs = &session_attrs[i];
- params_set[i].symmetric_op = &ops_set[i];
- if (continual_buf_len)
- params_set[i].total_operations = 0xFFFFFF;
- else
- params_set[i].total_operations = 1000000;
-
- params_set[i].burst_size = burst_size;
-
- }
-
- if (continual_buf_len)
- printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
- " burst size: %u", "AES_GCM", "AES_GCM",
- gcm_test->key.len << 3, burst_size);
-
- for (i = 0; i < RTE_DIM(gcm_tests); i++) {
-
- if (!continual_buf_len) {
- printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
- " burst size: %u", "AES_GCM", "AES_GCM",
- gcm_test->key.len << 3, burst_size);
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
- " Retries\tEmptyPolls");
- }
-
- uint16_t len = RTE_DIM(buf_lengths);
- uint16_t p = 0;
-
- if (continual_buf_len) {
- for (k = 0; k < RTE_DIM(buf_lengths); k++)
- if (buf_lengths[k] == continual_buf_len) {
- len = k + 1;
- p = k;
- break;
- }
- }
- for (j = p; j < len; ++j) {
-
- params_set[i].symmetric_op->c_len = buf_lengths[j];
- params_set[i].symmetric_op->p_len = buf_lengths[j];
-
- ops_set[i].t_data = gcm_tests[i]->auth_tags[j].data;
- ops_set[i].t_len = gcm_tests[i]->auth_tags[j].len;
-
- /* Run is twice, one for encryption/hash checks,
- * one for perf
- */
- if (perf_AES_GCM(testsuite_params.dev_id, 0,
- ¶ms_set[i], 1))
- return TEST_FAILED;
-
- for (k = 0; k < loops; k++) {
- if (continual_buf_len)
- printf("\n\nBuffer Size(B)\tOPS(M)\t"
- "Throughput(Gbps)\t"
- "Retries\tEmptyPolls");
- if (perf_AES_GCM(testsuite_params.dev_id, 0,
- ¶ms_set[i], 0))
- return TEST_FAILED;
- if (continual_buf_len)
- printf("\n\nCompleted loop %i of %i ...",
- k+1, loops);
- }
- }
-
- }
- printf("\n");
- return 0;
-}
-
-static int test_cryptodev_perf_AES_GCM(void)
-{
- return test_perf_AES_GCM(0, 0);
-}
-/*
- * This function calls AES GCM performance tests providing
- * size of packet as an argument. If size of packet is not
- * in the buf_lengths array, all sizes will be used
- */
-static int test_continual_perf_AES_GCM(void)
-{
- return test_perf_AES_GCM(1024, 10);
-}
-
-static int
-test_perf_continual_performance_test(void)
-{
- unsigned int total_operations = 0xFFFFFF;
- unsigned int total_loops = 10;
- unsigned int burst_size = 32;
- uint8_t i;
-
- struct perf_test_params params_set = {
- .total_operations = total_operations,
- .burst_size = burst_size,
- .buf_size = 1024,
-
- .chain = CIPHER_HASH,
-
- .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .key_length = 16,
- .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
- };
-
- for (i = 1; i <= total_loops; ++i) {
- printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
- " burst_size: %d ops\n",
- chain_mode_name(params_set.chain),
- rte_crypto_cipher_algorithm_strings[params_set.cipher_algo],
- rte_crypto_auth_algorithm_strings[params_set.auth_algo],
- params_set.key_length,
- burst_size);
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
- "Retries\tEmptyPolls\n");
- test_perf_aes_sha(testsuite_params.dev_id, 0,
- ¶ms_set);
- printf("\nCompleted loop %i of %i ...", i, total_loops);
- }
- return 0;
-}
-
-static struct unit_test_suite cryptodev_qat_continual_testsuite = {
- .suite_name = "Crypto Device Continual Performance Test",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_continual_performance_test),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_continual_perf_AES_GCM),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_testsuite = {
- .suite_name = "Crypto Device Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_cryptodev_perf_AES_GCM),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_aes_cbc_vary_burst_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = {
- .suite_name = "Crypto Device DPAA2_SEC Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_gcm_testsuite = {
- .suite_name = "Crypto Device AESNI GCM Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_cryptodev_perf_AES_GCM),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_aes_testsuite = {
- .suite_name = "Crypto Device AESNI MB Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_snow3g_testsuite = {
- .suite_name = "Crypto Device SNOW3G Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_snow3G_vary_pkt_size),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_snow3G_vary_burst_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_openssl_testsuite = {
- .suite_name = "Crypto Device OPENSSL Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_openssl_vary_pkt_size),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_openssl_vary_burst_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_armv8_testsuite = {
- .suite_name = "Crypto Device ARMv8 Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_armv8_vary_pkt_size),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_armv8_vary_burst_size),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static int
-perftest_aesni_gcm_cryptodev(void)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_gcm_testsuite);
-}
-
-static int
-perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_aes_testsuite);
-}
-
-static int
-perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_testsuite);
-}
-
-static int
-perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
-}
-
-static int
-perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
-}
-
-static int
-perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "OpenSSL PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_openssl_testsuite);
-}
-
-static int
-perftest_qat_continual_cryptodev(void)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_qat_continual_testsuite);
-}
-
-static int
-perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_armv8_testsuite);
-}
-
-static int
-perftest_dpaa2_sec_cryptodev(void)
-{
- gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
-
- if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
- "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
- "in config file to run this testsuite.\n");
- return TEST_FAILED;
- }
-
- return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
-}
-
-REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_openssl_perftest,
- perftest_openssl_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_qat_continual_perftest,
- perftest_qat_continual_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_sw_armv8_perftest,
- perftest_sw_armv8_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_perftest,
- perftest_dpaa2_sec_cryptodev);
--
2.9.4
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v5 2/5] net/i40e: implement dynamic mapping of sw flow types to hw pctypes
@ 2017-10-04 12:52 3% ` Kirill Rybalchenko
0 siblings, 0 replies; 200+ results
From: Kirill Rybalchenko @ 2017-10-04 12:52 UTC (permalink / raw)
To: dev; +Cc: kirill.rybalchenko, andrey.chilikin, beilei.xing, jingjing.wu
Implement dynamic mapping of software flow types to hardware pctypes.
This allows to add new flow types and pctypes for DDP without changing
API of the driver. The mapping table is located in private
data area for particular network adapter and can be individually
modified with set of appropriate functions.
v2:
Re-arrange patchset to avoid compillation errors.
Remove usage of statically defined flow types and pctypes.
v3:
Change prototypes of some static functions.
Fixe bugs in i40e_pctype_to_flowtype and i40e_flowtype_to_pctype
functions.
Various small modifications after reviewing.
v4:
Change prototypes of some static functions.
Move declaration of automatic variables to beginning of function.
Move declaration of I40E_FILTER_PCTYPE_INVALID to i40e_ethdev.h
v5:
Fix code style warnings.
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 347 ++++++++++++--------------------------
drivers/net/i40e/i40e_ethdev.h | 23 ++-
drivers/net/i40e/i40e_ethdev_vf.c | 16 +-
drivers/net/i40e/i40e_fdir.c | 54 +++---
drivers/net/i40e/i40e_flow.c | 5 +-
drivers/net/i40e/i40e_rxtx.c | 58 +++++++
drivers/net/i40e/i40e_rxtx.h | 1 +
7 files changed, 218 insertions(+), 286 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 41c4033..0b151a0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1070,6 +1070,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
return 0;
}
i40e_set_default_ptype_table(dev);
+ i40e_set_default_pctype_table(dev);
pci_dev = RTE_ETH_DEV_TO_PCI(dev);
intr_handle = &pci_dev->intr_handle;
@@ -3020,7 +3021,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) *
sizeof(uint32_t);
dev_info->reta_size = pf->hash_lut_size;
- dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+ dev_info->flow_type_rss_offloads = pf->adapter->flow_types_mask;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_thresh = {
@@ -6611,104 +6612,36 @@ i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr)
/* Configure hash enable flags for RSS */
uint64_t
-i40e_config_hena(uint64_t flags, enum i40e_mac_type type)
+i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags)
{
uint64_t hena = 0;
+ int i;
if (!flags)
return hena;
- if (flags & ETH_RSS_FRAG_IPV4)
- hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4;
- if (flags & ETH_RSS_NONFRAG_IPV4_TCP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV4_UDP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV4_SCTP)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
- if (flags & ETH_RSS_NONFRAG_IPV4_OTHER)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
- if (flags & ETH_RSS_FRAG_IPV6)
- hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6;
- if (flags & ETH_RSS_NONFRAG_IPV6_TCP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (flags & (1ULL << i))
+ hena |= adapter->pctypes_tbl[i];
}
- if (flags & ETH_RSS_NONFRAG_IPV6_UDP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV6_SCTP)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
- if (flags & ETH_RSS_NONFRAG_IPV6_OTHER)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
- if (flags & ETH_RSS_L2_PAYLOAD)
- hena |= 1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD;
return hena;
}
/* Parse the hash enable flags */
uint64_t
-i40e_parse_hena(uint64_t flags)
+i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags)
{
uint64_t rss_hf = 0;
if (!flags)
return rss_hf;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4))
- rss_hf |= ETH_RSS_FRAG_IPV4;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_SCTP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_OTHER;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6))
- rss_hf |= ETH_RSS_FRAG_IPV6;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_SCTP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_OTHER;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
- rss_hf |= ETH_RSS_L2_PAYLOAD;
+ int i;
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (flags & adapter->pctypes_tbl[i])
+ rss_hf |= (1ULL << i);
+ }
return rss_hf;
}
@@ -6799,7 +6732,7 @@ i40e_hw_rss_hash_set(struct i40e_pf *pf, struct rte_eth_rss_conf *rss_conf)
if (ret)
return ret;
- hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+ hena = i40e_config_hena(pf->adapter, rss_conf->rss_hf);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (uint32_t)hena);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), (uint32_t)(hena >> 32));
I40E_WRITE_FLUSH(hw);
@@ -6813,14 +6746,13 @@ i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+ uint64_t rss_hf = rss_conf->rss_hf & pf->adapter->flow_types_mask;
uint64_t hena;
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
- if (!(hena & ((hw->mac.type == I40E_MAC_X722)
- ? I40E_RSS_HENA_ALL_X722
- : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+ if (!(hena & pf->adapter->pctypes_mask)) { /* RSS disabled */
if (rss_hf != 0) /* Enable RSS */
return -EINVAL;
return 0; /* Nothing to do */
@@ -6845,7 +6777,7 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
- rss_conf->rss_hf = i40e_parse_hena(hena);
+ rss_conf->rss_hf = i40e_parse_hena(pf->adapter, hena);
return 0;
}
@@ -7620,7 +7552,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)
}
rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
- if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+ if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) {
i40e_pf_disable_rss(pf);
return 0;
}
@@ -7841,9 +7773,9 @@ static int
i40e_get_hash_filter_global_config(struct i40e_hw *hw,
struct rte_eth_hash_global_conf *g_cfg)
{
- uint32_t reg, mask = I40E_FLOW_TYPES;
- uint16_t i;
- enum i40e_filter_pctype pctype;
+ struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
+ uint32_t reg;
+ uint16_t i, j;
memset(g_cfg, 0, sizeof(*g_cfg));
reg = i40e_read_rx_ctl(hw, I40E_GLQF_CTL);
@@ -7854,29 +7786,38 @@ i40e_get_hash_filter_global_config(struct i40e_hw *hw,
PMD_DRV_LOG(DEBUG, "Hash function is %s",
(reg & I40E_GLQF_CTL_HTOEP_MASK) ? "Toeplitz" : "Simple XOR");
- for (i = 0; mask && i < RTE_ETH_FLOW_MAX; i++) {
- if (!(mask & (1UL << i)))
- continue;
- mask &= ~(1UL << i);
- /* Bit set indicats the coresponding flow type is supported */
- g_cfg->valid_bit_mask[0] |= (1UL << i);
- /* if flowtype is invalid, continue */
- if (!I40E_VALID_FLOW(i))
+ /*
+ * We work only with lowest 32 bits which is not correct, but to work
+ * properly the valid_bit_mask size should be increased up to 64 bits
+ * and this will brake ABI. This modification will be done in next
+ * release
+ */
+ g_cfg->valid_bit_mask[0] = (uint32_t)adapter->flow_types_mask;
+
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < UINT32_BIT; i++) {
+ if (!adapter->pctypes_tbl[i])
continue;
- pctype = i40e_flowtype_to_pctype(i);
- reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(pctype));
- if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK)
- g_cfg->sym_hash_enable_mask[0] |= (1UL << i);
+ for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+ j < I40E_FILTER_PCTYPE_MAX; j++) {
+ if (adapter->pctypes_tbl[i] & (1ULL << j)) {
+ reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(j));
+ if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK) {
+ g_cfg->sym_hash_enable_mask[0] |=
+ (1UL << i);
+ }
+ }
+ }
}
return 0;
}
static int
-i40e_hash_global_config_check(struct rte_eth_hash_global_conf *g_cfg)
+i40e_hash_global_config_check(const struct i40e_adapter *adapter,
+ const struct rte_eth_hash_global_conf *g_cfg)
{
uint32_t i;
- uint32_t mask0, i40e_mask = I40E_FLOW_TYPES;
+ uint32_t mask0, i40e_mask = adapter->flow_types_mask;
if (g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&
g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
@@ -7919,64 +7860,36 @@ static int
i40e_set_hash_filter_global_config(struct i40e_hw *hw,
struct rte_eth_hash_global_conf *g_cfg)
{
+ struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
int ret;
- uint16_t i;
+ uint16_t i, j;
uint32_t reg;
- uint32_t mask0 = g_cfg->valid_bit_mask[0];
- enum i40e_filter_pctype pctype;
+ /*
+ * We work only with lowest 32 bits which is not correct, but to work
+ * properly the valid_bit_mask size should be increased up to 64 bits
+ * and this will brake ABI. This modification will be done in next
+ * release
+ */
+ uint32_t mask0 = g_cfg->valid_bit_mask[0] &
+ (uint32_t)adapter->flow_types_mask;
/* Check the input parameters */
- ret = i40e_hash_global_config_check(g_cfg);
+ ret = i40e_hash_global_config_check(adapter, g_cfg);
if (ret < 0)
return ret;
- for (i = 0; mask0 && i < UINT32_BIT; i++) {
- if (!(mask0 & (1UL << i)))
- continue;
- mask0 &= ~(1UL << i);
- /* if flowtype is invalid, continue */
- if (!I40E_VALID_FLOW(i))
- continue;
- pctype = i40e_flowtype_to_pctype(i);
- reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
- I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
- if (hw->mac.type == I40E_MAC_X722) {
- if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_UDP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP),
- reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_UDP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP),
- reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK),
- reg);
- } else {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype),
- reg);
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; mask0 && i < UINT32_BIT; i++) {
+ if (mask0 & (1UL << i)) {
+ reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
+ I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
+
+ for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+ j < I40E_FILTER_PCTYPE_MAX; j++) {
+ if (adapter->pctypes_tbl[i] & (1ULL << j))
+ i40e_write_rx_ctl(hw,
+ I40E_GLQF_HSYM(j),
+ reg);
}
- } else {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype), reg);
}
}
@@ -8598,16 +8511,14 @@ i40e_filter_input_set_init(struct i40e_pf *pf)
uint64_t input_set, inset_reg;
uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
int num, i;
+ uint16_t flow_type;
for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722(pctype))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE(pctype))
- continue;
- }
+ flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
input_set = i40e_get_default_input_set(pctype);
@@ -8670,7 +8581,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
return -EINVAL;
}
- if (!I40E_VALID_FLOW(conf->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
@@ -8678,10 +8590,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
if (hw->mac.type == I40E_MAC_X722) {
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(hw,
- I40E_GLQF_FD_PCTYPES((int)i40e_flowtype_to_pctype(
- conf->flow_type)));
- } else
- pctype = i40e_flowtype_to_pctype(conf->flow_type);
+ I40E_GLQF_FD_PCTYPES((int)pctype));
+ }
ret = i40e_parse_input_set(&input_set, pctype, conf->field,
conf->inset_size);
@@ -8689,11 +8599,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
PMD_DRV_LOG(ERR, "Failed to parse input set");
return -EINVAL;
}
- if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_HASH,
- input_set) != 0) {
- PMD_DRV_LOG(ERR, "Invalid input set");
- return -EINVAL;
- }
+
if (conf->op == RTE_ETH_INPUT_SET_ADD) {
/* get inset value in register */
inset_reg = i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, pctype));
@@ -8747,24 +8653,19 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,
return -EINVAL;
}
- if (!I40E_VALID_FLOW(conf->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
- pctype = i40e_flowtype_to_pctype(conf->flow_type);
-
ret = i40e_parse_input_set(&input_set, pctype, conf->field,
conf->inset_size);
if (ret) {
PMD_DRV_LOG(ERR, "Failed to parse input set");
return -EINVAL;
}
- if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
- input_set) != 0) {
- PMD_DRV_LOG(ERR, "Invalid input set");
- return -EINVAL;
- }
/* get inset value in register */
inset_reg = i40e_read_rx_ctl(hw, I40E_PRTQF_FD_INSET(pctype, 1));
@@ -9203,72 +9104,42 @@ i40e_hw_init(struct rte_eth_dev *dev)
i40e_set_symmetric_hash_enable_per_port(hw, 0);
}
+/*
+ * For X722 it is possible to have multiple pctypes mapped to the same flowtype
+ * however this function will return only one highest pctype index,
+ * which is not quite correct. This is known problem of i40e driver
+ * and needs to be fixed later.
+ */
enum i40e_filter_pctype
-i40e_flowtype_to_pctype(uint16_t flow_type)
-{
- static const enum i40e_filter_pctype pctype_table[] = {
- [RTE_ETH_FLOW_FRAG_IPV4] = I40E_FILTER_PCTYPE_FRAG_IPV4,
- [RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_UDP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_SCTP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
- I40E_FILTER_PCTYPE_NONF_IPV4_OTHER,
- [RTE_ETH_FLOW_FRAG_IPV6] = I40E_FILTER_PCTYPE_FRAG_IPV6,
- [RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_UDP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_SCTP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
- I40E_FILTER_PCTYPE_NONF_IPV6_OTHER,
- [RTE_ETH_FLOW_L2_PAYLOAD] = I40E_FILTER_PCTYPE_L2_PAYLOAD,
- };
+i40e_flowtype_to_pctype(const struct i40e_adapter *adapter, uint16_t flow_type)
+{
+ int i;
+ uint64_t pctype_mask;
- return pctype_table[flow_type];
+ if (flow_type < I40E_FLOW_TYPE_MAX) {
+ pctype_mask = adapter->pctypes_tbl[flow_type];
+ for (i = I40E_FILTER_PCTYPE_MAX - 1; i > 0; i--) {
+ if (pctype_mask & (1ULL << i))
+ return (enum i40e_filter_pctype)i;
+ }
+ }
+ return I40E_FILTER_PCTYPE_INVALID;
}
uint16_t
-i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
+i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+ enum i40e_filter_pctype pctype)
{
- static const uint16_t flowtype_table[] = {
- [I40E_FILTER_PCTYPE_FRAG_IPV4] = RTE_ETH_FLOW_FRAG_IPV4,
- [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK] =
- RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_SCTP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] =
- RTE_ETH_FLOW_NONFRAG_IPV4_OTHER,
- [I40E_FILTER_PCTYPE_FRAG_IPV6] = RTE_ETH_FLOW_FRAG_IPV6,
- [I40E_FILTER_PCTYPE_NONF_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_TCP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK] =
- RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_SCTP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_SCTP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] =
- RTE_ETH_FLOW_NONFRAG_IPV6_OTHER,
- [I40E_FILTER_PCTYPE_L2_PAYLOAD] = RTE_ETH_FLOW_L2_PAYLOAD,
- };
+ uint16_t flowtype;
+ uint64_t pctype_mask = 1ULL << pctype;
+
+ for (flowtype = RTE_ETH_FLOW_UNKNOWN + 1; flowtype < I40E_FLOW_TYPE_MAX;
+ flowtype++) {
+ if (adapter->pctypes_tbl[flowtype] & pctype_mask)
+ return flowtype;
+ }
- return flowtype_table[pctype];
+ return RTE_ETH_FLOW_UNKNOWN;
}
/*
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ad80f0f..5b84da2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -478,8 +478,9 @@ struct i40e_fdir_flex_mask {
} bitmask[I40E_FDIR_BITMASK_NUM_WORD];
};
-#define I40E_FILTER_PCTYPE_MAX 64
-#define I40E_MAX_FDIR_FILTER_NUM (1024 * 8)
+#define I40E_FILTER_PCTYPE_INVALID 0
+#define I40E_FILTER_PCTYPE_MAX 64
+#define I40E_MAX_FDIR_FILTER_NUM (1024 * 8)
struct i40e_fdir_filter {
TAILQ_ENTRY(i40e_fdir_filter) rules;
@@ -852,7 +853,8 @@ struct i40e_vf {
uint64_t flags;
};
-#define I40E_MAX_PKT_TYPE 256
+#define I40E_MAX_PKT_TYPE 256
+#define I40E_FLOW_TYPE_MAX 64
/*
* Structure to store private data for each PF/VF instance.
@@ -881,6 +883,10 @@ struct i40e_adapter {
/* ptype mapping table */
uint32_t ptype_tbl[I40E_MAX_PKT_TYPE] __rte_cache_min_aligned;
+ /* flow type to pctype mapping table */
+ uint64_t pctypes_tbl[I40E_FLOW_TYPE_MAX] __rte_cache_min_aligned;
+ uint64_t flow_types_mask;
+ uint64_t pctypes_mask;
};
extern const struct rte_flow_ops i40e_flow_ops;
@@ -925,8 +931,8 @@ int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
struct i40e_vsi_vlan_pvid_info *info);
int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on);
-uint64_t i40e_config_hena(uint64_t flags, enum i40e_mac_type type);
-uint64_t i40e_parse_hena(uint64_t flags);
+uint64_t i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags);
+uint64_t i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags);
enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
enum i40e_status_code i40e_fdir_setup_rx_resources(struct i40e_pf *pf);
int i40e_fdir_setup(struct i40e_pf *pf);
@@ -935,8 +941,11 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name,
int socket_id);
int i40e_fdir_configure(struct rte_eth_dev *dev);
void i40e_fdir_teardown(struct i40e_pf *pf);
-enum i40e_filter_pctype i40e_flowtype_to_pctype(uint16_t flow_type);
-uint16_t i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype);
+enum i40e_filter_pctype
+ i40e_flowtype_to_pctype(const struct i40e_adapter *adapter,
+ uint16_t flow_type);
+uint16_t i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+ enum i40e_filter_pctype pctype);
int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
enum rte_filter_op filter_op,
void *arg);
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a903deb..111ac39 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1443,6 +1443,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
i40e_set_default_ptype_table(eth_dev);
+ i40e_set_default_pctype_table(eth_dev);
rte_eth_copy_pci_info(eth_dev, pci_dev);
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
@@ -2178,7 +2179,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX;
dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t);
dev_info->reta_size = ETH_RSS_RETA_SIZE_64;
- dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+ dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask;
dev_info->max_mac_addrs = I40E_NUM_MACADDR_MAX;
dev_info->rx_offload_capa =
DEV_RX_OFFLOAD_VLAN_STRIP |
@@ -2506,7 +2507,7 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct rte_eth_rss_conf *rss_conf)
if (ret)
return ret;
- hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+ hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
I40EVF_WRITE_FLUSH(hw);
@@ -2549,7 +2550,7 @@ i40evf_config_rss(struct i40e_vf *vf)
}
rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
- if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+ if ((rss_conf.rss_hf & vf->adapter->flow_types_mask) == 0) {
i40evf_disable_rss(vf);
PMD_DRV_LOG(DEBUG, "No hash flag is set");
return 0;
@@ -2574,14 +2575,13 @@ i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
{
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+ uint64_t rss_hf = rss_conf->rss_hf & vf->adapter->flow_types_mask;
uint64_t hena;
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
- if (!(hena & ((hw->mac.type == I40E_MAC_X722)
- ? I40E_RSS_HENA_ALL_X722
- : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+ if (!(hena & vf->adapter->pctypes_mask)) { /* RSS disabled */
if (rss_hf != 0) /* Enable RSS */
return -EINVAL;
return 0;
@@ -2607,7 +2607,7 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
- rss_conf->rss_hf = i40e_parse_hena(hena);
+ rss_conf->rss_hf = i40e_parse_hena(vf->adapter, hena);
return 0;
}
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 84c0a1f..268ada0 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -323,6 +323,7 @@ i40e_init_flx_pld(struct i40e_pf *pf)
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint8_t pctype;
int i, index;
+ uint16_t flow_type;
/*
* Define the bytes stream extracted as flexible payload in
@@ -344,15 +345,10 @@ i40e_init_flx_pld(struct i40e_pf *pf)
/* initialize the masks */
for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722(
- (enum i40e_filter_pctype)pctype))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE(
- (enum i40e_filter_pctype)pctype))
- continue;
- }
+ flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
pf->fdir.flex_mask[pctype].word_mask = 0;
i40e_write_rx_ctl(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -449,7 +445,8 @@ i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg)
* arguments are valid
*/
static int
-i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
+i40e_check_fdir_flex_conf(const struct i40e_adapter *adapter,
+ const struct rte_eth_fdir_flex_conf *conf)
{
const struct rte_eth_flex_payload_cfg *flex_cfg;
const struct rte_eth_fdir_flex_mask *flex_mask;
@@ -457,6 +454,7 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
uint8_t nb_bitmask;
uint16_t i, j;
int ret = 0;
+ enum i40e_filter_pctype pctype;
if (conf == NULL) {
PMD_DRV_LOG(INFO, "NULL pointer.");
@@ -487,7 +485,8 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
}
for (i = 0; i < conf->nb_flexmasks; i++) {
flex_mask = &conf->flex_mask[i];
- if (!I40E_VALID_FLOW(flex_mask->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(adapter, flex_mask->flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(WARNING, "invalid flow type.");
return -EINVAL;
}
@@ -650,7 +649,7 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
i40e_init_flx_pld(pf); /* set flex config to default value */
conf = &dev->data->dev_conf.fdir_conf.flex_conf;
- ret = i40e_check_fdir_flex_conf(conf);
+ ret = i40e_check_fdir_flex_conf(pf->adapter, conf);
if (ret < 0) {
PMD_DRV_LOG(ERR, " invalid configuration arguments.");
return -EINVAL;
@@ -664,11 +663,11 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
hw, I40E_GLQF_FD_PCTYPES(
- (int)i40e_flowtype_to_pctype(
+ (int)i40e_flowtype_to_pctype(pf->adapter,
conf->flex_mask[i].flow_type)));
} else
- pctype = i40e_flowtype_to_pctype(
- conf->flex_mask[i].flow_type);
+ pctype = i40e_flowtype_to_pctype(pf->adapter,
+ conf->flex_mask[i].flow_type);
i40e_set_flex_mask_on_pctype(pf, pctype, &conf->flex_mask[i]);
}
@@ -1100,7 +1099,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (!I40E_VALID_FLOW(filter->input.flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, filter->input.flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
@@ -1141,12 +1141,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
if (hw->mac.type == I40E_MAC_X722) {
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
- hw, I40E_GLQF_FD_PCTYPES(
- (int)i40e_flowtype_to_pctype(
- filter->input.flow_type)));
- } else
- pctype = i40e_flowtype_to_pctype(filter->input.flow_type);
-
+ hw, I40E_GLQF_FD_PCTYPES((int)pctype));
+ }
ret = i40e_fdir_filter_programming(pf, pctype, filter, add);
if (ret < 0) {
PMD_DRV_LOG(ERR, "fdir programming fails for PCTYPE(%u).",
@@ -1384,7 +1380,6 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
{
struct i40e_fdir_flex_mask *mask;
struct rte_eth_fdir_flex_mask *ptr = flex_mask;
- struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint16_t flow_type;
uint8_t i, j;
uint16_t off_bytes, mask_tmp;
@@ -1393,14 +1388,11 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
i++) {
mask = &pf->fdir.flex_mask[i];
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722((enum i40e_filter_pctype)i))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
- continue;
- }
- flow_type = i40e_pctype_to_flowtype((enum i40e_filter_pctype)i);
+ flow_type = i40e_pctype_to_flowtype(pf->adapter,
+ (enum i40e_filter_pctype)i);
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
+
for (j = 0; j < I40E_FDIR_MAX_FLEXWORD_NUM; j++) {
if (mask->word_mask & I40E_FLEX_WORD_MASK(j)) {
ptr->mask[j * sizeof(uint16_t)] = UINT8_MAX;
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index b92719a..5d8afc6 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -2776,8 +2776,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
}
}
- pctype = i40e_flowtype_to_pctype(flow_type);
- if (pctype == 0 || pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID ||
+ pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM, item,
"Unsupported flow type");
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 3a7b68e..f69050f 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2943,6 +2943,64 @@ i40e_set_default_ptype_table(struct rte_eth_dev *dev)
ad->ptype_tbl[i] = i40e_get_default_pkt_type(i);
}
+void __attribute__((cold))
+i40e_set_default_pctype_table(struct rte_eth_dev *dev)
+{
+ struct i40e_adapter *ad =
+ I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ int i;
+
+ for (i = 0; i < I40E_FLOW_TYPE_MAX; i++)
+ ad->pctypes_tbl[i] = 0ULL;
+ ad->flow_types_mask = 0ULL;
+ ad->pctypes_mask = 0ULL;
+
+ ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV4] =
+ (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER);
+ ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV6] =
+ (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER);
+ ad->pctypes_tbl[RTE_ETH_FLOW_L2_PAYLOAD] =
+ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD);
+
+ if (hw->mac.type == I40E_MAC_X722) {
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
+ }
+
+ for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (ad->pctypes_tbl[i])
+ ad->flow_types_mask |= (1ULL << i);
+ ad->pctypes_mask |= ad->pctypes_tbl[i];
+ }
+}
+
/* Stubs needed for linkage when CONFIG_RTE_I40E_INC_VECTOR is set to 'n' */
int __attribute__((weak))
i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev)
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 20084d6..2a58ced 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -255,6 +255,7 @@ void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
struct i40e_tx_queue *txq);
void i40e_set_tx_function(struct rte_eth_dev *dev);
void i40e_set_default_ptype_table(struct rte_eth_dev *dev);
+void i40e_set_default_pctype_table(struct rte_eth_dev *dev);
/* For each value it means, datasheet of hardware can tell more details
*
--
2.5.5
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v4] Policy Based Power Control for Guest
@ 2017-10-04 9:15 3% ` David Hunt
2017-10-04 15:25 2% ` [dpdk-dev] [PATCH v5 0/9] " David Hunt
0 siblings, 1 reply; 200+ results
From: David Hunt @ 2017-10-04 9:15 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V4 patchset changes:
* None, replying into correct email thread. V3 was a reply to the
turbo patch set, should have been inband policy power patchset.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpU0 IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v6 0/4] ethdev new offloads API
2017-09-28 18:54 4% ` [dpdk-dev] [PATCH v5 " Shahaf Shuler
@ 2017-10-04 8:17 4% ` Shahaf Shuler
2017-10-04 16:12 0% ` Ananyev, Konstantin
0 siblings, 1 reply; 200+ results
From: Shahaf Shuler @ 2017-10-04 8:17 UTC (permalink / raw)
To: konstantin.ananyev, thomas, arybchenko, jerin.jacob, ferruh.yigit; +Cc: dev
Tx offloads configuration is per queue. Tx offloads are enabled by default,
and can be disabled using ETH_TXQ_FLAGS_NO* flags.
This behaviour is not consistent with the Rx side where the Rx offloads
configuration is per port. Rx offloads are disabled by default and enabled
according to bit field in rte_eth_rxmode structure.
Moreover, considering more Tx and Rx offloads will be added
over time, the cost of managing them all inside the PMD will be tremendous,
as the PMD will need to check the matching for the entire offload set
for each mbuf it handles.
In addition, on the current approach each Rx offload added breaks the
ABI compatibility as it requires to add entries to existing bit-fields.
The series address above issues by defining a new offloads API.
In the new API, offloads are divided into per-port and per-queue offloads,
with a corresponding capability for each.
The offloads are disabled by default. Each offload can be enabled or
disabled using the existing DEV_TX_OFFLOADS_* or DEV_RX_OFFLOADS_* flags.
Such API will enable to easily add or remove offloads, without breaking the
ABI compatibility.
In order to provide a smooth transition between the APIs the following actions
were taken:
* The old offloads API is kept for the meanwhile.
* Helper function which copy from old to new API were added to ethdev,
enabling the PMD to support only one of the APIs.
* Helper function which copy from new to old API were also added,
to enable application to use the new API with PMD which still supports
the old one.
Per discussion made on the RFC of this series [1], the integration plan which was
decided is to do the transition in two phases:
* ethdev API will move on 17.11.
* Apps and examples will move on 18.02.
This to enable PMD maintainers sufficient time to adopt the new API.
[1]
http://dpdk.org/ml/archives/dev/2017-August/072643.html
on v6:
- Move mbuf fast free Tx offload to a seperate patch.
on v5:
- Fix documentation.
- Fix comments on port offloads configuration.
on v4:
- Added another patch for documentation.
- Fixed ETH_TXQ_FLAGS_IGNORE flag override.
- Clarify the description of DEV_TX_OFFLOAD_MBUF_FAST_FREE offload.
on v3:
- Introduce the DEV_TX_OFFLOAD_MBUF_FAST_FREE to act as an equivalent
for the no refcnt and single mempool flags.
- Fix features documentation.
- Fix comment style.
on v2:
- Taking new approach of dividing offloads into per-queue and per-port one.
- Postpone the Tx/Rx public struct renaming to 18.02
- Squash the helper functions into the Rx/Tx offloads intro patches.
Shahaf Shuler (4):
ethdev: introduce Rx queue offloads API
ethdev: introduce Tx queue offloads API
ethdev: add mbuf fast free Tx offload
doc: add details on ethdev offloads API
doc/guides/nics/features.rst | 66 +++++---
doc/guides/nics/features/default.ini | 1 +
doc/guides/prog_guide/poll_mode_drv.rst | 20 +++
lib/librte_ether/rte_ethdev.c | 223 +++++++++++++++++++++++++--
lib/librte_ether/rte_ethdev.h | 89 ++++++++++-
5 files changed, 359 insertions(+), 40 deletions(-)
Series-reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
--
2.12.0
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
2017-10-03 14:29 0% ` Mokhtar, Amr
@ 2017-10-03 15:17 4% ` Thomas Monjalon
2017-10-04 17:11 0% ` Flavio Leitner
2017-10-05 21:55 0% ` Mokhtar, Amr
0 siblings, 2 replies; 200+ results
From: Thomas Monjalon @ 2017-10-03 15:17 UTC (permalink / raw)
To: Mokhtar, Amr; +Cc: dev, fbl, aconole, bluca
03/10/2017 16:29, Mokhtar, Amr:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 25/08/2017 15:46, Amr Mokhtar:
> > > +int
> > > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > > + const struct rte_bbdev_conf *conf);
> >
> > I am not convinced by the "configure all" function in ethdev.
> > We break the ABI each time we add a new feature to configure.
> > And it does not really help to have all configurations in one struct.
> > Would you mind to split the struct rte_bbdev_conf and split the function
> > accordingly?
>
> There is nothing to split tbh. The only parameter it has is the socket_id.
> And in fact, it's optional, can be null. The only config we need is num_queues.
Indeed, there is nothing in this struct.
If you need only to allocate queues, you just have to rename this function.
> I don't see in the near future that we may need to add more config params.
> As a side, in the time of the implementation we were trying to avoid any
> diversions from the current design ideology of ethdev and cryptodev.
There is no ideology in ethdev, just some mistakes ;)
> Can we leave it for consideration with future releases?
No it should be addressed from the beginning.
When you will need to add something more to configure port-wise,
you should add a new function instead of breaking the ABI
of the global conf struct.
That's why the configure option should be more specialized.
Distro people were complaining about ABI breakage last week.
This is exactly an example of how to avoid it from the beginning.
> > [...]
> > > +struct __rte_cache_aligned rte_bbdev {
> > > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue function */
> > > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue function */
> > > + const struct rte_bbdev_ops *dev_ops; /**< Functions exported by PMD
> > */
> > > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > > + bool attached; /**< If device is currently attached or not */
> >
> > What "attached" means?
> > I'm afraid you are trying to manage hotplug in the wrong layer.
>
> Hotplug is not supported in the current release.
It is not answering the question.
What is an "attached" device?
> > [...]
> > > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > > + int status; /**< Status of operation that was performed */
> > > + struct rte_mempool *mempool; /**< Mempool which op instance is in
> > */
> > > + void *opaque_data; /**< Opaque pointer for user data */
> > > + /**
> > > + * Anonymous union of operation-type specific parameters. When
> > allocated
> > > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > > + * parameters at the end of each rte_bbdev_op structure, and the
> > > + * pointers here point to it.
> > > + */
> > > + RTE_STD_C11
> > > + union {
> > > + void *generic;
> > > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > > + };
> > > +};
> >
> > I am not sure it is a good idea to fit every operations
> > in the same struct and the same functions.
>
> Due to the fact that our design adopts this idea that a device can support both
> the encode and decode operations.
> Then, at the time of PMD registration, the enqueue functions is allocated.
> This enqueue() function is common for both operations.
> This fitted operation structure is essential for the driver to decide on the operation.
Sorry I do not understand why you must have a "generic operation".
Please, could you try again to explain this design to someone
not fully understanding how turbo enc/dec works?
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v3 0/9] Policy Based Power Control for Guest
@ 2017-10-03 14:08 3% ` David Hunt
2017-10-11 16:18 2% ` [dpdk-dev] [PATCH v9 " David Hunt
1 sibling, 0 replies; 200+ results
From: David Hunt @ 2017-10-03 14:08 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, jingjing.wu
Policy Based Power Control for Guest
This patchset adds the facility for a guest VM to send a policy down to the
host that will allow the host to scale up/down cpu frequencies
depending on the policy criteria independently of the DPDK app running in
the guest. This differs from the previous vm_power implementation where
individual scale up/down requests were send from the guest to the host via
virtio-serial.
V3 patchset changes:
* Changed to using is_same_ether_addr() instead of looping through
the mac address bytes to compare them.
* Tweaked some comments and working in the i40e patch after review.
* Added a patch to the set to add new i40e function to map file, so
as to allow shared library builds. The power library API needs a cleanup
in next release, so will add API/ABI warning for this cleanup in a
separate patch.
V2 patchset changes:
* Removed API's in ethdev layer.
* Now just a single new API in the i40e driver for mapping VF MAC to
VF index.
* Moved new function from rte_rxtx.c to rte_pmd_i40e.c
* Removed function for reading i40e register, moved to using the
standard stats API.
* Renamed i40e function to rte_pmd_i40e_query_vfid_by_mac
* Cleaned up policy generation code.
It's a modification of the vm_power_manager app that runs in the host, and
the guest_vm_power_app example app that runs in the guest. This allows the
guest to send down a policy to the host via virtio-serial, which then allows
the host to scale up/down based on the criteria in the policy, resulting in
quicker scale up/down than individual requests coming from the guest.
It also means that the DPDK application running in the guest does not need
to be modified in any way, it is unaware that it's cores are being scaled
up/down, reducing the effort in implementing a power-aware infrastructure.
The usage model is as follows:
1. Set up the VF's and assign to the guest in the usual way.
2. run vm_power_manager on the host, creating a channel to the guest.
3. Start the guest_vm_power_mgr app on the guest, which establishes
a virtio-serial channel to the host.
4. Send down the profile for the guest using the "send_profile now" command.
There is an example profile hard-coded into guest_vm_power_mgr.
5. Stop the guest_vm_power_mgr and run your normal power-unaware application.
6. Send traffic into the VFs at varying traffic rates.
Observe the frequency change on the host (turbostat -i 1)
The sequence of code changes are as follows:
A new function has been aded to the i40e driver to allow mapping of
a VF MAC to VF index.
Next we make an addition to librte_power that adds an extra command to allow
the passing of a policy structure from the guest to the host. This struct
contains information like busy/quiet hour, packet throughput thresholds, etc.
The next addition adds functionality to convert the virtual CPU (vcpu) IDs to
physical CPU (pcpu) IDs so that the host can scale up/down the cores used
in the guest.
The remaining patches are functionality to process the policy, and take action
when the relevant trigger occurs to cause a frequency change.
[1/9] net/i40e: add API to convert VF MAC to VF id
[2/9] lib/librte_power: add extra msg type for policies
[3/9] examples/vm_power_mgr: add vcpu to pcpu mapping
[4/9] examples/vm_power_mgr: add scale to medium freq fn
[5/9] examples/vm_power_mgr: add policy to channels
[6/9] examples/vm_power_mgr: add port initialisation
[7/9] power: add send channel msg function to map file
[8/9] examples/guest_cli: add send policy to host
[9/9] examples/vm_power_mgr: set MAC address of VF
^ permalink raw reply [relevance 3%]
* Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
@ 2017-10-03 14:29 0% ` Mokhtar, Amr
2017-10-03 15:17 4% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Mokhtar, Amr @ 2017-10-03 14:29 UTC (permalink / raw)
To: thomas; +Cc: dev
Hi Thomas,
Thanks for reviewing.. Kindly find my reply in-line below..
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday 21 September 2017 15:56
> To: Mokhtar, Amr <amr.mokhtar@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC] Wireless Base Band Device (bbdev)
>
> 25/08/2017 15:46, Amr Mokhtar:
> > +/**
> > + * Configure a device.
> > + * This function must be called on a device before setting up the
> > +queues and
> > + * starting the device. It can also be called when a device is in the
> > +stopped
> > + * state. If any device queues have been configured their
> > +configuration will be
> > + * cleared by a call to this function.
> > + *
> > + * @param dev_id
> > + * The identifier of the device.
> > + * @param num_queues
> > + * Number of queues to configure on device.
> > + * @param conf
> > + * The device configuration. If NULL, a default configuration will be used.
> > + *
> > + * @return
> > + * - 0 on success
> > + * - EINVAL if num_queues is invalid, 0 or greater than maximum
> > + * - EBUSY if the identified device has already started
> > + * - ENOMEM if unable to allocate memory
> > + */
> > +int
> > +rte_bbdev_configure(uint8_t dev_id, uint16_t num_queues,
> > + const struct rte_bbdev_conf *conf);
>
> I am not convinced by the "configure all" function in ethdev.
> We break the ABI each time we add a new feature to configure.
> And it does not really help to have all configurations in one struct.
> Would you mind to split the struct rte_bbdev_conf and split the function
> accordingly?
There is nothing to split tbh. The only parameter it has is the socket_id.
And in fact, it's optional, can be null. The only config we need is num_queues.
I don't see in the near future that we may need to add more config params.
As a side, in the time of the implementation we were trying to avoid any
diversions from the current design ideology of ethdev and cryptodev.
Can we leave it for consideration with future releases?
>
> [...]
> > +struct rte_bbdev_info {
> > + int socket_id; /**< NUMA socket that device is on */
> > + const char *dev_name; /**< Unique device name */
> > + const struct rte_pci_device *pci_dev; /**< PCI information */
> > + unsigned int num_queues; /**< Number of queues currently configured
> */
> > + struct rte_bbdev_conf conf; /**< Current device configuration */
> > + bool started; /**< Set if device is currently started */
> > + struct rte_bbdev_driver_info drv; /**< Info from device driver */
> > +};
>
> As Stephen said, PCI must not appear in this API.
> Please use the bus abstraction.
Done.
>
> [...]
> > +struct __rte_cache_aligned rte_bbdev {
> > + rte_bbdev_enqueue_ops_t enqueue_ops; /**< Enqueue function */
> > + rte_bbdev_dequeue_ops_t dequeue_ops; /**< Dequeue function */
> > + const struct rte_bbdev_ops *dev_ops; /**< Functions exported by PMD
> */
> > + struct rte_bbdev_data *data; /**< Pointer to device data */
> > + bool attached; /**< If device is currently attached or not */
>
> What "attached" means?
> I'm afraid you are trying to manage hotplug in the wrong layer.
Hotplug is not supported in the current release.
>
> > + struct rte_device *device; /**< Backing device (HW only) */
>
> SW port should have also a rte_device (vdev).
Right. Fixed the comment.
>
> [...]
> > +/** Data input and output buffer for Turbo operations */ struct
> > +rte_bbdev_op_data {
>
> Why there is no "turbo" word in the name of this struct?
To keep it a generic input/output data descriptor,
that suits any type of baseband operation not only for turbo.
>
> > + struct rte_mbuf *data;
> > + /**< First mbuf segment with input/output data. */
> > + uint32_t offset;
> > + /**< The starting point for the Turbo input/output, in bytes, from the
> > + * start of the data in the data buffer. It must be smaller than
> > + * data_len of the mbuf's first segment!
> > + */
> > + uint32_t length;
> > + /**< For input operations: the length, in bytes, of the source buffer
> > + * on which the Turbo encode/decode will be computed.
> > + * For output operations: the length, in bytes, of the output buffer
> > + * of the Turbo operation.
> > + */
> > +};
>
> [...]
> > +/** Structure specifying a single operation */ struct rte_bbdev_op {
> > + enum rte_bbdev_op_type type; /**< Type of this operation */
> > + int status; /**< Status of operation that was performed */
> > + struct rte_mempool *mempool; /**< Mempool which op instance is in
> */
> > + void *opaque_data; /**< Opaque pointer for user data */
> > + /**
> > + * Anonymous union of operation-type specific parameters. When
> allocated
> > + * using rte_bbdev_op_pool_create(), space is allocated for the
> > + * parameters at the end of each rte_bbdev_op structure, and the
> > + * pointers here point to it.
> > + */
> > + RTE_STD_C11
> > + union {
> > + void *generic;
> > + struct rte_bbdev_op_turbo_dec *turbo_dec;
> > + struct rte_bbdev_op_turbo_enc *turbo_enc;
> > + };
> > +};
>
> I am not sure it is a good idea to fit every operations in the same struct and the
> same functions.
Due to the fact that our design adopts this idea that a device can support both
the encode and decode operations.
Then, at the time of PMD registration, the enqueue functions is allocated.
This enqueue() function is common for both operations.
This fitted operation structure is essential for the driver to decide on the operation.
>
> [...]
> > +/**
> > + * Helper macro for logging
> > + *
> > + * @param level
> > + * Log level: EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO, or
> DEBUG
> > + * @param fmt
> > + * The format string, as in printf(3).
> > + * @param ...
> > + * The variable arguments required by the format string.
> > + *
> > + * @return
> > + * - 0 on success
> > + * - Negative on error
> > + */
> > +#define rte_bbdev_log(level, fmt, ...) \
> > + RTE_LOG(level, BBDEV, fmt "\n", ##__VA_ARGS__)
>
> This is the legacy log system.
> Please use dynamic log type.
Done.
>
> [...]
> > +#ifdef RTE_LIBRTE_BBDEV_DEBUG
> > +#define rte_bbdev_log_verbose(fmt, ...) rte_bbdev_log_debug(fmt,
> > +##__VA_ARGS__) #else #define rte_bbdev_log_verbose(fmt, ...) #endif
>
> With the new log functions, you do not need to disable debug log at compilation
> time.
Right.
>
> > +/**
> > + * Initialisation params structure that can be used by software
> > +based drivers */ struct rte_bbdev_init_params {
> > + int socket_id; /**< Base band null device socket */
> > + uint16_t queues_num; /**< Base band null device queues number */ };
> > +
> > +/**
> > + * Parse generic parameters that could be used for software based devices.
> > + *
> > + * @param params
> > + * Pointer to structure that will hold the parsed parameters.
> > + * @param input_args
> > + * Pointer to arguments to be parsed.
> > + *
> > + * @return
> > + * - 0 on success
> > + * - EINVAL if invalid parameter pointer is provided
> > + * - EFAULT if unable to parse provided arguments
> > + */
> > +int
> > +rte_bbdev_parse_params(struct rte_bbdev_init_params *params,
> > + const char *input_args);
>
> I do not understand the intent of these parameters.
> Are they common to every PMDs?
> Or could they be moved in software PMDs?
That was an old design approach, but this now moved and became the
responsibility of the soft PMD.
>
> End of this first review pass :)
Thanks!!
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] lib/power: add turbo functions to version.map
2017-10-02 16:25 3% ` Hunt, David
@ 2017-10-02 16:52 0% ` Thomas Monjalon
0 siblings, 0 replies; 200+ results
From: Thomas Monjalon @ 2017-10-02 16:52 UTC (permalink / raw)
To: Hunt, David; +Cc: dev
02/10/2017 18:25, Hunt, David:
> Hi Thomas,
>
>
> On 2/10/2017 4:39 PM, Thomas Monjalon wrote:
> > 02/10/2017 17:06, Hunt, David:
> >> On 2/10/2017 3:55 PM, Thomas Monjalon wrote:
> >>> +DPDK_17.11 {
> >>>> + global:
> >>>> +
> >>>> + rte_power_acpi_turbo_status;
> >>> Is it really the function you want to expose?
> >>> rte_power_turbo_status seems more generic.
> >> Not really, it was in there for completeness, but users should be able
> >> to keep track of the turbo'd cores, so not really needed.
> >>
> >>> More comments about what is part of the API:
> >>> If you do not want to expose ACPI and VM implementations,
> >>> it should not be part of the rte_* include files.
> >> I'll address the above comments in the next version.
> >
> > You did not address the comment about what is rte_*.h.
> > If you do not want to expose everything, you should move it to
> > another .h file.
> >
> > Files starting with rte_ are included in doxygen API doc.
> > Only rte_power.h is installed.
> > The installed include, the doxygen doc and the map file
> > should all expose the same API consistently.
> >
> > I think a cleanup is needed.
>
> While I agree a cleanup is needed, this small patch is only intended to
> fix the priority issue of the shared library builds, which are broken at
> the moment.
> The initial patch should have had rte_power_turbo_status, not
> rte_power_acpi_turbo_status.
> Rather than moving code around at this stage, I propose having the three
> exposed functions in the map file (with the correct names).
OK, so we need a v3 (v2 has only 2 functions).
> Then, later on, I can do an ABI breakage notification for the next
> release to rename all the other rte*.h files, as some consumers of DPDK
> may be using those directly, at which stage we will be down to just
> exporting the functions in rte_power.h.
> Does that sound OK with you?
OK, thanks
^ permalink raw reply [relevance 0%]
* Re: [dpdk-dev] [PATCH] lib/power: add turbo functions to version.map
@ 2017-10-02 16:25 3% ` Hunt, David
2017-10-02 16:52 0% ` Thomas Monjalon
0 siblings, 1 reply; 200+ results
From: Hunt, David @ 2017-10-02 16:25 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
On 2/10/2017 4:39 PM, Thomas Monjalon wrote:
> 02/10/2017 17:06, Hunt, David:
>> On 2/10/2017 3:55 PM, Thomas Monjalon wrote:
>>> +DPDK_17.11 {
>>>> + global:
>>>> +
>>>> + rte_power_acpi_turbo_status;
>>> Is it really the function you want to expose?
>>> rte_power_turbo_status seems more generic.
>> Not really, it was in there for completeness, but users should be able
>> to keep track of the turbo'd cores, so not really needed.
>>
>>> More comments about what is part of the API:
>>> If you do not want to expose ACPI and VM implementations,
>>> it should not be part of the rte_* include files.
>> I'll address the above comments in the next version.
> You did not address the comment about what is rte_*.h.
> If you do not want to expose everything, you should move it to
> another .h file.
>
> Files starting with rte_ are included in doxygen API doc.
> Only rte_power.h is installed.
> The installed include, the doxygen doc and the map file
> should all expose the same API consistently.
>
> I think a cleanup is needed.
While I agree a cleanup is needed, this small patch is only intended to
fix the priority issue of the shared library builds, which are broken at
the moment.
The initial patch should have had rte_power_turbo_status, not
rte_power_acpi_turbo_status.
Rather than moving code around at this stage, I propose having the three
exposed functions in the map file (with the correct names).
Then, later on, I can do an ABI breakage notification for the next
release to rename all the other rte*.h files, as some consumers of DPDK
may be using those directly, at which stage we will be down to just
exporting the functions in rte_power.h.
Does that sound OK with you?
Regards,
Dave.
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v4 2/5] net/i40e: implement dynamic mapping of sw flow types to hw pctypes
@ 2017-10-02 15:08 3% ` Kirill Rybalchenko
1 sibling, 0 replies; 200+ results
From: Kirill Rybalchenko @ 2017-10-02 15:08 UTC (permalink / raw)
To: dev; +Cc: kirill.rybalchenko, andrey.chilikin, beilei.xing, jingjing.wu
Implement dynamic mapping of software flow types to hardware pctypes.
This allows to add new flow types and pctypes for DDP without changing
API of the driver. The mapping table is located in private
data area for particular network adapter and can be individually
modified with set of appropriate functions.
v2:
Re-arrange patchset to avoid compillation errors.
Remove usage of statically defined flow types and pctypes.
v3:
Change prototypes of some static functions.
Fixe bugs in i40e_pctype_to_flowtype and i40e_flowtype_to_pctype
functions.
Various small modifications after reviewing.
v4:
Change prototypes of some static functions.
Move declaration of automatic variables to beginning of function.
Move declaration of I40E_FILTER_PCTYPE_INVALID to i40e_ethdev.h
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 344 ++++++++++++--------------------------
drivers/net/i40e/i40e_ethdev.h | 22 ++-
drivers/net/i40e/i40e_ethdev_vf.c | 16 +-
drivers/net/i40e/i40e_fdir.c | 54 +++---
drivers/net/i40e/i40e_flow.c | 5 +-
drivers/net/i40e/i40e_rxtx.c | 57 +++++++
drivers/net/i40e/i40e_rxtx.h | 1 +
7 files changed, 212 insertions(+), 287 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 41c4033..6443702 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1070,6 +1070,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
return 0;
}
i40e_set_default_ptype_table(dev);
+ i40e_set_default_pctype_table(dev);
pci_dev = RTE_ETH_DEV_TO_PCI(dev);
intr_handle = &pci_dev->intr_handle;
@@ -3020,7 +3021,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) *
sizeof(uint32_t);
dev_info->reta_size = pf->hash_lut_size;
- dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+ dev_info->flow_type_rss_offloads = pf->adapter->flow_types_mask;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_thresh = {
@@ -6611,104 +6612,36 @@ i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr)
/* Configure hash enable flags for RSS */
uint64_t
-i40e_config_hena(uint64_t flags, enum i40e_mac_type type)
+i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags)
{
uint64_t hena = 0;
+ int i;
if (!flags)
return hena;
- if (flags & ETH_RSS_FRAG_IPV4)
- hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4;
- if (flags & ETH_RSS_NONFRAG_IPV4_TCP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV4_UDP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV4_SCTP)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
- if (flags & ETH_RSS_NONFRAG_IPV4_OTHER)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
- if (flags & ETH_RSS_FRAG_IPV6)
- hena |= 1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6;
- if (flags & ETH_RSS_NONFRAG_IPV6_TCP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (flags & (1ULL << i))
+ hena |= adapter->pctypes_tbl[i];
}
- if (flags & ETH_RSS_NONFRAG_IPV6_UDP) {
- if (type == I40E_MAC_X722) {
- hena |= (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |
- (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
- } else
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
- }
- if (flags & ETH_RSS_NONFRAG_IPV6_SCTP)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
- if (flags & ETH_RSS_NONFRAG_IPV6_OTHER)
- hena |= 1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
- if (flags & ETH_RSS_L2_PAYLOAD)
- hena |= 1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD;
return hena;
}
/* Parse the hash enable flags */
uint64_t
-i40e_parse_hena(uint64_t flags)
+i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags)
{
uint64_t rss_hf = 0;
if (!flags)
return rss_hf;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4))
- rss_hf |= ETH_RSS_FRAG_IPV4;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_SCTP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER))
- rss_hf |= ETH_RSS_NONFRAG_IPV4_OTHER;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6))
- rss_hf |= ETH_RSS_FRAG_IPV6;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_SCTP;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER))
- rss_hf |= ETH_RSS_NONFRAG_IPV6_OTHER;
- if (flags & (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
- rss_hf |= ETH_RSS_L2_PAYLOAD;
+ int i;
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (flags & adapter->pctypes_tbl[i])
+ rss_hf |= (1ULL << i);
+ }
return rss_hf;
}
@@ -6799,7 +6732,7 @@ i40e_hw_rss_hash_set(struct i40e_pf *pf, struct rte_eth_rss_conf *rss_conf)
if (ret)
return ret;
- hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+ hena = i40e_config_hena(pf->adapter, rss_conf->rss_hf);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (uint32_t)hena);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), (uint32_t)(hena >> 32));
I40E_WRITE_FLUSH(hw);
@@ -6813,14 +6746,13 @@ i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+ uint64_t rss_hf = rss_conf->rss_hf & pf->adapter->flow_types_mask;
uint64_t hena;
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
- if (!(hena & ((hw->mac.type == I40E_MAC_X722)
- ? I40E_RSS_HENA_ALL_X722
- : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+ if (!(hena & pf->adapter->pctypes_mask)) { /* RSS disabled */
if (rss_hf != 0) /* Enable RSS */
return -EINVAL;
return 0; /* Nothing to do */
@@ -6845,7 +6777,7 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
- rss_conf->rss_hf = i40e_parse_hena(hena);
+ rss_conf->rss_hf = i40e_parse_hena(pf->adapter, hena);
return 0;
}
@@ -7620,7 +7552,7 @@ i40e_pf_config_rss(struct i40e_pf *pf)
}
rss_conf = pf->dev_data->dev_conf.rx_adv_conf.rss_conf;
- if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+ if ((rss_conf.rss_hf & pf->adapter->flow_types_mask) == 0) {
i40e_pf_disable_rss(pf);
return 0;
}
@@ -7841,9 +7773,9 @@ static int
i40e_get_hash_filter_global_config(struct i40e_hw *hw,
struct rte_eth_hash_global_conf *g_cfg)
{
- uint32_t reg, mask = I40E_FLOW_TYPES;
- uint16_t i;
- enum i40e_filter_pctype pctype;
+ struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
+ uint32_t reg;
+ uint16_t i, j;
memset(g_cfg, 0, sizeof(*g_cfg));
reg = i40e_read_rx_ctl(hw, I40E_GLQF_CTL);
@@ -7854,29 +7786,37 @@ i40e_get_hash_filter_global_config(struct i40e_hw *hw,
PMD_DRV_LOG(DEBUG, "Hash function is %s",
(reg & I40E_GLQF_CTL_HTOEP_MASK) ? "Toeplitz" : "Simple XOR");
- for (i = 0; mask && i < RTE_ETH_FLOW_MAX; i++) {
- if (!(mask & (1UL << i)))
- continue;
- mask &= ~(1UL << i);
- /* Bit set indicats the coresponding flow type is supported */
- g_cfg->valid_bit_mask[0] |= (1UL << i);
- /* if flowtype is invalid, continue */
- if (!I40E_VALID_FLOW(i))
- continue;
- pctype = i40e_flowtype_to_pctype(i);
- reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(pctype));
- if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK)
- g_cfg->sym_hash_enable_mask[0] |= (1UL << i);
+ /*
+ * We work only with lowest 32 bits which is not correct, but to work
+ * properly the valid_bit_mask size should be increased up to 64 bits
+ * and this will brake ABI. This modification will be done in next release
+ */
+ g_cfg->valid_bit_mask[0] = (uint32_t)adapter->flow_types_mask;
+
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < UINT32_BIT; i++) {
+ if (adapter->pctypes_tbl[i]) {
+ for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+ j < I40E_FILTER_PCTYPE_MAX; j++) {
+ if (adapter->pctypes_tbl[i] & (1ULL << j)) {
+ reg = i40e_read_rx_ctl(hw, I40E_GLQF_HSYM(j));
+ if (reg & I40E_GLQF_HSYM_SYMH_ENA_MASK) {
+ g_cfg->sym_hash_enable_mask[0] |=
+ (1UL << i);
+ }
+ }
+ }
+ }
}
return 0;
}
static int
-i40e_hash_global_config_check(struct rte_eth_hash_global_conf *g_cfg)
+i40e_hash_global_config_check(const struct i40e_adapter *adapter,
+ const struct rte_eth_hash_global_conf *g_cfg)
{
uint32_t i;
- uint32_t mask0, i40e_mask = I40E_FLOW_TYPES;
+ uint32_t mask0, i40e_mask = adapter->flow_types_mask;
if (g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&
g_cfg->hash_func != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
@@ -7919,64 +7859,32 @@ static int
i40e_set_hash_filter_global_config(struct i40e_hw *hw,
struct rte_eth_hash_global_conf *g_cfg)
{
+ struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back;
int ret;
- uint16_t i;
+ uint16_t i, j;
uint32_t reg;
- uint32_t mask0 = g_cfg->valid_bit_mask[0];
- enum i40e_filter_pctype pctype;
+ /*
+ * We work only with lowest 32 bits which is not correct, but to work
+ * properly the valid_bit_mask size should be increased up to 64 bits
+ * and this will brake ABI. This modification will be done in next release
+ */
+ uint32_t mask0 = g_cfg->valid_bit_mask[0] & (uint32_t)adapter->flow_types_mask;
/* Check the input parameters */
- ret = i40e_hash_global_config_check(g_cfg);
+ ret = i40e_hash_global_config_check(adapter, g_cfg);
if (ret < 0)
return ret;
- for (i = 0; mask0 && i < UINT32_BIT; i++) {
- if (!(mask0 & (1UL << i)))
- continue;
- mask0 &= ~(1UL << i);
- /* if flowtype is invalid, continue */
- if (!I40E_VALID_FLOW(i))
- continue;
- pctype = i40e_flowtype_to_pctype(i);
- reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
- I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
- if (hw->mac.type == I40E_MAC_X722) {
- if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_UDP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP),
- reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_UDP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP),
- reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP),
- reg);
- } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP), reg);
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK),
- reg);
- } else {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype),
- reg);
+ for (i = RTE_ETH_FLOW_UNKNOWN + 1; mask0 && i < UINT32_BIT; i++) {
+ if (mask0 & (1UL << i)) {
+ reg = (g_cfg->sym_hash_enable_mask[0] & (1UL << i)) ?
+ I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;
+
+ for (j = I40E_FILTER_PCTYPE_INVALID + 1;
+ j < I40E_FILTER_PCTYPE_MAX; j++) {
+ if (adapter->pctypes_tbl[i] & (1ULL << j))
+ i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(j), reg);
}
- } else {
- i40e_write_rx_ctl(hw, I40E_GLQF_HSYM(pctype), reg);
}
}
@@ -8598,16 +8506,14 @@ i40e_filter_input_set_init(struct i40e_pf *pf)
uint64_t input_set, inset_reg;
uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
int num, i;
+ uint16_t flow_type;
for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722(pctype))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE(pctype))
- continue;
- }
+ flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
input_set = i40e_get_default_input_set(pctype);
@@ -8670,7 +8576,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
return -EINVAL;
}
- if (!I40E_VALID_FLOW(conf->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
@@ -8678,10 +8585,8 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
if (hw->mac.type == I40E_MAC_X722) {
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(hw,
- I40E_GLQF_FD_PCTYPES((int)i40e_flowtype_to_pctype(
- conf->flow_type)));
- } else
- pctype = i40e_flowtype_to_pctype(conf->flow_type);
+ I40E_GLQF_FD_PCTYPES((int)pctype));
+ }
ret = i40e_parse_input_set(&input_set, pctype, conf->field,
conf->inset_size);
@@ -8689,11 +8594,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,
PMD_DRV_LOG(ERR, "Failed to parse input set");
return -EINVAL;
}
- if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_HASH,
- input_set) != 0) {
- PMD_DRV_LOG(ERR, "Invalid input set");
- return -EINVAL;
- }
+
if (conf->op == RTE_ETH_INPUT_SET_ADD) {
/* get inset value in register */
inset_reg = i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, pctype));
@@ -8747,24 +8648,19 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,
return -EINVAL;
}
- if (!I40E_VALID_FLOW(conf->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, conf->flow_type);
+
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
- pctype = i40e_flowtype_to_pctype(conf->flow_type);
-
ret = i40e_parse_input_set(&input_set, pctype, conf->field,
conf->inset_size);
if (ret) {
PMD_DRV_LOG(ERR, "Failed to parse input set");
return -EINVAL;
}
- if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
- input_set) != 0) {
- PMD_DRV_LOG(ERR, "Invalid input set");
- return -EINVAL;
- }
/* get inset value in register */
inset_reg = i40e_read_rx_ctl(hw, I40E_PRTQF_FD_INSET(pctype, 1));
@@ -9203,72 +9099,42 @@ i40e_hw_init(struct rte_eth_dev *dev)
i40e_set_symmetric_hash_enable_per_port(hw, 0);
}
+/*
+ * For X722 it is possible to have multiple pctypes mapped to the same flowtype
+ * however this function will return only one highest pctype index,
+ * which is not quite correct. This is known problem of i40e driver
+ * and needs to be fixed later.
+ */
enum i40e_filter_pctype
-i40e_flowtype_to_pctype(uint16_t flow_type)
-{
- static const enum i40e_filter_pctype pctype_table[] = {
- [RTE_ETH_FLOW_FRAG_IPV4] = I40E_FILTER_PCTYPE_FRAG_IPV4,
- [RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_UDP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_TCP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
- I40E_FILTER_PCTYPE_NONF_IPV4_SCTP,
- [RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
- I40E_FILTER_PCTYPE_NONF_IPV4_OTHER,
- [RTE_ETH_FLOW_FRAG_IPV6] = I40E_FILTER_PCTYPE_FRAG_IPV6,
- [RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_UDP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_TCP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
- I40E_FILTER_PCTYPE_NONF_IPV6_SCTP,
- [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
- I40E_FILTER_PCTYPE_NONF_IPV6_OTHER,
- [RTE_ETH_FLOW_L2_PAYLOAD] = I40E_FILTER_PCTYPE_L2_PAYLOAD,
- };
+i40e_flowtype_to_pctype(const struct i40e_adapter *adapter, uint16_t flow_type)
+{
+ int i;
+ uint64_t pctype_mask;
- return pctype_table[flow_type];
+ if (flow_type < I40E_FLOW_TYPE_MAX) {
+ pctype_mask = adapter->pctypes_tbl[flow_type];
+ for (i = I40E_FILTER_PCTYPE_MAX - 1; i > 0; i--) {
+ if (pctype_mask & (1ULL << i))
+ return (enum i40e_filter_pctype)i;
+ }
+ }
+ return I40E_FILTER_PCTYPE_INVALID;
}
uint16_t
-i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
+i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+ enum i40e_filter_pctype pctype)
{
- static const uint16_t flowtype_table[] = {
- [I40E_FILTER_PCTYPE_FRAG_IPV4] = RTE_ETH_FLOW_FRAG_IPV4,
- [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_UDP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK] =
- RTE_ETH_FLOW_NONFRAG_IPV4_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] =
- RTE_ETH_FLOW_NONFRAG_IPV4_SCTP,
- [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] =
- RTE_ETH_FLOW_NONFRAG_IPV4_OTHER,
- [I40E_FILTER_PCTYPE_FRAG_IPV6] = RTE_ETH_FLOW_FRAG_IPV6,
- [I40E_FILTER_PCTYPE_NONF_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_UDP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_TCP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK] =
- RTE_ETH_FLOW_NONFRAG_IPV6_TCP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_SCTP] =
- RTE_ETH_FLOW_NONFRAG_IPV6_SCTP,
- [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] =
- RTE_ETH_FLOW_NONFRAG_IPV6_OTHER,
- [I40E_FILTER_PCTYPE_L2_PAYLOAD] = RTE_ETH_FLOW_L2_PAYLOAD,
- };
+ uint16_t flowtype;
+ uint64_t pctype_mask = 1ULL << pctype;
+
+ for (flowtype = RTE_ETH_FLOW_UNKNOWN + 1; flowtype < I40E_FLOW_TYPE_MAX;
+ flowtype++) {
+ if (adapter->pctypes_tbl[flowtype] & pctype_mask)
+ return flowtype;
+ }
- return flowtype_table[pctype];
+ return RTE_ETH_FLOW_UNKNOWN;
}
/*
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ad80f0f..66cc053 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -478,8 +478,9 @@ struct i40e_fdir_flex_mask {
} bitmask[I40E_FDIR_BITMASK_NUM_WORD];
};
-#define I40E_FILTER_PCTYPE_MAX 64
-#define I40E_MAX_FDIR_FILTER_NUM (1024 * 8)
+#define I40E_FILTER_PCTYPE_INVALID 0
+#define I40E_FILTER_PCTYPE_MAX 64
+#define I40E_MAX_FDIR_FILTER_NUM (1024 * 8)
struct i40e_fdir_filter {
TAILQ_ENTRY(i40e_fdir_filter) rules;
@@ -852,7 +853,8 @@ struct i40e_vf {
uint64_t flags;
};
-#define I40E_MAX_PKT_TYPE 256
+#define I40E_MAX_PKT_TYPE 256
+#define I40E_FLOW_TYPE_MAX 64
/*
* Structure to store private data for each PF/VF instance.
@@ -881,6 +883,10 @@ struct i40e_adapter {
/* ptype mapping table */
uint32_t ptype_tbl[I40E_MAX_PKT_TYPE] __rte_cache_min_aligned;
+ /* flow type to pctype mapping table */
+ uint64_t pctypes_tbl[I40E_FLOW_TYPE_MAX] __rte_cache_min_aligned;
+ uint64_t flow_types_mask;
+ uint64_t pctypes_mask;
};
extern const struct rte_flow_ops i40e_flow_ops;
@@ -925,8 +931,8 @@ int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
struct i40e_vsi_vlan_pvid_info *info);
int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on);
-uint64_t i40e_config_hena(uint64_t flags, enum i40e_mac_type type);
-uint64_t i40e_parse_hena(uint64_t flags);
+uint64_t i40e_config_hena(const struct i40e_adapter *adapter, uint64_t flags);
+uint64_t i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags);
enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
enum i40e_status_code i40e_fdir_setup_rx_resources(struct i40e_pf *pf);
int i40e_fdir_setup(struct i40e_pf *pf);
@@ -935,8 +941,10 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name,
int socket_id);
int i40e_fdir_configure(struct rte_eth_dev *dev);
void i40e_fdir_teardown(struct i40e_pf *pf);
-enum i40e_filter_pctype i40e_flowtype_to_pctype(uint16_t flow_type);
-uint16_t i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype);
+enum i40e_filter_pctype i40e_flowtype_to_pctype(const struct i40e_adapter *adapter,
+ uint16_t flow_type);
+uint16_t i40e_pctype_to_flowtype(const struct i40e_adapter *adapter,
+ enum i40e_filter_pctype pctype);
int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
enum rte_filter_op filter_op,
void *arg);
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a903deb..111ac39 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1443,6 +1443,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
i40e_set_default_ptype_table(eth_dev);
+ i40e_set_default_pctype_table(eth_dev);
rte_eth_copy_pci_info(eth_dev, pci_dev);
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
@@ -2178,7 +2179,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX;
dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t);
dev_info->reta_size = ETH_RSS_RETA_SIZE_64;
- dev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;
+ dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask;
dev_info->max_mac_addrs = I40E_NUM_MACADDR_MAX;
dev_info->rx_offload_capa =
DEV_RX_OFFLOAD_VLAN_STRIP |
@@ -2506,7 +2507,7 @@ i40evf_hw_rss_hash_set(struct i40e_vf *vf, struct rte_eth_rss_conf *rss_conf)
if (ret)
return ret;
- hena = i40e_config_hena(rss_conf->rss_hf, hw->mac.type);
+ hena = i40e_config_hena(vf->adapter, rss_conf->rss_hf);
i40e_write_rx_ctl(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
i40e_write_rx_ctl(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
I40EVF_WRITE_FLUSH(hw);
@@ -2549,7 +2550,7 @@ i40evf_config_rss(struct i40e_vf *vf)
}
rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
- if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+ if ((rss_conf.rss_hf & vf->adapter->flow_types_mask) == 0) {
i40evf_disable_rss(vf);
PMD_DRV_LOG(DEBUG, "No hash flag is set");
return 0;
@@ -2574,14 +2575,13 @@ i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
{
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+ uint64_t rss_hf = rss_conf->rss_hf & vf->adapter->flow_types_mask;
uint64_t hena;
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
- if (!(hena & ((hw->mac.type == I40E_MAC_X722)
- ? I40E_RSS_HENA_ALL_X722
- : I40E_RSS_HENA_ALL))) { /* RSS disabled */
+
+ if (!(hena & vf->adapter->pctypes_mask)) { /* RSS disabled */
if (rss_hf != 0) /* Enable RSS */
return -EINVAL;
return 0;
@@ -2607,7 +2607,7 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(0));
hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_VFQF_HENA(1))) << 32;
- rss_conf->rss_hf = i40e_parse_hena(hena);
+ rss_conf->rss_hf = i40e_parse_hena(vf->adapter, hena);
return 0;
}
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 84c0a1f..def2e4c 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -323,6 +323,7 @@ i40e_init_flx_pld(struct i40e_pf *pf)
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint8_t pctype;
int i, index;
+ uint16_t flow_type;
/*
* Define the bytes stream extracted as flexible payload in
@@ -344,15 +345,10 @@ i40e_init_flx_pld(struct i40e_pf *pf)
/* initialize the masks */
for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722(
- (enum i40e_filter_pctype)pctype))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE(
- (enum i40e_filter_pctype)pctype))
- continue;
- }
+ flow_type = i40e_pctype_to_flowtype(pf->adapter, pctype);
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
pf->fdir.flex_mask[pctype].word_mask = 0;
i40e_write_rx_ctl(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -449,7 +445,8 @@ i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg)
* arguments are valid
*/
static int
-i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
+i40e_check_fdir_flex_conf(const struct i40e_adapter *adapter,
+ const struct rte_eth_fdir_flex_conf *conf)
{
const struct rte_eth_flex_payload_cfg *flex_cfg;
const struct rte_eth_fdir_flex_mask *flex_mask;
@@ -457,6 +454,7 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
uint8_t nb_bitmask;
uint16_t i, j;
int ret = 0;
+ enum i40e_filter_pctype pctype;
if (conf == NULL) {
PMD_DRV_LOG(INFO, "NULL pointer.");
@@ -487,7 +485,8 @@ i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
}
for (i = 0; i < conf->nb_flexmasks; i++) {
flex_mask = &conf->flex_mask[i];
- if (!I40E_VALID_FLOW(flex_mask->flow_type)) {
+ pctype = i40e_flowtype_to_pctype(adapter, flex_mask->flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(WARNING, "invalid flow type.");
return -EINVAL;
}
@@ -650,7 +649,7 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
i40e_init_flx_pld(pf); /* set flex config to default value */
conf = &dev->data->dev_conf.fdir_conf.flex_conf;
- ret = i40e_check_fdir_flex_conf(conf);
+ ret = i40e_check_fdir_flex_conf(pf->adapter, conf);
if (ret < 0) {
PMD_DRV_LOG(ERR, " invalid configuration arguments.");
return -EINVAL;
@@ -664,11 +663,11 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
hw, I40E_GLQF_FD_PCTYPES(
- (int)i40e_flowtype_to_pctype(
+ (int)i40e_flowtype_to_pctype(pf->adapter,
conf->flex_mask[i].flow_type)));
} else
- pctype = i40e_flowtype_to_pctype(
- conf->flex_mask[i].flow_type);
+ pctype = i40e_flowtype_to_pctype(pf->adapter,
+ conf->flex_mask[i].flow_type);
i40e_set_flex_mask_on_pctype(pf, pctype, &conf->flex_mask[i]);
}
@@ -1100,7 +1099,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (!I40E_VALID_FLOW(filter->input.flow_type)) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, filter->input.flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID) {
PMD_DRV_LOG(ERR, "invalid flow_type input.");
return -EINVAL;
}
@@ -1141,12 +1141,8 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
if (hw->mac.type == I40E_MAC_X722) {
/* get translated pctype value in fd pctype register */
pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
- hw, I40E_GLQF_FD_PCTYPES(
- (int)i40e_flowtype_to_pctype(
- filter->input.flow_type)));
- } else
- pctype = i40e_flowtype_to_pctype(filter->input.flow_type);
-
+ hw, I40E_GLQF_FD_PCTYPES((int)pctype));
+ }
ret = i40e_fdir_filter_programming(pf, pctype, filter, add);
if (ret < 0) {
PMD_DRV_LOG(ERR, "fdir programming fails for PCTYPE(%u).",
@@ -1384,7 +1380,6 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
{
struct i40e_fdir_flex_mask *mask;
struct rte_eth_fdir_flex_mask *ptr = flex_mask;
- struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint16_t flow_type;
uint8_t i, j;
uint16_t off_bytes, mask_tmp;
@@ -1393,14 +1388,11 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
i++) {
mask = &pf->fdir.flex_mask[i];
- if (hw->mac.type == I40E_MAC_X722) {
- if (!I40E_VALID_PCTYPE_X722((enum i40e_filter_pctype)i))
- continue;
- } else {
- if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
- continue;
- }
- flow_type = i40e_pctype_to_flowtype((enum i40e_filter_pctype)i);
+ flow_type = i40e_pctype_to_flowtype(pf->adapter,
+ (enum i40e_filter_pctype)i);
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN)
+ continue;
+
for (j = 0; j < I40E_FDIR_MAX_FLEXWORD_NUM; j++) {
if (mask->word_mask & I40E_FLEX_WORD_MASK(j)) {
ptr->mask[j * sizeof(uint16_t)] = UINT8_MAX;
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index b92719a..5d8afc6 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -2776,8 +2776,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
}
}
- pctype = i40e_flowtype_to_pctype(flow_type);
- if (pctype == 0 || pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
+ pctype = i40e_flowtype_to_pctype(pf->adapter, flow_type);
+ if (pctype == I40E_FILTER_PCTYPE_INVALID ||
+ pctype > I40E_FILTER_PCTYPE_L2_PAYLOAD) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM, item,
"Unsupported flow type");
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 3a7b68e..0c8ad00 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2943,6 +2943,63 @@ i40e_set_default_ptype_table(struct rte_eth_dev *dev)
ad->ptype_tbl[i] = i40e_get_default_pkt_type(i);
}
+void __attribute__((cold))
+i40e_set_default_pctype_table(struct rte_eth_dev *dev)
+{
+ struct i40e_adapter *ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ int i;
+
+ for (i = 0; i < I40E_FLOW_TYPE_MAX; i++)
+ ad->pctypes_tbl[i] = 0ULL;
+ ad->flow_types_mask = 0ULL;
+ ad->pctypes_mask = 0ULL;
+
+ ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV4] =
+ (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_SCTP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_OTHER] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER);
+ ad->pctypes_tbl[RTE_ETH_FLOW_FRAG_IPV6] =
+ (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_SCTP] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] =
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER);
+ ad->pctypes_tbl[RTE_ETH_FLOW_L2_PAYLOAD] =
+ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD);
+
+ if (hw->mac.type == I40E_MAC_X722) {
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV4_TCP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_UDP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
+ ad->pctypes_tbl[RTE_ETH_FLOW_NONFRAG_IPV6_TCP] |=
+ (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
+ }
+
+ for (i = 0; i < I40E_FLOW_TYPE_MAX; i++) {
+ if (ad->pctypes_tbl[i])
+ ad->flow_types_mask |= (1ULL << i);
+ ad->pctypes_mask |= ad->pctypes_tbl[i];
+ }
+}
+
/* Stubs needed for linkage when CONFIG_RTE_I40E_INC_VECTOR is set to 'n' */
int __attribute__((weak))
i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev)
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 20084d6..2a58ced 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -255,6 +255,7 @@ void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
struct i40e_tx_queue *txq);
void i40e_set_tx_function(struct rte_eth_dev *dev);
void i40e_set_default_ptype_table(struct rte_eth_dev *dev);
+void i40e_set_default_pctype_table(struct rte_eth_dev *dev);
/* For each value it means, datasheet of hardware can tell more details
*
--
2.5.5
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v6 2/5] ethdev: increase port_id range
2017-09-29 7:17 4% ` [dpdk-dev] [PATCH v6 " Zhiyong Yang
2017-09-29 7:17 7% ` [dpdk-dev] [PATCH v6 1/5] net/bonding: remove bonding APIs using ABI versioning Zhiyong Yang
@ 2017-09-29 7:17 1% ` Zhiyong Yang
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
2 siblings, 0 replies; 200+ results
From: Zhiyong Yang @ 2017-09-29 7:17 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
Extend port_id definition from uint8_t to uint16_t in lib and drivers
data structures, specifically rte_eth_dev_data. Modify the APIs,
drivers and app using port_id at the same time.
Fix some checkpatch issues from the original code and remove some
unnecessary cast operations.
release_17_11 and deprecation docs have been updated in this patch.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
app/pdump/main.c | 2 +-
app/test-pmd/cmdline.c | 6 +-
app/test-pmd/config.c | 4 +-
app/test-pmd/ieee1588fwd.c | 26 ++-
app/test-pmd/parameters.c | 2 +-
app/test-pmd/rxonly.c | 2 +-
app/test-pmd/testpmd.c | 18 +-
app/test-pmd/testpmd.h | 4 +-
doc/guides/rel_notes/deprecation.rst | 6 -
doc/guides/rel_notes/release_17_11.rst | 24 ++-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x_rxtx.h | 4 +-
drivers/net/bnxt/Makefile | 2 +-
drivers/net/bnxt/bnxt.h | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 4 +-
drivers/net/bnxt/bnxt_rxq.h | 2 +-
drivers/net/bnxt/bnxt_txq.h | 2 +-
drivers/net/bnxt/rte_pmd_bnxt.c | 32 +--
drivers/net/bnxt/rte_pmd_bnxt.h | 32 +--
drivers/net/bonding/Makefile | 2 +-
drivers/net/bonding/rte_eth_bond.h | 41 ++--
drivers/net/bonding/rte_eth_bond_8023ad.c | 60 +++---
drivers/net/bonding/rte_eth_bond_8023ad.h | 30 +--
drivers/net/bonding/rte_eth_bond_8023ad_private.h | 12 +-
drivers/net/bonding/rte_eth_bond_alb.c | 6 +-
drivers/net/bonding/rte_eth_bond_alb.h | 6 +-
drivers/net/bonding/rte_eth_bond_api.c | 64 +++---
drivers/net/bonding/rte_eth_bond_args.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 62 +++---
drivers/net/bonding/rte_eth_bond_private.h | 45 ++--
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/em_rxtx.c | 4 +-
drivers/net/e1000/igb_rxtx.c | 4 +-
drivers/net/failsafe/failsafe_ether.c | 4 +-
drivers/net/failsafe/failsafe_private.h | 4 +-
drivers/net/fm10k/fm10k.h | 6 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/i40e/i40e_ethdev.c | 5 +-
drivers/net/i40e/i40e_rxtx.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.c | 50 ++---
drivers/net/i40e/rte_pmd_i40e.h | 48 ++---
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.h | 4 +-
drivers/net/ixgbe/rte_pmd_ixgbe.c | 60 +++---
drivers/net/ixgbe/rte_pmd_ixgbe.h | 64 +++---
drivers/net/mlx5/mlx5_rxtx.h | 4 +-
drivers/net/nfp/nfp_net.c | 16 +-
drivers/net/nfp/nfp_net_pmd.h | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_if.h | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
drivers/net/thunderx/nicvf_struct.h | 2 +-
drivers/net/vhost/Makefile | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 6 +-
drivers/net/vhost/rte_eth_vhost.h | 4 +-
drivers/net/virtio/virtio_pci.h | 2 +-
drivers/net/virtio/virtio_rxtx.h | 6 +-
drivers/net/vmxnet3/vmxnet3_ring.h | 4 +-
lib/librte_bitratestats/Makefile | 2 +-
lib/librte_bitratestats/rte_bitrate.c | 2 +-
lib/librte_bitratestats/rte_bitrate.h | 2 +-
lib/librte_ether/Makefile | 2 +-
lib/librte_ether/rte_ethdev.c | 241 +++++++++++-----------
lib/librte_ether/rte_ethdev.h | 238 ++++++++++-----------
lib/librte_ether/rte_flow.c | 2 +-
lib/librte_ether/rte_flow_driver.h | 2 +-
lib/librte_ether/rte_tm.c | 62 +++---
lib/librte_ether/rte_tm.h | 60 +++---
lib/librte_ether/rte_tm_driver.h | 2 +-
lib/librte_kni/rte_kni.h | 6 +-
lib/librte_latencystats/rte_latencystats.c | 12 +-
lib/librte_pdump/Makefile | 2 +-
lib/librte_pdump/rte_pdump.c | 16 +-
lib/librte_pdump/rte_pdump.h | 4 +-
lib/librte_port/rte_port_ethdev.c | 6 +-
lib/librte_port/rte_port_ethdev.h | 6 +-
81 files changed, 765 insertions(+), 738 deletions(-)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index 3b13753d9..090a50cfc 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -623,7 +623,7 @@ static void
create_mp_ring_vdev(void)
{
int i;
- uint8_t portid;
+ uint16_t portid;
struct pdump_tuples *pt = NULL;
struct rte_mempool *mbuf_pool = NULL;
char vdev_args[SIZE];
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ccdf239d6..d9d083888 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -4588,7 +4588,7 @@ struct cmd_show_bonding_config_result {
cmdline_fixed_string_t show;
cmdline_fixed_string_t bonding;
cmdline_fixed_string_t config;
- uint8_t port_id;
+ portid_t port_id;
};
static void cmd_show_bonding_config_parsed(void *parsed_result,
@@ -4597,7 +4597,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
{
struct cmd_show_bonding_config_result *res = parsed_result;
int bonding_mode, agg_mode;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ portid_t slaves[RTE_MAX_ETHPORTS];
int num_slaves, num_active_slaves;
int primary_id;
int i;
@@ -11500,7 +11500,7 @@ struct cmd_vf_vlan_stripq_result {
cmdline_fixed_string_t vf;
cmdline_fixed_string_t vlan;
cmdline_fixed_string_t stripq;
- uint8_t port_id;
+ portid_t port_id;
uint16_t vf_id;
cmdline_fixed_string_t on_off;
};
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3ae3e1cd8..155136dd5 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -358,7 +358,7 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
if (rc != 0) {
- printf("Failed to retrieve information for port: %hhu, "
+ printf("Failed to retrieve information for port: %u, "
"RX queue: %hu\nerror desc: %s(%d)\n",
port_id, queue_id, strerror(-rc), rc);
return;
@@ -391,7 +391,7 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo);
if (rc != 0) {
- printf("Failed to retrieve information for port: %hhu, "
+ printf("Failed to retrieve information for port: %u, "
"TX queue: %hu\nerror desc: %s(%d)\n",
port_id, queue_id, strerror(-rc), rc);
return;
diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index 51170ee3e..91ee78646 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -86,12 +86,11 @@ port_ieee1588_rx_timestamp_check(portid_t pi, uint32_t index)
struct timespec timestamp = {0, 0};
if (rte_eth_timesync_read_rx_timestamp(pi, ×tamp, index) < 0) {
- printf("Port %u RX timestamp registers not valid\n",
- (unsigned) pi);
+ printf("Port %u RX timestamp registers not valid\n", pi);
return;
}
printf("Port %u RX timestamp value %lu s %lu ns\n",
- (unsigned) pi, timestamp.tv_sec, timestamp.tv_nsec);
+ pi, timestamp.tv_sec, timestamp.tv_nsec);
}
#define MAX_TX_TMST_WAIT_MICROSECS 1000 /**< 1 milli-second */
@@ -110,12 +109,12 @@ port_ieee1588_tx_timestamp_check(portid_t pi)
if (wait_us >= MAX_TX_TMST_WAIT_MICROSECS) {
printf("Port %u TX timestamp registers not valid after "
"%u micro-seconds\n",
- (unsigned) pi, (unsigned) MAX_TX_TMST_WAIT_MICROSECS);
+ pi, MAX_TX_TMST_WAIT_MICROSECS);
return;
}
printf("Port %u TX timestamp value %lu s %lu ns validated after "
"%u micro-second%s\n",
- (unsigned) pi, timestamp.tv_sec, timestamp.tv_nsec, wait_us,
+ pi, timestamp.tv_sec, timestamp.tv_nsec, wait_us,
(wait_us == 1) ? "" : "s");
}
@@ -148,11 +147,11 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
if (eth_type == ETHER_TYPE_1588) {
printf("Port %u Received PTP packet not filtered"
" by hardware\n",
- (unsigned) fs->rx_port);
+ fs->rx_port);
} else {
printf("Port %u Received non PTP packet type=0x%4x "
"len=%u\n",
- (unsigned) fs->rx_port, eth_type,
+ fs->rx_port, eth_type,
(unsigned) mb->pkt_len);
}
rte_pktmbuf_free(mb);
@@ -161,7 +160,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
if (eth_type != ETHER_TYPE_1588) {
printf("Port %u Received NON PTP packet incorrectly"
" detected by hardware\n",
- (unsigned) fs->rx_port);
+ fs->rx_port);
rte_pktmbuf_free(mb);
return;
}
@@ -175,19 +174,19 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
if (ptp_hdr->version != 0x02) {
printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
" protocol version 0x%x (should be 0x02)\n",
- (unsigned) fs->rx_port, ptp_hdr->version);
+ fs->rx_port, ptp_hdr->version);
rte_pktmbuf_free(mb);
return;
}
if (ptp_hdr->msg_id != PTP_SYNC_MESSAGE) {
printf("Port %u Received PTP V2 Ethernet frame with unexpected"
" message ID 0x%x (expected 0x0 - PTP_SYNC_MESSAGE)\n",
- (unsigned) fs->rx_port, ptp_hdr->msg_id);
+ fs->rx_port, ptp_hdr->msg_id);
rte_pktmbuf_free(mb);
return;
}
printf("Port %u IEEE1588 PTP V2 SYNC Message filtered by hardware\n",
- (unsigned) fs->rx_port);
+ fs->rx_port);
/*
* Check that the received PTP packet has been timestamped by the
@@ -196,7 +195,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
if (! (mb->ol_flags & PKT_RX_IEEE1588_TMST)) {
printf("Port %u Received PTP packet not timestamped"
" by hardware\n",
- (unsigned) fs->rx_port);
+ fs->rx_port);
rte_pktmbuf_free(mb);
return;
}
@@ -216,8 +215,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
mb->ol_flags |= PKT_TX_IEEE1588_TMST;
fs->tx_packets += 1;
if (rte_eth_tx_burst(fs->rx_port, fs->tx_queue, &mb, 1) == 0) {
- printf("Port %u sent PTP packet dropped\n",
- (unsigned) fs->rx_port);
+ printf("Port %u sent PTP packet dropped\n", fs->rx_port);
fs->fwd_dropped += 1;
rte_pktmbuf_free(mb);
return;
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 2f7f70fd6..31287d71d 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -734,7 +734,7 @@ launch_args_parse(int argc, char** argv)
if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
n = atoi(optarg);
if (n > 0 && n <= nb_ports)
- nb_fwd_ports = (uint8_t) n;
+ nb_fwd_ports = n;
else
rte_exit(EXIT_FAILURE,
"Invalid port %d\n", n);
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 5ef021905..57df01468 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -122,7 +122,7 @@ pkt_burst_receive(struct fwd_stream *fs)
*/
if (verbose_level > 0)
printf("port %u/queue %u: received %u packets\n",
- (unsigned) fs->rx_port,
+ fs->rx_port,
(unsigned) fs->rx_queue,
(unsigned) nb_rx);
for (i = 0; i < nb_rx; i++) {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e097ee04e..477e2e7ad 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -390,7 +390,7 @@ struct gro_status gro_ports[RTE_MAX_ETHPORTS];
/* Forward function declarations */
static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
static void check_all_ports_link_status(uint32_t port_mask);
-static int eth_event_callback(uint8_t port_id,
+static int eth_event_callback(portid_t port_id,
enum rte_eth_event_type type,
void *param, void *ret_param);
@@ -1816,7 +1816,8 @@ check_all_ports_link_status(uint32_t port_mask)
{
#define CHECK_INTERVAL 100 /* 100ms */
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
- uint8_t portid, count, all_ports_up, print_flag = 0;
+ portid_t portid;
+ uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
printf("Checking link statuses...\n");
@@ -1831,14 +1832,13 @@ check_all_ports_link_status(uint32_t port_mask)
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
- printf("Port %d Link Up - speed %u "
- "Mbps - %s\n", (uint8_t)portid,
- (unsigned)link.link_speed,
+ printf(
+ "Port%d Link Up. speed %u Mbps- %s\n",
+ portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
- printf("Port %d Link Down\n",
- (uint8_t)portid);
+ printf("Port %d Link Down\n", portid);
continue;
}
/* clear all_ports_up flag if any link down */
@@ -1885,7 +1885,7 @@ rmv_event_callback(void *arg)
/* This function is used by the interrupt thread */
static int
-eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param,
+eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
void *ret_param)
{
static const char * const event_desc[] = {
@@ -2328,7 +2328,7 @@ int
main(int argc, char** argv)
{
int diag;
- uint8_t port_id;
+ portid_t port_id;
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 1d1ee7587..657c1235c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -78,7 +78,7 @@
#define UMA_NO_CONFIG 0xFF
typedef uint8_t lcoreid_t;
-typedef uint8_t portid_t;
+typedef uint16_t portid_t;
typedef uint16_t queueid_t;
typedef uint16_t streamid_t;
@@ -283,7 +283,7 @@ enum dcb_mode_enable
#define MAX_RX_QUEUE_STATS_MAPPINGS 4096 /* MAX_PORT of 32 @ 128 rx_queues/port */
struct queue_stats_mappings {
- uint8_t port_id;
+ portid_t port_id;
uint16_t queue_id;
uint8_t stats_counter_id;
} __rte_cache_aligned;
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3362f3350..45eb5c4a9 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -76,12 +76,6 @@ Deprecation Notices
done by the EAL and not by the ``ethdev`` layer anymore. Users relying on this
flag being present only have to remove their checks to follow the change.
-* ABI/API changes are planned for 17.11 in all structures which include port_id
- definition such as "rte_eth_dev_data", "rte_port_ethdev_reader_params",
- "rte_port_ethdev_writer_params", and so on. The definition of port_id will be
- changed from 8 bits to 16 bits in order to support more than 256 ports in
- DPDK. All APIs which have port_id parameter will be changed at the same time.
-
* ethdev: An ABI change is planned for 17.11 for the structure rte_eth_dev_data.
The size of the unique name will increase RTE_ETH_NAME_MAX_LEN from 32 to
64 characters to allow using a globally unique identifier (GUID) in this field.
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index f6f916928..4d2c9669d 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -41,6 +41,11 @@ New Features
Also, make sure to start the actual text at the margin.
=========================================================
+* **Extended port_id range from uint8_t to uint16_t.**
+
+ Increased port_id range from 8 bits to 16 bits in order to support more than
+ 256 ports in dpdk. All ethdev APIs which have port_id as parameter are changed
+ in the meantime.
Resolved Issues
---------------
@@ -144,7 +149,10 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=========================================================
+* **Extended port_id range.**
+ The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure
+ changed, as described in the `New Features` section.
Shared Library Versions
-----------------------
@@ -165,13 +173,13 @@ The libraries prepended with a plus sign were incremented in this version.
.. code-block:: diff
librte_acl.so.2
- librte_bitratestats.so.1
+ librte_bitratestats.so.2
librte_cfgfile.so.2
librte_cmdline.so.2
librte_cryptodev.so.3
librte_distributor.so.1
librte_eal.so.5
- librte_ethdev.so.7
+ librte_ethdev.so.8
librte_eventdev.so.2
librte_gro.so.1
librte_hash.so.2
@@ -186,14 +194,14 @@ The libraries prepended with a plus sign were incremented in this version.
librte_meter.so.1
librte_metrics.so.1
librte_net.so.1
- librte_pdump.so.1
+ librte_pdump.so.2
librte_pipeline.so.3
- librte_pmd_bnxt.so.1
- librte_pmd_bond.so.1
- librte_pmd_i40e.so.1
- librte_pmd_ixgbe.so.1
+ librte_pmd_bnxt.so.2
+ librte_pmd_bond.so.2
+ librte_pmd_i40e.so.2
+ librte_pmd_ixgbe.so.2
librte_pmd_ring.so.2
- librte_pmd_vhost.so.1
+ librte_pmd_vhost.so.2
librte_port.so.3
librte_power.so.1
librte_reorder.so.1
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 9a47852ca..483b0c107 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -75,7 +75,7 @@ struct pkt_rx_queue {
unsigned int framenum;
struct rte_mempool *mb_pool;
- uint8_t in_port;
+ uint16_t in_port;
volatile unsigned long rx_pkts;
volatile unsigned long err_pkts;
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 6db362b04..893284733 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -641,7 +641,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++) {
status = eth_ark_tx_queue_stop(dev, i);
if (status != 0) {
- uint8_t port = dev->data->port_id;
+ uint16_t port = dev->data->port_id;
PMD_DRV_LOG(ERR,
"tx_queue stop anomaly"
" port %u, queue %u\n",
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index c746a0e2c..b5cc955f2 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -190,7 +190,7 @@ struct avp_dev {
struct rte_eth_dev_data *dev_data;
/**< Back pointer to ethernet device data */
volatile uint32_t flags; /**< Device operational flags */
- uint8_t port_id; /**< Ethernet port identifier */
+ uint16_t port_id; /**< Ethernet port identifier */
struct rte_mempool *pool; /**< pkt mbuf mempool */
unsigned int guest_mbuf_size; /**< local pool mbuf size */
unsigned int host_mbuf_size; /**< host mbuf size */
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.h b/drivers/net/bnx2x/bnx2x_rxtx.h
index 2e38ec26a..9600e0f1c 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.h
+++ b/drivers/net/bnx2x/bnx2x_rxtx.h
@@ -41,7 +41,7 @@ struct bnx2x_rx_queue {
uint16_t rx_cq_head; /**< Index of current rcq bd. */
uint16_t rx_cq_tail; /**< Index of last rcq bd. */
uint16_t queue_id; /**< RX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
struct bnx2x_softc *sc; /**< Ptr to dev_private data. */
};
@@ -62,7 +62,7 @@ struct bnx2x_tx_queue {
uint16_t nb_tx_avail; /**< Number of TX descriptors available. */
uint16_t nb_tx_pages; /**< number of TX pages */
uint16_t queue_id; /**< TX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
struct bnx2x_softc *sc; /**< Ptr to dev_private data */
};
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index b03f65dc9..55b49b538 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -40,7 +40,7 @@ LIB = librte_pmd_bnxt.a
EXPORT_MAP := rte_pmd_bnxt_version.map
-LIBABIVER := 1
+LIBABIVER := 2
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 405d94deb..26a9018b5 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -126,7 +126,7 @@ struct bnxt_pf_info {
#define BNXT_FIRST_VF_FID 128
#define BNXT_PF_RINGS_USED(bp) bnxt_get_num_queues(bp)
#define BNXT_PF_RINGS_AVAIL(bp) (bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
- uint8_t port_id;
+ uint16_t port_id;
uint16_t first_vf_id;
uint16_t active_vfs;
uint16_t max_vfs;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c9d11228b..2e817535e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -489,13 +489,13 @@ static void bnxt_print_link_info(struct rte_eth_dev *eth_dev)
if (link->link_status)
RTE_LOG(INFO, PMD, "Port %d Link Up - speed %u Mbps - %s\n",
- (uint8_t)(eth_dev->data->port_id),
+ eth_dev->data->port_id,
(uint32_t)link->link_speed,
(link->link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
RTE_LOG(INFO, PMD, "Port %d Link Down\n",
- (uint8_t)(eth_dev->data->port_id));
+ eth_dev->data->port_id);
}
static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index 01aaa007f..cea0785d1 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -48,7 +48,7 @@ struct bnxt_rx_queue {
uint16_t rx_free_thresh; /* max free RX desc to hold */
uint16_t queue_id; /* RX queue index */
uint16_t reg_idx; /* RX queue register index */
- uint8_t port_id; /* Device port identifier */
+ uint16_t port_id; /* Device port identifier */
uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
struct bnxt *bp;
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 16f3a0bdd..f753c10f2 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -46,7 +46,7 @@ struct bnxt_tx_queue {
uint16_t tx_next_rs; /* next desc to set RS bit */
uint16_t queue_id; /* TX queue index */
uint16_t reg_idx; /* TX queue register index */
- uint8_t port_id; /* Device port identifier */
+ uint16_t port_id; /* Device port identifier */
uint8_t pthresh; /* Prefetch threshold register */
uint8_t hthresh; /* Host threshold register */
uint8_t wthresh; /* Write-back threshold reg */
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index c343d9033..63fc27911 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -67,7 +67,7 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg)
true : false;
}
-int rte_pmd_bnxt_set_tx_loopback(uint8_t port, uint8_t on)
+int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on)
{
struct rte_eth_dev *eth_dev;
struct bnxt *bp;
@@ -108,7 +108,7 @@ rte_pmd_bnxt_set_all_queues_drop_en_cb(struct bnxt_vnic_info *vnic, void *onptr)
vnic->bd_stall = !(*on);
}
-int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on)
+int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
{
struct rte_eth_dev *eth_dev;
struct bnxt *bp;
@@ -159,7 +159,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on)
return rc;
}
-int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
struct ether_addr *mac_addr)
{
struct rte_eth_dev *dev;
@@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
return rc;
}
-int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
uint16_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *eth_dev;
@@ -241,7 +241,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
return rc;
}
-int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_dev *dev;
@@ -294,7 +294,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
return rc;
}
-int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_dev *dev;
@@ -350,7 +350,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq_cb(struct bnxt_vnic_info *vnic, void *onptr)
}
int
-rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
@@ -385,7 +385,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
return rc;
}
-int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
uint16_t rx_mask, uint8_t on)
{
struct rte_eth_dev *dev;
@@ -477,7 +477,7 @@ static int bnxt_set_vf_table(struct bnxt *bp, uint16_t vf)
return rc;
}
-int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
+int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
uint64_t vf_mask, uint8_t vlan_on)
{
struct bnxt_vlan_table_entry *ve;
@@ -570,7 +570,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
return rc;
}
-int rte_pmd_bnxt_get_vf_stats(uint8_t port,
+int rte_pmd_bnxt_get_vf_stats(uint16_t port,
uint16_t vf_id,
struct rte_eth_stats *stats)
{
@@ -598,7 +598,7 @@ int rte_pmd_bnxt_get_vf_stats(uint8_t port,
return bnxt_hwrm_func_qstats(bp, bp->pf.first_vf_id + vf_id, stats);
}
-int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
+int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
uint16_t vf_id)
{
struct rte_eth_dev *dev;
@@ -625,7 +625,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
return bnxt_hwrm_func_clr_stats(bp, bp->pf.first_vf_id + vf_id);
}
-int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
+int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
@@ -651,7 +651,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
return bnxt_vf_vnic_count(bp, vf_id);
}
-int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
+int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
uint64_t *count)
{
struct rte_eth_dev *dev;
@@ -679,7 +679,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
count);
}
-int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *addr,
+int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr,
uint32_t vf_id)
{
struct rte_eth_dev *dev;
@@ -756,7 +756,7 @@ int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *addr,
}
int
-rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
uint16_t vlan_id)
{
struct rte_eth_dev *dev;
@@ -793,7 +793,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
return rc;
}
-int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on)
+int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_dev *dev;
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index c4c4770e3..f881d30d6 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -78,7 +78,7 @@ struct rte_pmd_bnxt_mb_event_param {
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
/**
* Set the VF MAC address.
@@ -94,7 +94,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
-int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
struct ether_addr *mac_addr);
/**
@@ -115,7 +115,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint8_t port, uint16_t vf,
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable/Disable vf vlan insert
@@ -134,7 +134,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
uint16_t vlan_id);
/**
@@ -156,7 +156,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint8_t port, uint16_t vf,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
+int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
uint64_t vf_mask, uint8_t vlan_on);
/**
@@ -173,7 +173,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_tx_loopback(uint8_t port, uint8_t on);
+int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on);
/**
* set all queues drop enable bit
@@ -189,7 +189,7 @@ int rte_pmd_bnxt_set_tx_loopback(uint8_t port, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on);
+int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on);
/**
* Set the VF rate limit.
@@ -207,7 +207,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint8_t port, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
-int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
uint16_t tx_rate, uint64_t q_msk);
/**
@@ -226,7 +226,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint8_t port, uint16_t vf,
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_get_vf_stats(uint8_t port,
+int rte_pmd_bnxt_get_vf_stats(uint16_t port,
uint16_t vf_id,
struct rte_eth_stats *stats);
@@ -242,7 +242,7 @@ int rte_pmd_bnxt_get_vf_stats(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
+int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
uint16_t vf_id);
/**
@@ -261,7 +261,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
/**
* Set RX L2 Filtering mode of a VF of an Ethernet device.
@@ -280,7 +280,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
+int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
uint16_t rx_mask, uint8_t on);
/**
@@ -297,7 +297,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint8_t port, uint16_t vf,
* - (-ENOMEM) on an allocation failure
* - (-1) firmware interface error
*/
-int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
+int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id);
/**
* Queries the TX drop counter for the function
@@ -313,7 +313,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
* - (-EINVAL) invalid vf_id specified.
* - (-ENOTSUP) Ethernet device is not a PF
*/
-int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
+int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
uint64_t *count);
/**
@@ -331,7 +331,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
* - (-ENOTSUP) Ethernet device is not a PF
* - (-ENOMEM) on an allocation failure
*/
-int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
+int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
uint32_t vf_id);
/**
@@ -350,5 +350,5 @@ int rte_pmd_bnxt_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_bnxt_set_vf_persist_stats(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on);
#endif /* _PMD_BNXT_H_ */
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 910c932da..ffc0c3cf7 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_eth_bond_version.map
-LIBABIVER := 1
+LIBABIVER := 2
#
# all source are stored in SRCS-y
diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
index 8efbf0713..87ff29173 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -151,7 +151,7 @@ rte_eth_bond_free(const char *name);
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id);
+rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id);
/**
* Remove a slave rte_eth_dev device from the bonded device
@@ -163,7 +163,7 @@ rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id);
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id);
+rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id);
/**
* Set link bonding mode of bonded device
@@ -175,7 +175,7 @@ rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id);
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode);
+rte_eth_bond_mode_set(uint16_t bonded_port_id, uint8_t mode);
/**
* Get link bonding mode of bonded device
@@ -186,7 +186,7 @@ rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode);
* link bonding mode on success, negative value otherwise
*/
int
-rte_eth_bond_mode_get(uint8_t bonded_port_id);
+rte_eth_bond_mode_get(uint16_t bonded_port_id);
/**
* Set slave rte_eth_dev as primary slave of bonded device
@@ -198,7 +198,7 @@ rte_eth_bond_mode_get(uint8_t bonded_port_id);
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id);
+rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id);
/**
* Get primary slave of bonded device
@@ -209,7 +209,7 @@ rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id);
* Port Id of primary slave on success, -1 on failure
*/
int
-rte_eth_bond_primary_get(uint8_t bonded_port_id);
+rte_eth_bond_primary_get(uint16_t bonded_port_id);
/**
* Populate an array with list of the slaves port id's of the bonded device
@@ -223,7 +223,8 @@ rte_eth_bond_primary_get(uint8_t bonded_port_id);
* negative value otherwise
*/
int
-rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len);
+rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t slaves[],
+ uint16_t len);
/**
* Populate an array with list of the active slaves port id's of the bonded
@@ -238,8 +239,8 @@ rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len);
* negative value otherwise
*/
int
-rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],
- uint8_t len);
+rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[],
+ uint16_t len);
/**
* Set explicit MAC address to use on bonded device and it's slaves.
@@ -252,7 +253,7 @@ rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_mac_address_set(uint8_t bonded_port_id,
+rte_eth_bond_mac_address_set(uint16_t bonded_port_id,
struct ether_addr *mac_addr);
/**
@@ -265,7 +266,7 @@ rte_eth_bond_mac_address_set(uint8_t bonded_port_id,
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_mac_address_reset(uint8_t bonded_port_id);
+rte_eth_bond_mac_address_reset(uint16_t bonded_port_id);
/**
* Set the transmit policy for bonded device to use when it is operating in
@@ -279,7 +280,7 @@ rte_eth_bond_mac_address_reset(uint8_t bonded_port_id);
* 0 on success, negative value otherwise.
*/
int
-rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy);
+rte_eth_bond_xmit_policy_set(uint16_t bonded_port_id, uint8_t policy);
/**
* Get the transmit policy set on bonded device for balance mode operation
@@ -290,7 +291,7 @@ rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy);
* Balance transmit policy on success, negative value otherwise.
*/
int
-rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id);
+rte_eth_bond_xmit_policy_get(uint16_t bonded_port_id);
/**
* Set the link monitoring frequency (in ms) for monitoring the link status of
@@ -304,7 +305,7 @@ rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id);
*/
int
-rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms);
+rte_eth_bond_link_monitoring_set(uint16_t bonded_port_id, uint32_t internal_ms);
/**
* Get the current link monitoring frequency (in ms) for monitoring of the link
@@ -316,7 +317,7 @@ rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms);
* Monitoring interval on success, negative value otherwise.
*/
int
-rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id);
+rte_eth_bond_link_monitoring_get(uint16_t bonded_port_id);
/**
@@ -330,7 +331,8 @@ rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id);
* 0 on success, negative value otherwise.
*/
int
-rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms);
+rte_eth_bond_link_down_prop_delay_set(uint16_t bonded_port_id,
+ uint32_t delay_ms);
/**
* Get the period in milliseconds set for delaying the disabling of a bonded
@@ -342,7 +344,7 @@ rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
* Delay period on success, negative value otherwise.
*/
int
-rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id);
+rte_eth_bond_link_down_prop_delay_get(uint16_t bonded_port_id);
/**
* Set the period in milliseconds for delaying the enabling of a bonded link
@@ -355,7 +357,8 @@ rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id);
* 0 on success, negative value otherwise.
*/
int
-rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms);
+rte_eth_bond_link_up_prop_delay_set(uint16_t bonded_port_id,
+ uint32_t delay_ms);
/**
* Get the period in milliseconds set for delaying the enabling of a bonded
@@ -367,7 +370,7 @@ rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms);
* Delay period on success, negative value otherwise.
*/
int
-rte_eth_bond_link_up_prop_delay_get(uint8_t bonded_port_id);
+rte_eth_bond_link_up_prop_delay_get(uint16_t bonded_port_id);
#ifdef __cplusplus
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index c2b9e053c..c1873aa13 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -209,7 +209,7 @@ set_warning_flags(struct port *port, uint16_t flags)
}
static void
-show_warnings(uint8_t slave_id)
+show_warnings(uint16_t slave_id)
{
struct port *port = &mode_8023ad_ports[slave_id];
uint8_t warnings;
@@ -278,7 +278,7 @@ record_default(struct port *port)
* @param port Port on which LACPDU was received.
*/
static void
-rx_machine(struct bond_dev_private *internals, uint8_t slave_id,
+rx_machine(struct bond_dev_private *internals, uint16_t slave_id,
struct lacpdu *lacp)
{
struct port *agg, *port = &mode_8023ad_ports[slave_id];
@@ -399,7 +399,7 @@ rx_machine(struct bond_dev_private *internals, uint8_t slave_id,
* @param port Port to handle state machine.
*/
static void
-periodic_machine(struct bond_dev_private *internals, uint8_t slave_id)
+periodic_machine(struct bond_dev_private *internals, uint16_t slave_id)
{
struct port *port = &mode_8023ad_ports[slave_id];
/* Calculate if either site is LACP enabled */
@@ -461,7 +461,7 @@ periodic_machine(struct bond_dev_private *internals, uint8_t slave_id)
* @param port Port to handle state machine.
*/
static void
-mux_machine(struct bond_dev_private *internals, uint8_t slave_id)
+mux_machine(struct bond_dev_private *internals, uint16_t slave_id)
{
struct port *port = &mode_8023ad_ports[slave_id];
@@ -564,7 +564,7 @@ mux_machine(struct bond_dev_private *internals, uint8_t slave_id)
* @param port
*/
static void
-tx_machine(struct bond_dev_private *internals, uint8_t slave_id)
+tx_machine(struct bond_dev_private *internals, uint16_t slave_id)
{
struct port *agg, *port = &mode_8023ad_ports[slave_id];
@@ -688,11 +688,11 @@ static void
selection_logic(struct bond_dev_private *internals, uint8_t slave_id)
{
struct port *agg, *port;
- uint8_t slaves_count, new_agg_id, i, j = 0;
- uint8_t *slaves;
+ uint16_t slaves_count, new_agg_id, i, j = 0;
+ uint16_t *slaves;
uint64_t agg_bandwidth[8] = {0};
uint64_t agg_count[8] = {0};
- uint8_t default_slave = 0;
+ uint16_t default_slave = 0;
uint8_t mode_count_id, mode_band_id;
struct rte_eth_link link_info;
@@ -923,7 +923,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
}
void
-bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)
+bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
+ uint16_t slave_id)
{
struct bond_dev_private *internals = bond_dev->data->dev_private;
@@ -951,7 +952,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)
memcpy(&port->actor, &initial, sizeof(struct port_params));
/* Standard requires that port ID must be grater than 0.
* Add 1 do get corresponding port_number */
- port->actor.port_number = rte_cpu_to_be_16((uint16_t)slave_id + 1);
+ port->actor.port_number = rte_cpu_to_be_16(slave_id + 1);
memcpy(&port->partner, &initial, sizeof(struct port_params));
@@ -1022,12 +1023,12 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)
int
bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *bond_dev,
- uint8_t slave_id)
+ uint16_t slave_id)
{
struct bond_dev_private *internals = bond_dev->data->dev_private;
void *pkt = NULL;
struct port *port;
- uint8_t i;
+ uint16_t i;
/* Given slave must be in active list */
RTE_ASSERT(find_slave_by_id(internals->active_slaves,
@@ -1066,7 +1067,7 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev)
struct bond_dev_private *internals = bond_dev->data->dev_private;
struct ether_addr slave_addr;
struct port *slave, *agg_slave;
- uint8_t slave_id, i, j;
+ uint16_t slave_id, i, j;
bond_mode_8023ad_stop(bond_dev);
@@ -1214,7 +1215,7 @@ bond_mode_8023ad_stop(struct rte_eth_dev *bond_dev)
void
bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
- uint8_t slave_id, struct rte_mbuf *pkt)
+ uint16_t slave_id, struct rte_mbuf *pkt)
{
struct mode8023ad_private *mode4 = &internals->mode4;
struct port *port = &mode_8023ad_ports[slave_id];
@@ -1295,7 +1296,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
}
int
-rte_eth_bond_8023ad_conf_get(uint8_t port_id,
+rte_eth_bond_8023ad_conf_get(uint16_t port_id,
struct rte_eth_bond_8023ad_conf *conf)
{
struct rte_eth_dev *bond_dev;
@@ -1312,7 +1313,7 @@ rte_eth_bond_8023ad_conf_get(uint8_t port_id,
}
int
-rte_eth_bond_8023ad_agg_selection_set(uint8_t port_id,
+rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
enum rte_bond_8023ad_agg_selection agg_selection)
{
struct rte_eth_dev *bond_dev;
@@ -1334,7 +1335,7 @@ rte_eth_bond_8023ad_agg_selection_set(uint8_t port_id,
return 0;
}
-int rte_eth_bond_8023ad_agg_selection_get(uint8_t port_id)
+int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id)
{
struct rte_eth_dev *bond_dev;
struct bond_dev_private *internals;
@@ -1355,7 +1356,7 @@ int rte_eth_bond_8023ad_agg_selection_get(uint8_t port_id)
static int
-bond_8023ad_setup_validate(uint8_t port_id,
+bond_8023ad_setup_validate(uint16_t port_id,
struct rte_eth_bond_8023ad_conf *conf)
{
if (valid_bonded_port_id(port_id) != 0)
@@ -1379,8 +1380,9 @@ bond_8023ad_setup_validate(uint8_t port_id,
return 0;
}
+
int
-rte_eth_bond_8023ad_setup(uint8_t port_id,
+rte_eth_bond_8023ad_setup(uint16_t port_id,
struct rte_eth_bond_8023ad_conf *conf)
{
struct rte_eth_dev *bond_dev;
@@ -1401,7 +1403,7 @@ rte_eth_bond_8023ad_setup(uint8_t port_id,
int
-rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
+rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id,
struct rte_eth_bond_8023ad_slave_info *info)
{
struct rte_eth_dev *bond_dev;
@@ -1434,7 +1436,7 @@ rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
}
static int
-bond_8023ad_ext_validate(uint8_t port_id, uint8_t slave_id)
+bond_8023ad_ext_validate(uint16_t port_id, uint16_t slave_id)
{
struct rte_eth_dev *bond_dev;
struct bond_dev_private *internals;
@@ -1462,7 +1464,8 @@ bond_8023ad_ext_validate(uint8_t port_id, uint8_t slave_id)
}
int
-rte_eth_bond_8023ad_ext_collect(uint8_t port_id, uint8_t slave_id, int enabled)
+rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t slave_id,
+ int enabled)
{
struct port *port;
int res;
@@ -1482,7 +1485,8 @@ rte_eth_bond_8023ad_ext_collect(uint8_t port_id, uint8_t slave_id, int enabled)
}
int
-rte_eth_bond_8023ad_ext_distrib(uint8_t port_id, uint8_t slave_id, int enabled)
+rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t slave_id,
+ int enabled)
{
struct port *port;
int res;
@@ -1502,7 +1506,7 @@ rte_eth_bond_8023ad_ext_distrib(uint8_t port_id, uint8_t slave_id, int enabled)
}
int
-rte_eth_bond_8023ad_ext_distrib_get(uint8_t port_id, uint8_t slave_id)
+rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t slave_id)
{
struct port *port;
int err;
@@ -1516,7 +1520,7 @@ rte_eth_bond_8023ad_ext_distrib_get(uint8_t port_id, uint8_t slave_id)
}
int
-rte_eth_bond_8023ad_ext_collect_get(uint8_t port_id, uint8_t slave_id)
+rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t slave_id)
{
struct port *port;
int err;
@@ -1530,7 +1534,7 @@ rte_eth_bond_8023ad_ext_collect_get(uint8_t port_id, uint8_t slave_id)
}
int
-rte_eth_bond_8023ad_ext_slowtx(uint8_t port_id, uint8_t slave_id,
+rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t slave_id,
struct rte_mbuf *lacp_pkt)
{
struct port *port;
@@ -1591,7 +1595,7 @@ bond_mode_8023ad_ext_periodic_cb(void *arg)
}
int
-rte_eth_bond_8023ad_dedicated_queues_enable(uint8_t port)
+rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port)
{
int retval = 0;
struct rte_eth_dev *dev = &rte_eth_devices[port];
@@ -1615,7 +1619,7 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint8_t port)
}
int
-rte_eth_bond_8023ad_dedicated_queues_disable(uint8_t port)
+rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
{
int retval = 0;
struct rte_eth_dev *dev = &rte_eth_devices[port];
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index d609745e0..2874336d3 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -64,7 +64,7 @@ extern "C" {
#define MARKER_TLV_TYPE_INFO 0x01
#define MARKER_TLV_TYPE_RESP 0x02
-typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint8_t slave_id,
+typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t slave_id,
struct rte_mbuf *lacp_pkt);
enum rte_bond_8023ad_selection {
@@ -176,7 +176,7 @@ struct rte_eth_bond_8023ad_slave_info {
struct port_params actor;
uint8_t partner_state;
struct port_params partner;
- uint8_t agg_port_id;
+ uint16_t agg_port_id;
};
/**
@@ -192,7 +192,7 @@ struct rte_eth_bond_8023ad_slave_info {
* -EINVAL if conf is NULL
*/
int
-rte_eth_bond_8023ad_conf_get(uint8_t port_id,
+rte_eth_bond_8023ad_conf_get(uint16_t port_id,
struct rte_eth_bond_8023ad_conf *conf);
/**
@@ -207,7 +207,7 @@ rte_eth_bond_8023ad_conf_get(uint8_t port_id,
* -EINVAL if configuration is invalid.
*/
int
-rte_eth_bond_8023ad_setup(uint8_t port_id,
+rte_eth_bond_8023ad_setup(uint16_t port_id,
struct rte_eth_bond_8023ad_conf *conf);
/**
@@ -223,7 +223,7 @@ rte_eth_bond_8023ad_setup(uint8_t port_id,
* bonded device or is not inactive).
*/
int
-rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
+rte_eth_bond_8023ad_slave_info(uint16_t port_id, uint16_t slave_id,
struct rte_eth_bond_8023ad_slave_info *conf);
#ifdef __cplusplus
@@ -241,7 +241,8 @@ rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
* -EINVAL if slave is not valid.
*/
int
-rte_eth_bond_8023ad_ext_collect(uint8_t port_id, uint8_t slave_id, int enabled);
+rte_eth_bond_8023ad_ext_collect(uint16_t port_id, uint16_t slave_id,
+ int enabled);
/**
* Get COLLECTING flag from slave port actor state.
@@ -254,7 +255,7 @@ rte_eth_bond_8023ad_ext_collect(uint8_t port_id, uint8_t slave_id, int enabled);
* -EINVAL if slave is not valid.
*/
int
-rte_eth_bond_8023ad_ext_collect_get(uint8_t port_id, uint8_t slave_id);
+rte_eth_bond_8023ad_ext_collect_get(uint16_t port_id, uint16_t slave_id);
/**
* Configure a slave port to start distributing.
@@ -267,7 +268,8 @@ rte_eth_bond_8023ad_ext_collect_get(uint8_t port_id, uint8_t slave_id);
* -EINVAL if slave is not valid.
*/
int
-rte_eth_bond_8023ad_ext_distrib(uint8_t port_id, uint8_t slave_id, int enabled);
+rte_eth_bond_8023ad_ext_distrib(uint16_t port_id, uint16_t slave_id,
+ int enabled);
/**
* Get DISTRIBUTING flag from slave port actor state.
@@ -280,7 +282,7 @@ rte_eth_bond_8023ad_ext_distrib(uint8_t port_id, uint8_t slave_id, int enabled);
* -EINVAL if slave is not valid.
*/
int
-rte_eth_bond_8023ad_ext_distrib_get(uint8_t port_id, uint8_t slave_id);
+rte_eth_bond_8023ad_ext_distrib_get(uint16_t port_id, uint16_t slave_id);
/**
* LACPDU transmit path for external 802.3ad state machine. Caller retains
@@ -294,7 +296,7 @@ rte_eth_bond_8023ad_ext_distrib_get(uint8_t port_id, uint8_t slave_id);
* 0 on success, negative value otherwise.
*/
int
-rte_eth_bond_8023ad_ext_slowtx(uint8_t port_id, uint8_t slave_id,
+rte_eth_bond_8023ad_ext_slowtx(uint16_t port_id, uint16_t slave_id,
struct rte_mbuf *lacp_pkt);
/**
@@ -320,7 +322,7 @@ rte_eth_bond_8023ad_ext_slowtx(uint8_t port_id, uint8_t slave_id,
* 0 on success, negative value otherwise.
*/
int
-rte_eth_bond_8023ad_dedicated_queues_enable(uint8_t port_id);
+rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port_id);
/**
* Disable slow queue on slaves
@@ -337,7 +339,7 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint8_t port_id);
*
*/
int
-rte_eth_bond_8023ad_dedicated_queues_disable(uint8_t port_id);
+rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port_id);
/*
* Get aggregator mode for 8023ad
@@ -347,7 +349,7 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint8_t port_id);
* agregator mode on success, negative value otherwise
*/
int
-rte_eth_bond_8023ad_agg_selection_get(uint8_t port_id);
+rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id);
/**
* Set aggregator mode for 8023ad
@@ -356,6 +358,6 @@ rte_eth_bond_8023ad_agg_selection_get(uint8_t port_id);
* 0 on success, negative value otherwise
*/
int
-rte_eth_bond_8023ad_agg_selection_set(uint8_t port_id,
+rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
enum rte_bond_8023ad_agg_selection agg_selection);
#endif /* RTE_ETH_BOND_8023AD_H_ */
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad_private.h b/drivers/net/bonding/rte_eth_bond_8023ad_private.h
index d46e44a84..433c7000d 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad_private.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad_private.h
@@ -279,7 +279,7 @@ bond_mode_8023ad_stop(struct rte_eth_dev *dev);
*/
void
bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
- uint8_t slave_id, struct rte_mbuf *pkt);
+ uint16_t slave_id, struct rte_mbuf *pkt);
/**
* @internal
@@ -293,7 +293,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
* 0 on success, negative value otherwise.
*/
void
-bond_mode_8023ad_activate_slave(struct rte_eth_dev *dev, uint8_t port_id);
+bond_mode_8023ad_activate_slave(struct rte_eth_dev *dev, uint16_t port_id);
/**
* @internal
@@ -307,7 +307,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *dev, uint8_t port_id);
* 0 on success, negative value otherwise.
*/
int
-bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *dev, uint8_t slave_pos);
+bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *dev, uint16_t slave_pos);
/**
* Updates state when MAC was changed on bonded device or one of its slaves.
@@ -318,12 +318,12 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev);
int
bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
- uint8_t slave_port);
+ uint16_t slave_port);
int
-bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint8_t slave_port);
+bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port);
int
-bond_8023ad_slow_pkt_hw_filter_supported(uint8_t port_id);
+bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id);
#endif /* RTE_ETH_BOND_8023AD_H_ */
diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c
index d9d37495d..f7efbb78e 100644
--- a/drivers/net/bonding/rte_eth_bond_alb.c
+++ b/drivers/net/bonding/rte_eth_bond_alb.c
@@ -148,7 +148,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset,
rte_spinlock_unlock(&internals->mode6.lock);
}
-uint8_t
+uint16_t
bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
struct bond_dev_private *internals)
{
@@ -220,13 +220,13 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
return internals->current_primary_port;
}
-uint8_t
+uint16_t
bond_mode_alb_arp_upd(struct client_data *client_info,
struct rte_mbuf *pkt, struct bond_dev_private *internals)
{
struct ether_hdr *eth_h;
struct arp_hdr *arp_h;
- uint8_t slave_idx;
+ uint16_t slave_idx;
rte_spinlock_lock(&internals->mode6.lock);
eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h
index fd7c3aeb4..9f17f7c85 100644
--- a/drivers/net/bonding/rte_eth_bond_alb.h
+++ b/drivers/net/bonding/rte_eth_bond_alb.h
@@ -51,7 +51,7 @@ struct client_data {
uint32_t cli_ip;
/**< Client IP address */
- uint8_t slave_idx;
+ uint16_t slave_idx;
/**< Index of slave on which we connect with that client */
uint8_t in_use;
/**< Flag indicating if entry in client table is currently used */
@@ -113,7 +113,7 @@ bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset,
* @return
* Index of slave on which packet should be sent.
*/
-uint8_t
+uint16_t
bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
struct bond_dev_private *internals);
@@ -127,7 +127,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
* @return
* Index of slawe on which packet should be sent.
*/
-uint8_t
+uint16_t
bond_mode_alb_arp_upd(struct client_data *client_info,
struct rte_mbuf *pkt, struct bond_dev_private *internals);
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index de1d9e0db..529aae34e 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -56,14 +56,14 @@ check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev)
}
int
-valid_bonded_port_id(uint8_t port_id)
+valid_bonded_port_id(uint16_t port_id)
{
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
return check_for_bonded_ethdev(&rte_eth_devices[port_id]);
}
int
-valid_slave_port_id(uint8_t port_id, uint8_t mode)
+valid_slave_port_id(uint16_t port_id, uint8_t mode)
{
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
@@ -80,7 +80,7 @@ valid_slave_port_id(uint8_t port_id, uint8_t mode)
}
void
-activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
+activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
uint8_t active_count = internals->active_slave_count;
@@ -107,11 +107,11 @@ activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
}
void
-deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
+deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
{
- uint8_t slave_pos;
+ uint16_t slave_pos;
struct bond_dev_private *internals = eth_dev->data->dev_private;
- uint8_t active_count = internals->active_slave_count;
+ uint16_t active_count = internals->active_slave_count;
if (internals->mode == BONDING_MODE_8023AD) {
bond_mode_8023ad_stop(eth_dev);
@@ -153,7 +153,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
{
struct bond_dev_private *internals;
char devargs[52];
- uint8_t port_id;
+ uint16_t port_id;
int ret;
if (name == NULL) {
@@ -193,7 +193,7 @@ rte_eth_bond_free(const char *name)
}
static int
-slave_vlan_filter_set(uint8_t bonded_port_id, uint8_t slave_port_id)
+slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
@@ -233,7 +233,7 @@ slave_vlan_filter_set(uint8_t bonded_port_id, uint8_t slave_port_id)
}
static int
-__eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
+__eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev, *slave_eth_dev;
struct bond_dev_private *internals;
@@ -363,7 +363,7 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
}
int
-rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id)
+rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
@@ -387,7 +387,8 @@ rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id)
}
static int
-__eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
+__eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
+ uint16_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
@@ -466,7 +467,7 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
}
int
-rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id)
+rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
@@ -488,7 +489,7 @@ rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id)
}
int
-rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode)
+rte_eth_bond_mode_set(uint16_t bonded_port_id, uint8_t mode)
{
if (valid_bonded_port_id(bonded_port_id) != 0)
return -1;
@@ -497,7 +498,7 @@ rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode)
}
int
-rte_eth_bond_mode_get(uint8_t bonded_port_id)
+rte_eth_bond_mode_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
@@ -510,7 +511,7 @@ rte_eth_bond_mode_get(uint8_t bonded_port_id)
}
int
-rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id)
+rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id)
{
struct bond_dev_private *internals;
@@ -531,7 +532,7 @@ rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id)
}
int
-rte_eth_bond_primary_get(uint8_t bonded_port_id)
+rte_eth_bond_primary_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
@@ -547,7 +548,8 @@ rte_eth_bond_primary_get(uint8_t bonded_port_id)
}
int
-rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len)
+rte_eth_bond_slaves_get(uint16_t bonded_port_id, uint16_t slaves[],
+ uint16_t len)
{
struct bond_dev_private *internals;
uint8_t i;
@@ -570,8 +572,8 @@ rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len)
}
int
-rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],
- uint8_t len)
+rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[],
+ uint16_t len)
{
struct bond_dev_private *internals;
@@ -586,13 +588,14 @@ rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],
if (internals->active_slave_count > len)
return -1;
- memcpy(slaves, internals->active_slaves, internals->active_slave_count);
+ memcpy(slaves, internals->active_slaves,
+ internals->active_slave_count * sizeof(internals->active_slaves[0]));
return internals->active_slave_count;
}
int
-rte_eth_bond_mac_address_set(uint8_t bonded_port_id,
+rte_eth_bond_mac_address_set(uint16_t bonded_port_id,
struct ether_addr *mac_addr)
{
struct rte_eth_dev *bonded_eth_dev;
@@ -618,7 +621,7 @@ rte_eth_bond_mac_address_set(uint8_t bonded_port_id,
}
int
-rte_eth_bond_mac_address_reset(uint8_t bonded_port_id)
+rte_eth_bond_mac_address_reset(uint16_t bonded_port_id)
{
struct rte_eth_dev *bonded_eth_dev;
struct bond_dev_private *internals;
@@ -647,7 +650,7 @@ rte_eth_bond_mac_address_reset(uint8_t bonded_port_id)
}
int
-rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy)
+rte_eth_bond_xmit_policy_set(uint16_t bonded_port_id, uint8_t policy)
{
struct bond_dev_private *internals;
@@ -677,7 +680,7 @@ rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy)
}
int
-rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id)
+rte_eth_bond_xmit_policy_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
@@ -690,7 +693,7 @@ rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id)
}
int
-rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms)
+rte_eth_bond_link_monitoring_set(uint16_t bonded_port_id, uint32_t internal_ms)
{
struct bond_dev_private *internals;
@@ -704,7 +707,7 @@ rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms)
}
int
-rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id)
+rte_eth_bond_link_monitoring_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
@@ -717,7 +720,8 @@ rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id)
}
int
-rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
+rte_eth_bond_link_down_prop_delay_set(uint16_t bonded_port_id,
+ uint32_t delay_ms)
{
struct bond_dev_private *internals;
@@ -732,7 +736,7 @@ rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
}
int
-rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id)
+rte_eth_bond_link_down_prop_delay_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
@@ -745,7 +749,7 @@ rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id)
}
int
-rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
+rte_eth_bond_link_up_prop_delay_set(uint16_t bonded_port_id, uint32_t delay_ms)
{
struct bond_dev_private *internals;
@@ -760,7 +764,7 @@ rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
}
int
-rte_eth_bond_link_up_prop_delay_get(uint8_t bonded_port_id)
+rte_eth_bond_link_up_prop_delay_get(uint16_t bonded_port_id)
{
struct bond_dev_private *internals;
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index bb634c62e..04d1f4e8f 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -153,7 +153,7 @@ bond_ethdev_parse_slave_port_kvarg(const char *key,
return -1;
} else
slave_ports->slaves[slave_ports->slave_count++] =
- (uint8_t)port_id;
+ port_id;
}
return 0;
}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 3ee70baa0..2d680e3fb 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -174,7 +174,7 @@ const struct rte_flow_attr flow_attr_8023ad = {
int
bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
- uint8_t slave_port) {
+ uint16_t slave_port) {
struct rte_flow_error error;
struct bond_dev_private *internals = (struct bond_dev_private *)
(bond_dev->data->dev_private);
@@ -202,12 +202,12 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
}
int
-bond_8023ad_slow_pkt_hw_filter_supported(uint8_t port_id) {
+bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
struct rte_eth_dev *bond_dev = &rte_eth_devices[port_id];
struct bond_dev_private *internals = (struct bond_dev_private *)
(bond_dev->data->dev_private);
struct rte_eth_dev_info bond_info, slave_info;
- uint8_t idx;
+ uint16_t idx;
/* Verify if all slaves in bonding supports flow director and */
if (internals->slave_count > 0) {
@@ -230,7 +230,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint8_t port_id) {
}
int
-bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint8_t slave_port) {
+bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) {
struct rte_flow_error error;
struct bond_dev_private *internals = (struct bond_dev_private *)
@@ -270,10 +270,10 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
struct bond_dev_private *internals = bd_rx_q->dev_private;
uint16_t num_rx_total = 0; /* Total number of received packets */
- uint8_t slaves[RTE_MAX_ETHPORTS];
- uint8_t slave_count;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t slave_count;
- uint8_t i, idx;
+ uint16_t i, idx;
/* Copy slave list to protect against slave up/down changes during tx
* bursting */
@@ -302,8 +302,8 @@ bond_ethdev_tx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
- uint8_t num_of_slaves;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t num_of_slaves;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
/* positions in slaves, not ID */
uint8_t distributing_offsets[RTE_MAX_ETHPORTS];
uint8_t distributing_count;
@@ -394,8 +394,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
uint16_t num_rx_total = 0; /* Total number of received packets */
- uint8_t slaves[RTE_MAX_ETHPORTS];
- uint8_t slave_count, idx;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t slave_count, idx;
uint8_t collecting; /* current slave collecting status */
const uint8_t promisc = internals->promiscuous_en;
@@ -673,8 +673,8 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts];
uint16_t slave_nb_pkts[RTE_MAX_ETHPORTS] = { 0 };
- uint8_t num_of_slaves;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t num_of_slaves;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
uint16_t num_tx_total = 0, num_tx_slave;
@@ -904,7 +904,7 @@ bandwidth_cmp(const void *a, const void *b)
}
static void
-bandwidth_left(uint8_t port_id, uint64_t load, uint8_t update_idx,
+bandwidth_left(uint16_t port_id, uint64_t load, uint8_t update_idx,
struct bwg_slave *bwg_slave)
{
struct rte_eth_link link_status;
@@ -970,10 +970,10 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
struct rte_eth_dev *primary_port =
&rte_eth_devices[internals->primary_port];
uint16_t num_tx_total = 0;
- uint8_t i, j;
+ uint16_t i, j;
- uint8_t num_of_slaves = internals->active_slave_count;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t num_of_slaves = internals->active_slave_count;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
struct ether_hdr *ether_hdr;
struct ether_addr primary_slave_addr;
@@ -1059,7 +1059,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
uint16_t num_send, num_not_send = 0;
uint16_t num_tx_total = 0;
- uint8_t slave_idx;
+ uint16_t slave_idx;
int i, j;
@@ -1178,8 +1178,8 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
- uint8_t num_of_slaves;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t num_of_slaves;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
uint16_t num_tx_total = 0, num_tx_slave = 0, tx_fail_total = 0;
@@ -1239,8 +1239,8 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
- uint8_t num_of_slaves;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t num_of_slaves;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
/* positions in slaves, not ID */
uint8_t distributing_offsets[RTE_MAX_ETHPORTS];
uint8_t distributing_count;
@@ -1333,7 +1333,7 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs,
struct bond_tx_queue *bd_tx_q;
uint8_t tx_failed_flag = 0, num_of_slaves;
- uint8_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t slaves[RTE_MAX_ETHPORTS];
uint16_t max_nb_of_tx_pkts = 0;
@@ -1861,7 +1861,7 @@ slave_add(struct bond_dev_private *internals,
void
bond_ethdev_primary_set(struct bond_dev_private *internals,
- uint8_t slave_port_id)
+ uint16_t slave_port_id)
{
int i;
@@ -2125,7 +2125,7 @@ static int
bond_ethdev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
int res;
- uint8_t i;
+ uint16_t i;
struct bond_dev_private *internals = dev->data->dev_private;
/* don't do this while a slave is being added */
@@ -2137,7 +2137,7 @@ bond_ethdev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
rte_bitmap_clear(internals->vlan_filter_bmp, vlan_id);
for (i = 0; i < internals->slave_count; i++) {
- uint8_t port_id = internals->slaves[i].port_id;
+ uint16_t port_id = internals->slaves[i].port_id;
res = rte_eth_dev_vlan_filter(port_id, vlan_id, on);
if (res == ENOTSUP)
@@ -2277,7 +2277,7 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)
static int
bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete)
{
- void (*link_update)(uint8_t port_id, struct rte_eth_link *eth_link);
+ void (*link_update)(uint16_t port_id, struct rte_eth_link *eth_link);
struct bond_dev_private *bond_ctx;
struct rte_eth_link slave_link;
@@ -2466,7 +2466,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
}
int
-bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
+bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
void *param, void *ret_param __rte_unused)
{
struct rte_eth_dev *bonded_eth_dev;
@@ -2951,7 +2951,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
struct bond_dev_private *internals = dev->data->dev_private;
struct rte_kvargs *kvlist = internals->kvlist;
int arg_count;
- uint8_t port_id = dev - rte_eth_devices;
+ uint16_t port_id = dev - rte_eth_devices;
uint8_t agg_mode;
static const uint8_t default_rss_key[40] = {
@@ -3086,7 +3086,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
/* Parse/set primary slave port id*/
arg_count = rte_kvargs_count(kvlist, PMD_BOND_PRIMARY_SLAVE_KVARG);
if (arg_count == 1) {
- uint8_t primary_slave_port_id;
+ uint16_t primary_slave_port_id;
if (rte_kvargs_process(kvlist,
PMD_BOND_PRIMARY_SLAVE_KVARG,
@@ -3099,7 +3099,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
/* Set balance mode transmit policy*/
- if (rte_eth_bond_primary_set(port_id, (uint8_t)primary_slave_port_id)
+ if (rte_eth_bond_primary_set(port_id, primary_slave_port_id)
!= 0) {
RTE_LOG(ERR, EAL,
"Failed to set primary slave port %d on bonded device %s\n",
diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h
index 1fe6ff880..1392da98d 100644
--- a/drivers/net/bonding/rte_eth_bond_private.h
+++ b/drivers/net/bonding/rte_eth_bond_private.h
@@ -93,12 +93,12 @@ struct bond_tx_queue {
/** Bonded slave devices structure */
struct bond_ethdev_slave_ports {
- uint8_t slaves[RTE_MAX_ETHPORTS]; /**< Slave port id array */
- uint8_t slave_count; /**< Number of slaves */
+ uint16_t slaves[RTE_MAX_ETHPORTS]; /**< Slave port id array */
+ uint16_t slave_count; /**< Number of slaves */
};
struct bond_slave_details {
- uint8_t port_id;
+ uint16_t port_id;
uint8_t link_status_poll_enabled;
uint8_t link_status_wait_to_complete;
@@ -114,14 +114,14 @@ typedef uint16_t (*xmit_hash_t)(const struct rte_mbuf *buf, uint8_t slave_count)
/** Link Bonding PMD device private configuration Structure */
struct bond_dev_private {
- uint8_t port_id; /**< Port Id of Bonded Port */
+ uint16_t port_id; /**< Port Id of Bonded Port */
uint8_t mode; /**< Link Bonding Mode */
rte_spinlock_t lock;
- uint8_t primary_port; /**< Primary Slave Port */
- uint8_t current_primary_port; /**< Primary Slave Port */
- uint8_t user_defined_primary_port;
+ uint16_t primary_port; /**< Primary Slave Port */
+ uint16_t current_primary_port; /**< Primary Slave Port */
+ uint16_t user_defined_primary_port;
/**< Flag for whether primary port is user defined or not */
uint8_t balance_xmit_policy;
@@ -144,16 +144,17 @@ struct bond_dev_private {
uint16_t nb_rx_queues; /**< Total number of rx queues */
uint16_t nb_tx_queues; /**< Total number of tx queues*/
- uint8_t active_slave; /**< Next active_slave to poll */
- uint8_t active_slave_count; /**< Number of active slaves */
- uint8_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */
+ uint16_t active_slave; /**< Next active_slave to poll */
+ uint16_t active_slave_count; /**< Number of active slaves */
+ uint16_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */
- uint8_t slave_count; /**< Number of bonded slaves */
+ uint16_t slave_count; /**< Number of bonded slaves */
struct bond_slave_details slaves[RTE_MAX_ETHPORTS];
/**< Arary of bonded slaves details */
struct mode8023ad_private mode4;
- uint8_t tlb_slaves_order[RTE_MAX_ETHPORTS]; /* TLB active slaves send order */
+ uint16_t tlb_slaves_order[RTE_MAX_ETHPORTS];
+ /**< TLB active slaves send order */
struct mode_alb_private mode6;
uint32_t rx_offload_capa; /** Rx offload capability */
@@ -186,10 +187,10 @@ check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev);
/* Search given slave array to find position of given id.
* Return slave pos or slaves_count if not found. */
-static inline uint8_t
-find_slave_by_id(uint8_t *slaves, uint8_t slaves_count, uint8_t slave_id) {
+static inline uint16_t
+find_slave_by_id(uint16_t *slaves, uint16_t slaves_count, uint16_t slave_id) {
- uint8_t pos;
+ uint16_t pos;
for (pos = 0; pos < slaves_count; pos++) {
if (slave_id == slaves[pos])
break;
@@ -199,19 +200,19 @@ find_slave_by_id(uint8_t *slaves, uint8_t slaves_count, uint8_t slave_id) {
}
int
-valid_port_id(uint8_t port_id);
+valid_port_id(uint16_t port_id);
int
-valid_bonded_port_id(uint8_t port_id);
+valid_bonded_port_id(uint16_t port_id);
int
-valid_slave_port_id(uint8_t port_id, uint8_t mode);
+valid_slave_port_id(uint16_t port_id, uint8_t mode);
void
-deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id);
+deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id);
void
-activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id);
+activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id);
void
link_properties_set(struct rte_eth_dev *bonded_eth_dev,
@@ -255,10 +256,10 @@ xmit_l34_hash(const struct rte_mbuf *buf, uint8_t slave_count);
void
bond_ethdev_primary_set(struct bond_dev_private *internals,
- uint8_t slave_port_id);
+ uint16_t slave_port_id);
int
-bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
+bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
void *param, void *ret_param);
int
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 3d4ab9368..a59947d78 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1624,7 +1624,7 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,
rte_em_dev_atomic_read_link_status(dev, &link);
if (link.link_status) {
PMD_INIT_LOG(INFO, " Port %d: Link Up - speed %u Mbps - %s",
- dev->data->port_id, (unsigned)link.link_speed,
+ dev->data->port_id, link.link_speed,
link.link_duplex == ETH_LINK_FULL_DUPLEX ?
"full-duplex" : "half-duplex");
} else {
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 31819c5bd..06ba68e39 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -119,7 +119,7 @@ struct em_rx_queue {
uint16_t nb_rx_hold; /**< number of held free RX desc. */
uint16_t rx_free_thresh; /**< max free RX desc to hold. */
uint16_t queue_id; /**< RX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold register. */
@@ -186,7 +186,7 @@ struct em_tx_queue {
/** Total number of TX descriptors ready to be allocated. */
uint16_t nb_tx_free;
uint16_t queue_id; /**< TX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold register. */
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 1c80a2a1b..a800d9c2b 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -122,7 +122,7 @@ struct igb_rx_queue {
uint16_t rx_free_thresh; /**< max free RX desc to hold. */
uint16_t queue_id; /**< RX queue index. */
uint16_t reg_idx; /**< RX queue register index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold register. */
@@ -191,7 +191,7 @@ struct igb_tx_queue {
/**< Index of first used TX descriptor. */
uint16_t queue_id; /**< TX queue index. */
uint16_t reg_idx; /**< TX queue register index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold register. */
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index a3a8cce95..1c8a9337e 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -400,7 +400,7 @@ failsafe_eth_dev_state_sync(struct rte_eth_dev *dev)
}
int
-failsafe_eth_rmv_event_callback(uint8_t port_id __rte_unused,
+failsafe_eth_rmv_event_callback(uint16_t port_id __rte_unused,
enum rte_eth_event_type event __rte_unused,
void *cb_arg, void *out __rte_unused)
{
@@ -419,7 +419,7 @@ failsafe_eth_rmv_event_callback(uint8_t port_id __rte_unused,
}
int
-failsafe_eth_lsc_event_callback(uint8_t port_id __rte_unused,
+failsafe_eth_lsc_event_callback(uint16_t port_id __rte_unused,
enum rte_eth_event_type event __rte_unused,
void *cb_arg, void *out __rte_unused)
{
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 0361cf434..4ae6e6c5f 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -180,10 +180,10 @@ int failsafe_eal_uninit(struct rte_eth_dev *dev);
int failsafe_eth_dev_state_sync(struct rte_eth_dev *dev);
void failsafe_dev_remove(struct rte_eth_dev *dev);
-int failsafe_eth_rmv_event_callback(uint8_t port_id,
+int failsafe_eth_rmv_event_callback(uint16_t port_id,
enum rte_eth_event_type type,
void *arg, void *out);
-int failsafe_eth_lsc_event_callback(uint8_t port_id,
+int failsafe_eth_lsc_event_callback(uint16_t port_id,
enum rte_eth_event_type event,
void *cb_arg, void *out);
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 8e1a95062..060982b10 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -204,7 +204,7 @@ struct fm10k_rx_queue {
uint16_t rxrearm_nb; /* number of remaining to be re-armed */
uint16_t rxrearm_start; /* the idx we start the re-arming from */
uint16_t rx_using_sse; /* indicates that vector RX is in use */
- uint8_t port_id;
+ uint16_t port_id;
uint8_t drop_en;
uint8_t rx_deferred_start; /* don't start this queue in dev start. */
uint16_t rx_ftag_en; /* indicates FTAG RX supported */
@@ -241,7 +241,7 @@ struct fm10k_tx_queue {
volatile uint32_t *tail_ptr;
uint32_t txq_flags; /* Holds flags for this TXq */
uint16_t nb_desc;
- uint8_t port_id;
+ uint16_t port_id;
uint8_t tx_deferred_start; /** don't start this queue in dev start. */
uint16_t queue_id;
uint16_t tx_ftag_en; /* indicates FTAG TX supported */
@@ -289,7 +289,7 @@ static inline uint16_t fifo_remove(struct fifo *fifo)
}
static inline void
-fm10k_pktmbuf_reset(struct rte_mbuf *mb, uint8_t in_port)
+fm10k_pktmbuf_reset(struct rte_mbuf *mb, uint16_t in_port)
{
rte_mbuf_refcnt_set(mb, 1);
mb->next = NULL;
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 55c79a60a..1290d7f32 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -42,7 +42,7 @@ CFLAGS += -DX722_A0_SUPPORT
EXPORT_MAP := rte_pmd_i40e_version.map
-LIBABIVER := 1
+LIBABIVER := 2
#
# Add extra flags for base driver files (also known as shared code)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f12aefa5d..c4c6aec1d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1920,8 +1920,9 @@ i40e_dev_start(struct rte_eth_dev *dev)
hw->adapter_stopped = 0;
if (dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
- PMD_INIT_LOG(ERR, "Invalid link_speeds for port %hhu; autonegotiation disabled",
- dev->data->port_id);
+ PMD_INIT_LOG(ERR,
+ "Invalid link_speeds for port %u, autonegotiation disabled",
+ dev->data->port_id);
return -EINVAL;
}
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 20084d649..ff2ab8575 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -121,7 +121,7 @@ struct i40e_rx_queue {
uint16_t rxrearm_start; /**< the idx we start the re-arming from */
uint64_t mbuf_initializer; /**< value to init mbufs */
- uint8_t port_id; /**< device port ID */
+ uint16_t port_id; /**< device port ID */
uint8_t crc_len; /**< 0 if CRC stripped, 4 otherwise */
uint16_t queue_id; /**< RX queue index */
uint16_t reg_idx; /**< RX queue register index */
@@ -167,7 +167,7 @@ struct i40e_tx_queue {
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold reg. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint16_t queue_id; /**< TX queue index. */
uint16_t reg_idx;
uint32_t txq_flags;
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index f12b7f4a1..3728d39b9 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -41,7 +41,7 @@
#include "rte_pmd_i40e.h"
int
-rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -66,7 +66,7 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
}
int
-rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -170,7 +170,7 @@ i40e_add_rm_all_vlan_filter(struct i40e_vsi *vsi, uint8_t add)
}
int
-rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -430,7 +430,7 @@ i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
}
int
-rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
+rte_pmd_i40e_set_tx_loopback(uint16_t port, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -473,7 +473,7 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
}
int
-rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -514,7 +514,7 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
}
int
-rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -555,7 +555,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
}
int
-rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
struct ether_addr *mac_addr)
{
struct i40e_mac_filter *f;
@@ -598,7 +598,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
/* Set vlan strip on/off for specific VF from host */
int
-rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
+rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -633,7 +633,7 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
return ret;
}
-int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id,
uint16_t vlan_id)
{
struct rte_eth_dev *dev;
@@ -698,7 +698,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
return ret;
}
-int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
uint8_t on)
{
struct rte_eth_dev *dev;
@@ -764,7 +764,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
return ret;
}
-int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
+int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -858,7 +858,7 @@ i40e_vlan_filter_count(struct i40e_vsi *vsi)
return count;
}
-int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id,
uint64_t vf_mask, uint8_t on)
{
struct rte_eth_dev *dev;
@@ -941,7 +941,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
}
int
-rte_pmd_i40e_get_vf_stats(uint8_t port,
+rte_pmd_i40e_get_vf_stats(uint16_t port,
uint16_t vf_id,
struct rte_eth_stats *stats)
{
@@ -986,7 +986,7 @@ rte_pmd_i40e_get_vf_stats(uint8_t port,
}
int
-rte_pmd_i40e_reset_vf_stats(uint8_t port,
+rte_pmd_i40e_reset_vf_stats(uint16_t port,
uint16_t vf_id)
{
struct rte_eth_dev *dev;
@@ -1020,7 +1020,7 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,
}
int
-rte_pmd_i40e_set_vf_max_bw(uint8_t port, uint16_t vf_id, uint32_t bw)
+rte_pmd_i40e_set_vf_max_bw(uint16_t port, uint16_t vf_id, uint32_t bw)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -1109,7 +1109,7 @@ rte_pmd_i40e_set_vf_max_bw(uint8_t port, uint16_t vf_id, uint32_t bw)
}
int
-rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port, uint16_t vf_id,
+rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port, uint16_t vf_id,
uint8_t tc_num, uint8_t *bw_weight)
{
struct rte_eth_dev *dev;
@@ -1223,7 +1223,7 @@ rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port, uint16_t vf_id,
}
int
-rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port, uint16_t vf_id,
+rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port, uint16_t vf_id,
uint8_t tc_no, uint32_t bw)
{
struct rte_eth_dev *dev;
@@ -1341,7 +1341,7 @@ rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port, uint16_t vf_id,
}
int
-rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)
+rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
{
struct rte_eth_dev *dev;
struct i40e_pf *pf;
@@ -1513,7 +1513,7 @@ i40e_add_rm_profile_info(struct i40e_hw *hw, uint8_t *profile_info_sec)
/* Check if the profile info exists */
static int
-i40e_check_profile_info(uint8_t port, uint8_t *profile_info_sec)
+i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec)
{
struct rte_eth_dev *dev = &rte_eth_devices[port];
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1557,7 +1557,7 @@ i40e_check_profile_info(uint8_t port, uint8_t *profile_info_sec)
}
int
-rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
+rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
uint32_t size,
enum rte_pmd_i40e_package_op op)
{
@@ -1863,7 +1863,7 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
}
int
-rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size)
+rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size)
{
struct rte_eth_dev *dev;
struct i40e_hw *hw;
@@ -1991,7 +1991,7 @@ static int check_invalid_ptype_mapping(
int
rte_pmd_i40e_ptype_mapping_update(
- uint8_t port,
+ uint16_t port,
struct rte_pmd_i40e_ptype_mapping *mapping_items,
uint16_t count,
uint8_t exclusive)
@@ -2027,7 +2027,7 @@ rte_pmd_i40e_ptype_mapping_update(
return 0;
}
-int rte_pmd_i40e_ptype_mapping_reset(uint8_t port)
+int rte_pmd_i40e_ptype_mapping_reset(uint16_t port)
{
struct rte_eth_dev *dev;
@@ -2044,7 +2044,7 @@ int rte_pmd_i40e_ptype_mapping_reset(uint8_t port)
}
int rte_pmd_i40e_ptype_mapping_get(
- uint8_t port,
+ uint16_t port,
struct rte_pmd_i40e_ptype_mapping *mapping_items,
uint16_t size,
uint16_t *count,
@@ -2078,7 +2078,7 @@ int rte_pmd_i40e_ptype_mapping_get(
return 0;
}
-int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
+int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
uint32_t target,
uint8_t mask,
uint32_t pkt_type)
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 356fa89d7..7f32a59b1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -157,7 +157,7 @@ struct rte_pmd_i40e_ptype_mapping {
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* invalid.
*/
-int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
+int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf);
/**
* Enable/Disable VF MAC anti spoofing.
@@ -174,7 +174,7 @@ int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
+int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port,
uint16_t vf_id,
uint8_t on);
@@ -193,7 +193,7 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
+int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port,
uint16_t vf_id,
uint8_t on);
@@ -210,7 +210,7 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_tx_loopback(uint8_t port,
+int rte_pmd_i40e_set_tx_loopback(uint16_t port,
uint8_t on);
/**
@@ -228,7 +228,7 @@ int rte_pmd_i40e_set_tx_loopback(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
+int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port,
uint16_t vf_id,
uint8_t on);
@@ -247,7 +247,7 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
+int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port,
uint16_t vf_id,
uint8_t on);
@@ -271,7 +271,7 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
-int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
struct ether_addr *mac_addr);
/**
@@ -291,7 +291,7 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable/Disable vf vlan insert
@@ -309,7 +309,7 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id,
uint16_t vlan_id);
/**
@@ -328,7 +328,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
uint8_t on);
/**
@@ -347,7 +347,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
+int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on);
/**
* Enable/Disable VF VLAN filter
@@ -368,7 +368,7 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id,
uint64_t vf_mask, uint8_t on);
/**
@@ -393,7 +393,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_get_vf_stats(uint8_t port,
+int rte_pmd_i40e_get_vf_stats(uint16_t port,
uint16_t vf_id,
struct rte_eth_stats *stats);
@@ -409,7 +409,7 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_reset_vf_stats(uint8_t port,
+int rte_pmd_i40e_reset_vf_stats(uint16_t port,
uint16_t vf_id);
/**
@@ -434,7 +434,7 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
+int rte_pmd_i40e_set_vf_max_bw(uint16_t port,
uint16_t vf_id,
uint32_t bw);
@@ -459,7 +459,7 @@ int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
+int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port,
uint16_t vf_id,
uint8_t tc_num,
uint8_t *bw_weight);
@@ -484,7 +484,7 @@ int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,
+int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port,
uint16_t vf_id,
uint8_t tc_no,
uint32_t bw);
@@ -502,7 +502,7 @@ int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map);
+int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map);
/**
* Load/Unload a ddp package
@@ -523,7 +523,7 @@ int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map);
* - (-EACCES) if profile does not exist.
* - (-ENOTSUP) if operation not supported.
*/
-int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
+int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
uint32_t size,
enum rte_pmd_i40e_package_op op);
@@ -561,7 +561,7 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
+int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size);
/**
* Update hardware defined ptype to software defined packet type
@@ -581,7 +581,7 @@ int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
* set other PTYPEs maps to PTYPE_UNKNOWN.
*/
int rte_pmd_i40e_ptype_mapping_update(
- uint8_t port,
+ uint16_t port,
struct rte_pmd_i40e_ptype_mapping *mapping_items,
uint16_t count,
uint8_t exclusive);
@@ -593,7 +593,7 @@ int rte_pmd_i40e_ptype_mapping_update(
* @param port
* pointer to port identifier of the device
*/
-int rte_pmd_i40e_ptype_mapping_reset(uint8_t port);
+int rte_pmd_i40e_ptype_mapping_reset(uint16_t port);
/**
* Get hardware defined ptype to software defined ptype
@@ -612,7 +612,7 @@ int rte_pmd_i40e_ptype_mapping_reset(uint8_t port);
* -(!0) only return mapping items which packet_type != RTE_PTYPE_UNKNOWN.
*/
int rte_pmd_i40e_ptype_mapping_get(
- uint8_t port,
+ uint16_t port,
struct rte_pmd_i40e_ptype_mapping *mapping_items,
uint16_t size,
uint16_t *count,
@@ -632,7 +632,7 @@ int rte_pmd_i40e_ptype_mapping_get(
* @param pkt_type
* the new packet type to overwrite
*/
-int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
+int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
uint32_t target,
uint8_t mask,
uint32_t pkt_type);
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 5e57cb353..18ad4feca 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_ixgbe_version.map
-LIBABIVER := 1
+LIBABIVER := 2
ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
#
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 9ca5cbcd3..d873c409f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2508,8 +2508,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
* - fixed speed: TODO implement
*/
if (dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
- PMD_INIT_LOG(ERR, "Invalid link_speeds for port %hhu; fix speed not supported",
- dev->data->port_id);
+ PMD_INIT_LOG(ERR,
+ "Invalid link_speeds for port %u, fix speed not supported",
+ dev->data->port_id);
return -EINVAL;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 85feb0bdc..81c527fad 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -148,7 +148,7 @@ struct ixgbe_rx_queue {
uint16_t queue_id; /**< RX queue index. */
uint16_t reg_idx; /**< RX queue register index. */
uint16_t pkt_type_mask; /**< Packet type mask for different NICs. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t crc_len; /**< 0 if CRC stripped, 4 otherwise. */
uint8_t drop_en; /**< If not 0, set SRRCTL.Drop_En. */
uint8_t rx_deferred_start; /**< not in global dev start. */
@@ -237,7 +237,7 @@ struct ixgbe_tx_queue {
uint16_t tx_next_rs; /**< next desc to set RS bit */
uint16_t queue_id; /**< TX queue index. */
uint16_t reg_idx; /**< TX queue register index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint8_t pthresh; /**< Prefetch threshold register. */
uint8_t hthresh; /**< Host threshold register. */
uint8_t wthresh; /**< Write-back threshold reg. */
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 79897ff64..f12737857 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -38,7 +38,7 @@
#include "rte_pmd_ixgbe.h"
int
-rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
+rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
struct ether_addr *mac_addr)
{
struct ixgbe_hw *hw;
@@ -73,7 +73,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
}
int
-rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf)
+rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf)
{
struct ixgbe_hw *hw;
struct ixgbe_vf_info *vfinfo;
@@ -105,7 +105,7 @@ rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf)
}
int
-rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
{
struct ixgbe_hw *hw;
struct ixgbe_mac_info *mac;
@@ -135,7 +135,7 @@ rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
{
struct ixgbe_hw *hw;
struct ixgbe_mac_info *mac;
@@ -164,7 +164,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
+rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf, uint16_t vlan_id)
{
struct ixgbe_hw *hw;
uint32_t ctrl;
@@ -200,7 +200,7 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
}
int
-rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on)
+rte_pmd_ixgbe_set_tx_loopback(uint16_t port, uint8_t on)
{
struct ixgbe_hw *hw;
uint32_t ctrl;
@@ -230,7 +230,7 @@ rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on)
}
int
-rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on)
+rte_pmd_ixgbe_set_all_queues_drop_en(uint16_t port, uint8_t on)
{
struct ixgbe_hw *hw;
uint32_t reg_value;
@@ -260,7 +260,7 @@ rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on)
{
struct ixgbe_hw *hw;
uint32_t reg_value;
@@ -295,7 +295,7 @@ rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
struct rte_pci_device *pci_dev;
@@ -342,7 +342,7 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf,
+rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf,
uint16_t rx_mask, uint8_t on)
{
int val = 0;
@@ -389,7 +389,7 @@ rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf,
}
int
-rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
struct rte_pci_device *pci_dev;
@@ -439,7 +439,7 @@ rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
struct rte_pci_device *pci_dev;
@@ -489,7 +489,7 @@ rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
}
int
-rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
+rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
uint64_t vf_mask, uint8_t vlan_on)
{
struct rte_eth_dev *dev;
@@ -524,7 +524,7 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
}
int
-rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
+rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
uint16_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *dev;
@@ -540,7 +540,7 @@ rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
}
int
-rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp)
+rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp)
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
@@ -623,7 +623,7 @@ rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp)
}
int
-rte_pmd_ixgbe_macsec_disable(uint8_t port)
+rte_pmd_ixgbe_macsec_disable(uint16_t port)
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
@@ -687,7 +687,7 @@ rte_pmd_ixgbe_macsec_disable(uint8_t port)
}
int
-rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac)
+rte_pmd_ixgbe_macsec_config_txsc(uint16_t port, uint8_t *mac)
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
@@ -712,7 +712,7 @@ rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac)
}
int
-rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi)
+rte_pmd_ixgbe_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi)
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
@@ -738,7 +738,7 @@ rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi)
}
int
-rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
+rte_pmd_ixgbe_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
uint32_t pn, uint8_t *key)
{
struct ixgbe_hw *hw;
@@ -794,7 +794,7 @@ rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
}
int
-rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
+rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
uint32_t pn, uint8_t *key)
{
struct ixgbe_hw *hw;
@@ -837,7 +837,7 @@ rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
}
int
-rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
+rte_pmd_ixgbe_set_tc_bw_alloc(uint16_t port,
uint8_t tc_num,
uint8_t *bw_weight)
{
@@ -911,7 +911,7 @@ rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
#ifdef RTE_LIBRTE_IXGBE_BYPASS
int
-rte_pmd_ixgbe_bypass_init(uint8_t port_id)
+rte_pmd_ixgbe_bypass_init(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -926,7 +926,7 @@ rte_pmd_ixgbe_bypass_init(uint8_t port_id)
}
int
-rte_pmd_ixgbe_bypass_state_show(uint8_t port_id, uint32_t *state)
+rte_pmd_ixgbe_bypass_state_show(uint16_t port_id, uint32_t *state)
{
struct rte_eth_dev *dev;
@@ -940,7 +940,7 @@ rte_pmd_ixgbe_bypass_state_show(uint8_t port_id, uint32_t *state)
}
int
-rte_pmd_ixgbe_bypass_state_set(uint8_t port_id, uint32_t *new_state)
+rte_pmd_ixgbe_bypass_state_set(uint16_t port_id, uint32_t *new_state)
{
struct rte_eth_dev *dev;
@@ -954,7 +954,7 @@ rte_pmd_ixgbe_bypass_state_set(uint8_t port_id, uint32_t *new_state)
}
int
-rte_pmd_ixgbe_bypass_event_show(uint8_t port_id,
+rte_pmd_ixgbe_bypass_event_show(uint16_t port_id,
uint32_t event,
uint32_t *state)
{
@@ -970,7 +970,7 @@ rte_pmd_ixgbe_bypass_event_show(uint8_t port_id,
}
int
-rte_pmd_ixgbe_bypass_event_store(uint8_t port_id,
+rte_pmd_ixgbe_bypass_event_store(uint16_t port_id,
uint32_t event,
uint32_t state)
{
@@ -986,7 +986,7 @@ rte_pmd_ixgbe_bypass_event_store(uint8_t port_id,
}
int
-rte_pmd_ixgbe_bypass_wd_timeout_store(uint8_t port_id, uint32_t timeout)
+rte_pmd_ixgbe_bypass_wd_timeout_store(uint16_t port_id, uint32_t timeout)
{
struct rte_eth_dev *dev;
@@ -1000,7 +1000,7 @@ rte_pmd_ixgbe_bypass_wd_timeout_store(uint8_t port_id, uint32_t timeout)
}
int
-rte_pmd_ixgbe_bypass_ver_show(uint8_t port_id, uint32_t *ver)
+rte_pmd_ixgbe_bypass_ver_show(uint16_t port_id, uint32_t *ver)
{
struct rte_eth_dev *dev;
@@ -1014,7 +1014,7 @@ rte_pmd_ixgbe_bypass_ver_show(uint8_t port_id, uint32_t *ver)
}
int
-rte_pmd_ixgbe_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout)
+rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port_id, uint32_t *wd_timeout)
{
struct rte_eth_dev *dev;
@@ -1028,7 +1028,7 @@ rte_pmd_ixgbe_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout)
}
int
-rte_pmd_ixgbe_bypass_wd_reset(uint8_t port_id)
+rte_pmd_ixgbe_bypass_wd_reset(uint16_t port_id)
{
struct rte_eth_dev *dev;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index d33c285db..81b18f876 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -53,7 +53,7 @@
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* invalid.
*/
-int rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf);
+int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf);
/**
* Set the VF MAC address.
@@ -69,7 +69,7 @@ int rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if *vf* or *mac_addr* is invalid.
*/
-int rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
+int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
struct ether_addr *mac_addr);
/**
@@ -87,7 +87,8 @@ int rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf,
+ uint8_t on);
/**
* Enable/Disable VF MAC anti spoofing.
@@ -104,7 +105,7 @@ int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable/Disable vf vlan insert
@@ -122,7 +123,7 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+int rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf,
uint16_t vlan_id);
/**
@@ -139,7 +140,7 @@ int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on);
+int rte_pmd_ixgbe_set_tx_loopback(uint16_t port, uint8_t on);
/**
* set all queues drop enable bit
@@ -155,7 +156,7 @@ int rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on);
+int rte_pmd_ixgbe_set_all_queues_drop_en(uint16_t port, uint8_t on);
/**
* set drop enable bit in the VF split rx control register
@@ -174,7 +175,7 @@ int rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on);
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable/Disable vf vlan strip for all queues in a pool
@@ -194,7 +195,7 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable MACsec offload.
@@ -212,7 +213,7 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
* - (-ENODEV) if *port* invalid.
* - (-ENOTSUP) if hardware doesn't support this feature.
*/
-int rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp);
+int rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp);
/**
* Disable MACsec offload.
@@ -224,7 +225,7 @@ int rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp);
* - (-ENODEV) if *port* invalid.
* - (-ENOTSUP) if hardware doesn't support this feature.
*/
-int rte_pmd_ixgbe_macsec_disable(uint8_t port);
+int rte_pmd_ixgbe_macsec_disable(uint16_t port);
/**
* Configure Tx SC (Secure Connection).
@@ -238,7 +239,7 @@ int rte_pmd_ixgbe_macsec_disable(uint8_t port);
* - (-ENODEV) if *port* invalid.
* - (-ENOTSUP) if hardware doesn't support this feature.
*/
-int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac);
+int rte_pmd_ixgbe_macsec_config_txsc(uint16_t port, uint8_t *mac);
/**
* Configure Rx SC (Secure Connection).
@@ -254,7 +255,7 @@ int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac);
* - (-ENODEV) if *port* invalid.
* - (-ENOTSUP) if hardware doesn't support this feature.
*/
-int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi);
+int rte_pmd_ixgbe_macsec_config_rxsc(uint16_t port, uint8_t *mac, uint16_t pi);
/**
* Enable Tx SA (Secure Association).
@@ -275,7 +276,7 @@ int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi);
* - (-ENOTSUP) if hardware doesn't support this feature.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
+int rte_pmd_ixgbe_macsec_select_txsa(uint16_t port, uint8_t idx, uint8_t an,
uint32_t pn, uint8_t *key);
/**
@@ -297,7 +298,7 @@ int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
* - (-ENOTSUP) if hardware doesn't support this feature.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
+int rte_pmd_ixgbe_macsec_select_rxsa(uint16_t port, uint8_t idx, uint8_t an,
uint32_t pn, uint8_t *key);
/**
@@ -323,7 +324,8 @@ int rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on);
+rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf, uint16_t rx_mask,
+ uint8_t on);
/**
* Enable or disable a VF traffic receive of an Ethernet device.
@@ -342,7 +344,7 @@ rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on);
+rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable or disable a VF traffic transmit of the Ethernet device.
@@ -361,7 +363,7 @@ rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on);
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on);
+rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on);
/**
* Enable/Disable hardware VF VLAN filtering by an Ethernet device of
@@ -383,7 +385,8 @@ rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on);
* - (-EINVAL) if bad parameter.
*/
int
-rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on);
+rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
+ uint64_t vf_mask, uint8_t vlan_on);
/**
* Set the rate limitation for a vf on an Ethernet device.
@@ -402,7 +405,8 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk);
+int rte_pmd_ixgbe_set_vf_rate_limit(uint16_t port, uint16_t vf,
+ uint16_t tx_rate, uint64_t q_msk);
/**
* Set all the TCs' bandwidth weight.
@@ -423,7 +427,7 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate,
* - (-EINVAL) if bad parameter.
* - (-ENOTSUP) not supported by firmware.
*/
-int rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
+int rte_pmd_ixgbe_set_tc_bw_alloc(uint16_t port,
uint8_t tc_num,
uint8_t *bw_weight);
@@ -439,7 +443,7 @@ int rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_init(uint8_t port);
+int rte_pmd_ixgbe_bypass_init(uint16_t port);
/**
* Return bypass state.
@@ -456,7 +460,7 @@ int rte_pmd_ixgbe_bypass_init(uint8_t port);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_state_show(uint8_t port, uint32_t *state);
+int rte_pmd_ixgbe_bypass_state_show(uint16_t port, uint32_t *state);
/**
* Set bypass state
@@ -473,7 +477,7 @@ int rte_pmd_ixgbe_bypass_state_show(uint8_t port, uint32_t *state);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_state_set(uint8_t port, uint32_t *new_state);
+int rte_pmd_ixgbe_bypass_state_set(uint16_t port, uint32_t *new_state);
/**
* Return bypass state when given event occurs.
@@ -497,7 +501,7 @@ int rte_pmd_ixgbe_bypass_state_set(uint8_t port, uint32_t *new_state);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_event_show(uint8_t port,
+int rte_pmd_ixgbe_bypass_event_show(uint16_t port,
uint32_t event,
uint32_t *state);
@@ -523,7 +527,7 @@ int rte_pmd_ixgbe_bypass_event_show(uint8_t port,
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_event_store(uint8_t port,
+int rte_pmd_ixgbe_bypass_event_store(uint16_t port,
uint32_t event,
uint32_t state);
@@ -547,7 +551,7 @@ int rte_pmd_ixgbe_bypass_event_store(uint8_t port,
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_wd_timeout_store(uint8_t port, uint32_t timeout);
+int rte_pmd_ixgbe_bypass_wd_timeout_store(uint16_t port, uint32_t timeout);
/**
* Get bypass firmware version.
@@ -561,7 +565,7 @@ int rte_pmd_ixgbe_bypass_wd_timeout_store(uint8_t port, uint32_t timeout);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_ver_show(uint8_t port, uint32_t *ver);
+int rte_pmd_ixgbe_bypass_ver_show(uint16_t port, uint32_t *ver);
/**
* Return bypass watchdog timeout in seconds
@@ -583,7 +587,7 @@ int rte_pmd_ixgbe_bypass_ver_show(uint8_t port, uint32_t *ver);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
+int rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port, uint32_t *wd_timeout);
/**
* Reset bypass watchdog timer
@@ -595,7 +599,7 @@ int rte_pmd_ixgbe_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_bypass_wd_reset(uint8_t port);
+int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port);
/**
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 7de1d1086..238a64f43 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -112,14 +112,14 @@ struct rxq {
unsigned int sges_n:2; /* Log 2 of SGEs (max buffers per packet). */
unsigned int cqe_n:4; /* Log 2 of CQ elements. */
unsigned int elts_n:4; /* Log 2 of Mbufs. */
- unsigned int port_id:8;
unsigned int rss_hash:1; /* RSS hash result is enabled. */
unsigned int mark:1; /* Marked flow available on the queue. */
unsigned int pending_err:1; /* CQE error needs to be handled. */
unsigned int trim_elts:1; /* Whether elts needs clean-up. */
- unsigned int :6; /* Remaining bits. */
+ unsigned int :14; /* Remaining bits. */
volatile uint32_t *rq_db;
volatile uint32_t *cq_db;
+ uint16_t port_id;
uint16_t rq_ci;
uint16_t rq_pi;
uint16_t cq_ci;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 92b03c4cb..f1b968fc2 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1240,12 +1240,12 @@ nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
nfp_net_dev_atomic_read_link_status(dev, &link);
if (link.link_status)
RTE_LOG(INFO, PMD, "Port %d: Link Up - speed %u Mbps - %s\n",
- (int)(dev->data->port_id), (unsigned)link.link_speed,
+ dev->data->port_id, link.link_speed,
link.link_duplex == ETH_LINK_FULL_DUPLEX
? "full-duplex" : "half-duplex");
else
RTE_LOG(INFO, PMD, " Port %d: Link Down\n",
- (int)(dev->data->port_id));
+ dev->data->port_id);
RTE_LOG(INFO, PMD, "PCI Address: %04d:%02d:%02d:%d\n",
pci_dev->addr.domain, pci_dev->addr.bus,
@@ -1549,7 +1549,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
"tx_free_thresh must be less than the number of TX "
"descriptors. (tx_free_thresh=%u port=%d "
"queue=%d)\n", (unsigned int)tx_free_thresh,
- (int)dev->data->port_id, (int)queue_idx);
+ dev->data->port_id, (int)queue_idx);
return -(EINVAL);
}
@@ -1847,9 +1847,9 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
*/
new_mb = rte_pktmbuf_alloc(rxq->mem_pool);
if (unlikely(new_mb == NULL)) {
- RTE_LOG_DP(DEBUG, PMD, "RX mbuf alloc failed port_id=%u "
- "queue_id=%u\n", (unsigned)rxq->port_id,
- (unsigned)rxq->qidx);
+ RTE_LOG_DP(DEBUG, PMD,
+ "RX mbuf alloc failed port_id=%u queue_id=%u\n",
+ rxq->port_id, (unsigned int)rxq->qidx);
nfp_net_mbuf_alloc_failed(rxq);
break;
}
@@ -1933,7 +1933,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
return nb_hold;
PMD_RX_LOG(DEBUG, "RX port_id=%u queue_id=%u, %d packets received\n",
- (unsigned)rxq->port_id, (unsigned)rxq->qidx, nb_hold);
+ rxq->port_id, (unsigned int)rxq->qidx, nb_hold);
nb_hold += rxq->nb_rx_hold;
@@ -1944,7 +1944,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rte_wmb();
if (nb_hold > rxq->rx_free_thresh) {
PMD_RX_LOG(DEBUG, "port=%u queue=%u nb_hold=%u avail=%u\n",
- (unsigned)rxq->port_id, (unsigned)rxq->qidx,
+ rxq->port_id, (unsigned int)rxq->qidx,
(unsigned)nb_hold, (unsigned)avail);
nfp_qcp_ptr_add(rxq->qcp_fl, NFP_QCP_WRITE_PTR, nb_hold);
nb_hold = 0;
diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h
index eec56bc1c..828d0d35b 100644
--- a/drivers/net/nfp/nfp_net_pmd.h
+++ b/drivers/net/nfp/nfp_net_pmd.h
@@ -250,7 +250,7 @@ struct nfp_net_txq {
uint32_t tx_hthresh; /* not used by now. Future? */
uint32_t tx_wthresh; /* not used by now. Future? */
uint32_t txq_flags; /* not used by now. Future? */
- uint8_t port_id;
+ uint16_t port_id;
int qidx;
int tx_qcidx;
__le64 dma;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 5aef0591e..fa9313dec 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -68,7 +68,7 @@ struct null_queue {
struct pmd_internals {
unsigned packet_size;
unsigned packet_copy;
- uint8_t port_id;
+ uint16_t port_id;
struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index defb3b419..b51f16cbd 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -75,7 +75,7 @@ struct queue_stat {
struct pcap_rx_queue {
pcap_t *pcap;
- uint8_t in_port;
+ uint16_t in_port;
struct rte_mempool *mb_pool;
struct queue_stat rx_stat;
char name[PATH_MAX];
diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h
index 9864bb448..96f0d351d 100644
--- a/drivers/net/qede/qede_if.h
+++ b/drivers/net/qede/qede_if.h
@@ -97,7 +97,7 @@ struct qed_link_output {
uint32_t speed; /* In Mb/s */
uint32_t adv_speed; /* Speed mask */
uint8_t duplex; /* In DUPLEX defs */
- uint8_t port; /* In PORT defs */
+ uint16_t port; /* In PORT defs */
bool autoneg;
uint32_t pause_config;
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 464d3d384..e3fa7b0e2 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -394,7 +394,7 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
};
char args_str[32] = { 0 };
char ring_name[32] = { 0 };
- uint8_t port_id = RTE_MAX_ETHPORTS;
+ uint16_t port_id = RTE_MAX_ETHPORTS;
int ret;
/* do some parameter checking */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 9c0d57cc1..d141acf0e 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -71,7 +71,7 @@
struct szedata2_rx_queue {
struct szedata *sze;
uint8_t rx_channel;
- uint8_t in_port;
+ uint16_t in_port;
struct rte_mempool *mb_pool;
volatile uint64_t rx_pkts;
volatile uint64_t rx_bytes;
diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h
index 4ee6c3bb0..e54a96f8e 100644
--- a/drivers/net/thunderx/nicvf_struct.h
+++ b/drivers/net/thunderx/nicvf_struct.h
@@ -100,7 +100,7 @@ struct nicvf_rxq {
uint16_t queue_id;
uint16_t precharge_cnt;
uint8_t rx_drop_en;
- uint8_t port_id;
+ uint16_t port_id;
uint8_t rbptr_offset;
} __rte_cache_aligned;
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 3ba8ad64f..258a917c7 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -43,7 +43,7 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_vhost_version.map
-LIBABIVER := 1
+LIBABIVER := 2
#
# all source are stored in SRCS-y
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 0dac5e60e..04179b4db 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -105,7 +105,7 @@ struct vhost_queue {
rte_atomic32_t while_queuing;
struct pmd_internal *internal;
struct rte_mempool *mb_pool;
- uint8_t port;
+ uint16_t port;
uint16_t virtqueue_id;
struct vhost_stats stats;
};
@@ -705,7 +705,7 @@ static struct vhost_device_ops vhost_ops = {
};
int
-rte_eth_vhost_get_queue_event(uint8_t port_id,
+rte_eth_vhost_get_queue_event(uint16_t port_id,
struct rte_eth_vhost_queue_event *event)
{
struct rte_vhost_vring_state *state;
@@ -742,7 +742,7 @@ rte_eth_vhost_get_queue_event(uint8_t port_id,
}
int
-rte_eth_vhost_get_vid_from_port_id(uint8_t port_id)
+rte_eth_vhost_get_vid_from_port_id(uint16_t port_id)
{
struct internal_list *list;
struct rte_eth_dev *eth_dev;
diff --git a/drivers/net/vhost/rte_eth_vhost.h b/drivers/net/vhost/rte_eth_vhost.h
index 39ca77197..948f3c810 100644
--- a/drivers/net/vhost/rte_eth_vhost.h
+++ b/drivers/net/vhost/rte_eth_vhost.h
@@ -69,7 +69,7 @@ struct rte_eth_vhost_queue_event {
* - On success, zero.
* - On failure, a negative value.
*/
-int rte_eth_vhost_get_queue_event(uint8_t port_id,
+int rte_eth_vhost_get_queue_event(uint16_t port_id,
struct rte_eth_vhost_queue_event *event);
/**
@@ -79,7 +79,7 @@ int rte_eth_vhost_get_queue_event(uint8_t port_id,
* - On success, the 'vid' associated with 'port_id'.
* - On failure, a negative value.
*/
-int rte_eth_vhost_get_vid_from_port_id(uint8_t port_id);
+int rte_eth_vhost_get_vid_from_port_id(uint16_t port_id);
#ifdef __cplusplus
}
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 18caebdd7..330ee94be 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -260,7 +260,7 @@ struct virtio_hw {
uint8_t use_msix;
uint8_t modern;
uint8_t use_simple_rxtx;
- uint8_t port_id;
+ uint16_t port_id;
uint8_t mac_addr[ETHER_ADDR_LEN];
uint32_t notify_off_multiplier;
uint8_t *isr;
diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h
index 28f82d6a8..198b2d8fb 100644
--- a/drivers/net/virtio/virtio_rxtx.h
+++ b/drivers/net/virtio/virtio_rxtx.h
@@ -54,7 +54,7 @@ struct virtnet_rx {
struct rte_mempool *mpool; /**< mempool for mbuf allocation */
uint16_t queue_id; /**< DPDK queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
/* Statistics */
struct virtnet_stats stats;
@@ -69,7 +69,7 @@ struct virtnet_tx {
phys_addr_t virtio_net_hdr_mem; /**< hdr for each xmit packet */
uint16_t queue_id; /**< DPDK queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
/* Statistics */
struct virtnet_stats stats;
@@ -82,7 +82,7 @@ struct virtnet_ctl {
/**< memzone to populate hdr. */
const struct rte_memzone *virtio_net_hdr_mz;
phys_addr_t virtio_net_hdr_mem; /**< hdr for each xmit packet */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
const struct rte_memzone *mz; /**< mem zone to populate RX ring. */
};
diff --git a/drivers/net/vmxnet3/vmxnet3_ring.h b/drivers/net/vmxnet3/vmxnet3_ring.h
index d2e8323ba..a6fa93ac7 100644
--- a/drivers/net/vmxnet3/vmxnet3_ring.h
+++ b/drivers/net/vmxnet3/vmxnet3_ring.h
@@ -144,7 +144,7 @@ typedef struct vmxnet3_tx_queue {
const struct rte_memzone *mz;
bool stopped;
uint16_t queue_id; /**< Device TX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
uint16_t txdata_desc_size;
} vmxnet3_tx_queue_t;
@@ -179,7 +179,7 @@ typedef struct vmxnet3_rx_queue {
const struct rte_memzone *mz;
bool stopped;
uint16_t queue_id; /**< Device RX queue index. */
- uint8_t port_id; /**< Device port identifier. */
+ uint16_t port_id; /**< Device port identifier. */
} vmxnet3_rx_queue_t;
#endif /* _VMXNET3_RING_H_ */
diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
index 58a20ea09..a079cced7 100644
--- a/lib/librte_bitratestats/Makefile
+++ b/lib/librte_bitratestats/Makefile
@@ -38,7 +38,7 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_bitratestats_version.map
-LIBABIVER := 1
+LIBABIVER := 2
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) := rte_bitrate.c
diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index 3ceb35166..f373697a7 100644
--- a/lib/librte_bitratestats/rte_bitrate.c
+++ b/lib/librte_bitratestats/rte_bitrate.c
@@ -84,7 +84,7 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
int
rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
- uint8_t port_id)
+ uint16_t port_id)
{
struct rte_stats_bitrate *port_data;
struct rte_eth_stats eth_stats;
diff --git a/lib/librte_bitratestats/rte_bitrate.h b/lib/librte_bitratestats/rte_bitrate.h
index 15fc270a3..16467221b 100644
--- a/lib/librte_bitratestats/rte_bitrate.h
+++ b/lib/librte_bitratestats/rte_bitrate.h
@@ -85,7 +85,7 @@ int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data);
* - Negative value on error
*/
int rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
- uint8_t port_id);
+ uint16_t port_id);
#ifdef __cplusplus
}
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 201cb96fc..edcddf70d 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_ethdev_version.map
-LIBABIVER := 7
+LIBABIVER := 8
SRCS-y += rte_ethdev.c
SRCS-y += rte_flow.c
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1849a3bdd..0779c0d08 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -139,8 +139,8 @@ enum {
STAT_QMAP_RX
};
-uint8_t
-rte_eth_find_next(uint8_t port_id)
+uint16_t
+rte_eth_find_next(uint16_t port_id)
{
while (port_id < RTE_MAX_ETHPORTS &&
rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED)
@@ -188,7 +188,7 @@ rte_eth_dev_allocated(const char *name)
return NULL;
}
-static uint8_t
+static uint16_t
rte_eth_dev_find_free_port(void)
{
unsigned i;
@@ -201,7 +201,7 @@ rte_eth_dev_find_free_port(void)
}
static struct rte_eth_dev *
-eth_dev_get(uint8_t port_id)
+eth_dev_get(uint16_t port_id)
{
struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id];
@@ -217,7 +217,7 @@ eth_dev_get(uint8_t port_id)
struct rte_eth_dev *
rte_eth_dev_allocate(const char *name)
{
- uint8_t port_id;
+ uint16_t port_id;
struct rte_eth_dev *eth_dev;
port_id = rte_eth_dev_find_free_port();
@@ -252,7 +252,7 @@ rte_eth_dev_allocate(const char *name)
struct rte_eth_dev *
rte_eth_dev_attach_secondary(const char *name)
{
- uint8_t i;
+ uint16_t i;
struct rte_eth_dev *eth_dev;
if (rte_eth_dev_data == NULL)
@@ -286,7 +286,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
}
int
-rte_eth_dev_is_valid_port(uint8_t port_id)
+rte_eth_dev_is_valid_port(uint16_t port_id)
{
if (port_id >= RTE_MAX_ETHPORTS ||
(rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED &&
@@ -297,17 +297,17 @@ rte_eth_dev_is_valid_port(uint8_t port_id)
}
int
-rte_eth_dev_socket_id(uint8_t port_id)
+rte_eth_dev_socket_id(uint16_t port_id)
{
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
return rte_eth_devices[port_id].data->numa_node;
}
-uint8_t
+uint16_t
rte_eth_dev_count(void)
{
- uint8_t p;
- uint8_t count;
+ uint16_t p;
+ uint16_t count;
count = 0;
@@ -318,7 +318,7 @@ rte_eth_dev_count(void)
}
int
-rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
+rte_eth_dev_get_name_by_port(uint16_t port_id, char *name)
{
const char *tmp;
@@ -337,7 +337,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
}
int
-rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
+rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
{
int ret;
int i;
@@ -362,7 +362,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_is_detachable(uint8_t port_id)
+rte_eth_dev_is_detachable(uint16_t port_id)
{
uint32_t dev_flags;
@@ -378,7 +378,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
/* attach the new device, then store port_id of the device */
int
-rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
+rte_eth_dev_attach(const char *devargs, uint16_t *port_id)
{
int ret = -1;
int current = rte_eth_dev_count();
@@ -424,7 +424,7 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
/* detach the device, then store the name of the device */
int
-rte_eth_dev_detach(uint8_t port_id, char *name)
+rte_eth_dev_detach(uint16_t port_id, char *name)
{
int ret = -1;
@@ -502,7 +502,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
}
int
-rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
+rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
{
struct rte_eth_dev *dev;
@@ -528,7 +528,7 @@ rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
}
int
-rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
+rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
{
struct rte_eth_dev *dev;
@@ -554,7 +554,7 @@ rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
}
int
-rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
+rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
{
struct rte_eth_dev *dev;
@@ -580,7 +580,7 @@ rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
}
int
-rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id)
+rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
{
struct rte_eth_dev *dev;
@@ -689,7 +689,7 @@ rte_eth_speed_bitflag(uint32_t speed, int duplex)
}
int
-rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
+rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
const struct rte_eth_conf *dev_conf)
{
struct rte_eth_dev *dev;
@@ -850,7 +850,7 @@ _rte_eth_dev_reset(struct rte_eth_dev *dev)
}
static void
-rte_eth_dev_config_restore(uint8_t port_id)
+rte_eth_dev_config_restore(uint16_t port_id)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
@@ -905,7 +905,7 @@ rte_eth_dev_config_restore(uint8_t port_id)
}
int
-rte_eth_dev_start(uint8_t port_id)
+rte_eth_dev_start(uint16_t port_id)
{
struct rte_eth_dev *dev;
int diag;
@@ -917,7 +917,7 @@ rte_eth_dev_start(uint8_t port_id)
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
if (dev->data->dev_started != 0) {
- RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+ RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu16
" already started\n",
port_id);
return 0;
@@ -939,7 +939,7 @@ rte_eth_dev_start(uint8_t port_id)
}
void
-rte_eth_dev_stop(uint8_t port_id)
+rte_eth_dev_stop(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -949,7 +949,7 @@ rte_eth_dev_stop(uint8_t port_id)
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
if (dev->data->dev_started == 0) {
- RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+ RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu16
" already stopped\n",
port_id);
return;
@@ -960,7 +960,7 @@ rte_eth_dev_stop(uint8_t port_id)
}
int
-rte_eth_dev_set_link_up(uint8_t port_id)
+rte_eth_dev_set_link_up(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -973,7 +973,7 @@ rte_eth_dev_set_link_up(uint8_t port_id)
}
int
-rte_eth_dev_set_link_down(uint8_t port_id)
+rte_eth_dev_set_link_down(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -986,7 +986,7 @@ rte_eth_dev_set_link_down(uint8_t port_id)
}
void
-rte_eth_dev_close(uint8_t port_id)
+rte_eth_dev_close(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1006,7 +1006,7 @@ rte_eth_dev_close(uint8_t port_id)
}
int
-rte_eth_dev_reset(uint8_t port_id)
+rte_eth_dev_reset(uint16_t port_id)
{
struct rte_eth_dev *dev;
int ret;
@@ -1023,7 +1023,7 @@ rte_eth_dev_reset(uint8_t port_id)
}
int
-rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
+rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
uint16_t nb_rx_desc, unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp)
@@ -1114,7 +1114,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
}
int
-rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
+rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf)
{
@@ -1218,7 +1218,7 @@ rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)
}
int
-rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id, uint32_t free_cnt)
+rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -1232,7 +1232,7 @@ rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id, uint32_t free_cnt)
}
void
-rte_eth_promiscuous_enable(uint8_t port_id)
+rte_eth_promiscuous_enable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1245,7 +1245,7 @@ rte_eth_promiscuous_enable(uint8_t port_id)
}
void
-rte_eth_promiscuous_disable(uint8_t port_id)
+rte_eth_promiscuous_disable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1258,7 +1258,7 @@ rte_eth_promiscuous_disable(uint8_t port_id)
}
int
-rte_eth_promiscuous_get(uint8_t port_id)
+rte_eth_promiscuous_get(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1269,7 +1269,7 @@ rte_eth_promiscuous_get(uint8_t port_id)
}
void
-rte_eth_allmulticast_enable(uint8_t port_id)
+rte_eth_allmulticast_enable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1282,7 +1282,7 @@ rte_eth_allmulticast_enable(uint8_t port_id)
}
void
-rte_eth_allmulticast_disable(uint8_t port_id)
+rte_eth_allmulticast_disable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1295,7 +1295,7 @@ rte_eth_allmulticast_disable(uint8_t port_id)
}
int
-rte_eth_allmulticast_get(uint8_t port_id)
+rte_eth_allmulticast_get(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1320,7 +1320,7 @@ rte_eth_dev_atomic_read_link_status(struct rte_eth_dev *dev,
}
void
-rte_eth_link_get(uint8_t port_id, struct rte_eth_link *eth_link)
+rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
{
struct rte_eth_dev *dev;
@@ -1337,7 +1337,7 @@ rte_eth_link_get(uint8_t port_id, struct rte_eth_link *eth_link)
}
void
-rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
+rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link)
{
struct rte_eth_dev *dev;
@@ -1354,7 +1354,7 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
}
int
-rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
+rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
{
struct rte_eth_dev *dev;
@@ -1370,7 +1370,7 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
}
void
-rte_eth_stats_reset(uint8_t port_id)
+rte_eth_stats_reset(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1383,7 +1383,7 @@ rte_eth_stats_reset(uint8_t port_id)
}
static int
-get_xstats_count(uint8_t port_id)
+get_xstats_count(uint16_t port_id)
{
struct rte_eth_dev *dev;
int count;
@@ -1412,7 +1412,7 @@ get_xstats_count(uint8_t port_id)
}
int
-rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
+rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
uint64_t *id)
{
int cnt_xstats, idx_xstat;
@@ -1456,7 +1456,7 @@ rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
}
int
-rte_eth_xstats_get_names_by_id(uint8_t port_id,
+rte_eth_xstats_get_names_by_id(uint16_t port_id,
struct rte_eth_xstat_name *xstats_names, unsigned int size,
uint64_t *ids)
{
@@ -1573,7 +1573,7 @@ rte_eth_xstats_get_names_by_id(uint8_t port_id,
}
int
-rte_eth_xstats_get_names(uint8_t port_id,
+rte_eth_xstats_get_names(uint16_t port_id,
struct rte_eth_xstat_name *xstats_names,
unsigned int size)
{
@@ -1639,8 +1639,8 @@ rte_eth_xstats_get_names(uint8_t port_id,
/* retrieve ethdev extended statistics */
int
-rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids, uint64_t *values,
- unsigned int n)
+rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids,
+ uint64_t *values, unsigned int n)
{
/* If need all xstats */
if (!ids) {
@@ -1765,7 +1765,7 @@ rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids, uint64_t *values,
}
int
-rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
+rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
unsigned int n)
{
struct rte_eth_stats eth_stats;
@@ -1847,7 +1847,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
/* reset ethdev extended statistics */
void
-rte_eth_xstats_reset(uint8_t port_id)
+rte_eth_xstats_reset(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -1865,7 +1865,7 @@ rte_eth_xstats_reset(uint8_t port_id)
}
static int
-set_queue_stats_mapping(uint8_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
uint8_t is_rx)
{
struct rte_eth_dev *dev;
@@ -1881,7 +1881,7 @@ set_queue_stats_mapping(uint8_t port_id, uint16_t queue_id, uint8_t stat_idx,
int
-rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id, uint16_t tx_queue_id,
+rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
uint8_t stat_idx)
{
return set_queue_stats_mapping(port_id, tx_queue_id, stat_idx,
@@ -1890,7 +1890,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id, uint16_t tx_queue_id,
int
-rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
+rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
uint8_t stat_idx)
{
return set_queue_stats_mapping(port_id, rx_queue_id, stat_idx,
@@ -1898,7 +1898,7 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
}
int
-rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
{
struct rte_eth_dev *dev;
@@ -1910,7 +1910,7 @@ rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
}
void
-rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
+rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
{
struct rte_eth_dev *dev;
const struct rte_eth_desc_lim lim = {
@@ -1934,7 +1934,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
}
int
-rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
+rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
uint32_t *ptypes, int num)
{
int i, j;
@@ -1960,7 +1960,7 @@ rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
}
void
-rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
+rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr)
{
struct rte_eth_dev *dev;
@@ -1971,7 +1971,7 @@ rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
int
-rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
+rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu)
{
struct rte_eth_dev *dev;
@@ -1983,7 +1983,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
}
int
-rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
+rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
{
int ret;
struct rte_eth_dev *dev;
@@ -2000,7 +2000,7 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
}
int
-rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
+rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
{
struct rte_eth_dev *dev;
int ret;
@@ -2039,7 +2039,8 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
}
int
-rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int on)
+rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
+ int on)
{
struct rte_eth_dev *dev;
@@ -2057,7 +2058,7 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o
}
int
-rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
+rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
enum rte_vlan_type vlan_type,
uint16_t tpid)
{
@@ -2071,7 +2072,7 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
}
int
-rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
+rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
{
struct rte_eth_dev *dev;
int ret = 0;
@@ -2114,7 +2115,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
}
int
-rte_eth_dev_get_vlan_offload(uint8_t port_id)
+rte_eth_dev_get_vlan_offload(uint16_t port_id)
{
struct rte_eth_dev *dev;
int ret = 0;
@@ -2135,7 +2136,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
}
int
-rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
+rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
{
struct rte_eth_dev *dev;
@@ -2148,7 +2149,7 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
}
int
-rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
+rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
{
struct rte_eth_dev *dev;
@@ -2160,7 +2161,7 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
}
int
-rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
+rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
{
struct rte_eth_dev *dev;
@@ -2176,7 +2177,8 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
}
int
-rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc_conf)
+rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
+ struct rte_eth_pfc_conf *pfc_conf)
{
struct rte_eth_dev *dev;
@@ -2242,7 +2244,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
}
int
-rte_eth_dev_rss_reta_update(uint8_t port_id,
+rte_eth_dev_rss_reta_update(uint16_t port_id,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size)
{
@@ -2268,7 +2270,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
}
int
-rte_eth_dev_rss_reta_query(uint8_t port_id,
+rte_eth_dev_rss_reta_query(uint16_t port_id,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size)
{
@@ -2288,7 +2290,8 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
}
int
-rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
+rte_eth_dev_rss_hash_update(uint16_t port_id,
+ struct rte_eth_rss_conf *rss_conf)
{
struct rte_eth_dev *dev;
uint16_t rss_hash_protos;
@@ -2307,7 +2310,7 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
}
int
-rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
+rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
struct rte_eth_rss_conf *rss_conf)
{
struct rte_eth_dev *dev;
@@ -2319,7 +2322,7 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
}
int
-rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
+rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
struct rte_eth_udp_tunnel *udp_tunnel)
{
struct rte_eth_dev *dev;
@@ -2341,7 +2344,7 @@ rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
}
int
-rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
+rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
struct rte_eth_udp_tunnel *udp_tunnel)
{
struct rte_eth_dev *dev;
@@ -2364,7 +2367,7 @@ rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
}
int
-rte_eth_led_on(uint8_t port_id)
+rte_eth_led_on(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -2375,7 +2378,7 @@ rte_eth_led_on(uint8_t port_id)
}
int
-rte_eth_led_off(uint8_t port_id)
+rte_eth_led_off(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -2390,7 +2393,7 @@ rte_eth_led_off(uint8_t port_id)
* an empty spot.
*/
static int
-get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr)
+get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -2409,7 +2412,7 @@ get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr)
static const struct ether_addr null_mac_addr;
int
-rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
+rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr,
uint32_t pool)
{
struct rte_eth_dev *dev;
@@ -2462,7 +2465,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
}
int
-rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
+rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr)
{
struct rte_eth_dev *dev;
int index;
@@ -2491,7 +2494,7 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
}
int
-rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
+rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr)
{
struct rte_eth_dev *dev;
@@ -2517,7 +2520,7 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
* an empty spot.
*/
static int
-get_hash_mac_addr_index(uint8_t port_id, const struct ether_addr *addr)
+get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -2536,7 +2539,7 @@ get_hash_mac_addr_index(uint8_t port_id, const struct ether_addr *addr)
}
int
-rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
+rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr,
uint8_t on)
{
int index;
@@ -2588,7 +2591,7 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
}
int
-rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)
+rte_eth_dev_uc_all_hash_table_set(uint16_t port_id, uint8_t on)
{
struct rte_eth_dev *dev;
@@ -2600,7 +2603,7 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)
return (*dev->dev_ops->uc_all_hash_table_set)(dev, on);
}
-int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
+int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
uint16_t tx_rate)
{
struct rte_eth_dev *dev;
@@ -2631,7 +2634,7 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
}
int
-rte_eth_mirror_rule_set(uint8_t port_id,
+rte_eth_mirror_rule_set(uint16_t port_id,
struct rte_eth_mirror_conf *mirror_conf,
uint8_t rule_id, uint8_t on)
{
@@ -2669,7 +2672,7 @@ rte_eth_mirror_rule_set(uint8_t port_id,
}
int
-rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
+rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id)
{
struct rte_eth_dev *dev;
@@ -2682,7 +2685,7 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
}
int
-rte_eth_dev_callback_register(uint8_t port_id,
+rte_eth_dev_callback_register(uint16_t port_id,
enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb_fn, void *cb_arg)
{
@@ -2722,7 +2725,7 @@ rte_eth_dev_callback_register(uint8_t port_id,
}
int
-rte_eth_dev_callback_unregister(uint8_t port_id,
+rte_eth_dev_callback_unregister(uint16_t port_id,
enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb_fn, void *cb_arg)
{
@@ -2794,7 +2797,7 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
}
int
-rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
+rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data)
{
uint32_t vec;
struct rte_eth_dev *dev;
@@ -2855,7 +2858,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
}
int
-rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
+rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id,
int epfd, int op, void *data)
{
uint32_t vec;
@@ -2895,7 +2898,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_dev_rx_intr_enable(uint8_t port_id,
+rte_eth_dev_rx_intr_enable(uint16_t port_id,
uint16_t queue_id)
{
struct rte_eth_dev *dev;
@@ -2909,7 +2912,7 @@ rte_eth_dev_rx_intr_enable(uint8_t port_id,
}
int
-rte_eth_dev_rx_intr_disable(uint8_t port_id,
+rte_eth_dev_rx_intr_disable(uint16_t port_id,
uint16_t queue_id)
{
struct rte_eth_dev *dev;
@@ -2924,7 +2927,8 @@ rte_eth_dev_rx_intr_disable(uint8_t port_id,
int
-rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
+rte_eth_dev_filter_supported(uint16_t port_id,
+ enum rte_filter_type filter_type)
{
struct rte_eth_dev *dev;
@@ -2937,7 +2941,7 @@ rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
}
int
-rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
+rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
enum rte_filter_op filter_op, void *arg)
{
struct rte_eth_dev *dev;
@@ -2950,7 +2954,7 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
}
void *
-rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
+rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
@@ -2992,7 +2996,7 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
}
void *
-rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
+rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
@@ -3027,7 +3031,7 @@ rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
}
void *
-rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
+rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
rte_tx_callback_fn fn, void *user_param)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
@@ -3070,7 +3074,7 @@ rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
+rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxtx_callback *user_cb)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
@@ -3104,7 +3108,7 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
+rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxtx_callback *user_cb)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
@@ -3138,7 +3142,7 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo)
{
struct rte_eth_dev *dev;
@@ -3162,7 +3166,7 @@ rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
struct rte_eth_txq_info *qinfo)
{
struct rte_eth_dev *dev;
@@ -3186,7 +3190,7 @@ rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
}
int
-rte_eth_dev_set_mc_addr_list(uint8_t port_id,
+rte_eth_dev_set_mc_addr_list(uint16_t port_id,
struct ether_addr *mc_addr_set,
uint32_t nb_mc_addr)
{
@@ -3200,7 +3204,7 @@ rte_eth_dev_set_mc_addr_list(uint8_t port_id,
}
int
-rte_eth_timesync_enable(uint8_t port_id)
+rte_eth_timesync_enable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -3212,7 +3216,7 @@ rte_eth_timesync_enable(uint8_t port_id)
}
int
-rte_eth_timesync_disable(uint8_t port_id)
+rte_eth_timesync_disable(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -3224,7 +3228,7 @@ rte_eth_timesync_disable(uint8_t port_id)
}
int
-rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
+rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,
uint32_t flags)
{
struct rte_eth_dev *dev;
@@ -3237,7 +3241,8 @@ rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
}
int
-rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
+rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
+ struct timespec *timestamp)
{
struct rte_eth_dev *dev;
@@ -3249,7 +3254,7 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
}
int
-rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta)
+rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
{
struct rte_eth_dev *dev;
@@ -3261,7 +3266,7 @@ rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta)
}
int
-rte_eth_timesync_read_time(uint8_t port_id, struct timespec *timestamp)
+rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)
{
struct rte_eth_dev *dev;
@@ -3273,7 +3278,7 @@ rte_eth_timesync_read_time(uint8_t port_id, struct timespec *timestamp)
}
int
-rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *timestamp)
+rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
{
struct rte_eth_dev *dev;
@@ -3285,7 +3290,7 @@ rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *timestamp)
}
int
-rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
+rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
{
struct rte_eth_dev *dev;
@@ -3297,7 +3302,7 @@ rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
}
int
-rte_eth_dev_get_eeprom_length(uint8_t port_id)
+rte_eth_dev_get_eeprom_length(uint16_t port_id)
{
struct rte_eth_dev *dev;
@@ -3309,7 +3314,7 @@ rte_eth_dev_get_eeprom_length(uint8_t port_id)
}
int
-rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
+rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
{
struct rte_eth_dev *dev;
@@ -3321,7 +3326,7 @@ rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
}
int
-rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
+rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
{
struct rte_eth_dev *dev;
@@ -3333,7 +3338,7 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
}
int
-rte_eth_dev_get_dcb_info(uint8_t port_id,
+rte_eth_dev_get_dcb_info(uint16_t port_id,
struct rte_eth_dcb_info *dcb_info)
{
struct rte_eth_dev *dev;
@@ -3348,7 +3353,7 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
}
int
-rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
+rte_eth_dev_l2_tunnel_eth_type_conf(uint16_t port_id,
struct rte_eth_l2_tunnel_conf *l2_tunnel)
{
struct rte_eth_dev *dev;
@@ -3371,7 +3376,7 @@ rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
}
int
-rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
+rte_eth_dev_l2_tunnel_offload_set(uint16_t port_id,
struct rte_eth_l2_tunnel_conf *l2_tunnel,
uint32_t mask,
uint8_t en)
@@ -3415,7 +3420,7 @@ rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
}
int
-rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id,
uint16_t *nb_rx_desc,
uint16_t *nb_tx_desc)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 99cdd54d4..34f729ab8 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1572,7 +1572,7 @@ struct eth_dev_ops {
* @return
* The number of packets returned to the user.
*/
-typedef uint16_t (*rte_rx_callback_fn)(uint8_t port, uint16_t queue,
+typedef uint16_t (*rte_rx_callback_fn)(uint16_t port, uint16_t queue,
struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
void *user_param);
@@ -1596,7 +1596,7 @@ typedef uint16_t (*rte_rx_callback_fn)(uint8_t port, uint16_t queue,
* @return
* The number of packets to be written to the NIC.
*/
-typedef uint16_t (*rte_tx_callback_fn)(uint8_t port, uint16_t queue,
+typedef uint16_t (*rte_tx_callback_fn)(uint16_t port, uint16_t queue,
struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
/**
@@ -1699,7 +1699,7 @@ struct rte_eth_dev_data {
/** bitmap array of associating Ethernet MAC addresses to pools */
struct ether_addr* hash_mac_addrs;
/** Device Ethernet MAC addresses of hash filtering. */
- uint8_t port_id; /**< Device [external] port identifier. */
+ uint16_t port_id; /**< Device [external] port identifier. */
__extension__
uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
@@ -1741,7 +1741,7 @@ extern struct rte_eth_dev rte_eth_devices[];
* @return
* Next valid port id, RTE_MAX_ETHPORTS if there is none.
*/
-uint8_t rte_eth_find_next(uint8_t port_id);
+uint16_t rte_eth_find_next(uint16_t port_id);
/**
* Macro to iterate over all enabled ethdev ports.
@@ -1764,7 +1764,7 @@ uint8_t rte_eth_find_next(uint8_t port_id);
* @return
* - The total number of usable Ethernet devices.
*/
-uint8_t rte_eth_dev_count(void);
+uint16_t rte_eth_dev_count(void);
/**
* @internal
@@ -1825,7 +1825,7 @@ int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
* @return
* 0 on success and port_id is filled, negative on error
*/
-int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
+int rte_eth_dev_attach(const char *devargs, uint16_t *port_id);
/**
* Detach a Ethernet device specified by port identifier.
@@ -1840,7 +1840,7 @@ int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
* @return
* 0 on success and devname is filled, negative on error
*/
-int rte_eth_dev_detach(uint8_t port_id, char *devname);
+int rte_eth_dev_detach(uint16_t port_id, char *devname);
/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
@@ -1884,7 +1884,7 @@ uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
* - 0: Success, device configured.
* - <0: Error code returned by the driver configuration function.
*/
-int rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_queue,
+int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,
uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf);
/**
@@ -1939,7 +1939,7 @@ void _rte_eth_dev_reset(struct rte_eth_dev *dev);
* allocate network memory buffers from the memory pool when
* initializing receive descriptors.
*/
-int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
+int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
uint16_t nb_rx_desc, unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
@@ -1987,7 +1987,7 @@ int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
* - 0: Success, the transmit queue is correctly set up.
* - -ENOMEM: Unable to allocate the transmit ring descriptors.
*/
-int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
+int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
@@ -2001,7 +2001,7 @@ int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
* a default of zero if the socket could not be determined.
* -1 is returned is the port_id value is out of range.
*/
-int rte_eth_dev_socket_id(uint8_t port_id);
+int rte_eth_dev_socket_id(uint16_t port_id);
/**
* Check if port_id of device is attached
@@ -2012,7 +2012,7 @@ int rte_eth_dev_socket_id(uint8_t port_id);
* - 0 if port is out of range or not attached
* - 1 if device is attached
*/
-int rte_eth_dev_is_valid_port(uint8_t port_id);
+int rte_eth_dev_is_valid_port(uint16_t port_id);
/**
* Start specified RX queue of a port. It is used when rx_deferred_start
@@ -2029,7 +2029,7 @@ int rte_eth_dev_is_valid_port(uint8_t port_id);
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
-int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
+int rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id);
/**
* Stop specified RX queue of a port
@@ -2045,7 +2045,7 @@ int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
-int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
+int rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id);
/**
* Start TX for specified queue of a port. It is used when tx_deferred_start
@@ -2062,7 +2062,7 @@ int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
-int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
+int rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id);
/**
* Stop specified TX queue of a port
@@ -2078,7 +2078,7 @@ int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
* - -EINVAL: The port_id or the queue_id out of range.
* - -ENOTSUP: The function not supported in PMD driver.
*/
-int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
+int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id);
@@ -2097,7 +2097,7 @@ int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
* - 0: Success, Ethernet device started.
* - <0: Error code of the driver device start function.
*/
-int rte_eth_dev_start(uint8_t port_id);
+int rte_eth_dev_start(uint16_t port_id);
/**
* Stop an Ethernet device. The device can be restarted with a call to
@@ -2106,7 +2106,7 @@ int rte_eth_dev_start(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_dev_stop(uint8_t port_id);
+void rte_eth_dev_stop(uint16_t port_id);
/**
@@ -2121,7 +2121,7 @@ void rte_eth_dev_stop(uint8_t port_id);
* - 0: Success, Ethernet device linked up.
* - <0: Error code of the driver device link up function.
*/
-int rte_eth_dev_set_link_up(uint8_t port_id);
+int rte_eth_dev_set_link_up(uint16_t port_id);
/**
* Link down an Ethernet device.
@@ -2132,7 +2132,7 @@ int rte_eth_dev_set_link_up(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-int rte_eth_dev_set_link_down(uint8_t port_id);
+int rte_eth_dev_set_link_down(uint16_t port_id);
/**
* Close a stopped Ethernet device. The device cannot be restarted!
@@ -2142,7 +2142,7 @@ int rte_eth_dev_set_link_down(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_dev_close(uint8_t port_id);
+void rte_eth_dev_close(uint16_t port_id);
/**
* Reset a Ethernet device and keep its port id.
@@ -2172,7 +2172,7 @@ void rte_eth_dev_close(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-int rte_eth_dev_reset(uint8_t port_id);
+int rte_eth_dev_reset(uint16_t port_id);
/**
* Enable receipt in promiscuous mode for an Ethernet device.
@@ -2180,7 +2180,7 @@ int rte_eth_dev_reset(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_promiscuous_enable(uint8_t port_id);
+void rte_eth_promiscuous_enable(uint16_t port_id);
/**
* Disable receipt in promiscuous mode for an Ethernet device.
@@ -2188,7 +2188,7 @@ void rte_eth_promiscuous_enable(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_promiscuous_disable(uint8_t port_id);
+void rte_eth_promiscuous_disable(uint16_t port_id);
/**
* Return the value of promiscuous mode for an Ethernet device.
@@ -2200,7 +2200,7 @@ void rte_eth_promiscuous_disable(uint8_t port_id);
* - (0) if promiscuous is disabled.
* - (-1) on error
*/
-int rte_eth_promiscuous_get(uint8_t port_id);
+int rte_eth_promiscuous_get(uint16_t port_id);
/**
* Enable the receipt of any multicast frame by an Ethernet device.
@@ -2208,7 +2208,7 @@ int rte_eth_promiscuous_get(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_allmulticast_enable(uint8_t port_id);
+void rte_eth_allmulticast_enable(uint16_t port_id);
/**
* Disable the receipt of all multicast frames by an Ethernet device.
@@ -2216,7 +2216,7 @@ void rte_eth_allmulticast_enable(uint8_t port_id);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_allmulticast_disable(uint8_t port_id);
+void rte_eth_allmulticast_disable(uint16_t port_id);
/**
* Return the value of allmulticast mode for an Ethernet device.
@@ -2228,7 +2228,7 @@ void rte_eth_allmulticast_disable(uint8_t port_id);
* - (0) if allmulticast is disabled.
* - (-1) on error
*/
-int rte_eth_allmulticast_get(uint8_t port_id);
+int rte_eth_allmulticast_get(uint16_t port_id);
/**
* Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
@@ -2241,7 +2241,7 @@ int rte_eth_allmulticast_get(uint8_t port_id);
* A pointer to an *rte_eth_link* structure to be filled with
* the status, the speed and the mode of the Ethernet device link.
*/
-void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
+void rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link);
/**
* Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX
@@ -2254,7 +2254,7 @@ void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
* A pointer to an *rte_eth_link* structure to be filled with
* the status, the speed and the mode of the Ethernet device link.
*/
-void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);
+void rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link);
/**
* Retrieve the general I/O statistics of an Ethernet device.
@@ -2273,7 +2273,7 @@ void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);
* @return
* Zero if successful. Non-zero otherwise.
*/
-int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
+int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats);
/**
* Reset the general I/O statistics of an Ethernet device.
@@ -2281,7 +2281,7 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_stats_reset(uint8_t port_id);
+void rte_eth_stats_reset(uint16_t port_id);
/**
* Retrieve names of extended statistics of an Ethernet device.
@@ -2303,7 +2303,7 @@ void rte_eth_stats_reset(uint8_t port_id);
* shall not be used by the caller.
* - A negative value on error (invalid port id).
*/
-int rte_eth_xstats_get_names(uint8_t port_id,
+int rte_eth_xstats_get_names(uint16_t port_id,
struct rte_eth_xstat_name *xstats_names,
unsigned int size);
@@ -2329,7 +2329,7 @@ int rte_eth_xstats_get_names(uint8_t port_id,
* shall not be used by the caller.
* - A negative value on error (invalid port id).
*/
-int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
+int rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
unsigned int n);
/**
@@ -2355,7 +2355,7 @@ int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
* - A negative value on error (invalid port id).
*/
int
-rte_eth_xstats_get_names_by_id(uint8_t port_id,
+rte_eth_xstats_get_names_by_id(uint16_t port_id,
struct rte_eth_xstat_name *xstats_names, unsigned int size,
uint64_t *ids);
@@ -2382,7 +2382,7 @@ rte_eth_xstats_get_names_by_id(uint8_t port_id,
* shall not be used by the caller.
* - A negative value on error (invalid port id).
*/
-int rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids,
+int rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids,
uint64_t *values, unsigned int n);
/**
@@ -2402,7 +2402,7 @@ int rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids,
* -ENODEV for invalid port_id,
* -EINVAL if the xstat_name doesn't exist in port_id
*/
-int rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
+int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
uint64_t *id);
/**
@@ -2411,7 +2411,7 @@ int rte_eth_xstats_get_id_by_name(uint8_t port_id, const char *xstat_name,
* @param port_id
* The port identifier of the Ethernet device.
*/
-void rte_eth_xstats_reset(uint8_t port_id);
+void rte_eth_xstats_reset(uint16_t port_id);
/**
* Set a mapping for the specified transmit queue to the specified per-queue
@@ -2430,7 +2430,7 @@ void rte_eth_xstats_reset(uint8_t port_id);
* @return
* Zero if successful. Non-zero otherwise.
*/
-int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id,
+int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
uint16_t tx_queue_id, uint8_t stat_idx);
/**
@@ -2450,7 +2450,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id,
* @return
* Zero if successful. Non-zero otherwise.
*/
-int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id,
+int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,
uint8_t stat_idx);
@@ -2463,7 +2463,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id,
* A pointer to a structure of type *ether_addr* to be filled with
* the Ethernet address of the Ethernet device.
*/
-void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
+void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr);
/**
* Retrieve the contextual information of an Ethernet device.
@@ -2474,7 +2474,7 @@ void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
* A pointer to a structure of type *rte_eth_dev_info* to be filled with
* the contextual information of the Ethernet device.
*/
-void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
+void rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info);
/**
* Retrieve the firmware version of a device.
@@ -2494,7 +2494,7 @@ void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
* - (>0) if *fw_size* is not enough to store firmware version, return
* the size of the non truncated string.
*/
-int rte_eth_dev_fw_version_get(uint8_t port_id,
+int rte_eth_dev_fw_version_get(uint16_t port_id,
char *fw_version, size_t fw_size);
/**
@@ -2535,7 +2535,7 @@ int rte_eth_dev_fw_version_get(uint8_t port_id,
* count of supported ptypes will be returned.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
+int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
uint32_t *ptypes, int num);
/**
@@ -2549,7 +2549,7 @@ int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
* - (0) if successful.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
+int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu);
/**
* Change the MTU of an Ethernet device.
@@ -2565,7 +2565,7 @@ int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
* - (-EINVAL) if *mtu* invalid.
* - (-EBUSY) if operation is not allowed when the port is running
*/
-int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);
+int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu);
/**
* Enable/Disable hardware filtering by an Ethernet device of received
@@ -2585,7 +2585,7 @@ int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);
* - (-ENOSYS) if VLAN filtering on *port_id* disabled.
* - (-EINVAL) if *vlan_id* > 4095.
*/
-int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
+int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on);
/**
* Enable/Disable hardware VLAN Strip by a rx queue of an Ethernet device.
@@ -2606,7 +2606,7 @@ int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if *rx_queue_id* invalid.
*/
-int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id,
+int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
int on);
/**
@@ -2625,7 +2625,7 @@ int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id,
* - (-ENOSUP) if hardware-assisted VLAN TPID setup is not supported.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
+int rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
enum rte_vlan_type vlan_type,
uint16_t tag_type);
@@ -2649,7 +2649,7 @@ int rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
* - (-ENOSUP) if hardware-assisted VLAN filtering not configured.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);
+int rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask);
/**
* Read VLAN Offload configuration from an Ethernet device
@@ -2663,7 +2663,7 @@ int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);
* ETH_VLAN_EXTEND_OFFLOAD
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_get_vlan_offload(uint8_t port_id);
+int rte_eth_dev_get_vlan_offload(uint16_t port_id);
/**
* Set port based TX VLAN insertion on or off.
@@ -2679,7 +2679,7 @@ int rte_eth_dev_get_vlan_offload(uint8_t port_id);
* - (0) if successful.
* - negative if failed.
*/
-int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on);
+int rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on);
/**
*
@@ -2764,7 +2764,7 @@ int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on);
* *rx_pkts* array.
*/
static inline uint16_t
-rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
+rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -2809,7 +2809,7 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
* (-ENOTSUP) if the device does not support this function
*/
static inline int
-rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
+rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
{
struct rte_eth_dev *dev;
@@ -2838,7 +2838,7 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
* - (-ENOTSUP) if the device does not support this function
*/
static inline int
-rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
+rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
@@ -2885,7 +2885,7 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
* - (-ENODEV) bad port or queue (only if compiled with debug).
*/
static inline int
-rte_eth_rx_descriptor_status(uint8_t port_id, uint16_t queue_id,
+rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
uint16_t offset)
{
struct rte_eth_dev *dev;
@@ -2942,7 +2942,7 @@ rte_eth_rx_descriptor_status(uint8_t port_id, uint16_t queue_id,
* - (-ENOTSUP) if the device does not support this function.
* - (-ENODEV) bad port or queue (only if compiled with debug).
*/
-static inline int rte_eth_tx_descriptor_status(uint8_t port_id,
+static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
uint16_t queue_id, uint16_t offset)
{
struct rte_eth_dev *dev;
@@ -3026,7 +3026,7 @@ static inline int rte_eth_tx_descriptor_status(uint8_t port_id,
* *tx_pkts* parameter when the transmit ring is full or has been filled up.
*/
static inline uint16_t
-rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
+rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -3115,7 +3115,7 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
#ifndef RTE_ETHDEV_TX_PREPARE_NOOP
static inline uint16_t
-rte_eth_tx_prepare(uint8_t port_id, uint16_t queue_id,
+rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
struct rte_eth_dev *dev;
@@ -3157,7 +3157,8 @@ rte_eth_tx_prepare(uint8_t port_id, uint16_t queue_id,
*/
static inline uint16_t
-rte_eth_tx_prepare(__rte_unused uint8_t port_id, __rte_unused uint16_t queue_id,
+rte_eth_tx_prepare(__rte_unused uint16_t port_id,
+ __rte_unused uint16_t queue_id,
__rte_unused struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
return nb_pkts;
@@ -3226,7 +3227,7 @@ rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
* callback is called for any packets which could not be sent.
*/
static inline uint16_t
-rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
+rte_eth_tx_buffer_flush(uint16_t port_id, uint16_t queue_id,
struct rte_eth_dev_tx_buffer *buffer)
{
uint16_t sent;
@@ -3278,7 +3279,7 @@ rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
* the rest.
*/
static __rte_always_inline uint16_t
-rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,
+rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_id,
struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
{
buffer->pkts[buffer->length++] = tx_pkt;
@@ -3394,7 +3395,7 @@ rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
* are in use.
*/
int
-rte_eth_tx_done_cleanup(uint8_t port_id, uint16_t queue_id, uint32_t free_cnt);
+rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt);
/**
* The eth device event type for interrupt, and maybe others in the future.
@@ -3412,7 +3413,7 @@ enum rte_eth_event_type {
RTE_ETH_EVENT_MAX /**< max value of this enum */
};
-typedef int (*rte_eth_dev_cb_fn)(uint8_t port_id,
+typedef int (*rte_eth_dev_cb_fn)(uint16_t port_id,
enum rte_eth_event_type event, void *cb_arg, void *ret_param);
/**< user application callback to be registered for interrupts */
@@ -3434,7 +3435,7 @@ typedef int (*rte_eth_dev_cb_fn)(uint8_t port_id,
* - On success, zero.
* - On failure, a negative value.
*/
-int rte_eth_dev_callback_register(uint8_t port_id,
+int rte_eth_dev_callback_register(uint16_t port_id,
enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb_fn, void *cb_arg);
@@ -3455,7 +3456,7 @@ int rte_eth_dev_callback_register(uint8_t port_id,
* - On success, zero.
* - On failure, a negative value.
*/
-int rte_eth_dev_callback_unregister(uint8_t port_id,
+int rte_eth_dev_callback_unregister(uint16_t port_id,
enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb_fn, void *cb_arg);
@@ -3501,7 +3502,7 @@ int _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
* that operation.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
+int rte_eth_dev_rx_intr_enable(uint16_t port_id, uint16_t queue_id);
/**
* When lcore wakes up from rx interrupt indicating packet coming, disable rx
@@ -3522,7 +3523,7 @@ int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
* that operation.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
+int rte_eth_dev_rx_intr_disable(uint16_t port_id, uint16_t queue_id);
/**
* RX Interrupt control per port.
@@ -3541,7 +3542,7 @@ int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
* - On success, zero.
* - On failure, a negative value.
*/
-int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
+int rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data);
/**
* RX Interrupt control per queue.
@@ -3564,7 +3565,7 @@ int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
* - On success, zero.
* - On failure, a negative value.
*/
-int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
+int rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id,
int epfd, int op, void *data);
/**
@@ -3579,7 +3580,7 @@ int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
* that operation.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_led_on(uint8_t port_id);
+int rte_eth_led_on(uint16_t port_id);
/**
* Turn off the LED on the Ethernet device.
@@ -3593,7 +3594,7 @@ int rte_eth_led_on(uint8_t port_id);
* that operation.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_led_off(uint8_t port_id);
+int rte_eth_led_off(uint16_t port_id);
/**
* Get current status of the Ethernet link flow control for Ethernet device
@@ -3607,7 +3608,7 @@ int rte_eth_led_off(uint8_t port_id);
* - (-ENOTSUP) if hardware doesn't support flow control.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_flow_ctrl_get(uint8_t port_id,
+int rte_eth_dev_flow_ctrl_get(uint16_t port_id,
struct rte_eth_fc_conf *fc_conf);
/**
@@ -3624,7 +3625,7 @@ int rte_eth_dev_flow_ctrl_get(uint8_t port_id,
* - (-EINVAL) if bad parameter
* - (-EIO) if flow control setup failure
*/
-int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
+int rte_eth_dev_flow_ctrl_set(uint16_t port_id,
struct rte_eth_fc_conf *fc_conf);
/**
@@ -3642,7 +3643,7 @@ int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
* - (-EINVAL) if bad parameter
* - (-EIO) if flow control setup failure
*/
-int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id,
+int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
struct rte_eth_pfc_conf *pfc_conf);
/**
@@ -3663,7 +3664,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id,
* - (-ENOSPC) if no more MAC addresses can be added.
* - (-EINVAL) if MAC address is invalid.
*/
-int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
+int rte_eth_dev_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
uint32_t pool);
/**
@@ -3679,7 +3680,7 @@ int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
* - (-ENODEV) if *port* invalid.
* - (-EADDRINUSE) if attempting to remove the default MAC address
*/
-int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
+int rte_eth_dev_mac_addr_remove(uint16_t port, struct ether_addr *mac_addr);
/**
* Set the default MAC address.
@@ -3694,8 +3695,8 @@ int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if MAC address is invalid.
*/
-int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
-
+int rte_eth_dev_default_mac_addr_set(uint16_t port,
+ struct ether_addr *mac_addr);
/**
* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
@@ -3712,7 +3713,7 @@ int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_dev_rss_reta_update(uint8_t port,
+int rte_eth_dev_rss_reta_update(uint16_t port,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size);
@@ -3731,7 +3732,7 @@ int rte_eth_dev_rss_reta_update(uint8_t port,
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_dev_rss_reta_query(uint8_t port,
+int rte_eth_dev_rss_reta_query(uint16_t port,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size);
@@ -3753,8 +3754,8 @@ int rte_eth_dev_rss_reta_query(uint8_t port,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,
- uint8_t on);
+int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr,
+ uint8_t on);
/**
* Updates all unicast hash bitmaps for receiving packet with any Unicast
@@ -3773,7 +3774,7 @@ int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on);
+int rte_eth_dev_uc_all_hash_table_set(uint16_t port, uint8_t on);
/**
* Set a traffic mirroring rule on an Ethernet device
@@ -3796,7 +3797,7 @@ int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on);
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if the mr_conf information is not correct.
*/
-int rte_eth_mirror_rule_set(uint8_t port_id,
+int rte_eth_mirror_rule_set(uint16_t port_id,
struct rte_eth_mirror_conf *mirror_conf,
uint8_t rule_id,
uint8_t on);
@@ -3814,7 +3815,7 @@ int rte_eth_mirror_rule_set(uint8_t port_id,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_mirror_rule_reset(uint8_t port_id,
+int rte_eth_mirror_rule_reset(uint16_t port_id,
uint8_t rule_id);
/**
@@ -3832,7 +3833,7 @@ int rte_eth_mirror_rule_reset(uint8_t port_id,
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
+int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
uint16_t tx_rate);
/**
@@ -3848,7 +3849,7 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
*/
-int rte_eth_dev_rss_hash_update(uint8_t port_id,
+int rte_eth_dev_rss_hash_update(uint16_t port_id,
struct rte_eth_rss_conf *rss_conf);
/**
@@ -3865,7 +3866,7 @@ int rte_eth_dev_rss_hash_update(uint8_t port_id,
* - (-ENOTSUP) if hardware doesn't support RSS.
*/
int
-rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
+rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
struct rte_eth_rss_conf *rss_conf);
/**
@@ -3886,7 +3887,7 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
* - (-ENOTSUP) if hardware doesn't support tunnel type.
*/
int
-rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
+rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
struct rte_eth_udp_tunnel *tunnel_udp);
/**
@@ -3908,7 +3909,7 @@ rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
* - (-ENOTSUP) if hardware doesn't support tunnel type.
*/
int
-rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
+rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
struct rte_eth_udp_tunnel *tunnel_udp);
/**
@@ -3924,7 +3925,8 @@ rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
* - (-ENOTSUP) if hardware doesn't support this filter type.
* - (-ENODEV) if *port_id* invalid.
*/
-int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type);
+int rte_eth_dev_filter_supported(uint16_t port_id,
+ enum rte_filter_type filter_type);
/**
* Take operations to assigned filter type on an Ethernet device.
@@ -3944,7 +3946,7 @@ int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_ty
* - (-ENODEV) if *port_id* invalid.
* - others depends on the specific operations implementation.
*/
-int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
+int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
enum rte_filter_op filter_op, void *arg);
/**
@@ -3959,7 +3961,7 @@ int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
* - (-ENODEV) if port identifier is invalid.
* - (-ENOTSUP) if hardware doesn't support.
*/
-int rte_eth_dev_get_dcb_info(uint8_t port_id,
+int rte_eth_dev_get_dcb_info(uint16_t port_id,
struct rte_eth_dcb_info *dcb_info);
/**
@@ -3986,7 +3988,7 @@ int rte_eth_dev_get_dcb_info(uint8_t port_id,
* NULL on error.
* On success, a pointer value which can later be used to remove the callback.
*/
-void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
+void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param);
/**
@@ -4014,7 +4016,7 @@ void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
* NULL on error.
* On success, a pointer value which can later be used to remove the callback.
*/
-void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
+void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param);
/**
@@ -4041,7 +4043,7 @@ void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
* NULL on error.
* On success, a pointer value which can later be used to remove the callback.
*/
-void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
+void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
rte_tx_callback_fn fn, void *user_param);
/**
@@ -4074,7 +4076,7 @@ void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
* - -EINVAL: The port_id or the queue_id is out of range, or the callback
* is NULL or not found for the port/queue.
*/
-int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
+int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxtx_callback *user_cb);
/**
@@ -4107,7 +4109,7 @@ int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
* - -EINVAL: The port_id or the queue_id is out of range, or the callback
* is NULL or not found for the port/queue.
*/
-int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
+int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxtx_callback *user_cb);
/**
@@ -4127,7 +4129,7 @@ int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
* - -ENOTSUP: routine is not supported by the device PMD.
* - -EINVAL: The port_id or the queue_id is out of range.
*/
-int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
/**
@@ -4147,7 +4149,7 @@ int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
* - -ENOTSUP: routine is not supported by the device PMD.
* - -EINVAL: The port_id or the queue_id is out of range.
*/
-int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
/**
@@ -4166,7 +4168,7 @@ int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
* - (-ENODEV) if *port_id* invalid.
* - others depends on the specific operations implementation.
*/
-int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
+int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info);
/**
* Retrieve size of device EEPROM
@@ -4179,7 +4181,7 @@ int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
* - (-ENODEV) if *port_id* invalid.
* - others depends on the specific operations implementation.
*/
-int rte_eth_dev_get_eeprom_length(uint8_t port_id);
+int rte_eth_dev_get_eeprom_length(uint16_t port_id);
/**
* Retrieve EEPROM and EEPROM attribute
@@ -4195,7 +4197,7 @@ int rte_eth_dev_get_eeprom_length(uint8_t port_id);
* - (-ENODEV) if *port_id* invalid.
* - others depends on the specific operations implementation.
*/
-int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
+int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
/**
* Program EEPROM with provided data
@@ -4211,7 +4213,7 @@ int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
* - (-ENODEV) if *port_id* invalid.
* - others depends on the specific operations implementation.
*/
-int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
+int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
/**
* Set the list of multicast addresses to filter on an Ethernet device.
@@ -4230,7 +4232,7 @@ int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
* - (-ENOTSUP) if PMD of *port_id* doesn't support multicast filtering.
* - (-ENOSPC) if *port_id* has not enough multicast filtering resources.
*/
-int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
+int rte_eth_dev_set_mc_addr_list(uint16_t port_id,
struct ether_addr *mc_addr_set,
uint32_t nb_mc_addr);
@@ -4245,7 +4247,7 @@ int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_enable(uint8_t port_id);
+int rte_eth_timesync_enable(uint16_t port_id);
/**
* Disable IEEE1588/802.1AS timestamping for an Ethernet device.
@@ -4258,7 +4260,7 @@ int rte_eth_timesync_enable(uint8_t port_id);
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_disable(uint8_t port_id);
+int rte_eth_timesync_disable(uint16_t port_id);
/**
* Read an IEEE1588/802.1AS RX timestamp from an Ethernet device.
@@ -4277,7 +4279,7 @@ int rte_eth_timesync_disable(uint8_t port_id);
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
+int rte_eth_timesync_read_rx_timestamp(uint16_t port_id,
struct timespec *timestamp, uint32_t flags);
/**
@@ -4294,7 +4296,7 @@ int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
+int rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
struct timespec *timestamp);
/**
@@ -4313,7 +4315,7 @@ int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta);
+int rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta);
/**
* Read the time from the timesync clock on an Ethernet device.
@@ -4329,7 +4331,7 @@ int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta);
* @return
* - 0: Success.
*/
-int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
+int rte_eth_timesync_read_time(uint16_t port_id, struct timespec *time);
/**
* Set the time of the timesync clock on an Ethernet device.
@@ -4348,7 +4350,7 @@ int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
* - -ENODEV: The port ID is invalid.
* - -ENOTSUP: The function is not supported by the Ethernet driver.
*/
-int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time);
+int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time);
/**
* Create memzone for HW rings.
@@ -4389,7 +4391,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
* - (-ENOTSUP) if hardware doesn't support tunnel type.
*/
int
-rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
+rte_eth_dev_l2_tunnel_eth_type_conf(uint16_t port_id,
struct rte_eth_l2_tunnel_conf *l2_tunnel);
/**
@@ -4416,7 +4418,7 @@ rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
* - (-ENOTSUP) if hardware doesn't support tunnel type.
*/
int
-rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
+rte_eth_dev_l2_tunnel_offload_set(uint16_t port_id,
struct rte_eth_l2_tunnel_conf *l2_tunnel,
uint32_t mask,
uint8_t en);
@@ -4434,7 +4436,7 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
* - (-ENODEV or -EINVAL) on failure.
*/
int
-rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
+rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id);
/**
* Get the device name from port id
@@ -4448,7 +4450,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
* - (-EINVAL) on failure.
*/
int
-rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+rte_eth_dev_get_name_by_port(uint16_t port_id, char *name);
/**
* Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
@@ -4466,7 +4468,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
* - (0) if successful.
* - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
*/
-int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+int rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id,
uint16_t *nb_rx_desc,
uint16_t *nb_tx_desc);
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 2001fbbf4..95d9ee007 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -108,7 +108,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
/* Get generic flow operations structure from a port. */
const struct rte_flow_ops *
-rte_flow_ops_get(uint8_t port_id, struct rte_flow_error *error)
+rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
const struct rte_flow_ops *ops;
diff --git a/lib/librte_ether/rte_flow_driver.h b/lib/librte_ether/rte_flow_driver.h
index 4d95391d8..8573cefa3 100644
--- a/lib/librte_ether/rte_flow_driver.h
+++ b/lib/librte_ether/rte_flow_driver.h
@@ -178,7 +178,7 @@ rte_flow_error_set(struct rte_flow_error *error,
* additional details.
*/
const struct rte_flow_ops *
-rte_flow_ops_get(uint8_t port_id, struct rte_flow_error *error);
+rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error);
#ifdef __cplusplus
}
diff --git a/lib/librte_ether/rte_tm.c b/lib/librte_ether/rte_tm.c
index 71679650e..ceac34115 100644
--- a/lib/librte_ether/rte_tm.c
+++ b/lib/librte_ether/rte_tm.c
@@ -40,7 +40,7 @@
/* Get generic traffic manager operations structure from a port. */
const struct rte_tm_ops *
-rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error)
+rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
const struct rte_tm_ops *ops;
@@ -87,7 +87,7 @@ rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error)
/* Get number of leaf nodes */
int
-rte_tm_get_number_of_leaf_nodes(uint8_t port_id,
+rte_tm_get_number_of_leaf_nodes(uint16_t port_id,
uint32_t *n_leaf_nodes,
struct rte_tm_error *error)
{
@@ -113,7 +113,7 @@ rte_tm_get_number_of_leaf_nodes(uint8_t port_id,
/* Check node type (leaf or non-leaf) */
int
-rte_tm_node_type_get(uint8_t port_id,
+rte_tm_node_type_get(uint16_t port_id,
uint32_t node_id,
int *is_leaf,
struct rte_tm_error *error)
@@ -124,7 +124,7 @@ rte_tm_node_type_get(uint8_t port_id,
}
/* Get capabilities */
-int rte_tm_capabilities_get(uint8_t port_id,
+int rte_tm_capabilities_get(uint16_t port_id,
struct rte_tm_capabilities *cap,
struct rte_tm_error *error)
{
@@ -134,7 +134,7 @@ int rte_tm_capabilities_get(uint8_t port_id,
}
/* Get level capabilities */
-int rte_tm_level_capabilities_get(uint8_t port_id,
+int rte_tm_level_capabilities_get(uint16_t port_id,
uint32_t level_id,
struct rte_tm_level_capabilities *cap,
struct rte_tm_error *error)
@@ -145,7 +145,7 @@ int rte_tm_level_capabilities_get(uint8_t port_id,
}
/* Get node capabilities */
-int rte_tm_node_capabilities_get(uint8_t port_id,
+int rte_tm_node_capabilities_get(uint16_t port_id,
uint32_t node_id,
struct rte_tm_node_capabilities *cap,
struct rte_tm_error *error)
@@ -156,7 +156,7 @@ int rte_tm_node_capabilities_get(uint8_t port_id,
}
/* Add WRED profile */
-int rte_tm_wred_profile_add(uint8_t port_id,
+int rte_tm_wred_profile_add(uint16_t port_id,
uint32_t wred_profile_id,
struct rte_tm_wred_params *profile,
struct rte_tm_error *error)
@@ -167,7 +167,7 @@ int rte_tm_wred_profile_add(uint8_t port_id,
}
/* Delete WRED profile */
-int rte_tm_wred_profile_delete(uint8_t port_id,
+int rte_tm_wred_profile_delete(uint16_t port_id,
uint32_t wred_profile_id,
struct rte_tm_error *error)
{
@@ -177,7 +177,7 @@ int rte_tm_wred_profile_delete(uint8_t port_id,
}
/* Add/update shared WRED context */
-int rte_tm_shared_wred_context_add_update(uint8_t port_id,
+int rte_tm_shared_wred_context_add_update(uint16_t port_id,
uint32_t shared_wred_context_id,
uint32_t wred_profile_id,
struct rte_tm_error *error)
@@ -188,7 +188,7 @@ int rte_tm_shared_wred_context_add_update(uint8_t port_id,
}
/* Delete shared WRED context */
-int rte_tm_shared_wred_context_delete(uint8_t port_id,
+int rte_tm_shared_wred_context_delete(uint16_t port_id,
uint32_t shared_wred_context_id,
struct rte_tm_error *error)
{
@@ -198,7 +198,7 @@ int rte_tm_shared_wred_context_delete(uint8_t port_id,
}
/* Add shaper profile */
-int rte_tm_shaper_profile_add(uint8_t port_id,
+int rte_tm_shaper_profile_add(uint16_t port_id,
uint32_t shaper_profile_id,
struct rte_tm_shaper_params *profile,
struct rte_tm_error *error)
@@ -209,7 +209,7 @@ int rte_tm_shaper_profile_add(uint8_t port_id,
}
/* Delete WRED profile */
-int rte_tm_shaper_profile_delete(uint8_t port_id,
+int rte_tm_shaper_profile_delete(uint16_t port_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error)
{
@@ -219,7 +219,7 @@ int rte_tm_shaper_profile_delete(uint8_t port_id,
}
/* Add shared shaper */
-int rte_tm_shared_shaper_add_update(uint8_t port_id,
+int rte_tm_shared_shaper_add_update(uint16_t port_id,
uint32_t shared_shaper_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error)
@@ -230,7 +230,7 @@ int rte_tm_shared_shaper_add_update(uint8_t port_id,
}
/* Delete shared shaper */
-int rte_tm_shared_shaper_delete(uint8_t port_id,
+int rte_tm_shared_shaper_delete(uint16_t port_id,
uint32_t shared_shaper_id,
struct rte_tm_error *error)
{
@@ -240,7 +240,7 @@ int rte_tm_shared_shaper_delete(uint8_t port_id,
}
/* Add node to port traffic manager hierarchy */
-int rte_tm_node_add(uint8_t port_id,
+int rte_tm_node_add(uint16_t port_id,
uint32_t node_id,
uint32_t parent_node_id,
uint32_t priority,
@@ -256,7 +256,7 @@ int rte_tm_node_add(uint8_t port_id,
}
/* Delete node from traffic manager hierarchy */
-int rte_tm_node_delete(uint8_t port_id,
+int rte_tm_node_delete(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error)
{
@@ -266,7 +266,7 @@ int rte_tm_node_delete(uint8_t port_id,
}
/* Suspend node */
-int rte_tm_node_suspend(uint8_t port_id,
+int rte_tm_node_suspend(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error)
{
@@ -276,7 +276,7 @@ int rte_tm_node_suspend(uint8_t port_id,
}
/* Resume node */
-int rte_tm_node_resume(uint8_t port_id,
+int rte_tm_node_resume(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error)
{
@@ -286,7 +286,7 @@ int rte_tm_node_resume(uint8_t port_id,
}
/* Commit the initial port traffic manager hierarchy */
-int rte_tm_hierarchy_commit(uint8_t port_id,
+int rte_tm_hierarchy_commit(uint16_t port_id,
int clear_on_fail,
struct rte_tm_error *error)
{
@@ -296,7 +296,7 @@ int rte_tm_hierarchy_commit(uint8_t port_id,
}
/* Update node parent */
-int rte_tm_node_parent_update(uint8_t port_id,
+int rte_tm_node_parent_update(uint16_t port_id,
uint32_t node_id,
uint32_t parent_node_id,
uint32_t priority,
@@ -309,7 +309,7 @@ int rte_tm_node_parent_update(uint8_t port_id,
}
/* Update node private shaper */
-int rte_tm_node_shaper_update(uint8_t port_id,
+int rte_tm_node_shaper_update(uint16_t port_id,
uint32_t node_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error)
@@ -320,7 +320,7 @@ int rte_tm_node_shaper_update(uint8_t port_id,
}
/* Update node shared shapers */
-int rte_tm_node_shared_shaper_update(uint8_t port_id,
+int rte_tm_node_shared_shaper_update(uint16_t port_id,
uint32_t node_id,
uint32_t shared_shaper_id,
int add,
@@ -332,7 +332,7 @@ int rte_tm_node_shared_shaper_update(uint8_t port_id,
}
/* Update node stats */
-int rte_tm_node_stats_update(uint8_t port_id,
+int rte_tm_node_stats_update(uint16_t port_id,
uint32_t node_id,
uint64_t stats_mask,
struct rte_tm_error *error)
@@ -343,7 +343,7 @@ int rte_tm_node_stats_update(uint8_t port_id,
}
/* Update WFQ weight mode */
-int rte_tm_node_wfq_weight_mode_update(uint8_t port_id,
+int rte_tm_node_wfq_weight_mode_update(uint16_t port_id,
uint32_t node_id,
int *wfq_weight_mode,
uint32_t n_sp_priorities,
@@ -355,7 +355,7 @@ int rte_tm_node_wfq_weight_mode_update(uint8_t port_id,
}
/* Update node congestion management mode */
-int rte_tm_node_cman_update(uint8_t port_id,
+int rte_tm_node_cman_update(uint16_t port_id,
uint32_t node_id,
enum rte_tm_cman_mode cman,
struct rte_tm_error *error)
@@ -366,7 +366,7 @@ int rte_tm_node_cman_update(uint8_t port_id,
}
/* Update node private WRED context */
-int rte_tm_node_wred_context_update(uint8_t port_id,
+int rte_tm_node_wred_context_update(uint16_t port_id,
uint32_t node_id,
uint32_t wred_profile_id,
struct rte_tm_error *error)
@@ -377,7 +377,7 @@ int rte_tm_node_wred_context_update(uint8_t port_id,
}
/* Update node shared WRED context */
-int rte_tm_node_shared_wred_context_update(uint8_t port_id,
+int rte_tm_node_shared_wred_context_update(uint16_t port_id,
uint32_t node_id,
uint32_t shared_wred_context_id,
int add,
@@ -389,7 +389,7 @@ int rte_tm_node_shared_wred_context_update(uint8_t port_id,
}
/* Read and/or clear stats counters for specific node */
-int rte_tm_node_stats_read(uint8_t port_id,
+int rte_tm_node_stats_read(uint16_t port_id,
uint32_t node_id,
struct rte_tm_node_stats *stats,
uint64_t *stats_mask,
@@ -402,7 +402,7 @@ int rte_tm_node_stats_read(uint8_t port_id,
}
/* Packet marking - VLAN DEI */
-int rte_tm_mark_vlan_dei(uint8_t port_id,
+int rte_tm_mark_vlan_dei(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
@@ -414,7 +414,7 @@ int rte_tm_mark_vlan_dei(uint8_t port_id,
}
/* Packet marking - IPv4/IPv6 ECN */
-int rte_tm_mark_ip_ecn(uint8_t port_id,
+int rte_tm_mark_ip_ecn(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
@@ -426,7 +426,7 @@ int rte_tm_mark_ip_ecn(uint8_t port_id,
}
/* Packet marking - IPv4/IPv6 DSCP */
-int rte_tm_mark_ip_dscp(uint8_t port_id,
+int rte_tm_mark_ip_dscp(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
diff --git a/lib/librte_ether/rte_tm.h b/lib/librte_ether/rte_tm.h
index ebbfa1eec..2b25a8715 100644
--- a/lib/librte_ether/rte_tm.h
+++ b/lib/librte_ether/rte_tm.h
@@ -1040,7 +1040,7 @@ struct rte_tm_error {
* 0 on success, non-zero error code otherwise.
*/
int
-rte_tm_get_number_of_leaf_nodes(uint8_t port_id,
+rte_tm_get_number_of_leaf_nodes(uint16_t port_id,
uint32_t *n_leaf_nodes,
struct rte_tm_error *error);
@@ -1064,7 +1064,7 @@ rte_tm_get_number_of_leaf_nodes(uint8_t port_id,
* 0 on success, non-zero error code otherwise.
*/
int
-rte_tm_node_type_get(uint8_t port_id,
+rte_tm_node_type_get(uint16_t port_id,
uint32_t node_id,
int *is_leaf,
struct rte_tm_error *error);
@@ -1082,7 +1082,7 @@ rte_tm_node_type_get(uint8_t port_id,
* 0 on success, non-zero error code otherwise.
*/
int
-rte_tm_capabilities_get(uint8_t port_id,
+rte_tm_capabilities_get(uint16_t port_id,
struct rte_tm_capabilities *cap,
struct rte_tm_error *error);
@@ -1102,7 +1102,7 @@ rte_tm_capabilities_get(uint8_t port_id,
* 0 on success, non-zero error code otherwise.
*/
int
-rte_tm_level_capabilities_get(uint8_t port_id,
+rte_tm_level_capabilities_get(uint16_t port_id,
uint32_t level_id,
struct rte_tm_level_capabilities *cap,
struct rte_tm_error *error);
@@ -1122,7 +1122,7 @@ rte_tm_level_capabilities_get(uint8_t port_id,
* 0 on success, non-zero error code otherwise.
*/
int
-rte_tm_node_capabilities_get(uint8_t port_id,
+rte_tm_node_capabilities_get(uint16_t port_id,
uint32_t node_id,
struct rte_tm_node_capabilities *cap,
struct rte_tm_error *error);
@@ -1147,7 +1147,7 @@ rte_tm_node_capabilities_get(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_n_max
*/
int
-rte_tm_wred_profile_add(uint8_t port_id,
+rte_tm_wred_profile_add(uint16_t port_id,
uint32_t wred_profile_id,
struct rte_tm_wred_params *profile,
struct rte_tm_error *error);
@@ -1170,7 +1170,7 @@ rte_tm_wred_profile_add(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_n_max
*/
int
-rte_tm_wred_profile_delete(uint8_t port_id,
+rte_tm_wred_profile_delete(uint16_t port_id,
uint32_t wred_profile_id,
struct rte_tm_error *error);
@@ -1201,7 +1201,7 @@ rte_tm_wred_profile_delete(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_shared_n_max
*/
int
-rte_tm_shared_wred_context_add_update(uint8_t port_id,
+rte_tm_shared_wred_context_add_update(uint16_t port_id,
uint32_t shared_wred_context_id,
uint32_t wred_profile_id,
struct rte_tm_error *error);
@@ -1225,7 +1225,7 @@ rte_tm_shared_wred_context_add_update(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_shared_n_max
*/
int
-rte_tm_shared_wred_context_delete(uint8_t port_id,
+rte_tm_shared_wred_context_delete(uint16_t port_id,
uint32_t shared_wred_context_id,
struct rte_tm_error *error);
@@ -1249,7 +1249,7 @@ rte_tm_shared_wred_context_delete(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_n_max
*/
int
-rte_tm_shaper_profile_add(uint8_t port_id,
+rte_tm_shaper_profile_add(uint16_t port_id,
uint32_t shaper_profile_id,
struct rte_tm_shaper_params *profile,
struct rte_tm_error *error);
@@ -1272,7 +1272,7 @@ rte_tm_shaper_profile_add(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_n_max
*/
int
-rte_tm_shaper_profile_delete(uint8_t port_id,
+rte_tm_shaper_profile_delete(uint16_t port_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error);
@@ -1301,7 +1301,7 @@ rte_tm_shaper_profile_delete(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_shared_n_max
*/
int
-rte_tm_shared_shaper_add_update(uint8_t port_id,
+rte_tm_shared_shaper_add_update(uint16_t port_id,
uint32_t shared_shaper_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error);
@@ -1324,7 +1324,7 @@ rte_tm_shared_shaper_add_update(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_shared_n_max
*/
int
-rte_tm_shared_shaper_delete(uint8_t port_id,
+rte_tm_shared_shaper_delete(uint16_t port_id,
uint32_t shared_shaper_id,
struct rte_tm_error *error);
@@ -1392,7 +1392,7 @@ rte_tm_shared_shaper_delete(uint8_t port_id,
* @see struct rte_tm_capabilities
*/
int
-rte_tm_node_add(uint8_t port_id,
+rte_tm_node_add(uint16_t port_id,
uint32_t node_id,
uint32_t parent_node_id,
uint32_t priority,
@@ -1425,7 +1425,7 @@ rte_tm_node_add(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_ADD_DELETE
*/
int
-rte_tm_node_delete(uint8_t port_id,
+rte_tm_node_delete(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error);
@@ -1449,7 +1449,7 @@ rte_tm_node_delete(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME
*/
int
-rte_tm_node_suspend(uint8_t port_id,
+rte_tm_node_suspend(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error);
@@ -1472,7 +1472,7 @@ rte_tm_node_suspend(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME
*/
int
-rte_tm_node_resume(uint8_t port_id,
+rte_tm_node_resume(uint16_t port_id,
uint32_t node_id,
struct rte_tm_error *error);
@@ -1513,7 +1513,7 @@ rte_tm_node_resume(uint8_t port_id,
* @see rte_tm_node_delete()
*/
int
-rte_tm_hierarchy_commit(uint8_t port_id,
+rte_tm_hierarchy_commit(uint16_t port_id,
int clear_on_fail,
struct rte_tm_error *error);
@@ -1549,7 +1549,7 @@ rte_tm_hierarchy_commit(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL
*/
int
-rte_tm_node_parent_update(uint8_t port_id,
+rte_tm_node_parent_update(uint16_t port_id,
uint32_t node_id,
uint32_t parent_node_id,
uint32_t priority,
@@ -1578,7 +1578,7 @@ rte_tm_node_parent_update(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_private_n_max
*/
int
-rte_tm_node_shaper_update(uint8_t port_id,
+rte_tm_node_shaper_update(uint16_t port_id,
uint32_t node_id,
uint32_t shaper_profile_id,
struct rte_tm_error *error);
@@ -1605,7 +1605,7 @@ rte_tm_node_shaper_update(uint8_t port_id,
* @see struct rte_tm_capabilities::shaper_shared_n_max
*/
int
-rte_tm_node_shared_shaper_update(uint8_t port_id,
+rte_tm_node_shared_shaper_update(uint16_t port_id,
uint32_t node_id,
uint32_t shared_shaper_id,
int add,
@@ -1632,7 +1632,7 @@ rte_tm_node_shared_shaper_update(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_STATS
*/
int
-rte_tm_node_stats_update(uint8_t port_id,
+rte_tm_node_stats_update(uint16_t port_id,
uint32_t node_id,
uint64_t stats_mask,
struct rte_tm_error *error);
@@ -1660,7 +1660,7 @@ rte_tm_node_stats_update(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_N_SP_PRIORITIES
*/
int
-rte_tm_node_wfq_weight_mode_update(uint8_t port_id,
+rte_tm_node_wfq_weight_mode_update(uint16_t port_id,
uint32_t node_id,
int *wfq_weight_mode,
uint32_t n_sp_priorities,
@@ -1683,7 +1683,7 @@ rte_tm_node_wfq_weight_mode_update(uint8_t port_id,
* @see RTE_TM_UPDATE_NODE_CMAN
*/
int
-rte_tm_node_cman_update(uint8_t port_id,
+rte_tm_node_cman_update(uint16_t port_id,
uint32_t node_id,
enum rte_tm_cman_mode cman,
struct rte_tm_error *error);
@@ -1707,7 +1707,7 @@ rte_tm_node_cman_update(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_private_n_max
*/
int
-rte_tm_node_wred_context_update(uint8_t port_id,
+rte_tm_node_wred_context_update(uint16_t port_id,
uint32_t node_id,
uint32_t wred_profile_id,
struct rte_tm_error *error);
@@ -1732,7 +1732,7 @@ rte_tm_node_wred_context_update(uint8_t port_id,
* @see struct rte_tm_capabilities::cman_wred_context_shared_n_max
*/
int
-rte_tm_node_shared_wred_context_update(uint8_t port_id,
+rte_tm_node_shared_wred_context_update(uint16_t port_id,
uint32_t node_id,
uint32_t shared_wred_context_id,
int add,
@@ -1764,7 +1764,7 @@ rte_tm_node_shared_wred_context_update(uint8_t port_id,
* @see enum rte_tm_stats_type
*/
int
-rte_tm_node_stats_read(uint8_t port_id,
+rte_tm_node_stats_read(uint16_t port_id,
uint32_t node_id,
struct rte_tm_node_stats *stats,
uint64_t *stats_mask,
@@ -1801,7 +1801,7 @@ rte_tm_node_stats_read(uint8_t port_id,
* @see struct rte_tm_capabilities::mark_vlan_dei_supported
*/
int
-rte_tm_mark_vlan_dei(uint8_t port_id,
+rte_tm_mark_vlan_dei(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
@@ -1851,7 +1851,7 @@ rte_tm_mark_vlan_dei(uint8_t port_id,
* @see struct rte_tm_capabilities::mark_ip_ecn_sctp_supported
*/
int
-rte_tm_mark_ip_ecn(uint8_t port_id,
+rte_tm_mark_ip_ecn(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
@@ -1899,7 +1899,7 @@ rte_tm_mark_ip_ecn(uint8_t port_id,
* @see struct rte_tm_capabilities::mark_ip_dscp_supported
*/
int
-rte_tm_mark_ip_dscp(uint8_t port_id,
+rte_tm_mark_ip_dscp(uint16_t port_id,
int mark_green,
int mark_yellow,
int mark_red,
diff --git a/lib/librte_ether/rte_tm_driver.h b/lib/librte_ether/rte_tm_driver.h
index a5b698fe0..b2e8ccf80 100644
--- a/lib/librte_ether/rte_tm_driver.h
+++ b/lib/librte_ether/rte_tm_driver.h
@@ -357,7 +357,7 @@ rte_tm_error_set(struct rte_tm_error *error,
* success, NULL otherwise.
*/
const struct rte_tm_ops *
-rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error);
+rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error);
#ifdef __cplusplus
}
diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h
index 37deb4727..87812cd55 100644
--- a/lib/librte_kni/rte_kni.h
+++ b/lib/librte_kni/rte_kni.h
@@ -63,13 +63,13 @@ struct rte_mbuf;
* Structure which has the function pointers for KNI interface.
*/
struct rte_kni_ops {
- uint8_t port_id; /* Port ID */
+ uint16_t port_id; /* Port ID */
/* Pointer to function of changing MTU */
- int (*change_mtu)(uint8_t port_id, unsigned new_mtu);
+ int (*change_mtu)(uint16_t port_id, unsigned int new_mtu);
/* Pointer to function of configuring network interface */
- int (*config_network_if)(uint8_t port_id, uint8_t if_up);
+ int (*config_network_if)(uint16_t port_id, uint8_t if_up);
};
/**
diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index ce029a12c..d6ad13c4e 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -135,7 +135,7 @@ rte_latencystats_fill_values(struct rte_metric_value *values)
}
static uint16_t
-add_time_stamps(uint8_t pid __rte_unused,
+add_time_stamps(uint16_t pid __rte_unused,
uint16_t qid __rte_unused,
struct rte_mbuf **pkts,
uint16_t nb_pkts,
@@ -165,7 +165,7 @@ add_time_stamps(uint8_t pid __rte_unused,
}
static uint16_t
-calc_latency(uint8_t pid __rte_unused,
+calc_latency(uint16_t pid __rte_unused,
uint16_t qid __rte_unused,
struct rte_mbuf **pkts,
uint16_t nb_pkts,
@@ -226,10 +226,10 @@ rte_latencystats_init(uint64_t app_samp_intvl,
rte_latency_stats_flow_type_fn user_cb)
{
unsigned int i;
- uint8_t pid;
+ uint16_t pid;
uint16_t qid;
struct rxtx_cbs *cbs = NULL;
- const uint8_t nb_ports = rte_eth_dev_count();
+ const uint16_t nb_ports = rte_eth_dev_count();
const char *ptr_strings[NUM_LATENCY_STATS] = {0};
const struct rte_memzone *mz = NULL;
const unsigned int flags = 0;
@@ -290,11 +290,11 @@ rte_latencystats_init(uint64_t app_samp_intvl,
int
rte_latencystats_uninit(void)
{
- uint8_t pid;
+ uint16_t pid;
uint16_t qid;
int ret = 0;
struct rxtx_cbs *cbs = NULL;
- const uint8_t nb_ports = rte_eth_dev_count();
+ const uint16_t nb_ports = rte_eth_dev_count();
/** De register Rx/Tx callbacks */
for (pid = 0; pid < nb_ports; pid++) {
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 1c03bcbb7..6b21c62e5 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -40,7 +40,7 @@ LDLIBS += -lpthread
EXPORT_MAP := rte_pdump_version.map
-LIBABIVER := 1
+LIBABIVER := 2
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_PDUMP) := rte_pdump.c
diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 729e79a36..e6182d35c 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -207,7 +207,7 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params)
}
static uint16_t
-pdump_rx(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
+pdump_rx(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts,
uint16_t max_pkts __rte_unused,
void *user_params)
@@ -217,7 +217,7 @@ pdump_rx(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
}
static uint16_t
-pdump_tx(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
+pdump_tx(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params)
{
pdump_copy(pkts, nb_pkts, user_params);
@@ -225,7 +225,7 @@ pdump_tx(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
}
static int
-pdump_regitser_rx_callbacks(uint16_t end_q, uint8_t port, uint16_t queue,
+pdump_regitser_rx_callbacks(uint16_t end_q, uint16_t port, uint16_t queue,
struct rte_ring *ring, struct rte_mempool *mp,
uint16_t operation)
{
@@ -279,7 +279,7 @@ pdump_regitser_rx_callbacks(uint16_t end_q, uint8_t port, uint16_t queue,
}
static int
-pdump_regitser_tx_callbacks(uint16_t end_q, uint8_t port, uint16_t queue,
+pdump_regitser_tx_callbacks(uint16_t end_q, uint16_t port, uint16_t queue,
struct rte_ring *ring, struct rte_mempool *mp,
uint16_t operation)
{
@@ -337,7 +337,7 @@ static int
set_pdump_rxtx_cbs(struct pdump_request *p)
{
uint16_t nb_rx_q = 0, nb_tx_q = 0, end_q, queue;
- uint8_t port;
+ uint16_t port;
int ret = 0;
uint32_t flags;
uint16_t operation;
@@ -764,7 +764,7 @@ pdump_validate_flags(uint32_t flags)
}
static int
-pdump_validate_port(uint8_t port, char *name)
+pdump_validate_port(uint16_t port, char *name)
{
int ret = 0;
@@ -828,7 +828,7 @@ pdump_prepare_client_request(char *device, uint16_t queue,
}
int
-rte_pdump_enable(uint8_t port, uint16_t queue, uint32_t flags,
+rte_pdump_enable(uint16_t port, uint16_t queue, uint32_t flags,
struct rte_ring *ring,
struct rte_mempool *mp,
void *filter)
@@ -876,7 +876,7 @@ rte_pdump_enable_by_deviceid(char *device_id, uint16_t queue,
}
int
-rte_pdump_disable(uint8_t port, uint16_t queue, uint32_t flags)
+rte_pdump_disable(uint16_t port, uint16_t queue, uint32_t flags)
{
int ret = 0;
char name[DEVICE_ID_SIZE];
diff --git a/lib/librte_pdump/rte_pdump.h b/lib/librte_pdump/rte_pdump.h
index ba6e39b09..4ec0a106f 100644
--- a/lib/librte_pdump/rte_pdump.h
+++ b/lib/librte_pdump/rte_pdump.h
@@ -113,7 +113,7 @@ rte_pdump_uninit(void);
*/
int
-rte_pdump_enable(uint8_t port, uint16_t queue, uint32_t flags,
+rte_pdump_enable(uint16_t port, uint16_t queue, uint32_t flags,
struct rte_ring *ring,
struct rte_mempool *mp,
void *filter);
@@ -136,7 +136,7 @@ rte_pdump_enable(uint8_t port, uint16_t queue, uint32_t flags,
*/
int
-rte_pdump_disable(uint8_t port, uint16_t queue, uint32_t flags);
+rte_pdump_disable(uint16_t port, uint16_t queue, uint32_t flags);
/**
* Enables packet capturing on given device id and queue.
diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c
index d5c5fba55..4ed10f276 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -60,7 +60,7 @@ struct rte_port_ethdev_reader {
struct rte_port_in_stats stats;
uint16_t queue_id;
- uint8_t port_id;
+ uint16_t port_id;
};
static void *
@@ -156,7 +156,7 @@ struct rte_port_ethdev_writer {
uint16_t tx_buf_count;
uint64_t bsz_mask;
uint16_t queue_id;
- uint8_t port_id;
+ uint16_t port_id;
};
static void *
@@ -337,7 +337,7 @@ struct rte_port_ethdev_writer_nodrop {
uint64_t bsz_mask;
uint64_t n_retries;
uint16_t queue_id;
- uint8_t port_id;
+ uint16_t port_id;
};
static void *
diff --git a/lib/librte_port/rte_port_ethdev.h b/lib/librte_port/rte_port_ethdev.h
index 201a79e41..f5ed9ab2d 100644
--- a/lib/librte_port/rte_port_ethdev.h
+++ b/lib/librte_port/rte_port_ethdev.h
@@ -54,7 +54,7 @@ extern "C" {
/** ethdev_reader port parameters */
struct rte_port_ethdev_reader_params {
/** NIC RX port ID */
- uint8_t port_id;
+ uint16_t port_id;
/** NIC RX queue ID */
uint16_t queue_id;
@@ -66,7 +66,7 @@ extern struct rte_port_in_ops rte_port_ethdev_reader_ops;
/** ethdev_writer port parameters */
struct rte_port_ethdev_writer_params {
/** NIC RX port ID */
- uint8_t port_id;
+ uint16_t port_id;
/** NIC RX queue ID */
uint16_t queue_id;
@@ -82,7 +82,7 @@ extern struct rte_port_out_ops rte_port_ethdev_writer_ops;
/** ethdev_writer_nodrop port parameters */
struct rte_port_ethdev_writer_nodrop_params {
/** NIC RX port ID */
- uint8_t port_id;
+ uint16_t port_id;
/** NIC RX queue ID */
uint16_t queue_id;
--
2.13.3
^ permalink raw reply [relevance 1%]
* [dpdk-dev] [PATCH v6 1/5] net/bonding: remove bonding APIs using ABI versioning
2017-09-29 7:17 4% ` [dpdk-dev] [PATCH v6 " Zhiyong Yang
@ 2017-09-29 7:17 7% ` Zhiyong Yang
2017-09-29 7:17 1% ` [dpdk-dev] [PATCH v6 2/5] ethdev: increase port_id range Zhiyong Yang
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
2 siblings, 0 replies; 200+ results
From: Zhiyong Yang @ 2017-09-29 7:17 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
There are two bonding APIs using ABI versioning, and both have
port_id as parameter. Since we are already breaking ABI, no need
to keep older versions of APIs.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/bonding/rte_eth_bond_8023ad.c | 149 +--------------------------
drivers/net/bonding/rte_eth_bond_8023ad.h | 18 ----
drivers/net/bonding/rte_eth_bond_version.map | 4 -
3 files changed, 2 insertions(+), 169 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 20b5a8961..c2b9e053c 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1111,27 +1111,6 @@ bond_mode_8023ad_conf_get(struct rte_eth_dev *dev,
conf->tx_period_ms = mode4->tx_period_timeout / ms_ticks;
conf->update_timeout_ms = mode4->update_timeout_us / 1000;
conf->rx_marker_period_ms = mode4->rx_marker_timeout / ms_ticks;
-}
-
-static void
-bond_mode_8023ad_conf_get_v1607(struct rte_eth_dev *dev,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct bond_dev_private *internals = dev->data->dev_private;
- struct mode8023ad_private *mode4 = &internals->mode4;
-
- bond_mode_8023ad_conf_get(dev, conf);
- conf->slowrx_cb = mode4->slowrx_cb;
-}
-
-static void
-bond_mode_8023ad_conf_get_v1708(struct rte_eth_dev *dev,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct bond_dev_private *internals = dev->data->dev_private;
- struct mode8023ad_private *mode4 = &internals->mode4;
-
- bond_mode_8023ad_conf_get(dev, conf);
conf->slowrx_cb = mode4->slowrx_cb;
conf->agg_selection = mode4->agg_selection;
}
@@ -1171,27 +1150,6 @@ bond_mode_8023ad_conf_assign(struct mode8023ad_private *mode4,
mode4->dedicated_queues.tx_qid = UINT16_MAX;
}
-static void
-bond_mode_8023ad_setup_v20(struct rte_eth_dev *dev,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_bond_8023ad_conf def_conf;
- struct bond_dev_private *internals = dev->data->dev_private;
- struct mode8023ad_private *mode4 = &internals->mode4;
-
- if (conf == NULL) {
- conf = &def_conf;
- bond_mode_8023ad_conf_get_default(conf);
- }
-
- bond_mode_8023ad_stop(dev);
- bond_mode_8023ad_conf_assign(mode4, conf);
-
- if (dev->data->dev_started)
- bond_mode_8023ad_start(dev);
-}
-
-
void
bond_mode_8023ad_setup(struct rte_eth_dev *dev,
struct rte_eth_bond_8023ad_conf *conf)
@@ -1207,27 +1165,6 @@ bond_mode_8023ad_setup(struct rte_eth_dev *dev,
bond_mode_8023ad_stop(dev);
bond_mode_8023ad_conf_assign(mode4, conf);
-
-
- if (dev->data->dev_started)
- bond_mode_8023ad_start(dev);
-}
-
-static void
-bond_mode_8023ad_setup_v1708(struct rte_eth_dev *dev,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_bond_8023ad_conf def_conf;
- struct bond_dev_private *internals = dev->data->dev_private;
- struct mode8023ad_private *mode4 = &internals->mode4;
-
- if (conf == NULL) {
- conf = &def_conf;
- bond_mode_8023ad_conf_get_default(conf);
- }
-
- bond_mode_8023ad_stop(dev);
- bond_mode_8023ad_conf_assign(mode4, conf);
mode4->slowrx_cb = conf->slowrx_cb;
mode4->agg_selection = AGG_STABLE;
@@ -1358,7 +1295,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
}
int
-rte_eth_bond_8023ad_conf_get_v20(uint8_t port_id,
+rte_eth_bond_8023ad_conf_get(uint8_t port_id,
struct rte_eth_bond_8023ad_conf *conf)
{
struct rte_eth_dev *bond_dev;
@@ -1373,46 +1310,6 @@ rte_eth_bond_8023ad_conf_get_v20(uint8_t port_id,
bond_mode_8023ad_conf_get(bond_dev, conf);
return 0;
}
-VERSION_SYMBOL(rte_eth_bond_8023ad_conf_get, _v20, 2.0);
-
-int
-rte_eth_bond_8023ad_conf_get_v1607(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_dev *bond_dev;
-
- if (valid_bonded_port_id(port_id) != 0)
- return -EINVAL;
-
- if (conf == NULL)
- return -EINVAL;
-
- bond_dev = &rte_eth_devices[port_id];
- bond_mode_8023ad_conf_get_v1607(bond_dev, conf);
- return 0;
-}
-VERSION_SYMBOL(rte_eth_bond_8023ad_conf_get, _v1607, 16.07);
-
-int
-rte_eth_bond_8023ad_conf_get_v1708(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_dev *bond_dev;
-
- if (valid_bonded_port_id(port_id) != 0)
- return -EINVAL;
-
- if (conf == NULL)
- return -EINVAL;
-
- bond_dev = &rte_eth_devices[port_id];
- bond_mode_8023ad_conf_get_v1708(bond_dev, conf);
- return 0;
-}
-MAP_STATIC_SYMBOL(int rte_eth_bond_8023ad_conf_get(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf),
- rte_eth_bond_8023ad_conf_get_v1708);
-BIND_DEFAULT_SYMBOL(rte_eth_bond_8023ad_conf_get, _v1708, 17.08);
int
rte_eth_bond_8023ad_agg_selection_set(uint8_t port_id,
@@ -1483,25 +1380,7 @@ bond_8023ad_setup_validate(uint8_t port_id,
}
int
-rte_eth_bond_8023ad_setup_v20(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_dev *bond_dev;
- int err;
-
- err = bond_8023ad_setup_validate(port_id, conf);
- if (err != 0)
- return err;
-
- bond_dev = &rte_eth_devices[port_id];
- bond_mode_8023ad_setup_v20(bond_dev, conf);
-
- return 0;
-}
-VERSION_SYMBOL(rte_eth_bond_8023ad_setup, _v20, 2.0);
-
-int
-rte_eth_bond_8023ad_setup_v1607(uint8_t port_id,
+rte_eth_bond_8023ad_setup(uint8_t port_id,
struct rte_eth_bond_8023ad_conf *conf)
{
struct rte_eth_dev *bond_dev;
@@ -1516,30 +1395,6 @@ rte_eth_bond_8023ad_setup_v1607(uint8_t port_id,
return 0;
}
-VERSION_SYMBOL(rte_eth_bond_8023ad_setup, _v1607, 16.07);
-
-
-int
-rte_eth_bond_8023ad_setup_v1708(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf)
-{
- struct rte_eth_dev *bond_dev;
- int err;
-
- err = bond_8023ad_setup_validate(port_id, conf);
- if (err != 0)
- return err;
-
- bond_dev = &rte_eth_devices[port_id];
- bond_mode_8023ad_setup_v1708(bond_dev, conf);
-
- return 0;
-}
-BIND_DEFAULT_SYMBOL(rte_eth_bond_8023ad_setup, _v1708, 17.08);
-MAP_STATIC_SYMBOL(int rte_eth_bond_8023ad_setup(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf),
- rte_eth_bond_8023ad_setup_v1708);
-
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 1d353c734..d609745e0 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -194,15 +194,6 @@ struct rte_eth_bond_8023ad_slave_info {
int
rte_eth_bond_8023ad_conf_get(uint8_t port_id,
struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_conf_get_v20(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_conf_get_v1607(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_conf_get_v1708(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
/**
* @internal
@@ -218,15 +209,6 @@ rte_eth_bond_8023ad_conf_get_v1708(uint8_t port_id,
int
rte_eth_bond_8023ad_setup(uint8_t port_id,
struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_setup_v20(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_setup_v1607(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
-int
-rte_eth_bond_8023ad_setup_v1708(uint8_t port_id,
- struct rte_eth_bond_8023ad_conf *conf);
/**
* @internal
diff --git a/drivers/net/bonding/rte_eth_bond_version.map b/drivers/net/bonding/rte_eth_bond_version.map
index 0f4e847da..ec3374b0f 100644
--- a/drivers/net/bonding/rte_eth_bond_version.map
+++ b/drivers/net/bonding/rte_eth_bond_version.map
@@ -1,8 +1,6 @@
DPDK_2.0 {
global:
- rte_eth_bond_8023ad_conf_get;
- rte_eth_bond_8023ad_setup;
rte_eth_bond_active_slaves_get;
rte_eth_bond_create;
rte_eth_bond_link_monitoring_set;
@@ -39,8 +37,6 @@ DPDK_16.07 {
rte_eth_bond_8023ad_ext_distrib;
rte_eth_bond_8023ad_ext_distrib_get;
rte_eth_bond_8023ad_ext_slowtx;
- rte_eth_bond_8023ad_conf_get;
- rte_eth_bond_8023ad_setup;
} DPDK_16.04;
--
2.13.3
^ permalink raw reply [relevance 7%]
* [dpdk-dev] [PATCH v6 0/5] increase port_id range
@ 2017-09-29 7:17 4% ` Zhiyong Yang
2017-09-29 7:17 7% ` [dpdk-dev] [PATCH v6 1/5] net/bonding: remove bonding APIs using ABI versioning Zhiyong Yang
` (2 more replies)
0 siblings, 3 replies; 200+ results
From: Zhiyong Yang @ 2017-09-29 7:17 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas
port_id is currently defined as uint8_t, which is limited to the range
0 to 255. A larger range is required for vdev scalability.
It is necessary for a redefinition of port_id to extend it from
1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
be changed at the same time.
Discussion about port_id is the following thread.
http://www.dpdk.org/dev/patchwork/patch/23208/
Changes in V2:
1. cover more PMDs to increase port_id range.
2. cover more examples to increase port_id range.
3. add 17.11 release note.
Changes in V3:
1. cover mlx4 and mlx5.
2. add to increase port_id range in test code.
3. The patch "librte_mbuf: modify port initialization value" is merged
into the patchset.
Changes in V4:
1. Add a patch to remove bonding APIs using ABI versioning according to
Ferruh's comments.
2. Unify to use typedef portid_t in testpmd code.
3. update release note deprecation doc in 2/5
4. fix some issues according to comments.
Changes in V5:
1. For 1/5, bond_mode_8023ad_conf_get_v1708() and bond_mode_8023ad_conf
_get() are merged into one function bond_mode_8023ad_conf_get.
Changes in V6:
1. For 2/5, remove the unnecessary LIBABIVER in Makefile and update
the release notes "Shared Library Versions".
Note: The patchset have dependency on the following patch.
http://www.dpdk.org/dev/patchwork/patch/28738/
http://www.dpdk.org/dev/patchwork/patch/29219/
Note: 3/5 and 4/5 patches' building depends on 2/5 patch since 2/5 patch
breaks lib/PMD API/ABI.
Zhiyong Yang (5):
net/bonding: remove bonding APIs using ABI versioning
ethdev: increase port_id range
examples: increase port_id range
test: increase port_id range
librte_mbuf: modify port initialization value
app/pdump/main.c | 2 +-
app/test-pmd/cmdline.c | 6 +-
app/test-pmd/config.c | 4 +-
app/test-pmd/ieee1588fwd.c | 26 +--
app/test-pmd/parameters.c | 2 +-
app/test-pmd/rxonly.c | 2 +-
app/test-pmd/testpmd.c | 18 +-
app/test-pmd/testpmd.h | 4 +-
doc/guides/rel_notes/deprecation.rst | 6 -
doc/guides/rel_notes/release_17_11.rst | 24 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x_rxtx.h | 4 +-
drivers/net/bnxt/Makefile | 2 +-
drivers/net/bnxt/bnxt.h | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 4 +-
drivers/net/bnxt/bnxt_rxq.h | 2 +-
drivers/net/bnxt/bnxt_txq.h | 2 +-
drivers/net/bnxt/rte_pmd_bnxt.c | 32 +--
drivers/net/bnxt/rte_pmd_bnxt.h | 32 +--
drivers/net/bonding/Makefile | 2 +-
drivers/net/bonding/rte_eth_bond.h | 41 ++--
drivers/net/bonding/rte_eth_bond_8023ad.c | 203 +++--------------
drivers/net/bonding/rte_eth_bond_8023ad.h | 48 ++--
drivers/net/bonding/rte_eth_bond_8023ad_private.h | 12 +-
drivers/net/bonding/rte_eth_bond_alb.c | 6 +-
drivers/net/bonding/rte_eth_bond_alb.h | 6 +-
drivers/net/bonding/rte_eth_bond_api.c | 64 +++---
drivers/net/bonding/rte_eth_bond_args.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 62 +++---
drivers/net/bonding/rte_eth_bond_private.h | 45 ++--
drivers/net/bonding/rte_eth_bond_version.map | 4 -
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/em_rxtx.c | 4 +-
drivers/net/e1000/igb_rxtx.c | 4 +-
drivers/net/failsafe/failsafe_ether.c | 4 +-
drivers/net/failsafe/failsafe_private.h | 4 +-
drivers/net/fm10k/fm10k.h | 6 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/i40e/i40e_ethdev.c | 5 +-
drivers/net/i40e/i40e_rxtx.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.c | 50 ++---
drivers/net/i40e/rte_pmd_i40e.h | 48 ++--
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.h | 4 +-
drivers/net/ixgbe/rte_pmd_ixgbe.c | 60 ++---
drivers/net/ixgbe/rte_pmd_ixgbe.h | 64 +++---
drivers/net/mlx5/mlx5_rxtx.h | 4 +-
drivers/net/nfp/nfp_net.c | 16 +-
drivers/net/nfp/nfp_net_pmd.h | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_if.h | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
drivers/net/thunderx/nicvf_struct.h | 2 +-
drivers/net/vhost/Makefile | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 6 +-
drivers/net/vhost/rte_eth_vhost.h | 4 +-
drivers/net/virtio/virtio_pci.h | 2 +-
drivers/net/virtio/virtio_rxtx.h | 6 +-
drivers/net/vmxnet3/vmxnet3_ring.h | 4 +-
examples/bond/main.c | 16 +-
examples/distributor/main.c | 26 +--
examples/exception_path/main.c | 35 ++-
examples/ip_fragmentation/main.c | 33 +--
examples/ip_pipeline/init.c | 4 +-
examples/ip_reassembly/main.c | 34 +--
examples/ipv4_multicast/main.c | 30 +--
examples/kni/main.c | 30 +--
examples/l2fwd-cat/l2fwd-cat.c | 12 +-
examples/l2fwd-jobstats/main.c | 34 +--
examples/l2fwd-keepalive/main.c | 50 ++---
examples/l2fwd/main.c | 47 ++--
examples/l3fwd-acl/main.c | 9 +-
examples/l3fwd-power/main.c | 60 ++---
examples/l3fwd-vf/main.c | 50 +++--
examples/l3fwd/l3fwd.h | 10 +-
examples/l3fwd/l3fwd_common.h | 2 +-
examples/l3fwd/l3fwd_em.c | 2 +-
examples/l3fwd/l3fwd_em.h | 6 +-
examples/l3fwd/l3fwd_em_hlm.h | 14 +-
examples/l3fwd/l3fwd_lpm.c | 15 +-
examples/l3fwd/l3fwd_lpm.h | 4 +-
examples/l3fwd/l3fwd_lpm_neon.h | 4 +-
examples/l3fwd/l3fwd_lpm_sse.h | 4 +-
examples/l3fwd/main.c | 30 +--
examples/link_status_interrupt/main.c | 9 +-
examples/load_balancer/config.c | 14 +-
examples/load_balancer/init.c | 34 ++-
examples/load_balancer/main.h | 11 +-
examples/load_balancer/runtime.c | 12 +-
.../client_server_mp/mp_client/client.c | 17 +-
.../client_server_mp/mp_server/args.c | 4 +-
.../client_server_mp/mp_server/args.h | 2 +-
.../client_server_mp/mp_server/init.c | 11 +-
.../client_server_mp/mp_server/main.c | 2 +-
.../multi_process/client_server_mp/shared/common.h | 4 +-
examples/multi_process/l2fwd_fork/main.c | 23 +-
examples/netmap_compat/lib/compat_netmap.c | 52 +++--
examples/netmap_compat/lib/compat_netmap.h | 2 +-
examples/packet_ordering/main.c | 19 +-
examples/performance-thread/l3fwd-thread/main.c | 143 ++++++------
examples/ptpclient/ptpclient.c | 4 +-
examples/qos_sched/args.c | 12 +-
examples/qos_sched/init.c | 31 +--
examples/qos_sched/main.c | 14 +-
examples/qos_sched/main.h | 24 +-
examples/qos_sched/stats.c | 16 +-
examples/quota_watermark/qw/init.c | 4 +-
examples/quota_watermark/qw/main.c | 10 +-
examples/rxtx_callbacks/main.c | 8 +-
examples/server_node_efd/server/main.c | 2 +-
examples/server_node_efd/shared/common.h | 4 +-
examples/skeleton/basicfwd.c | 12 +-
examples/vhost/main.c | 10 +-
lib/librte_bitratestats/Makefile | 2 +-
lib/librte_bitratestats/rte_bitrate.c | 2 +-
lib/librte_bitratestats/rte_bitrate.h | 2 +-
lib/librte_ether/Makefile | 2 +-
lib/librte_ether/rte_ethdev.c | 241 +++++++++++----------
lib/librte_ether/rte_ethdev.h | 238 ++++++++++----------
lib/librte_ether/rte_flow.c | 2 +-
lib/librte_ether/rte_flow_driver.h | 2 +-
lib/librte_ether/rte_tm.c | 62 +++---
lib/librte_ether/rte_tm.h | 60 ++---
lib/librte_ether/rte_tm_driver.h | 2 +-
lib/librte_kni/rte_kni.h | 6 +-
lib/librte_latencystats/rte_latencystats.c | 12 +-
lib/librte_mbuf/rte_mbuf.c | 2 +-
lib/librte_mbuf/rte_mbuf.h | 4 +-
lib/librte_pdump/Makefile | 2 +-
lib/librte_pdump/rte_pdump.c | 16 +-
lib/librte_pdump/rte_pdump.h | 4 +-
lib/librte_port/rte_port_ethdev.c | 6 +-
lib/librte_port/rte_port_ethdev.h | 6 +-
test/test/test_kni.c | 12 +-
test/test/test_link_bonding.c | 40 ++--
test/test/test_link_bonding_mode4.c | 12 +-
test/test/test_pmd_perf.c | 30 +--
test/test/test_pmd_ring_perf.c | 2 +-
test/test/virtual_pmd.c | 24 +-
test/test/virtual_pmd.h | 28 +--
145 files changed, 1394 insertions(+), 1499 deletions(-)
--
2.13.3
^ permalink raw reply [relevance 4%]
* [dpdk-dev] [PATCH v5 0/3] ethdev new offloads API
@ 2017-09-28 18:54 4% ` Shahaf Shuler
2017-10-04 8:17 4% ` [dpdk-dev] [PATCH v6 0/4] " Shahaf Shuler
0 siblings, 1 reply; 200+ results
From: Shahaf Shuler @ 2017-09-28 18:54 UTC (permalink / raw)
To: ferruh.yigit, thomas; +Cc: arybchenko, konstantin.ananyev, jerin.jacob, dev
Tx offloads configuration is per queue. Tx offloads are enabled by default,
and can be disabled using ETH_TXQ_FLAGS_NO* flags.
This behaviour is not consistent with the Rx side where the Rx offloads
configuration is per port. Rx offloads are disabled by default and enabled
according to bit field in rte_eth_rxmode structure.
Moreover, considering more Tx and Rx offloads will be added
over time, the cost of managing them all inside the PMD will be tremendous,
as the PMD will need to check the matching for the entire offload set
for each mbuf it handles.
In addition, on the current approach each Rx offload added breaks the
ABI compatibility as it requires to add entries to existing bit-fields.
The series address above issues by defining a new offloads API.
In the new API, offloads are divided into per-port and per-queue offloads,
with a corresponding capability for each.
The offloads are disabled by default. Each offload can be enabled or
disabled using the existing DEV_TX_OFFLOADS_* or DEV_RX_OFFLOADS_* flags.
Such API will enable to easily add or remove offloads, without breaking the
ABI compatibility.
In order to provide a smooth transition between the APIs the following actions
were taken:
* The old offloads API is kept for the meanwhile.
* Helper function which copy from old to new API were added to ethdev,
enabling the PMD to support only one of the APIs.
* Helper function which copy from new to old API were also added,
to enable application to use the new API with PMD which still supports
the old one.
Per discussion made on the RFC of this series [1], the integration plan which was
decided is to do the transition in two phases:
* ethdev API will move on 17.11.
* Apps and examples will move on 18.02.
This to enable PMD maintainers sufficient time to adopt the new API.
[1]
http://dpdk.org/ml/archives/dev/2017-August/072643.html
on v5:
- fix documentation.
- fix comments on port offloads configuration.
on v4:
- Added another patch for documentation.
- Fixed ETH_TXQ_FLAGS_IGNORE flag override.
- clarify the description of DEV_TX_OFFLOAD_MBUF_FAST_FREE offload.
on v3:
- Introduce the DEV_TX_OFFLOAD_MBUF_FAST_FREE to act as an equivalent
for the no refcnt and single mempool flags.
- Fix features documentation.
- Fix comment style.
on v2:
- Taking new approach of dividing offloads into per-queue and per-port one.
- Postpone the Tx/Rx public struct renaming to 18.02
- squash the helper functions into the Rx/Tx offloads intro patches.
Shahaf Shuler (3):
ethdev: introduce Rx queue offloads API
ethdev: introduce Tx queue offloads API
doc: add details on ethdev offloads API
doc/guides/nics/features.rst | 66 +++++---
doc/guides/prog_guide/poll_mode_drv.rst | 20 +++
lib/librte_ether/rte_ethdev.c | 223 +++++++++++++++++++++++++--
lib/librte_ether/rte_ethdev.h | 89 ++++++++++-
4 files changed, 358 insertions(+), 40 deletions(-)
Series-reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
--
2.12.0
^ permalink raw reply [relevance 4%]
* Re: [dpdk-dev] DPDK Community Survey 2017
@ 2017-09-28 13:58 3% ` Kevin Traynor
0 siblings, 0 replies; 200+ results
From: Kevin Traynor @ 2017-09-28 13:58 UTC (permalink / raw)
To: Jain, Deepak K, dev, users; +Cc: Thomas Monjalon
On 09/22/2017 11:47 AM, Jain, Deepak K wrote:
> Hi All,
>
> As part of our ongoing efforts to improve DPDK, we'd like to hear your feedback!
>
> We have created a number of DPDK-related questions here.
>
> https://www.surveymonkey.com/r/DPDK_Community_Survey_2017
>
> and want to hear your views!!
>
> The survey will close at midnight GMT on Sunday October 1st, 2017.
>
> Thanks in advance for your feedback - the more responses we get the more data we have to drive further features, improvements, etc.
>
> So please respond!!!
>
> Regards
> Deepak
>
>
>
Hi Deepak,
Thanks for the survey, I hope people will take the time to fill it out -
it was a recurring theme of the conference over the last few days that
more user input is needed. I'm not suggesting a survey on the survey ;-)
but a few comments below. Just my $0.02.
The deadline is really short - I'm not sure why the rush.
Some questions are for users and some for devs. Probably should note
that in the intro, so devs hang in there until the relevant questions.
Q5, I don't think it's a good idea to use radio buttons here, as a user
may have multiple applications. It would also be good to ask the stage
of applications. i.e. poc, development, product
Q10/Q12. I'm not sure if users of OVS will know under the hood if
OVS uses vhost pmd and vhost lib (it only uses vhost lib). You could
probably extrapolate from a combination of other answers, but anyway
both answers indicate vhost lib is being used and maybe that's good
enough info.
Q13. There should be an additional question on hardware generation. We
see hardware deprecation sometimes for older hardware, so need to ask
users which hardware generations they are using.
Q14. Probably this Q should allow multiple selections also.
Q15. It would be interesting to combine the kernels from the choices in
this question with the usage of KNI, igb_uio etc.
Q16. Does "usability of API", include release to release stability, or
just how easy it is to program against? I think maybe another option is
needed.
Q17. Typical trade offs between good and optimal performance should be
listed. Otherwise, why would anyone not say optimal. For example, things
like older hardware support, API/ABI stability etc. I'm sure there's others.
thanks,
Kevin.
^ permalink raw reply [relevance 3%]
* [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h
2017-09-28 13:55 2% ` [dpdk-dev] [PATCH v2 " Jianfeng Tan
@ 2017-09-28 13:55 2% ` Jianfeng Tan
2017-10-05 13:13 0% ` Jan Blunck
0 siblings, 1 reply; 200+ results
From: Jianfeng Tan @ 2017-09-28 13:55 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, konstantin.ananyev, pablo.de.lara.guarch,
thomas, yliu, maxime.coquelin, mtetsuyah, ferruh.yigit,
Jianfeng Tan
The helper API, rte_cryptodev_vdev_pmd_init(), has a parameter of
struct rte_vdev_device *, which needs to include rte_vdev.h.
We will move vdev into drivers/bus, so we need to avoid such
dependency. And also, we cannot break the ABI.
This patch changes that pointer to void *, and defines an internal
structure same with struct rte_vdev_device.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
lib/librte_cryptodev/rte_cryptodev_pmd.c | 9 +-
lib/librte_cryptodev/rte_cryptodev_vdev.c | 161 ++++++++++++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev_vdev.h | 3 +-
3 files changed, 169 insertions(+), 4 deletions(-)
create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.c
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index a57faad..60b3980 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -75,9 +75,14 @@ rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
return 0;
}
+struct vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next;
+ struct rte_device device;
+};
+
struct rte_cryptodev *
rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev)
+ int socket_id, void *vdev)
{
struct rte_cryptodev *cryptodev;
@@ -99,7 +104,7 @@ rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
" data");
}
- cryptodev->device = &vdev->device;
+ cryptodev->device = &((struct vdev_device *)vdev)->device;
/* initialise user call-back tail queue */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.c b/lib/librte_cryptodev/rte_cryptodev_vdev.c
new file mode 100644
index 0000000..4af8d51
--- /dev/null
+++ b/lib/librte_cryptodev/rte_cryptodev_vdev.c
@@ -0,0 +1,161 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/queue.h>
+
+#include "rte_cryptodev_vdev.h"
+#include "rte_cryptodev_pci.h"
+#include "rte_cryptodev_pmd.h"
+
+/**
+ * Parse name from argument
+ */
+static int
+rte_cryptodev_vdev_parse_name_arg(const char *key __rte_unused,
+ const char *value, void *extra_args)
+{
+ struct rte_crypto_vdev_init_params *params = extra_args;
+
+ if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
+ CDEV_LOG_ERR("Invalid name %s, should be less than "
+ "%u bytes", value,
+ RTE_CRYPTODEV_NAME_MAX_LEN - 1);
+ return -1;
+ }
+
+ strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
+
+ return 0;
+}
+
+/**
+ * Parse integer from argument
+ */
+static int
+rte_cryptodev_vdev_parse_integer_arg(const char *key __rte_unused,
+ const char *value, void *extra_args)
+{
+ int *i = extra_args;
+
+ *i = atoi(value);
+ if (*i < 0) {
+ CDEV_LOG_ERR("Argument has to be positive.");
+ return -1;
+ }
+
+ return 0;
+}
+
+struct vdev_device {
+ TAILQ_ENTRY(rte_vdev_device) next;
+ struct rte_device device;
+};
+
+struct rte_cryptodev *
+rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
+ int socket_id, void *vdev)
+{
+ struct rte_cryptodev *cryptodev;
+
+ /* allocate device structure */
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
+ if (cryptodev == NULL)
+ return NULL;
+
+ /* allocate private device structure */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ cryptodev->data->dev_private =
+ rte_zmalloc_socket("cryptodev device private",
+ dev_private_size,
+ RTE_CACHE_LINE_SIZE,
+ socket_id);
+
+ if (cryptodev->data->dev_private == NULL)
+ rte_panic("Cannot allocate memzone for private device"
+ " data");
+ }
+
+ cryptodev->device = &((struct vdev_device *)vdev)->device;
+
+ /* initialise user call-back tail queue */
+ TAILQ_INIT(&(cryptodev->link_intr_cbs));
+
+ return cryptodev;
+}
+
+int
+rte_cryptodev_vdev_parse_init_params(struct rte_crypto_vdev_init_params *params,
+ const char *input_args)
+{
+ struct rte_kvargs *kvlist = NULL;
+ int ret = 0;
+
+ if (params == NULL)
+ return -EINVAL;
+
+ if (input_args) {
+ kvlist = rte_kvargs_parse(input_args,
+ cryptodev_vdev_valid_params);
+ if (kvlist == NULL)
+ return -1;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
+ &rte_cryptodev_vdev_parse_integer_arg,
+ ¶ms->max_nb_queue_pairs);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist,
+ RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
+ &rte_cryptodev_vdev_parse_integer_arg,
+ ¶ms->max_nb_sessions);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_SOCKET_ID,
+ &rte_cryptodev_vdev_parse_integer_arg,
+ ¶ms->socket_id);
+ if (ret < 0)
+ goto free_kvlist;
+
+ ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_NAME,
+ &rte_cryptodev_vdev_parse_name_arg,
+ params);
+ if (ret < 0)
+ goto free_kvlist;
+ }
+
+free_kvlist:
+ rte_kvargs_free(kvlist);
+ return ret;
+}
diff --git a/lib/librte_cryptodev/rte_cryptodev_vdev.h b/lib/librte_cryptodev/rte_cryptodev_vdev.h
index 94ab9d3..1142d1d 100644
--- a/lib/librte_cryptodev/rte_cryptodev_vdev.h
+++ b/lib/librte_cryptodev/rte_cryptodev_vdev.h
@@ -33,7 +33,6 @@
#ifndef _RTE_CRYPTODEV_VDEV_H_
#define _RTE_CRYPTODEV_VDEV_H_
-#include <rte_vdev.h>
#include <inttypes.h>
#include "rte_cryptodev.h"
@@ -80,7 +79,7 @@ struct rte_crypto_vdev_init_params {
*/
struct rte_cryptodev *
rte_cryptodev_vdev_pmd_init(const char *name, size_t dev_private_size,
- int socket_id, struct rte_vdev_device *vdev);
+ int socket_id, void *vdev);
/**
* @internal
--
2.7.4
^ permalink raw reply [relevance 2%]
* [dpdk-dev] [PATCH v2 00/12] support to run vdev in the secondary process
@ 2017-09-28 13:55 2% ` Jianfeng Tan
2017-09-28 13:55 2% ` [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h Jianfeng Tan
0 siblings, 1 reply; 200+ results
From: Jianfeng Tan @ 2017-09-28 13:55 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, konstantin.ananyev, pablo.de.lara.guarch,
thomas, yliu, maxime.coquelin, mtetsuyah, ferruh.yigit,
Jianfeng Tan
v2:
- Address Gaetan's comment in patch 2.
- Add RTE_LOGTYPE_BUS suggested by Gaetan.
- Don't moving crypto vdev into drivers/bus/vdev, instead we use a
new way (details in patch 3) which may break the ABI (the
validate_abi.sh report a low warning of "Problems with Symbols").
- Rename CONFIG_RTE_LIBRTE_VDEV to CONFIG_RTE_LIBRTE_VDEV_BUS.
- Return error if there's an existing action for an action name.
- Redefine rte_eal_primary_secondary_t as func pointer, and change
the first parameter type to avoid explicit type casting.
- Handle the case for vhost "primary - VM - secondary" sequence.
- Fix a bug in recv multiple messages as one message.
- Fix a bug of get vid of -1 in secondary process.
- Remove the modification on helloworld example, instead we use
symmetric_mp as the test case.
- Address yuanhan's comment on code refactor on mp channel.
Patch 1~6: move vdev bus into drivers/bus.
Patch 7: add unix socket channel for primary/secondary communication.
Patch 8~9: make use of the channel to discover and probe virtual devices
the primary process.
Patch 10~12: support to run vhost-pmd in the secondary process.
How to test:
Step 1: run symmetric_mp as the primary process.
$ ./symmetric_mp -c 2 --proc-type=auto ... \
--vdev 'net_vhost0,iface=/tmp/sock1,queues=2' \
--vdev 'net_vhost1,iface=/tmp/sock2,queues=2' \
-- -p 3 --num-procs=2 --proc-id=0
Step 2: run testpmd as the secondary process.
$ ./symmetric_mp -c 4 --proc-type=auto -- -p 3 --num-procs=2 --proc-id=1
Step 3: start VM1.
$ ./qemu-system-x86_64 ... -chardev socket,id=chr1,path=/tmp/sock1 \
-netdev type=vhost-user,id=net1,chardev=chr1,vhostforce,queues=2 \
-device virtio-net-pci,netdev=net1,mq=on,vectors=6 ...
Step 4: start VM2.
$ ./qemu-system-x86_64 ... -chardev socket,id=chr1,path=/tmp/sock2 \
-netdev type=vhost-user,id=net1,chardev=chr1,vhostforce,queues=2 \
-device virtio-net-pci,netdev=net1,mq=on,vectors=6 ...
Step 5: enable multi queue in VM1 and VM2.
$ ethtool -L ethX combined 2
Note in this test case, only queue 1, i.e., secondary process can process
packets. To use queue 1, basically, we can run command like:
$ taskset -c 1 <commands>
Jianfeng Tan (12):
cryptodev: remove crypto vdev init API
eal: avoid calling rte_vdev_init()
cryptodev: avoid dependency on rte_vdev.h
bus/fslmc: introduce RTE_LOGTYPE_BUS for bus drivers
bus/vdev: move to vdev bus to drivers/bus
bus/vdev: normalize log type
eal: add channel for primary/secondary communication
bus/vdev: scan and probe vdev in secondary processes
ethdev: support attach vdev in secondary process
vhost: allocate virtio_net in memzone
vhost: support to kick in secondary process
net/vhost: support to run in the secondary process
config/common_base | 5 +
doc/guides/rel_notes/deprecation.rst | 5 -
drivers/bus/Makefile | 2 +
drivers/bus/fslmc/fslmc_bus.c | 5 +-
drivers/bus/fslmc/fslmc_logs.h | 42 +-
drivers/bus/fslmc/fslmc_vfio.c | 4 +-
drivers/bus/vdev/Makefile | 55 +++
drivers/bus/vdev/rte_bus_vdev_version.map | 10 +
drivers/bus/vdev/rte_vdev.h | 153 ++++++++
drivers/bus/vdev/vdev.c | 440 +++++++++++++++++++++
drivers/bus/vdev/vdev_logs.h | 40 ++
drivers/net/vhost/rte_eth_vhost.c | 200 +++++++++-
lib/librte_cryptodev/rte_cryptodev.c | 6 -
lib/librte_cryptodev/rte_cryptodev.h | 18 -
lib/librte_cryptodev/rte_cryptodev_pmd.c | 9 +-
lib/librte_cryptodev/rte_cryptodev_vdev.c | 161 ++++++++
lib/librte_cryptodev/rte_cryptodev_vdev.h | 3 +-
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
lib/librte_eal/bsdapp/eal/Makefile | 1 -
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 21 +-
lib/librte_eal/common/eal_common_log.c | 1 +
lib/librte_eal/common/eal_common_proc.c | 498 ++++++++++++++++++++++++
lib/librte_eal/common/eal_common_vdev.c | 342 ----------------
lib/librte_eal/common/eal_filesystem.h | 18 +
lib/librte_eal/common/eal_private.h | 10 +
lib/librte_eal/common/include/rte_dev.h | 24 +-
lib/librte_eal/common/include/rte_eal.h | 68 ++++
lib/librte_eal/common/include/rte_log.h | 1 +
lib/librte_eal/common/include/rte_vdev.h | 131 -------
lib/librte_eal/linuxapp/eal/Makefile | 1 -
lib/librte_eal/linuxapp/eal/eal.c | 6 +
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
lib/librte_ether/rte_ethdev_vdev.h | 26 +-
lib/librte_vhost/rte_vhost.h | 3 +
lib/librte_vhost/rte_vhost_version.map | 7 +
lib/librte_vhost/socket.c | 2 +
lib/librte_vhost/vhost.c | 71 +++-
lib/librte_vhost/vhost.h | 7 +-
lib/librte_vhost/vhost_user.c | 17 +-
mk/rte.app.mk | 1 +
42 files changed, 1799 insertions(+), 634 deletions(-)
create mode 100644 drivers/bus/vdev/Makefile
create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map
create mode 100644 drivers/bus/vdev/rte_vdev.h
create mode 100644 drivers/bus/vdev/vdev.c
create mode 100644 drivers/bus/vdev/vdev_logs.h
create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.7.4
^ permalink raw reply [relevance 2%]
* [dpdk-dev] [PATCH v3 13/13] doc: add notes on EAL PCI API update
@ 2017-09-25 15:24 4% ` Gaetan Rivet
1 sibling, 0 replies; 200+ results
From: Gaetan Rivet @ 2017-09-25 15:24 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add a section related to EAL API changes to 17.11 release notes.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 8bf91bd..d5546ba 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -130,6 +130,34 @@ API Changes
* Rework start and stop APIs into ``rte_service_runstate_set``
* Added API to set runstate of service implementation to indicate readyness
+* **PCI bus API moved outside of the EAL**
+
+ The PCI bus previously implemented within the EAL has been moved.
+ A first part has been added as an RTE library providing PCI helpers to
+ parse device locations or other such utilities.
+ A second part consisting in the actual bus driver has been moved to its
+ proper subdirectory, without changing its functionalities.
+
+ As such, several PCI-related functions are not proposed by the EAL anymore:
+
+ * rte_pci_detach
+ * rte_pci_dump
+ * rte_pci_ioport_map
+ * rte_pci_ioport_read
+ * rte_pci_ioport_unmap
+ * rte_pci_ioport_write
+ * rte_pci_map_device
+ * rte_pci_probe
+ * rte_pci_probe_one
+ * rte_pci_read_config
+ * rte_pci_register
+ * rte_pci_scan
+ * rte_pci_unmap_device
+ * rte_pci_unregister
+ * rte_pci_write_config
+
+ These functions are made available either as part of ``librte_pci`` or
+ ``librte_bus_pci``.
ABI Changes
-----------
--
2.1.4
^ permalink raw reply [relevance 4%]
Results 10401-10600 of ~18000 next (older) | prev (newer) | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2016-11-16 16:23 [dpdk-dev] [PATCH 00/22] Generic flow API (rte_flow) Adrien Mazarguil
2016-12-16 16:24 ` [dpdk-dev] [PATCH v2 00/25] " Adrien Mazarguil
2016-12-16 16:24 ` [dpdk-dev] [PATCH v2 01/25] ethdev: introduce generic flow API Adrien Mazarguil
2017-10-23 8:53 0% ` Zhao1, Wei
2017-05-15 19:57 [dpdk-dev] [PATCH] test/crypto: remove crypto perf tests Pablo de Lara
2017-10-04 6:48 1% ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2017-08-12 10:22 [dpdk-dev] [PATCH] eal: bus scan and probe never fail Shreyansh Jain
2017-10-05 23:21 ` Thomas Monjalon
2017-10-06 13:12 ` Shreyansh Jain
2017-10-06 13:37 ` Thomas Monjalon
2017-10-06 17:34 ` Jan Blunck
2017-10-09 11:10 ` Shreyansh Jain
2017-10-09 18:21 ` Don Provan
2017-10-10 5:00 ` Shreyansh Jain
2017-10-10 16:00 3% ` Aaron Conole
2017-10-11 22:34 0% ` Thomas Monjalon
2017-10-12 13:08 0% ` Aaron Conole
2017-10-12 5:39 0% ` Shreyansh Jain
2017-10-12 13:20 0% ` Aaron Conole
2017-08-14 15:15 [dpdk-dev] [PATCH v1 0/4] make dpdk iova aware Santosh Shukla
2017-11-06 1:41 2% ` [dpdk-dev] [PATCH v4 00/15] make DPDK IOVA aware Thomas Monjalon
2017-11-06 1:41 10% ` [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes Thomas Monjalon
2017-11-06 5:56 0% ` santosh
2017-11-06 8:50 0% ` Mcnamara, John
2017-08-22 16:24 [dpdk-dev] [PATCH v2] vhost: added user callbacks for socket open/close Dariusz Stojaczyk
2017-08-30 10:50 ` [dpdk-dev] [PATCH v3] rte_vhost: " Dariusz Stojaczyk
2017-10-10 3:14 0% ` Yuanhan Liu
2017-08-25 9:40 [dpdk-dev] [PATCH 00/12] support to run vdev in the secondary process Jianfeng Tan
2017-09-28 13:55 2% ` [dpdk-dev] [PATCH v2 " Jianfeng Tan
2017-09-28 13:55 2% ` [dpdk-dev] [PATCH v2 03/12] cryptodev: avoid dependency on rte_vdev.h Jianfeng Tan
2017-10-05 13:13 0% ` Jan Blunck
2017-10-09 1:04 0% ` Tan, Jianfeng
2017-08-25 13:46 [dpdk-dev] [RFC] Wireless Base Band Device (bbdev) Amr Mokhtar
2017-09-21 14:56 ` Thomas Monjalon
2017-10-03 14:29 0% ` Mokhtar, Amr
2017-10-03 15:17 4% ` Thomas Monjalon
2017-10-04 17:11 0% ` Flavio Leitner
2017-10-05 21:55 0% ` Mokhtar, Amr
2017-10-05 22:22 0% ` Thomas Monjalon
2017-10-06 23:27 0% ` Mokhtar, Amr
2017-10-07 11:42 0% ` Thomas Monjalon
2017-08-25 16:07 [dpdk-dev] [PATCH 0/6] devargs cleanup Gaetan Rivet
2017-10-12 8:21 ` [dpdk-dev] [PATCH v2 00/18] " Gaetan Rivet
2017-10-12 8:21 10% ` [dpdk-dev] [PATCH v2 18/18] doc: remove devargs deprecation notices Gaetan Rivet
2017-10-17 18:18 ` [dpdk-dev] [PATCH v2 00/18] devargs cleanup Aaron Conole
2017-10-18 8:36 4% ` Gaëtan Rivet
2017-08-26 0:06 [dpdk-dev] [PATCH 1/3] ethdev: add new eth_dev_ops function for mtr ops get Cristian Dumitrescu
2017-10-05 13:09 ` [dpdk-dev] [PATCH V2 0/5] rte_mtr: generic ethdev api for metering and policing Cristian Dumitrescu
2017-10-05 13:09 1% ` [dpdk-dev] [PATCH V2 3/5] ethdev: add new api for traffic " Cristian Dumitrescu
2017-09-01 2:36 [dpdk-dev] [PATCH v4] ethdev: allow returning error on VLAN offload configuration David Harton
2017-10-25 3:01 4% ` [dpdk-dev] [PATCH v5] ethdev: allow returning error on VLAN offload ops Ferruh Yigit
2017-09-05 10:31 [dpdk-dev] [PATCH v2 0/5] make dpdk iova aware Santosh Shukla
2017-10-20 12:31 ` [dpdk-dev] [PATCH v3 0/6] " Santosh Shukla
2017-10-20 12:31 ` [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types Santosh Shukla
2017-11-03 11:11 4% ` Thomas Monjalon
2017-11-03 11:35 0% ` santosh
2017-11-03 13:58 0% ` Thomas Monjalon
2017-11-03 15:22 0% ` [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iovatypes Jonas Pfefferle1
2017-10-20 12:31 15% ` [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice Santosh Shukla
2017-10-23 20:29 0% ` Thomas Monjalon
2017-10-24 5:06 0% ` santosh
2017-10-25 9:45 0% ` Thomas Monjalon
2017-10-25 9:50 3% ` Richardson, Bruce
2017-10-25 10:01 3% ` Thomas Monjalon
2017-10-25 10:05 4% ` Bruce Richardson
2017-10-25 10:12 0% ` Thomas Monjalon
2017-10-25 10:32 0% ` Bruce Richardson
2017-09-12 15:06 [dpdk-dev] [PATCH 1/2] reorder: fix ready buffers not being nulled out Pavan Nikhilesh
2017-10-12 8:32 3% ` Bruce Richardson
2017-09-13 10:44 [dpdk-dev] [PATCH v2 1/4] lib/librte_power: add turbo boost API David Hunt
2017-10-03 14:08 3% ` [dpdk-dev] [PATCH v3 0/9] Policy Based Power Control for Guest David Hunt
2017-10-11 16:18 2% ` [dpdk-dev] [PATCH v9 " David Hunt
2017-10-12 0:23 0% ` Ferruh Yigit
2017-09-14 14:55 [dpdk-dev] [PATCH] ethdev: fix LIBABIVER Ferruh Yigit
2017-09-27 2:06 ` Yang, Zhiyong
2017-10-04 21:54 3% ` Thomas Monjalon
2017-09-15 13:41 [dpdk-dev] [PATCH] doc: add note on hardware support deprecation Bruce Richardson
2017-09-18 13:59 ` [dpdk-dev] [PATCH v2] " Bruce Richardson
2017-10-13 20:46 0% ` Thomas Monjalon
2017-09-17 6:54 [dpdk-dev] [PATCH v4 0/3] ethdev new offloads API Shahaf Shuler
2017-09-28 18:54 4% ` [dpdk-dev] [PATCH v5 " Shahaf Shuler
2017-10-04 8:17 4% ` [dpdk-dev] [PATCH v6 0/4] " Shahaf Shuler
2017-10-04 16:12 0% ` Ananyev, Konstantin
2017-10-05 0:55 0% ` Ferruh Yigit
2017-09-18 9:31 [dpdk-dev] [PATCH v2 00/14] Move PCI away from the EAL Gaetan Rivet
2017-09-25 15:23 ` [dpdk-dev] [PATCH v3 00/13] " Gaetan Rivet
2017-09-25 15:24 4% ` [dpdk-dev] [PATCH v3 13/13] doc: add notes on EAL PCI API update Gaetan Rivet
2017-10-12 8:17 ` [dpdk-dev] [PATCH v4 00/16] Move PCI away from the EAL Gaetan Rivet
2017-10-12 8:17 4% ` [dpdk-dev] [PATCH v4 16/16] doc: add notes on EAL PCI API update Gaetan Rivet
2017-10-12 10:45 ` [dpdk-dev] [PATCH v5 00/20] Move PCI away from the EAL Gaetan Rivet
2017-10-12 10:45 4% ` [dpdk-dev] [PATCH v5 19/20] doc: add notes on EAL PCI API update Gaetan Rivet
2017-10-25 22:38 ` [dpdk-dev] [PATCH v7 00/25] Move PCI away from the EAL Gaetan Rivet
2017-10-25 22:38 4% ` [dpdk-dev] [PATCH v7 24/25] doc: add notes on EAL PCI API update Gaetan Rivet
2017-10-26 10:05 ` [dpdk-dev] [PATCH v8 00/25] Move PCI away from the EAL Gaetan Rivet
2017-10-26 10:06 4% ` [dpdk-dev] [PATCH v8 24/25] doc: add notes on EAL PCI API update Gaetan Rivet
2017-09-20 9:12 [dpdk-dev] [PATCH v4] devtools: rework abi checker script Olivier Matz
2017-10-05 7:53 27% ` [dpdk-dev] [PATCH v5] " Olivier Matz
2017-10-05 13:15 4% ` Neil Horman
2017-11-07 23:24 4% ` Thomas Monjalon
2017-09-20 14:32 [dpdk-dev] [PATCH v3 0/6] net/i40e: implement dynamic mapping of flow types to pctypes Kirill Rybalchenko
2017-10-02 15:08 ` [dpdk-dev] [PATCH v4 0/5] " Kirill Rybalchenko
2017-10-02 15:08 3% ` [dpdk-dev] [PATCH v4 2/5] net/i40e: implement dynamic mapping of sw flow types to hw pctypes Kirill Rybalchenko
2017-10-04 12:52 ` [dpdk-dev] [PATCH v5 0/5] net/i40e: implement dynamic mapping of flow types to pctypes Kirill Rybalchenko
2017-10-04 12:52 3% ` [dpdk-dev] [PATCH v5 2/5] net/i40e: implement dynamic mapping of sw flow types to hw pctypes Kirill Rybalchenko
2017-09-22 10:47 [dpdk-dev] DPDK Community Survey 2017 Jain, Deepak K
2017-09-28 13:58 3% ` Kevin Traynor
2017-09-25 3:22 [dpdk-dev] [PATCH v5 0/5] increase port_id range Zhiyong Yang
2017-09-29 7:17 4% ` [dpdk-dev] [PATCH v6 " Zhiyong Yang
2017-09-29 7:17 7% ` [dpdk-dev] [PATCH v6 1/5] net/bonding: remove bonding APIs using ABI versioning Zhiyong Yang
2017-09-29 7:17 1% ` [dpdk-dev] [PATCH v6 2/5] ethdev: increase port_id range Zhiyong Yang
2017-10-06 2:15 0% ` [dpdk-dev] [PATCH v6 0/5] " Ferruh Yigit
2017-10-06 13:31 0% ` Gaëtan Rivet
2017-10-06 14:29 0% ` Thomas Monjalon
2017-10-06 16:02 0% ` Thomas Monjalon
2017-10-11 21:21 0% ` Ferruh Yigit
2017-10-12 1:33 0% ` Yang, Zhiyong
2017-09-25 12:27 [dpdk-dev] [PATCH v2] Policy Based Power Control for Guest David Hunt
2017-10-04 9:15 3% ` [dpdk-dev] [PATCH v4] " David Hunt
2017-10-04 15:25 2% ` [dpdk-dev] [PATCH v5 0/9] " David Hunt
2017-10-05 12:25 2% ` [dpdk-dev] [PATCH v6 " David Hunt
2017-10-05 13:28 2% ` [dpdk-dev] [PATCH v7 " David Hunt
2017-10-05 13:54 0% ` Ananyev, Konstantin
2017-10-05 14:34 2% ` [dpdk-dev] [PATCH v8 " David Hunt
2017-10-09 22:34 0% ` Ferruh Yigit
2017-09-28 2:17 [dpdk-dev] [PATCH v4 0/8] GPT-C and GTP-U enabling Beilei Xing
2017-09-29 5:18 ` [dpdk-dev] [PATCH v6 " Beilei Xing
2017-09-29 5:18 ` [dpdk-dev] [PATCH v6 4/8] ethdev: add GTP items to support flow API Beilei Xing
2017-09-29 8:15 ` Sean Harte
2017-09-29 8:54 ` Xing, Beilei
2017-09-29 9:29 ` Sean Harte
2017-10-02 12:27 ` Adrien Mazarguil
2017-10-03 8:56 ` Sean Harte
2017-10-05 8:06 ` Wu, Jingjing
2017-10-05 8:30 3% ` Adrien Mazarguil
2017-10-05 8:39 0% ` Wu, Jingjing
2017-10-02 12:20 [dpdk-dev] [PATCH] lib/power: add turbo functions to version.map David Hunt
2017-10-02 14:55 ` Thomas Monjalon
2017-10-02 15:06 ` Hunt, David
2017-10-02 15:39 ` Thomas Monjalon
2017-10-02 16:25 3% ` Hunt, David
2017-10-02 16:52 0% ` Thomas Monjalon
2017-10-03 14:59 [dpdk-dev] [PATCH v5 0/3] run-time Linking support Xiaoyun Li
2017-10-04 22:58 ` [dpdk-dev] [PATCH v6 " Xiaoyun Li
2017-10-04 22:58 ` [dpdk-dev] [PATCH v6 1/3] eal/x86: run-time dispatch over memcpy Xiaoyun Li
2017-10-05 9:37 ` Ananyev, Konstantin
2017-10-05 11:19 ` Li, Xiaoyun
2017-10-05 11:26 3% ` Richardson, Bruce
2017-10-05 9:49 [dpdk-dev] [PATCH v1 0/7] Flow API helpers enhancements Adrien Mazarguil
2017-10-05 9:49 ` [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper Adrien Mazarguil
2017-10-11 9:23 ` Thomas Monjalon
2017-10-11 11:56 5% ` Adrien Mazarguil
2017-10-11 19:05 5% ` Aaron Conole
2017-10-12 13:37 4% ` Neil Horman
2017-10-12 14:02 5% ` Adrien Mazarguil
2017-10-05 13:09 [dpdk-dev] [PATCH V2 1/5] ethdev: add new flow action for metering and policing Cristian Dumitrescu
2017-10-06 14:45 ` [dpdk-dev] [PATCH V3 0/5] rte_mtr: generic ethdev api " Cristian Dumitrescu
2017-10-06 14:45 1% ` [dpdk-dev] [PATCH V3 3/5] ethdev: add new api for traffic " Cristian Dumitrescu
2017-10-06 14:45 [dpdk-dev] [PATCH V3 1/5] ethdev: add new flow action for " Cristian Dumitrescu
2017-10-13 12:22 ` [dpdk-dev] [PATCH V4 0/5] rte_mtr: generic ethdev api " Cristian Dumitrescu
2017-10-13 12:22 1% ` [dpdk-dev] [PATCH V4 3/5] ethdev: add new api for traffic " Cristian Dumitrescu
2017-10-06 16:21 9% [dpdk-dev] ABI/API stability in DPDK Mcnamara, John
2017-10-06 16:27 4% ` Ferruh Yigit
2017-10-06 17:15 4% ` Thomas Monjalon
2017-10-09 3:20 [dpdk-dev] [PATCH v3 0/5] move vdev into drivers/bus Jianfeng Tan
2017-10-13 11:51 ` [dpdk-dev] [PATCH v7 0/4] " Jianfeng Tan
2017-10-13 11:51 4% ` [dpdk-dev] [PATCH v7 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-10-23 10:06 3% ` De Lara Guarch, Pablo
2017-10-25 17:10 ` [dpdk-dev] [PATCH v8 0/4] move vdev into drivers/bus Jianfeng Tan
2017-10-25 17:10 4% ` [dpdk-dev] [PATCH v8 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-10-25 17:10 1% ` [dpdk-dev] [PATCH v8 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
2017-10-25 21:32 3% ` De Lara Guarch, Pablo
2017-10-27 1:06 ` [dpdk-dev] [PATCH v0 0/4] move vdev into drivers/bus Jianfeng Tan
2017-10-27 1:06 4% ` [dpdk-dev] [PATCH v9 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-10-27 1:06 1% ` [dpdk-dev] [PATCH v9 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
2017-10-27 3:23 ` [dpdk-dev] [PATCH v10 0/4] move vdev into drivers/bus Jianfeng Tan
2017-10-27 3:23 4% ` [dpdk-dev] [PATCH v10 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-10-27 3:23 1% ` [dpdk-dev] [PATCH v10 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
2017-10-30 8:28 ` [dpdk-dev] [PATCH v11 0/4] move vdev into drivers/bus Jianfeng Tan
2017-10-30 8:28 4% ` [dpdk-dev] [PATCH v11 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-10-30 8:28 1% ` [dpdk-dev] [PATCH v11 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
2017-11-07 6:54 ` [dpdk-dev] [PATCH v12 0/4] move vdev into drivers/bus Jianfeng Tan
2017-11-07 6:54 4% ` [dpdk-dev] [PATCH v12 1/4] cryptodev: remove crypto vdev init API Jianfeng Tan
2017-11-07 6:54 1% ` [dpdk-dev] [PATCH v12 3/4] bus/vdev: move to vdev bus to drivers/bus Jianfeng Tan
2017-10-09 16:12 [dpdk-dev] [PATCH 1/2] ethdev: add return value to stats get dev op Matan Azrad
2017-10-09 16:12 4% ` [dpdk-dev] [PATCH 2/2] doc: update stats get API change Matan Azrad
2017-10-10 20:20 1% ` [dpdk-dev] [PATCH v2] ethdev: add return value to stats get dev op Matan Azrad
2017-10-10 14:15 [dpdk-dev] [PATCH] drivers: update DPAA2 libs ABIVER and build reproducibility Hemant Agrawal
2017-10-10 15:48 5% ` Thomas Monjalon
2017-10-11 9:36 3% [dpdk-dev] next techboard meeting (13th, October) Olivier MATZ
2017-10-11 12:41 0% ` Wiles, Keith
2017-10-11 12:48 0% ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
2017-10-11 12:53 0% ` Wiles, Keith
2017-10-12 8:18 4% [dpdk-dev] [PATCH v1 0/8] Bus control framework Gaetan Rivet
2017-10-12 8:18 4% ` [dpdk-dev] [PATCH v1 2/8] bus: introduce opaque " Gaetan Rivet
2017-10-14 0:09 3% [dpdk-dev] [PATCH] doc: fix highlight of bumped libs in release notes Thomas Monjalon
2017-10-16 8:33 0% ` Yang, Zhiyong
2017-10-18 20:57 0% ` Ferruh Yigit
2017-10-23 10:13 0% ` Thomas Monjalon
2017-10-23 10:15 3% ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2017-10-23 16:26 0% ` Ferruh Yigit
2017-10-23 20:39 0% ` Thomas Monjalon
2017-10-16 13:42 [dpdk-dev] [PATCH v1 1/2] mempool/octeontx: move mbox from event to mempool Santosh Shukla
2017-10-16 13:42 3% ` [dpdk-dev] [PATCH v1 2/2] event/octeontx: bump library version Santosh Shukla
2017-10-17 9:50 0% ` Hemant Agrawal
2017-10-23 14:38 3% ` Thomas Monjalon
2017-10-20 21:21 [dpdk-dev] [PATCH 0/3] Break dependency on bus infrastructure* Declan Doherty
2017-10-25 12:00 ` [dpdk-dev] [PATCH v2 0/3] Break cryptodev dependency on bus infrastructure Declan Doherty
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 1/3] cryptodev: add new APIs to assist PMD initialisation Declan Doherty
2017-10-25 12:00 1% ` [dpdk-dev] [PATCH v2 2/3] cryptodev: break dependency on virtual device bus Declan Doherty
2017-10-25 12:00 3% ` [dpdk-dev] [PATCH v2 3/3] cryptodev: break dependency on PCI " Declan Doherty
2017-10-22 13:32 [dpdk-dev] [PATCH v9 0/4] flow classification library Bernard Iremonger
2017-10-23 15:16 ` [dpdk-dev] [PATCH v10 " Bernard Iremonger
2017-10-23 20:59 ` Thomas Monjalon
2017-10-24 8:40 3% ` Iremonger, Bernard
2017-10-24 9:23 0% ` Mcnamara, John
2017-10-24 9:38 0% ` Thomas Monjalon
2017-10-24 9:53 0% ` Iremonger, Bernard
2017-10-24 10:25 0% ` Thomas Monjalon
2017-10-23 9:56 10% [dpdk-dev] [PATCH] eal: remove deprecated log functions Olivier Matz
2017-10-23 11:50 3% [dpdk-dev] DPDK techboard minutes of October 13 Olivier MATZ
2017-10-23 12:16 2% [dpdk-dev] [PATCH] mbuf: rename deprecated VLAN flags Olivier Matz
2017-10-25 15:12 2% ` [dpdk-dev] [PATCH v2] " Olivier Matz
2017-10-25 12:29 4% [dpdk-dev] [PATCH] eal: fix version map experimental export section Harry van Haaren
2017-11-06 23:07 0% ` Thomas Monjalon
2017-10-30 11:06 3% [dpdk-dev] rte_security deprecation Thomas Monjalon
2017-10-30 11:30 0% ` Akhil Goyal
2017-10-30 12:27 8% [dpdk-dev] [PATCH] doc: update release notes for rte_security Akhil Goyal
2017-10-30 14:22 0% ` Thomas Monjalon
2017-11-01 6:20 0% ` Akhil Goyal
2017-11-02 16:36 0% ` Mcnamara, John
2017-11-07 6:44 8% ` [dpdk-dev] [PATCH v2] " Akhil Goyal
2017-11-08 1:07 0% ` Thomas Monjalon
2017-11-02 14:31 [dpdk-dev] [PATCH ] examples/l3fwd: fix aliasing in port grouping Guduri Prathyusha
2017-11-02 14:46 ` Ananyev, Konstantin
2017-11-02 15:33 ` Guduri Prathyusha
2017-11-02 15:52 ` Ananyev, Konstantin
2017-11-03 3:21 ` Jianbo.Liu
2017-11-03 5:42 3% ` Guduri Prathyusha
2017-11-03 11:24 [dpdk-dev] [PATCH] mem: remove old function from symbol list Thomas Monjalon
2017-11-03 11:34 3% ` Gonzalez Monroy, Sergio
2017-11-03 13:52 0% ` Thomas Monjalon
2017-11-03 15:24 5% [dpdk-dev] [PATCH v1] i40e: highlight change to flexible payload for RSS config John McNamara
2017-11-04 19:41 0% ` Chilikin, Andrey
2017-11-06 11:08 7% [dpdk-dev] [PATCH] mempool: increase ABI version Thomas Monjalon
2017-11-06 11:33 4% ` santosh
2017-11-06 22:59 4% ` Thomas Monjalon
2017-11-06 11:28 28% [dpdk-dev] [PATCH] doc: update ABI/API policy Bruce Richardson
2017-11-06 14:48 4% ` Mcnamara, John
2017-11-11 11:37 4% ` Thomas Monjalon
2017-11-07 6:05 4% ` Yuanhan Liu
2017-11-08 19:09 4% ` Kevin Traynor
2017-11-07 3:08 3% [dpdk-dev] [dpdk-techboard] [DRAFT] DPDK techboard minutes of October 26 Thomas Monjalon
2017-11-07 3:09 3% [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
2017-11-08 9:53 16% [dpdk-dev] [PATCH] doc: postpone devargs clean-up Gaetan Rivet
2017-11-09 13:43 1% [dpdk-dev] [RFC] cmdline: rework as a wrapper to libedit Adrien Mazarguil
2017-11-15 4:12 0% ` Wiles, Keith
2017-11-15 8:04 0% ` Olivier MATZ
2017-11-15 16:31 0% ` Wiles, Keith
2017-11-16 9:23 0% ` Adrien Mazarguil
2017-11-16 16:48 0% ` Wiles, Keith
2017-11-16 16:53 0% ` Jim Thompson
2017-11-10 12:27 4% [dpdk-dev] [PATCH v1] doc: update release notes for 17.11 John McNamara
2017-11-17 17:10 1% [dpdk-dev] [PATCH] virtio: add new driver for crypto devices Jay Zhou
2017-11-17 22:41 6% [dpdk-dev] [PATCH v1] doc: add template release notes for 18.02 John McNamara
2017-11-22 17:38 6% ` [dpdk-dev] [PATCH v2] " John McNamara
2017-11-20 8:21 3% [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Andrew Rybchenko
2017-11-20 8:22 ` [dpdk-dev] [PATCH 1/2] ethdev: add GENEVE flow pattern item Andrew Rybchenko
2017-11-23 9:39 3% ` Adrien Mazarguil
2017-11-20 8:22 ` [dpdk-dev] [PATCH 2/2] app/testpmd: support GENEVE pattern item in flow rules Andrew Rybchenko
2017-11-23 9:40 3% ` Adrien Mazarguil
2017-11-23 9:39 4% ` [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Adrien Mazarguil
2017-11-23 10:07 0% ` Andrew Rybchenko
2017-12-01 10:43 3% ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2017-11-20 10:31 [dpdk-dev] [PATCH 0/2] add inline protocol support Anoob Joseph
2017-11-22 6:55 ` [dpdk-dev] [PATCH v2 " Anoob Joseph
2017-11-22 6:55 ` [dpdk-dev] [PATCH v2 1/2] lib/security: add support for get metadata Anoob Joseph
2017-11-22 13:27 3% ` Neil Horman
2017-11-22 14:13 0% ` Anoob
2017-11-27 13:55 0% ` Neil Horman
2017-11-22 8:10 [dpdk-dev] [PATCH 1/3] security: fix device operation type Nelio Laranjeiro
2017-11-22 8:10 ` [dpdk-dev] [PATCH 2/3] crypto: fix pedentic compilation errors Nelio Laranjeiro
2017-11-22 13:56 3% ` Neil Horman
2017-11-22 14:31 0% ` Gaëtan Rivet
2017-11-22 16:50 0% ` De Lara Guarch, Pablo
2017-11-24 16:06 4% [dpdk-dev] [RFC PATCH 0/6] mempool: add bucket mempool driver Andrew Rybchenko
2017-11-27 12:21 2% [dpdk-dev] 17.08.1 patches review and test Yuanhan Liu
2017-11-30 19:09 0% ` Patil, Harish
2017-11-27 12:29 6% [dpdk-dev] [PATCH] ethdev: increase flow type limit from 32 to 64 Kirill Rybalchenko
2017-11-28 11:57 [dpdk-dev] [PATCH 0/5] ethdev: Port ownership Matan Azrad
2017-11-28 11:57 ` [dpdk-dev] [PATCH 2/5] ethdev: add port ownership Matan Azrad
2017-11-30 12:36 ` Neil Horman
2017-11-30 13:24 ` Gaëtan Rivet
2017-11-30 14:30 3% ` Matan Azrad
2017-11-30 15:09 3% ` Gaëtan Rivet
2017-11-30 15:43 3% ` Matan Azrad
2017-11-30 8:01 1% [dpdk-dev] [RFC 1/2] net/tap: add eBPF to TAP device Ophir Munk
2017-11-30 8:01 1% ` [dpdk-dev] [RFC 2/2] net/tap: add eBPF instructions Ophir Munk
2017-12-01 2:29 [dpdk-dev] [PATCH 1/7] ethdev: remove unused flag from header Ferruh Yigit
2017-12-01 2:29 ` [dpdk-dev] [PATCH 7/7] ethdev: use opaque user callback object Ferruh Yigit
2017-12-01 10:33 ` Bruce Richardson
2017-12-01 11:22 ` Ananyev, Konstantin
2017-12-01 13:17 ` Bruce Richardson
2017-12-01 23:51 ` Ferruh Yigit
2017-12-04 10:31 3% ` Bruce Richardson
2017-12-01 14:47 4% [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Konstantin Ananyev
2017-12-01 14:48 19% ` [dpdk-dev] [RFC PATCH 3/3] doc: ethdev ABI change deprecation notice Konstantin Ananyev
2017-12-01 14:56 0% ` [dpdk-dev] [RFC PATCH 0/3] *** SUBJECT HERE *** Ananyev, Konstantin
2017-12-01 14:55 4% [dpdk-dev] [RFC PATCH 0/3] ethdev: few changes in rte_ethdev layer Konstantin Ananyev
2017-12-01 18:56 4% [dpdk-dev] [PATCH 0/4] dpdk: enhance EXPERIMENTAL api tagging Neil Horman
2017-12-01 18:56 5% ` [dpdk-dev] [PATCH 2/4] compat: Add __experimental macro Neil Horman
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).