s390/qeth: keep track of LP2LP capability for csum offload
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 6 May 2020 08:09:40 +0000 (10:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 May 2020 21:11:25 +0000 (14:11 -0700)
When enabling TX CSO, make a note of whether the device has support for
LP2LP offloading. This will become relevant in subsequent patches.

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

index e0b26310ecab5cf6b67bba2ef0b08acb88be1a5f..2ac7771394d8a2c3e8198cabb165c5a67cf430e6 100644 (file)
@@ -688,6 +688,9 @@ struct qeth_card_info {
        u8 promisc_mode:1;
        u8 use_v1_blkt:1;
        u8 is_vm_nic:1;
+       /* no bitfield, we take a pointer on these two: */
+       u8 has_lp2lp_cso_v6;
+       u8 has_lp2lp_cso_v4;
        enum qeth_card_types type;
        enum qeth_link_types link_type;
        int broadcast_capable;
index f7689461c242cf3f75c99380fe15e92fb9b30c0f..ef96890eea5c2c497822b8e7f64502bcfe169b09 100644 (file)
@@ -6300,7 +6300,7 @@ static int qeth_set_csum_off(struct qeth_card *card, enum qeth_ipa_funcs cstype,
 }
 
 static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype,
-                           enum qeth_prot_versions prot)
+                           enum qeth_prot_versions prot, u8 *lp2lp)
 {
        u32 required_features = QETH_IPA_CHECKSUM_UDP | QETH_IPA_CHECKSUM_TCP;
        struct qeth_cmd_buffer *iob;
@@ -6352,8 +6352,11 @@ static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype,
 
        dev_info(&card->gdev->dev, "HW Checksumming (%sbound IPv%d) enabled\n",
                 cstype == IPA_INBOUND_CHECKSUM ? "in" : "out", prot);
-       if (!qeth_ipa_caps_enabled(&caps, QETH_IPA_CHECKSUM_LP2LP) &&
-           cstype == IPA_OUTBOUND_CHECKSUM)
+
+       if (lp2lp)
+               *lp2lp = qeth_ipa_caps_enabled(&caps, QETH_IPA_CHECKSUM_LP2LP);
+
+       if (lp2lp && !*lp2lp)
                dev_warn(&card->gdev->dev,
                         "Hardware checksumming is performed only if %s and its peer use different OSA Express 3 ports\n",
                         QETH_CARD_IFNAME(card));
@@ -6361,9 +6364,9 @@ static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype,
 }
 
 static int qeth_set_ipa_csum(struct qeth_card *card, bool on, int cstype,
-                            enum qeth_prot_versions prot)
+                            enum qeth_prot_versions prot, u8 *lp2lp)
 {
-       return on ? qeth_set_csum_on(card, cstype, prot) :
+       return on ? qeth_set_csum_on(card, cstype, prot, lp2lp) :
                    qeth_set_csum_off(card, cstype, prot);
 }
 
@@ -6451,13 +6454,13 @@ static int qeth_set_ipa_rx_csum(struct qeth_card *card, bool on)
 
        if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
                rc_ipv4 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
-                                           QETH_PROT_IPV4);
+                                           QETH_PROT_IPV4, NULL);
        if (!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
                /* no/one Offload Assist available, so the rc is trivial */
                return rc_ipv4;
 
        rc_ipv6 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
-                                   QETH_PROT_IPV6);
+                                   QETH_PROT_IPV6, NULL);
 
        if (on)
                /* enable: success if any Assist is active */
@@ -6504,13 +6507,15 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features)
 
        if ((changed & NETIF_F_IP_CSUM)) {
                rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM,
-                                      IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4);
+                                      IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4,
+                                      &card->info.has_lp2lp_cso_v4);
                if (rc)
                        changed ^= NETIF_F_IP_CSUM;
        }
        if (changed & NETIF_F_IPV6_CSUM) {
                rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM,
-                                      IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6);
+                                      IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6,
+                                      &card->info.has_lp2lp_cso_v6);
                if (rc)
                        changed ^= NETIF_F_IPV6_CSUM;
        }