openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

ipmc.h (1606B)


      1 /*
      2  * ! \file bcm_int/dnx/ipmc/ipmc.h Internal DNX IPMC APIs
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #ifndef _IPMC_API_INCLUDED__
      9 /*
     10  * {
     11  */
     12 #define _IPMC_API_INCLUDED__
     13 
     14 #ifndef BCM_DNX_SUPPORT
     15 #error "This file is for use by DNX (JR2) family only!"
     16 #endif
     17 
     18 /*
     19  * The IN-LIF mask size of 22bits.
     20  */
     21 #define IPMC_GLOBAL_IN_LIF_MASK_SIZE 22
     22 /**
     23  * The value of the first two bytes of the IPv6 multicast address
     24  */
     25 #define IPMC_MC_IPV6_ADDRESS_PREFIX 0xFF
     26 /**
     27  * The number of bytes in an IPv6 address
     28  */
     29 #define NOF_IPV6_ADDR_BYTES  16
     30 /**
     31  * The IN-LIF (in_lif) can be fully mask (don't care about it value) or not masked at all (nothing in between).
     32  */
     33 #define IPMC_GET_IN_LIF_MASK(in_lif) (in_lif == 0 ? 0 : SAL_UPTO_BIT(IPMC_GLOBAL_IN_LIF_MASK_SIZE))
     34 /*
     35  * Checks whether the mask of the IPv6 address is empty (all 1s) - if the last byte is 0xFF,
     36  * then we can assume that all bytes in the mask are equal to 0xFF.
     37  */
     38 #define IPMC_IS_IPV6_NO_MASKING(mask) (mask[NOF_IPV6_ADDR_BYTES-1] == 0xFF)
     39 /*
     40  * Checks whether the IPv6 addess (an array of 16 uint8) is fully masked.
     41  * We can assume that if the first byte is 0, then all the others are 0.
     42  */
     43 #define IPMC_IS_IPV6_FULL_MASKING(mask) (mask[0] == 0)
     44 /*
     45  * Indicate whether the IPv6 address is multicast - If its first byte is 0xFF
     46  */
     47 #define IPMC_IS_IPV6_ADDRESS_MULTICAST(addr, mask) ((addr[0] & mask[0]) == IPMC_MC_IPV6_ADDRESS_PREFIX)
     48 /*
     49  * }
     50  */
     51 #endif/*_IPMC_API_INCLUDED__*/