uint32_t reg_val)
{
uint32_t ori_reg_val;
- struct rte_eth_dev *dev;
+ struct rte_eth_dev_data *dev_data =
+ ((struct i40e_adapter *)hw->back)->pf.dev_data;
+ struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
ori_reg_val = i40e_read_rx_ctl(hw, reg_addr);
- dev = ((struct i40e_adapter *)hw->back)->eth_dev;
i40e_write_rx_ctl(hw, reg_addr, reg_val);
if (ori_reg_val != reg_val)
PMD_DRV_LOG(WARNING,
struct i40e_asq_cmd_details *cmd_details)
{
uint64_t ori_reg_val;
- struct rte_eth_dev *dev;
+ struct rte_eth_dev_data *dev_data =
+ ((struct i40e_adapter *)hw->back)->pf.dev_data;
+ struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
int ret;
ret = i40e_aq_debug_read_register(hw, reg_addr, &ori_reg_val, NULL);
reg_addr);
return -EIO;
}
- dev = ((struct i40e_adapter *)hw->back)->eth_dev;
if (ori_reg_val != reg_val)
PMD_DRV_LOG(WARNING,
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- pf->adapter->eth_dev = dev;
pf->dev_data = dev->data;
hw->back = I40E_PF_TO_ADAPTER(pf);
void
i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)
{
- struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+ struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
int
i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
{
- struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+ struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
void
i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
{
- struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+ struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
void
i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)
{
- struct rte_eth_dev *dev = vsi->adapter->eth_dev;
+ struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
break;
}
if (ret == I40E_SUCCESS)
- i40e_set_tx_function(container_of(pf, struct i40e_adapter, pf)
- ->eth_dev);
+ i40e_set_tx_function(&rte_eth_devices[pf->dev_data->port_id]);
return ret;
}
}
}
if (ret == I40E_SUCCESS)
- i40e_set_rx_function(container_of(pf, struct i40e_adapter, pf)
- ->eth_dev);
+ i40e_set_rx_function(&rte_eth_devices[pf->dev_data->port_id]);
return ret;
}
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
enum i40e_status_code status = I40E_SUCCESS;
if (pf->support_multi_driver) {
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
enum i40e_status_code status = I40E_SUCCESS;
if (pf->support_multi_driver) {
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
enum i40e_status_code status = I40E_SUCCESS;
if (pf->support_multi_driver) {
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
enum i40e_status_code status = I40E_SUCCESS;
if (pf->support_multi_driver) {
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
enum i40e_status_code status = I40E_SUCCESS;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
if (pf->support_multi_driver) {
PMD_DRV_LOG(ERR, "Replace l1 filter is not supported.");
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
enum i40e_status_code status = I40E_SUCCESS;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
if (pf->support_multi_driver) {
PMD_DRV_LOG(ERR, "Replace cloud filter is not supported.");
i40e_check_write_global_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val)
{
uint32_t reg = i40e_read_rx_ctl(hw, addr);
- struct rte_eth_dev *dev;
+ struct rte_eth_dev_data *dev_data =
+ ((struct i40e_adapter *)hw->back)->pf.dev_data;
+ struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id];
- dev = ((struct i40e_adapter *)hw->back)->eth_dev;
if (reg != val) {
i40e_write_rx_ctl(hw, addr, val);
PMD_DRV_LOG(WARNING,
struct i40e_aqc_replace_cloud_filters_cmd filter_replace;
struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
if (pf->support_multi_driver) {
PMD_DRV_LOG(ERR, "Replace cloud filter is not supported.");
do { \
uint32_t ori_val; \
struct rte_eth_dev *dev; \
+ struct rte_eth_dev_data *dev_data; \
ori_val = I40E_READ_REG((hw), (reg)); \
- dev = ((struct i40e_adapter *)hw->back)->eth_dev; \
+ dev_data = ((struct i40e_adapter *)hw->back)->pf.dev_data; \
+ dev = &rte_eth_devices[dev_data->port_id]; \
I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), \
(reg)), (value)); \
if (ori_val != value) \
struct i40e_adapter {
/* Common for both PF and VF */
struct i40e_hw hw;
- struct rte_eth_dev *eth_dev;
/* Specific for PF or VF */
union {
#define I40E_VSI_TO_DEV_DATA(vsi) \
(((struct i40e_vsi *)vsi)->adapter->pf.dev_data)
#define I40E_VSI_TO_ETH_DEV(vsi) \
- (((struct i40e_vsi *)vsi)->adapter->eth_dev)
+ (&rte_eth_devices[((struct i40e_vsi *)vsi)->adapter->pf.dev_data->port_id])
/* I40E_PF_TO */
#define I40E_PF_TO_HW(pf) \
int err = I40E_SUCCESS;
char z_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz = NULL;
- struct rte_eth_dev *eth_dev = pf->adapter->eth_dev;
+ struct rte_eth_dev *eth_dev = &rte_eth_devices[pf->dev_data->port_id];
uint16_t i;
if ((pf->flags & I40E_FLAG_FDIR) == 0) {
{
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
struct i40e_vsi *vsi;
- struct rte_eth_dev *dev = pf->adapter->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
vsi = pf->fdir.fdir_vsi;
if (!vsi)
static int
i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
{
- struct rte_eth_dev *dev = pf->adapter->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
struct i40e_fdir_info *fdir_info = &pf->fdir;
struct i40e_fdir_filter *fdir_filter;
enum i40e_filter_pctype pctype;
const struct i40e_rte_flow_rss_conf *rss_conf)
{
struct i40e_hw *hw = &pf->adapter->hw;
- struct rte_eth_dev *dev = pf->adapter->eth_dev;
+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
struct i40e_queue_region_info *regions = pf->queue_region.region;
uint32_t num = pf->queue_region.queue_region_number;
uint32_t i, region_id_mask = 0;
struct i40e_rte_flow_rss_conf *rss_conf)
{
struct i40e_hw *hw = &pf->adapter->hw;
+ struct rte_eth_dev *dev;
uint64_t inset;
uint32_t idx;
int ret;
}
if (rss_conf->misc_reset_flags & I40E_HASH_FLOW_RESET_FLAG_REGION) {
- ret = i40e_flush_queue_region_all_conf(pf->adapter->eth_dev,
- hw, pf, 0);
+ dev = &rte_eth_devices[pf->dev_data->port_id];
+ ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
if (ret)
return ret;
return I40E_ERR_BAD_PTR;
}
- dev = pf->adapter->eth_dev;
+ dev = &rte_eth_devices[pf->dev_data->port_id];
/* Allocate the TX queue data structure. */
txq = rte_zmalloc_socket("i40e fdir tx queue",
return I40E_ERR_BAD_PTR;
}
- dev = pf->adapter->eth_dev;
+ dev = &rte_eth_devices[pf->dev_data->port_id];
/* Allocate the RX queue data structure. */
rxq = rte_zmalloc_socket("i40e fdir rx queue",
int wait_to_complete)
{
struct i40e_vf_representor *representor = ethdev->data->dev_private;
+ struct rte_eth_dev *dev =
+ &rte_eth_devices[representor->adapter->pf.dev_data->port_id];
- return i40e_dev_link_update(representor->adapter->eth_dev,
- wait_to_complete);
+ return i40e_dev_link_update(dev, wait_to_complete);
}
static int
i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,
struct rte_eth_dev_info *dev_info)
{
struct i40e_vf_representor *representor = ethdev->data->dev_private;
+ struct rte_eth_dev_data *pf_dev_data =
+ representor->adapter->pf.dev_data;
/* get dev info for the vdev */
dev_info->device = ethdev->device;
};
dev_info->switch_info.name =
- representor->adapter->eth_dev->device->name;
+ rte_eth_devices[pf_dev_data->port_id].device->name;
dev_info->switch_info.domain_id = representor->switch_domain_id;
dev_info->switch_info.port_id = representor->vf_id;
int ret;
ret = rte_pmd_i40e_get_vf_native_stats(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, &native_stats);
if (ret == 0) {
i40evf_stat_update_48(
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_get_vf_native_stats(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, &representor->stats_offset);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_unicast_promisc(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, 1);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_unicast_promisc(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, 0);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_multicast_promisc(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, 1);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_multicast_promisc(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, 0);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
rte_pmd_i40e_remove_vf_mac_addr(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, ðdev->data->mac_addrs[index]);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_mac_addr(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, mac_addr);
}
uint64_t vf_mask = 1ULL << representor->vf_id;
return rte_pmd_i40e_set_vf_vlan_filter(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
vlan_id, vf_mask, on);
}
struct i40e_pf *pf;
uint32_t vfid;
- pdev = representor->adapter->eth_dev;
+ pdev = &rte_eth_devices[representor->adapter->pf.dev_data->port_id];
vfid = representor->vf_id;
if (!is_i40e_supported(pdev)) {
struct i40e_vf_representor *representor = ethdev->data->dev_private;
rte_pmd_i40e_set_vf_vlan_stripq(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, on);
}
struct i40e_vf_representor *representor = ethdev->data->dev_private;
return rte_pmd_i40e_set_vf_vlan_insert(
- representor->adapter->eth_dev->data->port_id,
+ representor->adapter->pf.dev_data->port_id,
representor->vf_id, vlan_id);
}
((struct i40e_vf_representor *)init_params)->adapter;
pf = I40E_DEV_PRIVATE_TO_PF(
- representor->adapter->eth_dev->data->dev_private);
+ representor->adapter->pf.dev_data->dev_private);
if (representor->vf_id >= pf->vf_num)
return -ENODEV;
ethdev->data->mac_addrs = &vf->mac_addr;
/* Link state. Inherited from PF */
- link = &representor->adapter->eth_dev->data->dev_link;
+ link = &representor->adapter->pf.dev_data->dev_link;
ethdev->data->dev_link.link_speed = link->link_speed;
ethdev->data->dev_link.link_duplex = link->link_duplex;