Skip to content

Commit

Permalink
Poll host link (#106)
Browse files Browse the repository at this point in the history
* comment cleanup

Signed-off-by: Anthony Floeder <[email protected]>

* Add slot setting for rabbit management port on PAX 0

Signed-off-by: Anthony Floeder <[email protected]>

* Refresh port status every minute unless there are events to process

Signed-off-by: Anthony Floeder <[email protected]>

---------

Signed-off-by: Anthony Floeder <[email protected]>
  • Loading branch information
ajfloeder authored Aug 20, 2024
1 parent 2df688b commit cb407b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/switchtec/pkg/switchtec/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func (dev *Device) GetGfmsEvents() ([]GfmsEvent, error) {
type response struct {
ResponseNumber uint16 // Number of GFMS Event Entries in this response
RemainingNumberFlags uint16 // [0:14] Number of GFMS Event Entries remaining in GFMS Event Queue
// [15] Flag to indicatre whether the event entry buffer queue has
// [15] Flag to indicate whether the event entry buffer queue has
// been overwritten as a result of not being read in time.
Data [maxDataLength - 4]byte
}
Expand Down
16 changes: 12 additions & 4 deletions pkg/manager-fabric/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type monitor struct {
fabric *Fabric
}

// Run will run the Fabirc Monitor forever
// Run Fabric Monitor forever
func (m *monitor) Run() {

for {
Expand All @@ -49,10 +49,18 @@ func (m *monitor) Run() {
s := &m.fabric.switches[idx]

// The normal path is when the switch is operating without issue and we can
// poll the switch for any events, and process those events
// poll the switch for any events then process those events
if s.isReady() {

if events, err := s.dev.GetEvents(); err == nil {

// In the steady state there will be no events.
// Refresh the port status to ensure we're up to date.
if len(events) == 0 {
s.refreshPortStatus()
continue
}

for _, event := range events {
physPortId, isDown := m.getEventInfo(event)

Expand All @@ -77,7 +85,7 @@ func (m *monitor) Run() {

func (*monitor) checkSwitchStatus(s *Switch) {

// Check if the switch path changed by trying to re-identifying the switch.
// Check if the switch path changed by trying to re-identify the switch.
// If the switch is found, it's likely the switch path has changed and we
// need to re-open the switch.
if err := s.identify(); err != nil {
Expand All @@ -96,7 +104,7 @@ func (*monitor) checkSwitchStatus(s *Switch) {

const invalidPhysicalPortId = math.MaxUint8

func (m *monitor) getEventInfo(e switchtec.GfmsEvent) (uint8, bool) {
func (m *monitor) getEventInfo(e switchtec.GfmsEvent) (uint8, bool /* is down event? */) {

switch e.Id {
case switchtec.FabricLinkUp_GfmsEvent, switchtec.FabricLinkDown_GfmsEvent:
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager-nnf/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (s *StorageService) cleanupVolumes() {
}

// Initialize is responsible for initializing the NNF Storage Service; the
// Storage Service must complete initialization without error prior any
// Storage Service must complete initialization without error prior to any
// access to the Storage Service. Failure to initialize will cause the
// storage service to misbehave.
func (s *StorageService) Initialize(log ec.Logger, ctrl NnfControllerInterface) error {
Expand Down Expand Up @@ -529,7 +529,7 @@ func (s *StorageService) EventHandler(e event.Event) error {
}

// Check if the fabric is ready; that is all devices are enumerated and discovery
// is complete. We
// is complete.
if e.Is(msgreg.FabricReadyNnf("")) {
log.V(1).Info("Fabric ready")

Expand Down

0 comments on commit cb407b1

Please sign in to comment.