Neale Ranns | 17ff3c1 | 2018-07-04 10:24:24 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | |
| 16 | #ifndef __PIPE_H__ |
| 17 | #define __PIPE_H__ |
| 18 | |
| 19 | #include <vnet/ethernet/ethernet.h> |
| 20 | |
| 21 | /** |
Lijian.Zhang | 33af8c1 | 2019-09-16 16:22:36 +0800 | [diff] [blame] | 22 | * representation of a pipe interface |
Neale Ranns | 17ff3c1 | 2018-07-04 10:24:24 -0700 | [diff] [blame] | 23 | */ |
| 24 | typedef struct pipe_t_ |
| 25 | { |
| 26 | /** the SW if_index of the other end of the pipe */ |
| 27 | u32 sw_if_index; |
| 28 | |
| 29 | /** Sub-interface config */ |
| 30 | subint_config_t subint; |
| 31 | } pipe_t; |
| 32 | |
| 33 | /** |
| 34 | * Create a new pipe interface |
| 35 | * |
| 36 | * @param is_specified Has the user speficied a desired instance number |
| 37 | * @param user_instance The user's desired instnace |
| 38 | * @param parent_sw_index OUT the created parent interface |
| 39 | * @param pipe_sw_if_index OUT the ends of the pipe |
| 40 | */ |
| 41 | extern int vnet_create_pipe_interface (u8 is_specified, |
| 42 | u32 user_instance, |
| 43 | u32 * parent_sw_if_index, |
| 44 | u32 pipe_sw_if_index[2]); |
| 45 | extern int vnet_delete_pipe_interface (u32 parent_sw_if_index); |
| 46 | |
| 47 | /** |
| 48 | * Get the pipe instnace based on one end |
| 49 | */ |
| 50 | extern pipe_t *pipe_get (u32 sw_if_index); |
| 51 | |
| 52 | /** |
| 53 | * Call back function when walking all the pipes |
| 54 | */ |
| 55 | typedef walk_rc_t (*pipe_cb_fn_t) (u32 parent_sw_if_index, |
| 56 | u32 pipe_sw_if_index[2], |
| 57 | u32 instance, void *ctx); |
| 58 | |
| 59 | /** |
| 60 | * Walk all the of pipe interfaces |
| 61 | */ |
| 62 | extern void pipe_walk (pipe_cb_fn_t fn, void *ctx); |
| 63 | |
| 64 | #endif |
| 65 | |
| 66 | /* |
| 67 | * fd.io coding-style-patch-verification: ON |
| 68 | * |
| 69 | * Local Variables: |
| 70 | * eval: (c-set-style "gnu") |
| 71 | * End: |
| 72 | */ |