UPSTREAM: xfrm: Remove xfrmi interface ID from flowi
authorBenedict Wong <benedictwong@google.com>
Thu, 19 Jul 2018 17:50:44 +0000 (10:50 -0700)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:32:14 +0000 (17:32 +0800)
commitfd44aaa9acb630c7c3cc9158794b9b6774c87626
tree036a88366f800b3c46e0f3493ccb29b09d86667c
parent91230d41835f458ce13c9a4431faa9f95a8809ed
UPSTREAM: xfrm: Remove xfrmi interface ID from flowi

In order to remove performance impact of having the extra u32 in every
single flowi, this change removes the flowi_xfrm struct, prefering to
take the if_id as a method parameter where needed.

In the inbound direction, if_id is only needed during the
__xfrm_check_policy() function, and the if_id can be determined at that
point based on the skb. As such, xfrmi_decode_session() is only called
with the skb in __xfrm_check_policy().

In the outbound direction, the only place where if_id is needed is the
xfrm_lookup() call in xfrmi_xmit2(). With this change, the if_id is
directly passed into the xfrm_lookup_with_ifid() call. All existing
callers can still call xfrm_lookup(), which uses a Defenderault if_id of 0.

This change does not change any behavior of XFRMIs except for improving
overall system performance via flowi size reduction.

This change has been tested against the Android Kernel Networking Tests:

https://android.googlesource.com/kernel/tests/+/master/net/test

Signed-off-by: Benedict Wong <benedictwong@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit bc56b33404599edc412b91933d74b36873e8ea25)
Bug: 113046120
Change-Id: Icd3a1ea08427b91c54a64318d9dbb9acfb5d429a
include/net/flow.h
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c