mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
nfp: flower: allow matching on ipv4 UDP tunnel tos and ttl
The addition of FLOW_DISSECTOR_KEY_ENC_IP to TC flower means that the ToS and TTL of the tunnel header can now be matched on. Extend the NFP tunnel match function to include these new fields. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2a43747147
commit
d7ff7ec573
@ -346,7 +346,7 @@ struct nfp_flower_ipv6 {
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | ipv4_addr_dst |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Reserved |
|
||||
* | Reserved | tos | ttl |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Reserved |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
@ -356,7 +356,10 @@ struct nfp_flower_ipv6 {
|
||||
struct nfp_flower_ipv4_udp_tun {
|
||||
__be32 ip_src;
|
||||
__be32 ip_dst;
|
||||
__be32 reserved[2];
|
||||
__be16 reserved1;
|
||||
u8 tos;
|
||||
u8 ttl;
|
||||
__be32 reserved2;
|
||||
__be32 tun_id;
|
||||
};
|
||||
|
||||
|
@ -270,6 +270,7 @@ nfp_flower_compile_ipv4_udp_tun(struct nfp_flower_ipv4_udp_tun *frame,
|
||||
struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
|
||||
struct flow_dissector_key_ipv4_addrs *tun_ips;
|
||||
struct flow_dissector_key_keyid *vni;
|
||||
struct flow_dissector_key_ip *ip;
|
||||
|
||||
memset(frame, 0, sizeof(struct nfp_flower_ipv4_udp_tun));
|
||||
|
||||
@ -293,6 +294,14 @@ nfp_flower_compile_ipv4_udp_tun(struct nfp_flower_ipv4_udp_tun *frame,
|
||||
frame->ip_src = tun_ips->src;
|
||||
frame->ip_dst = tun_ips->dst;
|
||||
}
|
||||
|
||||
if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_ENC_IP)) {
|
||||
ip = skb_flow_dissector_target(flow->dissector,
|
||||
FLOW_DISSECTOR_KEY_ENC_IP,
|
||||
target);
|
||||
frame->tos = ip->tos;
|
||||
frame->ttl = ip->ttl;
|
||||
}
|
||||
}
|
||||
|
||||
int nfp_flower_compile_flow_match(struct tc_cls_flower_offload *flow,
|
||||
|
@ -66,6 +66,7 @@
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_PORTS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_IP) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_MPLS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_IP))
|
||||
|
||||
@ -74,7 +75,8 @@
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_KEYID) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_PORTS))
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_PORTS) | \
|
||||
BIT(FLOW_DISSECTOR_KEY_ENC_IP))
|
||||
|
||||
#define NFP_FLOWER_WHITELIST_TUN_DISSECTOR_R \
|
||||
(BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL) | \
|
||||
|
Loading…
Reference in New Issue
Block a user