DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Angela Czubak <aczubak@caviumnetworks.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH] net/thunderx: manage PCI device mapping for SQS VFs
Date: Tue, 6 Jun 2017 19:35:07 +0530	[thread overview]
Message-ID: <20170606140506.GA31583@jerin> (raw)
In-Reply-To: <130021ab-eac2-88ae-4b32-0ffe88f0bb55@intel.com>

-----Original Message-----
> Date: Tue, 6 Jun 2017 14:36:09 +0100
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, dev@dpdk.org
> CC: Angela Czubak <aczubak@caviumnetworks.com>, Thomas Monjalon
>  <thomas@monjalon.net>
> Subject: Re: [dpdk-dev] [PATCH] net/thunderx: manage PCI device mapping for
>  SQS VFs
> User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
>  Thunderbird/52.1.1
> 
> On 6/1/2017 2:05 PM, Jerin Jacob wrote:
> > Since the commit e84ad157b7bc ("pci: unmap resources if probe fails"),
> > EAL unmaps the PCI device if ethdev probe returns positive or
> > negative value.
> > 
> > nicvf thunderx PMD needs special treatment for Secondary queue set(SQS)
> > PCIe VF devices, where, it expects to not unmap or free the memory
> > without registering the ethdev subsystem.
> > 
> > To keep the same behavior, moved the PCI map function inside
> > the driver without using the EAL services.
> 
> What do you think adding a flag something like
> RTE_PCI_DRV_FIXED_MAPPING? Does mapping but not unmap on error.
> This would be more generic solution.
> 
> I am concerned about calling eal level API from PMD.

Understood.

Another option is to unmap only on ERROR(ie, when probe return <0 value)

	ret = dr->probe(dr, dev);
        if (ret) { // change to if (ret < 0)
                dev->driver = NULL;
                if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
                        rte_pci_unmap_device(dev);
        }

I am fine with either way. Let me know, what you prefer. I will
change accordingly.

>
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Signed-off-by: Angela Czubak <aczubak@caviumnetworks.com>
> > ---
> >  drivers/net/thunderx/nicvf_ethdev.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> > index 796701b0f..6ec2f9266 100644
> > --- a/drivers/net/thunderx/nicvf_ethdev.c
> > +++ b/drivers/net/thunderx/nicvf_ethdev.c
> > @@ -2025,6 +2025,13 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
> >  	}
> >  
> >  	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
> > +
> > +	ret = rte_pci_map_device(pci_dev);
> > +	if (ret) {
> > +		PMD_INIT_LOG(ERR, "Failed to map pci device");
> > +		goto fail;
> > +	}
> > +
> >  	rte_eth_copy_pci_info(eth_dev, pci_dev);
> >  
> >  	nic->device_id = pci_dev->id.device_id;
> > @@ -2171,7 +2178,7 @@ static int nicvf_eth_pci_remove(struct rte_pci_device *pci_dev)
> >  
> >  static struct rte_pci_driver rte_nicvf_pmd = {
> >  	.id_table = pci_id_nicvf_map,
> > -	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> > +	.drv_flags = RTE_PCI_DRV_INTR_LSC,
> >  	.probe = nicvf_eth_pci_probe,
> >  	.remove = nicvf_eth_pci_remove,
> >  };
> > 
> 

  reply	other threads:[~2017-06-06 14:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 13:05 Jerin Jacob
2017-06-06 13:36 ` Ferruh Yigit
2017-06-06 14:05   ` Jerin Jacob [this message]
2017-06-06 14:54     ` Ferruh Yigit
2017-06-08 11:44 ` [dpdk-dev] [PATCH v2 1/2] eal/pci: introduce a PCI driver flag Jerin Jacob
2017-06-08 11:44   ` [dpdk-dev] [PATCH v2 2/2] net/thunderx: manage PCI device mapping for SQS VFs Jerin Jacob
2017-06-08 14:40   ` [dpdk-dev] [PATCH v2 1/2] eal/pci: introduce a PCI driver flag Ferruh Yigit
2017-06-08 17:15     ` Jerin Jacob
2017-06-08 19:44       ` Ferruh Yigit
2017-06-09  4:35         ` Jerin Jacob
2017-06-09  9:13           ` Ferruh Yigit
2017-06-09  9:27             ` Jerin Jacob
2017-06-09 10:27   ` [dpdk-dev] [PATCH v3 " Jerin Jacob
2017-06-09 10:27     ` [dpdk-dev] [PATCH v3 2/2] net/thunderx: manage PCI device mapping for SQS VFs Jerin Jacob
2017-06-09 10:46     ` [dpdk-dev] [PATCH v3 1/2] eal/pci: introduce a PCI driver flag Ferruh Yigit
2017-06-12 16:02       ` Ferruh Yigit
2017-06-12 16:21     ` Thomas Monjalon
2017-06-13  4:43       ` Jerin Jacob
2017-06-13  7:03         ` Thomas Monjalon
2017-06-13  7:24           ` Jerin Jacob
2017-06-13  8:18             ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170606140506.GA31583@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=aczubak@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).