blob: db381a84d3683937b4b74860dcfe6d676e78a252 [file] [log] [blame]
Neale Rannsd792d9c2017-10-21 10:53:20 -07001/*
2 * Copyright (c) 2016 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/**
Jim Thompsonf324dec2019-04-08 03:22:21 -050016 * bier_disposition : The BIER disposition object
Neale Rannsd792d9c2017-10-21 10:53:20 -070017 *
Jim Thompsonf324dec2019-04-08 03:22:21 -050018 * A BIER disposition object is used to pop the BIER header for for-us
Neale Rannsd792d9c2017-10-21 10:53:20 -070019 * packets and steer the packet down the payload protocol specific graph
20 */
21
22#ifndef __BIER_DISP_ENTRY_H__
23#define __BIER_DISP_ENTRY_H__
24
25#include <vnet/bier/bier_types.h>
26#include <vnet/fib/fib_types.h>
27#include <vnet/dpo/dpo.h>
28
29/**
Jim Thompsonf324dec2019-04-08 03:22:21 -050030 * The BIER disposition object
Neale Rannsd792d9c2017-10-21 10:53:20 -070031 */
32typedef struct bier_disp_entry_t_ {
33 /**
Dave Baracheb987d32018-05-03 08:26:39 -040034 * Required for pool_get_aligned
35 */
36 CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
37
38 /**
Neale Rannsd792d9c2017-10-21 10:53:20 -070039 * The DPO contirubted from the per-payload protocol parents
40 * on cachline 1.
41 */
42 struct
43 {
44 dpo_id_t bde_dpo;
45 u32 bde_rpf_id;
46 } bde_fwd[BIER_HDR_N_PROTO];
47
48 /**
49 * number of locks
50 */
51 u32 bde_locks;
52
53 /**
54 * The path-lists used by per-payload protocol parents.
55 * We don't add the disp entry to the graph as a sibling
56 * since there is nothing we can do with the updates to
57 * forwarding.
58 */
59 fib_node_index_t bde_pl[BIER_HDR_N_PROTO];
60} bier_disp_entry_t;
61
62extern index_t bier_disp_entry_add_or_lock(void);
63extern void bier_disp_entry_path_add(index_t bdei,
64 bier_hdr_proto_id_t pproto,
65 const fib_route_path_t *rpaths);
66extern int bier_disp_entry_path_remove(index_t bdei,
67 bier_hdr_proto_id_t pproto,
68 const fib_route_path_t *rpaths);
69
70extern void bier_disp_entry_unlock(index_t bdi);
71extern void bier_disp_entry_lock(index_t bdi);
72
73extern u8* format_bier_disp_entry(u8* s, va_list *ap);
74
75extern void bier_disp_entry_contribute_forwarding(index_t bdi,
76 dpo_id_t *dpo);
77
78extern bier_disp_entry_t *bier_disp_entry_pool;
79
80always_inline bier_disp_entry_t*
81bier_disp_entry_get (index_t bdi)
82{
83 return (pool_elt_at_index(bier_disp_entry_pool, bdi));
84}
85
86#endif