From patchwork Mon Oct 9 09:37:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 9992453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5DB3860223 for ; Mon, 9 Oct 2017 09:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 616C5252D5 for ; Mon, 9 Oct 2017 09:39:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5570C2821F; Mon, 9 Oct 2017 09:39:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8D52252D5 for ; Mon, 9 Oct 2017 09:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241AbdJIJj1 (ORCPT ); Mon, 9 Oct 2017 05:39:27 -0400 Received: from mail-sn1nam01on0075.outbound.protection.outlook.com ([104.47.32.75]:54168 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750828AbdJIJjX (ORCPT ); Mon, 9 Oct 2017 05:39:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pKL0TGblK85Xz5dL51RNFqt8nbTT5arbekvip3aXetM=; b=BrY+y4Jt+i8XDlEithhSKiud0vVjookrmEVAHACzlz0Mlu+myXVBAYLYZXu193zsen9D9+2g58mTd1ilfd2kEfgfqgXJTf60/g8tNEn5D1iupPm97CpZqCQ5TCPRXG1YuC9lpWwDT/5KrRIGmU/TfUt251gVTlJ0+pkcZiihcWY= Received: from SN4PR0701CA0004.namprd07.prod.outlook.com (10.161.192.142) by BY2PR0701MB1944.namprd07.prod.outlook.com (10.163.155.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 9 Oct 2017 09:39:21 +0000 Received: from BL2FFO11FD010.protection.gbl (2a01:111:f400:7c09::124) by SN4PR0701CA0004.outlook.office365.com (2603:10b6:803:28::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Mon, 9 Oct 2017 09:39:20 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BL2FFO11FD010.mail.protection.outlook.com (10.173.161.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.77.10 via Frontend Transport; Mon, 9 Oct 2017 09:39:20 +0000 Received: from lb-tlvb-michal.il.qlogic.com.com (10.185.6.89) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Mon, 9 Oct 2017 02:39:17 -0700 From: Michal Kalderon To: CC: , , , Michal Kalderon , "Ariel Elior" Subject: [PATCH v3 net-next 11/12] qed: Add support for MPA header being split over two tcp packets Date: Mon, 9 Oct 2017 12:37:53 +0300 Message-ID: <1507541874-18344-12-git-send-email-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1507541874-18344-1-git-send-email-Michal.Kalderon@cavium.com> References: <1507541874-18344-1-git-send-email-Michal.Kalderon@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(2980300002)(428002)(199003)(189002)(48376002)(316002)(86362001)(5003940100001)(189998001)(50466002)(50986999)(47776003)(105586002)(76176999)(5660300001)(36756003)(101416001)(2351001)(69596002)(6916009)(4326008)(6666003)(2950100002)(8936002)(77096006)(356003)(305945005)(478600001)(106466001)(2906002)(81166006)(8676002)(81156014)(104016004)(50226002)(72206003)(107886003)(16586007)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1944; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD010; 1:LHtmxuJ8Nr8mUGeouZHIKZJ3DQ9xTwacUdh5d/0qYe4rWNlncrgbSvxvcOIhUDTG9pVDDSTDY/hNilbZvQCHqf/un5KSRyatXwga8eGsBeYJSGskqUh3uUdc2LU0VZff X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6121044c-36a2-496b-9563-08d50ef99e6c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BY2PR0701MB1944; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 3:SlBsvMWHQNpuxq34ckTtLNUzJpQZDWGHH0Dab4vmW9qQBDVoKhlJ2wVHgb4hsaDE1qsJqvK8oXWNWh+fjI/wicJ9b3Lw8d4/zqcjBVWVq7CJdMr+2eqYsI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pA5Ao1+YrC9TKkIcAuGOQsG2KJz/DAZWHSpDkVbiRV/fcuFs5Ug4FAGphI/0kcoXlZGWuVeQAMKDWgPuFJFZxDB0HP4sKjCrleE3Kf8ePOMTzsghB+PNiw986JQk+AP0cDHpzEBQ7u3U4YWDeKVDly1UODzH/O69qY9VTMaqCLvsNgIjymkscnbwt7Ly75PJE8/djSt+yB6iFnzN1Ux59sAGX2UwVstfSChf5PmOrqfWbVESnwr4NJCSb+I/8RfNZWzcs2RK73bUQTiYkU25rHT0l9DIQjjXfdlC0eLHqDoyV2IM31PcYafluMVfldvr/I51/VJliQppjf86FBZPy X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR0701MB1944; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR0701MB1944; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 4:CobfhclW8zLqtCV6Tg4CFLfzo6kBk4fqWubFh/LLONfiKVv24C0+hA9qeZqiHiKrAkNRBe4LnPf2BylHa6E2KJLamHWxu2OnWs92peXhPrbFanNgHRxLDGQvBNfP877hD9uRtVuHAfUIiFGELsFJozK20z8XFj6ZqzSDlMcK9YI/KwrZWqCvY+PG69fn5QOpFE97yUrtsBxzx3K94icVRmOlk9rFxwFPNSFQhz9ACpvBQj1yPF/sqalSOU1YVM0f X-Forefront-PRVS: 045584D28C X-Microsoft-Exch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wlHQ3rqBdfydVYzsRmKYAXJb0k1i/L6U4EmKrBVPlaY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2017 09:39:20.6923 (UTC) X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB1944 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a special case where an MPA header is split over to tcp packets, in this case we need to wait for the next packet to get the fpdu length. We use the incomplete_bytes to mark this fpdu as a "special" one which requires updating the length with the next packet Signed-off-by: Michal Kalderon Signed-off-by: Ariel Elior --- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 36 ++++++++++++++++++++++++++++- drivers/net/ethernet/qlogic/qed/qed_iwarp.h | 6 +++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c index 8b17369..2994942 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c @@ -1742,6 +1742,7 @@ enum qed_iwarp_mpa_pkt_type { QED_IWARP_MPA_PKT_UNALIGNED }; +#define QED_IWARP_INVALID_FPDU_LENGTH 0xffff #define QED_IWARP_MPA_FPDU_LENGTH_SIZE (2) #define QED_IWARP_MPA_CRC32_DIGEST_SIZE (4) @@ -1774,6 +1775,15 @@ enum qed_iwarp_mpa_pkt_type { goto out; } + /* special case of one byte remaining... + * lower byte will be read next packet + */ + if (tcp_payload_len == 1) { + fpdu->fpdu_length = *mpa_data << BITS_PER_BYTE; + pkt_type = QED_IWARP_MPA_PKT_PARTIAL; + goto out; + } + mpa_len = ntohs(*((u16 *)(mpa_data))); fpdu->fpdu_length = QED_IWARP_FPDU_LEN_WITH_PAD(mpa_len); @@ -1802,7 +1812,9 @@ enum qed_iwarp_mpa_pkt_type { fpdu->mpa_frag = buf->data_phys_addr + pkt_data->first_mpa_offset; fpdu->mpa_frag_virt = (u8 *)(buf->data) + pkt_data->first_mpa_offset; - if (tcp_payload_size < fpdu->fpdu_length) + if (tcp_payload_size == 1) + fpdu->incomplete_bytes = QED_IWARP_INVALID_FPDU_LENGTH; + else if (tcp_payload_size < fpdu->fpdu_length) fpdu->incomplete_bytes = fpdu->fpdu_length - tcp_payload_size; else fpdu->incomplete_bytes = 0; /* complete fpdu */ @@ -1810,6 +1822,27 @@ enum qed_iwarp_mpa_pkt_type { fpdu->mpa_frag_len = fpdu->fpdu_length - fpdu->incomplete_bytes; } +static void +qed_iwarp_update_fpdu_length(struct qed_hwfn *p_hwfn, + struct qed_iwarp_fpdu *fpdu, u8 *mpa_data) +{ + u16 mpa_len; + + /* Update incomplete packets if needed */ + if (fpdu->incomplete_bytes == QED_IWARP_INVALID_FPDU_LENGTH) { + /* Missing lower byte is now available */ + mpa_len = fpdu->fpdu_length | *mpa_data; + fpdu->fpdu_length = QED_IWARP_FPDU_LEN_WITH_PAD(mpa_len); + fpdu->mpa_frag_len = fpdu->fpdu_length; + /* one byte of hdr */ + fpdu->incomplete_bytes = fpdu->fpdu_length - 1; + DP_VERBOSE(p_hwfn, + QED_MSG_RDMA, + "MPA_ALIGN: Partial header mpa_len=%x fpdu_length=%x incomplete_bytes=%x\n", + mpa_len, fpdu->fpdu_length, fpdu->incomplete_bytes); + } +} + static int qed_iwarp_send_fpdu(struct qed_hwfn *p_hwfn, struct qed_iwarp_fpdu *fpdu, @@ -1960,6 +1993,7 @@ enum qed_iwarp_mpa_pkt_type { curr_pkt->first_mpa_offset += fpdu->fpdu_length; break; case QED_IWARP_MPA_PKT_UNALIGNED: + qed_iwarp_update_fpdu_length(p_hwfn, fpdu, mpa_data); rc = qed_iwarp_send_fpdu(p_hwfn, fpdu, curr_pkt, buf, mpa_buf->tcp_payload_len, pkt_type); diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h index 58db51a..c58793a 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h @@ -69,6 +69,12 @@ struct qed_iwarp_ll2_mpa_buf { u8 placement_offset; }; +/* In some cases a fpdu will arrive with only one byte of the header, in this + * case the fpdu_length will be partial (contain only higher byte and + * incomplete bytes will contain the invalid value + */ +#define QED_IWARP_INVALID_INCOMPLETE_BYTES 0xffff + struct qed_iwarp_fpdu { struct qed_iwarp_ll2_buff *mpa_buf; void *mpa_frag_virt;