[dpdk-dev] [PATCH v5 21/28] librte_ether: remove branches on pci_dev

Bruce Richardson bruce.richardson at intel.com
Thu Oct 29 12:51:41 CET 2015


On Fri, Oct 23, 2015 at 06:36:26PM +0100, Bernard Iremonger wrote:
> use dev_type to distinguish between vdev's and pdev's.
> remove pci_dev branches.
> update release notes.
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
> ---
>  doc/guides/rel_notes/release_2_2.rst |  3 +++
>  lib/librte_ether/rte_ethdev.c        | 40 +++++++++++++++---------------------
>  2 files changed, 20 insertions(+), 23 deletions(-)
> 
<snip>  
>  /* attach the new physical device, then store port_id of the device */
> @@ -1143,14 +1141,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  	 * If link state interrupt is enabled, check that the
>  	 * device supports it.
>  	 */
> -	if (dev_conf->intr_conf.lsc == 1) {
> -		const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
> -
> -		if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
> +	if ((dev_conf->intr_conf.lsc == 1) &&
> +		(!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
>  			PMD_DEBUG_TRACE("driver %s does not support lsc\n",
> -					pci_drv->name);
> +					dev->data->drv_name);

Is this safe to do? From your previous patches for the vdevs, you appear to be
setting the drv_name field to NULL for those vdevs, leading to undefined
behaviour here. (printf may catch the NULL and print it as "(null)" rather
than crashing, but it's still wrong!)

/Bruce



More information about the dev mailing list