Home | History | Annotate | Line # | Download | only in dev
      1 /*	$NetBSD: if_cnmacvar.h,v 1.5 2022/09/18 11:38:48 thorpej Exp $	*/
      2 
      3 #undef DEBUG
      4 #ifdef DEBUG
      5 #define	dprintf printf
      6 #else
      7 #define	dprintf(...)
      8 #endif
      9 
     10 #define	IS_MAC_MULTICASTBIT(addr) \
     11         ((addr)[0] & 0x01)
     12 
     13 #define	SEND_QUEUE_SIZE		(32)
     14 #define	GATHER_QUEUE_SIZE	(1024)
     15 #define	FREE_QUEUE_SIZE		GATHER_QUEUE_SIZE
     16 #define	RECV_QUEUE_SIZE		(GATHER_QUEUE_SIZE * 2)
     17 
     18 /* Number of mbufs per port to keep in the packet pool */
     19 #define	CNMAC_MBUFS_PER_PORT	256
     20 
     21 /* XXX MUST BE REPLACED WITH BUS_DMA!!! */
     22 paddr_t kvtophys(vaddr_t);
     23 /* XXX MUST BE REPLACED WITH BUS_DMA!!! */
     24 
     25 struct _send_queue_entry;
     26 struct octsmi_softc;
     27 struct octgmx_port_softc;
     28 struct octipd_softc;
     29 struct octpip_softc;
     30 struct octpko_softc;
     31 struct octpow_softc;
     32 
     33 extern struct octpow_softc	octpow_softc;
     34 
     35 struct cnmac_softc {
     36 	device_t		sc_dev;
     37 	bus_space_tag_t		sc_regt;
     38 	bus_dma_tag_t		sc_dmat;
     39 
     40 	void			*sc_ih;
     41 
     42 	struct octpip_softc	*sc_pip;
     43 	struct octipd_softc	*sc_ipd;
     44 	struct octpko_softc	*sc_pko;
     45 	struct octsmi_softc	*sc_smi;
     46 	struct octgmx_softc	*sc_gmx;
     47 	struct octgmx_port_softc
     48 				*sc_gmx_port;
     49 	struct octpow_softc	*sc_pow;
     50 
     51 	struct ethercom		sc_ethercom;
     52 	struct mii_data		sc_mii;
     53 
     54 	void			*sc_sdhook;
     55 
     56 	struct callout		sc_tick_misc_ch;
     57 	struct callout		sc_tick_free_ch;
     58 
     59 	int64_t			sc_soft_req_cnt;
     60 	int64_t			sc_soft_req_thresh;
     61 	int64_t			sc_hard_done_cnt;
     62 	int			sc_flush;
     63 	int			sc_prefetch;
     64 	SIMPLEQ_HEAD(, _send_queue_entry)
     65 				sc_sendq;
     66 	uint64_t		sc_ext_callback_cnt;
     67 	bool			sc_txbusy;
     68 
     69 	uint32_t		sc_port;
     70 	uint32_t		sc_port_type;
     71 	uint32_t		sc_init_flag;
     72 	int			sc_powgroup;
     73 
     74 	/*
     75 	 * Redirection - received (input) packets are redirected (directly sent)
     76 	 * to another port.  Only meant to test hardware + driver performance.
     77 	 *
     78 	 *  0	- disabled
     79 	 * >0	- redirected to ports that correspond to bits
     80 	 *		0b001 (0x1)	- Port 0
     81 	 *		0b010 (0x2)	- Port 1
     82 	 *		0b100 (0x4)	- Port 2
     83 	 */
     84 	int			sc_redir;
     85 
     86 	struct octfau_desc	sc_fau_done;
     87 	struct octpko_cmdptr_desc
     88 				sc_cmdptr;
     89 
     90 	size_t			sc_ip_offset;
     91 
     92 	struct timeval		sc_rxerr_log_last;
     93 
     94 	int			sc_quirks;
     95 };
     96