mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
xfrm: Skip redundant statistics update for crypto offload
In the crypto offload path, every packet is still processed by the software stack. The state's statistics required for the expiration check are being updated in software. However, the code also calls xfrm_dev_state_update_stats(), which triggers a query to the hardware device to fetch statistics. This hardware query is redundant and introduces unnecessary performance overhead. Skip this call when it's crypto offload (not packet offload) to avoid the unnecessary hardware access, thereby improving performance. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
94f39804d8
commit
95cfe23285
1 changed files with 6 additions and 1 deletions
|
@ -2282,7 +2282,12 @@ EXPORT_SYMBOL(xfrm_state_update);
|
|||
|
||||
int xfrm_state_check_expire(struct xfrm_state *x)
|
||||
{
|
||||
xfrm_dev_state_update_stats(x);
|
||||
/* All counters which are needed to decide if state is expired
|
||||
* are handled by SW for non-packet offload modes. Simply skip
|
||||
* the following update and save extra boilerplate in drivers.
|
||||
*/
|
||||
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET)
|
||||
xfrm_dev_state_update_stats(x);
|
||||
|
||||
if (!READ_ONCE(x->curlft.use_time))
|
||||
WRITE_ONCE(x->curlft.use_time, ktime_get_real_seconds());
|
||||
|
|
Loading…
Add table
Reference in a new issue