From d09290161e33574d8f0fa900ebe739214d17fe1a Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 17 Jul 2009 22:48:31 +0100 Subject: [netdevice] Make ll_broadcast per-netdevice rather than per-ll_protocol IPoIB has a link-layer broadcast address that varies according to the partition key. We currently go through several contortions to pretend that the link-layer address is a fixed constant; by making the broadcast address a property of the network device rather than the link-layer protocol it will be possible to simplify IPoIB's broadcast handling. --- src/drivers/net/ipoib.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/drivers/net/ipoib.c') 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; +} -- cgit v1.2.3-55-g7522