Skip to content

Commit 9addc92

Browse files
Michal Kalderondavem330
authored andcommitted
qed: Fix iWARP buffer size provided for syn packet processing.
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 <ariel.elior@marvell.com> Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8e29d23 commit 9addc92

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

drivers/net/ethernet/qlogic/qed/qed_iwarp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
26052605
struct qed_iwarp_info *iwarp_info;
26062606
struct qed_ll2_acquire_data data;
26072607
struct qed_ll2_cbs cbs;
2608-
u32 mpa_buff_size;
2608+
u32 buff_size;
26092609
u16 n_ooo_bufs;
26102610
int rc = 0;
26112611
int i;
@@ -2632,7 +2632,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
26322632

26332633
memset(&data, 0, sizeof(data));
26342634
data.input.conn_type = QED_LL2_TYPE_IWARP;
2635-
data.input.mtu = QED_IWARP_MAX_SYN_PKT_SIZE;
2635+
data.input.mtu = params->max_mtu;
26362636
data.input.rx_num_desc = QED_IWARP_LL2_SYN_RX_SIZE;
26372637
data.input.tx_num_desc = QED_IWARP_LL2_SYN_TX_SIZE;
26382638
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,
26542654
goto err;
26552655
}
26562656

2657+
buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu);
26572658
rc = qed_iwarp_ll2_alloc_buffers(p_hwfn,
26582659
QED_IWARP_LL2_SYN_RX_SIZE,
2659-
QED_IWARP_MAX_SYN_PKT_SIZE,
2660+
buff_size,
26602661
iwarp_info->ll2_syn_handle);
26612662
if (rc)
26622663
goto err;
@@ -2710,10 +2711,9 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
27102711
if (rc)
27112712
goto err;
27122713

2713-
mpa_buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu);
27142714
rc = qed_iwarp_ll2_alloc_buffers(p_hwfn,
27152715
data.input.rx_num_desc,
2716-
mpa_buff_size,
2716+
buff_size,
27172717
iwarp_info->ll2_mpa_handle);
27182718
if (rc)
27192719
goto err;
@@ -2726,7 +2726,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
27262726

27272727
iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps;
27282728

2729-
iwarp_info->mpa_intermediate_buf = kzalloc(mpa_buff_size, GFP_KERNEL);
2729+
iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL);
27302730
if (!iwarp_info->mpa_intermediate_buf)
27312731
goto err;
27322732

drivers/net/ethernet/qlogic/qed/qed_iwarp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);
4646

4747
#define QED_IWARP_LL2_SYN_TX_SIZE (128)
4848
#define QED_IWARP_LL2_SYN_RX_SIZE (256)
49-
#define QED_IWARP_MAX_SYN_PKT_SIZE (128)
5049

5150
#define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256)
5251
#define QED_IWARP_MAX_OOO (16)

0 commit comments

Comments
 (0)