iPXE
eoib.h
Go to the documentation of this file.
1 #ifndef _IPXE_EOIB_H
2 #define _IPXE_EOIB_H
3 
4 /** @file
5  *
6  * Ethernet over Infiniband
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <byteswap.h>
14 #include <ipxe/netdevice.h>
15 #include <ipxe/infiniband.h>
16 #include <ipxe/ib_mcast.h>
17 
18 /** An EoIB header */
19 struct eoib_header {
20  /** Signature */
22  /** Reserved */
24 } __attribute__ (( packed ));
25 
26 /** EoIB magic signature */
27 #define EOIB_MAGIC 0x8919
28 
29 /** An EoIB device */
30 struct eoib_device {
31  /** Name */
32  const char *name;
33  /** Network device */
34  struct net_device *netdev;
35  /** Underlying Infiniband device */
36  struct ib_device *ibdev;
37  /** List of EoIB devices */
38  struct list_head list;
39  /** Broadcast address */
41 
42  /** Completion queue */
44  /** Queue pair */
45  struct ib_queue_pair *qp;
46  /** Broadcast group membership */
48 
49  /** Peer cache */
50  struct list_head peers;
51 
52  /** Send duplicate packet to gateway (or NULL)
53  *
54  * @v eoib EoIB device
55  * @v original Original I/O buffer
56  */
57  void ( * duplicate ) ( struct eoib_device *eoib,
58  struct io_buffer *original );
59  /** Gateway (if any) */
61  /** Multicast group additional component mask */
62  unsigned int mask;
63 };
64 
65 /**
66  * Check if EoIB device uses a gateway
67  *
68  * @v eoib EoIB device
69  * @v has_gw EoIB device uses a gateway
70  */
71 static inline int eoib_has_gateway ( struct eoib_device *eoib ) {
72 
73  return ( eoib->duplicate != NULL );
74 }
75 
76 /**
77  * Force creation of multicast group
78  *
79  * @v eoib EoIB device
80  */
81 static inline void eoib_force_group_creation ( struct eoib_device *eoib ) {
82 
83  /* Some dubious EoIB implementations require each endpoint to
84  * force the creation of the multicast group. Yes, this makes
85  * it impossible for the group parameters (e.g. SL) to ever be
86  * modified without breaking backwards compatiblity with every
87  * existing driver.
88  */
92 }
93 
94 extern int eoib_create ( struct ib_device *ibdev, const uint8_t *hw_addr,
95  struct ib_address_vector *broadcast,
96  const char *name );
97 extern struct eoib_device * eoib_find ( struct ib_device *ibdev,
98  const uint8_t *hw_addr );
99 extern void eoib_destroy ( struct eoib_device *eoib );
100 extern void eoib_set_gateway ( struct eoib_device *eoib,
101  struct ib_address_vector *av );
102 
103 #endif /* _IPXE_EOIB_H */
#define __attribute__(x)
Definition: compiler.h:10
const char * name
Definition: ath9k_hw.c:1984
Infiniband protocol.
unsigned short uint16_t
Definition: stdint.h:11
struct list_head peers
Peer cache.
Definition: eoib.h:50
struct ib_address_vector broadcast
Broadcast address.
Definition: eoib.h:40
#define IB_SA_MCMEMBER_REC_SL
Definition: ib_mad.h:290
Infiniband multicast groups.
An EoIB device.
Definition: eoib.h:30
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void eoib_destroy(struct eoib_device *eoib)
Remove EoIB device.
Definition: eoib.c:695
const char * name
Name.
Definition: eoib.h:32
struct ib_completion_queue * cq
Completion queue.
Definition: eoib.h:43
A doubly-linked list entry (or list head)
Definition: list.h:18
An Infiniband device.
Definition: infiniband.h:398
#define IB_SA_MCMEMBER_REC_PKEY
Definition: ib_mad.h:285
void eoib_set_gateway(struct eoib_device *eoib, struct ib_address_vector *av)
Set EoIB gateway.
Definition: eoib.c:881
#define IB_SA_MCMEMBER_REC_QKEY
Definition: ib_mad.h:280
static void eoib_force_group_creation(struct eoib_device *eoib)
Force creation of multicast group.
Definition: eoib.h:81
struct ib_mc_membership membership
Broadcast group membership.
Definition: eoib.h:47
struct list_head list
List of EoIB devices.
Definition: eoib.h:38
unsigned int mask
Multicast group additional component mask.
Definition: eoib.h:62
struct eoib_device * eoib_find(struct ib_device *ibdev, const uint8_t *hw_addr)
Find EoIB device.
Definition: eoib.c:677
struct net_device * netdev
Network device.
Definition: eoib.h:34
An Infiniband multicast group membership.
Definition: ib_mcast.h:17
static int eoib_has_gateway(struct eoib_device *eoib)
Check if EoIB device uses a gateway.
Definition: eoib.h:71
struct ib_device * ibdev
Underlying Infiniband device.
Definition: eoib.h:36
An EoIB header.
Definition: eoib.h:19
void(* duplicate)(struct eoib_device *eoib, struct io_buffer *original)
Send duplicate packet to gateway (or NULL)
Definition: eoib.h:57
A network device.
Definition: netdevice.h:352
An Infiniband Completion Queue.
Definition: infiniband.h:224
unsigned char uint8_t
Definition: stdint.h:10
#define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS
Definition: ib_mad.h:284
uint16_t magic
Signature.
Definition: eoib.h:21
An Infiniband Queue Pair.
Definition: infiniband.h:157
Network device management.
struct ib_address_vector gateway
Gateway (if any)
Definition: eoib.h:60
uint16_t reserved
Reserved.
Definition: eoib.h:23
An Infiniband Address Vector.
Definition: infiniband.h:72
#define IB_SA_MCMEMBER_REC_FLOW_LABEL
Definition: ib_mad.h:291
int eoib_create(struct ib_device *ibdev, const uint8_t *hw_addr, struct ib_address_vector *broadcast, const char *name)
Create EoIB device.
Definition: eoib.c:619
struct ib_queue_pair * qp
Queue pair.
Definition: eoib.h:45
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
A persistent I/O buffer.
Definition: iobuf.h:33