Subject: Re: [patch 04/14] e1000: consolidate managability enabling/disabling

From: Jeff Garzik <[email-masked]>
Date: Fri, 15 Dec 2006 09:32:30 -0500

Arjan van de Ven wrote:
> +static void
> +e1000_init_manageability(struct e1000_adapter *adapter)
> +{
> +	if (adapter->en_mng_pt) {
> +		uint32_t manc2h = E1000_READ_REG(&adapter->hw, MANC2H);
> +		uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
> +
> +		/* disable hardware interception of ARP */
> +		manc &= ~(E1000_MANC_ARP_EN);
> +
> +		/* enable receiving management packets to the host */
> +		/* this will probably generate destination unreachable messages
> +		 * from the host OS, but the packets will be handled on SMBUS */
> +		if (adapter->hw.mac_type >= e1000_82571) {
> +			manc |= E1000_MANC_EN_MNG2HOST;
> +#define E1000_MNG2HOST_PORT_623 (1 << 5)
> +#define E1000_MNG2HOST_PORT_664 (1 << 6)
> +			manc2h |= E1000_MNG2HOST_PORT_623;
> +			manc2h |= E1000_MNG2HOST_PORT_664;
> +			E1000_WRITE_REG(&adapter->hw, MANC2H, manc2h);
> +		}
> +
> +		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> +	}
> +}
> +
> +static void
> +e1000_release_manageability(struct e1000_adapter *adapter)
> +{
> +	if (adapter->en_mng_pt) {
> +		uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
> +
> +		/* re-enable hardware interception of ARP */
> +		manc |= E1000_MANC_ARP_EN;
> +
> +		if (adapter->hw.mac_type >= e1000_82571)
> +			manc &= ~E1000_MANC_EN_MNG2HOST;
> +
> +		/* don't explicitly have to mess with MANC2H since
> +		 * MANC has an enable disable that gates MANC2H */
> +
> +		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> +	}
> +}

This patch adds more error-probe mac_type tests, rather than a simple 
and tough-to-screw-up E1000_HAS_MGMT feature bit.

> +	/* If the controller is 82573 and f/w is AMT, do not set
> +	 * DRV_LOAD until the interface is up.  For all other cases,
> +	 * let the f/w know that the h/w is now under the control
> +	 * of the driver. */
> +	if (adapter->hw.mac_type != e1000_82573 ||
> +	    !e1000_check_mng_mode(&adapter->hw))
> +		e1000_get_hw_control(adapter);
>  
> -	if (netif_running(netdev))
> -		mod_timer(&adapter->watchdog_timer, jiffies);

ditto