Skip to content

Commit 636827e

Browse files
sneginhaPlaidCat
authored andcommitted
xfrm: Support ESN context update to hardware for TX
commit-author Jianbo Liu <jianbol@nvidia.com> commit 373b79a Previously xfrm_dev_state_advance_esn() was added for RX only. But it's possible that ESN context also need to be synced to hardware for TX, so call it for outbound in this patch. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> (cherry picked from commit 373b79a) Signed-off-by: Srinivas Neginhal <sneginhal@google.com>
1 parent b03f1fb commit 636827e

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

Documentation/networking/xfrm_device.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ the stack in xfrm_input().
136136

137137
hand the packet to napi_gro_receive() as usual
138138

139-
In ESN mode, xdo_dev_state_advance_esn() is called from xfrm_replay_advance_esn().
139+
In ESN mode, xdo_dev_state_advance_esn() is called from
140+
xfrm_replay_advance_esn() for RX, and xfrm_replay_overflow_offload_esn for TX.
140141
Driver will check packet seq number and update HW ESN state machine if needed.
141142

142143
When the SA is removed by the user, the driver's xdo_dev_state_delete()

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6572,6 +6572,9 @@ static void cxgb4_advance_esn_state(struct xfrm_state *x)
65726572
{
65736573
struct adapter *adap = netdev2adap(x->xso.dev);
65746574

6575+
if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
6576+
return;
6577+
65756578
if (!mutex_trylock(&uld_mutex)) {
65766579
dev_dbg(adap->pdev_dev,
65776580
"crypto uld critical resource is under use\n");

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ static void mlx5e_xfrm_advance_esn_state(struct xfrm_state *x)
419419
&sa_entry->modify_work;
420420
bool need_update;
421421

422+
if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
423+
return;
424+
422425
need_update = mlx5e_ipsec_update_esn_state(sa_entry);
423426
if (!need_update)
424427
return;

net/xfrm/xfrm_replay.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
729729
}
730730

731731
replay_esn->oseq = oseq;
732+
xfrm_dev_state_advance_esn(x);
732733

733734
if (xfrm_aevent_is_on(net))
734735
xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);

0 commit comments

Comments
 (0)