The shared pointer is initialized to a static local array defined in the
primary process and it shall not be accessed in the secondary process.
This patch copies the local data to shared data, to avoid data access
violation.
Fixes: 040b44551f77 ("net/iavf: unify Rx packet type table")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
/* For vector PMD */
bool rx_vec_allowed;
bool tx_vec_allowed;
- const uint32_t *ptype_tbl;
+ uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE] __rte_cache_min_aligned;
bool stopped;
uint16_t fdir_ref_cnt;
struct iavf_devargs devargs;
}
/* set default ptype table */
- adapter->ptype_tbl = iavf_get_default_ptype_table();
+ iavf_set_default_ptype_table(eth_dev);
/* copy mac addr */
eth_dev->data->mac_addrs = rte_zmalloc(
return RTE_ETH_TX_DESC_FULL;
}
-const uint32_t *
-iavf_get_default_ptype_table(void)
+static inline uint32_t
+iavf_get_default_ptype(uint16_t ptype)
{
static const uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE]
__rte_cache_aligned = {
/* All others reserved */
};
- return ptype_tbl;
+ return ptype_tbl[ptype];
+}
+
+void __rte_cold
+iavf_set_default_ptype_table(struct rte_eth_dev *dev)
+{
+ struct iavf_adapter *ad =
+ IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ int i;
+
+ for (i = 0; i < IAVF_MAX_PKT_TYPE; i++)
+ ad->ptype_tbl[i] = iavf_get_default_ptype(i);
}
uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t xtr_type);
-const uint32_t *iavf_get_default_ptype_table(void);
+void iavf_set_default_ptype_table(struct rte_eth_dev *dev);
static inline
void iavf_dump_rx_descriptor(struct iavf_rx_queue *rxq,