ONLP
Open Network Linux Platform APIs
|
Data Structures | |
struct | onlp_sfp_info_t |
Macros | |
#define | ONLP_SFP_BLOCK_DATA_SIZE 256 |
#define | ONLP_SFP_CONTROL_STRINGS |
#define | ONLP_SFP_CONTROL_VALID(_e) ( (0 <= (_e)) && ((_e) <= ONLP_SFP_CONTROL_POWER_OVERRIDE)) |
#define | ONLP_SFP_CONTROL_FLAG_VALID(_e) (onlp_sfp_control_flag_valid((_e))) |
#define | ONLP_SFP_TYPE_STRINGS |
#define | ONLP_SFP_TYPE_VALID(_e) ( (0 <= (_e)) && ((_e) <= ONLP_SFP_TYPE_QSFP28)) |
Typedefs | |
typedef enum onlp_sfp_control_e | onlp_sfp_control_t |
typedef enum onlp_sfp_control_flag_e | onlp_sfp_control_flag_t |
typedef enum onlp_sfp_type_e | onlp_sfp_type_t |
typedef struct onlp_sfp_info_t | onlp_sfp_info_t |
typedef aim_bitmap256_t | onlp_sfp_bitmap_t |
Enumerations | |
enum | onlp_sfp_control_e { ONLP_SFP_CONTROL_RESET, ONLP_SFP_CONTROL_RESET_STATE, ONLP_SFP_CONTROL_RX_LOS, ONLP_SFP_CONTROL_TX_FAULT, ONLP_SFP_CONTROL_TX_DISABLE, ONLP_SFP_CONTROL_TX_DISABLE_CHANNEL, ONLP_SFP_CONTROL_LP_MODE, ONLP_SFP_CONTROL_POWER_OVERRIDE, ONLP_SFP_CONTROL_LAST = ONLP_SFP_CONTROL_POWER_OVERRIDE, ONLP_SFP_CONTROL_COUNT, ONLP_SFP_CONTROL_INVALID = -1 } |
enum | onlp_sfp_control_flag_e { ONLP_SFP_CONTROL_FLAG_RESET = (1 << 0), ONLP_SFP_CONTROL_FLAG_RESET_STATE = (1 << 1), ONLP_SFP_CONTROL_FLAG_RX_LOS = (1 << 2), ONLP_SFP_CONTROL_FLAG_TX_FAULT = (1 << 3), ONLP_SFP_CONTROL_FLAG_TX_DISABLE = (1 << 4), ONLP_SFP_CONTROL_FLAG_TX_DISABLE_CHANNEL = (1 << 5), ONLP_SFP_CONTROL_FLAG_LP_MODE = (1 << 6), ONLP_SFP_CONTROL_FLAG_POWER_OVERRIDE = (1 << 7) } |
enum | onlp_sfp_type_e { ONLP_SFP_TYPE_SFP, ONLP_SFP_TYPE_QSFP, ONLP_SFP_TYPE_SFP28, ONLP_SFP_TYPE_QSFP28, ONLP_SFP_TYPE_LAST = ONLP_SFP_TYPE_QSFP28, ONLP_SFP_TYPE_COUNT, ONLP_SFP_TYPE_INVALID = -1 } |
Functions | |
int | onlp_sfp_sw_init (void) |
Software initialization of the SFP module. | |
int | onlp_sfp_hw_init (uint32_t flags) |
Hardware initialization of the SFP module. More... | |
int | onlp_sfp_sw_denit (void) |
Deinitialize the sfp software module. More... | |
void | onlp_sfp_bitmap_t_init (onlp_sfp_bitmap_t *bmap) |
int | onlp_sfp_bitmap_get (onlp_sfp_bitmap_t *bmap) |
Get the set of valid SFP ports. More... | |
int | onlp_sfp_info_get (onlp_oid_t port, onlp_sfp_info_t *info) |
Get the SFP information structure. More... | |
int | onlp_sfp_info_dom_get (onlp_oid_t port, onlp_sfp_info_t *info) |
Get the SFP information structure (including DOM) More... | |
int | onlp_sfp_hdr_get (onlp_oid_t port, onlp_oid_hdr_t *rv) |
Get the SFP's oid header. More... | |
int | onlp_sfp_port_valid (onlp_oid_t port) |
Determine if a given port number is a valid SFP port. More... | |
int | onlp_sfp_type_get (onlp_oid_t port, onlp_sfp_type_t *rtype) |
Determine the SFP Connector type. More... | |
int | onlp_sfp_is_present (onlp_oid_t port) |
Determine if an SFP is currently plugged in. More... | |
int | onlp_sfp_presence_bitmap_get (onlp_sfp_bitmap_t *dst) |
Return the presence bitmap for all ports. More... | |
int | onlp_sfp_rx_los_bitmap_get (onlp_sfp_bitmap_t *dst) |
Get the RX_LOS bitmap for all ports. More... | |
int | onlp_sfp_dev_read (onlp_oid_t port, int devaddr, int addr, uint8_t *dst, int count) |
Read bytes from the target device on the given SFP port. More... | |
int | onlp_sfp_dev_alloc_read (onlp_oid_t port, int devaddr, int addr, int count, uint8_t **rv) |
Read bytes from the target device on the given SFP port. More... | |
int | onlp_sfp_dev_write (onlp_oid_t port, int devaddr, int addr, uint8_t *src, int count) |
Write bytes to the target device on the given SFP port. More... | |
int | onlp_sfp_dev_readb (onlp_oid_t port, int devaddr, int addr) |
Read a byte from the target device on the given SFP port. More... | |
int | onlp_sfp_dev_writeb (onlp_oid_t port, int devaddr, int addr, uint8_t value) |
Write a byte to the target device on the given SFP port. More... | |
int | onlp_sfp_dev_readw (onlp_oid_t port, int devaddr, int addr) |
Read a word from the target device on the given SFP port. More... | |
int | onlp_sfp_dev_writew (onlp_oid_t port, int devaddr, int addr, uint16_t value) |
Write a word to the target device on the given SFP port. More... | |
int | onlp_sfp_post_insert (onlp_oid_t port, sff_info_t *info) |
Perform any actions required after an SFP is inserted. More... | |
int | onlp_sfp_control_set (onlp_oid_t port, onlp_sfp_control_t control, int value) |
Set an SFP control. More... | |
int | onlp_sfp_control_get (onlp_oid_t port, onlp_sfp_control_t control, int *value) |
Get an SFP control. More... | |
int | onlp_sfp_control_flags_get (onlp_oid_t port, uint32_t *flags) |
Get the value of all SFP controls. More... | |
int | onlp_sfp_info_to_user_json (onlp_sfp_info_t *info, cJSON **rv, uint32_t flags) |
Convert an SFP info structure to user JSON. More... | |
int | onlp_sfp_info_to_json (onlp_sfp_info_t *info, cJSON **rv, uint32_t flags) |
Convert an SFP info structure to JSON. More... | |
int | onlp_sfp_info_from_json (cJSON *cj, onlp_sfp_info_t *info) |
Convert a JSON object to an SFP info structure. More... | |
int | onlp_sfp_hw_denit (void) |
Hardware deinitialize the SFP subsystem. | |
int | onlp_sfp_inventory_show (aim_pvs_t *pvs) |
Show the current SFP inventory. | |
const char * | onlp_sfp_control_name (onlp_sfp_control_t e) |
int | onlp_sfp_control_value (const char *str, onlp_sfp_control_t *e, int substr) |
const char * | onlp_sfp_control_desc (onlp_sfp_control_t e) |
const char * | onlp_sfp_control_flag_name (onlp_sfp_control_flag_t e) |
int | onlp_sfp_control_flag_value (const char *str, onlp_sfp_control_flag_t *e, int substr) |
const char * | onlp_sfp_control_flag_desc (onlp_sfp_control_flag_t e) |
int | onlp_sfp_control_flag_valid (onlp_sfp_control_flag_t e) |
const char * | onlp_sfp_type_name (onlp_sfp_type_t e) |
int | onlp_sfp_type_value (const char *str, onlp_sfp_type_t *e, int substr) |
const char * | onlp_sfp_type_desc (onlp_sfp_type_t e) |
Variables | |
aim_map_si_t | onlp_sfp_control_map [] |
aim_map_si_t | onlp_sfp_control_desc_map [] |
aim_map_si_t | onlp_sfp_control_flag_map [] |
aim_map_si_t | onlp_sfp_control_flag_desc_map [] |
aim_map_si_t | onlp_sfp_type_map [] |
aim_map_si_t | onlp_sfp_type_desc_map [] |
#define ONLP_SFP_BLOCK_DATA_SIZE 256 |
SFP Block Data Size
#define ONLP_SFP_CONTROL_FLAG_VALID | ( | _e | ) | (onlp_sfp_control_flag_valid((_e))) |
validator
#define ONLP_SFP_CONTROL_STRINGS |
Strings macro.
#define ONLP_SFP_CONTROL_VALID | ( | _e | ) | ( (0 <= (_e)) && ((_e) <= ONLP_SFP_CONTROL_POWER_OVERRIDE)) |
validator
#define ONLP_SFP_TYPE_STRINGS |
Strings macro.
#define ONLP_SFP_TYPE_VALID | ( | _e | ) | ( (0 <= (_e)) && ((_e) <= ONLP_SFP_TYPE_QSFP28)) |
validator
typedef aim_bitmap256_t onlp_sfp_bitmap_t |
Valid SFP Port bitmaps are communicated using this type.
typedef enum onlp_sfp_control_flag_e onlp_sfp_control_flag_t |
onlp_sfp_control_flag
typedef enum onlp_sfp_control_e onlp_sfp_control_t |
onlp_sfp_control
typedef struct onlp_sfp_info_t onlp_sfp_info_t |
SFP Information Structure.
typedef enum onlp_sfp_type_e onlp_sfp_type_t |
onlp_sfp_type
enum onlp_sfp_control_e |
onlp_sfp_control
onlp_sfp_control_flag
enum onlp_sfp_type_e |
onlp_sfp_type
int onlp_sfp_bitmap_get | ( | onlp_sfp_bitmap_t * | bmap | ) |
Get the set of valid SFP ports.
bmap | Returns the valid set of SFP-capable port numbers. |
void onlp_sfp_bitmap_t_init | ( | onlp_sfp_bitmap_t * | bmap | ) |
Convenience function for initializing SFP bitmaps.
bmap | The address of the bitmap to initialize. |
const char* onlp_sfp_control_desc | ( | onlp_sfp_control_t | e | ) |
Enum descriptions.
const char* onlp_sfp_control_flag_desc | ( | onlp_sfp_control_flag_t | e | ) |
Enum descriptions.
const char* onlp_sfp_control_flag_name | ( | onlp_sfp_control_flag_t | e | ) |
Enum names.
int onlp_sfp_control_flag_valid | ( | onlp_sfp_control_flag_t | e | ) |
Enum validator.
int onlp_sfp_control_flag_value | ( | const char * | str, |
onlp_sfp_control_flag_t * | e, | ||
int | substr | ||
) |
Enum values.
int onlp_sfp_control_flags_get | ( | onlp_oid_t | port, |
uint32_t * | flags | ||
) |
Get the value of all SFP controls.
port | The port. |
flags | Receives the control flag values. See onlp_sfp_control_flags_t |
int onlp_sfp_control_get | ( | onlp_oid_t | port, |
onlp_sfp_control_t | control, | ||
int * | value | ||
) |
Get an SFP control.
port | The SFP Port ID. | |
control | The control | |
[out] | value | Receives the current value. |
const char* onlp_sfp_control_name | ( | onlp_sfp_control_t | e | ) |
Enum names.
int onlp_sfp_control_set | ( | onlp_oid_t | port, |
onlp_sfp_control_t | control, | ||
int | value | ||
) |
Set an SFP control.
port | The SFP Port ID. |
control | The control. |
value | The value. |
int onlp_sfp_control_value | ( | const char * | str, |
onlp_sfp_control_t * | e, | ||
int | substr | ||
) |
Enum values.
int onlp_sfp_dev_alloc_read | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr, | ||
int | count, | ||
uint8_t ** | rv | ||
) |
Read bytes from the target device on the given SFP port.
port | The SFP OID or Port ID. | |
devaddr | The device address. | |
addr | The start target address. | |
count | The number of bytes to read. | |
[out] | rv | Receives the allocated buffer. |
int onlp_sfp_dev_read | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr, | ||
uint8_t * | dst, | ||
int | count | ||
) |
Read bytes from the target device on the given SFP port.
port | The SFP OID or Port ID. |
devaddr | The device address. |
addr | The address to read. |
dst | Receives the data. |
count | The read length. |
int onlp_sfp_dev_readb | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr | ||
) |
Read a byte from the target device on the given SFP port.
port | The SFP Port ID. |
devaddr | The device address. |
addr | The read address. |
int onlp_sfp_dev_readw | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr | ||
) |
Read a word from the target device on the given SFP port.
port | The SFP Port ID. |
devaddr | The device address. |
addr | The read address. |
int onlp_sfp_dev_write | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr, | ||
uint8_t * | src, | ||
int | count | ||
) |
Write bytes to the target device on the given SFP port.
port | The SFP OID or Port ID. |
devaddr | The device address. |
addr | The address to write. |
src | The source data. |
count | The write length. |
int onlp_sfp_dev_writeb | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr, | ||
uint8_t | value | ||
) |
Write a byte to the target device on the given SFP port.
port | The SFP Port ID. |
devaddr | The device address. |
addr | The write address. |
value | The write value. |
int onlp_sfp_dev_writew | ( | onlp_oid_t | port, |
int | devaddr, | ||
int | addr, | ||
uint16_t | value | ||
) |
Write a word to the target device on the given SFP port.
port | The SFP Port ID. |
devaddr | The device address. |
addr | The write address. |
value | The write value. |
int onlp_sfp_hdr_get | ( | onlp_oid_t | port, |
onlp_oid_hdr_t * | rv | ||
) |
Get the SFP's oid header.
port | The SFP OID. | |
[out] | rv | Receives the header. |
int onlp_sfp_hw_init | ( | uint32_t | flags | ) |
Hardware initialization of the SFP module.
flags | The hardware initialization flags. |
int onlp_sfp_info_dom_get | ( | onlp_oid_t | port, |
onlp_sfp_info_t * | info | ||
) |
Get the SFP information structure (including DOM)
port | The SFP OID or Port ID. | |
[out] | info | Receives the information structure. |
int onlp_sfp_info_from_json | ( | cJSON * | cj, |
onlp_sfp_info_t * | info | ||
) |
Convert a JSON object to an SFP info structure.
cj | The JSON object. | |
[out] | info | Receives the SFP info structure. |
int onlp_sfp_info_get | ( | onlp_oid_t | port, |
onlp_sfp_info_t * | info | ||
) |
Get the SFP information structure.
port | The SFP OID or Port ID. | |
[out] | info | Receives the information structure. |
int onlp_sfp_info_to_json | ( | onlp_sfp_info_t * | info, |
cJSON ** | rv, | ||
uint32_t | flags | ||
) |
Convert an SFP info structure to JSON.
info | The SFP info structure. | |
[out] | rv | Receives the JSON object. |
flags | The JSON format flags. |
int onlp_sfp_info_to_user_json | ( | onlp_sfp_info_t * | info, |
cJSON ** | rv, | ||
uint32_t | flags | ||
) |
Convert an SFP info structure to user JSON.
info | The SFP info structure. | |
[out] | rv | Receives the JSON object. |
flags | The JSON format flags. |
int onlp_sfp_is_present | ( | onlp_oid_t | port | ) |
Determine if an SFP is currently plugged in.
port | The SFP port number. |
int onlp_sfp_port_valid | ( | onlp_oid_t | port | ) |
Determine if a given port number is a valid SFP port.
port | The port number. |
int onlp_sfp_post_insert | ( | onlp_oid_t | port, |
sff_info_t * | info | ||
) |
Perform any actions required after an SFP is inserted.
port | The SFP Port ID. |
info | The SFF Module information structure. |
int onlp_sfp_presence_bitmap_get | ( | onlp_sfp_bitmap_t * | dst | ) |
Return the presence bitmap for all ports.
dst | The receives the presence bitmap for all ports. |
int onlp_sfp_rx_los_bitmap_get | ( | onlp_sfp_bitmap_t * | dst | ) |
Get the RX_LOS bitmap for all ports.
dst | Receives the RX_LOS bitmap for all ports. |
int onlp_sfp_sw_denit | ( | void | ) |
Deinitialize the sfp software module.
Software deinitialize the SFP subsystem.
const char* onlp_sfp_type_desc | ( | onlp_sfp_type_t | e | ) |
Enum descriptions.
int onlp_sfp_type_get | ( | onlp_oid_t | port, |
onlp_sfp_type_t * | rtype | ||
) |
Determine the SFP Connector type.
port | The port number. | |
[out] | rtype | Receives the type. |
const char* onlp_sfp_type_name | ( | onlp_sfp_type_t | e | ) |
Enum names.
int onlp_sfp_type_value | ( | const char * | str, |
onlp_sfp_type_t * | e, | ||
int | substr | ||
) |
Enum values.
aim_map_si_t onlp_sfp_control_desc_map[] |
onlp_sfp_control_desc_map table.
aim_map_si_t onlp_sfp_control_flag_desc_map[] |
onlp_sfp_control_flag_desc_map table.
aim_map_si_t onlp_sfp_control_flag_map[] |
onlp_sfp_control_flag_map table.
aim_map_si_t onlp_sfp_control_map[] |
onlp_sfp_control_map table.
aim_map_si_t onlp_sfp_type_desc_map[] |
onlp_sfp_type_desc_map table.
aim_map_si_t onlp_sfp_type_map[] |
onlp_sfp_type_map table.