Merge branch 'fix/hda-samsung-p50' into topic/hda
[pandora-kernel.git] / drivers / staging / octeon / ethernet-defines.h
1 /**********************************************************************
2  * Author: Cavium Networks
3  *
4  * Contact: support@caviumnetworks.com
5  * This file is part of the OCTEON SDK
6  *
7  * Copyright (c) 2003-2007 Cavium Networks
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License, Version 2, as
11  * published by the Free Software Foundation.
12  *
13  * This file is distributed in the hope that it will be useful, but
14  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16  * NONINFRINGEMENT.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this file; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  * or visit http://www.gnu.org/licenses/.
23  *
24  * This file may also be available under a different license from Cavium.
25  * Contact Cavium Networks for more information
26 **********************************************************************/
27
28 /*
29  * A few defines are used to control the operation of this driver:
30  *  CONFIG_CAVIUM_RESERVE32
31  *      This kernel config options controls the amount of memory configured
32  *      in a wired TLB entry for all processes to share. If this is set, the
33  *      driver will use this memory instead of kernel memory for pools. This
34  *      allows 32bit userspace application to access the buffers, but also
35  *      requires all received packets to be copied.
36  *  CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS
37  *      This kernel config option allows the user to control the number of
38  *      packet and work queue buffers allocated by the driver. If this is zero,
39  *      the driver uses the default from below.
40  *  USE_SKBUFFS_IN_HW
41  *      Tells the driver to populate the packet buffers with kernel skbuffs.
42  *      This allows the driver to receive packets without copying them. It also
43  *      means that 32bit userspace can't access the packet buffers.
44  *  USE_32BIT_SHARED
45  *      This define tells the driver to allocate memory for buffers from the
46  *      32bit sahred region instead of the kernel memory space.
47  *  USE_HW_TCPUDP_CHECKSUM
48  *      Controls if the Octeon TCP/UDP checksum engine is used for packet
49  *      output. If this is zero, the kernel will perform the checksum in
50  *      software.
51  *  USE_MULTICORE_RECEIVE
52  *      Process receive interrupts on multiple cores. This spreads the network
53  *      load across the first 8 processors. If ths is zero, only one core
54  *      processes incomming packets.
55  *  USE_ASYNC_IOBDMA
56  *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
57  *      IOBDMAs to issue IO accesses without stalling. Set this to zero
58  *      to disable this. Note that IOBDMAs require CVMSEG.
59  *  REUSE_SKBUFFS_WITHOUT_FREE
60  *      Allows the TX path to free an skbuff into the FPA hardware pool. This
61  *      can significantly improve performance for forwarding and bridging, but
62  *      may be somewhat dangerous. Checks are made, but if any buffer is reused
63  *      without the proper Linux cleanup, the networking stack may have very
64  *      bizarre bugs.
65  */
66 #ifndef __ETHERNET_DEFINES_H__
67 #define __ETHERNET_DEFINES_H__
68
69 #include "cvmx-config.h"
70
71
72 #define OCTEON_ETHERNET_VERSION "1.9"
73
74 #ifndef CONFIG_CAVIUM_RESERVE32
75 #define CONFIG_CAVIUM_RESERVE32 0
76 #endif
77
78 #if CONFIG_CAVIUM_RESERVE32
79 #define USE_32BIT_SHARED            1
80 #define USE_SKBUFFS_IN_HW           0
81 #define REUSE_SKBUFFS_WITHOUT_FREE  0
82 #else
83 #define USE_32BIT_SHARED            0
84 #define USE_SKBUFFS_IN_HW           1
85 #ifdef CONFIG_NETFILTER
86 #define REUSE_SKBUFFS_WITHOUT_FREE  0
87 #else
88 #define REUSE_SKBUFFS_WITHOUT_FREE  1
89 #endif
90 #endif
91
92 /* Max interrupts per second per core */
93 #define INTERRUPT_LIMIT             10000
94
95 /* Don't limit the number of interrupts */
96 /*#define INTERRUPT_LIMIT             0     */
97 #define USE_HW_TCPUDP_CHECKSUM      1
98
99 #define USE_MULTICORE_RECEIVE       1
100
101 /* Enable Random Early Dropping under load */
102 #define USE_RED                     1
103 #define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
104
105 /*
106  * Allow SW based preamble removal at 10Mbps to workaround PHYs giving
107  * us bad preambles.
108  */
109 #define USE_10MBPS_PREAMBLE_WORKAROUND 1
110 /*
111  * Use this to have all FPA frees also tell the L2 not to write data
112  * to memory.
113  */
114 #define DONT_WRITEBACK(x)           (x)
115 /* Use this to not have FPA frees control L2 */
116 /*#define DONT_WRITEBACK(x)         0   */
117
118 /* Maximum number of packets to process per interrupt. */
119 #define MAX_RX_PACKETS 120
120 /* Maximum number of SKBs to try to free per xmit packet. */
121 #define MAX_SKB_TO_FREE 10
122 #define MAX_OUT_QUEUE_DEPTH 1000
123
124 #ifndef CONFIG_SMP
125 #undef USE_MULTICORE_RECEIVE
126 #define USE_MULTICORE_RECEIVE 0
127 #endif
128
129 #define IP_PROTOCOL_TCP             6
130 #define IP_PROTOCOL_UDP             0x11
131
132 #define FAU_NUM_PACKET_BUFFERS_TO_FREE (CVMX_FAU_REG_END - sizeof(uint32_t))
133 #define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS+1)
134
135
136 #endif /* __ETHERNET_DEFINES_H__ */