tx.h (2310B)
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-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: tx.h 8 * Purpose: 9 */ 10 11 #ifndef _BCM_INT_TX_H_ 12 #define _BCM_INT_TX_H_ 13 14 #include <bcm/pkt.h> 15 16 /* This is all the extra information associated with a DV for RX */ 17 typedef struct tx_dv_info_s { 18 volatile bcm_pkt_t **pkt; 19 int pkt_count; 20 volatile uint8 pkt_done_cnt; 21 bcm_pkt_cb_f chain_done_cb; 22 void *cookie; 23 } tx_dv_info_t; 24 25 /* 26 * TX DV INFO structure maintains information about a TX chain. 27 * This includes: Per packet callbacks and the chain done callback. 28 * 29 * Packets are processed in the order they return if any packet in 30 * the chain requires a call back. If none does, then only a chain 31 * done callback is setup/made. 32 * 33 * A "current" packet is maintained in the order the packet's are 34 * set up. The packet-done interrupts will occur in this order. 35 * 36 * TX DV info macros: 37 * 38 * TX_INFO_SET(dv, val) Assign the TX info ptr for a DV 39 * TX_INFO(dv) Access the TX info ptr of a DV 40 * TX_INFO_PKT_ADD(dv) Add pkt ptr to info struct; advance count 41 * TX_INFO_CUR_PKT(dv) Pointer to "current" pkt done being processed 42 * TX_INFO_PKT_MARK_DONE(dv) Advances "current" packet. 43 */ 44 45 #define TX_INFO_SET(dv, val) ((dv)->dv_public1.ptr = val) 46 #define TX_INFO(dv) ((tx_dv_info_t *)((dv)->dv_public1.ptr)) 47 #define TX_INFO_PKT_ADD(dv, pkt) \ 48 TX_INFO(dv)->pkt[TX_INFO(dv)->pkt_count++] = (pkt) 49 #define TX_INFO_CUR_PKT(dv) (TX_INFO(dv)->pkt[TX_INFO(dv)->pkt_done_cnt]) 50 #define TX_INFO_PKT_MARK_DONE(dv) ((TX_INFO(dv)->pkt_done_cnt)++) 51 52 #define TX_DV_NEXT(dv) ((dv_t *)((dv)->dv_public2.ptr)) 53 #define TX_DV_NEXT_SET(dv, dv_next) \ 54 ((dv)->dv_public2.ptr = (void *)(dv_next)) 55 56 /* 57 * Define: TX_EXTRA_DCB_COUNT: 58 * The number of extra DCBs needed to accomodate portions of the 59 * packet such as the HiGig header, SL tag, breaking up a block due 60 * to VLAN tag insertion, etc. 61 */ 62 #define TX_EXTRA_DCB_COUNT 6 63 64 extern void 65 _bcm_rcpu_tx_packet_done_cb(int unit, bcm_pkt_t *pkt); 66 67 #endif /* !_BCM_INT_TX_H_ */