fix NXActionRegLoad action_to_str
Backport from https://github.com/faucetsdn/ryu/commit/a44ace49 Story: #2009283 Task: #43618 Change-Id: I66c3947eac1aa2475bb8cb2291dba03915041707
This commit is contained in:
parent
2e8cf5bed2
commit
f77f83c622
@ -39,9 +39,7 @@ def action_to_str(act, ofctl_action_to_str):
|
||||
src_start, src_end)
|
||||
|
||||
elif sub_type == nicira_ext.NXAST_REG_LOAD:
|
||||
start = act.ofs
|
||||
end = start + act.nbits
|
||||
return 'NX_LOAD: {%s[%s..%s]: %x}' % (act.dst, start, end, act.value)
|
||||
return 'NX_LOAD: {%s%s: %x}' % (act.dst, nicira_ext.ofs_nbits_str(act.ofs_nbits), act.value)
|
||||
|
||||
elif sub_type == nicira_ext.NXAST_LEARN:
|
||||
specs = []
|
||||
|
@ -342,6 +342,17 @@ def ofs_nbits(start, end):
|
||||
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):
|
||||
return (vendor << 16) | (field << 9) | (hasmask << 8) | length
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user