patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 03/17] net/nfp: fix link status display problem
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 04/17] net/nfp: fix coredump caused by firmware abnormal cleanup Chaoyong He
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Zerun Fu, stable, Chaoyong He, Long Wu, Peng Zhang

From: Zerun Fu <zerun.fu@corigine.com>

In the previous logic, the link status will shown as down wrongly
whenever the call to 'nfp_eth_read_ports()' fail.

Fix this by removing the exit logic when call to 'nfp_eth_read_ports()'
fail and just giving a warning.

Fixes: 8412feed3f26 ("net/nfp: modify link update function")
Cc: stable@dpdk.org

Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index fed8daa188..a6573ed45c 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -730,7 +730,7 @@ nfp_net_allmulticast_disable(struct rte_eth_dev *dev)
 	return nfp_net_set_allmulticast_mode(dev, false);
 }
 
-static int
+static void
 nfp_net_speed_aneg_update(struct rte_eth_dev *dev,
 		struct nfp_net_hw *hw,
 		struct nfp_net_hw_priv *hw_priv,
@@ -750,8 +750,7 @@ nfp_net_speed_aneg_update(struct rte_eth_dev *dev,
 	if (pf_dev->speed_updated || aneg == NFP_ANEG_AUTO) {
 		nfp_eth_table = nfp_eth_read_ports(pf_dev->cpp);
 		if (nfp_eth_table == NULL) {
-			PMD_DRV_LOG(DEBUG, "Error reading NFP ethernet table.");
-			return -EIO;
+			PMD_DRV_LOG(WARNING, "Failed to update port speed.");
 		} else {
 			pf_dev->nfp_eth_table->ports[hw->idx] = nfp_eth_table->ports[hw->idx];
 			free(nfp_eth_table);
@@ -773,8 +772,6 @@ nfp_net_speed_aneg_update(struct rte_eth_dev *dev,
 	if (dev->data->dev_conf.link_speeds == RTE_ETH_LINK_SPEED_AUTONEG &&
 			eth_port->supp_aneg)
 		link->link_autoneg = RTE_ETH_LINK_AUTONEG;
-
-	return 0;
 }
 
 int
@@ -790,11 +787,7 @@ nfp_net_link_update_common(struct rte_eth_dev *dev,
 	hw_priv = dev->process_private;
 	if (link->link_status == RTE_ETH_LINK_UP) {
 		if (hw_priv->pf_dev != NULL) {
-			ret = nfp_net_speed_aneg_update(dev, hw, hw_priv, link);
-			if (ret != 0) {
-				PMD_DRV_LOG(DEBUG, "Failed to update speed and aneg.");
-				return ret;
-			}
+			nfp_net_speed_aneg_update(dev, hw, hw_priv, link);
 		} else {
 			/*
 			 * Shift and mask nn_link_status so that it is effectively the value
-- 
2.39.1


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

* [PATCH 04/17] net/nfp: fix coredump caused by firmware abnormal cleanup
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
  2024-06-24  1:57 ` [PATCH 03/17] net/nfp: fix link status display problem Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 05/17] net/nfp: forbid offload flow rules with empty action list Chaoyong He
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, peng.zhang, stable, Long Wu

The logic of 'nfp_fw_setup()' consider both single-pf and multi-pf
firmware, but the abnormal firmware cleanup logic only consider multi-pf
firmware and try to write the heart beat value, which will cause
coredump when using the single-pf firmware.

Fixes: 8ba461d1eecc ("net/nfp: introduce keepalive mechanism for multiple PF")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9870b2dd33..9196d5d0a4 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2335,9 +2335,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	free(sym_tbl);
 fw_cleanup:
 	nfp_fw_unload(cpp);
-	nfp_net_keepalive_stop(&pf_dev->multi_pf);
-	nfp_net_keepalive_clear(pf_dev->multi_pf.beat_addr, pf_dev->multi_pf.function_id);
-	nfp_net_keepalive_uninit(&pf_dev->multi_pf);
+	if (pf_dev->multi_pf.enabled) {
+		nfp_net_keepalive_stop(&pf_dev->multi_pf);
+		nfp_net_keepalive_clear(pf_dev->multi_pf.beat_addr, pf_dev->multi_pf.function_id);
+		nfp_net_keepalive_uninit(&pf_dev->multi_pf);
+	}
 eth_table_cleanup:
 	free(nfp_eth_table);
 hwinfo_cleanup:
-- 
2.39.1


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

* [PATCH 05/17] net/nfp: forbid offload flow rules with empty action list
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
  2024-06-24  1:57 ` [PATCH 03/17] net/nfp: fix link status display problem Chaoyong He
  2024-06-24  1:57 ` [PATCH 04/17] net/nfp: fix coredump caused by firmware abnormal cleanup Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 06/17] net/nfp: remove redundancy function call Chaoyong He
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

The original logic allow offload flow rules with empty action list, but
the matched packets will be drop by the flower firmware.

Fix this by forbidding offload this type flow rules.

Fixes: 4d946034bf9c ("net/nfp: support basic flow actions")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_flow.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 9f410515e6..d127171fdb 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -4757,6 +4757,11 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor,
 		total_actions++;
 	}
 
+	if (total_actions == 0 || param.position == param.action_data) {
+		PMD_DRV_LOG(ERR, "The action list is empty");
+		return -ENOTSUP;
+	}
+
 	nfp_flow_meta = nfp_flow->payload.meta;
 	if (flag.drop_flag)
 		nfp_flow_meta->shortcut = rte_cpu_to_be_32(NFP_FL_SC_ACT_DROP);
-- 
2.39.1


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

* [PATCH 06/17] net/nfp: remove redundancy function call
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (2 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 05/17] net/nfp: forbid offload flow rules with empty action list Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 07/17] net/nfp: fix flow rule match data problem Chaoyong He
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

Remove the redundancy call of 'rte_eth_copy_pci_info()' as the API
'rte_eth_dev_pci_allocate()' already done that.

Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev_vf.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index a5c600c87b..cdf5da3af7 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -303,8 +303,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
 	net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat",
 			sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0);
 	if (net_hw->eth_xstats_base == NULL) {
-- 
2.39.1


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

* [PATCH 07/17] net/nfp: fix flow rule match data problem
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (3 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 06/17] net/nfp: remove redundancy function call Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 08/17] net/nfp: fix flow rule action " Chaoyong He
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable, Peng Zhang

From: Long Wu <long.wu@corigine.com>

The port and port mask field of 'struct nfp_net_cmsg_match_v4'
are in the wrong position, and this will cause firmware not
work as expected.

Fixes: 42eabda06b0f ("net/nfp: support IPv4 flow item")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_cmsg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_cmsg.h b/drivers/net/nfp/nfp_net_cmsg.h
index 4fab462cb9..b3d9bc33cf 100644
--- a/drivers/net/nfp/nfp_net_cmsg.h
+++ b/drivers/net/nfp/nfp_net_cmsg.h
@@ -52,10 +52,10 @@ struct nfp_net_cmsg_match_v4 {
 	uint32_t src_ipv4_mask;
 	uint32_t dst_ipv4;
 	uint32_t dst_ipv4_mask;
-	uint16_t src_port;
 	uint16_t src_port_mask;
-	uint16_t dst_port;
+	uint16_t src_port;
 	uint16_t dst_port_mask;
+	uint16_t dst_port;
 };
 
 /**
-- 
2.39.1


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

* [PATCH 08/17] net/nfp: fix flow rule action data problem
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (4 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 07/17] net/nfp: fix flow rule match data problem Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 11/17] net/nfp: fix flow position index problem Chaoyong He
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable, Peng Zhang

From: Long Wu <long.wu@corigine.com>

The data type of 'mark_id' field in 'struct nfp_net_cmsg_action'
should be 'uint32_t' rather than 'uint16_t'.

Fixes: 0b9079d24808 ("net/nfp: support flow API for CoreNIC firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_cmsg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net_cmsg.h b/drivers/net/nfp/nfp_net_cmsg.h
index b3d9bc33cf..ccb607f443 100644
--- a/drivers/net/nfp/nfp_net_cmsg.h
+++ b/drivers/net/nfp/nfp_net_cmsg.h
@@ -144,7 +144,7 @@ struct nfp_net_cmsg_action {
 	uint16_t action;
 	uint8_t queue;
 	uint8_t spare;
-	uint16_t mark_id;
+	uint32_t mark_id;
 };
 
 enum nfp_net_cfg_mbox_cmd {
-- 
2.39.1


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

* [PATCH 11/17] net/nfp: fix flow position index problem
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (5 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 08/17] net/nfp: fix flow rule action " Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 12/17] net/nfp: fix getting firmware version Chaoyong He
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable, Peng Zhang

From: Long Wu <long.wu@corigine.com>

The flow position acquire and free interfaces use different index,
and this will cause the flow free logic failed.

Fix this problem by using the same flow position index.

Fixes: 0b9079d24808 ("net/nfp: support flow API for CoreNIC firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_flow.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index 2dab317a5f..2c7801ed41 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -123,7 +123,11 @@ static void
 nfp_net_flow_position_free(struct nfp_net_priv *priv,
 		struct rte_flow *nfp_flow)
 {
-	priv->flow_position[nfp_flow->position] = false;
+	uint32_t index;
+
+	index = NFP_NET_FLOW_LIMIT - 1 - nfp_flow->position;
+
+	priv->flow_position[index] = false;
 }
 
 static struct rte_flow *
-- 
2.39.1


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

* [PATCH 12/17] net/nfp: fix getting firmware version
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (6 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 11/17] net/nfp: fix flow position index problem Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 13/17] doc: update the metadata description section Chaoyong He
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Zerun Fu, stable, Chaoyong He, Long Wu, Peng Zhang

From: Zerun Fu <zerun.fu@corigine.com>

The original logic try to get the NSP resource every time the application
call 'rte_eth_dev_fw_version_get()' interface, there are chances the NSP
resource busy and fail to get it. And because the local string variables
not initialized, there will be out of range problem when it fail to get
the NSP resource.

Fix this by initializing the local string variables and storing the
firmware version string once we get it.

Fixes: 128c8ad951bf ("net/nfp: support getting firmware version")
Cc: stable@dpdk.org

Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 26 ++++++++++++++++++--------
 drivers/net/nfp/nfp_net_common.h |  6 ++++++
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index a6573ed45c..84893e2d73 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -193,9 +193,6 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw,
 			nfp_net_link_speed_rte2nfp(link->link_speed));
 }
 
-/* The length of firmware version string */
-#define FW_VER_LEN        32
-
 /**
  * Reconfigure the firmware of VF configure
  *
@@ -2274,11 +2271,11 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 		size_t fw_size)
 {
 	struct nfp_net_hw *hw;
-	char mip_name[FW_VER_LEN];
-	char app_name[FW_VER_LEN];
-	char nsp_version[FW_VER_LEN];
-	char vnic_version[FW_VER_LEN];
 	struct nfp_net_hw_priv *hw_priv;
+	char app_name[FW_VER_LEN] = {0};
+	char mip_name[FW_VER_LEN] = {0};
+	char nsp_version[FW_VER_LEN] = {0};
+	char vnic_version[FW_VER_LEN] = {0};
 
 	if (fw_size < FW_VER_LEN)
 		return FW_VER_LEN;
@@ -2286,6 +2283,11 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 	hw = nfp_net_get_hw(dev);
 	hw_priv = dev->process_private;
 
+	if (hw->fw_version[0] != 0) {
+		snprintf(fw_version, FW_VER_LEN, "%s", hw->fw_version);
+		return 0;
+	}
+
 	if (!rte_eth_dev_is_repr(dev)) {
 		snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d",
 			hw->ver.extend, hw->ver.class,
@@ -2298,8 +2300,16 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 	nfp_net_get_mip_name(hw_priv, mip_name);
 	nfp_net_get_app_name(hw_priv, app_name);
 
-	snprintf(fw_version, FW_VER_LEN, "%s %s %s %s",
+	if (nsp_version[0] == 0 || mip_name[0] == 0) {
+		snprintf(fw_version, FW_VER_LEN, "%s %s %s %s",
 			vnic_version, nsp_version, mip_name, app_name);
+		return 0;
+	}
+
+	snprintf(hw->fw_version, FW_VER_LEN, "%s %s %s %s",
+			vnic_version, nsp_version, mip_name, app_name);
+
+	snprintf(fw_version, FW_VER_LEN, "%s", hw->fw_version);
 
 	return 0;
 }
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 6c739891be..3c4d305b01 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -50,6 +50,9 @@
 				RTE_ETH_RSS_NONFRAG_IPV6_UDP  | \
 				RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
 
+/* The length of firmware version string */
+#define FW_VER_LEN        32
+
 /*
  * Each PF has corresponding word to beat:
  * Offset | Usage
@@ -255,6 +258,9 @@ struct nfp_net_hw {
 
 	/** Used for rte_flow of CoreNIC firmware */
 	struct nfp_net_priv *priv;
+
+	/** Used for firmware version */
+	char fw_version[FW_VER_LEN];
 };
 
 static inline uint32_t
-- 
2.39.1


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

* [PATCH 13/17] doc: update the metadata description section
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (7 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 12/17] net/nfp: fix getting firmware version Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 14/17] net/nfp: remove the unneeded logic Chaoyong He
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, stable, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The description about the metadata of Tx direction
when using the firmware with NFDk is not correct.
Because of the exist of 8-bits metadata length, the
32-bits field type header contains only 6 4-bits
datatype specifiers rather than 8.

Fixes: c4b058784e75 ("net/nfp: modify parse metadata logic")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 doc/guides/nics/nfp.rst | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index ed9548de0b..d2c7afc8cb 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -329,10 +329,6 @@ be wrote N times in the heads. It is the same with NFD3.
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                        Data for field 5                       |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Data for field 6                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   |                        Data for field 7                       |
-   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          Packet Data                          |
    |                              ...                              |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-- 
2.39.1


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

* [PATCH 14/17] net/nfp: remove the unneeded logic
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (8 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 13/17] doc: update the metadata description section Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 15/17] net/nfp: adapts the reverse sequence card Chaoyong He
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, stable, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The logic in NFDk datapatch can make sure there only one layer VLAN,
so remove the unneeded logic here and make it clean and easy to
understand.

Fixes: 7c82b8626af8 ("net/nfp: support VLAN insert with NFDk")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
index e6847ccb33..2cea5688b3 100644
--- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
+++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
@@ -141,7 +141,6 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 	uint32_t meta_type;
 	struct nfp_net_hw *hw;
 	uint32_t header_offset;
-	uint8_t vlan_layer = 0;
 	uint8_t ipsec_layer = 0;
 	struct nfp_net_meta_raw meta_data;
 
@@ -184,12 +183,7 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt,
 			meta += NFP_NET_META_FIELD_SIZE) {
 		switch (meta_type & NFP_NET_META_FIELD_MASK) {
 		case NFP_NET_META_VLAN:
-			if (vlan_layer > 0) {
-				PMD_DRV_LOG(ERR, "At most 1 layers of vlan is supported");
-				return -EINVAL;
-			}
 			nfp_net_meta_set_vlan(&meta_data, pkt, layer);
-			vlan_layer++;
 			break;
 		case NFP_NET_META_IPSEC:
 			if (ipsec_layer > 2) {
-- 
2.39.1


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

* [PATCH 15/17] net/nfp: adapts the reverse sequence card
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (9 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 14/17] net/nfp: remove the unneeded logic Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 16/17] net/nfp: fix null pointer dereferences Chaoyong He
  2024-06-24  1:57 ` [PATCH 17/17] net/nfp: fix port action core dump Chaoyong He
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, chaoyong.he, stable

From: Peng Zhang <peng.zhang@corigine.com>

The NFP chip-wide port index is 'eth_port->index'.
In the normal card, it uses 'eth_port->eth_index', but because
'eth_port->eth_index' and 'eth_port->index' have the same value,
it doesn't have any problem.
But in the reverse sequence card, the value is different,
so it will lead the 'nfp_eth_config_start()' failed.

In this commit, fix this bug by using 'eth_port->index'.

Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_representor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 086dbc58e3..b1589cf78c 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -845,7 +845,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 		eth_port = &nfp_eth_table->ports[id];
 		flower_repr.repr_type = NFP_REPR_TYPE_PHYS_PORT;
 		flower_repr.port_id = nfp_flower_get_phys_port_id(eth_port->index);
-		flower_repr.nfp_idx = eth_port->eth_index;
+		flower_repr.nfp_idx = eth_port->index;
 		flower_repr.vf_id = i + 1;
 
 		/* Copy the real mac of the interface to the representor struct */
-- 
2.39.1


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

* [PATCH 16/17] net/nfp: fix null pointer dereferences
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (10 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 15/17] net/nfp: adapts the reverse sequence card Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  2024-06-24  1:57 ` [PATCH 17/17] net/nfp: fix port action core dump Chaoyong He
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

CI found null pointer dereferences problem.

Coverity issue: 426271
Fixes: 153ef2e49ed7 ("net/nfp: add process private structure")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 84893e2d73..aed40daa67 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -1265,6 +1265,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	hw = nfp_net_get_hw(dev);
 	hw_priv = dev->process_private;
+	if (hw_priv == NULL)
+		return -EINVAL;
 
 	nfp_net_rx_desc_limits(hw_priv, &min_rx_desc, &max_rx_desc);
 	nfp_net_tx_desc_limits(hw, hw_priv, &min_tx_desc, &max_tx_desc);
@@ -1367,7 +1369,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	}
 
 	/* Only PF supports getting speed capability. */
-	if (hw_priv != NULL && hw_priv->pf_dev != NULL)
+	if (hw_priv->pf_dev != NULL)
 		dev_info->speed_capa = hw_priv->pf_dev->speed_capa;
 
 	return 0;
-- 
2.39.1


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

* [PATCH 17/17] net/nfp: fix port action core dump
       [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
                   ` (11 preceding siblings ...)
  2024-06-24  1:57 ` [PATCH 16/17] net/nfp: fix null pointer dereferences Chaoyong He
@ 2024-06-24  1:57 ` Chaoyong He
  12 siblings, 0 replies; 13+ messages in thread
From: Chaoyong He @ 2024-06-24  1:57 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable

From: Long Wu <long.wu@corigine.com>

The app will be destroyed if add a port flow action which its
destination port id is invalid.

Add a check to avoid the problem.

Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index d127171fdb..24e7047407 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -931,7 +931,7 @@ nfp_flow_item_check_port(struct nfp_item_calculate_param *param)
 	const struct rte_flow_item_port_id *port_id;
 
 	port_id = param->item->spec;
-	if (port_id == NULL || port_id->id >= RTE_MAX_ETHPORTS)
+	if (port_id == NULL || rte_eth_dev_is_valid_port(port_id->id) == 0)
 		return -ERANGE;
 
 	return 0;
@@ -1256,7 +1256,7 @@ nfp_flow_action_check_port(struct nfp_action_calculate_param *param)
 		port_id = action_port_id->id;
 	}
 
-	if (port_id >= RTE_MAX_ETHPORTS)
+	if (rte_eth_dev_is_valid_port(port_id) == 0)
 		return -ERANGE;
 
 	return 0;
-- 
2.39.1


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

end of thread, other threads:[~2024-06-24  1:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240624015723.3712898-1-chaoyong.he@corigine.com>
2024-06-24  1:57 ` [PATCH 03/17] net/nfp: fix link status display problem Chaoyong He
2024-06-24  1:57 ` [PATCH 04/17] net/nfp: fix coredump caused by firmware abnormal cleanup Chaoyong He
2024-06-24  1:57 ` [PATCH 05/17] net/nfp: forbid offload flow rules with empty action list Chaoyong He
2024-06-24  1:57 ` [PATCH 06/17] net/nfp: remove redundancy function call Chaoyong He
2024-06-24  1:57 ` [PATCH 07/17] net/nfp: fix flow rule match data problem Chaoyong He
2024-06-24  1:57 ` [PATCH 08/17] net/nfp: fix flow rule action " Chaoyong He
2024-06-24  1:57 ` [PATCH 11/17] net/nfp: fix flow position index problem Chaoyong He
2024-06-24  1:57 ` [PATCH 12/17] net/nfp: fix getting firmware version Chaoyong He
2024-06-24  1:57 ` [PATCH 13/17] doc: update the metadata description section Chaoyong He
2024-06-24  1:57 ` [PATCH 14/17] net/nfp: remove the unneeded logic Chaoyong He
2024-06-24  1:57 ` [PATCH 15/17] net/nfp: adapts the reverse sequence card Chaoyong He
2024-06-24  1:57 ` [PATCH 16/17] net/nfp: fix null pointer dereferences Chaoyong He
2024-06-24  1:57 ` [PATCH 17/17] net/nfp: fix port action core dump Chaoyong He

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