diff options
Diffstat (limited to 'drivers/s390/net/qeth_l3_main.c')
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 176 |
1 files changed, 70 insertions, 106 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 09ef518ca1ea..b1c1d2510d55 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -97,7 +97,7 @@ static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, return false; qeth_l3_convert_addr_to_bits((u8 *) &addr->u, addr_bits, - (addr->proto == QETH_PROT_IPV4)? 4:16); + (addr->proto == QETH_PROT_IPV4) ? 4 : 16); list_for_each_entry(ipatoe, &card->ipato.entries, entry) { if (addr->proto != ipatoe->proto) continue; @@ -105,11 +105,9 @@ static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, (ipatoe->proto == QETH_PROT_IPV4) ? 4 : 16); if (addr->proto == QETH_PROT_IPV4) - rc = !memcmp(addr_bits, ipatoe_bits, - min(32, ipatoe->mask_bits)); + rc = !memcmp(addr_bits, ipatoe_bits, ipatoe->mask_bits); else - rc = !memcmp(addr_bits, ipatoe_bits, - min(128, ipatoe->mask_bits)); + rc = !memcmp(addr_bits, ipatoe_bits, ipatoe->mask_bits); if (rc) break; } @@ -314,7 +312,8 @@ static int qeth_l3_setdelip_cb(struct qeth_card *card, struct qeth_reply *reply, } static int qeth_l3_send_setdelmc(struct qeth_card *card, - struct qeth_ipaddr *addr, int ipacmd) + struct qeth_ipaddr *addr, + enum qeth_ipa_cmds ipacmd) { struct qeth_cmd_buffer *iob; struct qeth_ipa_cmd *cmd; @@ -535,14 +534,13 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card, QETH_CARD_TEXT(card, 2, "addipato"); - mutex_lock(&card->conf_mutex); mutex_lock(&card->ip_lock); list_for_each_entry(ipatoe, &card->ipato.entries, entry) { if (ipatoe->proto != new->proto) continue; if (!memcmp(ipatoe->addr, new->addr, - (ipatoe->proto == QETH_PROT_IPV4)? 4:16) && + (ipatoe->proto == QETH_PROT_IPV4) ? 4 : 16) && (ipatoe->mask_bits == new->mask_bits)) { rc = -EEXIST; break; @@ -555,28 +553,26 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card, } mutex_unlock(&card->ip_lock); - mutex_unlock(&card->conf_mutex); return rc; } int qeth_l3_del_ipato_entry(struct qeth_card *card, enum qeth_prot_versions proto, u8 *addr, - int mask_bits) + unsigned int mask_bits) { struct qeth_ipato_entry *ipatoe, *tmp; int rc = -ENOENT; QETH_CARD_TEXT(card, 2, "delipato"); - mutex_lock(&card->conf_mutex); mutex_lock(&card->ip_lock); list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { if (ipatoe->proto != proto) continue; if (!memcmp(ipatoe->addr, addr, - (proto == QETH_PROT_IPV4)? 4:16) && + (proto == QETH_PROT_IPV4) ? 4 : 16) && (ipatoe->mask_bits == mask_bits)) { list_del(&ipatoe->entry); qeth_l3_update_ipato(card); @@ -586,7 +582,6 @@ int qeth_l3_del_ipato_entry(struct qeth_card *card, } mutex_unlock(&card->ip_lock); - mutex_unlock(&card->conf_mutex); return rc; } @@ -596,7 +591,6 @@ int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip, enum qeth_prot_versions proto) { struct qeth_ipaddr addr; - int rc; qeth_l3_init_ipaddr(&addr, type, proto); if (proto == QETH_PROT_IPV4) @@ -604,11 +598,7 @@ int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip, else memcpy(&addr.u.a6.addr, ip, 16); - mutex_lock(&card->conf_mutex); - rc = qeth_l3_modify_ip(card, &addr, add); - mutex_unlock(&card->conf_mutex); - - return rc; + return qeth_l3_modify_ip(card, &addr, add); } int qeth_l3_modify_hsuid(struct qeth_card *card, bool add) @@ -716,16 +706,16 @@ static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card) if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { dev_info(&card->gdev->dev, - "ARP processing not supported on %s!\n", - QETH_CARD_IFNAME(card)); + "ARP processing not supported on %s!\n", + netdev_name(card->dev)); return 0; } rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, IPA_CMD_ASS_START, NULL); if (rc) { dev_warn(&card->gdev->dev, - "Starting ARP processing support for %s failed\n", - QETH_CARD_IFNAME(card)); + "Starting ARP processing support for %s failed\n", + netdev_name(card->dev)); } return rc; } @@ -738,8 +728,8 @@ static int qeth_l3_start_ipa_source_mac(struct qeth_card *card) if (!qeth_is_supported(card, IPA_SOURCE_MAC)) { dev_info(&card->gdev->dev, - "Inbound source MAC-address not supported on %s\n", - QETH_CARD_IFNAME(card)); + "Inbound source MAC-address not supported on %s\n", + netdev_name(card->dev)); return -EOPNOTSUPP; } @@ -747,8 +737,8 @@ static int qeth_l3_start_ipa_source_mac(struct qeth_card *card) IPA_CMD_ASS_START, NULL); if (rc) dev_warn(&card->gdev->dev, - "Starting source MAC-address support for %s failed\n", - QETH_CARD_IFNAME(card)); + "Starting source MAC-address support for %s failed\n", + netdev_name(card->dev)); return rc; } @@ -760,7 +750,7 @@ static int qeth_l3_start_ipa_vlan(struct qeth_card *card) if (!qeth_is_supported(card, IPA_FULL_VLAN)) { dev_info(&card->gdev->dev, - "VLAN not supported on %s\n", QETH_CARD_IFNAME(card)); + "VLAN not supported on %s\n", netdev_name(card->dev)); return -EOPNOTSUPP; } @@ -768,8 +758,8 @@ static int qeth_l3_start_ipa_vlan(struct qeth_card *card) IPA_CMD_ASS_START, NULL); if (rc) { dev_warn(&card->gdev->dev, - "Starting VLAN support for %s failed\n", - QETH_CARD_IFNAME(card)); + "Starting VLAN support for %s failed\n", + netdev_name(card->dev)); } else { dev_info(&card->gdev->dev, "VLAN enabled\n"); } @@ -784,8 +774,8 @@ static int qeth_l3_start_ipa_multicast(struct qeth_card *card) if (!qeth_is_supported(card, IPA_MULTICASTING)) { dev_info(&card->gdev->dev, - "Multicast not supported on %s\n", - QETH_CARD_IFNAME(card)); + "Multicast not supported on %s\n", + netdev_name(card->dev)); return -EOPNOTSUPP; } @@ -793,8 +783,8 @@ static int qeth_l3_start_ipa_multicast(struct qeth_card *card) IPA_CMD_ASS_START, NULL); if (rc) { dev_warn(&card->gdev->dev, - "Starting multicast support for %s failed\n", - QETH_CARD_IFNAME(card)); + "Starting multicast support for %s failed\n", + netdev_name(card->dev)); } else { dev_info(&card->gdev->dev, "Multicast enabled\n"); card->dev->flags |= IFF_MULTICAST; @@ -817,7 +807,7 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card) if (rc) { dev_err(&card->gdev->dev, "Activating IPv6 support for %s failed\n", - QETH_CARD_IFNAME(card)); + netdev_name(card->dev)); return rc; } rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6, IPA_CMD_ASS_START, @@ -825,15 +815,15 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card) if (rc) { dev_err(&card->gdev->dev, "Activating IPv6 support for %s failed\n", - QETH_CARD_IFNAME(card)); + netdev_name(card->dev)); return rc; } rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU, IPA_CMD_ASS_START, NULL); if (rc) { dev_warn(&card->gdev->dev, - "Enabling the passthrough mode for %s failed\n", - QETH_CARD_IFNAME(card)); + "Enabling the passthrough mode for %s failed\n", + netdev_name(card->dev)); return rc; } out: @@ -847,7 +837,7 @@ static int qeth_l3_start_ipa_ipv6(struct qeth_card *card) if (!qeth_is_supported(card, IPA_IPV6)) { dev_info(&card->gdev->dev, - "IPv6 not supported on %s\n", QETH_CARD_IFNAME(card)); + "IPv6 not supported on %s\n", netdev_name(card->dev)); return 0; } return qeth_l3_softsetup_ipv6(card); @@ -862,16 +852,17 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) card->info.broadcast_capable = 0; if (!qeth_is_supported(card, IPA_FILTERING)) { dev_info(&card->gdev->dev, - "Broadcast not supported on %s\n", - QETH_CARD_IFNAME(card)); + "Broadcast not supported on %s\n", + netdev_name(card->dev)); rc = -EOPNOTSUPP; goto out; } rc = qeth_send_simple_setassparms(card, IPA_FILTERING, IPA_CMD_ASS_START, NULL); if (rc) { - dev_warn(&card->gdev->dev, "Enabling broadcast filtering for " - "%s failed\n", QETH_CARD_IFNAME(card)); + dev_warn(&card->gdev->dev, + "Enabling broadcast filtering for %s failed\n", + netdev_name(card->dev)); goto out; } @@ -879,8 +870,8 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) IPA_CMD_ASS_CONFIGURE, &filter_data); if (rc) { dev_warn(&card->gdev->dev, - "Setting up broadcast filtering for %s failed\n", - QETH_CARD_IFNAME(card)); + "Setting up broadcast filtering for %s failed\n", + netdev_name(card->dev)); goto out; } card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO; @@ -888,8 +879,9 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) rc = qeth_send_simple_setassparms(card, IPA_FILTERING, IPA_CMD_ASS_ENABLE, &filter_data); if (rc) { - dev_warn(&card->gdev->dev, "Setting up broadcast echo " - "filtering for %s failed\n", QETH_CARD_IFNAME(card)); + dev_warn(&card->gdev->dev, + "Setting up broadcast echo filtering for %s failed\n", + netdev_name(card->dev)); goto out; } card->info.broadcast_capable = QETH_BROADCAST_WITHOUT_ECHO; @@ -1152,33 +1144,6 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev, return 0; } -static void qeth_l3_stop_card(struct qeth_card *card) -{ - QETH_CARD_TEXT(card, 2, "stopcard"); - - qeth_set_allowed_threads(card, 0, 1); - - cancel_work_sync(&card->rx_mode_work); - qeth_l3_drain_rx_mode_cache(card); - - if (card->options.sniffer && - (card->info.promisc_mode == SET_PROMISC_MODE_ON)) - qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); - - if (card->state == CARD_STATE_SOFTSETUP) { - qeth_l3_clear_ip_htable(card, 1); - qeth_clear_ipacmd_list(card); - card->state = CARD_STATE_DOWN; - } - - qeth_qdio_clear_card(card, 0); - qeth_drain_output_queues(card); - qeth_clear_working_pool_list(card); - flush_workqueue(card->event_wq); - qeth_flush_local_addrs(card); - card->info.promisc_mode = 0; -} - static void qeth_l3_set_promisc_mode(struct qeth_card *card) { bool enable = card->dev->flags & IFF_PROMISC; @@ -1234,7 +1199,6 @@ static void qeth_l3_rx_mode_work(struct work_struct *work) kfree(addr); break; } - addr->ref_counter = 1; fallthrough; default: /* for next call to set_rx_mode(): */ @@ -1869,8 +1833,10 @@ static u16 qeth_l3_osa_select_queue(struct net_device *dev, struct sk_buff *skb, { struct qeth_card *card = dev->ml_priv; - return IS_VM_NIC(card) ? netdev_pick_tx(dev, skb, sb_dev) : - qeth_get_priority_queue(card, skb); + if (qeth_uses_tx_prio_queueing(card)) + return qeth_get_priority_queue(card, skb); + + return netdev_pick_tx(dev, skb, sb_dev); } static const struct net_device_ops qeth_l3_netdev_ops = { @@ -1913,10 +1879,6 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) unsigned int headroom; int rc; - rc = qeth_setup_netdev(card); - if (rc) - return rc; - if (IS_OSD(card) || IS_OSX(card)) { card->dev->netdev_ops = &qeth_l3_osa_netdev_ops; @@ -2024,21 +1986,10 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) qeth_l3_clear_ipato_list(card); } -static int qeth_l3_set_online(struct qeth_card *card) +static int qeth_l3_set_online(struct qeth_card *card, bool carrier_ok) { - struct ccwgroup_device *gdev = card->gdev; struct net_device *dev = card->dev; int rc = 0; - bool carrier_ok; - - rc = qeth_core_hardsetup_card(card, &carrier_ok); - if (rc) { - QETH_CARD_TEXT_(card, 2, "2err%04x", rc); - rc = -ENODEV; - goto out_remove; - } - - qeth_print_status_message(card); /* softsetup */ QETH_CARD_TEXT(card, 2, "softsetp"); @@ -2065,12 +2016,19 @@ static int qeth_l3_set_online(struct qeth_card *card) if (dev->reg_state != NETREG_REGISTERED) { rc = qeth_l3_setup_netdev(card); if (rc) - goto out_remove; + goto err_setup; if (carrier_ok) netif_carrier_on(dev); } else { rtnl_lock(); + rc = qeth_set_real_num_tx_queues(card, + qeth_tx_actual_queues(card)); + if (rc) { + rtnl_unlock(); + goto err_set_queues; + } + if (carrier_ok) netif_carrier_on(dev); else @@ -2085,22 +2043,29 @@ static int qeth_l3_set_online(struct qeth_card *card) } rtnl_unlock(); } - qeth_trace_features(card); - /* let user_space know that device is online */ - kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); return 0; -out_remove: - qeth_l3_stop_card(card); - qeth_stop_channel(&card->data); - qeth_stop_channel(&card->write); - qeth_stop_channel(&card->read); - qdio_free(CARD_DDEV(card)); + +err_set_queues: +err_setup: + qeth_set_allowed_threads(card, 0, 1); + card->state = CARD_STATE_DOWN; + qeth_l3_clear_ip_htable(card, 1); return rc; } static void qeth_l3_set_offline(struct qeth_card *card) { - qeth_l3_stop_card(card); + qeth_set_allowed_threads(card, 0, 1); + qeth_l3_drain_rx_mode_cache(card); + + if (card->options.sniffer && + (card->info.promisc_mode == SET_PROMISC_MODE_ON)) + qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); + + if (card->state == CARD_STATE_SOFTSETUP) { + card->state = CARD_STATE_DOWN; + qeth_l3_clear_ip_htable(card, 1); + } } /* Returns zero if the command is successfully "consumed" */ @@ -2110,7 +2075,7 @@ static int qeth_l3_control_event(struct qeth_card *card, return 1; } -struct qeth_discipline qeth_l3_discipline = { +const struct qeth_discipline qeth_l3_discipline = { .devtype = &qeth_l3_devtype, .setup = qeth_l3_probe_device, .remove = qeth_l3_remove_device, @@ -2174,7 +2139,6 @@ static struct qeth_card *qeth_l3_get_card_from_dev(struct net_device *dev) static int qeth_l3_ip_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; struct net_device *dev = ifa->ifa_dev->dev; struct qeth_ipaddr addr; |