提交 a427673e 编写于 作者: J John Hurley 提交者: David S. Miller

nfp: flower: remove dead code paths

Port matching is selected by default on every rule so remove check for it
and delete 'else' side of the statement. Remove nfp_flower_meta_one as now
it will not feature in the code. Rename nfp_flower_meta_two given that one
has been removed.

'Additional metadata' if statement can never be true so remove it as well.
Signed-off-by: NJohn Hurley <john.hurley@netronome.com>
Reviewed-by: NDirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 de7d9549
......@@ -165,20 +165,6 @@ struct nfp_fl_pop_vlan {
__be16 reserved;
};
/* Metadata without L2 (1W/4B)
* ----------------------------------------------------------------
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | key_layers | mask_id | reserved |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct nfp_flower_meta_one {
u8 nfp_flow_key_layer;
u8 mask_id;
u16 reserved;
};
struct nfp_fl_pre_tunnel {
struct nfp_fl_act_head head;
__be16 reserved;
......@@ -209,7 +195,7 @@ struct nfp_fl_set_vxlan {
* NOTE: | TCI |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct nfp_flower_meta_two {
struct nfp_flower_meta_tci {
u8 nfp_flow_key_layer;
u8 mask_id;
__be16 tci;
......
......@@ -38,7 +38,7 @@
#include "main.h"
static void
nfp_flower_compile_meta_tci(struct nfp_flower_meta_two *frame,
nfp_flower_compile_meta_tci(struct nfp_flower_meta_tci *frame,
struct tc_cls_flower_offload *flow, u8 key_type,
bool mask_version)
{
......@@ -46,7 +46,7 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_two *frame,
struct flow_dissector_key_vlan *flow_vlan;
u16 tmp_tci;
memset(frame, 0, sizeof(struct nfp_flower_meta_two));
memset(frame, 0, sizeof(struct nfp_flower_meta_tci));
/* Populate the metadata frame. */
frame->nfp_flow_key_layer = key_type;
frame->mask_id = ~0;
......@@ -67,14 +67,6 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_two *frame,
}
}
static void
nfp_flower_compile_meta(struct nfp_flower_meta_one *frame, u8 key_type)
{
frame->nfp_flow_key_layer = key_type;
frame->mask_id = 0;
frame->reserved = 0;
}
static int
nfp_flower_compile_port(struct nfp_flower_in_port *frame, u32 cmsg_port,
bool mask_version, enum nfp_flower_tun_type tun_type)
......@@ -278,49 +270,32 @@ int nfp_flower_compile_flow_match(struct tc_cls_flower_offload *flow,
ext = nfp_flow->unmasked_data;
msk = nfp_flow->mask_data;
if (NFP_FLOWER_LAYER_PORT & key_ls->key_layer) {
/* Populate Exact Metadata. */
nfp_flower_compile_meta_tci((struct nfp_flower_meta_two *)ext,
flow, key_ls->key_layer, false);
/* Populate Mask Metadata. */
nfp_flower_compile_meta_tci((struct nfp_flower_meta_two *)msk,
flow, key_ls->key_layer, true);
ext += sizeof(struct nfp_flower_meta_two);
msk += sizeof(struct nfp_flower_meta_two);
/* Populate Exact Port data. */
err = nfp_flower_compile_port((struct nfp_flower_in_port *)ext,
nfp_repr_get_port_id(netdev),
false, tun_type);
if (err)
return err;
/* Populate Mask Port Data. */
err = nfp_flower_compile_port((struct nfp_flower_in_port *)msk,
nfp_repr_get_port_id(netdev),
true, tun_type);
if (err)
return err;
ext += sizeof(struct nfp_flower_in_port);
msk += sizeof(struct nfp_flower_in_port);
} else {
/* Populate Exact Metadata. */
nfp_flower_compile_meta((struct nfp_flower_meta_one *)ext,
key_ls->key_layer);
/* Populate Mask Metadata. */
nfp_flower_compile_meta((struct nfp_flower_meta_one *)msk,
key_ls->key_layer);
ext += sizeof(struct nfp_flower_meta_one);
msk += sizeof(struct nfp_flower_meta_one);
}
if (NFP_FLOWER_LAYER_META & key_ls->key_layer) {
/* Additional Metadata Fields.
* Currently unsupported.
*/
return -EOPNOTSUPP;
}
/* Populate Exact Metadata. */
nfp_flower_compile_meta_tci((struct nfp_flower_meta_tci *)ext,
flow, key_ls->key_layer, false);
/* Populate Mask Metadata. */
nfp_flower_compile_meta_tci((struct nfp_flower_meta_tci *)msk,
flow, key_ls->key_layer, true);
ext += sizeof(struct nfp_flower_meta_tci);
msk += sizeof(struct nfp_flower_meta_tci);
/* Populate Exact Port data. */
err = nfp_flower_compile_port((struct nfp_flower_in_port *)ext,
nfp_repr_get_port_id(netdev),
false, tun_type);
if (err)
return err;
/* Populate Mask Port Data. */
err = nfp_flower_compile_port((struct nfp_flower_in_port *)msk,
nfp_repr_get_port_id(netdev),
true, tun_type);
if (err)
return err;
ext += sizeof(struct nfp_flower_in_port);
msk += sizeof(struct nfp_flower_in_port);
if (NFP_FLOWER_LAYER_MAC & key_ls->key_layer) {
/* Populate Exact MAC Data. */
......
......@@ -151,7 +151,7 @@ nfp_flower_calculate_key_layers(struct nfp_fl_key_ls *ret_key_ls,
key_layer_two = 0;
key_layer = NFP_FLOWER_LAYER_PORT;
key_size = sizeof(struct nfp_flower_meta_one) +
key_size = sizeof(struct nfp_flower_meta_tci) +
sizeof(struct nfp_flower_in_port);
if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS) ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册