From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH -next 4/6] bnx2: Allow user-specified multiple advertisement speed values.
Date: Mon, 15 Feb 2010 21:42:10 -0800 [thread overview]
Message-ID: <1266298932-28129-4-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1266298932-28129-3-git-send-email-mchan@broadcom.com>
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.
Reported-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
---
drivers/net/bnx2.c | 33 ++++++++-------------------------
1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 54d43d8..2c75fd7 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -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;
}
--
1.6.4.GIT
next prev parent reply other threads:[~2010-02-16 5:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-16 5:42 [PATCH -next 1/6] bnx2: Check BNX2_FLAG_USING_MSIX flag when setting up MSIX Michael Chan
2010-02-16 5:42 ` [PATCH -next 2/6] bnx2: Need to call cnic_setup_cnic_irq_info() after MTU change Michael Chan
2010-02-16 5:42 ` [PATCH -next 3/6] bnx2: Adjust flow control water marks Michael Chan
2010-02-16 5:42 ` Michael Chan [this message]
2010-02-16 5:42 ` [PATCH -next 5/6] bnx2: Fix bug when saving statistics Michael Chan
2010-02-16 23:20 ` David Miller
[not found] ` <1266298932-28129-6-git-send-email-mchan@broadcom.com>
2010-02-16 23:20 ` [PATCH -next 6/6] bnx2: Update firmwares and update version to 2.0.8 David Miller
2010-02-16 23:20 ` [PATCH -next 4/6] bnx2: Allow user-specified multiple advertisement speed values David Miller
2010-02-16 23:20 ` [PATCH -next 3/6] bnx2: Adjust flow control water marks David Miller
2010-02-16 23:20 ` [PATCH -next 2/6] bnx2: Need to call cnic_setup_cnic_irq_info() after MTU change David Miller
2010-02-16 23:20 ` [PATCH -next 1/6] bnx2: Check BNX2_FLAG_USING_MSIX flag when setting up MSIX David Miller
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=1266298932-28129-4-git-send-email-mchan@broadcom.com \
--to=mchan@broadcom.com \
--cc=davem@davemloft.net \
--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).