static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config);
-static int is_ixgbe_pmd(const char *driver_name);
+static bool is_device_supported(struct rte_eth_dev *dev,
+ struct eth_driver *drv);
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
ixgbe_add_rar(dev, addr, 0, 0);
}
-static int
-is_ixgbe_pmd(const char *driver_name)
+static bool
+is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv)
{
- if (!strstr(driver_name, "ixgbe"))
- return -ENOTSUP;
+ if (strcmp(dev->driver->pci_drv.driver.name,
+ drv->pci_drv.driver.name))
+ return false;
- if (strstr(driver_name, "ixgbe_vf"))
- return -ENOTSUP;
-
- return 0;
+ return true;
}
int
int rar_entry;
uint8_t *new_mac = (uint8_t *)(mac_addr);
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_hw *hw;
struct ixgbe_mac_info *mac;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
struct ixgbe_hw *hw;
struct ixgbe_mac_info *mac;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
struct ixgbe_hw *hw;
uint32_t ctrl;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (vlan_id > ETHER_MAX_VLAN_ID)
struct ixgbe_hw *hw;
uint32_t ctrl;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
if (on > 1)
int i;
int num_queues = (int)(IXGBE_QDE_IDX_MASK >> IXGBE_QDE_IDX_SHIFT);
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
if (on > 1)
struct ixgbe_hw *hw;
uint32_t reg_value;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
/* only support VF's 0 to 63 */
- if ((vf >= dev_info.max_vfs) || (vf > 63))
+ if ((vf >= pci_dev->max_vfs) || (vf > 63))
return -EINVAL;
if (on > 1)
rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
+ struct ixgbe_hw *hw;
uint16_t queues_per_pool;
uint32_t q;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
+ hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
* first 124 queues 0-123 will be allocated to VF's and only
* the last 4 queues 123-127 will be assigned to the PF.
*/
-
- queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
+ if (hw->mac.type == ixgbe_mac_82598EB)
+ queues_per_pool = (uint16_t)hw->mac.max_rx_queues /
+ ETH_16_POOLS;
+ else
+ queues_per_pool = (uint16_t)hw->mac.max_rx_queues /
+ ETH_64_POOLS;
for (q = 0; q < queues_per_pool; q++)
(*dev->dev_ops->vlan_strip_queue_set)(dev,
{
int val = 0;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
struct ixgbe_hw *hw;
uint32_t vmolr;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
uint32_t reg, addr;
uint32_t val;
const uint8_t bit1 = 0x1;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
{
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
uint32_t reg, addr;
uint32_t val;
const uint8_t bit1 = 0x1;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (on > 1)
uint64_t vf_mask, uint8_t vlan_on)
{
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
int ret = 0;
uint16_t vf_idx;
struct ixgbe_hw *hw;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0))
uint16_t tx_rate, uint64_t q_msk)
{
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
struct ixgbe_hw *hw;
struct ixgbe_vf_info *vfinfo;
struct rte_eth_link link;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- rte_eth_dev_info_get(port, &dev_info);
+ pci_dev = IXGBE_DEV_TO_PCI(dev);
rte_eth_link_get_nowait(port, &link);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- if (vf >= dev_info.max_vfs)
+ if (vf >= pci_dev->max_vfs)
return -EINVAL;
if (tx_rate > link.link_speed)
if (q_msk == 0)
return 0;
- pci_dev = IXGBE_DEV_TO_PCI(dev);
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
/* Stop the data paths */
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
/* Stop the data paths */
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl, i;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
if (idx != 0 && idx != 1)
{
struct ixgbe_hw *hw;
struct rte_eth_dev *dev;
- struct rte_eth_dev_info dev_info;
uint32_t ctrl, i;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
- rte_eth_dev_info_get(port, &dev_info);
- if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_ixgbe_pmd))
return -ENOTSUP;
- dev = &rte_eth_devices[port];
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
if (idx != 0 && idx != 1)