LCOV - code coverage report
Current view: top level - vnsw/agent/services/multicast/agent_map - gmp_intf.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 4 5 80.0 %
Date: 2026-11-09 02:10:49 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_gmp_intf_h
       7             : #define vnsw_agent_gmp_intf_h
       8             : 
       9             : /*
      10             :  * GMP interface handle
      11             :  *
      12             :  * This structure represents an interface from the GMP toolkit's point of
      13             :  * view--a pointer to it is defined as the abstract interface ID.
      14             :  *
      15             :  * The GMP toolkit uses the same type to represent an interface for both
      16             :  * the host and router sides.  rpd needs to bind different structures in
      17             :  * the host case (the mgm_instance) and the router case (the gmp_intf).
      18             :  * So we embed this common structure within each.  The structure carries
      19             :  * a boolean that defines whether we're looking at a host
      20             :  * or a router interface;  with that knowledge we can use the wrapper inlines
      21             :  * to extract the mgm_inst or gmp_intf structures as appropriate.
      22             :  *
      23             :  * The structure also has a thread entry for the transmit interface thread;
      24             :  * this is used for both host and router interfaces.
      25             :  */
      26             : typedef struct gmp_intf_handle_ {
      27             :     boolean gmpifh_host;        /* TRUE if this is a host interface */
      28             :     task_thread gmpifh_xmit_thread;      /* Entry on transmit thread */
      29             : } gmp_intf_handle;
      30             : 
      31             : THREAD_TO_STRUCT(gmp_xmit_thread_to_handle, gmp_intf_handle,
      32             :          gmpifh_xmit_thread);
      33             : 
      34             : /*
      35             :  * gmp_intf
      36             :  *
      37             :  * This structure is rpd's manifestation of an interface for use by
      38             :  * GMPR.  It is created upon the first reference to an interface in
      39             :  * configuration (whether or not the physical interface exists or is
      40             :  * up) and is destroyed when there are no longer any references to the
      41             :  * interface.  gmp_intfs are bound to mgm_ifs (when they are up) and
      42             :  * are keyed by ifae and protocol.
      43             :  */
      44             : 
      45             : typedef struct gmp_intf_ {
      46             :     patnode gmpif_patnode;      /* Patricia node */
      47             :     gmp_proto gmpif_proto;      /* Protocol (MLD or IGMP) */
      48             :     gmp_intf_handle gmpif_handle;   /* GMP interface handle */
      49             :     uint32_t gmpif_refcount;       /* Reference count for locking */
      50             :     void *vm_interface;
      51             :     gmpr_intf_params params;
      52             : } gmp_intf;
      53             : 
      54             : PATNODE_TO_STRUCT(gmp_intf_patnode_to_intf, gmp_intf, gmpif_patnode);
      55         216 : MEMBER_TO_STRUCT(gmp_handle_to_gif, gmp_intf, gmp_intf_handle, gmpif_handle);
      56             : 
      57             : /* Inlines */
      58             : 
      59             : /*
      60             :  * gmp_intf_is_local
      61             :  *
      62             :  * Returns TRUE if the gmp_intf pointer represents the local "interface"
      63             :  * (is NULL) or FALSE if not.
      64             :  */
      65             : static inline boolean
      66             : gmp_intf_is_local (gmp_intf *gif)
      67             : {
      68             :     return (gif == NULL);
      69             : }
      70             : 
      71             : 
      72             : /*
      73             :  * gmp_gif_to_handle
      74             :  *
      75             :  * Convert a gmp_intf pointer to a gmp_intf_handle pointer.  If the gmp_intf
      76             :  * pointer is NULL, we return a NULL handle.
      77             :  */
      78             : static inline gmp_intf_handle *
      79         240 : gmp_gif_to_handle (gmp_intf *gif)
      80             : {
      81         240 :     if (gif)
      82         240 :         return &gif->gmpif_handle;
      83             :     else
      84           0 :         return NULL;
      85             : }
      86             : 
      87             : #endif /* vnsw_agent_gmp_intf_h */

Generated by: LCOV version 1.14