[ovs-dev] openflow-1.0 : handling of max_len = 0

Tetsuo NAKAGAWA nakagawa at mxc.nes.nec.co.jp
Thu Mar 4 02:28:06 UTC 2010


Hi.

I'm using Open vSwitch with openflow-1.0 branch.

A 'max_len' in struct ofp_action_output is explained as
follows in "OpenFlow Specification Version 1.0.0".

  5.2.4 Flow Action Structures
  
    (snip)
  
    An action_output has the following fields:
  
    /* Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
     * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
     * number of bytes to send. A 'max_len' of zero means no bytes of the
     * packet should be sent.*/
    struct ofp_action_output {
        uint16_t type;                 /* OFPAT_OUTPUT. */
        uint16_t len;                  /* Length is 8. */
        uint16_t port;                 /* Output port. */
        uint16_t max_len;              /* Max length to send to controller. */
    };
    OFP_ASSERT(sizeof(struct ofp_action_output) == 8);
  
    The max_len indicates the maximum amount of data from a packet that should
    be sent when the port is OFPP_CONTROLLER. If max_len is zero, the switch must
    send a zero-size packet_in message. The port specifies the physical port from
    which packets should be sent.

But ovs-vswitchd (openflow-1.0 branch) send entire message
when max_len is 0.

OpenFlow Specification Version 0.8.9 has required send
entire message as follows  when a 'max_len' is 0.

  5.2.3 Flow Action Structures

    (snip)

    The max_len indicates the maximum amount of data from a packet that should
    be sent when the port is OFPP_CONTROLLER. If max_len is zero, then the entire
    packet should be sent. The port specifies the physical port from which packet
    packets should be sent.

I think following patch is needed to support to OpenFlow 1.0.0.

  diff -ru ./openvswitch-openflow-1.0_20100302.org/lib/ofp-print.c ./openvswitch-openflow-1.0_20100302/lib/ofp-print.c
  --- ./openvswitch-openflow-1.0_20100302.org/lib/ofp-print.c     2010-02-21 11:50:53.000000000 +0900
  +++ ./openvswitch-openflow-1.0_20100302/lib/ofp-print.c 2010-03-02 15:45:15.000000000 +0900
  @@ -294,13 +294,8 @@
               ds_put_format(string, "output:%"PRIu16, port);
           } else {
               ofp_print_port_name(string, port);
  -            if (port == OFPP_CONTROLLER) {
  -                if (oa->max_len) {
  -                    ds_put_format(string, ":%"PRIu16, ntohs(oa->max_len));
  -                } else {
  -                    ds_put_cstr(string, ":all");
  -                }
  -            }
  +            if (port == OFPP_CONTROLLER) 
  +                ds_put_format(string, ":%"PRIu16, ntohs(oa->max_len));
           }
           break;
       }
  diff -ru ./openvswitch-openflow-1.0_20100302.org/ofproto/ofproto.c ./openvswitch-openflow-1.0_20100302/ofproto/ofproto.c
  --- ./openvswitch-openflow-1.0_20100302.org/ofproto/ofproto.c   2010-02-21 11:50:53.000000000 +0900
  +++ ./openvswitch-openflow-1.0_20100302/ofproto/ofproto.c       2010-03-02 15:43:03.000000000 +0900
  @@ -1959,7 +1959,7 @@
                         const struct ofp_action_output *oao)
   {
       union odp_action *a = odp_actions_add(actions, ODPAT_CONTROLLER);
  -    a->controller.arg = oao->max_len ? ntohs(oao->max_len) : UINT32_MAX;
  +    a->controller.arg = ntohs(oao->max_len);
   }
   
   struct action_xlate_ctx {


best regards,

--- Tetsuo NAKAGAWA





More information about the dev mailing list