ll_dest = destaddr;
DBG2 ( " DEST %s", ll_protocol->ntoa ( ll_dest ) );
} else {
- ll_dest = ll_protocol->ll_broadcast;
+ ll_dest = pxe_netdev->ll_broadcast;
DBG2 ( " BCAST" );
}
.ll_proto = htons ( ARPHRD_INFINIBAND ),
.ll_addr_len = IPOIB_ALEN,
.ll_header_len = IPOIB_HLEN,
- .ll_broadcast = ( uint8_t * ) &ipoib_broadcast,
.push = ipoib_push,
.pull = ipoib_pull,
.ntoa = ipoib_ntoa,
netdev_nullify ( netdev );
netdev_put ( netdev );
}
+
+/**
+ * Allocate IPoIB device
+ *
+ * @v priv_size Size of driver private data
+ * @ret netdev Network device, or NULL
+ */
+struct net_device * alloc_ipoibdev ( size_t priv_size ) {
+ struct net_device *netdev;
+
+ netdev = alloc_netdev ( priv_size );
+ if ( netdev ) {
+ netdev->ll_protocol = &ipoib_protocol;
+ netdev->ll_broadcast = ( uint8_t * ) &ipoib_broadcast;
+ netdev->max_pkt_len = IPOIB_PKT_LEN;
+ }
+ return netdev;
+}
/* Do not remove this message */
printf ( "WARNING: Using legacy NIC wrapper on %s\n",
- ethernet_protocol.ntoa ( nic.node_addr ) );
+ netdev->ll_protocol->ntoa ( nic.node_addr ) );
legacy_registered = 1;
return 0;
* firmware doesn't currently support this.
*/
if ( ( rc = phantom_add_macaddr ( phantom,
- netdev->ll_protocol->ll_broadcast ) ) != 0 )
+ netdev->ll_broadcast ) ) != 0 )
goto err_add_macaddr_broadcast;
if ( ( rc = phantom_add_macaddr ( phantom,
netdev->ll_addr ) ) != 0 )
phantom_del_macaddr ( phantom, netdev->ll_addr );
err_add_macaddr_unicast:
- phantom_del_macaddr ( phantom,
- netdev->ll_protocol->ll_broadcast );
+ phantom_del_macaddr ( phantom, netdev->ll_broadcast );
err_add_macaddr_broadcast:
phantom_destroy_tx_ctx ( phantom );
err_create_tx_ctx:
/* Shut down the port */
phantom_del_macaddr ( phantom, netdev->ll_addr );
- phantom_del_macaddr ( phantom,
- netdev->ll_protocol->ll_broadcast );
+ phantom_del_macaddr ( phantom, netdev->ll_broadcast );
phantom_destroy_tx_ctx ( phantom );
phantom_destroy_rx_ctx ( phantom );
free_dma ( phantom->desc, sizeof ( *(phantom->desc) ) );
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
-#include <gpxe/netdevice.h>
-#include <gpxe/if_ether.h>
-
-extern struct ll_protocol ethernet_protocol;
extern const char * eth_ntoa ( const void *ll_addr );
-
-/**
- * Allocate Ethernet device
- *
- * @v priv_size Size of driver private data
- * @ret netdev Network device, or NULL
- */
-static inline struct net_device * alloc_etherdev ( size_t priv_size ) {
- struct net_device *netdev;
-
- netdev = alloc_netdev ( priv_size );
- if ( netdev ) {
- netdev->ll_protocol = ðernet_protocol;
- netdev->max_pkt_len = ETH_FRAME_LEN;
- }
- return netdev;
-}
+extern struct net_device * alloc_etherdev ( size_t priv_size );
#endif /* _GPXE_ETHERNET_H */
} __attribute__ (( packed )) u;
} __attribute__ (( packed ));
-extern struct ll_protocol ipoib_protocol;
-
extern const char * ipoib_ntoa ( const void *ll_addr );
-
-/**
- * Allocate IPoIB device
- *
- * @v priv_size Size of driver private data
- * @ret netdev Network device, or NULL
- */
-static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
- struct net_device *netdev;
-
- netdev = alloc_netdev ( priv_size );
- if ( netdev ) {
- netdev->ll_protocol = &ipoib_protocol;
- netdev->max_pkt_len = IPOIB_PKT_LEN;
- }
- return netdev;
-}
-
extern void ipoib_link_state_changed ( struct ib_device *ibdev );
extern int ipoib_probe ( struct ib_device *ibdev );
extern void ipoib_remove ( struct ib_device *ibdev );
+extern struct net_device * alloc_ipoibdev ( size_t priv_size );
#endif /* _GPXE_IPOIB_H */
uint8_t ll_addr_len;
/** Link-layer header length */
uint8_t ll_header_len;
- /** Link-layer broadcast address */
- const uint8_t *ll_broadcast;
};
/** Network device operations */
* For Ethernet, this is the MAC address.
*/
uint8_t ll_addr[MAX_LL_ADDR_LEN];
+ /** Link-layer broadcast address */
+ const uint8_t *ll_broadcast;
/** Current device state
*
EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST );
assert ( ll_addr_len <= sizeof ( mode->CurrentAddress ) );
memcpy ( &mode->CurrentAddress, netdev->ll_addr, ll_addr_len );
- memcpy ( &mode->BroadcastAddress, netdev->ll_protocol->ll_broadcast,
- ll_addr_len );
+ memcpy ( &mode->BroadcastAddress, netdev->ll_broadcast, ll_addr_len );
memcpy ( &mode->PermanentAddress, netdev->ll_addr, ll_addr_len );
mode->IfType = ntohs ( netdev->ll_protocol->ll_proto );
mode->MacAddressChangeable = TRUE;
return -ENOMEM;
aoe->refcnt.free = aoe_free;
aoe->netdev = netdev_get ( netdev );
- memcpy ( aoe->target, ethernet_protocol.ll_broadcast,
- sizeof ( aoe->target ) );
+ memcpy ( aoe->target, netdev->ll_broadcast, sizeof ( aoe->target ) );
aoe->tag = AOE_TAG_MAGIC;
aoe->timer.expired = aoe_timer_expired;
/* Transmit ARP request */
if ( ( rc = net_tx ( iobuf, netdev, &arp_protocol,
- ll_protocol->ll_broadcast ) ) != 0 )
+ netdev->ll_broadcast ) ) != 0 )
return rc;
return -ENOENT;
.ll_proto = htons ( ARPHRD_ETHER ),
.ll_addr_len = ETH_ALEN,
.ll_header_len = ETH_HLEN,
- .ll_broadcast = eth_broadcast,
.push = eth_push,
.pull = eth_pull,
.ntoa = eth_ntoa,
.mc_hash = eth_mc_hash,
};
+
+/**
+ * Allocate Ethernet device
+ *
+ * @v priv_size Size of driver private data
+ * @ret netdev Network device, or NULL
+ */
+struct net_device * alloc_etherdev ( size_t priv_size ) {
+ struct net_device *netdev;
+
+ netdev = alloc_netdev ( priv_size );
+ if ( netdev ) {
+ netdev->ll_protocol = ðernet_protocol;
+ netdev->ll_broadcast = eth_broadcast;
+ netdev->max_pkt_len = ETH_FRAME_LEN;
+ }
+ return netdev;
+}
if ( dest.s_addr == INADDR_BROADCAST ) {
/* Broadcast address */
- memcpy ( ll_dest, ll_protocol->ll_broadcast,
+ memcpy ( ll_dest, netdev->ll_broadcast,
ll_protocol->ll_addr_len );
return 0;
} else if ( IN_MULTICAST ( ntohl ( dest.s_addr ) ) ) {