mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Reorder struct ip_fw_chain:
* move rarely-used fields down * move uh_lock to different cacheline * remove some usused fields Sponsored by: Yandex LLC
This commit is contained in:
parent
b65c25f54a
commit
5fa3fdd3d9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261117
@ -2666,7 +2666,7 @@ vnet_ipfw_init(const void *unused)
|
|||||||
rule->set = RESVD_SET;
|
rule->set = RESVD_SET;
|
||||||
rule->cmd[0].len = 1;
|
rule->cmd[0].len = 1;
|
||||||
rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
|
rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
|
||||||
chain->rules = chain->default_rule = chain->map[0] = rule;
|
chain->default_rule = chain->map[0] = rule;
|
||||||
chain->id = rule->id = 1;
|
chain->id = rule->id = 1;
|
||||||
|
|
||||||
IPFW_LOCK_INIT(chain);
|
IPFW_LOCK_INIT(chain);
|
||||||
|
@ -213,25 +213,27 @@ VNET_DECLARE(unsigned int, fw_tables_max);
|
|||||||
#define V_fw_tables_max VNET(fw_tables_max)
|
#define V_fw_tables_max VNET(fw_tables_max)
|
||||||
|
|
||||||
struct ip_fw_chain {
|
struct ip_fw_chain {
|
||||||
struct ip_fw *rules; /* list of rules */
|
|
||||||
struct ip_fw *reap; /* list of rules to reap */
|
|
||||||
struct ip_fw *default_rule;
|
|
||||||
int n_rules; /* number of static rules */
|
|
||||||
int static_len; /* total len of static rules */
|
|
||||||
struct ip_fw **map; /* array of rule ptrs to ease lookup */
|
struct ip_fw **map; /* array of rule ptrs to ease lookup */
|
||||||
|
uint32_t id; /* ruleset id */
|
||||||
|
int n_rules; /* number of static rules */
|
||||||
LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */
|
LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */
|
||||||
struct radix_node_head **tables; /* IPv4 tables */
|
struct radix_node_head **tables; /* IPv4 tables */
|
||||||
struct radix_node_head **xtables; /* extended tables */
|
struct radix_node_head **xtables; /* extended tables */
|
||||||
uint8_t *tabletype; /* Array of table types */
|
uint8_t *tabletype; /* Array of table types */
|
||||||
#if defined( __linux__ ) || defined( _WIN32 )
|
#if defined( __linux__ ) || defined( _WIN32 )
|
||||||
spinlock_t rwmtx;
|
spinlock_t rwmtx;
|
||||||
spinlock_t uh_lock;
|
|
||||||
#else
|
#else
|
||||||
struct rwlock rwmtx;
|
struct rwlock rwmtx;
|
||||||
|
#endif
|
||||||
|
int static_len; /* total len of static rules */
|
||||||
|
uint32_t gencnt; /* NAT generation count */
|
||||||
|
struct ip_fw *reap; /* list of rules to reap */
|
||||||
|
struct ip_fw *default_rule;
|
||||||
|
#if defined( __linux__ ) || defined( _WIN32 )
|
||||||
|
spinlock_t uh_lock;
|
||||||
|
#else
|
||||||
struct rwlock uh_lock; /* lock for upper half */
|
struct rwlock uh_lock; /* lock for upper half */
|
||||||
#endif
|
#endif
|
||||||
uint32_t id; /* ruleset id */
|
|
||||||
uint32_t gencnt; /* generation count */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sockopt; /* used by tcp_var.h */
|
struct sockopt; /* used by tcp_var.h */
|
||||||
|
@ -159,7 +159,7 @@ ipfw_add_rule(struct ip_fw_chain *chain, struct ip_fw *input_rule)
|
|||||||
int i, l, insert_before;
|
int i, l, insert_before;
|
||||||
struct ip_fw **map; /* the new array of pointers */
|
struct ip_fw **map; /* the new array of pointers */
|
||||||
|
|
||||||
if (chain->rules == NULL || input_rule->rulenum > IPFW_DEFAULT_RULE-1)
|
if (chain->map == NULL || input_rule->rulenum > IPFW_DEFAULT_RULE - 1)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
l = RULESIZE(input_rule);
|
l = RULESIZE(input_rule);
|
||||||
|
Loading…
Reference in New Issue
Block a user