Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * <:copyright-BRCM:2016:DUAL/GPL:standard |
| 4 | * |
| 5 | * Copyright (c) 2016 Broadcom |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * Unless you and Broadcom execute a separate written software license |
| 9 | * agreement governing use of this software, this software is licensed |
| 10 | * to you under the terms of the GNU General Public License version 2 |
| 11 | * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 12 | * with the following added to such license: |
| 13 | * |
| 14 | * As a special exception, the copyright holders of this software give |
| 15 | * you permission to link this software with independent modules, and |
| 16 | * to copy and distribute the resulting executable under terms of your |
| 17 | * choice, provided that you also meet, for each linked independent |
| 18 | * module, the terms and conditions of the license of that module. |
| 19 | * An independent module is a module which is not derived from this |
| 20 | * software. The special exception does not apply to any modifications |
| 21 | * of the software. |
| 22 | * |
| 23 | * Not withstanding the above, under no circumstances may you combine |
| 24 | * this software in any way with any other Broadcom software provided |
| 25 | * under a license other than the GPL, without Broadcom's express prior |
| 26 | * written consent. |
| 27 | * |
| 28 | * :> |
| 29 | * |
| 30 | *****************************************************************************/ |
| 31 | |
| 32 | /** |
| 33 | * @file bal_switch_flow.h |
| 34 | * |
| 35 | * @brief Switch flow interfaces header file |
| 36 | * |
| 37 | * This file expose the APIs to the core to configure the switches |
| 38 | * with regarding to the operation of a flow. |
| 39 | * |
| 40 | * @defgroup sw_util Switch Util |
| 41 | * @ingroup core |
| 42 | */ |
| 43 | |
| 44 | #ifndef _BAL_SWITCH_FLOW_H_ |
| 45 | #define _BAL_SWITCH_FLOW_H_ |
| 46 | |
| 47 | #include <bal_utils_msg.h> |
| 48 | #include "bcmos_errno.h" |
| 49 | #include "flow_fsm.h" |
| 50 | |
| 51 | /*@{*/ |
| 52 | |
| 53 | /* Data structure to keep a link list of flow that has been programmed in the switch */ |
| 54 | /* reserve 16 pairs of uni-direction ports */ |
| 55 | #define MAX_PON_PORT 32 |
| 56 | #define MAX_NET_PORT 32 |
| 57 | #define MAX_FIELD_EID 64 |
| 58 | |
| 59 | #define BAL_SW_FLOW_TYPE_NONE 0 |
| 60 | #define BAL_SW_FLOW_TYPE_DOWNSTREAM (1 << BCMBAL_FLOW_TYPE_DOWNSTREAM) |
| 61 | #define BAL_SW_FLOW_TYPE_UPSTREAM (1 << BCMBAL_FLOW_TYPE_UPSTREAM) |
| 62 | #define BAL_SW_FLOW_TYPE_MULTICAST (1 << BCMBAL_FLOW_TYPE_MULTICAST) |
| 63 | |
| 64 | typedef struct bal_sw_flow bal_sw_flow; |
| 65 | struct bal_sw_flow |
| 66 | { |
| 67 | uint32_t id; /* flow id */ |
| 68 | uint32_t type; /* downstream or upstream */ |
| 69 | uint32_t device; /* device id, aka unit of the device */ |
| 70 | uint32_t trap_code; /* id for trap reason */ |
| 71 | uint32_t trap_port; /* trap gport */ |
| 72 | uint32_t num_eid; |
| 73 | uint32_t field_entry_id[MAX_FIELD_EID]; /* field entry for ACL rules */ |
| 74 | void *p_vsi_svc; /* vswitch entry in the vsi list */ |
| 75 | uint32_t vsi_svc_indx; /* index to the service within the vswitch this flow is using */ |
| 76 | uint32_t svc_port; /* LLId or GEMID */ |
| 77 | uint32_t num_pon; |
| 78 | uint32_t pon_port[MAX_PON_PORT]; /* pon gport attached to vswitch */ |
| 79 | uint32_t num_net; |
| 80 | uint32_t net_port[MAX_NET_PORT]; /* nni gport attached to vswitch */ |
| 81 | bcmbal_cookie flow_cookie; |
| 82 | void *p_service_cfg; |
| 83 | uint32_t group_id; |
| 84 | uint32_t valid; |
| 85 | TAILQ_ENTRY(bal_sw_flow) flow_next; |
| 86 | }; |
| 87 | |
| 88 | extern bcmos_errno bal_sw_util_flow_list_insert(bal_sw_flow entry); |
| 89 | extern bcmos_errno bal_sw_util_flow_list_remove(bal_sw_flow *p_entry); |
| 90 | extern bal_sw_flow *bal_sw_util_flow_list_get_by_id(uint32_t id); |
| 91 | extern bal_sw_flow *bal_sw_util_flow_list_get_by_trap_code(uint32_t trap_code); |
| 92 | extern bcmos_bool bal_sw_util_flow_ds_acl_cls_chk(bcmbal_flow_cfg *p_flow); |
| 93 | extern bcmos_bool bal_sw_util_flow_us_acl_cls_chk(bcmbal_flow_cfg *p_flow); |
| 94 | |
| 95 | /*@}*/ |
| 96 | |
| 97 | #endif /* _BAL_SWITCH_FLOW_H_ */ |