bfcmap_ctrl.h (3438B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 */ 7 #ifndef __BFCMAP_CTRL_H 8 #define __BFCMAP_CTRL_H 9 10 /*#include <bfcmap_util.h>*/ 11 12 struct bfcmap_port_ctrl_s; 13 struct bfcmap_dev_ctrl_s; 14 struct bfcmap_api_table_s; 15 struct bfcmap_counter_info_s; 16 struct bfcmap_counter_cb_s; 17 18 typedef struct bfcmap_port_ctrl_s { 19 int mdev; /* bfcmap unit */ 20 int mport; /* bfcmap port */ 21 bfcmap_port_t portId; 22 bfcmap_port_config_t cfg; 23 bfcmap_dev_io_f msec_io_f; 24 struct bfcmap_dev_ctrl_s *parent; 25 bfcmap_dev_addr_t dev_addr; 26 bfcmap_dev_addr_t uc_dev_addr; 27 struct bfcmap_api_table_s *api; 28 bfcmap_sal_lock_t plock; /* Port lock */ 29 30 #define BFCMAP_CTRL_FLAG_ATTACHED 0x00000001 31 #define BFCMAP_CTRL_FLAG_SHR_MEM_INITED 0x00000002 32 unsigned int f; /* flags */ 33 34 struct bfcmap_int_hw_mapper_s *mp; 35 void *fcmap_port_cfg; 36 37 } bfcmap_port_ctrl_t; 38 39 #define BFCMAP_PORT(c) (c)->mport 40 #define BFCMAP_UNIT(c) (c)->mdev 41 #define BFCMAP_PORT_DEVICE_CONTROL(c) (c)->parent 42 #define BFCMAP_PORT_FLAGS(c) (c)->f 43 44 #define BFCMAP_EGRESS_CHAN_TBL(c) (c)->e_chans 45 #define BFCMAP_INGRESS_CHAN_TBL(c) (c)->i_chans 46 47 #define BFCMAP_CHAN_GET_TBL(mpc,d) \ 48 (((d) == BFCMAP_DIR_INGRESS) ? (mpc)->i_chans : (mpc)->e_chans) 49 50 #define BFCMAP_PORT_GET_MAX_CHAN(mpc,d) \ 51 (((d) == BFCMAP_DIR_INGRESS) ? (mpc)->max_ingress_chan : (mpc)->max_egress_chan) 52 53 #define BFCMAP_CHAN_ENTRY(t, i) *((t) + (i)) 54 55 #define BFCMAP_PORT_CONFIG(mpc) (&(mpc)->cfg) 56 57 #define BFCMAP_LOCK_PORT(mpc) BFCMAP_SAL_LOCK((mpc)->plock) 58 59 #define BFCMAP_UNLOCK_PORT(mpc) BFCMAP_SAL_UNLOCK((mpc)->plock) 60 61 #define BFCMAP_CHAN_VEC(mpc) ((mpc)->chan_vec) 62 63 64 /* BFCMAP unit control structure. This keeps track 65 * of all the ports attached to a bfcmap device.*/ 66 typedef struct bfcmap_dev_ctrl_s { 67 int mdev; /* bfcmap unit */ 68 int num_ports; /* Number of port on this device*/ 69 bfcmap_dev_addr_t dev_addr; 70 bfcmap_core_t core_type; 71 bfcmap_port_ctrl_t *ports; /* bfcmap_port_ctrl_t port ctrl tbl */ 72 73 #define BFCMAP_UNIT_ATTACHED 0x0001 74 unsigned int flags; /* Device flags */ 75 bfcmap_sal_lock_t ulock; 76 77 bfcmap_counter_info_t *counter_info; 78 struct bfcmap_counter_cb_s *counter_cb; 79 bfcmap_port_t p; /* bfcmap port containing switch unit and port */ 80 struct bfcmap_mibs_s *mibs; /* FC MIBs structure */ 81 struct bfcmap_mibs_s *prev_mibs; /* Previous FC MIBs structure */ 82 } bfcmap_dev_ctrl_t; 83 84 extern bfcmap_dev_ctrl_t *bfcmap_unit_cb[BFCMAP_MAX_UNITS]; 85 86 #define BFCMAP_DEVICE_CTRL(md) bfcmap_unit_cb[(md)] 87 88 #define BFCMAP_LOCK_DEVICE(mdc) BFCMAP_SAL_LOCK((mdc)->ulock) 89 90 #define BFCMAP_UNLOCK_DEVICE(mdc) BFCMAP_SAL_UNLOCK((mdc)->ulock) 91 92 #define BFCMAP_DEVICE_NUM_PORTS(mdc) ((mdc)->num_ports) 93 94 #define BFCMAP_UNIT_PORT_CONTROL(mdc, p) ((mdc)->ports + (p)) 95 96 #endif /* __BFCMAP_CTRL_H */ 97