Skip to content

Commit d7e6ed9

Browse files
Kittipon Meesompopdavem330
authored andcommitted
s390/qeth: add IPv6 RX checksum offload support
Check if a qeth device supports IPv6 RX checksum offload, and hook it up into the existing NETIF_F_RXCSUM support. As NETIF_F_RXCSUM is now backed by a combination of HW Assists, we need to be a little smarter when dealing with errors during a configuration change: - switching on NETIF_F_RXCSUM only makes sense if at least one HW Assist was enabled successfully. - for switching off NETIF_F_RXCSUM, all available HW Assists need to be deactivated. Signed-off-by: Kittipon Meesompop <[email protected]> Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 571f9dd commit d7e6ed9

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

drivers/s390/net/qeth_core_main.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6430,6 +6430,29 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on)
64306430
return rc;
64316431
}
64326432

6433+
static int qeth_set_ipa_rx_csum(struct qeth_card *card, bool on)
6434+
{
6435+
int rc_ipv4 = (on) ? -EOPNOTSUPP : 0;
6436+
int rc_ipv6;
6437+
6438+
if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
6439+
rc_ipv4 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
6440+
QETH_PROT_IPV4);
6441+
if (!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
6442+
/* no/one Offload Assist available, so the rc is trivial */
6443+
return rc_ipv4;
6444+
6445+
rc_ipv6 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
6446+
QETH_PROT_IPV6);
6447+
6448+
if (on)
6449+
/* enable: success if any Assist is active */
6450+
return (rc_ipv6) ? rc_ipv4 : 0;
6451+
6452+
/* disable: failure if any Assist is still active */
6453+
return (rc_ipv6) ? rc_ipv6 : rc_ipv4;
6454+
}
6455+
64336456
#define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO | \
64346457
NETIF_F_IPV6_CSUM)
64356458
/**
@@ -6477,9 +6500,8 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features)
64776500
if (rc)
64786501
changed ^= NETIF_F_IPV6_CSUM;
64796502
}
6480-
if ((changed & NETIF_F_RXCSUM)) {
6481-
rc = qeth_set_ipa_csum(card, features & NETIF_F_RXCSUM,
6482-
IPA_INBOUND_CHECKSUM, QETH_PROT_IPV4);
6503+
if (changed & NETIF_F_RXCSUM) {
6504+
rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM);
64836505
if (rc)
64846506
changed ^= NETIF_F_RXCSUM;
64856507
}
@@ -6508,7 +6530,8 @@ netdev_features_t qeth_fix_features(struct net_device *dev,
65086530
features &= ~NETIF_F_IP_CSUM;
65096531
if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6))
65106532
features &= ~NETIF_F_IPV6_CSUM;
6511-
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
6533+
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) &&
6534+
!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
65126535
features &= ~NETIF_F_RXCSUM;
65136536
if (!qeth_is_supported(card, IPA_OUTBOUND_TSO))
65146537
features &= ~NETIF_F_TSO;

drivers/s390/net/qeth_core_mpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ enum qeth_ipa_funcs {
246246
IPA_QUERY_ARP_ASSIST = 0x00040000L,
247247
IPA_INBOUND_TSO = 0x00080000L,
248248
IPA_OUTBOUND_TSO = 0x00100000L,
249+
IPA_INBOUND_CHECKSUM_V6 = 0x00400000L,
249250
IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L,
250251
};
251252

drivers/s390/net/qeth_l2_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,16 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
992992
card->dev->hw_features |= NETIF_F_IP_CSUM;
993993
card->dev->vlan_features |= NETIF_F_IP_CSUM;
994994
}
995-
if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
996-
card->dev->hw_features |= NETIF_F_RXCSUM;
997-
card->dev->vlan_features |= NETIF_F_RXCSUM;
998-
}
999995
}
1000996
if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {
1001997
card->dev->hw_features |= NETIF_F_IPV6_CSUM;
1002998
card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
1003999
}
1000+
if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) ||
1001+
qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) {
1002+
card->dev->hw_features |= NETIF_F_RXCSUM;
1003+
card->dev->vlan_features |= NETIF_F_RXCSUM;
1004+
}
10041005

10051006
card->info.broadcast_capable = 1;
10061007
qeth_l2_request_initial_mac(card);

0 commit comments

Comments
 (0)