[ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headers

Almost all clients of the raw-packet interfaces (UNDI and SNP) can
handle only Ethernet link layers.  Expose an Ethernet-compatible link
layer to local clients, while remaining compatible with IPoIB on the
wire.  This requires manipulation of ARP (but not DHCP) packets within
the IPoIB driver.

This is ugly, but it's the only viable way to allow IPoIB devices to
be driven via the raw-packet interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-08-29 23:34:14 +01:00
parent f54a61e434
commit 03f0c23f8b
8 changed files with 435 additions and 303 deletions

View File

@@ -651,8 +651,6 @@ struct dhcphdr {
#define PXEBS_SETTINGS_NAME "pxebs"
extern uint32_t dhcp_last_xid;
extern unsigned int dhcp_chaddr ( struct net_device *netdev, void *chaddr,
uint16_t *flags );
extern int dhcp_create_packet ( struct dhcp_packet *dhcppkt,
struct net_device *netdev, uint8_t msgtype,
uint32_t xid, const void *options,

View File

@@ -8,6 +8,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/if_arp.h>
#include <ipxe/infiniband.h>
/** IPoIB MAC address length */
@@ -33,25 +34,32 @@ struct ipoib_hdr {
/** Network-layer protocol */
uint16_t proto;
/** Reserved, must be zero */
union {
/** Reserved, must be zero */
uint16_t reserved;
/** Peer addresses
*
* We use these fields internally to represent the
* peer addresses using a lookup key. There simply
* isn't enough room in the IPoIB header to store
* literal source or destination MAC addresses.
*/
struct {
/** Destination address key */
uint8_t dest;
/** Source address key */
uint8_t src;
} __attribute__ (( packed )) peer;
} __attribute__ (( packed )) u;
uint16_t reserved;
} __attribute__ (( packed ));
/** GUID mask used for constructing eIPoIB Local Ethernet MAC address (LEMAC) */
#define IPOIB_GUID_MASK 0xe7
/** eIPoIB Remote Ethernet MAC address
*
* An eIPoIB REMAC address is an Ethernet-like (6 byte) link-layer
* pseudo-address used to look up a full IPoIB link-layer address.
*/
struct ipoib_remac {
/** Remote QPN
*
* Must be ORed with EIPOIB_QPN_LA so that eIPoIB REMAC
* addresses are considered as locally-assigned Ethernet MAC
* addreses.
*/
uint32_t qpn;
/** Remote LID */
uint16_t lid;
} __attribute__ (( packed ));
/** eIPoIB REMAC locally-assigned address indicator */
#define EIPOIB_QPN_LA 0x02000000UL
extern const char * ipoib_ntoa ( const void *ll_addr );
extern struct net_device * alloc_ipoibdev ( size_t priv_size );

View File

@@ -188,8 +188,17 @@ struct ll_protocol {
uint8_t ll_addr_len;
/** Link-layer header length */
uint8_t ll_header_len;
/** Flags */
unsigned int flags;
};
/** Local link-layer address functions only as a name
*
* This flag indicates that the local link-layer address cannot
* directly be used as a destination address by a remote node.
*/
#define LL_NAME_ONLY 0x0001
/** Network device operations */
struct net_device_operations {
/** Open network device