mlx5-next updates 2022-09-07
Subsystems (6)
cover mlx5-next updates 2022-09-07
From: Saeed Mahameed <[email protected]>
This series includes various mlx5 updates
1) HW definitions and support for NPPS clock settings.
2) NVMEoTCP HW capabilities and definitions
3) crypt HW bits and definitions for upcoming ipsec and TLS improvements
4) various cleanups
5) Enable hash mode by default for all NICs
Liu, Changcheng Says:
=====================
When hardware lag hash mode is active, the explicit port affinity of the QP/TIS is ignored. The steering rules inside the port-select steering domain will determine the egress port.
To support setting explicit port affinity while using hardware lag hash mode, a new capability of bypassing the port-select steering domain is introduced.
The following patch series enable hash mode over NICs that support the new capability:
5.1) Set the active port bit mask to let the firmware know which ports
are down and which are up, so it can use this info when handling failover on QPs with explicit port affinity.
5.2) Remove the assignment of default port affinity by the driver as
the user has dedicated userspace APIs to set the port affinity so the default configuration isn't needed anymore.
5.3) Detect and enable port-select bypass so explicit port affinity is
honored by the firmware.
5.4) Enable hash mode by default on all NICs
When setting QP/TIS port affinity explicitly and hash mode is active and the bypass port-select flow table capability is enabled by firmware, firmware adds a steering rule to catch egress traffic of these QPs/TISs and make their traffic skip the port-select steering domain. This adds performance overhead for all QPs/TISs. The common use case is to not set explicit port affinity(as when in hash, we don't need it). If there is a user that does want to set port affinity, it can be done with the dedicated userspace APIs.
Detect the bypass port-select flow table capability, set it to let firmware know the driver supports this new capability.
=====================
Aya Levin (2):
net/mlx5: Expose NPPS related registers net/mlx5: Add support for NPPS with real time mode
Ben Ben-Ishay (1):
net/mlx5: Add NVMEoTCP caps, HW bits, 128B CQE and enumerations
Gal Pressman (2):
net/mlx5: Remove unused functions
net/mlx5: Remove unused structs
Jianbo Liu (2):
net/mlx5: Add IFC bits for general obj create param net/mlx5: Add IFC bits and enums for crypto key
Leon Romanovsky (1):
net/mlx5: Remove from FPGA IFC file not-needed definitions
Liu, Changcheng (5):
net/mlx5: add IFC bits for bypassing port select flow table RDMA/mlx5: Don't set tx affinity when lag is in hash mode net/mlx5: Lag, set active ports if support bypass port select flow
table
net/mlx5: Lag, enable hash mode by default for all NICs net/mlx5: detect and enable bypass port select flow table
Or Gerlitz (1):
net/mlx5e: Rename from tls to transport static params
drivers/infiniband/hw/mlx5/mlx5_ib.h | 12 + .../ethernet/mellanox/mlx5/core/en/tc/meter.c | 6 +- .../mlx5/core/en_accel/common_utils.h | 32 ++ .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 5 - .../mellanox/mlx5/core/en_accel/ktls_rx.c | 6 +- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 8 +- .../mellanox/mlx5/core/en_accel/ktls_txrx.c | 36 +-- .../mellanox/mlx5/core/en_accel/ktls_utils.h | 17 +- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 6 + .../net/ethernet/mellanox/mlx5/core/health.c | 7 - .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 91 +++++- .../ethernet/mellanox/mlx5/core/lib/clock.c | 139 +++++++-- .../net/ethernet/mellanox/mlx5/core/main.c | 34 +++ .../mellanox/mlx5/core/steering/dr_types.h | 14 - .../mellanox/mlx5/core/steering/fs_dr.h | 4 - include/linux/mlx5/device.h | 70 ++++- include/linux/mlx5/driver.h | 9 +- include/linux/mlx5/fs_helpers.h | 48 --- include/linux/mlx5/mlx5_ifc.h | 280 ++++++++++++++++-- include/linux/mlx5/mlx5_ifc_fpga.h | 24 -- include/linux/mlx5/qp.h | 1 + 21 files changed, 629 insertions(+), 220 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/common_utils.h
Signature · 1 line
2.37.2
PATCH 1/14 net/mlx5: Expose NPPS related registers
From: Aya Levin <[email protected]>
Add management capability bits indicating firmware may support N pulses per second. Add corresponding fields in MTPPS register.
--- include/linux/mlx5/mlx5_ifc.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
include/linux/mlx5/mlx5_ifc.h +14 -4
@@ -9789,7 +9789,9 @@ struct mlx5_ifc_pcam_reg_bits {struct mlx5_ifc_mcam_enhanced_features_bits {u8 reserved_at_0[0x5d ];u8 mcia_32dwords[0x1 ]; -u8 reserved_at_5e[0xc ]; +u8 out_pulse_duration_ns[0x1 ]; +u8 npps_period[0x1 ]; +u8 reserved_at_60[0xa ];u8 reset_state[0x1 ];u8 ptpcyc2realtime_modify[0x1 ];u8 reserved_at_6c[0x2 ];
@@ -10289,7 +10291,12 @@ struct mlx5_ifc_mtpps_reg_bits {u8 reserved_at_18[0x4 ];u8 cap_max_num_of_pps_out_pins[0x4 ]; -u8 reserved_at_20[0x24 ]; +u8 reserved_at_20[0x13 ]; +u8 cap_log_min_npps_period[0x5 ]; +u8 reserved_at_38[0x3 ]; +u8 cap_log_min_out_pulse_duration_ns[0x5 ]; + +u8 reserved_at_40[0x4 ];u8 cap_pin_3_mode[0x4 ];u8 reserved_at_48[0x4 ];u8 cap_pin_2_mode[0x4 ];
@@ -10308,7 +10315,9 @@ struct mlx5_ifc_mtpps_reg_bits {u8 cap_pin_4_mode[0x4 ];u8 field_select[0x20 ]; -u8 reserved_at_a0[0x60 ]; +u8 reserved_at_a0[0x20 ]; + +u8 npps_period[0x40 ];u8 enable[0x1 ];u8 reserved_at_101[0xb ];
@@ -10317,7 +10326,8 @@ struct mlx5_ifc_mtpps_reg_bits {u8 pin_mode[0x4 ];u8 pin[0x8 ]; -u8 reserved_at_120[0x20 ]; +u8 reserved_at_120[0x2 ]; +u8 out_pulse_duration_ns[0x1e ];u8 time_stamp[0x40 ];
Signature · 1 line
2.37.2
PATCH 2/14 net/mlx5: Add support for NPPS with real time mode
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add support for setting NPPS. NPPS is currently available in REAL_TIME_CLOCK mode only. In addition allow the user to set the pulse duration.
When NPPS pulse duration is not set explicitly by the user, driver set it to 50% of the NPPS period.
--- .../ethernet/mellanox/mlx5/core/lib/clock.c | 139 +++++++++++++++--- include/linux/mlx5/driver.h | 2 + 2 files changed, 121 insertions(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +119 -20
@@ -65,6 +65,8 @@ enum {MLX5_MTPPS_FS_TIME_STAMP =BIT (0x4 ),MLX5_MTPPS_FS_OUT_PULSE_DURATION =BIT (0x5 ),MLX5_MTPPS_FS_ENH_OUT_PER_ADJ =BIT (0x7 ), +MLX5_MTPPS_FS_NPPS_PERIOD =BIT (0x9 ), + MLX5_MTPPS_FS_OUT_PULSE_DURATION_NS = BIT(0xa), };static bool mlx5_real_time_mode (struct mlx5_core_dev *mdev)
@@ -72,6 +74,13 @@ static bool mlx5_real_time_mode(struct mlx5_core_dev *mdev)return (mlx5_is_real_time_rq (mdev) ||mlx5_is_real_time_sq (mdev)); } +static bool mlx5_npps_real_time_supported (struct mlx5_core_dev *mdev) +{ +return (mlx5_real_time_mode (mdev) && +MLX5_CAP_MCAM_FEATURE (mdev, npps_period) && +MLX5_CAP_MCAM_FEATURE (mdev, out_pulse_duration_ns)); +} +static bool mlx5_modify_mtutc_allowed (struct mlx5_core_dev *mdev) {return MLX5_CAP_MCAM_FEATURE (mdev, ptpcyc2realtime_modify);
@@ -459,9 +468,95 @@ static u64 perout_conf_internal_timer(struct mlx5_core_dev *mdev, s64 sec)return find_target_cycles (mdev, target_ns); } -static u64 perout_conf_real_time (s64 sec) +static u64 perout_conf_real_time (s64 sec,u32 nsec) +{ +return (u64 )nsec | (u64 )sec <<32 ; +} + +static int perout_conf_1pps (struct mlx5_core_dev *mdev,struct ptp_clock_request *rq, +u64 *time_stamp,bool real_time) +{ +struct timespec64 ts; +s64 ns; + + ts.tv_nsec = rq->perout.period.nsec; + ts.tv_sec = rq->perout.period.sec; + ns =timespec64_to_ns (&ts); + +if ((ns >>1 ) !=500000000LL ) +return -EINVAL ; + + *time_stamp = real_time ?perout_conf_real_time (rq->perout.start.sec,0 ) : +perout_conf_internal_timer (mdev, rq->perout.start.sec); + +return 0 ; +} + +#define MLX5_MAX_PULSE_DURATION (BIT(__mlx5_bit_sz(mtpps_reg, out_pulse_duration_ns)) - 1) +static int mlx5_perout_conf_out_pulse_duration (struct mlx5_core_dev *mdev, +struct ptp_clock_request *rq, +u32 *out_pulse_duration_ns) { -return (u64 )sec <<32 ; +struct mlx5_pps *pps_info = &mdev->clock.pps_info; +u32 out_pulse_duration; +struct timespec64 ts; + +if (rq->perout.flags &PTP_PEROUT_DUTY_CYCLE ) { + ts.tv_sec = rq->perout.on.sec; + ts.tv_nsec = rq->perout.on.nsec; + out_pulse_duration = (u32 )timespec64_to_ns (&ts); + }else { +/* out_pulse_duration_ns should be up to 50% of the +* pulse period as default +*/ + ts.tv_sec = rq->perout.period.sec; + ts.tv_nsec = rq->perout.period.nsec; + out_pulse_duration = (u32 )timespec64_to_ns (&ts) >>1 ; + } + +if (out_pulse_duration < pps_info->min_out_pulse_duration_ns || + out_pulse_duration >MLX5_MAX_PULSE_DURATION ) { +mlx5_core_err (mdev,"NPPS pulse duration %u is not in [%llu, %lu]\n" , + out_pulse_duration, pps_info->min_out_pulse_duration_ns, +MLX5_MAX_PULSE_DURATION ); +return -EINVAL ; + } + *out_pulse_duration_ns = out_pulse_duration; + +return 0 ; +} + +static int perout_conf_npps_real_time (struct mlx5_core_dev *mdev,struct ptp_clock_request *rq, +u32 *field_select,u32 *out_pulse_duration_ns, +u64 *period,u64 *time_stamp) +{ +struct mlx5_pps *pps_info = &mdev->clock.pps_info; +struct ptp_clock_time *time = &rq->perout.start; +struct timespec64 ts; + + ts.tv_sec = rq->perout.period.sec; + ts.tv_nsec = rq->perout.period.nsec; +if (timespec64_to_ns (&ts) < pps_info->min_npps_period) { +mlx5_core_err (mdev,"NPPS period is lower than minimal npps period %llu\n" , + pps_info->min_npps_period); +return -EINVAL ; + } + *period =perout_conf_real_time (rq->perout.period.sec, rq->perout.period.nsec); + +if (mlx5_perout_conf_out_pulse_duration (mdev, rq, out_pulse_duration_ns)) +return -EINVAL ; + + *time_stamp =perout_conf_real_time (time->sec, time->nsec); + *field_select |=MLX5_MTPPS_FS_NPPS_PERIOD | +MLX5_MTPPS_FS_OUT_PULSE_DURATION_NS ; + +return 0 ; +} + +static bool mlx5_perout_verify_flags (struct mlx5_core_dev *mdev,unsigned int flags) +{ +return ((!mlx5_npps_real_time_supported (mdev) && flags) || + (mlx5_npps_real_time_supported (mdev) && flags & ~PTP_PEROUT_DUTY_CYCLE )); } static int mlx5_perout_configure(struct ptp_clock_info *ptp,
@@ -474,20 +569,20 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, container_of(clock, struct mlx5_core_dev, clock);bool rt_mode =mlx5_real_time_mode (mdev);u32 in[MLX5_ST_SZ_DW (mtpps_reg)] = {0 }; -struct timespec64 ts; +u32 out_pulse_duration_ns =0 ;u32 field_select =0 ; +u64 npps_period =0 ;u64 time_stamp =0 ;u8 pin_mode =0 ;u8 pattern =0 ;int pin =-1 ;int err =0 ; -s64 ns;if (!MLX5_PPS_CAP (mdev))return -EOPNOTSUPP ;/* Reject requests with unsupported flags */ -if (rq->perout.flags) +if (mlx5_perout_verify_flags (mdev, rq->perout.flags))return -EOPNOTSUPP ;if (rq->perout.index >= clock->ptp_info.n_pins)
@@ -500,29 +595,25 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp,if (on) {bool rt_mode =mlx5_real_time_mode (mdev); -s64 sec = rq->perout.start.sec; - -if (rq->perout.start.nsec) -return -EINVAL ; pin_mode =MLX5_PIN_MODE_OUT ; pattern =MLX5_OUT_PATTERN_PERIODIC ; - ts.tv_sec = rq->perout.period.sec; - ts.tv_nsec = rq->perout.period.nsec; - ns =timespec64_to_ns (&ts); -if ((ns >>1 ) !=500000000LL ) +if (rt_mode && rq->perout.start.sec >U32_MAX )return -EINVAL ; -if (rt_mode && sec >U32_MAX ) -return -EINVAL ; - - time_stamp = rt_mode ?perout_conf_real_time (sec) : -perout_conf_internal_timer (mdev, sec); - field_select |=MLX5_MTPPS_FS_PIN_MODE |MLX5_MTPPS_FS_PATTERN |MLX5_MTPPS_FS_TIME_STAMP ; + +if (mlx5_npps_real_time_supported (mdev)) + err =perout_conf_npps_real_time (mdev, rq, &field_select, + &out_pulse_duration_ns, &npps_period, + &time_stamp); +else + err =perout_conf_1pps (mdev, rq, &time_stamp, rt_mode); +if (err) +return err; }MLX5_SET (mtpps_reg, in, pin, pin);
@@ -531,7 +622,8 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp,MLX5_SET (mtpps_reg, in, enable, on);MLX5_SET64 (mtpps_reg, in, time_stamp, time_stamp);MLX5_SET (mtpps_reg, in, field_select, field_select); - +MLX5_SET64 (mtpps_reg, in, npps_period, npps_period); +MLX5_SET (mtpps_reg, in, out_pulse_duration_ns, out_pulse_duration_ns); err =mlx5_set_mtpps (mdev, in,sizeof (in));if (err)return err;
@@ -687,6 +779,13 @@ static void mlx5_get_pps_caps(struct mlx5_core_dev *mdev) clock->ptp_info.n_per_out =MLX5_GET (mtpps_reg, out, cap_max_num_of_pps_out_pins); +if (MLX5_CAP_MCAM_FEATURE (mdev, npps_period)) + clock->pps_info.min_npps_period =1 <<MLX5_GET (mtpps_reg, out, + cap_log_min_npps_period); +if (MLX5_CAP_MCAM_FEATURE (mdev, out_pulse_duration_ns)) + clock->pps_info.min_out_pulse_duration_ns =1 <<MLX5_GET (mtpps_reg, out, + cap_log_min_out_pulse_duration_ns); + clock->pps_info.pin_caps[0 ] =MLX5_GET (mtpps_reg, out, cap_pin_0_mode); clock->pps_info.pin_caps[1 ] =MLX5_GET (mtpps_reg, out, cap_pin_1_mode); clock->pps_info.pin_caps[2 ] =MLX5_GET (mtpps_reg, out, cap_pin_2_mode);
include/linux/mlx5/driver.h +2 -0
@@ -698,6 +698,8 @@ struct mlx5_pps {struct work_struct out_work;u64 start[MAX_PIN_NUM ];u8 enabled; +u64 min_npps_period; +u64 min_out_pulse_duration_ns; };struct mlx5_timer {
Signature · 1 line
2.37.2
PATCH 3/14 net/mlx5: add IFC bits for bypassing port select flow table
In reply to Saeed MahameedFrom: "Liu, Changcheng" <[email protected]>
port_select_flow_table_bypass - When set, device supports bypass port select flow table.active_port - Bitmask indicates the current active ports in PORT_SELECT_FT LAG. MLX5_SET_HCA_CAP_OP_MODE_PORT_SELECTION - op_mod to operate PORT_SELECTION_Capabilities.
--- include/linux/mlx5/mlx5_ifc.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/linux/mlx5/mlx5_ifc.h +7 -2
@@ -68,6 +68,7 @@ enum {MLX5_SET_HCA_CAP_OP_MOD_ODP =0x2 ,MLX5_SET_HCA_CAP_OP_MOD_ATOMIC =0x3 ,MLX5_SET_HCA_CAP_OP_MOD_ROCE =0x4 , + MLX5_SET_HCA_CAP_OP_MODE_PORT_SELECTION = 0x25, }; enum {
@@ -813,7 +814,9 @@ struct mlx5_ifc_flow_table_nic_cap_bits {struct mlx5_ifc_port_selection_cap_bits {u8 reserved_at_0[0x10 ];u8 port_select_flow_table[0x1 ]; -u8 reserved_at_11[0xf ]; +u8 reserved_at_11[0x1 ]; +u8 port_select_flow_table_bypass[0x1 ]; +u8 reserved_at_13[0xd ];u8 reserved_at_20[0x1e0 ];
@@ -10930,7 +10933,9 @@ struct mlx5_ifc_lagc_bits {u8 reserved_at_18[0x5 ];u8 lag_state[0x3 ]; -u8 reserved_at_20[0x14 ]; +u8 reserved_at_20[0xc ]; +u8 active_port[0x4 ]; +u8 reserved_at_30[0x4 ];u8 tx_remap_affinity_2[0x4 ];u8 reserved_at_38[0x4 ];u8 tx_remap_affinity_1[0x4 ];
Signature · 1 line
2.37.2
PATCH 4/14 RDMA/mlx5: Don't set tx affinity when lag is in hash mode
In reply to Saeed MahameedFrom: "Liu, Changcheng" <[email protected]>
In hash mode, without setting tx affinity explicitly, the port select flow table decides which port is used for the traffic.
If port_select_flow_table_bypass capability is supported and tx affinity is set explicitly for QP/TIS, they will be added into the explicit affinity table in FW to check which port is used for the traffic.
1. The overloaded explicit affinity table may affect performance. To avoid this, do not set tx affinity explicitly by default.
2. The packets of the same flow need to be transmitted on the same port. Because the packets of the same flow use different QPs in slow & fast path, it shouldn't set tx affinity explicitly for these QPs.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 12 ++++++++++++ .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 16 ++++++++++++++++ include/linux/mlx5/driver.h | 1 + 3 files changed, 29 insertions(+)
drivers/infiniband/hw/mlx5/mlx5_ib.h +12 -0
@@ -1540,6 +1540,18 @@ int mlx5_ib_test_wc(struct mlx5_ib_dev *dev);static inline bool mlx5_ib_lag_should_assign_affinity (struct mlx5_ib_dev *dev) { +/* +* If the driver is in hash mode and the port_select_flow_table_bypass cap +* is supported, it means that the driver no longer needs to assign the port +* affinity by default. If a user wants to set the port affinity explicitly, +* the user has a dedicated API to do that, so there is no need to assign +* the port affinity by default. +*/ +if (dev->lag_active && +mlx5_lag_mode_is_hash (dev->mdev) && +MLX5_CAP_PORT_SELECTION (dev->mdev, port_select_flow_table_bypass)) +return 0 ; +return dev->lag_active || (MLX5_CAP_GEN (dev->mdev, num_lag_ports) >1 &&MLX5_CAP_GEN (dev->mdev, lag_tx_port_affinity));
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +16 -0
@@ -1271,6 +1271,22 @@ bool mlx5_lag_is_active(struct mlx5_core_dev *dev) }EXPORT_SYMBOL (mlx5_lag_is_active); +bool mlx5_lag_mode_is_hash (struct mlx5_core_dev *dev) +{ +struct mlx5_lag *ldev; +unsigned long flags; +bool res =0 ; + +spin_lock_irqsave (&lag_lock, flags); + ldev =mlx5_lag_dev (dev); +if (ldev) + res =test_bit (MLX5_LAG_MODE_FLAG_HASH_BASED , &ldev->mode_flags); +spin_unlock_irqrestore (&lag_lock, flags); + +return res; +} +EXPORT_SYMBOL (mlx5_lag_mode_is_hash); +bool mlx5_lag_is_master (struct mlx5_core_dev *dev) {struct mlx5_lag *ldev;
include/linux/mlx5/driver.h +1 -0
@@ -1154,6 +1154,7 @@ int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev);bool mlx5_lag_is_roce (struct mlx5_core_dev *dev);bool mlx5_lag_is_sriov (struct mlx5_core_dev *dev);bool mlx5_lag_is_active (struct mlx5_core_dev *dev); +bool mlx5_lag_mode_is_hash (struct mlx5_core_dev *dev);bool mlx5_lag_is_master (struct mlx5_core_dev *dev);bool mlx5_lag_is_shared_fdb (struct mlx5_core_dev *dev);struct net_device *mlx5_lag_get_roce_netdev (struct mlx5_core_dev *dev);
Signature · 1 line
2.37.2
PATCH 5/14 net/mlx5: Lag, set active ports if support bypass port select flow table
In reply to Saeed MahameedFrom: "Liu, Changcheng" <[email protected]>
active_port bit mask indicates the current active ports. Set bit indicates the port is active. Update active ports info to FW to redirect the QP/TIS from inactive ports to other ports.
--- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +55 -3
@@ -65,6 +65,21 @@ static int get_port_sel_mode(enum mlx5_lag_mode mode, unsigned long flags)return MLX5_LAG_PORT_SELECT_MODE_QUEUE_AFFINITY ; } +static u8 lag_active_port_bits (struct mlx5_lag *ldev) +{ +u8 enabled_ports[MLX5_MAX_PORTS ] = {}; +u8 active_port =0 ; +int num_enabled; +int idx; + +mlx5_infer_tx_enabled (&ldev->tracker, ldev->ports, enabled_ports, + &num_enabled); +for (idx =0 ; idx < num_enabled; idx++) + active_port |=BIT_MASK (enabled_ports[idx]); + +return active_port; +} +static int mlx5_cmd_create_lag (struct mlx5_core_dev *dev,u8 *ports,int mode,unsigned long flags) {
@@ -77,9 +92,21 @@ static int mlx5_cmd_create_lag(struct mlx5_core_dev *dev, u8 *ports, int mode, lag_ctx =MLX5_ADDR_OF (create_lag_in, in, ctx);MLX5_SET (create_lag_in, in, opcode,MLX5_CMD_OP_CREATE_LAG );MLX5_SET (lagc, lag_ctx, fdb_selection_mode, fdb_sel_mode); -if (port_sel_mode ==MLX5_LAG_PORT_SELECT_MODE_QUEUE_AFFINITY ) { + +switch (port_sel_mode) { +case MLX5_LAG_PORT_SELECT_MODE_QUEUE_AFFINITY :MLX5_SET (lagc, lag_ctx, tx_remap_affinity_1, ports[0 ]);MLX5_SET (lagc, lag_ctx, tx_remap_affinity_2, ports[1 ]); +break ; +case MLX5_LAG_PORT_SELECT_MODE_PORT_SELECT_FT : +if (!MLX5_CAP_PORT_SELECTION (dev, port_select_flow_table_bypass)) +break ; + +MLX5_SET (lagc, lag_ctx, active_port, +lag_active_port_bits (mlx5_lag_dev (dev))); +break ; +default : +break ; }MLX5_SET (lagc, lag_ctx, port_select_mode, port_sel_mode);
@@ -386,12 +413,37 @@ static void mlx5_lag_drop_rule_setup(struct mlx5_lag *ldev, } } +static int mlx5_cmd_modify_active_port (struct mlx5_core_dev *dev,u8 ports) +{ +u32 in[MLX5_ST_SZ_DW (modify_lag_in)] = {}; +void *lag_ctx; + + lag_ctx =MLX5_ADDR_OF (modify_lag_in, in, ctx); + +MLX5_SET (modify_lag_in, in, opcode,MLX5_CMD_OP_MODIFY_LAG ); +MLX5_SET (modify_lag_in, in, field_select,0x2 ); + +MLX5_SET (lagc, lag_ctx, active_port, ports); + +return mlx5_cmd_exec_in (dev, modify_lag, in); +} +static int _mlx5_modify_lag (struct mlx5_lag *ldev,u8 *ports) {struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1 ].dev; +u8 active_ports; +int ret; -if (test_bit (MLX5_LAG_MODE_FLAG_HASH_BASED , &ldev->mode_flags)) -return mlx5_lag_port_sel_modify (ldev, ports); +if (test_bit (MLX5_LAG_MODE_FLAG_HASH_BASED , &ldev->mode_flags)) { + ret =mlx5_lag_port_sel_modify (ldev, ports); +if (ret || + !MLX5_CAP_PORT_SELECTION (dev0, port_select_flow_table_bypass)) +return ret; + + active_ports =lag_active_port_bits (ldev); + +return mlx5_cmd_modify_active_port (dev0, active_ports); + }return mlx5_cmd_modify_lag (dev0, ldev->ports, ports); }
Signature · 1 line
2.37.2
PATCH 6/14 net/mlx5: Lag, enable hash mode by default for all NICs
In reply to Saeed MahameedFrom: "Liu, Changcheng" <[email protected]>
The firmware supports adding a steering rule to catch egress traffic of the QPs/TISs which are set port affinity explicitly in hash mode. Enable that mode for NICS with 2 ports as well.
--- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +9 -8
@@ -484,21 +484,22 @@ void mlx5_modify_lag(struct mlx5_lag *ldev,mlx5_lag_drop_rule_setup (ldev, tracker); } -#define MLX5_LAG_ROCE_HASH_PORTS_SUPPORTED 4static int mlx5_lag_set_port_sel_mode_roce (struct mlx5_lag *ldev,unsigned long *flags) { -struct lag_func *dev0 = &ldev->pf[MLX5_LAG_P1 ]; +struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1 ].dev; -if (ldev->ports ==MLX5_LAG_ROCE_HASH_PORTS_SUPPORTED ) { -/* Four ports are support only in hash mode */ -if (!MLX5_CAP_PORT_SELECTION (dev0->dev, port_select_flow_table)) -return -EINVAL ; -set_bit (MLX5_LAG_MODE_FLAG_HASH_BASED , flags); +if (!MLX5_CAP_PORT_SELECTION (dev0, port_select_flow_table)) {if (ldev->ports >2 ) - ldev->buckets =MLX5_LAG_MAX_HASH_BUCKETS ; +return -EINVAL ; +return 0 ; } +if (ldev->ports >2 ) + ldev->buckets =MLX5_LAG_MAX_HASH_BUCKETS ; + +set_bit (MLX5_LAG_MODE_FLAG_HASH_BASED , flags); +return 0 ; }
Signature · 1 line
2.37.2
PATCH 7/14 net/mlx5: detect and enable bypass port select flow table
In reply to Saeed MahameedFrom: "Liu, Changcheng" <[email protected]>
Use port selection capability port_select_flow_table_bypass bit to detect and enable explicit port affinity even when in lag hash mode.
--- .../net/ethernet/mellanox/mlx5/core/main.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +34 -0
@@ -652,6 +652,33 @@ static int handle_hca_cap_roce(struct mlx5_core_dev *dev, void *set_ctx)return err; } +static int handle_hca_cap_port_selection (struct mlx5_core_dev *dev, +void *set_ctx) +{ +void *set_hca_cap; +int err; + +if (!MLX5_CAP_GEN (dev, port_selection_cap)) +return 0 ; + + err =mlx5_core_get_caps (dev,MLX5_CAP_PORT_SELECTION ); +if (err) +return err; + +if (MLX5_CAP_PORT_SELECTION (dev, port_select_flow_table_bypass) || + !MLX5_CAP_PORT_SELECTION_MAX (dev, port_select_flow_table_bypass)) +return 0 ; + + set_hca_cap =MLX5_ADDR_OF (set_hca_cap_in, set_ctx, capability); +memcpy (set_hca_cap, dev->caps.hca[MLX5_CAP_PORT_SELECTION ]->cur, +MLX5_ST_SZ_BYTES (port_selection_cap)); +MLX5_SET (port_selection_cap, set_hca_cap, port_select_flow_table_bypass,1 ); + + err =set_caps (dev, set_ctx,MLX5_SET_HCA_CAP_OP_MODE_PORT_SELECTION ); + +return err; +} +static int set_hca_cap (struct mlx5_core_dev *dev) {int set_sz =MLX5_ST_SZ_BYTES (set_hca_cap_in);
@@ -696,6 +723,13 @@ static int set_hca_cap(struct mlx5_core_dev *dev) goto out; } +memset (set_ctx,0 , set_sz); + err =handle_hca_cap_port_selection (dev, set_ctx); +if (err) { +mlx5_core_err (dev,"handle_hca_cap_port_selection failed\n" ); + goto out; + } + out:kfree (set_ctx);return err;
Signature · 1 line
2.37.2
PATCH 8/14 net/mlx5: Remove unused functions
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Remove functions which are no longer used in the driver:
mlx5e_ipsec_is_tx_flow
mlx5_health_flush get_cqe_enhanced_num_mini_cqes get_cqe_l3_hdr_type
mlx5_health_flush
mlx5_fs_is_ipsec_flow _mlx5_fs_is_outer_ipproto_flow mlx5_fs_is_outer_tcp_flow mlx5_fs_is_outer_udp_flow mlx5_fs_is_vxlan_flow mlx5_fs_is_outer_ipsec_flow
--- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 5 -- .../net/ethernet/mellanox/mlx5/core/health.c | 7 --- include/linux/mlx5/device.h | 11 ----- include/linux/mlx5/driver.h | 1 - include/linux/mlx5/fs_helpers.h | 48 ------------------- 5 files changed, 72 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +0 -5
@@ -77,11 +77,6 @@ static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe)return MLX5_IPSEC_METADATA_MARKER (be32_to_cpu (cqe->ft_metadata)); } -static inline bool mlx5e_ipsec_is_tx_flow (struct mlx5e_accel_tx_ipsec_state *ipsec_st) -{ -return ipsec_st->x; -} -static inline bool mlx5e_ipsec_eseg_meta (struct mlx5_wqe_eth_seg *eseg) {return eseg->flow_table_metadata &cpu_to_be32 (MLX5_ETH_WQE_FT_META_IPSEC );
drivers/net/ethernet/mellanox/mlx5/core/health.c +0 -7
@@ -875,13 +875,6 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev)cancel_work_sync (&health->fatal_report_work); } -void mlx5_health_flush (struct mlx5_core_dev *dev) -{ -struct mlx5_core_health *health = &dev->priv.health; - -flush_workqueue (health->wq); -} -void mlx5_health_cleanup (struct mlx5_core_dev *dev) {struct mlx5_core_health *health = &dev->priv.health;
include/linux/mlx5/device.h +0 -11
@@ -874,12 +874,6 @@ static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe)return cqe->op_own >>4 ; } -static inline u8 get_cqe_enhanced_num_mini_cqes (struct mlx5_cqe64 *cqe) -{ -/* num_of_mini_cqes is zero based */ -return get_cqe_opcode (cqe) +1 ; -} -static inline u8 get_cqe_lro_tcppsh (struct mlx5_cqe64 *cqe) {return (cqe->lro.tcppsh_abort_dupack >>6 ) &1 ;
@@ -890,11 +884,6 @@ static inline u8 get_cqe_l4_hdr_type(struct mlx5_cqe64 *cqe)return (cqe->l4_l3_hdr_type >>4 ) &0x7 ; } -static inline u8 get_cqe_l3_hdr_type (struct mlx5_cqe64 *cqe) -{ -return (cqe->l4_l3_hdr_type >>2 ) &0x3 ; -} -static inline bool cqe_is_tunneled (struct mlx5_cqe64 *cqe) {return cqe->tls_outer_l3_tunneled &0x1 ;
include/linux/mlx5/driver.h +0 -1
@@ -1017,7 +1017,6 @@ int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,bool mlx5_cmd_is_down (struct mlx5_core_dev *dev);int mlx5_core_get_caps (struct mlx5_core_dev *dev,enum mlx5_cap_type cap_type); -void mlx5_health_flush (struct mlx5_core_dev *dev);void mlx5_health_cleanup (struct mlx5_core_dev *dev);int mlx5_health_init (struct mlx5_core_dev *dev);void mlx5_start_health_poll (struct mlx5_core_dev *dev);
include/linux/mlx5/fs_helpers.h +0 -48
58 lines not on this page · raw message
Signature · 1 line
2.37.2
PATCH 9/14 net/mlx5: Remove unused structs
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Remove structs which are no longer used in the driver:
mlx5dr_cmd_qp_create_attr
mlx5_fs_dr_ns
mlx5_pas
--- .../mellanox/mlx5/core/steering/dr_types.h | 14 -------------- .../ethernet/mellanox/mlx5/core/steering/fs_dr.h | 4 ---- include/linux/mlx5/driver.h | 5 ----- 3 files changed, 23 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +0 -14
@@ -1294,20 +1294,6 @@ struct mlx5dr_cmd_gid_attr {u32 roce_ver; }; -struct mlx5dr_cmd_qp_create_attr { -u32 page_id; -u32 pdn; -u32 cqn; -u32 pm_state; -u32 service_type; -u32 buff_umem_id; -u32 db_umem_id; -u32 sq_wqe_cnt; -u32 rq_wqe_cnt; -u32 rq_wqe_shift; -u8 isolate_vl_tc:1 ; -}; -int mlx5dr_cmd_query_gid (struct mlx5_core_dev *mdev,u8 vhca_port_num,u16 index,struct mlx5dr_cmd_gid_attr *attr);
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.h +0 -4
@@ -14,10 +14,6 @@ struct mlx5_fs_dr_action {struct mlx5dr_action *dr_action; }; -struct mlx5_fs_dr_ns { -struct mlx5_dr_ns *dr_ns; -}; -struct mlx5_fs_dr_rule {struct mlx5dr_rule *dr_rule;/* Only actions created by fs_dr */
include/linux/mlx5/driver.h +0 -5
@@ -856,11 +856,6 @@ struct mlx5_cmd_work_ent {refcount_t refcnt; }; -struct mlx5_pas { -u64 pa; -u8 log_sz; -}; -enum phy_port_state {MLX5_AAA_111 };
Signature · 1 line
2.37.2
PATCH 10/14 net/mlx5: Remove from FPGA IFC file not-needed definitions
In reply to Saeed MahameedFrom: Leon Romanovsky <[email protected]>
Move IP layout bits definitions to be close to the place that actually uses it, together with removal extra defines that not in-use.
--- include/linux/mlx5/mlx5_ifc.h | 16 ++++++++++++++++ include/linux/mlx5/mlx5_ifc_fpga.h | 24 ------------------------ 2 files changed, 16 insertions(+), 24 deletions(-)
include/linux/mlx5/mlx5_ifc.h +16 -0
@@ -477,6 +477,22 @@ struct mlx5_ifc_odp_per_transport_service_cap_bits {u8 reserved_at_6[0x1a ]; }; +struct mlx5_ifc_ipv4_layout_bits { +u8 reserved_at_0[0x60 ]; + +u8 ipv4[0x20 ]; +}; + +struct mlx5_ifc_ipv6_layout_bits { +u8 ipv6[16 ][0x8 ]; +}; + +union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits { +struct mlx5_ifc_ipv6_layout_bits ipv6_layout; +struct mlx5_ifc_ipv4_layout_bits ipv4_layout; +u8 reserved_at_0[0x80 ]; +}; +struct mlx5_ifc_fte_match_set_lyr_2_4_bits {u8 smac_47_16[0x20 ];
include/linux/mlx5/mlx5_ifc_fpga.h +0 -24
@@ -32,30 +32,6 @@ #ifndef MLX5_IFC_FPGA_H #define MLX5_IFC_FPGA_H -struct mlx5_ifc_ipv4_layout_bits { - u8 reserved_at_0[0x60]; - - u8 ipv4[0x20]; -}; - -struct mlx5_ifc_ipv6_layout_bits { - u8 ipv6[16][0x8]; -}; - -union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits { - struct mlx5_ifc_ipv6_layout_bits ipv6_layout; - struct mlx5_ifc_ipv4_layout_bits ipv4_layout; - u8 reserved_at_0[0x80]; -}; - -enum { - MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9, -}; - -enum { - MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2, -}; - struct mlx5_ifc_fpga_shell_caps_bits { u8 max_num_qps[0x10]; u8 reserved_at_10[0x8];
Signature · 1 line
2.37.2
PATCH 11/14 net/mlx5e: Rename from tls to transport static params
In reply to Saeed MahameedFrom: Or Gerlitz <[email protected]>
The static params structure is used in TLS but also in other transports we're offloading like nvmeotcp:
- Rename the relevant structures/fields
- Create common file for appropriate transports
- Apply changes in the TLS code
No functional change here.
--- .../mlx5/core/en_accel/common_utils.h | 32 +++++++++++++++++ .../mellanox/mlx5/core/en_accel/ktls_rx.c | 6 ++-- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 8 ++--- .../mellanox/mlx5/core/en_accel/ktls_txrx.c | 36 ++++++++----------- .../mellanox/mlx5/core/en_accel/ktls_utils.h | 17 ++------- include/linux/mlx5/device.h | 8 ++--- include/linux/mlx5/mlx5_ifc.h | 8 +++-- 7 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/common_utils.h
drivers/net/ethernet/mellanox/mlx5/core/en_accel/common_utils.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. */ +#ifndef __MLX5E_COMMON_UTILS_H__ +#define __MLX5E_COMMON_UTILS_H__ + +#include "en.h" + +struct mlx5e_set_transport_static_params_wqe { +struct mlx5_wqe_ctrl_seg ctrl; +struct mlx5_wqe_umr_ctrl_seg uctrl; +struct mlx5_mkey_seg mkc; +struct mlx5_wqe_transport_static_params_seg params; +}; + +/* macros for transport_static_params handling */ +#define MLX5E_TRANSPORT_SET_STATIC_PARAMS_WQEBBS \ + (DIV_ROUND_UP(sizeof(struct mlx5e_set_transport_static_params_wqe), MLX5_SEND_WQE_BB)) + +#define MLX5E_TRANSPORT_FETCH_SET_STATIC_PARAMS_WQE (sq, pi) \ + ((struct mlx5e_set_transport_static_params_wqe *)\ + mlx5e_fetch_wqe(&(sq)->wq, pi, sizeof(struct mlx5e_set_transport_static_params_wqe))) + +#define MLX5E_TRANSPORT_STATIC_PARAMS_WQE_SZ \ + (sizeof(struct mlx5e_set_transport_static_params_wqe)) + +#define MLX5E_TRANSPORT_STATIC_PARAMS_DS_CNT \ + (DIV_ROUND_UP(MLX5E_TRANSPORT_STATIC_PARAMS_WQE_SZ, MLX5_SEND_WQE_DS)) + +#define MLX5E_TRANSPORT_STATIC_PARAMS_OCTWORD_SIZE \ + (MLX5_ST_SZ_BYTES(transport_static_params) / MLX5_SEND_WQE_DS) + +#endif /* __MLX5E_COMMON_UTILS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +3 -3
@@ -136,16 +136,16 @@ static struct mlx5_wqe_ctrl_seg * post_static_params(struct mlx5e_icosq *sq, struct mlx5e_ktls_offload_context_rx *priv_rx) { - struct mlx5e_set_tls_static_params_wqe *wqe; + struct mlx5e_set_transport_static_params_wqe *wqe;struct mlx5e_icosq_wqe_info wi;u16 pi, num_wqebbs; - num_wqebbs =MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS ; + num_wqebbs =MLX5E_TRANSPORT_SET_STATIC_PARAMS_WQEBBS ;if (unlikely (!mlx5e_icosq_can_post_wqe (sq, num_wqebbs)))return ERR_PTR (-ENOSPC ); pi =mlx5e_icosq_get_next_pi (sq, num_wqebbs); - wqe =MLX5E_TLS_FETCH_SET_STATIC_PARAMS_WQE (sq, pi); + wqe =MLX5E_TRANSPORT_FETCH_SET_STATIC_PARAMS_WQE (sq, pi); mlx5e_ktls_build_static_params(wqe, sq->pc, sq->sqn, &priv_rx->crypto_info, mlx5e_tir_get_tirn(&priv_rx->tir), priv_rx->key_id, priv_rx->resync.seq, false,
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +4 -4
@@ -32,7 +32,7 @@ u16 mlx5e_ktls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *pa num_dumps =mlx5e_ktls_dumps_num_wqes (params,MAX_SKB_FRAGS ,TLS_MAX_PAYLOAD_SIZE ); - stop_room +=mlx5e_stop_room_for_wqe (mdev,MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS ); + stop_room +=mlx5e_stop_room_for_wqe (mdev,MLX5E_TRANSPORT_SET_STATIC_PARAMS_WQEBBS ); stop_room +=mlx5e_stop_room_for_wqe (mdev,MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS ); stop_room += num_dumps *mlx5e_stop_room_for_wqe (mdev,MLX5E_KTLS_DUMP_WQEBBS ); stop_room +=1 ;/* fence nop */
@@ -544,12 +544,12 @@ post_static_params(struct mlx5e_txqsq *sq, struct mlx5e_ktls_offload_context_tx *priv_tx, bool fence) { -struct mlx5e_set_tls_static_params_wqe *wqe; +struct mlx5e_set_transport_static_params_wqe *wqe;u16 pi, num_wqebbs; - num_wqebbs =MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS ; + num_wqebbs =MLX5E_TRANSPORT_SET_STATIC_PARAMS_WQEBBS ; pi =mlx5e_txqsq_get_next_pi (sq, num_wqebbs); - wqe =MLX5E_TLS_FETCH_SET_STATIC_PARAMS_WQE (sq, pi); + wqe =MLX5E_TRANSPORT_FETCH_SET_STATIC_PARAMS_WQE (sq, pi);mlx5e_ktls_build_static_params (wqe, sq->pc, sq->sqn, &priv_tx->crypto_info, priv_tx->tisn, priv_tx->key_id,0 , fence,TLS_OFFLOAD_CTX_DIR_TX );
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.c +15 -21
@@ -8,10 +8,6 @@ enum { MLX5E_STATIC_PARAMS_CONTEXT_TLS_1_2 = 0x2, }; -enum { -MLX5E_ENCRYPTION_STANDARD_TLS =0x1 , -}; -#define EXTRACT_INFO_FIELDS do { \ salt = info->salt; \ rec_seq = info->rec_seq; \
@@ -20,7 +16,7 @@ enum { }while (0 ) static void -fill_static_params (struct mlx5_wqe_tls_static_params_seg *params, +fill_static_params (struct mlx5_wqe_transport_static_params_seg *params,struct tls12_crypto_info_aes_gcm_128 *info,u32 key_id,u32 resync_tcp_sn) {
@@ -34,25 +30,25 @@ fill_static_params(struct mlx5_wqe_tls_static_params_seg *params,EXTRACT_INFO_FIELDS ; - gcm_iv =MLX5_ADDR_OF (tls_static_params, ctx, gcm_iv); - initial_rn =MLX5_ADDR_OF (tls_static_params, ctx, initial_record_number); + gcm_iv =MLX5_ADDR_OF (transport_static_params, ctx, gcm_iv); + initial_rn =MLX5_ADDR_OF (transport_static_params, ctx, initial_record_number);memcpy (gcm_iv, salt, salt_sz);memcpy (initial_rn, rec_seq, rec_seq_sz); tls_version =MLX5E_STATIC_PARAMS_CONTEXT_TLS_1_2 ; -MLX5_SET (tls_static_params, ctx, tls_version, tls_version); -MLX5_SET (tls_static_params, ctx, const_1,1 ); -MLX5_SET (tls_static_params, ctx, const_2,2 ); -MLX5_SET (tls_static_params, ctx, encryption_standard, -MLX5E_ENCRYPTION_STANDARD_TLS ); -MLX5_SET (tls_static_params, ctx, resync_tcp_sn, resync_tcp_sn); -MLX5_SET (tls_static_params, ctx, dek_index, key_id); +MLX5_SET (transport_static_params, ctx, tls_version, tls_version); +MLX5_SET (transport_static_params, ctx, const_1,1 ); +MLX5_SET (transport_static_params, ctx, const_2,2 ); +MLX5_SET (transport_static_params, ctx, acc_type, +MLX5_TRANSPORT_STATIC_PARAMS_ACC_TYPE_TLS ); +MLX5_SET (transport_static_params, ctx, resync_tcp_sn, resync_tcp_sn); +MLX5_SET (transport_static_params, ctx, dek_index, key_id); } void -mlx5e_ktls_build_static_params(struct mlx5e_set_tls_static_params_wqe *wqe, +mlx5e_ktls_build_static_params(struct mlx5e_set_transport_static_params_wqe *wqe, u16 pc, u32 sqn, struct tls12_crypto_info_aes_gcm_128 *info, u32 tis_tir_num, u32 key_id, u32 resync_tcp_sn,
@@ -61,19 +57,17 @@ mlx5e_ktls_build_static_params(struct mlx5e_set_tls_static_params_wqe *wqe,struct mlx5_wqe_umr_ctrl_seg *ucseg = &wqe->uctrl;struct mlx5_wqe_ctrl_seg *cseg = &wqe->ctrl;u8 opmod = direction ==TLS_OFFLOAD_CTX_DIR_TX ? -MLX5_OPC_MOD_TLS_TIS_STATIC_PARAMS : -MLX5_OPC_MOD_TLS_TIR_STATIC_PARAMS ; - -#define STATIC_PARAMS_DS_CNT DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS) +MLX5_OPC_MOD_TRANSPORT_TIS_STATIC_PARAMS : +MLX5_OPC_MOD_TRANSPORT_TIR_STATIC_PARAMS ; cseg->opmod_idx_opcode =cpu_to_be32 ((pc <<8 ) |MLX5_OPCODE_UMR | (opmod <<24 )); cseg->qpn_ds =cpu_to_be32 ((sqn <<MLX5_WQE_CTRL_QPN_SHIFT ) | -STATIC_PARAMS_DS_CNT ); +MLX5E_TRANSPORT_STATIC_PARAMS_DS_CNT ); cseg->fm_ce_se = fence ?MLX5_FENCE_MODE_INITIATOR_SMALL :0 ; cseg->tis_tir_num =cpu_to_be32 (tis_tir_num <<8 ); ucseg->flags =MLX5_UMR_INLINE ; - ucseg->bsf_octowords =cpu_to_be16 (MLX5_ST_SZ_BYTES (tls_static_params) /16 ); + ucseg->bsf_octowords =cpu_to_be16 (MLX5E_TRANSPORT_STATIC_PARAMS_OCTWORD_SIZE );fill_static_params (&wqe->params, info, key_id, resync_tcp_sn); }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_utils.h +2 -15
@@ -6,6 +6,7 @@#include <net/tls.h> #include "en.h" +#include "en_accel/common_utils.h" enum {MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD =0 ,
@@ -27,13 +28,6 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,void mlx5e_ktls_del_rx (struct net_device *netdev,struct tls_context *tls_ctx);void mlx5e_ktls_rx_resync (struct net_device *netdev,struct sock *sk,u32 seq,u8 *rcd_sn); -struct mlx5e_set_tls_static_params_wqe { -struct mlx5_wqe_ctrl_seg ctrl; -struct mlx5_wqe_umr_ctrl_seg uctrl; -struct mlx5_mkey_seg mkc; -struct mlx5_wqe_tls_static_params_seg params; -}; -struct mlx5e_set_tls_progress_params_wqe {struct mlx5_wqe_ctrl_seg ctrl;struct mlx5_wqe_tls_progress_params_seg params;
@@ -44,19 +38,12 @@ struct mlx5e_get_tls_progress_params_wqe {struct mlx5_seg_get_psv psv; }; -#define MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS \ - (DIV_ROUND_UP(sizeof(struct mlx5e_set_tls_static_params_wqe), MLX5_SEND_WQE_BB)) -#define MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS \ (DIV_ROUND_UP(sizeof(struct mlx5e_set_tls_progress_params_wqe), MLX5_SEND_WQE_BB))#define MLX5E_KTLS_GET_PROGRESS_WQEBBS \ (DIV_ROUND_UP(sizeof(struct mlx5e_get_tls_progress_params_wqe), MLX5_SEND_WQE_BB)) -#define MLX5E_TLS_FETCH_SET_STATIC_PARAMS_WQE (sq, pi) \ - ((struct mlx5e_set_tls_static_params_wqe *)\ - mlx5e_fetch_wqe(&(sq)->wq, pi, sizeof(struct mlx5e_set_tls_static_params_wqe))) -#define MLX5E_TLS_FETCH_SET_PROGRESS_PARAMS_WQE (sq, pi) \ ((struct mlx5e_set_tls_progress_params_wqe *)\ mlx5e_fetch_wqe(&(sq)->wq, pi, sizeof(struct mlx5e_set_tls_progress_params_wqe)))
@@ -70,7 +57,7 @@ struct mlx5e_get_tls_progress_params_wqe { mlx5e_fetch_wqe(&(sq)->wq, pi, sizeof(struct mlx5e_dump_wqe))) void -mlx5e_ktls_build_static_params(struct mlx5e_set_tls_static_params_wqe *wqe, +mlx5e_ktls_build_static_params(struct mlx5e_set_transport_static_params_wqe *wqe, u16 pc, u32 sqn, struct tls12_crypto_info_aes_gcm_128 *info, u32 tis_tir_num, u32 key_id, u32 resync_tcp_sn,
include/linux/mlx5/device.h +4 -4
@@ -444,8 +444,8 @@ enum { };enum { -MLX5_OPC_MOD_TLS_TIS_STATIC_PARAMS =0x1 , -MLX5_OPC_MOD_TLS_TIR_STATIC_PARAMS =0x2 , +MLX5_OPC_MOD_TRANSPORT_TIS_STATIC_PARAMS =0x1 , +MLX5_OPC_MOD_TRANSPORT_TIR_STATIC_PARAMS =0x2 , };enum {
@@ -453,8 +453,8 @@ enum { MLX5_OPC_MOD_TLS_TIR_PROGRESS_PARAMS = 0x2, }; -struct mlx5_wqe_tls_static_params_seg { -u8 ctx[MLX5_ST_SZ_BYTES (tls_static_params)]; +struct mlx5_wqe_transport_static_params_seg { +u8 ctx[MLX5_ST_SZ_BYTES (transport_static_params)]; };struct mlx5_wqe_tls_progress_params_seg {
include/linux/mlx5/mlx5_ifc.h +6 -2
@@ -11671,12 +11671,16 @@ enum { MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_IPSEC = 0x2, }; -struct mlx5_ifc_tls_static_params_bits { +enum { +MLX5_TRANSPORT_STATIC_PARAMS_ACC_TYPE_TLS =0x1 , +}; + +struct mlx5_ifc_transport_static_params_bits {u8 const_2[0x2 ];u8 tls_version[0x4 ];u8 const_1[0x2 ];u8 reserved_at_8[0x14 ]; -u8 encryption_standard[0x4 ]; +u8 acc_type[0x4 ];u8 reserved_at_20[0x20 ];
Signature · 1 line
2.37.2
PATCH 12/14 net/mlx5: Add NVMEoTCP caps, HW bits, 128B CQE and enumerations
In reply to Saeed MahameedFrom: Ben Ben-Ishay <[email protected]>
Add the necessary infrastructure for NVMEoTCP offload:
- Create mlx5_cqe128 structure for NVMEoTCP offload. The new structure consist from the regular mlx5_cqe64 + NVMEoTCP data information for offloaded packets.
- Add nvmetcp field to mlx5_cqe64, this field define the type of the data that the additional NVMEoTCP part represents.
- Add nvmeotcp_zero_copy_en + nvmeotcp_crc_en bit to the TIR, for identify NVMEoTCP offload flow and tag_buffer_id that will be used by the connected nvmeotcp_queues.
- Add new capability to HCA_CAP that represents the NVMEoTCP offload ability.
--- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 6 ++ include/linux/mlx5/device.h | 51 +++++++++++++- include/linux/mlx5/mlx5_ifc.h | 74 ++++++++++++++++++-- include/linux/mlx5/qp.h | 1 + 4 files changed, 127 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fw.c +6 -0
@@ -273,6 +273,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)return err; } +if (MLX5_CAP_GEN (dev, nvmeotcp)) { + err =mlx5_core_get_caps (dev,MLX5_CAP_DEV_NVMEOTCP ); +if (err) +return err; + } +return 0 ; }
include/linux/mlx5/device.h +50 -1
87 lines not on this page · raw message
include/linux/mlx5/mlx5_ifc.h +70 -4
139 lines not on this page · raw message
include/linux/mlx5/qp.h +1 -0
@@ -225,6 +225,7 @@ struct mlx5_wqe_ctrl_seg {#define MLX5_WQE_CTRL_OPCODE_MASK 0xff#define MLX5_WQE_CTRL_WQE_INDEX_MASK 0x00ffff00#define MLX5_WQE_CTRL_WQE_INDEX_SHIFT 8 +#define MLX5_WQE_CTRL_TIR_TIS_INDEX_SHIFT 8enum {MLX5_ETH_WQE_L3_INNER_CSUM =1 <<4 ,
Signature · 1 line
2.37.2
PATCH 13/14 net/mlx5: Add IFC bits for general obj create param
In reply to Saeed MahameedFrom: Jianbo Liu <[email protected]>
Before this patch, the log_obj_range was defined inside general_obj_in_cmd_hdr to support bulk allocation. However, we need to modify/query one of the object in the bulk in later patch, so change those fields to param bits for parameters specific for cmd header, and add general_obj_create_param according to what was updated in spec. We will also add general_obj_query_param for modify/query later.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c | 6 ++++-- include/linux/mlx5/mlx5_ifc.h | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c +4 -2
@@ -199,13 +199,15 @@ mlx5e_flow_meter_create_aso_obj(struct mlx5e_flow_meters *flow_meters, int *obj_u32 in[MLX5_ST_SZ_DW (create_flow_meter_aso_obj_in)] = {};u32 out[MLX5_ST_SZ_DW (general_obj_out_cmd_hdr)];struct mlx5_core_dev *mdev = flow_meters->mdev; -void *obj; +void *obj, *param;int err;MLX5_SET (general_obj_in_cmd_hdr, in, opcode,MLX5_CMD_OP_CREATE_GENERAL_OBJECT );MLX5_SET (general_obj_in_cmd_hdr, in, obj_type,MLX5_GENERAL_OBJECT_TYPES_FLOW_METER_ASO ); -MLX5_SET (general_obj_in_cmd_hdr, in, log_obj_range, flow_meters->log_granularity); + param =MLX5_ADDR_OF (general_obj_in_cmd_hdr, in, op_param); +MLX5_SET (general_obj_create_param, param, log_obj_range, + flow_meters->log_granularity); obj =MLX5_ADDR_OF (create_flow_meter_aso_obj_in, in, flow_meter_aso_obj);MLX5_SET (flow_meter_aso_obj, obj, meter_aso_access_pd, flow_meters->pdn);
include/linux/mlx5/mlx5_ifc.h +8 -3
@@ -6085,6 +6085,13 @@ struct mlx5_ifc_match_definer_bits {u8 match_mask[16 ][0x20 ]; }; +struct mlx5_ifc_general_obj_create_param_bits { +u8 alias_object[0x1 ]; +u8 reserved_at_1[0x2 ]; +u8 log_obj_range[0x5 ]; +u8 reserved_at_8[0x18 ]; +}; +struct mlx5_ifc_general_obj_in_cmd_hdr_bits {u8 opcode[0x10 ];u8 uid[0x10 ];
@@ -6094,9 +6101,7 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits {u8 obj_id[0x20 ]; -u8 reserved_at_60[0x3 ]; -u8 log_obj_range[0x5 ]; -u8 reserved_at_68[0x18 ]; +struct mlx5_ifc_general_obj_create_param_bits op_param; };struct mlx5_ifc_general_obj_out_cmd_hdr_bits {
Signature · 1 line
2.37.2
PATCH 14/14 net/mlx5: Add IFC bits and enums for crypto key
In reply to Saeed MahameedFrom: Jianbo Liu <[email protected]>
Add and extend structure layouts and defines for fast crypto key update. This is a prerequisite to support bulk creation, key modification and destruction, software wrapped DEK, and SYNC_CRYPTO command.
--- include/linux/mlx5/mlx5_ifc.h | 146 ++++++++++++++++++++++++++++++++-- 1 file changed, 140 insertions(+), 6 deletions(-)
include/linux/mlx5/mlx5_ifc.h +140 -6
@@ -303,6 +303,7 @@ enum {MLX5_CMD_OP_SYNC_STEERING =0xb00 ,MLX5_CMD_OP_QUERY_VHCA_STATE =0xb0d ,MLX5_CMD_OP_MODIFY_VHCA_STATE =0xb0e , +MLX5_CMD_OP_SYNC_CRYPTO =0xb12 , MLX5_CMD_OP_MAX };
@@ -1094,6 +1095,30 @@ struct mlx5_ifc_sync_steering_out_bits {u8 reserved_at_40[0x40 ]; }; +struct mlx5_ifc_sync_crypto_in_bits { +u8 opcode[0x10 ]; +u8 uid[0x10 ]; + +u8 reserved_at_20[0x10 ]; +u8 op_mod[0x10 ]; + +u8 reserved_at_40[0x20 ]; + +u8 reserved_at_60[0x10 ]; +u8 crypto_type[0x10 ]; + +u8 reserved_at_80[0x80 ]; +}; + +struct mlx5_ifc_sync_crypto_out_bits { +u8 status[0x8 ]; +u8 reserved_at_8[0x18 ]; + +u8 syndrome[0x20 ]; + +u8 reserved_at_40[0x40 ]; +}; +struct mlx5_ifc_device_mem_cap_bits {u8 memic[0x1 ];u8 reserved_at_1[0x1f ];
@@ -1730,7 +1755,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 reserved_at_460[0x3 ];u8 log_max_uctx[0x5 ]; -u8 reserved_at_468[0x2 ]; +u8 reserved_at_468[0x1 ]; +u8 crypto[0x1 ];u8 ipsec_offload[0x1 ];u8 log_max_umem[0x5 ];u8 max_num_eqs[0x10 ];
@@ -3310,6 +3336,30 @@ struct mlx5_ifc_nvmeotcp_cap_bits {u8 reserved_at_40[0x7c0 ]; }; +struct mlx5_ifc_crypto_cap_bits { +u8 reserved_at_0[0x3 ]; +u8 synchronize_dek[0x1 ]; +u8 int_kek_manual[0x1 ]; +u8 int_kek_auto[0x1 ]; +u8 reserved_at_6[0x1a ]; + +u8 reserved_at_20[0x3 ]; +u8 log_dek_max_alloc[0x5 ]; +u8 reserved_at_28[0x3 ]; +u8 log_max_num_deks[0x5 ]; +u8 reserved_at_30[0x10 ]; + +u8 reserved_at_40[0x20 ]; + +u8 reserved_at_60[0x3 ]; +u8 log_dek_granularity[0x5 ]; +u8 reserved_at_68[0x3 ]; +u8 log_max_num_int_kek[0x5 ]; +u8 sw_wrapped_dek[0x10 ]; + +u8 reserved_at_80[0x780 ]; +}; +union mlx5_ifc_hca_cap_union_bits {struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap;struct mlx5_ifc_cmd_hca_cap_2_bits cmd_hca_cap_2;
@@ -3330,6 +3380,7 @@ union mlx5_ifc_hca_cap_union_bits {struct mlx5_ifc_virtio_emulation_cap_bits virtio_emulation_cap;struct mlx5_ifc_shampo_cap_bits shampo_cap;struct mlx5_ifc_nvmeotcp_cap_bits nvmeotcp_cap; +struct mlx5_ifc_crypto_cap_bits crypto_cap;u8 reserved_at_0[0x8000 ]; };
@@ -6092,6 +6143,11 @@ struct mlx5_ifc_general_obj_create_param_bits {u8 reserved_at_8[0x18 ]; }; +struct mlx5_ifc_general_obj_query_param_bits { +u8 alias_object[0x1 ]; +u8 obj_offset[0x1f ]; +}; +struct mlx5_ifc_general_obj_in_cmd_hdr_bits {u8 opcode[0x10 ];u8 uid[0x10 ];
@@ -6101,7 +6157,10 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits {u8 obj_id[0x20 ]; -struct mlx5_ifc_general_obj_create_param_bits op_param; +union { +struct mlx5_ifc_general_obj_create_param_bits create; +struct mlx5_ifc_general_obj_query_param_bits query; + } op_param; };struct mlx5_ifc_general_obj_out_cmd_hdr_bits {
@@ -11528,6 +11587,7 @@ enum {MLX5_GENERAL_OBJECT_TYPES_SAMPLER =0x20 ,MLX5_GENERAL_OBJECT_TYPES_NVMEOTCP_TAG_BUFFER_TABLE =0x21 ,MLX5_GENERAL_OBJECT_TYPES_FLOW_METER_ASO =0x24 , + MLX5_GENERAL_OBJECT_TYPES_INT_KEK = 0x47, }; enum {
@@ -11578,10 +11638,44 @@ struct mlx5_ifc_modify_ipsec_obj_in_bits {struct mlx5_ifc_ipsec_obj_bits ipsec_object; }; +struct mlx5_ifc_wrapped_dek_bits { +u8 gcm_iv[0x60 ]; + +u8 reserved_at_60[0x20 ]; + +u8 const0[0x1 ]; +u8 key_size[0x1 ]; +u8 reserved_at_82[0x2 ]; +u8 key2_invalid[0x1 ]; +u8 reserved_at_85[0x3 ]; +u8 pd[0x18 ]; + +u8 key_purpose[0x5 ]; +u8 reserved_at_a5[0x13 ]; +u8 kek_id[0x8 ]; + +u8 reserved_at_c0[0x40 ]; + +u8 key1[0x8 ][0x20 ]; + +u8 key2[0x8 ][0x20 ]; + +u8 reserved_at_300[0x40 ]; + +u8 const1[0x1 ]; +u8 reserved_at_341[0x1f ]; + +u8 reserved_at_360[0x20 ]; + +u8 auth_tag[0x80 ]; +}; +struct mlx5_ifc_encryption_key_obj_bits {u8 modify_field_select[0x40 ]; -u8 reserved_at_40[0x14 ]; +u8 state[0x8 ]; +u8 sw_wrapped[0x1 ]; +u8 reserved_at_49[0xb ];u8 key_size[0x4 ];u8 reserved_at_58[0x4 ];u8 key_type[0x4 ];
@@ -11589,10 +11683,17 @@ struct mlx5_ifc_encryption_key_obj_bits {u8 reserved_at_60[0x8 ];u8 pd[0x18 ]; -u8 reserved_at_80[0x180 ]; -u8 key[8 ][0x20 ]; +u8 reserved_at_80[0x100 ]; + +u8 opaque[0x40 ]; + +u8 reserved_at_1c0[0x40 ]; + +u8 key[8 ][0x80 ]; + +u8 sw_wrapped_dek[8 ][0x80 ]; -u8 reserved_at_300[0x500 ]; +u8 reserved_at_a00[0x600 ]; };struct mlx5_ifc_create_encryption_key_in_bits {
@@ -11600,6 +11701,11 @@ struct mlx5_ifc_create_encryption_key_in_bits {struct mlx5_ifc_encryption_key_obj_bits encryption_key_object; }; +struct mlx5_ifc_modify_encryption_key_in_bits { +struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr; +struct mlx5_ifc_encryption_key_obj_bits encryption_key_object; +}; +enum {MLX5_FLOW_METER_MODE_BYTES_IP_LENGTH =0x0 ,MLX5_FLOW_METER_MODE_BYTES_CALC_WITH_L2 =0x1 ,
@@ -11655,6 +11761,34 @@ struct mlx5_ifc_create_flow_meter_aso_obj_in_bits {struct mlx5_ifc_flow_meter_aso_obj_bits flow_meter_aso_obj; }; +struct mlx5_ifc_int_kek_obj_bits { +u8 modify_field_select[0x40 ]; + +u8 state[0x8 ]; +u8 auto_gen[0x1 ]; +u8 reserved_at_49[0xb ]; +u8 key_size[0x4 ]; +u8 reserved_at_58[0x8 ]; + +u8 reserved_at_60[0x8 ]; +u8 pd[0x18 ]; + +u8 reserved_at_80[0x180 ]; +u8 key[8 ][0x80 ]; + +u8 reserved_at_600[0x200 ]; +}; + +struct mlx5_ifc_create_int_kek_obj_in_bits { +struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr; +struct mlx5_ifc_int_kek_obj_bits int_kek_object; +}; + +struct mlx5_ifc_create_int_kek_obj_out_bits { +struct mlx5_ifc_general_obj_out_cmd_hdr_bits general_obj_out_cmd_hdr; +struct mlx5_ifc_int_kek_obj_bits int_kek_object; +}; +struct mlx5_ifc_sampler_obj_bits {u8 modify_field_select[0x40 ];
Signature · 1 line
2.37.2