Skip to content

Commit db191db

Browse files
pjvuurendavem330
authored andcommitted
nfp: flower: fix vlan match by checking both vlan id and vlan pcp
Previously we only checked if the vlan id field is present when trying to match a vlan tag. The vlan id and vlan pcp field should be treated independently. Fixes: 5571e8c ("nfp: extend flower matching capabilities") Signed-off-by: Pieter Jansen van Vuuren <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 12a78b0 commit db191db

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

drivers/net/ethernet/netronome/nfp/flower/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct nfp_app;
7070
#define NFP_FL_FEATS_GENEVE BIT(0)
7171
#define NFP_FL_NBI_MTU_SETTING BIT(1)
7272
#define NFP_FL_FEATS_GENEVE_OPT BIT(2)
73+
#define NFP_FL_FEATS_VLAN_PCP BIT(3)
7374
#define NFP_FL_FEATS_LAG BIT(31)
7475

7576
struct nfp_fl_mask_id {

drivers/net/ethernet/netronome/nfp/flower/match.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_tci *frame,
5656
FLOW_DISSECTOR_KEY_VLAN,
5757
target);
5858
/* Populate the tci field. */
59-
if (flow_vlan->vlan_id) {
59+
if (flow_vlan->vlan_id || flow_vlan->vlan_priority) {
6060
tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
6161
flow_vlan->vlan_priority) |
6262
FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ nfp_flower_calculate_key_layers(struct nfp_app *app,
192192
key_size += sizeof(struct nfp_flower_mac_mpls);
193193
}
194194

195+
if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_VLAN)) {
196+
struct flow_dissector_key_vlan *flow_vlan;
197+
198+
flow_vlan = skb_flow_dissector_target(flow->dissector,
199+
FLOW_DISSECTOR_KEY_VLAN,
200+
flow->mask);
201+
if (!(priv->flower_ext_feats & NFP_FL_FEATS_VLAN_PCP) &&
202+
flow_vlan->vlan_priority)
203+
return -EOPNOTSUPP;
204+
}
205+
195206
if (dissector_uses_key(flow->dissector,
196207
FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
197208
struct flow_dissector_key_ipv4_addrs *mask_ipv4 = NULL;

0 commit comments

Comments
 (0)