patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 01/10] net/atlantic: fix negative error codes
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
@ 2019-03-12 15:24 ` Igor Russkikh
  2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 04/10] net/atlantic: fix buffer overflow Igor Russkikh
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:24 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

These are just convention breakage on rte_errno,
no real harm from that.

Cc: stable@dpdk.org
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Fixes: 2b1472d7150c ("net/atlantic: implement Tx path")
---
 drivers/net/atlantic/atl_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c
index 40c913795c79..aea58c0d5b83 100644
--- a/drivers/net/atlantic/atl_rxtx.c
+++ b/drivers/net/atlantic/atl_rxtx.c
@@ -812,12 +812,12 @@ atl_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 		ol_flags = m->ol_flags;
 
 		if (m->nb_segs > AQ_HW_MAX_SEGS_SIZE) {
-			rte_errno = -EINVAL;
+			rte_errno = EINVAL;
 			return i;
 		}
 
 		if (ol_flags & ATL_TX_OFFLOAD_NOTSUP_MASK) {
-			rte_errno = -ENOTSUP;
+			rte_errno = ENOTSUP;
 			return i;
 		}
 
-- 
2.17.1

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

* [dpdk-stable] [PATCH v3 04/10] net/atlantic: fix buffer overflow
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
  2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 01/10] net/atlantic: fix negative error codes Igor Russkikh
@ 2019-03-12 15:24 ` Igor Russkikh
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths Igor Russkikh
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:24 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable, Pavel Belous

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

Found by Coverity scan. This is a real memory corruption.
There is no need in extra RTE_ALIGN macros since the
request/result structures are 4-byte aligned by definition.

Cc: stable@dpdk.org
Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set")
Coverity issue: 323518
Coverity issue: 323520
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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 6841d9bce39c..f90ccfe9e010 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -501,7 +501,7 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, u32 *data, u32 len)
 	/* Write SMBUS request to cfg memory */
 	err = hw_atl_utils_fw_upload_dwords(self, self->rpc_addr,
 				(u32 *)(void *)&request,
-				RTE_ALIGN(sizeof(request), sizeof(u32)));
+				sizeof(request) / sizeof(u32));
 
 	if (err < 0)
 		return err;
@@ -523,7 +523,7 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, u32 *data, u32 len)
 
 	err = hw_atl_utils_fw_downld_dwords(self, self->rpc_addr + sizeof(u32),
 			&result,
-			RTE_ALIGN(sizeof(result), sizeof(u32)));
+			sizeof(result) / sizeof(u32));
 
 	if (err < 0)
 		return err;
@@ -558,7 +558,7 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, u32 *data, u32 len)
 	/* Write SMBUS request to cfg memory */
 	err = hw_atl_utils_fw_upload_dwords(self, self->rpc_addr,
 				(u32 *)(void *)&request,
-				RTE_ALIGN(sizeof(request), sizeof(u32)));
+				sizeof(request) / sizeof(u32));
 
 	if (err < 0)
 		return err;
@@ -589,7 +589,7 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, u32 *data, u32 len)
 	/* Read status of write operation */
 	err = hw_atl_utils_fw_downld_dwords(self, self->rpc_addr + sizeof(u32),
 				&result,
-				RTE_ALIGN(sizeof(result), sizeof(u32)));
+				sizeof(result) / sizeof(u32));
 
 	if (err < 0)
 		return err;
-- 
2.17.1

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

* [dpdk-stable] [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
  2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 01/10] net/atlantic: fix negative error codes Igor Russkikh
  2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 04/10] net/atlantic: fix buffer overflow Igor Russkikh
@ 2019-03-12 15:25 ` Igor Russkikh
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 07/10] net/atlantic: fix link configuration Igor Russkikh
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:25 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable, Pavel Belous

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

Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set")
Cc: stable@dpdk.org
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
 .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   | 28 ++++++++++++++++---
 1 file changed, 24 insertions(+), 4 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 1d9190155421..f215ceb70435 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -534,13 +534,33 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 		return err;
 
 	if (result == 0) {
-		err = hw_atl_utils_fw_downld_dwords(self,
+		u32 num_dwords = len / sizeof(u32);
+		u32 bytes_remains = len % sizeof(u32);
+
+		if (num_dwords) {
+			err = hw_atl_utils_fw_downld_dwords(self,
 				self->rpc_addr + sizeof(u32) * 2,
 				data,
-				RTE_ALIGN(len, sizeof(u32)));
+				num_dwords);
 
-		if (err < 0)
-			return err;
+			if (err < 0)
+				return err;
+		}
+
+		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));
+
+			if (err < 0)
+				return err;
+
+			rte_memcpy((u8 *)data + len - bytes_remains,
+				   &val, bytes_remains);
+		}
 	}
 
 	return 0;
-- 
2.17.1

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

* [dpdk-stable] [PATCH v3 07/10] net/atlantic: fix link configuration
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
                   ` (2 preceding siblings ...)
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths Igor Russkikh
@ 2019-03-12 15:25 ` Igor Russkikh
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload Igor Russkikh
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 10/10] net/atlantic: fix xstats to return correct number of items Igor Russkikh
  5 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:25 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

In case link speed is re configured after port start, it does not
takes the requested speed value, but instead just sets full autoneg
mask.

Cc: stable@dpdk.org
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 | 44 ++++++++++++++-----------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index a510646a5f7e..e43e1e724696 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -465,8 +465,6 @@ atl_dev_start(struct rte_eth_dev *dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	uint32_t intr_vector = 0;
-	uint32_t *link_speeds;
-	uint32_t speed = 0;
 	int status;
 	int err;
 
@@ -543,6 +541,8 @@ atl_dev_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
+	err = atl_dev_set_link_up(dev);
+
 	err = hw->aq_fw_ops->update_link_status(hw);
 
 	if (err)
@@ -550,26 +550,6 @@ atl_dev_start(struct rte_eth_dev *dev)
 
 	dev->data->dev_link.link_status = hw->aq_link_status.mbps != 0;
 
-	link_speeds = &dev->data->dev_conf.link_speeds;
-
-	speed = 0x0;
-
-	if (*link_speeds == ETH_LINK_SPEED_AUTONEG) {
-		speed = hw->aq_nic_cfg->link_speed_msk;
-	} else {
-		if (*link_speeds & ETH_LINK_SPEED_10G)
-			speed |= AQ_NIC_RATE_10G;
-		if (*link_speeds & ETH_LINK_SPEED_5G)
-			speed |= AQ_NIC_RATE_5G;
-		if (*link_speeds & ETH_LINK_SPEED_1G)
-			speed |= AQ_NIC_RATE_1G;
-		if (*link_speeds & ETH_LINK_SPEED_2_5G)
-			speed |=  AQ_NIC_RATE_2G5;
-		if (*link_speeds & ETH_LINK_SPEED_100M)
-			speed |= AQ_NIC_RATE_100M;
-	}
-
-	err = hw->aq_fw_ops->set_link_speed(hw, speed);
 	if (err)
 		goto error;
 
@@ -657,9 +637,25 @@ static int
 atl_dev_set_link_up(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t link_speeds = dev->data->dev_conf.link_speeds;
+	uint32_t speed_mask = 0;
+
+	if (link_speeds == ETH_LINK_SPEED_AUTONEG) {
+		speed_mask = hw->aq_nic_cfg->link_speed_msk;
+	} else {
+		if (link_speeds & ETH_LINK_SPEED_10G)
+			speed_mask |= AQ_NIC_RATE_10G;
+		if (link_speeds & ETH_LINK_SPEED_5G)
+			speed_mask |= AQ_NIC_RATE_5G;
+		if (link_speeds & ETH_LINK_SPEED_1G)
+			speed_mask |= AQ_NIC_RATE_1G;
+		if (link_speeds & ETH_LINK_SPEED_2_5G)
+			speed_mask |=  AQ_NIC_RATE_2G5;
+		if (link_speeds & ETH_LINK_SPEED_100M)
+			speed_mask |= AQ_NIC_RATE_100M;
+	}
 
-	return hw->aq_fw_ops->set_link_speed(hw,
-			hw->aq_nic_cfg->link_speed_msk);
+	return hw->aq_fw_ops->set_link_speed(hw, speed_mask);
 }
 
 /*
-- 
2.17.1

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

* [dpdk-stable] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
                   ` (3 preceding siblings ...)
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 07/10] net/atlantic: fix link configuration Igor Russkikh
@ 2019-03-12 15:25 ` Igor Russkikh
  2019-03-12 20:03   ` [dpdk-stable] [dpdk-dev] " Rami Rosen
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 10/10] net/atlantic: fix xstats to return correct number of items Igor Russkikh
  5 siblings, 1 reply; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:25 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

Original vlan offload code declared callbacks, but did not
enable the feature offload bit

Cc: stable@dpdk.org
Fixes: f7c2c2c8c558 ("net/atlantic: implement VLAN filters and offloads")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 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 e43e1e724696..b05dc545d0b1 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -165,7 +165,8 @@ static struct rte_pci_driver rte_atl_pmd = {
 			| DEV_RX_OFFLOAD_IPV4_CKSUM \
 			| DEV_RX_OFFLOAD_UDP_CKSUM \
 			| DEV_RX_OFFLOAD_TCP_CKSUM \
-			| DEV_RX_OFFLOAD_JUMBO_FRAME)
+			| DEV_RX_OFFLOAD_JUMBO_FRAME \
+			| DEV_RX_OFFLOAD_VLAN_FILTER)
 
 #define ATL_TX_OFFLOADS (DEV_TX_OFFLOAD_VLAN_INSERT \
 			| DEV_TX_OFFLOAD_IPV4_CKSUM \
-- 
2.17.1

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

* [dpdk-stable] [PATCH v3 10/10] net/atlantic: fix xstats to return correct number of items
       [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
                   ` (4 preceding siblings ...)
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload Igor Russkikh
@ 2019-03-12 15:25 ` Igor Russkikh
  5 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2019-03-12 15:25 UTC (permalink / raw)
  To: dev; +Cc: Pavel Belous, Igor Russkikh, stable

Max number of xstats items was returned instead of actual number
of filled in records.

Cc: stable@dpdk.org
Fixes: fbe059e87209 ("net/atlantic: implement device statistics")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index b05dc545d0b1..5c62d137b255 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -758,7 +758,7 @@ atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
 		snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, "%s",
 			atl_xstats_tbl[i].name);
 
-	return size;
+	return i;
 }
 
 static int
@@ -778,7 +778,7 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
 					atl_xstats_tbl[i].offset);
 	}
 
-	return n;
+	return i;
 }
 
 static int
-- 
2.17.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload
  2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload Igor Russkikh
@ 2019-03-12 20:03   ` Rami Rosen
  0 siblings, 0 replies; 7+ messages in thread
From: Rami Rosen @ 2019-03-12 20:03 UTC (permalink / raw)
  To: Igor Russkikh; +Cc: dev, Pavel Belous, stable

Original vlan offload code declared callbacks, but did not
> enable the feature offload bit
>
> Cc: stable@dpdk.org
> Fixes: f7c2c2c8c558 ("net/atlantic: implement VLAN filters and offloads")
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
> ---
> Reviewed-by: Rami Rosen <ramirose@gmail.com>



>
>

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

end of thread, other threads:[~2019-03-12 20:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1552402263.git.igor.russkikh@aquantia.com>
2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 01/10] net/atlantic: fix negative error codes Igor Russkikh
2019-03-12 15:24 ` [dpdk-stable] [PATCH v3 04/10] net/atlantic: fix buffer overflow Igor Russkikh
2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 06/10] net/atlantic: fix EEPROM get for small and uneven lengths Igor Russkikh
2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 07/10] net/atlantic: fix link configuration Igor Russkikh
2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 09/10] net/atlantic: fix missing VLAN filter offload Igor Russkikh
2019-03-12 20:03   ` [dpdk-stable] [dpdk-dev] " Rami Rosen
2019-03-12 15:25 ` [dpdk-stable] [PATCH v3 10/10] net/atlantic: fix xstats to return correct number of items Igor Russkikh

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).