> -----Original Message-----
> From: Mingjin Ye <mingjinx...@intel.com>
> Sent: Tuesday, January 2, 2024 6:52 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.y...@intel.com>; Ye, MingjinX
> <mingjinx...@intel.com>; sta...@dpdk.org; Wu, Jingjing
> <jingjing...@intel.com>; Xing, Beilei <beilei.x...@intel.com>
> Subject: [PATCH v7 1/2] net/iavf: fix Rx/Tx burst in multi-process
>
> In a multi-process environment, a secondary process operates on shared
> memory and changes the function pointer of the primary process, resulting
> in a crash when the primary process cannot find the function address during
> an Rx/Tx burst.
>
> Fixes: 5b3124a0a6ef ("net/iavf: support no polling when link down")
> Cc: sta...@dpdk.org
>
> Signed-off-by: Mingjin Ye <mingjinx...@intel.com>
> ---
> v2: Add fix for Rx burst.
> ---
> v3: fix Rx/Tx routing.
> ---
> drivers/net/iavf/iavf.h | 42 ++++++++-
> drivers/net/iavf/iavf_rxtx.c | 173 +++++++++++++++++++++++------------
> 2 files changed, 157 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> 10868f2c30..73a089c199 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -313,6 +313,44 @@ struct iavf_devargs {
>
> struct iavf_security_ctx;
>
> +enum iavf_rx_burst_type {
> + IAVF_RX_DEFAULT,
> + IAVF_RX_FLEX_RXD,
> + IAVF_RX_BULK_ALLOC,
> + IAVF_RX_SCATTERED,
> + IAVF_RX_SCATTERED_FLEX_RXD,
> + IAVF_RX_SSE,
> + IAVF_RX_AVX2,
> + IAVF_RX_AVX2_OFFLOAD,
> + IAVF_RX_SSE_FLEX_RXD,
> + IAVF_RX_AVX2_FLEX_RXD,
> + IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
> + IAVF_RX_SSE_SCATTERED,
> + IAVF_RX_AVX2_SCATTERED,
> + IAVF_RX_AVX2_SCATTERED_OFFLOAD,
> + IAVF_RX_SSE_SCATTERED_FLEX_RXD,
> + IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
> + IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
> + IAVF_RX_AVX512,
> + IAVF_RX_AVX512_OFFLOAD,
> + IAVF_RX_AVX512_FLEX_RXD,
> + IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
> + IAVF_RX_AVX512_SCATTERED,
> + IAVF_RX_AVX512_SCATTERED_OFFLOAD,
> + IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
> + IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
> +};
> +
> +enum iavf_tx_burst_type {
> + IAVF_TX_DEFAULT,
> + IAVF_TX_SSE,
> + IAVF_TX_AVX2,
> + IAVF_TX_AVX2_OFFLOAD,
> + IAVF_TX_AVX512,
> + IAVF_TX_AVX512_OFFLOAD,
> + IAVF_TX_AVX512_CTX_OFFLOAD,
> +};
> +
> /* Structure to store private data for each VF instance. */ struct
> iavf_adapter
> {
> struct iavf_hw hw;
> @@ -328,8 +366,8 @@ struct iavf_adapter {
> bool stopped;
> bool closed;
> bool no_poll;
> - eth_rx_burst_t rx_pkt_burst;
> - eth_tx_burst_t tx_pkt_burst;
> + enum iavf_rx_burst_type rx_burst_type;
> + enum iavf_tx_burst_type tx_burst_type;
> uint16_t fdir_ref_cnt;
> struct iavf_devargs devargs;
> };
> diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index
> f19aa14646..13b932ad85 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -3707,15 +3707,68 @@ iavf_prep_pkts(__rte_unused void *tx_queue,
> struct rte_mbuf **tx_pkts,
> return i;
> }
>
> +static
> +const eth_rx_burst_t iavf_rx_pkt_burst_ops[] = {
Its will broke if we insert a new type without change the ops array.
It's better to explicitly initial an array with index
[IAVF_RX_DEFAULT] = iavf_recv_pkts,
....