From patchwork Tue Oct 3 08:55:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 9981957 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 8ED346029B for ; Tue, 3 Oct 2017 08:56:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 817D21FFCA for ; Tue, 3 Oct 2017 08:56:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 764EC2862A; Tue, 3 Oct 2017 08:56:47 +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 E9F441FFCA for ; Tue, 3 Oct 2017 08:56:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751157AbdJCI4a (ORCPT ); Tue, 3 Oct 2017 04:56:30 -0400 Received: from mail-by2nam01on0069.outbound.protection.outlook.com ([104.47.34.69]:25601 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751201AbdJCI42 (ORCPT ); Tue, 3 Oct 2017 04:56:28 -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=EnY70qW3lQGwkHwILqktW7BGB7UKD4nOvevnDWtob+nPXQaDsdryVuH5/xCmW/HZt//7xM216qfLrzw0LyLKDS4wAa6BtVc+efjxkDTDIQXhPEj9OjgmH41Zl44MC4fsjtaXpf7WcPrmUWBm8CQDxB7rAxOBnPCecplseA73xs8= Received: from CO2PR07CA0068.namprd07.prod.outlook.com (10.174.192.36) by CY1PR0701MB2044.namprd07.prod.outlook.com (10.163.142.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 3 Oct 2017 08:56:25 +0000 Received: from BY2FFO11FD047.protection.gbl (2a01:111:f400:7c0c::144) by CO2PR07CA0068.outlook.office365.com (2603:10b6:100::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8 via Frontend Transport; Tue, 3 Oct 2017 08:56:25 +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 BY2FFO11FD047.mail.protection.outlook.com (10.1.15.175) 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; Tue, 3 Oct 2017 08:56:24 +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; Tue, 3 Oct 2017 01:56:23 -0700 From: Michal Kalderon To: CC: , , , Michal Kalderon , "Ariel Elior" Subject: [PATCH v2 net-next 11/12] qed: Add support for MPA header being split over two tcp packets Date: Tue, 3 Oct 2017 11:55:01 +0300 Message-ID: <1507020902-4952-12-git-send-email-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1507020902-4952-1-git-send-email-Michal.Kalderon@cavium.com> References: <1507020902-4952-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)(979002)(6009001)(346002)(376002)(2980300002)(428002)(199003)(189002)(81166006)(77096006)(54906003)(36756003)(316002)(16586007)(101416001)(50466002)(5003940100001)(8676002)(189998001)(356003)(8936002)(47776003)(478600001)(107886003)(86362001)(81156014)(50986999)(6916009)(2950100002)(5660300001)(106466001)(105586002)(6666003)(104016004)(4326008)(48376002)(76176999)(50226002)(2906002)(72206003)(305945005)(69596002)(2351001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB2044; 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; BY2FFO11FD047; 1:vc+kdxKZLChfY0zshjHYXm/WFPzFxDstLNlVa6Ksso19xf3nLgdUteVbnvBo+FOEC/xBaInGxRsj3UcQehClVoI6aG2PEUdaQvy1fIAd3zgE2/T0qfL99UN2Sd02uClr X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ee0d1d3-c2df-4fb5-f03a-08d50a3ca08e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY1PR0701MB2044; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2044; 3:m6aHVCcsw1yc77Ku/01xlzf8w6OV4QaEP6H8K35t2tkSIWNKh0ZXDsmd8g1iZNC0VjgokbYaac0TXztS0BcALBmEaXD6H4u9JueUcpdy0tLZ71siETLtlUJL8INvMsaUMQrbP9vuvXJzeXpVzfkB/pITzMsL+hr/PCaL9HEYqicLI0yZ1zvLtvCZouy9fpJnOsHodWpcFSW2COHsOPHh3CHLYxVZ6PrY/1jL+Lcp9pTs0YmD4rD9P86JqjKwh++HKFveMG9MzfmyN27GegBVp8uyz4t1bRJW57E+0ijOXsrnkr/IEgurLfLSUfVv8mPhIv9iWm9n+1huslH+Q8VGVg==; 25:dK/GUc34CRr5G0J73/QBL8AhgaH9dYKIJq0BnR7i/A5b1tLdILsmS+WRplVwSk+66shmwv/JiXPO+BZIl+NuCLlbY2GWrps1LARHCUDILaqfWItpudNyBe24qyzRfI+DVHf4ELcMoSF7hLR/dGphXFyld1xb9tAE5W+WZmox+/xJ2JvUjp6spqseRhR2jVKM26in3vYUbVKzup9ku6cNe1hdycIA/qK//A/R4Z6Y19FNboW3iqqZ3SgFnC6kvBsiswye72Ev+87jI67dAD6IoK5sFylBVo5uEr4k7d03wDb+uoS8wF1kG3kUdzx0fDv3poAu29EDuKmprF1UknrUEg==; 31:GmlwSBH7tj7lgPKV4HJ0fuPQlguAYFSSxUMwnKu9nIxFJiPKnWZWaeCVLS/oWLRMPYD6UIMxa3EUJZAnoswOs17TsYW8GFuS8yhZXOgruMXlIOOR9fgLtLb1Ko2f6iE8lHtF7P833ZBRwFbQASc8F6BsKUMIb9njrcE4BWvzDWGWtB6dXTjVp0xL/Ngm9japIn3K//lBHzZEauce1OJBWjUYnE9KvfIYRVDf/NUNtck= X-MS-TrafficTypeDiagnostic: CY1PR0701MB2044: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2044; 20:V/054Pqbmzh9b4lUDx4bwPgmMmRilfa8qajzcBiw4HAFx96cQzkbpt6ErK2T6SvIKmFnjhjuajpb9bjHwQYlwxrwUCIBtTp42DMD8lcBkUIPTzhrQWcR5Qc1X3homcvKJPvZfn716CWgr89KayUR56Q+LewhInUhpiRwbDgXUBHHMCogerUUOuW6FKamXxkBZ7A0LEo8md0DgGqu2Zzh7IlBfqGfYyEiHHULb9WlIze/bhLb2r1ky74MSJERsfe4o0g6ibxn50ZDrqsd5p0Mw5K7oIvK0oWwMG34w/deSybDzXxVcldmEgrV+30DnJ4TTF3XJMRin1jVHDIV/IJ9KJUWIeUXas/c5spO05+2dJc5wOR0AAadWFB0a5d+bOuN5T/XSfNoSkAVUT+swampGQ7rogKwyJJ4tGzo5lS1nNKPOUAoMNkJuMBpvqGhhzJR0AoIOu8xhXZZ2uTwA+gnzFdID/9nyOMuK0HKs5s4arpHueYmhmE35dfj8fQnQRe3; 4:TcK22XNi2JQravF71PGk4mQHglTQhQ9FDuegj8nyx2oyacEuS2jkMcFw7891MFDK0QRUuNKSSEkoKUtcNA70DkOeqc6hT0iye8wd1gncq92cYkmVcKmv28PA4RpTlUfkXYxWIxOvAUO5QwrYk1zbNhLBVblEcakHWrcdb2XRTAbYx6jaexJ++jVYmzS5rbTD7vM5w7gytHI8wTKjevIDjY1Vcjjh/jAh575x/TmlEtcQKi4ZbtkTO/s4y9WZO01b 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)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123555025)(20161123558100)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0701MB2044; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0701MB2044; X-Forefront-PRVS: 044968D9E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB2044; 23:6bfH058xkgylAFB9EkoMUkl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czflDF/B/DPxFVUcC73Ejxy7MZw5Pu965VHhTIEm8RoJk?= =?us-ascii?Q?j4rZtLQjkVpzWLLD3MTYuBkmXN/s4yPKShb50KN39Jy79Kss1LEbO+sBeEF7?= =?us-ascii?Q?f7GjhacwditzSnjQoDNggmgGm6f05M354xhdtvt0YBoBBMjNysu0fNAlAUMj?= =?us-ascii?Q?szF56vLAkhsvi9JtmDgq466+XUs/GnR+aj8oKWW+Rv4Kktu52Uw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2044; 6:npkYLMtpnWzBpw5n9WwnGxExL51I3QX1aFbwAPOoXT8mMrLfVyverweKNc1gFW0Q4m3vXaarrLphi2a045tm/fbRXQcZmxTCk782oYKcbQWLvxo+zp8ZZHX+yt5cbns6zI3o2dpCnz2+yQewp478XbQ3bnW5SavYYakN9g3354+jD6ghwb2YN4h7kD6ipv7kftaxkkCkAqvC97rd/Tr775YP9puEPKZeEH16JiCfSJKB16fn7KS5+tnSYftiWAdo7hVEambthqi95NpV7OcPVKD1W6vSq2w6VMjbsQs/qGh3Vcbw/0IdxJvOFSQU7l2kRJrqB8sb5btT1VIL5Ol2oQ==; 5:EkBUtFTF/YmTCfUiLKZscJFgIAnDYKV1lb8fffbqY50hxdKDSp1gMrO+1Foq9gY04Yp71tgROMw/hrWTfnpTgth58f/J6sylaijF/DT9FpxsIUvLypjAr7Cgn+mlj0vt7iMQDgoGneO1z/8lIDHXfA==; 24:sLjCJTPNjXRXkA70lEZvKc0S+s6B4QVnPvOl7BB2fRNFxknCH0RYLnc2F38J/xPlCbNixHnV50iZLhHTgXcojstL6eJ4V6WeK5u2j96Vvxk=; 7:p+O9HibIMkET6/wtMubZ3lAH2F9ourwIg/YYLEjb7ZDUJN9LIZv9DCcblGn/LWNhEiNgpprl2tTM9zAQMEmYMm0nYS+UToQDwmW5d0M3AEyaca9A0/XvYudT4OC+EOK9leHGeGL94foawfs95PBigSUOl6rC55HI+xVqYbkeqH4KFJEikqm03nly4dCVvND6+tQnF0M9N0IeyzxNYK87cReKaoAh80wcpFERToftQxs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2017 08:56:24.8646 (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: CY1PR0701MB2044 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;