From: Ursula Braun <ubraun@linux.vnet.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
ubraun@linux.vnet.ibm.com
Subject: [PATCH RESEND net-next 02/12] s390/qeth: test RX/TX checksum offload reply
Date: Thu, 12 Jan 2017 15:48:33 +0100 [thread overview]
Message-ID: <20170112144843.33463-3-ubraun@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170112144843.33463-1-ubraun@linux.vnet.ibm.com>
From: Thomas Richter <tmricht@linux.vnet.ibm.com>
Turning on receive and/or transmit checksum offload support
on the OSA card requires 2 commands:
1. start command which replies with available features
2. enable command to turn on selected features.
The current version does not check the reply of the start
command and simply uses the returned value to enable
offload features. When the start command returns zero, this
leads to a situation where no checksum offload
is turned on by the hardware. Even worse no error
indication is returned. The Linux kernel assumes
the OSA card performs RX/TX checksum offload, but the hardware
does not perform any checksum verification at all.
This patch checks the return of the start and enable
command responses from the hardware and turns off
checksum offloading if the commands fails or does not
respond with the correct bit setting.
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_core_main.c | 13 +++++++++++++
drivers/s390/net/qeth_core_mpc.h | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 5ab80ea..49b813f 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -6104,11 +6104,19 @@ static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
{
+ const __u32 required_features = QETH_IPA_CHECKSUM_IP_HDR |
+ QETH_IPA_CHECKSUM_UDP |
+ QETH_IPA_CHECKSUM_TCP;
struct qeth_checksum_cmd chksum_cb;
int rc;
rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_START, 0,
&chksum_cb);
+ if (!rc) {
+ if ((required_features & chksum_cb.supported) !=
+ required_features)
+ rc = -EIO;
+ }
if (rc) {
qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
dev_warn(&card->gdev->dev,
@@ -6118,6 +6126,11 @@ static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
}
rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_ENABLE,
chksum_cb.supported, &chksum_cb);
+ if (!rc) {
+ if ((required_features & chksum_cb.enabled) !=
+ required_features)
+ rc = -EIO;
+ }
if (rc) {
qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
dev_warn(&card->gdev->dev,
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h
index f54ea72..bc69d0a 100644
--- a/drivers/s390/net/qeth_core_mpc.h
+++ b/drivers/s390/net/qeth_core_mpc.h
@@ -352,6 +352,16 @@ struct qeth_arp_query_info {
char *udata;
};
+/* IPA set assist segmentation bit definitions for receive and
+ * transmit checksum offloading.
+ */
+enum qeth_ipa_checksum_bits {
+ QETH_IPA_CHECKSUM_IP_HDR = 0x0002,
+ QETH_IPA_CHECKSUM_UDP = 0x0008,
+ QETH_IPA_CHECKSUM_TCP = 0x0010,
+ QETH_IPA_CHECKSUM_LP2LP = 0x0020
+};
+
/* IPA Assist checksum offload reply layout. */
struct qeth_checksum_cmd {
__u32 supported;
--
2.8.4
next prev parent reply other threads:[~2017-01-12 14:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 14:48 [PATCH RESEND net-next 00/12] s390: qeth patches Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 01/12] s390/qeth: rework RX/TX checksum offload Ursula Braun
2017-01-12 14:48 ` Ursula Braun [this message]
2017-01-12 14:48 ` [PATCH RESEND net-next 03/12] s390/qeth: display warning for OSA3 RX/TX checksum offloading Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 04/12] s390/qeth: Allow reading hsuid in state DOWN Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 05/12] s390/qeth: Remove QETH_IP_HEADER_SIZE Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 06/12] s390/qeth: drop qeth_l2_del_all_macs() parameter Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 07/12] s390/qeth: don't convert return code twice Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 08/12] s390/qeth: consolidate errno translation Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 09/12] s390/qeth: extract qeth_l2_remove_mac() Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 10/12] s390/qeth: shuffle MAC management functions around Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 11/12] s390/qeth: issue STARTLAN as first IPA command Ursula Braun
2017-01-12 14:48 ` [PATCH RESEND net-next 12/12] s390/qeth: fix retrieval of vipa and proxy-arp addresses Ursula Braun
2017-01-12 15:03 ` [PATCH RESEND net-next 00/12] s390: qeth patches David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170112144843.33463-3-ubraun@linux.vnet.ibm.com \
--to=ubraun@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).