mirror of
https://github.com/faucetsdn/ryu.git
synced 2025-08-07 07:07:15 +02:00
Merge pull request #151 from crezov/master
fix NXActionRegLoad action_to_str
This commit is contained in:
commit
537f35f4b2
@ -39,9 +39,7 @@ def action_to_str(act, ofctl_action_to_str):
|
|||||||
src_start, src_end)
|
src_start, src_end)
|
||||||
|
|
||||||
elif sub_type == nicira_ext.NXAST_REG_LOAD:
|
elif sub_type == nicira_ext.NXAST_REG_LOAD:
|
||||||
start = act.ofs
|
return 'NX_LOAD: {%s%s: %x}' % (act.dst, nicira_ext.ofs_nbits_str(act.ofs_nbits), act.value)
|
||||||
end = start + act.nbits
|
|
||||||
return 'NX_LOAD: {%s[%s..%s]: %x}' % (act.dst, start, end, act.value)
|
|
||||||
|
|
||||||
elif sub_type == nicira_ext.NXAST_LEARN:
|
elif sub_type == nicira_ext.NXAST_LEARN:
|
||||||
specs = []
|
specs = []
|
||||||
|
@ -332,6 +332,17 @@ def ofs_nbits(start, end):
|
|||||||
return (start << 6) + (end - start)
|
return (start << 6) + (end - start)
|
||||||
|
|
||||||
|
|
||||||
|
def ofs_nbits_str(n):
|
||||||
|
start = 0
|
||||||
|
while True:
|
||||||
|
start += 1
|
||||||
|
if (start << 6) > n:
|
||||||
|
break
|
||||||
|
start -= 1
|
||||||
|
end = n + start - (start << 6)
|
||||||
|
return "[%d..%d]" % (start, end)
|
||||||
|
|
||||||
|
|
||||||
def nxm_header__(vendor, field, hasmask, length):
|
def nxm_header__(vendor, field, hasmask, length):
|
||||||
return (vendor << 16) | (field << 9) | (hasmask << 8) | length
|
return (vendor << 16) | (field << 9) | (hasmask << 8) | length
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user