1 #ifndef _IPXE_IPOIB_H
2 #define _IPXE_IPOIB_H
3 
4 /** @file
5  *
6  * IP over Infiniband
7  */
8 
9 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
10 
11 #include <ipxe/if_arp.h>
12 #include <ipxe/infiniband.h>
13 
14 /** IPoIB MAC address length */
15 #define IPOIB_ALEN 20
16 
17 /** An IPoIB MAC address */
18 struct ipoib_mac {
19 	/** Queue pair number
20 	 *
21 	 * MSB indicates support for IPoIB "connected mode".  Lower 24
22 	 * bits are the QPN.
23 	 */
24 	uint32_t flags__qpn;
25 	/** Port GID */
26 	union ib_gid gid;
27 } __attribute__ (( packed ));
28 
29 /** IPoIB link-layer header length */
30 #define IPOIB_HLEN 4
31 
32 /** IPoIB link-layer header */
33 struct ipoib_hdr {
34 	/** Network-layer protocol */
35 	uint16_t proto;
36 	/** Reserved, must be zero */
37 	uint16_t reserved;
38 } __attribute__ (( packed ));
39 
40 /** GUID mask used for constructing eIPoIB Local Ethernet MAC address (LEMAC) */
41 #define IPOIB_GUID_MASK 0xe7
42 
43 /** eIPoIB Remote Ethernet MAC address
44  *
45  * An eIPoIB REMAC address is an Ethernet-like (6 byte) link-layer
46  * pseudo-address used to look up a full IPoIB link-layer address.
47  */
48 struct ipoib_remac {
49 	/** Remote QPN
50 	 *
51 	 * Must be ORed with EIPOIB_QPN_LA so that eIPoIB REMAC
52 	 * addresses are considered as locally-assigned Ethernet MAC
53 	 * addreses.
54 	 */
55 	uint32_t qpn;
56 	/** Remote LID */
57 	uint16_t lid;
58 } __attribute__ (( packed ));
59 
60 /** eIPoIB REMAC locally-assigned address indicator */
61 #define EIPOIB_QPN_LA 0x02000000UL
62 
63 extern const char * ipoib_ntoa ( const void *ll_addr );
64 extern struct net_device * alloc_ipoibdev ( size_t priv_size );
65 extern struct net_device * ipoib_netdev ( struct ib_device *ibdev );
66 
67 #endif /* _IPXE_IPOIB_H */
68