netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net_device + pci_dev question
@ 2005-11-27 19:58 Mateusz Berezecki
  2005-11-27 21:25 ` Arjan van de Ven
  0 siblings, 1 reply; 5+ messages in thread
From: Mateusz Berezecki @ 2005-11-27 19:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

Hello List!

Having only net_device pointer is it possible to retrieve associated pci_dev
pointer basing on this information only?


kind regards,
Mateusz Berezecki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: net_device + pci_dev question
  2005-11-27 19:58 net_device + pci_dev question Mateusz Berezecki
@ 2005-11-27 21:25 ` Arjan van de Ven
  2005-11-28 20:56   ` Re[2]: " Mateusz Berezecki
  0 siblings, 1 reply; 5+ messages in thread
From: Arjan van de Ven @ 2005-11-27 21:25 UTC (permalink / raw)
  To: Mateusz Berezecki; +Cc: linux-kernel, netdev

On Sun, 2005-11-27 at 20:58 +0100, Mateusz Berezecki wrote:
> Hello List!
> 
> Having only net_device pointer is it possible to retrieve associated pci_dev
> pointer basing on this information only?

what do you need it for?

(and.. what if the nic isn't a pci one?)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[2]: net_device + pci_dev question
  2005-11-27 21:25 ` Arjan van de Ven
@ 2005-11-28 20:56   ` Mateusz Berezecki
  2005-11-28 21:03     ` Arjan van de Ven
  0 siblings, 1 reply; 5+ messages in thread
From: Mateusz Berezecki @ 2005-11-28 20:56 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel, netdev

Hello Arjan,

On 27th november 2005 (22:25:13) you wrote:

> On Sun, 2005-11-27 at 20:58 +0100, Mateusz Berezecki wrote:
>> Hello List!
>> 
>> Having only net_device pointer is it possible to retrieve associated pci_dev
>> pointer basing on this information only?

> what do you need it for?

for pci_alloc_consistent() which takes pci_dev as a first argument to
allocate contiguous memory block for DMA transfers. I just realized
when I saw your answer that I might have moved the memory allocation to
some routine which is called earlier in time which has access to
pci_dev pointer directly, like net_device->init IIRC. But I'm not
really sure if that would be correct solution.

> (and.. what if the nic isn't a pci one?)

Uh... it's cardbus interface and still uses pci_* stuff without problems. (?)
Do I miss something?

kind regards
Mateusz Berezecki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re[2]: net_device + pci_dev question
  2005-11-28 20:56   ` Re[2]: " Mateusz Berezecki
@ 2005-11-28 21:03     ` Arjan van de Ven
  2005-11-28 21:08       ` Re[4]: " Mateusz Berezecki
  0 siblings, 1 reply; 5+ messages in thread
From: Arjan van de Ven @ 2005-11-28 21:03 UTC (permalink / raw)
  To: Mateusz Berezecki; +Cc: linux-kernel, netdev

On Mon, 2005-11-28 at 21:56 +0100, Mateusz Berezecki wrote:
> Hello Arjan,
> 
> On 27th november 2005 (22:25:13) you wrote:
> 
> > On Sun, 2005-11-27 at 20:58 +0100, Mateusz Berezecki wrote:
> >> Hello List!
> >> 
> >> Having only net_device pointer is it possible to retrieve associated pci_dev
> >> pointer basing on this information only?
> 
> > what do you need it for?
> 
> for pci_alloc_consistent() which takes pci_dev as a first argument to
> allocate contiguous memory block for DMA transfers. I just realized

oh it's *your own* netdev...

that makes things a lot easier ;)

it's custom to have driver private data per net dev
(see netdev_priv() to get it, alloc_etherdev() takes the size of it as
argument). It's custom to make that private data a struct in which you
can store the pci device pointer yourself, as well as any other per card
data that you need to store

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[4]: net_device + pci_dev question
  2005-11-28 21:03     ` Arjan van de Ven
@ 2005-11-28 21:08       ` Mateusz Berezecki
  0 siblings, 0 replies; 5+ messages in thread
From: Mateusz Berezecki @ 2005-11-28 21:08 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel, netdev

Hello Arjan,

On 28th november 2005 (22:03:38) you wrote:

> oh it's *your own* netdev...

Yes:-) Sorry for not being precise

> that makes things a lot easier ;)


> it's custom to have driver private data per net dev
> (see netdev_priv() to get it, alloc_etherdev() takes the size of it as
> argument). It's custom to make that private data a struct in which you
> can store the pci device pointer yourself, as well as any other per card
> data that you need to store


Ok, I will do it like that then. Thank you for the explanation on this
issue.

kind regards,
Mateusz Berezecki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-28 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-27 19:58 net_device + pci_dev question Mateusz Berezecki
2005-11-27 21:25 ` Arjan van de Ven
2005-11-28 20:56   ` Re[2]: " Mateusz Berezecki
2005-11-28 21:03     ` Arjan van de Ven
2005-11-28 21:08       ` Re[4]: " Mateusz Berezecki

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).