Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-03-19 Thread Ben Pfaff
OK, now I understand.

I see why the LIVE bit change gets sent when the port gets enabled as a
result of port carrier status going up or down.  It's because
ofproto-dpif will report the port as changed via port_poll(), and thus
ofproto_run() will pass it to process_port_change().  But the other
reasons why a port might become LIVE or not-LIVE, such as CFM or BFD or
LACP reporting a change in status, do not get reported via port_poll(),
and I suspect that these will thus not get reported through an
OFPT_PORT_STATUS message.  I don't think any of the existing tests check
this behavior, so adding a test that shows that (at least one of these)
works as expected would be reassuring.

Thanks,

Ben.

On Wed, Mar 16, 2016 at 10:06:44AM +, Zoltán Balogh wrote:
> Hi Ben,
> 
> Sorry, there was no question in my e-mail.
> 
> The thing is, that I sent a patch on 11th of February. Then you replied:
> "This seems like a good start but I don't see anything that generates 
> an OFPT_PORT_STATUS message when the LIVE bit gets set or unset"
> 
> So, I tried to explain how the OFPT_PORT_STATUS message will be generated 
> after the LIVE bit is set/cleared. That was the purpose of the e-mail I sent 
> on 1st of March.
> 
> Based on the explanation, is the patch acceptable? Is there something missing?
> 
> Best regards,
> Zoltán
> 
> -Original Message-
> From: Ben Pfaff [mailto:b...@ovn.org] 
> Sent: Friday, March 11, 2016 6:56 PM
> To: Zoltán Balogh
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as 
> link aliveness
> 
> Can you briefly state the question you're asking?  I didn't know how to 
> respond to the previous email.
> 
> On Fri, Mar 11, 2016 at 10:42:26AM +, Zoltán Balogh wrote:
> > Hi,
> > 
> > Could someone please respond to this e-mail or give any feedback?
> > 
> > Thank you,
> > Zoltan
> > 
> > -Original Message-
> > From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Zoltán 
> > Balogh
> > Sent: Tuesday, March 01, 2016 1:41 PM
> > To: Ben Pfaff
> > Cc: dev@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable 
> > flag as link aliveness
> > 
> > Hi Ben,
> > 
> > This small patch modifies the port_run( ) function in ofproto_dpif. This 
> > function is invoked indirectly from ofproto_run() when ofproto_class->run() 
> > is called.
> > Sending of OFPT_PORT_STATUS message can be triggered by invoking 
> > update_port() in ofproto.
> > 
> > I tried to create a 'call tree' that shows where the LIVE bit is 
> > set/cleared and where OFPT_PORT_STATUS message can be sent to a controller. 
> > We start from the main loop, that invokes bridge_run(), xxx_run(), 
> > xxx_wait(), poll_block() and so on.
> > I used exclamation mark (!) to indicate where LIVE bit can be updated if 
> > needed and asterisk (*) to show where OFPT_PORT_STATUS can be sent via 
> > update_port().
> > So, here comes the tree. It looks quite ugly in my outlook. It can be 
> > copy-pasted to an editor with fixed width character set to get a better 
> > look.
> > 
> >main()
> > -> bridge_run()
> >  +-> bridge_run__()
> >  | -> ofproto_run()
> >  |  +-> ofproto_class->run() 
> >  !   |  | -> port_run() # updates OFPUTIL_PS_LIVE bit if 
> > needed !!!
> >  |  |
> >  |  +-> process_port_change()
> >  |  | +-> reinit_ports()
> >  *   |  | | -> update_port()
> >  |  | |
> >  *   |  | +-> update_port()
> >  |  |
> >  *   |  +-> update_port()  
> >  |
> >  +-> bridge_reconfigure() 
> >+-> bridge_delete_or_reconfigure_ports()
> >| -> ofproto_port_del()
> >  * |  -> update_port()
> >|
> >+-> bridge_add_ports()
> >| -> bridge_add_ports__()
> >|  -> iface_create()
> >|   +-> iface_do_create()
> >|   | -> ofproto_port_add()
> >  * |   |  -> update_port()
> >|   |  
> >|   +-> ofproto_port_add()
> >  * |  

Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-03-16 Thread Zoltán Balogh
Hi Ben,

Sorry, there was no question in my e-mail.

The thing is, that I sent a patch on 11th of February. Then you replied:
"This seems like a good start but I don't see anything that generates 
an OFPT_PORT_STATUS message when the LIVE bit gets set or unset"

So, I tried to explain how the OFPT_PORT_STATUS message will be generated after 
the LIVE bit is set/cleared. That was the purpose of the e-mail I sent on 1st 
of March.

Based on the explanation, is the patch acceptable? Is there something missing?

Best regards,
Zoltán

-Original Message-
From: Ben Pfaff [mailto:b...@ovn.org] 
Sent: Friday, March 11, 2016 6:56 PM
To: Zoltán Balogh
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link 
aliveness

Can you briefly state the question you're asking?  I didn't know how to respond 
to the previous email.

On Fri, Mar 11, 2016 at 10:42:26AM +, Zoltán Balogh wrote:
> Hi,
> 
> Could someone please respond to this e-mail or give any feedback?
> 
> Thank you,
> Zoltan
> 
> -Original Message-
> From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Zoltán 
> Balogh
> Sent: Tuesday, March 01, 2016 1:41 PM
> To: Ben Pfaff
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable 
> flag as link aliveness
> 
> Hi Ben,
> 
> This small patch modifies the port_run( ) function in ofproto_dpif. This 
> function is invoked indirectly from ofproto_run() when ofproto_class->run() 
> is called.
> Sending of OFPT_PORT_STATUS message can be triggered by invoking 
> update_port() in ofproto.
> 
> I tried to create a 'call tree' that shows where the LIVE bit is set/cleared 
> and where OFPT_PORT_STATUS message can be sent to a controller. 
> We start from the main loop, that invokes bridge_run(), xxx_run(), 
> xxx_wait(), poll_block() and so on.
> I used exclamation mark (!) to indicate where LIVE bit can be updated if 
> needed and asterisk (*) to show where OFPT_PORT_STATUS can be sent via 
> update_port().
> So, here comes the tree. It looks quite ugly in my outlook. It can be 
> copy-pasted to an editor with fixed width character set to get a better look.
> 
>main()
> -> bridge_run()
>  +-> bridge_run__()
>  | -> ofproto_run()
>  |  +-> ofproto_class->run() 
>  !   |  | -> port_run() # updates OFPUTIL_PS_LIVE bit if 
> needed !!!
>  |  |
>  |  +-> process_port_change()
>  |  | +-> reinit_ports()
>  *   |  | | -> update_port()
>  |  | |
>  *   |  | +-> update_port()
>  |  |
>  *   |  +-> update_port()  
>  |
>  +-> bridge_reconfigure() 
>+-> bridge_delete_or_reconfigure_ports()
>| -> ofproto_port_del()
>  * |  -> update_port()
>|
>+-> bridge_add_ports()
>| -> bridge_add_ports__()
>|  -> iface_create()
>|   +-> iface_do_create()
>|   | -> ofproto_port_add()
>  * |   |  -> update_port()
>|   |  
>|   +-> ofproto_port_add()
>  * | -> update_port()
>|
>+-> bridge_run__()
>  -> ofproto_run()
>   +-> ofproto_class->run() 
>  !| -> port_run() # updates OFPUTIL_PS_LIVE bit 
> if needed !!!
>   |
>   +-> process_port_change()
>   | +-> reinit_ports()
>  *| | -> update_port()
>   | |
>  *| +-> update_port()
>   |
>  *+-> update_port()
> 
> 
> So, you can see that LIVE bit is updated before update_port() can be called 
> in each cycle of the main loop. When update_port() is called, it verifies if 
> any properties of the port has changed. If it has then calls 
> ofport_modified() which sends port status message to the controller.
> 
> I did a test with ovs-testcontroller in verbose mode. I created a bridge, 
> added a physical port to it, then changed the port's state to up. 
> This is the controller ouput:
> 
> 2016-03-01T08:40:58Z|00050|vconn|DBG|tcp:19

Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-03-11 Thread Ben Pfaff
Can you briefly state the question you're asking?  I didn't know how to
respond to the previous email.

On Fri, Mar 11, 2016 at 10:42:26AM +, Zoltán Balogh wrote:
> Hi,
> 
> Could someone please respond to this e-mail or give any feedback?
> 
> Thank you,
> Zoltan
> 
> -Original Message-
> From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Zoltán Balogh
> Sent: Tuesday, March 01, 2016 1:41 PM
> To: Ben Pfaff
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as 
> link aliveness
> 
> Hi Ben,
> 
> This small patch modifies the port_run( ) function in ofproto_dpif. This 
> function is invoked indirectly from ofproto_run() when ofproto_class->run() 
> is called.
> Sending of OFPT_PORT_STATUS message can be triggered by invoking 
> update_port() in ofproto.
> 
> I tried to create a 'call tree' that shows where the LIVE bit is set/cleared 
> and where OFPT_PORT_STATUS message can be sent to a controller. 
> We start from the main loop, that invokes bridge_run(), xxx_run(), 
> xxx_wait(), poll_block() and so on.
> I used exclamation mark (!) to indicate where LIVE bit can be updated if 
> needed and asterisk (*) to show where OFPT_PORT_STATUS can be sent via 
> update_port().
> So, here comes the tree. It looks quite ugly in my outlook. It can be 
> copy-pasted to an editor with fixed width character set to get a better look.
> 
>main()
> -> bridge_run()
>  +-> bridge_run__()
>  | -> ofproto_run()
>  |  +-> ofproto_class->run() 
>  !   |  | -> port_run() # updates OFPUTIL_PS_LIVE bit if 
> needed !!!
>  |  |
>  |  +-> process_port_change()
>  |  | +-> reinit_ports()
>  *   |  | | -> update_port()
>  |  | |
>  *   |  | +-> update_port()
>  |  |
>  *   |  +-> update_port()  
>  |
>  +-> bridge_reconfigure() 
>+-> bridge_delete_or_reconfigure_ports()
>| -> ofproto_port_del()
>  * |  -> update_port()
>|
>+-> bridge_add_ports()
>| -> bridge_add_ports__()
>|  -> iface_create()
>|   +-> iface_do_create()
>|   | -> ofproto_port_add()
>  * |   |  -> update_port()
>|   |  
>|   +-> ofproto_port_add()
>  * | -> update_port()
>|
>+-> bridge_run__()
>  -> ofproto_run()
>   +-> ofproto_class->run() 
>  !| -> port_run() # updates OFPUTIL_PS_LIVE bit 
> if needed !!!
>   |
>   +-> process_port_change()
>   | +-> reinit_ports()
>  *| | -> update_port()
>   | |
>  *| +-> update_port()
>   |
>  *+-> update_port()
> 
> 
> So, you can see that LIVE bit is updated before update_port() can be called 
> in each cycle of the main loop. When update_port() is called, it verifies if 
> any properties of the port has changed. If it has then calls 
> ofport_modified() which sends port status message to the controller.
> 
> I did a test with ovs-testcontroller in verbose mode. I created a bridge, 
> added a physical port to it, then changed the port's state to up. 
> This is the controller ouput:
> 
> 2016-03-01T08:40:58Z|00050|vconn|DBG|tcp:192.168.2.145:42767: received: 
> OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): addr:aa:55:aa:55:00:07
>  config: 0
>  state:  LINK_DOWN
>  speed: 0 Mbps now, 0 Mbps max
> 2016-03-01T08:40:58Z|00051|learning_switch|DBG|6e81cdce5141: OpenFlow 
> packet ignored: OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): 
> addr:aa:55:aa:55:00:07
>  config: 0
>  state:  LINK_DOWN
>  speed: 0 Mbps now, 0 Mbps max
> 2016-03-01T08:40:58Z|00052|poll_loop|DBG|wakeup due to [POLLIN] on fd 8 
> (192.168.2.145:6653<->192.168.2.145:42767) at lib/stream-fd.c:155
> 2016-03-01T08:40:58Z|00053|vconn|DBG|tcp:192.168.2.145:42767: received: 
> OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): addr:aa:55:aa:55:00

Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-03-11 Thread Zoltán Balogh
Hi,

Could someone please respond to this e-mail or give any feedback?

Thank you,
Zoltan

-Original Message-
From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Zoltán Balogh
Sent: Tuesday, March 01, 2016 1:41 PM
To: Ben Pfaff
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link 
aliveness

Hi Ben,

This small patch modifies the port_run( ) function in ofproto_dpif. This 
function is invoked indirectly from ofproto_run() when ofproto_class->run() is 
called.
Sending of OFPT_PORT_STATUS message can be triggered by invoking update_port() 
in ofproto.

I tried to create a 'call tree' that shows where the LIVE bit is set/cleared 
and where OFPT_PORT_STATUS message can be sent to a controller. 
We start from the main loop, that invokes bridge_run(), xxx_run(), xxx_wait(), 
poll_block() and so on.
I used exclamation mark (!) to indicate where LIVE bit can be updated if needed 
and asterisk (*) to show where OFPT_PORT_STATUS can be sent via update_port().
So, here comes the tree. It looks quite ugly in my outlook. It can be 
copy-pasted to an editor with fixed width character set to get a better look.

   main()
-> bridge_run()
 +-> bridge_run__()
 | -> ofproto_run()
 |  +-> ofproto_class->run() 
 !   |  | -> port_run() # updates OFPUTIL_PS_LIVE bit if needed 
!!!
 |  |
 |  +-> process_port_change()
 |  | +-> reinit_ports()
 *   |  | | -> update_port()
 |  | |
 *   |  | +-> update_port()
 |  |
 *   |  +-> update_port()  
 |
 +-> bridge_reconfigure() 
   +-> bridge_delete_or_reconfigure_ports()
   | -> ofproto_port_del()
 * |  -> update_port()
   |
   +-> bridge_add_ports()
   | -> bridge_add_ports__()
   |  -> iface_create()
   |   +-> iface_do_create()
   |   | -> ofproto_port_add()
 * |   |  -> update_port()
   |   |  
   |   +-> ofproto_port_add()
 * | -> update_port()
   |
   +-> bridge_run__()
 -> ofproto_run()
  +-> ofproto_class->run() 
 !| -> port_run() # updates OFPUTIL_PS_LIVE bit if 
needed !!!
  |
  +-> process_port_change()
  | +-> reinit_ports()
 *| | -> update_port()
  | |
 *| +-> update_port()
  |
 *+-> update_port()


So, you can see that LIVE bit is updated before update_port() can be called in 
each cycle of the main loop. When update_port() is called, it verifies if any 
properties of the port has changed. If it has then calls ofport_modified() 
which sends port status message to the controller.

I did a test with ovs-testcontroller in verbose mode. I created a bridge, added 
a physical port to it, then changed the port's state to up. 
This is the controller ouput:

2016-03-01T08:40:58Z|00050|vconn|DBG|tcp:192.168.2.145:42767: received: 
OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): addr:aa:55:aa:55:00:07
 config: 0
 state:  LINK_DOWN
 speed: 0 Mbps now, 0 Mbps max
2016-03-01T08:40:58Z|00051|learning_switch|DBG|6e81cdce5141: OpenFlow 
packet ignored: OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): 
addr:aa:55:aa:55:00:07
 config: 0
 state:  LINK_DOWN
 speed: 0 Mbps now, 0 Mbps max
2016-03-01T08:40:58Z|00052|poll_loop|DBG|wakeup due to [POLLIN] on fd 8 
(192.168.2.145:6653<->192.168.2.145:42767) at lib/stream-fd.c:155
2016-03-01T08:40:58Z|00053|vconn|DBG|tcp:192.168.2.145:42767: received: 
OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): addr:aa:55:aa:55:00:07
 config: 0
 state:  LIVE
 speed: 0 Mbps now, 0 Mbps max
2016-03-01T08:40:58Z|00054|learning_switch|DBG|6e81cdce5141: OpenFlow 
packet ignored: OFPT_PORT_STATUS (OF1.3) (xid=0x0): MOD: 1(eth3): 
addr:aa:55:aa:55:00:07
 config: 0
 state:  LIVE
 speed: 0 Mbps now, 0 Mbps max


This is what ovs-ofctl shows before and after port state modification:

# ovs-ofctl show br
OFPT_FEATURES_REPLY (xid=0x2): dpid:6e81cdce5141 n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src 
mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_ds

Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-03-01 Thread Zoltán Balogh
 show br -OOpenFlow11
OFPT_FEATURES_REPLY (OF1.1) (xid=0x2): dpid:6e81cdce5141
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS 
ARP_MATCH_IP
 1(eth3): addr:aa:55:aa:55:00:07
 config: 0
 state:  LIVE
 speed: 0 Mbps now, 0 Mbps max
 LOCAL(br): addr:6e:81:cd:ce:51:41
 config: PORT_DOWN
 state:  LINK_DOWN
 speed: 0 Mbps now, 0 Mbps max
OFPT_GET_CONFIG_REPLY (OF1.1) (xid=0x4): frags=normal miss_send_len=0


Well, the strange thing is that the vswitch sends two OFPT_PORT_STATUS 
messages. The first one indicates LINK_DOWN, the second one LIVE state. I'm not 
sure if this we should see.

Best regards,
Zoltan

-Original Message-
From: Ben Pfaff [mailto:b...@ovn.org] 
Sent: Monday, February 29, 2016 7:28 PM
To: Zoltán Balogh
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link 
aliveness

On Thu, Feb 11, 2016 at 02:29:07PM +, Zoltán Balogh wrote:
> Hi,
> 
> The idea is to use OFPPS_LIVE bit to propagate link aliveness state towards 
> the controller also when sending port status.
> The ofport->may_enable flag could be used for this purpose. I updated some 
> unit tests according to the changes of ofproto-dpif.
> 
> Signed-off-by: Zoltán Balogh 
> Co-authored-by: László Sürü 
> Signed-off-by: László Sürü 
> Co-authored-by: Jan Scheurich 
> Signed-off-by: Jan Scheurich 

Thank you for working on this!

This seems like a good start but I don't see anything that generates an 
OFPT_PORT_STATUS message when the LIVE bit gets set or unset.  OpenFlow 
requires that behavior:

   All port state bits are read-only and cannot be changed by the
   controller. When the port flags are changed, the switch must send an
   OFPT_PORT_STATUS message to notify the controller of the change.

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


Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-02-29 Thread Ben Pfaff
On Thu, Feb 11, 2016 at 02:29:07PM +, Zoltán Balogh wrote:
> Hi,
> 
> The idea is to use OFPPS_LIVE bit to propagate link aliveness state towards 
> the controller also when sending port status.
> The ofport->may_enable flag could be used for this purpose. I updated some 
> unit tests according to the changes of ofproto-dpif.
> 
> Signed-off-by: Zoltán Balogh 
> Co-authored-by: László Sürü 
> Signed-off-by: László Sürü 
> Co-authored-by: Jan Scheurich 
> Signed-off-by: Jan Scheurich 

Thank you for working on this!

This seems like a good start but I don't see anything that generates an
OFPT_PORT_STATUS message when the LIVE bit gets set or unset.  OpenFlow
requires that behavior:

   All port state bits are read-only and cannot be changed by the
   controller. When the port flags are changed, the switch must send an
   OFPT_PORT_STATUS message to notify the controller of the change.

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


Re: [ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-02-17 Thread Markus Magnusson

Hello,

Just adding info that the patch is about fixing "OVS seems to be missing 
an implementation of OFPPS_LIVE in OpenFlow port state ", as  
acknowledged by Ben in 
http://openvswitch.org/pipermail/dev/2014-August/044926.html 



Brs Markus

On 02/11/2016 03:29 PM, Zoltán Balogh wrote:

Hi,

The idea is to use OFPPS_LIVE bit to propagate link aliveness state towards the 
controller also when sending port status.
The ofport->may_enable flag could be used for this purpose. I updated some unit 
tests according to the changes of ofproto-dpif.

Signed-off-by: Zoltán Balogh 
Co-authored-by: László Sürü 
Signed-off-by: László Sürü 
Co-authored-by: Jan Scheurich 
Signed-off-by: Jan Scheurich 

---

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 44e7bbc..9c1b7c9 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3398,6 +3398,13 @@ port_run(struct ofport_dpif *ofport)
  }
  
  ofport->may_enable = enable;

+
+/* Propagate the may_enable flag as link liveness. */
+if (ofport->may_enable) {
+ofport->up.pp.state |= OFPUTIL_PS_LIVE;
+} else {
+ofport->up.pp.state &= ~OFPUTIL_PS_LIVE;
+}
  }
  
  static int

diff --git a/tests/ofproto.at b/tests/ofproto.at
index 52e1ab4..ec169ae 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -770,15 +770,15 @@ AT_CLEANUP
  AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
  OVS_VSWITCHD_START
  for command_config_state in \
-'up 0 0' \
+'up 0 LIVE' \
  'down PORT_DOWN LINK_DOWN' \
  'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
  'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
  'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
  'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
  'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
-'up NO_RECV 0' \
-'receive 0 0'
+'up NO_RECV LIVE' \
+'receive 0 LIVE'
  do
  set $command_config_state
  command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
@@ -801,15 +801,15 @@ AT_CLEANUP
  AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
  OVS_VSWITCHD_START
  for command_config_state in \
-'up 0 0' \
+'up 0 LIVE' \
  'down PORT_DOWN LINK_DOWN' \
  'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
  'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
  'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
  'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
  'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
-'up NO_RECV 0' \
-'receive 0 0'
+'up NO_RECV LIVE' \
+'receive 0 LIVE'
  do
  set $command_config_state
  command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
@@ -2831,7 +2831,7 @@ 
udp,vlan_tci=0x,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
   speed: 0 Mbps now, 0 Mbps max
  OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
   config: 0
- state:  0
+ state:  LIVE
   speed: 0 Mbps now, 0 Mbps max"
  fi
  
@@ -2840,7 +2840,7 @@ OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x

  if test X"$1" = X"OFPPR_DELETE"; then shift;
  echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): 
addr:aa:55:aa:55:00:0x
   config: 0
- state:  0
+ state:  LIVE
   speed: 0 Mbps now, 0 Mbps max"
  fi
  
@@ -2935,7 +2935,7 @@ check_async () {

   speed: 0 Mbps now, 0 Mbps max
  OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
   config: 0
- state:  0
+ state:  LIVE
   speed: 0 Mbps now, 0 Mbps max"
  fi
  
@@ -2944,7 +2944,7 @@ OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x

  if test X"$1" = X"OFPPR_DELETE"; then shift;
  echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): 
addr:aa:55:aa:55:00:0x
   config: 0
- state:  0
+ state:  LIVE
   speed: 0 Mbps now, 0 Mbps max"
  fi

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


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


[ovs-dev] [PATCH] ofproto-dpif : propagate may_enable flag as link aliveness

2016-02-11 Thread Zoltán Balogh
Hi,

The idea is to use OFPPS_LIVE bit to propagate link aliveness state towards the 
controller also when sending port status.
The ofport->may_enable flag could be used for this purpose. I updated some unit 
tests according to the changes of ofproto-dpif.

Signed-off-by: Zoltán Balogh 
Co-authored-by: László Sürü 
Signed-off-by: László Sürü 
Co-authored-by: Jan Scheurich 
Signed-off-by: Jan Scheurich 

---

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 44e7bbc..9c1b7c9 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3398,6 +3398,13 @@ port_run(struct ofport_dpif *ofport)
 }
 
 ofport->may_enable = enable;
+
+/* Propagate the may_enable flag as link liveness. */
+if (ofport->may_enable) {
+ofport->up.pp.state |= OFPUTIL_PS_LIVE;
+} else {
+ofport->up.pp.state &= ~OFPUTIL_PS_LIVE;
+}
 }
 
 static int
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 52e1ab4..ec169ae 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -770,15 +770,15 @@ AT_CLEANUP
 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
 OVS_VSWITCHD_START
 for command_config_state in \
-'up 0 0' \
+'up 0 LIVE' \
 'down PORT_DOWN LINK_DOWN' \
 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
-'up NO_RECV 0' \
-'receive 0 0'
+'up NO_RECV LIVE' \
+'receive 0 LIVE'
 do
 set $command_config_state
 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
@@ -801,15 +801,15 @@ AT_CLEANUP
 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
 OVS_VSWITCHD_START
 for command_config_state in \
-'up 0 0' \
+'up 0 LIVE' \
 'down PORT_DOWN LINK_DOWN' \
 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
-'up NO_RECV 0' \
-'receive 0 0'
+'up NO_RECV LIVE' \
+'receive 0 LIVE'
 do
 set $command_config_state
 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
@@ -2831,7 +2831,7 @@ 
udp,vlan_tci=0x,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
  speed: 0 Mbps now, 0 Mbps max
 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
  config: 0
- state:  0
+ state:  LIVE
  speed: 0 Mbps now, 0 Mbps max"
 fi
 
@@ -2840,7 +2840,7 @@ OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): 
addr:aa:55:aa:55:00:0x
 if test X"$1" = X"OFPPR_DELETE"; then shift;
 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): 
addr:aa:55:aa:55:00:0x
  config: 0
- state:  0
+ state:  LIVE
  speed: 0 Mbps now, 0 Mbps max"
 fi
 
@@ -2935,7 +2935,7 @@ check_async () {
  speed: 0 Mbps now, 0 Mbps max
 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
  config: 0
- state:  0
+ state:  LIVE
  speed: 0 Mbps now, 0 Mbps max"
 fi
 
@@ -2944,7 +2944,7 @@ OFPT_PORT_STATUS (OF1.5): MOD: 2(test): 
addr:aa:55:aa:55:00:0x
 if test X"$1" = X"OFPPR_DELETE"; then shift;
 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): 
addr:aa:55:aa:55:00:0x
  config: 0
- state:  0
+ state:  LIVE
  speed: 0 Mbps now, 0 Mbps max"
 fi

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