mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
[XFRM]: Export SAD info.
On a system with a lot of SAs, counting SAD entries chews useful CPU time since you need to dump the whole SAD to user space; i.e something like ip xfrm state ls | grep -i src | wc -l I have seen taking literally minutes on a 40K SAs when the system is swapping. With this patch, some of the SAD info (that was already being tracked) is exposed to user space. i.e you do: ip xfrm state count And you get the count; you can also pass -s to the command line and get the hash info. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
98486fa2f4
commit
28d8909bc7
4 changed files with 99 additions and 0 deletions
|
|
@ -181,6 +181,10 @@ enum {
|
|||
XFRM_MSG_MIGRATE,
|
||||
#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
|
||||
|
||||
XFRM_MSG_NEWSADINFO,
|
||||
#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
|
||||
XFRM_MSG_GETSADINFO,
|
||||
#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
|
||||
__XFRM_MSG_MAX
|
||||
};
|
||||
#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
|
||||
|
|
@ -234,6 +238,17 @@ enum xfrm_ae_ftype_t {
|
|||
#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
|
||||
};
|
||||
|
||||
/* SAD Table filter flags */
|
||||
enum xfrm_sad_ftype_t {
|
||||
XFRM_SAD_UNSPEC,
|
||||
XFRM_SAD_HMASK=1,
|
||||
XFRM_SAD_HMAX=2,
|
||||
XFRM_SAD_CNT=4,
|
||||
__XFRM_SAD_MAX
|
||||
|
||||
#define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1)
|
||||
};
|
||||
|
||||
struct xfrm_userpolicy_type {
|
||||
__u8 type;
|
||||
__u16 reserved1;
|
||||
|
|
@ -265,6 +280,16 @@ enum xfrm_attr_type_t {
|
|||
#define XFRMA_MAX (__XFRMA_MAX - 1)
|
||||
};
|
||||
|
||||
enum xfrm_sadattr_type_t {
|
||||
XFRMA_SAD_UNSPEC,
|
||||
XFRMA_SADHMASK,
|
||||
XFRMA_SADHMAX,
|
||||
XFRMA_SADCNT,
|
||||
__XFRMA_SAD_MAX
|
||||
|
||||
#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
|
||||
};
|
||||
|
||||
struct xfrm_usersa_info {
|
||||
struct xfrm_selector sel;
|
||||
struct xfrm_id id;
|
||||
|
|
|
|||
|
|
@ -416,6 +416,13 @@ struct xfrm_audit
|
|||
u32 secid;
|
||||
};
|
||||
|
||||
/* SAD metadata, add more later */
|
||||
struct xfrm_sadinfo
|
||||
{
|
||||
u32 sadhcnt; /* current hash bkts */
|
||||
u32 sadhmcnt; /* max allowed hash bkts */
|
||||
u32 sadcnt; /* current running count */
|
||||
};
|
||||
#ifdef CONFIG_AUDITSYSCALL
|
||||
extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
|
||||
struct xfrm_policy *xp, struct xfrm_state *x);
|
||||
|
|
@ -938,6 +945,7 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
|
|||
extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
|
||||
extern int xfrm_state_delete(struct xfrm_state *x);
|
||||
extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
|
||||
extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si);
|
||||
extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
|
||||
extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
|
||||
extern void xfrm_replay_notify(struct xfrm_state *x, int event);
|
||||
|
|
|
|||
Loading…
Reference in a new issue