sfp

package
v1.2.0-rc.1.0...-65ced95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: GPL-2.0, GPL-2.0-or-later Imports: 7 Imported by: 0

Documentation

Overview

Example
m := &QsfpModule{
	BusIndex:   10,
	BusAddress: 20,
}
m.Present()
fmt.Printf("%+v\n", m)
Output:

Index

Examples

Constants

View Source
const (
	TemperatureToCelsius = 1 / 256.
	SupplyVoltageToVolts = 100e-6
	RxPowerToWatts       = 1e-4
	TxPowerToWatts       = 1e-4
	TxBiasCurrentToAmps  = 2e-3
)
View Source
const (
	Log2Compliance40GXLPPI, Compliance40GXLPPI = iota, 1 << iota
	Log2Compliance40G_LR, Compliance40G_LR
	Log2Compliance40G_SR, Compliance40G_SR
	Log2Compliance40G_CR, Compliance40G_CR
	Log2Compliance10G_SR, Compliance10G_SR
	Log2Compliance10G_LR, Compliance10G_LR
	Log2Compliance10G_LRM, Compliance10G_LRM
	Log2ComplianceExtendedValid, ComplianceExtendedValid
)
View Source
const (
	ExtendedComplianceUnspecified      = iota
	ExtendedCompliance100G_AOC_BER_5e5 // 01h 100G_AOC (Active Optical Cable) or 25GAUI C2M AOC. Providing a worst BER of 5 × 10^(-5)
	ExtendedCompliance100G_SR          // 02h 100GBASE-SR4 or 25GBASE-SR
	ExtendedCompliance100G_LR          // 03h 100GBASE-LR4 or 25GBASE-LR
	ExtendedCompliance100G_ER          // 04h 100GBASE-ER4 or 25GBASE-ER
	ExtendedCompliance100G_SR10        // 05h 100GBASE-SR10
	ExtendedCompliance100G_CWDM4       // 06h 100G CWDM4
	ExtendedCompliance100G_PSM4        // 07h 100G PSM4 Parallel SMF
	ExtendedCompliance100G_ACC_BER_5e5 // 08h 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. Providing a worst BER of 5 × 10^(-5)

	ExtendedCompliance100G_CR     // 0Bh 100GBASE-CR4 or 25GBASE-CR CA-L
	ExtendedCompliance25G_CR_CA_S // 0Ch 25GBASE-CR CA-S
	ExtendedCompliance25G_CR_CA_N // 0Dh 25GBASE-CR CA-N

	ExtendedCompliance40G_ER            // 10h 40GBASE-ER4
	ExtendedCompliance4x10G_SR          // 11h 4 x 10GBASE-SR
	ExtendedCompliance40G_PSM4          // 12h 40G PSM4 Parallel SMF
	ExtendedComplianceG959_1_P1I1_2D1   // 13h G959.1 profile P1I1-2D1 (10709 MBd, 2km, 1310nm SM)
	ExtendedComplianceG959_1_P1S1_2D2   // 14h G959.1 profile P1S1-2D2 (10709 MBd, 40km, 1550nm SM)
	ExtendedComplianceG959_1_P1L1_2D2   // 15h G959.1 profile P1L1-2D2 (10709 MBd, 80km, 1550nm SM)
	ExtendedCompliance10GBASE_T         // 16h 10GBASE-T with SFI electrical interface
	ExtendedCompliance100G_CLR4         // 17h 100G CLR4
	ExtendedCompliance100G_AOC_BER_1e12 // 18h 100G AOC or 25GAUI C2M AOC. Providing a worst BER of 10^(-12) or below
	ExtendedCompliance100G_ACC_BER_1e12 // 19h 100G ACC or 25GAUI C2M ACC. Providing a worst BER of 10^(-12) or below
	ExtendedCompliance100GE_DWDM2       // 1Ah 100GE-DWDM2 (DWDM transceiver using 2 wavelengths on a 1550nm DWDM grid with a reach up to 80km)
)
View Source
const QsfpNChannel = 4

Variables

View Source
var DynamicMonitoringRedisFields = []string{
	"qsfp.alarms.module",
	"qsfp.alarms.channels",
	"qsfp.rx1.power.units.mW",
	"qsfp.rx2.power.units.mW",
	"qsfp.rx3.power.units.mW",
	"qsfp.rx4.power.units.mW",
	"qsfp.temperature.units.C",
	"qsfp.vcc.units.V",
	"qsfp.tx1.bias.units.mA",
	"qsfp.tx1.power.units.mW",
	"qsfp.tx2.bias.units.mA",
	"qsfp.tx2.power.units.mW",
	"qsfp.tx3.bias.units.mA",
	"qsfp.tx3.power.units.mW",
	"qsfp.tx4.bias.units.mA",
	"qsfp.tx4.power.units.mW",
}
View Source
var StaticMonitoringRedisFields = []string{
	"qsfp.rx.power.highAlarmThreshold.units.mW",
	"qsfp.rx.power.highWarnThreshold.units.mW",
	"qsfp.rx.power.lowAlarmThreshold.units.mW",
	"qsfp.rx.power.lowWarnThreshold.units.mW",
	"qsfp.temperature.highAlarmThreshold.units.C",
	"qsfp.temperature.highWarnThreshold.units.C",
	"qsfp.temperature.lowAlarmThreshold.units.C",
	"qsfp.temperature.lowWarnThreshold.units.C",
	"qsfp.tx.bias.highAlarmThreshold.units.mA",
	"qsfp.tx.bias.highWarnThreshold.units.mA",
	"qsfp.tx.bias.lowAlarmThreshold.units.mA",
	"qsfp.tx.bias.lowWarnThreshold.units.mA",
	"qsfp.tx.power.highAlarmThreshold.units.mW",
	"qsfp.tx.power.highWarnThreshold.units.mW",
	"qsfp.tx.power.lowAlarmThreshold.units.mW",
	"qsfp.tx.power.lowWarnThreshold.units.mW",
	"qsfp.vcc.highAlarmThreshold.units.V",
	"qsfp.vcc.highWarnThreshold.units.V",
	"qsfp.vcc.lowAlarmThreshold.units.V",
	"qsfp.vcc.lowWarnThreshold.units.V",
}
View Source
var StaticRedisFields = []string{
	"qsfp.id",
	"qsfp.compliance",
	"qsfp.partnumber",
	"qsfp.presence",
	"qsfp.serialnumber",
	"qsfp.vendor",
	"qsfp.connectortype",
}

Functions

This section is empty.

Types

type Access

type Access interface {
	// Activate/deactivate module reset.
	SfpReset(active bool)
	// Enable/disable low power mode.
	SfpSetLowPowerMode(enable bool)
	SfpReadWrite(offset uint, p []uint8, isWrite bool) (ok bool)
}

type ChannelRxPowerInterrupts

type ChannelRxPowerInterrupts uint16

func (ChannelRxPowerInterrupts) String

func (i ChannelRxPowerInterrupts) String() string

type ChannelStatusInterrupt

type ChannelStatusInterrupt uint16

func (ChannelStatusInterrupt) String

func (i ChannelStatusInterrupt) String() string

type ChannelStatusLOL

type ChannelStatusLOL byte

func (ChannelStatusLOL) String

func (i ChannelStatusLOL) String() string

type ChannelTxBiasInterrupts

type ChannelTxBiasInterrupts uint16

func (ChannelTxBiasInterrupts) String

func (i ChannelTxBiasInterrupts) String() string

type ChannelTxPowerInterrupts

type ChannelTxPowerInterrupts uint16

func (ChannelTxPowerInterrupts) String

func (i ChannelTxPowerInterrupts) String() string

type Compliance

type Compliance byte

func (Compliance) String

func (i Compliance) String() string

type ConnectorType

type ConnectorType reg8
const (
	ConnectorUnknown ConnectorType = iota
	ConnectorSubscriber
	ConnectorFibreChannelStyle1
	ConnectorFibreChannelStyle2
	ConnectorBNCTNC
	ConnectorFibreChannelCoax
	ConnectorFiberJack
	ConnectorLucent
	ConnectorMTRJ
	ConnectorMU
	ConnectorSG
	ConnectorOpticalPigtail
	ConnectorMPO1x12
	ConnectorMPO2x16
	ConnectorHSSDC2               ConnectorType = 0x20
	ConnectorCopperPigtail        ConnectorType = 0x21
	ConnectorRJ45                 ConnectorType = 0x22
	ConnectorNoSeparableConnector ConnectorType = 0x23
	ConnectorMXC2x16              ConnectorType = 0x24
)

func (ConnectorType) String

func (i ConnectorType) String() string

type Eeprom

type Eeprom struct {
	Id            Id
	ExtendedId    reg8
	ConnectorType ConnectorType

	// Byte 131 Compatibility[0] SfpCompliance
	//   [0] 40G active cable xlppi
	//   [1] 40GBASE-LR4
	//   [2] 40GBASE-SR4
	//   [3] 40GBASE-CR4
	//   [4] 10GBASE-SR
	//   [5] 10GBASE-LR
	//   [6] 10GBASE-LRM
	//   [7] Extended (Options[0] becomes SfpExtendedCompliance)
	Compatibility [8]reg8

	Encoding                     reg8
	NominalBitRate100MbitsPerSec reg8

	LinkLength [5]reg8

	VendorName [16]reg8

	VendorOui           [3]reg8
	VendorPartNumber    [16]reg8
	VendorRevision      [4]reg8
	LaserWavelengthInNm [2]reg8

	Options                 [2]reg8
	MaxBitRateMarginPercent reg8
	MinBitRateMarginPercent reg8
	VendorSerialNumber      [16]reg8
	VendorDateCode          [8]reg8

	VendorSpecific [32]reg8
	// contains filtered or unexported fields
}

Upper memory map (page select 0) Read only.

type ExtendedCompliance

type ExtendedCompliance byte

func (ExtendedCompliance) String

func (i ExtendedCompliance) String() string

type Id

type Id reg8

SFP Ids from eeprom.

const (
	IdUnknown Id = iota
	IdGbic
	IdOnMotherboard
	IdSfp
	IdXbi
	IdXenpak
	IdXfp
	IdXff
	IdXfpE
	IdXpak
	IdX2
	IdDwdmSfp
	IdQsfp
	IdQsfpPlus
	IdCxp
	IdShieldedMiniMultilaneHD4X
	IdShieldedMiniMultilaneHD8X
	IdQsfp28
	IdCxp2
	IdCdfpStyle12
	IdShieldedMiniMultilaneHD4XFanout
	IdShieldedMiniMultilaneHD8XFanoutCable
	IdCdfpStyle3
	IdMicroQsfp
	IdQsfpDD
)

func (Id) String

func (i Id) String() string

type ModuleInterrupts

type ModuleInterrupts uint16

func (ModuleInterrupts) String

func (i ModuleInterrupts) String() string

type QsfpAlarmStatus

type QsfpAlarmStatus uint8
const (
	QsfpLoWarning QsfpAlarmStatus = 1 << iota
	QsfpHiWarning
	QsfpLoAlarm
	QsfpHiAlarm
)

4 bit alarm status for temperature, voltage, ...

type QsfpAlarms

type QsfpAlarms struct {
	Module   string
	Channels string
}

type QsfpIdFields

type QsfpIdFields struct {
	Id            string
	Vendor        string
	PartNumber    string
	Revision      string
	SerialNumber  string
	Date          string
	ConnectorType string
	Compliance    string
}

type QsfpModule

type QsfpModule struct {

	// All values from EEPROM are valid.
	AllEepromValid bool

	Config QsfpModuleConfig

	Ident QsfpIdFields

	Mon QsfpMonitoring

	Alarms QsfpAlarms
	// contains filtered or unexported fields
}

func (*QsfpModule) GetCompliance

func (m *QsfpModule) GetCompliance() (c Compliance, x ExtendedCompliance)

func (*QsfpModule) GetConnectorType

func (m *QsfpModule) GetConnectorType() ConnectorType

func (*QsfpModule) GetId

func (m *QsfpModule) GetId() Id

func (*QsfpModule) GetSignal

func (m *QsfpModule) GetSignal(s QsfpSignal) bool

func (*QsfpModule) Init

func (m *QsfpModule) Init(a Access)

func (*QsfpModule) Interrupt

func (m *QsfpModule) Interrupt() (err error)

func (*QsfpModule) Monitoring

func (m *QsfpModule) Monitoring()

func (*QsfpModule) Present

func (m *QsfpModule) Present(is bool) (err error)

func (*QsfpModule) SetSignal

func (m *QsfpModule) SetSignal(s QsfpSignal, new bool) (old bool, err error)

func (*QsfpModule) String

func (m *QsfpModule) String() string

func (*QsfpModule) TxEnable

func (m *QsfpModule) TxEnable(enableMask, laneMask uint) uint

type QsfpModuleConfig

type QsfpModuleConfig struct {
	TemperatureInCelsius QsfpThreshold
	SupplyVoltageInVolts QsfpThreshold
	RxPowerInWatts       QsfpThreshold
	TxBiasCurrentInAmps  QsfpThreshold
	TxPowerInWatts       QsfpThreshold
}

type QsfpMonitoring

type QsfpMonitoring struct {
	Temperature string
	Voltage     string
	RxPower     [QsfpNChannel]string
	TxPower     [QsfpNChannel]string
	TxBias      [QsfpNChannel]string
}

type QsfpSignal

type QsfpSignal uint8
const (
	QsfpLowPowerMode QsfpSignal = iota
	QsfpInterruptStatus
	QsfpModuleIsPresent
	QsfpModuleSelected
	QsfpResetIsActive
	QsfpNSignal
)

type QsfpThreshold

type QsfpThreshold struct {
	Alarm, Warning struct{ Hi, Lo float64 }
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL