Skip to content

Commit c2bf23e

Browse files
pieterj-xilinxkuba-moo
authored andcommitted
sfc: include vport_id in filter spec hash and equal()
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 <[email protected]> Signed-off-by: Edward Cree <[email protected]> Signed-off-by: Pieter Jansen van Vuuren <[email protected]> Reviewed-by: Martin Habets <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d753a05 commit c2bf23e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/net/ethernet/sfc/filter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ struct efx_filter_spec {
162162
u32 priority:2;
163163
u32 flags:6;
164164
u32 dmaq_id:12;
165-
u32 vport_id;
166165
u32 rss_context;
167-
__be16 outer_vid __aligned(4); /* allow jhash2() of match values */
166+
u32 vport_id;
167+
__be16 outer_vid;
168168
__be16 inner_vid;
169169
u8 loc_mac[ETH_ALEN];
170170
u8 rem_mac[ETH_ALEN];

drivers/net/ethernet/sfc/rx_common.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,17 +660,17 @@ bool efx_filter_spec_equal(const struct efx_filter_spec *left,
660660
(EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX)))
661661
return false;
662662

663-
return memcmp(&left->outer_vid, &right->outer_vid,
663+
return memcmp(&left->vport_id, &right->vport_id,
664664
sizeof(struct efx_filter_spec) -
665-
offsetof(struct efx_filter_spec, outer_vid)) == 0;
665+
offsetof(struct efx_filter_spec, vport_id)) == 0;
666666
}
667667

668668
u32 efx_filter_spec_hash(const struct efx_filter_spec *spec)
669669
{
670-
BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3);
671-
return jhash2((const u32 *)&spec->outer_vid,
670+
BUILD_BUG_ON(offsetof(struct efx_filter_spec, vport_id) & 3);
671+
return jhash2((const u32 *)&spec->vport_id,
672672
(sizeof(struct efx_filter_spec) -
673-
offsetof(struct efx_filter_spec, outer_vid)) / 4,
673+
offsetof(struct efx_filter_spec, vport_id)) / 4,
674674
0);
675675
}
676676

0 commit comments

Comments
 (0)