Skip to content

Commit

Permalink
sfc: include vport_id in filter spec hash and equal()
Browse files Browse the repository at this point in the history
[ Upstream commit c2bf23e ]

Filters on different vports are qualified by different implicit MACs and/or
VLANs, so shouldn't be considered equal even if their other match fields
are identical.

Fixes: 7c460d9 ("sfc: Extend and abstract efx_filter_spec to cover Huntington/EF10")
Co-developed-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com>
Link: https://lore.kernel.org/r/20221018092841.32206-1-pieter.jansen-van-vuuren@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Pieter Jansen van Vuuren authored and gregkh committed Oct 29, 2022
1 parent 0163e04 commit fb56ab8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/sfc/filter.h
Expand Up @@ -161,9 +161,9 @@ struct efx_filter_spec {
u32 priority:2;
u32 flags:6;
u32 dmaq_id:12;
u32 vport_id;
u32 rss_context;
__be16 outer_vid __aligned(4); /* allow jhash2() of match values */
u32 vport_id;
__be16 outer_vid;
__be16 inner_vid;
u8 loc_mac[ETH_ALEN];
u8 rem_mac[ETH_ALEN];
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/sfc/rx_common.c
Expand Up @@ -660,17 +660,17 @@ bool efx_filter_spec_equal(const struct efx_filter_spec *left,
(EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX)))
return false;

return memcmp(&left->outer_vid, &right->outer_vid,
return memcmp(&left->vport_id, &right->vport_id,
sizeof(struct efx_filter_spec) -
offsetof(struct efx_filter_spec, outer_vid)) == 0;
offsetof(struct efx_filter_spec, vport_id)) == 0;
}

u32 efx_filter_spec_hash(const struct efx_filter_spec *spec)
{
BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3);
return jhash2((const u32 *)&spec->outer_vid,
BUILD_BUG_ON(offsetof(struct efx_filter_spec, vport_id) & 3);
return jhash2((const u32 *)&spec->vport_id,
(sizeof(struct efx_filter_spec) -
offsetof(struct efx_filter_spec, outer_vid)) / 4,
offsetof(struct efx_filter_spec, vport_id)) / 4,
0);
}

Expand Down

0 comments on commit fb56ab8

Please sign in to comment.