mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
flow: Enable matching on new field 'pkt_mark'.
The Linux kernel datapath enables matching and setting the skb mark but this functionality is currently used only internally by ovs-vswitchd. This exposes it through NXM to enable external controllers to interact with other kernel subsystems. Although this is simply exporting the skb mark, the intention is that this is a platform independent mechanism to access some system metadata and therefore may have different implementations on various systems. Bug #17855 Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
This commit is contained in:
@@ -1134,11 +1134,17 @@ ofputil_usable_protocols(const struct match *match)
|
||||
return OFPUTIL_P_NONE;
|
||||
}
|
||||
|
||||
/* pkt_mark and skb_priority can't be sent in a flow_mod */
|
||||
if (wc->masks.pkt_mark || wc->masks.skb_priority) {
|
||||
/* skb_priority can't be sent in a flow_mod */
|
||||
if (wc->masks.skb_priority) {
|
||||
return OFPUTIL_P_NONE;
|
||||
}
|
||||
|
||||
/* NXM and OXM support pkt_mark */
|
||||
if (wc->masks.pkt_mark) {
|
||||
return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM
|
||||
| OFPUTIL_P_OF13_OXM;
|
||||
}
|
||||
|
||||
/* NXM, OXM, and OF1.1 support bitwise matching on ethernet addresses. */
|
||||
if (!eth_mask_is_exact(wc->masks.dl_src)
|
||||
&& !eth_addr_is_zero(wc->masks.dl_src)) {
|
||||
@@ -2917,6 +2923,7 @@ ofputil_decode_packet_in_finish(struct ofputil_packet_in *pin,
|
||||
pin->fmd.tun_dst = match->flow.tunnel.ip_dst;
|
||||
pin->fmd.metadata = match->flow.metadata;
|
||||
memcpy(pin->fmd.regs, match->flow.regs, sizeof pin->fmd.regs);
|
||||
pin->fmd.pkt_mark = match->flow.pkt_mark;
|
||||
}
|
||||
|
||||
enum ofperr
|
||||
@@ -3031,6 +3038,10 @@ ofputil_packet_in_to_match(const struct ofputil_packet_in *pin,
|
||||
}
|
||||
}
|
||||
|
||||
if (pin->fmd.pkt_mark != 0) {
|
||||
match_set_pkt_mark(match, pin->fmd.pkt_mark);
|
||||
}
|
||||
|
||||
match_set_in_port(match, pin->fmd.in_port);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user