On 9/28/2018 8:45 AM, Gagandeep Singh wrote: > This patch introduces the enetc PMD with basic > initialisation functions includes probe, teardown, > hardware initialisation > > Signed-off-by: Gagandeep Singh <g.si...@nxp.com>
<...> > +struct enetc_eth_mac_info { > + uint8_t addr[ETH_ADDR_LEN]; > + uint8_t perm_addr[ETH_ADDR_LEN]; Can reuse DPDK ETHER_ADDR_LEN for this instead of re-defining? (You can skip if this is coming from a common code and you need to maintain the difference yourself for this change.) <...> > +static int > +enetc_dev_init(struct rte_eth_dev *eth_dev) > +{ > + int error = 0; > + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); > + struct enetc_eth_hw *hw = > + ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > + > + PMD_INIT_FUNC_TRACE(); > + eth_dev->dev_ops = &enetc_ops; > + eth_dev->rx_pkt_burst = NULL; > + eth_dev->tx_pkt_burst = NULL; > + > + /* Retrieving and storing the HW base address of device */ > + hw->hw.reg = (void *)pci_dev->mem_resource[0].addr; > + hw->device_id = pci_dev->id.device_id; > + > + error = enetc_hardware_init(hw); > + if (error != 0) { > + ENETC_PMD_ERR("Hardware initialization failed"); > + return -1; > + } > + > + /* Allocate memory for storing MAC addresses */ > + eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); > + if (!eth_dev->data->mac_addrs) { > + ENETC_PMD_ERR("Failed to allocate %d bytes needed to " > + "store MAC addresses", > + ETHER_ADDR_LEN * 1); > + error = -ENOMEM; > + return -1; > + } Need to free eth_dev->data->mac_addrs on uninit() <...> > +static int > +enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) > +{ > + struct enetc_eth_hw *hw = > + ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + struct rte_eth_link link; > + > + PMD_INIT_FUNC_TRACE(); > + hw->mac.get_link_status = 1; > + > + memset(&link, 0, sizeof(link)); > + rte_eth_linkstatus_get(dev, &link); > + > + link.link_duplex = ETH_LINK_FULL_DUPLEX; > + link.link_status = ETH_LINK_UP; > + rte_eth_linkstatus_set(dev, &link); rte_eth_linkstatus_get() / rte_eth_linkstatus_set() updates variables that holds the status of the link, but this PMD function should update the HW link status not just the state. <...> > +/* DP Logs, toggled out at compile time if level lower than current level */ > +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ > + RTE_LOG_DP(level, PMD, fmt, ## args) > + > +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ > + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) > +#define ENETC_PMD_DP_INFO(fmt, args...) \ > + ENETC_PMD_DP_LOG(INFO, fmt, ## args) > +#define ENETC_PMD_DP_WARN(fmt, args...) \ > + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) What about adding DP logs when you need them?