dpdk.git
4 years agoethdev: support flow aging
Dong Zhou [Tue, 21 Apr 2020 10:11:38 +0000 (13:11 +0300)]
ethdev: support flow aging

One of the reasons to destroy a flow is the fact that no packet matches
the flow for "timeout" time.
For example, when TCP\UDP sessions are suddenly closed.

Currently, there is not any DPDK mechanism for flow aging and the
applications use their own ways to detect and destroy aged-out flows.

The flow aging implementation need include:
- A new rte_flow action: RTE_FLOW_ACTION_TYPE_AGE to set the timeout and
  the application flow context for each flow.
- A new ethdev event: RTE_ETH_EVENT_FLOW_AGED for the driver to report
  that there are new aged-out flows.
- A new rte_flow API: rte_flow_get_aged_flows to get the aged-out flows
  contexts from the port.
- Support input flow aging command line in Testpmd.

The new event type addition in the enum is flagged as an ABI breakage,
so an ignore rule is added for these reasons:
- It is not changing value of existing types (except MAX)
- The new value is not used by existing API if the event is not
  registered
In general, it is safe adding new ethdev event types at the end of the
enum, because of event callback registration mechanism.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: fix build with rdma-core 21
Thomas Monjalon [Thu, 16 Apr 2020 15:59:04 +0000 (17:59 +0200)]
common/mlx5: fix build with rdma-core 21

drivers/common/mlx5/mlx5_glue.c: In function 'mlx5_glue_devx_qp_query':
drivers/common/mlx5/mlx5_glue.c:1010:9: error:
implicit declaration of function 'mlx5dv_devx_qp_query'

The function mlx5dv_devx_qp_query() was added in rdma-core 22.
This function is compiled only if HAVE_IBV_DEVX_OBJ,
which is true if the function mlx5dv_devx_obj_create is found.
Unfortunately mlx5dv_devx_obj_create() was introduced in rdma-core 21,
when mlx5dv_devx_qp_query() did not exist yet.

A new flag HAVE_IBV_DEVX_QP is added when mlx5dv_devx_qp_query()
is found.

Fixes: 62d6f70f30f4 ("net/mlx5: add glue for queue query via DevX")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize memory for flow meter
Wentao Cui [Mon, 20 Apr 2020 02:40:02 +0000 (05:40 +0300)]
net/mlx5: optimize memory for flow meter

This commit focus on flow meter data structures
optimization: mlx5_flow_meter.

Optimize memory consumption of flow meter data structure.
Reorganize flow meter data structure,delete unnecessary
data fields.

Signed-off-by: Wentao Cui <wentaoc@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/i40e: fix flow director initialisation
Bernard Iremonger [Tue, 7 Apr 2020 15:26:41 +0000 (16:26 +0100)]
net/i40e: fix flow director initialisation

Remove references to struct rte_fdir_conf which is deprecated,
in i40e_flow_parse_fdir_filter(), i40e_flow_destroy() and
i40e_flow_add_del_fdir_filter().

Fixes: c3be43817cfb ("net/i40e: fix unexpected skip FDIR setup")
Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Fixes: 4149825bbdb9 ("net/i40e: finish integration FDIR with generic flow API")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: support flow director mark action
Simei Su [Tue, 21 Apr 2020 06:19:30 +0000 (14:19 +0800)]
net/iavf: support flow director mark action

This patch enables mark action support and takes mark only case
into consideration.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director PFCP
Simei Su [Tue, 21 Apr 2020 06:19:29 +0000 (14:19 +0800)]
net/iavf: support flow director PFCP

This patch enables PFCP node and session packets with S_FIELD
for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director L2TPv3 and IPsec
Simei Su [Tue, 21 Apr 2020 06:19:28 +0000 (14:19 +0800)]
net/iavf: support flow director L2TPv3 and IPsec

This patch enables L2TPv3 with SESSION_ID, ESP/AH with SPI, NAT-T
with SPI and IP src/dst for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director GTPU
Simei Su [Tue, 21 Apr 2020 06:19:27 +0000 (14:19 +0800)]
net/iavf: support flow director GTPU

This patch enables GTPU with TEID and QFI for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director basic rule
Simei Su [Tue, 21 Apr 2020 06:19:26 +0000 (14:19 +0800)]
net/iavf: support flow director basic rule

This patch adds FDIR create/destroy/validate function in AVF.
Common pattern and queue/qgroup/passthru/drop actions are supported.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: check DSN package file firstly
Haiyue Wang [Thu, 16 Apr 2020 03:11:22 +0000 (11:11 +0800)]
net/ice: check DSN package file firstly

Align the package file search sequence with PF only for DCF mode. Get
the DSN through the virtual channel firstly to check the accessibility
of the package file.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add RSS hash parsing in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:25 +0000 (14:16 +0800)]
net/iavf: add RSS hash parsing in SSE path

Support RSS hash parsing from Flex Rx
descriptor in SSE data path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add RSS hash parsing in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:24 +0000 (14:16 +0800)]
net/iavf: add RSS hash parsing in AVX path

Support RSS hash parsing from Flex Rx
descriptor in AVX data path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:23 +0000 (14:16 +0800)]
net/iavf: support flow mark in SSE path

Support Flow Director mark ID parsing from Flex
Rx descriptor in SSE path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:22 +0000 (14:16 +0800)]
net/iavf: support flow mark in AVX path

Support Flow Director mark ID parsing from Flex
Rx descriptor in AVX path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in normal data path
Leyi Rong [Mon, 20 Apr 2020 06:16:21 +0000 (14:16 +0800)]
net/iavf: support flow mark in normal data path

Support Flow Director mark ID parsing in normal path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add flow director enabled switch value
Leyi Rong [Mon, 20 Apr 2020 06:16:20 +0000 (14:16 +0800)]
net/iavf: add flow director enabled switch value

The commit adds fdir_enabled flag into iavf_rx_queue structure
to identify if fdir id is active. Rx data path can be benefit if
fdir id parsing is not needed, especially in vector path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:19 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in SSE path

Support flexible Rx descriptor format in SSE
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:18 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in AVX path

Support flexible Rx descriptor format in AVX
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in normal path
Leyi Rong [Mon, 20 Apr 2020 06:16:17 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in normal path

Support flexible Rx descriptor format in normal
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: return error if opcode is mismatched
Leyi Rong [Mon, 20 Apr 2020 06:16:16 +0000 (14:16 +0800)]
net/iavf: return error if opcode is mismatched

Adds error return when the opcode of read message is
mismatched which is received from adminQ.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor definitions
Leyi Rong [Mon, 20 Apr 2020 06:16:15 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor definitions

Add definitions for flexible Rx descriptor structures and macros.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: add mlx5 flow memory optimization to release notes
Suanming Mou [Mon, 20 Apr 2020 06:53:44 +0000 (14:53 +0800)]
doc: add mlx5 flow memory optimization to release notes

Add flow memory optimization item.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Raslan Darawsheh <rasland@mellanox.com>
4 years agonet/mlx5: reorganize flow API structure
Suanming Mou [Thu, 16 Apr 2020 08:34:31 +0000 (16:34 +0800)]
net/mlx5: reorganize flow API structure

Currently, the rte flow structure is not fully aligned and has some
bits wasted. The members can be optimized and reorganized to save
memory.

1. The drv_type uses only limited bits, change the type to 2 bits what
it needs.

2. Align the hairpin_flow_id, drv_type, fdir, copy_applied to 32 bits.
As hairpin never uses the full 32 bits.

3. __rte_packed helps tight up the structure memory layout.

The optimization totally helps save 14 bytes for the structure.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allocate flow API from indexed pool
Suanming Mou [Thu, 16 Apr 2020 08:34:30 +0000 (16:34 +0800)]
net/mlx5: allocate flow API from indexed pool

This commit allocates rte flow from indexed memory pool.

Allocate rte flow memory from indexed memory pool helps save more than
MALLOC_ELEM_OVERHEAD bytes memory from rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow RSS struct
Suanming Mou [Thu, 16 Apr 2020 08:34:29 +0000 (16:34 +0800)]
net/mlx5: optimize flow RSS struct

When destroy the flow with RSS, flow can invoke the queues information
from hrxq index table object, since the queue number and list are both
saved to the index table object. No need to save the duplicated data in
rte flow.

Save the RSS description information to the intermediate private data
when create the flow with RSS action helps to save the memory for rte
flow.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow director filter memory
Wentao Cui [Thu, 16 Apr 2020 08:34:28 +0000 (16:34 +0800)]
net/mlx5: optimize flow director filter memory

This commit is for mlx5 fdir flow memory optimization.

Currently for the fdir member in rte_flow structure. It saves the fdir
memory pointer directly. As fdir is fading away, use one bit help to
indicate the function in the flow and add the content to an extra list
save the memory for the other widely usage cases.

Signed-off-by: Wentao Cui <wentaoc@mellanox.com>
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert mark copy resource to indexed
Suanming Mou [Thu, 16 Apr 2020 08:34:27 +0000 (16:34 +0800)]
net/mlx5: convert mark copy resource to indexed

Allocate mark copy resource from indexed pool helps rte flow saves the 4
bytes index instead of 8 bytes pointer. For mark copy resource itself,
it helps save MALLOC_ELEM_OVERHEAD bytes from rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allocate meter from indexed pool
Suanming Mou [Thu, 16 Apr 2020 08:34:26 +0000 (16:34 +0800)]
net/mlx5: allocate meter from indexed pool

This patch allocate the meter object memory from indexed memory pool
which will help to save the MALLOC_ELEM_OVERHEAD memory taken by
rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow meter handle type
Suanming Mou [Thu, 16 Apr 2020 08:34:25 +0000 (16:34 +0800)]
net/mlx5: optimize flow meter handle type

While flow attaches the meter handle, the meter id can be the unique tag
for the flow to get the meter handle. It's no need for flow to save the
pointer of the meter handle.

Save the meter id instead of pointer helps reduce the size for rte flow
structure.

As the supported maximum meter rule is 4K, uint16_t type is selected for
the meter id.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize flow handle struct
Suanming Mou [Thu, 16 Apr 2020 08:34:24 +0000 (16:34 +0800)]
net/mlx5: reorganize flow handle struct

Currently, the mlx5_flow_handle struct is not fully aligned and has some
bits wasted. The members can be optimized and reorganized to save memory.

1. As metadata and meter is sharing the same flow match id, now the flow
   id is limited to 24 bits due to the 8 MSBs are used as for the meter
   color.  Align the flow id to other bit members to 32 bits to save the
   mlx5 flow handle memory.

2. The vlan_vf in struct mlx5_flow_handle_dv was already moved to struct
   mlx5_flow_handle. Remove the legacy vlan_vf in struct
   mlx5_flow_handle_dv.

3. Reorganize the vlan_vf in mlx5_flow_handle with member SILIST_ENTRY
   next to make it align with 8 bytes.

4. Reorganize the header modify in mlx5_flow_handle_dv to ILIST_ENTRY
   next to make it align to with bytes.

5. Introduce __rte_pack attribute to make the struct tightly organized.

It will totally save 20 bytes memory for mlx5_flow_handle struct.

For the resource objects which are converted to indexed, align the names
with the prefix of rix_.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize action flags in flow handle
Suanming Mou [Thu, 16 Apr 2020 08:34:23 +0000 (16:34 +0800)]
net/mlx5: optimize action flags in flow handle

As only limited bits is used in act_flags for flow destroy, it's a bit
expensive to save the whole 64 bits. Move the act_flags out of flow
handle and save the needed bits for flow destroy to save some bytes for
the flow handle data struct.

The fate action type and mark bits are reserved as they will be used in
flow destroy.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize fate actions as union
Suanming Mou [Thu, 16 Apr 2020 08:34:22 +0000 (16:34 +0800)]
net/mlx5: reorganize fate actions as union

Currently, one flow only has one fate action, the fate actions members
in the flow struct can be reorganized as union to save the memory for
flow struct.

This commit reorganizes the fate actions as union, the act_flags helps
to identify the fate action type when flow destroys.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert flow dev handle to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:08 +0000 (10:42 +0800)]
net/mlx5: convert flow dev handle to indexed

This commit converts flow dev handle to indexed.

Change the mlx5 flow handle from pointer to uint32_t saves memory for
flow. With million flow, it saves several MBytes memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert hrxq to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:07 +0000 (10:42 +0800)]
net/mlx5: convert hrxq to indexed

This commit converts hrxq to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert jump resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:06 +0000 (10:42 +0800)]
net/mlx5: convert jump resource to indexed

This commit convert jump resource to indexed.

The table data struct is allocated from indexed memory. As it is add in
the hash list, the pointer is still used for hash list search. The index
is added to the table struct, and the pointer in flow handle is decrease
to uint32_t type. For flow without jump flows, it saves 4 bytes memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert port id action to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:05 +0000 (10:42 +0800)]
net/mlx5: convert port id action to indexed

This commit converts port id action to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert tag resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:04 +0000 (10:42 +0800)]
net/mlx5: convert tag resource to indexed

This commit convert tag resource to indexed.

As tag resources are add in the hash list, to avoid introduce
performance issue and keep the hash list, only the tag resource memory
is allocated from indexed memory. The resources is still added to the
hash list. Add four bytes index in the tag resource struct and change
the tag resources in the flow handle from pointer to uint32_t seems be
no benefit for tag resource, but it saves memory for flows without tag
action. And also for sub flows share one tag action resource.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert push VLAN resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:03 +0000 (10:42 +0800)]
net/mlx5: convert push VLAN resource to indexed

This commit converts the push VLAN resource to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert encap/decap resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:02 +0000 (10:42 +0800)]
net/mlx5: convert encap/decap resource to indexed

This commit converts the flow encap/decap resource to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add trunk release for indexed pool
Suanming Mou [Thu, 16 Apr 2020 02:42:01 +0000 (10:42 +0800)]
net/mlx5: add trunk release for indexed pool

While entries are fully freed in trunk, it means the trunk is free now.
User may prefer the free trunk memory can be reclaimed.

Add the trunk release memory option for indexed pool in this case.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add trunk dynamic grow for indexed pool
Suanming Mou [Thu, 16 Apr 2020 02:42:00 +0000 (10:42 +0800)]
net/mlx5: add trunk dynamic grow for indexed pool

This commit add trunk dynamic grow for the indexed pool.

In case for pools which are not sure the entry number needed, pools can
be configured in increase progressively mode. It means the trunk size
will be increased dynamically one after one, then reach a stable value.
It saves memory to avoid allocate a very big trunk at beginning.

User should set both the grow_shift and grow_trunk to help the trunk
grow works. Keep one or both grow_shift and grow_trunk as 0 makes the
trunk work as fixed size.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add indexed memory pool
Suanming Mou [Thu, 16 Apr 2020 02:41:59 +0000 (10:41 +0800)]
net/mlx5: add indexed memory pool

Currently, the memory allocated by rte_malloc() also introduced more
than 64 bytes overhead. It means when allocate 64 bytes memory, the
real cost in memory maybe double. And the libc malloc() overhead is 16
bytes, If users try allocating millions of small memory blocks, the
overhead costing maybe huge. And save the memory pointer will also be
quite expensive.

Indexed memory pool is introduced to save the memory for allocating
huge amount of small memory blocks. The indexed memory uses trunk and
bitmap to manage the memory entries. While the pool is empty, the trunk
slot contains memory entry array will be allocated firstly. The bitmap
in the trunk records the entry allocation. The offset of trunk slot in
the pool and the offset of memory entry in the trunk slot compose the
index for the memory entry. So, by the index, it will be very easy to
address the memory of the entry. User saves the 32 bits index for the
memory resource instead of the 64 bits pointer.
User should create different pools for allocating different size of
small memory block. It means one pool provides one fixed size of small
memory blocked allocating.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/tap: fix queues fd check before close
Yunjian Wang [Fri, 17 Apr 2020 12:03:57 +0000 (20:03 +0800)]
net/tap: fix queues fd check before close

The fd is possibly a negative value while it is passed as an
argument to function "close". Fix the check to the fd.

Fixes: ed8132e7c912 ("net/tap: move fds of queues to be in process private")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/bnxt: remove redefinition of page size
Ajit Khaparde [Fri, 17 Apr 2020 16:02:58 +0000 (09:02 -0700)]
net/bnxt: remove redefinition of page size

PAGE_SIZE is a common macro and cause redefinition errors.
Replace such occurrences.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add port database
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:16 +0000 (20:19 +0530)]
net/bnxt: add port database

The port database is a repository of the port details
it is used by the ulp code to query any port related details.

Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add cache table type for TCAM lookup
Mike Baucom [Wed, 15 Apr 2020 14:49:15 +0000 (20:19 +0530)]
net/bnxt: add cache table type for TCAM lookup

In order to re-use allocated resources and reduce search complexity for
simple keys, a generic software cache table was added for the TCAM. The
implementation is specifically only for keys that can be compressed to
less than 16 bits.  The keys are generated using the same mechanisms as
other search tables, but the table type is set to a cache that mirrors
the actual TCAM table. The allocated result fields are stored in the
cache entry and can be used for subsequent searches in future tables.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add default identifiers to ULP mapper
Mike Baucom [Fri, 17 Apr 2020 15:53:24 +0000 (08:53 -0700)]
net/bnxt: add default identifiers to ULP mapper

- Added ulp_mapper_init/deinit to allocate/deallocate mapper data for
  storing the default identifiers
- Modified the template_db to include the new opcode for accessing the
  default ids.
- Modified the result and key field builders to use the new opcode for
  writing the default ids into blobs

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add session and function flow flush
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:13 +0000 (20:19 +0530)]
net/bnxt: add session and function flow flush

The ulp flow flush has been extended to support session flow
flush and function flow flush. The session flow flush is called when
there the device is sole owner of the session and it deletes all the
flows associated with that session. The function flow flush is
called if the device function is not the sole owner of the session,
it deletes all the flows that are associated with that device
function.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: use hashing for flow template match
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:12 +0000 (20:19 +0530)]
net/bnxt: use hashing for flow template match

Currently, all the flow templates are sequentially searched to find out
whether there is a matching template for the incoming RTE_FLOW offload
request. As sequential search will have performance concerns, this
patch will address it by using hash algorithm to find out the flow
template. This change resulted in creation of computed fields to
remove the fields that do not participate in the hash calculations.
The field bitmap is created for this purpose.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: aggregate ULP mapper create arguments
Mike Baucom [Wed, 15 Apr 2020 14:49:11 +0000 (20:19 +0530)]
net/bnxt: aggregate ULP mapper create arguments

The changes are to the ulp mapper flow_create, the API changed
to take the bnxt_ulp_mapper_create_parms structure instead of individual
fields.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: aggregate ULP parser arguments
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:10 +0000 (20:19 +0530)]
net/bnxt: aggregate ULP parser arguments

The changes are to the ulp rte parser, the API are changed
to take the parser param structure instead of individual
fields.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add resource name type to debug messages
Mike Baucom [Wed, 15 Apr 2020 14:49:09 +0000 (20:19 +0530)]
net/bnxt: add resource name type to debug messages

Added the name of the resource to the index/result and key/mask common
builder functions.

Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add flow database resource iteration API
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:08 +0000 (20:19 +0530)]
net/bnxt: add flow database resource iteration API

This API can be used to iterate individual resource
functions in the flow database.

Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: allow usage of more resources in flow DB
Mike Baucom [Wed, 15 Apr 2020 14:49:07 +0000 (20:19 +0530)]
net/bnxt: allow usage of more resources in flow DB

Allow the flow db resources to be more effectively utilized.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add SVIF changes for port id
Mike Baucom [Wed, 15 Apr 2020 14:49:06 +0000 (20:19 +0530)]
net/bnxt: add SVIF changes for port id

Modification of the parser to get the SVIF from the driver for matches
on port_id, pf, and phy_port.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add flow stats in extended stats
Somnath Kotur [Thu, 16 Apr 2020 04:27:01 +0000 (21:27 -0700)]
net/bnxt: add flow stats in extended stats

This patch allows to display flow stats in extended stats.
To do this, DMA-able memory is registered with the FW during device
initialization. Then the driver uses an alarm thread to query the
per flow stats using the HWRM_CFA_COUNTER_QSTATS HWRM command at
regular intervals and stores it locally which will be displayed
when the application queries the xstats.
The DMA-able memory is unregistered during driver cleanup.
This functionality can be enabled using the flow-xstat devarg and
will be disabled by default. The intention behind this is to allow
stats to be displayed for all the flows in one shot instead of
querying one at a time.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
4 years agonet/bnxt: add PCI function stats to extended stats
Ajit Khaparde [Thu, 2 Apr 2020 05:26:29 +0000 (22:26 -0700)]
net/bnxt: add PCI function stats to extended stats

HWRM API allows drivers to query stats per PCI function.
These stats can provide some useful information in certain
circumstances.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: add counters to xstats
Christos Ricudis [Mon, 13 Apr 2020 16:35:54 +0000 (00:35 +0800)]
net/bnxt: add counters to xstats

Add several missing hardware counters to xstats

Signed-off-by: Christos Ricudis <ricudis@niometrics.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/virtio: support Virtio link speed feature
Ivan Dyukov [Mon, 30 Mar 2020 07:58:02 +0000 (10:58 +0300)]
net/virtio: support Virtio link speed feature

This patch adds a support of VIRTIO_NET_F_SPEED_DUPLEX feature
for virtio driver.

There are two ways to specify speed of the link:
   'speed' devarg
   negotiate speed from qemu via VIRTIO_NET_F_SPEED_DUPLEX
The highest priority is devarg. If devarg is not specified,
drivers tries to negotiate it from qemu.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: adding link speed parameter
Ivan Dyukov [Mon, 30 Mar 2020 07:58:01 +0000 (10:58 +0300)]
net/virtio-user: adding link speed parameter

virtio driver already parses speed devarg. virtio-user should add
it to list of valid devargs and call eth_virtio_dev_init function
which init speed value.

eth_virtio_dev_init already is called from virtio_user_pmd_probe
function. The only change is required to enable speed devargs:
adding speed to list of valid devargs.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: fix devargs parsing
Ivan Dyukov [Mon, 30 Mar 2020 07:58:00 +0000 (10:58 +0300)]
net/virtio-user: fix devargs parsing

strtoull returns 0 if it fails to parse input string. It's ignored
in get_integer_arg.

This patch handles error cases for strtoull function.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add link speed parameter
Ivan Dyukov [Mon, 30 Mar 2020 07:57:59 +0000 (10:57 +0300)]
net/virtio: add link speed parameter

Some applications like pktgen use link speed to calculate
transmission rate. It limits outcome traffic to hardcoded 10G.

This patch adds speed devarg which allows to configure
link speed of virtio device.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: refactor devargs parsing
Ivan Dyukov [Mon, 30 Mar 2020 07:57:58 +0000 (10:57 +0300)]
net/virtio: refactor devargs parsing

Refactor vdpa specific devargs parsing to more generic way.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix shadowed descriptors not flushed
Marvin Liu [Fri, 17 Apr 2020 01:16:09 +0000 (09:16 +0800)]
vhost: fix shadowed descriptors not flushed

When ring size or enqueue packets not aligned with batch number, it is
possible that descs update still kept in shadowed used structure when
batched enqueue. Fix this issue by flushing remained shadowed used descs
before batch flush.

Fixes: f41516c309d7 ("vhost: flush batched enqueue descs directly")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix shadow update
Marvin Liu [Fri, 17 Apr 2020 02:39:05 +0000 (10:39 +0800)]
vhost: fix shadow update

Defer shadow ring update introduces functional issue which has been
described in Eugenio's fix patch.

The current implementation of vhost_net in packed vring tries to fill
the shadow vector before send any actual changes to the guest. While
this can be beneficial for the throughput, it conflicts with some
bufferfloats methods like the linux kernel napi, that stops
transmitting packets if there are too much bytes/buffers in the
driver.

It also introduces performance issue when frontend run much faster than
backend. Frontend may not be able to collect available descs when shadow
update is deferred. That will harm RFC2544 throughput.

Appropriate choice is to remove deferred shadowed update method.
Now shadowed used descs are flushed at the end of dequeue function.

Fixes: 31d6c6a5b820 ("vhost: optimize packed ring dequeue")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agodoc: add note for vhost builtin example
Xuan Ding [Wed, 25 Mar 2020 04:21:15 +0000 (04:21 +0000)]
doc: add note for vhost builtin example

Add memory pre-allocation note for vhost example when enabling
"builtin-net-driver".

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: add logs
Matan Azrad [Tue, 24 Mar 2020 14:24:37 +0000 (14:24 +0000)]
vdpa/mlx5: add logs

Add log prints to improve driver status following.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: validate notifier configuration
Matan Azrad [Tue, 24 Mar 2020 14:24:36 +0000 (14:24 +0000)]
vdpa/mlx5: validate notifier configuration

When both, direct and indirect notifier management cannot be
configured, return an error.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: support direct HW notifications
Matan Azrad [Tue, 24 Mar 2020 14:24:35 +0000 (14:24 +0000)]
vdpa/mlx5: support direct HW notifications

Add support for the next 2 callbacks:
get_vfio_device_fd and get_notify_area.

This will allow direct HW doorbell ringing from guest and will save CPU
usage in host.

By this patch, the QEMU will map the physical address of the virtio
device in guest directly to the physical address of the HW device
doorbell.

The guest doorbell write is 2 bytes transaction while some Mellanox nics
support only 4 bytes transactions.

Remove ConnectX-5 and BF1 devices support which don't support 2B
doorbell writes for HW triggering.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: move virtual doorbell alloc to probe
Matan Azrad [Tue, 24 Mar 2020 14:24:34 +0000 (14:24 +0000)]
vdpa/mlx5: move virtual doorbell alloc to probe

The configure and close operations may be called a lot of time by vhost
library according to the virtio connections in the guest.

VAR is the device memory space for the virtio queues doorbells.
Each VAR page can be shared for more than one queue while its owner must
synchronize the writes to it.

The mlx5 driver allocates single VAR page for all its queues.

Therefore, it is better to allocate it in probe device level instead of
creating and destroying it per new connection.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: set default queue indices
Asaf Penso [Mon, 23 Mar 2020 17:50:13 +0000 (17:50 +0000)]
vdpa/mlx5: set default queue indices

The rte_vhost_get_vring_base function is being called to get the values
of last_avail_idx and last_used_idx.
These fields will not have the correct values in case the function
returns an error.

Adding a check for the function return value, and in the case of an
error, set the fields to be zero and print a warning message.

Fixes: bff735011078 ("vdpa/mlx5: prepare virtio queues")
Cc: stable@dpdk.org
Signed-off-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/bnxt: enable meson build on TruFlow
Venkat Duvvuru [Wed, 15 Apr 2020 08:19:11 +0000 (13:49 +0530)]
net/bnxt: enable meson build on TruFlow

Include tf_ulp & tf_core directories and the files inside them.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support marking packet
Venkat Duvvuru [Wed, 15 Apr 2020 08:19:10 +0000 (13:49 +0530)]
net/bnxt: support marking packet

When a flow is offloaded with MARK action (RTE_FLOW_ACTION_TYPE_MARK),
each packet of that flow will have metadata set in its completion.
This metadata will be used to fetch an index into a mark table where
the actual MARK for that flow is stored. Fetch the MARK from the mark
table and inject it into packet’s mbuf.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: disable vector mode on host based TruFlow
Venkat Duvvuru [Wed, 15 Apr 2020 08:19:09 +0000 (13:49 +0530)]
net/bnxt: disable vector mode on host based TruFlow

If bp->truflow is not set then don't enable vector mode.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: register TruFlow flow API ops
Venkat Duvvuru [Wed, 15 Apr 2020 08:19:08 +0000 (13:49 +0530)]
net/bnxt: register TruFlow flow API ops

Register bnxt_ulp_rte_flow_ops when host based TRUFLOW is
enabled.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support flow API flush
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:07 +0000 (13:49 +0530)]
net/bnxt: support flow API flush

This patch does the following
1. Gets the ulp session information from eth_dev
2. Fetches the rte_flow table associated with this session
3. Iterates through all the flows in the flow table
4. Calls ulp_mapper_resources_free which releases the key & action
   tables associated with each flow

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support flow API destroy
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:06 +0000 (13:49 +0530)]
net/bnxt: support flow API destroy

This patch does the following
1. Gets the ulp session information from eth_dev
2. Fetches the flow associated with the flow id from the flow table
3. Calls ulp_mapper_resources_free which releases the key & action
   tables associated with that flow

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support flow API validate
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:05 +0000 (13:49 +0530)]
net/bnxt: support flow API validate

This patch does the following
1. Validates rte_flow_create arguments
2. Parses rte_flow_item types
3. Parses rte_flow_action types
4. Calls ulp_matcher_pattern_match to see if the flow is supported
5. If there is a match, returns success otherwise failure

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: support flow API create
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:04 +0000 (13:49 +0530)]
net/bnxt: support flow API create

This patch does the following
1. Validates rte_flow_create arguments
2. Parses rte_flow_item types
3. Parses rte_flow_action types
4. Calls ulp_matcher_pattern_match to see if the flow is supported
5. If there is a match, calls ulp_mapper_flow_create to program
   key & action tables

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support flow API action parsing
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:03 +0000 (13:49 +0530)]
net/bnxt: support flow API action parsing

This patch does the following
1. Registers a callback handler for each rte_flow_action type, if
   it is supported
2. Iterates through each rte_flow_action till RTE_FLOW_ACTION_TYPE_END
3. Invokes the action call back handler
4. Each action call back handler will populate the respective fields in
   act_details & act_bitmap

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support flow API item parsing
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:02 +0000 (13:49 +0530)]
net/bnxt: support flow API item parsing

1. Registers a callback handler for each rte_flow_item type, if it
   is supported
2. Iterates through each rte_flow_item till RTE_FLOW_ITEM_TYPE_END
3. Invokes the header call back handler
4. Each header call back handler will populate the respective fields
   in hdr_field & hdr_bitmap

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: match flow API actions with flow template actions
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:01 +0000 (13:49 +0530)]
net/bnxt: match flow API actions with flow template actions

This patch does the following
1. Takes act_bitmap generated from the rte_flow_actions
2. Iterates through the static act_bitmap list
3. Returns success if a match is found, otherwise an error

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: match flow API items with flow template patterns
Kishore Padmanabha [Wed, 15 Apr 2020 08:19:00 +0000 (13:49 +0530)]
net/bnxt: match flow API items with flow template patterns

This patch does the following
1. Takes hdr_bitmap generated from the rte_flow_items
2. Iterates through the static hdr_bitmap list
3. Returns success if a match is found, otherwise an error

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support alloc and program key and act tables
Mike Baucom [Wed, 15 Apr 2020 08:18:59 +0000 (13:48 +0530)]
net/bnxt: support alloc and program key and act tables

This patch does the following
1. Gets the action tables information from the action template id
2. Gets the class tables information from the class template id
3. Initializes the registry file
4. Allocates a flow id from the flow table
5. Process the class & action tables

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support freeing key and action tables
Mike Baucom [Wed, 15 Apr 2020 08:18:58 +0000 (13:48 +0530)]
net/bnxt: support freeing key and action tables

This patch does the following
1. Gets all the flow resources from the flow id
2. Frees all the table resources
3. Frees the flow in the flow table

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support process key tables
Mike Baucom [Wed, 15 Apr 2020 08:18:57 +0000 (13:48 +0530)]
net/bnxt: support process key tables

This patch creates the classifier table entries for a flow.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support process action tables
Mike Baucom [Wed, 15 Apr 2020 08:18:56 +0000 (13:48 +0530)]
net/bnxt: support process action tables

This patch processes the action template. Iterates through the list
of action info templates and processes it.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: add helper functions for blob/regfile ops
Mike Baucom [Wed, 15 Apr 2020 08:18:55 +0000 (13:48 +0530)]
net/bnxt: add helper functions for blob/regfile ops

1. blob routines for managing key/mask/result data
2. regfile routines for managing temporal data during flow
   construction

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support ULP session manager cleanup
Venkat Duvvuru [Wed, 15 Apr 2020 08:18:54 +0000 (13:48 +0530)]
net/bnxt: support ULP session manager cleanup

A ULP session will contain all the resources needed to support
rte flow offloads. A session is initialized as part of rte_eth_device
start. A DPDK application can have multiple interfaces which
means rte_eth_device start will be called for each of these devices.
ULP session manager will make sure that a single ULP session is only
initialized once. Apart from this, it also initializes MARK database,
EEM table & flow database. ULP session manager also manages a list of
all opened ULP sessions.

This patch adds support for cleaning up resources initialized for ULP
sessions.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support ULP session manager init
Venkat Duvvuru [Wed, 15 Apr 2020 08:18:53 +0000 (13:48 +0530)]
net/bnxt: support ULP session manager init

A ULP session will contain all the resources needed to support
rte flow offloads. A session is initialized as part of rte_eth_device
start. A DPDK application can have multiple interfaces which
means rte_eth_device start will be called for each of these devices.
ULP session manager will make sure that a single ULP session is only
initialized once. Apart from this, it also initializes MARK database,
EEM table & flow database. ULP session manager also manages a list of
all opened ULP sessions.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support host memory based TruFlow
Venkat Duvvuru [Wed, 15 Apr 2020 08:18:52 +0000 (13:48 +0530)]
net/bnxt: support host memory based TruFlow

This feature can be enabled by passing
"-w 0000:0d:00.0,host-based-truflow=1” to the DPDK application.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fetch VNIC info
Venkat Duvvuru [Wed, 15 Apr 2020 08:18:51 +0000 (13:48 +0530)]
net/bnxt: fetch VNIC info

VNIC is needed for the driver to program the action record for rx
flows. VNIC determines what receive rings to use to place the received
packets. This patch introduces a routine that will convert a given
dpdk port to VNIC.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fetch SVIF information from firmware
Venkat Duvvuru [Wed, 15 Apr 2020 08:18:50 +0000 (13:48 +0530)]
net/bnxt: fetch SVIF information from firmware

SVIF (source virtual interface) is used to represent a physical port,
physical function, or a virtual function. SVIF is compared during L2
context and exact match lookups in TX direction. SVIF is masked for
port information during L2 context and exact match lookup in RX direction.
Hence, driver needs this SVIF information to program L2 context and Exact
match tables.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support EM/EEM
Pete Spreadborough [Wed, 15 Apr 2020 08:18:49 +0000 (13:48 +0530)]
net/bnxt: support EM/EEM

- Add TruFlow flow memory support
- Exact Match (EM) adds the capability to manage and manipulate
  data flows using on chip memory.
- Extended Exact Match (EEM) behaves similarly to EM, but at a
  vastly increased scale by using host DDR, with performance
  trade-off due to the need to access off-chip memory.

Signed-off-by: Pete Spreadborough <peter.spreadborough@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support TruFlow core table scope
Farah Smith [Wed, 15 Apr 2020 08:18:48 +0000 (13:48 +0530)]
net/bnxt: support TruFlow core table scope

- Added TruFlow Table public API
- Added Table Scope capability including Table Type support code for
  setting and getting Table Types.

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support TruFlow core TCAM
Shahaji Bhosle [Wed, 15 Apr 2020 08:18:47 +0000 (13:48 +0530)]
net/bnxt: support TruFlow core TCAM

- Add TruFlow TCAM public API functions
- Add TCAM support functions as well as public APIs.

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add TruFlow core identifier
Farah Smith [Wed, 15 Apr 2020 08:18:46 +0000 (13:48 +0530)]
net/bnxt: add TruFlow core identifier

- Add TruFlow Identifier resource support
- Add TruFlow public API for Identifier resources.
- Add support code and stack for Identifier resource allocation control.

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add resource manager
Michael Wildt [Wed, 15 Apr 2020 08:18:45 +0000 (13:48 +0530)]
net/bnxt: add resource manager

- Add TruFlow RM functionality for resource handling
- Update the TruFlow Resource Manager (RM) with resource
  support functions for debugging as well as resource cleanup.
- Add support for Internal and external pools.

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add initial TruFlow core resource management
Shahaji Bhosle [Wed, 15 Apr 2020 08:18:44 +0000 (13:48 +0530)]
net/bnxt: add initial TruFlow core resource management

- Add TruFlow public API definitions for resources
  as well as RM infrastructure

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add TruFlow core session SRAM
Michael Wildt [Wed, 15 Apr 2020 08:18:43 +0000 (13:48 +0530)]
net/bnxt: add TruFlow core session SRAM

- Add TruFlow session resource support functionality
- Add TruFlow session hw flush capability as well as
  sram support functions.
- Add resource definitions for session pools.

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>