dm thin metadata: fix __udivdi3 undefined on 32-bit
[linux/fpc-iii.git] / drivers / staging / octeon / ethernet-util.h
blob45f024bc5e33f777d2a320633dff9eb55dfac64d
1 /*
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.
9 */
11 #include <asm/octeon/cvmx-pip.h>
12 #include <asm/octeon/cvmx-helper.h>
13 #include <asm/octeon/cvmx-helper-util.h>
15 /**
16 * cvm_oct_get_buffer_ptr - convert packet data address to pointer
17 * @packet_ptr: Packet data hardware address
19 * Returns Packet buffer pointer
21 static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
23 return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
24 << 7);
27 /**
28 * INTERFACE - convert IPD port to logical interface
29 * @ipd_port: Port to check
31 * Returns Logical interface
33 static inline int INTERFACE(int ipd_port)
35 int interface = cvmx_helper_get_interface_num(ipd_port);
37 if (interface >= 0)
38 return interface;
39 else if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
40 return 10;
41 panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port);
44 /**
45 * INDEX - convert IPD/PKO port number to the port's interface index
46 * @ipd_port: Port to check
48 * Returns Index into interface port list
50 static inline int INDEX(int ipd_port)
52 return cvmx_helper_get_interface_index_num(ipd_port);