summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5
AgeCommit message (Collapse)Author
2018-11-05net/mlx5: make vectorized Tx threshold configurableYongseok Koh
Add txqs_max_vec parameter to configure the maximum number of Tx queues to enable vectorized Tx. And its default value is set according to the architecture and device type. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: move device spawn configuration to probingYongseok Koh
When a device is spawned, it does make more sense that the configuration parameters are passed by callee. Furthermore, setting default value for some configuration would need PCIe device ID which can be found in the probe function. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: add E-switch VXLAN rule cleanup routinesViacheslav Ovsiienko
The last part of patchset contains the rule cleanup routines. These ones is the part of outer interface initialization at the moment of VXLAN VTEP attaching. These routines query the list of attached VXLAN devices, the list of local IP addresses with peer and link scope attribute and the list of permanent neigh rules, then all found abovementioned items on the specified outer device are flushed. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add E-Switch VXLAN encapsulation rulesViacheslav Ovsiienko
VXLAN encap rules are applied to the VF ingress traffic and have the VTEP as actual redirection destinations instead of outer PF. The encapsulation rule should provide: - redirection action VF->PF - VF port ID - some inner network parameters (MACs/IP) - the tunnel outer source IP (v4/v6) - the tunnel outer destination IP (v4/v6). Current - VNI - Virtual Network Identifier There is no direct way found to provide kernel with all required encapsulatioh header parameters. The encapsulation VTEP is created attached to the outer interface and assumed as default path for egress encapsulated traffic. The outer tunnel IP address are assigned to interface using Netlink, the implicit route is created like this: ip addr add <src_ip> peer <dst_ip> dev <outer> scope link Peer address provides implicit route, and scode link reduces the risk of conflicts. At initialization time all local scope link addresses are flushed from device (see next part of patchset). The destination MAC address is provided via permenent neigh rule: ip neigh add dev <outer> lladdr <dst_mac> to <dst_ip> nud permanent At initialization time all neigh rules of this type are flushed from device (see the next part of patchset). Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add E-switch VXLAN tunnel devices managementViacheslav Ovsiienko
VXLAN interfaces are dynamically created for each local UDP port of outer networks and then used as targets for TC "flower" filters in order to perform encapsulation. These VXLAN interfaces are system-wide, the only one device with given UDP port can exist in the system (the attempt of creating another device with the same UDP local port returns EEXIST), so PMD should support the shared device instances database for PMD instances. These VXLAN implicitly created devices are called VTEPs (Virtual Tunnel End Points). Creation of the VTEP occurs at the moment of rule applying. The link is set up, root ingress qdisc is also initialized. Encapsulation VTEPs are created on per port basis, the single VTEP is attached to the outer interface and is shared for all encapsulation rules on this interface. The source UDP port is automatically selected in range 30000-60000. For decapsulaton one VTEP is created per every unique UDP local port to accept tunnel traffic. The name of created VTEP consists of prefix "vmlx_" and the number of UDP port in decimal digits without leading zeros (vmlx_4789). The VTEP can be preliminary created in the system before the launching application, it allows to share UDP ports between primary and secondary processes. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: fix E-Switch flow counter deletionViacheslav Ovsiienko
The counters for E-Switch rules were erroneously deleted in flow_tcf_remove() routine. The counters deletion is moved to flow_tcf_destroy() routine. Fixes: e1114ff6a5ab ("net/mlx5: support e-switch flow count action") Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: update E-Switch VXLAN netlink routinesViacheslav Ovsiienko
This part of patchset updates Netlink exchange routine. Message sequence numbers became not random ones, the multipart reply messages are supported, not propagating errors to the following socket calls, Netlink replies buffer size is increased to MNL_SOCKET_BUFFER_SIZE and now is preallocated at context creation time instead of stack usage. This update is needed to support Netlink query operations. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add VXLAN to flow translate routineViacheslav Ovsiienko
This part of patchset adds support of VXLAN-related items and actions to the flow translation routine. Later some tunnel types, other than VXLAN can be addedd (GRE). No VTEP devices are created at this point, the flow rule is just translated, not applied yet. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add VXLAN to flow prepare routineViacheslav Ovsiienko
The e-switch Flow prepare function is updated to support VXLAN encapsulation/and decapsulation actions. The function calculates buffer size for Netlink message and Flow description structures, including optional ones for tunneling purposes. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add E-Switch VXLAN to validation routineViacheslav Ovsiienko
This patch adds VXLAN support for flow item/action lists validation. The following entities are now supported: - RTE_FLOW_ITEM_TYPE_VXLAN, contains the tunnel VNI - RTE_FLOW_ACTION_TYPE_VXLAN_DECAP, if this action is specified the items in the flow items list treated as outer network parameters for tunnel outer header match. The ethernet layer addresses always are treated as inner ones. - RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP, contains the item list to build the encapsulation header. In current implementation the values is the subject for some constraints: - outer source MAC address will be always unconditionally set to the one of MAC addresses of outer egress interface - no way to specify source UDP port - all abovementioned parameters are ignored if specified in the rule, warning messages are sent to the log Minimal tunneling support is also added. If VXLAN decapsulation action is specified the ETH item can follow the VXLAN VNI item, the content of this ETH item is treated as inner MAC addresses and type. The outer ETH item for VXLAN decapsulation action is always ignored. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: swap items/actions validations for E-Switch rulesViacheslav Ovsiienko
The rule validation function for E-Switch checks item list first, then action list is checked. This patch swaps the validation order, now actions are checked first. This is preparation for validation function update with VXLAN tunnel actions. VXLAN decapsulation action requires to check the items in special way. We could do this special check in the single item check pass if the action flags were gathered before. This is the reason to swap the item/actions checking loops. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add necessary structures for E-Switch VXLANViacheslav Ovsiienko
This patch introduces the data structures needed to implement VXLAN encapsulation/decapsulation hardware offload support for E-Switch. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: add necessary definitions for E-Switch VXLANViacheslav Ovsiienko
This patch contains tc flower related and some other definitions needed to implement VXLAN encapsulation/decapsulation hardware offload support for E-Switch. mlx5 driver dynamically creates and manages the VXLAN virtual tunnel endpoint devices, the following definitions control the parameters of these network devices: - MLX5_VXLAN_PORT_MIN - minimal allowed UDP port for VXLAN device - MLX5_VXLAN_PORT_MAX - maximal allowed UDP port for VXLAN device - MLX5_VXLAN_DEVICE_PFX - name prefix of driver created VXLAN device The mlx5 drivers creates the VXLAN devices with UDP port within specified range, devices have the names with specified prefix, followed by decimal digits of UDP port. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: prepare meson build for adding E-Switch VXLANViacheslav Ovsiienko
This patch updates meson.build before adding E-Switch VXLAN encapsulation/decapsulation hardware offload support. E-Switch rules are controlled via tc Netilnk commands, so we need to include tc related headers, and check for some tunnel specific key definitions. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: prepare makefile for adding E-Switch VXLANViacheslav Ovsiienko
This patch updates makefile before adding E-Switch VXLAN encapsulation/decapsulation hardware offload support. E-Switch rules are controlled via tc Netilnk commands, so we need to include tc related headers, and check for some tunnel specific key definitions. Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: enable loopback by configured modeDekel Peled
Enable NIC loopback mode based on rte_eth_conf.lpbk_mode configuration. Signed-off-by: Dekel Peled <dekelp@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: add flow action functions to glueDekel Peled
This patch adds glue functions for operations: - Create packet reformat (encap/decap) flow action. - Destroy flow action. The new operations depend on HAVE_IBV_FLOW_DV_SUPPORT. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: fix validation of MLPS-in-GREYongseok Koh
Multiple tunnel isn't allowed but MPLS over GRE should be accepted. 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-05net/mlx5: add missing flow director deleteYongseok Koh
Deleting FDIR flow is not implemented by mistake. Also the name of static functions are properly renamed. Fixes: b42c000e37a8 ("net/mlx5: remove flow support") Cc: stable@dpdk.org Signed-off-by: Yongseok Koh <yskoh@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-11-05net/mlx5: add 128B padding of Rx completion entryYongseok Koh
A PMD parameter (rxq_cqe_pad_en) is added to enable 128B padding of CQE on RX side. The size of CQE is aligned with the size of a cacheline of the core. If cacheline size is 128B, the CQE size is configured to be 128B even though the device writes only 64B data on the cacheline. This is to avoid unnecessary cache invalidation by device's two consecutive writes on to one cacheline. However in some architecture, it is more beneficial to update entire cacheline with padding the rest 64B rather than striding because read-modify-write could drop performance a lot. On the other hand, writing extra data will consume more PCIe bandwidth and could also drop the maximum throughput. It is recommended to empirically set this parameter. Disabled by default. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: fix flow counters deletion in VerbsViacheslav Ovsiienko
The Flow counters created with Verbs are erroneously destroyed in Flow remove function (flow_verbs_remove()). Counter Verbs handles stored in the translated rule buffer become invalid. If rule is reapplied with these invalid counter handles the driver hangs. The counter should be destroyed with Verbs in the Flow destroy function. The Flow remove function should keep counters intact. Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-11-05net/mlx5: fix detection and error for multiple item layersShahaf Shuler
1. The check for the Eth item was wrong. causing an error with flow rules like: flow create 0 ingress pattern eth / vlan vid is 13 / ipv4 / gre / eth / vlan vid is 15 / end actions drop / end 2. align all error messages. 3. align multiple item layers check. Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: fix bit width of flow itemsShahaf Shuler
Apply the changes from commit c744f6b1b969 ("net/mlx5: fix bit width of item and action flags") in some places that were overlooked. Fixes: 0ddd11437a9a ("net/mlx5: fix bit width of item and action flags") Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-11-05net/mlx5: use pkg-config to handle SUSE libmnlStephen Hemminger
SUSE decided to install the libmnl include file in a non-standard place: /usr/include/libmnl/libmnl/libmnl.h This was probably a mistake by the SUSE package maintainer, but hard to get fixed. Workaround the problem by pkg-config to find the necessary include directive for libmnl. Fixes: 20b71e92ef8e ("net/mlx5: lay groundwork for switch offloads") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Luca Boccassi <bluca@debian.org>
2018-10-26net/mlx5: close all ports on removeOphir Munk
With the introduction of representors several eth devices are using the same rte device (e.g. a PCI bus). When calling port detach on one eth device it is required that all eth devices belonging to the same rte device have been closed in advance, then the rte device itself can be removed/detached. This commit implements this requirement implicitly by adding a remove callback to struct rte_pci_driver. The new behavior can be demonstrated in testpmd. First we attach a representor 0 using PCI address 0000:08:00.0 testpmd> port attach 0000:08:00.0,representor=[0] Attaching a new port... EAL: PCI device 0000:08:00.0 on NUMA socket 0 EAL: probe driver: 15b3:1013 net_mlx5 Port 0 is attached. Done Port 1 is attached. Done Port 0 is the master device (PF) - an ethdev of the PCI address. Port 1 is representor 0 - another ethdev (representing a VF) using the same PCI address. Next we detach port 1 testpmd> port detach 1 Removing a device... Port 0 is closed Port 1 is closed Now total ports is 0 Done Since port 0 has been implicitly closed we cannot act on it anymore. testpmd> port stop 0 Invalid port 0 Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-26net/mlx5: release port on closeOphir Munk
With the introduction of representors several eth devices are using the same rte device (e.g. a PCI bus). It is therefore required to release the eth device resources during an eth device close operation rather than during an rte device removal (detach) operation. In current version many PMDs are still releasing the eth device as part of the rte device removal. In order to allow a smooth transition for all PMDs to behave correctly an ethdev flag RTE_ETH_DEV_CLOSE_REMOVE is used. When this flag is set it indicates to rte_eth_dev_close() to call rte_eth_dev_release_port(), so the port is freed during the close operation. Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-10-26net/mlx5: allow multiple probing for representorOphir Munk
Implement probing of a rte device multiple times, see [1]. Set PCI driver RTE_PCI_DRV_PROBE_AGAIN flag to enable multiple probing of the PCI device by the PCI common driver. Consecutive probing requests with a devargs string may contain repetitive master and representors devices for which eth device should be created only once. In case an eth device already exists - silently ignore it. [1] commit e9d159c3d534 ("eal: allow probing a device again") Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Shahaf Shuler <shahafs@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: rename static functionsYongseok Koh
In mlx5_flow*.c, static functions have names starting from 'flow_' while shared ones start from "mlx5_flow_'. 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: add warning message for Direct Verbs flowYongseok Koh
In case that the library doesn't support DV flow, if enabled by 'dv_flow_en=1', print out a warning message and disable it. Fixes: 51e72d386c99 ("net/mlx5: add runtime parameter to enable Direct Verbs") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
2018-10-26net/mlx5: support new flow counter APIViacheslav Ovsiienko
This patch updates the functions performing the Verbs ibrary calls in order to support different versions of the library. The functions: - flow_verbs_counter_new() - flow_verbs_counter_release() - flow_verbs_counter_query() now have the several compilation branches, depending on the counters support found in the system at compile time. The flow_verbs_counter_create() function is introduced as helper for flow_verbs_counter_new(), actually this helper create the counters with Verbs. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: remove unnecessary structure initializersViacheslav Ovsiienko
The unnecessary structure filed initializers to zero are removed. We need to do this minor preparation before the following mlx5 counter structure modification. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: add new flow counter Verbs API to glue libraryViacheslav Ovsiienko
This patch updates the mlx5 glue library, new counter support Verbs function pointers are added to the glue linking structure mlx5_glue. This structure now contains the pointers to the both versions of counter supporting functions due to compatibility issues. Depending on configuration macros the functions perform actual Verbs library calls or return an error with meaning "feature is not supported" (NULL or ENOTSUP). Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: relocate flow counters query functionViacheslav Ovsiienko
The flow_verbs_query_count() is moved into the the group of counter managing functions and renamed to flow_verbs_counter_query() in order to be in unified fashion with others. Also minor function modification is made to avoid unreachable code warnings if there is no counter support at compile time. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: simplify flow counters support checkViacheslav Ovsiienko
The redundant check of Flow counters support in runtime is removed. The flag flow_counter_en is eliminated from the code. The Verbs create counter function just returns an error if no counter support presented in the system. If there is no any of Flow counters configuration macro defined the log message is emited, indicating the missing counter support. mlx5_flow_validate_action_count() fuctnion is also updated due to flow_counter_en flag removal. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: introduce new flow counters configuration macroViacheslav Ovsiienko
The new configuration macro HAVE_IBV_DEVICE_COUNTERS_SET_V45 is introduced. Both makefile and meson.build are changed. Flow counter support code depends on the following configuration macros: - HAVE_IBV_DEVICE_COUNTERS_SET_V42 - is defined if system supports the "old" flow counters functionality, MLNX_OFED version from 4.2 to 4.4 is required. - HAVE_IBV_DEVICE_COUNTERS_SET_V45 - is defined if system supports the "new" flow counters functionality, MLNX_OVED 4.5 (or higher) or Linux rdma-core v19 (or higher) is required. Neither HAVE_IBV_DEVICE_COUNTERS_SET_V42 nor HAVE_IBV_DEVICE_COUNTERS_SET_V45 is defined if there is no counters support. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: rename flow counter configuration macroViacheslav Ovsiienko
The HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT is replaced with HAVE_IBV_DEVICE_COUNTERS_SET_V42. At this stage it is just macro renaming. This macro is defined if system supports the "old" Flow counters functionality, MLNX_OFED version from 4.2 to 4.4 is required. We need to do this preparation before introducing the new configuration macro (HAVE_IBV_DEVICE_COUNTERS_SET_V45) for the "new" Flow counters support. Both makefile and meson.build are changed. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-10-26net/mlx5: fix flow counters creationViacheslav Ovsiienko
The Flow counter creation function contains two problems: - Flow counter object in Verbs is not freed in case of memory allocation error. The call of counter Verbs object deallocating function is added to fix. - The initial value of reference counter is set to one in order to provide the correct counter object freeing in the flow_verbs_counter_release() function. The reference counter field should be initialized to one. Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>