aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/ipoib.c19
-rw-r--r--src/drivers/net/legacy.c2
-rw-r--r--src/drivers/net/phantom/phantom.c8
3 files changed, 22 insertions, 7 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index bb8757b43..d330d5a5a 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -348,7 +348,6 @@ struct ll_protocol ipoib_protocol __ll_protocol = {
.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,
@@ -1132,3 +1131,21 @@ void ipoib_remove ( struct ib_device *ibdev ) {
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;
+}
diff --git a/src/drivers/net/legacy.c b/src/drivers/net/legacy.c
index 4977076c0..c4bfc96a9 100644
--- a/src/drivers/net/legacy.c
+++ b/src/drivers/net/legacy.c
@@ -122,7 +122,7 @@ int legacy_probe ( void *hwdev,
/* 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;
diff --git a/src/drivers/net/phantom/phantom.c b/src/drivers/net/phantom/phantom.c
index ad17cdfe7..85949c296 100644
--- a/src/drivers/net/phantom/phantom.c
+++ b/src/drivers/net/phantom/phantom.c
@@ -1156,7 +1156,7 @@ static int phantom_open ( struct net_device *netdev ) {
* 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 )
@@ -1166,8 +1166,7 @@ static int phantom_open ( struct net_device *netdev ) {
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:
@@ -1191,8 +1190,7 @@ static void phantom_close ( struct net_device *netdev ) {
/* 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) ) );