Skip to content

Commit 8385c51

Browse files
Lior Nahmansondavem330
authored andcommitted
net/mlx5: Introduce MACsec Connect-X offload hardware bits and structures
Add MACsec offload related IFC structs, layouts and enumerations. Signed-off-by: Lior Nahmanson <[email protected]> Reviewed-by: Raed Salem <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e227ee9 commit 8385c51

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed

include/linux/mlx5/device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,7 @@ enum mlx5_cap_type {
11981198
MLX5_CAP_DEV_EVENT = 0x14,
11991199
MLX5_CAP_IPSEC,
12001200
MLX5_CAP_DEV_SHAMPO = 0x1d,
1201+
MLX5_CAP_MACSEC = 0x1f,
12011202
MLX5_CAP_GENERAL_2 = 0x20,
12021203
MLX5_CAP_PORT_SELECTION = 0x25,
12031204
/* NUM OF CAP Types */
@@ -1446,6 +1447,9 @@ enum mlx5_qcam_feature_groups {
14461447
#define MLX5_CAP_DEV_SHAMPO(mdev, cap)\
14471448
MLX5_GET(shampo_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_SHAMPO], cap)
14481449

1450+
#define MLX5_CAP_MACSEC(mdev, cap)\
1451+
MLX5_GET(macsec_cap, (mdev)->caps.hca[MLX5_CAP_MACSEC]->cur, cap)
1452+
14491453
enum {
14501454
MLX5_CMD_STAT_OK = 0x0,
14511455
MLX5_CMD_STAT_INT_ERR = 0x1,

include/linux/mlx5/mlx5_ifc.h

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ enum {
8282
MLX5_GENERAL_OBJ_TYPES_CAP_SW_ICM = (1ULL << MLX5_OBJ_TYPE_SW_ICM),
8383
MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT = (1ULL << 11),
8484
MLX5_GENERAL_OBJ_TYPES_CAP_VIRTIO_NET_Q = (1ULL << 13),
85+
MLX5_GENERAL_OBJ_TYPES_CAP_MACSEC_OFFLOAD = (1ULL << 39),
8586
};
8687

8788
enum {
@@ -449,7 +450,12 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
449450
u8 reserved_at_60[0x2];
450451
u8 reformat_insert[0x1];
451452
u8 reformat_remove[0x1];
452-
u8 reserver_at_64[0x14];
453+
u8 macsec_encrypt[0x1];
454+
u8 macsec_decrypt[0x1];
455+
u8 reserved_at_66[0x2];
456+
u8 reformat_add_macsec[0x1];
457+
u8 reformat_remove_macsec[0x1];
458+
u8 reserved_at_6a[0xe];
453459
u8 log_max_ft_num[0x8];
454460

455461
u8 reserved_at_80[0x10];
@@ -611,7 +617,11 @@ struct mlx5_ifc_fte_match_set_misc2_bits {
611617

612618
u8 metadata_reg_a[0x20];
613619

614-
u8 reserved_at_1a0[0x60];
620+
u8 reserved_at_1a0[0x8];
621+
622+
u8 macsec_syndrome[0x8];
623+
624+
u8 reserved_at_1b0[0x50];
615625
};
616626

617627
struct mlx5_ifc_fte_match_set_misc3_bits {
@@ -1276,6 +1286,24 @@ struct mlx5_ifc_ipsec_cap_bits {
12761286
u8 reserved_at_30[0x7d0];
12771287
};
12781288

1289+
struct mlx5_ifc_macsec_cap_bits {
1290+
u8 macsec_epn[0x1];
1291+
u8 reserved_at_1[0x2];
1292+
u8 macsec_crypto_esp_aes_gcm_256_encrypt[0x1];
1293+
u8 macsec_crypto_esp_aes_gcm_128_encrypt[0x1];
1294+
u8 macsec_crypto_esp_aes_gcm_256_decrypt[0x1];
1295+
u8 macsec_crypto_esp_aes_gcm_128_decrypt[0x1];
1296+
u8 reserved_at_7[0x4];
1297+
u8 log_max_macsec_offload[0x5];
1298+
u8 reserved_at_10[0x10];
1299+
1300+
u8 min_log_macsec_full_replay_window[0x8];
1301+
u8 max_log_macsec_full_replay_window[0x8];
1302+
u8 reserved_at_30[0x10];
1303+
1304+
u8 reserved_at_40[0x7c0];
1305+
};
1306+
12791307
enum {
12801308
MLX5_WQ_TYPE_LINKED_LIST = 0x0,
12811309
MLX5_WQ_TYPE_CYCLIC = 0x1,
@@ -3295,6 +3323,7 @@ union mlx5_ifc_hca_cap_union_bits {
32953323
struct mlx5_ifc_device_mem_cap_bits device_mem_cap;
32963324
struct mlx5_ifc_virtio_emulation_cap_bits virtio_emulation_cap;
32973325
struct mlx5_ifc_shampo_cap_bits shampo_cap;
3326+
struct mlx5_ifc_macsec_cap_bits macsec_cap;
32983327
u8 reserved_at_0[0x8000];
32993328
};
33003329

@@ -3323,6 +3352,7 @@ enum {
33233352

33243353
enum {
33253354
MLX5_FLOW_CONTEXT_ENCRYPT_DECRYPT_TYPE_IPSEC = 0x0,
3355+
MLX5_FLOW_CONTEXT_ENCRYPT_DECRYPT_TYPE_MACSEC = 0x1,
33263356
};
33273357

33283358
struct mlx5_ifc_vlan_bits {
@@ -6320,6 +6350,8 @@ enum mlx5_reformat_ctx_type {
63206350
MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL = 0x4,
63216351
MLX5_REFORMAT_TYPE_INSERT_HDR = 0xf,
63226352
MLX5_REFORMAT_TYPE_REMOVE_HDR = 0x10,
6353+
MLX5_REFORMAT_TYPE_ADD_MACSEC = 0x11,
6354+
MLX5_REFORMAT_TYPE_DEL_MACSEC = 0x12,
63236355
};
63246356

63256357
struct mlx5_ifc_alloc_packet_reformat_context_in_bits {
@@ -11475,6 +11507,7 @@ enum {
1147511507
MLX5_GENERAL_OBJECT_TYPES_IPSEC = 0x13,
1147611508
MLX5_GENERAL_OBJECT_TYPES_SAMPLER = 0x20,
1147711509
MLX5_GENERAL_OBJECT_TYPES_FLOW_METER_ASO = 0x24,
11510+
MLX5_GENERAL_OBJECT_TYPES_MACSEC = 0x27,
1147811511
};
1147911512

1148011513
enum {
@@ -11525,6 +11558,67 @@ struct mlx5_ifc_modify_ipsec_obj_in_bits {
1152511558
struct mlx5_ifc_ipsec_obj_bits ipsec_object;
1152611559
};
1152711560

11561+
struct mlx5_ifc_macsec_aso_bits {
11562+
u8 valid[0x1];
11563+
u8 reserved_at_1[0x1];
11564+
u8 mode[0x2];
11565+
u8 window_size[0x2];
11566+
u8 soft_lifetime_arm[0x1];
11567+
u8 hard_lifetime_arm[0x1];
11568+
u8 remove_flow_enable[0x1];
11569+
u8 epn_event_arm[0x1];
11570+
u8 reserved_at_a[0x16];
11571+
11572+
u8 remove_flow_packet_count[0x20];
11573+
11574+
u8 remove_flow_soft_lifetime[0x20];
11575+
11576+
u8 reserved_at_60[0x80];
11577+
11578+
u8 mode_parameter[0x20];
11579+
11580+
u8 replay_protection_window[8][0x20];
11581+
};
11582+
11583+
struct mlx5_ifc_macsec_offload_obj_bits {
11584+
u8 modify_field_select[0x40];
11585+
11586+
u8 confidentiality_en[0x1];
11587+
u8 reserved_at_41[0x1];
11588+
u8 esn_en[0x1];
11589+
u8 esn_overlap[0x1];
11590+
u8 reserved_at_44[0x2];
11591+
u8 confidentiality_offset[0x2];
11592+
u8 reserved_at_48[0x4];
11593+
u8 aso_return_reg[0x4];
11594+
u8 reserved_at_50[0x10];
11595+
11596+
u8 esn_msb[0x20];
11597+
11598+
u8 reserved_at_80[0x8];
11599+
u8 dekn[0x18];
11600+
11601+
u8 reserved_at_a0[0x20];
11602+
11603+
u8 sci[0x40];
11604+
11605+
u8 reserved_at_100[0x8];
11606+
u8 macsec_aso_access_pd[0x18];
11607+
11608+
u8 reserved_at_120[0x60];
11609+
11610+
u8 salt[3][0x20];
11611+
11612+
u8 reserved_at_1e0[0x20];
11613+
11614+
struct mlx5_ifc_macsec_aso_bits macsec_aso;
11615+
};
11616+
11617+
struct mlx5_ifc_create_macsec_obj_in_bits {
11618+
struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr;
11619+
struct mlx5_ifc_macsec_offload_obj_bits macsec_object;
11620+
};
11621+
1152811622
struct mlx5_ifc_encryption_key_obj_bits {
1152911623
u8 modify_field_select[0x40];
1153011624

@@ -11642,6 +11736,7 @@ enum {
1164211736
enum {
1164311737
MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_TLS = 0x1,
1164411738
MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_IPSEC = 0x2,
11739+
MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_MACSEC = 0x4,
1164511740
};
1164611741

1164711742
struct mlx5_ifc_tls_static_params_bits {

0 commit comments

Comments
 (0)