xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/octeon/cvmx-packet.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************license start***************
2*4882a593Smuzhiyun  * Author: Cavium Networks
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Contact: support@caviumnetworks.com
5*4882a593Smuzhiyun  * This file is part of the OCTEON SDK
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 2003-2008 Cavium Networks
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file is free software; you can redistribute it and/or modify
10*4882a593Smuzhiyun  * it under the terms of the GNU General Public License, Version 2, as
11*4882a593Smuzhiyun  * published by the Free Software Foundation.
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * This file is distributed in the hope that it will be useful, but
14*4882a593Smuzhiyun  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15*4882a593Smuzhiyun  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16*4882a593Smuzhiyun  * NONINFRINGEMENT.  See the GNU General Public License for more
17*4882a593Smuzhiyun  * details.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License
20*4882a593Smuzhiyun  * along with this file; if not, write to the Free Software
21*4882a593Smuzhiyun  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22*4882a593Smuzhiyun  * or visit http://www.gnu.org/licenses/.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * This file may also be available under a different license from Cavium.
25*4882a593Smuzhiyun  * Contact Cavium Networks for more information
26*4882a593Smuzhiyun  ***********************license end**************************************/
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /*
29*4882a593Smuzhiyun  * Packet buffer defines.
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifndef __CVMX_PACKET_H__
33*4882a593Smuzhiyun #define __CVMX_PACKET_H__
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /**
36*4882a593Smuzhiyun  * This structure defines a buffer pointer on Octeon
37*4882a593Smuzhiyun  */
38*4882a593Smuzhiyun union cvmx_buf_ptr {
39*4882a593Smuzhiyun 	void *ptr;
40*4882a593Smuzhiyun 	uint64_t u64;
41*4882a593Smuzhiyun 	struct {
42*4882a593Smuzhiyun #ifdef __BIG_ENDIAN_BITFIELD
43*4882a593Smuzhiyun 		/* if set, invert the "free" pick of the overall
44*4882a593Smuzhiyun 		 * packet. HW always sets this bit to 0 on inbound
45*4882a593Smuzhiyun 		 * packet */
46*4882a593Smuzhiyun 		uint64_t i:1;
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun 		/* Indicates the amount to back up to get to the
49*4882a593Smuzhiyun 		 * buffer start in cache lines. In most cases this is
50*4882a593Smuzhiyun 		 * less than one complete cache line, so the value is
51*4882a593Smuzhiyun 		 * zero */
52*4882a593Smuzhiyun 		uint64_t back:4;
53*4882a593Smuzhiyun 		/* The pool that the buffer came from / goes to */
54*4882a593Smuzhiyun 		uint64_t pool:3;
55*4882a593Smuzhiyun 		/* The size of the segment pointed to by addr (in bytes) */
56*4882a593Smuzhiyun 		uint64_t size:16;
57*4882a593Smuzhiyun 		/* Pointer to the first byte of the data, NOT buffer */
58*4882a593Smuzhiyun 		uint64_t addr:40;
59*4882a593Smuzhiyun #else
60*4882a593Smuzhiyun 	        uint64_t addr:40;
61*4882a593Smuzhiyun 	        uint64_t size:16;
62*4882a593Smuzhiyun 	        uint64_t pool:3;
63*4882a593Smuzhiyun 	        uint64_t back:4;
64*4882a593Smuzhiyun 	        uint64_t i:1;
65*4882a593Smuzhiyun #endif
66*4882a593Smuzhiyun 	} s;
67*4882a593Smuzhiyun };
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun #endif /*  __CVMX_PACKET_H__ */
70