From: Sathya Perla <sathya.perla@emulex.com>
To: <netdev@vger.kernel.org>
Subject: [PATCH net-next 05/14] be2net: fix return status of some ethtool methods
Date: Thu, 17 Jul 2014 16:20:23 +0530 [thread overview]
Message-ID: <1405594232-30818-6-git-send-email-sathya.perla@emulex.com> (raw)
In-Reply-To: <1405594232-30818-1-git-send-email-sathya.perla@emulex.com>
From: Kalesh AP <kalesh.purayil@emulex.com>
ethtool expects a -ve status value to be returned when a driver method
encounters an error. The driver was directly passing the
error status returned by FW (a positive value) to ethtool.
This patch fixes this by returning -EIO status in cases where FW returns
an error.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 2 ++
drivers/net/ethernet/emulex/benet/be_ethtool.c | 12 +++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index d3d871b..3e639e8 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -672,6 +672,8 @@ static inline void swap_dws(void *wrb, int len)
#endif /* __BIG_ENDIAN */
}
+#define be_cmd_status(status) (status > 0 ? -EIO : status)
+
static inline u8 is_tcp_pkt(struct sk_buff *skb)
{
u8 val = 0;
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index e2da4d2..25f516d 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
if (status)
dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
- return status;
+ return be_cmd_status(status);
}
static int be_set_phys_id(struct net_device *netdev,
@@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
err:
dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
ddrdma_cmd.dma);
- return ret;
+ return be_cmd_status(ret);
}
static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
@@ -885,7 +885,7 @@ static int be_read_eeprom(struct net_device *netdev,
dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
eeprom_cmd.dma);
- return status;
+ return be_cmd_status(status);
}
static u32 be_get_msg_level(struct net_device *netdev)
@@ -1042,7 +1042,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter,
if (!status)
adapter->rss_info.rss_flags = rss_flags;
- return status;
+ return be_cmd_status(status);
}
static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
@@ -1080,6 +1080,7 @@ static int be_set_channels(struct net_device *netdev,
struct ethtool_channels *ch)
{
struct be_adapter *adapter = netdev_priv(netdev);
+ int status;
if (ch->rx_count || ch->tx_count || ch->other_count ||
!ch->combined_count || ch->combined_count > be_max_qs(adapter))
@@ -1087,7 +1088,8 @@ static int be_set_channels(struct net_device *netdev,
adapter->cfg_num_qs = ch->combined_count;
- return be_update_queues(adapter);
+ status = be_update_queues(adapter);
+ return be_cmd_status(status);
}
static u32 be_get_rxfh_indir_size(struct net_device *netdev)
--
1.7.1
next prev parent reply other threads:[~2014-07-17 10:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 10:50 [PATCH net-next 00/14] be2net: patch set Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 01/14] be2net: use -ENETDOWN error status when interface is down Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 02/14] be2net: fix error status for FW-download Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 03/14] be2net: return -ETIMEDOUT when a FW-cmd times out Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 04/14] be2net: return -ENOMEM for memory allocation failures Sathya Perla
2014-07-17 10:50 ` Sathya Perla [this message]
2014-07-17 10:50 ` [PATCH net-next 06/14] be2net: fix return status of some ndo methods Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 07/14] be2net: update UE bit description strings Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 08/14] be2net: reduce arguments passed to FW-cmd routines Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 09/14] be2net: remove unused structures in be_cmds.h Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 10/14] be2net: use "if (!foo)" test style Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 11/14] be2net: use be_max_vfs() macro to access max-vfs Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 12/14] be2net: avoid SRIOV config for BE2 chip Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 13/14] be2net: use adapter->flags to track SRIOV state Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 14/14] be2net: update driver version to 10.4 Sathya Perla
2014-07-17 23:38 ` [PATCH net-next 00/14] be2net: patch set 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=1405594232-30818-6-git-send-email-sathya.perla@emulex.com \
--to=sathya.perla@emulex.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).