aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>2014-09-02 02:20:17 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-02 16:54:06 -0400
commit511c24456ad19d51fcdbc5eda9df7be98c20e6b0 (patch)
tree89d36bcc3fa41515c01c77b85a92700205b7d98e
parentc24f33796830aa42c496c2b2529ce6d51533af84 (diff)
qeth: don't query for info if hardware not ready.
When qeth device is queried for ethtool data, hardware operation is performed to extract the necessary information from the card. If the card is not online at the moment (e.g. it is undergoing recovery), this operation produces undesired effects like temporarily freezing the system. This patch prevents execution of the hardware query operation when the card is not online. In such case, ioctl() operation returns error with errno ENODEV. Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com> Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/s390/net/qeth_core.h1
-rw-r--r--drivers/s390/net/qeth_core_main.c16
-rw-r--r--drivers/s390/net/qeth_l2_sys.c7
3 files changed, 17 insertions, 7 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 97ef37b51068..e7646ce3d659 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -889,6 +889,7 @@ extern const struct attribute_group *qeth_generic_attr_groups[];
889extern const struct attribute_group *qeth_osn_attr_groups[]; 889extern const struct attribute_group *qeth_osn_attr_groups[];
890extern struct workqueue_struct *qeth_wq; 890extern struct workqueue_struct *qeth_wq;
891 891
892int qeth_card_hw_is_reachable(struct qeth_card *);
892const char *qeth_get_cardname_short(struct qeth_card *); 893const char *qeth_get_cardname_short(struct qeth_card *);
893int qeth_realloc_buffer_pool(struct qeth_card *, int); 894int qeth_realloc_buffer_pool(struct qeth_card *, int);
894int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); 895int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index c0d6ba8655c7..fd22c811cbe1 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -73,6 +73,13 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int);
73struct workqueue_struct *qeth_wq; 73struct workqueue_struct *qeth_wq;
74EXPORT_SYMBOL_GPL(qeth_wq); 74EXPORT_SYMBOL_GPL(qeth_wq);
75 75
76int qeth_card_hw_is_reachable(struct qeth_card *card)
77{
78 return (card->state == CARD_STATE_SOFTSETUP) ||
79 (card->state == CARD_STATE_UP);
80}
81EXPORT_SYMBOL_GPL(qeth_card_hw_is_reachable);
82
76static void qeth_close_dev_handler(struct work_struct *work) 83static void qeth_close_dev_handler(struct work_struct *work)
77{ 84{
78 struct qeth_card *card; 85 struct qeth_card *card;
@@ -5790,6 +5797,7 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev,
5790 struct qeth_card *card = netdev->ml_priv; 5797 struct qeth_card *card = netdev->ml_priv;
5791 enum qeth_link_types link_type; 5798 enum qeth_link_types link_type;
5792 struct carrier_info carrier_info; 5799 struct carrier_info carrier_info;
5800 int rc;
5793 u32 speed; 5801 u32 speed;
5794 5802
5795 if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) 5803 if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan))
@@ -5832,8 +5840,14 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev,
5832 /* Check if we can obtain more accurate information. */ 5840 /* Check if we can obtain more accurate information. */
5833 /* If QUERY_CARD_INFO command is not supported or fails, */ 5841 /* If QUERY_CARD_INFO command is not supported or fails, */
5834 /* just return the heuristics that was filled above. */ 5842 /* just return the heuristics that was filled above. */
5835 if (qeth_query_card_info(card, &carrier_info) != 0) 5843 if (!qeth_card_hw_is_reachable(card))
5844 return -ENODEV;
5845 rc = qeth_query_card_info(card, &carrier_info);
5846 if (rc == -EOPNOTSUPP) /* for old hardware, return heuristic */
5836 return 0; 5847 return 0;
5848 if (rc) /* report error from the hardware operation */
5849 return rc;
5850 /* on success, fill in the information got from the hardware */
5837 5851
5838 netdev_dbg(netdev, 5852 netdev_dbg(netdev,
5839 "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", 5853 "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n",
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c
index ae1bc04b8653..59e3aa538b4d 100644
--- a/drivers/s390/net/qeth_l2_sys.c
+++ b/drivers/s390/net/qeth_l2_sys.c
@@ -5,17 +5,12 @@
5 5
6#include <linux/slab.h> 6#include <linux/slab.h>
7#include <asm/ebcdic.h> 7#include <asm/ebcdic.h>
8#include "qeth_core.h"
8#include "qeth_l2.h" 9#include "qeth_l2.h"
9 10
10#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ 11#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \
11struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) 12struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store)
12 13
13static int qeth_card_hw_is_reachable(struct qeth_card *card)
14{
15 return (card->state == CARD_STATE_SOFTSETUP) ||
16 (card->state == CARD_STATE_UP);
17}
18
19static ssize_t qeth_bridge_port_role_state_show(struct device *dev, 14static ssize_t qeth_bridge_port_role_state_show(struct device *dev,
20 struct device_attribute *attr, char *buf, 15 struct device_attribute *attr, char *buf,
21 int show_state) 16 int show_state)