Skip to content

Commit c338325

Browse files
Emeel HakimSaeed Mahameed
authored andcommitted
net/mlx5e: Support IPsec upper protocol selector field offload for RX
Support RX policy/state upper protocol selector field offload, to enable selecting RX traffic for IPsec operation based on l4 protocol UDP with specific source/destination port. Signed-off-by: Emeel Hakim <ehakim@nvidia.com> Reviewed-by: Raed Salem <raeds@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 7d83352 commit c338325

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,8 @@ static int mlx5e_xfrm_validate_state(struct mlx5_core_dev *mdev,
440440
return -EINVAL;
441441
}
442442

443-
if (x->sel.proto != IPPROTO_IP &&
444-
(x->sel.proto != IPPROTO_UDP || x->xso.dir != XFRM_DEV_OFFLOAD_OUT)) {
445-
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP, and only Tx direction");
443+
if (x->sel.proto != IPPROTO_IP && x->sel.proto != IPPROTO_UDP) {
444+
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP");
446445
return -EINVAL;
447446
}
448447

@@ -983,9 +982,8 @@ static int mlx5e_xfrm_validate_policy(struct mlx5_core_dev *mdev,
983982
return -EINVAL;
984983
}
985984

986-
if (sel->proto != IPPROTO_IP &&
987-
(sel->proto != IPPROTO_UDP || x->xdo.dir != XFRM_DEV_OFFLOAD_OUT)) {
988-
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP, and only Tx direction");
985+
if (x->selector.proto != IPPROTO_IP && x->selector.proto != IPPROTO_UDP) {
986+
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP");
989987
return -EINVAL;
990988
}
991989

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ static int rx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
12431243
setup_fte_spi(spec, attrs->spi);
12441244
setup_fte_esp(spec);
12451245
setup_fte_no_frags(spec);
1246+
setup_fte_upper_proto_match(spec, &attrs->upspec);
12461247

12471248
if (rx != ipsec->rx_esw)
12481249
err = setup_modify_header(ipsec, attrs->type,
@@ -1519,6 +1520,7 @@ static int rx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
15191520
setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6);
15201521

15211522
setup_fte_no_frags(spec);
1523+
setup_fte_upper_proto_match(spec, &attrs->upspec);
15221524

15231525
switch (attrs->action) {
15241526
case XFRM_POLICY_ALLOW:

0 commit comments

Comments
 (0)