From: Jarno Rajahalme Date: Thu, 24 Oct 2013 20:19:28 +0000 (-0700) Subject: OXM inspired match field names. X-Git-Tag: sliver-openvswitch-2.0.90-1~6^2~38 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=44a7e26dcc2a68c0293b38c03048f938f318f0fd OXM inspired match field names. Adds OXM inspired aliases for match fields that don't have them already ("ip_proto", "ip_ecn", "ip_dscp", and "tunnel_id"). "ip_dscp" replaces the earlier undocumented "nw_tos_shifted", and takes the DSCP value (0-63), which is then shifted appropriately when applied to an IP packet. The number of bits for this field is fixed from 8 to 6. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- diff --git a/lib/meta-flow.c b/lib/meta-flow.c index f53f3c486..9f39c1838 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -49,7 +49,7 @@ const struct mf_field mf_fields[MFF_N_IDS] = { /* ## -------- ## */ { - MFF_TUN_ID, "tun_id", NULL, + MFF_TUN_ID, "tun_id", "tunnel_id", MF_FIELD_SIZES(be64), MFM_FULLY, MFS_HEXADECIMAL, @@ -411,7 +411,7 @@ const struct mf_field mf_fields[MFF_N_IDS] = { }, { - MFF_IP_PROTO, "nw_proto", NULL, + MFF_IP_PROTO, "nw_proto", "ip_proto", MF_FIELD_SIZES(u8), MFM_NONE, MFS_DECIMAL, @@ -433,8 +433,8 @@ const struct mf_field mf_fields[MFF_N_IDS] = { OFPUTIL_P_ANY, /* Will be shifted for OXM. */ OFPUTIL_P_NONE, }, { - MFF_IP_DSCP_SHIFTED, "nw_tos_shifted", NULL, - MF_FIELD_SIZES(u8), + MFF_IP_DSCP_SHIFTED, "ip_dscp", NULL, + 1, 6, MFM_NONE, MFS_DECIMAL, MFP_IP_ANY, @@ -444,7 +444,7 @@ const struct mf_field mf_fields[MFF_N_IDS] = { OFPUTIL_P_ANY, /* Will be shifted for non-OXM. */ OFPUTIL_P_NONE, }, { - MFF_IP_ECN, "nw_ecn", NULL, + MFF_IP_ECN, "nw_ecn", "ip_ecn", 1, 2, MFM_NONE, MFS_DECIMAL, diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 4272fb1b8..01ef8e77f 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -70,8 +70,8 @@ for test_case in \ 'ipv6,nw_proto=1 NXM,OXM' \ 'ip,nw_tos=0xf0 any' \ 'ipv6,nw_tos=0xf0 NXM,OXM' \ - 'ip,nw_tos_shifted=0x3c any' \ - 'ipv6,nw_tos_shifted=0x3c NXM,OXM' \ + 'ip,ip_dscp=0x3c any' \ + 'ipv6,ip_dscp=0x3c NXM,OXM' \ 'ip,nw_ecn=1 NXM,OXM' \ 'ipv6,nw_ecn=1 NXM,OXM' \ 'ip,nw_ttl=5 NXM,OXM' \ @@ -252,8 +252,8 @@ for test_case in \ 'ipv6 nw_proto 1/1' \ 'ip nw_tos 0xf0/0xf0' \ 'ipv6 nw_tos 0xf0/0xf0' \ - 'ip nw_tos_shifted 0x3c/0xf0' \ - 'ipv6 nw_tos_shifted 0x3c/0xf0' \ + 'ip ip_dscp 0x3c/0xf0' \ + 'ipv6 ip_dscp 0x3c/0xf0' \ 'ip nw_ecn 1/1' \ 'ipv6 nw_ecn 1/1' \ 'ip nw_ttl 5/1' \ diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 81c90bdd5..168e9559f 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -594,6 +594,7 @@ When \fBdl_type\fR is wildcarded or set to a value other than 0x0800, (see \fBFlow Syntax\fR above). . .IP \fBnw_proto=\fIproto\fR +.IQ \fBip_proto=\fIproto\fR When \fBip\fR or \fBdl_type=0x0800\fR is specified, matches IP protocol type \fIproto\fR, which is specified as a decimal number between 0 and 255, inclusive (e.g. 1 to match ICMP packets or 6 to match @@ -626,7 +627,16 @@ When \fBdl_type\fR is wildcarded or set to a value other than 0x0800 or 0x86dd, the value of \fBnw_tos\fR is ignored (see \fBFlow Syntax\fR above). . +.IP \fBip_dscp=\fIdscp\fR +Matches IP ToS/DSCP or IPv6 traffic class field \fIdscp\fR, which is +specified as a decimal number between 0 and 63, inclusive. +.IP +When \fBdl_type\fR is wildcarded or set to a value other than 0x0800 or +0x86dd, the value of \fBip_dscp\fR is ignored (see \fBFlow Syntax\fR +above). +. .IP \fBnw_ecn=\fIecn\fR +.IQ \fBip_ecn=\fIecn\fR Matches \fIecn\fR bits in IP ToS or IPv6 traffic class fields, which is specified as a decimal number between 0 and 3, inclusive. .IP @@ -920,6 +930,7 @@ address option. An address is specified as 6 pairs of hexadecimal digits delimited by colons. . .IP \fBtun_id=\fItunnel-id\fR[\fB/\fImask\fR] +.IQ \fBtunnel_id=\fItunnel-id\fR[\fB/\fImask\fR] Matches tunnel identifier \fItunnel-id\fR. Only packets that arrive over a tunnel that carries a key (e.g. GRE with the RFC 2890 key extension and a nonzero key value) will have a nonzero tunnel ID.