aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_l2_sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/qeth_l2_sys.c')
-rw-r--r--drivers/s390/net/qeth_l2_sys.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c
index 17fd4cd888f9..ae1bc04b8653 100644
--- a/drivers/s390/net/qeth_l2_sys.c
+++ b/drivers/s390/net/qeth_l2_sys.c
@@ -119,9 +119,63 @@ static ssize_t qeth_bridge_port_state_show(struct device *dev,
119static DEVICE_ATTR(bridge_state, 0644, qeth_bridge_port_state_show, 119static DEVICE_ATTR(bridge_state, 0644, qeth_bridge_port_state_show,
120 NULL); 120 NULL);
121 121
122static ssize_t qeth_bridgeport_hostnotification_show(struct device *dev,
123 struct device_attribute *attr, char *buf)
124{
125 struct qeth_card *card = dev_get_drvdata(dev);
126 int enabled;
127
128 if (!card)
129 return -EINVAL;
130
131 mutex_lock(&card->conf_mutex);
132
133 enabled = card->options.sbp.hostnotification;
134
135 mutex_unlock(&card->conf_mutex);
136
137 return sprintf(buf, "%d\n", enabled);
138}
139
140static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev,
141 struct device_attribute *attr, const char *buf, size_t count)
142{
143 struct qeth_card *card = dev_get_drvdata(dev);
144 int rc = 0;
145 int enable;
146
147 if (!card)
148 return -EINVAL;
149
150 if (sysfs_streq(buf, "0"))
151 enable = 0;
152 else if (sysfs_streq(buf, "1"))
153 enable = 1;
154 else
155 return -EINVAL;
156
157 mutex_lock(&card->conf_mutex);
158
159 if (qeth_card_hw_is_reachable(card)) {
160 rc = qeth_bridgeport_an_set(card, enable);
161 if (!rc)
162 card->options.sbp.hostnotification = enable;
163 } else
164 card->options.sbp.hostnotification = enable;
165
166 mutex_unlock(&card->conf_mutex);
167
168 return rc ? rc : count;
169}
170
171static DEVICE_ATTR(bridge_hostnotify, 0644,
172 qeth_bridgeport_hostnotification_show,
173 qeth_bridgeport_hostnotification_store);
174
122static struct attribute *qeth_l2_bridgeport_attrs[] = { 175static struct attribute *qeth_l2_bridgeport_attrs[] = {
123 &dev_attr_bridge_role.attr, 176 &dev_attr_bridge_role.attr,
124 &dev_attr_bridge_state.attr, 177 &dev_attr_bridge_state.attr,
178 &dev_attr_bridge_hostnotify.attr,
125 NULL, 179 NULL,
126}; 180};
127 181
@@ -147,6 +201,8 @@ void qeth_l2_remove_device_attributes(struct device *dev)
147 */ 201 */
148void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card) 202void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
149{ 203{
204 int rc;
205
150 if (!card) 206 if (!card)
151 return; 207 return;
152 if (!card->options.sbp.supported_funcs) 208 if (!card->options.sbp.supported_funcs)
@@ -158,4 +214,10 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
158 qeth_bridgeport_query_ports(card, 214 qeth_bridgeport_query_ports(card,
159 &card->options.sbp.role, NULL); 215 &card->options.sbp.role, NULL);
160 } 216 }
217 if (card->options.sbp.hostnotification) {
218 rc = qeth_bridgeport_an_set(card, 1);
219 if (rc)
220 card->options.sbp.hostnotification = 0;
221 } else
222 qeth_bridgeport_an_set(card, 0);
161} 223}