On Dec 8, 2011, at 1:17 AM, s p wrote:

> Hello all,
> 
> 
> Can I use ddi_copyout in a solaris NIC driver?

No.

> (I want to transfer more than 2K data to the user land through ioctl 
> interface in a nic driver.)

There are other ways to transfer large amounts of data using STREAMs, but it is 
a pain in the arse, and I'm not sure you can do so with GLDv3 drivers.  
(Basically, you have to use the M_COPYIN and M_COPYOUT messages, and that 
requires a full state machine in your driver because the data will arrive 
asynchronously.   The reason for this is that in a NIC driver you are 
disconnected from user-context, so you can't just copyin/copyout normally, as 
there won't necessarily be user context to do so with.)

I can't imagine why you want to transfer such large amounts of data *except* 
perhaps for firmware updating.

If you are doing a firmware update, you can try a few different approaches 
which would be easier from a NIC driver:

a) break the large ioctl smaller ioctls using a simple protocol between the 
driver and userland
b) use a special mac address to receive data from userland, and send it as 
ethernet packets

I think "a" is the cleaner/simpler approach, but it does require you to retain 
state in your driver.  (You're going to be faced with that problem with any 
solution, I think.)

> 
> Also, in the man page of ddi_copyout, I came across the below statement
> 
> This routine is designed for use in  driver  ioctl(9E)  rou-
>      tines for drivers that support layered ioctls.
> 
> 
> What does "layered ioctls" mean here? How can I know if the driver is 
> supporting layered ioctls or not?

layered ioctls refer to ioctls from one kernel driver or subsystem to another.  
In this case, there is a kernel context rather than user context.  It isn't 
relevant to what you're doing, but is for things like software raid subsystems 
that sit above physical disk drivers, etc.

Hopefully that helps.

        - Garrett

> 
> Thanks much in advance for the help!
> 
> - shriosu
> _______________________________________________
> driver-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/driver-discuss

_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to