ROFL-pipeline  v0.6.0dev
Data Structures | Macros | Typedefs | Enumerations | Functions
switch_port.h File Reference

Port abstraction and API. More...

#include <stdbool.h>
#include <inttypes.h>
#include "rofl.h"
#include "port_queue.h"
#include "common/bitmap.h"
#include "platform/lock.h"

Go to the source code of this file.

Data Structures

struct  port_stats
 Port stats. More...
 
struct  switch_port
 Port abstraction. More...
 
struct  logical_switch_port
 
struct  __switch_port_name
 List of ports name (snapshots) More...
 
struct  switch_port_name_list
 

Macros

#define SW_PORT_ETH_ALEN   6
 
#define SWITCH_PORT_MAX_LEN_NAME   32
 
#define SWITCH_PORT_MAX_QUEUES   16
 

Typedefs

typedef enum port_features port_features_t
 Port features. More...
 
typedef void platform_port_state_t
 
typedef struct port_stats port_stats_t
 Port stats. More...
 
typedef enum port_type port_type_t
 Port type enumeration. More...
 
typedef struct switch_port switch_port_t
 Port abstraction. More...
 
typedef enum
logical_switch_port_attachment_state 
logical_switch_port_attachment_state_t
 
typedef struct logical_switch_port logical_switch_port_t
 
typedef switch_port_t switch_port_snapshot_t
 Snapshot of the port. More...
 
typedef struct __switch_port_name __switch_port_name_t
 List of ports name (snapshots) More...
 
typedef struct
switch_port_name_list 
switch_port_name_list_t
 

Enumerations

enum  port_state_t { PORT_STATE_NONE = 0 << 0, PORT_STATE_LINK_DOWN = 1 << 0, PORT_STATE_BLOCKED = 1 << 1, PORT_STATE_LIVE = 1 << 2 }
 Port state. More...
 
enum  port_features {
  PORT_FEATURE_10MB_HD = 1 << 0, PORT_FEATURE_10MB_FD = 1 << 1, PORT_FEATURE_100MB_HD = 1 << 2, PORT_FEATURE_100MB_FD = 1 << 3,
  PORT_FEATURE_1GB_HD = 1 << 4, PORT_FEATURE_1GB_FD = 1 << 5, PORT_FEATURE_10GB_FD = 1 << 6, PORT_FEATURE_40GB_FD = 1 << 7,
  PORT_FEATURE_100GB_FD = 1 << 8, PORT_FEATURE_1TB_FD = 1 << 9, PORT_FEATURE_OTHER = 1 << 10, PORT_FEATURE_COPPER = 1 << 11,
  PORT_FEATURE_FIBER = 1 << 12, PORT_FEATURE_AUTONEG = 1 << 13, PORT_FEATURE_PAUSE = 1 << 14, PORT_FEATURE_PAUSE_ASYM = 1 << 15
}
 Port features. More...
 
enum  port_type {
  PORT_TYPE_INVALID = 0, PORT_TYPE_PHYSICAL = 1, PORT_TYPE_VIRTUAL = 2, PORT_TYPE_TUNNEL = 3,
  PORT_TYPE_META_FLOOD = 5, PORT_TYPE_META_IN_PORT = 6, PORT_TYPE_META_ALL = 7, PORT_TYPE_NF_NATIVE = 8,
  PORT_TYPE_NF_SHMEM = 9, PORT_TYPE_NF_EXTERNAL = 10
}
 Port type enumeration. More...
 
enum  logical_switch_port_attachment_state { LOGICAL_PORT_STATE_FREE = 0, LOGICAL_PORT_STATE_ATTACHED = 1, LOGICAL_PORT_STATE_DETACHED = 2 }
 

Functions

ROFL_BEGIN_DECLS switch_port_tswitch_port_init (char *name, bool up, port_type_t type, port_state_t state)
 Init a switch_port structure. More...
 
rofl_result_t switch_port_destroy (switch_port_t *port)
 Destroy a switch_port structure. More...
 
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. More...
 
rofl_result_t switch_port_remove_queue (switch_port_t *port, uint32_t id)
 Remove queue from port. More...
 
void switch_port_add_capabilities (bitmap32_t *bitmap, bitmap32_t features)
 Adds capabilities to the port. More...
 
void switch_port_remove_capabilities (bitmap32_t *bitmap, bitmap32_t features)
 Removes capabilities to the port. More...
 
void switch_port_set_current_speed (switch_port_t *port, port_features_t speed)
 Sets current speed. More...
 
void switch_port_set_current_max_speed (switch_port_t *port, port_features_t speed)
 Sets current MAX speed. More...
 
switch_port_snapshot_t__switch_port_get_snapshot (switch_port_t *port)
 
switch_port_snapshot_tswitch_port_clone_snapshot (switch_port_snapshot_t *orig)
 Clone a snapshot. More...
 
void switch_port_destroy_snapshot (switch_port_snapshot_t *snapshot)
 Destroy a switch port snapshot. More...
 
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() More...
 

Detailed Description

Port abstraction and API.

Author
Marc Sune<marc.sune (at) bisdn.de>

Definition in file switch_port.h.

Typedef Documentation

List of ports name (snapshots)

Snapshot of the port.

Definition at line 228 of file switch_port.h.