|  | @@ -42,6 +42,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
 | 
		
	
		
			
			| 42 | 42 |  #include <ipxe/fcoe.h>
 | 
		
	
		
			
			| 43 | 43 |  #include <ipxe/vlan.h>
 | 
		
	
		
			
			| 44 | 44 |  #include <ipxe/bofm.h>
 | 
		
	
		
			
			|  | 45 | +#include <ipxe/nvsvpd.h>
 | 
		
	
		
			
			|  | 46 | +#include <ipxe/nvo.h>
 | 
		
	
		
			
			| 45 | 47 |  #include "hermon.h"
 | 
		
	
		
			
			| 46 | 48 |  
 | 
		
	
		
			
			| 47 | 49 |  /**
 | 
		
	
	
		
			
			|  | @@ -3383,7 +3385,7 @@ static int hermon_register_netdev ( struct hermon *hermon,
 | 
		
	
		
			
			| 3383 | 3385 |  					    &query_port ) ) != 0 ) {
 | 
		
	
		
			
			| 3384 | 3386 |  		DBGC ( hermon, "Hermon %p port %d could not query port: %s\n",
 | 
		
	
		
			
			| 3385 | 3387 |  		       hermon, ibdev->port, strerror ( rc ) );
 | 
		
	
		
			
			| 3386 |  | -		return rc;
 | 
		
	
		
			
			|  | 3388 | +		goto err_query_port;
 | 
		
	
		
			
			| 3387 | 3389 |  	}
 | 
		
	
		
			
			| 3388 | 3390 |  	mac.dwords[0] = htonl ( MLX_GET ( &query_port, mac_47_32 ) );
 | 
		
	
		
			
			| 3389 | 3391 |  	mac.dwords[1] = htonl ( MLX_GET ( &query_port, mac_31_0 ) );
 | 
		
	
	
		
			
			|  | @@ -3394,10 +3396,26 @@ static int hermon_register_netdev ( struct hermon *hermon,
 | 
		
	
		
			
			| 3394 | 3396 |  	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
 | 
		
	
		
			
			| 3395 | 3397 |  		DBGC ( hermon, "Hermon %p port %d could not register network "
 | 
		
	
		
			
			| 3396 | 3398 |  		       "device: %s\n", hermon, ibdev->port, strerror ( rc ) );
 | 
		
	
		
			
			| 3397 |  | -		return rc;
 | 
		
	
		
			
			|  | 3399 | +		goto err_register_netdev;
 | 
		
	
		
			
			|  | 3400 | +	}
 | 
		
	
		
			
			|  | 3401 | +
 | 
		
	
		
			
			|  | 3402 | +	/* Register non-volatile options */
 | 
		
	
		
			
			|  | 3403 | +	if ( ( rc = register_nvo ( &port->nvo,
 | 
		
	
		
			
			|  | 3404 | +				   netdev_settings ( netdev ) ) ) != 0 ) {
 | 
		
	
		
			
			|  | 3405 | +		DBGC ( hermon, "Hermon %p port %d could not register non-"
 | 
		
	
		
			
			|  | 3406 | +		       "volatile options: %s\n",
 | 
		
	
		
			
			|  | 3407 | +		       hermon, ibdev->port, strerror ( rc ) );
 | 
		
	
		
			
			|  | 3408 | +		goto err_register_nvo;
 | 
		
	
		
			
			| 3398 | 3409 |  	}
 | 
		
	
		
			
			| 3399 | 3410 |  
 | 
		
	
		
			
			| 3400 | 3411 |  	return 0;
 | 
		
	
		
			
			|  | 3412 | +
 | 
		
	
		
			
			|  | 3413 | +	unregister_nvo ( &port->nvo );
 | 
		
	
		
			
			|  | 3414 | + err_register_nvo:
 | 
		
	
		
			
			|  | 3415 | +	unregister_netdev ( netdev );
 | 
		
	
		
			
			|  | 3416 | + err_register_netdev:
 | 
		
	
		
			
			|  | 3417 | + err_query_port:
 | 
		
	
		
			
			|  | 3418 | +	return rc;
 | 
		
	
		
			
			| 3401 | 3419 |  }
 | 
		
	
		
			
			| 3402 | 3420 |  
 | 
		
	
		
			
			| 3403 | 3421 |  /**
 | 
		
	
	
		
			
			|  | @@ -3429,6 +3447,7 @@ static void hermon_unregister_netdev ( struct hermon *hermon __unused,
 | 
		
	
		
			
			| 3429 | 3447 |  				       struct hermon_port *port ) {
 | 
		
	
		
			
			| 3430 | 3448 |  	struct net_device *netdev = port->netdev;
 | 
		
	
		
			
			| 3431 | 3449 |  
 | 
		
	
		
			
			|  | 3450 | +	unregister_nvo ( &port->nvo );
 | 
		
	
		
			
			| 3432 | 3451 |  	unregister_netdev ( netdev );
 | 
		
	
		
			
			| 3433 | 3452 |  }
 | 
		
	
		
			
			| 3434 | 3453 |  
 | 
		
	
	
		
			
			|  | @@ -3822,6 +3841,15 @@ static int hermon_probe ( struct pci_device *pci ) {
 | 
		
	
		
			
			| 3822 | 3841 |  			goto err_set_port_type;
 | 
		
	
		
			
			| 3823 | 3842 |  	}
 | 
		
	
		
			
			| 3824 | 3843 |  
 | 
		
	
		
			
			|  | 3844 | +	/* Initialise non-volatile storage */
 | 
		
	
		
			
			|  | 3845 | +	nvs_vpd_init ( &hermon->nvsvpd, pci );
 | 
		
	
		
			
			|  | 3846 | +	for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
 | 
		
	
		
			
			|  | 3847 | +		port = &hermon->port[i];
 | 
		
	
		
			
			|  | 3848 | +		nvs_vpd_nvo_init ( &hermon->nvsvpd,
 | 
		
	
		
			
			|  | 3849 | +				   HERMON_VPD_FIELD ( port->ibdev->port ),
 | 
		
	
		
			
			|  | 3850 | +				   &port->nvo, NULL );
 | 
		
	
		
			
			|  | 3851 | +	}
 | 
		
	
		
			
			|  | 3852 | +
 | 
		
	
		
			
			| 3825 | 3853 |  	/* Register devices */
 | 
		
	
		
			
			| 3826 | 3854 |  	for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
 | 
		
	
		
			
			| 3827 | 3855 |  		port = &hermon->port[i];
 |