History

xfrm: configure policy hash table thresholds by netlink

Enable to specify local and remote prefix length thresholds for the policy hash table via a netlink XFRM_MSG_NEWSPDINFO message. prefix length thresholds are specified by XFRMA_SPD_IPV4_HTHRESH and XFRMA_SPD_IPV6_HTHRESH optional attributes (struct xfrmu_spdhthresh). example: struct xfrmu_spdhthresh thresh4 = { .lbits = 0; .rbits = 24; }; struct xfrmu_spdhthresh thresh6 = { .lbits = 0; .rbits = 56; }; struct nlmsghdr *hdr; struct nl_msg *msg; msg = nlmsg_alloc(); hdr = nlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, XFRMA_SPD_IPV4_HTHRESH, sizeof(__u32), NLM_F_REQUEST); nla_put(msg, XFRMA_SPD_IPV4_HTHRESH, sizeof(thresh4), &thresh4); nla_put(msg, XFRMA_SPD_IPV6_HTHRESH, sizeof(thresh6), &thresh6); nla_send_auto(sk, msg); The numbers are the policy selector minimum prefix lengths to put a policy in the hash table. - lbits is the local threshold (source address for out policies, destination address for in and fwd policies). - rbits is the remote threshold (destination address for out policies, source address for in and fwd policies). The default values are: XFRMA_SPD_IPV4_HTHRESH: 32 32 XFRMA_SPD_IPV6_HTHRESH: 128 128 Dynamic re-building of the SPD is performed when the thresholds values are changed. The current thresholds can be read via a XFRM_MSG_GETSPDINFO request: the kernel replies to XFRM_MSG_GETSPDINFO requests by an XFRM_MSG_NEWSPDINFO message, with both attributes XFRMA_SPD_IPV4_HTHRESH and XFRMA_SPD_IPV6_HTHRESH.

Christophe Gouault committed 12 years ago

Commit 880a6fa1 parent b58555f5 files · +182 −3Browse files

Showing the changes to include/uapi/linux (1 of 5 files). Show all

Unified · Split

include/uapi/linux/xfrm.h+7−0
@@ -328,6 +328,8 @@ enum xfrm_spdattr_type_t { · 327 unmodified lines
328328 XFRMA_SPD_UNSPEC,
329329 XFRMA_SPD_INFO,
330330 XFRMA_SPD_HINFO,
331+ XFRMA_SPD_IPV4_HTHRESH,
332+ XFRMA_SPD_IPV6_HTHRESH,
331333 __XFRMA_SPD_MAX
332334
333335 #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
@@ -347,6 +349,11 @@ struct xfrmu_spdhinfo { · 13 unmodified lines
347349 __u32 spdhmcnt;
348350 };
349351
352+struct xfrmu_spdhthresh {
353+ __u8 lbits;
354+ __u8 rbits;
355+};
356+
350357 struct xfrm_usersa_info {
351358 struct xfrm_selector sel;
352359 struct xfrm_id id;