1 /* SPDX-License-Identifier: GPL-2.0 */
3 * This file is based on code from OCTEON SDK by Cavium Networks.
5 * Copyright (c) 2003-2007 Cavium Networks
9 * cvm_oct_get_buffer_ptr - convert packet data address to pointer
10 * @packet_ptr: Packet data hardware address
12 * Returns Packet buffer pointer
14 static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr
)
16 return cvmx_phys_to_ptr(((packet_ptr
.s
.addr
>> 7) - packet_ptr
.s
.back
)
21 * INTERFACE - convert IPD port to logical interface
22 * @ipd_port: Port to check
24 * Returns Logical interface
26 static inline int INTERFACE(int ipd_port
)
30 if (ipd_port
== CVMX_PIP_NUM_INPUT_PORTS
)
32 interface
= cvmx_helper_get_interface_num(ipd_port
);
35 panic("Illegal ipd_port %d passed to %s\n", ipd_port
, __func__
);
39 * INDEX - convert IPD/PKO port number to the port's interface index
40 * @ipd_port: Port to check
42 * Returns Index into interface port list
44 static inline int INDEX(int ipd_port
)
46 return cvmx_helper_get_interface_index_num(ipd_port
);