"Peter Phaal" <peter.ph...@inmon.com> writes:

> The following structure would add the needed support to sFlow:
>
> /* Extended OpenFlow data */
> /* opaque = flow_data; enterprise = 0; format = 1017 */ 
>
> struct extended_openflow {
>   opaque flow_cookie[8];
> }

It seems likely that OpenFlow will add the flow cookie as an
unsigned 64-bit integer.  Perhaps sFlow should use the same type,
if so.

> One possible addition is a bit array identifying the header fields that are
> being used to make the forwarding decision. OpenFlow currently forwards
> based on combinations of the following fields:
> 1. ingress port
> 2. VLAN
> 3. Priority
> 4. L2 source
> 5. L2 destination
> 6. L2 type
> 7. L3 source
> 8. L3 destination
> 9. L3 protocol
> 10. L4 source port
> 11. L4 destination port
> An unsigned int value would encode the 11 bits and leave room for future
> expansion. The bits would identify fields that were matched (1) or were
> wildcards (0).

OpenFlow has an existing type that it uses to encode the
wildcards for a flow.  It would be convenient for OpenFlow
implementors of sFlow if sFlow specified the same encoding:

/* Flow wildcards. */
enum ofp_flow_wildcards {
    OFPFW_IN_PORT  = 1 << 0,  /* Switch input port. */
    OFPFW_DL_VLAN  = 1 << 1,  /* VLAN. */
    OFPFW_DL_SRC   = 1 << 2,  /* Ethernet source address. */
    OFPFW_DL_DST   = 1 << 3,  /* Ethernet destination address. */
    OFPFW_DL_TYPE  = 1 << 4,  /* Ethernet frame type. */
    OFPFW_NW_PROTO = 1 << 5,  /* IP protocol. */
    OFPFW_TP_SRC   = 1 << 6,  /* TCP/UDP source port. */
    OFPFW_TP_DST   = 1 << 7,  /* TCP/UDP destination port. */

    /* IP source address wildcard bit count.  0 is exact match, 1 ignores the
     * LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard
     * the entire field.  This is the *opposite* of the usual convention where
     * e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded. */
    OFPFW_NW_SRC_SHIFT = 8,
    OFPFW_NW_SRC_BITS = 6,
    OFPFW_NW_SRC_MASK = ((1 << OFPFW_NW_SRC_BITS) - 1) << OFPFW_NW_SRC_SHIFT,
    OFPFW_NW_SRC_ALL = 32 << OFPFW_NW_SRC_SHIFT,

    /* IP destination address wildcard bit count.  Same format as source. */
    OFPFW_NW_DST_SHIFT = 14,
    OFPFW_NW_DST_BITS = 6,
    OFPFW_NW_DST_MASK = ((1 << OFPFW_NW_DST_BITS) - 1) << OFPFW_NW_DST_SHIFT,
    OFPFW_NW_DST_ALL = 32 << OFPFW_NW_DST_SHIFT,

    /* Wildcard all fields. */
    OFPFW_ALL = ((1 << 20) - 1)
};

> An OpenFlow switch may also rewrite packet fields (e.g. changing the VLAN,
> MAC address, IP address) if it is performing functions like NAT, tunneling
> etc. Again, a bit array could be used to identify the fields that are being
> rewritten. The value of rewritten fields should be reported using existing
> sflow structures (extended_switch, extended_nat etc.)

I agree that it would be a good idea to provide this information
in fields already included in sFlow.

Reply via email to