]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nfp: flower: do not assume mac/mpls matches
authorJohn Hurley <john.hurley@netronome.com>
Sat, 9 Dec 2017 03:37:01 +0000 (19:37 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Dec 2017 17:07:47 +0000 (12:07 -0500)
Remove the matching of mac/mpls as a default selection. These are not
necessarily set by a TC rule (unlike the port). Previously a mac/mpls
field would exist in every match and be masked out if not used. This patch
has no impact on functionality but removes unnessary memory assignment in
the match cmsg.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/offload.c

index 553f94f55dce64ba9cdb661ff9bdb04faf41acac..1b7c59a8b139d5b144672f591f41fae779487a8c 100644 (file)
@@ -150,10 +150,15 @@ nfp_flower_calculate_key_layers(struct nfp_fl_key_ls *ret_key_ls,
                return -EOPNOTSUPP;
 
        key_layer_two = 0;
-       key_layer = NFP_FLOWER_LAYER_PORT | NFP_FLOWER_LAYER_MAC;
+       key_layer = NFP_FLOWER_LAYER_PORT;
        key_size = sizeof(struct nfp_flower_meta_one) +
-                  sizeof(struct nfp_flower_in_port) +
-                  sizeof(struct nfp_flower_mac_mpls);
+                  sizeof(struct nfp_flower_in_port);
+
+       if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS) ||
+           dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_MPLS)) {
+               key_layer |= NFP_FLOWER_LAYER_MAC;
+               key_size += sizeof(struct nfp_flower_mac_mpls);
+       }
 
        if (dissector_uses_key(flow->dissector,
                               FLOW_DISSECTOR_KEY_ENC_CONTROL)) {