13 #ifndef __PHYSICAL_PORT_H__
14 #define __PHYSICAL_PORT_H__
28 #define SW_PORT_ETH_ALEN 6
29 #define SWITCH_PORT_MAX_LEN_NAME 32
30 #define SWITCH_PORT_MAX_QUEUES 16
37 PORT_STATE_NONE = 0 << 0,
38 PORT_STATE_LINK_DOWN = 1 << 0,
39 PORT_STATE_BLOCKED = 1 << 1,
40 PORT_STATE_LIVE = 1 << 2,
48 PORT_FEATURE_10MB_HD = 1 << 0,
49 PORT_FEATURE_10MB_FD = 1 << 1,
50 PORT_FEATURE_100MB_HD = 1 << 2,
51 PORT_FEATURE_100MB_FD = 1 << 3,
52 PORT_FEATURE_1GB_HD = 1 << 4,
53 PORT_FEATURE_1GB_FD = 1 << 5,
54 PORT_FEATURE_10GB_FD = 1 << 6,
55 PORT_FEATURE_40GB_FD = 1 << 7,
56 PORT_FEATURE_100GB_FD = 1 << 8,
57 PORT_FEATURE_1TB_FD = 1 << 9,
58 PORT_FEATURE_OTHER = 1 << 10,
60 PORT_FEATURE_COPPER = 1 << 11,
61 PORT_FEATURE_FIBER = 1 << 12,
62 PORT_FEATURE_AUTONEG = 1 << 13,
63 PORT_FEATURE_PAUSE = 1 << 14,
64 PORT_FEATURE_PAUSE_ASYM = 1 << 15
68 typedef void platform_port_state_t;
89 uint64_t rx_frame_err;
95 platform_mutex_t* mutex;
107 PORT_TYPE_INVALID = 0,
108 PORT_TYPE_PHYSICAL = 1,
109 PORT_TYPE_VIRTUAL = 2,
110 PORT_TYPE_TUNNEL = 3,
114 PORT_TYPE_META_FLOOD = 5,
115 PORT_TYPE_META_IN_PORT = 6,
116 PORT_TYPE_META_ALL = 7,
125 PORT_TYPE_NF_NATIVE = 8,
126 PORT_TYPE_NF_SHMEM = 9,
127 PORT_TYPE_NF_EXTERNAL = 10
148 uint8_t hwaddr[SW_PORT_ETH_ALEN];
155 bool forward_packets;
167 char name[SWITCH_PORT_MAX_LEN_NAME];
177 bitmap32_t advertised;
178 bitmap32_t supported;
186 unsigned int max_queues;
192 bool of_generate_packet_in;
200 bool is_attached_to_sw;
201 uint64_t attached_sw_dpid;
203 unsigned int of_port_num;
206 platform_mutex_t* mutex;
209 platform_port_state_t* platform_port_state;
213 typedef enum logical_switch_port_attachment_state{
214 LOGICAL_PORT_STATE_FREE = 0,
215 LOGICAL_PORT_STATE_ATTACHED = 1,
216 LOGICAL_PORT_STATE_DETACHED = 2
217 }logical_switch_port_attachment_state_t;
220 logical_switch_port_attachment_state_t attachment_state;
233 char name[SWITCH_PORT_MAX_LEN_NAME];
239 unsigned int num_of_ports;
337 #endif //PHYSICAL_PORT
OpenFlow-enabled switch abstraction (version-indepedent part).
Defines the locking interface used by the library. The user of the library MUST provide an implementa...
enum port_features port_features_t
Port features.
port_features
Port features.
void switch_port_destroy_snapshot(switch_port_snapshot_t *snapshot)
Destroy a switch port snapshot.
void switch_port_name_list_destroy(switch_port_name_list_t *list)
Destroys a port name list, previously generated by calling fwd_module_get_all_port_names() ...
void switch_port_set_current_speed(switch_port_t *port, port_features_t speed)
Sets current speed.
switch_port_snapshot_t * switch_port_clone_snapshot(switch_port_snapshot_t *orig)
Clone a snapshot.
List of ports name (snapshots)
struct port_stats port_stats_t
Port stats.
switch_port_t switch_port_snapshot_t
Snapshot of the port.
void switch_port_add_capabilities(bitmap32_t *bitmap, bitmap32_t features)
Adds capabilities to the port.
enum port_type port_type_t
Port type enumeration.
struct __switch_port_name __switch_port_name_t
List of ports name (snapshots)
ROFL_BEGIN_DECLS switch_port_t * switch_port_init(char *name, bool up, port_type_t type, port_state_t state)
Init a switch_port structure.
rofl_result_t switch_port_remove_queue(switch_port_t *port, uint32_t id)
Remove queue from port.
struct switch_port switch_port_t
Port abstraction.
port_type
Port type enumeration.
rofl_result_t switch_port_destroy(switch_port_t *port)
Destroy a switch_port structure.
Defines common bitmap operations, specially for large types.
rofl_result_t switch_port_add_queue(switch_port_t *port, uint32_t id, char *name, uint16_t length, uint16_t min_rate, uint16_t max_rate)
Add queue to port.
void switch_port_set_current_max_speed(switch_port_t *port, port_features_t speed)
Sets current MAX speed.
void switch_port_remove_capabilities(bitmap32_t *bitmap, bitmap32_t features)
Removes capabilities to the port.
Switch queue abstraction.