GNU Linux-libre 4.19.245-gnu1
[releases.git] / drivers / staging / octeon / ethernet-defines.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This file is based on code from OCTEON SDK by Cavium Networks.
4  *
5  * Copyright (c) 2003-2007 Cavium Networks
6  */
7
8 /*
9  * A few defines are used to control the operation of this driver:
10  *  USE_ASYNC_IOBDMA
11  *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
12  *      IOBDMAs to issue IO accesses without stalling. Set this to zero
13  *      to disable this. Note that IOBDMAs require CVMSEG.
14  *  REUSE_SKBUFFS_WITHOUT_FREE
15  *      Allows the TX path to free an skbuff into the FPA hardware pool. This
16  *      can significantly improve performance for forwarding and bridging, but
17  *      may be somewhat dangerous. Checks are made, but if any buffer is reused
18  *      without the proper Linux cleanup, the networking stack may have very
19  *      bizarre bugs.
20  */
21 #ifndef __ETHERNET_DEFINES_H__
22 #define __ETHERNET_DEFINES_H__
23
24 #include <asm/octeon/cvmx-config.h>
25
26 #ifdef CONFIG_NETFILTER
27 #define REUSE_SKBUFFS_WITHOUT_FREE  0
28 #else
29 #define REUSE_SKBUFFS_WITHOUT_FREE  1
30 #endif
31
32 #define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
33
34 /* Maximum number of SKBs to try to free per xmit packet. */
35 #define MAX_OUT_QUEUE_DEPTH 1000
36
37 #define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32))
38 #define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32))
39
40 #define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS + 1)
41
42 #endif /* __ETHERNET_DEFINES_H__ */