Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | *------------------------------------------------------------------ |
| 3 | * Copyright (c) 2018 Cisco and/or its affiliates. |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at: |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | *------------------------------------------------------------------ |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * A QOS egress map translates from the COS bits stored in the packet's |
| 20 | * meta-data into a per-protocol COS value |
| 21 | */ |
| 22 | |
| 23 | #ifndef __QOS_EGRESS_MAP_H__ |
| 24 | #define __QOS_EGRESS_MAP_H__ |
| 25 | |
| 26 | #include <vnet/qos/qos_types.h> |
| 27 | #include <vnet/dpo/dpo.h> |
| 28 | |
| 29 | /** |
| 30 | * An attempt at type safety |
| 31 | */ |
| 32 | typedef u32 qos_egress_map_id_t; |
| 33 | |
| 34 | /** |
Paul Vinciguerra | bdc0e6b | 2018-09-22 05:32:50 -0700 | [diff] [blame] | 35 | * For a given output source a table maps each value of every input source. |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 36 | */ |
| 37 | typedef struct qos_egress_map_t_ |
| 38 | { |
Dave Barach | eb987d3 | 2018-05-03 08:26:39 -0400 | [diff] [blame] | 39 | /** |
| 40 | * Required for pool_get_aligned |
| 41 | */ |
| 42 | CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); |
| 43 | |
| 44 | /** |
| 45 | * The array of output mapped values; |
| 46 | * output = eq_qos[input-source][input-value] |
| 47 | */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 48 | qos_bits_t qem_output[QOS_N_SOURCES][256]; |
| 49 | } qos_egress_map_t; |
| 50 | |
| 51 | extern u8 *format_qos_egress_map (u8 * s, va_list * args); |
| 52 | |
| 53 | /** |
| 54 | * Add a qos-egress map to an interface. If sw_if_index = ~0 |
| 55 | * then the configuration is for the 'default' table. |
| 56 | * If the table is ~0, this is a removal. |
| 57 | * the egress mapping is applied. For example, is output is MPLS then |
Paul Vinciguerra | bdc0e6b | 2018-09-22 05:32:50 -0700 | [diff] [blame] | 58 | * the QoS markings will occur for MPLS packets. |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 59 | */ |
| 60 | extern void qos_egress_map_update (qos_egress_map_id_t tid, |
| 61 | qos_source_t input_source, |
| 62 | qos_bits_t * values); |
| 63 | extern void qos_egress_map_delete (qos_egress_map_id_t tid); |
| 64 | |
| 65 | /** |
| 66 | * Get the VPP QoS map index from the user's map-ID |
| 67 | */ |
| 68 | extern index_t qos_egress_map_find (qos_egress_map_id_t tid); |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 69 | extern qos_egress_map_id_t qos_egress_map_get_id (index_t qemi); |
| 70 | |
| 71 | /** |
| 72 | * Walk each of the configured maps |
| 73 | */ |
| 74 | typedef walk_rc_t (*qos_egress_map_walk_cb_t) (qos_egress_map_id_t id, |
| 75 | const qos_egress_map_t * m, |
| 76 | void *c); |
| 77 | void qos_egress_map_walk (qos_egress_map_walk_cb_t fn, void *c); |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * Data-plane functions |
| 81 | */ |
| 82 | |
| 83 | /** |
| 84 | * Pool from which to allocate map |
| 85 | */ |
| 86 | extern qos_egress_map_t *qem_pool; |
| 87 | |
| 88 | #endif |
| 89 | |
| 90 | /* |
| 91 | * fd.io coding-style-patch-verification: ON |
| 92 | * |
| 93 | * Local Variables: |
| 94 | * eval: (c-set-style "gnu") |
| 95 | * End: |
| 96 | */ |