]>
Commit | Line | Data |
---|---|---|
36e3f504 SL |
1 | From 87a6cd94ecf74fbce916ce061661724e4a4f352d Mon Sep 17 00:00:00 2001 |
2 | From: Michal Kalderon <michal.kalderon@marvell.com> | |
3 | Date: Mon, 18 Feb 2019 15:24:02 +0200 | |
4 | Subject: qed: Fix iWARP buffer size provided for syn packet processing. | |
5 | ||
6 | [ Upstream commit 9addc92730df55e2c05e8d3f69267a89d65bcba8 ] | |
7 | ||
8 | The assumption that the maximum size of a syn packet is 128 bytes | |
9 | is wrong. Tunneling headers were not accounted for. | |
10 | Allocate buffers large enough for mtu. | |
11 | ||
12 | Signed-off-by: Ariel Elior <ariel.elior@marvell.com> | |
13 | Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com> | |
14 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
15 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
16 | --- | |
17 | drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 12 ++++++------ | |
18 | drivers/net/ethernet/qlogic/qed/qed_iwarp.h | 1 - | |
19 | 2 files changed, 6 insertions(+), 7 deletions(-) | |
20 | ||
21 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c | |
22 | index e860bdf0f752..3c932f79a02e 100644 | |
23 | --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c | |
24 | +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c | |
25 | @@ -2606,7 +2606,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, | |
26 | struct qed_iwarp_info *iwarp_info; | |
27 | struct qed_ll2_acquire_data data; | |
28 | struct qed_ll2_cbs cbs; | |
29 | - u32 mpa_buff_size; | |
30 | + u32 buff_size; | |
31 | u16 n_ooo_bufs; | |
32 | int rc = 0; | |
33 | int i; | |
34 | @@ -2633,7 +2633,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, | |
35 | ||
36 | memset(&data, 0, sizeof(data)); | |
37 | data.input.conn_type = QED_LL2_TYPE_IWARP; | |
38 | - data.input.mtu = QED_IWARP_MAX_SYN_PKT_SIZE; | |
39 | + data.input.mtu = params->max_mtu; | |
40 | data.input.rx_num_desc = QED_IWARP_LL2_SYN_RX_SIZE; | |
41 | data.input.tx_num_desc = QED_IWARP_LL2_SYN_TX_SIZE; | |
42 | data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */ | |
43 | @@ -2655,9 +2655,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, | |
44 | goto err; | |
45 | } | |
46 | ||
47 | + buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu); | |
48 | rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, | |
49 | QED_IWARP_LL2_SYN_RX_SIZE, | |
50 | - QED_IWARP_MAX_SYN_PKT_SIZE, | |
51 | + buff_size, | |
52 | iwarp_info->ll2_syn_handle); | |
53 | if (rc) | |
54 | goto err; | |
55 | @@ -2711,10 +2712,9 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, | |
56 | if (rc) | |
57 | goto err; | |
58 | ||
59 | - mpa_buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu); | |
60 | rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, | |
61 | data.input.rx_num_desc, | |
62 | - mpa_buff_size, | |
63 | + buff_size, | |
64 | iwarp_info->ll2_mpa_handle); | |
65 | if (rc) | |
66 | goto err; | |
67 | @@ -2727,7 +2727,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, | |
68 | ||
69 | iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps; | |
70 | ||
71 | - iwarp_info->mpa_intermediate_buf = kzalloc(mpa_buff_size, GFP_KERNEL); | |
72 | + iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL); | |
73 | if (!iwarp_info->mpa_intermediate_buf) | |
74 | goto err; | |
75 | ||
76 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h | |
77 | index b8f612d00241..7ac959038324 100644 | |
78 | --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h | |
79 | +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h | |
80 | @@ -46,7 +46,6 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state); | |
81 | ||
82 | #define QED_IWARP_LL2_SYN_TX_SIZE (128) | |
83 | #define QED_IWARP_LL2_SYN_RX_SIZE (256) | |
84 | -#define QED_IWARP_MAX_SYN_PKT_SIZE (128) | |
85 | ||
86 | #define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256) | |
87 | #define QED_IWARP_MAX_OOO (16) | |
88 | -- | |
89 | 2.19.1 | |
90 |