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/net/ethernet.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/net/ethernet.c') diff --git a/src/net/ethernet.c b/src/net/ethernet.c index 6c5f7879d..5e2793f94 100644 --- a/src/net/ethernet.c +++ b/src/net/ethernet.c @@ -145,9 +145,26 @@ struct ll_protocol ethernet_protocol __ll_protocol = { .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; +} -- cgit v1.2.3-55-g7522