2 * This file is based on code from OCTEON SDK by Cavium Networks.
4 * Copyright (c) 2003-2007 Cavium Networks
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, Version 2, as
8 * published by the Free Software Foundation.
12 * cvm_oct_get_buffer_ptr - convert packet data address to pointer
13 * @packet_ptr: Packet data hardware address
15 * Returns Packet buffer pointer
17 static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
19 return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
24 * INTERFACE - convert IPD port to logical interface
25 * @ipd_port: Port to check
27 * Returns Logical interface
29 static inline int INTERFACE(int ipd_port)
31 if (ipd_port < 32) /* Interface 0 or 1 for RGMII,GMII,SPI, etc */
33 else if (ipd_port < 36) /* Interface 2 for NPI */
35 else if (ipd_port < 40) /* Interface 3 for loopback */
37 else if (ipd_port == 40) /* Non existent interface for POW0 */
39 panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port);
43 * INDEX - convert IPD/PKO port number to the port's interface index
44 * @ipd_port: Port to check
46 * Returns Index into interface port list
48 static inline int INDEX(int ipd_port)