Lines Matching +full:invert +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0
24 if ((proto == QETH_PROT_IPV4 && !in4_pton(buf, -1, addr, -1, &end)) || in qeth_l3_string_to_ipaddr()
25 (proto == QETH_PROT_IPV6 && !in6_pton(buf, -1, addr, -1, &end))) in qeth_l3_string_to_ipaddr()
26 return -EINVAL; in qeth_l3_string_to_ipaddr()
33 switch (route->type) { in qeth_l3_dev_route_show()
39 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) in qeth_l3_dev_route_show()
44 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) in qeth_l3_dev_route_show()
49 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) in qeth_l3_dev_route_show()
63 return qeth_l3_dev_route_show(card, &card->options.route4, buf); in qeth_l3_dev_route4_show()
70 enum qeth_routing_types old_route_type = route->type; in qeth_l3_dev_route_store()
73 mutex_lock(&card->conf_mutex); in qeth_l3_dev_route_store()
75 route->type = NO_ROUTER; in qeth_l3_dev_route_store()
77 route->type = PRIMARY_CONNECTOR; in qeth_l3_dev_route_store()
79 route->type = SECONDARY_CONNECTOR; in qeth_l3_dev_route_store()
81 route->type = PRIMARY_ROUTER; in qeth_l3_dev_route_store()
83 route->type = SECONDARY_ROUTER; in qeth_l3_dev_route_store()
85 route->type = MULTICAST_ROUTER; in qeth_l3_dev_route_store()
87 rc = -EINVAL; in qeth_l3_dev_route_store()
91 (old_route_type != route->type)) { in qeth_l3_dev_route_store()
99 route->type = old_route_type; in qeth_l3_dev_route_store()
100 mutex_unlock(&card->conf_mutex); in qeth_l3_dev_route_store()
109 return qeth_l3_dev_route_store(card, &card->options.route4, in qeth_l3_dev_route4_store()
121 return qeth_l3_dev_route_show(card, &card->options.route6, buf); in qeth_l3_dev_route6_show()
129 return qeth_l3_dev_route_store(card, &card->options.route6, in qeth_l3_dev_route6_store()
141 return sysfs_emit(buf, "%i\n", card->options.sniffer ? 1 : 0); in qeth_l3_dev_sniffer_show()
152 return -EPERM; in qeth_l3_dev_sniffer_store()
153 if (card->options.cq == QETH_CQ_ENABLED) in qeth_l3_dev_sniffer_store()
154 return -EPERM; in qeth_l3_dev_sniffer_store()
156 mutex_lock(&card->conf_mutex); in qeth_l3_dev_sniffer_store()
157 if (card->state != CARD_STATE_DOWN) { in qeth_l3_dev_sniffer_store()
158 rc = -EPERM; in qeth_l3_dev_sniffer_store()
164 rc = -EINVAL; in qeth_l3_dev_sniffer_store()
169 card->options.sniffer = i; in qeth_l3_dev_sniffer_store()
172 qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd); in qeth_l3_dev_sniffer_store()
173 if (card->ssqd.qdioac2 & CHSC_AC2_SNIFFER_AVAILABLE) { in qeth_l3_dev_sniffer_store()
174 card->options.sniffer = i; in qeth_l3_dev_sniffer_store()
177 rc = -EPERM; in qeth_l3_dev_sniffer_store()
182 rc = -EINVAL; in qeth_l3_dev_sniffer_store()
185 mutex_unlock(&card->conf_mutex); in qeth_l3_dev_sniffer_store()
199 return -EPERM; in qeth_l3_dev_hsuid_show()
201 memcpy(tmp_hsuid, card->options.hsuid, sizeof(tmp_hsuid)); in qeth_l3_dev_hsuid_show()
214 return -EPERM; in qeth_l3_dev_hsuid_store()
216 mutex_lock(&card->conf_mutex); in qeth_l3_dev_hsuid_store()
217 if (card->state != CARD_STATE_DOWN) { in qeth_l3_dev_hsuid_store()
218 rc = -EPERM; in qeth_l3_dev_hsuid_store()
222 if (card->options.sniffer) { in qeth_l3_dev_hsuid_store()
223 rc = -EPERM; in qeth_l3_dev_hsuid_store()
227 if (card->options.cq == QETH_CQ_NOTAVAILABLE) { in qeth_l3_dev_hsuid_store()
228 rc = -EPERM; in qeth_l3_dev_hsuid_store()
234 rc = -EINVAL; in qeth_l3_dev_hsuid_store()
238 if (card->options.hsuid[0]) in qeth_l3_dev_hsuid_store()
244 card->options.hsuid[0] = '\0'; in qeth_l3_dev_hsuid_store()
245 memcpy(card->dev->perm_addr, card->options.hsuid, 9); in qeth_l3_dev_hsuid_store()
251 rc = -EPERM; in qeth_l3_dev_hsuid_store()
255 scnprintf(card->options.hsuid, sizeof(card->options.hsuid), in qeth_l3_dev_hsuid_store()
256 "%-8s", tmp); in qeth_l3_dev_hsuid_store()
257 ASCEBC(card->options.hsuid, 8); in qeth_l3_dev_hsuid_store()
258 memcpy(card->dev->perm_addr, card->options.hsuid, 9); in qeth_l3_dev_hsuid_store()
263 mutex_unlock(&card->conf_mutex); in qeth_l3_dev_hsuid_store()
288 return sysfs_emit(buf, "%u\n", card->ipato.enabled ? 1 : 0); in qeth_l3_dev_ipato_enable_show()
295 bool enable; in qeth_l3_dev_ipato_enable_store() local
298 mutex_lock(&card->conf_mutex); in qeth_l3_dev_ipato_enable_store()
299 if (card->state != CARD_STATE_DOWN) { in qeth_l3_dev_ipato_enable_store()
300 rc = -EPERM; in qeth_l3_dev_ipato_enable_store()
304 mutex_lock(&card->ip_lock); in qeth_l3_dev_ipato_enable_store()
306 enable = !card->ipato.enabled; in qeth_l3_dev_ipato_enable_store()
307 } else if (kstrtobool(buf, &enable)) { in qeth_l3_dev_ipato_enable_store()
308 rc = -EINVAL; in qeth_l3_dev_ipato_enable_store()
312 if (card->ipato.enabled != enable) { in qeth_l3_dev_ipato_enable_store()
313 card->ipato.enabled = enable; in qeth_l3_dev_ipato_enable_store()
318 mutex_unlock(&card->ip_lock); in qeth_l3_dev_ipato_enable_store()
320 mutex_unlock(&card->conf_mutex); in qeth_l3_dev_ipato_enable_store()
324 static QETH_DEVICE_ATTR(ipato_enable, enable, 0644,
333 return sysfs_emit(buf, "%u\n", card->ipato.invert4 ? 1 : 0); in qeth_l3_dev_ipato_invert4_show()
341 bool invert; in qeth_l3_dev_ipato_invert4_store() local
344 mutex_lock(&card->ip_lock); in qeth_l3_dev_ipato_invert4_store()
346 invert = !card->ipato.invert4; in qeth_l3_dev_ipato_invert4_store()
347 } else if (kstrtobool(buf, &invert)) { in qeth_l3_dev_ipato_invert4_store()
348 rc = -EINVAL; in qeth_l3_dev_ipato_invert4_store()
352 if (card->ipato.invert4 != invert) { in qeth_l3_dev_ipato_invert4_store()
353 card->ipato.invert4 = invert; in qeth_l3_dev_ipato_invert4_store()
358 mutex_unlock(&card->ip_lock); in qeth_l3_dev_ipato_invert4_store()
373 mutex_lock(&card->ip_lock); in qeth_l3_dev_ipato_add_show()
374 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_dev_ipato_add_show()
375 if (ipatoe->proto != proto) in qeth_l3_dev_ipato_add_show()
378 qeth_l3_ipaddr_to_string(proto, ipatoe->addr, addr_str); in qeth_l3_dev_ipato_add_show()
380 addr_str, ipatoe->mask_bits); in qeth_l3_dev_ipato_add_show()
382 mutex_unlock(&card->ip_lock); in qeth_l3_dev_ipato_add_show()
404 return -EINVAL; in qeth_l3_parse_ipatoe()
406 /* Terminate the %addr sub-string, and parse it: */ in qeth_l3_parse_ipatoe()
417 return -EINVAL; in qeth_l3_parse_ipatoe()
436 return -ENOMEM; in qeth_l3_dev_ipato_add_store()
438 ipatoe->proto = proto; in qeth_l3_dev_ipato_add_store()
439 memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4) ? 4 : 16); in qeth_l3_dev_ipato_add_store()
440 ipatoe->mask_bits = mask_bits; in qeth_l3_dev_ipato_add_store()
490 return sysfs_emit(buf, "%u\n", card->ipato.invert6 ? 1 : 0); in qeth_l3_dev_ipato_invert6_show()
497 bool invert; in qeth_l3_dev_ipato_invert6_store() local
500 mutex_lock(&card->ip_lock); in qeth_l3_dev_ipato_invert6_store()
502 invert = !card->ipato.invert6; in qeth_l3_dev_ipato_invert6_store()
503 } else if (kstrtobool(buf, &invert)) { in qeth_l3_dev_ipato_invert6_store()
504 rc = -EINVAL; in qeth_l3_dev_ipato_invert6_store()
508 if (card->ipato.invert6 != invert) { in qeth_l3_dev_ipato_invert6_store()
509 card->ipato.invert6 = invert; in qeth_l3_dev_ipato_invert6_store()
514 mutex_unlock(&card->ip_lock); in qeth_l3_dev_ipato_invert6_store()
580 mutex_lock(&card->ip_lock); in qeth_l3_dev_ip_add_show()
581 hash_for_each(card->ip_htable, i, ipaddr, hnode) { in qeth_l3_dev_ip_add_show()
582 if (ipaddr->proto != proto || ipaddr->type != type) in qeth_l3_dev_ip_add_show()
585 qeth_l3_ipaddr_to_string(proto, (u8 *)&ipaddr->u, addr_str); in qeth_l3_dev_ip_add_show()
588 mutex_unlock(&card->ip_lock); in qeth_l3_dev_ip_add_show()
689 return -EINVAL; in qeth_l3_parse_rxipe()
695 return -EINVAL; in qeth_l3_parse_rxipe()
701 return -EINVAL; in qeth_l3_parse_rxipe()