diff options
author | Tonghao Zhang <xiangxia.m.yue@gmail.com> | 2020-06-05 21:17:29 +0800 |
---|---|---|
committer | Simon Horman <simon.horman@netronome.com> | 2020-06-08 11:08:05 +0200 |
commit | a3db6e473d9fb6558d0dc065bc4b3e4e1c2f9455 (patch) | |
tree | e3f84e59ee4e9a8204aa13e9bbe9b3a1807a06ec /lib/match.c | |
parent | 5db012c4ac3630ec99fa6c64bbae38cbbcd0544e (diff) | |
download | openvswitch-a3db6e473d9fb6558d0dc065bc4b3e4e1c2f9455.tar.gz |
netdev-offload-tc: Allow installing arp rules to TC dp.
This patch allows to install arp rules to tc dp.
In the future, arp will be offloaded to hardware to
be processed. So OvS enable this now.
$ ovs-appctl dpctl/add-flow 'recirc_id(0),in_port(3),eth(),\
eth_type(0x0806),arp(op=2,tha=00:50:56:e1:4b:ab,tip=10.255.1.116)' 2
$ ovs-appctl dpctl/dump-flows
... arp(tip=10.255.1.116,op=2,tha=00:50:56:e1:4b:ab) ...
$ tc filter show dev <ethx> ingress
...
eth_type arp
arp_tip 10.255.1.116
arp_op reply
arp_tha 00:50:56:e1:4b:ab
not_in_hw
action order 1: mirred (Egress Redirect to device <ethy>) stolen
...
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'lib/match.c')
-rw-r--r-- | lib/match.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/match.c b/lib/match.c index 29b25a73b..a77554851 100644 --- a/lib/match.c +++ b/lib/match.c @@ -941,6 +941,14 @@ match_set_nw_proto(struct match *match, uint8_t nw_proto) } void +match_set_nw_proto_masked(struct match *match, + const uint8_t nw_proto, const uint8_t mask) +{ + match->flow.nw_proto = nw_proto; + match->wc.masks.nw_proto = mask; +} + +void match_set_nw_src(struct match *match, ovs_be32 nw_src) { match->flow.nw_src = nw_src; @@ -1034,6 +1042,30 @@ match_set_icmp_code(struct match *match, uint8_t icmp_code) } void +match_set_arp_opcode_masked(struct match *match, + const uint8_t opcode, + const uint8_t mask) +{ + match_set_nw_proto_masked(match, opcode, mask); +} + +void +match_set_arp_spa_masked(struct match *match, + const ovs_be32 arp_spa, + const ovs_be32 mask) +{ + match_set_nw_src_masked(match, arp_spa, mask); +} + +void +match_set_arp_tpa_masked(struct match *match, + const ovs_be32 arp_tpa, + const ovs_be32 mask) +{ + match_set_nw_dst_masked(match, arp_tpa, mask); +} + +void match_set_arp_sha(struct match *match, const struct eth_addr sha) { match->flow.arp_sha = sha; |