lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1350235151-11146-2-git-send-email-dmitry@daynix.com>
Date:	Sun, 14 Oct 2012 19:19:11 +0200
From:	Dmitry Fleytman <dmitry@...nix.com>
To:	linux-kernel@...r.kernel.org
Cc:	e1000-devel@...ts.sourceforge.net,
	Chris Webb <chris.webb@...stichosts.com>,
	Richard Davies <richard.davies@...stichosts.com>,
	Dmitry Fleytman <dmitry@...nix.com>
Subject: [PATCH] RX initialization sequence fixed - enable RX after corresponding ring initialization only

Reported-by: Chris Webb	<chris.webb@...stichosts.com>
Reported-by: Richard Davies <richard.davies@...stichosts.com>

Signed-off-by: Dmitry Fleytman <dmitry@...nix.com>
---
 drivers/net/ethernet/intel/e1000/e1000_ethtool.c |    9 +++++----
 drivers/net/ethernet/intel/e1000/e1000_main.c    |   18 ++++++++++++++++--
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 9089d00..ebcce7a 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1091,10 +1091,6 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
 	ew32(RDLEN, rxdr->size);
 	ew32(RDH, 0);
 	ew32(RDT, 0);
-	rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 |
-		E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
-		(hw->mc_filter_type << E1000_RCTL_MO_SHIFT);
-	ew32(RCTL, rctl);
 
 	for (i = 0; i < rxdr->count; i++) {
 		struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i);
@@ -1115,6 +1111,11 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
 		memset(skb->data, 0x00, skb->len);
 	}
 
+	rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 |
+		E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
+		(hw->mc_filter_type << E1000_RCTL_MO_SHIFT);
+	ew32(RCTL, rctl);
+
 	return 0;
 
 err_nomem:
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 222bfaf..01a4ad9 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -118,6 +118,7 @@ static int e1000_open(struct net_device *netdev);
 static int e1000_close(struct net_device *netdev);
 static void e1000_configure_tx(struct e1000_adapter *adapter);
 static void e1000_configure_rx(struct e1000_adapter *adapter);
+static void e1000_enable_rx(struct e1000_adapter *adapter);
 static void e1000_setup_rctl(struct e1000_adapter *adapter);
 static void e1000_clean_all_tx_rings(struct e1000_adapter *adapter);
 static void e1000_clean_all_rx_rings(struct e1000_adapter *adapter);
@@ -404,6 +405,7 @@ static void e1000_configure(struct e1000_adapter *adapter)
 		adapter->alloc_rx_buf(adapter, ring,
 		                      E1000_DESC_UNUSED(ring));
 	}
+	e1000_enable_rx(adapter);
 }
 
 int e1000_up(struct e1000_adapter *adapter)
@@ -1928,8 +1930,19 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
 			rxcsum &= ~E1000_RXCSUM_TUOFL;
 		ew32(RXCSUM, rxcsum);
 	}
+}
+
+/**
+ * e1000_enable_rx - Enable receive in HW
+ * @adapter: board private structure
+ *
+ * Inform HW that SW is ready for incoming packets indications
+ **/
 
-	/* Enable Receives */
+static void e1000_enable_rx(struct e1000_adapter *adapter)
+{
+	struct e1000_hw *hw = &adapter->hw;
+	u32 rctl = er32(RCTL);
 	ew32(RCTL, rctl | E1000_RCTL_EN);
 }
 
@@ -2196,6 +2209,7 @@ static void e1000_leave_82542_rst(struct e1000_adapter *adapter)
 		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
 		e1000_configure_rx(adapter);
 		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
+		e1000_enable_rx(adapter);
 	}
 }
 
@@ -5010,7 +5024,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
 			rctl |= E1000_RCTL_MPE;
 
 		/* enable receives in the hardware */
-		ew32(RCTL, rctl | E1000_RCTL_EN);
+		e1000_enable_rx(adapter);
 
 		if (hw->mac_type >= e1000_82540) {
 			ctrl = er32(CTRL);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ