@@ -1982,28 +1982,28 @@ static int bnxt_tc_setup_indr_cb(struct net_device *netdev, struct Qdisc *sch, v
static const struct rhashtable_params bnxt_tc_flow_ht_params = {
.head_offset = offsetof(struct bnxt_tc_flow_node, node),
.key_offset = offsetof(struct bnxt_tc_flow_node, cookie),
- .key_len = sizeof(((struct bnxt_tc_flow_node *)0)->cookie),
+ .key_len = sizeof_field(struct bnxt_tc_flow_node, cookie),
.automatic_shrinking = true
};
static const struct rhashtable_params bnxt_tc_l2_ht_params = {
.head_offset = offsetof(struct bnxt_tc_l2_node, node),
.key_offset = offsetof(struct bnxt_tc_l2_node, key),
- .key_len = BNXT_TC_L2_KEY_LEN,
+ .key_len = offsetofend(struct bnxt_tc_l2_key, inner_vlan_tci),
.automatic_shrinking = true
};
static const struct rhashtable_params bnxt_tc_decap_l2_ht_params = {
.head_offset = offsetof(struct bnxt_tc_l2_node, node),
.key_offset = offsetof(struct bnxt_tc_l2_node, key),
- .key_len = BNXT_TC_L2_KEY_LEN,
+ .key_len = offsetofend(struct bnxt_tc_l2_key, inner_vlan_tci),
.automatic_shrinking = true
};
static const struct rhashtable_params bnxt_tc_tunnel_ht_params = {
.head_offset = offsetof(struct bnxt_tc_tunnel_node, node),
.key_offset = offsetof(struct bnxt_tc_tunnel_node, key),
- .key_len = sizeof(struct ip_tunnel_key),
+ .key_len = sizeof_field(struct bnxt_tc_tunnel_node, key),
.automatic_shrinking = true
};
@@ -173,7 +173,6 @@ struct bnxt_tc_tunnel_node {
*/
struct bnxt_tc_l2_node {
/* hash key: first 16b of key */
-#define BNXT_TC_L2_KEY_LEN 16
struct bnxt_tc_l2_key key;
struct rhash_head node;
@@ -1103,7 +1103,7 @@ static const struct rhashtable_params cxgb4_tc_flower_ht_params = {
.nelem_hint = 384,
.head_offset = offsetof(struct ch_tc_flower_entry, node),
.key_offset = offsetof(struct ch_tc_flower_entry, tc_flower_cookie),
- .key_len = sizeof(((struct ch_tc_flower_entry *)0)->tc_flower_cookie),
+ .key_len = sizeof_field(struct ch_tc_flower_entry, tc_flower_cookie),
.max_size = 524288,
.min_size = 512,
.automatic_shrinking = true
@@ -13,7 +13,7 @@
static const struct rhashtable_params ice_fdb_ht_params = {
.key_offset = offsetof(struct ice_esw_br_fdb_entry, data),
- .key_len = sizeof(struct ice_esw_br_fdb_data),
+ .key_len = sizeof_field(struct ice_esw_br_fdb_entry, data),
.head_offset = offsetof(struct ice_esw_br_fdb_entry, ht_node),
.automatic_shrinking = true,
};
@@ -79,14 +79,14 @@ struct prestera_acl_vtcam {
};
static const struct rhashtable_params prestera_acl_ruleset_ht_params = {
- .key_len = sizeof(struct prestera_acl_ruleset_ht_key),
+ .key_len = sizeof_field(struct prestera_acl_ruleset, ht_key),
.key_offset = offsetof(struct prestera_acl_ruleset, ht_key),
.head_offset = offsetof(struct prestera_acl_ruleset, ht_node),
.automatic_shrinking = true,
};
static const struct rhashtable_params prestera_acl_rule_ht_params = {
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct prestera_acl_rule, cookie),
.key_offset = offsetof(struct prestera_acl_rule, cookie),
.head_offset = offsetof(struct prestera_acl_rule, ht_node),
.automatic_shrinking = true,
@@ -95,7 +95,7 @@ static const struct rhashtable_params prestera_acl_rule_ht_params = {
static const struct rhashtable_params __prestera_acl_rule_entry_ht_params = {
.key_offset = offsetof(struct prestera_acl_rule_entry, key),
.head_offset = offsetof(struct prestera_acl_rule_entry, ht_node),
- .key_len = sizeof(struct prestera_acl_rule_entry_key),
+ .key_len = sizeof_field(struct prestera_acl_rule_entry, key),
.automatic_shrinking = true,
};
@@ -67,14 +67,14 @@ struct prestera_kern_fib_cache {
static const struct rhashtable_params __prestera_kern_neigh_cache_ht_params = {
.key_offset = offsetof(struct prestera_kern_neigh_cache, key),
.head_offset = offsetof(struct prestera_kern_neigh_cache, ht_node),
- .key_len = sizeof(struct prestera_kern_neigh_cache_key),
+ .key_len = sizeof_field(struct prestera_kern_neigh_cache, key),
.automatic_shrinking = true,
};
static const struct rhashtable_params __prestera_kern_fib_cache_ht_params = {
.key_offset = offsetof(struct prestera_kern_fib_cache, key),
.head_offset = offsetof(struct prestera_kern_fib_cache, ht_node),
- .key_len = sizeof(struct prestera_kern_fib_cache_key),
+ .key_len = sizeof_field(struct prestera_kern_fib_cache, key),
.automatic_shrinking = true,
};
@@ -35,19 +35,19 @@
static const struct rhashtable_params __prestera_fib_ht_params = {
.key_offset = offsetof(struct prestera_fib_node, key),
.head_offset = offsetof(struct prestera_fib_node, ht_node),
- .key_len = sizeof(struct prestera_fib_key),
+ .key_len = sizeof_field(struct prestera_fib_node, key),
.automatic_shrinking = true,
};
static const struct rhashtable_params __prestera_nh_neigh_ht_params = {
.key_offset = offsetof(struct prestera_nh_neigh, key),
- .key_len = sizeof(struct prestera_nh_neigh_key),
+ .key_len = sizeof_field(struct prestera_nh_neigh, key),
.head_offset = offsetof(struct prestera_nh_neigh, ht_node),
};
static const struct rhashtable_params __prestera_nexthop_group_ht_params = {
.key_offset = offsetof(struct prestera_nexthop_group, key),
- .key_len = sizeof(struct prestera_nexthop_group_key),
+ .key_len = sizeof_field(struct prestera_nexthop_group, key),
.head_offset = offsetof(struct prestera_nexthop_group, ht_node),
};
@@ -47,7 +47,7 @@ struct mtk_flow_data {
static const struct rhashtable_params mtk_flow_ht_params = {
.head_offset = offsetof(struct mtk_flow_entry, node),
.key_offset = offsetof(struct mtk_flow_entry, cookie),
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct mtk_flow_entry, cookie),
.automatic_shrinking = true,
};
@@ -269,7 +269,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
static const struct rhashtable_params mlx5e_neigh_ht_params = {
.head_offset = offsetof(struct mlx5e_neigh_hash_entry, rhash_node),
.key_offset = offsetof(struct mlx5e_neigh_hash_entry, m_neigh),
- .key_len = sizeof(struct mlx5e_neigh),
+ .key_len = sizeof_field(struct mlx5e_neigh_hash_entry, m_neigh),
.automatic_shrinking = true,
};
@@ -173,7 +173,7 @@ mlx5_tc_ct_entry_destroy_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
static const struct rhashtable_params cts_ht_params = {
.head_offset = offsetof(struct mlx5_ct_entry, node),
.key_offset = offsetof(struct mlx5_ct_entry, cookie),
- .key_len = sizeof(((struct mlx5_ct_entry *)0)->cookie),
+ .key_len = sizeof_field(struct mlx5_ct_entry, cookie),
.automatic_shrinking = true,
.min_size = 16 * 1024,
};
@@ -181,14 +181,14 @@ static const struct rhashtable_params cts_ht_params = {
static const struct rhashtable_params zone_params = {
.head_offset = offsetof(struct mlx5_ct_ft, node),
.key_offset = offsetof(struct mlx5_ct_ft, zone),
- .key_len = sizeof(((struct mlx5_ct_ft *)0)->zone),
+ .key_len = sizeof_field(struct mlx5_ct_ft, zone),
.automatic_shrinking = true,
};
static const struct rhashtable_params tuples_ht_params = {
.head_offset = offsetof(struct mlx5_ct_entry, tuple_node),
.key_offset = offsetof(struct mlx5_ct_entry, tuple),
- .key_len = sizeof(((struct mlx5_ct_entry *)0)->tuple),
+ .key_len = sizeof_field(struct mlx5_ct_entry, tuple),
.automatic_shrinking = true,
.min_size = 16 * 1024,
};
@@ -196,7 +196,7 @@ static const struct rhashtable_params tuples_ht_params = {
static const struct rhashtable_params tuples_nat_ht_params = {
.head_offset = offsetof(struct mlx5_ct_entry, tuple_nat_node),
.key_offset = offsetof(struct mlx5_ct_entry, tuple_nat),
- .key_len = sizeof(((struct mlx5_ct_entry *)0)->tuple_nat),
+ .key_len = sizeof_field(struct mlx5_ct_entry, tuple_nat),
.automatic_shrinking = true,
.min_size = 16 * 1024,
};
@@ -4339,7 +4339,7 @@ static void get_flags(int flags, unsigned long *flow_flags)
static const struct rhashtable_params tc_ht_params = {
.head_offset = offsetof(struct mlx5e_tc_flow, node),
.key_offset = offsetof(struct mlx5e_tc_flow, cookie),
- .key_len = sizeof(((struct mlx5e_tc_flow *)0)->cookie),
+ .key_len = sizeof_field(struct mlx5e_tc_flow, cookie),
.automatic_shrinking = true,
};
@@ -15,7 +15,7 @@
static const struct rhashtable_params fdb_ht_params = {
.key_offset = offsetof(struct mlx5_esw_bridge_fdb_entry, key),
- .key_len = sizeof(struct mlx5_esw_bridge_fdb_key),
+ .key_len = sizeof_field(struct mlx5_esw_bridge_fdb_entry, key),
.head_offset = offsetof(struct mlx5_esw_bridge_fdb_entry, ht_node),
.automatic_shrinking = true,
};
@@ -9,7 +9,7 @@
static const struct rhashtable_params mdb_ht_params = {
.key_offset = offsetof(struct mlx5_esw_bridge_mdb_entry, key),
- .key_len = sizeof(struct mlx5_esw_bridge_mdb_key),
+ .key_len = sizeof_field(struct mlx5_esw_bridge_mdb_entry, key),
.head_offset = offsetof(struct mlx5_esw_bridge_mdb_entry, ht_node),
.automatic_shrinking = true,
};
@@ -106,7 +106,7 @@ struct mlxsw_afa_set {
};
static const struct rhashtable_params mlxsw_afa_set_ht_params = {
- .key_len = sizeof(struct mlxsw_afa_set_ht_key),
+ .key_len = sizeof_field(struct mlxsw_afa_set, ht_key),
.key_offset = offsetof(struct mlxsw_afa_set, ht_key),
.head_offset = offsetof(struct mlxsw_afa_set, ht_node),
.automatic_shrinking = true,
@@ -124,7 +124,7 @@ struct mlxsw_afa_fwd_entry {
};
static const struct rhashtable_params mlxsw_afa_fwd_entry_ht_params = {
- .key_len = sizeof(struct mlxsw_afa_fwd_entry_ht_key),
+ .key_len = sizeof_field(struct mlxsw_afa_fwd_entry, ht_key),
.key_offset = offsetof(struct mlxsw_afa_fwd_entry, ht_key),
.head_offset = offsetof(struct mlxsw_afa_fwd_entry, ht_node),
.automatic_shrinking = true,
@@ -188,7 +188,7 @@ struct mlxsw_afa_policer {
};
static const struct rhashtable_params mlxsw_afa_policer_ht_params = {
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct mlxsw_afa_policer, fa_index),
.key_offset = offsetof(struct mlxsw_afa_policer, fa_index),
.head_offset = offsetof(struct mlxsw_afa_policer, ht_node),
.automatic_shrinking = true,
@@ -2844,7 +2844,7 @@ struct mlxsw_sp_sample_trigger_node {
static const struct rhashtable_params mlxsw_sp_sample_trigger_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_sample_trigger_node, trigger),
.head_offset = offsetof(struct mlxsw_sp_sample_trigger_node, ht_node),
- .key_len = sizeof(struct mlxsw_sp_sample_trigger),
+ .key_len = sizeof_field(struct mlxsw_sp_sample_trigger_node, trigger),
.automatic_shrinking = true,
};
@@ -3005,7 +3005,7 @@ struct mlxsw_sp_ipv6_addr_node {
static const struct rhashtable_params mlxsw_sp_ipv6_addr_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_ipv6_addr_node, key),
.head_offset = offsetof(struct mlxsw_sp_ipv6_addr_node, ht_node),
- .key_len = sizeof(struct in6_addr),
+ .key_len = sizeof_field(struct mlxsw_sp_ipv6_addr_node, key),
.automatic_shrinking = true,
};
@@ -78,14 +78,14 @@ struct mlxsw_sp_acl_rule {
};
static const struct rhashtable_params mlxsw_sp_acl_ruleset_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_acl_ruleset_ht_key),
+ .key_len = sizeof_field(struct mlxsw_sp_acl_ruleset, ht_key),
.key_offset = offsetof(struct mlxsw_sp_acl_ruleset, ht_key),
.head_offset = offsetof(struct mlxsw_sp_acl_ruleset, ht_node),
.automatic_shrinking = true,
};
static const struct rhashtable_params mlxsw_sp_acl_rule_ht_params = {
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct mlxsw_sp_acl_rule, cookie),
.key_offset = offsetof(struct mlxsw_sp_acl_rule, cookie),
.head_offset = offsetof(struct mlxsw_sp_acl_rule, ht_node),
.automatic_shrinking = true,
@@ -52,13 +52,13 @@ struct mlxsw_sp_acl_atcam_region_12kb {
};
static const struct rhashtable_params mlxsw_sp_acl_atcam_lkey_id_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_acl_atcam_lkey_id_ht_key),
+ .key_len = sizeof_field(struct mlxsw_sp_acl_atcam_lkey_id, ht_key),
.key_offset = offsetof(struct mlxsw_sp_acl_atcam_lkey_id, ht_key),
.head_offset = offsetof(struct mlxsw_sp_acl_atcam_lkey_id, ht_node),
};
static const struct rhashtable_params mlxsw_sp_acl_atcam_entries_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_acl_atcam_entry_ht_key),
+ .key_len = sizeof_field(struct mlxsw_sp_acl_atcam_entry, ht_key),
.key_offset = offsetof(struct mlxsw_sp_acl_atcam_entry, ht_key),
.head_offset = offsetof(struct mlxsw_sp_acl_atcam_entry, ht_node),
};
@@ -198,7 +198,7 @@ struct mlxsw_sp_acl_tcam_ventry {
};
static const struct rhashtable_params mlxsw_sp_acl_tcam_vchunk_ht_params = {
- .key_len = sizeof(unsigned int),
+ .key_len = sizeof_field(struct mlxsw_sp_acl_tcam_vchunk, priority),
.key_offset = offsetof(struct mlxsw_sp_acl_tcam_vchunk, priority),
.head_offset = offsetof(struct mlxsw_sp_acl_tcam_vchunk, ht_node),
.automatic_shrinking = true,
@@ -91,7 +91,7 @@ struct mlxsw_sp_mr_route {
};
static const struct rhashtable_params mlxsw_sp_mr_route_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_mr_route_key),
+ .key_len = sizeof_field(struct mlxsw_sp_mr_route, key),
.key_offset = offsetof(struct mlxsw_sp_mr_route, key),
.head_offset = offsetof(struct mlxsw_sp_mr_route, ht_node),
.automatic_shrinking = true,
@@ -77,7 +77,7 @@ struct mlxsw_sp_nve_mc_list {
};
static const struct rhashtable_params mlxsw_sp_nve_mc_list_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_nve_mc_list_key),
+ .key_len = sizeof_field(struct mlxsw_sp_nve_mc_list, key),
.key_offset = offsetof(struct mlxsw_sp_nve_mc_list, key),
.head_offset = offsetof(struct mlxsw_sp_nve_mc_list, ht_node),
};
@@ -810,7 +810,7 @@ struct mlxsw_sp_nve_ipv6_ht_node {
};
static const struct rhashtable_params mlxsw_sp_nve_ipv6_ht_params = {
- .key_len = sizeof(struct mlxsw_sp_nve_ipv6_ht_key),
+ .key_len = sizeof_field(struct mlxsw_sp_nve_ipv6_ht_node, key),
.key_offset = offsetof(struct mlxsw_sp_nve_ipv6_ht_node, key),
.head_offset = offsetof(struct mlxsw_sp_nve_ipv6_ht_node, ht_node),
};
@@ -2196,7 +2196,7 @@ struct mlxsw_sp_neigh_entry {
static const struct rhashtable_params mlxsw_sp_neigh_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_neigh_entry, key),
.head_offset = offsetof(struct mlxsw_sp_neigh_entry, ht_node),
- .key_len = sizeof(struct mlxsw_sp_neigh_key),
+ .key_len = sizeof_field(struct mlxsw_sp_neigh_entry, key),
};
struct mlxsw_sp_neigh_entry *
@@ -3375,7 +3375,7 @@ bool mlxsw_sp_nexthop_group_has_ipip(struct mlxsw_sp_nexthop *nh)
static const struct rhashtable_params mlxsw_sp_nexthop_group_vr_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_nexthop_group_vr_entry, key),
.head_offset = offsetof(struct mlxsw_sp_nexthop_group_vr_entry, ht_node),
- .key_len = sizeof(struct mlxsw_sp_nexthop_group_vr_key),
+ .key_len = sizeof_field(struct mlxsw_sp_nexthop_group_vr_entry, key),
.automatic_shrinking = true,
};
@@ -3662,7 +3662,7 @@ mlxsw_sp_nexthop6_group_lookup(struct mlxsw_sp *mlxsw_sp,
static const struct rhashtable_params mlxsw_sp_nexthop_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_nexthop, key),
.head_offset = offsetof(struct mlxsw_sp_nexthop, ht_node),
- .key_len = sizeof(struct mlxsw_sp_nexthop_key),
+ .key_len = sizeof_field(struct mlxsw_sp_nexthop, key),
};
static int mlxsw_sp_nexthop_insert(struct mlxsw_sp *mlxsw_sp,
@@ -6561,7 +6561,7 @@ mlxsw_sp_fib4_entry_lookup(struct mlxsw_sp *mlxsw_sp,
static const struct rhashtable_params mlxsw_sp_fib_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_fib_node, key),
.head_offset = offsetof(struct mlxsw_sp_fib_node, ht_node),
- .key_len = sizeof(struct mlxsw_sp_fib_key),
+ .key_len = sizeof_field(struct mlxsw_sp_fib_node, key),
.automatic_shrinking = true,
};
@@ -127,7 +127,7 @@ struct mlxsw_sp_mdb_entry_port {
static const struct rhashtable_params mlxsw_sp_mdb_ht_params = {
.key_offset = offsetof(struct mlxsw_sp_mdb_entry, key),
.head_offset = offsetof(struct mlxsw_sp_mdb_entry, ht_node),
- .key_len = sizeof(struct mlxsw_sp_mdb_entry_key),
+ .key_len = sizeof_field(struct mlxsw_sp_mdb_entry, key),
};
static int
@@ -15,7 +15,8 @@
const struct rhashtable_params nfp_bpf_maps_neutral_params = {
.nelem_hint = 4,
- .key_len = sizeof_field(struct bpf_map, id),
+ .key_len = sizeof_field(struct nfp_bpf_neutral_map,
+ map_id),
.key_offset = offsetof(struct nfp_bpf_neutral_map, map_id),
.head_offset = offsetof(struct nfp_bpf_neutral_map, l),
.automatic_shrinking = true,
@@ -10,7 +10,8 @@
const struct rhashtable_params nfp_tc_ct_merge_params = {
.head_offset = offsetof(struct nfp_fl_ct_tc_merge,
hash_node),
- .key_len = sizeof(unsigned long) * 2,
+ .key_len = sizeof_field(struct nfp_fl_ct_tc_merge,
+ cookie),
.key_offset = offsetof(struct nfp_fl_ct_tc_merge, cookie),
.automatic_shrinking = true,
};
@@ -18,7 +19,8 @@ const struct rhashtable_params nfp_tc_ct_merge_params = {
const struct rhashtable_params nfp_nft_ct_merge_params = {
.head_offset = offsetof(struct nfp_fl_nft_tc_merge,
hash_node),
- .key_len = sizeof(unsigned long) * 3,
+ .key_len = sizeof_field(struct nfp_fl_nft_tc_merge,
+ cookie),
.key_offset = offsetof(struct nfp_fl_nft_tc_merge, cookie),
.automatic_shrinking = true,
};
@@ -34,7 +34,8 @@ struct nfp_fl_stats_ctx_to_flow {
static const struct rhashtable_params stats_ctx_table_params = {
.key_offset = offsetof(struct nfp_fl_stats_ctx_to_flow, stats_cxt),
.head_offset = offsetof(struct nfp_fl_stats_ctx_to_flow, ht_node),
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct nfp_fl_stats_ctx_to_flow,
+ stats_cxt),
};
static int nfp_release_stats_entry(struct nfp_app *app, u32 stats_context_id)
@@ -485,19 +486,21 @@ const struct rhashtable_params nfp_flower_table_params = {
const struct rhashtable_params merge_table_params = {
.key_offset = offsetof(struct nfp_merge_info, parent_ctx),
.head_offset = offsetof(struct nfp_merge_info, ht_node),
- .key_len = sizeof(u64),
+ .key_len = sizeof_field(struct nfp_merge_info, parent_ctx),
};
const struct rhashtable_params nfp_zone_table_params = {
.head_offset = offsetof(struct nfp_fl_ct_zone_entry, hash_node),
- .key_len = sizeof(u16),
+ .key_len = sizeof_field(struct nfp_fl_ct_zone_entry,
+ zone),
.key_offset = offsetof(struct nfp_fl_ct_zone_entry, zone),
.automatic_shrinking = false,
};
const struct rhashtable_params nfp_ct_map_params = {
.head_offset = offsetof(struct nfp_fl_ct_map_entry, hash_node),
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct nfp_fl_ct_map_entry,
+ cookie),
.key_offset = offsetof(struct nfp_fl_ct_map_entry, cookie),
.automatic_shrinking = true,
};
@@ -505,7 +508,7 @@ const struct rhashtable_params nfp_ct_map_params = {
const struct rhashtable_params neigh_table_params = {
.key_offset = offsetof(struct nfp_neigh_entry, neigh_cookie),
.head_offset = offsetof(struct nfp_neigh_entry, ht_node),
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct nfp_neigh_entry, neigh_cookie),
};
int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count,
@@ -555,7 +555,7 @@ int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev,
static const struct rhashtable_params stats_meter_table_params = {
.key_offset = offsetof(struct nfp_meter_entry, meter_id),
.head_offset = offsetof(struct nfp_meter_entry, ht_node),
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct nfp_meter_entry, meter_id),
};
struct nfp_meter_entry *
@@ -201,7 +201,7 @@ struct nfp_tun_offloaded_mac {
static const struct rhashtable_params offloaded_macs_params = {
.key_offset = offsetof(struct nfp_tun_offloaded_mac, addr),
.head_offset = offsetof(struct nfp_tun_offloaded_mac, ht_node),
- .key_len = ETH_ALEN,
+ .key_len = sizeof_field(struct nfp_tun_offloaded_mac, addr),
.automatic_shrinking = true,
};
@@ -1053,7 +1053,7 @@ static bool efx_mae_asl_id(u32 id)
/* mport handling */
static const struct rhashtable_params efx_mae_mports_ht_params = {
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct mae_mport_desc, mport_id),
.key_offset = offsetof(struct mae_mport_desc, mport_id),
.head_offset = offsetof(struct mae_mport_desc, linkage),
};
@@ -90,31 +90,31 @@ s64 efx_tc_flower_external_mport(struct efx_nic *efx, struct efx_rep *efv)
}
static const struct rhashtable_params efx_tc_mac_ht_params = {
- .key_len = offsetofend(struct efx_tc_mac_pedit_action, h_addr),
- .key_offset = 0,
+ .key_len = sizeof_field(struct efx_tc_mac_pedit_action, h_addr),
+ .key_offset = offsetof(struct efx_tc_mac_pedit_action, h_addr),
.head_offset = offsetof(struct efx_tc_mac_pedit_action, linkage),
};
static const struct rhashtable_params efx_tc_encap_match_ht_params = {
- .key_len = offsetof(struct efx_tc_encap_match, linkage),
+ .key_len = offsetofend(struct efx_tc_encap_match, ip_tos_mask),
.key_offset = 0,
.head_offset = offsetof(struct efx_tc_encap_match, linkage),
};
static const struct rhashtable_params efx_tc_match_action_ht_params = {
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct efx_tc_flow_rule, cookie),
.key_offset = offsetof(struct efx_tc_flow_rule, cookie),
.head_offset = offsetof(struct efx_tc_flow_rule, linkage),
};
static const struct rhashtable_params efx_tc_lhs_rule_ht_params = {
- .key_len = sizeof(unsigned long),
+ .key_len = sizeof_field(struct efx_tc_lhs_rule, cookie),
.key_offset = offsetof(struct efx_tc_lhs_rule, cookie),
.head_offset = offsetof(struct efx_tc_lhs_rule, linkage),
};
static const struct rhashtable_params efx_tc_recirc_ht_params = {
- .key_len = offsetof(struct efx_tc_recirc_id, linkage),
+ .key_len = offsetofend(struct efx_tc_recirc_id, net_dev),
.key_offset = 0,
.head_offset = offsetof(struct efx_tc_recirc_id, linkage),
};
@@ -16,14 +16,14 @@ static int efx_tc_flow_block(enum tc_setup_type type, void *type_data,
void *cb_priv);
static const struct rhashtable_params efx_tc_ct_zone_ht_params = {
- .key_len = offsetof(struct efx_tc_ct_zone, linkage),
- .key_offset = 0,
+ .key_len = sizeof_field(struct efx_tc_ct_zone, zone),
+ .key_offset = offsetof(struct efx_tc_ct_zone, zone),
.head_offset = offsetof(struct efx_tc_ct_zone, linkage),
};
static const struct rhashtable_params efx_tc_ct_ht_params = {
- .key_len = offsetof(struct efx_tc_ct_entry, linkage),
- .key_offset = 0,
+ .key_len = sizeof_field(struct efx_tc_ct_entry, cookie),
+ .key_offset = offsetof(struct efx_tc_ct_entry, cookie),
.head_offset = offsetof(struct efx_tc_ct_entry, linkage),
};
@@ -17,14 +17,14 @@
/* Counter-management hashtables */
static const struct rhashtable_params efx_tc_counter_id_ht_params = {
- .key_len = offsetof(struct efx_tc_counter_index, linkage),
- .key_offset = 0,
+ .key_len = sizeof_field(struct efx_tc_counter_index, cookie),
+ .key_offset = offsetof(struct efx_tc_counter_index, cookie),
.head_offset = offsetof(struct efx_tc_counter_index, linkage),
};
static const struct rhashtable_params efx_tc_counter_ht_params = {
- .key_len = offsetof(struct efx_tc_counter, linkage),
- .key_offset = 0,
+ .key_len = sizeof_field(struct efx_tc_counter, fw_id),
+ .key_offset = offsetof(struct efx_tc_counter, fw_id),
.head_offset = offsetof(struct efx_tc_counter, linkage),
};
@@ -17,7 +17,7 @@
#include <net/arp.h>
static const struct rhashtable_params efx_neigh_ht_params = {
- .key_len = offsetof(struct efx_neigh_binder, ha),
+ .key_len = offsetofend(struct efx_neigh_binder, dst_ip6),
.key_offset = 0,
.head_offset = offsetof(struct efx_neigh_binder, linkage),
};
@@ -115,7 +115,7 @@ struct nsim_fib_event {
static const struct rhashtable_params nsim_fib_rt_ht_params = {
.key_offset = offsetof(struct nsim_fib_rt, key),
.head_offset = offsetof(struct nsim_fib_rt, ht_node),
- .key_len = sizeof(struct nsim_fib_rt_key),
+ .key_len = sizeof_field(struct nsim_fib_rt, key),
.automatic_shrinking = true,
};
@@ -129,7 +129,7 @@ struct nsim_nexthop {
static const struct rhashtable_params nsim_nexthop_ht_params = {
.key_offset = offsetof(struct nsim_nexthop, id),
.head_offset = offsetof(struct nsim_nexthop, ht_node),
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct nsim_nexthop, id),
.automatic_shrinking = true,
};
@@ -85,7 +85,7 @@ struct vxlan_mdb_flush_desc {
static const struct rhashtable_params vxlan_mdb_rht_params = {
.head_offset = offsetof(struct vxlan_mdb_entry, rhnode),
.key_offset = offsetof(struct vxlan_mdb_entry, key),
- .key_len = sizeof(struct vxlan_mdb_entry_key),
+ .key_len = sizeof_field(struct vxlan_mdb_entry, key),
.automatic_shrinking = true,
};
@@ -29,7 +29,7 @@ static inline int vxlan_vni_cmp(struct rhashtable_compare_arg *arg,
const struct rhashtable_params vxlan_vni_rht_params = {
.head_offset = offsetof(struct vxlan_vni_node, vnode),
.key_offset = offsetof(struct vxlan_vni_node, vni),
- .key_len = sizeof(__be32),
+ .key_len = sizeof_field(struct vxlan_vni_node, vni),
.nelem_hint = 3,
.max_size = VXLAN_N_VID,
.obj_cmpfn = vxlan_vni_cmp,
@@ -757,7 +757,7 @@ struct mac80211_hwsim_data {
static const struct rhashtable_params hwsim_rht_params = {
.nelem_hint = 2,
.automatic_shrinking = true,
- .key_len = ETH_ALEN,
+ .key_len = sizeof_field(struct mac80211_hwsim_data, addresses[1]),
.key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),
.head_offset = offsetof(struct mac80211_hwsim_data, rht),
};
@@ -39,14 +39,14 @@
static const struct rhashtable_params br_mdb_rht_params = {
.head_offset = offsetof(struct net_bridge_mdb_entry, rhnode),
.key_offset = offsetof(struct net_bridge_mdb_entry, addr),
- .key_len = sizeof(struct br_ip),
+ .key_len = sizeof_field(struct net_bridge_mdb_entry, addr),
.automatic_shrinking = true,
};
static const struct rhashtable_params br_sg_port_rht_params = {
.head_offset = offsetof(struct net_bridge_port_group, rhnode),
.key_offset = offsetof(struct net_bridge_port_group, key),
- .key_len = sizeof(struct net_bridge_port_group_sg_key),
+ .key_len = sizeof_field(struct net_bridge_port_group, key),
.automatic_shrinking = true,
};
@@ -22,7 +22,7 @@ static inline int br_vlan_cmp(struct rhashtable_compare_arg *arg,
static const struct rhashtable_params br_vlan_rht_params = {
.head_offset = offsetof(struct net_bridge_vlan, vnode),
.key_offset = offsetof(struct net_bridge_vlan, vid),
- .key_len = sizeof(u16),
+ .key_len = sizeof_field(struct net_bridge_vlan, vid),
.nelem_hint = 3,
.max_size = VLAN_N_VID,
.obj_cmpfn = br_vlan_cmp,
@@ -737,8 +737,8 @@ static int ip4_obj_cmpfn(struct rhashtable_compare_arg *arg, const void *ptr)
static const struct rhashtable_params ip4_rhash_params = {
.head_offset = offsetof(struct inet_frag_queue, node),
- .key_offset = offsetof(struct inet_frag_queue, key),
- .key_len = sizeof(struct frag_v4_compare_key),
+ .key_offset = offsetof(struct inet_frag_queue, key.v4),
+ .key_len = sizeof_field(struct inet_frag_queue, key.v4),
.hashfn = ip4_key_hashfn,
.obj_hashfn = ip4_obj_hashfn,
.obj_cmpfn = ip4_obj_cmpfn,
@@ -393,7 +393,7 @@ static inline int ipmr_hash_cmp(struct rhashtable_compare_arg *arg,
static const struct rhashtable_params ipmr_rht_params = {
.head_offset = offsetof(struct mr_mfc, mnode),
.key_offset = offsetof(struct mfc_cache, cmparg),
- .key_len = sizeof(struct mfc_cache_cmp_arg),
+ .key_len = sizeof_field(struct mfc_cache, cmparg),
.nelem_hint = 3,
.obj_cmpfn = ipmr_hash_cmp,
.automatic_shrinking = true,
@@ -85,7 +85,7 @@ static const struct rhashtable_params rht_params = {
.nelem_hint = 1024,
.head_offset = offsetof(struct ila_map, node),
.key_offset = offsetof(struct ila_map, xp.ip.locator_match),
- .key_len = sizeof(u64), /* identifier */
+ .key_len = sizeof_field(struct ila_map, xp.ip.locator_match),
.max_size = 1048576,
.min_size = 256,
.automatic_shrinking = true,
@@ -61,7 +61,7 @@ static int ioam6_sc_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
}
static const struct rhashtable_params rht_ns_params = {
- .key_len = sizeof(__be16),
+ .key_len = sizeof_field(struct ioam6_namespace, id),
.key_offset = offsetof(struct ioam6_namespace, id),
.head_offset = offsetof(struct ioam6_namespace, head),
.automatic_shrinking = true,
@@ -69,7 +69,7 @@ static const struct rhashtable_params rht_ns_params = {
};
static const struct rhashtable_params rht_sc_params = {
- .key_len = sizeof(u32),
+ .key_len = sizeof_field(struct ioam6_schema, id),
.key_offset = offsetof(struct ioam6_schema, id),
.head_offset = offsetof(struct ioam6_schema, head),
.automatic_shrinking = true,
@@ -376,7 +376,7 @@ static int ip6mr_hash_cmp(struct rhashtable_compare_arg *arg,
static const struct rhashtable_params ip6mr_rht_params = {
.head_offset = offsetof(struct mr_mfc, mnode),
.key_offset = offsetof(struct mfc6_cache, cmparg),
- .key_len = sizeof(struct mfc6_cache_cmp_arg),
+ .key_len = sizeof_field(struct mfc6_cache, cmparg),
.nelem_hint = 3,
.obj_cmpfn = ip6mr_hash_cmp,
.automatic_shrinking = true,
@@ -28,7 +28,7 @@ static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
static const struct rhashtable_params mesh_rht_params = {
.nelem_hint = 2,
.automatic_shrinking = true,
- .key_len = ETH_ALEN,
+ .key_len = sizeof_field(struct mesh_path, dst),
.key_offset = offsetof(struct mesh_path, dst),
.head_offset = offsetof(struct mesh_path, rhash),
.hashfn = mesh_table_hash,
@@ -43,7 +43,7 @@ static struct rhashtable bind_hash_table;
static const struct rhashtable_params ht_parms = {
.nelem_hint = 768,
- .key_len = RDS_BOUND_KEY_LEN,
+ .key_len = sizeof_field(struct rds_sock, rs_bound_key),
.key_offset = offsetof(struct rds_sock, rs_bound_key),
.head_offset = offsetof(struct rds_sock, rs_bound_node),
.max_size = 16384,
@@ -147,7 +147,7 @@ struct cls_fl_filter {
static const struct rhashtable_params mask_ht_params = {
.key_offset = offsetof(struct fl_flow_mask, key),
- .key_len = sizeof(struct fl_flow_key),
+ .key_len = sizeof_field(struct fl_flow_mask, key),
.head_offset = offsetof(struct fl_flow_mask, ht_node),
.automatic_shrinking = true,
};
@@ -3041,7 +3041,7 @@ static const struct rhashtable_params tsk_rht_params = {
.nelem_hint = 192,
.head_offset = offsetof(struct tipc_sock, node),
.key_offset = offsetof(struct tipc_sock, portid),
- .key_len = sizeof(u32), /* portid */
+ .key_len = sizeof_field(struct tipc_sock, portid),
.max_size = 1048576,
.min_size = 256,
.automatic_shrinking = true,