nh_tx.h (3617B)
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 * File: nh_tx.h 8 * Purpose: Header file for next hop transmit functions 9 */ 10 11 #ifndef _CPUTRANS_NH_TX_H_ 12 #define _CPUTRANS_NH_TX_H_ 13 14 #include <sdk_config.h> 15 #include <shared/idents.h> 16 17 #include <bcm/types.h> 18 #include <bcm/rx.h> 19 20 /* Next hop callback function prototype */ 21 typedef int (*nh_tx_cb_f)(int unit, int port, uint8 *pkt_buf, int len, 22 void *cookie); 23 24 /* Next hop transmit function prototype */ 25 typedef int (*nh_tx_tx_f)(int unit, int port, uint8 *pkt_buf, int len, 26 nh_tx_cb_f callback, void *cookie); 27 28 extern int nh_tx_setup(bcm_trans_ptr_t *trans_ptr); 29 extern int nh_tx_setup_done(void); 30 31 extern void nh_tx_l2_header_setup(uint8 *pkt_buf, uint16 vlan); 32 33 extern int nh_tx_dest_set(const bcm_mac_t mac, int dest_mod, int dest_port); 34 extern int nh_tx_dest_get(bcm_mac_t *mac, int *dest_mod, int *dest_port); 35 extern int nh_tx_dest_install(int install, int vid); 36 37 extern int nh_tx_src_set(int src_mod, int src_port); 38 extern int nh_tx_src_get(int *src_mod, int *src_port); 39 40 extern int nh_tx_trans_ptr_set(int unit, int port, bcm_trans_ptr_t *ptr); 41 extern int nh_tx_trans_ptr_get(int unit, int port, bcm_trans_ptr_t **ptr); 42 43 extern int nh_tx_src_mod_port_set(int unit, int port, 44 int src_mod, int src_port); 45 extern int nh_tx_src_mod_port_get(int unit, int port, 46 int *src_mod, int *src_port); 47 48 extern int nh_tx(int unit, 49 int port, 50 uint8 *pkt_buf, 51 int len, 52 int cos, 53 int vlan, 54 uint16 pkt_type, 55 uint32 ct_flags, 56 nh_tx_cb_f callback, 57 void *cookie); 58 59 extern void nh_pkt_setup(bcm_pkt_t *pkt, int cos, uint16 vlan, 60 uint16 pkt_type, uint32 ct_flags); 61 extern void nh_pkt_local_setup(bcm_pkt_t *pkt, int unit, int port); 62 extern void nh_pkt_final_setup(bcm_pkt_t *pkt, int unit, int port); 63 extern int nh_pkt_tx(bcm_pkt_t *pkt, nh_tx_cb_f callback, void *cookie); 64 65 extern int nh_tx_pkt_recognize(uint8 *pkt_buf, uint16 *pkt_type); 66 67 extern int nh_tx_local_mac_set(const bcm_mac_t new_mac); 68 extern int nh_tx_local_mac_get(bcm_mac_t *local_mac); 69 70 extern int nh_tx_snap_set(const bcm_mac_t new_mac, uint16 new_type, 71 uint16 new_local_type); 72 extern int nh_tx_snap_get(bcm_mac_t snap_mac, uint16 *snap_type, 73 uint16 *local_type); 74 75 extern int nh_tx_reset(int reset_to_defaults); 76 77 extern int nh_tx_unknown_modid_get(int *modid); 78 extern int nh_tx_unknown_modid_set(int modid); 79 80 #ifndef NH_TX_DEST_MAC_DEFAULT 81 #define NH_TX_DEST_MAC_DEFAULT {0x00, 0x10, 0x18, 0xff, 0xff, 0xff} 82 #endif 83 #ifndef NH_TX_SNAP_MAC_DEFAULT 84 #define NH_TX_SNAP_MAC_DEFAULT SHARED_BRCM_NTSW_SNAP_MAC 85 #endif 86 #ifndef NH_TX_SNAP_TYPE_DEFAULT 87 #define NH_TX_SNAP_TYPE_DEFAULT SHARED_BRCM_NTSW_SNAP_TYPE 88 #endif 89 #define NH_TX_LOCAL_PKT_TYPE SHARED_PKT_TYPE_NH_TX 90 #ifndef NH_TX_DEST_PORT_DEFAULT 91 #define NH_TX_DEST_PORT_DEFAULT 0 92 #endif 93 #ifndef NH_TX_DEST_MOD_DEFAULT 94 #define NH_TX_DEST_MOD_DEFAULT 0 95 #endif 96 #ifndef NH_TX_SRC_PORT_DEFAULT 97 #define NH_TX_SRC_PORT_DEFAULT 0 98 #endif 99 #ifndef NH_TX_SRC_MOD_DEFAULT 100 #define NH_TX_SRC_MOD_DEFAULT 31 101 #endif 102 #ifndef NH_TX_NUM_PKTS_DEFAULT 103 #define NH_TX_NUM_PKTS_DEFAULT 10 104 #endif 105 106 107 #endif /* _CPUTRANS_NH_TX_H_ */