Hi Ben,

Have you got a chance to look at the below patch?

In the test case, wire_reason() translate OFPR_ACTION to OFPR_NO_MATCH, but 
OFPR_ACTION (as the value of pin->up.reason) was still passed to 
ofconn_receives_async_msg() to check whether the packet-in shall be sent or not 
- which it decides as not for the test case and thus the packet-in is not sent.

The patch instead passes the value from wire_reason() to 
ofconn_receives_async_msg() so that the async flag for NO_MATCH was tested and 
the packet-in will be sent for the test case.

Thanks,
Shu

-----Original Message-----
From: Shu Shen 
Sent: Friday, November 21, 2014 4:27 PM
To: dev@openvswitch.org
Cc: Shu Shen
Subject: [PATCH] ofproto: fix checking of packet_in_mask in async config

The check shall use wire protool reasons, which could be different from
the internal packet-in reason.

Signed-off-by: Shu Shen <shu.s...@radisys.com>
---
 ofproto/connmgr.c     |  2 +-
 tests/ofproto-dpif.at | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 627f326..46e7431 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1677,7 +1677,7 @@ connmgr_send_packet_in(struct connmgr *mgr,
         enum ofp_packet_in_reason reason = wire_reason(ofconn, pin);
 
         if (ofconn_wants_packet_in_on_miss(ofconn, pin)
-            && ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->up.reason)
+            && ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, reason)
             && ofconn->controller_id == pin->controller_id) {
             schedule_packet_in(ofconn, *pin, reason);
         }
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index d2d089b..684157b 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -2652,6 +2652,68 @@ OFPST_FLOW reply (OF1.3):
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
+OVS_VSWITCHD_START([dnl
+   add-port br0 p1 -- set Interface p1 type=dummy
+])
+ON_EXIT([kill `cat ovs-ofctl.pid`])
+
+AT_CAPTURE_FILE([ofctl_monitor.log])
+# A table-miss flow has priority 0 and no match
+AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 
actions=output:CONTROLLER'])
+
+dnl Singleton controller action.
+AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 
--detach --no-chdir --pidfile 2> ofctl_monitor.log])
+
+# Become slave (OF 1.3), which should disable everything except port status.
+ovs-appctl -t ovs-ofctl ofctl/send 
041800180000000200000003000000000000000000000001
+
+# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
+ovs-appctl -t ovs-ofctl ofctl/send 
041c002000000002000000000000000100000000000000000000000000000000
+
+for i in 1 2 3 ; do
+    ovs-appctl netdev-dummy/receive p1 
'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
+OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
+dnl
+send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
+ master:
+       PACKET_IN: (off)
+     PORT_STATUS: (off)
+    FLOW_REMOVED: (off)
+
+ slave:
+       PACKET_IN: no_match
+     PORT_STATUS: (off)
+    FLOW_REMOVED: (off)
+dnl
+OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn
 tcp_csum:0
+dnl
+OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn
 tcp_csum:0
+dnl
+OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn
 tcp_csum:0
+])
+
+AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
+
+AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | 
sort], [0], [dnl
+ n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
+OFPST_FLOW reply (OF1.3):
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 
 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
 OVS_VSWITCHD_START([dnl
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to