diff options
author | Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com> | 2018-04-26 03:42:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-27 13:38:49 -0400 |
commit | d7e6ed97b534e8b5706f4ef6d51c44f13608333c (patch) | |
tree | 868de56dfdb3574c7778885958c344b9c510f759 | |
parent | 571f9dd8026b44fe52d9ca9ed6a68c53aad1f3ba (diff) |
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 <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 31 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_mpc.h | 1 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 9 |
3 files changed, 33 insertions, 8 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 55b05d9c1cb6..06415b6a8f68 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -6430,6 +6430,29 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on) | |||
6430 | return rc; | 6430 | return rc; |
6431 | } | 6431 | } |
6432 | 6432 | ||
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 | |||
6433 | #define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO | \ | 6456 | #define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO | \ |
6434 | NETIF_F_IPV6_CSUM) | 6457 | NETIF_F_IPV6_CSUM) |
6435 | /** | 6458 | /** |
@@ -6477,9 +6500,8 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) | |||
6477 | if (rc) | 6500 | if (rc) |
6478 | changed ^= NETIF_F_IPV6_CSUM; | 6501 | changed ^= NETIF_F_IPV6_CSUM; |
6479 | } | 6502 | } |
6480 | if ((changed & NETIF_F_RXCSUM)) { | 6503 | if (changed & NETIF_F_RXCSUM) { |
6481 | rc = qeth_set_ipa_csum(card, features & NETIF_F_RXCSUM, | 6504 | rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM); |
6482 | IPA_INBOUND_CHECKSUM, QETH_PROT_IPV4); | ||
6483 | if (rc) | 6505 | if (rc) |
6484 | changed ^= NETIF_F_RXCSUM; | 6506 | changed ^= NETIF_F_RXCSUM; |
6485 | } | 6507 | } |
@@ -6508,7 +6530,8 @@ netdev_features_t qeth_fix_features(struct net_device *dev, | |||
6508 | features &= ~NETIF_F_IP_CSUM; | 6530 | features &= ~NETIF_F_IP_CSUM; |
6509 | if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) | 6531 | if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) |
6510 | features &= ~NETIF_F_IPV6_CSUM; | 6532 | 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)) | ||
6512 | features &= ~NETIF_F_RXCSUM; | 6535 | features &= ~NETIF_F_RXCSUM; |
6513 | if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) | 6536 | if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) |
6514 | features &= ~NETIF_F_TSO; | 6537 | features &= ~NETIF_F_TSO; |
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h index af3c35fbfa9e..878e62f35169 100644 --- a/drivers/s390/net/qeth_core_mpc.h +++ b/drivers/s390/net/qeth_core_mpc.h | |||
@@ -246,6 +246,7 @@ enum qeth_ipa_funcs { | |||
246 | IPA_QUERY_ARP_ASSIST = 0x00040000L, | 246 | IPA_QUERY_ARP_ASSIST = 0x00040000L, |
247 | IPA_INBOUND_TSO = 0x00080000L, | 247 | IPA_INBOUND_TSO = 0x00080000L, |
248 | IPA_OUTBOUND_TSO = 0x00100000L, | 248 | IPA_OUTBOUND_TSO = 0x00100000L, |
249 | IPA_INBOUND_CHECKSUM_V6 = 0x00400000L, | ||
249 | IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L, | 250 | IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L, |
250 | }; | 251 | }; |
251 | 252 | ||
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 5b1780fa4cb5..810d69bd9991 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -992,15 +992,16 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) | |||
992 | card->dev->hw_features |= NETIF_F_IP_CSUM; | 992 | card->dev->hw_features |= NETIF_F_IP_CSUM; |
993 | card->dev->vlan_features |= NETIF_F_IP_CSUM; | 993 | card->dev->vlan_features |= NETIF_F_IP_CSUM; |
994 | } | 994 | } |
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 | } | ||
999 | } | 995 | } |
1000 | if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { | 996 | if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { |
1001 | card->dev->hw_features |= NETIF_F_IPV6_CSUM; | 997 | card->dev->hw_features |= NETIF_F_IPV6_CSUM; |
1002 | card->dev->vlan_features |= NETIF_F_IPV6_CSUM; | 998 | card->dev->vlan_features |= NETIF_F_IPV6_CSUM; |
1003 | } | 999 | } |
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 | } | ||
1004 | 1005 | ||
1005 | card->info.broadcast_capable = 1; | 1006 | card->info.broadcast_capable = 1; |
1006 | qeth_l2_request_initial_mac(card); | 1007 | qeth_l2_request_initial_mac(card); |