summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_flow_dv.c
AgeCommit message (Collapse)Author
2019-03-29net/mlx5: switch to the shared IB device contextViacheslav Ovsiienko
The code is updated to use the shared IB device context and device handles. The IB device context is shared between reprentors created over the single multiport IB device. All Verbs and DevX objects will be created within this shared context. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-03-01net/mlx: prefix private structureThomas Monjalon
The private structure stored in rte_eth_dev->data->dev_private was named "struct priv". In order to ease code browsing, the structure is renamed "struct mlx[45]_priv". Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2019-01-14net/mlx5: validate TOS and TTL on E-SwitchViacheslav Ovsiienko
This patch adds the type-of-service and time-to-live IP header fields validation on E-Switch, both for match pattern and VXLAN encapsulation action IP header itesm. The E-Switch flows will use the common mlx5_flow_validate_item_ipv4/6 routines with added extra parameter, specifying the supported fields mask. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-01-14net/mlx5: support flow counters using devxMoti Haimovsky
This commit adds counters support when creating flows via direct verbs. The implementation uses devx interface in order to create query and delete the counters. This support requires MLNX_OFED_LINUX-4.5-0.1.0.1 installation. Signed-off-by: Moti Haimovsky <motih@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2019-01-03net/mlx5: support modify header using Direct VerbsDekel Peled
This patch implements the set of actions to support offload of packet header modifications to MLX5 NIC. Implementation is based on RFC [1]. [1] http://mails.dpdk.org/archives/dev/2018-November/119971.html Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-16net/mlx5: fix MPLS item validationDekel Peled
Update the mlx5_flow_validate_item_mpls() function to allow MPLS over IP, UDP, and GRE. Modify the flow_dv_validate() function with the new logic introduced in previous patch of this series: set new variable last_item after each validation, update item_flags after each item iteration. The new variable last_item is sent to mlx5_flow_validate_item_mpls() and used to validate the MPLS item. Same change implemented in flow_verbs_validate(). Update the mlx5_flow_validate_item_mpls() function to verify that device configuration has mpls_en set to 1. This code was added earlier this year, but unintentionaly removed in recent versions. Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-16net/mlx5: add MPLS to Direct Verbs flow engineDekel Peled
The support in MPLS on this flow engine was overlooked. It's absence is critical because there are required actions for MPLS which can be done only with the DV engine. To set correctly the MPLS filter, we need to reason about the flow item before the MPLS (UDP, GRE or other). To do that, a new variable last_item was added and updated after each translation. the full item flags are updated after each item iteration. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-16net/mlx5: fix flow query routine in Direct VerbsViacheslav Ovsiienko
The flow_dv_query() just returns -ENOTSUP value and does not set provided error parameter structure, that crashes the port_flow_query(). The patch fixes flow_db_query(), now it sets an error parameter structure. Fixes: 684dafe795d0 ("net/mlx5: add flow query abstraction interface") Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-14net/mlx5: fix Direct Verbs RSS hash fieldYongseok Koh
As mlx5_flow_hashfields_adjust() refers to flow->rss, actions must be translated prior to items like in Verbs. Otherwise, hash fields are not correctly set. Fixes: d02cb0691299 ("net/mlx5: add Direct Verbs translate actions") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-14net/mlx5: fix L4 protocol validationYongseok Koh
- Currently, no device supports partial mask for protocol in IP header. - As there could be multiple IP items, next_protocol variable in flow validation has to be reset for inner layer. Otherwise, inner TCP/UDP will see protocol number of outer IP header. - Remove redundant protocol checking for MPLS, which is done in mlx5_flow_validate_item_mpls(). Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-14net/mlx5: fix device flow referenceYongseok Koh
dev_flow->verbs is mistakenly used instead of dev_flow->dv. A sanity check is added for debugging purpose. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: remove flags setting from flow preparationYongseok Koh
Even though flow_drv_prepare() takes item_flags and action_flags to be filled in, those are not used and will be overwritten by parsing of flow_drv_translate(). There's no reason to keep the flags and fill it. Appropriate notes are added to the documentation of flow_drv_prepare() and flow_drv_translate(). Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-11-05net/mlx5: fix Direct Verbs flow tunnelYongseok Koh
1) Fix layer parsing In translation of tunneled flows, dev_flow->layers must not be used to check tunneled layer as it contains all the layers parsed from flow_drv_prepare(). Checking tunneled layer is needed to distinguish between outer and inner item. This should be based on dynamic parsing. With dev_flow->layers on a tunneled flow, items will always be interpreted as inner as dev_flow->layer already has all the items. Dynamic parsing (item_flags) is added as there's no such code. 2) Refactoring code - flow_dv_create_item() and flow_dv_create_action() are merged into flow_dv_translate() for consistency with Verbs and *_validate(). Fixes: 246636411536 ("net/mlx5: fix flow tunnel handling") Fixes: d02cb0691299 ("net/mlx5: add Direct Verbs translate actions") Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-11-05net/mlx5: support default RSS key as nullOphir Munk
Applications which add RSS rules must supply an RSS key and length. If an application is only interested in default RSS operation it should not care about the exact RSS key. By setting the key to NULL - the PMD will use the default RSS key. In addition if the application does not care about the RSS type it can set it to 0 and the PMD will use the default type (ETH_RSS_IP). Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add caching of encap/decap actionsDekel Peled
Make flow encap and decap Verbs actions cacheable resources. Store created actions in local database. This enables MLX5 PMD reuse of existing actions. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add raw data encap/decap to Direct VerbsDekel Peled
This patch implements the encap and decap actions, using raw data, in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add NVGRE decap action to Direct VerbsDekel Peled
This patch implements the NVGRE decap action in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add NVGRE encap action to Direct VerbsDekel Peled
This patch implements the nvgre encap action in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add VXLAN decap action to Direct VerbsDekel Peled
This patch implements the VXLAN decap action in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add VXLAN encap action to Direct VerbsDekel Peled
This patch implements the VXLAN encap action in DV flow for MLX5 PMD. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: fix memory leak on Direct Verbs errorDekel Peled
Add freeing of allocated memory before exiting on mlx5dv error. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-26net/mlx5: fix bit width of item and action flagsYongseok Koh
Most of the code uses uint64_t for MLX5_FLOW_LAYER_* and MLX5_FLOW_ACTION_*, but there're some code using uint32_t. Fixes: 2ed2fe5f0a9c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch") Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-26net/mlx5: fix flow tunnel handlingYongseok Koh
Both rte_flow and mlx5_flow redundantly have item flags. And it is not properly set in the code. This causes wrong tunnel flag handling. A rte_flow can have multiple expanded device flows if the flow has an RSS action. Therefore, mlx5_flow should have the layers field. Fixes: c4d9b9f7f382 ("net/mlx5: add Direct Verbs final functions") Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Fixes: 4e05a229c5da ("net/mlx5: add flow prepare function") Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-26net/mlx5: fix flow mark ID conversion in Direct VerbsYongseok Koh
Fixes: d02cb0691299 ("net/mlx5: add Direct Verbs translate actions") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-26net/mlx5: fix wildcard item for Direct VerbsYongseok Koh
If a network layer is specified with no spec, it means wildcard match. flow_dv_translate_item_*() returns without writing anything if spec is null and it causes creation of wrong flow. E.g., the following flow has to patch with any ipv4 packet. flow create 0 ingress pattern eth / ipv4 / end actions ... But, with the current code, it matches any packet because PMD doesn't write anything about IPv4. The matcher value and mask becomes completely zero. It should have written the IP version at least. It is same for the rest of items. Even if the spec is null, PMD has to write constant fields before return, e.g. IP version and IP protocol number. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-26net/mlx5: fix item validation in Direct VerbsYongseok Koh
1) remove MPLS item in validation as it doesn't have a translator. 2) add missing NVGRE item to validation 3) match switch-case order between validation and translation. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-26net/mlx5: fix UDP hash field flag in Direct VerbsYongseok Koh
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-26net/mlx5: support metadata as flow rule criteriaDekel Peled
As described in series starting at [1], it adds option to set metadata value as match pattern when creating a new flow rule. This patch adds metadata support in mlx5 driver, in two parts: - Add the validation and setting of metadata value in matcher, when creating a new flow rule. - Add the passing of metadata value from mbuf to wqe when indicated by ol_flag, in different burst functions. [1] "ethdev: support metadata as flow rule criteria" http://mails.dpdk.org/archives/dev/2018-September/113269.html Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-26net/mlx5: add flow query abstraction interfaceMoti Haimovsky
Flow engine now supports multiple driver paths with each having its own flow query implantation routine. This patch adds an abstraction to the flow query routine in accordance to commit 0c76d1c9a18d ("net/mlx5: add abstraction for multiple flow drivers") done by Yongseok Koh. Signed-off-by: Moti Haimovsky <motih@mellanox.com>
2018-10-18net/mlx5: fix build on ArmShahaf Shuler
On some ARM environment, the below compilation error will be seen dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function 'flow_dv_translate_item_nvgre': /tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer targets in initialization differ in signedness [-Werror=pointer-sign] const char *tni_v = nvgre_v->tni; The reason for this error is that nvgre_v->tni is defined as byte array in size of 3B. However the code in the function iterate till the 4B in order to copy/set also the subsequent field after it (flow_id) Fixing by pointing to this struct from a different pointer. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-11net/mlx5: support e-switch TCP-flags flow filterMoti Haimovsky
This patch adds support for offloading flow rules with TCP-flags filter to mlx5 eswitch Hardwrae. With mlx5 it is possible to offload a limited set of flow rules to the mlxsw (or e-switch) using the DPDK flow commands using the "transfer" attribute. This set of flow rules also supports filtering according to the values found in the TCP flags. This patch implements this offload capability in the mlx5 PMD under transfer attribute. Signed-off-by: Moti Haimovsky <motih@mellanox.com>
2018-10-11net/mlx5: allow flow rule with attribute egressDekel Peled
This patch complements [1], adding to MLX5 PMD the option to set flow rule for egress traffic. [1] "net/mlx5: support metadata as flow rule criteria" http://mails.dpdk.org/archives/dev/2018-September/113275.html Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add abstraction for multiple flow driversYongseok Koh
Flow engine has to support multiple driver paths. Verbs/DV for NIC flow steering and Linux TC flower for E-Switch flow steering. In the future, another flow driver could be added (devX). Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add Direct Verbs final functionsOri Kam
This commits add the missing function which are apply, remove, and destroy. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add Direct Verbs translate actionsOri Kam
In this commit we add the translation of flow actions. Unlike the Verbs API actions are separeted from the items and are passed to the API in array structure. Since the target action like RSS require the QP information those actions are handled both in the translate action and in the apply. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add Direct Verbs translate itemsOri Kam
This commit handles the translation of the requested flow into Direct Verbs API. The Direct Verbs introduce the matcher object which acts as shared mask for all flows that are using the same mask. So in this commit we translate the item and get in return a matcher and the value that should be matched. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add Direct Verbs prepare functionOri Kam
This function allocates the Direct Verbs device flow, and introduce the relevant PRM structures. This commit also adds the matcher object. The matcher object acts as a mask and should be shared between flows. For example all rules that should match source IP with full mask should use the same matcher. A flow that should match dest IP or source IP but without full mask should have a new matcher allocated. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-10-11net/mlx5: add Direct Verbs validation functionOri Kam
This is commit introduce the Direct Verbs driver API. The Direct Verbs is an API adds new features like encapsulation, match on metatdata. In this commit the validation function was added, most of the validation is done with functions that are also in use for the Verbs API. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>