netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] qed: iWARP - fix some syn related issues.
@ 2019-02-18 13:24 Michal Kalderon
  2019-02-18 13:24 ` [PATCH net 1/2] qed: Fix iWARP buffer size provided for syn packet processing Michal Kalderon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Kalderon @ 2019-02-18 13:24 UTC (permalink / raw)
  To: michal.kalderon, ariel.elior, davem; +Cc: netdev, linux-rdma

This series fixes two bugs related to iWARP syn processing flow. 

Michal Kalderon (2):
  qed: Fix iWARP buffer size provided for syn packet processing.
  qed: Fix iWARP syn packet mac address validation.

 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 21 +++++++++++++++------
 drivers/net/ethernet/qlogic/qed/qed_iwarp.h |  1 -
 2 files changed, 15 insertions(+), 7 deletions(-)

-- 
2.9.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] qed: Fix iWARP buffer size provided for syn packet processing.
  2019-02-18 13:24 [PATCH net 0/2] qed: iWARP - fix some syn related issues Michal Kalderon
@ 2019-02-18 13:24 ` Michal Kalderon
  2019-02-18 13:24 ` [PATCH net 2/2] qed: Fix iWARP syn packet mac address validation Michal Kalderon
  2019-02-19  0:52 ` [PATCH net 0/2] qed: iWARP - fix some syn related issues David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Kalderon @ 2019-02-18 13:24 UTC (permalink / raw)
  To: michal.kalderon, ariel.elior, davem; +Cc: netdev, linux-rdma

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>
---
 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 beb8e5d..e84fb01 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 b8f612d..7ac95903 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.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] qed: Fix iWARP syn packet mac address validation.
  2019-02-18 13:24 [PATCH net 0/2] qed: iWARP - fix some syn related issues Michal Kalderon
  2019-02-18 13:24 ` [PATCH net 1/2] qed: Fix iWARP buffer size provided for syn packet processing Michal Kalderon
@ 2019-02-18 13:24 ` Michal Kalderon
  2019-02-19  0:52 ` [PATCH net 0/2] qed: iWARP - fix some syn related issues David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Kalderon @ 2019-02-18 13:24 UTC (permalink / raw)
  To: michal.kalderon, ariel.elior, davem; +Cc: netdev, linux-rdma

The ll2 forwards all syn packets to the driver without validating the mac
address. Add validation check in the driver's iWARP listener flow and drop
the packet if it isn't intended for the device.

Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
index e84fb01..ded556b 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
@@ -1688,6 +1688,15 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
 
 	eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0);
 
+	if (!ether_addr_equal(ethh->h_dest,
+			      p_hwfn->p_rdma_info->iwarp.mac_addr)) {
+		DP_VERBOSE(p_hwfn,
+			   QED_MSG_RDMA,
+			   "Got unexpected mac %pM instead of %pM\n",
+			   ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr);
+		return -EINVAL;
+	}
+
 	ether_addr_copy(remote_mac_addr, ethh->h_source);
 	ether_addr_copy(local_mac_addr, ethh->h_dest);
 
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] qed: iWARP - fix some syn related issues.
  2019-02-18 13:24 [PATCH net 0/2] qed: iWARP - fix some syn related issues Michal Kalderon
  2019-02-18 13:24 ` [PATCH net 1/2] qed: Fix iWARP buffer size provided for syn packet processing Michal Kalderon
  2019-02-18 13:24 ` [PATCH net 2/2] qed: Fix iWARP syn packet mac address validation Michal Kalderon
@ 2019-02-19  0:52 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-19  0:52 UTC (permalink / raw)
  To: michal.kalderon; +Cc: ariel.elior, netdev, linux-rdma

From: Michal Kalderon <michal.kalderon@marvell.com>
Date: Mon, 18 Feb 2019 15:24:01 +0200

> This series fixes two bugs related to iWARP syn processing flow. 

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-19  0:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 13:24 [PATCH net 0/2] qed: iWARP - fix some syn related issues Michal Kalderon
2019-02-18 13:24 ` [PATCH net 1/2] qed: Fix iWARP buffer size provided for syn packet processing Michal Kalderon
2019-02-18 13:24 ` [PATCH net 2/2] qed: Fix iWARP syn packet mac address validation Michal Kalderon
2019-02-19  0:52 ` [PATCH net 0/2] qed: iWARP - fix some syn related issues David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).