Skip to content

Commit 373b79a

Browse files
Jianbo Liuklassert
authored andcommitted
xfrm: Support ESN context update to hardware for TX
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 <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 59af653 commit 373b79a

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
@@ -169,7 +169,8 @@ the stack in xfrm_input().
169169

170170
hand the packet to napi_gro_receive() as usual
171171

172-
In ESN mode, xdo_dev_state_advance_esn() is called from xfrm_replay_advance_esn().
172+
In ESN mode, xdo_dev_state_advance_esn() is called from
173+
xfrm_replay_advance_esn() for RX, and xfrm_replay_overflow_offload_esn for TX.
173174
Driver will check packet seq number and update HW ESN state machine if needed.
174175

175176
Packet offload mode:

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

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

6562+
if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
6563+
return;
6564+
65626565
if (!mutex_trylock(&uld_mutex)) {
65636566
dev_dbg(adap->pdev_dev,
65646567
"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
@@ -980,6 +980,9 @@ static void mlx5e_xfrm_advance_esn_state(struct xfrm_state *x)
980980
struct mlx5e_ipsec_sa_entry *sa_entry_shadow;
981981
bool need_update;
982982

983+
if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
984+
return;
985+
983986
need_update = mlx5e_ipsec_update_esn_state(sa_entry);
984987
if (!need_update)
985988
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)