failover.c (1758B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * Failover initializers 8 */ 9 10 #include <sal/core/libc.h> 11 #include <bcm/failover.h> 12 13 #ifdef INCLUDE_L3 14 15 /* 16 * Function: 17 * bcm_failover_element_t_init 18 * Purpose: 19 * Initialize Failover element struct 20 * Parameters: 21 * failover - Pointer to the struct to be init'ed 22 */ 23 24 void 25 bcm_failover_element_t_init(bcm_failover_element_t *failover) 26 { 27 if (failover != NULL) { 28 sal_memset(failover, 0, sizeof(*failover)); 29 failover->failover_id = BCM_FAILOVER_INVALID; 30 failover->intf = BCM_IF_INVALID; 31 failover->port = BCM_GPORT_INVALID; 32 } 33 return; 34 } 35 36 /* 37 * Function: 38 * bcm_failover_multi_level_t_init 39 * Purpose: 40 * Initialize multi level Failover struct 41 * Parameters: 42 * multi_level_failover - Pointer to the struct to be init'ed 43 */ 44 void 45 bcm_failover_multi_level_t_init( 46 bcm_failover_multi_level_t *multi_level_failover) 47 { 48 if (multi_level_failover != NULL) { 49 sal_memset(multi_level_failover, 0, sizeof(*multi_level_failover)); 50 } 51 return; 52 } 53 54 #else 55 int _bcm_failover_not_empty; 56 #endif /* INCLUDE_L3 */ 57 58 /* 59 * Function: 60 * bcm_failover_ring_t_init 61 * Purpose: 62 * Initialize Failover ring struct 63 * Parameters: 64 * failover - Pointer to the struct to be init'ed 65 */ 66 67 void 68 bcm_failover_ring_t_init(bcm_failover_ring_t *failover_ring) 69 { 70 if (failover_ring != NULL) { 71 sal_memset(failover_ring, 0, sizeof(*failover_ring)); 72 failover_ring->port0 = BCM_GPORT_INVALID; 73 failover_ring->port1 = BCM_GPORT_INVALID; 74 } 75 return; 76 }