LCOV - code coverage report
Current view: top level - plugins/lacp - rx_machine.h (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 3 3 100.0 %
Date: 2023-10-26 01:39:38 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Cisco and/or its affiliates.
       3             :  * Licensed under the Apache License, Version 2.0 (the "License");
       4             :  * you may not use this file except in compliance with the License.
       5             :  * You may obtain a copy of the License at:
       6             :  *
       7             :  *     http://www.apache.org/licenses/LICENSE-2.0
       8             :  *
       9             :  * Unless required by applicable law or agreed to in writing, software
      10             :  * distributed under the License is distributed on an "AS IS" BASIS,
      11             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             :  * See the License for the specific language governing permissions and
      13             :  * limitations under the License.
      14             :  */
      15             : 
      16             : #ifndef __LACP_RX_MACHINE_H__
      17             : #define __LACP_RX_MACHINE_H__
      18             : 
      19             : #include <stdint.h>
      20             : #include <lacp/machine.h>
      21             : 
      22             : #define foreach_lacp_rx_event          \
      23             :   _(0, BEGIN, "begin")                 \
      24             :   _(1, PORT_DISABLED, "port disabled") \
      25             :   _(2, PORT_MOVED, "port moved")       \
      26             :   _(3, LACP_ENABLED, "lacp enabled")   \
      27             :   _(4, LACP_DISABLED, "lacp disabled") \
      28             :   _(5, PDU_RECEIVED, "pdu received")   \
      29             :   _(6, TIMER_EXPIRED, "timer expired")
      30             : 
      31             : typedef enum
      32             : {
      33             : #define _(a, b, c) LACP_RX_EVENT_##b = (a),
      34             :   foreach_lacp_rx_event
      35             : #undef _
      36             : } lacp_rx_event_t;
      37             : 
      38             : #define foreach_lacp_rx_sm_state       \
      39             :   _(0, INITIALIZE, "initialize")       \
      40             :   _(1, PORT_DISABLED, "port disabled") \
      41             :   _(2, EXPIRED, "expired")             \
      42             :   _(3, LACP_DISABLED, "lacp disabled") \
      43             :   _(4, DEFAULTED, "defaulted")         \
      44             :   _(5, CURRENT, "current")
      45             : 
      46             : typedef enum
      47             : {
      48             : #define _(a, b, c) LACP_RX_STATE_##b = (a),
      49             :   foreach_lacp_rx_sm_state
      50             : #undef _
      51             : } lacp_rx_sm_state_t;
      52             : 
      53             : extern lacp_machine_t lacp_rx_machine;
      54             : 
      55             : int lacp_rx_action_initialize (void *, void *);
      56             : int lacp_rx_action_port_disabled (void *, void *);
      57             : int lacp_rx_action_pdu_received (void *, void *);
      58             : int lacp_rx_action_expired (void *, void *);
      59             : int lacp_rx_action_lacp_disabled (void *, void *);
      60             : int lacp_rx_action_defaulted (void *, void *);
      61             : int lacp_rx_action_current (void *, void *);
      62             : void lacp_rx_debug_func (member_if_t * mif, int event, int state,
      63             :                          lacp_fsm_state_t * transition);
      64             : 
      65             : #define LACP_ACTION_INITIALIZE \
      66             :   LACP_ACTION_ROUTINE(lacp_rx_action_initialize)
      67             : #define LACP_ACTION_PORT_DISABLED \
      68             :   LACP_ACTION_ROUTINE(lacp_rx_action_port_disabled)
      69             : #define LACP_ACTION_EXPIRED \
      70             :   LACP_ACTION_ROUTINE(lacp_rx_action_expired)
      71             : #define LACP_ACTION_LACP_DISABLED \
      72             :   LACP_ACTION_ROUTINE(lacp_rx_action_lacp_disabled)
      73             : #define LACP_ACTION_DEFAULTED LACP_ACTION_ROUTINE(lacp_rx_action_defaulted)
      74             : #define LACP_ACTION_CURRENT LACP_ACTION_ROUTINE(lacp_rx_action_current)
      75             : 
      76             : static inline void
      77          32 : lacp_start_current_while_timer (vlib_main_t * vm, member_if_t * mif,
      78             :                                 u8 expiration)
      79             : {
      80          32 :   mif->current_while_timer = vlib_time_now (vm) + expiration;
      81          32 : }
      82             : 
      83             : #endif /* __LACP_RX_MACHINE_H__ */
      84             : 
      85             : /*
      86             :  * fd.io coding-style-patch-verification: ON
      87             :  *
      88             :  * Local Variables:
      89             :  * eval: (c-set-style "gnu")
      90             :  * End:
      91             :  */

Generated by: LCOV version 1.14