|  | @@ -109,6 +109,53 @@ static void intelxvf_check_link ( struct net_device *netdev ) {
 | 
		
	
		
			
			| 109 | 109 |  	}
 | 
		
	
		
			
			| 110 | 110 |  }
 | 
		
	
		
			
			| 111 | 111 |  
 | 
		
	
		
			
			|  | 112 | +/******************************************************************************
 | 
		
	
		
			
			|  | 113 | + *
 | 
		
	
		
			
			|  | 114 | + * Mailbox messages
 | 
		
	
		
			
			|  | 115 | + *
 | 
		
	
		
			
			|  | 116 | + ******************************************************************************
 | 
		
	
		
			
			|  | 117 | + */
 | 
		
	
		
			
			|  | 118 | +
 | 
		
	
		
			
			|  | 119 | +/**
 | 
		
	
		
			
			|  | 120 | + * Send negotiate API version message
 | 
		
	
		
			
			|  | 121 | + *
 | 
		
	
		
			
			|  | 122 | + * @v intel		Intel device
 | 
		
	
		
			
			|  | 123 | + * @v version		Requested version
 | 
		
	
		
			
			|  | 124 | + * @ret rc		Return status code
 | 
		
	
		
			
			|  | 125 | + */
 | 
		
	
		
			
			|  | 126 | +static int intelxvf_mbox_version ( struct intel_nic *intel,
 | 
		
	
		
			
			|  | 127 | +				   unsigned int version ) {
 | 
		
	
		
			
			|  | 128 | +	union intelvf_msg msg;
 | 
		
	
		
			
			|  | 129 | +	int rc;
 | 
		
	
		
			
			|  | 130 | +
 | 
		
	
		
			
			|  | 131 | +	/* Send set MTU message */
 | 
		
	
		
			
			|  | 132 | +	memset ( &msg, 0, sizeof ( msg ) );
 | 
		
	
		
			
			|  | 133 | +	msg.hdr = INTELXVF_MSG_TYPE_VERSION;
 | 
		
	
		
			
			|  | 134 | +	msg.version.version = version;
 | 
		
	
		
			
			|  | 135 | +	if ( ( rc = intelvf_mbox_msg ( intel, &msg ) ) != 0 ) {
 | 
		
	
		
			
			|  | 136 | +		DBGC ( intel, "INTEL %p negotiate API version failed: %s\n",
 | 
		
	
		
			
			|  | 137 | +		       intel, strerror ( rc ) );
 | 
		
	
		
			
			|  | 138 | +		return rc;
 | 
		
	
		
			
			|  | 139 | +	}
 | 
		
	
		
			
			|  | 140 | +
 | 
		
	
		
			
			|  | 141 | +	/* Check response */
 | 
		
	
		
			
			|  | 142 | +	if ( ( msg.hdr & INTELVF_MSG_TYPE_MASK ) != INTELXVF_MSG_TYPE_VERSION ){
 | 
		
	
		
			
			|  | 143 | +		DBGC ( intel, "INTEL %p negotiate API version unexpected "
 | 
		
	
		
			
			|  | 144 | +		       "response:\n", intel );
 | 
		
	
		
			
			|  | 145 | +		DBGC_HDA ( intel, 0, &msg, sizeof ( msg ) );
 | 
		
	
		
			
			|  | 146 | +		return -EPROTO;
 | 
		
	
		
			
			|  | 147 | +	}
 | 
		
	
		
			
			|  | 148 | +
 | 
		
	
		
			
			|  | 149 | +	/* Check that this version is supported */
 | 
		
	
		
			
			|  | 150 | +	if ( ! ( msg.hdr & INTELVF_MSG_ACK ) ) {
 | 
		
	
		
			
			|  | 151 | +		DBGC ( intel, "INTEL %p negotiate API version failed\n",
 | 
		
	
		
			
			|  | 152 | +		       intel );
 | 
		
	
		
			
			|  | 153 | +		return -EPERM;
 | 
		
	
		
			
			|  | 154 | +	}
 | 
		
	
		
			
			|  | 155 | +
 | 
		
	
		
			
			|  | 156 | +	return 0;
 | 
		
	
		
			
			|  | 157 | +}
 | 
		
	
		
			
			|  | 158 | +
 | 
		
	
		
			
			| 112 | 159 |  /******************************************************************************
 | 
		
	
		
			
			| 113 | 160 |   *
 | 
		
	
		
			
			| 114 | 161 |   * Network device interface
 | 
		
	
	
		
			
			|  | @@ -138,6 +185,15 @@ static int intelxvf_open ( struct net_device *netdev ) {
 | 
		
	
		
			
			| 138 | 185 |  		goto err_mbox_reset;
 | 
		
	
		
			
			| 139 | 186 |  	}
 | 
		
	
		
			
			| 140 | 187 |  
 | 
		
	
		
			
			|  | 188 | +	/* Negotiate API version 1.1.  If we do not negotiate at least
 | 
		
	
		
			
			|  | 189 | +	 * this version, then the RX datapath will remain disabled if
 | 
		
	
		
			
			|  | 190 | +	 * the PF has jumbo frames enabled.
 | 
		
	
		
			
			|  | 191 | +	 *
 | 
		
	
		
			
			|  | 192 | +	 * Ignore failures, since the host may not actually support
 | 
		
	
		
			
			|  | 193 | +	 * v1.1.
 | 
		
	
		
			
			|  | 194 | +	 */
 | 
		
	
		
			
			|  | 195 | +	intelxvf_mbox_version ( intel, INTELXVF_MSG_VERSION_1_1 );
 | 
		
	
		
			
			|  | 196 | +
 | 
		
	
		
			
			| 141 | 197 |  	/* Set MAC address */
 | 
		
	
		
			
			| 142 | 198 |  	if ( ( rc = intelvf_mbox_set_mac ( intel, netdev->ll_addr ) ) != 0 ) {
 | 
		
	
		
			
			| 143 | 199 |  		DBGC ( intel, "INTEL %p could not set MAC address: %s\n",
 | 
		
	
	
		
			
			|  | @@ -145,6 +201,13 @@ static int intelxvf_open ( struct net_device *netdev ) {
 | 
		
	
		
			
			| 145 | 201 |  		goto err_mbox_set_mac;
 | 
		
	
		
			
			| 146 | 202 |  	}
 | 
		
	
		
			
			| 147 | 203 |  
 | 
		
	
		
			
			|  | 204 | +	/* Set MTU */
 | 
		
	
		
			
			|  | 205 | +	if ( ( rc = intelvf_mbox_set_mtu ( intel, netdev->max_pkt_len ) ) != 0){
 | 
		
	
		
			
			|  | 206 | +		DBGC ( intel, "INTEL %p could not set MTU %zd: %s\n",
 | 
		
	
		
			
			|  | 207 | +		       intel, netdev->max_pkt_len, strerror ( rc ) );
 | 
		
	
		
			
			|  | 208 | +		goto err_mbox_set_mtu;
 | 
		
	
		
			
			|  | 209 | +	}
 | 
		
	
		
			
			|  | 210 | +
 | 
		
	
		
			
			| 148 | 211 |  	/* Create transmit descriptor ring */
 | 
		
	
		
			
			| 149 | 212 |  	if ( ( rc = intel_create_ring ( intel, &intel->tx ) ) != 0 )
 | 
		
	
		
			
			| 150 | 213 |  		goto err_create_tx;
 | 
		
	
	
		
			
			|  | @@ -188,6 +251,7 @@ static int intelxvf_open ( struct net_device *netdev ) {
 | 
		
	
		
			
			| 188 | 251 |   err_create_rx:
 | 
		
	
		
			
			| 189 | 252 |  	intel_destroy_ring ( intel, &intel->tx );
 | 
		
	
		
			
			| 190 | 253 |   err_create_tx:
 | 
		
	
		
			
			|  | 254 | + err_mbox_set_mtu:
 | 
		
	
		
			
			| 191 | 255 |   err_mbox_set_mac:
 | 
		
	
		
			
			| 192 | 256 |   err_mbox_reset:
 | 
		
	
		
			
			| 193 | 257 |  	intelxvf_reset ( intel );
 |