mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
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>
This commit is contained in:
committed by
Simon Horman
parent
5db012c4ac
commit
a3db6e473d
@@ -589,6 +589,14 @@ parse_tc_flower_to_match(struct tc_flower *flower,
|
||||
match->flow.mpls_lse[0] = key->mpls_lse & mask->mpls_lse;
|
||||
match->wc.masks.mpls_lse[0] = mask->mpls_lse;
|
||||
match_set_dl_type(match, key->encap_eth_type[0]);
|
||||
} else if (key->eth_type == htons(ETH_TYPE_ARP)) {
|
||||
match_set_arp_sha_masked(match, key->arp.sha, mask->arp.sha);
|
||||
match_set_arp_tha_masked(match, key->arp.tha, mask->arp.tha);
|
||||
match_set_arp_spa_masked(match, key->arp.spa, mask->arp.spa);
|
||||
match_set_arp_tpa_masked(match, key->arp.tpa, mask->arp.tpa);
|
||||
match_set_arp_opcode_masked(match, key->arp.opcode,
|
||||
mask->arp.opcode);
|
||||
match_set_dl_type(match, key->eth_type);
|
||||
} else {
|
||||
match_set_dl_type(match, key->eth_type);
|
||||
}
|
||||
@@ -1558,6 +1566,25 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
|
||||
mask->dl_type = 0;
|
||||
mask->in_port.odp_port = 0;
|
||||
|
||||
if (key->dl_type == htons(ETH_P_ARP)) {
|
||||
flower.key.arp.spa = key->nw_src;
|
||||
flower.key.arp.tpa = key->nw_dst;
|
||||
flower.key.arp.sha = key->arp_sha;
|
||||
flower.key.arp.tha = key->arp_tha;
|
||||
flower.key.arp.opcode = key->nw_proto;
|
||||
flower.mask.arp.spa = mask->nw_src;
|
||||
flower.mask.arp.tpa = mask->nw_dst;
|
||||
flower.mask.arp.sha = mask->arp_sha;
|
||||
flower.mask.arp.tha = mask->arp_tha;
|
||||
flower.mask.arp.opcode = mask->nw_proto;
|
||||
|
||||
mask->nw_src = 0;
|
||||
mask->nw_dst = 0;
|
||||
mask->nw_proto = 0;
|
||||
memset(&mask->arp_sha, 0, sizeof mask->arp_sha);
|
||||
memset(&mask->arp_tha, 0, sizeof mask->arp_tha);
|
||||
}
|
||||
|
||||
if (is_ip_any(key)) {
|
||||
flower.key.ip_proto = key->nw_proto;
|
||||
flower.mask.ip_proto = mask->nw_proto;
|
||||
|
Reference in New Issue
Block a user