Skip to content

Commit

Permalink
fix loci OXM ordering to match the spec
Browse files Browse the repository at this point in the history
The C backend will now output OXMs in the same order as the Java backend.
  • Loading branch information
rlane committed Oct 15, 2013
1 parent 6870e17 commit 4964d54
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
4 changes: 2 additions & 2 deletions c_gen/c_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ def gen_unified_match_to_v3(out):
/* For each active member, add an OXM entry to the list */
""")
# @fixme Would like to generate the list in some reasonable order
for key, entry in match.of_match_members.items():
for key in match.match_keys_sorted:
entry = match.of_match_members[key]
out.write("""\
if (OF_MATCH_MASK_%(ku)s_ACTIVE_TEST(src)) {
if (!OF_MATCH_MASK_%(ku)s_EXACT_TEST(src)) {
Expand Down
67 changes: 34 additions & 33 deletions loxi_front_end/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,7 @@
takes_mask_in_spec=False,
order=211,
),
ipv4_src = dict(
name="ipv4_src",
m_type="of_ipv4_t",
v1_wc_shift=8,
print_type="PRIx32",
conditions="is_ipv4(match)",
takes_mask_in_spec=True,
order=300,
),
ipv4_dst = dict(
name="ipv4_dst",
m_type="of_ipv4_t",
v1_wc_shift=14,
print_type="PRIx32",
conditions="is_ipv4(match)",
takes_mask_in_spec=True,
order=301,
),

ip_dscp = dict(
name="ip_dscp",
m_type="uint8_t",
Expand Down Expand Up @@ -191,6 +174,24 @@
takes_mask_in_spec=False,
order=320,
),
ipv4_src = dict(
name="ipv4_src",
m_type="of_ipv4_t",
v1_wc_shift=8,
print_type="PRIx32",
conditions="is_ipv4(match)",
takes_mask_in_spec=True,
order=330,
),
ipv4_dst = dict(
name="ipv4_dst",
m_type="of_ipv4_t",
v1_wc_shift=14,
print_type="PRIx32",
conditions="is_ipv4(match)",
takes_mask_in_spec=True,
order=331,
),

tcp_dst = dict(
name="tcp_dst",
Expand Down Expand Up @@ -270,7 +271,7 @@
print_type="PRIx16",
conditions="is_arp(match)",
takes_mask_in_spec=False,
order=250,
order=450,
),

arp_spa = dict(
Expand All @@ -279,15 +280,15 @@
print_type="PRIx32",
conditions="is_arp(match)",
takes_mask_in_spec=True,
order=251,
order=451,
),
arp_tpa = dict(
name="arp_tpa",
m_type="uint32_t",
print_type="PRIx32",
conditions="is_arp(match)",
takes_mask_in_spec=True,
order=252,
order=452,
),

arp_sha = dict(
Expand All @@ -296,15 +297,15 @@
print_type="\"p\"",
conditions="is_arp(match)",
takes_mask_in_spec=False,
order=253,
order=453,
),
arp_tha = dict(
name="arp_tha",
m_type="of_mac_addr_t",
print_type="\"p\"",
conditions="is_arp(match)",
takes_mask_in_spec=False,
order=254,
order=454,
),

ipv6_src = dict(
Expand All @@ -313,15 +314,15 @@
print_type="\"p\"",
conditions="is_ipv6(match)",
takes_mask_in_spec=True,
order=350,
order=500,
),
ipv6_dst = dict(
name="ipv6_dst",
m_type="of_ipv6_t",
print_type="\"p\"",
conditions="is_ipv6(match)",
takes_mask_in_spec=True,
order=351,
order=501,
),

ipv6_flabel = dict(
Expand All @@ -330,7 +331,7 @@
print_type="PRIx32",
conditions="is_ipv6(match)",
takes_mask_in_spec=False, # Comment in openflow.h says True
order=360,
order=502,
),

icmpv6_type = dict(
Expand All @@ -339,15 +340,15 @@
print_type="PRIx8",
conditions="is_icmp_v6(match)",
takes_mask_in_spec=False,
order=440,
order=510,
),
icmpv6_code = dict(
name="icmpv6_code",
m_type="uint8_t",
print_type="PRIx8",
conditions="is_icmp_v6(match)",
takes_mask_in_spec=False,
order=441,
order=511,
),

ipv6_nd_target = dict(
Expand All @@ -356,7 +357,7 @@
print_type="\"p\"",
conditions="", # fixme
takes_mask_in_spec=False,
order=442,
order=512,
),

ipv6_nd_sll = dict(
Expand All @@ -365,15 +366,15 @@
print_type="\"p\"",
conditions="", # fixme
takes_mask_in_spec=False,
order=443,
order=520,
),
ipv6_nd_tll = dict(
name="ipv6_nd_tll",
m_type="of_mac_addr_t",
print_type="\"p\"",
conditions="", # fixme
takes_mask_in_spec=False,
order=444,
order=521,
),

mpls_label = dict(
Expand All @@ -383,7 +384,7 @@
print_type="PRIx32",
conditions="",
takes_mask_in_spec=False,
order=500,
order=600,
),
mpls_tc = dict(
name="mpls_tc",
Expand All @@ -392,7 +393,7 @@
print_type="PRIx8",
conditions="",
takes_mask_in_spec=False,
order=501,
order=601,
),

bsn_in_ports_128 = dict(
Expand Down

0 comments on commit 4964d54

Please sign in to comment.