mlx5 SW steering updates 2021-01-05
Subsystems (3)
From: Saeed Mahameed <[email protected]>
Hi Jakub, Dave
This series introduces some refactoring to SW steering to support different formats of different Hardware.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit f6e7a024bfe5e11d91ccff46bb576e3fb5a516ea:
Merge tag 'arc-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc (2021-01-05 12:46:27 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-01-05
for you to fetch changes up to 4781df92f4dab5ca6928390c3cf4bfba9730a526:
net/mlx5: DR, Move STEv0 modify header logic (2021-01-05 15:00:49 -0800)
----------------------------------------------------------------
mlx5-updates-2021-01-05
SW steering, Refactor to have a device specific STE layer below dr_ste
This series introduces some improvements and refactoring by adding a new layer below dr_ste to allow support for different devices format.
It adds a struct of device specific callbacks for STE layer below dr_ste. Each device will implement its HW-specific function, and a common logic from the DR code will access these functions through the new ste_ctx API.
Connect-X5-style steering format is called STE_v0.
In the next patch series we bring the Connect-X6-style format - STE_v1.
----------------------------------------------------------------
Yevgeny Kliteynik (16):
net/mlx5: DR, Add infrastructure for supporting several steering formats net/mlx5: DR, Move macros from dr_ste.c to header
net/mlx5: DR, Use the new HW specific STE infrastructure net/mlx5: DR, Move HW STEv0 match logic to a separate file net/mlx5: DR, Remove unused macro definition from dr_ste net/mlx5: DR, Fix STEv0 source_eswitch_owner_vhca_id support net/mlx5: DR, Merge similar DR STE SET macros
net/mlx5: DR, Move STEv0 look up types from mlx5_ifc_dr header net/mlx5: DR, Refactor ICMP STE builder
net/mlx5: DR, Move action apply logic to dr_ste
net/mlx5: DR, Add STE setters and getters per-device API net/mlx5: DR, Move STEv0 setters and getters
net/mlx5: DR, Add STE tx/rx actions per-device API net/mlx5: DR, Move STEv0 action apply logic
net/mlx5: DR, Add STE modify header actions per-device API net/mlx5: DR, Move STEv0 modify header logic
drivers/net/ethernet/mellanox/mlx5/core/Makefile | 1 + .../mellanox/mlx5/core/steering/dr_action.c | 579 +------ .../mellanox/mlx5/core/steering/dr_domain.c | 6 + .../mellanox/mlx5/core/steering/dr_matcher.c | 106 +- .../ethernet/mellanox/mlx5/core/steering/dr_rule.c | 49 +- .../ethernet/mellanox/mlx5/core/steering/dr_ste.c | 1592 +++---------------- .../ethernet/mellanox/mlx5/core/steering/dr_ste.h | 167 ++ .../mellanox/mlx5/core/steering/dr_ste_v0.c | 1640 ++++++++++++++++++++ .../mellanox/mlx5/core/steering/dr_types.h | 182 ++- .../mellanox/mlx5/core/steering/mlx5_ifc_dr.h | 85 - 10 files changed, 2329 insertions(+), 2078 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
PATCH 1/16 net/mlx5: DR, Add infrastructure for supporting several steering formats
From: Yevgeny Kliteynik <[email protected]>
Add a struct of device specific callbacks for STE layer below dr_ste. Each device will implement its HW-specific function, and a comon logic from the DR code will access these functions through the new ste_ctx API.
More callbacks will follow in the subsequent patches.
--- .../mellanox/mlx5/core/steering/dr_ste.c | 2 +- .../mellanox/mlx5/core/steering/dr_ste.h | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +1 -1
@@ -3,7 +3,7 @@#include <linux/types.h> #include <linux/crc32.h> -#include "dr_types.h" +#include "dr_ste.h" #define DR_STE_CRC_POLY 0xEDB88320L#define STE_IPV4 0x1
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. */ + +#ifndef _DR_STE_ +#define _DR_STE_ + +#include "dr_types.h" + +#define DR_STE_CTX_BUILDER (fname) \ + ((*build_##fname##_init)(struct mlx5dr_ste_build *sb, \ + struct mlx5dr_match_param *mask)) + +struct mlx5dr_ste_ctx { +void DR_STE_CTX_BUILDER(eth_l2_src_dst ); +void DR_STE_CTX_BUILDER(eth_l3_ipv6_src ); +void DR_STE_CTX_BUILDER(eth_l3_ipv6_dst ); +void DR_STE_CTX_BUILDER(eth_l3_ipv4_5_tuple ); +void DR_STE_CTX_BUILDER(eth_l2_src ); +void DR_STE_CTX_BUILDER(eth_l2_dst ); +void DR_STE_CTX_BUILDER(eth_l2_tnl ); +void DR_STE_CTX_BUILDER(eth_l3_ipv4_misc ); +void DR_STE_CTX_BUILDER(eth_ipv6_l3_l4 ); +void DR_STE_CTX_BUILDER(mpls ); +void DR_STE_CTX_BUILDER(tnl_gre ); +void DR_STE_CTX_BUILDER(tnl_mpls ); +int DR_STE_CTX_BUILDER(icmp ); +void DR_STE_CTX_BUILDER(general_purpose ); +void DR_STE_CTX_BUILDER(eth_l4_misc ); +void DR_STE_CTX_BUILDER(tnl_vxlan_gpe ); +void DR_STE_CTX_BUILDER(tnl_geneve ); +void DR_STE_CTX_BUILDER(register_0 ); +void DR_STE_CTX_BUILDER(register_1 ); +void DR_STE_CTX_BUILDER(src_gvmi_qpn ); +}; + +#endif /* _DR_STE_ */
Signature · 1 line
2.26.2
PATCH 2/16 net/mlx5: DR, Move macros from dr_ste.c to header
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Move some macros from dr_ste.c to header - these macros will be used by all the format-specific functions.
--- .../mellanox/mlx5/core/steering/dr_ste.c | 74 ------------------ .../mellanox/mlx5/core/steering/dr_ste.h | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 74 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +0 -74
@@ -6,83 +6,9 @@#include "dr_ste.h" #define DR_STE_CRC_POLY 0xEDB88320L -#define STE_IPV4 0x1 -#define STE_IPV6 0x2 -#define STE_TCP 0x1 -#define STE_UDP 0x2 -#define STE_SPI 0x3 -#define IP_VERSION_IPV4 0x4 -#define IP_VERSION_IPV6 0x6 -#define STE_SVLAN 0x1 -#define STE_CVLAN 0x2#define DR_STE_ENABLE_FLOW_TAG BIT(31) -/* Set to STE a specific value using DR_STE_SET */ -#define DR_STE_SET_VAL (lookup_type, tag, t_fname, spec, s_fname, value) do { \ - if ((spec)->s_fname) { \ - MLX5_SET(ste_##lookup_type, tag, t_fname, value); \ - (spec)->s_fname = 0; \ - } \ -} while (0) - -/* Set to STE spec->s_fname to tag->t_fname */ -#define DR_STE_SET_TAG (lookup_type, tag, t_fname, spec, s_fname) \ - DR_STE_SET_VAL(lookup_type, tag, t_fname, spec, s_fname, spec->s_fname) - -/* Set to STE -1 to bit_mask->bm_fname and set spec->s_fname as used */ -#define DR_STE_SET_MASK (lookup_type, bit_mask, bm_fname, spec, s_fname) \ - DR_STE_SET_VAL(lookup_type, bit_mask, bm_fname, spec, s_fname, -1) - -/* Set to STE spec->s_fname to bit_mask->bm_fname and set spec->s_fname as used */ -#define DR_STE_SET_MASK_V (lookup_type, bit_mask, bm_fname, spec, s_fname) \ - DR_STE_SET_VAL(lookup_type, bit_mask, bm_fname, spec, s_fname, (spec)->s_fname) - -#define DR_STE_SET_TCP_FLAGS (lookup_type, tag, spec) do { \ - MLX5_SET(ste_##lookup_type, tag, tcp_ns, !!((spec)->tcp_flags & (1 << 8))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_cwr, !!((spec)->tcp_flags & (1 << 7))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_ece, !!((spec)->tcp_flags & (1 << 6))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_urg, !!((spec)->tcp_flags & (1 << 5))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_ack, !!((spec)->tcp_flags & (1 << 4))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_psh, !!((spec)->tcp_flags & (1 << 3))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_rst, !!((spec)->tcp_flags & (1 << 2))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_syn, !!((spec)->tcp_flags & (1 << 1))); \ - MLX5_SET(ste_##lookup_type, tag, tcp_fin, !!((spec)->tcp_flags & (1 << 0))); \ -} while (0) - -#define DR_STE_SET_MPLS_MASK (lookup_type, mask, in_out, bit_mask) do { \ - DR_STE_SET_MASK_V(lookup_type, mask, mpls0_label, mask, \ - in_out##_first_mpls_label);\ - DR_STE_SET_MASK_V(lookup_type, mask, mpls0_s_bos, mask, \ - in_out##_first_mpls_s_bos); \ - DR_STE_SET_MASK_V(lookup_type, mask, mpls0_exp, mask, \ - in_out##_first_mpls_exp); \ - DR_STE_SET_MASK_V(lookup_type, mask, mpls0_ttl, mask, \ - in_out##_first_mpls_ttl); \ -} while (0) - -#define DR_STE_SET_MPLS_TAG (lookup_type, mask, in_out, tag) do { \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_label, mask, \ - in_out##_first_mpls_label);\ - DR_STE_SET_TAG(lookup_type, tag, mpls0_s_bos, mask, \ - in_out##_first_mpls_s_bos); \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_exp, mask, \ - in_out##_first_mpls_exp); \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_ttl, mask, \ - in_out##_first_mpls_ttl); \ -} while (0) - -#define DR_STE_IS_OUTER_MPLS_OVER_GRE_SET (_misc) (\ - (_misc)->outer_first_mpls_over_gre_label || \ - (_misc)->outer_first_mpls_over_gre_exp || \ - (_misc)->outer_first_mpls_over_gre_s_bos || \ - (_misc)->outer_first_mpls_over_gre_ttl) -#define DR_STE_IS_OUTER_MPLS_OVER_UDP_SET (_misc) (\ - (_misc)->outer_first_mpls_over_udp_label || \ - (_misc)->outer_first_mpls_over_udp_exp || \ - (_misc)->outer_first_mpls_over_udp_s_bos || \ - (_misc)->outer_first_mpls_over_udp_ttl) -#define DR_STE_CALC_LU_TYPE (lookup_type, rx, inner) \ ((inner) ? MLX5DR_STE_LU_TYPE_##lookup_type##_I : \ (rx) ? MLX5DR_STE_LU_TYPE_##lookup_type##_D : \
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +76 -0
82 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 3/16 net/mlx5: DR, Use the new HW specific STE infrastructure
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Split the STE builders functionality into the common part and device-specific part. All the device-specific part (with 'v0' in the function names) is accessed through the STE context structure.
Subsequent patches will have the device-specific logic moved to a separate file.
--- .../mellanox/mlx5/core/steering/dr_domain.c | 6 + .../mellanox/mlx5/core/steering/dr_matcher.c | 106 ++- .../mellanox/mlx5/core/steering/dr_ste.c | 766 ++++++++++++------ .../mellanox/mlx5/core/steering/dr_ste.h | 2 + .../mellanox/mlx5/core/steering/dr_types.h | 63 +- 5 files changed, 613 insertions(+), 330 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c +6 -0
@@ -57,6 +57,12 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn) {int ret; + dmn->ste_ctx =mlx5dr_ste_get_ctx (dmn->info.caps.sw_format_ver); +if (!dmn->ste_ctx) { +mlx5dr_err (dmn,"SW Steering on this device is unsupported\n" ); +return -EOPNOTSUPP ; + } + ret =mlx5_core_alloc_pd (dmn->mdev, &dmn->pdn);if (ret) {mlx5dr_err (dmn,"Couldn't allocate PD, ret: %d" , ret);
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +61 -45
197 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +501 -265
1,200 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +2 -0
@@ -82,6 +82,8 @@ (_misc)->outer_first_mpls_over_udp_s_bos || \ (_misc)->outer_first_mpls_over_udp_ttl) +u16 mlx5dr_ste_conv_bit_to_byte_mask (u8 *bit_mask); +#define DR_STE_CTX_BUILDER (fname) \ ((*build_##fname##_init)(struct mlx5dr_ste_build *sb, \ struct mlx5dr_match_param *mask))
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +43 -20
126 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 4/16 net/mlx5: DR, Move HW STEv0 match logic to a separate file
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Move current STE match logic to a seprate file.
This file will be used for HW specific STEv0.
Future patches will add functionality for v1 steering.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 1 + .../mellanox/mlx5/core/steering/dr_ste.c | 1279 ---------------- .../mellanox/mlx5/core/steering/dr_ste.h | 2 + .../mellanox/mlx5/core/steering/dr_ste_v0.c | 1283 +++++++++++++++++ 4 files changed, 1286 insertions(+), 1279 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -0
@@ -83,5 +83,6 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o steering/dr_matcher.o steering/dr_rule.o \ steering/dr_icm_pool.o steering/dr_buddy.o \ steering/dr_ste.o steering/dr_send.o \ + steering/dr_ste_v0.o \ steering/dr_cmd.o steering/dr_fw.o \ steering/dr_action.o steering/fs_dr.o
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +0 -1279
1,411 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +2 -0
@@ -111,4 +111,6 @@ struct mlx5dr_ste_ctx { void DR_STE_CTX_BUILDER(src_gvmi_qpn); }; +extern struct mlx5dr_ste_ctx ste_ctx_v0; +#endif /* _DR_STE_ */
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c new file +1283 -0
1,283 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 5/16 net/mlx5: DR, Remove unused macro definition from dr_ste
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +0 -2
@@ -5,8 +5,6 @@#include <linux/crc32.h> #include "dr_ste.h" -#define DR_STE_CRC_POLY 0xEDB88320L -#define DR_STE_ENABLE_FLOW_TAG BIT(31)enum dr_ste_tunl_action {
Signature · 1 line
2.26.2
PATCH 6/16 net/mlx5: DR, Fix STEv0 source_eswitch_owner_vhca_id support
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Check vport_cap only if match on source gvmi is required.
--- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +14 -11
@@ -1227,23 +1227,26 @@ dr_ste_v0_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value, caps = &dmn->peer_dmn->info.caps; else return -EINVAL; + + misc->source_eswitch_owner_vhca_id =0 ; }else { caps = &dmn->info.caps; } - vport_cap =mlx5dr_get_vport_cap (caps, misc->source_port); -if (!vport_cap) { -mlx5dr_err (dmn,"Vport 0x%x is invalid\n" , - misc->source_port); -return -EINVAL ; - } - source_gvmi_set =MLX5_GET (ste_src_gvmi_qp, bit_mask, source_gvmi); -if (vport_cap->vport_gvmi && source_gvmi_set) -MLX5_SET (ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi); +if (source_gvmi_set) { + vport_cap =mlx5dr_get_vport_cap (caps, misc->source_port); +if (!vport_cap) { +mlx5dr_err (dmn,"Vport 0x%x is invalid\n" , + misc->source_port); +return -EINVAL ; + } - misc->source_eswitch_owner_vhca_id =0 ; - misc->source_port =0 ; +if (vport_cap->vport_gvmi) +MLX5_SET (ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi); + + misc->source_port =0 ; + }return 0 ; }
Signature · 1 line
2.26.2
PATCH 7/16 net/mlx5: DR, Merge similar DR STE SET macros
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Merge DR_STE_STE macros for better code reuse, the macro DR_STE_SET_MASK_V and DR_STE_SET_TAG are merged to avoid tag and bit_mask function creation which are usually the same.
--- .../mellanox/mlx5/core/steering/dr_ste.h | 35 +- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 464 +++--------------- 2 files changed, 84 insertions(+), 415 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +11 -24
@@ -24,17 +24,13 @@ } \ }while (0 ) -/* Set to STE spec->s_fname to tag->t_fname */ +/* Set to STE spec->s_fname to tag->t_fname set spec->s_fname as used */#define DR_STE_SET_TAG (lookup_type, tag, t_fname, spec, s_fname) \ DR_STE_SET_VAL(lookup_type, tag, t_fname, spec, s_fname, spec->s_fname) -/* Set to STE -1 to bit_mask->bm_fname and set spec->s_fname as used */ -#define DR_STE_SET_MASK (lookup_type, bit_mask, bm_fname, spec, s_fname) \ - DR_STE_SET_VAL(lookup_type, bit_mask, bm_fname, spec, s_fname, -1) - -/* Set to STE spec->s_fname to bit_mask->bm_fname and set spec->s_fname as used */ -#define DR_STE_SET_MASK_V (lookup_type, bit_mask, bm_fname, spec, s_fname) \ - DR_STE_SET_VAL(lookup_type, bit_mask, bm_fname, spec, s_fname, (spec)->s_fname) +/* Set to STE -1 to tag->t_fname and set spec->s_fname as used */ +#define DR_STE_SET_ONES (lookup_type, tag, t_fname, spec, s_fname) \ + DR_STE_SET_VAL(lookup_type, tag, t_fname, spec, s_fname, -1)#define DR_STE_SET_TCP_FLAGS (lookup_type, tag, spec) do { \ MLX5_SET(ste_##lookup_type, tag, tcp_ns, !!((spec)->tcp_flags & (1 << 8))); \
@@ -48,25 +44,16 @@ MLX5_SET(ste_##lookup_type, tag, tcp_fin, !!((spec)->tcp_flags & (1 << 0))); \ } while (0) -#define DR_STE_SET_MPLS_MASK (lookup_type, mask, in_out, bit_mask) do { \ - DR_STE_SET_MASK_V(lookup_type, bit_mask, mpls0_label, mask, \ - in_out##_first_mpls_label);\ - DR_STE_SET_MASK_V(lookup_type, bit_mask, mpls0_s_bos, mask, \ - in_out##_first_mpls_s_bos); \ - DR_STE_SET_MASK_V(lookup_type, bit_mask, mpls0_exp, mask, \ - in_out##_first_mpls_exp); \ - DR_STE_SET_MASK_V(lookup_type, bit_mask, mpls0_ttl, mask, \ - in_out##_first_mpls_ttl); \ -} while (0) - -#define DR_STE_SET_MPLS_TAG (lookup_type, mask, in_out, tag) do { \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_label, mask, \ +#define DR_STE_SET_MPLS (lookup_type, mask, in_out, tag) do { \ + struct mlx5dr_match_misc2 *_mask = mask; \ + u8 *_tag = tag; \ + DR_STE_SET_TAG(lookup_type, _tag, mpls0_label, _mask, \ in_out##_first_mpls_label);\ - DR_STE_SET_TAG(lookup_type, tag, mpls0_s_bos, mask, \ + DR_STE_SET_TAG(lookup_type, _tag, mpls0_s_bos, _mask, \ in_out##_first_mpls_s_bos); \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_exp, mask, \ + DR_STE_SET_TAG(lookup_type, _tag, mpls0_exp, _mask, \ in_out##_first_mpls_exp); \ - DR_STE_SET_TAG(lookup_type, tag, mpls0_ttl, mask, \ + DR_STE_SET_TAG(lookup_type, _tag, mpls0_ttl, _mask, \ in_out##_first_mpls_ttl); \ } while (0)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +73 -391
741 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 8/16 net/mlx5: DR, Move STEv0 look up types from mlx5_ifc_dr header
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
The lookup types are device specific and should not be exposed to DR upper layers, matchers/tables. Each HW STE version should keep them internal. The lu_type size is updated to support larger lu_types as required for STEv1.
--- .../mellanox/mlx5/core/steering/dr_ste.c | 6 +- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 70 +++++++++++++++---- .../mellanox/mlx5/core/steering/dr_types.h | 8 +-- .../mellanox/mlx5/core/steering/mlx5_ifc_dr.h | 40 ----------- 4 files changed, 64 insertions(+), 60 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +3 -3
@@ -171,7 +171,7 @@ void mlx5dr_ste_set_hit_gvmi(u8 *hw_ste_p, u16 gvmi)MLX5_SET (ste_general, hw_ste_p, next_table_base_63_48, gvmi); } -void mlx5dr_ste_init (u8 *hw_ste_p,u8 lu_type,u8 entry_type, +void mlx5dr_ste_init (u8 *hw_ste_p,u16 lu_type,u8 entry_type,u16 gvmi) {MLX5_SET (ste_general, hw_ste_p, entry_type, entry_type);
@@ -523,7 +523,7 @@ int mlx5dr_ste_create_next_htbl(struct mlx5dr_matcher *matcher,struct mlx5dr_ste_htbl *next_htbl;if (!mlx5dr_ste_is_last_in_rule (nic_matcher, ste->ste_chain_location)) { -u8 next_lu_type; +u16 next_lu_type;u16 byte_mask; next_lu_type =MLX5_GET (ste_general, hw_ste, next_lu_type);
@@ -576,7 +576,7 @@ static void dr_ste_set_ctrl(struct mlx5dr_ste_htbl *htbl)struct mlx5dr_ste_htbl *mlx5dr_ste_htbl_alloc (struct mlx5dr_icm_pool *pool,enum mlx5dr_icm_chunk_size chunk_size, -u8 lu_type,u16 byte_mask) +u16 lu_type,u16 byte_mask) {struct mlx5dr_icm_chunk *chunk;struct mlx5dr_ste_htbl *htbl;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +57 -13
136 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +4 -4
@@ -155,7 +155,7 @@ struct mlx5dr_ste_htbl_ctrl { };struct mlx5dr_ste_htbl { -u8 lu_type; +u16 lu_type;u16 byte_mask;u32 refcount;struct mlx5dr_icm_chunk *chunk;
@@ -191,7 +191,7 @@ struct mlx5dr_ste_build { u8 vhca_id_valid:1;struct mlx5dr_domain *dmn;struct mlx5dr_cmd_caps *caps; -u8 lu_type; +u16 lu_type;u16 byte_mask;u8 bit_mask[DR_STE_SIZE_MASK ]; int (*ste_build_tag_func)(struct mlx5dr_match_param *spec,
@@ -202,7 +202,7 @@ struct mlx5dr_ste_build {struct mlx5dr_ste_htbl *mlx5dr_ste_htbl_alloc (struct mlx5dr_icm_pool *pool,enum mlx5dr_icm_chunk_size chunk_size, -u8 lu_type,u16 byte_mask); +u16 lu_type,u16 byte_mask);int mlx5dr_ste_htbl_free (struct mlx5dr_ste_htbl *htbl);
@@ -220,7 +220,7 @@ static inline void mlx5dr_htbl_get(struct mlx5dr_ste_htbl *htbl)/* STE utils */ u32 mlx5dr_ste_calc_hash_index (u8 *hw_ste_p,struct mlx5dr_ste_htbl *htbl); -void mlx5dr_ste_init (u8 *hw_ste_p,u8 lu_type,u8 entry_type,u16 gvmi); +void mlx5dr_ste_init (u8 *hw_ste_p,u16 lu_type,u8 entry_type,u16 gvmi);void mlx5dr_ste_always_hit_htbl (struct mlx5dr_ste *ste,struct mlx5dr_ste_htbl *next_htbl);void mlx5dr_ste_set_miss_addr (u8 *hw_ste,u64 miss_addr);
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h +0 -40
@@ -50,46 +50,6 @@ enum { };enum { -MLX5DR_STE_LU_TYPE_NOP =0x00 , -MLX5DR_STE_LU_TYPE_SRC_GVMI_AND_QP =0x05 , -MLX5DR_STE_LU_TYPE_ETHL2_TUNNELING_I =0x0a , -MLX5DR_STE_LU_TYPE_ETHL2_DST_O =0x06 , -MLX5DR_STE_LU_TYPE_ETHL2_DST_I =0x07 , -MLX5DR_STE_LU_TYPE_ETHL2_DST_D =0x1b , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_O =0x08 , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_I =0x09 , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_D =0x1c , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_DST_O =0x36 , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_DST_I =0x37 , -MLX5DR_STE_LU_TYPE_ETHL2_SRC_DST_D =0x38 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_DST_O =0x0d , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_DST_I =0x0e , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_DST_D =0x1e , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_SRC_O =0x0f , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_SRC_I =0x10 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV6_SRC_D =0x1f , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_5_TUPLE_O =0x11 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_5_TUPLE_I =0x12 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_5_TUPLE_D =0x20 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_MISC_O =0x29 , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_MISC_I =0x2a , -MLX5DR_STE_LU_TYPE_ETHL3_IPV4_MISC_D =0x2b , -MLX5DR_STE_LU_TYPE_ETHL4_O =0x13 , -MLX5DR_STE_LU_TYPE_ETHL4_I =0x14 , -MLX5DR_STE_LU_TYPE_ETHL4_D =0x21 , -MLX5DR_STE_LU_TYPE_ETHL4_MISC_O =0x2c , -MLX5DR_STE_LU_TYPE_ETHL4_MISC_I =0x2d , -MLX5DR_STE_LU_TYPE_ETHL4_MISC_D =0x2e , -MLX5DR_STE_LU_TYPE_MPLS_FIRST_O =0x15 , -MLX5DR_STE_LU_TYPE_MPLS_FIRST_I =0x24 , -MLX5DR_STE_LU_TYPE_MPLS_FIRST_D =0x25 , -MLX5DR_STE_LU_TYPE_GRE =0x16 , -MLX5DR_STE_LU_TYPE_FLEX_PARSER_0 =0x22 , -MLX5DR_STE_LU_TYPE_FLEX_PARSER_1 =0x23 , -MLX5DR_STE_LU_TYPE_FLEX_PARSER_TNL_HEADER =0x19 , -MLX5DR_STE_LU_TYPE_GENERAL_PURPOSE =0x18 , -MLX5DR_STE_LU_TYPE_STEERING_REGISTERS_0 =0x2f , -MLX5DR_STE_LU_TYPE_STEERING_REGISTERS_1 =0x30 ,MLX5DR_STE_LU_TYPE_DONT_CARE =0x0f , };
Signature · 1 line
2.26.2
PATCH 9/16 net/mlx5: DR, Refactor ICMP STE builder
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Reworked ICMP tag builder to better handle ICMP v4/6 fields and avoid unneeded code duplication and 'if' statements, removed unused macro, changed bitfield of len 8 to u8.
--- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 57 +++++++------------ .../mellanox/mlx5/core/steering/dr_types.h | 8 +-- 2 files changed, 23 insertions(+), 42 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +19 -38
@@ -662,9 +662,8 @@ dr_ste_v0_build_tnl_mpls_init(struct mlx5dr_ste_build *sb, sb->ste_build_tag_func = &dr_ste_v0_build_tnl_mpls_tag; } -#define ICMP_TYPE_OFFSET_FIRST_DW 24 -#define ICMP_CODE_OFFSET_FIRST_DW 16 -#define ICMP_HEADER_DATA_OFFSET_SECOND_DW 0 +#define ICMP_TYPE_OFFSET_FIRST_DW 24 +#define ICMP_CODE_OFFSET_FIRST_DW 16 static int dr_ste_v0_build_icmp_tag(struct mlx5dr_match_param *value,
@@ -672,49 +671,36 @@ dr_ste_v0_build_icmp_tag(struct mlx5dr_match_param *value, u8 *tag) {struct mlx5dr_match_misc3 *misc_3 = &value->misc3; -u32 icmp_header_data; +u32 *icmp_header_data;int dw0_location;int dw1_location; -u32 icmp_type; -u32 icmp_code; +u8 *icmp_type; +u8 *icmp_code;bool is_ipv4; is_ipv4 =DR_MASK_IS_ICMPV4_SET (misc_3);if (is_ipv4) { - icmp_header_data = misc_3->icmpv4_header_data; - icmp_type = misc_3->icmpv4_type; - icmp_code = misc_3->icmpv4_code; + icmp_header_data = &misc_3->icmpv4_header_data; + icmp_type = &misc_3->icmpv4_type; + icmp_code = &misc_3->icmpv4_code; dw0_location = sb->caps->flex_parser_id_icmp_dw0; dw1_location = sb->caps->flex_parser_id_icmp_dw1; }else { - icmp_header_data = misc_3->icmpv6_header_data; - icmp_type = misc_3->icmpv6_type; - icmp_code = misc_3->icmpv6_code; + icmp_header_data = &misc_3->icmpv6_header_data; + icmp_type = &misc_3->icmpv6_type; + icmp_code = &misc_3->icmpv6_code; dw0_location = sb->caps->flex_parser_id_icmpv6_dw0; dw1_location = sb->caps->flex_parser_id_icmpv6_dw1; }switch (dw0_location) {case 4 : -if (icmp_type) { -MLX5_SET (ste_flex_parser_1, tag, flex_parser_4, - (icmp_type <<ICMP_TYPE_OFFSET_FIRST_DW )); -if (is_ipv4) - misc_3->icmpv4_type =0 ; -else - misc_3->icmpv6_type =0 ; - } +MLX5_SET (ste_flex_parser_1, tag, flex_parser_4, + (*icmp_type <<ICMP_TYPE_OFFSET_FIRST_DW ) | + (*icmp_code <<ICMP_TYPE_OFFSET_FIRST_DW )); -if (icmp_code) { -u32 cur_val =MLX5_GET (ste_flex_parser_1, tag, - flex_parser_4); -MLX5_SET (ste_flex_parser_1, tag, flex_parser_4, - cur_val | (icmp_code <<ICMP_CODE_OFFSET_FIRST_DW )); -if (is_ipv4) - misc_3->icmpv4_code =0 ; -else - misc_3->icmpv6_code =0 ; - } + *icmp_type =0 ; + *icmp_code =0 ;break ;default :return -EINVAL ;
@@ -722,14 +708,9 @@ dr_ste_v0_build_icmp_tag(struct mlx5dr_match_param *value,switch (dw1_location) {case 5 : -if (icmp_header_data) { -MLX5_SET (ste_flex_parser_1, tag, flex_parser_5, - (icmp_header_data <<ICMP_HEADER_DATA_OFFSET_SECOND_DW )); -if (is_ipv4) - misc_3->icmpv4_header_data =0 ; -else - misc_3->icmpv6_header_data =0 ; - } +MLX5_SET (ste_flex_parser_1, tag, flex_parser_5, + *icmp_header_data); + *icmp_header_data =0 ;break ;default :return -EINVAL ;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +4 -4
@@ -596,10 +596,10 @@ struct mlx5dr_match_misc3 { u32 outer_vxlan_gpe_next_protocol:8;u32 icmpv4_header_data;u32 icmpv6_header_data; - u32 icmpv6_code:8; - u32 icmpv6_type:8; - u32 icmpv4_code:8; - u32 icmpv4_type:8; +u8 icmpv6_code; +u8 icmpv6_type; +u8 icmpv4_code; +u8 icmpv4_type;u8 reserved_auto3[0x1c ]; };
Signature · 1 line
2.26.2
PATCH 10/16 net/mlx5: DR, Move action apply logic to dr_ste
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
The action apply logic is device specific per STE version, moving to the STE layer will allow implementing it for both devices while keeping DR upper layers the same.
--- .../mellanox/mlx5/core/steering/dr_action.c | 177 +------------ .../mellanox/mlx5/core/steering/dr_ste.c | 236 ++++++++++++++---- .../mellanox/mlx5/core/steering/dr_types.h | 52 ++-- 3 files changed, 231 insertions(+), 234 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +9 -168
@@ -348,28 +348,6 @@ static const struct dr_action_modify_field_conv dr_action_conv_arr[] = { }, }; -#define MAX_VLANS 2 -struct dr_action_vlan_info { -int count; -u32 headers[MAX_VLANS ]; -}; - -struct dr_action_apply_attr { -u32 modify_index; -u16 modify_actions; -u32 decap_index; -u16 decap_actions; -u8 decap_with_vlan:1 ; -u64 final_icm_addr; -u32 flow_tag; -u32 ctr_id; -u16 gvmi; -u16 hit_gvmi; -u32 reformat_id; -u32 reformat_size; -struct dr_action_vlan_info vlans; -}; -static int dr_action_reformat_to_action_type (enum mlx5dr_action_reformat_type reformat_type,enum mlx5dr_action_type *action_type)
@@ -394,141 +372,6 @@ dr_action_reformat_to_action_type(enum mlx5dr_action_reformat_type reformat_typereturn 0 ; } -static void dr_actions_init_next_ste (u8 **last_ste, -u32 *added_stes, -enum mlx5dr_ste_entry_type entry_type, -u16 gvmi) -{ - (*added_stes)++; - *last_ste +=DR_STE_SIZE ; -mlx5dr_ste_init (*last_ste,MLX5DR_STE_LU_TYPE_DONT_CARE , entry_type, gvmi); -} - -static void dr_actions_apply_tx (struct mlx5dr_domain *dmn, -u8 *action_type_set, -u8 *last_ste, -struct dr_action_apply_attr *attr, -u32 *added_stes) -{ -bool encap = action_type_set[DR_ACTION_TYP_L2_TO_TNL_L2 ] || - action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3 ]; - -/* We want to make sure the modify header comes before L2 -* encapsulation. The reason for that is that we support -* modify headers for outer headers only -*/ -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) { -mlx5dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); -mlx5dr_ste_set_rewrite_actions (last_ste, - attr->modify_actions, - attr->modify_index); - } - -if (action_type_set[DR_ACTION_TYP_PUSH_VLAN ]) { -int i; - -for (i =0 ; i < attr->vlans.count; i++) { -if (i || action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) -dr_actions_init_next_ste (&last_ste, - added_stes, -MLX5DR_STE_TYPE_TX , - attr->gvmi); - -mlx5dr_ste_set_tx_push_vlan (last_ste, - attr->vlans.headers[i], - encap); - } - } - -if (encap) { -/* Modify header and encapsulation require a different STEs. -* Since modify header STE format doesn't support encapsulation -* tunneling_action. -*/ -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ] || - action_type_set[DR_ACTION_TYP_PUSH_VLAN ]) -dr_actions_init_next_ste (&last_ste, - added_stes, -MLX5DR_STE_TYPE_TX , - attr->gvmi); - -mlx5dr_ste_set_tx_encap (last_ste, - attr->reformat_id, - attr->reformat_size, - action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3 ]); -/* Whenever prio_tag_required enabled, we can be sure that the -* previous table (ACL) already push vlan to our packet, -* And due to HW limitation we need to set this bit, otherwise -* push vlan + reformat will not work. -*/ -if (MLX5_CAP_GEN (dmn->mdev, prio_tag_required)) -mlx5dr_ste_set_go_back_bit (last_ste); - } - -if (action_type_set[DR_ACTION_TYP_CTR ]) -mlx5dr_ste_set_counter_id (last_ste, attr->ctr_id); -} - -static void dr_actions_apply_rx (u8 *action_type_set, -u8 *last_ste, -struct dr_action_apply_attr *attr, -u32 *added_stes) -{ -if (action_type_set[DR_ACTION_TYP_CTR ]) -mlx5dr_ste_set_counter_id (last_ste, attr->ctr_id); - -if (action_type_set[DR_ACTION_TYP_TNL_L3_TO_L2 ]) { -mlx5dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); -mlx5dr_ste_set_rx_decap_l3 (last_ste, attr->decap_with_vlan); -mlx5dr_ste_set_rewrite_actions (last_ste, - attr->decap_actions, - attr->decap_index); - } - -if (action_type_set[DR_ACTION_TYP_TNL_L2_TO_L2 ]) -mlx5dr_ste_set_rx_decap (last_ste); - -if (action_type_set[DR_ACTION_TYP_POP_VLAN ]) { -int i; - -for (i =0 ; i < attr->vlans.count; i++) { -if (i || - action_type_set[DR_ACTION_TYP_TNL_L2_TO_L2 ] || - action_type_set[DR_ACTION_TYP_TNL_L3_TO_L2 ]) -dr_actions_init_next_ste (&last_ste, - added_stes, -MLX5DR_STE_TYPE_RX , - attr->gvmi); - -mlx5dr_ste_set_rx_pop_vlan (last_ste); - } - } - -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) { -if (mlx5dr_ste_get_entry_type (last_ste) ==MLX5DR_STE_TYPE_MODIFY_PKT ) -dr_actions_init_next_ste (&last_ste, - added_stes, -MLX5DR_STE_TYPE_MODIFY_PKT , - attr->gvmi); -else -mlx5dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); - -mlx5dr_ste_set_rewrite_actions (last_ste, - attr->modify_actions, - attr->modify_index); - } - -if (action_type_set[DR_ACTION_TYP_TAG ]) { -if (mlx5dr_ste_get_entry_type (last_ste) ==MLX5DR_STE_TYPE_MODIFY_PKT ) -dr_actions_init_next_ste (&last_ste, - added_stes, -MLX5DR_STE_TYPE_RX , - attr->gvmi); - -mlx5dr_ste_rx_set_flow_tag (last_ste, attr->flow_tag); - } -} -/* Apply the actions on the rule STE array starting from the last_ste. * Actions might require more than one STE, new_num_stes will return * the new size of the STEs array, rule with actions.
@@ -537,21 +380,19 @@ static void dr_actions_apply(struct mlx5dr_domain *dmn,enum mlx5dr_ste_entry_type ste_type, u8 *action_type_set, u8 *last_ste, - struct dr_action_apply_attr *attr, + struct mlx5dr_ste_actions_attr *attr, u32 *new_num_stes) { u32 added_stes = 0;if (ste_type ==MLX5DR_STE_TYPE_RX ) -dr_actions_apply_rx (action_type_set, last_ste, attr, &added_stes); +mlx5dr_ste_set_actions_rx (dmn, action_type_set, + last_ste, attr, &added_stes);else -dr_actions_apply_tx (dmn, action_type_set, last_ste, attr, &added_stes); +mlx5dr_ste_set_actions_tx (dmn, action_type_set, + last_ste, attr, &added_stes); - last_ste += added_stes *DR_STE_SIZE ; *new_num_stes += added_stes; - -mlx5dr_ste_set_hit_gvmi (last_ste, attr->hit_gvmi); -mlx5dr_ste_set_hit_addr (last_ste, attr->final_icm_addr,1 ); } static enum dr_action_domain
@@ -643,9 +484,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,bool rx_rule = nic_dmn->ste_type ==MLX5DR_STE_TYPE_RX ;struct mlx5dr_domain *dmn = matcher->tbl->dmn;u8 action_type_set[DR_ACTION_TYP_MAX ] = {}; +struct mlx5dr_ste_actions_attr attr = {};struct mlx5dr_action *dest_action =NULL ;u32 state =DR_ACTION_STATE_NO_ACTION ; -struct dr_action_apply_attr attr = {};enum dr_action_domain action_domain;bool recalc_cs_required = false;u8 *last_ste;
@@ -756,12 +597,12 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, }break ;case DR_ACTION_TYP_POP_VLAN : - max_actions_type =MAX_VLANS ; + max_actions_type =MLX5DR_MAX_VLANS ; attr.vlans.count++;break ;case DR_ACTION_TYP_PUSH_VLAN : - max_actions_type =MAX_VLANS ; -if (attr.vlans.count ==MAX_VLANS ) + max_actions_type =MLX5DR_MAX_VLANS ; +if (attr.vlans.count ==MLX5DR_MAX_VLANS )return -EINVAL ; attr.vlans.headers[attr.vlans.count++] = action->push_vlan.vlan_hdr;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +190 -46
367 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +32 -20
67 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 11/16 net/mlx5: DR, Add STE setters and getters per-device API
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Extend the STE context struct with various per-device setters and getters.
--- .../ethernet/mellanox/mlx5/core/steering/dr_ste.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +12 -0
@@ -76,6 +76,7 @@ u16 mlx5dr_ste_conv_bit_to_byte_mask(u8 *bit_mask); struct mlx5dr_match_param *mask)) struct mlx5dr_ste_ctx { +/* Builders */ void DR_STE_CTX_BUILDER (eth_l2_src_dst );void DR_STE_CTX_BUILDER (eth_l3_ipv6_src );void DR_STE_CTX_BUILDER (eth_l3_ipv6_dst );
@@ -96,6 +97,17 @@ struct mlx5dr_ste_ctx {void DR_STE_CTX_BUILDER (register_0 );void DR_STE_CTX_BUILDER (register_1 );void DR_STE_CTX_BUILDER (src_gvmi_qpn ); + +/* Getters and Setters */ +void (*ste_init)(u8 *hw_ste_p,u16 lu_type, +u8 entry_type,u16 gvmi); +void (*set_next_lu_type)(u8 *hw_ste_p,u16 lu_type); +u16 (*get_next_lu_type)(u8 *hw_ste_p); +void (*set_miss_addr)(u8 *hw_ste_p,u64 miss_addr); +u64 (*get_miss_addr)(u8 *hw_ste_p); +void (*set_hit_addr)(u8 *hw_ste_p,u64 icm_addr,u32 ht_size); +void (*set_byte_mask)(u8 *hw_ste_p,u16 byte_mask); +u16 (*get_byte_mask)(u8 *hw_ste_p); };extern struct mlx5dr_ste_ctx ste_ctx_v0;
Signature · 1 line
2.26.2
PATCH 12/16 net/mlx5: DR, Move STEv0 setters and getters
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Use the new setters and getters API for STEv0: move HW specific setter and getters from dr_ste to STEv0 file. Since STEv0 and STEv1 format are different each version should implemented different setters and getters. Rename remaining static functions w/o mlx5 prefix.
--- .../mellanox/mlx5/core/steering/dr_action.c | 5 +- .../mellanox/mlx5/core/steering/dr_rule.c | 49 ++++-- .../mellanox/mlx5/core/steering/dr_ste.c | 147 ++++++++---------- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 77 +++++++++ .../mellanox/mlx5/core/steering/dr_types.h | 20 ++- 5 files changed, 195 insertions(+), 103 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +3 -2
@@ -383,13 +383,14 @@ static void dr_actions_apply(struct mlx5dr_domain *dmn,struct mlx5dr_ste_actions_attr *attr, u32 *new_num_stes) { + struct mlx5dr_ste_ctx *ste_ctx = dmn->ste_ctx;u32 added_stes =0 ;if (ste_type ==MLX5DR_STE_TYPE_RX ) -mlx5dr_ste_set_actions_rx (dmn, action_type_set, +mlx5dr_ste_set_actions_rx (ste_ctx, dmn, action_type_set, last_ste, attr, &added_stes);else -mlx5dr_ste_set_actions_tx (dmn, action_type_set, +mlx5dr_ste_set_actions_tx (ste_ctx, dmn, action_type_set, last_ste, attr, &added_stes); *new_num_stes += added_stes;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +33 -16
167 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +69 -78
347 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +77 -0
93 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +13 -7
@@ -220,8 +220,13 @@ static inline void mlx5dr_htbl_get(struct mlx5dr_ste_htbl *htbl)/* STE utils */ u32 mlx5dr_ste_calc_hash_index (u8 *hw_ste_p,struct mlx5dr_ste_htbl *htbl); -void mlx5dr_ste_set_miss_addr (u8 *hw_ste,u64 miss_addr); -void mlx5dr_ste_set_hit_addr (u8 *hw_ste,u64 icm_addr,u32 ht_size); +void mlx5dr_ste_set_miss_addr (struct mlx5dr_ste_ctx *ste_ctx, +u8 *hw_ste,u64 miss_addr); +void mlx5dr_ste_set_hit_addr (struct mlx5dr_ste_ctx *ste_ctx, +u8 *hw_ste,u64 icm_addr,u32 ht_size); +void mlx5dr_ste_set_hit_addr_by_next_htbl (struct mlx5dr_ste_ctx *ste_ctx, +u8 *hw_ste, +struct mlx5dr_ste_htbl *next_htbl);void mlx5dr_ste_set_bit_mask (u8 *hw_ste_p,u8 *bit_mask);bool mlx5dr_ste_is_last_in_rule (struct mlx5dr_matcher_rx_tx *nic_matcher,u8 ste_location);
@@ -250,12 +255,14 @@ struct mlx5dr_ste_actions_attr { } vlans; }; -void mlx5dr_ste_set_actions_rx (struct mlx5dr_domain *dmn, +void mlx5dr_ste_set_actions_rx (struct mlx5dr_ste_ctx *ste_ctx, +struct mlx5dr_domain *dmn,u8 *action_type_set,u8 *last_ste,struct mlx5dr_ste_actions_attr *attr,u32 *added_stes); -void mlx5dr_ste_set_actions_tx(struct mlx5dr_domain *dmn, +void mlx5dr_ste_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_domain *dmn, u8 *action_type_set, u8 *last_ste, struct mlx5dr_ste_actions_attr *attr,
@@ -285,8 +292,6 @@ static inline bool mlx5dr_ste_is_not_used(struct mlx5dr_ste *ste)return !ste->refcount; } -void mlx5dr_ste_set_hit_addr_by_next_htbl (u8 *hw_ste, -struct mlx5dr_ste_htbl *next_htbl);bool mlx5dr_ste_equal_tag (void *src,void *dst); int mlx5dr_ste_create_next_htbl(struct mlx5dr_matcher *matcher, struct mlx5dr_matcher_rx_tx *nic_matcher,
@@ -1035,7 +1040,8 @@ int mlx5dr_ste_htbl_init_and_postsend(struct mlx5dr_domain *dmn,struct mlx5dr_ste_htbl *htbl, struct mlx5dr_htbl_connect_info *connect_info, bool update_hw_ste); -void mlx5dr_ste_set_formatted_ste(u16 gvmi, +void mlx5dr_ste_set_formatted_ste(struct mlx5dr_ste_ctx *ste_ctx, + u16 gvmi, struct mlx5dr_domain_rx_tx *nic_dmn, struct mlx5dr_ste_htbl *htbl, u8 *formatted_ste,
Signature · 1 line
2.26.2
PATCH 13/16 net/mlx5: DR, Add STE tx/rx actions per-device API
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Extend the STE context struct with per-device
tx/rx actions.
--- .../ethernet/mellanox/mlx5/core/steering/dr_ste.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +12 -0
@@ -108,6 +108,18 @@ struct mlx5dr_ste_ctx {void (*set_hit_addr)(u8 *hw_ste_p,u64 icm_addr,u32 ht_size);void (*set_byte_mask)(u8 *hw_ste_p,u16 byte_mask);u16 (*get_byte_mask)(u8 *hw_ste_p); + +/* Actions */ +void (*set_actions_rx)(struct mlx5dr_domain *dmn, +u8 *action_type_set, +u8 *hw_ste_arr, +struct mlx5dr_ste_actions_attr *attr, +u32 *added_stes); +void (*set_actions_tx)(struct mlx5dr_domain *dmn, +u8 *action_type_set, +u8 *hw_ste_arr, +struct mlx5dr_ste_actions_attr *attr, +u32 *added_stes); };extern struct mlx5dr_ste_ctx ste_ctx_v0;
Signature · 1 line
2.26.2
PATCH 14/16 net/mlx5: DR, Move STEv0 action apply logic
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Use STE tx/rx actions per-device API: move HW specific action apply logic from dr_ste to STEv0 file - STEv0 and STEv1 actions format is different, each version should have its own implementation.
--- .../mellanox/mlx5/core/steering/dr_ste.c | 240 +---------------- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 251 +++++++++++++++++- 2 files changed, 256 insertions(+), 235 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +6 -234
@@ -5,22 +5,6 @@#include <linux/crc32.h> #include "dr_ste.h" -#define DR_STE_ENABLE_FLOW_TAG BIT(31) - -enum dr_ste_tunl_action { -DR_STE_TUNL_ACTION_NONE =0 , -DR_STE_TUNL_ACTION_ENABLE =1 , -DR_STE_TUNL_ACTION_DECAP =2 , -DR_STE_TUNL_ACTION_L3_DECAP =3 , -DR_STE_TUNL_ACTION_POP_VLAN =4 , -}; - -enum dr_ste_action_type { -DR_STE_ACTION_TYPE_PUSH_VLAN =1 , -DR_STE_ACTION_TYPE_ENCAP_L3 =3 , -DR_STE_ACTION_TYPE_ENCAP =4 , -}; -struct dr_hw_ste_format {u8 ctrl[DR_STE_SIZE_CTRL ];u8 tag[DR_STE_SIZE_TAG ];
@@ -88,90 +72,6 @@ void mlx5dr_ste_set_bit_mask(u8 *hw_ste_p, u8 *bit_mask)memcpy (hw_ste->mask, bit_mask,DR_STE_SIZE_MASK ); } -static void dr_ste_rx_set_flow_tag (u8 *hw_ste_p,u32 flow_tag) -{ -MLX5_SET (ste_rx_steering_mult, hw_ste_p, qp_list_pointer, -DR_STE_ENABLE_FLOW_TAG | flow_tag); -} - -static void dr_ste_set_counter_id (u8 *hw_ste_p,u32 ctr_id) -{ -/* This can be used for both rx_steering_mult and for sx_transmit */ -MLX5_SET (ste_rx_steering_mult, hw_ste_p, counter_trigger_15_0, ctr_id); -MLX5_SET (ste_rx_steering_mult, hw_ste_p, counter_trigger_23_16, ctr_id >>16 ); -} - -static void dr_ste_set_go_back_bit (u8 *hw_ste_p) -{ -MLX5_SET (ste_sx_transmit, hw_ste_p, go_back,1 ); -} - -static void dr_ste_set_tx_push_vlan (u8 *hw_ste_p,u32 vlan_hdr, -bool go_back) -{ -MLX5_SET (ste_sx_transmit, hw_ste_p, action_type, -DR_STE_ACTION_TYPE_PUSH_VLAN ); -MLX5_SET (ste_sx_transmit, hw_ste_p, encap_pointer_vlan_data, vlan_hdr); -/* Due to HW limitation we need to set this bit, otherwise reforamt + -* push vlan will not work. -*/ -if (go_back) -dr_ste_set_go_back_bit (hw_ste_p); -} - -static void dr_ste_set_tx_encap (void *hw_ste_p,u32 reformat_id, -int size,bool encap_l3) -{ -MLX5_SET (ste_sx_transmit, hw_ste_p, action_type, - encap_l3 ?DR_STE_ACTION_TYPE_ENCAP_L3 :DR_STE_ACTION_TYPE_ENCAP ); -/* The hardware expects here size in words (2 byte) */ -MLX5_SET (ste_sx_transmit, hw_ste_p, action_description, size /2 ); -MLX5_SET (ste_sx_transmit, hw_ste_p, encap_pointer_vlan_data, reformat_id); -} - -static void dr_ste_set_rx_decap (u8 *hw_ste_p) -{ -MLX5_SET (ste_rx_steering_mult, hw_ste_p, tunneling_action, -DR_STE_TUNL_ACTION_DECAP ); -} - -static void dr_ste_set_rx_pop_vlan (u8 *hw_ste_p) -{ -MLX5_SET (ste_rx_steering_mult, hw_ste_p, tunneling_action, -DR_STE_TUNL_ACTION_POP_VLAN ); -} - -static void dr_ste_set_rx_decap_l3 (u8 *hw_ste_p,bool vlan) -{ -MLX5_SET (ste_rx_steering_mult, hw_ste_p, tunneling_action, -DR_STE_TUNL_ACTION_L3_DECAP ); -MLX5_SET (ste_modify_packet, hw_ste_p, action_description, vlan ?1 :0 ); -} - -static void dr_ste_set_entry_type (u8 *hw_ste_p,u8 entry_type) -{ -MLX5_SET (ste_general, hw_ste_p, entry_type, entry_type); -} - -static u8 dr_ste_get_entry_type (u8 *hw_ste_p) -{ -return MLX5_GET (ste_general, hw_ste_p, entry_type); -} - -static void dr_ste_set_rewrite_actions (u8 *hw_ste_p,u16 num_of_actions, -u32 re_write_index) -{ -MLX5_SET (ste_modify_packet, hw_ste_p, number_of_re_write_actions, - num_of_actions); -MLX5_SET (ste_modify_packet, hw_ste_p, header_re_write_actions_pointer, - re_write_index); -} - -static void dr_ste_set_hit_gvmi (u8 *hw_ste_p,u16 gvmi) -{ -MLX5_SET (ste_general, hw_ste_p, next_table_base_63_48, gvmi); -} -static void dr_ste_set_always_hit (struct dr_hw_ste_format *hw_ste) {memset (&hw_ste->tag,0 ,sizeof (hw_ste->tag));
@@ -612,154 +512,26 @@ int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl)return 0 ; } -static void dr_ste_arr_init_next_ste (struct mlx5dr_ste_ctx *ste_ctx, -u8 **last_ste, -u32 *added_stes, -enum mlx5dr_ste_entry_type entry_type, -u16 gvmi) -{ - (*added_stes)++; - *last_ste +=DR_STE_SIZE ; - ste_ctx->ste_init (*last_ste,MLX5DR_STE_LU_TYPE_DONT_CARE , entry_type, gvmi); -} -void mlx5dr_ste_set_actions_tx (struct mlx5dr_ste_ctx *ste_ctx,struct mlx5dr_domain *dmn,u8 *action_type_set, -u8 *last_ste, +u8 *hw_ste_arr,struct mlx5dr_ste_actions_attr *attr,u32 *added_stes) { -bool encap = action_type_set[DR_ACTION_TYP_L2_TO_TNL_L2 ] || - action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3 ]; - -/* We want to make sure the modify header comes before L2 -* encapsulation. The reason for that is that we support -* modify headers for outer headers only -*/ -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) { -dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); -dr_ste_set_rewrite_actions (last_ste, - attr->modify_actions, - attr->modify_index); - } - -if (action_type_set[DR_ACTION_TYP_PUSH_VLAN ]) { -int i; - -for (i =0 ; i < attr->vlans.count; i++) { -if (i || action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) -dr_ste_arr_init_next_ste (ste_ctx, - &last_ste, - added_stes, -MLX5DR_STE_TYPE_TX , - attr->gvmi); - -dr_ste_set_tx_push_vlan (last_ste, - attr->vlans.headers[i], - encap); - } - } - -if (encap) { -/* Modify header and encapsulation require a different STEs. -* Since modify header STE format doesn't support encapsulation -* tunneling_action. -*/ -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ] || - action_type_set[DR_ACTION_TYP_PUSH_VLAN ]) -dr_ste_arr_init_next_ste (ste_ctx, - &last_ste, - added_stes, -MLX5DR_STE_TYPE_TX , - attr->gvmi); - -dr_ste_set_tx_encap (last_ste, - attr->reformat_id, - attr->reformat_size, - action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3 ]); -/* Whenever prio_tag_required enabled, we can be sure that the -* previous table (ACL) already push vlan to our packet, -* And due to HW limitation we need to set this bit, otherwise -* push vlan + reformat will not work. -*/ -if (MLX5_CAP_GEN (dmn->mdev, prio_tag_required)) -dr_ste_set_go_back_bit (last_ste); - } - -if (action_type_set[DR_ACTION_TYP_CTR ]) -dr_ste_set_counter_id (last_ste, attr->ctr_id); - -dr_ste_set_hit_gvmi (last_ste, attr->hit_gvmi); -mlx5dr_ste_set_hit_addr (ste_ctx, last_ste, attr->final_icm_addr,1 ); + ste_ctx->set_actions_tx (dmn, action_type_set, hw_ste_arr, + attr, added_stes); }void mlx5dr_ste_set_actions_rx (struct mlx5dr_ste_ctx *ste_ctx,struct mlx5dr_domain *dmn,u8 *action_type_set, -u8 *last_ste, +u8 *hw_ste_arr,struct mlx5dr_ste_actions_attr *attr,u32 *added_stes) { -if (action_type_set[DR_ACTION_TYP_CTR ]) -dr_ste_set_counter_id (last_ste, attr->ctr_id); - -if (action_type_set[DR_ACTION_TYP_TNL_L3_TO_L2 ]) { -dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); -dr_ste_set_rx_decap_l3 (last_ste, attr->decap_with_vlan); -dr_ste_set_rewrite_actions (last_ste, - attr->decap_actions, - attr->decap_index); - } - -if (action_type_set[DR_ACTION_TYP_TNL_L2_TO_L2 ]) -dr_ste_set_rx_decap (last_ste); - -if (action_type_set[DR_ACTION_TYP_POP_VLAN ]) { -int i; - -for (i =0 ; i < attr->vlans.count; i++) { -if (i || - action_type_set[DR_ACTION_TYP_TNL_L2_TO_L2 ] || - action_type_set[DR_ACTION_TYP_TNL_L3_TO_L2 ]) -dr_ste_arr_init_next_ste (ste_ctx, - &last_ste, - added_stes, -MLX5DR_STE_TYPE_RX , - attr->gvmi); - -dr_ste_set_rx_pop_vlan (last_ste); - } - } - -if (action_type_set[DR_ACTION_TYP_MODIFY_HDR ]) { -if (dr_ste_get_entry_type (last_ste) ==MLX5DR_STE_TYPE_MODIFY_PKT ) -dr_ste_arr_init_next_ste (ste_ctx, - &last_ste, - added_stes, -MLX5DR_STE_TYPE_MODIFY_PKT , - attr->gvmi); -else -dr_ste_set_entry_type (last_ste,MLX5DR_STE_TYPE_MODIFY_PKT ); - -dr_ste_set_rewrite_actions (last_ste, - attr->modify_actions, - attr->modify_index); - } - -if (action_type_set[DR_ACTION_TYP_TAG ]) { -if (dr_ste_get_entry_type (last_ste) ==MLX5DR_STE_TYPE_MODIFY_PKT ) -dr_ste_arr_init_next_ste (ste_ctx, - &last_ste, - added_stes, -MLX5DR_STE_TYPE_RX , - attr->gvmi); - -dr_ste_rx_set_flow_tag (last_ste, attr->flow_tag); - } - -dr_ste_set_hit_gvmi (last_ste, attr->hit_gvmi); -mlx5dr_ste_set_hit_addr (ste_ctx, last_ste, attr->final_icm_addr,1 ); + ste_ctx->set_actions_rx (dmn, action_type_set, hw_ste_arr, + attr, added_stes); } int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn,
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +250 -1
285 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 15/16 net/mlx5: DR, Add STE modify header actions per-device API
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Extend the STE context struct with per-device modify header actions.
--- .../mellanox/mlx5/core/steering/dr_ste.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +23 -0
@@ -120,6 +120,29 @@ struct mlx5dr_ste_ctx {u8 *hw_ste_arr, struct mlx5dr_ste_actions_attr *attr, u32 *added_stes); +u32 modify_field_arr_sz; +const struct mlx5dr_ste_action_modify_field *modify_field_arr; +void (*set_action_set)(u8 *hw_action, +u8 hw_field, +u8 shifter, +u8 length, +u32 data); +void (*set_action_add)(u8 *hw_action, +u8 hw_field, +u8 shifter, +u8 length, +u32 data); +void (*set_action_copy)(u8 *hw_action, +u8 dst_hw_field, +u8 dst_shifter, +u8 dst_len, +u8 src_hw_field, +u8 src_shifter); +int (*set_action_decap_l3_list)(void *data, +u32 data_sz, +u8 *hw_action, +u32 hw_action_sz, +u16 *used_hw_action_num); };extern struct mlx5dr_ste_ctx ste_ctx_v0;
Signature · 1 line
2.26.2
PATCH 16/16 net/mlx5: DR, Move STEv0 modify header logic
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Move HW specific modify header fields and logic to STEv0 file and use the new STE context callbacks.
Since STEv0 and STEv1 modify actions values are different, each version has its own implementation.
--- .../mellanox/mlx5/core/steering/dr_action.c | 401 +++--------------- .../mellanox/mlx5/core/steering/dr_ste.c | 64 +++ .../mellanox/mlx5/core/steering/dr_ste.h | 17 + .../mellanox/mlx5/core/steering/dr_ste_v0.c | 327 +++++++++++++- .../mellanox/mlx5/core/steering/dr_types.h | 37 ++ .../mellanox/mlx5/core/steering/mlx5_ifc_dr.h | 45 -- 6 files changed, 501 insertions(+), 390 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +59 -342
@@ -218,136 +218,6 @@ next_action_state[DR_ACTION_DOMAIN_MAX][DR_ACTION_STATE_MAX][DR_ACTION_TYP_MAX] }, }; -struct dr_action_modify_field_conv { -u16 hw_field; -u8 start; -u8 end; -u8 l3_type; -u8 l4_type; -}; - -static const struct dr_action_modify_field_conv dr_action_conv_arr[] = { - [MLX5_ACTION_IN_FIELD_OUT_SMAC_47_16 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_1 , .start =16 , .end =47 , - }, - [MLX5_ACTION_IN_FIELD_OUT_SMAC_15_0 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_1 , .start =0 , .end =15 , - }, - [MLX5_ACTION_IN_FIELD_OUT_ETHERTYPE ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_2 , .start =32 , .end =47 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DMAC_47_16 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_0 , .start =16 , .end =47 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DMAC_15_0 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_0 , .start =0 , .end =15 , - }, - [MLX5_ACTION_IN_FIELD_OUT_IP_DSCP ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_1 , .start =0 , .end =5 , - }, - [MLX5_ACTION_IN_FIELD_OUT_TCP_FLAGS ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_0 , .start =48 , .end =56 , - .l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_TCP , - }, - [MLX5_ACTION_IN_FIELD_OUT_TCP_SPORT ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_0 , .start =0 , .end =15 , - .l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_TCP , - }, - [MLX5_ACTION_IN_FIELD_OUT_TCP_DPORT ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_0 , .start =16 , .end =31 , - .l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_TCP , - }, - [MLX5_ACTION_IN_FIELD_OUT_IP_TTL ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_1 , .start =8 , .end =15 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV4 , - }, - [MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_1 , .start =8 , .end =15 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_UDP_SPORT ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_0 , .start =0 , .end =15 , - .l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_UDP , - }, - [MLX5_ACTION_IN_FIELD_OUT_UDP_DPORT ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_0 , .start =16 , .end =31 , - .l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_UDP , - }, - [MLX5_ACTION_IN_FIELD_OUT_SIPV6_127_96 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_3 , .start =32 , .end =63 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_SIPV6_95_64 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_3 , .start =0 , .end =31 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_SIPV6_63_32 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_4 , .start =32 , .end =63 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_SIPV6_31_0 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_4 , .start =0 , .end =31 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DIPV6_127_96 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_0 , .start =32 , .end =63 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DIPV6_95_64 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_0 , .start =0 , .end =31 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DIPV6_63_32 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_2 , .start =32 , .end =63 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_2 , .start =0 , .end =31 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV6 , - }, - [MLX5_ACTION_IN_FIELD_OUT_SIPV4 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_0 , .start =0 , .end =31 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV4 , - }, - [MLX5_ACTION_IN_FIELD_OUT_DIPV4 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L3_0 , .start =32 , .end =63 , - .l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_IPV4 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_A ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_METADATA , .start =0 , .end =31 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_B ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_METADATA , .start =32 , .end =63 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_0 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_0 , .start =32 , .end =63 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_1 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_0 , .start =0 , .end =31 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_2 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_1 , .start =32 , .end =63 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_3 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_1 , .start =0 , .end =31 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_4 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_2 , .start =32 , .end =63 , - }, - [MLX5_ACTION_IN_FIELD_METADATA_REG_C_5 ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_REG_2 , .start =0 , .end =31 , - }, - [MLX5_ACTION_IN_FIELD_OUT_TCP_SEQ_NUM ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_1 , .start =32 , .end =63 , - }, - [MLX5_ACTION_IN_FIELD_OUT_TCP_ACK_NUM ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L4_1 , .start =0 , .end =31 , - }, - [MLX5_ACTION_IN_FIELD_OUT_FIRST_VID ] = { - .hw_field =MLX5DR_ACTION_MDFY_HW_FLD_L2_2 , .start =0 , .end =15 , - }, -}; -static int dr_action_reformat_to_action_type (enum mlx5dr_action_reformat_type reformat_type,enum mlx5dr_action_type *action_type)
@@ -659,132 +529,6 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,return -EINVAL ; } -#define CVLAN_ETHERTYPE 0x8100 -#define SVLAN_ETHERTYPE 0x88a8 -#define HDR_LEN_L2_ONLY 14 -#define HDR_LEN_L2_VLAN 18 -#define REWRITE_HW_ACTION_NUM 6 - -static int dr_actions_l2_rewrite (struct mlx5dr_domain *dmn, -struct mlx5dr_action *action, -void *data,size_t data_sz) -{ -struct mlx5_ifc_l2_hdr_bits *l2_hdr = data; -u64 ops[REWRITE_HW_ACTION_NUM ] = {}; -u32 hdr_fld_4b; -u16 hdr_fld_2b; -u16 vlan_type; -bool vlan; -int i =0 ; -int ret; - - vlan = (data_sz !=HDR_LEN_L2_ONLY ); - -/* dmac_47_16 */ -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_length,0 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_0 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,16 ); - hdr_fld_4b =MLX5_GET (l2_hdr, l2_hdr, dmac_47_16); -MLX5_SET (dr_action_hw_set, ops + i, - inline_data, hdr_fld_4b); - i++; - -/* smac_47_16 */ -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_length,0 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_1 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,16 ); - hdr_fld_4b = (MLX5_GET (l2_hdr, l2_hdr, smac_31_0) >>16 | -MLX5_GET (l2_hdr, l2_hdr, smac_47_32) <<16 ); -MLX5_SET (dr_action_hw_set, ops + i, - inline_data, hdr_fld_4b); - i++; - -/* dmac_15_0 */ -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_length,16 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_0 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,0 ); - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, dmac_15_0); -MLX5_SET (dr_action_hw_set, ops + i, - inline_data, hdr_fld_2b); - i++; - -/* ethertype + (optional) vlan */ -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_2 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,32 ); -if (!vlan) { - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, ethertype); -MLX5_SET (dr_action_hw_set, ops + i, inline_data, hdr_fld_2b); -MLX5_SET (dr_action_hw_set, ops + i, destination_length,16 ); - }else { - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, ethertype); - vlan_type = hdr_fld_2b ==SVLAN_ETHERTYPE ?DR_STE_SVLAN :DR_STE_CVLAN ; - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, vlan); - hdr_fld_4b = (vlan_type <<16 ) | hdr_fld_2b; -MLX5_SET (dr_action_hw_set, ops + i, inline_data, hdr_fld_4b); -MLX5_SET (dr_action_hw_set, ops + i, destination_length,18 ); - } - i++; - -/* smac_15_0 */ -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_length,16 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_1 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,0 ); - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, smac_31_0); -MLX5_SET (dr_action_hw_set, ops + i, - inline_data, hdr_fld_2b); - i++; - -if (vlan) { -MLX5_SET (dr_action_hw_set, ops + i, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); - hdr_fld_2b =MLX5_GET (l2_hdr, l2_hdr, vlan_type); -MLX5_SET (dr_action_hw_set, ops + i, - inline_data, hdr_fld_2b); -MLX5_SET (dr_action_hw_set, ops + i, - destination_length,16 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_field_code,MLX5DR_ACTION_MDFY_HW_FLD_L2_2 ); -MLX5_SET (dr_action_hw_set, ops + i, - destination_left_shifter,0 ); - i++; - } - - action->rewrite.data = (void *)ops; - action->rewrite.num_of_actions = i; - - ret =mlx5dr_send_postsend_action (dmn, action); -if (ret) { -mlx5dr_dbg (dmn,"Writing encapsulation action to ICM failed\n" ); -return ret; - } - -return 0 ; -} -static struct mlx5dr_action *dr_action_create_generic (enum mlx5dr_action_type action_type) {
@@ -1059,21 +803,34 @@ dr_action_create_reformat_action(struct mlx5dr_domain *dmn, }case DR_ACTION_TYP_TNL_L3_TO_L2 : { -/* Only Ethernet frame is supported, with VLAN (18) or without (14) */ -if (data_sz !=HDR_LEN_L2_ONLY && data_sz !=HDR_LEN_L2_VLAN ) -return -EINVAL ; +u8 hw_actions[ACTION_CACHE_LINE_SIZE ] = {}; +int ret; + + ret =mlx5dr_ste_set_action_decap_l3_list (dmn->ste_ctx, + data, data_sz, + hw_actions, +ACTION_CACHE_LINE_SIZE , + &action->rewrite.num_of_actions); +if (ret) { +mlx5dr_dbg (dmn,"Failed creating decap l3 action list\n" ); +return ret; + } action->rewrite.chunk =mlx5dr_icm_alloc_chunk (dmn->action_icm_pool,DR_CHUNK_SIZE_8 ); -if (!action->rewrite.chunk) +if (!action->rewrite.chunk) { +mlx5dr_dbg (dmn,"Failed allocating modify header chunk\n" );return -ENOMEM ; + } + action->rewrite.data = (void *)hw_actions; action->rewrite.index = (action->rewrite.chunk->icm_addr - dmn->info.caps.hdr_modify_icm_addr) /ACTION_CACHE_LINE_SIZE ; - ret =dr_actions_l2_rewrite (dmn, action, data, data_sz); + ret =mlx5dr_send_postsend_action (dmn, action);if (ret) { +mlx5dr_dbg (dmn,"Writing decap l3 actions to ICM failed\n" );mlx5dr_icm_free_chunk (action->rewrite.chunk);return ret; }
@@ -1085,6 +842,9 @@ dr_action_create_reformat_action(struct mlx5dr_domain *dmn, } } +#define CVLAN_ETHERTYPE 0x8100 +#define SVLAN_ETHERTYPE 0x88a8 +struct mlx5dr_action *mlx5dr_action_create_pop_vlan (void ) {return dr_action_create_generic (DR_ACTION_TYP_POP_VLAN );
@@ -1157,31 +917,13 @@ mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn,return NULL ; } -static const struct dr_action_modify_field_conv * -dr_action_modify_get_hw_info (u16 sw_field) -{ -const struct dr_action_modify_field_conv *hw_action_info; - -if (sw_field >=ARRAY_SIZE (dr_action_conv_arr)) - goto not_found; - - hw_action_info = &dr_action_conv_arr[sw_field]; -if (!hw_action_info->end && !hw_action_info->start) - goto not_found; - -return hw_action_info; - -not_found: -return NULL ; -} -static int dr_action_modify_sw_to_hw_add (struct mlx5dr_domain *dmn,__be64 *sw_action,__be64 *hw_action, -const struct dr_action_modify_field_conv **ret_hw_info) +const struct mlx5dr_ste_action_modify_field **ret_hw_info) { -const struct dr_action_modify_field_conv *hw_action_info; +const struct mlx5dr_ste_action_modify_field *hw_action_info;u8 max_length;u16 sw_field;u32 data;
@@ -1191,7 +933,7 @@ dr_action_modify_sw_to_hw_add(struct mlx5dr_domain *dmn, data =MLX5_GET (set_action_in, sw_action, data);/* Convert SW data to HW modify action format */ - hw_action_info =dr_action_modify_get_hw_info (sw_field); + hw_action_info =mlx5dr_ste_conv_modify_hdr_sw_field (dmn->ste_ctx, sw_field);if (!hw_action_info) {mlx5dr_dbg (dmn,"Modify add action invalid field given\n" );return -EINVAL ;
@@ -1199,20 +941,12 @@ dr_action_modify_sw_to_hw_add(struct mlx5dr_domain *dmn, max_length = hw_action_info->end - hw_action_info->start +1 ; -MLX5_SET (dr_action_hw_set, hw_action, - opcode,MLX5DR_ACTION_MDFY_HW_OP_ADD ); - -MLX5_SET (dr_action_hw_set, hw_action, destination_field_code, - hw_action_info->hw_field); - -MLX5_SET (dr_action_hw_set, hw_action, destination_left_shifter, - hw_action_info->start); - -/* PRM defines that length zero specific length of 32bits */ -MLX5_SET (dr_action_hw_set, hw_action, destination_length, - max_length ==32 ?0 : max_length); - -MLX5_SET (dr_action_hw_set, hw_action, inline_data, data); +mlx5dr_ste_set_action_add (dmn->ste_ctx, + hw_action, + hw_action_info->hw_field, + hw_action_info->start, + max_length, + data); *ret_hw_info = hw_action_info;
@@ -1223,9 +957,9 @@ static int dr_action_modify_sw_to_hw_set(struct mlx5dr_domain *dmn, __be64 *sw_action, __be64 *hw_action, - const struct dr_action_modify_field_conv **ret_hw_info) + const struct mlx5dr_ste_action_modify_field **ret_hw_info) { - const struct dr_action_modify_field_conv *hw_action_info; + const struct mlx5dr_ste_action_modify_field *hw_action_info;u8 offset, length, max_length;u16 sw_field;u32 data;
@@ -1237,7 +971,7 @@ dr_action_modify_sw_to_hw_set(struct mlx5dr_domain *dmn, data =MLX5_GET (set_action_in, sw_action, data);/* Convert SW data to HW modify action format */ - hw_action_info =dr_action_modify_get_hw_info (sw_field); + hw_action_info =mlx5dr_ste_conv_modify_hdr_sw_field (dmn->ste_ctx, sw_field);if (!hw_action_info) {mlx5dr_dbg (dmn,"Modify set action invalid field given\n" );return -EINVAL ;
@@ -1253,19 +987,12 @@ dr_action_modify_sw_to_hw_set(struct mlx5dr_domain *dmn,return -EINVAL ; } -MLX5_SET (dr_action_hw_set, hw_action, - opcode,MLX5DR_ACTION_MDFY_HW_OP_SET ); - -MLX5_SET (dr_action_hw_set, hw_action, destination_field_code, - hw_action_info->hw_field); - -MLX5_SET (dr_action_hw_set, hw_action, destination_left_shifter, - hw_action_info->start + offset); - -MLX5_SET (dr_action_hw_set, hw_action, destination_length, - length ==32 ?0 : length); - -MLX5_SET (dr_action_hw_set, hw_action, inline_data, data); +mlx5dr_ste_set_action_set (dmn->ste_ctx, + hw_action, + hw_action_info->hw_field, + hw_action_info->start + offset, + length, + data); *ret_hw_info = hw_action_info;
@@ -1276,12 +1003,12 @@ static int dr_action_modify_sw_to_hw_copy(struct mlx5dr_domain *dmn, __be64 *sw_action, __be64 *hw_action, - const struct dr_action_modify_field_conv **ret_dst_hw_info, - const struct dr_action_modify_field_conv **ret_src_hw_info) + const struct mlx5dr_ste_action_modify_field **ret_dst_hw_info, + const struct mlx5dr_ste_action_modify_field **ret_src_hw_info) { u8 src_offset, dst_offset, src_max_length, dst_max_length, length; -const struct dr_action_modify_field_conv *hw_dst_action_info; -const struct dr_action_modify_field_conv *hw_src_action_info; +const struct mlx5dr_ste_action_modify_field *hw_dst_action_info; +const struct mlx5dr_ste_action_modify_field *hw_src_action_info;u16 src_field, dst_field;/* Get SW modify action data */
@@ -1292,8 +1019,8 @@ dr_action_modify_sw_to_hw_copy(struct mlx5dr_domain *dmn, length =MLX5_GET (copy_action_in, sw_action, length);/* Convert SW data to HW modify action format */ - hw_src_action_info =dr_action_modify_get_hw_info (src_field); - hw_dst_action_info =dr_action_modify_get_hw_info (dst_field); + hw_src_action_info =mlx5dr_ste_conv_modify_hdr_sw_field (dmn->ste_ctx, src_field); + hw_dst_action_info =mlx5dr_ste_conv_modify_hdr_sw_field (dmn->ste_ctx, dst_field);if (!hw_src_action_info || !hw_dst_action_info) {mlx5dr_dbg (dmn,"Modify copy action invalid field given\n" );return -EINVAL ;
@@ -1313,23 +1040,13 @@ dr_action_modify_sw_to_hw_copy(struct mlx5dr_domain *dmn,return -EINVAL ; } -MLX5_SET (dr_action_hw_copy, hw_action, - opcode,MLX5DR_ACTION_MDFY_HW_OP_COPY ); - -MLX5_SET (dr_action_hw_copy, hw_action, destination_field_code, - hw_dst_action_info->hw_field); - -MLX5_SET (dr_action_hw_copy, hw_action, destination_left_shifter, - hw_dst_action_info->start + dst_offset); - -MLX5_SET (dr_action_hw_copy, hw_action, destination_length, - length ==32 ?0 : length); - -MLX5_SET (dr_action_hw_copy, hw_action, source_field_code, - hw_src_action_info->hw_field); - -MLX5_SET (dr_action_hw_copy, hw_action, source_left_shifter, - hw_src_action_info->start + dst_offset); +mlx5dr_ste_set_action_copy (dmn->ste_ctx, + hw_action, + hw_dst_action_info->hw_field, + hw_dst_action_info->start + dst_offset, + length, + hw_src_action_info->hw_field, + hw_src_action_info->start + src_offset); *ret_dst_hw_info = hw_dst_action_info; *ret_src_hw_info = hw_src_action_info;
@@ -1341,8 +1058,8 @@ static int dr_action_modify_sw_to_hw(struct mlx5dr_domain *dmn, __be64 *sw_action, __be64 *hw_action, - const struct dr_action_modify_field_conv **ret_dst_hw_info, - const struct dr_action_modify_field_conv **ret_src_hw_info) + const struct mlx5dr_ste_action_modify_field **ret_dst_hw_info, + const struct mlx5dr_ste_action_modify_field **ret_src_hw_info) { u8 action;int ret;
@@ -1519,15 +1236,15 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action, u32 *num_hw_actions, bool *modify_ttl) { -const struct dr_action_modify_field_conv *hw_dst_action_info; -const struct dr_action_modify_field_conv *hw_src_action_info; -u16 hw_field =MLX5DR_ACTION_MDFY_HW_FLD_RESERVED ; -u32 l3_type =MLX5DR_ACTION_MDFY_HW_HDR_L3_NONE ; -u32 l4_type =MLX5DR_ACTION_MDFY_HW_HDR_L4_NONE ; +const struct mlx5dr_ste_action_modify_field *hw_dst_action_info; +const struct mlx5dr_ste_action_modify_field *hw_src_action_info;struct mlx5dr_domain *dmn = action->rewrite.dmn;int ret, i, hw_idx =0 ;__be64 *sw_action;__be64 hw_action; +u16 hw_field =0 ; +u32 l3_type =0 ; +u32 l4_type =0 ; *modify_ttl = false;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +64 -0
70 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +17 -0
@@ -15,6 +15,11 @@#define IP_VERSION_IPV6 0x6#define STE_SVLAN 0x1#define STE_CVLAN 0x2 +#define HDR_LEN_L2_MACS 0xC +#define HDR_LEN_L2_VLAN 0x4 +#define HDR_LEN_L2_ETHER 0x2 +#define HDR_LEN_L2 (HDR_LEN_L2_MACS + HDR_LEN_L2_ETHER) +#define HDR_LEN_L2_W_VLAN (HDR_LEN_L2 + HDR_LEN_L2_VLAN)/* Set to STE a specific value using DR_STE_SET */ #define DR_STE_SET_VAL (lookup_type, tag, t_fname, spec, s_fname, value) do { \
@@ -69,6 +74,18 @@ (_misc)->outer_first_mpls_over_udp_s_bos || \ (_misc)->outer_first_mpls_over_udp_ttl) +enum dr_ste_action_modify_type_l3 { +DR_STE_ACTION_MDFY_TYPE_L3_NONE =0x0 , +DR_STE_ACTION_MDFY_TYPE_L3_IPV4 =0x1 , +DR_STE_ACTION_MDFY_TYPE_L3_IPV6 =0x2 , +}; + +enum dr_ste_action_modify_type_l4 { +DR_STE_ACTION_MDFY_TYPE_L4_NONE =0x0 , +DR_STE_ACTION_MDFY_TYPE_L4_TCP =0x1 , +DR_STE_ACTION_MDFY_TYPE_L4_UDP =0x2 , +}; +u16 mlx5dr_ste_conv_bit_to_byte_mask (u8 *bit_mask);#define DR_STE_CTX_BUILDER (fname) \
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +324 -3
361 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +37 -0
@@ -268,6 +268,35 @@ void mlx5dr_ste_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx,struct mlx5dr_ste_actions_attr *attr, u32 *added_stes); +void mlx5dr_ste_set_action_set (struct mlx5dr_ste_ctx *ste_ctx, +__be64 *hw_action, +u8 hw_field, +u8 shifter, +u8 length, +u32 data); +void mlx5dr_ste_set_action_add (struct mlx5dr_ste_ctx *ste_ctx, +__be64 *hw_action, +u8 hw_field, +u8 shifter, +u8 length, +u32 data); +void mlx5dr_ste_set_action_copy (struct mlx5dr_ste_ctx *ste_ctx, +__be64 *hw_action, +u8 dst_hw_field, +u8 dst_shifter, +u8 dst_len, +u8 src_hw_field, +u8 src_shifter); +int mlx5dr_ste_set_action_decap_l3_list (struct mlx5dr_ste_ctx *ste_ctx, +void *data, +u32 data_sz, +u8 *hw_action, +u32 hw_action_sz, +u16 *used_hw_action_num); + +const struct mlx5dr_ste_action_modify_field * +mlx5dr_ste_conv_modify_hdr_sw_field (struct mlx5dr_ste_ctx *ste_ctx,u16 sw_field); +struct mlx5dr_ste_ctx *mlx5dr_ste_get_ctx (u8 version); void mlx5dr_ste_free(struct mlx5dr_ste *ste, struct mlx5dr_matcher *matcher,
@@ -765,6 +794,14 @@ struct mlx5dr_rule_member {struct list_head use_ste_list; }; +struct mlx5dr_ste_action_modify_field { +u16 hw_field; +u8 start; +u8 end; +u8 l3_type; +u8 l4_type; +}; +struct mlx5dr_action {enum mlx5dr_action_type action_type;refcount_t refcount;
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h +0 -45
51 lines not on this page · raw message
Signature · 1 line
2.26.2
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Tue, 5 Jan 2021 15:03:17 -0800
Quoted 9 lines
From: Saeed Mahameed <[email protected]>
Hi Jakub, Dave
This series introduces some refactoring to SW steering to support different formats of different Hardware.
For more information please see tag log below.Please pull and let me know if there is any problem.
Pulled, thanks Saeed.