提交 0532d4e3 编写于 作者: K Kalesh AP 提交者: David S. Miller

be2net: fix return status of some ethtool methods

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: NKalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: NSathya Perla <sathya.perla@emulex.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6b568689
...@@ -672,6 +672,8 @@ static inline void swap_dws(void *wrb, int len) ...@@ -672,6 +672,8 @@ static inline void swap_dws(void *wrb, int len)
#endif /* __BIG_ENDIAN */ #endif /* __BIG_ENDIAN */
} }
#define be_cmd_status(status) (status > 0 ? -EIO : status)
static inline u8 is_tcp_pkt(struct sk_buff *skb) static inline u8 is_tcp_pkt(struct sk_buff *skb)
{ {
u8 val = 0; u8 val = 0;
......
...@@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) ...@@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
if (status) if (status)
dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); 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, static int be_set_phys_id(struct net_device *netdev,
...@@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter) ...@@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
err: err:
dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va, dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
ddrdma_cmd.dma); ddrdma_cmd.dma);
return ret; return be_cmd_status(ret);
} }
static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, 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, ...@@ -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, dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
eeprom_cmd.dma); eeprom_cmd.dma);
return status; return be_cmd_status(status);
} }
static u32 be_get_msg_level(struct net_device *netdev) 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, ...@@ -1042,7 +1042,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter,
if (!status) if (!status)
adapter->rss_info.rss_flags = rss_flags; 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) 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, ...@@ -1080,6 +1080,7 @@ static int be_set_channels(struct net_device *netdev,
struct ethtool_channels *ch) struct ethtool_channels *ch)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status;
if (ch->rx_count || ch->tx_count || ch->other_count || if (ch->rx_count || ch->tx_count || ch->other_count ||
!ch->combined_count || ch->combined_count > be_max_qs(adapter)) !ch->combined_count || ch->combined_count > be_max_qs(adapter))
...@@ -1087,7 +1088,8 @@ static int be_set_channels(struct net_device *netdev, ...@@ -1087,7 +1088,8 @@ static int be_set_channels(struct net_device *netdev,
adapter->cfg_num_qs = ch->combined_count; 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) static u32 be_get_rxfh_indir_size(struct net_device *netdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册