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