7.2 Common Structures
7.2.1 Port Structures
7.2.1.2 Port Description Properties
The list of port description property types that are currently defined are:
/* Port description property types. */
enum ofp_port_desc_prop_type {
OFPPDPT_ETHERNET = 0, /* Ethernet property. */
OFPPDPT_OPTICAL = 1, /* Optical property. */
OFPPDPT_PIPELINE_INPUT = 2, /* Ingress pipeline fields. */
OFPPDPT_PIPELINE_OUTPUT = 3, /* Egress pipeline fields. */
OFPPDPT_RECIRCULATE = 4, /* Recirculation property. */
OFPPDPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
A property definition contains the property type, length, and any associated data:
/* Common header for all port description properties. */ struct ofp_port_desc_prop_header {
uint16_t type; /* One of OFPPDPT_*. */
uint16_t length; /* Length in bytes of this property. */
};
OFP_ASSERT(sizeof(struct ofp_port_desc_prop_header) == 4);
The OFPPDPT_ETHERNET property uses the following structure and fields:
/* Ethernet port description property. */ struct ofp_port_desc_prop_ethernet {
uint16_t type; /* OFPPDPT_ETHERNET. */
uint16_t length; /* Length in bytes of this property. */
uint8_t pad[4]; /* Align to 64 bits. */
/* Bitmaps of OFPPF_* that describe features. All bits zeroed if * unsupported or unavailable. */
uint32_t curr; /* Current features. */
uint32_t advertised; /* Features being advertised by the port. */
uint32_t supported; /* Features supported by the port. */
The curr, advertised, supported, and peer fields indicate link modes (speed and duplexity), link type (copper/fiber) and link features (autonegotiation and pause). Port features are represented by the following structure:
/* Features of ports available in a datapath. */ enum ofp_port_features {
OFPPF_10MB_HD = 1 << 0, /* 10 Mb half-duplex rate support. */ OFPPF_10MB_FD = 1 << 1, /* 10 Mb full-duplex rate support. */ OFPPF_100MB_HD = 1 << 2, /* 100 Mb half-duplex rate support. */ OFPPF_100MB_FD = 1 << 3, /* 100 Mb full-duplex rate support. */ OFPPF_1GB_HD = 1 << 4, /* 1 Gb half-duplex rate support. */ OFPPF_1GB_FD = 1 << 5, /* 1 Gb full-duplex rate support. */ OFPPF_10GB_FD = 1 << 6, /* 10 Gb full-duplex rate support. */ OFPPF_40GB_FD = 1 << 7, /* 40 Gb full-duplex rate support. */ OFPPF_100GB_FD = 1 << 8, /* 100 Gb full-duplex rate support. */ OFPPF_1TB_FD = 1 << 9, /* 1 Tb full-duplex rate support. */ OFPPF_OTHER = 1 << 10, /* Other rate, not in the list. */ OFPPF_COPPER = 1 << 11, /* Copper medium. */
OFPPF_FIBER = 1 << 12, /* Fiber medium. */ OFPPF_AUTONEG = 1 << 13, /* Auto-negotiation. */ OFPPF_PAUSE = 1 << 14, /* Pause. */
OFPPF_PAUSE_ASYM = 1 << 15 /* Asymmetric pause. */ };
Multiple of these flags may be set simultaneously. If none of the port speed flags are set, the max_speed or curr_speed are used.
The curr_speed and max_speed fields indicate the current and maximum bit rate (raw transmission speed) of the link in kbps. The number should be rounded to match common usage. For example, an optical 10 Gb/s Ethernet port should have this field set to 10000000 (instead of 10312500), and an OC-192 port should have this field set to 10000000 (instead of 9953280).
The max_speed fields indicate the maximum configured capacity of the link, whereas the curr_speed indicates the current capacity. If the port is a LAG with 3 links of 1 Gb/s capacity, with one of the ports of the LAG being down, one port auto-negotiated at 1 Gb/s and 1 port auto-negotiated at 100 Mb/s, the max_speed is 3 Gb/s and the curr_speed is 1.1 Gb/s.
The OFPPDPT_OPTICAL property uses the following structure and fields:
/* Optical port description property. */ struct ofp_port_desc_prop_optical {
uint16_t type; /* OFPPDPT_3OPTICAL. */
uint16_t length; /* Length in bytes of this property. */
uint8_t pad[4]; /* Align to 64 bits. */
uint32_t supported; /* Features supported by the port. */
uint32_t tx_min_freq_lmda; /* Minimum TX Frequency/Wavelength */
uint32_t tx_max_freq_lmda; /* Maximum TX Frequency/Wavelength */
uint32_t tx_grid_freq_lmda; /* TX Grid Spacing Frequency/Wavelength */
uint32_t rx_min_freq_lmda; /* Minimum RX Frequency/Wavelength */
uint32_t rx_max_freq_lmda; /* Maximum RX Frequency/Wavelength */
uint32_t rx_grid_freq_lmda; /* RX Grid Spacing Frequency/Wavelength */
uint16_t tx_pwr_max; /* Maximum TX power */ };
OFP_ASSERT(sizeof(struct ofp_port_desc_prop_optical) == 40);
The minimum, maximum, and grid spacing are specified for both transmit and receive optical ports as either a frequency in MHz or wavelength (lambda) as nm * 100. For ports that are not tunable, the minimum and maximum values will be identical and specify the fixed value. The tx_pwr_min and tx_pwr_maxare dBm * 10. The optical port features are specified as follows:
/* Features of optical ports available in switch. */ enum ofp_optical_port_features {
OFPOPF_RX_TUNE = 1 << 0, /* Receiver is tunable */ OFPOPF_TX_TUNE = 1 << 1, /* Transmit is tunable */ OFPOPF_TX_PWR = 1 << 2, /* Power is configurable */
OFPOPF_USE_FREQ = 1 << 3, /* Use Frequency, not wavelength */ };
The OFPOPF_RX_TUNE indicates the port receive function is able to tune, the OFPOPF_TX_TUNE indicates the port transmit function is able to tune. The OFPOPF_TX_PWR indicates the transmit power can be set. The OFPOPF_USE_FREQ indicates frequency must be used instead of wavelength for description of the port tuning. It is highly important that the same tuning domain (frequency or wavelength) is used as indicated, since conversion between wavelength and frequency is often prone to error due to the range of the values.
The OFPPDPT_PIPELINE_INPUT and OFPPDPT_PIPELINE_OUTPUT properties uses the following structure and fields:
/* Ingress or egress pipeline fields. */ struct ofp_port_desc_prop_oxm {
uint16_t type; /* One of OFPPDPT_PIPELINE_INPUT or
OFPPDPT_PIPELINE_OUTPUT. */
uint16_t length; /* Length in bytes of this property. */
/* Followed by:
* - Exactly (length - 4) bytes containing the oxm_ids, then
* - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
* bytes of all-zero bytes */
uint32_t oxm_ids[0]; /* Array of OXM headers */
};
OFP_ASSERT(sizeof(struct ofp_port_desc_prop_oxm) == 4);
The oxm_ids is a list of OXM types supported by the port (see 7.2.3.2). The elements of that list are 32-bit OXM headers for non-experimenter OXM fields or 64-bit OXM headers for experimenter OXM fields, those OXM fields don’t include any payload. The oxm_length field in OXM headers must be the length value defined for the OXM field, i.e. the payload length if the OXM field had a payload. For experimenter OXM fields with variable payload size, the oxm_length field must be the maximum length of the payload.
it receives based on internal processing. If OXM_OF_IN_PORT in the only pipeline field supported, this property does not need to be included.
The OFPPDPT_PIPELINE_OUTPUT property indicates the list of pipeline fields that are consumed by the port for packets that are output on that port (see 7.2.3.7). The port uses the values set in those pipeline fields for internal processing when forwarding packet. If no pipeline field is supported, this property does not need to be included.
The OFPPDPT_RECIRCULATE property uses the following structure and fields:
/* Recirculate port description property. */ struct ofp_port_desc_prop_recirculate {
uint16_t type; /* OFPPDPT_RECIRCULATE. */
uint16_t length; /* Length in bytes of the property,
including this header, excluding padding. */ /* Followed by:
* - Exactly (length - 4) bytes containing the port numbers, then
* - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
* bytes of all-zero bytes */
uint32_t port_nos[0]; /* List of recirculated input port numbers.
0 or more. The number of port numbers is inferred from the length field in the header. */
};
OFP_ASSERT(sizeof(struct ofp_port_desc_prop_recirculate) == 4);
The port_nos field is the list of input ports where a packet output on the present port can be recirculated back into the OpenFlow pipeline (see 4.7). This property must be used only when the port recirculates packets back to the OpenFlow pipeline, other ports must not used this property. For a loopback or unidirectional service returning on the same port, this field would only include the present port number. For an encapsulation/decapsulation service or other bidirectional services, this field would include the other port number representing the other side of the service. If the recirculation can return via an arbitrary port number, the list would be empty.
The OFPPDPT_EXPERIMENTER property uses the following structure and fields:
/* Experimenter port description property. */ struct ofp_port_desc_prop_experimenter {
uint16_t type; /* OFPPDPT_EXPERIMENTER. */
uint16_t length; /* Length in bytes of this property. */
uint32_t experimenter; /* Experimenter ID which takes the same
form as in struct
ofp_experimenter_header. */
uint32_t exp_type; /* Experimenter defined. */
/* Followed by:
* - Exactly (length - 12) bytes containing the experimenter data, then
* - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
* bytes of all-zero bytes */
uint32_t experimenter_data[0];
};
OFP_ASSERT(sizeof(struct ofp_port_desc_prop_experimenter) == 12);
The experimenter field is the Experimenter ID, which takes the same form as in the typical experi- menter structure (see 7.2.8).