mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) ) );
|
||||
|
||||
Reference in New Issue
Block a user