LCOV - code coverage report
Current view: top level - vnet/ip - ip_path_mtu.h (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 4 4 100.0 %
Date: 2023-10-26 01:39:38 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  *------------------------------------------------------------------
       3             :  * ip_path_mtu.h
       4             :  *
       5             :  * Copyright (c) 2021 Graphiant.
       6             :  * Licensed under the Apache License, Version 2.0 (the "License");
       7             :  * you may not use this file except in compliance with the License.
       8             :  * You may obtain a copy of the License at:
       9             :  *
      10             :  *     http://www.apache.org/licenses/LICENSE-2.0
      11             :  *
      12             :  * Unless required by applicable law or agreed to in writing, software
      13             :  * distributed under the License is distributed on an "AS IS" BASIS,
      14             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15             :  * See the License for the specific language governing permissions and
      16             :  * limitations under the License.
      17             :  *------------------------------------------------------------------
      18             :  */
      19             : 
      20             : #include <vnet/ip/ip.h>
      21             : 
      22             : /**
      23             :  * @brief
      24             :  * The Path MTU DPO. interposed in the forwarding chain of the host prefix.
      25             :  */
      26             : typedef struct ip_pmtu_dpo_t_
      27             : {
      28             :   /**
      29             :    * The protocol of packets using this DPO
      30             :    */
      31             :   dpo_proto_t ipm_proto;
      32             : 
      33             :   u8 __pad8;
      34             : 
      35             :   /**
      36             :    * Configured Path Mtu
      37             :    */
      38             :   u16 ipm_pmtu;
      39             : 
      40             :   /**
      41             :    * number of locks.
      42             :    */
      43             :   u16 ipm_locks;
      44             : 
      45             :   /**
      46             :    * Stacked DPO
      47             :    */
      48             :   dpo_id_t ipm_dpo;
      49             : } ip_pmtu_dpo_t;
      50             : 
      51             : /*
      52             :  * PMTU DPOs are accessed in the data-path so they should not straddle a cache
      53             :  * line. Align to a integer factor of a cacheline
      54             :  */
      55             : STATIC_ASSERT_SIZEOF (ip_pmtu_dpo_t, 2 * sizeof (u64));
      56             : 
      57             : #define foreach_ip_pmtu_flag                                                  \
      58             :   _ (ATTACHED, 0, "attached")                                                 \
      59             :   _ (REMOTE, 1, "remote")                                                     \
      60             :   _ (STALE, 2, "stale")
      61             : 
      62             : typedef enum ip_pmtu_flags_t_
      63             : {
      64             : #define _(a, b, c) IP_PMTU_FLAG_##a = (1 << b),
      65             :   foreach_ip_pmtu_flag
      66             : #undef _
      67             : } ip_pmtu_flags_t;
      68             : 
      69             : /**
      70             :  * Remote Path MTU tracking object
      71             :  */
      72             : typedef struct ip_pmtu_t_
      73             : {
      74             :   /** linkage into the FIB graph */
      75             :   fib_node_t ipt_node;
      76             : 
      77             :   /** Track fib entry */
      78             :   fib_node_index_t ipt_fib_entry;
      79             :   u32 ipt_sibling;
      80             :   ip_pmtu_flags_t ipt_flags;
      81             : 
      82             :   /** Configured MTU */
      83             :   u16 ipt_cfg_pmtu;
      84             : 
      85             :   /** MTU from the parent MTU */
      86             :   u16 ipt_parent_pmtu;
      87             : 
      88             :   /** operational MTU; the minimum value of the cfg and parent MTU */
      89             :   u16 ipt_oper_pmtu;
      90             : } ip_pmtu_t;
      91             : 
      92             : extern int ip_path_mtu_update (const ip_address_t *nh, u32 table_id, u16 pmtu);
      93             : 
      94             : typedef walk_rc_t (*ip_path_mtu_walk_t) (index_t ipti, void *ctx);
      95             : 
      96             : extern void ip_path_mtu_walk (ip_path_mtu_walk_t fn, void *ctx);
      97             : extern int ip_path_mtu_replace_begin (void);
      98             : extern int ip_path_mtu_replace_end (void);
      99             : 
     100             : extern u32 ip_pmtu_get_table_id (const ip_pmtu_t *ipt);
     101             : extern void ip_pmtu_get_ip (const ip_pmtu_t *ipt, ip_address_t *ip);
     102             : 
     103             : extern void ip_pmtu_dpo_add_or_lock (u16 pmtu, const dpo_id_t *parent,
     104             :                                      dpo_id_t *dpo);
     105             : 
     106             : /**
     107             :  * Data-plane accessor functions
     108             :  */
     109             : extern ip_pmtu_dpo_t *ip_pmtu_dpo_pool;
     110             : static_always_inline ip_pmtu_dpo_t *
     111         106 : ip_pmtu_dpo_get (index_t index)
     112             : {
     113         106 :   return (pool_elt_at_index (ip_pmtu_dpo_pool, index));
     114             : }
     115             : 
     116             : extern ip_pmtu_t *ip_pmtu_pool;
     117             : static_always_inline ip_pmtu_t *
     118         415 : ip_path_mtu_get (index_t index)
     119             : {
     120         415 :   return (pool_elt_at_index (ip_pmtu_pool, index));
     121             : }
     122             : 
     123             : /*
     124             :  * fd.io coding-style-patch-verification: ON
     125             :  *
     126             :  * Local Variables:
     127             :  * eval: (c-set-style "gnu")
     128             :  * End:
     129             :  */

Generated by: LCOV version 1.14