]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/qeth: remove duplicated carrier state tracking
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 26 Sep 2018 16:29:16 +0000 (18:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Sep 2018 16:56:08 +0000 (09:56 -0700)
The netdevice is always available, apply any carrier state changes to it
without caching them.
On a STARTLAN event (ie. carrier-up), defer updating the state to
qeth_core_hardsetup_card() in the subsequent recovery action.

Also remove the carrier-state checks from the xmit routines. Stopping
transmission on carrier-down is the responsibility of upper-level code
(eg see dev_direct_xmit()).

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_core_sys.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index 64bcb1237db09c6af643565e5989c7a3d9c16a6b..cd44ff2df6fe83655130c567d89048561e6a2b98 100644 (file)
@@ -763,7 +763,6 @@ struct qeth_switch_info {
 struct qeth_card {
        struct list_head list;
        enum qeth_card_states state;
-       int lan_online;
        spinlock_t lock;
        struct ccwgroup_device *gdev;
        struct qeth_channel read;
index 9cbdc6760abab0449b243f6f1a2ac19e46a159df..0078b5d217cc4f46821344ebdaa1ad2a620b2874 100644 (file)
@@ -652,16 +652,13 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
                                 "The link for interface %s on CHPID 0x%X failed\n",
                                 QETH_CARD_IFNAME(card), card->info.chpid);
                        qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card);
+                       netif_carrier_off(card->dev);
                }
-               card->lan_online = 0;
-               netif_carrier_off(card->dev);
                return NULL;
        case IPA_CMD_STARTLAN:
                dev_info(&card->gdev->dev,
                         "The link for %s on CHPID 0x%X has been restored\n",
                         QETH_CARD_IFNAME(card), card->info.chpid);
-               netif_carrier_on(card->dev);
-               card->lan_online = 1;
                if (card->info.hwtrap)
                        card->info.hwtrap = 2;
                qeth_schedule_recovery(card);
@@ -5133,13 +5130,14 @@ retriable:
                if (rc == IPA_RC_LAN_OFFLINE) {
                        dev_warn(&card->gdev->dev,
                                "The LAN is offline\n");
-                       card->lan_online = 0;
+                       netif_carrier_off(card->dev);
                } else {
                        rc = -ENODEV;
                        goto out;
                }
-       } else
-               card->lan_online = 1;
+       } else {
+               netif_carrier_on(card->dev);
+       }
 
        card->options.ipa4.supported_funcs = 0;
        card->options.ipa6.supported_funcs = 0;
index 970f6c71a66e727cbcb34f801a292cd1d5f5e446..30f61608fa22c909df76abc2374d1609b9998892 100644 (file)
@@ -31,10 +31,9 @@ static ssize_t qeth_dev_state_show(struct device *dev,
        case CARD_STATE_SOFTSETUP:
                return sprintf(buf, "SOFTSETUP\n");
        case CARD_STATE_UP:
-               if (card->lan_online)
-               return sprintf(buf, "UP (LAN ONLINE)\n");
-               else
-                       return sprintf(buf, "UP (LAN OFFLINE)\n");
+               return sprintf(buf, "UP (LAN %s)\n",
+                              netif_carrier_ok(card->dev) ? "ONLINE" :
+                                                            "OFFLINE");
        case CARD_STATE_RECOVER:
                return sprintf(buf, "RECOVER\n");
        default:
index ed475b4ddd3efc0071219aa810f4f20fb5b21b23..c810d53fff5173f94f75b277f7639854072777ee 100644 (file)
@@ -694,7 +694,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
        int tx_bytes = skb->len;
        int rc;
 
-       if ((card->state != CARD_STATE_UP) || !card->lan_online) {
+       if (card->state != CARD_STATE_UP) {
                card->stats.tx_carrier_errors++;
                goto tx_drop;
        }
@@ -997,10 +997,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
                goto out_remove;
        }
        card->state = CARD_STATE_SOFTSETUP;
-       if (card->lan_online)
-               netif_carrier_on(card->dev);
-       else
-               netif_carrier_off(card->dev);
 
        qeth_set_allowed_threads(card, 0xffffffff, 0);
 
index 86c89338b1a253c385aba3b4be45a0f9ba94f7a4..80893481bb850f00a0b65b41c5b86ef262d9e5b5 100644 (file)
@@ -2233,7 +2233,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
                        goto tx_drop;
        }
 
-       if (card->state != CARD_STATE_UP || !card->lan_online) {
+       if (card->state != CARD_STATE_UP) {
                card->stats.tx_carrier_errors++;
                goto tx_drop;
        }
@@ -2573,10 +2573,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
 
        qeth_set_allowed_threads(card, 0xffffffff, 0);
        qeth_l3_recover_ip(card);
-       if (card->lan_online)
-               netif_carrier_on(card->dev);
-       else
-               netif_carrier_off(card->dev);
 
        qeth_enable_hw_features(card->dev);
        if (recover_flag == CARD_STATE_RECOVER) {