Home | History | Annotate | Line # | Download | only in ixgbe
ixgbe_netbsd.h revision 1.11.12.1
      1  1.11.12.1  thorpej /*$NetBSD: ixgbe_netbsd.h,v 1.11.12.1 2021/04/03 22:28:49 thorpej Exp $*/
      2        1.1   dyoung /*
      3        1.1   dyoung  * Copyright (c) 2011 The NetBSD Foundation, Inc.
      4        1.1   dyoung  * All rights reserved.
      5        1.1   dyoung  *
      6        1.1   dyoung  * This code is derived from software contributed to The NetBSD Foundation
      7        1.1   dyoung  * by Coyote Point Systems, Inc.
      8        1.1   dyoung  *
      9        1.1   dyoung  * Redistribution and use in source and binary forms, with or without
     10        1.1   dyoung  * modification, are permitted provided that the following conditions
     11        1.1   dyoung  * are met:
     12        1.1   dyoung  * 1. Redistributions of source code must retain the above copyright
     13        1.1   dyoung  *    notice, this list of conditions and the following disclaimer.
     14        1.1   dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     15        1.1   dyoung  *    notice, this list of conditions and the following disclaimer in the
     16        1.1   dyoung  *    documentation and/or other materials provided with the distribution.
     17        1.1   dyoung  *
     18        1.1   dyoung  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19        1.1   dyoung  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20        1.1   dyoung  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21        1.1   dyoung  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22        1.1   dyoung  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23        1.1   dyoung  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24        1.1   dyoung  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25        1.1   dyoung  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26        1.1   dyoung  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27        1.1   dyoung  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28        1.1   dyoung  * POSSIBILITY OF SUCH DAMAGE.
     29        1.1   dyoung  */
     30        1.1   dyoung 
     31        1.1   dyoung #ifndef _IXGBE_NETBSD_H
     32        1.1   dyoung #define _IXGBE_NETBSD_H
     33        1.1   dyoung 
     34        1.7  msaitoh #if 0 /* Enable this if you don't want to use TX multiqueue function */
     35        1.3  msaitoh #define	IXGBE_LEGACY_TX	1
     36        1.6  msaitoh #endif
     37        1.3  msaitoh 
     38        1.1   dyoung #define	ETHERCAP_VLAN_HWCSUM	0
     39        1.1   dyoung #define	MJUM9BYTES	(9 * 1024)
     40        1.1   dyoung #define	MJUM16BYTES	(16 * 1024)
     41        1.1   dyoung #define	MJUMPAGESIZE	PAGE_SIZE
     42        1.1   dyoung 
     43  1.11.12.1  thorpej /*
     44  1.11.12.1  thorpej  * Number of jcl per queue is calculated by
     45  1.11.12.1  thorpej  * adapter->num_rx_desc * IXGBE_JCLNUM_MULTI. The lower limit is 2.
     46  1.11.12.1  thorpej  */
     47  1.11.12.1  thorpej #define	IXGBE_JCLNUM_MULTI_LOWLIM	2
     48  1.11.12.1  thorpej #define	IXGBE_JCLNUM_MULTI_DEFAULT	3
     49  1.11.12.1  thorpej #if !defined(IXGBE_JCLNUM_MULTI)
     50  1.11.12.1  thorpej # define IXGBE_JCLNUM_MULTI IXGBE_JCLNUM_MULTI_DEFAULT
     51  1.11.12.1  thorpej #else
     52  1.11.12.1  thorpej # if (IXGBE_JCLNUM_MULTI < IXGBE_JCLNUM_MULTI_LOWLIM)
     53  1.11.12.1  thorpej #  error IXGBE_JCLNUM_MULTI is too low.
     54  1.11.12.1  thorpej # endif
     55  1.11.12.1  thorpej #endif
     56  1.11.12.1  thorpej 
     57        1.1   dyoung #define IFCAP_RXCSUM	\
     58        1.1   dyoung 	(IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\
     59        1.1   dyoung 	IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx)
     60        1.1   dyoung 
     61        1.1   dyoung #define IFCAP_TXCSUM	\
     62        1.1   dyoung 	(IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|\
     63        1.1   dyoung 	IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx)
     64        1.1   dyoung 
     65        1.1   dyoung #define IFCAP_HWCSUM	(IFCAP_RXCSUM|IFCAP_TXCSUM)
     66        1.1   dyoung 
     67        1.1   dyoung struct ixgbe_dma_tag {
     68        1.1   dyoung 	bus_dma_tag_t	dt_dmat;
     69        1.1   dyoung 	bus_size_t	dt_alignment;
     70        1.1   dyoung 	bus_size_t	dt_boundary;
     71        1.1   dyoung 	bus_size_t	dt_maxsize;
     72        1.1   dyoung 	int		dt_nsegments;
     73        1.1   dyoung 	bus_size_t	dt_maxsegsize;
     74        1.1   dyoung 	int		dt_flags;
     75        1.1   dyoung };
     76        1.1   dyoung 
     77        1.1   dyoung typedef struct ixgbe_dma_tag ixgbe_dma_tag_t;
     78        1.1   dyoung 
     79        1.1   dyoung struct ixgbe_extmem_head;
     80        1.1   dyoung typedef struct ixgbe_extmem_head ixgbe_extmem_head_t;
     81        1.1   dyoung 
     82        1.1   dyoung struct ixgbe_extmem {
     83        1.1   dyoung 	ixgbe_extmem_head_t		*em_head;
     84        1.1   dyoung 	bus_dma_tag_t			em_dmat;
     85        1.1   dyoung 	bus_size_t			em_size;
     86        1.1   dyoung 	bus_dma_segment_t		em_seg;
     87        1.1   dyoung 	void				*em_vaddr;
     88        1.1   dyoung 	TAILQ_ENTRY(ixgbe_extmem)	em_link;
     89        1.1   dyoung };
     90        1.1   dyoung 
     91        1.1   dyoung typedef struct ixgbe_extmem ixgbe_extmem_t;
     92        1.1   dyoung 
     93        1.1   dyoung struct ixgbe_extmem_head {
     94        1.1   dyoung 	TAILQ_HEAD(, ixgbe_extmem)	eh_freelist;
     95        1.1   dyoung 	kmutex_t			eh_mtx;
     96        1.1   dyoung 	bool				eh_initialized;
     97        1.1   dyoung };
     98        1.1   dyoung 
     99        1.1   dyoung int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, int,
    100        1.1   dyoung     bus_size_t, int, ixgbe_dma_tag_t **);
    101        1.1   dyoung void ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *);
    102        1.1   dyoung int ixgbe_dmamap_create(ixgbe_dma_tag_t *, int, bus_dmamap_t *);
    103        1.1   dyoung void ixgbe_dmamap_destroy(ixgbe_dma_tag_t *, bus_dmamap_t);
    104        1.1   dyoung void ixgbe_dmamap_sync(ixgbe_dma_tag_t *, bus_dmamap_t, int);
    105        1.1   dyoung void ixgbe_dmamap_unload(ixgbe_dma_tag_t *, bus_dmamap_t);
    106        1.1   dyoung 
    107        1.1   dyoung struct mbuf *ixgbe_getjcl(ixgbe_extmem_head_t *, int, int, int, size_t);
    108        1.4  msaitoh void ixgbe_pci_enable_busmaster(pci_chipset_tag_t, pcitag_t);
    109        1.1   dyoung 
    110        1.9  msaitoh u_int atomic_load_acq_uint(volatile u_int *);
    111        1.9  msaitoh 
    112        1.1   dyoung #endif /* _IXGBE_NETBSD_H */
    113