netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: "Kok, Auke" <auke-jan.h.kok@intel.com>
Cc: netdev@vger.kernel.org, "Brandeburg,
	Jesse" <jesse.brandeburg@intel.com>,
	"Kok, Auke" <auke@foo-projects.org>,
	"Ronciak, John" <john.ronciak@intel.com>
Subject: Re: [PATCH 08/22] e1000: Fix all manageability workarounds
Date: Mon, 11 Dec 2006 09:41:36 -0500	[thread overview]
Message-ID: <457D6E20.50207@pobox.com> (raw)
In-Reply-To: <20061208230302.30109.69865.stgit@gitlost.site>

Kok, Auke wrote:
> +		/* 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);


NAK, test a management packet feature, not a mac type


> +	}
> +}
> +
> +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;

ditto.  can't you see how fragile the above code test is, when compared 
with testing a feature bit?


> +		/* don't explicitly have to mess with MANC2H since
> +		 * MANC has an enable disable that gates MANC2H */
> +
> +		/* XXX stop the hardware watchdog ? */
> +
> +		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> +	}
> +}
> +
>  int
>  e1000_up(struct e1000_adapter *adapter)
>  {
> @@ -475,6 +522,7 @@ e1000_up(struct e1000_adapter *adapter)
>  	e1000_set_multi(netdev);
>  
>  	e1000_restore_vlan(adapter);
> +	e1000_init_manageability(adapter);
>  
>  	e1000_configure_tx(adapter);
>  	e1000_setup_rctl(adapter);
> @@ -705,14 +753,7 @@ e1000_reset(struct e1000_adapter *adapte
>  		                    phy_data);
>  	}
>  
> -	if ((adapter->en_mng_pt) &&
> -	    (adapter->hw.mac_type >= e1000_82540) &&
> -	    (adapter->hw.mac_type < e1000_82571) &&
> -	    (adapter->hw.media_type == e1000_media_type_copper)) {
> -		manc = E1000_READ_REG(&adapter->hw, MANC);
> -		manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
> -		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> -	}
> +	e1000_release_manageability(adapter);
>  }
>  
>  /**
> @@ -1078,22 +1119,13 @@ e1000_remove(struct pci_dev *pdev)
>  {
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct e1000_adapter *adapter = netdev_priv(netdev);
> -	uint32_t manc;
>  #ifdef CONFIG_E1000_NAPI
>  	int i;
>  #endif
>  
>  	flush_scheduled_work();
>  
> -	if (adapter->hw.mac_type >= e1000_82540 &&
> -	    adapter->hw.mac_type < e1000_82571 &&
> -	    adapter->hw.media_type == e1000_media_type_copper) {
> -		manc = E1000_READ_REG(&adapter->hw, MANC);
> -		if (manc & E1000_MANC_SMBUS_EN) {
> -			manc |= E1000_MANC_ARP_EN;
> -			E1000_WRITE_REG(&adapter->hw, MANC, manc);
> -		}
> -	}
> +	e1000_release_manageability(adapter);
>  
>  	/* Release control of h/w to f/w.  If f/w is AMT enabled, this
>  	 * would have already happened in close and is redundant. */
> @@ -3615,6 +3647,14 @@ e1000_update_stats(struct e1000_adapter 
>  			adapter->phy_stats.receive_errors += phy_tmp;
>  	}
>  
> +	/* Management Stats */
> +	if (adapter->hw.mac_type > e1000_82544) {
> +		adapter->stats.mgptc += E1000_READ_REG(hw, MGTPTC);
> +		adapter->stats.mgprc += E1000_READ_REG(hw, MGTPRC);
> +		adapter->stats.mgpdc += E1000_READ_REG(hw, MGTPDC);
> +	}

test a feature bit


>  	spin_unlock_irqrestore(&adapter->stats_lock, flags);
>  }
>  #ifdef CONFIG_PCI_MSI
> @@ -5027,7 +5067,7 @@ e1000_suspend(struct pci_dev *pdev, pm_m
>  {
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct e1000_adapter *adapter = netdev_priv(netdev);
> -	uint32_t ctrl, ctrl_ext, rctl, manc, status;
> +	uint32_t ctrl, ctrl_ext, rctl, status;
>  	uint32_t wufc = adapter->wol;
>  #ifdef CONFIG_PM
>  	int retval = 0;
> @@ -5096,16 +5136,12 @@ e1000_suspend(struct pci_dev *pdev, pm_m
>  		pci_enable_wake(pdev, PCI_D3cold, 0);
>  	}
>  
> -	if (adapter->hw.mac_type >= e1000_82540 &&
> -	    adapter->hw.mac_type < e1000_82571 &&
> -	    adapter->hw.media_type == e1000_media_type_copper) {
> -		manc = E1000_READ_REG(&adapter->hw, MANC);
> -		if (manc & E1000_MANC_SMBUS_EN) {
> -			manc |= E1000_MANC_ARP_EN;
> -			E1000_WRITE_REG(&adapter->hw, MANC, manc);
> -			pci_enable_wake(pdev, PCI_D3hot, 1);
> -			pci_enable_wake(pdev, PCI_D3cold, 1);
> -		}
> +	e1000_release_manageability(adapter);
> +
> +	/* make sure adapter isn't asleep if manageability is enabled */
> +	if (adapter->en_mng_pt) {
> +		pci_enable_wake(pdev, PCI_D3hot, 1);
> +		pci_enable_wake(pdev, PCI_D3cold, 1);
>  	}
>  
>  	if (adapter->hw.phy_type == e1000_phy_igp_3)
> @@ -5131,7 +5167,7 @@ e1000_resume(struct pci_dev *pdev)
>  {
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct e1000_adapter *adapter = netdev_priv(netdev);
> -	uint32_t manc, err;
> +	uint32_t err;
>  
>  	pci_set_power_state(pdev, PCI_D0);
>  	e1000_pci_restore_state(adapter);
> @@ -5151,19 +5187,13 @@ e1000_resume(struct pci_dev *pdev)
>  	e1000_reset(adapter);
>  	E1000_WRITE_REG(&adapter->hw, WUS, ~0);
>  
> +	e1000_init_manageability(adapter);
> +
>  	if (netif_running(netdev))
>  		e1000_up(adapter);
>  
>  	netif_device_attach(netdev);
>  
> -	if (adapter->hw.mac_type >= e1000_82540 &&
> -	    adapter->hw.mac_type < e1000_82571 &&
> -	    adapter->hw.media_type == e1000_media_type_copper) {
> -		manc = E1000_READ_REG(&adapter->hw, MANC);
> -		manc &= ~(E1000_MANC_ARP_EN);
> -		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> -	}
> -
>  	/* 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
> @@ -5264,7 +5294,8 @@ static void e1000_io_resume(struct pci_d
>  {
>  	struct net_device *netdev = pci_get_drvdata(pdev);
>  	struct e1000_adapter *adapter = netdev->priv;
> -	uint32_t manc, swsm;
> +
> +	e1000_init_manageability(adapter);
>  
>  	if (netif_running(netdev)) {
>  		if (e1000_up(adapter)) {
> @@ -5275,26 +5306,14 @@ static void e1000_io_resume(struct pci_d
>  
>  	netif_device_attach(netdev);
>  
> -	if (adapter->hw.mac_type >= e1000_82540 &&
> -	    adapter->hw.mac_type < e1000_82571 &&
> -	    adapter->hw.media_type == e1000_media_type_copper) {
> -		manc = E1000_READ_REG(&adapter->hw, MANC);
> -		manc &= ~(E1000_MANC_ARP_EN);
> -		E1000_WRITE_REG(&adapter->hw, MANC, manc);
> -	}
> -
> -	switch (adapter->hw.mac_type) {
> -	case e1000_82573:
> -		swsm = E1000_READ_REG(&adapter->hw, SWSM);
> -		E1000_WRITE_REG(&adapter->hw, SWSM,
> -				swsm | E1000_SWSM_DRV_LOAD);
> -		break;
> -	default:
> -		break;
> -	}
> +	/* 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);

ditto


> -	if (netif_running(netdev))
> -		mod_timer(&adapter->watchdog_timer, jiffies);
>  }
>  
>  /* e1000_main.c */
> 
> 
> 
> ---
> Auke Kok <auke-jan.h.kok@intel.com>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2006-12-11 14:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 23:02 [PATCH 00/22] ixgb, e1000 fixes Kok, Auke
2006-12-08 23:02 ` [PATCH 01/22] e1000: Fix early TSO completion Kok, Auke
2006-12-11 14:36   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 02/22] ixgb: Maybe stop TX if not enough free descriptors Kok, Auke
2006-12-11 14:37   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 03/22] ixgb: Write RA register high word first, increment version Kok, Auke
2006-12-11 14:37   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 04/22] e1000: display FC link properties Kok, Auke
2006-12-08 23:02 ` [PATCH 05/22] e1000: dynamic itr code fixes Kok, Auke
2006-12-08 23:02 ` [PATCH 06/22] e1000: minor tso ipv6 cleanups Kok, Auke
2006-12-11 14:42   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 07/22] e1000: omit stats for broken counter in 82543 Kok, Auke
2006-12-11 14:42   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 08/22] e1000: Fix all manageability workarounds Kok, Auke
2006-12-11 14:41   ` Jeff Garzik [this message]
2006-12-08 23:03 ` [PATCH 09/22] e1000: Fix PBA allocation calculations Kok, Auke
2006-12-08 23:03 ` [PATCH 10/22] e1000: Make copybreak parameter changeable by user Kok, Auke
2006-12-08 23:03 ` [PATCH 11/22] e1000: Fire a link even interrupt instead of a watchdog at init Kok, Auke
2006-12-11 22:48   ` Shaw Vrana
2006-12-08 23:03 ` [PATCH 12/22] e1000: Fix powerdown link loss when forced to gig speed Kok, Auke
2006-12-11 14:46   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 13/22] e1000: disable TSO when debugging slab Kok, Auke
2006-12-11 14:47   ` Jeff Garzik
2006-12-15  2:42     ` Herbert Xu
2006-12-08 23:03 ` [PATCH 14/22] e1000: always turn on receives on esb2 Kok, Auke
2006-12-11 14:47   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 15/22] e1000: simplify msi specific interrupt handler Kok, Auke
2006-12-11 14:48   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 16/22] e1000: Rewrite parm handling code to warn when forcing autoneg to gig only Kok, Auke
2006-12-08 23:03 ` [PATCH 17/22] e1000: set max frame size before enabling new link settings Kok, Auke
2006-12-08 23:03 ` [PATCH 18/22] e1000: For older adapters, we know that the pci bus type is pci Kok, Auke
2006-12-08 23:03 ` [PATCH 19/22] e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber output Kok, Auke
2006-12-08 23:03 ` [PATCH 20/22] e1000: Fix poor quad port performance with NAPI Kok, Auke
2006-12-11 14:49   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 21/22] e1000: Version increment 7.3.20-k2 and minor cleanups Kok, Auke
2006-12-11 14:50   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 22/22] # This series applies on GIT commit 0ae851352a87db3f829511816a2da227860bf585 Kok, Auke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=457D6E20.50207@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=auke-jan.h.kok@intel.com \
    --cc=auke@foo-projects.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).