/* Prototypes */
static int nfp_net_close(struct rte_eth_dev *dev);
-static int nfp_net_configure(struct rte_eth_dev *dev);
-static void nfp_net_dev_interrupt_handler(void *param);
-static void nfp_net_dev_interrupt_delayed_handler(void *param);
-static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
-static int nfp_net_infos_get(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info);
static int nfp_net_init(struct rte_eth_dev *eth_dev);
static int nfp_pf_init(struct rte_pci_device *pci_dev);
static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev);
+static int nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port);
static int nfp_pci_uninit(struct rte_eth_dev *eth_dev);
static int nfp_init_phyports(struct nfp_pf_dev *pf_dev);
-static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static int nfp_net_promisc_enable(struct rte_eth_dev *dev);
-static int nfp_net_promisc_disable(struct rte_eth_dev *dev);
-static int nfp_net_start(struct rte_eth_dev *dev);
-static int nfp_net_stats_get(struct rte_eth_dev *dev,
- struct rte_eth_stats *stats);
-static int nfp_net_stats_reset(struct rte_eth_dev *dev);
static int nfp_net_stop(struct rte_eth_dev *dev);
-static int nfp_net_rss_config_default(struct rte_eth_dev *dev);
-static int nfp_net_rss_hash_update(struct rte_eth_dev *dev,
- struct rte_eth_rss_conf *rss_conf);
-static int nfp_net_rss_reta_write(struct rte_eth_dev *dev,
- struct rte_eth_rss_reta_entry64 *reta_conf,
- uint16_t reta_size);
-static int nfp_net_rss_hash_write(struct rte_eth_dev *dev,
- struct rte_eth_rss_conf *rss_conf);
-static int nfp_set_mac_addr(struct rte_eth_dev *dev,
- struct rte_ether_addr *mac_addr);
static int nfp_fw_setup(struct rte_pci_device *dev,
struct nfp_cpp *cpp,
struct nfp_eth_table *nfp_eth_table,
* Write the update word to the BAR and ping the reconfig queue. Then poll
* until the firmware has acknowledged the update by zeroing the update word.
*/
-static int
+int
nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
{
uint32_t err;
* before any other function in the Ethernet API. This function can
* also be re-invoked when a device is in the stopped state.
*/
-static int
+int
nfp_net_configure(struct rte_eth_dev *dev)
{
struct rte_eth_conf *dev_conf;
return 0;
}
-static void
+void
nfp_net_enable_queues(struct rte_eth_dev *dev)
{
struct nfp_net_hw *hw;
nn_cfg_writeq(hw, NFP_NET_CFG_RXRS_ENABLE, enabled_queues);
}
-static void
+void
nfp_net_disable_queues(struct rte_eth_dev *dev)
{
struct nfp_net_hw *hw;
hw->ctrl = new_ctrl;
}
-static void
+void
nfp_net_params_setup(struct nfp_net_hw *hw)
{
nn_cfg_writel(hw, NFP_NET_CFG_MTU, hw->mtu);
nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, hw->flbufsz);
}
-static void
+void
nfp_net_cfg_queue_setup(struct nfp_net_hw *hw)
{
hw->qcp_cfg = hw->tx_bar + NFP_QCP_QUEUE_ADDR_SZ;
#define ETH_ADDR_LEN 6
-static void
+void
nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src)
{
int i;
return 0;
}
-static void
-nfp_net_vf_read_mac(struct nfp_net_hw *hw)
-{
- uint32_t tmp;
-
- tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));
- memcpy(&hw->mac_addr[0], &tmp, 4);
-
- tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));
- memcpy(&hw->mac_addr[4], &tmp, 2);
-}
-
-static void
+void
nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac)
{
uint32_t mac0 = *(uint32_t *)mac;
return 0;
}
-static int
+int
nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
struct rte_intr_handle *intr_handle)
{
return 0;
}
-static uint32_t
+uint32_t
nfp_check_offloads(struct rte_eth_dev *dev)
{
struct nfp_net_hw *hw;
return 0;
}
-static int
+int
nfp_net_promisc_enable(struct rte_eth_dev *dev)
{
uint32_t new_ctrl, update = 0;
return 0;
}
-static int
+int
nfp_net_promisc_disable(struct rte_eth_dev *dev)
{
uint32_t new_ctrl, update = 0;
* Wait to complete is needed as it can take up to 9 seconds to get the Link
* status.
*/
-static int
+int
nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
{
struct nfp_net_hw *hw;
return ret;
}
-static int
+int
nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
int i;
return -EINVAL;
}
-static int
+int
nfp_net_stats_reset(struct rte_eth_dev *dev)
{
int i;
return 0;
}
-static int
+int
nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct nfp_net_hw *hw;
return 0;
}
-static const uint32_t *
+const uint32_t *
nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
{
static const uint32_t ptypes[] = {
return NULL;
}
-static int
+int
nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct rte_pci_device *pci_dev;
return 0;
}
-static int
+int
nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct rte_pci_device *pci_dev;
}
}
+/*
+ * Interrupt handler which shall be registered for alarm callback for delayed
+ * handling specific interrupt to wait for the stable nic state. As the NIC
+ * interrupt state is not stable for nfp after link is just down, it needs
+ * to wait 4 seconds to get the stable status.
+ *
+ * @param handle Pointer to interrupt handle.
+ * @param param The address of parameter (struct rte_eth_dev *)
+ *
+ * @return void
+ */
static void
+nfp_net_dev_interrupt_delayed_handler(void *param)
+{
+ struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+
+ nfp_net_link_update(dev, 0);
+ rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
+
+ nfp_net_dev_link_status_print(dev);
+
+ /* Unmasking */
+ nfp_net_irq_unmask(dev);
+}
+
+void
nfp_net_dev_interrupt_handler(void *param)
{
int64_t timeout;
}
}
-/*
- * Interrupt handler which shall be registered for alarm callback for delayed
- * handling specific interrupt to wait for the stable nic state. As the NIC
- * interrupt state is not stable for nfp after link is just down, it needs
- * to wait 4 seconds to get the stable status.
- *
- * @param handle Pointer to interrupt handle.
- * @param param The address of parameter (struct rte_eth_dev *)
- *
- * @return void
- */
-static void
-nfp_net_dev_interrupt_delayed_handler(void *param)
-{
- struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
-
- nfp_net_link_update(dev, 0);
- rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
-
- nfp_net_dev_link_status_print(dev);
-
- /* Unmasking */
- nfp_net_irq_unmask(dev);
-}
-
-static int
+int
nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
{
struct nfp_net_hw *hw;
return 0;
}
-static int
+int
nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
uint32_t new_ctrl, update;
}
/* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */
-static int
+int
nfp_net_reta_update(struct rte_eth_dev *dev,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size)
}
/* Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device. */
-static int
+int
nfp_net_reta_query(struct rte_eth_dev *dev,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size)
return 0;
}
-static int
+int
nfp_net_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf)
{
return 0;
}
-static int
+int
nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf)
{
return 0;
}
-static int
+int
nfp_net_rss_config_default(struct rte_eth_dev *dev)
{
struct rte_eth_conf *dev_conf;
if (hw->is_phyport) {
nfp_net_pf_read_mac(pf_dev, port);
nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);
- } else {
- nfp_net_vf_read_mac(hw);
}
if (!rte_is_valid_assigned_ether_addr(
},
};
-static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {
- {
- RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
- PCI_DEVICE_ID_NFP6000_VF_NIC)
- },
- {
- .vendor_id = 0,
- },
-};
-
static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev;
return nfp_net_close(eth_dev);
}
-static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
- struct rte_pci_device *pci_dev)
-{
- return rte_eth_dev_pci_generic_probe(pci_dev,
- sizeof(struct nfp_net_adapter), nfp_net_init);
-}
-
static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev)
{
return rte_eth_dev_pci_generic_remove(pci_dev, nfp_pci_uninit);
.remove = eth_nfp_pci_remove,
};
-static struct rte_pci_driver rte_nfp_net_vf_pmd = {
- .id_table = pci_id_nfp_vf_net_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = eth_nfp_pci_probe,
- .remove = eth_nfp_pci_remove,
-};
-
RTE_PMD_REGISTER_PCI(net_nfp_pf, rte_nfp_net_pf_pmd);
-RTE_PMD_REGISTER_PCI(net_nfp_vf, rte_nfp_net_vf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_nfp_pf, pci_id_nfp_pf_net_map);
-RTE_PMD_REGISTER_PCI_TABLE(net_nfp_vf, pci_id_nfp_vf_net_map);
RTE_PMD_REGISTER_KMOD_DEP(net_nfp_pf, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_KMOD_DEP(net_nfp_vf, "* igb_uio | uio_pci_generic | vfio");
RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE);
RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE);
/*