ONLP
Open Network Linux Platform APIs
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
sfp.h File Reference

SFP Management Interface. More...

#include <onlp/onlp_config.h>
#include <onlp/onlp.h>
#include <onlp/oids.h>
#include <AIM/aim_bitmap.h>
#include <AIM/aim_pvs.h>
#include <sff/sff.h>
#include <sff/dom.h>

Go to the source code of this file.

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 []
 

Detailed Description

SFP Management Interface.