Skip to contentSkip to conversation

bnx2: Check BNX2_FLAG_USING_MSIX flag when setting up MSIX.

PATCH Applied Michael Chan 2 participants 11 messages Feb 16, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 2/6 bnx2: Need to call cnic_setup_cnic_irq_info() after MTU change.

In reply to Michael Chan

New status blocks are allocated during MTU change so we need to update this information for the cnic driver.

---
 drivers/net/bnx2.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/bnx2.c +7 -0
index 48bc578..063f283 100644
@@ -7141,6 +7141,13 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
 			dev_close(bp->dev);
 			return rc;
 		}
+#ifdef BCM_CNIC
+		mutex_lock(&bp->cnic_lock);
+		/* Let cnic know about the new status block. */
+		if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD)
+			bnx2_setup_cnic_irq_info(bp);
+		mutex_unlock(&bp->cnic_lock);
+#endif
 		bnx2_netif_start(bp);
 	}
 	return 0;
Signature · 1 line
1.6.4.GIT
#2 lore raw

PATCH 3/6 bnx2: Adjust flow control water marks.

The current water marks are too high and can cause unnecessary flow control frames.

---
 drivers/net/bnx2.c |    2 +-
 drivers/net/bnx2.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnx2.c +1 -1
index 063f283..54d43d8 100644
@@ -1277,7 +1277,7 @@ bnx2_init_rx_context(struct bnx2 *bp, u32 cid)
 		if (lo_water >= bp->rx_ring_size)
 			lo_water = 0;
 
-		hi_water = bp->rx_ring_size / 4;
+		hi_water = min_t(int, bp->rx_ring_size / 4, lo_water + 16);
 
 		if (hi_water <= lo_water)
 			lo_water = 0;
drivers/net/bnx2.h +1 -1
index b860fbb..cd4b0e4 100644
@@ -349,7 +349,7 @@ struct l2_fhdr {
 #define BNX2_L2CTX_BD_PRE_READ				0x00000000
 #define BNX2_L2CTX_CTX_SIZE				0x00000000
 #define BNX2_L2CTX_CTX_TYPE				0x00000000
-#define BNX2_L2CTX_LO_WATER_MARK_DEFAULT		 32
+#define BNX2_L2CTX_LO_WATER_MARK_DEFAULT		 4
 #define BNX2_L2CTX_LO_WATER_MARK_SCALE			 4
 #define BNX2_L2CTX_LO_WATER_MARK_DIS			 0
 #define BNX2_L2CTX_HI_WATER_MARK_SHIFT			 4
Signature · 1 line
1.6.4.GIT
#3 lore raw

PATCH 4/6 bnx2: Allow user-specified multiple advertisement speed values.

Remove unnecessary code that works around older versions of ethtool that can pass down invalid advertisement speed values. This old code prevents the user from specifying multiple advertisement values. The new code uses simple masking to mask out invalid advertisment bits.

---
 drivers/net/bnx2.c |   33 ++++++++-------------------------
 1 files changed, 8 insertions(+), 25 deletions(-)
drivers/net/bnx2.c +8 -25
index 54d43d8..2c75fd7 100644
@@ -6751,32 +6751,15 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 	if (cmd->autoneg == AUTONEG_ENABLE) {
 		autoneg |= AUTONEG_SPEED;
 
-		cmd->advertising &= ETHTOOL_ALL_COPPER_SPEED;
-
-		/* allow advertising 1 speed */
-		if ((cmd->advertising == ADVERTISED_10baseT_Half) ||
-			(cmd->advertising == ADVERTISED_10baseT_Full) ||
-			(cmd->advertising == ADVERTISED_100baseT_Half) ||
-			(cmd->advertising == ADVERTISED_100baseT_Full)) {
-
-			if (cmd->port == PORT_FIBRE)
-				goto err_out_unlock;
-
-			advertising = cmd->advertising;
-
-		} else if (cmd->advertising == ADVERTISED_2500baseX_Full) {
-			if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE) ||
-			    (cmd->port == PORT_TP))
-				goto err_out_unlock;
-		} else if (cmd->advertising == ADVERTISED_1000baseT_Full)
-			advertising = cmd->advertising;
-		else if (cmd->advertising == ADVERTISED_1000baseT_Half)
-			goto err_out_unlock;
-		else {
-			if (cmd->port == PORT_FIBRE)
-				advertising = ETHTOOL_ALL_FIBRE_SPEED;
-			else
+		advertising = cmd->advertising;
+		if (cmd->port == PORT_TP) {
+			advertising &= ETHTOOL_ALL_COPPER_SPEED;
+			if (!advertising)
 				advertising = ETHTOOL_ALL_COPPER_SPEED;
+		} else {
+			advertising &= ETHTOOL_ALL_FIBRE_SPEED;
+			if (!advertising)
+				advertising = ETHTOOL_ALL_FIBRE_SPEED;
 		}
 		advertising |= ADVERTISED_Autoneg;
 	}
Signature · 1 line
1.6.4.GIT
#4 lore raw

PATCH 5/6 bnx2: Fix bug when saving statistics.

From: Patrick Rabau <[email protected]>

This fixes the problem of dropping the carry when adding 2 32-bit values. Switch to use array indexing for better readability.

Reported by and fix provided by Patrick Rabau.

---
 drivers/net/bnx2.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/bnx2.c +5 -5
index 2c75fd7..dda815a 100644
@@ -6555,16 +6555,16 @@ bnx2_save_stats(struct bnx2 *bp)
 		u32 hi;
 		u64 lo;
 
-		hi = *(temp_stats + i) + *(hw_stats + i);
-		lo = *(temp_stats + i + 1) + *(hw_stats + i + 1);
+		hi = temp_stats[i] + hw_stats[i];
+		lo = (u64) temp_stats[i + 1] + (u64) hw_stats[i + 1];
 		if (lo > 0xffffffff)
 			hi++;
-		*(temp_stats + i) = hi;
-		*(temp_stats + i + 1) = lo & 0xffffffff;
+		temp_stats[i] = hi;
+		temp_stats[i + 1] = lo & 0xffffffff;
 	}
 
 	for ( ; i < sizeof(struct statistics_block) / 4; i++)
-		*(temp_stats + i) = *(temp_stats + i) + *(hw_stats + i);
+		temp_stats[i] += hw_stats[i];
 }
 
 #define GET_64BIT_NET_STATS64(ctr)				\
Signature · 1 line
1.6.4.GIT
#0 lore raw

PATCH 1/6 bnx2: Check BNX2_FLAG_USING_MSIX flag when setting up MSIX.

Checking the flag is more correct than checking bp->irq_nvecs. By accident it is not a problem because we always have more than 1 vectors when using MSIX mode.

---
 drivers/net/bnx2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/bnx2.c +1 -1
index c7f5515..48bc578 100644
@@ -4940,7 +4940,7 @@ bnx2_init_chip(struct bnx2 *bp)
 		      BNX2_HC_CONFIG_COLLECT_STATS;
 	}
 
-	if (bp->irq_nvecs > 1) {
+	if (bp->flags & BNX2_FLAG_USING_MSIX) {
 		REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR,
 		       BNX2_HC_MSIX_BIT_VECTOR_VAL);
 
Signature · 1 line
1.6.4.GIT
maintainer Applied
#8 lore raw

Re: [PATCH -next 4/6] bnx2: Allow user-specified multiple advertisement speed values.

In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Mon, 15 Feb 2010 21:42:10 -0800

Quoted 8 lines

Remove unnecessary code that works around older versions of ethtool that can pass down invalid advertisement speed values. This old code prevents the user from specifying multiple advertisement values. The new code uses simple masking to mask out invalid advertisment bits.

Applied.

maintainer Applied
#5 lore raw

Re: [PATCH -next 5/6] bnx2: Fix bug when saving statistics.

In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Mon, 15 Feb 2010 21:42:11 -0800

Quoted 9 lines

From: Patrick Rabau <[email protected]>

This fixes the problem of dropping the carry when adding 2 32-bit values. Switch to use array indexing for better readability.

Reported by and fix provided by Patrick Rabau.

Applied.