forked from magma/magma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pipelined): QFI value Set in RYU (magma#12514)
* feat(RYU): QFI value Set in RYU Signed-off-by: prabina pattnaik <prabinak@wavelabs.ai> * feat(Pipelined): QFI value Set in RYU Signed-off-by: prabina pattnaik <prabinak@wavelabs.ai>
- Loading branch information
1 parent
b0c3f3a
commit b730007
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...eploy/roles/magma/files/patches/0002-QFI-value-set-in-Openflow-controller-using-RYU.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 82cb817858258fab69aabf5c3ed007f28d0aa0d3 Mon Sep 17 00:00:00 2001 | ||
From: Prabina Pattnaik <prabinak@wavelabs.ai> | ||
Date: Wed, 20 Apr 2022 13:53:50 +0530 | ||
Subject: [PATCH] QFI value set in Openflow controller using RYU | ||
|
||
Signed-off-by: Prabina Pattnaik <prabinak@wavelabs.ai> | ||
--- | ||
ryu/ofproto/nicira_ext.py | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
|
||
diff --git a/ryu/ofproto/nicira_ext.py b/ryu/ofproto/nicira_ext.py | ||
index 9c2d2aaf..7c5f9ef4 100644 | ||
--- a/ryu/ofproto/nicira_ext.py | ||
+++ b/ryu/ofproto/nicira_ext.py | ||
@@ -435,6 +435,7 @@ NXM_NX_PKT_MARK_W = nxm_header_w(0x0001, 33, 4) | ||
NXM_NX_TCP_FLAGS = nxm_header(0x0001, 34, 2) | ||
NXM_NX_TCP_FLAGS_W = nxm_header_w(0x0001, 34, 2) | ||
|
||
+NXM_NX_QFI = nxm_header(0x0001, 126, 1) | ||
|
||
def nxm_nx_reg(idx): | ||
return nxm_header(0x0001, idx, 4) | ||
@@ -632,6 +633,7 @@ reg<idx> Integer 32bit Packet register. | ||
<idx> is register number 0-15. | ||
xxreg<idx> Integer 128bit Packet extended-extended register. | ||
<idx> is register number 0-3. | ||
+qfi Integer 8bit QFI Value Set. | ||
================ =============== ============================================== | ||
|
||
.. Note:: | ||
@@ -709,6 +711,7 @@ oxm_types = [ | ||
oxm_fields.NiciraExtended1('ct_label', 108, type_desc.Int16), | ||
oxm_fields.NiciraExtended1('tun_ipv6_src', 109, type_desc.IPv6Addr), | ||
oxm_fields.NiciraExtended1('tun_ipv6_dst', 110, type_desc.IPv6Addr), | ||
+ oxm_fields.NiciraExtended1("qfi", 126, type_desc.Int1), | ||
|
||
# Prefix the name with '_' to indicate this is not intended to be used | ||
# in wild. | ||
-- | ||
2.11.0 | ||
|
59 changes: 59 additions & 0 deletions
59
...eploy/roles/magma/files/patches/0003-QFI-value-set-in-Openflow-controller-using-RYU.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py | ||
index 6d886853..81b32c43 100644 | ||
--- a/ryu/ofproto/nx_match.py | ||
+++ b/ryu/ofproto/nx_match.py | ||
@@ -44,6 +44,7 @@ FWW_ARP_SHA = 1 << 3 | ||
FWW_ARP_THA = 1 << 6 | ||
FWW_IPV6_LABEL = 1 << 7 | ||
FWW_NW_TTL = 1 << 8 | ||
+FWW_QFI = 1 << 9 | ||
FWW_ALL = (1 << 13) - 1 | ||
|
||
FLOW_NW_FRAG_ANY = 1 << 0 | ||
@@ -94,6 +95,7 @@ class Flow(ofproto_parser.StringifyMixin): | ||
self.ipv6_label = 0 | ||
self.pkt_mark = 0 | ||
self.tcp_flags = 0 | ||
+ self.qfi = 0 | ||
|
||
|
||
class FlowWildcards(ofproto_parser.StringifyMixin): | ||
@@ -318,6 +320,10 @@ class ClsRule(ofproto_parser.StringifyMixin): | ||
self.flow.tcp_flags = tcp_flags | ||
self.wc.tcp_flags_mask = mask | ||
|
||
+ def set_qfi(self, qfi): | ||
+ self.wc.wildcards &= ~FWW_QFI | ||
+ self.flow.qfi = qfi | ||
+ | ||
def flow_format(self): | ||
# Tunnel ID is only supported by NXM | ||
if self.wc.tun_id_mask != 0: | ||
@@ -959,6 +965,16 @@ class MFPktMark(MFField): | ||
|
||
|
||
@_register_make | ||
+@_set_nxm_headers([ofproto_v1_0.NXM_NX_QFI]) | ||
+class MFPQfi(MFField): | ||
+ @classmethod | ||
+ def make(cls, header): | ||
+ return cls(header, MF_PACK_STRING_8) | ||
+ | ||
+ def put(self, buf, offset, rule): | ||
+ return self.put(buf, offset, rule.flow.qfi) | ||
+ | ||
+@_register_make | ||
@_set_nxm_headers([ofproto_v1_0.NXM_NX_TCP_FLAGS, | ||
ofproto_v1_0.NXM_NX_TCP_FLAGS_W]) | ||
class MFTcpFlags(MFField): | ||
@@ -1159,6 +1175,10 @@ def serialize_nxm_match(rule, buf, offset): | ||
header = ofproto_v1_0.NXM_NX_TUN_ID_W | ||
offset += nxm_put(buf, offset, header, rule) | ||
|
||
+ # QFI Value | ||
+ if not rule.wc.wildcards & FWW_QFI: | ||
+ offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_QFI, rule) | ||
+ | ||
# XXX: Cookie | ||
|
||
for i in range(FLOW_N_REGS): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters