Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3244631imc; Wed, 13 Mar 2019 12:34:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz45O0f+1R7BhiAQarqUSU1PbFaZlQXfk2QYtpnoYB+x7chqF35yJFi9jM71Gg0JWXGA91b X-Received: by 2002:a63:4e57:: with SMTP id o23mr39265198pgl.368.1552505684749; Wed, 13 Mar 2019 12:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505684; cv=none; d=google.com; s=arc-20160816; b=vjMNqwTD6BSmdzDSLk8mAtn8BIOph3DEYHU4rlcD2S3iAvSjtq77MntpRj3GmydABb fCobtsjunoKmd4sPqlDV6aU0b9gZTnkDqn5sNF4+O2n3T/q0SJoeCnPVjuI/DWoeo+3f xWx1TgPMxgwFhcSAnVfua+8bJ794w0eb2Ek6O0YCCggpQ44zhrK/o6uHcyut2iYWBW3D cVs0P1jP+nfLa5cEbhlQnMyAt+sW0C3d/YkFfr/v3m7VgGxc6Y8GaSCvHCf6eXWUZVEW hz9sugQWqmFmEl782PsRQIJeqGtujmagAbALNZPA0FA8gQ5N/cLz/YtzDxA4OAw31i2D lRDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S7QHoISdcDGxfR+ijBtvaByakIEsh5NEig03cEEDda0=; b=Jryp8KhmvoWe+u/ODLkG0vTx+I3mS8CShefuJQ2IFTpAch9Kq2PIstqHbLuDsPPJfC nKo60+xDQkoOj3Mhza60tw8ZiOCh4cZfmnLiPn0YWJRwwYI/tqmZZxk/Cd+Q7c5v6osb 3dynzzARnh923fDNRQc96VMX8EmTmbWUqdhN8Xz8ITChSoFVDd6PanUCdVb8py3rN9pZ XFb3V+WL7Mww7JXrVhTu3ZawDHxpJfAQI6w1fpB1vHklYIVtzbs02rQeZVOTx2agQlsK fxpZRfQxh4Bin0Wbxni28keV9lgxRuQowlB/T8DmMtpIiglOblqhv13Z/WBLiqkaPiO0 11BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sMeLt5E3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si11401516pls.204.2019.03.13.12.34.28; Wed, 13 Mar 2019 12:34:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sMeLt5E3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbfCMTcR (ORCPT + 99 others); Wed, 13 Mar 2019 15:32:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:41798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727383AbfCMTLO (ORCPT ); Wed, 13 Mar 2019 15:11:14 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 567112173C; Wed, 13 Mar 2019 19:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504273; bh=cDoCzvKMYVJaHbEs2UZyyXf+MUS7wuGz0oKLbeBVYNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMeLt5E3yfN9sNkpyGTPrBMMvaJYsEsu5OSLr6GYjhpccluR/qHb1/OnyzA0Qgxg0 1BrUP4hV2vNSJpGGiWXh7OV9MX7wmCYCJT87/QrMQwWkxjbndeilc9nP4ehgag6FX+ gpklPdIbyVMB8Z46QRA9RFn4lvy/kLogDQr5x+J8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michal Kalderon , Ariel Elior , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 25/60] qed: Fix iWARP buffer size provided for syn packet processing. Date: Wed, 13 Mar 2019 15:09:46 -0400 Message-Id: <20190313191021.158171-25-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kalderon [ Upstream commit 9addc92730df55e2c05e8d3f69267a89d65bcba8 ] The assumption that the maximum size of a syn packet is 128 bytes is wrong. Tunneling headers were not accounted for. Allocate buffers large enough for mtu. Signed-off-by: Ariel Elior Signed-off-by: Michal Kalderon Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 12 ++++++------ drivers/net/ethernet/qlogic/qed/qed_iwarp.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c index beb8e5d6401a..e84fb01b91fd 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c @@ -2605,7 +2605,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, struct qed_iwarp_info *iwarp_info; struct qed_ll2_acquire_data data; struct qed_ll2_cbs cbs; - u32 mpa_buff_size; + u32 buff_size; u16 n_ooo_bufs; int rc = 0; int i; @@ -2632,7 +2632,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, memset(&data, 0, sizeof(data)); data.input.conn_type = QED_LL2_TYPE_IWARP; - data.input.mtu = QED_IWARP_MAX_SYN_PKT_SIZE; + data.input.mtu = params->max_mtu; data.input.rx_num_desc = QED_IWARP_LL2_SYN_RX_SIZE; data.input.tx_num_desc = QED_IWARP_LL2_SYN_TX_SIZE; data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */ @@ -2654,9 +2654,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, goto err; } + buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu); rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, QED_IWARP_LL2_SYN_RX_SIZE, - QED_IWARP_MAX_SYN_PKT_SIZE, + buff_size, iwarp_info->ll2_syn_handle); if (rc) goto err; @@ -2710,10 +2711,9 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, if (rc) goto err; - mpa_buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu); rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, data.input.rx_num_desc, - mpa_buff_size, + buff_size, iwarp_info->ll2_mpa_handle); if (rc) goto err; @@ -2726,7 +2726,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps; - iwarp_info->mpa_intermediate_buf = kzalloc(mpa_buff_size, GFP_KERNEL); + iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL); if (!iwarp_info->mpa_intermediate_buf) goto err; diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h index b8f612d00241..7ac959038324 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h @@ -46,7 +46,6 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state); #define QED_IWARP_LL2_SYN_TX_SIZE (128) #define QED_IWARP_LL2_SYN_RX_SIZE (256) -#define QED_IWARP_MAX_SYN_PKT_SIZE (128) #define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256) #define QED_IWARP_MAX_OOO (16) -- 2.19.1