[v5] net/ice: fix function pointer in multi-process

Message ID 20211026015542.1416819-1-dapengx.yu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v5] net/ice: fix function pointer in multi-process |

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Yu, DapengX Oct. 26, 2021, 1:55 a.m. UTC
  From: Dapeng Yu <dapengx.yu@intel.com>

This patch uses the index value to call the function, instead of the
function pointer assignment to save the selection of Receive Flex
Descriptor profile ID.

Otherwise the secondary process will run with wrong function address
from primary process.

Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
V2:
* Remove redundant code
V3:
* Fix incorrect switch statements in V2
V4:
* Combine similar case statements
V5:
* Rebase
---
 drivers/net/ice/ice_rxtx.c | 32 ++++++++++++++++++--------------
 drivers/net/ice/ice_rxtx.h |  2 +-
 2 files changed, 19 insertions(+), 15 deletions(-)
  

Comments

Qi Zhang Oct. 27, 2021, 3:28 a.m. UTC | #1
> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Tuesday, October 26, 2021 9:56 AM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX
> <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [PATCH v5] net/ice: fix function pointer in multi-process
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> This patch uses the index value to call the function, instead of the function
> pointer assignment to save the selection of Receive Flex Descriptor profile ID.
> 
> Otherwise the secondary process will run with wrong function address from
> primary process.
> 
> Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  
Navin Srinivas Feb. 24, 2022, 6 p.m. UTC | #2
Hi,

Whether this fix is applicable for VF? I do not see this change ported to
VF in DPDK-20.11.4.

Thanks,
Navin Srinivas

On Wed, Oct 27, 2021 at 8:58 AM Zhang, Qi Z <qi.z.zhang@intel.com> wrote:

>
>
> > -----Original Message-----
> > From: Yu, DapengX <dapengx.yu@intel.com>
> > Sent: Tuesday, October 26, 2021 9:56 AM
> > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX
> > <dapengx.yu@intel.com>; stable@dpdk.org
> > Subject: [PATCH v5] net/ice: fix function pointer in multi-process
> >
> > From: Dapeng Yu <dapengx.yu@intel.com>
> >
> > This patch uses the index value to call the function, instead of the
> function
> > pointer assignment to save the selection of Receive Flex Descriptor
> profile ID.
> >
> > Otherwise the secondary process will run with wrong function address from
> > primary process.
> >
> > Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> > Acked-by: Haiyue Wang <haiyue.wang@intel.com>
>
> Applied to dpdk-next-net-intel.
>
> Thanks
> Qi
>
  
Qi Zhang Feb. 25, 2022, 1:34 a.m. UTC | #3
We need a separate fix for AVF which is ongoing.
And DPDK 20.11.4 LTS by default will only backport all the fix that during DPDK 21.11 dev cycle, so you may need to wait for 20.11.5 or just cherry pick by yourself.

Regards
Qi


From: Navin Srinivas <g.navinsrinivas@gmail.com>
Sent: Friday, February 25, 2022 2:00 AM
To: Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: Yu, DapengX <dapengx.yu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5] net/ice: fix function pointer in multi-process

Hi,

Whether this fix is applicable for VF? I do not see this change ported to VF in DPDK-20.11.4.

Thanks,
Navin Srinivas

On Wed, Oct 27, 2021 at 8:58 AM Zhang, Qi Z <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>> wrote:


> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com<mailto:dapengx.yu@intel.com>>
> Sent: Tuesday, October 26, 2021 9:56 AM
> To: Yang, Qiming <qiming.yang@intel.com<mailto:qiming.yang@intel.com>>; Zhang, Qi Z
> <qi.z.zhang@intel.com<mailto:qi.z.zhang@intel.com>>
> Cc: dev@dpdk.org<mailto:dev@dpdk.org>; Wang, Haiyue <haiyue.wang@intel.com<mailto:haiyue.wang@intel.com>>; Yu, DapengX
> <dapengx.yu@intel.com<mailto:dapengx.yu@intel.com>>; stable@dpdk.org<mailto:stable@dpdk.org>
> Subject: [PATCH v5] net/ice: fix function pointer in multi-process
>
> From: Dapeng Yu <dapengx.yu@intel.com<mailto:dapengx.yu@intel.com>>
>
> This patch uses the index value to call the function, instead of the function
> pointer assignment to save the selection of Receive Flex Descriptor profile ID.
>
> Otherwise the secondary process will run with wrong function address from
> primary process.
>
> Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
> Cc: stable@dpdk.org<mailto:stable@dpdk.org>
>
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com<mailto:dapengx.yu@intel.com>>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com<mailto:haiyue.wang@intel.com>>

Applied to dpdk-next-net-intel.

Thanks
Qi
  
Navin Srinivas Feb. 25, 2022, 10:24 a.m. UTC | #4
Hi Qi,
Thank you for your reply and confirmation.

Regards,
Navin Srinivas

On Fri, Feb 25, 2022 at 7:04 AM Zhang, Qi Z <qi.z.zhang@intel.com> wrote:

> We need a separate fix for AVF which is ongoing.
>
> And DPDK 20.11.4 LTS by default will only backport all the fix that during
> DPDK 21.11 dev cycle, so you may need to wait for 20.11.5 or just cherry
> pick by yourself.
>
>
>
> Regards
>
> Qi
>
>
>
>
>
> *From:* Navin Srinivas <g.navinsrinivas@gmail.com>
> *Sent:* Friday, February 25, 2022 2:00 AM
> *To:* Zhang, Qi Z <qi.z.zhang@intel.com>
> *Cc:* Yu, DapengX <dapengx.yu@intel.com>; Yang, Qiming <
> qiming.yang@intel.com>; dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>;
> stable@dpdk.org
> *Subject:* Re: [dpdk-dev] [PATCH v5] net/ice: fix function pointer in
> multi-process
>
>
>
> Hi,
>
>
>
> Whether this fix is applicable for VF? I do not see this change ported to
> VF in DPDK-20.11.4.
>
>
>
> Thanks,
>
> Navin Srinivas
>
>
>
> On Wed, Oct 27, 2021 at 8:58 AM Zhang, Qi Z <qi.z.zhang@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Yu, DapengX <dapengx.yu@intel.com>
> > Sent: Tuesday, October 26, 2021 9:56 AM
> > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX
> > <dapengx.yu@intel.com>; stable@dpdk.org
> > Subject: [PATCH v5] net/ice: fix function pointer in multi-process
> >
> > From: Dapeng Yu <dapengx.yu@intel.com>
> >
> > This patch uses the index value to call the function, instead of the
> function
> > pointer assignment to save the selection of Receive Flex Descriptor
> profile ID.
> >
> > Otherwise the secondary process will run with wrong function address from
> > primary process.
> >
> > Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> > Acked-by: Haiyue Wang <haiyue.wang@intel.com>
>
> Applied to dpdk-next-net-intel.
>
> Thanks
> Qi
>
>
  

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index e7217661dd..c3cad2fbbb 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -204,51 +204,55 @@  ice_rxd_to_pkt_fields_by_comms_aux_v2(struct ice_rx_queue *rxq,
 #endif
 }
 
+static const ice_rxd_to_pkt_fields_t rxd_to_pkt_fields_ops[] = {
+	[ICE_RXDID_COMMS_AUX_VLAN] = ice_rxd_to_pkt_fields_by_comms_aux_v1,
+	[ICE_RXDID_COMMS_AUX_IPV4] = ice_rxd_to_pkt_fields_by_comms_aux_v1,
+	[ICE_RXDID_COMMS_AUX_IPV6] = ice_rxd_to_pkt_fields_by_comms_aux_v1,
+	[ICE_RXDID_COMMS_AUX_IPV6_FLOW] = ice_rxd_to_pkt_fields_by_comms_aux_v1,
+	[ICE_RXDID_COMMS_AUX_TCP] = ice_rxd_to_pkt_fields_by_comms_aux_v1,
+	[ICE_RXDID_COMMS_AUX_IP_OFFSET] = ice_rxd_to_pkt_fields_by_comms_aux_v2,
+	[ICE_RXDID_COMMS_GENERIC] = ice_rxd_to_pkt_fields_by_comms_generic,
+	[ICE_RXDID_COMMS_OVS] = ice_rxd_to_pkt_fields_by_comms_ovs,
+};
+
 void
 ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid)
 {
+	rxq->rxdid = rxdid;
+
 	switch (rxdid) {
 	case ICE_RXDID_COMMS_AUX_VLAN:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1;
 		break;
 
 	case ICE_RXDID_COMMS_AUX_IPV4:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1;
 		break;
 
 	case ICE_RXDID_COMMS_AUX_IPV6:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1;
 		break;
 
 	case ICE_RXDID_COMMS_AUX_IPV6_FLOW:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1;
 		break;
 
 	case ICE_RXDID_COMMS_AUX_TCP:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1;
 		break;
 
 	case ICE_RXDID_COMMS_AUX_IP_OFFSET:
 		rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2;
 		break;
 
 	case ICE_RXDID_COMMS_GENERIC:
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_generic;
-		break;
-
+		/* fallthrough */
 	case ICE_RXDID_COMMS_OVS:
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs;
 		break;
 
 	default:
 		/* update this according to the RXDID for PROTO_XTR_NONE */
-		rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs;
+		rxq->rxdid = ICE_RXDID_COMMS_OVS;
 		break;
 	}
 
@@ -1608,7 +1612,7 @@  ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
 			mb->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
 				rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
 			ice_rxd_to_vlan_tci(mb, &rxdp[j]);
-			rxq->rxd_to_pkt_fields(rxq, mb, &rxdp[j]);
+			rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]);
 #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
 			if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
 				ts_ns = ice_tstamp_convert_32b_64b(hw,
@@ -1925,7 +1929,7 @@  ice_recv_scattered_pkts(void *rx_queue,
 		first_seg->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
 		ice_rxd_to_vlan_tci(first_seg, &rxd);
-		rxq->rxd_to_pkt_fields(rxq, first_seg, &rxd);
+		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, first_seg, &rxd);
 		pkt_flags = ice_rxd_error_to_pkt_flags(rx_stat_err0);
 #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
 		if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
@@ -2356,7 +2360,7 @@  ice_recv_pkts(void *rx_queue,
 		rxm->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
 		ice_rxd_to_vlan_tci(rxm, &rxd);
-		rxq->rxd_to_pkt_fields(rxq, rxm, &rxd);
+		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, rxm, &rxd);
 		pkt_flags = ice_rxd_error_to_pkt_flags(rx_stat_err0);
 #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
 		if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index e1c644fb63..146dc1f95d 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -89,7 +89,7 @@  struct ice_rx_queue {
 	bool rx_deferred_start; /* don't start this queue in dev start */
 	uint8_t proto_xtr; /* Protocol extraction from flexible descriptor */
 	uint64_t xtr_ol_flag; /* Protocol extraction offload flag */
-	ice_rxd_to_pkt_fields_t rxd_to_pkt_fields; /* handle FlexiMD by RXDID */
+	uint32_t rxdid; /* Receive Flex Descriptor profile ID */
 	ice_rx_release_mbufs_t rx_rel_mbufs;
 	uint64_t offloads;
 	uint32_t time_high;