Imported Upstream version 16.07-rc1
[deb_dpdk.git] / drivers / net / enic / base / vnic_enet.h
1 /*
2  * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
3  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
4  *
5  * Copyright (c) 2014, Cisco Systems, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34
35 #ifndef _VNIC_ENIC_H_
36 #define _VNIC_ENIC_H_
37
38 /* Hardware intr coalesce timer is in units of 1.5us */
39 #define INTR_COALESCE_USEC_TO_HW(usec) ((usec) * 2 / 3)
40 #define INTR_COALESCE_HW_TO_USEC(usec) ((usec) * 3 / 2)
41
42 /* Device-specific region: enet configuration */
43 struct vnic_enet_config {
44         u32 flags;
45         u32 wq_desc_count;
46         u32 rq_desc_count;
47         u16 mtu;
48         u16 intr_timer_deprecated;
49         u8 intr_timer_type;
50         u8 intr_mode;
51         char devname[16];
52         u32 intr_timer_usec;
53         u16 loop_tag;
54         u16 vf_rq_count;
55         u16 num_arfs;
56         u64 mem_paddr;
57         u16 rdma_qp_id;
58         u16 rdma_qp_count;
59         u16 rdma_resgrp;
60         u32 rdma_mr_id;
61         u32 rdma_mr_count;
62         u32 max_pkt_size;
63 };
64
65 #define VENETF_TSO              0x1     /* TSO enabled */
66 #define VENETF_LRO              0x2     /* LRO enabled */
67 #define VENETF_RXCSUM           0x4     /* RX csum enabled */
68 #define VENETF_TXCSUM           0x8     /* TX csum enabled */
69 #define VENETF_RSS              0x10    /* RSS enabled */
70 #define VENETF_RSSHASH_IPV4     0x20    /* Hash on IPv4 fields */
71 #define VENETF_RSSHASH_TCPIPV4  0x40    /* Hash on TCP + IPv4 fields */
72 #define VENETF_RSSHASH_IPV6     0x80    /* Hash on IPv6 fields */
73 #define VENETF_RSSHASH_TCPIPV6  0x100   /* Hash on TCP + IPv6 fields */
74 #define VENETF_RSSHASH_IPV6_EX  0x200   /* Hash on IPv6 extended fields */
75 #define VENETF_RSSHASH_TCPIPV6_EX 0x400 /* Hash on TCP + IPv6 ext. fields */
76 #define VENETF_LOOP             0x800   /* Loopback enabled */
77 #define VENETF_FAILOVER         0x1000  /* Fabric failover enabled */
78 #define VENETF_USPACE_NIC       0x2000  /* vHPC enabled */
79 #define VENETF_VMQ      0x4000 /* VMQ enabled */
80 #define VENETF_ARFS             0x8000  /* ARFS enabled */
81 #define VENETF_VXLAN    0x10000 /* VxLAN offload */
82 #define VENETF_NVGRE    0x20000 /* NVGRE offload */
83 #define VENETF_GRPINTR  0x40000 /* group interrupt */
84
85 #define VENET_INTR_TYPE_MIN     0       /* Timer specs min interrupt spacing */
86 #define VENET_INTR_TYPE_IDLE    1       /* Timer specs idle time before irq */
87
88 #define VENET_INTR_MODE_ANY     0       /* Try MSI-X, then MSI, then INTx */
89 #define VENET_INTR_MODE_MSI     1       /* Try MSI then INTx */
90 #define VENET_INTR_MODE_INTX    2       /* Try INTx only */
91
92 #endif /* _VNIC_ENIC_H_ */