All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH  00/11] Aquantia atlantic bugfixes
@ 2019-04-29  8:20 Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 01/11] net/atlantic: enable broadcast traffic Igor Russkikh
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

This patchset contains various bugfixes found during verification
and integration testing.

Most notable is eeprom access cleanup, fix for broadcast filter,
flow control logic tracking, some code style cleanups.

Igor Russkikh (7):
  net/atlantic: enable broadcast traffic
  net/atlantic: extra line at eof
  net/atlantic: bad indentation
  net/atlantic: fix max eeprom size
  net/atlantic: validity check for eeprom dev address
  net/atlantic: typo on args check
  net/atlantic: extra err check

Pavel Belous (4):
  net/atlantic: eeprom get/set should consider offset
  net/atlantic: bad logic with offsets talking with firmware
  net/atlantic: flow control settings synchronization on rx
  net/atlantic: use capability bits to detect eeprom access

 drivers/net/atlantic/atl_ethdev.c             |  43 +++++--
 drivers/net/atlantic/atl_rxtx.c               |   1 -
 drivers/net/atlantic/atl_types.h              |   3 +-
 drivers/net/atlantic/hw_atl/hw_atl_b0.c       |   8 ++
 drivers/net/atlantic/hw_atl/hw_atl_b0.h       |   2 +
 drivers/net/atlantic/hw_atl/hw_atl_utils.c    |  17 +--
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  11 +-
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   | 111 ++++++++++++------
 8 files changed, 128 insertions(+), 68 deletions(-)

-- 
2.17.1


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

* [dpdk-dev] [PATCH  01/11] net/atlantic: enable broadcast traffic
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof Igor Russkikh
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

Broadcast was not correctly and fully initialized

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Fixes: 7906661edac6 ("net/atlantic: add b0 hardware layer")
cc: stable@dpdk.org
---
 drivers/net/atlantic/hw_atl/hw_atl_b0.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/atlantic/hw_atl/hw_atl_b0.c
index 53fd8e9f0237..e525a8581e6f 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_b0.c
@@ -286,6 +286,8 @@ int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self)
 	hw_atl_rpfl2broadcast_flr_act_set(self, 1U);
 	hw_atl_rpfl2broadcast_count_threshold_set(self, 0xFFFFU & (~0U / 256U));
 
+	hw_atl_rpfl2broadcast_en_set(self, 1U);
+
 	hw_atl_rdm_rx_dca_en_set(self, 0U);
 	hw_atl_rdm_rx_dca_mode_set(self, 0U);
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH  02/11] net/atlantic: extra line at eof
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 01/11] net/atlantic: enable broadcast traffic Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29 13:57   ` Ferruh Yigit
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 03/11] net/atlantic: bad indentation Igor Russkikh
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

Remove extra empty line at EOF

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/atl_rxtx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c
index f1519594adad..fe0077044097 100644
--- a/drivers/net/atlantic/atl_rxtx.c
+++ b/drivers/net/atlantic/atl_rxtx.c
@@ -1348,4 +1348,3 @@ atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 	return nb_tx;
 }
-
-- 
2.17.1


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

* [dpdk-dev] [PATCH  03/11] net/atlantic: bad indentation
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 01/11] net/atlantic: enable broadcast traffic Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 04/11] net/atlantic: eeprom get/set should consider offset Igor Russkikh
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

Make indentation correct. No functional impact.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c
index 4299b7016e2f..1910bd4c94a2 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c
@@ -305,10 +305,10 @@ int hw_atl_utils_fw_downld_dwords(struct aq_hw_s *self, u32 a,
 			AQ_HW_WAIT_FOR(!(0x100 & aq_hw_read_reg(self,
 							   HW_ATL_MIF_CMD)),
 				       1, 1000U);
-			if (err) {
-				err = -ETIMEDOUT;
-				goto err_exit;
-			}
+		if (err) {
+			err = -ETIMEDOUT;
+			goto err_exit;
+		}
 
 		*(p++) = aq_hw_read_reg(self, HW_ATL_MIF_VAL);
 		a += 4;
-- 
2.17.1


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

* [dpdk-dev] [PATCH 04/11] net/atlantic: eeprom get/set should consider offset
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (2 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 03/11] net/atlantic: bad indentation Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 05/11] net/atlantic: fix max eeprom size Igor Russkikh
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

From: Pavel Belous <pavel.belous@aquantia.com>

EEPROM get/set offset logic should take offset into account.
Data transfers to/from FW should also correctly use
dword based transfer interface, taking into account the
remainder.
We also check error code returned from FW.

cc: stable@dpdk.org
Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c             |  7 +-
 drivers/net/atlantic/atl_types.h              |  2 +-
 drivers/net/atlantic/hw_atl/hw_atl_utils.h    | 11 +--
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   | 95 ++++++++++++-------
 4 files changed, 68 insertions(+), 47 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 4e6124aa318e..7be97ab3095e 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1448,14 +1448,15 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev,
 	if (hw->aq_fw_ops->set_eeprom == NULL)
 		return -ENOTSUP;
 
-	if (eeprom->length != SFP_EEPROM_SIZE || eeprom->data == NULL)
+	if (eeprom->length + eeprom->offset > SFP_EEPROM_SIZE ||
+	    eeprom->data == NULL)
 		return -EINVAL;
 
 	if (eeprom->magic)
 		dev_addr = eeprom->magic;
 
-	return hw->aq_fw_ops->set_eeprom(hw, dev_addr,
-					 eeprom->data, eeprom->length);
+	return hw->aq_fw_ops->set_eeprom(hw, dev_addr, eeprom->data,
+					 eeprom->length, eeprom->offset);
 }
 
 static int
diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h
index dbaf2c635f50..84a4776951db 100644
--- a/drivers/net/atlantic/atl_types.h
+++ b/drivers/net/atlantic/atl_types.h
@@ -177,7 +177,7 @@ struct aq_fw_ops {
 			  u32 *data, u32 len, u32 offset);
 
 	int (*set_eeprom)(struct aq_hw_s *self, int dev_addr,
-			  u32 *data, u32 len);
+			  u32 *data, u32 len, u32 offset);
 
 	int (*send_macsec_req)(struct aq_hw_s *self,
 			       struct macsec_msg_fw_request *req,
diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.h b/drivers/net/atlantic/hw_atl/hw_atl_utils.h
index b7c531573623..81caffaedfd0 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils.h
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.h
@@ -337,15 +337,8 @@ struct offload_info {
 	u8 buf[0];
 } __attribute__((__packed__));
 
-struct smbus_read_request {
-	u32 offset; /* not used */
-	u32 device_id;
-	u32 address;
-	u32 length;
-} __attribute__((__packed__));
-
-struct smbus_write_request {
-	u32 offset; /* not used */
+struct smbus_request {
+	u32 msg_id; /* not used */
 	u32 device_id;
 	u32 address;
 	u32 length;
diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
index 89a3759b89b4..de4189441fad 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -498,14 +498,17 @@ static int aq_fw2x_led_control(struct aq_hw_s *self, u32 mode)
 static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 			      u32 *data, u32 len, u32 offset)
 {
-	int err = 0;
-	struct smbus_read_request request;
-	u32 mpi_opts;
+	u32 bytes_remains = len % sizeof(u32);
+	u32 num_dwords = len / sizeof(u32);
+	struct smbus_request request;
 	u32 result = 0;
+	u32 mpi_opts;
+	int err = 0;
 
 	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
 		return -EOPNOTSUPP;
 
+	request.msg_id = 0;
 	request.device_id = dev_addr;
 	request.address = offset;
 	request.length = len;
@@ -540,34 +543,33 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 	if (err < 0)
 		return err;
 
-	if (result == 0) {
-		u32 num_dwords = len / sizeof(u32);
-		u32 bytes_remains = len % sizeof(u32);
+	if (result)
+		return -EIO;
 
-		if (num_dwords) {
-			err = hw_atl_utils_fw_downld_dwords(self,
-				self->rpc_addr + sizeof(u32) * 2,
-				data,
-				num_dwords);
+	if (num_dwords) {
+		err = hw_atl_utils_fw_downld_dwords(self,
+			self->rpc_addr + sizeof(u32) * 2,
+			data,
+			num_dwords);
 
-			if (err < 0)
-				return err;
-		}
+		if (err < 0)
+			return err;
+	}
 
-		if (bytes_remains) {
-			u32 val = 0;
+	if (bytes_remains) {
+		u32 val = 0;
 
-			err = hw_atl_utils_fw_downld_dwords(self,
-				self->rpc_addr + sizeof(u32) * 2 + num_dwords,
-				&val,
-				sizeof(u32));
+		err = hw_atl_utils_fw_downld_dwords(self,
+			self->rpc_addr + (sizeof(u32) * 2) +
+			(num_dwords * sizeof(u32)),
+			&val,
+			1);
 
-			if (err < 0)
-				return err;
+		if (err < 0)
+			return err;
 
-			rte_memcpy((u8 *)data + len - bytes_remains,
-				   &val, bytes_remains);
-		}
+		rte_memcpy((u8 *)data + len - bytes_remains,
+				&val, bytes_remains);
 	}
 
 	return 0;
@@ -575,17 +577,18 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 
 
 static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,
-			      u32 *data, u32 len)
+			      u32 *data, u32 len, u32 offset)
 {
-	struct smbus_write_request request;
+	struct smbus_request request;
 	u32 mpi_opts, result = 0;
 	int err = 0;
 
 	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
 		return -EOPNOTSUPP;
 
+	request.msg_id = 0;
 	request.device_id = dev_addr;
-	request.address = 0;
+	request.address = offset;
 	request.length = len;
 
 	/* Write SMBUS request to cfg memory */
@@ -597,13 +600,34 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,
 		return err;
 
 	/* Write SMBUS data to cfg memory */
-	err = hw_atl_utils_fw_upload_dwords(self,
-				self->rpc_addr + sizeof(request),
-				(u32 *)(void *)data,
-				RTE_ALIGN(len, sizeof(u32)));
+	u32 num_dwords = len / sizeof(u32);
+	u32 bytes_remains = len % sizeof(u32);
 
-	if (err < 0)
-		return err;
+	if (num_dwords) {
+		err = hw_atl_utils_fw_upload_dwords(self,
+			self->rpc_addr + sizeof(request),
+			(u32 *)(void *)data,
+			num_dwords);
+
+		if (err < 0)
+			return err;
+	}
+
+	if (bytes_remains) {
+		u32 val = 0;
+
+		rte_memcpy(&val, (u8 *)data + (sizeof(u32) * num_dwords),
+			   bytes_remains);
+
+		err = hw_atl_utils_fw_upload_dwords(self,
+			self->rpc_addr + sizeof(request) +
+			(num_dwords * sizeof(u32)),
+			&val,
+			1);
+
+		if (err < 0)
+			return err;
+	}
 
 	/* Toggle 0x368.CAPS_LO_SMBUS_WRITE bit */
 	mpi_opts = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_CONTROL_ADDR);
@@ -627,6 +651,9 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,
 	if (err < 0)
 		return err;
 
+	if (result)
+		return -EIO;
+
 	return 0;
 }
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH  05/11] net/atlantic: fix max eeprom size
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (3 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 04/11] net/atlantic: eeprom get/set should consider offset Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 06/11] net/atlantic: validity check for eeprom dev address Igor Russkikh
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

Maximum size should be 256 bytes.
Move declaration to the top of the file

Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
cc: stable@dpdk.org
---
 drivers/net/atlantic/atl_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 7be97ab3095e..8a177ea5b4a3 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -179,6 +179,8 @@ static struct rte_pci_driver rte_atl_pmd = {
 			| DEV_TX_OFFLOAD_MACSEC_INSERT \
 			| DEV_TX_OFFLOAD_MULTI_SEGS)
 
+#define SFP_EEPROM_SIZE 0x100
+
 static const struct rte_eth_desc_lim rx_desc_lim = {
 	.nb_max = ATL_MAX_RING_DESC,
 	.nb_min = ATL_MIN_RING_DESC,
@@ -1411,7 +1413,6 @@ atl_dev_interrupt_handler(void *param)
 	atl_dev_interrupt_action(dev, dev->intr_handle);
 }
 
-#define SFP_EEPROM_SIZE 0xff
 
 static int
 atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused)
-- 
2.17.1


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

* [dpdk-dev] [PATCH 06/11] net/atlantic: validity check for eeprom dev address
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (4 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 05/11] net/atlantic: fix max eeprom size Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 07/11] net/atlantic: bad logic with offsets talking with firmware Igor Russkikh
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

Clients may not fillin magic field, thus causing garbage
to be passed as a device addr.

Limit that to maximum SMbus address.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 8a177ea5b4a3..485ef159eb05 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1433,6 +1433,9 @@ int atl_dev_get_eeprom(struct rte_eth_dev *dev,
 	    eeprom->data == NULL)
 		return -EINVAL;
 
+	if (eeprom->magic > 0x7F)
+		return -EINVAL;
+
 	if (eeprom->magic)
 		dev_addr = eeprom->magic;
 
@@ -1453,6 +1456,9 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev,
 	    eeprom->data == NULL)
 		return -EINVAL;
 
+	if (eeprom->magic > 0x7F)
+		return -EINVAL;
+
 	if (eeprom->magic)
 		dev_addr = eeprom->magic;
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH 07/11] net/atlantic: bad logic with offsets talking with firmware
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (5 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 06/11] net/atlantic: validity check for eeprom dev address Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 08/11] net/atlantic: flow control settings synchronization on rx Igor Russkikh
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

From: Pavel Belous <pavel.belous@aquantia.com>

eeprom write accesses start using non zero configuration memory
accesses. This revealed an issue where firmware interface was actually
always did the uploads starting with zero offset

Fixes: 86d36773bd42 ("net/atlantic: implement firmware operations")
cc: stable@dpdk.org
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
---
 drivers/net/atlantic/hw_atl/hw_atl_utils.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c
index 1910bd4c94a2..b399ae392dbd 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c
@@ -332,12 +332,13 @@ int hw_atl_utils_fw_upload_dwords(struct aq_hw_s *self, u32 a, u32 *p,
 		goto err_exit;
 	}
 	if (IS_CHIP_FEATURE(REVISION_B1)) {
-		u32 offset = 0;
+		u32 mbox_offset = (a - self->rpc_addr) / sizeof(u32);
+		u32 data_offset = 0;
 
-		for (; offset < cnt; ++offset) {
-			aq_hw_write_reg(self, 0x328, p[offset]);
+		for (; data_offset < cnt; ++mbox_offset, ++data_offset) {
+			aq_hw_write_reg(self, 0x328, p[data_offset]);
 			aq_hw_write_reg(self, 0x32C,
-				(0x80000000 | (0xFFFF & (offset * 4))));
+				(0x80000000 | (0xFFFF & (mbox_offset * 4))));
 			hw_atl_mcp_up_force_intr_set(self, 1);
 			/* 1000 times by 10us = 10ms */
 			AQ_HW_WAIT_FOR((aq_hw_read_reg(self,
-- 
2.17.1


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

* [dpdk-dev] [PATCH 08/11] net/atlantic: flow control settings synchronization on rx
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (6 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 07/11] net/atlantic: bad logic with offsets talking with firmware Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 09/11] net/atlantic: use capability bits to detect eeprom access Igor Russkikh
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

From: Pavel Belous <pavel.belous@aquantia.com>

Driver should track negotiated PHY flow control settings during
link state changes and update MAC level flow control configuration.

Otherwise there could be unexpected pause frames generation which
could lockup the datapath.

Fixes: 4c1c8f76463f ("net/atlantic: add flow control configuration")
cc: stable@dpdk.org
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c             | 24 +++++++++++++++----
 drivers/net/atlantic/atl_types.h              |  1 +
 drivers/net/atlantic/hw_atl/hw_atl_b0.c       |  6 +++++
 drivers/net/atlantic/hw_atl/hw_atl_b0.h       |  2 ++
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |  9 +++++++
 5 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 485ef159eb05..6cc8d198041e 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1160,6 +1160,7 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_eth_link link, old;
+	u32 fc = AQ_NIC_FC_OFF;
 	int err = 0;
 
 	link.link_status = ETH_LINK_DOWN;
@@ -1194,6 +1195,15 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 	if (link.link_status == old.link_status)
 		return -1;
 
+	/* Driver has to update flow control settings on RX block
+	 * on any link event.
+	 * We should query FW whether it negotiated FC.
+	 */
+	if (hw->aq_fw_ops->get_flow_control) {
+		hw->aq_fw_ops->get_flow_control(hw, &fc);
+		hw_atl_b0_set_fc(hw, fc, 0U);
+	}
+
 	if (rte_eal_alarm_set(1000 * 1000,
 			      atl_dev_delayed_handler, (void *)dev) < 0)
 		PMD_DRV_LOG(ERR, "rte_eal_alarm_set fail");
@@ -1496,14 +1506,20 @@ static int
 atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 fc = AQ_NIC_FC_OFF;
+
+	if (hw->aq_fw_ops->get_flow_control == NULL)
+		return -ENOTSUP;
+
+	hw->aq_fw_ops->get_flow_control(hw, &fc);
 
-	if (hw->aq_nic_cfg->flow_control == AQ_NIC_FC_OFF)
+	if (fc == AQ_NIC_FC_OFF)
 		fc_conf->mode = RTE_FC_NONE;
-	else if (hw->aq_nic_cfg->flow_control & (AQ_NIC_FC_RX | AQ_NIC_FC_TX))
+	else if (fc & (AQ_NIC_FC_RX | AQ_NIC_FC_TX))
 		fc_conf->mode = RTE_FC_FULL;
-	else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+	else if (fc & AQ_NIC_FC_RX)
 		fc_conf->mode = RTE_FC_RX_PAUSE;
-	else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+	else if (fc & AQ_NIC_FC_RX)
 		fc_conf->mode = RTE_FC_TX_PAUSE;
 
 	return 0;
diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h
index 84a4776951db..19aaf37673cd 100644
--- a/drivers/net/atlantic/atl_types.h
+++ b/drivers/net/atlantic/atl_types.h
@@ -169,6 +169,7 @@ struct aq_fw_ops {
 	int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
 			u32 *supported_rates);
 
+	int (*get_flow_control)(struct aq_hw_s *self, u32 *fc);
 	int (*set_flow_control)(struct aq_hw_s *self);
 
 	int (*led_control)(struct aq_hw_s *self, u32 mode);
diff --git a/drivers/net/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/atlantic/hw_atl/hw_atl_b0.c
index e525a8581e6f..a76268e923e6 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_b0.c
@@ -26,6 +26,12 @@ int hw_atl_b0_hw_reset(struct aq_hw_s *self)
 	return err;
 }
 
+int hw_atl_b0_set_fc(struct aq_hw_s *self, u32 fc, u32 tc)
+{
+	hw_atl_rpb_rx_xoff_en_per_tc_set(self, !!(fc & AQ_NIC_FC_RX), tc);
+	return 0;
+}
+
 static int hw_atl_b0_hw_qos_set(struct aq_hw_s *self)
 {
 	u32 tc = 0U;
diff --git a/drivers/net/atlantic/hw_atl/hw_atl_b0.h b/drivers/net/atlantic/hw_atl/hw_atl_b0.h
index 06feb56c1620..d1ba2aceb390 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_b0.h
+++ b/drivers/net/atlantic/hw_atl/hw_atl_b0.h
@@ -11,6 +11,8 @@
 int hw_atl_b0_hw_reset(struct aq_hw_s *self);
 int hw_atl_b0_hw_init(struct aq_hw_s *self, u8 *mac_addr);
 
+int hw_atl_b0_set_fc(struct aq_hw_s *self, u32 fc, u32 tc);
+
 int hw_atl_b0_hw_ring_tx_init(struct aq_hw_s *self, uint64_t base_addr,
 		int index, int size, int cpu, int vec);
 int hw_atl_b0_hw_ring_rx_init(struct aq_hw_s *self, uint64_t base_addr,
diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
index de4189441fad..e07ed5e3a8c9 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -473,7 +473,15 @@ static int aq_fw2x_get_eee_rate(struct aq_hw_s *self, u32 *rate,
 	return err;
 }
 
+static int aq_fw2x_get_flow_control(struct aq_hw_s *self, u32 *fc)
+{
+	u32 mpi_state = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR);
+
+	*fc = ((mpi_state & BIT(CAPS_HI_PAUSE)) ? AQ_NIC_FC_RX : 0) |
+	      ((mpi_state & BIT(CAPS_HI_ASYMMETRIC_PAUSE)) ? AQ_NIC_FC_TX : 0);
 
+	return 0;
+}
 
 static int aq_fw2x_set_flow_control(struct aq_hw_s *self)
 {
@@ -714,6 +722,7 @@ const struct aq_fw_ops aq_fw_2x_ops = {
 	.get_cable_len = aq_fw2x_get_cable_len,
 	.set_eee_rate = aq_fw2x_set_eee_rate,
 	.get_eee_rate = aq_fw2x_get_eee_rate,
+	.get_flow_control = aq_fw2x_get_flow_control,
 	.set_flow_control = aq_fw2x_set_flow_control,
 	.led_control = aq_fw2x_led_control,
 	.get_eeprom = aq_fw2x_get_eeprom,
-- 
2.17.1


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

* [dpdk-dev] [PATCH 09/11] net/atlantic: use capability bits to detect eeprom access
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (7 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 08/11] net/atlantic: flow control settings synchronization on rx Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 10/11] net/atlantic: typo on args check Igor Russkikh
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

From: Pavel Belous <pavel.belous@aquantia.com>

Its better to use capability bits FW provides to detect whether
firmware has APIs for EEPROM access.

Before that explicit FW version comparison was used and that may
cause conflicts.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
---
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
index e07ed5e3a8c9..0d24aa99bda0 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -34,7 +34,6 @@
 #define HAL_ATLANTIC_WOL_FILTERS_COUNT     8
 #define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL    0x0E
 
-#define HW_ATL_FW_FEATURE_EEPROM 0x03010025
 #define HW_ATL_FW_FEATURE_LED 0x03010026
 
 struct fw2x_msg_wol_pattern {
@@ -513,7 +512,7 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 	u32 mpi_opts;
 	int err = 0;
 
-	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
+	if ((self->caps_lo & BIT(CAPS_LO_SMBUS_READ)) == 0)
 		return -EOPNOTSUPP;
 
 	request.msg_id = 0;
@@ -591,7 +590,7 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,
 	u32 mpi_opts, result = 0;
 	int err = 0;
 
-	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
+	if ((self->caps_lo & BIT(CAPS_LO_SMBUS_WRITE)) == 0)
 		return -EOPNOTSUPP;
 
 	request.msg_id = 0;
-- 
2.17.1


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

* [dpdk-dev] [PATCH  10/11] net/atlantic: typo on args check
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (8 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 09/11] net/atlantic: use capability bits to detect eeprom access Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 11/11] net/atlantic: extra err check Igor Russkikh
  2019-05-08 16:05 ` [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Kevin Traynor
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

Found by coverity scan, two pointer args should be not zero checked

Coverity issue: 337929
Fixes: 2f40244b39ba ("net/atlantic: implement MACsec firmware interface")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
index 0d24aa99bda0..5927d90f1813 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -671,7 +671,7 @@ static int aq_fw2x_send_macsec_request(struct aq_hw_s *self,
 	int err = 0;
 	u32 mpi_opts = 0;
 
-	if (!response || !response)
+	if (!req || !response)
 		return 0;
 
 	if ((self->caps_lo & BIT(CAPS_LO_MACSEC)) == 0)
-- 
2.17.1


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

* [dpdk-dev] [PATCH  11/11] net/atlantic: extra err check
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (9 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 10/11] net/atlantic: typo on args check Igor Russkikh
@ 2019-04-29  8:20 ` Igor Russkikh
  2019-05-08 16:05 ` [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Kevin Traynor
  11 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-04-29  8:20 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh

Found by coverity scan - dead code

Coverity issue: 337665
Fixes: 7943ba05f67c ("net/atlantic: add link status and interrupt management")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 6cc8d198041e..7611aebb5718 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -602,9 +602,6 @@ atl_dev_start(struct rte_eth_dev *dev)
 
 	dev->data->dev_link.link_status = hw->aq_link_status.mbps != 0;
 
-	if (err)
-		goto error;
-
 	if (rte_intr_allow_others(intr_handle)) {
 		/* check if lsc interrupt is enabled */
 		if (dev->data->dev_conf.intr_conf.lsc != 0)
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof Igor Russkikh
@ 2019-04-29 13:57   ` Ferruh Yigit
  0 siblings, 0 replies; 15+ messages in thread
From: Ferruh Yigit @ 2019-04-29 13:57 UTC (permalink / raw)
  To: Igor Russkikh, dev; +Cc: Pavel Belous, Stephen Hemminger

On 4/29/2019 9:20 AM, Igor Russkikh wrote:
> Remove extra empty line at EOF
> 
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
> ---
>  drivers/net/atlantic/atl_rxtx.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c
> index f1519594adad..fe0077044097 100644
> --- a/drivers/net/atlantic/atl_rxtx.c
> +++ b/drivers/net/atlantic/atl_rxtx.c
> @@ -1348,4 +1348,3 @@ atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
>  
>  	return nb_tx;
>  }
> -
> 

This has been already fixed in v19.05-rc2 by:

Fixes: 2aa0db405fb6 ("drivers: remove blank line at EOF")
Cc: stephen@networkplumber.org

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

* Re: [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes
  2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
                   ` (10 preceding siblings ...)
  2019-04-29  8:20 ` [dpdk-dev] [PATCH 11/11] net/atlantic: extra err check Igor Russkikh
@ 2019-05-08 16:05 ` Kevin Traynor
  2019-05-13  7:59   ` Igor Russkikh
  11 siblings, 1 reply; 15+ messages in thread
From: Kevin Traynor @ 2019-05-08 16:05 UTC (permalink / raw)
  To: Igor Russkikh, dev, Pavel Belous, stable

On 29/04/2019 09:20, Igor Russkikh wrote:
> This patchset contains various bugfixes found during verification
> and integration testing.
> 
> Most notable is eeprom access cleanup, fix for broadcast filter,
> flow control logic tracking, some code style cleanups.
> 
> Igor Russkikh (7):
>   net/atlantic: enable broadcast traffic
>   net/atlantic: extra line at eof
>   net/atlantic: bad indentation
>   net/atlantic: fix max eeprom size
>   net/atlantic: validity check for eeprom dev address
>   net/atlantic: typo on args check
>   net/atlantic: extra err check
> 
> Pavel Belous (4):
>   net/atlantic: eeprom get/set should consider offset
>   net/atlantic: bad logic with offsets talking with firmware
>   net/atlantic: flow control settings synchronization on rx
>   net/atlantic: use capability bits to detect eeprom access
> 
>  drivers/net/atlantic/atl_ethdev.c             |  43 +++++--
>  drivers/net/atlantic/atl_rxtx.c               |   1 -
>  drivers/net/atlantic/atl_types.h              |   3 +-
>  drivers/net/atlantic/hw_atl/hw_atl_b0.c       |   8 ++
>  drivers/net/atlantic/hw_atl/hw_atl_b0.h       |   2 +
>  drivers/net/atlantic/hw_atl/hw_atl_utils.c    |  17 +--
>  drivers/net/atlantic/hw_atl/hw_atl_utils.h    |  11 +-
>  .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   | 111 ++++++++++++------
>  8 files changed, 128 insertions(+), 68 deletions(-)
> 

Hi - some of these that are fixes will apply on 18.11 stable branch with
a little of rebasing, some will not. It will be cleaner to take the
fixes as a series. Can you send backports for the series for the 18.11
branch, or let me know if they are not needed.

thanks,
Kevin.

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

* Re: [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes
  2019-05-08 16:05 ` [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Kevin Traynor
@ 2019-05-13  7:59   ` Igor Russkikh
  0 siblings, 0 replies; 15+ messages in thread
From: Igor Russkikh @ 2019-05-13  7:59 UTC (permalink / raw)
  To: Kevin Traynor, dev, Pavel Belous, stable


> 
> Hi - some of these that are fixes will apply on 18.11 stable branch with
> a little of rebasing, some will not. It will be cleaner to take the
> fixes as a series. Can you send backports for the series for the 18.11
> branch, or let me know if they are not needed.

Hi Kevin, I'll backport these to 18.11 and resubmit it soon.

Thanks,
  Igor

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

end of thread, other threads:[~2019-05-13  8:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29  8:20 [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 01/11] net/atlantic: enable broadcast traffic Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof Igor Russkikh
2019-04-29 13:57   ` Ferruh Yigit
2019-04-29  8:20 ` [dpdk-dev] [PATCH 03/11] net/atlantic: bad indentation Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 04/11] net/atlantic: eeprom get/set should consider offset Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 05/11] net/atlantic: fix max eeprom size Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 06/11] net/atlantic: validity check for eeprom dev address Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 07/11] net/atlantic: bad logic with offsets talking with firmware Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 08/11] net/atlantic: flow control settings synchronization on rx Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 09/11] net/atlantic: use capability bits to detect eeprom access Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 10/11] net/atlantic: typo on args check Igor Russkikh
2019-04-29  8:20 ` [dpdk-dev] [PATCH 11/11] net/atlantic: extra err check Igor Russkikh
2019-05-08 16:05 ` [dpdk-dev] [PATCH 00/11] Aquantia atlantic bugfixes Kevin Traynor
2019-05-13  7:59   ` Igor Russkikh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.